mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 17:49:10 +00:00
fix(core/dbc): improve ChrRace DBC handling (#14843)
Cherry pick of https://github.com/TrinityCore/TrinityCore/pull/24508 Co-authored-by: HelloKitty <5829095+HelloKitty@users.noreply.github.com>
This commit is contained in:
@@ -9968,9 +9968,15 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au
|
||||
return true;
|
||||
}
|
||||
|
||||
void Unit::setPowerType(Powers new_powertype)
|
||||
void Unit::setPowerType(Powers new_powertype, bool sendUpdate/* = true*/)
|
||||
{
|
||||
SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype);
|
||||
if (getPowerType() == new_powertype)
|
||||
return;
|
||||
|
||||
SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_POWER_TYPE, new_powertype);
|
||||
|
||||
if (!sendUpdate)
|
||||
return;
|
||||
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
@@ -15173,7 +15179,10 @@ uint32 Unit::GetCreatureType() const
|
||||
if (ssEntry && ssEntry->creatureType > 0)
|
||||
return ssEntry->creatureType;
|
||||
else
|
||||
return CREATURE_TYPE_HUMANOID;
|
||||
{
|
||||
ChrRacesEntry const* raceEntry = sChrRacesStore.AssertEntry(getRace());
|
||||
return raceEntry->CreatureType;
|
||||
}
|
||||
}
|
||||
else
|
||||
return ToCreature()->GetCreatureTemplate()->type;
|
||||
@@ -21277,25 +21286,6 @@ void Unit::BuildCooldownPacket(WorldPacket& data, uint8 flags, PacketCooldowns c
|
||||
}
|
||||
}
|
||||
|
||||
uint8 Unit::getRace(bool original) const
|
||||
{
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (original)
|
||||
return m_realRace;
|
||||
else
|
||||
return m_race;
|
||||
}
|
||||
|
||||
return GetByteValue(UNIT_FIELD_BYTES_0, 0);
|
||||
}
|
||||
|
||||
void Unit::setRace(uint8 race)
|
||||
{
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
m_race = race;
|
||||
}
|
||||
|
||||
// Check if unit in combat with specific unit
|
||||
bool Unit::IsInCombatWith(Unit const* who) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user