aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-08-25 19:12:00 +0200
committerShauren <shauren.trinity@gmail.com>2016-08-25 19:12:00 +0200
commita727a99e34a1a50b4b7589ab549751caa63282b0 (patch)
tree65c60c621ee2a8452acc03292c28e296897fbea9 /src/server/game/Spells/SpellEffects.cpp
parente2f133902f8a37984e462a807a30a6663448d01e (diff)
Core/Players: Implemented new glyph system
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index e2656495467..0df4abea54f 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -61,6 +61,7 @@
#include "DuelPackets.h"
#include "MiscPackets.h"
#include "SpellPackets.h"
+#include "TalentPackets.h"
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
{
@@ -3923,6 +3924,40 @@ void Spell::EffectApplyGlyph(SpellEffIndex /*effIndex*/)
Player* player = m_caster->ToPlayer();
if (!player)
return;
+
+ std::vector<uint32>& glyphs = player->GetGlyphs(player->GetActiveTalentGroup());
+ std::size_t replacedGlyph = glyphs.size();
+ for (std::size_t i = 0; i < glyphs.size(); ++i)
+ {
+ if (std::vector<uint32> const* activeGlyphBindableSpells = sDB2Manager.GetGlyphBindableSpells(glyphs[i]))
+ {
+ if (std::find(activeGlyphBindableSpells->begin(), activeGlyphBindableSpells->end(), m_misc.SpellId) != activeGlyphBindableSpells->end())
+ {
+ replacedGlyph = i;
+ player->RemoveAurasDueToSpell(sGlyphPropertiesStore.AssertEntry(glyphs[i])->SpellID);
+ break;
+ }
+ }
+ }
+
+ uint32 glyphId = effectInfo->MiscValue;
+ if (replacedGlyph < glyphs.size())
+ {
+ if (glyphId)
+ glyphs[replacedGlyph] = glyphId;
+ else
+ glyphs.erase(glyphs.begin() + replacedGlyph);
+ }
+ else if (glyphId)
+ glyphs.push_back(glyphId);
+
+ if (GlyphPropertiesEntry const* glyphProperties = sGlyphPropertiesStore.LookupEntry(glyphId))
+ player->CastSpell(player, glyphProperties->SpellID, true);
+
+ WorldPackets::Talent::ActiveGlyphs activeGlyphs;
+ activeGlyphs.Glyphs.emplace_back(m_misc.SpellId, uint16(glyphId));
+ activeGlyphs.IsFullUpdate = false;
+ player->SendDirectMessage(activeGlyphs.Write());
}
void Spell::EffectEnchantHeldItem(SpellEffIndex /*effIndex*/)