From 30e9ce350c11de35cbf27f78943e812b4b4e328a Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Fri, 1 Oct 2021 01:16:48 +0200 Subject: [PATCH] =?UTF-8?q?fix(Core/Spells):=20Do=20not=20send=20doubled?= =?UTF-8?q?=20learning=20packet=20if=20spell=20is=20lea=E2=80=A6=20(#8140)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(Core/Spells): Do not send doubled learning packet if spell is learned from skill. Fixes #7764 * typo. --- src/server/game/Entities/Player/Player.cpp | 10 +++++----- src/server/game/Entities/Player/Player.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 037c3260a..6b2271396 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2996,7 +2996,7 @@ bool Player::_addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool l // xinef: send packet so client can properly recognize this new spell // xinef: ignore passive spells and spells with learn effect // xinef: send spells with no aura effects (ie dual wield) - if (IsInWorld() && !isBeingLoaded() && temporary && (learnFromSkill || !spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_DO_NOT_DISPLAY)) || !spellInfo->HasAnyAura()) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) + if (IsInWorld() && !isBeingLoaded() && temporary && !learnFromSkill && (!spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_DO_NOT_DISPLAY)) || !spellInfo->HasAnyAura()) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) SendLearnPacket(spellInfo->Id, true); // xinef: DO NOT allow to learn spell with effect learn spell! @@ -3168,7 +3168,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const (!form && spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED))); } -void Player::learnSpell(uint32 spellId, bool temporary) +void Player::learnSpell(uint32 spellId, bool temporary /*= false*/, bool learnFromSkill /*= false*/) { // Xinef: don't allow to learn active spell once more if (HasActiveSpell(spellId)) @@ -3179,7 +3179,7 @@ void Player::learnSpell(uint32 spellId, bool temporary) uint32 firstRankSpellId = sSpellMgr->GetFirstSpellInChain(spellId); bool thisSpec = GetTalentSpellCost(firstRankSpellId) > 0 || sSpellMgr->IsAdditionalTalentSpell(firstRankSpellId); - bool added = addSpell(spellId, thisSpec ? GetActiveSpecMask() : SPEC_MASK_ALL, true, temporary); + bool added = addSpell(spellId, thisSpec ? GetActiveSpecMask() : SPEC_MASK_ALL, true, temporary, learnFromSkill); if (added) { sScriptMgr->OnPlayerLearnSpell(this, spellId); @@ -11260,11 +11260,11 @@ void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value) if (!IsInWorld()) { - addSpell(pAbility->Spell, SPEC_MASK_ALL, true, true, false); + addSpell(pAbility->Spell, SPEC_MASK_ALL, true, true); } else { - learnSpell(pAbility->Spell, true); + learnSpell(pAbility->Spell, true, true); } } } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index fc22a0863..9c2d47118 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1629,7 +1629,7 @@ public: void SendLearnPacket(uint32 spellId, bool learn); bool addSpell(uint32 spellId, uint8 addSpecMask, bool updateActive, bool temporary = false, bool learnFromSkill = false); bool _addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool learnFromSkill = false); - void learnSpell(uint32 spellId, bool temporary = false); + void learnSpell(uint32 spellId, bool temporary = false, bool learnFromSkill = false); void removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporary); void resetSpells(); void LearnCustomSpells();