fix(Core/Unit): Implement GetDisplayRace() (#17609)

This commit is contained in:
Ludwig
2023-11-08 19:19:38 +01:00
committed by GitHub
parent e18bfae91c
commit ef09d4b63f
3 changed files with 41 additions and 0 deletions

View File

@@ -21145,6 +21145,18 @@ void Unit::setRace(uint8 race)
m_race = race;
}
DisplayRace Unit::GetDisplayRaceFromModelId(uint32 modelId) const
{
if (CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(modelId))
{
if (CreatureDisplayInfoExtraEntry const* displayExtra = sCreatureDisplayInfoExtraStore.LookupEntry(display->ExtendedDisplayInfoID))
{
return DisplayRace(displayExtra->DisplayRaceID);
}
}
return DisplayRace::None;
}
// Check if unit in combat with specific unit
bool Unit::IsInCombatWith(Unit const* who) const
{