summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsketchyphoenix <sketchyphoenix@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-06-22 14:22:08 +0000
committersketchyphoenix <sketchyphoenix@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-06-22 14:22:08 +0000
commit7f558fc3f0f09071d232660536e9e12c8a214404 (patch)
tree1ccf67bc654406431ad791058c40deebe752d5a9 /src
parent465fca8dbd6e4eac36d0207b3981c05daa34c715 (diff)
downloadhercules-7f558fc3f0f09071d232660536e9e12c8a214404.tar.gz
hercules-7f558fc3f0f09071d232660536e9e12c8a214404.tar.bz2
hercules-7f558fc3f0f09071d232660536e9e12c8a214404.tar.xz
hercules-7f558fc3f0f09071d232660536e9e12c8a214404.zip
Added support for killmonster to fire OnMyMobDead optionally.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12876 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/mob.c2
-rw-r--r--src/map/mob.h1
-rw-r--r--src/map/script.c30
3 files changed, 30 insertions, 3 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 9859de698..adc8d8c83 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2532,7 +2532,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if(md->nd)
mob_script_callback(md, src, CALLBACK_DEAD);
else
- if(md->npc_event[0])
+ if(md->npc_event[0] && !md->npc_killmonster)
{
md->status.hp = 0; //So that npc_event invoked functions KNOW that I am dead.
if(src)
diff --git a/src/map/mob.h b/src/map/mob.h
index cade69305..0a65e1c42 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -141,6 +141,7 @@ struct mob_data {
short skillidx;
unsigned int skilldelay[MAX_MOBSKILL];
char npc_event[50];
+ int npc_killmonster; //for new killmonster behavior
};
diff --git a/src/map/script.c b/src/map/script.c
index db2ab5a86..4eb2e6324 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7468,6 +7468,24 @@ BUILDIN_FUNC(areamonster)
/*==========================================
* モンスター削除
*------------------------------------------*/
+ static int buildin_killmonster_sub_strip(struct block_list *bl,va_list ap)
+{ //same fix but with killmonster instead - stripping events from mobs.
+ TBL_MOB* md = (TBL_MOB*)bl;
+ char *event=va_arg(ap,char *);
+ int allflag=va_arg(ap,int);
+
+ md->npc_killmonster = 1;
+
+ if(!allflag){
+ if(strcmp(event,md->npc_event)==0)
+ status_kill(bl);
+ }else{
+ if(!md->spawn)
+ status_kill(bl);
+ }
+ md->npc_killmonster = 0;
+ return 0;
+}
static int buildin_killmonster_sub(struct block_list *bl,va_list ap)
{
TBL_MOB* md = (TBL_MOB*)bl;
@@ -7496,7 +7514,15 @@ BUILDIN_FUNC(killmonster)
if( (m=map_mapname2mapid(mapname))<0 )
return 0;
- map_foreachinmap(buildin_killmonster_sub, m, BL_MOB, event ,allflag);
+
+ if( script_hasdata(st,4) ) {
+ if ( script_getnum(st,4) == 1 ) {
+ map_foreachinmap(buildin_killmonster_sub, m, BL_MOB, event ,allflag);
+ return 0;
+ }
+ }
+
+ map_foreachinmap(buildin_killmonster_sub_strip, m, BL_MOB, event ,allflag);
return 0;
}
@@ -13456,7 +13482,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(produce,"i"),
BUILDIN_DEF(monster,"siisii*"),
BUILDIN_DEF(areamonster,"siiiisii*"),
- BUILDIN_DEF(killmonster,"ss"),
+ BUILDIN_DEF(killmonster,"ss?"),
BUILDIN_DEF(killmonsterall,"s?"),
BUILDIN_DEF(clone,"siisi*"),
BUILDIN_DEF(doevent,"s"),