fix(Core/Spells): Do not send doubled learning packet if spell is lea… (#8140)

* fix(Core/Spells): Do not send doubled learning packet if spell is learned from skill.

Fixes #7764

* typo.
This commit is contained in:
UltraNix
2021-10-01 01:16:48 +02:00
committed by GitHub
parent e4c07cd864
commit 30e9ce350c
2 changed files with 6 additions and 6 deletions

View File

@@ -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);
}
}
}