From 94b5924852ac0c230317cecc0970cf652bae62f3 Mon Sep 17 00:00:00 2001 From: LuzZza Date: Tue, 14 Mar 2006 20:28:10 +0000 Subject: - Updated @rura/@warp. Now you can use both "@warp mapname x y" and "@warp mapname,x,y". - Added command @tonpc (warp to NPC). - Fixed @where at-command. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5602 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 4 ++++ src/map/atcommand.c | 45 +++++++++++++++++++++++++++++++++++++++++---- src/map/atcommand.h | 1 + 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 81a25f229..1803b22ab 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,10 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS 2006/03/14 + * Updated @rura/@warp. Now you can use both "@warp mapname x y" and + "@warp mapname,x,y". [LuzZza] + * Added at-command @tonpc (warp to NPC). [LuzZza] + * Fixed @where at-command. [LuzZza] * Fixed WZ_WATERBALL + HW_MAGICPOWER [Skotlex] * Fixed incorrect range check in autospell-when-hit triggers. [Skotlex] * Modified Wedding recall skills to behave as in official [Skotlex] diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 44f689c2d..4f69ef2bc 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -290,6 +290,7 @@ ACMD_FUNC(away); // LuzZza ACMD_FUNC(main); // LuzZza ACMD_FUNC(clone); // [Valaris] +ACMD_FUNC(tonpc); // LuzZza /*========================================== *AtCommandInfo atcommand_info[]構造体の定義 @@ -603,6 +604,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_Clone, "@clone", 50, atcommand_clone }, { AtCommand_Clone, "@slaveclone", 50, atcommand_clone }, { AtCommand_Clone, "@evilclone", 50, atcommand_clone }, // [Valaris] + { AtCommand_ToNPC, "@tonpc", 40, atcommand_tonpc }, // LuzZza // add new commands before this line { AtCommand_Unknown, NULL, 1, NULL } @@ -1224,9 +1226,12 @@ int atcommand_rura( memset(map_name, '\0', sizeof(map_name)); - if (!message || !*message || sscanf(message, "%15s %d %d", map_name, &x, &y) < 1) { - clif_displaymessage(fd, "Please, enter a map (usage: @warp/@rura/@mapmove )."); - return -1; + if (!message || !*message || + (sscanf(message, "%15s %d %d", map_name, &x, &y) < 3 && + sscanf(message, "%15[^,],%d,%d", map_name, &x, &y) < 1)) { + + clif_displaymessage(fd, "Please, enter a map (usage: @warp/@rura/@mapmove )."); + return -1; } if (x <= 0) @@ -1292,7 +1297,7 @@ int atcommand_where( if (pl_sd == NULL) return -1; - if(strncmp(sd->status.name,atcmd_player_name,NAME_LENGTH)==0) + if(strncmp(sd->status.name,atcmd_player_name,NAME_LENGTH)!=0) return -1; GM_level = pc_isGM(sd);//also hide gms depending on settings in battle_athena.conf, show if they are aid [Kevin] @@ -5982,6 +5987,38 @@ int atcommand_nuke( return 0; } +/*========================================== + * @tonpc + *------------------------------------------ + */ +int atcommand_tonpc(const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + + char npcname[NAME_LENGTH]; + struct npc_data *nd; + + nullpo_retr(-1, sd); + + memset(npcname, 0, sizeof(npcname)); + + if (!message || !*message || sscanf(message, "%23[^\n]", npcname) < 1) { + clif_displaymessage(fd, "Please, enter a NPC name (usage: @tonpc )."); + return -1; + } + + if ((nd = npc_name2id(npcname)) != NULL) { + if (pc_setpos(sd, map[nd->bl.m].index, nd->bl.x, nd->bl.y, 3) == 0) + clif_displaymessage(fd, msg_table[0]); // Warped. + else + return -1; + } else { + clif_displaymessage(fd, msg_table[111]); // This NPC doesn't exist. + return -1; + } + + return 0; +} /*========================================== * diff --git a/src/map/atcommand.h b/src/map/atcommand.h index cd90468aa..08df26523 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -267,6 +267,7 @@ enum AtCommandType { AtCommand_Main, // LuzZza AtCommand_Clone, // [Valaris] + AtCommand_ToNPC, // LuzZza // end <- Ahem, guys, don't place AtCommands after AtCommand_Unknown! [Skotlex] AtCommand_Unknown, -- cgit v1.2.3-70-g09d2