fix(Core/Player): Fixes visual bug in Death Knight trainer and other classes for spells with multiple ranks

The fix was implemented generically in the Player::GetTrainerSpellState() function, ensuring that, for any spell that is part of a rank chain, the trainer correctly recognizes whether the player already knows any higher rank and marks the spell as "already learned" (TRAINER_SPELL_GRAY).

This improvement prevents the visual bug not only for Death Knights, but for any class with spells at multiple ranks, aligning the behavior with what's expected in the official client.
This commit is contained in:
EricksOliveira 2025-08-12 10:08:32 -03:00 committed by GitHub
parent 9efdd9798f
commit 54a50c5580
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3924,6 +3924,21 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
if (!trainer_spell)
return TRAINER_SPELL_RED;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!trainer_spell->learnedSpell[i])
continue;
if (uint32 firstRankSpell = sSpellMgr->GetFirstSpellInChain(trainer_spell->learnedSpell[i]))
{
for (uint32 spellId = firstRankSpell; spellId; spellId = sSpellMgr->GetNextSpellInChain(spellId))
{
if (HasSpell(spellId))
return TRAINER_SPELL_GRAY;
}
}
}
bool hasSpell = true;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{