diff options
author | LuzZza <LuzZza@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-14 20:28:10 +0000 |
---|---|---|
committer | LuzZza <LuzZza@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-14 20:28:10 +0000 |
commit | 94b5924852ac0c230317cecc0970cf652bae62f3 (patch) | |
tree | 7ecf31733d8b461e451f1992788fe9799f4d70b5 /src | |
parent | aa3e91a992eafac75f3eafd250bcebcf72b354e0 (diff) | |
download | hercules-94b5924852ac0c230317cecc0970cf652bae62f3.tar.gz hercules-94b5924852ac0c230317cecc0970cf652bae62f3.tar.bz2 hercules-94b5924852ac0c230317cecc0970cf652bae62f3.tar.xz hercules-94b5924852ac0c230317cecc0970cf652bae62f3.zip |
- 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
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 45 | ||||
-rw-r--r-- | src/map/atcommand.h | 1 |
2 files changed, 42 insertions, 4 deletions
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 <mapname> <x> <y>).");
- 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 <mapname> <x> <y>).");
+ 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 <NPC_name>).");
+ 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,
|