Browse Source

* [Improved]:
- mob_dead not to remove script controlled monsters with player sprites. (can be removed later using removemob command, it can be resurrected too :D)
* [Added]:
- buildin_mobdeadsit :D

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7024 54d463be-8e91-2dee-dedb-b68131a5f0ec

Lance 19 năm trước cách đây
mục cha
commit
dc71d18c29
3 tập tin đã thay đổi với 32 bổ sung3 xóa
  1. 4 0
      Changelog-Trunk.txt
  2. 7 3
      src/map/mob.c
  3. 21 0
      src/map/script.c

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/06/07
+	* [Improved]:
+	  - mob_dead not to remove script controlled monsters with player sprites.
+	  [Added]:
+	  - buildin_mobdeadsit :D [Lance]
 	* [Fixed]:
 	  - temp++ gets issued before if(mvp_damage<(unsigned int)md->dmglog[i].dmg) in
 	    mob_damage. Thanks to seahorsix. [Lance]

+ 7 - 3
src/map/mob.c

@@ -2125,16 +2125,20 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 		delete_timer(md->deletetimer,mob_timer_delete);
 		md->deletetimer=-1;
 	}
-	if(pcdb_checkid(md->vd->class_)) //Player mobs are not removed automatically by the client.
-		clif_clearchar_delay(tick+3000,&md->bl,0);
 
 	mob_deleteslave(md);
 	md->last_deadtime=tick;
 	
 	map_freeblock_unlock();
 
+	if(pcdb_checkid(md->vd->class_)) //Player mobs are not removed automatically by the client.
+		if(md->nd)
+			return 1; // Let the dead body stay there.. we have something to do with it :D
+		else
+			clif_clearchar_delay(tick+3000,&md->bl,0);
+
 	if(!md->spawn) //Tell status_damage to remove it from memory.
-		return 5;
+		return 5; // Note: Actually, it's 4. Oh well...
 	
 	mob_setdelayspawn(md); //Set respawning.
 	return 3; //Remove from map.

+ 21 - 0
src/map/script.c

@@ -430,6 +430,7 @@ int buildin_mobstop(struct script_state *st);
 int buildin_mobassist(struct script_state *st);
 int buildin_mobtalk(struct script_state *st);
 int buildin_mobemote(struct script_state *st);
+int buildin_mobdeadsit(struct script_state *st);
 int buildin_mobattach(struct script_state *st);
 // <--- [zBuffer] List of mob control commands
 int buildin_sleep(struct script_state *st);
@@ -770,6 +771,7 @@ struct {
 	{buildin_mobassist,"mobassist","i*"},
 	{buildin_mobtalk,"mobtalk","is"},
 	{buildin_mobemote,"mobemote","ii"},
+	{buildin_mobdeadsit,"mobdeadsit","ii"},
 	{buildin_mobattach,"mobattach","i*"},
 // <--- [zBuffer] List of mob control commands
 {buildin_sleep,"sleep","i"},
@@ -10762,6 +10764,25 @@ int buildin_mobemote(struct script_state *st) {
 	return 0;
 }
 
+int buildin_mobdeadsit(struct script_state *st){
+	int id, action;
+	struct mob_data *md = NULL;
+	id = conv_num(st, & (st->stack->stack_data[st->start+2]));
+	action = conv_num(st, & (st->stack->stack_data[st->start+3]));
+	if((md = (struct mob_data *)map_id2bl(id)) && md->bl.type == BL_MOB){
+		if(action > -1 && action < 3){
+			md->vd->dead_sit = action;
+		} else {
+			ShowError("buildin_mobdeadsit: Unrecognized action.\n");
+			report_src(st);
+		}
+	} else {
+		ShowError("buildin_mobdeadsit: Target is not a monster.\n");
+		report_src(st);
+	}
+	return 0;
+}
+
 int buildin_mobattach(struct script_state *st){
 	int id;
 	struct mob_data *md = NULL;