diff options
author | Hercules.ws <Hercules@efficiently.awesome> | 2015-02-23 18:25:48 +0100 |
---|---|---|
committer | HerculesWSAPI <Hercules@efficiently.awesome> | 2015-02-23 18:25:48 +0100 |
commit | 6b949190402e71d5c489f627da79eb5f51669b44 (patch) | |
tree | 129da394dda1c8989aa888eac8b65fc5621bb918 /src | |
parent | 330e31cc71ece055908acb1eb967b4009ebc9c46 (diff) | |
download | hercules-6b949190402e71d5c489f627da79eb5f51669b44.tar.gz hercules-6b949190402e71d5c489f627da79eb5f51669b44.tar.bz2 hercules-6b949190402e71d5c489f627da79eb5f51669b44.tar.xz hercules-6b949190402e71d5c489f627da79eb5f51669b44.zip |
HPM Hooks Update
Signed-off-by: HerculesWSAPI <Hercules@efficiently.awesome>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 48 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 12 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 325 |
3 files changed, 385 insertions, 0 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 40023d490..d92f2079f 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -65,6 +65,12 @@ struct { struct HPMHookPoint *HP_atcommand_add_post; struct HPMHookPoint *HP_atcommand_msg_pre; struct HPMHookPoint *HP_atcommand_msg_post; + struct HPMHookPoint *HP_atcommand_expand_message_table_pre; + struct HPMHookPoint *HP_atcommand_expand_message_table_post; + struct HPMHookPoint *HP_atcommand_msgfd_pre; + struct HPMHookPoint *HP_atcommand_msgfd_post; + struct HPMHookPoint *HP_atcommand_msgsd_pre; + struct HPMHookPoint *HP_atcommand_msgsd_post; struct HPMHookPoint *HP_battle_init_pre; struct HPMHookPoint *HP_battle_init_post; struct HPMHookPoint *HP_battle_final_pre; @@ -4349,6 +4355,24 @@ struct { struct HPMHookPoint *HP_script_hardcoded_constants_post; struct HPMHookPoint *HP_script_mapindexname2id_pre; struct HPMHookPoint *HP_script_mapindexname2id_post; + struct HPMHookPoint *HP_script_string_dup_pre; + struct HPMHookPoint *HP_script_string_dup_post; + struct HPMHookPoint *HP_script_load_translations_pre; + struct HPMHookPoint *HP_script_load_translations_post; + struct HPMHookPoint *HP_script_load_translation_pre; + struct HPMHookPoint *HP_script_load_translation_post; + struct HPMHookPoint *HP_script_translation_db_destroyer_pre; + struct HPMHookPoint *HP_script_translation_db_destroyer_post; + struct HPMHookPoint *HP_script_clear_translations_pre; + struct HPMHookPoint *HP_script_clear_translations_post; + struct HPMHookPoint *HP_script_parse_cleanup_timer_pre; + struct HPMHookPoint *HP_script_parse_cleanup_timer_post; + struct HPMHookPoint *HP_script_add_language_pre; + struct HPMHookPoint *HP_script_add_language_post; + struct HPMHookPoint *HP_script_get_translation_file_name_pre; + struct HPMHookPoint *HP_script_get_translation_file_name_post; + struct HPMHookPoint *HP_script_parser_clean_leftovers_pre; + struct HPMHookPoint *HP_script_parser_clean_leftovers_post; struct HPMHookPoint *HP_searchstore_open_pre; struct HPMHookPoint *HP_searchstore_open_post; struct HPMHookPoint *HP_searchstore_query_pre; @@ -5242,6 +5266,12 @@ struct { int HP_atcommand_add_post; int HP_atcommand_msg_pre; int HP_atcommand_msg_post; + int HP_atcommand_expand_message_table_pre; + int HP_atcommand_expand_message_table_post; + int HP_atcommand_msgfd_pre; + int HP_atcommand_msgfd_post; + int HP_atcommand_msgsd_pre; + int HP_atcommand_msgsd_post; int HP_battle_init_pre; int HP_battle_init_post; int HP_battle_final_pre; @@ -9526,6 +9556,24 @@ struct { int HP_script_hardcoded_constants_post; int HP_script_mapindexname2id_pre; int HP_script_mapindexname2id_post; + int HP_script_string_dup_pre; + int HP_script_string_dup_post; + int HP_script_load_translations_pre; + int HP_script_load_translations_post; + int HP_script_load_translation_pre; + int HP_script_load_translation_post; + int HP_script_translation_db_destroyer_pre; + int HP_script_translation_db_destroyer_post; + int HP_script_clear_translations_pre; + int HP_script_clear_translations_post; + int HP_script_parse_cleanup_timer_pre; + int HP_script_parse_cleanup_timer_post; + int HP_script_add_language_pre; + int HP_script_add_language_post; + int HP_script_get_translation_file_name_pre; + int HP_script_get_translation_file_name_post; + int HP_script_parser_clean_leftovers_pre; + int HP_script_parser_clean_leftovers_post; int HP_searchstore_open_pre; int HP_searchstore_open_post; int HP_searchstore_query_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index e127caeae..a3e4340be 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -36,6 +36,9 @@ struct HookingPointData HookingPoints[] = { { HP_POP(atcommand->base_commands, HP_atcommand_base_commands) }, { HP_POP(atcommand->add, HP_atcommand_add) }, { HP_POP(atcommand->msg, HP_atcommand_msg) }, + { HP_POP(atcommand->expand_message_table, HP_atcommand_expand_message_table) }, + { HP_POP(atcommand->msgfd, HP_atcommand_msgfd) }, + { HP_POP(atcommand->msgsd, HP_atcommand_msgsd) }, /* battle */ { HP_POP(battle->init, HP_battle_init) }, { HP_POP(battle->final, HP_battle_final) }, @@ -2209,6 +2212,15 @@ struct HookingPointData HookingPoints[] = { { HP_POP(script->array_cpy_list, HP_script_array_cpy_list) }, { HP_POP(script->hardcoded_constants, HP_script_hardcoded_constants) }, { HP_POP(script->mapindexname2id, HP_script_mapindexname2id) }, + { HP_POP(script->string_dup, HP_script_string_dup) }, + { HP_POP(script->load_translations, HP_script_load_translations) }, + { HP_POP(script->load_translation, HP_script_load_translation) }, + { HP_POP(script->translation_db_destroyer, HP_script_translation_db_destroyer) }, + { HP_POP(script->clear_translations, HP_script_clear_translations) }, + { HP_POP(script->parse_cleanup_timer, HP_script_parse_cleanup_timer) }, + { HP_POP(script->add_language, HP_script_add_language) }, + { HP_POP(script->get_translation_file_name, HP_script_get_translation_file_name) }, + { HP_POP(script->parser_clean_leftovers, HP_script_parser_clean_leftovers) }, /* searchstore */ { HP_POP(searchstore->open, HP_searchstore_open) }, { HP_POP(searchstore->query, HP_searchstore_query) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index c479fe435..c36525c21 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -845,6 +845,86 @@ const char* HP_atcommand_msg(int msg_number) { } return retVal___; } +void HP_atcommand_expand_message_table(void) { + int hIndex = 0; + if( HPMHooks.count.HP_atcommand_expand_message_table_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_atcommand_expand_message_table_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_atcommand_expand_message_table_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.atcommand.expand_message_table(); + } + if( HPMHooks.count.HP_atcommand_expand_message_table_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_atcommand_expand_message_table_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_atcommand_expand_message_table_post[hIndex].func; + postHookFunc(); + } + } + return; +} +const char* HP_atcommand_msgfd(int fd, int msg_number) { + int hIndex = 0; + const char* retVal___ = NULL; + if( HPMHooks.count.HP_atcommand_msgfd_pre ) { + const char* (*preHookFunc) (int *fd, int *msg_number); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_atcommand_msgfd_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_atcommand_msgfd_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &msg_number); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.atcommand.msgfd(fd, msg_number); + } + if( HPMHooks.count.HP_atcommand_msgfd_post ) { + const char* (*postHookFunc) (const char* retVal___, int *fd, int *msg_number); + for(hIndex = 0; hIndex < HPMHooks.count.HP_atcommand_msgfd_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_atcommand_msgfd_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &msg_number); + } + } + return retVal___; +} +const char* HP_atcommand_msgsd(struct map_session_data *sd, int msg_number) { + int hIndex = 0; + const char* retVal___ = NULL; + if( HPMHooks.count.HP_atcommand_msgsd_pre ) { + const char* (*preHookFunc) (struct map_session_data *sd, int *msg_number); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_atcommand_msgsd_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_atcommand_msgsd_pre[hIndex].func; + retVal___ = preHookFunc(sd, &msg_number); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.atcommand.msgsd(sd, msg_number); + } + if( HPMHooks.count.HP_atcommand_msgsd_post ) { + const char* (*postHookFunc) (const char* retVal___, struct map_session_data *sd, int *msg_number); + for(hIndex = 0; hIndex < HPMHooks.count.HP_atcommand_msgsd_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_atcommand_msgsd_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, &msg_number); + } + } + return retVal___; +} /* battle */ void HP_battle_init(bool minimal) { int hIndex = 0; @@ -58344,6 +58424,251 @@ unsigned short HP_script_mapindexname2id(struct script_state *st, const char *na } return retVal___; } +int HP_script_string_dup(char *str) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_script_string_dup_pre ) { + int (*preHookFunc) (char *str); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_string_dup_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_string_dup_pre[hIndex].func; + retVal___ = preHookFunc(str); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.string_dup(str); + } + if( HPMHooks.count.HP_script_string_dup_post ) { + int (*postHookFunc) (int retVal___, char *str); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_string_dup_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_string_dup_post[hIndex].func; + retVal___ = postHookFunc(retVal___, str); + } + } + return retVal___; +} +void HP_script_load_translations(void) { + int hIndex = 0; + if( HPMHooks.count.HP_script_load_translations_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translations_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_load_translations_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.script.load_translations(); + } + if( HPMHooks.count.HP_script_load_translations_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translations_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_load_translations_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_script_load_translation(const char *file, uint8 lang_id, uint32 *total) { + int hIndex = 0; + if( HPMHooks.count.HP_script_load_translation_pre ) { + void (*preHookFunc) (const char *file, uint8 *lang_id, uint32 *total); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_load_translation_pre[hIndex].func; + preHookFunc(file, &lang_id, total); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.script.load_translation(file, lang_id, total); + } + if( HPMHooks.count.HP_script_load_translation_post ) { + void (*postHookFunc) (const char *file, uint8 *lang_id, uint32 *total); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_load_translation_post[hIndex].func; + postHookFunc(file, &lang_id, total); + } + } + return; +} +int HP_script_translation_db_destroyer(DBKey key, DBData *data, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_script_translation_db_destroyer_pre ) { + int (*preHookFunc) (DBKey *key, DBData *data, va_list ap); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_translation_db_destroyer_pre; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_script_translation_db_destroyer_pre[hIndex].func; + retVal___ = preHookFunc(&key, data, 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.script.translation_db_destroyer(key, data, ap___copy); + va_end(ap___copy); + } + if( HPMHooks.count.HP_script_translation_db_destroyer_post ) { + int (*postHookFunc) (int retVal___, DBKey *key, DBData *data, va_list ap); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_translation_db_destroyer_post; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_script_translation_db_destroyer_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &key, data, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} +void HP_script_clear_translations(bool reload) { + int hIndex = 0; + if( HPMHooks.count.HP_script_clear_translations_pre ) { + void (*preHookFunc) (bool *reload); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_clear_translations_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_clear_translations_pre[hIndex].func; + preHookFunc(&reload); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.script.clear_translations(reload); + } + if( HPMHooks.count.HP_script_clear_translations_post ) { + void (*postHookFunc) (bool *reload); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_clear_translations_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_clear_translations_post[hIndex].func; + postHookFunc(&reload); + } + } + return; +} +int HP_script_parse_cleanup_timer(int tid, int64 tick, int id, intptr_t data) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_script_parse_cleanup_timer_pre ) { + int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_parse_cleanup_timer_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_parse_cleanup_timer_pre[hIndex].func; + retVal___ = preHookFunc(&tid, &tick, &id, &data); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.parse_cleanup_timer(tid, tick, id, data); + } + if( HPMHooks.count.HP_script_parse_cleanup_timer_post ) { + int (*postHookFunc) (int retVal___, int *tid, int64 *tick, int *id, intptr_t *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_parse_cleanup_timer_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_parse_cleanup_timer_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &tid, &tick, &id, &data); + } + } + return retVal___; +} +uint8 HP_script_add_language(const char *name) { + int hIndex = 0; + uint8 retVal___ = 0; + if( HPMHooks.count.HP_script_add_language_pre ) { + uint8 (*preHookFunc) (const char *name); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_add_language_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_add_language_pre[hIndex].func; + retVal___ = preHookFunc(name); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.add_language(name); + } + if( HPMHooks.count.HP_script_add_language_post ) { + uint8 (*postHookFunc) (uint8 retVal___, const char *name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_add_language_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_add_language_post[hIndex].func; + retVal___ = postHookFunc(retVal___, name); + } + } + return retVal___; +} +const char* HP_script_get_translation_file_name(const char *file) { + int hIndex = 0; + const char* retVal___ = NULL; + if( HPMHooks.count.HP_script_get_translation_file_name_pre ) { + const char* (*preHookFunc) (const char *file); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_file_name_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_get_translation_file_name_pre[hIndex].func; + retVal___ = preHookFunc(file); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.get_translation_file_name(file); + } + if( HPMHooks.count.HP_script_get_translation_file_name_post ) { + const char* (*postHookFunc) (const char* retVal___, const char *file); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_file_name_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_get_translation_file_name_post[hIndex].func; + retVal___ = postHookFunc(retVal___, file); + } + } + return retVal___; +} +void HP_script_parser_clean_leftovers(void) { + int hIndex = 0; + if( HPMHooks.count.HP_script_parser_clean_leftovers_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_parser_clean_leftovers_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_parser_clean_leftovers_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.script.parser_clean_leftovers(); + } + if( HPMHooks.count.HP_script_parser_clean_leftovers_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_parser_clean_leftovers_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_parser_clean_leftovers_post[hIndex].func; + postHookFunc(); + } + } + return; +} /* searchstore */ bool HP_searchstore_open(struct map_session_data *sd, unsigned int uses, unsigned short effect) { int hIndex = 0; |