mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 17:13:47 +00:00
fix(Core/Creatures): Fixed displaying trainer npcflags that are not valid to player. (#4848)
This commit is contained in:
@@ -1033,6 +1033,47 @@ bool Creature::isCanTrainingAndResetTalentsOf(Player* player) const
|
||||
&& player->getClass() == GetCreatureTemplate()->trainer_class;
|
||||
}
|
||||
|
||||
bool Creature::IsValidTrainerForPlayer(Player* player, uint32* npcFlags /*= nullptr*/) const
|
||||
{
|
||||
if (!IsTrainer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (m_creatureInfo->trainer_type)
|
||||
{
|
||||
case TRAINER_TYPE_CLASS:
|
||||
case TRAINER_TYPE_PETS:
|
||||
if (m_creatureInfo->trainer_class && m_creatureInfo->trainer_class != player->getClass())
|
||||
{
|
||||
if (npcFlags)
|
||||
*npcFlags &= ~UNIT_NPC_FLAG_TRAINER_CLASS;
|
||||
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case TRAINER_TYPE_MOUNTS:
|
||||
if (m_creatureInfo->trainer_race && m_creatureInfo->trainer_race != player->getRace())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case TRAINER_TYPE_TRADESKILLS:
|
||||
if (m_creatureInfo->trainer_spell && !player->HasSpell(m_creatureInfo->trainer_spell))
|
||||
{
|
||||
if (npcFlags)
|
||||
*npcFlags &= ~UNIT_NPC_FLAG_TRAINER_PROFESSION;
|
||||
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Player* Creature::GetLootRecipient() const
|
||||
{
|
||||
if (!m_lootRecipient)
|
||||
|
||||
Reference in New Issue
Block a user