From 9fde55170e84d499a20d4cd1aae85dd90be93189 Mon Sep 17 00:00:00 2001 From: Daegaladh Date: Mon, 29 Jul 2024 19:52:56 +0200 Subject: [PATCH] Clears the cooldown timer display --- src/map/clif.cpp | 11 +++++++++++ src/map/homunculus.cpp | 4 ++++ src/map/pc.cpp | 4 ++++ src/map/skill.cpp | 13 ++++++++++--- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/map/clif.cpp b/src/map/clif.cpp index ae160f66dc..6b84553df2 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -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 } diff --git a/src/map/homunculus.cpp b/src/map/homunculus.cpp index c8cdef0079..737a949d12 100644 --- a/src/map/homunculus.cpp +++ b/src/map/homunculus.cpp @@ -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); diff --git a/src/map/pc.cpp b/src/map/pc.cpp index dfbc927b13..486816fce2 100755 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -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; diff --git a/src/map/skill.cpp b/src/map/skill.cpp index c15ecc239b..17b6aab725 100755 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -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(map_id2bl(id)); if (hd) { - auto skill = util::vector_get(hd->blockskill, (uint16)data); + auto skill = util::vector_get(hd->blockskill, static_cast(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); }