Skip to content

Commit

Permalink
HPM Hooks update
Browse files Browse the repository at this point in the history
Signed-off-by: Ibrahim Zidan <[email protected]>
  • Loading branch information
hemagx committed May 12, 2019
1 parent a712dd7 commit 03fc81d
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/plugins/HPMHooking/HPMHooking.Defs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ typedef bool (*HPMHOOK_pre_achievement_readdb_validate_criteria_weaponlv) (const
typedef bool (*HPMHOOK_post_achievement_readdb_validate_criteria_weaponlv) (bool retVal___, const struct config_setting_t *t, struct achievement_objective *obj, enum achievement_types type, int entry_id, int obj_idx);
typedef bool (*HPMHOOK_pre_achievement_readdb_validate_criteria_achievement) (const struct config_setting_t **t, struct achievement_objective **obj, enum achievement_types *type, int *entry_id, int *obj_idx);
typedef bool (*HPMHOOK_post_achievement_readdb_validate_criteria_achievement) (bool retVal___, const struct config_setting_t *t, struct achievement_objective *obj, enum achievement_types type, int entry_id, int obj_idx);
typedef bool (*HPMHOOK_pre_achievement_readdb_validate_criteria_intimacy) (const struct config_setting_t **t, struct achievement_objective **obj, enum achievement_types *type, int *entry_id, int *obj_idx);
typedef bool (*HPMHOOK_post_achievement_readdb_validate_criteria_intimacy) (bool retVal___, const struct config_setting_t *t, struct achievement_objective *obj, enum achievement_types type, int entry_id, int obj_idx);
typedef bool (*HPMHOOK_pre_achievement_readdb_rewards) (const struct config_setting_t **conf, struct achievement_data **entry, const char **source);
typedef bool (*HPMHOOK_post_achievement_readdb_rewards) (bool retVal___, const struct config_setting_t *conf, struct achievement_data *entry, const char *source);
typedef void (*HPMHOOK_pre_achievement_readdb_validate_reward_items) (const struct config_setting_t **t, struct achievement_data **entry);
Expand Down Expand Up @@ -158,6 +160,8 @@ typedef void (*HPMHOOK_pre_achievement_validate_adopt) (struct map_session_data
typedef void (*HPMHOOK_post_achievement_validate_adopt) (struct map_session_data *sd, bool parent);
typedef void (*HPMHOOK_pre_achievement_validate_zeny) (struct map_session_data **sd, int *amount);
typedef void (*HPMHOOK_post_achievement_validate_zeny) (struct map_session_data *sd, int amount);
typedef void (*HPMHOOK_pre_achievement_validate_zeny_vending) (struct map_session_data **sd, int *amount);
typedef void (*HPMHOOK_post_achievement_validate_zeny_vending) (struct map_session_data *sd, int amount);
typedef void (*HPMHOOK_pre_achievement_validate_refine) (struct map_session_data **sd, unsigned int *idx, bool *success);
typedef void (*HPMHOOK_post_achievement_validate_refine) (struct map_session_data *sd, unsigned int idx, bool success);
typedef void (*HPMHOOK_pre_achievement_validate_item_get) (struct map_session_data **sd, int *nameid, int *amount);
Expand All @@ -168,6 +172,10 @@ typedef void (*HPMHOOK_pre_achievement_validate_achieve) (struct map_session_dat
typedef void (*HPMHOOK_post_achievement_validate_achieve) (struct map_session_data *sd, int achid);
typedef void (*HPMHOOK_pre_achievement_validate_taming) (struct map_session_data **sd, int *class);
typedef void (*HPMHOOK_post_achievement_validate_taming) (struct map_session_data *sd, int class);
typedef void (*HPMHOOK_pre_achievement_validate_pet_intimacy) (struct map_session_data **sd);
typedef void (*HPMHOOK_post_achievement_validate_pet_intimacy) (struct map_session_data *sd);
typedef void (*HPMHOOK_pre_achievement_validate_pet_runaway) (struct map_session_data **sd, int *class);
typedef void (*HPMHOOK_post_achievement_validate_pet_runaway) (struct map_session_data *sd, int class);
typedef void (*HPMHOOK_pre_achievement_validate_achievement_rank) (struct map_session_data **sd, int *rank);
typedef void (*HPMHOOK_post_achievement_validate_achievement_rank) (struct map_session_data *sd, int rank);
typedef bool (*HPMHOOK_pre_achievement_type_requires_criteria) (enum achievement_types *type);
Expand Down
16 changes: 16 additions & 0 deletions src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ struct {
struct HPMHookPoint *HP_achievement_readdb_validate_criteria_weaponlv_post;
struct HPMHookPoint *HP_achievement_readdb_validate_criteria_achievement_pre;
struct HPMHookPoint *HP_achievement_readdb_validate_criteria_achievement_post;
struct HPMHookPoint *HP_achievement_readdb_validate_criteria_intimacy_pre;
struct HPMHookPoint *HP_achievement_readdb_validate_criteria_intimacy_post;
struct HPMHookPoint *HP_achievement_readdb_rewards_pre;
struct HPMHookPoint *HP_achievement_readdb_rewards_post;
struct HPMHookPoint *HP_achievement_readdb_validate_reward_items_pre;
Expand Down Expand Up @@ -116,6 +118,8 @@ struct {
struct HPMHookPoint *HP_achievement_validate_adopt_post;
struct HPMHookPoint *HP_achievement_validate_zeny_pre;
struct HPMHookPoint *HP_achievement_validate_zeny_post;
struct HPMHookPoint *HP_achievement_validate_zeny_vending_pre;
struct HPMHookPoint *HP_achievement_validate_zeny_vending_post;
struct HPMHookPoint *HP_achievement_validate_refine_pre;
struct HPMHookPoint *HP_achievement_validate_refine_post;
struct HPMHookPoint *HP_achievement_validate_item_get_pre;
Expand All @@ -126,6 +130,10 @@ struct {
struct HPMHookPoint *HP_achievement_validate_achieve_post;
struct HPMHookPoint *HP_achievement_validate_taming_pre;
struct HPMHookPoint *HP_achievement_validate_taming_post;
struct HPMHookPoint *HP_achievement_validate_pet_intimacy_pre;
struct HPMHookPoint *HP_achievement_validate_pet_intimacy_post;
struct HPMHookPoint *HP_achievement_validate_pet_runaway_pre;
struct HPMHookPoint *HP_achievement_validate_pet_runaway_post;
struct HPMHookPoint *HP_achievement_validate_achievement_rank_pre;
struct HPMHookPoint *HP_achievement_validate_achievement_rank_post;
struct HPMHookPoint *HP_achievement_type_requires_criteria_pre;
Expand Down Expand Up @@ -6839,6 +6847,8 @@ struct {
int HP_achievement_readdb_validate_criteria_weaponlv_post;
int HP_achievement_readdb_validate_criteria_achievement_pre;
int HP_achievement_readdb_validate_criteria_achievement_post;
int HP_achievement_readdb_validate_criteria_intimacy_pre;
int HP_achievement_readdb_validate_criteria_intimacy_post;
int HP_achievement_readdb_rewards_pre;
int HP_achievement_readdb_rewards_post;
int HP_achievement_readdb_validate_reward_items_pre;
Expand Down Expand Up @@ -6897,6 +6907,8 @@ struct {
int HP_achievement_validate_adopt_post;
int HP_achievement_validate_zeny_pre;
int HP_achievement_validate_zeny_post;
int HP_achievement_validate_zeny_vending_pre;
int HP_achievement_validate_zeny_vending_post;
int HP_achievement_validate_refine_pre;
int HP_achievement_validate_refine_post;
int HP_achievement_validate_item_get_pre;
Expand All @@ -6907,6 +6919,10 @@ struct {
int HP_achievement_validate_achieve_post;
int HP_achievement_validate_taming_pre;
int HP_achievement_validate_taming_post;
int HP_achievement_validate_pet_intimacy_pre;
int HP_achievement_validate_pet_intimacy_post;
int HP_achievement_validate_pet_runaway_pre;
int HP_achievement_validate_pet_runaway_post;
int HP_achievement_validate_achievement_rank_pre;
int HP_achievement_validate_achievement_rank_post;
int HP_achievement_type_requires_criteria_pre;
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(achievement->readdb_validate_criteria_itemtype, HP_achievement_readdb_validate_criteria_itemtype) },
{ HP_POP(achievement->readdb_validate_criteria_weaponlv, HP_achievement_readdb_validate_criteria_weaponlv) },
{ HP_POP(achievement->readdb_validate_criteria_achievement, HP_achievement_readdb_validate_criteria_achievement) },
{ HP_POP(achievement->readdb_validate_criteria_intimacy, HP_achievement_readdb_validate_criteria_intimacy) },
{ HP_POP(achievement->readdb_rewards, HP_achievement_readdb_rewards) },
{ HP_POP(achievement->readdb_validate_reward_items, HP_achievement_readdb_validate_reward_items) },
{ HP_POP(achievement->readdb_validate_reward_item_sub, HP_achievement_readdb_validate_reward_item_sub) },
Expand Down Expand Up @@ -73,11 +74,14 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(achievement->validate_marry, HP_achievement_validate_marry) },
{ HP_POP(achievement->validate_adopt, HP_achievement_validate_adopt) },
{ HP_POP(achievement->validate_zeny, HP_achievement_validate_zeny) },
{ HP_POP(achievement->validate_zeny_vending, HP_achievement_validate_zeny_vending) },
{ HP_POP(achievement->validate_refine, HP_achievement_validate_refine) },
{ HP_POP(achievement->validate_item_get, HP_achievement_validate_item_get) },
{ HP_POP(achievement->validate_item_sell, HP_achievement_validate_item_sell) },
{ HP_POP(achievement->validate_achieve, HP_achievement_validate_achieve) },
{ HP_POP(achievement->validate_taming, HP_achievement_validate_taming) },
{ HP_POP(achievement->validate_pet_intimacy, HP_achievement_validate_pet_intimacy) },
{ HP_POP(achievement->validate_pet_runaway, HP_achievement_validate_pet_runaway) },
{ HP_POP(achievement->validate_achievement_rank, HP_achievement_validate_achievement_rank) },
{ HP_POP(achievement->type_requires_criteria, HP_achievement_type_requires_criteria) },
{ HP_POP(achievement->init_titles, HP_achievement_init_titles) },
Expand Down
105 changes: 105 additions & 0 deletions src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,33 @@ bool HP_achievement_readdb_validate_criteria_achievement(const struct config_set
}
return retVal___;
}
bool HP_achievement_readdb_validate_criteria_intimacy(const struct config_setting_t *t, struct achievement_objective *obj, enum achievement_types type, int entry_id, int obj_idx) {
int hIndex = 0;
bool retVal___ = false;
if (HPMHooks.count.HP_achievement_readdb_validate_criteria_intimacy_pre > 0) {
bool (*preHookFunc) (const struct config_setting_t **t, struct achievement_objective **obj, enum achievement_types *type, int *entry_id, int *obj_idx);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_readdb_validate_criteria_intimacy_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_achievement_readdb_validate_criteria_intimacy_pre[hIndex].func;
retVal___ = preHookFunc(&t, &obj, &type, &entry_id, &obj_idx);
}
if (*HPMforce_return) {
*HPMforce_return = false;
return retVal___;
}
}
{
retVal___ = HPMHooks.source.achievement.readdb_validate_criteria_intimacy(t, obj, type, entry_id, obj_idx);
}
if (HPMHooks.count.HP_achievement_readdb_validate_criteria_intimacy_post > 0) {
bool (*postHookFunc) (bool retVal___, const struct config_setting_t *t, struct achievement_objective *obj, enum achievement_types type, int entry_id, int obj_idx);
for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_readdb_validate_criteria_intimacy_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_achievement_readdb_validate_criteria_intimacy_post[hIndex].func;
retVal___ = postHookFunc(retVal___, t, obj, type, entry_id, obj_idx);
}
}
return retVal___;
}
bool HP_achievement_readdb_rewards(const struct config_setting_t *conf, struct achievement_data *entry, const char *source) {
int hIndex = 0;
bool retVal___ = false;
Expand Down Expand Up @@ -1223,6 +1250,32 @@ void HP_achievement_validate_zeny(struct map_session_data *sd, int amount) {
}
return;
}
void HP_achievement_validate_zeny_vending(struct map_session_data *sd, int amount) {
int hIndex = 0;
if (HPMHooks.count.HP_achievement_validate_zeny_vending_pre > 0) {
void (*preHookFunc) (struct map_session_data **sd, int *amount);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_validate_zeny_vending_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_achievement_validate_zeny_vending_pre[hIndex].func;
preHookFunc(&sd, &amount);
}
if (*HPMforce_return) {
*HPMforce_return = false;
return;
}
}
{
HPMHooks.source.achievement.validate_zeny_vending(sd, amount);
}
if (HPMHooks.count.HP_achievement_validate_zeny_vending_post > 0) {
void (*postHookFunc) (struct map_session_data *sd, int amount);
for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_validate_zeny_vending_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_achievement_validate_zeny_vending_post[hIndex].func;
postHookFunc(sd, amount);
}
}
return;
}
void HP_achievement_validate_refine(struct map_session_data *sd, unsigned int idx, bool success) {
int hIndex = 0;
if (HPMHooks.count.HP_achievement_validate_refine_pre > 0) {
Expand Down Expand Up @@ -1353,6 +1406,58 @@ void HP_achievement_validate_taming(struct map_session_data *sd, int class) {
}
return;
}
void HP_achievement_validate_pet_intimacy(struct map_session_data *sd) {
int hIndex = 0;
if (HPMHooks.count.HP_achievement_validate_pet_intimacy_pre > 0) {
void (*preHookFunc) (struct map_session_data **sd);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_validate_pet_intimacy_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_achievement_validate_pet_intimacy_pre[hIndex].func;
preHookFunc(&sd);
}
if (*HPMforce_return) {
*HPMforce_return = false;
return;
}
}
{
HPMHooks.source.achievement.validate_pet_intimacy(sd);
}
if (HPMHooks.count.HP_achievement_validate_pet_intimacy_post > 0) {
void (*postHookFunc) (struct map_session_data *sd);
for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_validate_pet_intimacy_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_achievement_validate_pet_intimacy_post[hIndex].func;
postHookFunc(sd);
}
}
return;
}
void HP_achievement_validate_pet_runaway(struct map_session_data *sd, int class) {
int hIndex = 0;
if (HPMHooks.count.HP_achievement_validate_pet_runaway_pre > 0) {
void (*preHookFunc) (struct map_session_data **sd, int *class);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_validate_pet_runaway_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_achievement_validate_pet_runaway_pre[hIndex].func;
preHookFunc(&sd, &class);
}
if (*HPMforce_return) {
*HPMforce_return = false;
return;
}
}
{
HPMHooks.source.achievement.validate_pet_runaway(sd, class);
}
if (HPMHooks.count.HP_achievement_validate_pet_runaway_post > 0) {
void (*postHookFunc) (struct map_session_data *sd, int class);
for (hIndex = 0; hIndex < HPMHooks.count.HP_achievement_validate_pet_runaway_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_achievement_validate_pet_runaway_post[hIndex].func;
postHookFunc(sd, class);
}
}
return;
}
void HP_achievement_validate_achievement_rank(struct map_session_data *sd, int rank) {
int hIndex = 0;
if (HPMHooks.count.HP_achievement_validate_achievement_rank_pre > 0) {
Expand Down

0 comments on commit 03fc81d

Please sign in to comment.