diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-03-12 00:24:35 +0100 |
---|---|---|
committer | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-03-14 22:35:10 +0100 |
commit | 44581f9de0df3ab18b719e55f793dc22bd2fcb72 (patch) | |
tree | 5c26e03b55e19a87132e4adc36de109c380efcca | |
parent | 10312bc4329e16a4b4420131cb976ef9fa6a13f5 (diff) | |
download | hercules-44581f9de0df3ab18b719e55f793dc22bd2fcb72.tar.gz hercules-44581f9de0df3ab18b719e55f793dc22bd2fcb72.tar.bz2 hercules-44581f9de0df3ab18b719e55f793dc22bd2fcb72.tar.xz hercules-44581f9de0df3ab18b719e55f793dc22bd2fcb72.zip |
Remove skillitem and skillitemlv variables and use map_session_data->autocast.skill_id/_lv instead
-rw-r--r-- | src/map/clif.c | 8 | ||||
-rw-r--r-- | src/map/pc.h | 1 | ||||
-rw-r--r-- | src/map/script.c | 8 | ||||
-rw-r--r-- | src/map/skill.c | 20 |
4 files changed, 15 insertions, 22 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 074ca570b..66a3d84c9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -12786,8 +12786,8 @@ static void clif_useSkillToIdReal(int fd, struct map_session_data *sd, int skill return; //Can't use skills while a menu is open. } if (sd->autocast.type != AUTOCAST_NONE) { - if (skill_lv != sd->skillitemlv) - skill_lv = sd->skillitemlv; + if (skill_lv != sd->autocast.skill_lv) + skill_lv = sd->autocast.skill_lv; if (!(tmp&INF_SELF_SKILL)) pc->delinvincibletimer(sd); // Target skills through items cancel invincibility. [Inkfish] unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); @@ -12927,8 +12927,8 @@ static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uin pc->delinvincibletimer(sd); if (sd->autocast.type != AUTOCAST_NONE) { - if( skill_lv != sd->skillitemlv ) - skill_lv = sd->skillitemlv; + if (skill_lv != sd->autocast.skill_lv) + skill_lv = sd->autocast.skill_lv; unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); } else { int lv; diff --git a/src/map/pc.h b/src/map/pc.h index 2991bfc68..6f932c447 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -304,7 +304,6 @@ struct map_session_data { int followtimer; // [MouseJstr] int followtarget; time_t emotionlasttime; // to limit flood with emotion packets - int skillitem,skillitemlv; uint16 skill_id_old,skill_lv_old; uint16 skill_id_dance,skill_lv_dance; short cook_mastery; // range: [0,1999] [Inkfish] diff --git a/src/map/script.c b/src/map/script.c index 6ed94bc92..2c8ce683e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11005,16 +11005,14 @@ static BUILDIN(itemskill) sd->autocast.type = AUTOCAST_ITEM; sd->autocast.skill_id = script_isstringtype(st, 2) ? skill->name2id(script_getstr(st, 2)) : script_getnum(st, 2); sd->autocast.skill_lv = script_getnum(st, 3); - sd->skillitem = script_isstringtype(st, 2) ? skill->name2id(script_getstr(st, 2)) : script_getnum(st, 2); - sd->skillitemlv = script_getnum(st, 3); int flag = script_hasdata(st, 4) ? script_getnum(st, 4) : ISF_NONE; sd->autocast.itemskill_check_conditions = ((flag & ISF_CHECKCONDITIONS) == ISF_CHECKCONDITIONS); if (sd->autocast.itemskill_check_conditions) { - if (skill->check_condition_castbegin(sd, sd->skillitem, sd->skillitemlv) == 0 - || skill->check_condition_castend(sd, sd->skillitem, sd->skillitemlv) == 0) { + if (skill->check_condition_castbegin(sd, sd->autocast.skill_id, sd->autocast.skill_lv) == 0 + || skill->check_condition_castend(sd, sd->autocast.skill_id, sd->autocast.skill_lv) == 0) { pc->autocast_clear(sd); return true; } @@ -11025,7 +11023,7 @@ static BUILDIN(itemskill) sd->autocast.itemskill_instant_cast = ((flag & ISF_INSTANTCAST) == ISF_INSTANTCAST); sd->autocast.itemskill_cast_on_self = ((flag & ISF_CASTONSELF) == ISF_CASTONSELF); - clif->item_skill(sd, sd->skillitem, sd->skillitemlv); + clif->item_skill(sd, sd->autocast.skill_id, sd->autocast.skill_lv); return true; } diff --git a/src/map/skill.c b/src/map/skill.c index 89729c572..6fc1b80a2 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1010,7 +1010,7 @@ static int skillnotok(uint16 skill_id, struct map_session_data *sd) if (pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL)) return 0; // can do any damn thing they want - if (skill_id == AL_TELEPORT && sd->autocast.type == AUTOCAST_ITEM && sd->skillitemlv > 2) + if (skill_id == AL_TELEPORT && sd->autocast.type == AUTOCAST_ITEM && sd->autocast.skill_lv > 2) return 0; // Teleport level 3 and higher bypasses this check if cast by itemskill() script commands. // Epoque: @@ -5824,7 +5824,7 @@ static int skill_castend_id(int tid, int64 tick, int id, intptr_t data) if (ud->walktimer != INVALID_TIMER && ud->skill_id != TK_RUN && ud->skill_id != RA_WUGDASH) unit->stop_walking(src, STOPWALKING_FLAG_FIXPOS); - if( !sd || sd->skillitem != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) ) + if (sd == NULL || sd->autocast.skill_id != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) != 0) ud->canact_tick = tick + skill->delay_fix(src, ud->skill_id, ud->skill_lv); // Tests show wings don't overwrite the delay but skill scrolls do. [Inkfish] if (sd) { // Cooldown application int i, cooldown = skill->get_cooldown(ud->skill_id, ud->skill_lv); @@ -5942,7 +5942,7 @@ static int skill_castend_id(int tid, int64 tick, int id, intptr_t data) } } - if( !sd || sd->skillitem != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) ) + if (sd == NULL || sd->autocast.skill_id != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) != 0) ud->canact_tick = tick; ud->skill_id = ud->skill_lv = ud->skilltarget = 0; //You can't place a skill failed packet here because it would be @@ -6334,8 +6334,6 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * sd->autocast.type = AUTOCAST_ABRA; sd->autocast.skill_id = abra_skill_id; sd->autocast.skill_lv = abra_skill_lv; - sd->skillitem = abra_skill_id; - sd->skillitemlv = abra_skill_lv; clif->item_skill(sd, abra_skill_id, abra_skill_lv); } else { // mob-casted @@ -7501,7 +7499,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * break; } - if (sd->autocast.type == AUTOCAST_TEMP || ((sd->skillitem == AL_TELEPORT || battle_config.skip_teleport_lv1_menu) && skill_lv == 1) || skill_lv == 3) + if (sd->autocast.type == AUTOCAST_TEMP || ((sd->autocast.skill_id == AL_TELEPORT || battle_config.skip_teleport_lv1_menu) && skill_lv == 1) || skill_lv == 3) { if( skill_lv == 1 ) pc->randomwarp(sd,CLR_TELEPORT); @@ -10078,8 +10076,6 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * sd->autocast.type = AUTOCAST_IMPROVISE; sd->autocast.skill_id = improv_skill_id; sd->autocast.skill_lv = improv_skill_lv; - sd->skillitem = improv_skill_id; - sd->skillitemlv = improv_skill_lv; clif->item_skill(sd, improv_skill_id, improv_skill_lv); } else { struct unit_data *ud = unit->bl2ud(src); @@ -10848,7 +10844,7 @@ static int skill_castend_pos(int tid, int64 tick, int id, intptr_t data) if (ud->walktimer != INVALID_TIMER) unit->stop_walking(src, STOPWALKING_FLAG_FIXPOS); - if( !sd || sd->skillitem != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) ) + if (sd == NULL || sd->autocast.skill_id != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) != 0) ud->canact_tick = tick + skill->delay_fix(src, ud->skill_id, ud->skill_lv); if (sd) { //Cooldown application int i, cooldown = skill->get_cooldown(ud->skill_id, ud->skill_lv); @@ -10877,7 +10873,7 @@ static int skill_castend_pos(int tid, int64 tick, int id, intptr_t data) map->freeblock_lock(); skill->castend_pos2(src,ud->skillx,ud->skilly,ud->skill_id,ud->skill_lv,tick,0); - if( sd && sd->skillitem != AL_WARP ) // Warp-Portal thru items will clear data in skill_castend_map. [Inkfish] + if (sd != NULL && sd->autocast.skill_id != AL_WARP) // Warp-Portal thru items will clear data in skill_castend_map. [Inkfish] pc->autocast_clear(sd); unit->set_dir(src, map->calc_dir(src, ud->skillx, ud->skilly)); @@ -10892,7 +10888,7 @@ static int skill_castend_pos(int tid, int64 tick, int id, intptr_t data) return 1; } while(0); - if( !sd || sd->skillitem != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) ) + if (sd == NULL || sd->autocast.skill_id != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) != 0) ud->canact_tick = tick; ud->skill_id = ud->skill_lv = 0; if(sd) @@ -11026,7 +11022,7 @@ static int skill_castend_map(struct map_session_data *sd, uint16 skill_id, const } } - lv = (sd->autocast.type > AUTOCAST_TEMP) ? sd->skillitemlv : pc->checkskill(sd, skill_id); + lv = (sd->autocast.type > AUTOCAST_TEMP) ? sd->autocast.skill_lv : pc->checkskill(sd, skill_id); wx = sd->menuskill_val>>16; wy = sd->menuskill_val&0xffff; |