Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<SpellGroup_t>(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<uint8_t>(m_virtue));
Expand Down
1 change: 1 addition & 0 deletions src/creatures/players/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1497,11 +1497,11 @@
* added to the player or being updated, there is a chance to prevent these actions
******************************************************************************/
struct DeflectCondition {
DeflectCondition(std::string source, ConditionType_t condition, uint8_t chance) :

Check warning on line 1500 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 1500 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 1500 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 1500 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 1500 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

when initialized here [-Wreorder]

Check warning on line 1500 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

when initialized here [-Wreorder]
source(source), condition(condition), chance(chance) { }
std::string source;
uint8_t chance = 0;

Check warning on line 1503 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘uint8_t Player::DeflectCondition::chance’ [-Wreorder]

Check warning on line 1503 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘uint8_t Player::DeflectCondition::chance’ [-Wreorder]

Check warning on line 1503 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘uint8_t Player::DeflectCondition::chance’ [-Wreorder]

Check warning on line 1503 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘uint8_t Player::DeflectCondition::chance’ [-Wreorder]

Check warning on line 1503 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘uint8_t Player::DeflectCondition::chance’ [-Wreorder]

Check warning on line 1503 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘uint8_t Player::DeflectCondition::chance’ [-Wreorder]
ConditionType_t condition = CONDITION_NONE;

Check warning on line 1504 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘Player::DeflectCondition::condition’ will be initialized after [-Wreorder]

Check warning on line 1504 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘Player::DeflectCondition::condition’ will be initialized after [-Wreorder]

Check warning on line 1504 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-22.04-linux-debug

‘Player::DeflectCondition::condition’ will be initialized after [-Wreorder]

Check warning on line 1504 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘Player::DeflectCondition::condition’ will be initialized after [-Wreorder]

Check warning on line 1504 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘Player::DeflectCondition::condition’ will be initialized after [-Wreorder]

Check warning on line 1504 in src/creatures/players/player.hpp

View workflow job for this annotation

GitHub Actions / ubuntu-24.04-linux-debug

‘Player::DeflectCondition::condition’ will be initialized after [-Wreorder]
};

const std::vector<DeflectCondition> &getDeflectConditions() const {
Expand All @@ -1528,6 +1528,7 @@
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;
Expand Down
5 changes: 5 additions & 0 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/server/network/protocol/protocolgame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading