mirror of
https://github.com/azerothcore/azerothcore-wotlk.git
synced 2025-11-10 12:24:22 +08:00
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:
parent
9efdd9798f
commit
54a50c5580
@ -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)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user