diff options
author | Hercules.ws <Hercules@efficiently.awesome> | 2013-11-15 02:01:27 +0100 |
---|---|---|
committer | HerculesWSAPI <Hercules@efficiently.awesome> | 2013-11-15 02:01:27 +0100 |
commit | 769ac1a193764055c64786064dc36669f11c6d9d (patch) | |
tree | f69315a32e17497a77c8f17585ccbebb6c4ca685 /src/plugins | |
parent | 9928044bdbdf734a2edc26c10f9ca5d2c3ee2d89 (diff) | |
download | hercules-769ac1a193764055c64786064dc36669f11c6d9d.tar.gz hercules-769ac1a193764055c64786064dc36669f11c6d9d.tar.bz2 hercules-769ac1a193764055c64786064dc36669f11c6d9d.tar.xz hercules-769ac1a193764055c64786064dc36669f11c6d9d.zip |
HPM Hooks Update
Signed-off-by: HerculesWSAPI <Hercules@efficiently.awesome>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc | 24 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.HookingPoints.inc | 6 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Hooks.inc | 144 |
3 files changed, 118 insertions, 56 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc index fc3163972..ebc69aae4 100644 --- a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc @@ -2459,8 +2459,6 @@ struct { struct HPMHookPoint *HP_itemdb_load_post; struct HPMHookPoint *HP_itemdb_search_pre; struct HPMHookPoint *HP_itemdb_search_post; - struct HPMHookPoint *HP_itemdb_parse_dbrow_pre; - struct HPMHookPoint *HP_itemdb_parse_dbrow_post; struct HPMHookPoint *HP_itemdb_exists_pre; struct HPMHookPoint *HP_itemdb_exists_post; struct HPMHookPoint *HP_itemdb_in_group_pre; @@ -2535,8 +2533,12 @@ struct { struct HPMHookPoint *HP_itemdb_read_combos_post; struct HPMHookPoint *HP_itemdb_gendercheck_pre; struct HPMHookPoint *HP_itemdb_gendercheck_post; - struct HPMHookPoint *HP_itemdb_re_split_atoi_pre; - struct HPMHookPoint *HP_itemdb_re_split_atoi_post; + struct HPMHookPoint *HP_itemdb_validate_entry_pre; + struct HPMHookPoint *HP_itemdb_validate_entry_post; + struct HPMHookPoint *HP_itemdb_readdb_sql_sub_pre; + struct HPMHookPoint *HP_itemdb_readdb_sql_sub_post; + struct HPMHookPoint *HP_itemdb_readdb_libconfig_sub_pre; + struct HPMHookPoint *HP_itemdb_readdb_libconfig_sub_post; struct HPMHookPoint *HP_itemdb_readdb_pre; struct HPMHookPoint *HP_itemdb_readdb_post; struct HPMHookPoint *HP_itemdb_read_sqldb_pre; @@ -2551,6 +2553,8 @@ struct { struct HPMHookPoint *HP_itemdb_destroy_item_data_post; struct HPMHookPoint *HP_itemdb_final_sub_pre; struct HPMHookPoint *HP_itemdb_final_sub_post; + struct HPMHookPoint *HP_itemdb_clear_pre; + struct HPMHookPoint *HP_itemdb_clear_post; struct HPMHookPoint *HP_logs_pick_pc_pre; struct HPMHookPoint *HP_logs_pick_pc_post; struct HPMHookPoint *HP_logs_pick_mob_pre; @@ -7406,8 +7410,6 @@ struct { int HP_itemdb_load_post; int HP_itemdb_search_pre; int HP_itemdb_search_post; - int HP_itemdb_parse_dbrow_pre; - int HP_itemdb_parse_dbrow_post; int HP_itemdb_exists_pre; int HP_itemdb_exists_post; int HP_itemdb_in_group_pre; @@ -7482,8 +7484,12 @@ struct { int HP_itemdb_read_combos_post; int HP_itemdb_gendercheck_pre; int HP_itemdb_gendercheck_post; - int HP_itemdb_re_split_atoi_pre; - int HP_itemdb_re_split_atoi_post; + int HP_itemdb_validate_entry_pre; + int HP_itemdb_validate_entry_post; + int HP_itemdb_readdb_sql_sub_pre; + int HP_itemdb_readdb_sql_sub_post; + int HP_itemdb_readdb_libconfig_sub_pre; + int HP_itemdb_readdb_libconfig_sub_post; int HP_itemdb_readdb_pre; int HP_itemdb_readdb_post; int HP_itemdb_read_sqldb_pre; @@ -7498,6 +7504,8 @@ struct { int HP_itemdb_destroy_item_data_post; int HP_itemdb_final_sub_pre; int HP_itemdb_final_sub_post; + int HP_itemdb_clear_pre; + int HP_itemdb_clear_post; int HP_logs_pick_pc_pre; int HP_logs_pick_pc_post; int HP_logs_pick_mob_pre; diff --git a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc index 446fcbd18..6cd3d4702 100644 --- a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc @@ -1248,7 +1248,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(itemdb->search_name_array, HP_itemdb_search_name_array) }, { HP_POP(itemdb->load, HP_itemdb_load) }, { HP_POP(itemdb->search, HP_itemdb_search) }, - { HP_POP(itemdb->parse_dbrow, HP_itemdb_parse_dbrow) }, { HP_POP(itemdb->exists, HP_itemdb_exists) }, { HP_POP(itemdb->in_group, HP_itemdb_in_group) }, { HP_POP(itemdb->group_item, HP_itemdb_group_item) }, @@ -1286,7 +1285,9 @@ struct HookingPointData HookingPoints[] = { { HP_POP(itemdb->combo_split_atoi, HP_itemdb_combo_split_atoi) }, { HP_POP(itemdb->read_combos, HP_itemdb_read_combos) }, { HP_POP(itemdb->gendercheck, HP_itemdb_gendercheck) }, - { HP_POP(itemdb->re_split_atoi, HP_itemdb_re_split_atoi) }, + { HP_POP(itemdb->validate_entry, HP_itemdb_validate_entry) }, + { HP_POP(itemdb->readdb_sql_sub, HP_itemdb_readdb_sql_sub) }, + { HP_POP(itemdb->readdb_libconfig_sub, HP_itemdb_readdb_libconfig_sub) }, { HP_POP(itemdb->readdb, HP_itemdb_readdb) }, { HP_POP(itemdb->read_sqldb, HP_itemdb_read_sqldb) }, { HP_POP(itemdb->unique_id, HP_itemdb_unique_id) }, @@ -1294,6 +1295,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(itemdb->read, HP_itemdb_read) }, { HP_POP(itemdb->destroy_item_data, HP_itemdb_destroy_item_data) }, { HP_POP(itemdb->final_sub, HP_itemdb_final_sub) }, + { HP_POP(itemdb->clear, HP_itemdb_clear) }, /* logs */ { HP_POP(logs->pick_pc, HP_logs_pick_pc) }, { HP_POP(logs->pick_mob, HP_logs_pick_mob) }, diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc index 354e13cd8..b6793f48f 100644 --- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc @@ -31329,32 +31329,6 @@ struct item_data* HP_itemdb_search(int nameid) { } return retVal___; } -int HP_itemdb_parse_dbrow(char **str, const char *source, int line, int scriptopt) { - int hIndex = 0; - int retVal___ = 0; - if( HPMHooks.count.HP_itemdb_parse_dbrow_pre ) { - int (*preHookFunc) (char **str, const char *source, int *line, int *scriptopt); - for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_parse_dbrow_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_itemdb_parse_dbrow_pre[hIndex].func; - retVal___ = preHookFunc(str, source, &line, &scriptopt); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.itemdb.parse_dbrow(str, source, line, scriptopt); - } - if( HPMHooks.count.HP_itemdb_parse_dbrow_post ) { - int (*postHookFunc) (int retVal___, char **str, const char *source, int *line, int *scriptopt); - for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_parse_dbrow_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_itemdb_parse_dbrow_post[hIndex].func; - retVal___ = postHookFunc(retVal___, str, source, &line, &scriptopt); - } - } - return retVal___; -} struct item_data* HP_itemdb_exists(int nameid) { int hIndex = 0; struct item_data* retVal___ = NULL; @@ -32325,39 +32299,92 @@ int HP_itemdb_gendercheck(struct item_data *id) { } return retVal___; } -void HP_itemdb_re_split_atoi(char *str, int *atk, int *matk) { +int HP_itemdb_validate_entry(struct item_data *entry, int n, const char *source) { int hIndex = 0; - if( HPMHooks.count.HP_itemdb_re_split_atoi_pre ) { - void (*preHookFunc) (char *str, int *atk, int *matk); - for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_re_split_atoi_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_itemdb_re_split_atoi_pre[hIndex].func; - preHookFunc(str, atk, matk); + int retVal___ = 0; + if( HPMHooks.count.HP_itemdb_validate_entry_pre ) { + int (*preHookFunc) (struct item_data *entry, int *n, const char *source); + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_validate_entry_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_itemdb_validate_entry_pre[hIndex].func; + retVal___ = preHookFunc(entry, &n, source); } if( *HPMforce_return ) { *HPMforce_return = false; - return; + return retVal___; } } { - HPMHooks.source.itemdb.re_split_atoi(str, atk, matk); + retVal___ = HPMHooks.source.itemdb.validate_entry(entry, n, source); } - if( HPMHooks.count.HP_itemdb_re_split_atoi_post ) { - void (*postHookFunc) (char *str, int *atk, int *matk); - for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_re_split_atoi_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_itemdb_re_split_atoi_post[hIndex].func; - postHookFunc(str, atk, matk); + if( HPMHooks.count.HP_itemdb_validate_entry_post ) { + int (*postHookFunc) (int retVal___, struct item_data *entry, int *n, const char *source); + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_validate_entry_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_itemdb_validate_entry_post[hIndex].func; + retVal___ = postHookFunc(retVal___, entry, &n, source); } } - return; + return retVal___; +} +int HP_itemdb_readdb_sql_sub(Sql *handle, int n, const char *source) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_itemdb_readdb_sql_sub_pre ) { + int (*preHookFunc) (Sql *handle, int *n, const char *source); + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_sql_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_itemdb_readdb_sql_sub_pre[hIndex].func; + retVal___ = preHookFunc(handle, &n, source); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.itemdb.readdb_sql_sub(handle, n, source); + } + if( HPMHooks.count.HP_itemdb_readdb_sql_sub_post ) { + int (*postHookFunc) (int retVal___, Sql *handle, int *n, const char *source); + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_sql_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_itemdb_readdb_sql_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, handle, &n, source); + } + } + return retVal___; +} +int HP_itemdb_readdb_libconfig_sub(config_setting_t *it, int n, const char *source) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_itemdb_readdb_libconfig_sub_pre ) { + int (*preHookFunc) (config_setting_t *it, int *n, const char *source); + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_libconfig_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_itemdb_readdb_libconfig_sub_pre[hIndex].func; + retVal___ = preHookFunc(it, &n, source); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.itemdb.readdb_libconfig_sub(it, n, source); + } + if( HPMHooks.count.HP_itemdb_readdb_libconfig_sub_post ) { + int (*postHookFunc) (int retVal___, config_setting_t *it, int *n, const char *source); + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_libconfig_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_itemdb_readdb_libconfig_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, it, &n, source); + } + } + return retVal___; } -int HP_itemdb_readdb(void) { +int HP_itemdb_readdb(const char *filename) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_itemdb_readdb_pre ) { - int (*preHookFunc) (void); + int (*preHookFunc) (const char *filename); for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_itemdb_readdb_pre[hIndex].func; - retVal___ = preHookFunc(); + retVal___ = preHookFunc(filename); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -32365,13 +32392,13 @@ int HP_itemdb_readdb(void) { } } { - retVal___ = HPMHooks.source.itemdb.readdb(); + retVal___ = HPMHooks.source.itemdb.readdb(filename); } if( HPMHooks.count.HP_itemdb_readdb_post ) { - int (*postHookFunc) (int retVal___); + int (*postHookFunc) (int retVal___, const char *filename); for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_itemdb_readdb_post[hIndex].func; - retVal___ = postHookFunc(retVal___); + retVal___ = postHookFunc(retVal___, filename); } } return retVal___; @@ -32536,6 +32563,31 @@ int HP_itemdb_final_sub(DBKey key, DBData *data, va_list ap) { } return retVal___; } +void HP_itemdb_clear(bool total) { + int hIndex = 0; + if( HPMHooks.count.HP_itemdb_clear_pre ) { + void (*preHookFunc) (bool *total); + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_clear_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_itemdb_clear_pre[hIndex].func; + preHookFunc(&total); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.itemdb.clear(total); + } + if( HPMHooks.count.HP_itemdb_clear_post ) { + void (*postHookFunc) (bool *total); + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_clear_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_itemdb_clear_post[hIndex].func; + postHookFunc(&total); + } + } + return; +} /* logs */ void HP_logs_pick_pc(struct map_session_data *sd, e_log_pick_type type, int amount, struct item *itm, struct item_data *data) { int hIndex = 0; |