fix(Core/Player): reapply talent auras on item change (#24048)

Co-authored-by: r0m1ntik <40755539+r0m1ntik@users.noreply.github.com>
This commit is contained in:
Tereneckla 2025-12-05 09:36:13 +00:00 committed by GitHub
parent 88078c81f4
commit 20326e7330
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7158,18 +7158,34 @@ void Player::ApplyItemDependentAuras(Item* item, bool apply)
{
if (apply)
{
PlayerSpellMap const& spells = GetSpellMap();
for (auto itr = spells.begin(); itr != spells.end(); ++itr)
for (auto [spellId, playerSpell]: GetSpellMap())
{
if (itr->second->State == PLAYERSPELL_REMOVED)
if (playerSpell->State == PLAYERSPELL_REMOVED)
continue;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo || !spellInfo->IsPassive() || spellInfo->EquippedItemClass < 0)
continue;
if (!HasAura(itr->first) && HasItemFitToSpellRequirements(spellInfo))
AddAura(itr->first, this); // no SMSG_SPELL_GO in sniff found
if (!HasAura(spellId) && HasItemFitToSpellRequirements(spellInfo))
AddAura(spellId, this); // no SMSG_SPELL_GO in sniff found
}
// Check talents (they are stored separately from regular spells)
for (auto [spellId, playerTalent] : GetTalentMap())
{
if (playerTalent->State == PLAYERSPELL_REMOVED)
continue;
if (!(playerTalent->IsInSpec(GetActiveSpec())))
continue;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo || !spellInfo->IsPassive() || spellInfo->EquippedItemClass < 0)
continue;
if (!HasAura(spellId) && HasItemFitToSpellRequirements(spellInfo))
AddAura(spellId, this);
}
}
else