fix(Core/Player): Only mark spells as invalid when none of the Skills match (#22537)
This commit is contained in:
@@ -3104,22 +3104,26 @@ bool Player::addSpell(uint32 spellId, uint8 addSpecMask, bool updateActive, bool
|
|||||||
bool Player::CheckSkillLearnedBySpell(uint32 spellId)
|
bool Player::CheckSkillLearnedBySpell(uint32 spellId)
|
||||||
{
|
{
|
||||||
SkillLineAbilityMapBounds skill_bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);
|
SkillLineAbilityMapBounds skill_bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);
|
||||||
|
uint32 errorSkill = 0;
|
||||||
for (SkillLineAbilityMap::const_iterator sla = skill_bounds.first; sla != skill_bounds.second; ++sla)
|
for (SkillLineAbilityMap::const_iterator sla = skill_bounds.first; sla != skill_bounds.second; ++sla)
|
||||||
{
|
{
|
||||||
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(sla->second->SkillLine);
|
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(sla->second->SkillLine);
|
||||||
if (!pSkill)
|
if (!pSkill)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(pSkill->id, getRace(), getClass());
|
if (GetSkillRaceClassInfo(pSkill->id, getRace(), getClass()))
|
||||||
if (!rcEntry)
|
return true;
|
||||||
{
|
else
|
||||||
LOG_ERROR("entities.player", "Player {} (GUID: {}), has spell ({}) that teach skill ({}) which is invalid for the race/class combination (Race: {}, Class: {}). Will be deleted.",
|
errorSkill = pSkill->id;
|
||||||
GetName(), GetGUID().GetCounter(), spellId, pSkill->id, getRace(), getClass());
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user