aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp23
-rw-r--r--src/server/game/Entities/Player/Player.h2
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp25
-rw-r--r--src/server/game/Server/WorldSession.h2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp4
5 files changed, 28 insertions, 28 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index acfa0c8be2e..bc5979c744b 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -26652,3 +26652,26 @@ uint32 Player::GetDefaultSpecId() const
return entry->DefaultSpec;
return 0;
}
+
+void Player::SendSpellCategoryCooldowns()
+{
+ WorldPackets::Spells::CategoryCooldown cooldowns;
+
+ Unit::AuraEffectList const& categoryCooldownAuras = GetAuraEffectsByType(SPELL_AURA_MOD_SPELL_CATEGORY_COOLDOWN);
+ for (AuraEffect* aurEff : categoryCooldownAuras)
+ {
+ uint32 categoryId = aurEff->GetMiscValue();
+ auto cItr = std::find_if(cooldowns.CategoryCooldowns.begin(), cooldowns.CategoryCooldowns.end(),
+ [categoryId](WorldPackets::Spells::CategoryCooldown::CategoryCooldownInfo const& cooldown)
+ {
+ return cooldown.Category == categoryId;
+ });
+
+ if (cItr == cooldowns.CategoryCooldowns.end())
+ cooldowns.CategoryCooldowns.emplace_back(categoryId, -aurEff->GetAmount());
+ else
+ cItr->ModCooldown -= aurEff->GetAmount();
+ }
+
+ SendDirectMessage(cooldowns.Write());
+}
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index aff2b06f2b0..75f1c1f0c66 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1881,6 +1881,8 @@ class Player : public Unit, public GridObject<Player>
void RemoveOverrideSpell(uint32 overridenSpellId, uint32 newSpellId);
void LearnSpecializationSpells();
void RemoveSpecializationSpells();
+ void SendSpellCategoryCooldowns();
+
void SetReputation(uint32 factionentry, uint32 value);
uint32 GetReputation(uint32 factionentry) const;
std::string GetGuildName();
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index 824b747b9f8..25a93b73483 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -634,28 +634,5 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket)
void WorldSession::HandleRequestCategoryCooldowns(WorldPackets::Spells::RequestCategoryCooldowns& /*requestCategoryCooldowns*/)
{
- SendSpellCategoryCooldowns();
-}
-
-void WorldSession::SendSpellCategoryCooldowns()
-{
- WorldPackets::Spells::CategoryCooldown cooldowns;
-
- Unit::AuraEffectList const& categoryCooldownAuras = _player->GetAuraEffectsByType(SPELL_AURA_MOD_SPELL_CATEGORY_COOLDOWN);
- for (AuraEffect* aurEff : categoryCooldownAuras)
- {
- uint32 categoryId = aurEff->GetMiscValue();
- auto cItr = std::find_if(cooldowns.CategoryCooldowns.begin(), cooldowns.CategoryCooldowns.end(),
- [categoryId](WorldPackets::Spells::CategoryCooldown::CategoryCooldownInfo const& cooldown)
- {
- return cooldown.Category == categoryId;
- });
-
- if (cItr == cooldowns.CategoryCooldowns.end())
- cooldowns.CategoryCooldowns.emplace_back(aurEff->GetMiscValue(), -aurEff->GetAmount());
- else
- cItr->ModCooldown -= aurEff->GetAmount();
- }
-
- SendPacket(cooldowns.Write());
+ _player->SendSpellCategoryCooldowns();
}
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 2317605bf54..69cc071a2c4 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -1443,8 +1443,6 @@ class WorldSession
// Token
void HandleUpdateListedAuctionableTokens(WorldPackets::Token::UpdateListedAuctionableTokens& updateListedAuctionableTokens);
- void SendSpellCategoryCooldowns();
-
// Compact Unit Frames (4.x)
void HandleSaveCUFProfiles(WorldPacket& recvPacket);
void SendLoadCUFProfiles();
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 543b818597e..ad68ca988ff 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -6640,6 +6640,6 @@ void AuraEffect::HandleModSpellCategoryCooldown(AuraApplication const* aurApp, u
if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
- if (aurApp->GetTarget()->GetTypeId() == TYPEID_PLAYER)
- aurApp->GetTarget()->ToPlayer()->GetSession()->SendSpellCategoryCooldowns();
+ if (Player* player = aurApp->GetTarget()->ToPlayer())
+ player->SendSpellCategoryCooldowns();
}