fix(Core/Player): Fix skill rewarded spell learning to properly handle skill-rewarded spells with out-of-order IDs (#24581)
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -11993,7 +11993,17 @@ void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value)
|
|||||||
{
|
{
|
||||||
uint32 raceMask = getRaceMask();
|
uint32 raceMask = getRaceMask();
|
||||||
uint32 classMask = getClassMask();
|
uint32 classMask = getClassMask();
|
||||||
for (SkillLineAbilityEntry const* pAbility : GetSkillLineAbilitiesBySkillLine(skill_id))
|
|
||||||
|
// Get all abilities for this skill and sort by MinSkillLineRank (lowest to highest)
|
||||||
|
auto abilities = GetSkillLineAbilitiesBySkillLine(skill_id);
|
||||||
|
std::vector<SkillLineAbilityEntry const*> sortedAbilities(abilities.begin(), abilities.end());
|
||||||
|
std::sort(sortedAbilities.begin(), sortedAbilities.end(),
|
||||||
|
[](SkillLineAbilityEntry const* a, SkillLineAbilityEntry const* b)
|
||||||
|
{
|
||||||
|
return a->MinSkillLineRank < b->MinSkillLineRank;
|
||||||
|
});
|
||||||
|
|
||||||
|
for (SkillLineAbilityEntry const* pAbility : sortedAbilities)
|
||||||
{
|
{
|
||||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pAbility->Spell);
|
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pAbility->Spell);
|
||||||
if (!spellInfo)
|
if (!spellInfo)
|
||||||
|
|||||||
Reference in New Issue
Block a user