From 1484c482951f2736a65b0e0735795d7ac4687b7c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 Oct 2015 19:05:28 +0300 Subject: Update HPM hooks. --- .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 48 +++- .../HPMHooking/HPMHooking_map.HookingPoints.inc | 12 +- src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 254 +++++++++++++++++---- 3 files changed, 251 insertions(+), 63 deletions(-) (limited to 'src/plugins/HPMHooking') diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index f36d91718..b7973cd59 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -3439,14 +3439,26 @@ struct { struct HPMHookPoint *HP_mob_drop_adjust_post; struct HPMHookPoint *HP_mob_item_dropratio_adjust_pre; struct HPMHookPoint *HP_mob_item_dropratio_adjust_post; - struct HPMHookPoint *HP_mob_parse_dbrow_pre; - struct HPMHookPoint *HP_mob_parse_dbrow_post; - struct HPMHookPoint *HP_mob_readdb_sub_pre; - struct HPMHookPoint *HP_mob_readdb_sub_post; struct HPMHookPoint *HP_mob_readdb_pre; struct HPMHookPoint *HP_mob_readdb_post; - struct HPMHookPoint *HP_mob_read_sqldb_pre; - struct HPMHookPoint *HP_mob_read_sqldb_post; + struct HPMHookPoint *HP_mob_lookup_const_pre; + struct HPMHookPoint *HP_mob_lookup_const_post; + struct HPMHookPoint *HP_mob_get_const_pre; + struct HPMHookPoint *HP_mob_get_const_post; + struct HPMHookPoint *HP_mob_read_libconfig_pre; + struct HPMHookPoint *HP_mob_read_libconfig_post; + struct HPMHookPoint *HP_mob_read_db_additional_fields_pre; + struct HPMHookPoint *HP_mob_read_db_additional_fields_post; + struct HPMHookPoint *HP_mob_read_db_sub_pre; + struct HPMHookPoint *HP_mob_read_db_sub_post; + struct HPMHookPoint *HP_mob_read_db_drops_sub_pre; + struct HPMHookPoint *HP_mob_read_db_drops_sub_post; + struct HPMHookPoint *HP_mob_read_db_mvpdrops_sub_pre; + struct HPMHookPoint *HP_mob_read_db_mvpdrops_sub_post; + struct HPMHookPoint *HP_mob_read_db_mode_sub_pre; + struct HPMHookPoint *HP_mob_read_db_mode_sub_post; + struct HPMHookPoint *HP_mob_read_db_stats_sub_pre; + struct HPMHookPoint *HP_mob_read_db_stats_sub_post; struct HPMHookPoint *HP_mob_name_constants_pre; struct HPMHookPoint *HP_mob_name_constants_post; struct HPMHookPoint *HP_mob_readdb_mobavail_pre; @@ -9198,14 +9210,26 @@ struct { int HP_mob_drop_adjust_post; int HP_mob_item_dropratio_adjust_pre; int HP_mob_item_dropratio_adjust_post; - int HP_mob_parse_dbrow_pre; - int HP_mob_parse_dbrow_post; - int HP_mob_readdb_sub_pre; - int HP_mob_readdb_sub_post; int HP_mob_readdb_pre; int HP_mob_readdb_post; - int HP_mob_read_sqldb_pre; - int HP_mob_read_sqldb_post; + int HP_mob_lookup_const_pre; + int HP_mob_lookup_const_post; + int HP_mob_get_const_pre; + int HP_mob_get_const_post; + int HP_mob_read_libconfig_pre; + int HP_mob_read_libconfig_post; + int HP_mob_read_db_additional_fields_pre; + int HP_mob_read_db_additional_fields_post; + int HP_mob_read_db_sub_pre; + int HP_mob_read_db_sub_post; + int HP_mob_read_db_drops_sub_pre; + int HP_mob_read_db_drops_sub_post; + int HP_mob_read_db_mvpdrops_sub_pre; + int HP_mob_read_db_mvpdrops_sub_post; + int HP_mob_read_db_mode_sub_pre; + int HP_mob_read_db_mode_sub_post; + int HP_mob_read_db_stats_sub_pre; + int HP_mob_read_db_stats_sub_post; int HP_mob_name_constants_pre; int HP_mob_name_constants_post; int HP_mob_readdb_mobavail_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index dacb51580..3ecb82965 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1754,10 +1754,16 @@ struct HookingPointData HookingPoints[] = { { HP_POP(mob->clone_delete, HP_mob_clone_delete) }, { HP_POP(mob->drop_adjust, HP_mob_drop_adjust) }, { HP_POP(mob->item_dropratio_adjust, HP_mob_item_dropratio_adjust) }, - { HP_POP(mob->parse_dbrow, HP_mob_parse_dbrow) }, - { HP_POP(mob->readdb_sub, HP_mob_readdb_sub) }, { HP_POP(mob->readdb, HP_mob_readdb) }, - { HP_POP(mob->read_sqldb, HP_mob_read_sqldb) }, + { HP_POP(mob->lookup_const, HP_mob_lookup_const) }, + { HP_POP(mob->get_const, HP_mob_get_const) }, + { HP_POP(mob->read_libconfig, HP_mob_read_libconfig) }, + { HP_POP(mob->read_db_additional_fields, HP_mob_read_db_additional_fields) }, + { HP_POP(mob->read_db_sub, HP_mob_read_db_sub) }, + { HP_POP(mob->read_db_drops_sub, HP_mob_read_db_drops_sub) }, + { HP_POP(mob->read_db_mvpdrops_sub, HP_mob_read_db_mvpdrops_sub) }, + { HP_POP(mob->read_db_mode_sub, HP_mob_read_db_mode_sub) }, + { HP_POP(mob->read_db_stats_sub, HP_mob_read_db_stats_sub) }, { HP_POP(mob->name_constants, HP_mob_name_constants) }, { HP_POP(mob->readdb_mobavail, HP_mob_readdb_mobavail) }, { HP_POP(mob->read_randommonster, HP_mob_read_randommonster) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 7ae0d9d48..b05525734 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -45921,15 +45921,41 @@ void HP_mob_item_dropratio_adjust(int nameid, int mob_id, int *rate_adjust) { } return; } -bool HP_mob_parse_dbrow(char **str) { +void HP_mob_readdb(void) { + int hIndex = 0; + if( HPMHooks.count.HP_mob_readdb_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_readdb_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mob_readdb_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mob.readdb(); + } + if( HPMHooks.count.HP_mob_readdb_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_readdb_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mob_readdb_post[hIndex].func; + postHookFunc(); + } + } + return; +} +bool HP_mob_lookup_const(const config_setting_t *it, const char *name, int *value) { int hIndex = 0; bool retVal___ = false; - if( HPMHooks.count.HP_mob_parse_dbrow_pre ) { - bool (*preHookFunc) (char **str); + if( HPMHooks.count.HP_mob_lookup_const_pre ) { + bool (*preHookFunc) (const config_setting_t *it, const char *name, int *value); *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_parse_dbrow_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_mob_parse_dbrow_pre[hIndex].func; - retVal___ = preHookFunc(str); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_lookup_const_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mob_lookup_const_pre[hIndex].func; + retVal___ = preHookFunc(it, name, value); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -45937,26 +45963,26 @@ bool HP_mob_parse_dbrow(char **str) { } } { - retVal___ = HPMHooks.source.mob.parse_dbrow(str); + retVal___ = HPMHooks.source.mob.lookup_const(it, name, value); } - if( HPMHooks.count.HP_mob_parse_dbrow_post ) { - bool (*postHookFunc) (bool retVal___, char **str); - for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_parse_dbrow_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_mob_parse_dbrow_post[hIndex].func; - retVal___ = postHookFunc(retVal___, str); + if( HPMHooks.count.HP_mob_lookup_const_post ) { + bool (*postHookFunc) (bool retVal___, const config_setting_t *it, const char *name, int *value); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_lookup_const_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mob_lookup_const_post[hIndex].func; + retVal___ = postHookFunc(retVal___, it, name, value); } } return retVal___; } -bool HP_mob_readdb_sub(char *fields[], int columns, int current) { +bool HP_mob_get_const(const config_setting_t *it, int *value) { int hIndex = 0; bool retVal___ = false; - if( HPMHooks.count.HP_mob_readdb_sub_pre ) { - bool (*preHookFunc) (char *fields[], int *columns, int *current); + if( HPMHooks.count.HP_mob_get_const_pre ) { + bool (*preHookFunc) (const config_setting_t *it, int *value); *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_readdb_sub_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_mob_readdb_sub_pre[hIndex].func; - retVal___ = preHookFunc(fields, &columns, ¤t); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_get_const_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mob_get_const_pre[hIndex].func; + retVal___ = preHookFunc(it, value); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -45964,25 +45990,52 @@ bool HP_mob_readdb_sub(char *fields[], int columns, int current) { } } { - retVal___ = HPMHooks.source.mob.readdb_sub(fields, columns, current); + retVal___ = HPMHooks.source.mob.get_const(it, value); } - if( HPMHooks.count.HP_mob_readdb_sub_post ) { - bool (*postHookFunc) (bool retVal___, char *fields[], int *columns, int *current); - for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_readdb_sub_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_mob_readdb_sub_post[hIndex].func; - retVal___ = postHookFunc(retVal___, fields, &columns, ¤t); + if( HPMHooks.count.HP_mob_get_const_post ) { + bool (*postHookFunc) (bool retVal___, const config_setting_t *it, int *value); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_get_const_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mob_get_const_post[hIndex].func; + retVal___ = postHookFunc(retVal___, it, value); } } return retVal___; } -void HP_mob_readdb(void) { +int HP_mob_read_libconfig(const char *filename) { int hIndex = 0; - if( HPMHooks.count.HP_mob_readdb_pre ) { - void (*preHookFunc) (void); + int retVal___ = 0; + if( HPMHooks.count.HP_mob_read_libconfig_pre ) { + int (*preHookFunc) (const char *filename); *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_readdb_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_mob_readdb_pre[hIndex].func; - preHookFunc(); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_libconfig_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mob_read_libconfig_pre[hIndex].func; + retVal___ = preHookFunc(filename); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mob.read_libconfig(filename); + } + if( HPMHooks.count.HP_mob_read_libconfig_post ) { + int (*postHookFunc) (int retVal___, const char *filename); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_libconfig_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mob_read_libconfig_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename); + } + } + return retVal___; +} +void HP_mob_read_db_additional_fields(struct mob_db *entry, int class_, config_setting_t *it, int n, const char *source) { + int hIndex = 0; + if( HPMHooks.count.HP_mob_read_db_additional_fields_pre ) { + void (*preHookFunc) (struct mob_db *entry, int *class_, config_setting_t *it, int *n, const char *source); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_additional_fields_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mob_read_db_additional_fields_pre[hIndex].func; + preHookFunc(entry, &class_, it, &n, source); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -45990,26 +46043,105 @@ void HP_mob_readdb(void) { } } { - HPMHooks.source.mob.readdb(); + HPMHooks.source.mob.read_db_additional_fields(entry, class_, it, n, source); } - if( HPMHooks.count.HP_mob_readdb_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_readdb_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_mob_readdb_post[hIndex].func; - postHookFunc(); + if( HPMHooks.count.HP_mob_read_db_additional_fields_post ) { + void (*postHookFunc) (struct mob_db *entry, int *class_, config_setting_t *it, int *n, const char *source); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_additional_fields_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mob_read_db_additional_fields_post[hIndex].func; + postHookFunc(entry, &class_, it, &n, source); + } + } + return; +} +bool HP_mob_read_db_sub(config_setting_t *mobt, int id, const char *source) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mob_read_db_sub_pre ) { + bool (*preHookFunc) (config_setting_t *mobt, int *id, const char *source); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mob_read_db_sub_pre[hIndex].func; + retVal___ = preHookFunc(mobt, &id, source); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mob.read_db_sub(mobt, id, source); + } + if( HPMHooks.count.HP_mob_read_db_sub_post ) { + bool (*postHookFunc) (bool retVal___, config_setting_t *mobt, int *id, const char *source); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mob_read_db_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, mobt, &id, source); + } + } + return retVal___; +} +void HP_mob_read_db_drops_sub(struct mob_db *entry, struct status_data *mstatus, int class_, config_setting_t *t) { + int hIndex = 0; + if( HPMHooks.count.HP_mob_read_db_drops_sub_pre ) { + void (*preHookFunc) (struct mob_db *entry, struct status_data *mstatus, int *class_, config_setting_t *t); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_drops_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mob_read_db_drops_sub_pre[hIndex].func; + preHookFunc(entry, mstatus, &class_, t); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mob.read_db_drops_sub(entry, mstatus, class_, t); + } + if( HPMHooks.count.HP_mob_read_db_drops_sub_post ) { + void (*postHookFunc) (struct mob_db *entry, struct status_data *mstatus, int *class_, config_setting_t *t); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_drops_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mob_read_db_drops_sub_post[hIndex].func; + postHookFunc(entry, mstatus, &class_, t); } } return; } -int HP_mob_read_sqldb(void) { +void HP_mob_read_db_mvpdrops_sub(struct mob_db *entry, struct status_data *mstatus, int class_, config_setting_t *t) { + int hIndex = 0; + if( HPMHooks.count.HP_mob_read_db_mvpdrops_sub_pre ) { + void (*preHookFunc) (struct mob_db *entry, struct status_data *mstatus, int *class_, config_setting_t *t); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_mvpdrops_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mob_read_db_mvpdrops_sub_pre[hIndex].func; + preHookFunc(entry, mstatus, &class_, t); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mob.read_db_mvpdrops_sub(entry, mstatus, class_, t); + } + if( HPMHooks.count.HP_mob_read_db_mvpdrops_sub_post ) { + void (*postHookFunc) (struct mob_db *entry, struct status_data *mstatus, int *class_, config_setting_t *t); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_mvpdrops_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mob_read_db_mvpdrops_sub_post[hIndex].func; + postHookFunc(entry, mstatus, &class_, t); + } + } + return; +} +int HP_mob_read_db_mode_sub(struct mob_db *entry, struct status_data *mstatus, int class_, config_setting_t *t) { int hIndex = 0; int retVal___ = 0; - if( HPMHooks.count.HP_mob_read_sqldb_pre ) { - int (*preHookFunc) (void); + if( HPMHooks.count.HP_mob_read_db_mode_sub_pre ) { + int (*preHookFunc) (struct mob_db *entry, struct status_data *mstatus, int *class_, config_setting_t *t); *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_sqldb_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_mob_read_sqldb_pre[hIndex].func; - retVal___ = preHookFunc(); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_mode_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mob_read_db_mode_sub_pre[hIndex].func; + retVal___ = preHookFunc(entry, mstatus, &class_, t); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -46017,17 +46149,43 @@ int HP_mob_read_sqldb(void) { } } { - retVal___ = HPMHooks.source.mob.read_sqldb(); + retVal___ = HPMHooks.source.mob.read_db_mode_sub(entry, mstatus, class_, t); } - if( HPMHooks.count.HP_mob_read_sqldb_post ) { - int (*postHookFunc) (int retVal___); - for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_sqldb_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_mob_read_sqldb_post[hIndex].func; - retVal___ = postHookFunc(retVal___); + if( HPMHooks.count.HP_mob_read_db_mode_sub_post ) { + int (*postHookFunc) (int retVal___, struct mob_db *entry, struct status_data *mstatus, int *class_, config_setting_t *t); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_mode_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mob_read_db_mode_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, entry, mstatus, &class_, t); } } return retVal___; } +void HP_mob_read_db_stats_sub(struct mob_db *entry, struct status_data *mstatus, int class_, config_setting_t *t) { + int hIndex = 0; + if( HPMHooks.count.HP_mob_read_db_stats_sub_pre ) { + void (*preHookFunc) (struct mob_db *entry, struct status_data *mstatus, int *class_, config_setting_t *t); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_stats_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mob_read_db_stats_sub_pre[hIndex].func; + preHookFunc(entry, mstatus, &class_, t); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mob.read_db_stats_sub(entry, mstatus, class_, t); + } + if( HPMHooks.count.HP_mob_read_db_stats_sub_post ) { + void (*postHookFunc) (struct mob_db *entry, struct status_data *mstatus, int *class_, config_setting_t *t); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_stats_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mob_read_db_stats_sub_post[hIndex].func; + postHookFunc(entry, mstatus, &class_, t); + } + } + return; +} void HP_mob_name_constants(void) { int hIndex = 0; if( HPMHooks.count.HP_mob_name_constants_pre ) { -- cgit v1.2.3-60-g2f50