From 8e3b160fa7f62246fd19bb973f544b387d42eeb2 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Thu, 10 Jul 2014 07:03:41 +0200 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc | 8 ++++ .../HPMHooking/HPMHooking.HookingPoints.inc | 2 + src/plugins/HPMHooking/HPMHooking.Hooks.inc | 54 ++++++++++++++++++++++ 3 files changed, 64 insertions(+) (limited to 'src') diff --git a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc index de5b11b93..1a1ffcc3c 100644 --- a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc @@ -3507,6 +3507,10 @@ struct { struct HPMHookPoint *HP_pc_can_give_items_post; struct HPMHookPoint *HP_pc_can_give_bound_items_pre; struct HPMHookPoint *HP_pc_can_give_bound_items_post; + struct HPMHookPoint *HP_pc_can_talk_pre; + struct HPMHookPoint *HP_pc_can_talk_post; + struct HPMHookPoint *HP_pc_can_attack_pre; + struct HPMHookPoint *HP_pc_can_attack_post; struct HPMHookPoint *HP_pc_can_use_command_pre; struct HPMHookPoint *HP_pc_can_use_command_post; struct HPMHookPoint *HP_pc_set_group_pre; @@ -8542,6 +8546,10 @@ struct { int HP_pc_can_give_items_post; int HP_pc_can_give_bound_items_pre; int HP_pc_can_give_bound_items_post; + int HP_pc_can_talk_pre; + int HP_pc_can_talk_post; + int HP_pc_can_attack_pre; + int HP_pc_can_attack_post; int HP_pc_can_use_command_pre; int HP_pc_can_use_command_post; int HP_pc_set_group_pre; diff --git a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc index 2a6761170..552d49b4f 100644 --- a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc @@ -1784,6 +1784,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->class2idx, HP_pc_class2idx) }, { HP_POP(pc->can_give_items, HP_pc_can_give_items) }, { HP_POP(pc->can_give_bound_items, HP_pc_can_give_bound_items) }, + { HP_POP(pc->can_talk, HP_pc_can_talk) }, + { HP_POP(pc->can_attack, HP_pc_can_attack) }, { HP_POP(pc->can_use_command, HP_pc_can_use_command) }, { HP_POP(pc->set_group, HP_pc_set_group) }, { HP_POP(pc->should_log_commands, HP_pc_should_log_commands) }, diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc index 78139fb61..84f1f6dc9 100644 --- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc @@ -46911,6 +46911,60 @@ bool HP_pc_can_give_bound_items(struct map_session_data *sd) { } return retVal___; } +bool HP_pc_can_talk(struct map_session_data *sd) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_pc_can_talk_pre ) { + bool (*preHookFunc) (struct map_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_can_talk_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_pc_can_talk_pre[hIndex].func; + retVal___ = preHookFunc(sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.can_talk(sd); + } + if( HPMHooks.count.HP_pc_can_talk_post ) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_can_talk_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_pc_can_talk_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd); + } + } + return retVal___; +} +bool HP_pc_can_attack(struct map_session_data *sd, int target_id) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_pc_can_attack_pre ) { + bool (*preHookFunc) (struct map_session_data *sd, int *target_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_can_attack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_pc_can_attack_pre[hIndex].func; + retVal___ = preHookFunc(sd, &target_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.can_attack(sd, target_id); + } + if( HPMHooks.count.HP_pc_can_attack_post ) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int *target_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_can_attack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_pc_can_attack_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, &target_id); + } + } + return retVal___; +} bool HP_pc_can_use_command(struct map_session_data *sd, const char *command) { int hIndex = 0; bool retVal___ = false; -- cgit v1.2.3-60-g2f50