diff options
-rw-r--r-- | src/common/HPMSymbols.inc.h | 12 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 70 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 19 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 459 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.sources.inc | 2 |
5 files changed, 562 insertions, 0 deletions
diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h index 4c3722b69..c6e672e3f 100644 --- a/src/common/HPMSymbols.inc.h +++ b/src/common/HPMSymbols.inc.h @@ -149,6 +149,9 @@ struct mercenary_interface *mercenary; #ifdef MAP_MOB_H /* mob */ struct mob_interface *mob; #endif // MAP_MOB_H +#ifdef MAP_NPC_H /* npc_chat */ +struct npc_chat_interface *npc_chat; +#endif // MAP_NPC_H #ifdef MAP_NPC_H /* npc */ struct npc_interface *npc; #endif // MAP_NPC_H @@ -167,6 +170,9 @@ struct pc_groups_interface *pcg; #ifdef MAP_PC_H /* pc */ struct pc_interface *pc; #endif // MAP_PC_H +#ifdef MAP_NPC_H /* libpcre */ +struct pcre_interface *libpcre; +#endif // MAP_NPC_H #ifdef MAP_PET_H /* pet */ struct pet_interface *pet; #endif // MAP_PET_H @@ -372,6 +378,9 @@ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("mercenary", mercenary)) retu #ifdef MAP_MOB_H /* mob */ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("mob", mob)) return "mob"; #endif // MAP_MOB_H +#ifdef MAP_NPC_H /* npc_chat */ +if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("npc_chat", npc_chat)) return "npc_chat"; +#endif // MAP_NPC_H #ifdef MAP_NPC_H /* npc */ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("npc", npc)) return "npc"; #endif // MAP_NPC_H @@ -390,6 +399,9 @@ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("pc_groups", pcg)) return "pc #ifdef MAP_PC_H /* pc */ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("pc", pc)) return "pc"; #endif // MAP_PC_H +#ifdef MAP_NPC_H /* libpcre */ +if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("libpcre", libpcre)) return "libpcre"; +#endif // MAP_NPC_H #ifdef MAP_PET_H /* pet */ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("pet", pet)) return "pet"; #endif // MAP_PET_H diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index b6afa8fcf..573619202 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -3481,6 +3481,24 @@ struct { struct HPMHookPoint *HP_mob_clear_spawninfo_post; struct HPMHookPoint *HP_mob_destroy_mob_db_pre; struct HPMHookPoint *HP_mob_destroy_mob_db_post; + struct HPMHookPoint *HP_npc_chat_sub_pre; + struct HPMHookPoint *HP_npc_chat_sub_post; + struct HPMHookPoint *HP_npc_chat_finalize_pre; + struct HPMHookPoint *HP_npc_chat_finalize_post; + struct HPMHookPoint *HP_npc_chat_def_pattern_pre; + struct HPMHookPoint *HP_npc_chat_def_pattern_post; + struct HPMHookPoint *HP_npc_chat_create_pcrematch_entry_pre; + struct HPMHookPoint *HP_npc_chat_create_pcrematch_entry_post; + struct HPMHookPoint *HP_npc_chat_delete_pcreset_pre; + struct HPMHookPoint *HP_npc_chat_delete_pcreset_post; + struct HPMHookPoint *HP_npc_chat_deactivate_pcreset_pre; + struct HPMHookPoint *HP_npc_chat_deactivate_pcreset_post; + struct HPMHookPoint *HP_npc_chat_activate_pcreset_pre; + struct HPMHookPoint *HP_npc_chat_activate_pcreset_post; + struct HPMHookPoint *HP_npc_chat_lookup_pcreset_pre; + struct HPMHookPoint *HP_npc_chat_lookup_pcreset_post; + struct HPMHookPoint *HP_npc_chat_finalize_pcrematch_entry_pre; + struct HPMHookPoint *HP_npc_chat_finalize_pcrematch_entry_post; struct HPMHookPoint *HP_npc_init_pre; struct HPMHookPoint *HP_npc_init_post; struct HPMHookPoint *HP_npc_final_pre; @@ -4267,6 +4285,22 @@ struct { struct HPMHookPoint *HP_pc_check_job_name_post; struct HPMHookPoint *HP_pc_update_idle_time_pre; struct HPMHookPoint *HP_pc_update_idle_time_post; + struct HPMHookPoint *HP_libpcre_compile_pre; + struct HPMHookPoint *HP_libpcre_compile_post; + struct HPMHookPoint *HP_libpcre_study_pre; + struct HPMHookPoint *HP_libpcre_study_post; + struct HPMHookPoint *HP_libpcre_exec_pre; + struct HPMHookPoint *HP_libpcre_exec_post; + struct HPMHookPoint *HP_libpcre_free_pre; + struct HPMHookPoint *HP_libpcre_free_post; + struct HPMHookPoint *HP_libpcre_copy_substring_pre; + struct HPMHookPoint *HP_libpcre_copy_substring_post; + struct HPMHookPoint *HP_libpcre_free_substring_pre; + struct HPMHookPoint *HP_libpcre_free_substring_post; + struct HPMHookPoint *HP_libpcre_copy_named_substring_pre; + struct HPMHookPoint *HP_libpcre_copy_named_substring_post; + struct HPMHookPoint *HP_libpcre_get_substring_pre; + struct HPMHookPoint *HP_libpcre_get_substring_post; struct HPMHookPoint *HP_pet_init_pre; struct HPMHookPoint *HP_pet_init_post; struct HPMHookPoint *HP_pet_final_pre; @@ -9264,6 +9298,24 @@ struct { int HP_mob_clear_spawninfo_post; int HP_mob_destroy_mob_db_pre; int HP_mob_destroy_mob_db_post; + int HP_npc_chat_sub_pre; + int HP_npc_chat_sub_post; + int HP_npc_chat_finalize_pre; + int HP_npc_chat_finalize_post; + int HP_npc_chat_def_pattern_pre; + int HP_npc_chat_def_pattern_post; + int HP_npc_chat_create_pcrematch_entry_pre; + int HP_npc_chat_create_pcrematch_entry_post; + int HP_npc_chat_delete_pcreset_pre; + int HP_npc_chat_delete_pcreset_post; + int HP_npc_chat_deactivate_pcreset_pre; + int HP_npc_chat_deactivate_pcreset_post; + int HP_npc_chat_activate_pcreset_pre; + int HP_npc_chat_activate_pcreset_post; + int HP_npc_chat_lookup_pcreset_pre; + int HP_npc_chat_lookup_pcreset_post; + int HP_npc_chat_finalize_pcrematch_entry_pre; + int HP_npc_chat_finalize_pcrematch_entry_post; int HP_npc_init_pre; int HP_npc_init_post; int HP_npc_final_pre; @@ -10050,6 +10102,22 @@ struct { int HP_pc_check_job_name_post; int HP_pc_update_idle_time_pre; int HP_pc_update_idle_time_post; + int HP_libpcre_compile_pre; + int HP_libpcre_compile_post; + int HP_libpcre_study_pre; + int HP_libpcre_study_post; + int HP_libpcre_exec_pre; + int HP_libpcre_exec_post; + int HP_libpcre_free_pre; + int HP_libpcre_free_post; + int HP_libpcre_copy_substring_pre; + int HP_libpcre_copy_substring_post; + int HP_libpcre_free_substring_pre; + int HP_libpcre_free_substring_post; + int HP_libpcre_copy_named_substring_pre; + int HP_libpcre_copy_named_substring_post; + int HP_libpcre_get_substring_pre; + int HP_libpcre_get_substring_post; int HP_pet_init_pre; int HP_pet_init_post; int HP_pet_final_pre; @@ -11603,12 +11671,14 @@ struct { struct mapreg_interface mapreg; struct mercenary_interface mercenary; struct mob_interface mob; + struct npc_chat_interface npc_chat; struct npc_interface npc; struct nullpo_interface nullpo; struct party_interface party; struct path_interface path; struct pc_groups_interface pcg; struct pc_interface pc; + struct pcre_interface libpcre; struct pet_interface pet; struct quest_interface quest; struct script_interface script; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index c937241f3..9eadbf01f 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1775,6 +1775,16 @@ struct HookingPointData HookingPoints[] = { { HP_POP(mob->load, HP_mob_load) }, { HP_POP(mob->clear_spawninfo, HP_mob_clear_spawninfo) }, { HP_POP(mob->destroy_mob_db, HP_mob_destroy_mob_db) }, +/* npc_chat */ + { HP_POP(npc_chat->sub, HP_npc_chat_sub) }, + { HP_POP(npc_chat->finalize, HP_npc_chat_finalize) }, + { HP_POP(npc_chat->def_pattern, HP_npc_chat_def_pattern) }, + { HP_POP(npc_chat->create_pcrematch_entry, HP_npc_chat_create_pcrematch_entry) }, + { HP_POP(npc_chat->delete_pcreset, HP_npc_chat_delete_pcreset) }, + { HP_POP(npc_chat->deactivate_pcreset, HP_npc_chat_deactivate_pcreset) }, + { HP_POP(npc_chat->activate_pcreset, HP_npc_chat_activate_pcreset) }, + { HP_POP(npc_chat->lookup_pcreset, HP_npc_chat_lookup_pcreset) }, + { HP_POP(npc_chat->finalize_pcrematch_entry, HP_npc_chat_finalize_pcrematch_entry) }, /* npc */ { HP_POP(npc->init, HP_npc_init) }, { HP_POP(npc->final, HP_npc_final) }, @@ -2174,6 +2184,15 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->autotrade_final, HP_pc_autotrade_final) }, { HP_POP(pc->check_job_name, HP_pc_check_job_name) }, { HP_POP(pc->update_idle_time, HP_pc_update_idle_time) }, +/* libpcre */ + { HP_POP(libpcre->compile, HP_libpcre_compile) }, + { HP_POP(libpcre->study, HP_libpcre_study) }, + { HP_POP(libpcre->exec, HP_libpcre_exec) }, + { HP_POP(libpcre->free, HP_libpcre_free) }, + { HP_POP(libpcre->copy_substring, HP_libpcre_copy_substring) }, + { HP_POP(libpcre->free_substring, HP_libpcre_free_substring) }, + { HP_POP(libpcre->copy_named_substring, HP_libpcre_copy_named_substring) }, + { HP_POP(libpcre->get_substring, HP_libpcre_get_substring) }, /* pet */ { HP_POP(pet->init, HP_pet_init) }, { HP_POP(pet->final, HP_pet_final) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 78c9136de..d0c832d8d 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -46477,6 +46477,250 @@ void HP_mob_destroy_mob_db(int index) { } return; } +/* npc_chat */ +int HP_npc_chat_sub(struct block_list *bl, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_npc_chat_sub_pre ) { + int (*preHookFunc) (struct block_list *bl, va_list ap); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_sub_pre; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_npc_chat_sub_pre[hIndex].func; + retVal___ = preHookFunc(bl, ap___copy); + va_end(ap___copy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list ap___copy; va_copy(ap___copy, ap); + retVal___ = HPMHooks.source.npc_chat.sub(bl, ap___copy); + va_end(ap___copy); + } + if( HPMHooks.count.HP_npc_chat_sub_post ) { + int (*postHookFunc) (int retVal___, struct block_list *bl, va_list ap); + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_sub_post; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_npc_chat_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, bl, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} +void HP_npc_chat_finalize(struct npc_data *nd) { + int hIndex = 0; + if( HPMHooks.count.HP_npc_chat_finalize_pre ) { + void (*preHookFunc) (struct npc_data *nd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_finalize_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_npc_chat_finalize_pre[hIndex].func; + preHookFunc(nd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.npc_chat.finalize(nd); + } + if( HPMHooks.count.HP_npc_chat_finalize_post ) { + void (*postHookFunc) (struct npc_data *nd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_finalize_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_npc_chat_finalize_post[hIndex].func; + postHookFunc(nd); + } + } + return; +} +void HP_npc_chat_def_pattern(struct npc_data *nd, int setid, const char *pattern, const char *label) { + int hIndex = 0; + if( HPMHooks.count.HP_npc_chat_def_pattern_pre ) { + void (*preHookFunc) (struct npc_data *nd, int *setid, const char *pattern, const char *label); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_def_pattern_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_npc_chat_def_pattern_pre[hIndex].func; + preHookFunc(nd, &setid, pattern, label); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.npc_chat.def_pattern(nd, setid, pattern, label); + } + if( HPMHooks.count.HP_npc_chat_def_pattern_post ) { + void (*postHookFunc) (struct npc_data *nd, int *setid, const char *pattern, const char *label); + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_def_pattern_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_npc_chat_def_pattern_post[hIndex].func; + postHookFunc(nd, &setid, pattern, label); + } + } + return; +} +struct pcrematch_entry* HP_npc_chat_create_pcrematch_entry(struct pcrematch_set *set) { + int hIndex = 0; + struct pcrematch_entry* retVal___ = NULL; + if( HPMHooks.count.HP_npc_chat_create_pcrematch_entry_pre ) { + struct pcrematch_entry* (*preHookFunc) (struct pcrematch_set *set); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_create_pcrematch_entry_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_npc_chat_create_pcrematch_entry_pre[hIndex].func; + retVal___ = preHookFunc(set); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.npc_chat.create_pcrematch_entry(set); + } + if( HPMHooks.count.HP_npc_chat_create_pcrematch_entry_post ) { + struct pcrematch_entry* (*postHookFunc) (struct pcrematch_entry* retVal___, struct pcrematch_set *set); + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_create_pcrematch_entry_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_npc_chat_create_pcrematch_entry_post[hIndex].func; + retVal___ = postHookFunc(retVal___, set); + } + } + return retVal___; +} +void HP_npc_chat_delete_pcreset(struct npc_data *nd, int setid) { + int hIndex = 0; + if( HPMHooks.count.HP_npc_chat_delete_pcreset_pre ) { + void (*preHookFunc) (struct npc_data *nd, int *setid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_delete_pcreset_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_npc_chat_delete_pcreset_pre[hIndex].func; + preHookFunc(nd, &setid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.npc_chat.delete_pcreset(nd, setid); + } + if( HPMHooks.count.HP_npc_chat_delete_pcreset_post ) { + void (*postHookFunc) (struct npc_data *nd, int *setid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_delete_pcreset_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_npc_chat_delete_pcreset_post[hIndex].func; + postHookFunc(nd, &setid); + } + } + return; +} +void HP_npc_chat_deactivate_pcreset(struct npc_data *nd, int setid) { + int hIndex = 0; + if( HPMHooks.count.HP_npc_chat_deactivate_pcreset_pre ) { + void (*preHookFunc) (struct npc_data *nd, int *setid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_deactivate_pcreset_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_npc_chat_deactivate_pcreset_pre[hIndex].func; + preHookFunc(nd, &setid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.npc_chat.deactivate_pcreset(nd, setid); + } + if( HPMHooks.count.HP_npc_chat_deactivate_pcreset_post ) { + void (*postHookFunc) (struct npc_data *nd, int *setid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_deactivate_pcreset_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_npc_chat_deactivate_pcreset_post[hIndex].func; + postHookFunc(nd, &setid); + } + } + return; +} +void HP_npc_chat_activate_pcreset(struct npc_data *nd, int setid) { + int hIndex = 0; + if( HPMHooks.count.HP_npc_chat_activate_pcreset_pre ) { + void (*preHookFunc) (struct npc_data *nd, int *setid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_activate_pcreset_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_npc_chat_activate_pcreset_pre[hIndex].func; + preHookFunc(nd, &setid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.npc_chat.activate_pcreset(nd, setid); + } + if( HPMHooks.count.HP_npc_chat_activate_pcreset_post ) { + void (*postHookFunc) (struct npc_data *nd, int *setid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_activate_pcreset_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_npc_chat_activate_pcreset_post[hIndex].func; + postHookFunc(nd, &setid); + } + } + return; +} +struct pcrematch_set* HP_npc_chat_lookup_pcreset(struct npc_data *nd, int setid) { + int hIndex = 0; + struct pcrematch_set* retVal___ = NULL; + if( HPMHooks.count.HP_npc_chat_lookup_pcreset_pre ) { + struct pcrematch_set* (*preHookFunc) (struct npc_data *nd, int *setid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_lookup_pcreset_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_npc_chat_lookup_pcreset_pre[hIndex].func; + retVal___ = preHookFunc(nd, &setid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.npc_chat.lookup_pcreset(nd, setid); + } + if( HPMHooks.count.HP_npc_chat_lookup_pcreset_post ) { + struct pcrematch_set* (*postHookFunc) (struct pcrematch_set* retVal___, struct npc_data *nd, int *setid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_lookup_pcreset_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_npc_chat_lookup_pcreset_post[hIndex].func; + retVal___ = postHookFunc(retVal___, nd, &setid); + } + } + return retVal___; +} +void HP_npc_chat_finalize_pcrematch_entry(struct pcrematch_entry *e) { + int hIndex = 0; + if( HPMHooks.count.HP_npc_chat_finalize_pcrematch_entry_pre ) { + void (*preHookFunc) (struct pcrematch_entry *e); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_finalize_pcrematch_entry_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_npc_chat_finalize_pcrematch_entry_pre[hIndex].func; + preHookFunc(e); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.npc_chat.finalize_pcrematch_entry(e); + } + if( HPMHooks.count.HP_npc_chat_finalize_pcrematch_entry_post ) { + void (*postHookFunc) (struct pcrematch_entry *e); + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_chat_finalize_pcrematch_entry_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_npc_chat_finalize_pcrematch_entry_post[hIndex].func; + postHookFunc(e); + } + } + return; +} /* npc */ int HP_npc_init(bool minimal) { int hIndex = 0; @@ -57122,6 +57366,221 @@ void HP_pc_update_idle_time(struct map_session_data *sd, enum e_battle_config_id } return; } +/* libpcre */ +pcre* HP_libpcre_compile(const char *pattern, int options, const char **errptr, int *erroffset, const unsigned char *tableptr) { + int hIndex = 0; + pcre* retVal___ = NULL; + if( HPMHooks.count.HP_libpcre_compile_pre ) { + pcre* (*preHookFunc) (const char *pattern, int *options, const char **errptr, int *erroffset, const unsigned char *tableptr); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_compile_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_libpcre_compile_pre[hIndex].func; + retVal___ = preHookFunc(pattern, &options, errptr, erroffset, tableptr); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.libpcre.compile(pattern, options, errptr, erroffset, tableptr); + } + if( HPMHooks.count.HP_libpcre_compile_post ) { + pcre* (*postHookFunc) (pcre* retVal___, const char *pattern, int *options, const char **errptr, int *erroffset, const unsigned char *tableptr); + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_compile_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_libpcre_compile_post[hIndex].func; + retVal___ = postHookFunc(retVal___, pattern, &options, errptr, erroffset, tableptr); + } + } + return retVal___; +} +pcre_extra* HP_libpcre_study(const pcre *code, int options, const char **errptr) { + int hIndex = 0; + pcre_extra* retVal___ = NULL; + if( HPMHooks.count.HP_libpcre_study_pre ) { + pcre_extra* (*preHookFunc) (const pcre *code, int *options, const char **errptr); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_study_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_libpcre_study_pre[hIndex].func; + retVal___ = preHookFunc(code, &options, errptr); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.libpcre.study(code, options, errptr); + } + if( HPMHooks.count.HP_libpcre_study_post ) { + pcre_extra* (*postHookFunc) (pcre_extra* retVal___, const pcre *code, int *options, const char **errptr); + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_study_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_libpcre_study_post[hIndex].func; + retVal___ = postHookFunc(retVal___, code, &options, errptr); + } + } + return retVal___; +} +int HP_libpcre_exec(const pcre *code, const pcre_extra *extra, const char *subject, int length, int startoffset, int options, int *ovector, int ovecsize) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_libpcre_exec_pre ) { + int (*preHookFunc) (const pcre *code, const pcre_extra *extra, const char *subject, int *length, int *startoffset, int *options, int *ovector, int *ovecsize); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_exec_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_libpcre_exec_pre[hIndex].func; + retVal___ = preHookFunc(code, extra, subject, &length, &startoffset, &options, ovector, &ovecsize); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.libpcre.exec(code, extra, subject, length, startoffset, options, ovector, ovecsize); + } + if( HPMHooks.count.HP_libpcre_exec_post ) { + int (*postHookFunc) (int retVal___, const pcre *code, const pcre_extra *extra, const char *subject, int *length, int *startoffset, int *options, int *ovector, int *ovecsize); + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_exec_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_libpcre_exec_post[hIndex].func; + retVal___ = postHookFunc(retVal___, code, extra, subject, &length, &startoffset, &options, ovector, &ovecsize); + } + } + return retVal___; +} +void HP_libpcre_free(void *ptr) { + int hIndex = 0; + if( HPMHooks.count.HP_libpcre_free_pre ) { + void (*preHookFunc) (void *ptr); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_free_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_libpcre_free_pre[hIndex].func; + preHookFunc(ptr); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.libpcre.free(ptr); + } + if( HPMHooks.count.HP_libpcre_free_post ) { + void (*postHookFunc) (void *ptr); + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_free_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_libpcre_free_post[hIndex].func; + postHookFunc(ptr); + } + } + return; +} +int HP_libpcre_copy_substring(const char *subject, int *ovector, int stringcount, int stringnumber, char *buffer, int buffersize) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_libpcre_copy_substring_pre ) { + int (*preHookFunc) (const char *subject, int *ovector, int *stringcount, int *stringnumber, char *buffer, int *buffersize); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_copy_substring_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_libpcre_copy_substring_pre[hIndex].func; + retVal___ = preHookFunc(subject, ovector, &stringcount, &stringnumber, buffer, &buffersize); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.libpcre.copy_substring(subject, ovector, stringcount, stringnumber, buffer, buffersize); + } + if( HPMHooks.count.HP_libpcre_copy_substring_post ) { + int (*postHookFunc) (int retVal___, const char *subject, int *ovector, int *stringcount, int *stringnumber, char *buffer, int *buffersize); + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_copy_substring_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_libpcre_copy_substring_post[hIndex].func; + retVal___ = postHookFunc(retVal___, subject, ovector, &stringcount, &stringnumber, buffer, &buffersize); + } + } + return retVal___; +} +void HP_libpcre_free_substring(const char *stringptr) { + int hIndex = 0; + if( HPMHooks.count.HP_libpcre_free_substring_pre ) { + void (*preHookFunc) (const char *stringptr); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_free_substring_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_libpcre_free_substring_pre[hIndex].func; + preHookFunc(stringptr); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.libpcre.free_substring(stringptr); + } + if( HPMHooks.count.HP_libpcre_free_substring_post ) { + void (*postHookFunc) (const char *stringptr); + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_free_substring_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_libpcre_free_substring_post[hIndex].func; + postHookFunc(stringptr); + } + } + return; +} +int HP_libpcre_copy_named_substring(const pcre *code, const char *subject, int *ovector, int stringcount, const char *stringname, char *buffer, int buffersize) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_libpcre_copy_named_substring_pre ) { + int (*preHookFunc) (const pcre *code, const char *subject, int *ovector, int *stringcount, const char *stringname, char *buffer, int *buffersize); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_copy_named_substring_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_libpcre_copy_named_substring_pre[hIndex].func; + retVal___ = preHookFunc(code, subject, ovector, &stringcount, stringname, buffer, &buffersize); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.libpcre.copy_named_substring(code, subject, ovector, stringcount, stringname, buffer, buffersize); + } + if( HPMHooks.count.HP_libpcre_copy_named_substring_post ) { + int (*postHookFunc) (int retVal___, const pcre *code, const char *subject, int *ovector, int *stringcount, const char *stringname, char *buffer, int *buffersize); + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_copy_named_substring_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_libpcre_copy_named_substring_post[hIndex].func; + retVal___ = postHookFunc(retVal___, code, subject, ovector, &stringcount, stringname, buffer, &buffersize); + } + } + return retVal___; +} +int HP_libpcre_get_substring(const char *subject, int *ovector, int stringcount, int stringnumber, const char **stringptr) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_libpcre_get_substring_pre ) { + int (*preHookFunc) (const char *subject, int *ovector, int *stringcount, int *stringnumber, const char **stringptr); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_get_substring_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_libpcre_get_substring_pre[hIndex].func; + retVal___ = preHookFunc(subject, ovector, &stringcount, &stringnumber, stringptr); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.libpcre.get_substring(subject, ovector, stringcount, stringnumber, stringptr); + } + if( HPMHooks.count.HP_libpcre_get_substring_post ) { + int (*postHookFunc) (int retVal___, const char *subject, int *ovector, int *stringcount, int *stringnumber, const char **stringptr); + for(hIndex = 0; hIndex < HPMHooks.count.HP_libpcre_get_substring_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_libpcre_get_substring_post[hIndex].func; + retVal___ = postHookFunc(retVal___, subject, ovector, &stringcount, &stringnumber, stringptr); + } + } + return retVal___; +} /* pet */ int HP_pet_init(bool minimal) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_map.sources.inc b/src/plugins/HPMHooking/HPMHooking_map.sources.inc index 024febdf8..786eec1d5 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.sources.inc @@ -36,12 +36,14 @@ memcpy(&HPMHooks.source.mapit, mapit, sizeof(struct mapit_interface)); memcpy(&HPMHooks.source.mapreg, mapreg, sizeof(struct mapreg_interface)); memcpy(&HPMHooks.source.mercenary, mercenary, sizeof(struct mercenary_interface)); memcpy(&HPMHooks.source.mob, mob, sizeof(struct mob_interface)); +memcpy(&HPMHooks.source.npc_chat, npc_chat, sizeof(struct npc_chat_interface)); memcpy(&HPMHooks.source.npc, npc, sizeof(struct npc_interface)); memcpy(&HPMHooks.source.nullpo, nullpo, sizeof(struct nullpo_interface)); memcpy(&HPMHooks.source.party, party, sizeof(struct party_interface)); memcpy(&HPMHooks.source.path, path, sizeof(struct path_interface)); memcpy(&HPMHooks.source.pcg, pcg, sizeof(struct pc_groups_interface)); memcpy(&HPMHooks.source.pc, pc, sizeof(struct pc_interface)); +memcpy(&HPMHooks.source.libpcre, libpcre, sizeof(struct pcre_interface)); memcpy(&HPMHooks.source.pet, pet, sizeof(struct pet_interface)); memcpy(&HPMHooks.source.quest, quest, sizeof(struct quest_interface)); memcpy(&HPMHooks.source.script, script, sizeof(struct script_interface)); |