summaryrefslogtreecommitdiff
path: root/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-04-09 15:24:22 +0200
committerGitHub <noreply@github.com>2017-04-09 15:24:22 +0200
commitdb5a1d0f714fa196e1c026ccb123ac7104af2f75 (patch)
treee399edacc33de1a1954777d5ebfd9b1b6213367e /src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
parent083ed4ad7a30bdc3172b3ef2a66bb257c0c0e70f (diff)
parent974222a8d3f189083205bf5d330de04a43226ad3 (diff)
downloadhercules-db5a1d0f714fa196e1c026ccb123ac7104af2f75.tar.gz
hercules-db5a1d0f714fa196e1c026ccb123ac7104af2f75.tar.bz2
hercules-db5a1d0f714fa196e1c026ccb123ac7104af2f75.tar.xz
hercules-db5a1d0f714fa196e1c026ccb123ac7104af2f75.zip
Merge pull request #1598 from Smokexyz/IRO
Implementation of Item Options System.
Diffstat (limited to 'src/plugins/HPMHooking/HPMHooking_map.Hooks.inc')
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc141
1 files changed, 127 insertions, 14 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 800fb8c76..322d60e46 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -24201,31 +24201,32 @@ void HP_clif_pNPCMarketPurchase(int fd, struct map_session_data *sd) {
}
return;
}
-void HP_clif_add_random_options(unsigned char *buf, struct item *item) {
+int HP_clif_add_item_options(struct ItemOptions *buf, const struct item *it) {
int hIndex = 0;
- if( HPMHooks.count.HP_clif_add_random_options_pre ) {
- void (*preHookFunc) (unsigned char **buf, struct item **item);
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_clif_add_item_options_pre ) {
+ int (*preHookFunc) (struct ItemOptions **buf, const struct item **it);
*HPMforce_return = false;
- for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_add_random_options_pre; hIndex++ ) {
- preHookFunc = HPMHooks.list.HP_clif_add_random_options_pre[hIndex].func;
- preHookFunc(&buf, &item);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_add_item_options_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_clif_add_item_options_pre[hIndex].func;
+ retVal___ = preHookFunc(&buf, &it);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
- return;
+ return retVal___;
}
}
{
- HPMHooks.source.clif.add_random_options(buf, item);
+ retVal___ = HPMHooks.source.clif.add_item_options(buf, it);
}
- if( HPMHooks.count.HP_clif_add_random_options_post ) {
- void (*postHookFunc) (unsigned char *buf, struct item *item);
- for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_add_random_options_post; hIndex++ ) {
- postHookFunc = HPMHooks.list.HP_clif_add_random_options_post[hIndex].func;
- postHookFunc(buf, item);
+ if( HPMHooks.count.HP_clif_add_item_options_post ) {
+ int (*postHookFunc) (int retVal___, struct ItemOptions *buf, const struct item *it);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_add_item_options_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_clif_add_item_options_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, buf, it);
}
}
- return;
+ return retVal___;
}
void HP_clif_pHotkeyRowShift(int fd, struct map_session_data *sd) {
int hIndex = 0;
@@ -35242,6 +35243,32 @@ void HP_itemdb_read_packages(void) {
}
return;
}
+void HP_itemdb_read_options(void) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_itemdb_read_options_pre ) {
+ void (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_options_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_itemdb_read_options_pre[hIndex].func;
+ preHookFunc();
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.itemdb.read_options();
+ }
+ if( HPMHooks.count.HP_itemdb_read_options_post ) {
+ void (*postHookFunc) (void);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_options_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_itemdb_read_options_post[hIndex].func;
+ postHookFunc();
+ }
+ }
+ return;
+}
void HP_itemdb_write_cached_packages(const char *config_filename) {
int hIndex = 0;
if( HPMHooks.count.HP_itemdb_write_cached_packages_pre ) {
@@ -35457,6 +35484,33 @@ struct item_data* HP_itemdb_exists(int nameid) {
}
return retVal___;
}
+struct item_option* HP_itemdb_option_exists(int idx) {
+ int hIndex = 0;
+ struct item_option* retVal___ = NULL;
+ if( HPMHooks.count.HP_itemdb_option_exists_pre ) {
+ struct item_option* (*preHookFunc) (int *idx);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_option_exists_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_itemdb_option_exists_pre[hIndex].func;
+ retVal___ = preHookFunc(&idx);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.itemdb.option_exists(idx);
+ }
+ if( HPMHooks.count.HP_itemdb_option_exists_post ) {
+ struct item_option* (*postHookFunc) (struct item_option* retVal___, int idx);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_option_exists_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_itemdb_option_exists_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, idx);
+ }
+ }
+ return retVal___;
+}
bool HP_itemdb_in_group(struct item_group *group, int nameid) {
int hIndex = 0;
bool retVal___ = false;
@@ -36328,6 +36382,32 @@ int HP_itemdb_validate_entry(struct item_data *entry, int n, const char *source)
}
return retVal___;
}
+void HP_itemdb_readdb_options_additional_fields(struct item_option *ito, struct config_setting_t *t, const char *source) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_itemdb_readdb_options_additional_fields_pre ) {
+ void (*preHookFunc) (struct item_option **ito, struct config_setting_t **t, const char **source);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_options_additional_fields_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_itemdb_readdb_options_additional_fields_pre[hIndex].func;
+ preHookFunc(&ito, &t, &source);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.itemdb.readdb_options_additional_fields(ito, t, source);
+ }
+ if( HPMHooks.count.HP_itemdb_readdb_options_additional_fields_post ) {
+ void (*postHookFunc) (struct item_option *ito, struct config_setting_t *t, const char *source);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_options_additional_fields_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_itemdb_readdb_options_additional_fields_post[hIndex].func;
+ postHookFunc(ito, t, source);
+ }
+ }
+ return;
+}
void HP_itemdb_readdb_additional_fields(int itemid, struct config_setting_t *it, int n, const char *source) {
int hIndex = 0;
if( HPMHooks.count.HP_itemdb_readdb_additional_fields_pre ) {
@@ -36546,6 +36626,39 @@ int HP_itemdb_final_sub(union DBKey key, struct DBData *data, va_list ap) {
}
return retVal___;
}
+int HP_itemdb_options_final_sub(union DBKey key, struct DBData *data, va_list ap) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_itemdb_options_final_sub_pre ) {
+ int (*preHookFunc) (union DBKey *key, struct DBData **data, va_list ap);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_options_final_sub_pre; hIndex++ ) {
+ va_list ap___copy; va_copy(ap___copy, ap);
+ preHookFunc = HPMHooks.list.HP_itemdb_options_final_sub_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.itemdb.options_final_sub(key, data, ap___copy);
+ va_end(ap___copy);
+ }
+ if( HPMHooks.count.HP_itemdb_options_final_sub_post ) {
+ int (*postHookFunc) (int retVal___, union DBKey key, struct DBData *data, va_list ap);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_options_final_sub_post; hIndex++ ) {
+ va_list ap___copy; va_copy(ap___copy, ap);
+ postHookFunc = HPMHooks.list.HP_itemdb_options_final_sub_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, key, data, ap___copy);
+ va_end(ap___copy);
+ }
+ }
+ return retVal___;
+}
void HP_itemdb_clear(bool total) {
int hIndex = 0;
if( HPMHooks.count.HP_itemdb_clear_pre ) {