fix(Core/Trainers): add new column ReqSpell to npc_trainer table (#9490)

Prevent learning gnomish and goblin engineering recipes at same time.
Fixes #5390

Co-authored-by: Skjalf <47818697+Nyeriah@users.noreply.github.com>
This commit is contained in:
UltraNix
2021-12-16 11:18:21 +01:00
committed by GitHub
parent c822ef969b
commit 0f83d52f43
6 changed files with 75 additions and 4 deletions

View File

@@ -182,9 +182,15 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank())
primary_prof_first_rank = true;
}
if (!valid)
continue;
if (tSpell->reqSpell && !_player->HasSpell(tSpell->reqSpell))
{
continue;
}
TrainerSpellState state = _player->GetTrainerSpellState(tSpell);
data << uint32(tSpell->spell); // learned spell (or cast-spell in profession case)
@@ -263,6 +269,11 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
if (!trainer_spell)
return;
if (trainer_spell->reqSpell && !_player->HasSpell(trainer_spell->reqSpell))
{
return;
}
// can't be learn, cheat? Or double learn with lags...
if (_player->GetTrainerSpellState(trainer_spell) != TRAINER_SPELL_GREEN)
return;