summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2020-02-09 21:18:26 +0100
committerGitHub <noreply@github.com>2020-02-09 21:18:26 +0100
commit481d92bfa0fac1320aebf0ab4f4ceb8365fa3ff3 (patch)
tree807314fa875ca53ab1508f347bcf5ad12e9f3348 /src/plugins
parent9e68350a054d5ec181a40528728d8de185a4f43c (diff)
parentd84aee4cd917fd1a151d7ec0b3a2d7e32df02441 (diff)
downloadhercules-481d92bfa0fac1320aebf0ab4f4ceb8365fa3ff3.tar.gz
hercules-481d92bfa0fac1320aebf0ab4f4ceb8365fa3ff3.tar.bz2
hercules-481d92bfa0fac1320aebf0ab4f4ceb8365fa3ff3.tar.xz
hercules-481d92bfa0fac1320aebf0ab4f4ceb8365fa3ff3.zip
Merge pull request #2590 from Kenpachi2k13/issue#2530
Change unload NPC behavior to kill mobs that were spawned by unloaded NPC (non-permanent monster spawns) [Issue #2530]
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc30
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc4
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc1
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc117
4 files changed, 96 insertions, 56 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 206934222..8c6f43433 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -5336,22 +5336,22 @@ typedef struct view_data* (*HPMHOOK_pre_mob_get_viewdata) (int *class_);
typedef struct view_data* (*HPMHOOK_post_mob_get_viewdata) (struct view_data* retVal___, int class_);
typedef int (*HPMHOOK_pre_mob_parse_dataset) (struct spawn_data **data);
typedef int (*HPMHOOK_post_mob_parse_dataset) (int retVal___, struct spawn_data *data);
-typedef struct mob_data* (*HPMHOOK_pre_mob_spawn_dataset) (struct spawn_data **data);
-typedef struct mob_data* (*HPMHOOK_post_mob_spawn_dataset) (struct mob_data* retVal___, struct spawn_data *data);
+typedef struct mob_data* (*HPMHOOK_pre_mob_spawn_dataset) (struct spawn_data **data, int *npc_id);
+typedef struct mob_data* (*HPMHOOK_post_mob_spawn_dataset) (struct mob_data* retVal___, struct spawn_data *data, int npc_id);
typedef int (*HPMHOOK_pre_mob_get_random_id) (int *type, int *flag, int *lv);
typedef int (*HPMHOOK_post_mob_get_random_id) (int retVal___, int type, int flag, int lv);
typedef bool (*HPMHOOK_pre_mob_ksprotected) (struct block_list **src, struct block_list **target);
typedef bool (*HPMHOOK_post_mob_ksprotected) (bool retVal___, struct block_list *src, struct block_list *target);
-typedef struct mob_data* (*HPMHOOK_pre_mob_once_spawn_sub) (struct block_list **bl, int16 *m, int16 *x, int16 *y, const char **mobname, int *class_, const char **event, unsigned int *size, unsigned int *ai);
-typedef struct mob_data* (*HPMHOOK_post_mob_once_spawn_sub) (struct mob_data* retVal___, struct block_list *bl, int16 m, int16 x, int16 y, const char *mobname, int class_, const char *event, unsigned int size, unsigned int ai);
+typedef struct mob_data* (*HPMHOOK_pre_mob_once_spawn_sub) (struct block_list **bl, int16 *m, int16 *x, int16 *y, const char **mobname, int *class_, const char **event, unsigned int *size, unsigned int *ai, int *npc_id);
+typedef struct mob_data* (*HPMHOOK_post_mob_once_spawn_sub) (struct mob_data* retVal___, struct block_list *bl, int16 m, int16 x, int16 y, const char *mobname, int class_, const char *event, unsigned int size, unsigned int ai, int npc_id);
typedef int (*HPMHOOK_pre_mob_once_spawn) (struct map_session_data **sd, int16 *m, int16 *x, int16 *y, const char **mobname, int *class_, int *amount, const char **event, unsigned int *size, unsigned int *ai);
typedef int (*HPMHOOK_post_mob_once_spawn) (int retVal___, struct map_session_data *sd, int16 m, int16 x, int16 y, const char *mobname, int class_, int amount, const char *event, unsigned int size, unsigned int ai);
typedef int (*HPMHOOK_pre_mob_once_spawn_area) (struct map_session_data **sd, int16 *m, int16 *x0, int16 *y0, int16 *x1, int16 *y1, const char **mobname, int *class_, int *amount, const char **event, unsigned int *size, unsigned int *ai);
typedef int (*HPMHOOK_post_mob_once_spawn_area) (int retVal___, struct map_session_data *sd, int16 m, int16 x0, int16 y0, int16 x1, int16 y1, const char *mobname, int class_, int amount, const char *event, unsigned int size, unsigned int ai);
-typedef int (*HPMHOOK_pre_mob_spawn_guardian) (const char **mapname, short *x, short *y, const char **mobname, int *class_, const char **event, int *guardian, bool *has_index);
-typedef int (*HPMHOOK_post_mob_spawn_guardian) (int retVal___, const char *mapname, short x, short y, const char *mobname, int class_, const char *event, int guardian, bool has_index);
-typedef int (*HPMHOOK_pre_mob_spawn_bg) (const char **mapname, short *x, short *y, const char **mobname, int *class_, const char **event, unsigned int *bg_id);
-typedef int (*HPMHOOK_post_mob_spawn_bg) (int retVal___, const char *mapname, short x, short y, const char *mobname, int class_, const char *event, unsigned int bg_id);
+typedef int (*HPMHOOK_pre_mob_spawn_guardian) (const char **mapname, short *x, short *y, const char **mobname, int *class_, const char **event, int *guardian, bool *has_index, int *npc_id);
+typedef int (*HPMHOOK_post_mob_spawn_guardian) (int retVal___, const char *mapname, short x, short y, const char *mobname, int class_, const char *event, int guardian, bool has_index, int npc_id);
+typedef int (*HPMHOOK_pre_mob_spawn_bg) (const char **mapname, short *x, short *y, const char **mobname, int *class_, const char **event, unsigned int *bg_id, int *npc_id);
+typedef int (*HPMHOOK_post_mob_spawn_bg) (int retVal___, const char *mapname, short x, short y, const char *mobname, int class_, const char *event, unsigned int bg_id, int npc_id);
typedef int (*HPMHOOK_pre_mob_can_reach) (struct mob_data **md, struct block_list **bl, int *range, int *state);
typedef int (*HPMHOOK_post_mob_can_reach) (int retVal___, struct mob_data *md, struct block_list *bl, int range, int state);
typedef int (*HPMHOOK_pre_mob_linksearch) (struct block_list **bl, va_list ap);
@@ -5686,10 +5686,12 @@ typedef int (*HPMHOOK_pre_npc_unload_ev_label) (union DBKey *key, struct DBData
typedef int (*HPMHOOK_post_npc_unload_ev_label) (int retVal___, union DBKey key, struct DBData *data, va_list ap);
typedef int (*HPMHOOK_pre_npc_unload_dup_sub) (struct npc_data **nd, va_list args);
typedef int (*HPMHOOK_post_npc_unload_dup_sub) (int retVal___, struct npc_data *nd, va_list args);
-typedef void (*HPMHOOK_pre_npc_unload_duplicates) (struct npc_data **nd);
-typedef void (*HPMHOOK_post_npc_unload_duplicates) (struct npc_data *nd);
-typedef int (*HPMHOOK_pre_npc_unload) (struct npc_data **nd, bool *single);
-typedef int (*HPMHOOK_post_npc_unload) (int retVal___, struct npc_data *nd, bool single);
+typedef void (*HPMHOOK_pre_npc_unload_duplicates) (struct npc_data **nd, bool *unload_mobs);
+typedef void (*HPMHOOK_post_npc_unload_duplicates) (struct npc_data *nd, bool unload_mobs);
+typedef int (*HPMHOOK_pre_npc_unload_mob) (struct mob_data **md, va_list args);
+typedef int (*HPMHOOK_post_npc_unload_mob) (int retVal___, struct mob_data *md, va_list args);
+typedef int (*HPMHOOK_pre_npc_unload) (struct npc_data **nd, bool *single, bool *unload_mobs);
+typedef int (*HPMHOOK_post_npc_unload) (int retVal___, struct npc_data *nd, bool single, bool unload_mobs;
typedef void (*HPMHOOK_pre_npc_clearsrcfile) (void);
typedef void (*HPMHOOK_post_npc_clearsrcfile) (void);
typedef void (*HPMHOOK_pre_npc_addsrcfile) (const char **name);
@@ -5772,8 +5774,8 @@ typedef int (*HPMHOOK_pre_npc_ev_label_db_clear_sub) (union DBKey *key, struct D
typedef int (*HPMHOOK_post_npc_ev_label_db_clear_sub) (int retVal___, union DBKey key, struct DBData *data, va_list args);
typedef int (*HPMHOOK_pre_npc_reload) (void);
typedef int (*HPMHOOK_post_npc_reload) (int retVal___);
-typedef bool (*HPMHOOK_pre_npc_unloadfile) (const char **filepath);
-typedef bool (*HPMHOOK_post_npc_unloadfile) (bool retVal___, const char *filepath);
+typedef bool (*HPMHOOK_pre_npc_unloadfile) (const char **filepath, bool *unload_mobs);
+typedef bool (*HPMHOOK_post_npc_unloadfile) (bool retVal___, const char *filepath, bool unload_mobs);
typedef void (*HPMHOOK_pre_npc_do_clear_npc) (void);
typedef void (*HPMHOOK_post_npc_do_clear_npc) (void);
typedef void (*HPMHOOK_pre_npc_debug_warps_sub) (struct npc_data **nd);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index d70ee0024..53ba3403c 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -4280,6 +4280,8 @@ struct {
struct HPMHookPoint *HP_npc_unload_dup_sub_post;
struct HPMHookPoint *HP_npc_unload_duplicates_pre;
struct HPMHookPoint *HP_npc_unload_duplicates_post;
+ struct HPMHookPoint *HP_npc_unload_mob_pre;
+ struct HPMHookPoint *HP_npc_unload_mob_post;
struct HPMHookPoint *HP_npc_unload_pre;
struct HPMHookPoint *HP_npc_unload_post;
struct HPMHookPoint *HP_npc_clearsrcfile_pre;
@@ -11145,6 +11147,8 @@ struct {
int HP_npc_unload_dup_sub_post;
int HP_npc_unload_duplicates_pre;
int HP_npc_unload_duplicates_post;
+ int HP_npc_unload_mob_pre;
+ int HP_npc_unload_mob_post;
int HP_npc_unload_pre;
int HP_npc_unload_post;
int HP_npc_clearsrcfile_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index c755e0bec..0904a1dac 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2192,6 +2192,7 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(npc->unload_ev_label, HP_npc_unload_ev_label) },
{ HP_POP(npc->unload_dup_sub, HP_npc_unload_dup_sub) },
{ HP_POP(npc->unload_duplicates, HP_npc_unload_duplicates) },
+ { HP_POP(npc->unload_mob, HP_npc_unload_mob) },
{ HP_POP(npc->unload, HP_npc_unload) },
{ HP_POP(npc->clearsrcfile, HP_npc_clearsrcfile) },
{ HP_POP(npc->addsrcfile, HP_npc_addsrcfile) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index d0ddcf28a..319e675a8 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -52053,15 +52053,15 @@ int HP_mob_parse_dataset(struct spawn_data *data) {
}
return retVal___;
}
-struct mob_data* HP_mob_spawn_dataset(struct spawn_data *data) {
+struct mob_data* HP_mob_spawn_dataset(struct spawn_data *data, int npc_id) {
int hIndex = 0;
struct mob_data* retVal___ = NULL;
if (HPMHooks.count.HP_mob_spawn_dataset_pre > 0) {
- struct mob_data* (*preHookFunc) (struct spawn_data **data);
+ struct mob_data* (*preHookFunc) (struct spawn_data **data, int *npc_id);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_spawn_dataset_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_mob_spawn_dataset_pre[hIndex].func;
- retVal___ = preHookFunc(&data);
+ retVal___ = preHookFunc(&data, &npc_id);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -52069,13 +52069,13 @@ struct mob_data* HP_mob_spawn_dataset(struct spawn_data *data) {
}
}
{
- retVal___ = HPMHooks.source.mob.spawn_dataset(data);
+ retVal___ = HPMHooks.source.mob.spawn_dataset(data, npc_id);
}
if (HPMHooks.count.HP_mob_spawn_dataset_post > 0) {
- struct mob_data* (*postHookFunc) (struct mob_data* retVal___, struct spawn_data *data);
+ struct mob_data* (*postHookFunc) (struct mob_data* retVal___, struct spawn_data *data, int npc_id);
for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_spawn_dataset_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_mob_spawn_dataset_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, data);
+ retVal___ = postHookFunc(retVal___, data, npc_id);
}
}
return retVal___;
@@ -52134,15 +52134,15 @@ bool HP_mob_ksprotected(struct block_list *src, struct block_list *target) {
}
return retVal___;
}
-struct mob_data* HP_mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int16 y, const char *mobname, int class_, const char *event, unsigned int size, unsigned int ai) {
+struct mob_data* HP_mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int16 y, const char *mobname, int class_, const char *event, unsigned int size, unsigned int ai, int npc_id) {
int hIndex = 0;
struct mob_data* retVal___ = NULL;
if (HPMHooks.count.HP_mob_once_spawn_sub_pre > 0) {
- struct mob_data* (*preHookFunc) (struct block_list **bl, int16 *m, int16 *x, int16 *y, const char **mobname, int *class_, const char **event, unsigned int *size, unsigned int *ai);
+ struct mob_data* (*preHookFunc) (struct block_list **bl, int16 *m, int16 *x, int16 *y, const char **mobname, int *class_, const char **event, unsigned int *size, unsigned int *ai, int *npc_id);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_once_spawn_sub_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_mob_once_spawn_sub_pre[hIndex].func;
- retVal___ = preHookFunc(&bl, &m, &x, &y, &mobname, &class_, &event, &size, &ai);
+ retVal___ = preHookFunc(&bl, &m, &x, &y, &mobname, &class_, &event, &size, &ai, &npc_id);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -52150,13 +52150,13 @@ struct mob_data* HP_mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x,
}
}
{
- retVal___ = HPMHooks.source.mob.once_spawn_sub(bl, m, x, y, mobname, class_, event, size, ai);
+ retVal___ = HPMHooks.source.mob.once_spawn_sub(bl, m, x, y, mobname, class_, event, size, ai, npc_id);
}
if (HPMHooks.count.HP_mob_once_spawn_sub_post > 0) {
- struct mob_data* (*postHookFunc) (struct mob_data* retVal___, struct block_list *bl, int16 m, int16 x, int16 y, const char *mobname, int class_, const char *event, unsigned int size, unsigned int ai);
+ struct mob_data* (*postHookFunc) (struct mob_data* retVal___, struct block_list *bl, int16 m, int16 x, int16 y, const char *mobname, int class_, const char *event, unsigned int size, unsigned int ai, int npc_id);
for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_once_spawn_sub_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_mob_once_spawn_sub_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, bl, m, x, y, mobname, class_, event, size, ai);
+ retVal___ = postHookFunc(retVal___, bl, m, x, y, mobname, class_, event, size, ai, npc_id);
}
}
return retVal___;
@@ -52215,15 +52215,15 @@ int HP_mob_once_spawn_area(struct map_session_data *sd, int16 m, int16 x0, int16
}
return retVal___;
}
-int HP_mob_spawn_guardian(const char *mapname, short x, short y, const char *mobname, int class_, const char *event, int guardian, bool has_index) {
+int HP_mob_spawn_guardian(const char *mapname, short x, short y, const char *mobname, int class_, const char *event, int guardian, bool has_index, int npc_id) {
int hIndex = 0;
int retVal___ = 0;
if (HPMHooks.count.HP_mob_spawn_guardian_pre > 0) {
- int (*preHookFunc) (const char **mapname, short *x, short *y, const char **mobname, int *class_, const char **event, int *guardian, bool *has_index);
+ int (*preHookFunc) (const char **mapname, short *x, short *y, const char **mobname, int *class_, const char **event, int *guardian, bool *has_index, int *npc_id);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_spawn_guardian_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_mob_spawn_guardian_pre[hIndex].func;
- retVal___ = preHookFunc(&mapname, &x, &y, &mobname, &class_, &event, &guardian, &has_index);
+ retVal___ = preHookFunc(&mapname, &x, &y, &mobname, &class_, &event, &guardian, &has_index, &npc_id);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -52231,26 +52231,26 @@ int HP_mob_spawn_guardian(const char *mapname, short x, short y, const char *mob
}
}
{
- retVal___ = HPMHooks.source.mob.spawn_guardian(mapname, x, y, mobname, class_, event, guardian, has_index);
+ retVal___ = HPMHooks.source.mob.spawn_guardian(mapname, x, y, mobname, class_, event, guardian, has_index, npc_id);
}
if (HPMHooks.count.HP_mob_spawn_guardian_post > 0) {
- int (*postHookFunc) (int retVal___, const char *mapname, short x, short y, const char *mobname, int class_, const char *event, int guardian, bool has_index);
+ int (*postHookFunc) (int retVal___, const char *mapname, short x, short y, const char *mobname, int class_, const char *event, int guardian, bool has_index, int npc_id);
for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_spawn_guardian_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_mob_spawn_guardian_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, mapname, x, y, mobname, class_, event, guardian, has_index);
+ retVal___ = postHookFunc(retVal___, mapname, x, y, mobname, class_, event, guardian, has_index, npc_id);
}
}
return retVal___;
}
-int HP_mob_spawn_bg(const char *mapname, short x, short y, const char *mobname, int class_, const char *event, unsigned int bg_id) {
+int HP_mob_spawn_bg(const char *mapname, short x, short y, const char *mobname, int class_, const char *event, unsigned int bg_id, int npc_id) {
int hIndex = 0;
int retVal___ = 0;
if (HPMHooks.count.HP_mob_spawn_bg_pre > 0) {
- int (*preHookFunc) (const char **mapname, short *x, short *y, const char **mobname, int *class_, const char **event, unsigned int *bg_id);
+ int (*preHookFunc) (const char **mapname, short *x, short *y, const char **mobname, int *class_, const char **event, unsigned int *bg_id, int *npc_id);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_spawn_bg_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_mob_spawn_bg_pre[hIndex].func;
- retVal___ = preHookFunc(&mapname, &x, &y, &mobname, &class_, &event, &bg_id);
+ retVal___ = preHookFunc(&mapname, &x, &y, &mobname, &class_, &event, &bg_id, &npc_id);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -52258,13 +52258,13 @@ int HP_mob_spawn_bg(const char *mapname, short x, short y, const char *mobname,
}
}
{
- retVal___ = HPMHooks.source.mob.spawn_bg(mapname, x, y, mobname, class_, event, bg_id);
+ retVal___ = HPMHooks.source.mob.spawn_bg(mapname, x, y, mobname, class_, event, bg_id, npc_id);
}
if (HPMHooks.count.HP_mob_spawn_bg_post > 0) {
- int (*postHookFunc) (int retVal___, const char *mapname, short x, short y, const char *mobname, int class_, const char *event, unsigned int bg_id);
+ int (*postHookFunc) (int retVal___, const char *mapname, short x, short y, const char *mobname, int class_, const char *event, unsigned int bg_id, int npc_id);
for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_spawn_bg_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_mob_spawn_bg_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, mapname, x, y, mobname, class_, event, bg_id);
+ retVal___ = postHookFunc(retVal___, mapname, x, y, mobname, class_, event, bg_id, npc_id);
}
}
return retVal___;
@@ -56811,14 +56811,14 @@ int HP_npc_unload_dup_sub(struct npc_data *nd, va_list args) {
}
return retVal___;
}
-void HP_npc_unload_duplicates(struct npc_data *nd) {
+void HP_npc_unload_duplicates(struct npc_data *nd, bool unload_mobs) {
int hIndex = 0;
if (HPMHooks.count.HP_npc_unload_duplicates_pre > 0) {
- void (*preHookFunc) (struct npc_data **nd);
+ void (*preHookFunc) (struct npc_data **nd, bool *unload_mobs);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_unload_duplicates_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_npc_unload_duplicates_pre[hIndex].func;
- preHookFunc(&nd);
+ preHookFunc(&nd, &unload_mobs);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -56826,26 +56826,59 @@ void HP_npc_unload_duplicates(struct npc_data *nd) {
}
}
{
- HPMHooks.source.npc.unload_duplicates(nd);
+ HPMHooks.source.npc.unload_duplicates(nd, unload_mobs);
}
if (HPMHooks.count.HP_npc_unload_duplicates_post > 0) {
- void (*postHookFunc) (struct npc_data *nd);
+ void (*postHookFunc) (struct npc_data *nd, bool unload_mobs);
for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_unload_duplicates_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_npc_unload_duplicates_post[hIndex].func;
- postHookFunc(nd);
+ postHookFunc(nd, unload_mobs);
}
}
return;
}
-int HP_npc_unload(struct npc_data *nd, bool single) {
+int HP_npc_unload_mob(struct mob_data *md, va_list args) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if (HPMHooks.count.HP_npc_unload_mob_pre > 0) {
+ int (*preHookFunc) (struct mob_data **md, va_list args);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_unload_mob_pre; hIndex++) {
+ va_list args___copy; va_copy(args___copy, args);
+ preHookFunc = HPMHooks.list.HP_npc_unload_mob_pre[hIndex].func;
+ retVal___ = preHookFunc(&md, args___copy);
+ va_end(args___copy);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ va_list args___copy; va_copy(args___copy, args);
+ retVal___ = HPMHooks.source.npc.unload_mob(md, args___copy);
+ va_end(args___copy);
+ }
+ if (HPMHooks.count.HP_npc_unload_mob_post > 0) {
+ int (*postHookFunc) (int retVal___, struct mob_data *md, va_list args);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_unload_mob_post; hIndex++) {
+ va_list args___copy; va_copy(args___copy, args);
+ postHookFunc = HPMHooks.list.HP_npc_unload_mob_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, md, args___copy);
+ va_end(args___copy);
+ }
+ }
+ return retVal___;
+}
+int HP_npc_unload(struct npc_data *nd, bool single, bool unload_mobs) {
int hIndex = 0;
int retVal___ = 0;
if (HPMHooks.count.HP_npc_unload_pre > 0) {
- int (*preHookFunc) (struct npc_data **nd, bool *single);
+ int (*preHookFunc) (struct npc_data **nd, bool *single, bool *unload_mobs);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_unload_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_npc_unload_pre[hIndex].func;
- retVal___ = preHookFunc(&nd, &single);
+ retVal___ = preHookFunc(&nd, &single, &unload_mobs);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -56853,13 +56886,13 @@ int HP_npc_unload(struct npc_data *nd, bool single) {
}
}
{
- retVal___ = HPMHooks.source.npc.unload(nd, single);
+ retVal___ = HPMHooks.source.npc.unload(nd, single, unload_mobs);
}
if (HPMHooks.count.HP_npc_unload_post > 0) {
- int (*postHookFunc) (int retVal___, struct npc_data *nd, bool single);
+ int (*postHookFunc) (int retVal___, struct npc_data *nd, bool single, bool unload_mobs);
for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_unload_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_npc_unload_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, nd, single);
+ retVal___ = postHookFunc(retVal___, nd, single, unload_mobs);
}
}
return retVal___;
@@ -57974,15 +58007,15 @@ int HP_npc_reload(void) {
}
return retVal___;
}
-bool HP_npc_unloadfile(const char *filepath) {
+bool HP_npc_unloadfile(const char *filepath, bool unload_mobs) {
int hIndex = 0;
bool retVal___ = false;
if (HPMHooks.count.HP_npc_unloadfile_pre > 0) {
- bool (*preHookFunc) (const char **filepath);
+ bool (*preHookFunc) (const char **filepath, bool *unload_mobs);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_unloadfile_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_npc_unloadfile_pre[hIndex].func;
- retVal___ = preHookFunc(&filepath);
+ retVal___ = preHookFunc(&filepath, &unload_mobs);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -57990,13 +58023,13 @@ bool HP_npc_unloadfile(const char *filepath) {
}
}
{
- retVal___ = HPMHooks.source.npc.unloadfile(filepath);
+ retVal___ = HPMHooks.source.npc.unloadfile(filepath, unload_mobs);
}
if (HPMHooks.count.HP_npc_unloadfile_post > 0) {
- bool (*postHookFunc) (bool retVal___, const char *filepath);
+ bool (*postHookFunc) (bool retVal___, const char *filepath, bool unload_mobs);
for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_unloadfile_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_npc_unloadfile_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, filepath);
+ retVal___ = postHookFunc(retVal___, filepath, unload_mobs);
}
}
return retVal___;