Core/Unit: Random code style/naming adjustments

This commit is contained in:
Treeston
2018-08-27 19:37:29 +02:00
parent 5cea572a9a
commit 710488ea20
4 changed files with 21 additions and 29 deletions

View File

@@ -288,10 +288,9 @@ bool DispelableAura::RollDispel() const
}
Unit::Unit(bool isWorldObject) :
WorldObject(isWorldObject), m_playerMovingMe(nullptr), m_lastSanctuaryTime(0),
LastCharmerGUID(), m_ControlledByPlayer(false),
movespline(new Movement::MoveSpline()), m_AutoRepeatFirstCast(false), m_procDeep(0), m_removedAurasCount(0),
m_charmer(nullptr), m_charmed(nullptr),
WorldObject(isWorldObject), m_playerMovingMe(nullptr), m_lastSanctuaryTime(0), LastCharmerGUID(),
movespline(new Movement::MoveSpline()), m_ControlledByPlayer(false), m_AutoRepeatFirstCast(false),
m_procDeep(0), m_transformSpell(0), m_removedAurasCount(0), m_charmer(nullptr), m_charmed(nullptr),
i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_vehicle(nullptr), m_vehicleKit(nullptr),
m_unitTypeMask(UNIT_MASK_NONE), m_Diminishing(), m_combatManager(this), m_threatManager(this),
m_comboTarget(nullptr), m_comboPoints(0), m_spellHistory(new SpellHistory(this))
@@ -328,7 +327,6 @@ Unit::Unit(bool isWorldObject) :
m_auraUpdateIterator = m_ownedAuras.end();
m_interruptMask = 0;
m_transform = 0;
m_canModifyStats = false;
for (uint8 i = 0; i < UNIT_MOD_END; ++i)
@@ -8858,7 +8856,7 @@ bool Unit::IsInFeralForm() const
bool Unit::IsInDisallowedMountForm() const
{
if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(getTransForm()))
if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(GetTransformSpell()))
if (transformSpellInfo->HasAttribute(SPELL_ATTR0_CASTABLE_WHILE_MOUNTED))
return false;
@@ -9835,11 +9833,6 @@ Player* Unit::GetPlayerBeingMoved() const
return nullptr;
}
bool Unit::isFrozen() const
{
return HasAuraState(AURA_STATE_FROZEN);
}
uint32 createProcHitMask(SpellNonMeleeDamage* damageInfo, SpellMissInfo missCondition)
{
uint32 hitMask = PROC_HIT_NONE;
@@ -10211,7 +10204,7 @@ void Unit::SetStandState(uint8 state)
bool Unit::IsPolymorphed() const
{
uint32 transformId = getTransForm();
uint32 transformId = GetTransformSpell();
if (!transformId)
return false;
@@ -13208,7 +13201,7 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
CreatureTemplate const* cinfo = creature->GetCreatureTemplate();
// this also applies for transform auras
if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(getTransForm()))
if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(GetTransformSpell()))
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (transform->Effects[i].IsAura(SPELL_AURA_TRANSFORM))
if (CreatureTemplate const* transformInfo = sObjectMgr->GetCreatureTemplate(transform->Effects[i].MiscValue))

View File

@@ -1061,11 +1061,10 @@ class TC_GAME_API Unit : public WorldObject
bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); }
bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); }
bool isFeared() const { return HasAuraType(SPELL_AURA_MOD_FEAR); }
bool isInRoots() const { return HasAuraType(SPELL_AURA_MOD_ROOT); }
bool IsFeared() const { return HasAuraType(SPELL_AURA_MOD_FEAR); }
bool IsRooted() const { return HasAuraType(SPELL_AURA_MOD_ROOT); }
bool IsPolymorphed() const;
bool isFrozen() const;
bool IsFrozen() const { return HasAuraState(AURA_STATE_FROZEN); }
bool isTargetableForAttack(bool checkFakeDeath = true) const;
@@ -1460,8 +1459,8 @@ class TC_GAME_API Unit : public WorldObject
uint32 GetNativeDisplayId() const { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID); }
void RestoreDisplayId();
void SetNativeDisplayId(uint32 modelId) { SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, modelId); }
void setTransForm(uint32 spellid) { m_transform = spellid;}
uint32 getTransForm() const { return m_transform;}
void SetTransformSpell(uint32 spellid) { m_transformSpell = spellid;}
uint32 GetTransformSpell() const { return m_transformSpell;}
// DynamicObject management
void _RegisterDynObject(DynamicObject* dynObj);
@@ -1612,8 +1611,6 @@ class TC_GAME_API Unit : public WorldObject
/// Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
TransportBase* GetDirectTransport() const;
bool m_ControlledByPlayer;
void HandleSpellClick(Unit* clicker, int8 seatId = -1);
void EnterVehicle(Unit* base, int8 seatId = -1);
void ExitVehicle(Position const* exitPosition = nullptr);
@@ -1689,6 +1686,8 @@ class TC_GAME_API Unit : public WorldObject
void _UpdateAutoRepeatSpell();
bool m_ControlledByPlayer;
bool m_AutoRepeatFirstCast;
uint32 m_attackTimer[MAX_ATTACK];
@@ -1708,7 +1707,7 @@ class TC_GAME_API Unit : public WorldObject
typedef std::list<GameObject*> GameObjectList;
GameObjectList m_gameObj;
uint32 m_transform;
uint32 m_transformSpell;
Spell* m_currentSpells[CURRENT_MAX_SPELL];

View File

@@ -835,7 +835,7 @@ namespace Trinity
bool operator()(Unit* u) const
{
if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
(u->isFeared() || u->IsCharmed() || u->isFrozen() || u->HasUnitState(UNIT_STATE_STUNNED) || u->HasUnitState(UNIT_STATE_CONFUSED)))
(u->IsFeared() || u->IsCharmed() || u->IsRooted() || u->HasUnitState(UNIT_STATE_STUNNED) || u->HasUnitState(UNIT_STATE_CONFUSED)))
{
return true;
}

View File

@@ -1705,7 +1705,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
// and polymorphic affects
if (target->IsPolymorphed())
target->RemoveAurasDueToSpell(target->getTransForm());
target->RemoveAurasDueToSpell(target->GetTransformSpell());
break;
}
default:
@@ -1777,7 +1777,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
if (modelid > 0)
{
SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm());
SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->GetTransformSpell());
if (!transformSpellInfo || !GetSpellInfo()->IsPositive())
target->SetDisplayId(modelid);
}
@@ -1902,10 +1902,10 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
if (apply)
{
// update active transform spell only when transform not set or not overwriting negative by positive case
SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm());
SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->GetTransformSpell());
if (!transformSpellInfo || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive())
{
target->setTransForm(GetId());
target->SetTransformSpell(GetId());
// special case (spell specific functionality)
if (GetMiscValue() == 0)
{
@@ -2091,8 +2091,8 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
else
{
// HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true) will reapply it if need
if (target->getTransForm() == GetId())
target->setTransForm(0);
if (target->GetTransformSpell() == GetId())
target->SetTransformSpell(0);
target->RestoreDisplayId();