fix(Core/Player): Only mark spells as invalid when none of the Skills match (#22537)

This commit is contained in:
Tereneckla 2025-07-23 15:49:29 +00:00 committed by GitHub
parent 6bf8469cf3
commit a96c7e85c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3104,22 +3104,26 @@ bool Player::addSpell(uint32 spellId, uint8 addSpecMask, bool updateActive, bool
bool Player::CheckSkillLearnedBySpell(uint32 spellId)
{
SkillLineAbilityMapBounds skill_bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);
uint32 errorSkill = 0;
for (SkillLineAbilityMap::const_iterator sla = skill_bounds.first; sla != skill_bounds.second; ++sla)
{
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(sla->second->SkillLine);
if (!pSkill)
continue;
SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(pSkill->id, getRace(), getClass());
if (!rcEntry)
{
LOG_ERROR("entities.player", "Player {} (GUID: {}), has spell ({}) that teach skill ({}) which is invalid for the race/class combination (Race: {}, Class: {}). Will be deleted.",
GetName(), GetGUID().GetCounter(), spellId, pSkill->id, getRace(), getClass());
return false;
}
if (GetSkillRaceClassInfo(pSkill->id, getRace(), getClass()))
return true;
else
errorSkill = pSkill->id;
}
if (errorSkill)
{
LOG_ERROR("entities.player", "Player {} (GUID: {}), has spell ({}) that teach skill ({}) which is invalid for the race/class combination (Race: {}, Class: {}). Will be deleted.",
GetName(), GetGUID().GetCounter(), spellId, errorSkill, getRace(), getClass());
return false;
}
return true;
}