From 0a1982baa30e29431622c1a4f52668756d563214 Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Wed, 11 Mar 2020 21:24:28 +0100 Subject: Rename function pc_itemskill_clear() to pc_autocast_clear() --- src/plugins/HPMHooking/HPMHooking.Defs.inc | 4 ++-- src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 8 ++++---- src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 2 +- src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 16 ++++++++-------- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/plugins/HPMHooking') diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 28f81b97f..edfd60fbc 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -6184,8 +6184,8 @@ typedef int (*HPMHOOK_pre_pc_checkitem) (struct map_session_data **sd); typedef int (*HPMHOOK_post_pc_checkitem) (int retVal___, struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_useitem) (struct map_session_data **sd, int *n); typedef int (*HPMHOOK_post_pc_useitem) (int retVal___, struct map_session_data *sd, int n); -typedef int (*HPMHOOK_pre_pc_itemskill_clear) (struct map_session_data **sd); -typedef int (*HPMHOOK_post_pc_itemskill_clear) (int retVal___, struct map_session_data *sd); +typedef int (*HPMHOOK_pre_pc_autocast_clear) (struct map_session_data **sd); +typedef int (*HPMHOOK_post_pc_autocast_clear) (int retVal___, struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_skillatk_bonus) (struct map_session_data **sd, uint16 *skill_id); typedef int (*HPMHOOK_post_pc_skillatk_bonus) (int retVal___, struct map_session_data *sd, uint16 skill_id); typedef int (*HPMHOOK_pre_pc_skillheal_bonus) (struct map_session_data **sd, uint16 *skill_id); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index f94606bab..fed7e7a5e 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -4764,8 +4764,8 @@ struct { struct HPMHookPoint *HP_pc_checkitem_post; struct HPMHookPoint *HP_pc_useitem_pre; struct HPMHookPoint *HP_pc_useitem_post; - struct HPMHookPoint *HP_pc_itemskill_clear_pre; - struct HPMHookPoint *HP_pc_itemskill_clear_post; + struct HPMHookPoint *HP_pc_autocast_clear_pre; + struct HPMHookPoint *HP_pc_autocast_clear_post; struct HPMHookPoint *HP_pc_skillatk_bonus_pre; struct HPMHookPoint *HP_pc_skillatk_bonus_post; struct HPMHookPoint *HP_pc_skillheal_bonus_pre; @@ -11639,8 +11639,8 @@ struct { int HP_pc_checkitem_post; int HP_pc_useitem_pre; int HP_pc_useitem_post; - int HP_pc_itemskill_clear_pre; - int HP_pc_itemskill_clear_post; + int HP_pc_autocast_clear_pre; + int HP_pc_autocast_clear_post; int HP_pc_skillatk_bonus_pre; int HP_pc_skillatk_bonus_post; int HP_pc_skillheal_bonus_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index a360b3f53..8b38177ae 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2440,7 +2440,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->unequipitem_pos, HP_pc_unequipitem_pos) }, { HP_POP(pc->checkitem, HP_pc_checkitem) }, { HP_POP(pc->useitem, HP_pc_useitem) }, - { HP_POP(pc->itemskill_clear, HP_pc_itemskill_clear) }, + { HP_POP(pc->autocast_clear, HP_pc_autocast_clear) }, { HP_POP(pc->skillatk_bonus, HP_pc_skillatk_bonus) }, { HP_POP(pc->skillheal_bonus, HP_pc_skillheal_bonus) }, { HP_POP(pc->skillheal2_bonus, HP_pc_skillheal2_bonus) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 592279cc4..4b139b322 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -63359,14 +63359,14 @@ int HP_pc_useitem(struct map_session_data *sd, int n) { } return retVal___; } -int HP_pc_itemskill_clear(struct map_session_data *sd) { +int HP_pc_autocast_clear(struct map_session_data *sd) { int hIndex = 0; int retVal___ = 0; - if (HPMHooks.count.HP_pc_itemskill_clear_pre > 0) { + if (HPMHooks.count.HP_pc_autocast_clear_pre > 0) { int (*preHookFunc) (struct map_session_data **sd); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_itemskill_clear_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_pc_itemskill_clear_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_autocast_clear_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pc_autocast_clear_pre[hIndex].func; retVal___ = preHookFunc(&sd); } if (*HPMforce_return) { @@ -63375,12 +63375,12 @@ int HP_pc_itemskill_clear(struct map_session_data *sd) { } } { - retVal___ = HPMHooks.source.pc.itemskill_clear(sd); + retVal___ = HPMHooks.source.pc.autocast_clear(sd); } - if (HPMHooks.count.HP_pc_itemskill_clear_post > 0) { + if (HPMHooks.count.HP_pc_autocast_clear_post > 0) { int (*postHookFunc) (int retVal___, struct map_session_data *sd); - for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_itemskill_clear_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_pc_itemskill_clear_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_autocast_clear_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pc_autocast_clear_post[hIndex].func; retVal___ = postHookFunc(retVal___, sd); } } -- cgit v1.2.3-60-g2f50 From 49d0ce1c60455e4971c7bf9c80f4b92ce49f377f Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Wed, 11 Mar 2020 23:02:24 +0100 Subject: Remove skill_is_item_skill() function and use map_session_data->autocast.type instead --- src/map/clif.c | 2 +- src/map/skill.c | 23 +++--------------- src/map/skill.h | 1 - src/map/unit.c | 4 ++-- src/plugins/HPMHooking/HPMHooking.Defs.inc | 2 -- .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 4 ---- .../HPMHooking/HPMHooking_map.HookingPoints.inc | 1 - src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 27 ---------------------- 8 files changed, 6 insertions(+), 58 deletions(-) (limited to 'src/plugins/HPMHooking') diff --git a/src/map/clif.c b/src/map/clif.c index 66533a6fc..1a99a07f3 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -6766,7 +6766,7 @@ static void clif_item_skill(struct map_session_data *sd, uint16 skill_id, uint16 struct PACKET_ZC_AUTORUN_SKILL *p = WFIFOP(fd, 0); int type = skill->get_inf(skill_id); - if (sd->state.itemskill_castonself == 1 && skill->is_item_skill(sd, skill_id, skill_lv)) + if (sd->state.itemskill_castonself == 1 && sd->autocast.type == AUTOCAST_ITEM) type = INF_SELF_SKILL; p->packetType = HEADER_ZC_AUTORUN_SKILL; diff --git a/src/map/skill.c b/src/map/skill.c index d21a19742..14bc9460e 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -14048,22 +14048,6 @@ static bool skill_is_combo(int skill_id) return false; } -/** - * Checks if a skill is casted by an item (itemskill() script command). - * - * @param sd The charcater's session data. - * @param skill_id The skill's ID. - * @param skill_lv The skill's level. - * @return true if skill is casted by an item, otherwise false. - */ -static bool skill_is_item_skill(struct map_session_data *sd, int skill_id, int skill_lv) -{ - nullpo_retr(false, sd); - - return (sd->skillitem == skill_id && sd->skillitemlv == skill_lv - && sd->itemskill_id == skill_id && sd->itemskill_lv == skill_lv); -} - static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) { struct status_data *st; @@ -14079,7 +14063,7 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s return 0; if ((sd->state.itemskill_conditions_checked == 1 || sd->state.itemskill_check_conditions == 0) - && skill->is_item_skill(sd, skill_id, skill_lv)) { + && sd->autocast.type == AUTOCAST_ITEM) { return 1; } @@ -15068,7 +15052,7 @@ static int skill_check_condition_castend(struct map_session_data *sd, uint16 ski return 0; if ((sd->state.itemskill_conditions_checked == 1 || sd->state.itemskill_check_conditions == 0) - && skill->is_item_skill(sd, skill_id, skill_lv)) { + && sd->autocast.type == AUTOCAST_ITEM) { return 1; } @@ -15273,7 +15257,7 @@ static int skill_consume_requirement(struct map_session_data *sd, uint16 skill_i nullpo_ret(sd); - if (sd->state.itemskill_check_conditions == 0 && skill->is_item_skill(sd, skill_id, skill_lv)) + if (sd->state.itemskill_check_conditions == 0 && sd->autocast.type == AUTOCAST_ITEM) return 1; req = skill->get_requirement(sd,skill_id,skill_lv); @@ -21672,7 +21656,6 @@ void skill_defaults(void) skill->cast_fix_sc = skill_castfix_sc; skill->vf_cast_fix = skill_vfcastfix; skill->delay_fix = skill_delay_fix; - skill->is_item_skill = skill_is_item_skill; skill->check_condition_castbegin = skill_check_condition_castbegin; skill->check_condition_castend = skill_check_condition_castend; skill->consume_requirement = skill_consume_requirement; diff --git a/src/map/skill.h b/src/map/skill.h index 731044876..65195dc75 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -2029,7 +2029,6 @@ struct skill_interface { int (*cast_fix_sc) ( struct block_list *bl, int time); int (*vf_cast_fix) ( struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv); int (*delay_fix) ( struct block_list *bl, uint16 skill_id, uint16 skill_lv); - bool (*is_item_skill) (struct map_session_data *sd, int skill_id, int skill_lv); int (*check_condition_castbegin) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); int (*check_condition_castend) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); int (*consume_requirement) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type); diff --git a/src/map/unit.c b/src/map/unit.c index c1da2c72b..ab6f345ed 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1707,7 +1707,7 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill if (!ud->state.running) //need TK_RUN or WUGDASH handler to be done before that, see bugreport:6026 unit->stop_walking(src, STOPWALKING_FLAG_FIXPOS);// even though this is not how official works but this will do the trick. bugreport:6829 - if (sd != NULL && sd->state.itemskill_no_casttime == 1 && skill->is_item_skill(sd, skill_id, skill_lv)) + if (sd != NULL && sd->state.itemskill_no_casttime == 1 && sd->autocast.type == AUTOCAST_ITEM) casttime = 0; // in official this is triggered even if no cast time. @@ -1915,7 +1915,7 @@ static int unit_skilluse_pos2(struct block_list *src, short skill_x, short skill unit->stop_walking(src, STOPWALKING_FLAG_FIXPOS); - if (sd != NULL && sd->state.itemskill_no_casttime == 1 && skill->is_item_skill(sd, skill_id, skill_lv)) + if (sd != NULL && sd->state.itemskill_no_casttime == 1 && sd->autocast.type == AUTOCAST_ITEM) casttime = 0; // in official this is triggered even if no cast time. diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index edfd60fbc..018170812 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -7332,8 +7332,6 @@ typedef int (*HPMHOOK_pre_skill_vf_cast_fix) (struct block_list **bl, double *ti typedef int (*HPMHOOK_post_skill_vf_cast_fix) (int retVal___, struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv); typedef int (*HPMHOOK_pre_skill_delay_fix) (struct block_list **bl, uint16 *skill_id, uint16 *skill_lv); typedef int (*HPMHOOK_post_skill_delay_fix) (int retVal___, struct block_list *bl, uint16 skill_id, uint16 skill_lv); -typedef bool (*HPMHOOK_pre_skill_is_item_skill) (struct map_session_data **sd, int *skill_id, int *skill_lv); -typedef bool (*HPMHOOK_post_skill_is_item_skill) (bool retVal___, struct map_session_data *sd, int skill_id, int skill_lv); typedef int (*HPMHOOK_pre_skill_check_condition_castbegin) (struct map_session_data **sd, uint16 *skill_id, uint16 *skill_lv); typedef int (*HPMHOOK_post_skill_check_condition_castbegin) (int retVal___, struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); typedef int (*HPMHOOK_pre_skill_check_condition_castend) (struct map_session_data **sd, uint16 *skill_id, uint16 *skill_lv); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index fed7e7a5e..8912ad8ef 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -5856,8 +5856,6 @@ struct { struct HPMHookPoint *HP_skill_vf_cast_fix_post; struct HPMHookPoint *HP_skill_delay_fix_pre; struct HPMHookPoint *HP_skill_delay_fix_post; - struct HPMHookPoint *HP_skill_is_item_skill_pre; - struct HPMHookPoint *HP_skill_is_item_skill_post; struct HPMHookPoint *HP_skill_check_condition_castbegin_pre; struct HPMHookPoint *HP_skill_check_condition_castbegin_post; struct HPMHookPoint *HP_skill_check_condition_castend_pre; @@ -12731,8 +12729,6 @@ struct { int HP_skill_vf_cast_fix_post; int HP_skill_delay_fix_pre; int HP_skill_delay_fix_post; - int HP_skill_is_item_skill_pre; - int HP_skill_is_item_skill_post; int HP_skill_check_condition_castbegin_pre; int HP_skill_check_condition_castbegin_post; int HP_skill_check_condition_castend_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 8b38177ae..9458fc2f6 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2997,7 +2997,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(skill->cast_fix_sc, HP_skill_cast_fix_sc) }, { HP_POP(skill->vf_cast_fix, HP_skill_vf_cast_fix) }, { HP_POP(skill->delay_fix, HP_skill_delay_fix) }, - { HP_POP(skill->is_item_skill, HP_skill_is_item_skill) }, { HP_POP(skill->check_condition_castbegin, HP_skill_check_condition_castbegin) }, { HP_POP(skill->check_condition_castend, HP_skill_check_condition_castend) }, { HP_POP(skill->consume_requirement, HP_skill_consume_requirement) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 4b139b322..04706b751 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -78163,33 +78163,6 @@ int HP_skill_delay_fix(struct block_list *bl, uint16 skill_id, uint16 skill_lv) } return retVal___; } -bool HP_skill_is_item_skill(struct map_session_data *sd, int skill_id, int skill_lv) { - int hIndex = 0; - bool retVal___ = false; - if (HPMHooks.count.HP_skill_is_item_skill_pre > 0) { - bool (*preHookFunc) (struct map_session_data **sd, int *skill_id, int *skill_lv); - *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_is_item_skill_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_skill_is_item_skill_pre[hIndex].func; - retVal___ = preHookFunc(&sd, &skill_id, &skill_lv); - } - if (*HPMforce_return) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.skill.is_item_skill(sd, skill_id, skill_lv); - } - if (HPMHooks.count.HP_skill_is_item_skill_post > 0) { - bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int skill_id, int skill_lv); - for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_is_item_skill_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_skill_is_item_skill_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd, skill_id, skill_lv); - } - } - return retVal___; -} int HP_skill_check_condition_castbegin(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) { int hIndex = 0; int retVal___ = 0; -- cgit v1.2.3-60-g2f50