From 7569afbe6932e55c6a62f0747ea1e7b5ba3c977e Mon Sep 17 00:00:00 2001 From: Smokexyz Date: Wed, 5 Jul 2017 23:10:59 +0530 Subject: Update HPM Hooking (Follow up 7a2447204644b53e64a730c9c8428cc5b33f5aa2) --- src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 39 ++++++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'src/plugins/HPMHooking/HPMHooking_char.Hooks.inc') diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 96e068903..a2a9fa8e2 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -528,15 +528,42 @@ int HP_chr_mmo_char_tosql(int char_id, struct mmo_charstatus *p) { } return retVal___; } -int HP_chr_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) { +int HP_chr_getitemdata_from_sql(struct item *items, int max, int guid, enum inventory_table_type table) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_chr_getitemdata_from_sql_pre > 0) { + int (*preHookFunc) (struct item **items, int *max, int *guid, enum inventory_table_type *table); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_getitemdata_from_sql_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_chr_getitemdata_from_sql_pre[hIndex].func; + retVal___ = preHookFunc(&items, &max, &guid, &table); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.getitemdata_from_sql(items, max, guid, table); + } + if (HPMHooks.count.HP_chr_getitemdata_from_sql_post > 0) { + int (*postHookFunc) (int retVal___, struct item *items, int max, int guid, enum inventory_table_type table); + for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_getitemdata_from_sql_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_chr_getitemdata_from_sql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, items, max, guid, table); + } + } + return retVal___; +} +int HP_chr_memitemdata_to_sql(const struct item items[], int id, enum inventory_table_type table) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_chr_memitemdata_to_sql_pre > 0) { - int (*preHookFunc) (const struct item *items[], int *max, int *id, int *tableswitch); + int (*preHookFunc) (const struct item *items[], int *id, enum inventory_table_type *table); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_memitemdata_to_sql_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_chr_memitemdata_to_sql_pre[hIndex].func; - retVal___ = preHookFunc(&items, &max, &id, &tableswitch); + retVal___ = preHookFunc(&items, &id, &table); } if (*HPMforce_return) { *HPMforce_return = false; @@ -544,13 +571,13 @@ int HP_chr_memitemdata_to_sql(const struct item items[], int max, int id, int ta } } { - retVal___ = HPMHooks.source.chr.memitemdata_to_sql(items, max, id, tableswitch); + retVal___ = HPMHooks.source.chr.memitemdata_to_sql(items, id, table); } if (HPMHooks.count.HP_chr_memitemdata_to_sql_post > 0) { - int (*postHookFunc) (int retVal___, const struct item items[], int max, int id, int tableswitch); + int (*postHookFunc) (int retVal___, const struct item items[], int id, enum inventory_table_type table); for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_memitemdata_to_sql_post; hIndex++) { postHookFunc = HPMHooks.list.HP_chr_memitemdata_to_sql_post[hIndex].func; - retVal___ = postHookFunc(retVal___, items, max, id, tableswitch); + retVal___ = postHookFunc(retVal___, items, id, table); } } return retVal___; -- cgit v1.2.3-60-g2f50