summaryrefslogtreecommitdiff
path: root/src/plugins/HPMHooking
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-09-28 22:42:14 +0300
committerAndrei Karas <akaras@inbox.ru>2018-10-02 21:41:55 +0300
commit87d487d88a2a0f2473d3e404fed15d94db1b62c0 (patch)
tree7f1a859aaa903c9e44352a0661f3cd3f6724d1f4 /src/plugins/HPMHooking
parent0528b1a5f0b3012c2ff91d364c73e9cb4513fd38 (diff)
downloadhercules-87d487d88a2a0f2473d3e404fed15d94db1b62c0.tar.gz
hercules-87d487d88a2a0f2473d3e404fed15d94db1b62c0.tar.bz2
hercules-87d487d88a2a0f2473d3e404fed15d94db1b62c0.tar.xz
hercules-87d487d88a2a0f2473d3e404fed15d94db1b62c0.zip
Update HPM.
Diffstat (limited to 'src/plugins/HPMHooking')
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc12
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc8
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc71
4 files changed, 80 insertions, 13 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index f80dc9003..33fcdab4d 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -176,8 +176,12 @@ typedef void (*HPMHOOK_pre_achievement_init_titles) (struct map_session_data **s
typedef void (*HPMHOOK_post_achievement_init_titles) (struct map_session_data *sd);
typedef bool (*HPMHOOK_pre_achievement_check_title) (struct map_session_data **sd, int *title_id);
typedef bool (*HPMHOOK_post_achievement_check_title) (bool retVal___, struct map_session_data *sd, int title_id);
-typedef void (*HPMHOOK_pre_achievement_get_rewards) (struct map_session_data **sd, const struct achievement_data **ad);
-typedef void (*HPMHOOK_post_achievement_get_rewards) (struct map_session_data *sd, const struct achievement_data *ad);
+typedef bool (*HPMHOOK_pre_achievement_get_rewards) (struct map_session_data **sd, const struct achievement_data **ad);
+typedef bool (*HPMHOOK_post_achievement_get_rewards) (bool retVal___, struct map_session_data *sd, const struct achievement_data *ad);
+typedef void (*HPMHOOK_pre_achievement_get_rewards_buffs) (struct map_session_data **sd, const struct achievement_data **ad);
+typedef void (*HPMHOOK_post_achievement_get_rewards_buffs) (struct map_session_data *sd, const struct achievement_data *ad);
+typedef void (*HPMHOOK_pre_achievement_get_rewards_items) (struct map_session_data **sd, const struct achievement_data **ad);
+typedef void (*HPMHOOK_post_achievement_get_rewards_items) (struct map_session_data *sd, const struct achievement_data *ad);
#endif // MAP_ACHIEVEMENT_H
#ifdef MAP_ATCOMMAND_H /* atcommand */
typedef void (*HPMHOOK_pre_atcommand_init) (bool *minimal);
@@ -5872,8 +5876,8 @@ typedef int (*HPMHOOK_pre_pc_search_inventory) (struct map_session_data **sd, in
typedef int (*HPMHOOK_post_pc_search_inventory) (int retVal___, struct map_session_data *sd, int item_id);
typedef int (*HPMHOOK_pre_pc_payzeny) (struct map_session_data **sd, int *zeny, enum e_log_pick_type *type, struct map_session_data **tsd);
typedef int (*HPMHOOK_post_pc_payzeny) (int retVal___, struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd);
-typedef int (*HPMHOOK_pre_pc_additem) (struct map_session_data **sd, struct item **item_data, int *amount, e_log_pick_type *log_type);
-typedef int (*HPMHOOK_post_pc_additem) (int retVal___, struct map_session_data *sd, struct item *item_data, int amount, e_log_pick_type log_type);
+typedef int (*HPMHOOK_pre_pc_additem) (struct map_session_data **sd, const struct item **item_data, int *amount, e_log_pick_type *log_type);
+typedef int (*HPMHOOK_post_pc_additem) (int retVal___, struct map_session_data *sd, const struct item *item_data, int amount, e_log_pick_type log_type);
typedef int (*HPMHOOK_pre_pc_getzeny) (struct map_session_data **sd, int *zeny, enum e_log_pick_type *type, struct map_session_data **tsd);
typedef int (*HPMHOOK_post_pc_getzeny) (int retVal___, struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd);
typedef int (*HPMHOOK_pre_pc_delitem) (struct map_session_data **sd, int *n, int *amount, int *type, short *reason, e_log_pick_type *log_type);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index 8762975e1..663dcac11 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -136,6 +136,10 @@ struct {
struct HPMHookPoint *HP_achievement_check_title_post;
struct HPMHookPoint *HP_achievement_get_rewards_pre;
struct HPMHookPoint *HP_achievement_get_rewards_post;
+ struct HPMHookPoint *HP_achievement_get_rewards_buffs_pre;
+ struct HPMHookPoint *HP_achievement_get_rewards_buffs_post;
+ struct HPMHookPoint *HP_achievement_get_rewards_items_pre;
+ struct HPMHookPoint *HP_achievement_get_rewards_items_post;
struct HPMHookPoint *HP_atcommand_init_pre;
struct HPMHookPoint *HP_atcommand_init_post;
struct HPMHookPoint *HP_atcommand_final_pre;
@@ -6719,6 +6723,10 @@ struct {
int HP_achievement_check_title_post;
int HP_achievement_get_rewards_pre;
int HP_achievement_get_rewards_post;
+ int HP_achievement_get_rewards_buffs_pre;
+ int HP_achievement_get_rewards_buffs_post;
+ int HP_achievement_get_rewards_items_pre;
+ int HP_achievement_get_rewards_items_post;
int HP_atcommand_init_pre;
int HP_atcommand_init_post;
int HP_atcommand_final_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index 2f3f1840f..da318d52c 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -83,6 +83,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(achievement->init_titles, HP_achievement_init_titles) },
{ HP_POP(achievement->check_title, HP_achievement_check_title) },
{ HP_POP(achievement->get_rewards, HP_achievement_get_rewards) },
+ { HP_POP(achievement->get_rewards_buffs, HP_achievement_get_rewards_buffs) },
+ { HP_POP(achievement->get_rewards_items, HP_achievement_get_rewards_items) },
/* atcommand_interface */
{ HP_POP(atcommand->init, HP_atcommand_init) },
{ HP_POP(atcommand->final, HP_atcommand_final) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 860e47f1b..aeb494d59 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -1459,27 +1459,80 @@ bool HP_achievement_check_title(struct map_session_data *sd, int title_id) {
}
return retVal___;
}
-void HP_achievement_get_rewards(struct map_session_data *sd, const struct achievement_data *ad) {
+bool HP_achievement_get_rewards(struct map_session_data *sd, const struct achievement_data *ad) {
int hIndex = 0;
+ bool retVal___ = false;
if (HPMHooks.count.HP_achievement_get_rewards_pre > 0) {
- void (*preHookFunc) (struct map_session_data **sd, const struct achievement_data **ad);
+ bool (*preHookFunc) (struct map_session_data **sd, const struct achievement_data **ad);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_get_rewards_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_achievement_get_rewards_pre[hIndex].func;
- preHookFunc(&sd, &ad);
+ retVal___ = preHookFunc(&sd, &ad);
}
if (*HPMforce_return) {
*HPMforce_return = false;
- return;
+ return retVal___;
}
}
{
- HPMHooks.source.achievement.get_rewards(sd, ad);
+ retVal___ = HPMHooks.source.achievement.get_rewards(sd, ad);
}
if (HPMHooks.count.HP_achievement_get_rewards_post > 0) {
- void (*postHookFunc) (struct map_session_data *sd, const struct achievement_data *ad);
+ bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, const struct achievement_data *ad);
for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_get_rewards_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_achievement_get_rewards_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, sd, ad);
+ }
+ }
+ return retVal___;
+}
+void HP_achievement_get_rewards_buffs(struct map_session_data *sd, const struct achievement_data *ad) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_achievement_get_rewards_buffs_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd, const struct achievement_data **ad);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_get_rewards_buffs_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_achievement_get_rewards_buffs_pre[hIndex].func;
+ preHookFunc(&sd, &ad);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.achievement.get_rewards_buffs(sd, ad);
+ }
+ if (HPMHooks.count.HP_achievement_get_rewards_buffs_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd, const struct achievement_data *ad);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_get_rewards_buffs_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_achievement_get_rewards_buffs_post[hIndex].func;
+ postHookFunc(sd, ad);
+ }
+ }
+ return;
+}
+void HP_achievement_get_rewards_items(struct map_session_data *sd, const struct achievement_data *ad) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_achievement_get_rewards_items_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd, const struct achievement_data **ad);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_get_rewards_items_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_achievement_get_rewards_items_pre[hIndex].func;
+ preHookFunc(&sd, &ad);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.achievement.get_rewards_items(sd, ad);
+ }
+ if (HPMHooks.count.HP_achievement_get_rewards_items_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd, const struct achievement_data *ad);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_get_rewards_items_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_achievement_get_rewards_items_post[hIndex].func;
postHookFunc(sd, ad);
}
}
@@ -59054,11 +59107,11 @@ int HP_pc_payzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type ty
}
return retVal___;
}
-int HP_pc_additem(struct map_session_data *sd, struct item *item_data, int amount, e_log_pick_type log_type) {
+int HP_pc_additem(struct map_session_data *sd, const struct item *item_data, int amount, e_log_pick_type log_type) {
int hIndex = 0;
int retVal___ = 0;
if (HPMHooks.count.HP_pc_additem_pre > 0) {
- int (*preHookFunc) (struct map_session_data **sd, struct item **item_data, int *amount, e_log_pick_type *log_type);
+ int (*preHookFunc) (struct map_session_data **sd, const struct item **item_data, int *amount, e_log_pick_type *log_type);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_additem_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_pc_additem_pre[hIndex].func;
@@ -59073,7 +59126,7 @@ int HP_pc_additem(struct map_session_data *sd, struct item *item_data, int amoun
retVal___ = HPMHooks.source.pc.additem(sd, item_data, amount, log_type);
}
if (HPMHooks.count.HP_pc_additem_post > 0) {
- int (*postHookFunc) (int retVal___, struct map_session_data *sd, struct item *item_data, int amount, e_log_pick_type log_type);
+ int (*postHookFunc) (int retVal___, struct map_session_data *sd, const struct item *item_data, int amount, e_log_pick_type log_type);
for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_additem_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_pc_additem_post[hIndex].func;
retVal___ = postHookFunc(retVal___, sd, item_data, amount, log_type);