aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/AchievementMgr.cpp6
-rw-r--r--src/game/GameObject.cpp32
-rw-r--r--src/game/GridNotifiers.h4
-rw-r--r--src/game/GridNotifiersImpl.h4
-rw-r--r--src/game/HostilRefManager.cpp24
-rw-r--r--src/game/HostilRefManager.h8
-rw-r--r--src/game/Level1.cpp2
-rw-r--r--src/game/Level3.cpp6
-rw-r--r--src/game/Map.cpp6
-rw-r--r--src/game/MotionMaster.cpp54
-rw-r--r--src/game/MovementHandler.cpp2
-rw-r--r--src/game/Object.cpp4
-rw-r--r--src/game/Pet.cpp4
-rw-r--r--src/game/Player.cpp8
-rw-r--r--src/game/QuestHandler.cpp4
-rw-r--r--src/game/Spell.cpp32
-rw-r--r--src/game/SpellAuras.cpp70
-rw-r--r--src/game/SpellEffects.cpp38
-rw-r--r--src/game/SpellHandler.cpp8
-rw-r--r--src/game/StatSystem.cpp2
-rw-r--r--src/game/ThreatManager.cpp92
-rw-r--r--src/game/ThreatManager.h49
-rw-r--r--src/game/Unit.cpp617
-rw-r--r--src/game/Unit.h4
-rw-r--r--src/game/WorldSession.cpp4
25 files changed, 543 insertions, 541 deletions
diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index a2c76ffb4c6..f041749cf08 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -255,7 +255,7 @@ bool AchievementCriteriaData::Meets(Player const* source, Unit const* target, ui
return false;
return target->GetEntry() == creature.id;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
- if (!target || target->GetTypeId()!=TYPEID_PLAYER)
+ if (!target || target->GetTypeId() != TYPEID_PLAYER)
return false;
if(classRace.class_id && classRace.class_id != ((Player*)target)->getClass())
return false;
@@ -263,7 +263,7 @@ bool AchievementCriteriaData::Meets(Player const* source, Unit const* target, ui
return false;
return true;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH:
- if (!target || target->GetTypeId()!=TYPEID_PLAYER)
+ if (!target || target->GetTypeId() != TYPEID_PLAYER)
return false;
return target->GetHealth()*100 <= health.percent*target->GetMaxHealth();
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD:
@@ -1210,7 +1210,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
continue;
// map specific case (BG in fact) expected player targeted damage/heal
- if(!unit || unit->GetTypeId()!=TYPEID_PLAYER)
+ if(!unit || unit->GetTypeId() != TYPEID_PLAYER)
continue;
}
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
index ae12b1cb379..c026cb6edf2 100644
--- a/src/game/GameObject.cpp
+++ b/src/game/GameObject.cpp
@@ -229,7 +229,7 @@ void GameObject::Update(uint32 /*p_time*/)
{
// splash bobber (bobber ready now)
Unit* caster = GetOwner();
- if(caster && caster->GetTypeId()==TYPEID_PLAYER)
+ if(caster && caster->GetTypeId() == TYPEID_PLAYER)
{
SetGoState(GO_STATE_ACTIVE);
SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
@@ -268,7 +268,7 @@ void GameObject::Update(uint32 /*p_time*/)
case GAMEOBJECT_TYPE_FISHINGNODE: // can't fish now
{
Unit* caster = GetOwner();
- if(caster && caster->GetTypeId()==TYPEID_PLAYER)
+ if(caster && caster->GetTypeId() == TYPEID_PLAYER)
{
caster->FinishSpell(CURRENT_CHANNELED_SPELL);
@@ -965,7 +965,7 @@ void GameObject::Use(Unit* user)
case GAMEOBJECT_TYPE_QUESTGIVER: //2
{
- if(user->GetTypeId()!=TYPEID_PLAYER)
+ if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -981,7 +981,7 @@ void GameObject::Use(Unit* user)
if(!info)
return;
- if(user->GetTypeId()!=TYPEID_PLAYER)
+ if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1040,7 +1040,7 @@ void GameObject::Use(Unit* user)
{
GameObjectInfo const* info = GetGOInfo();
- if(user->GetTypeId()==TYPEID_PLAYER)
+ if(user->GetTypeId() == TYPEID_PLAYER)
{
Player* player = (Player*)user;
@@ -1070,7 +1070,7 @@ void GameObject::Use(Unit* user)
if(!info)
return;
- if(user->GetTypeId()!=TYPEID_PLAYER)
+ if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1086,7 +1086,7 @@ void GameObject::Use(Unit* user)
//fishing bobber
case GAMEOBJECT_TYPE_FISHINGNODE: //17
{
- if(user->GetTypeId()!=TYPEID_PLAYER)
+ if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1162,7 +1162,7 @@ void GameObject::Use(Unit* user)
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
{
- if(user->GetTypeId()!=TYPEID_PLAYER)
+ if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1171,7 +1171,7 @@ void GameObject::Use(Unit* user)
GameObjectInfo const* info = GetGOInfo();
- if( !caster || caster->GetTypeId()!=TYPEID_PLAYER )
+ if( !caster || caster->GetTypeId() != TYPEID_PLAYER )
return;
// accept only use by player from same group for caster except caster itself
@@ -1219,10 +1219,10 @@ void GameObject::Use(Unit* user)
if(info->spellcaster.partyOnly)
{
Unit* caster = GetOwner();
- if( !caster || caster->GetTypeId()!=TYPEID_PLAYER )
+ if( !caster || caster->GetTypeId() != TYPEID_PLAYER )
return;
- if(user->GetTypeId()!=TYPEID_PLAYER || !((Player*)user)->IsInSameRaidWith((Player*)caster))
+ if(user->GetTypeId() != TYPEID_PLAYER || !((Player*)user)->IsInSameRaidWith((Player*)caster))
return;
}
@@ -1235,7 +1235,7 @@ void GameObject::Use(Unit* user)
{
GameObjectInfo const* info = GetGOInfo();
- if(user->GetTypeId()!=TYPEID_PLAYER)
+ if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1264,7 +1264,7 @@ void GameObject::Use(Unit* user)
case GAMEOBJECT_TYPE_FLAGSTAND: // 24
{
- if(user->GetTypeId()!=TYPEID_PLAYER)
+ if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1289,7 +1289,7 @@ void GameObject::Use(Unit* user)
}
case GAMEOBJECT_TYPE_FLAGDROP: // 26
{
- if(user->GetTypeId()!=TYPEID_PLAYER)
+ if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1338,7 +1338,7 @@ void GameObject::Use(Unit* user)
if(!info)
return;
- if(user->GetTypeId()!=TYPEID_PLAYER)
+ if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1363,7 +1363,7 @@ void GameObject::Use(Unit* user)
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellId );
if(!spellInfo)
{
- if(user->GetTypeId()!=TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this))
+ if(user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this))
sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId,GetEntry(),GetGoType());
else
sLog.outDebug("WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId);
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index 38cef3bd61a..42c4960f90c 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -524,7 +524,7 @@ namespace Trinity
RaiseDeadObjectCheck(Unit* funit, float range) : i_funit(funit), i_range(range) {}
bool operator()(Creature* u)
{
- if (i_funit->GetTypeId()!=TYPEID_PLAYER || !((Player*)i_funit)->isHonorOrXPTarget(u) ||
+ if (i_funit->GetTypeId() != TYPEID_PLAYER || !((Player*)i_funit)->isHonorOrXPTarget(u) ||
u->getDeathState() != CORPSE || u->isDeadByDefault() || u->isInFlight() ||
( u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1)) )==0 ||
(u->GetDisplayId() != u->GetNativeDisplayId()))
@@ -903,7 +903,7 @@ namespace Trinity
Unit const* owner = i_funit->GetOwner();
if(owner)
check = owner;
- i_targetForPlayer = ( check->GetTypeId()==TYPEID_PLAYER );
+ i_targetForPlayer = ( check->GetTypeId() == TYPEID_PLAYER );
}
bool operator()(Unit* u)
{
diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h
index 5a439b9c164..b15b57eff29 100644
--- a/src/game/GridNotifiersImpl.h
+++ b/src/game/GridNotifiersImpl.h
@@ -166,7 +166,7 @@ inline void Trinity::DynamicObjectUpdater::VisitHelper(Unit* target)
return;
//Check player targets and remove if in GM mode or GM invisibility (for not self casting case)
- if( target->GetTypeId()==TYPEID_PLAYER && target != i_check && (((Player*)target)->isGameMaster() || ((Player*)target)->GetVisibility()==VISIBILITY_OFF) )
+ if( target->GetTypeId() == TYPEID_PLAYER && target != i_check && (((Player*)target)->isGameMaster() || ((Player*)target)->GetVisibility()==VISIBILITY_OFF) )
return;
if (i_dynobject.IsAffecting(target))
@@ -190,7 +190,7 @@ inline void Trinity::DynamicObjectUpdater::VisitHelper(Unit* target)
if(!i_check->IsFriendlyTo(target))
return;
}
- else if( i_check->GetTypeId()==TYPEID_PLAYER )
+ else if( i_check->GetTypeId() == TYPEID_PLAYER )
{
if (i_check->IsFriendlyTo( target ))
return;
diff --git a/src/game/HostilRefManager.cpp b/src/game/HostilRefManager.cpp
index 4a51d54248d..48938dff71b 100644
--- a/src/game/HostilRefManager.cpp
+++ b/src/game/HostilRefManager.cpp
@@ -34,33 +34,33 @@ HostilRefManager::~HostilRefManager()
// The pVictim is hated than by them as well
// use for buffs and healing threat functionality
-void HostilRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
+void HostilRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{
HostilReference* ref;
- uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not devide threat
+ float size = pSingleTarget ? 1.0f : getSize(); // if pSingleTarget do not divide threat
ref = getFirst();
while(ref != NULL)
{
- float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
+ float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
if(pVictim == getOwner())
- ref->addThreat(float (threat) / size); // It is faster to modify the threat durectly if possible
+ ref->addThreat(threat / size); // It is faster to modify the threat durectly if possible
else
- ref->getSource()->addThreat(pVictim, float (threat) / size);
+ ref->getSource()->addThreat(pVictim, threat / size);
ref = ref->next();
}
}
//=================================================
-void HostilRefManager::addThreatPercent(int32 pValue)
+void HostilRefManager::addThreatPercent(int32 iPercent)
{
HostilReference* ref;
ref = getFirst();
- while(ref != NULL)
+ while (ref != NULL)
{
- ref->addThreatPercent(pValue);
+ ref->addThreatPercent(iPercent);
ref = ref->next();
}
}
@@ -68,14 +68,14 @@ void HostilRefManager::addThreatPercent(int32 pValue)
//=================================================
// The online / offline status is given to the method. The calculation has to be done before
-void HostilRefManager::setOnlineOfflineState(bool pIsOnline)
+void HostilRefManager::setOnlineOfflineState(bool bIsOnline)
{
HostilReference* ref;
ref = getFirst();
while(ref != NULL)
{
- ref->setOnlineOfflineState(pIsOnline);
+ ref->setOnlineOfflineState(bIsOnline);
ref = ref->next();
}
}
@@ -131,7 +131,7 @@ void HostilRefManager::deleteReference(Unit *pCreature)
//=================================================
// set state for one reference, defined by Unit
-void HostilRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline)
+void HostilRefManager::setOnlineOfflineState(Unit *pCreature, bool bIsOnline)
{
HostilReference* ref = getFirst();
while(ref)
@@ -139,7 +139,7 @@ void HostilRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline)
HostilReference* nextRef = ref->next();
if(ref->getSource()->getOwner() == pCreature)
{
- ref->setOnlineOfflineState(pIsOnline);
+ ref->setOnlineOfflineState(bIsOnline);
break;
}
ref = nextRef;
diff --git a/src/game/HostilRefManager.h b/src/game/HostilRefManager.h
index 316509e3908..a25a6011575 100644
--- a/src/game/HostilRefManager.h
+++ b/src/game/HostilRefManager.h
@@ -44,9 +44,9 @@ class HostilRefManager : public RefManager<Unit, ThreatManager>
// send threat to all my hateres for the pVictim
// The pVictim is hated than by them as well
// use for buffs and healing threat functionality
- void threatAssist(Unit *pVictim, float threat, SpellEntry const *threatSpell = 0, bool pSingleTarget=false);
+ void threatAssist(Unit *pVictim, float fThreat, SpellEntry const *threatSpell = 0, bool pSingleTarget = false);
- void addThreatPercent(int32 pValue);
+ void addThreatPercent(int32 iPercent);
// The references are not needed anymore
// tell the source to remove them from the list and free the mem
@@ -56,10 +56,10 @@ class HostilRefManager : public RefManager<Unit, ThreatManager>
void updateThreatTables();
- void setOnlineOfflineState(bool pIsOnline);
+ void setOnlineOfflineState(bool bIsOnline);
// set state for one reference, defined by Unit
- void setOnlineOfflineState(Unit *pCreature,bool pIsOnline);
+ void setOnlineOfflineState(Unit *pCreature, bool bIsOnline);
// delete one reference, defined by Unit
void deleteReference(Unit *pCreature);
diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
index 826503d03b8..49802dd3790 100644
--- a/src/game/Level1.cpp
+++ b/src/game/Level1.cpp
@@ -1483,7 +1483,7 @@ bool ChatHandler::HandleModifyTalentCommand (const char* args)
return false;
}
- if(target->GetTypeId()==TYPEID_PLAYER)
+ if(target->GetTypeId() == TYPEID_PLAYER)
{
// check online security
if (HasLowerSecurity((Player*)target, 0))
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 47346daba61..449f78b671e 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -4215,7 +4215,7 @@ bool ChatHandler::HandleDieCommand(const char* /*args*/)
return false;
}
- if(target->GetTypeId()==TYPEID_PLAYER)
+ if(target->GetTypeId() == TYPEID_PLAYER)
{
if(HasLowerSecurity((Player*)target,0,false))
return false;
@@ -6416,7 +6416,7 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
return false;
}
- PSendSysMessage(LANG_MOVEGENS_LIST,(unit->GetTypeId()==TYPEID_PLAYER ? "Player" : "Creature" ),unit->GetGUIDLow());
+ PSendSysMessage(LANG_MOVEGENS_LIST,(unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature" ),unit->GetGUIDLow());
MotionMaster* mm = unit->GetMotionMaster();
for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
@@ -6436,7 +6436,7 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
case CONFUSED_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_CONFUSED); break;
case TARGETED_MOTION_TYPE:
{
- if(unit->GetTypeId()==TYPEID_PLAYER)
+ if(unit->GetTypeId() == TYPEID_PLAYER)
{
TargetedMovementGenerator<Player> const* mgen = static_cast<TargetedMovementGenerator<Player> const*>(mg);
Unit* target = mgen->GetTarget();
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index 2c9030a4608..d859b8567cb 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -3419,7 +3419,7 @@ void Map::ScriptsProcess()
WorldObject* worldObject;
Player* player;
- if(target->GetTypeId()==TYPEID_PLAYER)
+ if(target->GetTypeId() == TYPEID_PLAYER)
{
if(source->GetTypeId()!=TYPEID_UNIT && source->GetTypeId()!=TYPEID_GAMEOBJECT)
{
@@ -3438,7 +3438,7 @@ void Map::ScriptsProcess()
break;
}
- if(source->GetTypeId()!=TYPEID_PLAYER)
+ if(source->GetTypeId() != TYPEID_PLAYER)
{
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED call for non-player(TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
@@ -3685,7 +3685,7 @@ void Map::ScriptsProcess()
break;
}
- if(target->GetTypeId()!=TYPEID_PLAYER)
+ if(target->GetTypeId() != TYPEID_PLAYER)
{
sLog.outError("SCRIPT_COMMAND_PLAY_SOUND in targeted mode call for non-player (TypeId: %u, Entry: %u, GUID: %u), skipping.",target->GetTypeId(),target->GetEntry(),target->GetGUIDLow());
break;
diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp
index 626440f8d1e..da418c7d713 100644
--- a/src/game/MotionMaster.cpp
+++ b/src/game/MotionMaster.cpp
@@ -217,7 +217,7 @@ MotionMaster::MoveTargetedHome()
void
MotionMaster::MoveConfused()
{
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) move confused", i_owner->GetGUIDLow() );
Mutate(new ConfusedMovementGenerator<Player>(), MOTION_SLOT_CONTROLLED);
@@ -238,20 +238,20 @@ MotionMaster::MoveChase(Unit* target, float dist, float angle)
return;
i_owner->clearUnitState(UNIT_STAT_FOLLOW);
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) chase to %s (GUID: %u)",
i_owner->GetGUIDLow(),
- target->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
- target->GetTypeId()==TYPEID_PLAYER ? i_owner->GetGUIDLow() : ((Creature*)i_owner)->GetDBTableGUIDLow() );
+ target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
+ target->GetTypeId() == TYPEID_PLAYER ? i_owner->GetGUIDLow() : ((Creature*)i_owner)->GetDBTableGUIDLow() );
Mutate(new TargetedMovementGenerator<Player>(*target,dist,angle), MOTION_SLOT_ACTIVE);
}
else
{
DEBUG_LOG("Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)",
i_owner->GetEntry(), i_owner->GetGUIDLow(),
- target->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
- target->GetTypeId()==TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() );
+ target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
+ target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() );
Mutate(new TargetedMovementGenerator<Creature>(*target,dist,angle), MOTION_SLOT_ACTIVE);
}
}
@@ -264,19 +264,19 @@ MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slo
return;
i_owner->addUnitState(UNIT_STAT_FOLLOW);
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) follow to %s (GUID: %u)", i_owner->GetGUIDLow(),
- target->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
- target->GetTypeId()==TYPEID_PLAYER ? i_owner->GetGUIDLow() : ((Creature*)i_owner)->GetDBTableGUIDLow() );
+ target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
+ target->GetTypeId() == TYPEID_PLAYER ? i_owner->GetGUIDLow() : ((Creature*)i_owner)->GetDBTableGUIDLow() );
Mutate(new TargetedMovementGenerator<Player>(*target,dist,angle), slot);
}
else
{
DEBUG_LOG("Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)",
i_owner->GetEntry(), i_owner->GetGUIDLow(),
- target->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
- target->GetTypeId()==TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() );
+ target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
+ target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() );
Mutate(new TargetedMovementGenerator<Creature>(*target,dist,angle), slot);
}
}
@@ -284,7 +284,7 @@ MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slo
void
MotionMaster::MovePoint(uint32 id, float x, float y, float z)
{
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), id, x, y, z );
Mutate(new PointMovementGenerator<Player>(id,x,y,z), MOTION_SLOT_ACTIVE);
@@ -300,7 +300,7 @@ MotionMaster::MovePoint(uint32 id, float x, float y, float z)
void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
{
//this function may make players fall below map
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
return;
float x, y, z;
@@ -312,7 +312,7 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa
void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
{
//this function may make players fall below map
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
return;
float x, y, z;
@@ -328,7 +328,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
i_owner->addUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING);
i_owner->m_TempSpeed = speedXY;
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) jump to point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z );
Mutate(new PointMovementGenerator<Player>(0,x,y,z), MOTION_SLOT_CONTROLLED);
@@ -351,7 +351,7 @@ MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id)
i_owner->addUnitState(UNIT_STAT_CHARGING);
i_owner->m_TempSpeed = speed;
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z );
Mutate(new PointMovementGenerator<Player>(id,x,y,z), MOTION_SLOT_CONTROLLED);
@@ -375,7 +375,7 @@ void MotionMaster::MoveFall(float z, uint32 id)
void
MotionMaster::MoveSeekAssistance(float x, float y, float z)
{
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
sLog.outError("Player (GUID: %u) attempt to seek assistance",i_owner->GetGUIDLow());
}
@@ -392,7 +392,7 @@ MotionMaster::MoveSeekAssistance(float x, float y, float z)
void
MotionMaster::MoveSeekAssistanceDistract(uint32 time)
{
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
sLog.outError("Player (GUID: %u) attempt to call distract after assistance",i_owner->GetGUIDLow());
}
@@ -413,19 +413,19 @@ MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
if(i_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
return;
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) flee from %s (GUID: %u)", i_owner->GetGUIDLow(),
- enemy->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
- enemy->GetTypeId()==TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow() );
+ enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
+ enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow() );
Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
}
else
{
DEBUG_LOG("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s",
i_owner->GetEntry(), i_owner->GetGUIDLow(),
- enemy->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
- enemy->GetTypeId()==TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow(),
+ enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
+ enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow(),
time ? " for a limited time" : "");
if (time)
Mutate(new TimedFleeingMovementGenerator(enemy->GetGUID(), time), MOTION_SLOT_CONTROLLED);
@@ -437,7 +437,7 @@ MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
void
MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) taxi to (Path %u node %u)", i_owner->GetGUIDLow(), path, pathnode);
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(path,pathnode);
@@ -456,7 +456,7 @@ MotionMaster::MoveDistract(uint32 timer)
if(Impl[MOTION_SLOT_CONTROLLED])
return;
- if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) distracted (timer: %u)", i_owner->GetGUIDLow(), timer);
}
@@ -510,12 +510,12 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
delete curr;
}*/
- //i_owner->GetTypeId()==TYPEID_PLAYER ?
+ //i_owner->GetTypeId() == TYPEID_PLAYER ?
//Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE);
DEBUG_LOG("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)",
- i_owner->GetTypeId()==TYPEID_PLAYER ? "Player" : "Creature",
+ i_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
i_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO" );
}
diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
index e29fde825c3..02a41d43923 100644
--- a/src/game/MovementHandler.cpp
+++ b/src/game/MovementHandler.cpp
@@ -229,7 +229,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
//sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
Unit *mover = _player->m_mover;
- Player *plMover = mover->GetTypeId()==TYPEID_PLAYER ? (Player*)mover : NULL;
+ Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;
// ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck
if(plMover && plMover->IsBeingTeleported())
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 6d46834fea2..132d1c3e03b 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1903,7 +1903,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
return NULL;
}
go->SetRespawnTime(respawnTime);
- if(GetTypeId()==TYPEID_PLAYER || GetTypeId()==TYPEID_UNIT) //not sure how to handle this
+ if(GetTypeId() == TYPEID_PLAYER || GetTypeId()==TYPEID_UNIT) //not sure how to handle this
((Unit*)this)->AddGameObject(go);
else
go->SetSpawnedByDefault(false);
@@ -1920,7 +1920,7 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3
return NULL;
//summon->SetName(GetName());
- if(GetTypeId()==TYPEID_PLAYER || GetTypeId()==TYPEID_UNIT)
+ if(GetTypeId() == TYPEID_PLAYER || GetTypeId()==TYPEID_UNIT)
{
summon->setFaction(((Unit*)this)->getFaction());
summon->SetLevel(((Unit*)this)->getLevel());
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 7df9deabc6f..8920647968c 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -1520,7 +1520,7 @@ void Pet::InitPetCreateSpells()
bool Pet::resetTalents(bool no_cost)
{
Unit *owner = GetOwner();
- if (!owner || owner->GetTypeId()!=TYPEID_PLAYER)
+ if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
return false;
// not need after this call
@@ -1862,7 +1862,7 @@ void Pet::LearnPetPassives()
void Pet::CastPetAuras(bool current)
{
Unit* owner = GetOwner();
- if(!owner || owner->GetTypeId()!=TYPEID_PLAYER)
+ if(!owner || owner->GetTypeId() != TYPEID_PLAYER)
return;
if(!IsPermanentPetFor((Player*)owner))
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 83c99679b2f..3c11eca2b16 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -13130,7 +13130,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
uint32 limittime = pQuest->GetLimitTime();
// shared timed quest
- if(questGiver && questGiver->GetTypeId()==TYPEID_PLAYER)
+ if(questGiver && questGiver->GetTypeId() == TYPEID_PLAYER)
limittime = ((Player*)questGiver)->getQuestStatusMap()[quest_id].m_timer / IN_MILISECONDS;
AddTimedQuest( quest_id );
@@ -19004,7 +19004,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
if (!m_seer->IsWithinDistInMap(u, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
return false;
}
- else if(u->GetTypeId()==TYPEID_PLAYER) // distance for show player
+ else if(u->GetTypeId() == TYPEID_PLAYER) // distance for show player
{
// Players far than max visible distance for player or not in our map are not visible too
if (!at_same_transport && !m_seer->IsWithinDistInMap(u, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
@@ -19052,7 +19052,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
// player see other player with stealth/invisibility only if he in same group or raid or same team (raid/team case dependent from conf setting)
if(!m_mover->canDetectInvisibilityOf(u))
- if(!(u->GetTypeId()==TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
+ if(!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
return false;
}
@@ -19065,7 +19065,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
if(!isAlive())
detect = false;
if(m_DetectInvTimer < 300 || !HaveAtClient(u))
- if(!(u->GetTypeId()==TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
+ if(!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
if(!detect || !m_mover->canDetectStealthOf(u, GetDistance(u)))
return false;
}
diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp
index 7589c8a3712..ae1c23ba08e 100644
--- a/src/game/QuestHandler.cpp
+++ b/src/game/QuestHandler.cpp
@@ -124,8 +124,8 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
// no or incorrect quest giver
if(!pObject
- || (pObject->GetTypeId()!=TYPEID_PLAYER && !pObject->hasQuest(quest))
- || (pObject->GetTypeId()==TYPEID_PLAYER && !((Player*)pObject)->CanShareQuest(quest))
+ || (pObject->GetTypeId() != TYPEID_PLAYER && !pObject->hasQuest(quest))
+ || (pObject->GetTypeId() == TYPEID_PLAYER && !((Player*)pObject)->CanShareQuest(quest))
)
{
_player->PlayerTalkClass->CloseGossip();
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 14d142e680b..99056c43772 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -630,7 +630,7 @@ void Spell::SelectSpellTargets()
AddUnitTarget(m_caster, i);
break;
case SPELL_EFFECT_SUMMON_PLAYER:
- if(m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
+ if(m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
{
Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection());
if(target)
@@ -2321,7 +2321,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
}
else
{
- if (m_caster->GetTypeId()==TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
SendCastResult(SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW);
finish(false);
@@ -2543,7 +2543,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
// Pet not found - remove cooldown
else
{
- if (modOwner->GetTypeId()==TYPEID_PLAYER)
+ if (modOwner->GetTypeId() == TYPEID_PLAYER)
modOwner->RemoveSpellCooldown(m_spellInfo->Id,true);
SendCastResult(SPELL_FAILED_NO_PET);
finish(false);
@@ -2648,11 +2648,11 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
}
}
- if (m_caster->GetTypeId()==TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->SetSpellModTakingSpell(this, true);
// Fill cost data (not use power for item casts
m_powerCost = m_CastItem ? 0 : CalculatePowerCost(m_spellInfo, m_caster, m_spellSchoolMask);
- if (m_caster->GetTypeId()==TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
SpellCastResult result = CheckCast(true);
@@ -2811,7 +2811,7 @@ void Spell::cast(bool skipCheck)
m_caster->SetInFront(m_targets.getUnitTarget());
// Should this be done for original caster?
- if (m_caster->GetTypeId()==TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
// Set spell which will drop charges for triggered cast spells
// if not successfully casted, will be remove in finish(false)
@@ -2967,7 +2967,7 @@ void Spell::cast(bool skipCheck)
m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, *i, true);
}
- if (m_caster->GetTypeId()==TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
SetExecutedCurrently(false);
@@ -3015,7 +3015,7 @@ uint64 Spell::handle_delayed(uint64 t_offset)
{
UpdatePointers();
- if (m_caster->GetTypeId()==TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->SetSpellModTakingSpell(this, true);
uint64 next_time = 0;
@@ -3052,7 +3052,7 @@ uint64 Spell::handle_delayed(uint64 t_offset)
}
}
- if (m_caster->GetTypeId()==TYPEID_PLAYER)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
// All targets passed - need finish phase
@@ -4329,7 +4329,7 @@ void Spell::TriggerSpell()
SpellCastResult Spell::CheckCast(bool strict)
{
// check cooldowns to prevent cheating
- if(m_caster->GetTypeId()==TYPEID_PLAYER)
+ if(m_caster->GetTypeId() == TYPEID_PLAYER)
{
//can cast triggered (by aura only?) spells while have this flag
if (!m_IsTriggeredSpell && ((Player*)m_caster)->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY))
@@ -4411,7 +4411,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// cancel autorepeat spells if cast start when moving
// (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
- if( m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->isMoving() )
+ if( m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->isMoving() )
{
// skip stuck spell to allow use it in falling case and apply spell limitations at movement
if( (!((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK) &&
@@ -4569,13 +4569,13 @@ SpellCastResult Spell::CheckCast(bool strict)
m_caster->GetZoneAndAreaId(zone,area);
SpellCastResult locRes= spellmgr.GetSpellAllowedInLocationError(m_spellInfo,m_caster->GetMapId(),zone,area,
- m_caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)m_caster) : NULL);
+ m_caster->GetTypeId() == TYPEID_PLAYER ? ((Player*)m_caster) : NULL);
if(locRes != SPELL_CAST_OK)
return locRes;
}
// not let players cast spells at mount (and let do it to creatures)
- if (m_caster->IsMounted() && m_caster->GetTypeId()==TYPEID_PLAYER && !m_IsTriggeredSpell &&
+ if (m_caster->IsMounted() && m_caster->GetTypeId() == TYPEID_PLAYER && !m_IsTriggeredSpell &&
!IsPassiveSpell(m_spellInfo->Id) && !(m_spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_MOUNTED))
{
if (m_caster->isInFlight())
@@ -5002,7 +5002,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{
if(m_caster->GetPetGUID()) //let warlock do a replacement summon
{
- if (m_caster->GetTypeId()==TYPEID_PLAYER && m_caster->getClass()==CLASS_WARLOCK)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->getClass()==CLASS_WARLOCK)
{
if (strict) //starting cast, trigger pet stun (cast by pet so it doesn't attack player)
if(Pet* pet = ((Player*)m_caster)->GetPet())
@@ -5043,7 +5043,7 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER:
{
//Do not allow to cast it before BG starts.
- if(m_caster->GetTypeId()==TYPEID_PLAYER)
+ if(m_caster->GetTypeId() == TYPEID_PLAYER)
if(BattleGround const *bg = ((Player*)m_caster)->GetBattleGround())
if(bg->GetStatus() != STATUS_IN_PROGRESS)
return SPELL_FAILED_TRY_AGAIN;
@@ -6060,7 +6060,7 @@ bool Spell::CheckTargetCreatureType(Unit* target) const
m_spellInfo->SpellFamilyName==SPELLFAMILY_PALADIN && m_spellInfo->Category == 19)
{
// not allow cast at player
- if(target->GetTypeId()==TYPEID_PLAYER)
+ if(target->GetTypeId() == TYPEID_PLAYER)
return false;
spellCreatureTargetMask = 0x7FF;
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 695a706b7f7..4321ca98cfc 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -1347,7 +1347,7 @@ void Aura::HandleAuraSpecificMods(bool apply)
{
if (Unit * caster = GetCaster())
{
- if (caster->GetTypeId()==TYPEID_PLAYER && ((Player*)caster)->isHonorOrXPTarget(m_target))
+ if (caster->GetTypeId() == TYPEID_PLAYER && ((Player*)caster)->isHonorOrXPTarget(m_target))
caster->CastSpell(m_target, 18662, true, NULL, GetPartAura(0));
}
}
@@ -2349,7 +2349,7 @@ void AuraEffect::TriggerSpell()
case 17949:
case 27252:
{
- if (caster->GetTypeId()!=TYPEID_PLAYER)
+ if (caster->GetTypeId() != TYPEID_PLAYER)
return;
Item* item = ((Player*)caster)->GetWeaponForAttack(BASE_ATTACK);
if (!item)
@@ -2815,11 +2815,11 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
}
return;
case 46699: // Requires No Ammo
- if(m_target->GetTypeId()==TYPEID_PLAYER)
+ if(m_target->GetTypeId() == TYPEID_PLAYER)
((Player*)m_target)->RemoveAmmo(); // not use ammo and not allow use
return;
case 52916: // Honor Among Thieves
- if(m_target->GetTypeId()==TYPEID_PLAYER)
+ if(m_target->GetTypeId() == TYPEID_PLAYER)
if (Unit * target = ObjectAccessor::GetUnit(*m_target,((Player*)m_target)->GetComboTarget()))
m_target->CastSpell(target, 51699, true);
return;
@@ -3100,7 +3100,7 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
if (!Real && !changeAmount)
break;
// Pain and Suffering
- if( m_spellProto->SpellIconID == 2874 && m_target->GetTypeId()==TYPEID_PLAYER )
+ if( m_spellProto->SpellIconID == 2874 && m_target->GetTypeId() == TYPEID_PLAYER )
{
if(apply)
{
@@ -3163,7 +3163,7 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
}
}
// Predatory Strikes
- if(m_target->GetTypeId()==TYPEID_PLAYER && GetSpellProto()->SpellIconID == 1563)
+ if(m_target->GetTypeId() == TYPEID_PLAYER && GetSpellProto()->SpellIconID == 1563)
{
((Player*)m_target)->UpdateAttackPowerAndDamage();
return;
@@ -3234,7 +3234,7 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
return;
}
- if(GetEffIndex()==0 && m_target->GetTypeId()==TYPEID_PLAYER)
+ if(GetEffIndex()==0 && m_target->GetTypeId() == TYPEID_PLAYER)
{
SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAuraMapBounds(GetId());
if(saBounds.first != saBounds.second)
@@ -3275,7 +3275,7 @@ void AuraEffect::HandleAuraMounted(bool apply, bool Real, bool /*changeAmount*/)
}
uint32 team = 0;
- if (m_target->GetTypeId()==TYPEID_PLAYER)
+ if (m_target->GetTypeId() == TYPEID_PLAYER)
team = ((Player*)m_target)->GetTeam();
uint32 display_id = objmgr.ChooseDisplayId(team,ci);
@@ -3351,7 +3351,7 @@ void AuraEffect::HandleAuraHover(bool apply, bool Real, bool /*changeAmount*/)
void AuraEffect::HandleWaterBreathing(bool apply, bool Real, bool /*changeAmount*/)
{
// update timers in client
- if(m_target->GetTypeId()==TYPEID_PLAYER)
+ if(m_target->GetTypeId() == TYPEID_PLAYER)
((Player*)m_target)->UpdateMirrorTimers();
}
@@ -3582,7 +3582,7 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun
// add/remove the shapeshift aura's boosts
HandleShapeshiftBoosts(apply);
- if(m_target->GetTypeId()==TYPEID_PLAYER)
+ if(m_target->GetTypeId() == TYPEID_PLAYER)
((Player*)m_target)->InitDataForForm();
if(m_target->getClass() == CLASS_DRUID)
@@ -3606,7 +3606,7 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun
m_target->HandleAuraEffect(aurEff, false);
}
}
- if (m_target->GetTypeId()==TYPEID_PLAYER)
+ if (m_target->GetTypeId() == TYPEID_PLAYER)
{
SpellShapeshiftEntry const *shapeInfo = sSpellShapeshiftStore.LookupEntry(form);
// Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
@@ -3630,7 +3630,7 @@ void AuraEffect::HandleAuraTransform(bool apply, bool Real, bool /*changeAmount*
if(GetMiscValue()==0)
{
// player applied only
- if (m_target->GetTypeId()!=TYPEID_PLAYER)
+ if (m_target->GetTypeId() != TYPEID_PLAYER)
return;
switch (GetId())
@@ -3769,7 +3769,7 @@ void AuraEffect::HandleAuraTransform(bool apply, bool Real, bool /*changeAmount*
if(CreatureInfo const* ci = objmgr.GetCreatureTemplate(cr_id))
{
uint32 team = 0;
- if (m_target->GetTypeId()==TYPEID_PLAYER)
+ if (m_target->GetTypeId() == TYPEID_PLAYER)
team = ((Player*)m_target)->GetTeam();
uint32 display_id = objmgr.ChooseDisplayId(team,ci);
@@ -3877,7 +3877,7 @@ void AuraEffect::HandleFarSight(bool apply, bool Real, bool /*changeAmount*/)
void AuraEffect::HandleAuraTrackCreatures(bool apply, bool Real, bool /*changeAmount*/)
{
- if(m_target->GetTypeId()!=TYPEID_PLAYER)
+ if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
m_target->SetUInt32Value(PLAYER_TRACK_CREATURES, apply ? ((uint32)1)<<(GetMiscValue()-1) : 0 );
@@ -3885,7 +3885,7 @@ void AuraEffect::HandleAuraTrackCreatures(bool apply, bool Real, bool /*changeAm
void AuraEffect::HandleAuraTrackResources(bool apply, bool Real, bool /*changeAmount*/)
{
- if(m_target->GetTypeId()!=TYPEID_PLAYER)
+ if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
m_target->SetUInt32Value(PLAYER_TRACK_RESOURCES, apply ? ((uint32)1)<<(GetMiscValue()-1): 0 );
@@ -3893,7 +3893,7 @@ void AuraEffect::HandleAuraTrackResources(bool apply, bool Real, bool /*changeAm
void AuraEffect::HandleAuraTrackStealthed(bool apply, bool Real, bool /*changeAmount*/)
{
- if(m_target->GetTypeId()!=TYPEID_PLAYER)
+ if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
m_target->ApplyModFlag(PLAYER_FIELD_BYTES,PLAYER_FIELD_BYTE_TRACK_STEALTHED,apply);
@@ -4072,7 +4072,7 @@ void AuraEffect::HandleModStealth(bool apply, bool Real, bool /*changeAmount*/)
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
m_target->SetStandFlags(UNIT_STAND_FLAGS_CREEP);
- if(m_target->GetTypeId()==TYPEID_PLAYER)
+ if(m_target->GetTypeId() == TYPEID_PLAYER)
m_target->SetFlag(PLAYER_FIELD_BYTES2, 0x2000);
// apply only if not in GM invisibility (and overwrite invisibility state)
@@ -4082,7 +4082,7 @@ void AuraEffect::HandleModStealth(bool apply, bool Real, bool /*changeAmount*/)
else if(!m_target->HasAuraType(SPELL_AURA_MOD_STEALTH)) // if last SPELL_AURA_MOD_STEALTH
{
m_target->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP);
- if(m_target->GetTypeId()==TYPEID_PLAYER)
+ if(m_target->GetTypeId() == TYPEID_PLAYER)
m_target->RemoveFlag(PLAYER_FIELD_BYTES2, 0x2000);
if(m_target->GetVisibility() != VISIBILITY_OFF)
@@ -4101,7 +4101,7 @@ void AuraEffect::HandleInvisibility(bool apply, bool Real, bool /*changeAmount*/
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
// apply glow vision
- if(m_target->GetTypeId()==TYPEID_PLAYER)
+ if(m_target->GetTypeId() == TYPEID_PLAYER)
m_target->SetFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
m_target->SetToNotify();
@@ -4141,7 +4141,7 @@ void AuraEffect::HandleInvisibilityDetect(bool apply, bool Real, bool /*changeAm
for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
m_target->m_detectInvisibilityMask |= (1 << GetMiscValue());
}
- if(Real && m_target->GetTypeId()==TYPEID_PLAYER)
+ if(Real && m_target->GetTypeId() == TYPEID_PLAYER)
m_target->SetToNotify();
}
@@ -4302,7 +4302,7 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real, bool ch
m_target->SendMessageToSet(&data, true);
//Players on flying mounts must be immune to polymorph
- if (m_target->GetTypeId()==TYPEID_PLAYER)
+ if (m_target->GetTypeId() == TYPEID_PLAYER)
m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,MECHANIC_POLYMORPH,apply);
// Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
@@ -4538,7 +4538,7 @@ void AuraEffect::HandleAuraProcTriggerSpell(bool apply, bool Real, bool /*change
if(!Real)
return;
// Elemental oath - "while Clearcasting from Elemental Focus is active, you deal 5%/10% more spell damage."
- if (m_target->GetTypeId()==TYPEID_PLAYER && (GetId() == 51466 || GetId() == 51470))
+ if (m_target->GetTypeId() == TYPEID_PLAYER && (GetId() == 51466 || GetId() == 51470))
{
if (apply)
{
@@ -5074,7 +5074,7 @@ void AuraEffect::HandleAuraIncreaseBaseHealthPercent(bool apply, bool /*Real*/,
void AuraEffect::HandleAuraModParryPercent(bool /*apply*/, bool Real, bool /*changeAmount*/)
{
- if(m_target->GetTypeId()!=TYPEID_PLAYER)
+ if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
((Player*)m_target)->UpdateParryPercentage();
@@ -5082,7 +5082,7 @@ void AuraEffect::HandleAuraModParryPercent(bool /*apply*/, bool Real, bool /*cha
void AuraEffect::HandleAuraModDodgePercent(bool /*apply*/, bool Real, bool /*changeAmount*/)
{
- if(m_target->GetTypeId()!=TYPEID_PLAYER)
+ if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
((Player*)m_target)->UpdateDodgePercentage();
@@ -5091,7 +5091,7 @@ void AuraEffect::HandleAuraModDodgePercent(bool /*apply*/, bool Real, bool /*cha
void AuraEffect::HandleAuraModBlockPercent(bool /*apply*/, bool Real, bool /*changeAmount*/)
{
- if(m_target->GetTypeId()!=TYPEID_PLAYER)
+ if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
((Player*)m_target)->UpdateBlockPercentage();
@@ -5104,7 +5104,7 @@ void AuraEffect::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real, bool cha
if(!Real && !changeAmount)
return;
- if(m_target->GetTypeId()!=TYPEID_PLAYER)
+ if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
((Player*)m_target)->UpdateManaRegen();
@@ -5112,7 +5112,7 @@ void AuraEffect::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real, bool cha
void AuraEffect::HandleAuraModWeaponCritPercent(bool apply, bool Real, bool changeAmount)
{
- if(m_target->GetTypeId()!=TYPEID_PLAYER)
+ if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
// apply item specific bonuses for already equipped weapon
@@ -5308,7 +5308,7 @@ void AuraEffect::HandleAuraModAttackPowerOfArmor(bool /*apply*/, bool Real, bool
void AuraEffect::HandleModDamageDone(bool apply, bool Real, bool changeAmount)
{
// apply item specific bonuses for already equipped weapon
- if((Real || changeAmount) && m_target->GetTypeId()==TYPEID_PLAYER)
+ if((Real || changeAmount) && m_target->GetTypeId() == TYPEID_PLAYER)
{
for (int i = 0; i < MAX_ATTACK; ++i)
if(Item* pItem = ((Player*)m_target)->GetWeaponForAttack(WeaponAttackType(i)))
@@ -5390,7 +5390,7 @@ void AuraEffect::HandleModDamagePercentDone(bool apply, bool Real, bool changeAm
sLog.outDebug("AURA MOD DAMAGE type:%u negative:%u", GetMiscValue(), m_amount > 0);
// apply item specific bonuses for already equipped weapon
- if((Real || changeAmount) && m_target->GetTypeId()==TYPEID_PLAYER)
+ if((Real || changeAmount) && m_target->GetTypeId() == TYPEID_PLAYER)
{
for (int i = 0; i < MAX_ATTACK; ++i)
if(Item* pItem = ((Player*)m_target)->GetWeaponForAttack(WeaponAttackType(i)))
@@ -5511,7 +5511,7 @@ void AuraEffect::HandleAuraAllowOnlyAbility(bool apply, bool Real, bool /*change
if(!apply && m_target->HasAuraType(SPELL_AURA_ALLOW_ONLY_ABILITY))
return;
- if(m_target->GetTypeId()==TYPEID_PLAYER)
+ if(m_target->GetTypeId() == TYPEID_PLAYER)
{
if (apply)
m_target->SetFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY);
@@ -5715,7 +5715,7 @@ void AuraEffect::HandleSpiritOfRedemption( bool apply, bool Real , bool /*change
// prepare spirit state
if(apply)
{
- if(m_target->GetTypeId()==TYPEID_PLAYER)
+ if(m_target->GetTypeId() == TYPEID_PLAYER)
{
// disable breath/etc timers
((Player*)m_target)->StopMirrorTimers();
@@ -5847,7 +5847,7 @@ void AuraEffect::PeriodicTick()
//As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit
// Reduce dot damage from resilience for players
- if (m_target->GetTypeId()==TYPEID_PLAYER)
+ if (m_target->GetTypeId() == TYPEID_PLAYER)
pdamage-=((Player*)m_target)->GetDotDamageReduction(pdamage);
pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist, m_spellProto);
@@ -5914,7 +5914,7 @@ void AuraEffect::PeriodicTick()
//As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit
// Reduce dot damage from resilience for players
- if (m_target->GetTypeId()==TYPEID_PLAYER)
+ if (m_target->GetTypeId() == TYPEID_PLAYER)
pdamage-=((Player*)m_target)->GetDotDamageReduction(pdamage);
pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist, m_spellProto);
@@ -6042,7 +6042,7 @@ void AuraEffect::PeriodicTick()
if(m_target!=pCaster && GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_HEALTH_FUNNEL)
{
uint32 dmg = spellProto->manaPerSecond;
- if(pCaster->GetHealth() <= dmg && pCaster->GetTypeId()==TYPEID_PLAYER)
+ if(pCaster->GetHealth() <= dmg && pCaster->GetTypeId() == TYPEID_PLAYER)
{
pCaster->RemoveAurasDueToSpell(GetId());
@@ -6922,7 +6922,7 @@ void AuraEffect::HandlePhase(bool apply, bool Real, bool /*changeAmount*/)
// no-phase is also phase state so same code for apply and remove
// phase auras normally not expected at BG but anyway better check
- if(m_target->GetTypeId()==TYPEID_PLAYER)
+ if(m_target->GetTypeId() == TYPEID_PLAYER)
{
// drop flag at invisible in bg
if(((Player*)m_target)->InBattleGround())
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index dac6a13bef8..5a691344905 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -547,7 +547,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
case SPELLFAMILY_ROGUE:
{
// Envenom
- if (m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[1] & 0x8))
+ if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[1] & 0x8))
{
// consume from stack dozes not more that have combo-points
if (uint32 combo = ((Player*)m_caster)->GetComboPoints())
@@ -572,7 +572,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
}
}
// Eviscerate
- else if ((m_spellInfo->SpellFamilyFlags[0] & 0x00020000) && m_caster->GetTypeId()==TYPEID_PLAYER)
+ else if ((m_spellInfo->SpellFamilyFlags[0] & 0x00020000) && m_caster->GetTypeId() == TYPEID_PLAYER)
{
if (uint32 combo = ((Player*)m_caster)->GetComboPoints())
{
@@ -875,7 +875,7 @@ void Spell::EffectDummy(uint32 i)
}
case 17271: // Test Fetid Skull
{
- if(!itemTarget && m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if(!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = roll_chance_i(50)
@@ -1029,7 +1029,7 @@ void Spell::EffectDummy(uint32 i)
return;
case 33060: // Make a Wish
{
- if(m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = 0;
@@ -1325,7 +1325,7 @@ void Spell::EffectDummy(uint32 i)
{
case 11958: // Cold Snap
{
- if(m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// immediately finishes the cooldown on Frost spells
@@ -1583,7 +1583,7 @@ void Spell::EffectDummy(uint32 i)
}
case 14185: // Preparation
{
- if(m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
//immediately finishes the cooldown on certain Rogue abilities
@@ -1611,7 +1611,7 @@ void Spell::EffectDummy(uint32 i)
{
case 23989: // Readiness talent
{
- if(m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
@@ -1629,7 +1629,7 @@ void Spell::EffectDummy(uint32 i)
}
case 37506: // Scatter Shot
{
- if (m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// break Auto Shot and autohit
@@ -1722,7 +1722,7 @@ void Spell::EffectDummy(uint32 i)
// non-standard cast requirement check
if (!unitTarget || unitTarget->getAttackers().empty())
{
- if(m_caster->GetTypeId()==TYPEID_PLAYER)
+ if(m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
SendCastResult(SPELL_FAILED_TARGET_AFFECTING_COMBAT);
return;
@@ -1858,7 +1858,7 @@ void Spell::EffectDummy(uint32 i)
// Lava Lash
if (m_spellInfo->SpellFamilyFlags[2] & 0x00000004)
{
- if (m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
if (Item *item = ((Player*)m_caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
@@ -2929,7 +2929,7 @@ void Spell::EffectCreateItem(uint32 i)
void Spell::EffectCreateItem2(uint32 i)
{
- if(m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)m_caster;
@@ -2954,7 +2954,7 @@ void Spell::EffectCreateItem2(uint32 i)
void Spell::EffectCreateRandomItem(uint32 i)
{
- if(m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)m_caster;
@@ -3430,7 +3430,7 @@ void Spell::EffectSummonType(uint32 i)
uint32 level = m_caster->getLevel();
// level of creature summoned using engineering item based at engineering skill level
- if(m_caster->GetTypeId()==TYPEID_PLAYER && m_CastItem)
+ if(m_caster->GetTypeId() == TYPEID_PLAYER && m_CastItem)
{
ItemPrototype const *proto = m_CastItem->GetProto();
if(proto && proto->RequiredSkill == SKILL_ENGINERING)
@@ -4315,7 +4315,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// Devastate bonus and sunder armor refresh
if(m_spellInfo->SpellFamilyFlags[1] & 0x40)
{
- if (m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
SpellEntry const *spellInfo = NULL;
uint32 stack = 0;
@@ -4377,14 +4377,14 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// Hemorrhage
if(m_spellInfo->SpellFamilyFlags[0] & 0x2000000)
{
- if(m_caster->GetTypeId()==TYPEID_PLAYER)
+ if(m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->AddComboPoints(unitTarget, 1, this);
}
// Fan of Knives
else if(m_spellInfo->SpellFamilyFlags[1] & 0x40000)
{
// 50% more damage with daggers
- if(m_caster->GetTypeId()==TYPEID_PLAYER)
+ if(m_caster->GetTypeId() == TYPEID_PLAYER)
if (Item* item = ((Player*)m_caster)->GetWeaponForAttack(m_attackType, true))
if (item->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER)
totalDamagePercentMod *= 1.5f;
@@ -4463,7 +4463,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// Mangle (Cat): CP
if(m_spellInfo->SpellFamilyFlags[1] & 0x400)
{
- if(m_caster->GetTypeId()==TYPEID_PLAYER)
+ if(m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->AddComboPoints(unitTarget,1, this);
}
// Shred, Maul - Rend and Tear
@@ -4767,7 +4767,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
{
case 6962:
{
- if(m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* plr = ((Player*)m_caster);
@@ -4900,7 +4900,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Bending Shinbone
case 8856:
{
- if(!itemTarget && m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if(!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = 0;
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index c4be996de66..1fd07ff19e8 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -294,7 +294,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
// ignore for remote control state (for player case)
Unit* mover = _player->m_mover;
- if(mover != _player && mover->GetTypeId()==TYPEID_PLAYER)
+ if(mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
{
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
return;
@@ -312,7 +312,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
return;
}
- if(mover->GetTypeId()==TYPEID_PLAYER)
+ if(mover->GetTypeId() == TYPEID_PLAYER)
{
// not have spell in spellbook or spell passive and not casted by client
if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellId) )
@@ -473,7 +473,7 @@ void WorldSession::HandleCancelChanneling( WorldPacket & recv_data)
// ignore for remote control state (for player case)
Unit* mover = _player->m_mover;
- if(mover != _player && mover->GetTypeId()==TYPEID_PLAYER)
+ if(mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
return;
mover->InterruptSpell(CURRENT_CHANNELED_SPELL);
@@ -570,7 +570,7 @@ void WorldSession::HandleMirrrorImageDataRequest( WorldPacket & recv_data )
WorldPacket data(SMSG_MIRRORIMAGE_DATA, 68);
data << (uint64)guid;
data << (uint32)creator->GetDisplayId();
- if (creator->GetTypeId()==TYPEID_PLAYER)
+ if (creator->GetTypeId() == TYPEID_PLAYER)
{
Player * pCreator = (Player *)creator;
data << (uint8)pCreator->getRace();
diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp
index 1f0e828699c..afda92829a3 100644
--- a/src/game/StatSystem.cpp
+++ b/src/game/StatSystem.cpp
@@ -1063,7 +1063,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
val = 2 * GetStat(STAT_STRENGTH) - 20.0f;
Unit* owner = GetOwner();
- if( owner && owner->GetTypeId()==TYPEID_PLAYER)
+ if( owner && owner->GetTypeId() == TYPEID_PLAYER)
{
if(isHunterPet()) //hunter pets benefit from owner's attack power
{
diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp
index 7b8f8ec7432..0305bf875e6 100644
--- a/src/game/ThreatManager.cpp
+++ b/src/game/ThreatManager.cpp
@@ -32,24 +32,23 @@
//==============================================================
// The pHatingUnit is not used yet
-float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float pThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
+float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
{
if (pThreatSpell)
if (Player* modOwner = pHatedUnit->GetSpellModOwner())
- modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, pThreat);
+ modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, fThreat);
- float threat = pHatedUnit->ApplyTotalThreatModifier(pThreat, schoolMask);
- return threat;
+ return pHatedUnit->ApplyTotalThreatModifier(fThreat, schoolMask);
}
//============================================================
//================= HostilReference ==========================
//============================================================
-HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat)
+HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat)
{
- iThreat = pThreat;
- iTempThreatModifyer = 0.0f;
+ iThreat = fThreat;
+ iTempThreatModifier = 0.0f;
link(pUnit, pThreatManager);
iUnitGuid = pUnit->GetGUID();
iOnline = true;
@@ -83,29 +82,29 @@ void HostilReference::sourceObjectDestroyLink()
void HostilReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent)
{
- if(getSource())
+ if (getSource())
getSource()->processThreatEvent(&pThreatRefStatusChangeEvent);
}
//============================================================
-void HostilReference::addThreat(float pMod)
+void HostilReference::addThreat(float fModThreat)
{
- iThreat += pMod;
- // the threat is changed. Source and target unit have to be availabe
+ iThreat += fModThreat;
+ // the threat is changed. Source and target unit have to be available
// if the link was cut before relink it again
- if(!isOnline())
+ if (!isOnline())
updateOnlineStatus();
- if(pMod != 0.0f)
+ if (fModThreat != 0.0f)
{
- ThreatRefStatusChangeEvent event(UEV_THREAT_REF_THREAT_CHANGE, this, pMod);
+ ThreatRefStatusChangeEvent event(UEV_THREAT_REF_THREAT_CHANGE, this, fModThreat);
fireStatusChanged(event);
}
- if(isValid() && pMod >= 0)
+ if (isValid() && fModThreat >= 0.0f)
{
Unit* victim_owner = getTarget()->GetCharmerOrOwner();
- if(victim_owner && victim_owner->isAlive())
+ if (victim_owner && victim_owner->isAlive())
getSource()->addThreat(victim_owner, 0.0f); // create a threat to the owner of a pet, if the pet attacks
}
}
@@ -118,25 +117,23 @@ void HostilReference::updateOnlineStatus()
bool online = false;
bool accessible = false;
- if(!isValid())
- {
- Unit* target = ObjectAccessor::GetUnit(*getSourceUnit(), getUnitGuid());
- if(target)
+ if (!isValid())
+ if (Unit* target = ObjectAccessor::GetUnit(*getSourceUnit(), getUnitGuid()))
link(target, getSource());
- }
+
// only check for online status if
// ref is valid
// target is no player or not gamemaster
// target is not in flight
- if(isValid() &&
+ if (isValid() &&
((getTarget()->GetTypeId() != TYPEID_PLAYER || !((Player*)getTarget())->isGameMaster()) ||
!getTarget()->hasUnitState(UNIT_STAT_IN_FLIGHT)))
{
- Creature* creature = (Creature* ) getSourceUnit();
+ Creature* creature = (Creature*)getSourceUnit();
online = getTarget()->isInAccessiblePlaceFor(creature);
- if(!online)
+ if (!online)
{
- if(creature->IsWithinCombatRange(getTarget(), creature->m_CombatDistance))
+ if (creature->IsWithinCombatRange(getTarget(), creature->m_CombatDistance))
online = true; // not accessible but stays online
}
else
@@ -152,10 +149,10 @@ void HostilReference::updateOnlineStatus()
void HostilReference::setOnlineOfflineState(bool pIsOnline)
{
- if(iOnline != pIsOnline)
+ if (iOnline != pIsOnline)
{
iOnline = pIsOnline;
- if(!iOnline)
+ if (!iOnline)
setAccessibleState(false); // if not online that not accessable as well
ThreatRefStatusChangeEvent event(UEV_THREAT_REF_ONLINE_STATUS, this);
@@ -167,7 +164,7 @@ void HostilReference::setOnlineOfflineState(bool pIsOnline)
void HostilReference::setAccessibleState(bool pIsAccessible)
{
- if(iAccessible != pIsAccessible)
+ if (iAccessible != pIsAccessible)
{
iAccessible = pIsAccessible;
@@ -231,20 +228,20 @@ HostilReference* ThreatContainer::getReferenceByTarget(Unit* pVictim)
//============================================================
// Add the threat, if we find the reference
-HostilReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat)
+HostilReference* ThreatContainer::addThreat(Unit* pVictim, float fThreat)
{
HostilReference* ref = getReferenceByTarget(pVictim);
- if(ref)
- ref->addThreat(pThreat);
+ if (ref)
+ ref->addThreat(fThreat);
return ref;
}
//============================================================
-void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 pPercent)
+void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 iPercent)
{
if(HostilReference* ref = getReferenceByTarget(pVictim))
- ref->addThreatPercent(pPercent);
+ ref->addThreatPercent(iPercent);
}
//============================================================
@@ -361,7 +358,7 @@ void ThreatManager::clearReferences()
//============================================================
-void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
+void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
{
//function deals with adding threat and adding players and pets into ThreatList
//mobs, NPCs, guards have ThreatList and HateOfflineList
@@ -373,19 +370,19 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask scho
return;
// not to GM
- if(!pVictim || (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster()) )
+ if (!pVictim || (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster()))
return;
// not to dead and not for dead
- if(!pVictim->isAlive() || !getOwner()->isAlive() )
+ if (!pVictim->isAlive() || !getOwner()->isAlive())
return;
assert(getOwner()->GetTypeId()== TYPEID_UNIT);
- float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, schoolMask, pThreatSpell);
+ float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, schoolMask, pThreatSpell);
// must check > 0.0f, otherwise dead loop
- if(threat > 0.0f && pVictim->GetReducedThreatPercent())
+ if (threat > 0.0f && pVictim->GetReducedThreatPercent())
{
float reducedThreat = threat * pVictim->GetReducedThreatPercent() / 100;
threat -= reducedThreat;
@@ -396,19 +393,19 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask scho
_addThreat(pVictim, threat);
}
-void ThreatManager::_addThreat(Unit *pVictim, float threat)
+void ThreatManager::_addThreat(Unit *pVictim, float fThreat)
{
- HostilReference* ref = iThreatContainer.addThreat(pVictim, threat);
+ HostilReference* ref = iThreatContainer.addThreat(pVictim, fThreat);
// Ref is not in the online refs, search the offline refs next
- if(!ref)
- ref = iThreatOfflineContainer.addThreat(pVictim, threat);
+ if (!ref)
+ ref = iThreatOfflineContainer.addThreat(pVictim, fThreat);
- if(!ref) // there was no ref => create a new one
+ if (!ref) // there was no ref => create a new one
{
// threat has to be 0 here
HostilReference* hostilReference = new HostilReference(pVictim, this, 0);
iThreatContainer.addReference(hostilReference);
- hostilReference->addThreat(threat); // now we add the real threat
+ hostilReference->addThreat(fThreat); // now we add the real threat
if(pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster())
hostilReference->setOnlineOfflineState(false); // GM is always offline
}
@@ -416,9 +413,9 @@ void ThreatManager::_addThreat(Unit *pVictim, float threat)
//============================================================
-void ThreatManager::modifyThreatPercent(Unit *pVictim, int32 pPercent)
+void ThreatManager::modifyThreatPercent(Unit *pVictim, int32 iPercent)
{
- iThreatContainer.modifyThreatPercent(pVictim, pPercent);
+ iThreatContainer.modifyThreatPercent(pVictim, iPercent);
}
//============================================================
@@ -451,8 +448,7 @@ void ThreatManager::tauntApply(Unit* pTaunter)
HostilReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
if(getCurrentVictim() && ref && (ref->getThreat() < getCurrentVictim()->getThreat()))
{
- if(ref->getTempThreatModifyer() == 0.0f)
- // Ok, temp threat is unused
+ if(ref->getTempThreatModifier() == 0.0f) // Ok, temp threat is unused
ref->setTempThreat(getCurrentVictim()->getThreat());
}
}
diff --git a/src/game/ThreatManager.h b/src/game/ThreatManager.h
index 1dba6277cfc..effe5456e6a 100644
--- a/src/game/ThreatManager.h
+++ b/src/game/ThreatManager.h
@@ -43,21 +43,26 @@ struct SpellEntry;
class ThreatCalcHelper
{
public:
- static float calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
+ static float calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
};
//==============================================================
class TRINITY_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager>
{
public:
- HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat);
+ HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat);
//=================================================
- void addThreat(float pMod);
+ void addThreat(float fModThreat);
- void setThreat(float pThreat) { addThreat(pThreat - getThreat()); }
+ void setThreat(float fThreat) { addThreat(fThreat - getThreat()); }
- void addThreatPercent(int32 pPercent) { float tmpThreat = iThreat; tmpThreat = tmpThreat * (pPercent+100) / 100; addThreat(tmpThreat-iThreat); }
+ void addThreatPercent(int32 pPercent)
+ {
+ float tmpThreat = iThreat;
+ tmpThreat = tmpThreat * (pPercent+100.0f) / 100.0f;
+ addThreat(tmpThreat-iThreat);
+ }
float getThreat() const { return iThreat; }
@@ -69,17 +74,23 @@ class TRINITY_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager>
// used for temporary setting a threat and reducting it later again.
// the threat modification is stored
- void setTempThreat(float pThreat) { iTempThreatModifyer = pThreat - getThreat(); if(iTempThreatModifyer != 0.0f) addThreat(iTempThreatModifyer); }
+ void setTempThreat(float fThreat)
+ {
+ iTempThreatModifier = fThreat - getThreat();
+ if (iTempThreatModifier != 0.0f)
+ addThreat(iTempThreatModifier);
+ }
void resetTempThreat()
{
- if(iTempThreatModifyer != 0.0f)
+ if (iTempThreatModifier != 0.0f)
{
- addThreat(-iTempThreatModifyer); iTempThreatModifyer = 0.0f;
+ addThreat(-iTempThreatModifier);
+ iTempThreatModifier = 0.0f;
}
}
- float getTempThreatModifyer() { return iTempThreatModifyer; }
+ float getTempThreatModifier() { return iTempThreatModifier; }
//=================================================
// check, if source can reach target and set the status
@@ -122,7 +133,7 @@ class TRINITY_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager>
Unit* getSourceUnit();
private:
float iThreat;
- float iTempThreatModifyer; // used for taunt
+ float iTempThreatModifier; // used for taunt
uint64 iUnitGuid;
bool iOnline;
bool iAccessible;
@@ -148,9 +159,9 @@ class TRINITY_DLL_SPEC ThreatContainer
ThreatContainer() { iDirty = false; }
~ThreatContainer() { clearReferences(); }
- HostilReference* addThreat(Unit* pVictim, float pThreat);
+ HostilReference* addThreat(Unit* pVictim, float fThreat);
- void modifyThreatPercent(Unit *pVictim, int32 percent);
+ void modifyThreatPercent(Unit *pVictim, int32 iPercent);
HostilReference* selectNextVictim(Creature* pAttacker, HostilReference* pCurrentVictim);
@@ -180,12 +191,12 @@ class TRINITY_DLL_SPEC ThreatManager
void clearReferences();
- void addThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
- void modifyThreatPercent(Unit *pVictim, int32 pPercent);
+ void addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
+ void modifyThreatPercent(Unit *pVictim, int32 iPercent);
float getThreat(Unit *pVictim, bool pAlsoSearchOfflineList = false);
- bool isThreatListEmpty() { return iThreatContainer.empty();}
+ bool isThreatListEmpty() { return iThreatContainer.empty(); }
void processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent);
@@ -193,7 +204,7 @@ class TRINITY_DLL_SPEC ThreatManager
HostilReference* getCurrentVictim() { return iCurrentVictim; }
- Unit* getOwner() { return iOwner; }
+ Unit* getOwner() { return iOwner; }
Unit* getHostilTarget();
@@ -202,16 +213,16 @@ class TRINITY_DLL_SPEC ThreatManager
void setCurrentVictim(HostilReference* pHostilReference);
- void setDirty(bool pDirty) { iThreatContainer.setDirty(pDirty); }
+ void setDirty(bool bDirty) { iThreatContainer.setDirty(bDirty); }
- // methods to access the lists from the outside to do sume dirty manipulation (scriping and such)
+ // methods to access the lists from the outside to do some dirty manipulation (scriping and such)
// I hope they are used as little as possible.
std::list<HostilReference*>& getThreatList() { return iThreatContainer.getThreatList(); }
std::list<HostilReference*>& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); }
ThreatContainer& getOnlineContainer() { return iThreatContainer; }
ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; }
private:
- void _addThreat(Unit *pVictim, float threat);
+ void _addThreat(Unit *pVictim, float fThreat);
HostilReference* iCurrentVictim;
Unit* iOwner;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 50e44229e99..ac1bb5e65af 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -289,7 +289,7 @@ void Unit::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTim
{
if (!transitTime)
{
- if(GetTypeId()==TYPEID_PLAYER)
+ if(GetTypeId() == TYPEID_PLAYER)
{
Traveller<Player> traveller(*(Player*)this);
transitTime = traveller.GetTotalTrevelTimeTo(x,y,z);
@@ -648,9 +648,8 @@ void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb)
uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss)
{
if(pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsAIEnabled)
- {
((Creature*)pVictim)->AI()->DamageTaken(this, damage);
- }
+
if (damagetype != NODAMAGE)
{
// interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)
@@ -746,7 +745,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
Player *killer = ((Player*)this);
// in bg, count dmg if victim is also a player
- if (pVictim->GetTypeId()==TYPEID_PLAYER)
+ if (pVictim->GetTypeId() == TYPEID_PLAYER)
{
if (BattleGround *bg = killer->GetBattleGround())
{
@@ -834,7 +833,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
pVictim->RewardRage(rage_damage, 0, false);
}
- if(GetTypeId()==TYPEID_PLAYER)
+ if(GetTypeId() == TYPEID_PLAYER)
{
// random durability for items (HIT DONE)
if (roll_chance_f(sWorld.getRate(RATE_DURABILITY_LOSS_DAMAGE)))
@@ -878,7 +877,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
// last damage from duel opponent
if(duel_hasEnded)
{
- assert(pVictim->GetTypeId()==TYPEID_PLAYER);
+ assert(pVictim->GetTypeId() == TYPEID_PLAYER);
Player *he = (Player*)pVictim;
assert(he->duel);
@@ -911,7 +910,7 @@ void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castIte
if(!spellInfo)
{
- sLog.outError("CastSpell: unknown spell id %i by caster: %s %u)", spellId,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog.outError("CastSpell: unknown spell id %i by caster: %s %u)", spellId,(GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
@@ -922,7 +921,7 @@ void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, I
{
if(!spellInfo)
{
- sLog.outError("CastSpell: unknown spell by caster: %s %u)", (GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog.outError("CastSpell: unknown spell by caster: %s %u)", (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
@@ -945,7 +944,7 @@ void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, I
}
else */if(!Victim)
{
- sLog.outError("CastSpell: spell id %i by caster: %s %u) does not have unit target", spellInfo->Id,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog.outError("CastSpell: spell id %i by caster: %s %u) does not have unit target", spellInfo->Id,(GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
else
@@ -958,7 +957,7 @@ void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, I
{
if(!Victim)
{
- sLog.outError("CastSpell: spell id %i by caster: %s %u) does not have destination", spellInfo->Id,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog.outError("CastSpell: spell id %i by caster: %s %u) does not have destination", spellInfo->Id,(GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
targets.setDst(Victim);
@@ -997,7 +996,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit*
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );
if(!spellInfo)
{
- sLog.outError("CastSpell: unknown spell id %i by caster: %s %u)", spellId,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog.outError("CastSpell: unknown spell id %i by caster: %s %u)", spellId,(GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
@@ -1011,7 +1010,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit*
{
if(!Victim)
{
- sLog.outError("CastSpell: spell id %i by caster: %s %u) does not have unit target", spellInfo->Id,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog.outError("CastSpell: spell id %i by caster: %s %u) does not have unit target", spellInfo->Id,(GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
else
@@ -1025,7 +1024,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit*
{
if(!Victim)
{
- sLog.outError("CastSpell: spell id %i by caster: %s %u) does not have destination", spellInfo->Id,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog.outError("CastSpell: spell id %i by caster: %s %u) does not have destination", spellInfo->Id,(GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
targets.setDst(Victim);
@@ -1055,7 +1054,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered,
if(!spellInfo)
{
- sLog.outError("CastSpell(x,y,z): unknown spell id %i by caster: %s %u)", spellId,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog.outError("CastSpell(x,y,z): unknown spell id %i by caster: %s %u)", spellId,(GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
@@ -1085,13 +1084,13 @@ void Unit::CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castI
if(!spellInfo)
{
- sLog.outError("CastSpell(x,y,z): unknown spell id %i by caster: %s %u)", spellId,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog.outError("CastSpell(x,y,z): unknown spell id %i by caster: %s %u)", spellId,(GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
if(!(spellInfo->Targets & ( TARGET_FLAG_OBJECT | TARGET_FLAG_OBJECT_UNK)))
{
- sLog.outError("CastSpell: spell id %i by caster: %s %u) is not gameobject spell", spellId,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog.outError("CastSpell: spell id %i by caster: %s %u) is not gameobject spell", spellId,(GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
@@ -1183,7 +1182,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
damage = int32((damage) * float((100.0f + critPctDamageMod)/100.0f));
// Resilience - reduce crit damage
- if (pVictim->GetTypeId()==TYPEID_PLAYER)
+ if (pVictim->GetTypeId() == TYPEID_PLAYER)
damage -= ((Player*)pVictim)->GetMeleeCritDamageReduction(damage);
}
// Spell weapon based damage CAN BE crit & blocked at same time
@@ -1209,7 +1208,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
damageInfo->HitInfo|= SPELL_HIT_TYPE_CRIT;
damage = SpellCriticalDamageBonus(spellInfo, damage, pVictim);
// Resilience - reduce crit damage
- if (pVictim->GetTypeId()==TYPEID_PLAYER)
+ if (pVictim->GetTypeId() == TYPEID_PLAYER)
damage -= ((Player*)pVictim)->GetSpellCritDamageReduction(damage);
}
}
@@ -1390,7 +1389,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
damageInfo->damage = int32((damageInfo->damage) * float((100.0f + mod)/100.0f));
// Resilience - reduce crit damage
- if (pVictim->GetTypeId()==TYPEID_PLAYER)
+ if (pVictim->GetTypeId() == TYPEID_PLAYER)
{
uint32 resilienceReduction = ((Player*)pVictim)->GetMeleeCritDamageReduction(damageInfo->damage);
damageInfo->damage -= resilienceReduction;
@@ -1677,7 +1676,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt
}
// Apply Player CR_ARMOR_PENETRATION rating
- if (GetTypeId()==TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
float maxArmorPen=0;
if (getLevel()<60)
@@ -1869,7 +1868,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
if (spellProto->SpellIconID == 2109)
{
if (!preventDeathSpell &&
- pVictim->GetTypeId()==TYPEID_PLAYER && // Only players
+ pVictim->GetTypeId() == TYPEID_PLAYER && // Only players
!((Player*)pVictim)->HasSpellCooldown(31231) &&
// Only if no cooldown
roll_chance_i((*i)->GetAmount()))
@@ -2345,7 +2344,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
if (GetTypeId() == TYPEID_PLAYER)
parry_chance-= int32(((Player*)this)->GetExpertiseDodgeOrParryReduction(attType)*100);
- if(pVictim->GetTypeId()==TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY) )
+ if(pVictim->GetTypeId() == TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY) )
{
int32 tmp2 = int32(parry_chance);
if ( (tmp2 > 0) // check if unit _can_ parry
@@ -2357,7 +2356,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
}
}
- if(pVictim->GetTypeId()==TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) )
+ if(pVictim->GetTypeId() == TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) )
{
tmp = block_chance;
if ( (tmp > 0) // check if unit _can_ block
@@ -2435,7 +2434,7 @@ uint32 Unit::CalculateDamage (WeaponAttackType attType, bool normalized, bool ad
{
float min_damage, max_damage;
- if (GetTypeId()==TYPEID_PLAYER && (normalized || !addTotalPct))
+ if (GetTypeId() == TYPEID_PLAYER && (normalized || !addTotalPct))
((Player*)this)->CalculateMinMaxDamage(attType,normalized,addTotalPct,min_damage, max_damage);
else
{
@@ -2508,7 +2507,7 @@ void Unit::SendMeleeAttackStop(Unit* victim)
data.append(victim->GetPackGUID()); // can be 0x00...
data << uint32(0); // can be 0x1
SendMessageToSet(&data, true);
- sLog.outDetail("%s %u stopped attacking %s %u", (GetTypeId()==TYPEID_PLAYER ? "player" : "creature"), GetGUIDLow(), (victim->GetTypeId()==TYPEID_PLAYER ? "player" : "creature"),victim->GetGUIDLow());
+ sLog.outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"),victim->GetGUIDLow());
/*if(victim->GetTypeId() == TYPEID_UNIT)
((Creature*)victim)->AI().EnterEvadeMode(this);*/
@@ -2812,7 +2811,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
HitChance += int32(m_modSpellHitChance*100.0f);
// Decrease hit chance from victim rating bonus
- if (pVictim->GetTypeId()==TYPEID_PLAYER)
+ if (pVictim->GetTypeId() == TYPEID_PLAYER)
HitChance -= int32(((Player*)pVictim)->GetRatingBonusValue(CR_HIT_TAKEN_SPELL)*100.0f);
if (HitChance < 100) HitChance = 100;
@@ -2953,7 +2952,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
misschance += ((leveldif - 2) * chance - m_modHitChance);
// Hit chance for victim based on ratings
- if (pVictim->GetTypeId()==TYPEID_PLAYER)
+ if (pVictim->GetTypeId() == TYPEID_PLAYER)
{
if (attType == RANGED_ATTACK)
misschance += ((Player*)pVictim)->GetRatingBonusValue(CR_HIT_TAKEN_RANGED);
@@ -3115,7 +3114,7 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVict
crit += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
// reduce crit chance from Rating for players
- if (pVictim->GetTypeId()==TYPEID_PLAYER)
+ if (pVictim->GetTypeId() == TYPEID_PLAYER)
{
if (attackType==RANGED_ATTACK)
crit -= ((Player*)pVictim)->GetRatingBonusValue(CR_CRIT_TAKEN_RANGED);
@@ -3639,7 +3638,7 @@ bool Unit::AddAura(Aura *Aur, bool handleEffects)
// ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
if( !isAlive() && !IsDeathPersistentSpell(aurSpellInfo) &&
//Aur->GetId() != 2584 && // Waiting to Resurrect (not have death persistence flag)
- (GetTypeId()!=TYPEID_PLAYER || !((Player*)this)->GetSession()->PlayerLoading()) )
+ (GetTypeId() != TYPEID_PLAYER || !((Player*)this)->GetSession()->PlayerLoading()) )
{
delete Aur;
return false;
@@ -3648,8 +3647,8 @@ bool Unit::AddAura(Aura *Aur, bool handleEffects)
if(Aur->GetTarget() != this)
{
sLog.outError("Aura (spell %u) add to aura list of %s (lowguid: %u) but Aura target is %s (lowguid: %u)",
- Aur->GetId(),(GetTypeId()==TYPEID_PLAYER?"player":"creature"),GetGUIDLow(),
- (Aur->GetTarget()->GetTypeId()==TYPEID_PLAYER?"player":"creature"),Aur->GetTarget()->GetGUIDLow());
+ Aur->GetId(),(GetTypeId() == TYPEID_PLAYER?"player":"creature"),GetGUIDLow(),
+ (Aur->GetTarget()->GetTypeId() == TYPEID_PLAYER?"player":"creature"),Aur->GetTarget()->GetGUIDLow());
delete Aur;
return false;
}
@@ -4431,7 +4430,7 @@ void Unit::AddGameObject(GameObject* gameObj)
m_gameObj.push_back(gameObj);
gameObj->SetOwnerGUID(GetGUID());
- if ( GetTypeId()==TYPEID_PLAYER && gameObj->GetSpellId() )
+ if ( GetTypeId() == TYPEID_PLAYER && gameObj->GetSpellId() )
{
SpellEntry const* createBySpell = sSpellStore.LookupEntry(gameObj->GetSpellId());
// Need disable spell use for owner
@@ -4461,7 +4460,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del)
{
RemoveAurasDueToSpell(spellid);
- if (GetTypeId()==TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
SpellEntry const* createBySpell = sSpellStore.LookupEntry(spellid );
// Need activate spell use for owner
@@ -4705,7 +4704,7 @@ bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
{
SpellEntry const *hasteSpell = triggeredByAura->GetSpellProto();
- Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
+ Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
@@ -4750,7 +4749,7 @@ bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false;
- if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
+ if( cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
return false;
if(basepoints0)
@@ -4758,7 +4757,7 @@ bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
- if( cooldown && GetTypeId()==TYPEID_PLAYER )
+ if( cooldown && GetTypeId() == TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true;
@@ -4768,7 +4767,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /*damage*/, AuraE
{
SpellEntry const *triggeredByAuraSpell = triggeredByAura->GetSpellProto();
- Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
+ Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
@@ -4812,7 +4811,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /*damage*/, AuraE
if(!target || target!=this && !target->isAlive())
return false;
- if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
+ if( cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
return false;
if(basepoints0)
@@ -4820,7 +4819,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /*damage*/, AuraE
else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
- if( cooldown && GetTypeId()==TYPEID_PLAYER )
+ if( cooldown && GetTypeId() == TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true;
@@ -4832,7 +4831,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
uint32 effIndex = triggeredByAura->GetEffIndex();
int32 triggerAmount = triggeredByAura->GetAmount();
- Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
+ Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
@@ -5892,7 +5891,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
int32 basepoints1 = triggerAmount * 2;
// Improved Leader of the Pack
// Check cooldown of heal spell cooldown
- if (GetTypeId()==TYPEID_PLAYER && !((Player *)this)->HasSpellCooldown(34299))
+ if (GetTypeId() == TYPEID_PLAYER && !((Player *)this)->HasSpellCooldown(34299))
CastCustomSpell(this,60889,&basepoints1,0,0,true,0,triggeredByAura);
break;
}
@@ -6452,7 +6451,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Windfury Weapon (Passive) 1-5 Ranks
case 33757:
{
- if(GetTypeId()!=TYPEID_PLAYER)
+ if(GetTypeId() != TYPEID_PLAYER)
return false;
if(!castItem || !castItem->IsEquipped())
@@ -6655,7 +6654,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Flametongue Weapon (Passive)
if (dummySpell->SpellFamilyFlags[0] & 0x200000)
{
- if(GetTypeId()!=TYPEID_PLAYER)
+ if(GetTypeId() != TYPEID_PLAYER)
return false;
if(!castItem || !castItem->IsEquipped())
@@ -6720,7 +6719,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
return false;
// custom cooldown processing case
- if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(dummySpell->Id))
+ if( cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(dummySpell->Id))
return false;
uint32 spell;
@@ -6742,7 +6741,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
CastSpell(pVictim, spellId, true, castItem, triggeredByAura);
- if( cooldown && GetTypeId()==TYPEID_PLAYER )
+ if( cooldown && GetTypeId() == TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
return true;
@@ -6922,7 +6921,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
{
triggered_spell_id = 54445;
target = this;
- pVictim->AddThreat(this,procSpell->EffectBasePoints[0]*triggerAmount/100);
+ pVictim->AddThreat(this,procSpell->EffectBasePoints[0]*triggerAmount/100.0f);
break;
}
break;
@@ -6947,7 +6946,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false;
- if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
+ if( cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
return false;
if(basepoints0)
@@ -6955,7 +6954,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura, originalCaster);
- if( cooldown && GetTypeId()==TYPEID_PLAYER )
+ if( cooldown && GetTypeId() == TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true;
@@ -6966,7 +6965,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect*
uint32 effIndex = triggeredByAura->GetEffIndex();
int32 triggerAmount = triggeredByAura->GetAmount();
- Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
+ Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
@@ -7006,14 +7005,14 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect*
if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false;
- if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
+ if( cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
return false;
if(basepoints0)
CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
- if( cooldown && GetTypeId()==TYPEID_PLAYER )
+ if( cooldown && GetTypeId() == TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true;
}
@@ -7023,7 +7022,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff
uint32 effIndex = triggeredByAura->GetEffIndex();
int32 triggerAmount = triggeredByAura->GetAmount();
- Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
+ Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
@@ -7063,7 +7062,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff
if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false;
- if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
+ if( cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
return false;
if(basepoints0)
@@ -7071,7 +7070,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff
else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
- if( cooldown && GetTypeId()==TYPEID_PLAYER )
+ if( cooldown && GetTypeId() == TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true;
@@ -7174,7 +7173,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
if(triggeredByAura->GetAuraName() == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE)
basepoints0 = triggerAmount;
- Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
+ Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
// Try handle unknown trigger spells
@@ -7651,12 +7650,12 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
if(!target)
return false;
- if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)target)->HasSpellCooldown(trigger_spell_id))
+ if( cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)target)->HasSpellCooldown(trigger_spell_id))
return false;
target->CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura);
- if( cooldown && GetTypeId()==TYPEID_PLAYER )
+ if( cooldown && GetTypeId() == TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown);
return true;
}
@@ -7733,7 +7732,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
case 50227:
{
// Remove cooldown on Shield Slam
- if (GetTypeId()==TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
((Player*)this)->RemoveSpellCategoryCooldown(1209, true);
break;
}
@@ -7789,7 +7788,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
case 58628:
{
// remove cooldown of Death Grip
- if (GetTypeId()==TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
((Player*)this)->RemoveCategoryCooldown(82);
return true;
}
@@ -7801,7 +7800,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
}
}
- if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(trigger_spell_id))
+ if( cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(trigger_spell_id))
return false;
// try detect target manually if not set
@@ -7817,7 +7816,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
else
CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura);
- if( cooldown && GetTypeId()==TYPEID_PLAYER )
+ if( cooldown && GetTypeId() == TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown);
return true;
@@ -7830,7 +7829,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraE
if(!pVictim || !pVictim->isAlive())
return false;
- Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
+ Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
@@ -7910,12 +7909,12 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraE
return false;
}
- if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
+ if( cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
return false;
CastSpell(pVictim, triggered_spell_id, true, castItem, triggeredByAura);
- if( cooldown && GetTypeId()==TYPEID_PLAYER )
+ if( cooldown && GetTypeId() == TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true;
@@ -7993,7 +7992,7 @@ bool Unit::IsHostileTo(Unit const* unit) const
return false;
// always non-hostile to GM in GM mode
- if(unit->GetTypeId()==TYPEID_PLAYER && ((Player const*)unit)->isGameMaster())
+ if(unit->GetTypeId() == TYPEID_PLAYER && ((Player const*)unit)->isGameMaster())
return false;
// always hostile to enemy
@@ -8024,7 +8023,7 @@ bool Unit::IsHostileTo(Unit const* unit) const
return false;
// special cases (Duel, etc)
- if(tester->GetTypeId()==TYPEID_PLAYER && target->GetTypeId()==TYPEID_PLAYER)
+ if(tester->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_PLAYER)
{
Player const* pTester = (Player const*)tester;
Player const* pTarget = (Player const*)target;
@@ -8064,7 +8063,7 @@ bool Unit::IsHostileTo(Unit const* unit) const
return true;
// PvC forced reaction and reputation case
- if(tester->GetTypeId()==TYPEID_PLAYER)
+ if(tester->GetTypeId() == TYPEID_PLAYER)
{
// forced reaction
if(target_faction->faction)
@@ -8079,7 +8078,7 @@ bool Unit::IsHostileTo(Unit const* unit) const
}
}
// CvP forced reaction and reputation case
- else if(target->GetTypeId()==TYPEID_PLAYER)
+ else if(target->GetTypeId() == TYPEID_PLAYER)
{
// forced reaction
if(tester_faction->faction)
@@ -8105,7 +8104,7 @@ bool Unit::IsFriendlyTo(Unit const* unit) const
return true;
// always friendly to GM in GM mode
- if(unit->GetTypeId()==TYPEID_PLAYER && ((Player const*)unit)->isGameMaster())
+ if(unit->GetTypeId() == TYPEID_PLAYER && ((Player const*)unit)->isGameMaster())
return true;
// always non-friendly to enemy
@@ -8136,7 +8135,7 @@ bool Unit::IsFriendlyTo(Unit const* unit) const
return true;
// special cases (Duel)
- if(tester->GetTypeId()==TYPEID_PLAYER && target->GetTypeId()==TYPEID_PLAYER)
+ if(tester->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_PLAYER)
{
Player const* pTester = (Player const*)tester;
Player const* pTarget = (Player const*)target;
@@ -8176,7 +8175,7 @@ bool Unit::IsFriendlyTo(Unit const* unit) const
return false;
// PvC forced reaction and reputation case
- if(tester->GetTypeId()==TYPEID_PLAYER)
+ if(tester->GetTypeId() == TYPEID_PLAYER)
{
// forced reaction
if(target_faction->faction)
@@ -8191,7 +8190,7 @@ bool Unit::IsFriendlyTo(Unit const* unit) const
}
}
// CvP forced reaction and reputation case
- else if(target->GetTypeId()==TYPEID_PLAYER)
+ else if(target->GetTypeId() == TYPEID_PLAYER)
{
// forced reaction
if(tester_faction->faction)
@@ -8246,11 +8245,11 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
return false;
// player cannot attack in mount state
- if(GetTypeId()==TYPEID_PLAYER && IsMounted())
+ if(GetTypeId() == TYPEID_PLAYER && IsMounted())
return false;
// nobody can attack GM in GM-mode
- if(victim->GetTypeId()==TYPEID_PLAYER)
+ if(victim->GetTypeId() == TYPEID_PLAYER)
{
if(((Player*)victim)->isGameMaster())
return false;
@@ -8372,7 +8371,7 @@ void Unit::CombatStop(bool includingCast)
AttackStop();
RemoveAllAttackers();
- if( GetTypeId()==TYPEID_PLAYER )
+ if( GetTypeId() == TYPEID_PLAYER )
((Player*)this)->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
ClearInCombat();
}
@@ -8524,7 +8523,7 @@ Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() const
if(IS_PLAYER_GUID(guid))
return ObjectAccessor::GetPlayer(*this, guid);
- return GetTypeId()==TYPEID_PLAYER ? (Player*)this : NULL;
+ return GetTypeId() == TYPEID_PLAYER ? (Player*)this : NULL;
}
Minion *Unit::GetFirstMinion() const
@@ -8816,7 +8815,7 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellPro
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem())
unit = GetOwner();
- if (unit->GetTypeId()==TYPEID_PLAYER)
+ if (unit->GetTypeId() == TYPEID_PLAYER)
{
// overheal = addhealth - gain
unit->SendHealSpellLog(pVictim, spellProto->Id, addhealth, addhealth - gain, critical);
@@ -8831,7 +8830,7 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellPro
((Player*)unit)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED, addhealth);
}
- if (pVictim->GetTypeId()==TYPEID_PLAYER)
+ if (pVictim->GetTypeId() == TYPEID_PLAYER)
{
((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain);
((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth);
@@ -10697,7 +10696,7 @@ bool Unit::isAttackableByAOE() const
UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE))
return false;
- if(GetTypeId()==TYPEID_PLAYER && ((Player *)this)->isGameMaster())
+ if(GetTypeId() == TYPEID_PLAYER && ((Player *)this)->isGameMaster())
return false;
return !hasUnitState(UNIT_STAT_UNATTACKABLE);
@@ -10834,7 +10833,7 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const
// find invisibility detect level
uint32 detectLevel = 0;
- if(i==6 && GetTypeId()==TYPEID_PLAYER) // special drunk detection case
+ if(i==6 && GetTypeId() == TYPEID_PLAYER) // special drunk detection case
{
detectLevel = ((Player*)this)->GetDrunkValue();
}
@@ -10954,7 +10953,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
non_stack_bonus = (100.0 + GetMaxPositiveAuraModifier(SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK))/100.0f;
// Update speed for vehicle if available
- if (GetTypeId()==TYPEID_PLAYER && GetVehicle())
+ if (GetTypeId() == TYPEID_PLAYER && GetVehicle())
GetVehicleBase()->UpdateSpeed(MOVE_FLIGHT, true);
break;
}
@@ -11184,23 +11183,23 @@ void Unit::setDeathState(DeathState s)
bool Unit::CanHaveThreatList() const
{
// only creatures can have threat list
- if( GetTypeId() != TYPEID_UNIT )
+ if (GetTypeId() != TYPEID_UNIT)
return false;
// only alive units can have threat list
- if( !isAlive() )
+ if (!isAlive())
return false;
// totems can not have threat list
- if( ((Creature*)this)->isTotem() )
+ if (((Creature*)this)->isTotem())
return false;
// vehicles can not have threat list
- //if( ((Creature*)this)->IsVehicle() )
+ //if (((Creature*)this)->IsVehicle())
// return false;
// summons can not have a threat list, unless they are controlled by a creature
- if( HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN) && IS_PLAYER_GUID(((Pet*)this)->GetOwnerGUID()) )
+ if (HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN) && IS_PLAYER_GUID(((Pet*)this)->GetOwnerGUID()))
return false;
return true;
@@ -11208,30 +11207,30 @@ bool Unit::CanHaveThreatList() const
//======================================================================
-float Unit::ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask)
+float Unit::ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask)
{
- if(!HasAuraType(SPELL_AURA_MOD_THREAT))
- return threat;
+ if (!HasAuraType(SPELL_AURA_MOD_THREAT))
+ return fThreat;
SpellSchools school = GetFirstSchoolInMask(schoolMask);
- return threat * m_threatModifier[school];
+ return fThreat * m_threatModifier[school];
}
//======================================================================
-void Unit::AddThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask, SpellEntry const *threatSpell)
+void Unit::AddThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *threatSpell)
{
// Only mobs can manage threat lists
- if(CanHaveThreatList())
- m_ThreatManager.addThreat(pVictim, threat, schoolMask, threatSpell);
+ if (CanHaveThreatList())
+ m_ThreatManager.addThreat(pVictim, fThreat, schoolMask, threatSpell);
}
//======================================================================
void Unit::DeleteThreatList()
{
- if(CanHaveThreatList() && !m_ThreatManager.isThreatListEmpty())
+ if (CanHaveThreatList() && !m_ThreatManager.isThreatListEmpty())
SendClearThreatListOpcode();
m_ThreatManager.clearReferences();
}
@@ -11242,17 +11241,17 @@ void Unit::TauntApply(Unit* taunter)
{
assert(GetTypeId()== TYPEID_UNIT);
- if(!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && ((Player*)taunter)->isGameMaster()))
+ if (!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && ((Player*)taunter)->isGameMaster()))
return;
- if(!CanHaveThreatList())
+ if (!CanHaveThreatList())
return;
- if(((Creature*)this)->HasReactState(REACT_PASSIVE))
+ if (((Creature*)this)->HasReactState(REACT_PASSIVE))
return;
Unit *target = getVictim();
- if(target && target == taunter)
+ if (target && target == taunter)
return;
SetInFront(taunter);
@@ -11268,20 +11267,20 @@ void Unit::TauntFadeOut(Unit *taunter)
{
assert(GetTypeId()== TYPEID_UNIT);
- if(!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && ((Player*)taunter)->isGameMaster()))
+ if (!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && ((Player*)taunter)->isGameMaster()))
return;
- if(!CanHaveThreatList())
+ if (!CanHaveThreatList())
return;
- if(((Creature*)this)->HasReactState(REACT_PASSIVE))
+ if (((Creature*)this)->HasReactState(REACT_PASSIVE))
return;
Unit *target = getVictim();
- if(!target || target != taunter)
+ if (!target || target != taunter)
return;
- if(m_ThreatManager.isThreatListEmpty())
+ if (m_ThreatManager.isThreatListEmpty())
{
if(((Creature*)this)->IsAIEnabled)
((Creature*)this)->AI()->EnterEvadeMode();
@@ -11310,12 +11309,12 @@ Unit* Creature::SelectVictim()
Unit* target = NULL;
// First checking if we have some taunt on us
const AuraEffectList& tauntAuras = GetAurasByType(SPELL_AURA_MOD_TAUNT);
- if ( !tauntAuras.empty() )
+ if (!tauntAuras.empty())
{
Unit* caster;
// The last taunt aura caster is alive an we are happy to attack him
- if ( (caster = tauntAuras.back()->GetCaster()) && caster->isAlive() )
+ if ((caster = tauntAuras.back()->GetCaster()) && caster->isAlive())
return getVictim();
else if (tauntAuras.size() > 1)
{
@@ -11327,8 +11326,8 @@ Unit* Creature::SelectVictim()
do
{
--aura;
- if ( (caster = (*aura)->GetCaster()) &&
- caster->IsInMap(this) && canAttack(caster) && caster->isInAccessiblePlaceFor((Creature*)this) )
+ if ((caster = (*aura)->GetCaster()) &&
+ caster->IsInMap(this) && canAttack(caster) && caster->isInAccessiblePlaceFor((Creature*)this))
{
target = caster;
break;
@@ -11341,11 +11340,11 @@ Unit* Creature::SelectVictim()
if (CanHaveThreatList())
{
- if ( !target && !m_ThreatManager.isThreatListEmpty() )
+ if (!target && !m_ThreatManager.isThreatListEmpty())
// No taunt aura or taunt aura caster is dead standard target selection
target = m_ThreatManager.getHostilTarget();
}
- else if(!HasReactState(REACT_PASSIVE))
+ else if (!HasReactState(REACT_PASSIVE))
{
// We have player pet probably
target = getAttackerForHelper();
@@ -11372,7 +11371,7 @@ Unit* Creature::SelectVictim()
else
return NULL;
- if(target && _IsTargetAcceptable(target))
+ if (target && _IsTargetAcceptable(target))
{
SetInFront(target);
return target;
@@ -11384,26 +11383,26 @@ Unit* Creature::SelectVictim()
// Note: creature not have targeted movement generator but have attacker in this case
for (AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
{
- if((*itr) && !canCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER
+ if ((*itr) && !canCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER
&& !((Creature*)(*itr))->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
return NULL;
}
// TODO: a vehicle may eat some mob, so mob should not evade
- if(GetVehicle())
+ if (GetVehicle())
return NULL;
// search nearby enemy before enter evade mode
- if(HasReactState(REACT_AGGRESSIVE))
- if(target = SelectNearestTarget())
- if(_IsTargetAcceptable(target))
+ if (HasReactState(REACT_AGGRESSIVE))
+ if (target = SelectNearestTarget())
+ if (_IsTargetAcceptable(target))
return target;
- if(m_invisibilityMask)
+ if (m_invisibilityMask)
{
Unit::AuraEffectList const& iAuras = GetAurasByType(SPELL_AURA_MOD_INVISIBILITY);
for (Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
- if((*itr)->GetParentAura()->IsPermanent())
+ if ((*itr)->GetParentAura()->IsPermanent())
{
AI()->EnterEvadeMode();
break;
@@ -11424,11 +11423,11 @@ Unit* Creature::SelectVictim()
int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 effBasePoints, Unit const* /*target*/)
{
int32 level = int32(getLevel());
- if (level > (int32)spellProto->maxLevel && spellProto->maxLevel > 0)
- level = (int32)spellProto->maxLevel;
- else if (level < (int32)spellProto->baseLevel)
- level = (int32)spellProto->baseLevel;
- level-= (int32)spellProto->spellLevel;
+ if (level > int32(spellProto->maxLevel) && spellProto->maxLevel > 0)
+ level = int32(spellProto->maxLevel);
+ else if (level < int32(spellProto->baseLevel))
+ level = int32(spellProto->baseLevel);
+ level -= int32(spellProto->spellLevel);
float basePointsPerLevel = spellProto->EffectRealPointsPerLevel[effect_index];
float randomPointsPerLevel = spellProto->EffectDicePerLevel[effect_index];
@@ -11443,15 +11442,15 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_inde
int32 value = basePoints + randvalue;
//random damage
//if(comboDamage != 0 && unitPlayer /*&& target && (target->GetGUID() == unitPlayer->GetComboTarget())*/)
- if(m_movedPlayer)
- if(uint8 comboPoints = m_movedPlayer->GetComboPoints())
- if(float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index])
- value += (int32)(comboDamage * comboPoints);
+ if (m_movedPlayer)
+ if (uint8 comboPoints = m_movedPlayer->GetComboPoints())
+ if (float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index])
+ value += int32(comboDamage * comboPoints);
if(Player* modOwner = GetSpellModOwner())
{
modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_ALL_EFFECTS, value);
- switch(effect_index)
+ switch (effect_index)
{
case 0:
modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_EFFECT1, value);
@@ -11488,7 +11487,7 @@ int32 Unit::CalcSpellDuration(SpellEntry const* spellProto)
int32 duration;
- if(comboPoints && minduration != -1 && minduration != maxduration)
+ if (comboPoints && minduration != -1 && minduration != maxduration)
duration = minduration + int32((maxduration - minduration) * comboPoints / 5);
else
duration = minduration;
@@ -11499,7 +11498,7 @@ int32 Unit::CalcSpellDuration(SpellEntry const* spellProto)
int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, int32 duration, bool positive)
{
//don't mod permament auras duration
- if (duration<0)
+ if (duration < 0)
return duration;
//cut duration only of negative effects
@@ -11511,7 +11510,7 @@ int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, i
int32 durationMod_always = 0;
int32 durationMod_not_stack = 0;
- for (uint8 i = 1; i<=MECHANIC_ENRAGED; ++i)
+ for (uint8 i = 1; i <= MECHANIC_ENRAGED; ++i)
{
if (!(mechanic & 1<<i))
continue;
@@ -11533,20 +11532,20 @@ int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, i
durationMod = durationMod_always;
if (durationMod != 0)
- duration = int32( float (duration) * float(100.0f+durationMod) /100.0f);
+ duration = int32(float(duration) * float(100.0f+durationMod) / 100.0f);
// there are only negative mods currently
- durationMod_always =target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, spellProto->Dispel);
- durationMod_not_stack=target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK, spellProto->Dispel);
+ durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, spellProto->Dispel);
+ durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK, spellProto->Dispel);
- durationMod=0;
+ durationMod = 0;
if (durationMod_always > durationMod_not_stack)
durationMod += durationMod_not_stack;
else
durationMod += durationMod_always;
if (durationMod != 0)
- duration = int32( float (duration) * float(100.0f+durationMod) /100.0f);
+ duration = int32(float(duration) * float(100.0f+durationMod) / 100.0f);
}
//else positive mods here, there are no currently
//when there will be, change GetTotalAuraModifierByMiscValue to GetTotalPositiveAuraModifierByMiscValue
@@ -11554,49 +11553,49 @@ int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, i
// Glyphs which increase duration of selfcasted buffs
if (target == this)
{
- switch(spellProto->SpellFamilyName)
+ switch (spellProto->SpellFamilyName)
{
- case SPELLFAMILY_DRUID:
- if (spellProto->SpellFamilyFlags[0] & 0x100)
- {
- // Glyph of Thorns
- if (AuraEffect * aurEff = GetAuraEffect(57862, 0))
- duration += aurEff->GetAmount() * MINUTE * IN_MILISECONDS;
- }
- break;
- case SPELLFAMILY_PALADIN:
- if (spellProto->SpellFamilyFlags[0] & 0x00000002)
- {
- // Glyph of Blessing of Might
- if (AuraEffect * aurEff = GetAuraEffect(57958, 0))
- duration += aurEff->GetAmount() * MINUTE * IN_MILISECONDS;
- }
- else if (spellProto->SpellFamilyFlags[0] & 0x00010000)
- {
- // Glyph of Blessing of Wisdom
- if (AuraEffect * aurEff = GetAuraEffect(57979, 0))
- duration += aurEff->GetAmount() * MINUTE * IN_MILISECONDS;
- }
- break;
+ case SPELLFAMILY_DRUID:
+ if (spellProto->SpellFamilyFlags[0] & 0x100)
+ {
+ // Glyph of Thorns
+ if (AuraEffect * aurEff = GetAuraEffect(57862, 0))
+ duration += aurEff->GetAmount() * MINUTE * IN_MILISECONDS;
+ }
+ break;
+ case SPELLFAMILY_PALADIN:
+ if (spellProto->SpellFamilyFlags[0] & 0x00000002)
+ {
+ // Glyph of Blessing of Might
+ if (AuraEffect * aurEff = GetAuraEffect(57958, 0))
+ duration += aurEff->GetAmount() * MINUTE * IN_MILISECONDS;
+ }
+ else if (spellProto->SpellFamilyFlags[0] & 0x00010000)
+ {
+ // Glyph of Blessing of Wisdom
+ if (AuraEffect * aurEff = GetAuraEffect(57979, 0))
+ duration += aurEff->GetAmount() * MINUTE * IN_MILISECONDS;
+ }
+ break;
}
}
- return duration>0 ? duration : 0;
+ return duration > 0 ? duration : 0;
}
void Unit::ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spell * spell)
{
- if (!spellProto || castTime<0)
+ if (!spellProto || castTime < 0)
return;
//called from caster
- if(Player* modOwner = GetSpellModOwner())
+ if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CASTING_TIME, castTime, spell);
- if( !(spellProto->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_TRADESPELL)) && spellProto->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && spellProto->SpellFamilyName)
- castTime = int32( float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
+ if (!(spellProto->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_TRADESPELL)) && spellProto->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && spellProto->SpellFamilyName)
+ castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
else
{
if (spellProto->Attributes & SPELL_ATTR_REQ_AMMO && !(spellProto->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG))
- castTime = int32 (float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
+ castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
}
}
@@ -11604,26 +11603,24 @@ DiminishingLevels Unit::GetDiminishing(DiminishingGroup group)
{
for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
{
- if(i->DRGroup != group)
+ if (i->DRGroup != group)
continue;
- if(!i->hitCount)
+ if (!i->hitCount)
return DIMINISHING_LEVEL_1;
- if(!i->hitTime)
+ if (!i->hitTime)
return DIMINISHING_LEVEL_1;
// If last spell was casted more than 15 seconds ago - reset the count.
- if(i->stack==0 && getMSTimeDiff(i->hitTime,getMSTime()) > 15000)
+ if (i->stack==0 && getMSTimeDiff(i->hitTime,getMSTime()) > 15000)
{
i->hitCount = DIMINISHING_LEVEL_1;
return DIMINISHING_LEVEL_1;
}
// or else increase the count.
else
- {
return DiminishingLevels(i->hitCount);
- }
}
return DIMINISHING_LEVEL_1;
}
@@ -11633,9 +11630,9 @@ void Unit::IncrDiminishing(DiminishingGroup group)
// Checking for existing in the table
for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
{
- if(i->DRGroup != group)
+ if (i->DRGroup != group)
continue;
- if(i->hitCount < DIMINISHING_LEVEL_IMMUNE)
+ if (i->hitCount < DIMINISHING_LEVEL_IMMUNE)
i->hitCount += 1;
return;
}
@@ -11644,7 +11641,7 @@ void Unit::IncrDiminishing(DiminishingGroup group)
void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster,DiminishingLevels Level, int32 limitduration)
{
- if(duration == -1 || group == DIMINISHING_NONE || caster->IsFriendlyTo(this) )
+ if (duration == -1 || group == DIMINISHING_NONE || caster->IsFriendlyTo(this))
return;
// test pet/charm masters instead pets/charmeds
@@ -11652,7 +11649,7 @@ void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Un
Unit const* casterOwner = caster->GetCharmerOrOwner();
// Duration of crowd control abilities on pvp target is limited by 10 sec. (2.2.0)
- if(limitduration > 0 && duration > limitduration)
+ if (limitduration > 0 && duration > limitduration)
{
Unit const* target = targetOwner ? targetOwner : this;
Unit const* source = casterOwner ? casterOwner : caster;
@@ -11664,7 +11661,7 @@ void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Un
float mod = 1.0f;
// Some diminishings applies to mobs too (for example, Stun)
- if((GetDiminishingReturnsGroupType(group) == DRTYPE_PLAYER && (targetOwner ? (targetOwner->GetTypeId() == TYPEID_PLAYER) : (GetTypeId() == TYPEID_PLAYER))) || GetDiminishingReturnsGroupType(group) == DRTYPE_ALL)
+ if ((GetDiminishingReturnsGroupType(group) == DRTYPE_PLAYER && (targetOwner ? (targetOwner->GetTypeId() == TYPEID_PLAYER) : (GetTypeId() == TYPEID_PLAYER))) || GetDiminishingReturnsGroupType(group) == DRTYPE_ALL)
{
DiminishingLevels diminish = Level;
switch(diminish)
@@ -11672,7 +11669,7 @@ void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Un
case DIMINISHING_LEVEL_1: break;
case DIMINISHING_LEVEL_2: mod = 0.5f; break;
case DIMINISHING_LEVEL_3: mod = 0.25f; break;
- case DIMINISHING_LEVEL_IMMUNE: mod = 0.0f;break;
+ case DIMINISHING_LEVEL_IMMUNE: mod = 0.0f; break;
default: break;
}
}
@@ -11685,12 +11682,12 @@ void Unit::ApplyDiminishingAura( DiminishingGroup group, bool apply )
// Checking for existing in the table
for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
{
- if(i->DRGroup != group)
+ if (i->DRGroup != group)
continue;
- if(apply)
+ if (apply)
i->stack += 1;
- else if(i->stack)
+ else if (i->stack)
{
i->stack -= 1;
// Remember time after last aura from group removed
@@ -11774,7 +11771,7 @@ uint32 Unit::GetCreatureType() const
bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
{
- if(unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
+ if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
{
sLog.outError("ERROR in HandleStatModifier(): non existed UnitMods or wrong UnitModifierType!");
return false;
@@ -11782,7 +11779,7 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f
float val = 1.0f;
- switch(modifierType)
+ switch (modifierType)
{
case BASE_VALUE:
case TOTAL_VALUE:
@@ -11801,7 +11798,7 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f
break;
}
- if(!CanModifyStats())
+ if (!CanModifyStats())
return false;
switch(unitMod)
@@ -11885,7 +11882,7 @@ float Unit::GetTotalAuraModValue(UnitMods unitMod) const
if(m_auraModifiersGroup[unitMod][TOTAL_PCT] <= 0.0f)
return 0.0f;
- float value = m_auraModifiersGroup[unitMod][BASE_VALUE];
+ float value = m_auraModifiersGroup[unitMod][BASE_VALUE];
value *= m_auraModifiersGroup[unitMod][BASE_PCT];
value += m_auraModifiersGroup[unitMod][TOTAL_VALUE];
value *= m_auraModifiersGroup[unitMod][TOTAL_PCT];
@@ -11934,19 +11931,17 @@ Stats Unit::GetStatByAuraGroup(UnitMods unitMod) const
Powers Unit::GetPowerTypeByAuraGroup(UnitMods unitMod) const
{
- switch(unitMod)
+ switch (unitMod)
{
- case UNIT_MOD_MANA: return POWER_MANA;
- case UNIT_MOD_RAGE: return POWER_RAGE;
- case UNIT_MOD_FOCUS: return POWER_FOCUS;
- case UNIT_MOD_ENERGY: return POWER_ENERGY;
- case UNIT_MOD_HAPPINESS: return POWER_HAPPINESS;
- case UNIT_MOD_RUNE: return POWER_RUNE;
- case UNIT_MOD_RUNIC_POWER:return POWER_RUNIC_POWER;
- default: return POWER_MANA;
+ case UNIT_MOD_RAGE: return POWER_RAGE;
+ case UNIT_MOD_FOCUS: return POWER_FOCUS;
+ case UNIT_MOD_ENERGY: return POWER_ENERGY;
+ case UNIT_MOD_HAPPINESS: return POWER_HAPPINESS;
+ case UNIT_MOD_RUNE: return POWER_RUNE;
+ case UNIT_MOD_RUNIC_POWER: return POWER_RUNIC_POWER;
+ default:
+ case UNIT_MOD_MANA: return POWER_MANA;
}
-
- return POWER_MANA;
}
float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const
@@ -11986,9 +11981,9 @@ void Unit::SetLevel(uint32 lvl)
void Unit::SetHealth(uint32 val)
{
- if(getDeathState() == JUST_DIED)
+ if (getDeathState() == JUST_DIED)
val = 0;
- else if(GetTypeId() == TYPEID_PLAYER && (getDeathState() == DEAD || getDeathState() == DEAD_FALLING))
+ else if (GetTypeId() == TYPEID_PLAYER && (getDeathState() == DEAD || getDeathState() == DEAD_FALLING))
val = 1;
else
{
@@ -12000,15 +11995,15 @@ void Unit::SetHealth(uint32 val)
SetUInt32Value(UNIT_FIELD_HEALTH, val);
// group update
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
- if(((Player*)this)->GetGroup())
+ if (((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP);
}
- else if(((Creature*)this)->isPet())
+ else if (((Creature*)this)->isPet())
{
Pet *pet = ((Pet*)this);
- if(pet->isControlled())
+ if (pet->isControlled())
{
Unit *owner = GetOwner();
if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
@@ -12019,18 +12014,19 @@ void Unit::SetHealth(uint32 val)
void Unit::SetMaxHealth(uint32 val)
{
- if(!val) val = 1;
+ if (!val)
+ val = 1;
uint32 health = GetHealth();
SetUInt32Value(UNIT_FIELD_MAXHEALTH, val);
// group update
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
- if(((Player*)this)->GetGroup())
+ if (((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_HP);
}
- else if(((Creature*)this)->isPet())
+ else if (((Creature*)this)->isPet())
{
Pet *pet = ((Pet*)this);
if(pet->isControlled())
@@ -12041,17 +12037,17 @@ void Unit::SetMaxHealth(uint32 val)
}
}
- if(val < health)
+ if (val < health)
SetHealth(val);
}
void Unit::SetPower(Powers power, uint32 val)
{
- if(GetPower(power) == val)
+ if (GetPower(power) == val)
return;
uint32 maxPower = GetMaxPower(power);
- if(maxPower < val)
+ if (maxPower < val)
val = maxPower;
SetStatInt32Value(UNIT_FIELD_POWER1 + power, val);
@@ -12063,23 +12059,23 @@ void Unit::SetPower(Powers power, uint32 val)
SendMessageToSet(&data, GetTypeId() == TYPEID_PLAYER ? true : false);
// group update
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
- if(((Player*)this)->GetGroup())
+ if (((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER);
}
- else if(((Creature*)this)->isPet())
+ else if (((Creature*)this)->isPet())
{
Pet *pet = ((Pet*)this);
- if(pet->isControlled())
+ if (pet->isControlled())
{
Unit *owner = GetOwner();
- if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
+ if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_POWER);
}
// Update the pet's character sheet with happiness damage bonus
- if(pet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS)
+ if (pet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS)
pet->UpdateDamagePhysical(BASE_ATTACK);
}
}
@@ -12090,23 +12086,23 @@ void Unit::SetMaxPower(Powers power, uint32 val)
SetStatInt32Value(UNIT_FIELD_MAXPOWER1 + power, val);
// group update
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
- if(((Player*)this)->GetGroup())
+ if (((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER);
}
- else if(((Creature*)this)->isPet())
+ else if (((Creature*)this)->isPet())
{
Pet *pet = ((Pet*)this);
- if(pet->isControlled())
+ if (pet->isControlled())
{
Unit *owner = GetOwner();
- if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
+ if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MAX_POWER);
}
}
- if(val < cur_power)
+ if (val < cur_power)
SetPower(power, val);
}
@@ -12115,18 +12111,18 @@ void Unit::ApplyPowerMod(Powers power, uint32 val, bool apply)
ApplyModUInt32Value(UNIT_FIELD_POWER1+power, val, apply);
// group update
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
- if(((Player*)this)->GetGroup())
+ if (((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER);
}
- else if(((Creature*)this)->isPet())
+ else if (((Creature*)this)->isPet())
{
Pet *pet = ((Pet*)this);
- if(pet->isControlled())
+ if (pet->isControlled())
{
Unit *owner = GetOwner();
- if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
+ if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_POWER);
}
}
@@ -12137,18 +12133,18 @@ void Unit::ApplyMaxPowerMod(Powers power, uint32 val, bool apply)
ApplyModUInt32Value(UNIT_FIELD_MAXPOWER1+power, val, apply);
// group update
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
{
- if(((Player*)this)->GetGroup())
+ if (((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER);
}
- else if(((Creature*)this)->isPet())
+ else if (((Creature*)this)->isPet())
{
Pet *pet = ((Pet*)this);
- if(pet->isControlled())
+ if (pet->isControlled())
{
Unit *owner = GetOwner();
- if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
+ if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MAX_POWER);
}
}
@@ -12157,13 +12153,13 @@ void Unit::ApplyMaxPowerMod(Powers power, uint32 val, bool apply)
uint32 Unit::GetCreatePowers( Powers power ) const
{
// POWER_FOCUS and POWER_HAPPINESS only have hunter pet
- switch(power)
+ switch (power)
{
case POWER_MANA: return GetCreateMana();
case POWER_RAGE: return 1000;
- case POWER_FOCUS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 100);
+ case POWER_FOCUS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 100);
case POWER_ENERGY: return 100;
- case POWER_HAPPINESS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 1050000);
+ case POWER_HAPPINESS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 1050000);
case POWER_RUNIC_POWER: return 1000;
case POWER_RUNE: return 0;
case POWER_HEALTH: return 0;
@@ -12174,7 +12170,7 @@ uint32 Unit::GetCreatePowers( Powers power ) const
void Unit::AddToWorld()
{
- if(!IsInWorld())
+ if (!IsInWorld())
{
WorldObject::AddToWorld();
m_Notified = false;
@@ -12189,9 +12185,9 @@ void Unit::RemoveFromWorld()
// cleanup
assert(GetGUID());
- if(IsInWorld())
+ if (IsInWorld())
{
- if(IsVehicle())
+ if (IsVehicle())
GetVehicleKit()->Uninstall();
RemoveCharmAuras();
@@ -12202,18 +12198,18 @@ void Unit::RemoveFromWorld()
UnsummonAllTotems();
RemoveAllControlled();
- if(m_NotifyListPos >= 0)
+ if (m_NotifyListPos >= 0)
GetMap()->RemoveUnitFromNotify(this);
- if(GetCharmerGUID())
+ if (GetCharmerGUID())
{
sLog.outCrash("Unit %u has charmer guid when removed from world", GetEntry());
assert(false);
}
- if(Unit *owner = GetOwner())
+ if (Unit *owner = GetOwner())
{
- if(owner->m_Controlled.find(this) != owner->m_Controlled.end())
+ if (owner->m_Controlled.find(this) != owner->m_Controlled.end())
{
sLog.outCrash("Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry());
assert(false);
@@ -12241,18 +12237,18 @@ void Unit::CleanupsBeforeDelete()
RemoveAllDynObjects();
GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
- if(IsInWorld())
+ if (IsInWorld())
RemoveFromWorld();
}
void Unit::UpdateCharmAI()
{
- if(GetTypeId() == TYPEID_PLAYER)
+ if (GetTypeId() == TYPEID_PLAYER)
return;
- if(i_disabledAI) // disabled AI must be primary AI
+ if (i_disabledAI) // disabled AI must be primary AI
{
- if(!isCharmed())
+ if (!isCharmed())
{
if(i_AI) delete i_AI;
i_AI = i_disabledAI;
@@ -12261,10 +12257,10 @@ void Unit::UpdateCharmAI()
}
else
{
- if(isCharmed())
+ if (isCharmed())
{
i_disabledAI = i_AI;
- if(isPossessed() || IsVehicle())
+ if (isPossessed() || IsVehicle())
i_AI = new PossessedAI((Creature*)this);
else
i_AI = new PetAI((Creature*)this);
@@ -12274,7 +12270,7 @@ void Unit::UpdateCharmAI()
CharmInfo* Unit::InitCharmInfo()
{
- if(!m_charmInfo)
+ if (!m_charmInfo)
m_charmInfo = new CharmInfo(this);
return m_charmInfo;
@@ -12282,7 +12278,7 @@ CharmInfo* Unit::InitCharmInfo()
void Unit::DeleteCharmInfo()
{
- if(!m_charmInfo)
+ if (!m_charmInfo)
return;
delete m_charmInfo;
@@ -12295,7 +12291,7 @@ CharmInfo::CharmInfo(Unit* unit)
for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
m_charmspells[i].SetActionAndType(0,ACT_DISABLED);
- if(m_unit->GetTypeId() == TYPEID_UNIT)
+ if (m_unit->GetTypeId() == TYPEID_UNIT)
{
m_oldReactState = ((Creature*)m_unit)->GetReactState();
((Creature*)m_unit)->SetReactState(REACT_PASSIVE);
@@ -12305,7 +12301,7 @@ CharmInfo::CharmInfo(Unit* unit)
CharmInfo::~CharmInfo()
{
- if(m_unit->GetTypeId() == TYPEID_UNIT)
+ if (m_unit->GetTypeId() == TYPEID_UNIT)
{
((Creature*)m_unit)->SetReactState(m_oldReactState);
}
@@ -12328,7 +12324,7 @@ void CharmInfo::InitPetActionBar()
void CharmInfo::InitEmptyActionBar(bool withAttack)
{
- if(withAttack)
+ if (withAttack)
SetActionBar(ACTION_BAR_INDEX_START,COMMAND_ATTACK,ACT_COMMAND);
else
SetActionBar(ACTION_BAR_INDEX_START,0,ACT_PASSIVE);
@@ -12345,9 +12341,9 @@ void CharmInfo::InitPossessCreateSpells()
{
uint32 spellId = ((Creature*)m_unit)->m_spells[i];
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
- if(spellInfo && spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD)
+ if (spellInfo && spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD)
spellId = 0;
- if(IsPassiveSpell(spellId))
+ if (IsPassiveSpell(spellId))
m_unit->CastSpell(m_unit, spellId, true);
else
AddSpellToActionBar(((Creature*)m_unit)->m_spells[i], ACT_PASSIVE);
@@ -12357,7 +12353,7 @@ void CharmInfo::InitPossessCreateSpells()
void CharmInfo::InitCharmCreateSpells()
{
- if(m_unit->GetTypeId() == TYPEID_PLAYER) //charmed players don't have spells
+ if (m_unit->GetTypeId() == TYPEID_PLAYER) //charmed players don't have spells
{
InitEmptyActionBar();
return;
@@ -12369,10 +12365,10 @@ void CharmInfo::InitCharmCreateSpells()
{
uint32 spellId = ((Creature*)m_unit)->m_spells[x];
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
- if(spellInfo && spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD)
+ if (spellInfo && spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD)
spellId = 0;
- if(!spellId)
+ if (!spellId)
{
m_charmspells[x].SetActionAndType(spellId,ACT_DISABLED);
continue;
@@ -12388,18 +12384,18 @@ void CharmInfo::InitCharmCreateSpells()
m_charmspells[x].SetActionAndType(spellId,ACT_DISABLED);
ActiveStates newstate;
- if(spellInfo)
+ if (spellInfo)
{
- if(!IsAutocastableSpell(spellId))
+ if (!IsAutocastableSpell(spellId))
newstate = ACT_PASSIVE;
else
{
bool autocast = false;
for (uint32 i = 0; i < MAX_SPELL_EFFECTS && !autocast; ++i)
- if(SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET)
+ if (SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET)
autocast = true;
- if(autocast)
+ if (autocast)
{
newstate = ACT_ENABLED;
ToggleCreatureAutocast(spellId, true);
@@ -12464,7 +12460,7 @@ bool CharmInfo::RemoveSpellFromActionBar(uint32 spell_id)
void CharmInfo::ToggleCreatureAutocast(uint32 spellid, bool apply)
{
- if(IsPassiveSpell(spellid))
+ if (IsPassiveSpell(spellid))
return;
for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
@@ -12475,7 +12471,7 @@ void CharmInfo::ToggleCreatureAutocast(uint32 spellid, bool apply)
void CharmInfo::SetPetNumber(uint32 petnumber, bool statwindow)
{
m_petnumber = petnumber;
- if(statwindow)
+ if (statwindow)
m_unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, m_petnumber);
else
m_unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, 0);
@@ -12502,11 +12498,11 @@ void CharmInfo::LoadPetActionBar(const std::string& data )
PetActionBar[index].SetActionAndType(action,ActiveStates(type));
// check correctness
- if(PetActionBar[index].IsActionBarForSpell())
+ if (PetActionBar[index].IsActionBarForSpell())
{
- if(!sSpellStore.LookupEntry(PetActionBar[index].GetAction()))
+ if (!sSpellStore.LookupEntry(PetActionBar[index].GetAction()))
SetActionBar(index,0,ACT_PASSIVE);
- else if(!IsAutocastableSpell(PetActionBar[index].GetAction()))
+ else if (!IsAutocastableSpell(PetActionBar[index].GetAction()))
SetActionBar(index,PetActionBar[index].GetAction(),ACT_PASSIVE);
}
}
@@ -12522,7 +12518,7 @@ void CharmInfo::SetSpellAutocast( uint32 spell_id, bool state )
{
for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
{
- if(spell_id == PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
+ if (spell_id == PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
{
PetActionBar[i].SetType(state ? ACT_ENABLED : ACT_DISABLED);
break;
@@ -12607,23 +12603,23 @@ uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missC
{
uint32 procEx = PROC_EX_NONE;
// Check victim state
- if (missCondition!=SPELL_MISS_NONE)
- switch (missCondition)
- {
- case SPELL_MISS_MISS: procEx|=PROC_EX_MISS; break;
- case SPELL_MISS_RESIST: procEx|=PROC_EX_RESIST; break;
- case SPELL_MISS_DODGE: procEx|=PROC_EX_DODGE; break;
- case SPELL_MISS_PARRY: procEx|=PROC_EX_PARRY; break;
- case SPELL_MISS_BLOCK: procEx|=PROC_EX_BLOCK; break;
- case SPELL_MISS_EVADE: procEx|=PROC_EX_EVADE; break;
- case SPELL_MISS_IMMUNE: procEx|=PROC_EX_IMMUNE; break;
- case SPELL_MISS_IMMUNE2: procEx|=PROC_EX_IMMUNE; break;
- case SPELL_MISS_DEFLECT: procEx|=PROC_EX_DEFLECT;break;
- case SPELL_MISS_ABSORB: procEx|=PROC_EX_ABSORB; break;
- case SPELL_MISS_REFLECT: procEx|=PROC_EX_REFLECT;break;
- default:
- break;
- }
+ if (missCondition != SPELL_MISS_NONE)
+ switch (missCondition)
+ {
+ case SPELL_MISS_MISS: procEx|=PROC_EX_MISS; break;
+ case SPELL_MISS_RESIST: procEx|=PROC_EX_RESIST; break;
+ case SPELL_MISS_DODGE: procEx|=PROC_EX_DODGE; break;
+ case SPELL_MISS_PARRY: procEx|=PROC_EX_PARRY; break;
+ case SPELL_MISS_BLOCK: procEx|=PROC_EX_BLOCK; break;
+ case SPELL_MISS_EVADE: procEx|=PROC_EX_EVADE; break;
+ case SPELL_MISS_IMMUNE: procEx|=PROC_EX_IMMUNE; break;
+ case SPELL_MISS_IMMUNE2: procEx|=PROC_EX_IMMUNE; break;
+ case SPELL_MISS_DEFLECT: procEx|=PROC_EX_DEFLECT;break;
+ case SPELL_MISS_ABSORB: procEx|=PROC_EX_ABSORB; break;
+ case SPELL_MISS_REFLECT: procEx|=PROC_EX_REFLECT;break;
+ default:
+ break;
+ }
else
{
// On block
@@ -12726,7 +12722,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
if(!IsTriggeredAtSpellProcEvent(pTarget, triggerData.aura, procSpell, procFlag, procExtra, attType, isVictim, active, triggerData.spellProcEvent))
continue;
- for (uint8 i=0; i<MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (AuraEffect * aurEff = itr->second->GetPartAura(i))
{
@@ -12794,7 +12790,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
sLog.outDebug("ProcDamageAndSpell: casting spell %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
// Don`t drop charge or add cooldown for not started trigger
if (HandleProcTriggerSpell(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
- takeCharges=true;
+ takeCharges = true;
break;
}
case SPELL_AURA_PROC_TRIGGER_DAMAGE:
@@ -12806,7 +12802,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
DealDamageMods(damageInfo.target,damageInfo.damage,&damageInfo.absorb);
SendSpellNonMeleeDamageLog(&damageInfo);
DealSpellDamage(&damageInfo, true);
- takeCharges=true;
+ takeCharges = true;
break;
}
case SPELL_AURA_MANA_SHIELD:
@@ -12814,31 +12810,31 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
{
sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s dummy aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
if (HandleDummyAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
- takeCharges=true;
+ takeCharges = true;
break;
}
case SPELL_AURA_OBS_MOD_POWER:
sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
if (HandleObsModEnergyAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
- takeCharges=true;
+ takeCharges = true;
break;
case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN:
sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
if (HandleModDamagePctTakenAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
- takeCharges=true;
+ takeCharges = true;
break;
case SPELL_AURA_MOD_HASTE:
{
sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s haste aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
if (HandleHasteAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
- takeCharges=true;
+ takeCharges = true;
break;
}
case SPELL_AURA_OVERRIDE_CLASS_SCRIPTS:
{
sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
if (HandleOverrideClassScriptAuraProc(pTarget, damage, triggeredByAura, procSpell, cooldown))
- takeCharges=true;
+ takeCharges = true;
break;
}
case SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE:
@@ -12847,7 +12843,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
(isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId());
HandleAuraRaidProcFromChargeWithValue(triggeredByAura);
- takeCharges=true;
+ takeCharges = true;
break;
}
case SPELL_AURA_RAID_PROC_FROM_CHARGE:
@@ -12856,7 +12852,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
(isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId());
HandleAuraRaidProcFromCharge(triggeredByAura);
- takeCharges=true;
+ takeCharges = true;
break;
}
case SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE:
@@ -12864,18 +12860,18 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
sLog.outDebug("ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
if (HandleProcTriggerSpell(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
- takeCharges=true;
+ takeCharges = true;
break;
}
case SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK:
// Skip melee hits or instant cast spells
if (procSpell && GetSpellCastTime(procSpell) != 0)
- takeCharges=true;
+ takeCharges = true;
break;
case SPELL_AURA_REFLECT_SPELLS_SCHOOL:
// Skip Melee hits and spells ws wrong school
if (procSpell && (triggeredByAura->GetMiscValue() & procSpell->SchoolMask)) // School check
- takeCharges=true;
+ takeCharges = true;
break;
case SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT:
case SPELL_AURA_MOD_POWER_COST_SCHOOL:
@@ -12883,27 +12879,27 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
if (procSpell &&
(procSpell->manaCost != 0 || procSpell->ManaCostPercentage != 0) && // Cost check
(triggeredByAura->GetMiscValue() & procSpell->SchoolMask) == 0) // School check
- takeCharges=true;
+ takeCharges = true;
break;
case SPELL_AURA_MECHANIC_IMMUNITY:
// Compare mechanic
if (procSpell && procSpell->Mechanic == triggeredByAura->GetMiscValue())
- takeCharges=true;
+ takeCharges = true;
break;
case SPELL_AURA_MOD_MECHANIC_RESISTANCE:
// Compare mechanic
if (procSpell && procSpell->Mechanic == triggeredByAura->GetMiscValue())
- takeCharges=true;
+ takeCharges = true;
break;
case SPELL_AURA_MOD_DAMAGE_FROM_CASTER:
// Compare casters
if (triggeredByAura->GetCasterGUID() == pTarget->GetGUID())
- takeCharges=true;
+ takeCharges = true;
break;
case SPELL_AURA_MOD_SPELL_CRIT_CHANCE:
sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s spell crit chance aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
if (procSpell && HandleSpellCritChanceAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
- takeCharges=true;
+ takeCharges = true;
break;
// CC Auras which use their amount amount to drop
// Are there any more auras which need this?
@@ -12932,15 +12928,14 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
//break;
default:
// nothing do, just charges counter
- takeCharges=true;
+ takeCharges = true;
break;
}
}
// Remove charge (aura can be removed by triggers)
if(useCharges && takeCharges)
- {
i->aura->DropAuraCharge();
- }
+
if (spellInfo->AttributesEx3 & SPELL_ATTR_EX3_DISABLE_PROC)
SetCantProc(false);
}
@@ -12957,12 +12952,12 @@ SpellSchoolMask Unit::GetMeleeDamageSchoolMask() const
Player* Unit::GetSpellModOwner() const
{
- if(GetTypeId()==TYPEID_PLAYER)
+ if(GetTypeId() == TYPEID_PLAYER)
return (Player*)this;
if(((Creature*)this)->isPet() || ((Creature*)this)->isTotem())
{
Unit* owner = GetOwner();
- if(owner && owner->GetTypeId()==TYPEID_PLAYER)
+ if(owner && owner->GetTypeId() == TYPEID_PLAYER)
return (Player*)owner;
}
return NULL;
@@ -13072,7 +13067,7 @@ void Unit::SetStandState(uint8 state)
if (IsStandState())
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_SEATED);
- if(GetTypeId()==TYPEID_PLAYER)
+ if(GetTypeId() == TYPEID_PLAYER)
{
WorldPacket data(SMSG_STANDSTATE_UPDATE, 1);
data << (uint8)state;
@@ -13119,7 +13114,7 @@ void Unit::ClearAllReactives()
for (uint8 i=0; i < MAX_REACTIVE; ++i)
m_reactiveTimer[i] = 0;
- if (HasAuraState( AURA_STATE_DEFENSE))
+ if (HasAuraState(AURA_STATE_DEFENSE))
ModifyAuraState(AURA_STATE_DEFENSE, false);
if (getClass() == CLASS_HUNTER && HasAuraState( AURA_STATE_HUNTER_PARRY))
ModifyAuraState(AURA_STATE_HUNTER_PARRY, false);
@@ -13444,7 +13439,7 @@ void Unit::RemovePetAura(PetAura const* petSpell)
Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id)
{
- if(GetTypeId()!=TYPEID_PLAYER)
+ if(GetTypeId() != TYPEID_PLAYER)
return NULL;
Pet* pet = new Pet((Player*)this, HUNTER_PET);
@@ -13459,7 +13454,7 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id)
pet->setFaction(getFaction());
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
- if(GetTypeId()==TYPEID_PLAYER)
+ if(GetTypeId() == TYPEID_PLAYER)
pet->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
uint32 level = (creatureTarget->getLevel() < (getLevel() - 5)) ? (getLevel() - 5) : creatureTarget->getLevel();
@@ -13738,7 +13733,7 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
// if talent known but not triggered (check priest class for speedup check)
bool SpiritOfRedemption = false;
- if(pVictim->GetTypeId()==TYPEID_PLAYER && pVictim->getClass()==CLASS_PRIEST)
+ if(pVictim->GetTypeId() == TYPEID_PLAYER && pVictim->getClass()==CLASS_PRIEST)
{
AuraEffectList const& vDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
for (AuraEffectList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); ++itr)
@@ -14639,7 +14634,7 @@ float Unit::MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType,
// bonus from skills is 0.04%
//miss_chance -= skillDiff * 0.04f;
int32 diff = -skillDiff;
- if(pVictim->GetTypeId()==TYPEID_PLAYER)
+ if(pVictim->GetTypeId() == TYPEID_PLAYER)
miss_chance += diff > 0 ? diff * 0.04 : diff * 0.02;
else
miss_chance += diff > 10 ? 2 + (diff - 10) * 0.4 : diff * 0.1;
diff --git a/src/game/Unit.h b/src/game/Unit.h
index d6f22930c61..6e6e4de94d6 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1645,8 +1645,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
// Threat related methods
bool CanHaveThreatList() const;
- void AddThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
- float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
+ void AddThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
+ float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
void DeleteThreatList();
void TauntApply(Unit* pVictim);
void TauntFadeOut(Unit *taunter);
diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp
index 83144d2644f..ad15c5f3932 100644
--- a/src/game/WorldSession.cpp
+++ b/src/game/WorldSession.cpp
@@ -326,11 +326,11 @@ void WorldSession::LogoutPlayer(bool Save)
Unit* owner = (*itr)->GetOwner(); // including player controlled case
if(owner)
{
- if(owner->GetTypeId()==TYPEID_PLAYER)
+ if(owner->GetTypeId() == TYPEID_PLAYER)
aset.insert((Player*)owner);
}
else
- if((*itr)->GetTypeId()==TYPEID_PLAYER)
+ if((*itr)->GetTypeId() == TYPEID_PLAYER)
aset.insert((Player*)(*itr));
}