From ffdd990aa4a8b90ea1ca383a30f306f1c3efddfb Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Thu, 5 Aug 2021 15:58:50 +0200 Subject: [PATCH] =?UTF-8?q?fix(Core/Spells):=20Glyphs=20should=20send=20SM?= =?UTF-8?q?SG=5FLEARNED=5FSPELL/SMSG=5FREMOVED=5F=E2=80=A6=20(#7161)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(Core/Spells): Glyphs should send SMSG_LEARNED_SPELL/SMSG_REMOVED_SPELL packet in case of updating spell tooltips. Fixed #6323 * chore(Core/CharacterHandler): improve comment * chore(Core/SpellEffects): improve comment Co-authored-by: Stefano Borzì --- src/server/game/Entities/Player/Player.cpp | 15 +++++++++++++++ src/server/game/Handlers/CharacterHandler.cpp | 1 + src/server/game/Spells/SpellEffects.cpp | 6 +++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 1864aedaf..22a801636 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2670,6 +2670,21 @@ void Player::SendInitialSpells() ++spellCount; } + // Added spells from glyphs too (needed by spell tooltips) + for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i) + { + if (uint32 glyph = GetGlyph(i)) + { + if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyph)) + { + data << uint32(glyphEntry->SpellId); + data << uint16(0); // it's not slot id + + ++spellCount; + } + } + } + // xinef: we have to send talents, but not those on m_spells list for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr) { diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 57466b110..41d9df44d 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1548,6 +1548,7 @@ void WorldSession::HandleRemoveGlyph(WorldPacket& recvData) if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyph)) { _player->RemoveAurasDueToSpell(glyphEntry->SpellId); + _player->SendLearnPacket(glyphEntry->SpellId, false); // Send packet to properly handle client-side spell tooltips _player->SetGlyph(slot, 0, true); _player->SendTalentsInfoData(false); } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index b48939990..4ba982ec3 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -102,7 +102,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS] = &Spell::EffectTeleUnitsFaceCaster, // 43 SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER &Spell::EffectLearnSkill, // 44 SPELL_EFFECT_SKILL_STEP &Spell::EffectAddHonor, // 45 SPELL_EFFECT_ADD_HONOR honor/pvp related - &Spell::EffectUnused, // 46 SPELL_EFFECT_SPAWN clientside, unit appears as if it was just spawned + &Spell::EffectUnused, // 46 SPELL_EFFECT_SPAWN client-side, unit appears as if it was just spawned &Spell::EffectTradeSkill, // 47 SPELL_EFFECT_TRADE_SKILL &Spell::EffectUnused, // 48 SPELL_EFFECT_STEALTH one spell: Base Stealth &Spell::EffectUnused, // 49 SPELL_EFFECT_DETECT one spell: Detect @@ -4540,8 +4540,12 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex) // remove old glyph aura if (uint32 oldGlyph = player->GetGlyph(m_glyphIndex)) if (GlyphPropertiesEntry const* oldGlyphEntry = sGlyphPropertiesStore.LookupEntry(oldGlyph)) + { player->RemoveAurasDueToSpell(oldGlyphEntry->SpellId); + player->SendLearnPacket(oldGlyphEntry->SpellId, false); // Send packet to properly handle client-side spell tooltips + } + player->SendLearnPacket(glyphEntry->SpellId, true); // Send packet to properly handle client-side spell tooltips player->CastSpell(m_caster, glyphEntry->SpellId, TriggerCastFlags(TRIGGERED_FULL_MASK & ~(TRIGGERED_IGNORE_SHAPESHIFT | TRIGGERED_IGNORE_CASTER_AURASTATE))); player->SetGlyph(m_glyphIndex, glyph, !player->GetSession()->PlayerLoading()); player->SendTalentsInfoData(false);