Skip to content

Commit ff12180

Browse files
committed
Update HPM hooks
Signed-off-by: hwsapibot <[email protected]>
1 parent 613ede9 commit ff12180

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed

src/common/HPMDataCheck.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
254254
#else
255255
#define COMMON_BASE62_H
256256
#endif // COMMON_BASE62_H
257+
#ifdef COMMON_CHARLOGINPACKETS_H
258+
{ "PACKET_CHARLOGIN_ONLINE_ACCOUNTS", sizeof(struct PACKET_CHARLOGIN_ONLINE_ACCOUNTS), SERVER_TYPE_ALL },
259+
#else
260+
#define COMMON_CHARLOGINPACKETS_H
261+
#endif // COMMON_CHARLOGINPACKETS_H
257262
#ifdef COMMON_CHARMAPPACKETS_H
258263
{ "PACKET_CHARMAP_AGENCY_JOIN_PARTY", sizeof(struct PACKET_CHARMAP_AGENCY_JOIN_PARTY), SERVER_TYPE_ALL },
259264
{ "PACKET_CHARMAP_GUILD_EMBLEM", sizeof(struct PACKET_CHARMAP_GUILD_EMBLEM), SERVER_TYPE_ALL },

src/plugins/HPMHooking/HPMHooking.Defs.inc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7546,6 +7546,12 @@ typedef bool (*HPMHOOK_pre_pc_auto_exp_insurance) (struct map_session_data **sd)
75467546
typedef bool (*HPMHOOK_post_pc_auto_exp_insurance) (bool retVal___, struct map_session_data *sd);
75477547
typedef void (*HPMHOOK_pre_pc_crimson_marker_clear) (struct map_session_data **sd);
75487548
typedef void (*HPMHOOK_post_pc_crimson_marker_clear) (struct map_session_data *sd);
7549+
typedef bool (*HPMHOOK_pre_pc_is_own_skill) (struct map_session_data **sd, uint16 *skill_id);
7550+
typedef bool (*HPMHOOK_post_pc_is_own_skill) (bool retVal___, struct map_session_data *sd, uint16 skill_id);
7551+
typedef void (*HPMHOOK_pre_pc_clear_existing_cloneskill) (struct map_session_data **sd, bool *clear_vars);
7552+
typedef void (*HPMHOOK_post_pc_clear_existing_cloneskill) (struct map_session_data *sd, bool clear_vars);
7553+
typedef void (*HPMHOOK_pre_pc_clear_existing_reproduceskill) (struct map_session_data **sd, bool *clear_vars);
7554+
typedef void (*HPMHOOK_post_pc_clear_existing_reproduceskill) (struct map_session_data *sd, bool clear_vars);
75497555
#endif // MAP_PC_H
75507556
#ifdef MAP_NPC_H /* libpcre */
75517557
typedef pcre* (*HPMHOOK_pre_libpcre_compile) (const char **pattern, int *options, const char ***errptr, int **erroffset, const unsigned char **tableptr);

src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5524,6 +5524,12 @@ struct {
55245524
struct HPMHookPoint *HP_pc_auto_exp_insurance_post;
55255525
struct HPMHookPoint *HP_pc_crimson_marker_clear_pre;
55265526
struct HPMHookPoint *HP_pc_crimson_marker_clear_post;
5527+
struct HPMHookPoint *HP_pc_is_own_skill_pre;
5528+
struct HPMHookPoint *HP_pc_is_own_skill_post;
5529+
struct HPMHookPoint *HP_pc_clear_existing_cloneskill_pre;
5530+
struct HPMHookPoint *HP_pc_clear_existing_cloneskill_post;
5531+
struct HPMHookPoint *HP_pc_clear_existing_reproduceskill_pre;
5532+
struct HPMHookPoint *HP_pc_clear_existing_reproduceskill_post;
55275533
struct HPMHookPoint *HP_libpcre_compile_pre;
55285534
struct HPMHookPoint *HP_libpcre_compile_post;
55295535
struct HPMHookPoint *HP_libpcre_study_pre;
@@ -13109,6 +13115,12 @@ struct {
1310913115
int HP_pc_auto_exp_insurance_post;
1311013116
int HP_pc_crimson_marker_clear_pre;
1311113117
int HP_pc_crimson_marker_clear_post;
13118+
int HP_pc_is_own_skill_pre;
13119+
int HP_pc_is_own_skill_post;
13120+
int HP_pc_clear_existing_cloneskill_pre;
13121+
int HP_pc_clear_existing_cloneskill_post;
13122+
int HP_pc_clear_existing_reproduceskill_pre;
13123+
int HP_pc_clear_existing_reproduceskill_post;
1311213124
int HP_libpcre_compile_pre;
1311313125
int HP_libpcre_compile_post;
1311413126
int HP_libpcre_study_pre;

src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2827,6 +2827,9 @@ struct HookingPointData HookingPoints[] = {
28272827
{ HP_POP(pc->expandInventory, HP_pc_expandInventory) },
28282828
{ HP_POP(pc->auto_exp_insurance, HP_pc_auto_exp_insurance) },
28292829
{ HP_POP(pc->crimson_marker_clear, HP_pc_crimson_marker_clear) },
2830+
{ HP_POP(pc->is_own_skill, HP_pc_is_own_skill) },
2831+
{ HP_POP(pc->clear_existing_cloneskill, HP_pc_clear_existing_cloneskill) },
2832+
{ HP_POP(pc->clear_existing_reproduceskill, HP_pc_clear_existing_reproduceskill) },
28302833
/* pcre_interface */
28312834
{ HP_POP(libpcre->compile, HP_libpcre_compile) },
28322835
{ HP_POP(libpcre->study, HP_libpcre_study) },

src/plugins/HPMHooking/HPMHooking_map.Hooks.inc

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73497,6 +73497,85 @@ void HP_pc_crimson_marker_clear(struct map_session_data *sd) {
7349773497
}
7349873498
return;
7349973499
}
73500+
bool HP_pc_is_own_skill(struct map_session_data *sd, uint16 skill_id) {
73501+
int hIndex = 0;
73502+
bool retVal___ = false;
73503+
if (HPMHooks.count.HP_pc_is_own_skill_pre > 0) {
73504+
bool (*preHookFunc) (struct map_session_data **sd, uint16 *skill_id);
73505+
*HPMforce_return = false;
73506+
for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_is_own_skill_pre; hIndex++) {
73507+
preHookFunc = HPMHooks.list.HP_pc_is_own_skill_pre[hIndex].func;
73508+
retVal___ = preHookFunc(&sd, &skill_id);
73509+
}
73510+
if (*HPMforce_return) {
73511+
*HPMforce_return = false;
73512+
return retVal___;
73513+
}
73514+
}
73515+
{
73516+
retVal___ = HPMHooks.source.pc.is_own_skill(sd, skill_id);
73517+
}
73518+
if (HPMHooks.count.HP_pc_is_own_skill_post > 0) {
73519+
bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, uint16 skill_id);
73520+
for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_is_own_skill_post; hIndex++) {
73521+
postHookFunc = HPMHooks.list.HP_pc_is_own_skill_post[hIndex].func;
73522+
retVal___ = postHookFunc(retVal___, sd, skill_id);
73523+
}
73524+
}
73525+
return retVal___;
73526+
}
73527+
void HP_pc_clear_existing_cloneskill(struct map_session_data *sd, bool clear_vars) {
73528+
int hIndex = 0;
73529+
if (HPMHooks.count.HP_pc_clear_existing_cloneskill_pre > 0) {
73530+
void (*preHookFunc) (struct map_session_data **sd, bool *clear_vars);
73531+
*HPMforce_return = false;
73532+
for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_clear_existing_cloneskill_pre; hIndex++) {
73533+
preHookFunc = HPMHooks.list.HP_pc_clear_existing_cloneskill_pre[hIndex].func;
73534+
preHookFunc(&sd, &clear_vars);
73535+
}
73536+
if (*HPMforce_return) {
73537+
*HPMforce_return = false;
73538+
return;
73539+
}
73540+
}
73541+
{
73542+
HPMHooks.source.pc.clear_existing_cloneskill(sd, clear_vars);
73543+
}
73544+
if (HPMHooks.count.HP_pc_clear_existing_cloneskill_post > 0) {
73545+
void (*postHookFunc) (struct map_session_data *sd, bool clear_vars);
73546+
for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_clear_existing_cloneskill_post; hIndex++) {
73547+
postHookFunc = HPMHooks.list.HP_pc_clear_existing_cloneskill_post[hIndex].func;
73548+
postHookFunc(sd, clear_vars);
73549+
}
73550+
}
73551+
return;
73552+
}
73553+
void HP_pc_clear_existing_reproduceskill(struct map_session_data *sd, bool clear_vars) {
73554+
int hIndex = 0;
73555+
if (HPMHooks.count.HP_pc_clear_existing_reproduceskill_pre > 0) {
73556+
void (*preHookFunc) (struct map_session_data **sd, bool *clear_vars);
73557+
*HPMforce_return = false;
73558+
for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_clear_existing_reproduceskill_pre; hIndex++) {
73559+
preHookFunc = HPMHooks.list.HP_pc_clear_existing_reproduceskill_pre[hIndex].func;
73560+
preHookFunc(&sd, &clear_vars);
73561+
}
73562+
if (*HPMforce_return) {
73563+
*HPMforce_return = false;
73564+
return;
73565+
}
73566+
}
73567+
{
73568+
HPMHooks.source.pc.clear_existing_reproduceskill(sd, clear_vars);
73569+
}
73570+
if (HPMHooks.count.HP_pc_clear_existing_reproduceskill_post > 0) {
73571+
void (*postHookFunc) (struct map_session_data *sd, bool clear_vars);
73572+
for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_clear_existing_reproduceskill_post; hIndex++) {
73573+
postHookFunc = HPMHooks.list.HP_pc_clear_existing_reproduceskill_post[hIndex].func;
73574+
postHookFunc(sd, clear_vars);
73575+
}
73576+
}
73577+
return;
73578+
}
7350073579
/* pcre_interface */
7350173580
pcre* HP_libpcre_compile(const char *pattern, int options, const char **errptr, int *erroffset, const unsigned char *tableptr) {
7350273581
int hIndex = 0;

0 commit comments

Comments
 (0)