fix(Core/Spells): Spells learned from skills should be visibile immediately in the spellbook and chat. (#5106)

This commit is contained in:
UltraNix
2021-04-09 05:09:17 +02:00
committed by GitHub
parent a2c034dc48
commit 3de7d14620
2 changed files with 7 additions and 7 deletions

View File

@@ -3908,9 +3908,9 @@ void Player::SendLearnPacket(uint32 spellId, bool learn)
}
}
bool Player::addSpell(uint32 spellId, uint8 addSpecMask, bool updateActive, bool temporary)
bool Player::addSpell(uint32 spellId, uint8 addSpecMask, bool updateActive, bool temporary /*= false*/, bool learnFromSkill /*= false*/)
{
if (!_addSpell(spellId, addSpecMask, temporary))
if (!_addSpell(spellId, addSpecMask, temporary, learnFromSkill))
return false;
if (!updateActive)
@@ -3955,7 +3955,7 @@ bool Player::addSpell(uint32 spellId, uint8 addSpecMask, bool updateActive, bool
return true;
}
bool Player::_addSpell(uint32 spellId, uint8 addSpecMask, bool temporary)
bool Player::_addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool learnFromSkill /*= false*/)
{
// pussywizard: this can be called to OVERWRITE currently existing spell params! usually to set active = false for lower ranks of a spell
@@ -3971,7 +3971,7 @@ bool Player::_addSpell(uint32 spellId, uint8 addSpecMask, bool temporary)
// 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 && (!spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)) || !spellInfo->HasAnyAura()) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
if (IsInWorld() && !isBeingLoaded() && temporary && (learnFromSkill || !spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)) || !spellInfo->HasAnyAura()) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
SendLearnPacket(spellInfo->Id, true);
// xinef: DO NOT allow to learn spell with effect learn spell!
@@ -24033,7 +24033,7 @@ void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value)
continue;
}
addSpell(pAbility->spellId, SPEC_MASK_ALL, true, true);
addSpell(pAbility->spellId, SPEC_MASK_ALL, true, true, true);
}
}
}