From b147ab584f2e92994252073f849a83e0fc74cf81 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Sun, 5 Apr 2020 23:12:30 +0200 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/plugins/HPMHooking/HPMHooking.Defs.inc | 2 ++ .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 4 ++++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 26 ++++++++++++++++++++++ 4 files changed, 33 insertions(+) (limited to 'src/plugins/HPMHooking') diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 3beaa33d3..b8aa5ae61 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -6500,6 +6500,8 @@ typedef int (*HPMHOOK_pre_pet_final) (void); typedef int (*HPMHOOK_post_pet_final) (int retVal___); typedef int (*HPMHOOK_pre_pet_hungry_val) (struct pet_data **pd); typedef int (*HPMHOOK_post_pet_hungry_val) (int retVal___, struct pet_data *pd); +typedef void (*HPMHOOK_pre_pet_set_hunger) (struct pet_data **pd, int *value); +typedef void (*HPMHOOK_post_pet_set_hunger) (struct pet_data *pd, int value); typedef void (*HPMHOOK_pre_pet_set_intimate) (struct pet_data **pd, int *value); typedef void (*HPMHOOK_post_pet_set_intimate) (struct pet_data *pd, int value); typedef int (*HPMHOOK_pre_pet_create_egg) (struct map_session_data **sd, int *item_id); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 8bf628a53..109c30885 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -5076,6 +5076,8 @@ struct { struct HPMHookPoint *HP_pet_final_post; struct HPMHookPoint *HP_pet_hungry_val_pre; struct HPMHookPoint *HP_pet_hungry_val_post; + struct HPMHookPoint *HP_pet_set_hunger_pre; + struct HPMHookPoint *HP_pet_set_hunger_post; struct HPMHookPoint *HP_pet_set_intimate_pre; struct HPMHookPoint *HP_pet_set_intimate_post; struct HPMHookPoint *HP_pet_create_egg_pre; @@ -11955,6 +11957,8 @@ struct { int HP_pet_final_post; int HP_pet_hungry_val_pre; int HP_pet_hungry_val_post; + int HP_pet_set_hunger_pre; + int HP_pet_set_hunger_post; int HP_pet_set_intimate_pre; int HP_pet_set_intimate_post; int HP_pet_create_egg_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 1ba2358ef..ac30b97d4 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2598,6 +2598,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pet->init, HP_pet_init) }, { HP_POP(pet->final, HP_pet_final) }, { HP_POP(pet->hungry_val, HP_pet_hungry_val) }, + { HP_POP(pet->set_hunger, HP_pet_set_hunger) }, { HP_POP(pet->set_intimate, HP_pet_set_intimate) }, { HP_POP(pet->create_egg, HP_pet_create_egg) }, { HP_POP(pet->unlocktarget, HP_pet_unlocktarget) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index c319a283d..940f96ca2 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -67561,6 +67561,32 @@ int HP_pet_hungry_val(struct pet_data *pd) { } return retVal___; } +void HP_pet_set_hunger(struct pet_data *pd, int value) { + int hIndex = 0; + if (HPMHooks.count.HP_pet_set_hunger_pre > 0) { + void (*preHookFunc) (struct pet_data **pd, int *value); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pet_set_hunger_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pet_set_hunger_pre[hIndex].func; + preHookFunc(&pd, &value); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pet.set_hunger(pd, value); + } + if (HPMHooks.count.HP_pet_set_hunger_post > 0) { + void (*postHookFunc) (struct pet_data *pd, int value); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pet_set_hunger_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pet_set_hunger_post[hIndex].func; + postHookFunc(pd, value); + } + } + return; +} void HP_pet_set_intimate(struct pet_data *pd, int value) { int hIndex = 0; if (HPMHooks.count.HP_pet_set_intimate_pre > 0) { -- cgit v1.2.3-70-g09d2