Clears the cooldown timer display

This commit is contained in:
Daegaladh 2024-07-29 19:52:56 +02:00
parent 48b105405a
commit 9fde55170e
4 changed files with 29 additions and 3 deletions

View File

@ -1926,6 +1926,17 @@ void clif_homskillinfoblock( homun_data& hd ){
}
clif_send( packet, packet->packetLength, &sd->bl, SELF );
if (battle_config.display_status_timers) {
// Clear cooldown display for skills that are no longer blocked
for (auto& it : hd.homunculus.hskill) {
if (it.id == 0)
continue;
if (util::vector_get(hd.blockskill, it.id) == hd.blockskill.end())
clif_skill_cooldown(*sd, it.id, 0);
}
}
#endif
}

View File

@ -292,6 +292,10 @@ int hom_vaporize(map_session_data *sd, int flag)
if (battle_config.hom_delay_reset_vaporize) {
hd->blockskill.clear();
hd->blockskill.shrink_to_fit();
// End all cooldown display timers
if (battle_config.display_status_timers)
clif_homskillinfoblock(*sd->hd);
}
status_change_clear(&hd->bl, 1);
clif_hominfo(sd, sd->hd, 0);

View File

@ -7016,6 +7016,10 @@ enum e_setpos pc_setpos(map_session_data* sd, unsigned short mapindex, int x, in
if (battle_config.hom_delay_reset_warp) {
sd->hd->blockskill.clear();
sd->hd->blockskill.shrink_to_fit();
// End all cooldown display timers
if (battle_config.display_status_timers)
clif_homskillinfoblock(*sd->hd);
}
sd->hd->bl.m = m;

View File

@ -23039,13 +23039,17 @@ int skill_blockpc_clear(map_session_data *sd) {
}
TIMER_FUNC(skill_blockhomun_end){
struct homun_data *hd = (TBL_HOM*) map_id2bl(id);
homun_data *hd = reinterpret_cast<homun_data *>(map_id2bl(id));
if (hd) {
auto skill = util::vector_get(hd->blockskill, (uint16)data);
auto skill = util::vector_get(hd->blockskill, static_cast<uint16>(data));
if (skill != hd->blockskill.end())
hd->blockskill.erase(skill);
// Make sure the cooldown display is removed
if (battle_config.display_status_timers)
clif_homskillinfoblock(*hd);
}
return 1;
@ -23067,8 +23071,11 @@ int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) //[
hd->blockskill.push_back(skill_id);
if (battle_config.display_status_timers)
if (battle_config.display_status_timers) {
// Reset the skill cooldown display first
clif_homskillinfoblock(*hd);
clif_skill_cooldown(*hd->master, skill_id, tick);
}
return add_timer(gettick() + tick, skill_blockhomun_end, hd->bl.id, skill_id);
}