ソースを参照

Added support for NPC/PC names in 'emotion' script command. (topic:249193)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14345 54d463be-8e91-2dee-dedb-b68131a5f0ec
Gepard 15 年 前
コミット
68f73aad02
3 ファイル変更20 行追加4 行削除
  1. 2 0
      Changelog-Trunk.txt
  2. 4 1
      doc/script_commands.txt
  3. 14 3
      src/map/script.c

+ 2 - 0
Changelog-Trunk.txt

@@ -3,6 +3,8 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 
+2010/06/18
+	* Added support for NPC/PC names in 'emotion' script command. [Gepard]
 2010/06/14
 2010/06/14
 	* Rev. 13442 Blocked being able to use the skill CR_DEVOTION on players under the status SC_HELLPOWER. [L0ne_W0lf]
 	* Rev. 13442 Blocked being able to use the skill CR_DEVOTION on players under the status SC_HELLPOWER. [L0ne_W0lf]
 	- Additionally, users afflicted by the status can also no longer use Token of Siegfried to self-res.
 	- Additionally, users afflicted by the status can also no longer use Token of Siegfried to self-res.

+ 4 - 1
doc/script_commands.txt

@@ -5992,7 +5992,7 @@ A full list of pet IDs can be found inside 'db/pet_db.txt'
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*emotion <emotion number>{, target};
+*emotion <emotion number>{,<target>}{,"<target name>"};
 
 
 This command makes an object display an emoticon sprite above their own as 
 This command makes an object display an emoticon sprite above their own as 
 if they were doing that emotion. For a full list of emotion numbers, 
 if they were doing that emotion. For a full list of emotion numbers, 
@@ -6003,6 +6003,9 @@ The optional target parameter specifies who will get the emotion on top of
 their head. If 0 (the default if omitted), the NPC in current use will show
 their head. If 0 (the default if omitted), the NPC in current use will show
 the emotion, if 1, the player that is running the script will display it.
 the emotion, if 1, the player that is running the script will display it.
 
 
+Target name parameter allows to display emotion on top of other NPC/PC without
+event labels. If specified name is not found, command does nothing.
+
 ---------------------------------------
 ---------------------------------------
 
 
 *misceffect <effect number>;
 *misceffect <effect number>;

+ 14 - 3
src/map/script.c

@@ -9419,7 +9419,7 @@ BUILDIN_FUNC(gvgoff)
 }
 }
 /*==========================================
 /*==========================================
  *	Shows an emoticon on top of the player/npc
  *	Shows an emoticon on top of the player/npc
- *	emotion emotion#, <target: 0 - NPC, 1 - PC>
+ *	emotion emotion#, <target: 0 - NPC, 1 - PC>, <NPC/PC name>
  *------------------------------------------*/
  *------------------------------------------*/
 //Optional second parameter added by [Skotlex]
 //Optional second parameter added by [Skotlex]
 BUILDIN_FUNC(emotion)
 BUILDIN_FUNC(emotion)
@@ -9435,11 +9435,22 @@ BUILDIN_FUNC(emotion)
 		player=script_getnum(st,3);
 		player=script_getnum(st,3);
 	
 	
 	if (player) {
 	if (player) {
-		TBL_PC *sd = script_rid2sd(st);
+		TBL_PC *sd = NULL;
+		if( script_hasdata(st,4) )
+			sd = map_nick2sd(script_getstr(st,4));
+		else
+			sd = script_rid2sd(st);
 		if (sd)
 		if (sd)
 			clif_emotion(&sd->bl,type);
 			clif_emotion(&sd->bl,type);
 	} else
 	} else
-		clif_emotion(map_id2bl(st->oid),type);
+		if( script_hasdata(st,4) )
+		{
+			TBL_NPC *nd = npc_name2id(script_getstr(st,4));
+			if(nd)
+				clif_emotion(&nd->bl,type);
+		}
+		else
+			clif_emotion(map_id2bl(st->oid),type);
 	return 0;
 	return 0;
 }
 }