Core/Unit: enable setting and retrieval of a temporary race for players
This commit is contained in:
@@ -151,7 +151,7 @@ m_movedByPlayer(NULL), m_lastSanctuaryTime(0), IsAIEnabled(false), NeedChangeAI(
|
|||||||
m_ControlledByPlayer(false), m_CreatedByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL),
|
m_ControlledByPlayer(false), m_CreatedByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL),
|
||||||
i_disabledAI(NULL), m_procDeep(0), m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_regenTimer(0),
|
i_disabledAI(NULL), m_procDeep(0), m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_regenTimer(0),
|
||||||
m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE),
|
m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE),
|
||||||
m_HostileRefManager(this), m_AutoRepeatFirstCast(false), m_realRace(0)
|
m_HostileRefManager(this), m_AutoRepeatFirstCast(false), m_realRace(0), m_race(0)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(default:4355)
|
#pragma warning(default:4355)
|
||||||
@@ -17857,6 +17857,21 @@ uint32 Unit::GetModelForTotem(PlayerTotemType totemType)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default: // One standard for other races.
|
||||||
|
{
|
||||||
|
switch (totemType)
|
||||||
|
{
|
||||||
|
case SUMMON_TYPE_TOTEM_FIRE: // fire
|
||||||
|
return 4589;
|
||||||
|
case SUMMON_TYPE_TOTEM_EARTH: // earth
|
||||||
|
return 4588;
|
||||||
|
case SUMMON_TYPE_TOTEM_WATER: // water
|
||||||
|
return 4587;
|
||||||
|
case SUMMON_TYPE_TOTEM_AIR: // air
|
||||||
|
return 4590;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -19264,8 +19279,19 @@ void Unit::BuildCooldownPacket(WorldPacket& data, uint8 flags, PacketCooldowns c
|
|||||||
|
|
||||||
uint8 Unit::getRace(bool original) const
|
uint8 Unit::getRace(bool original) const
|
||||||
{
|
{
|
||||||
if (GetTypeId() == TYPEID_PLAYER && original)
|
if (GetTypeId() == TYPEID_PLAYER)
|
||||||
return m_realRace;
|
{
|
||||||
|
if (original)
|
||||||
|
return m_realRace;
|
||||||
|
else
|
||||||
|
return m_race;
|
||||||
|
}
|
||||||
|
|
||||||
return GetByteValue(UNIT_FIELD_BYTES_0, 0);
|
return GetByteValue(UNIT_FIELD_BYTES_0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Unit::setRace(uint8 race)
|
||||||
|
{
|
||||||
|
if (GetTypeId() == TYPEID_PLAYER)
|
||||||
|
m_race = race;
|
||||||
}
|
}
|
||||||
@@ -1458,6 +1458,7 @@ class Unit : public WorldObject
|
|||||||
uint8 getLevelForTarget(WorldObject const* /*target*/) const { return getLevel(); }
|
uint8 getLevelForTarget(WorldObject const* /*target*/) const { return getLevel(); }
|
||||||
void SetLevel(uint8 lvl, bool showLevelChange = true);
|
void SetLevel(uint8 lvl, bool showLevelChange = true);
|
||||||
uint8 getRace(bool original = false) const;
|
uint8 getRace(bool original = false) const;
|
||||||
|
void setRace(uint8 race);
|
||||||
uint32 getRaceMask() const { return 1 << (getRace(true)-1); }
|
uint32 getRaceMask() const { return 1 << (getRace(true)-1); }
|
||||||
uint8 getClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, 1); }
|
uint8 getClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, 1); }
|
||||||
uint32 getClassMask() const { return 1 << (getClass()-1); }
|
uint32 getClassMask() const { return 1 << (getClass()-1); }
|
||||||
@@ -2441,6 +2442,7 @@ class Unit : public WorldObject
|
|||||||
void _UpdateAutoRepeatSpell();
|
void _UpdateAutoRepeatSpell();
|
||||||
|
|
||||||
uint8 m_realRace;
|
uint8 m_realRace;
|
||||||
|
uint8 m_race;
|
||||||
|
|
||||||
bool m_AutoRepeatFirstCast;
|
bool m_AutoRepeatFirstCast;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user