mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
fix(Core/Unit): Implement GetDisplayRace() (#17609)
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -1438,6 +1438,8 @@ public:
|
||||
[[nodiscard]] uint8 getClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, 1); }
|
||||
[[nodiscard]] uint32 getClassMask() const { return 1 << (getClass() - 1); }
|
||||
[[nodiscard]] uint8 getGender() const { return GetByteValue(UNIT_FIELD_BYTES_0, 2); }
|
||||
[[nodiscard]] DisplayRace GetDisplayRaceFromModelId(uint32 modelId) const;
|
||||
[[nodiscard]] DisplayRace GetDisplayRace() const { return GetDisplayRaceFromModelId(GetDisplayId()); };
|
||||
|
||||
[[nodiscard]] float GetStat(Stats stat) const { return float(GetUInt32Value(static_cast<uint16>(UNIT_FIELD_STAT0) + stat)); }
|
||||
void SetStat(Stats stat, int32 val) { SetStatInt32Value(static_cast<uint16>(UNIT_FIELD_STAT0) + stat, val); }
|
||||
|
||||
Reference in New Issue
Block a user