From d966a8e6860d418bb3a235e57928436127eba555 Mon Sep 17 00:00:00 2001 From: smokexyz Date: Mon, 22 May 2017 20:51:25 +0800 Subject: HPM Hook Update follow-up e8affc41f106503b530abaa7faa20d6e63b727b8 --- src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 185 ++++++++++++++++++++++- 1 file changed, 179 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 d2853fcdc..656fd8e07 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -8032,15 +8032,81 @@ int HP_inter_quest_parse_frommap(int fd) { return retVal___; } /* inter_storage_interface */ -int HP_inter_storage_tosql(int account_id, struct storage_data *p) { +struct DBData HP_inter_storage_ensure_account_storage(union DBKey key, va_list args) { + int hIndex = 0; + struct DBData retVal___ = { 0 }; + if (HPMHooks.count.HP_inter_storage_ensure_account_storage_pre > 0) { + struct DBData (*preHookFunc) (union DBKey *key, va_list args); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_ensure_account_storage_pre; hIndex++) { + va_list args___copy; va_copy(args___copy, args); + preHookFunc = HPMHooks.list.HP_inter_storage_ensure_account_storage_pre[hIndex].func; + retVal___ = preHookFunc(&key, 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.inter_storage.ensure_account_storage(key, args___copy); + va_end(args___copy); + } + if (HPMHooks.count.HP_inter_storage_ensure_account_storage_post > 0) { + struct DBData (*postHookFunc) (struct DBData retVal___, union DBKey key, va_list args); + for (hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_ensure_account_storage_post; hIndex++) { + va_list args___copy; va_copy(args___copy, args); + postHookFunc = HPMHooks.list.HP_inter_storage_ensure_account_storage_post[hIndex].func; + retVal___ = postHookFunc(retVal___, key, args___copy); + va_end(args___copy); + } + } + return retVal___; +} +int HP_inter_storage_clear_account_storage(union DBKey key, struct DBData *data, va_list args) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_inter_storage_clear_account_storage_pre > 0) { + int (*preHookFunc) (union DBKey *key, struct DBData **data, va_list args); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_clear_account_storage_pre; hIndex++) { + va_list args___copy; va_copy(args___copy, args); + preHookFunc = HPMHooks.list.HP_inter_storage_clear_account_storage_pre[hIndex].func; + retVal___ = preHookFunc(&key, &data, 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.inter_storage.clear_account_storage(key, data, args___copy); + va_end(args___copy); + } + if (HPMHooks.count.HP_inter_storage_clear_account_storage_post > 0) { + int (*postHookFunc) (int retVal___, union DBKey key, struct DBData *data, va_list args); + for (hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_clear_account_storage_post; hIndex++) { + va_list args___copy; va_copy(args___copy, args); + postHookFunc = HPMHooks.list.HP_inter_storage_clear_account_storage_post[hIndex].func; + retVal___ = postHookFunc(retVal___, key, data, args___copy); + va_end(args___copy); + } + } + return retVal___; +} +int HP_inter_storage_tosql(int account_id, struct storage_data *cp, const struct storage_data *p) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_inter_storage_tosql_pre > 0) { - int (*preHookFunc) (int *account_id, struct storage_data **p); + int (*preHookFunc) (int *account_id, struct storage_data **cp, const struct storage_data **p); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_tosql_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_inter_storage_tosql_pre[hIndex].func; - retVal___ = preHookFunc(&account_id, &p); + retVal___ = preHookFunc(&account_id, &cp, &p); } if (*HPMforce_return) { *HPMforce_return = false; @@ -8048,13 +8114,13 @@ int HP_inter_storage_tosql(int account_id, struct storage_data *p) { } } { - retVal___ = HPMHooks.source.inter_storage.tosql(account_id, p); + retVal___ = HPMHooks.source.inter_storage.tosql(account_id, cp, p); } if (HPMHooks.count.HP_inter_storage_tosql_post > 0) { - int (*postHookFunc) (int retVal___, int account_id, struct storage_data *p); + int (*postHookFunc) (int retVal___, int account_id, struct storage_data *cp, const struct storage_data *p); for (hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_tosql_post; hIndex++) { postHookFunc = HPMHooks.list.HP_inter_storage_tosql_post[hIndex].func; - retVal___ = postHookFunc(retVal___, account_id, p); + retVal___ = postHookFunc(retVal___, account_id, cp, p); } } return retVal___; @@ -14430,6 +14496,113 @@ int HP_mapif_parse_SaveGuildStorage(int fd) { } return retVal___; } +int HP_mapif_account_storage_load(int fd, int account_id) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_mapif_account_storage_load_pre > 0) { + int (*preHookFunc) (int *fd, int *account_id); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_mapif_account_storage_load_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_mapif_account_storage_load_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.account_storage_load(fd, account_id); + } + if (HPMHooks.count.HP_mapif_account_storage_load_post > 0) { + int (*postHookFunc) (int retVal___, int fd, int account_id); + for (hIndex = 0; hIndex < HPMHooks.count.HP_mapif_account_storage_load_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_mapif_account_storage_load_post[hIndex].func; + retVal___ = postHookFunc(retVal___, fd, account_id); + } + } + return retVal___; +} +int HP_mapif_pAccountStorageLoad(int fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_mapif_pAccountStorageLoad_pre > 0) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_mapif_pAccountStorageLoad_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_mapif_pAccountStorageLoad_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.pAccountStorageLoad(fd); + } + if (HPMHooks.count.HP_mapif_pAccountStorageLoad_post > 0) { + int (*postHookFunc) (int retVal___, int fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_mapif_pAccountStorageLoad_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_mapif_pAccountStorageLoad_post[hIndex].func; + retVal___ = postHookFunc(retVal___, fd); + } + } + return retVal___; +} +int HP_mapif_pAccountStorageSave(int fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_mapif_pAccountStorageSave_pre > 0) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_mapif_pAccountStorageSave_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_mapif_pAccountStorageSave_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.pAccountStorageSave(fd); + } + if (HPMHooks.count.HP_mapif_pAccountStorageSave_post > 0) { + int (*postHookFunc) (int retVal___, int fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_mapif_pAccountStorageSave_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_mapif_pAccountStorageSave_post[hIndex].func; + retVal___ = postHookFunc(retVal___, fd); + } + } + return retVal___; +} +void HP_mapif_sAccountStorageSaveAck(int fd, int account_id, bool save) { + int hIndex = 0; + if (HPMHooks.count.HP_mapif_sAccountStorageSaveAck_pre > 0) { + void (*preHookFunc) (int *fd, int *account_id, bool *save); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_mapif_sAccountStorageSaveAck_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_mapif_sAccountStorageSaveAck_pre[hIndex].func; + preHookFunc(&fd, &account_id, &save); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.sAccountStorageSaveAck(fd, account_id, save); + } + if (HPMHooks.count.HP_mapif_sAccountStorageSaveAck_post > 0) { + void (*postHookFunc) (int fd, int account_id, bool save); + for (hIndex = 0; hIndex < HPMHooks.count.HP_mapif_sAccountStorageSaveAck_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_mapif_sAccountStorageSaveAck_post[hIndex].func; + postHookFunc(fd, account_id, save); + } + } + return; +} int HP_mapif_itembound_ack(int fd, int aid, int guild_id) { int hIndex = 0; int retVal___ = 0; -- cgit v1.2.3-70-g09d2