Skip to content

Commit

Permalink
Update HPM hooks
Browse files Browse the repository at this point in the history
Signed-off-by: hwsapibot <[email protected]>
  • Loading branch information
HerculesWSAPI committed Jun 2, 2022
1 parent 981cff1 commit 89620fe
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/plugins/HPMHooking/HPMHooking.Defs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6080,6 +6080,10 @@ typedef int (*HPMHOOK_pre_npc_secure_timeout_timer) (int *tid, int64 *tick, int
typedef int (*HPMHOOK_post_npc_secure_timeout_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data);
typedef void (*HPMHOOK_pre_npc_process_files) (int *npc_min);
typedef void (*HPMHOOK_post_npc_process_files) (int npc_min);
typedef int (*HPMHOOK_pre_npc_dynamic_npc_despawn) (int *tid, int64 *tick, int *id, intptr_t *data);
typedef int (*HPMHOOK_post_npc_dynamic_npc_despawn) (int retVal___, int tid, int64 tick, int id, intptr_t data);
typedef void (*HPMHOOK_pre_npc_update_interaction_tick) (struct npc_data **nd);
typedef void (*HPMHOOK_post_npc_update_interaction_tick) (struct npc_data *nd);
#endif // MAP_NPC_H
#ifdef COMMON_NULLPO_H /* nullpo */
typedef void (*HPMHOOK_pre_nullpo_init) (void);
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4664,6 +4664,10 @@ struct {
struct HPMHookPoint *HP_npc_secure_timeout_timer_post;
struct HPMHookPoint *HP_npc_process_files_pre;
struct HPMHookPoint *HP_npc_process_files_post;
struct HPMHookPoint *HP_npc_dynamic_npc_despawn_pre;
struct HPMHookPoint *HP_npc_dynamic_npc_despawn_post;
struct HPMHookPoint *HP_npc_update_interaction_tick_pre;
struct HPMHookPoint *HP_npc_update_interaction_tick_post;
struct HPMHookPoint *HP_nullpo_init_pre;
struct HPMHookPoint *HP_nullpo_init_post;
struct HPMHookPoint *HP_nullpo_final_pre;
Expand Down Expand Up @@ -11995,6 +11999,10 @@ struct {
int HP_npc_secure_timeout_timer_post;
int HP_npc_process_files_pre;
int HP_npc_process_files_post;
int HP_npc_dynamic_npc_despawn_pre;
int HP_npc_dynamic_npc_despawn_post;
int HP_npc_update_interaction_tick_pre;
int HP_npc_update_interaction_tick_post;
int HP_nullpo_init_pre;
int HP_nullpo_init_post;
int HP_nullpo_final_pre;
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(npc->questinfo_clear, HP_npc_questinfo_clear) },
{ HP_POP(npc->secure_timeout_timer, HP_npc_secure_timeout_timer) },
{ HP_POP(npc->process_files, HP_npc_process_files) },
{ HP_POP(npc->dynamic_npc_despawn, HP_npc_dynamic_npc_despawn) },
{ HP_POP(npc->update_interaction_tick, HP_npc_update_interaction_tick) },
/* nullpo_interface */
{ HP_POP(nullpo->init, HP_nullpo_init) },
{ HP_POP(nullpo->final, HP_nullpo_final) },
Expand Down
53 changes: 53 additions & 0 deletions src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
Original file line number Diff line number Diff line change
Expand Up @@ -61957,6 +61957,59 @@ void HP_npc_process_files(int npc_min) {
}
return;
}
int HP_npc_dynamic_npc_despawn(int tid, int64 tick, int id, intptr_t data) {
int hIndex = 0;
int retVal___ = 0;
if (HPMHooks.count.HP_npc_dynamic_npc_despawn_pre > 0) {
int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_dynamic_npc_despawn_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_npc_dynamic_npc_despawn_pre[hIndex].func;
retVal___ = preHookFunc(&tid, &tick, &id, &data);
}
if (*HPMforce_return) {
*HPMforce_return = false;
return retVal___;
}
}
{
retVal___ = HPMHooks.source.npc.dynamic_npc_despawn(tid, tick, id, data);
}
if (HPMHooks.count.HP_npc_dynamic_npc_despawn_post > 0) {
int (*postHookFunc) (int retVal___, int tid, int64 tick, int id, intptr_t data);
for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_dynamic_npc_despawn_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_npc_dynamic_npc_despawn_post[hIndex].func;
retVal___ = postHookFunc(retVal___, tid, tick, id, data);
}
}
return retVal___;
}
void HP_npc_update_interaction_tick(struct npc_data *nd) {
int hIndex = 0;
if (HPMHooks.count.HP_npc_update_interaction_tick_pre > 0) {
void (*preHookFunc) (struct npc_data **nd);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_update_interaction_tick_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_npc_update_interaction_tick_pre[hIndex].func;
preHookFunc(&nd);
}
if (*HPMforce_return) {
*HPMforce_return = false;
return;
}
}
{
HPMHooks.source.npc.update_interaction_tick(nd);
}
if (HPMHooks.count.HP_npc_update_interaction_tick_post > 0) {
void (*postHookFunc) (struct npc_data *nd);
for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_update_interaction_tick_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_npc_update_interaction_tick_post[hIndex].func;
postHookFunc(nd);
}
}
return;
}
/* nullpo_interface */
void HP_nullpo_init(void) {
int hIndex = 0;
Expand Down

0 comments on commit 89620fe

Please sign in to comment.