From 68f8294f2c0f68dac181bffb427a2be8a52193f9 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Sat, 19 Oct 2013 21:23:41 +0200 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc | 16 +++ .../HPMHooking/HPMHooking.HookingPoints.inc | 4 + src/plugins/HPMHooking/HPMHooking.Hooks.inc | 115 +++++++++++++++++++++ 3 files changed, 135 insertions(+) diff --git a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc index 6fbb45016..8da24df17 100644 --- a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc @@ -2097,6 +2097,8 @@ struct { struct HPMHookPoint *HP_instance_init_post; struct HPMHookPoint *HP_instance_final_pre; struct HPMHookPoint *HP_instance_final_post; + struct HPMHookPoint *HP_instance_reload_pre; + struct HPMHookPoint *HP_instance_reload_post; struct HPMHookPoint *HP_instance_create_pre; struct HPMHookPoint *HP_instance_create_post; struct HPMHookPoint *HP_instance_add_map_pre; @@ -2107,6 +2109,12 @@ struct { struct HPMHookPoint *HP_instance_map2imap_post; struct HPMHookPoint *HP_instance_mapid2imapid_pre; struct HPMHookPoint *HP_instance_mapid2imapid_post; + struct HPMHookPoint *HP_instance_mapname2imap_pre; + struct HPMHookPoint *HP_instance_mapname2imap_post; + struct HPMHookPoint *HP_instance_map_npcsub_pre; + struct HPMHookPoint *HP_instance_map_npcsub_post; + struct HPMHookPoint *HP_instance_init_npc_pre; + struct HPMHookPoint *HP_instance_init_npc_post; struct HPMHookPoint *HP_instance_destroy_pre; struct HPMHookPoint *HP_instance_destroy_post; struct HPMHookPoint *HP_instance_start_pre; @@ -6978,6 +6986,8 @@ struct { int HP_instance_init_post; int HP_instance_final_pre; int HP_instance_final_post; + int HP_instance_reload_pre; + int HP_instance_reload_post; int HP_instance_create_pre; int HP_instance_create_post; int HP_instance_add_map_pre; @@ -6988,6 +6998,12 @@ struct { int HP_instance_map2imap_post; int HP_instance_mapid2imapid_pre; int HP_instance_mapid2imapid_post; + int HP_instance_mapname2imap_pre; + int HP_instance_mapname2imap_post; + int HP_instance_map_npcsub_pre; + int HP_instance_map_npcsub_post; + int HP_instance_init_npc_pre; + int HP_instance_init_npc_post; int HP_instance_destroy_pre; int HP_instance_destroy_post; int HP_instance_start_pre; diff --git a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc index 6ca0002f4..a538da537 100644 --- a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc @@ -1064,11 +1064,15 @@ struct HookingPointData HookingPoints[] = { /* instance */ { HP_POP(instance->init, HP_instance_init) }, { HP_POP(instance->final, HP_instance_final) }, + { HP_POP(instance->reload, HP_instance_reload) }, { HP_POP(instance->create, HP_instance_create) }, { HP_POP(instance->add_map, HP_instance_add_map) }, { HP_POP(instance->del_map, HP_instance_del_map) }, { HP_POP(instance->map2imap, HP_instance_map2imap) }, { HP_POP(instance->mapid2imapid, HP_instance_mapid2imapid) }, + { HP_POP(instance->mapname2imap, HP_instance_mapname2imap) }, + { HP_POP(instance->map_npcsub, HP_instance_map_npcsub) }, + { HP_POP(instance->init_npc, HP_instance_init_npc) }, { HP_POP(instance->destroy, HP_instance_destroy) }, { HP_POP(instance->start, HP_instance_start) }, { HP_POP(instance->check_idle, HP_instance_check_idle) }, diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc index 9a34af7b4..c3e234324 100644 --- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc @@ -26694,6 +26694,31 @@ void HP_instance_final(void) { } return; } +void HP_instance_reload(void) { + int hIndex = 0; + if( HPMHooks.count.HP_instance_reload_pre ) { + void (*preHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_instance_reload_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_instance_reload_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.instance.reload(); + } + if( HPMHooks.count.HP_instance_reload_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_instance_reload_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_instance_reload_post[hIndex].func; + postHookFunc(); + } + } + return; +} int HP_instance_create(int party_id, const char *name, enum instance_owner_type type) { int hIndex = 0; int retVal___ = 0; @@ -26823,6 +26848,96 @@ int HP_instance_mapid2imapid(int16 m, int instance_id) { } return retVal___; } +int HP_instance_mapname2imap(const char *map_name, int instance_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_instance_mapname2imap_pre ) { + int (*preHookFunc) (const char *map_name, int *instance_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_instance_mapname2imap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_instance_mapname2imap_pre[hIndex].func; + retVal___ = preHookFunc(map_name, &instance_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.instance.mapname2imap(map_name, instance_id); + } + if( HPMHooks.count.HP_instance_mapname2imap_post ) { + int (*postHookFunc) (int retVal___, const char *map_name, int *instance_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_instance_mapname2imap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_instance_mapname2imap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, map_name, &instance_id); + } + } + return retVal___; +} +int HP_instance_map_npcsub(struct block_list *bl, va_list args) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_instance_map_npcsub_pre ) { + int (*preHookFunc) (struct block_list *bl, va_list args); + for(hIndex = 0; hIndex < HPMHooks.count.HP_instance_map_npcsub_pre; hIndex++ ) { + va_list args___copy; va_copy(args___copy, args); + preHookFunc = HPMHooks.list.HP_instance_map_npcsub_pre[hIndex].func; + retVal___ = preHookFunc(bl, 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.instance.map_npcsub(bl, args___copy); + va_end(args___copy); + } + if( HPMHooks.count.HP_instance_map_npcsub_post ) { + int (*postHookFunc) (int retVal___, struct block_list *bl, va_list args); + for(hIndex = 0; hIndex < HPMHooks.count.HP_instance_map_npcsub_post; hIndex++ ) { + va_list args___copy; va_copy(args___copy, args); + postHookFunc = HPMHooks.list.HP_instance_map_npcsub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, bl, args___copy); + va_end(args___copy); + } + } + return retVal___; +} +int HP_instance_init_npc(struct block_list *bl, va_list args) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_instance_init_npc_pre ) { + int (*preHookFunc) (struct block_list *bl, va_list args); + for(hIndex = 0; hIndex < HPMHooks.count.HP_instance_init_npc_pre; hIndex++ ) { + va_list args___copy; va_copy(args___copy, args); + preHookFunc = HPMHooks.list.HP_instance_init_npc_pre[hIndex].func; + retVal___ = preHookFunc(bl, 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.instance.init_npc(bl, args___copy); + va_end(args___copy); + } + if( HPMHooks.count.HP_instance_init_npc_post ) { + int (*postHookFunc) (int retVal___, struct block_list *bl, va_list args); + for(hIndex = 0; hIndex < HPMHooks.count.HP_instance_init_npc_post; hIndex++ ) { + va_list args___copy; va_copy(args___copy, args); + postHookFunc = HPMHooks.list.HP_instance_init_npc_post[hIndex].func; + retVal___ = postHookFunc(retVal___, bl, args___copy); + va_end(args___copy); + } + } + return retVal___; +} void HP_instance_destroy(int instance_id) { int hIndex = 0; if( HPMHooks.count.HP_instance_destroy_pre ) { -- cgit v1.2.3-60-g2f50