Переглянути джерело

* Modified *killmonsterall to support a new argument that will allow it to kill monsters using the new OnMyMobDead behavior (in order to avoid breaking older scripts) (bugreport:1734)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12873 54d463be-8e91-2dee-dedb-b68131a5f0ec
sketchyphoenix 17 роки тому
батько
коміт
1cb87e882f
3 змінених файлів з 32 додано та 4 видалено
  1. 3 0
      Changelog-Trunk.txt
  2. 9 2
      doc/script_commands.txt
  3. 20 2
      src/map/script.c

+ 3 - 0
Changelog-Trunk.txt

@@ -5,6 +5,9 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2008/06/22
 	* Extended script command 'set' to return the variable reference (topic:190602). [FlavioJS]
+	* Fixed a bug where the "OnMyMobDead" event wouldn't trigger if the mob was killed and never attacked. (bugreport:1725) [SketchyPhoenix]
+	* Reworded a comment in can_copy to make more sense.
+	* Modified *killmonsterall to support a new argument that will allow it to kill monsters using the new OnMyMobDead behavior (in order to avoid breaking older scripts).
 2008/06/19
 	* Added Sirius_White's fix for sense working on emperium. (bugreport: 1679) [SketchyPhoenix]
 	* Fixed SC_CHANGEUNDEAD behavior: Blessing and Increase AGI deals 1 damage and does not apply buffs to those inflicted by it.

+ 9 - 2
doc/script_commands.txt

@@ -4623,10 +4623,17 @@ of the event label value.
 
 ---------------------------------------
 
-*killmonsterall "<map name>";
+*killmonsterall "<map name>"{,<type>};
 
 This command will kill all monsters on a specified map name, regardless of how 
-they were spawned or what they are.
+they were spawned or what they are. As of r12873, The behavior has changed slightly.
+In light of a label behavior fix for mob spawning commands that will now allow the label to 
+trigger when there is no player, killmonsterall has also been modified to support this.
+
+Using this the normal/old way means labels dont trigger when a player didn't
+attack/kill a monster. This is because it breaks compatability with older scripts if
+forced to use the new method. However, if you wish to use the new label type with this
+command, simply use 1 for type. Any other number won't be recognized.
 
 ---------------------------------------
 

+ 20 - 2
src/map/script.c

@@ -7500,6 +7500,17 @@ BUILDIN_FUNC(killmonster)
 	return 0;
 }
 
+static int buildin_killmonsterall_sub_strip(struct block_list *bl,va_list ap)
+{ //Strips the event from the mob if it's killed the old method.
+	struct mob_data *md;
+	
+	md = BL_CAST(BL_MOB, bl);
+	if (md->npc_event[0])
+		md->npc_event[0] = 0;
+		
+	status_kill(bl);
+	return 0;
+}
 static int buildin_killmonsterall_sub(struct block_list *bl,va_list ap)
 {
 	status_kill(bl);
@@ -7510,9 +7521,16 @@ BUILDIN_FUNC(killmonsterall)
 	const char *mapname;
 	int m;
 	mapname=script_getstr(st,2);
-
+	
 	if( (m=map_mapname2mapid(mapname))<0 )
 		return 0;
+	
+	if( script_hasdata(st,3) )
+		if ( script_getnum(st,3) == 1 ) {
+			map_foreachinmap(buildin_killmonsterall_sub_strip,m,BL_MOB);
+			return 0;
+		}
+		
 	map_foreachinmap(buildin_killmonsterall_sub,
 		m,BL_MOB);
 	return 0;
@@ -13438,7 +13456,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(monster,"siisii*"),
 	BUILDIN_DEF(areamonster,"siiiisii*"),
 	BUILDIN_DEF(killmonster,"ss"),
-	BUILDIN_DEF(killmonsterall,"s"),
+	BUILDIN_DEF(killmonsterall,"s?"),
 	BUILDIN_DEF(clone,"siisi*"),
 	BUILDIN_DEF(doevent,"s"),
 	BUILDIN_DEF(donpcevent,"s"),