diff options
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/map/init.c | 2 | ||||
-rw-r--r-- | src/map/mob.c | 41 | ||||
-rw-r--r-- | src/map/mob.h | 9 |
4 files changed, 54 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 07bffc3..61dc883 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,6 +35,8 @@ MAP_SRC = map/clif.c \ map/lang.h \ map/map.c \ map/map.h \ + map/mob.c \ + map/mob.h \ map/npc.c \ map/npc.h \ map/parse.c \ diff --git a/src/map/init.c b/src/map/init.c index d7ba9f2..60d8540 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -40,6 +40,7 @@ #include "map/itemdb.h" #include "map/lang.h" #include "map/map.h" +#include "map/mob.h" #include "map/npc.h" #include "map/unit.h" #include "map/parse.h" @@ -113,6 +114,7 @@ HPExport void plugin_init (void) addHookPre("pc->can_attack", epc_can_attack); addHookPre("pc->takeitem", epc_takeitem); addHookPre("pc->validate_levels", epc_validate_levels); + addHookPre("mob->deleteslave_sub", emob_deleteslave_sub); addHookPre("npc->parse_unknown_mapflag", enpc_parse_unknown_mapflag); addHookPre("npc->buysellsel", enpc_buysellsel); addHookPre("npc->db_checkid", enpc_db_checkid); diff --git a/src/map/mob.c b/src/map/mob.c new file mode 100644 index 0000000..bd0f7f1 --- /dev/null +++ b/src/map/mob.c @@ -0,0 +1,41 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "../../../common/HPMi.h" +#include "../../../common/malloc.h" +#include "../../../common/mmo.h" +#include "../../../common/socket.h" +#include "../../../common/strlib.h" +#include "../../../common/timer.h" +#include "../../../map/battle.h" +#include "../../../map/itemdb.h" +#include "../../../map/mob.h" + +int emob_deleteslave_sub(struct block_list *bl, va_list ap) +{ + if (!bl) + return 0; + struct mob_data *md = (struct mob_data *)bl; + if (!md) + return 0; + + const int id = va_arg(ap, int); + if (md->master_id > 0 && md->master_id == id) + { + if (md->db->status.mode & 0x8000) + { + md->master_id = 0; + md->master_dist = 0; + } + else + { + status_kill(bl); + } + } + + return 0; +} diff --git a/src/map/mob.h b/src/map/mob.h new file mode 100644 index 0000000..d0d9e87 --- /dev/null +++ b/src/map/mob.h @@ -0,0 +1,9 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#ifndef EVOL_MAP_MOB +#define EVOL_MAP_MOB + +int emob_deleteslave_sub(struct block_list *bl, va_list ap); + +#endif // EVOL_MAP_MOB |