浏览代码

- 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://svn.code.sf.net/p/rathena/svn/trunk@5602 54d463be-8e91-2dee-dedb-b68131a5f0ec

LuzZza 19 年之前
父节点
当前提交
40753b24b1
共有 3 个文件被更改,包括 46 次插入4 次删除
  1. 4 0
      Changelog-Trunk.txt
  2. 41 4
      src/map/atcommand.c
  3. 1 0
      src/map/atcommand.h

+ 4 - 0
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 <NPC_name> (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]

+ 41 - 4
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;
+}
 
 /*==========================================
  *

+ 1 - 0
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,