From c7a03f4a20ae7a39277417ee566211f7dd94130a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 15 Feb 2015 23:48:51 +0300 Subject: map: add attribute for mobs for stand slaves alive after muster was dead New mob attribute: 0x8000 --- src/map/init.c | 2 ++ src/map/mob.c | 41 +++++++++++++++++++++++++++++++++++++++++ src/map/mob.h | 9 +++++++++ 3 files changed, 52 insertions(+) create mode 100644 src/map/mob.c create mode 100644 src/map/mob.h (limited to 'src/map') 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 +#include +#include + +#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 -- cgit v1.2.3-70-g09d2