diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index c4b86f732..ed5c19430 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -12210,6 +12210,26 @@ void Player::setSereneCooldown(const uint64_t addTime) { m_serene_cooldown = timenow + addTime; } +void Player::resyncSpellCooldowns() const { + if (!client) { + return; + } + + // Resync individual spell cooldowns + for (const auto &condition : getConditionsByType(CONDITION_SPELLCOOLDOWN)) { + uint16_t spellId = condition->getSubId(); + uint32_t ticks = condition->getTicks(); + sendSpellCooldown(spellId, ticks); + } + + // Resync group spell cooldowns + for (const auto &condition : getConditionsByType(CONDITION_SPELLGROUPCOOLDOWN)) { + SpellGroup_t groupId = static_cast(condition->getSubId()); + uint32_t ticks = condition->getTicks(); + client->sendSpellGroupCooldown(groupId, ticks); + } +} + void Player::sendVirtueProtocol() const { if (client && m_virtue != VIRTUE_NONE) { client->sendVirtueProtocol(static_cast(m_virtue)); diff --git a/src/creatures/players/player.hpp b/src/creatures/players/player.hpp index 594c43545..a69a6b0de 100644 --- a/src/creatures/players/player.hpp +++ b/src/creatures/players/player.hpp @@ -1528,6 +1528,7 @@ class Player final : public Creature, public Cylinder, public Bankable { void setSerene(const bool isSerene); uint64_t getSereneCooldown(); void setSereneCooldown(const uint64_t addTime); + void resyncSpellCooldowns() const; void sendVirtueProtocol() const; void setVirtue(const VirtueMonk_t virtue); VirtueMonk_t getVirtue() const; diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index d619f9c57..ed0486191 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -776,6 +776,11 @@ void ProtocolGame::connect(const std::string &playerName, OperatingSystem_t oper player->client = getThis(); player->openPlayerContainers(); + + player->sendHarmonyProtocol(); + player->sendSereneProtocol(); + player->resyncSpellCooldowns(); + sendAddCreature(player, player->getPosition(), 0, true); player->lastIP = player->getIP(); player->lastLoad = OTSYS_TIME(); diff --git a/src/server/network/protocol/protocolgame.hpp b/src/server/network/protocol/protocolgame.hpp index e576b6e2f..7565348c4 100644 --- a/src/server/network/protocol/protocolgame.hpp +++ b/src/server/network/protocol/protocolgame.hpp @@ -541,7 +541,7 @@ class ProtocolGame final : public Protocol { void parseWheelGemAction(NetworkMessage &msg); void sendHarmonyProtocol(const uint8_t harmonyValue); - void sendSereneProtocol(const bool isSerene); + void sendSereneProtocol(const bool isSerene = true); void sendVirtueProtocol(const uint8_t virtueValue); void parseSelectSpellAimProtocol(NetworkMessage &msg);