[Build] Most errors fixed

This commit is contained in:
Antz 2015-02-07 22:46:39 +00:00 committed by Antz
parent 868302dd0b
commit 778052084e
70 changed files with 619 additions and 602 deletions

View file

@ -761,7 +761,7 @@ void BattleGround::EndBattleGround(Team winner)
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT); plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
if (!plr->isAlive()) if (!plr->IsAlive())
{ {
plr->ResurrectPlayer(1.0f); plr->ResurrectPlayer(1.0f);
plr->SpawnCorpseBones(); plr->SpawnCorpseBones();
@ -1026,7 +1026,7 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
plr->RemoveAurasDueToSpell(isArena() ? SPELL_ARENA_DAMPENING : SPELL_BATTLEGROUND_DAMPENING); plr->RemoveAurasDueToSpell(isArena() ? SPELL_ARENA_DAMPENING : SPELL_BATTLEGROUND_DAMPENING);
if (!plr->isAlive()) // resurrect on exit if (!plr->IsAlive()) // resurrect on exit
{ {
plr->ResurrectPlayer(1.0f); plr->ResurrectPlayer(1.0f);
plr->SpawnCorpseBones(); plr->SpawnCorpseBones();
@ -1715,7 +1715,7 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(Team team) const
if (itr->second.PlayerTeam == team) if (itr->second.PlayerTeam == team)
{ {
Player* pl = sObjectMgr.GetPlayer(itr->first); Player* pl = sObjectMgr.GetPlayer(itr->first);
if (pl && pl->isAlive()) if (pl && pl->IsAlive())
++count; ++count;
} }
} }

View file

@ -281,7 +281,7 @@ void BattleGroundEY::HandleAreaTrigger(Player* source, uint32 trigger)
if (GetStatus() != STATUS_IN_PROGRESS) if (GetStatus() != STATUS_IN_PROGRESS)
return; return;
if (!source->isAlive()) // hack code, must be removed later if (!source->IsAlive()) // hack code, must be removed later
return; return;
switch (trigger) switch (trigger)

View file

@ -428,7 +428,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
_player->SetBattleGroundEntryPoint(); _player->SetBattleGroundEntryPoint();
// resurrect the player // resurrect the player
if (!_player->isAlive()) if (!_player->IsAlive())
{ {
_player->ResurrectPlayer(1.0f); _player->ResurrectPlayer(1.0f);
_player->SpawnCorpseBones(); _player->SpawnCorpseBones();
@ -491,7 +491,7 @@ void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data)
DEBUG_LOG("WORLD: Received opcode CMSG_LEAVE_BATTLEFIELD"); DEBUG_LOG("WORLD: Received opcode CMSG_LEAVE_BATTLEFIELD");
// not allow leave battleground in combat // not allow leave battleground in combat
if (_player->isInCombat()) if (_player->IsInCombat())
if (BattleGround* bg = _player->GetBattleGround()) if (BattleGround* bg = _player->GetBattleGround())
if (bg->GetStatus() != STATUS_WAIT_LEAVE) if (bg->GetStatus() != STATUS_WAIT_LEAVE)
return; return;

View file

@ -81,7 +81,7 @@ bool ChatHandler::HandleStartCommand(char* /*args*/)
return false; return false;
} }
if (chr->isInCombat()) if (chr->IsInCombat())
{ {
SendSysMessage(LANG_YOU_IN_COMBAT); SendSysMessage(LANG_YOU_IN_COMBAT);
SetSentErrorMessage(true); SetSentErrorMessage(true);

View file

@ -1698,7 +1698,7 @@ bool ChatHandler::HandleNpcDelVendorCurrencyCommand(char* args)
return false; return false;
Creature* vendor = getSelectedCreature(); Creature* vendor = getSelectedCreature();
if (!vendor || !vendor->isVendor()) if (!vendor || !vendor->IsVendor())
{ {
SendSysMessage(LANG_COMMAND_VENDORSELECTION); SendSysMessage(LANG_COMMAND_VENDORSELECTION);
SetSentErrorMessage(true); SetSentErrorMessage(true);
@ -1733,7 +1733,7 @@ bool ChatHandler::HandleNpcDelVendorItemCommand(char* args)
return false; return false;
Creature* vendor = getSelectedCreature(); Creature* vendor = getSelectedCreature();
if (!vendor || !vendor->isVendor()) if (!vendor || !vendor->IsVendor())
{ {
SendSysMessage(LANG_COMMAND_VENDORSELECTION); SendSysMessage(LANG_COMMAND_VENDORSELECTION);
SetSentErrorMessage(true); SetSentErrorMessage(true);
@ -1828,7 +1828,7 @@ bool ChatHandler::HandleNpcAddMoveCommand(char* args)
{ {
pCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); pCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
pCreature->GetMotionMaster()->Initialize(); pCreature->GetMotionMaster()->Initialize();
if (pCreature->isAlive()) // dead creature will reset movement generator at respawn if (pCreature->IsAlive()) // dead creature will reset movement generator at respawn
{ {
pCreature->SetDeathState(JUST_DIED); pCreature->SetDeathState(JUST_DIED);
pCreature->Respawn(); pCreature->Respawn();
@ -2014,7 +2014,7 @@ bool ChatHandler::HandleNpcMoveCommand(char* args)
} }
pCreature->GetMap()->CreatureRelocation(pCreature, x, y, z, o); pCreature->GetMap()->CreatureRelocation(pCreature, x, y, z, o);
pCreature->GetMotionMaster()->Initialize(); pCreature->GetMotionMaster()->Initialize();
if (pCreature->isAlive()) // dead creature will reset movement generator at respawn if (pCreature->IsAlive()) // dead creature will reset movement generator at respawn
{ {
pCreature->SetDeathState(JUST_DIED); pCreature->SetDeathState(JUST_DIED);
pCreature->Respawn(); pCreature->Respawn();
@ -2108,7 +2108,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args)
{ {
pCreature->SetDefaultMovementType(move_type); pCreature->SetDefaultMovementType(move_type);
pCreature->GetMotionMaster()->Initialize(); pCreature->GetMotionMaster()->Initialize();
if (pCreature->isAlive()) // dead creature will reset movement generator at respawn if (pCreature->IsAlive()) // dead creature will reset movement generator at respawn
{ {
pCreature->SetDeathState(JUST_DIED); pCreature->SetDeathState(JUST_DIED);
pCreature->Respawn(); pCreature->Respawn();
@ -2217,7 +2217,7 @@ bool ChatHandler::HandleNpcSpawnDistCommand(char* args)
pCreature->SetRespawnRadius((float)option); pCreature->SetRespawnRadius((float)option);
pCreature->SetDefaultMovementType(mtype); pCreature->SetDefaultMovementType(mtype);
pCreature->GetMotionMaster()->Initialize(); pCreature->GetMotionMaster()->Initialize();
if (pCreature->isAlive()) // dead creature will reset movement generator at respawn if (pCreature->IsAlive()) // dead creature will reset movement generator at respawn
{ {
pCreature->SetDeathState(JUST_DIED); pCreature->SetDeathState(JUST_DIED);
pCreature->Respawn(); pCreature->Respawn();
@ -3077,7 +3077,7 @@ bool ChatHandler::HandleWpAddCommand(char* args)
{ {
target->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); target->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
target->GetMotionMaster()->Initialize(); target->GetMotionMaster()->Initialize();
if (target->isAlive()) // dead creature will reset movement generator at respawn if (target->IsAlive()) // dead creature will reset movement generator at respawn
{ {
target->SetDeathState(JUST_DIED); target->SetDeathState(JUST_DIED);
target->Respawn(); target->Respawn();
@ -3297,7 +3297,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
if (npcCreature) if (npcCreature)
{ {
npcCreature->GetMotionMaster()->Initialize(); npcCreature->GetMotionMaster()->Initialize();
if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn if (npcCreature->IsAlive()) // dead creature will reset movement generator at respawn
{ {
npcCreature->SetDeathState(JUST_DIED); npcCreature->SetDeathState(JUST_DIED);
npcCreature->Respawn(); npcCreature->Respawn();
@ -3377,7 +3377,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
delete result2; delete result2;
} }
npcCreature->GetMotionMaster()->Initialize(); npcCreature->GetMotionMaster()->Initialize();
if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn if (npcCreature->IsAlive()) // dead creature will reset movement generator at respawn
{ {
npcCreature->SetDeathState(JUST_DIED); npcCreature->SetDeathState(JUST_DIED);
npcCreature->Respawn(); npcCreature->Respawn();
@ -3441,7 +3441,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
if (npcCreature) if (npcCreature)
{ {
npcCreature->GetMotionMaster()->Initialize(); npcCreature->GetMotionMaster()->Initialize();
if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn if (npcCreature->IsAlive()) // dead creature will reset movement generator at respawn
{ {
npcCreature->SetDeathState(JUST_DIED); npcCreature->SetDeathState(JUST_DIED);
npcCreature->Respawn(); npcCreature->Respawn();
@ -3475,7 +3475,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
{ {
npcCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); npcCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
npcCreature->GetMotionMaster()->Initialize(); npcCreature->GetMotionMaster()->Initialize();
if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn if (npcCreature->IsAlive()) // dead creature will reset movement generator at respawn
{ {
npcCreature->SetDeathState(JUST_DIED); npcCreature->SetDeathState(JUST_DIED);
npcCreature->Respawn(); npcCreature->Respawn();

View file

@ -3963,7 +3963,7 @@ bool ChatHandler::HandleDieCommand(char* /*args*/)
return false; return false;
} }
if (target->isAlive()) if (target->IsAlive())
{ {
m_session->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_session->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
} }
@ -3985,7 +3985,7 @@ bool ChatHandler::HandleDamageCommand(char* args)
return false; return false;
} }
if (!target->isAlive()) if (!target->IsAlive())
return true; return true;
int32 damage_int; int32 damage_int;
@ -6066,7 +6066,7 @@ bool ChatHandler::HandleRespawnCommand(char* /*args*/)
return false; return false;
} }
if (target->isDead()) if (target->IsDead())
((Creature*)target)->Respawn(); ((Creature*)target)->Respawn();
return true; return true;
} }

View file

@ -38,7 +38,7 @@ void ConfusedMovementGenerator<T>::Initialize(T& unit)
// set initial position // set initial position
unit.GetPosition(i_x, i_y, i_z); unit.GetPosition(i_x, i_y, i_z);
if (!unit.isAlive() || unit.hasUnitState(UNIT_STAT_NOT_MOVE)) if (!unit.IsAlive() || unit.hasUnitState(UNIT_STAT_NOT_MOVE))
return; return;
unit.StopMoving(); unit.StopMoving();
@ -58,7 +58,7 @@ void ConfusedMovementGenerator<T>::Reset(T& unit)
{ {
i_nextMoveTime.Reset(0); i_nextMoveTime.Reset(0);
if (!unit.isAlive() || unit.hasUnitState(UNIT_STAT_NOT_MOVE)) if (!unit.IsAlive() || unit.hasUnitState(UNIT_STAT_NOT_MOVE))
return; return;
unit.StopMoving(); unit.StopMoving();

View file

@ -161,7 +161,7 @@ void FleeingMovementGenerator<T>::Reset(T& owner)
template<class T> template<class T>
bool FleeingMovementGenerator<T>::Update(T& owner, const uint32& time_diff) bool FleeingMovementGenerator<T>::Update(T& owner, const uint32& time_diff)
{ {
if (!&owner || !owner.isAlive()) if (!&owner || !owner.IsAlive())
return false; return false;
// ignore in case other no reaction state // ignore in case other no reaction state
@ -196,7 +196,7 @@ void TimedFleeingMovementGenerator::Finalize(Unit& owner)
owner.clearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); owner.clearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE);
if (Unit* victim = owner.getVictim()) if (Unit* victim = owner.getVictim())
{ {
if (owner.isAlive()) if (owner.IsAlive())
{ {
owner.AttackStop(true); owner.AttackStop(true);
((Creature*)&owner)->AI()->AttackStart(victim); ((Creature*)&owner)->AI()->AttackStart(victim);
@ -206,7 +206,7 @@ void TimedFleeingMovementGenerator::Finalize(Unit& owner)
bool TimedFleeingMovementGenerator::Update(Unit& owner, const uint32& time_diff) bool TimedFleeingMovementGenerator::Update(Unit& owner, const uint32& time_diff)
{ {
if (!owner.isAlive()) if (!owner.IsAlive())
return false; return false;
// ignore in case other no reaction state // ignore in case other no reaction state

View file

@ -72,7 +72,7 @@ AssistanceDistractMovementGenerator::Finalize(Unit& unit)
unit.clearUnitState(UNIT_STAT_DISTRACTED); unit.clearUnitState(UNIT_STAT_DISTRACTED);
if (Unit* victim = unit.getVictim()) if (Unit* victim = unit.getVictim())
{ {
if (unit.isAlive()) if (unit.IsAlive())
{ {
unit.AttackStop(true); unit.AttackStop(true);
((Creature*)&unit)->AI()->AttackStart(victim); ((Creature*)&unit)->AI()->AttackStart(victim);

View file

@ -1,4 +1,4 @@
/* /**
* MaNGOS is a full featured server for World of Warcraft, supporting * MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8 * the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
* *
@ -22,14 +22,14 @@
* and lore are copyrighted by Blizzard Entertainment, Inc. * and lore are copyrighted by Blizzard Entertainment, Inc.
*/ */
#include "../recastnavigation/Detour/Include/DetourCommon.h"
#include "MoveMap.h" #include "MoveMap.h"
#include "GridMap.h" #include "GridMap.h"
#include "Creature.h" #include "Creature.h"
#include "PathFinder.h" #include "PathFinder.h"
#include "Log.h" #include "Log.h"
#include "../recastnavigation/Detour/Include/DetourCommon.h"
////////////////// PathFinder ////////////////// ////////////////// PathFinder //////////////////
PathFinder::PathFinder(const Unit* owner) : PathFinder::PathFinder(const Unit* owner) :
m_polyLength(0), m_type(PATHFIND_BLANK), m_polyLength(0), m_type(PATHFIND_BLANK),
@ -56,7 +56,7 @@ PathFinder::~PathFinder()
bool PathFinder::calculate(float destX, float destY, float destZ, bool forceDest) bool PathFinder::calculate(float destX, float destY, float destZ, bool forceDest)
{ {
Vector3 oldDest = getEndPosition(); // Vector3 oldDest = getEndPosition();
Vector3 dest(destX, destY, destZ); Vector3 dest(destX, destY, destZ);
setEndPosition(dest); setEndPosition(dest);
@ -72,7 +72,7 @@ bool PathFinder::calculate(float destX, float destY, float destZ, bool forceDest
// make sure navMesh works - we can run on map w/o mmap // make sure navMesh works - we can run on map w/o mmap
// check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?) // check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?)
if (!m_navMesh || !m_navMeshQuery || m_sourceUnit->hasUnitState(UNIT_STAT_IGNORE_PATHFINDING) || if (!m_navMesh || !m_navMeshQuery || m_sourceUnit->hasUnitState(UNIT_STAT_IGNORE_PATHFINDING) ||
!HaveTile(start) || !HaveTile(dest)) !HaveTile(start) || !HaveTile(dest))
{ {
BuildShortcut(); BuildShortcut();
m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
@ -88,7 +88,7 @@ bool PathFinder::calculate(float destX, float destY, float destZ, bool forceDest
dtPolyRef PathFinder::getPathPolyByPosition(const dtPolyRef* polyPath, uint32 polyPathSize, const float* point, float* distance) const dtPolyRef PathFinder::getPathPolyByPosition(const dtPolyRef* polyPath, uint32 polyPathSize, const float* point, float* distance) const
{ {
if (!polyPath || !polyPathSize) if (!polyPath || !polyPathSize)
return INVALID_POLYREF; { return INVALID_POLYREF; }
dtPolyRef nearestPoly = INVALID_POLYREF; dtPolyRef nearestPoly = INVALID_POLYREF;
float minDist2d = FLT_MAX; float minDist2d = FLT_MAX;
@ -97,7 +97,8 @@ dtPolyRef PathFinder::getPathPolyByPosition(const dtPolyRef* polyPath, uint32 po
for (uint32 i = 0; i < polyPathSize; ++i) for (uint32 i = 0; i < polyPathSize; ++i)
{ {
float closestPoint[VERTEX_SIZE]; float closestPoint[VERTEX_SIZE];
if (DT_SUCCESS != m_navMeshQuery->closestPointOnPoly(polyPath[i], point, closestPoint)) dtStatus dtResult = m_navMeshQuery->closestPointOnPoly(polyPath[i], point, closestPoint, NULL);
if (dtStatusFailed(dtResult))
continue; continue;
float d = dtVdist2DSqr(point, closestPoint); float d = dtVdist2DSqr(point, closestPoint);
@ -109,11 +110,11 @@ dtPolyRef PathFinder::getPathPolyByPosition(const dtPolyRef* polyPath, uint32 po
} }
if (minDist2d < 1.0f) // shortcut out - close enough for us if (minDist2d < 1.0f) // shortcut out - close enough for us
break; { break; }
} }
if (distance) if (distance)
*distance = dtSqrt(minDist3d); { *distance = dtSqrt(minDist3d); }
return (minDist2d < 3.0f) ? nearestPoly : INVALID_POLYREF; return (minDist2d < 3.0f) ? nearestPoly : INVALID_POLYREF;
} }
@ -125,15 +126,15 @@ dtPolyRef PathFinder::getPolyByLocation(const float* point, float* distance) con
// we need to use the expensive navMesh.findNearestPoly // we need to use the expensive navMesh.findNearestPoly
dtPolyRef polyRef = getPathPolyByPosition(m_pathPolyRefs, m_polyLength, point, distance); dtPolyRef polyRef = getPathPolyByPosition(m_pathPolyRefs, m_polyLength, point, distance);
if (polyRef != INVALID_POLYREF) if (polyRef != INVALID_POLYREF)
return polyRef; { return polyRef; }
// we don't have it in our old path // we don't have it in our old path
// try to get it by findNearestPoly() // try to get it by findNearestPoly()
// first try with low search box // first try with low search box
float extents[VERTEX_SIZE] = {3.0f, 5.0f, 3.0f}; // bounds of poly search area float extents[VERTEX_SIZE] = {3.0f, 5.0f, 3.0f}; // bounds of poly search area
float closestPoint[VERTEX_SIZE] = {0.0f, 0.0f, 0.0f}; float closestPoint[VERTEX_SIZE] = {0.0f, 0.0f, 0.0f};
dtStatus result = m_navMeshQuery->findNearestPoly(point, extents, &m_filter, &polyRef, closestPoint); dtStatus dtResult = m_navMeshQuery->findNearestPoly(point, extents, &m_filter, &polyRef, closestPoint);
if (DT_SUCCESS == result && polyRef != INVALID_POLYREF) if (dtStatusSucceed(dtResult) && polyRef != INVALID_POLYREF)
{ {
*distance = dtVdist(closestPoint, point); *distance = dtVdist(closestPoint, point);
return polyRef; return polyRef;
@ -142,8 +143,8 @@ dtPolyRef PathFinder::getPolyByLocation(const float* point, float* distance) con
// still nothing .. // still nothing ..
// try with bigger search box // try with bigger search box
extents[1] = 200.0f; extents[1] = 200.0f;
result = m_navMeshQuery->findNearestPoly(point, extents, &m_filter, &polyRef, closestPoint); dtResult = m_navMeshQuery->findNearestPoly(point, extents, &m_filter, &polyRef, closestPoint);
if (DT_SUCCESS == result && polyRef != INVALID_POLYREF) if (dtStatusSucceed(dtResult) && polyRef != INVALID_POLYREF)
{ {
*distance = dtVdist(closestPoint, point); *distance = dtVdist(closestPoint, point);
return polyRef; return polyRef;
@ -163,6 +164,8 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
dtPolyRef startPoly = getPolyByLocation(startPoint, &distToStartPoly); dtPolyRef startPoly = getPolyByLocation(startPoint, &distToStartPoly);
dtPolyRef endPoly = getPolyByLocation(endPoint, &distToEndPoly); dtPolyRef endPoly = getPolyByLocation(endPoint, &distToEndPoly);
dtStatus dtResult;
// we have a hole in our mesh // we have a hole in our mesh
// make shortcut path and mark it as NOPATH ( with flying exception ) // make shortcut path and mark it as NOPATH ( with flying exception )
// its up to caller how he will use this info // its up to caller how he will use this info
@ -175,13 +178,13 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
{ {
// Check for swimming or flying shortcut // Check for swimming or flying shortcut
if ((startPoly == INVALID_POLYREF && m_sourceUnit->GetTerrain()->IsUnderWater(startPos.x, startPos.y, startPos.z)) || if ((startPoly == INVALID_POLYREF && m_sourceUnit->GetTerrain()->IsUnderWater(startPos.x, startPos.y, startPos.z)) ||
(endPoly == INVALID_POLYREF && m_sourceUnit->GetTerrain()->IsUnderWater(endPos.x, endPos.y, endPos.z))) (endPoly == INVALID_POLYREF && m_sourceUnit->GetTerrain()->IsUnderWater(endPos.x, endPos.y, endPos.z)))
m_type = ((Creature*)m_sourceUnit)->CanSwim() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH; { m_type = ((Creature*)m_sourceUnit)->CanSwim() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH; }
else else
m_type = ((Creature*)m_sourceUnit)->CanFly() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH; { m_type = ((Creature*)m_sourceUnit)->CanFly() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH; }
} }
else else
m_type = PATHFIND_NOPATH; { m_type = PATHFIND_NOPATH; }
return; return;
} }
@ -202,13 +205,13 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
{ {
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ BuildPolyPath :: underWater case\n"); DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ BuildPolyPath :: underWater case\n");
if (owner->CanSwim()) if (owner->CanSwim())
buildShotrcut = true; { buildShotrcut = true; }
} }
else else
{ {
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ BuildPolyPath :: flying case\n"); DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ BuildPolyPath :: flying case\n");
if (owner->CanFly()) if (owner->CanFly())
buildShotrcut = true; { buildShotrcut = true; }
} }
} }
@ -222,7 +225,8 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
{ {
float closestPoint[VERTEX_SIZE]; float closestPoint[VERTEX_SIZE];
// we may want to use closestPointOnPolyBoundary instead // we may want to use closestPointOnPolyBoundary instead
if (DT_SUCCESS == m_navMeshQuery->closestPointOnPoly(endPoly, endPoint, closestPoint)) dtResult = m_navMeshQuery->closestPointOnPoly(endPoly, endPoint, closestPoint, NULL);
if (dtStatusSucceed(dtResult))
{ {
dtVcopy(endPoint, closestPoint); dtVcopy(endPoint, closestPoint);
setActualEndPosition(Vector3(endPoint[2], endPoint[0], endPoint[1])); setActualEndPosition(Vector3(endPoint[2], endPoint[0], endPoint[1]));
@ -299,7 +303,7 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
m_polyLength -= pathStartIndex; m_polyLength -= pathStartIndex;
// try to adjust the suffix of the path instead of recalculating entire length // try to adjust the suffix of the path instead of recalculating entire length
// at given interval the target cannot get too far from its last location // at given interval the target can not get too far from its last location
// thus we have less poly to cover // thus we have less poly to cover
// sub-path of optimal path is optimal // sub-path of optimal path is optimal
@ -312,13 +316,15 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
// we need any point on our suffix start poly to generate poly-path, so we need last poly in prefix data // we need any point on our suffix start poly to generate poly-path, so we need last poly in prefix data
float suffixEndPoint[VERTEX_SIZE]; float suffixEndPoint[VERTEX_SIZE];
if (DT_SUCCESS != m_navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint)) dtResult = m_navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint, NULL);
if (dtStatusFailed(dtResult))
{ {
// we can hit offmesh connection as last poly - closestPointOnPoly() don't like that // we can hit offmesh connection as last poly - closestPointOnPoly() don't like that
// try to recover by using prev polyref // try to recover by using prev polyref
--prefixPolyLength; --prefixPolyLength;
suffixStartPoly = m_pathPolyRefs[prefixPolyLength - 1]; suffixStartPoly = m_pathPolyRefs[prefixPolyLength - 1];
if (DT_SUCCESS != m_navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint)) dtResult = m_navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint, NULL);
if (dtStatusFailed(dtResult))
{ {
// suffixStartPoly is still invalid, error state // suffixStartPoly is still invalid, error state
BuildShortcut(); BuildShortcut();
@ -329,17 +335,17 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
// generate suffix // generate suffix
uint32 suffixPolyLength = 0; uint32 suffixPolyLength = 0;
dtStatus dtResult = m_navMeshQuery->findPath( dtResult = m_navMeshQuery->findPath(
suffixStartPoly, // start polygon suffixStartPoly, // start polygon
endPoly, // end polygon endPoly, // end polygon
suffixEndPoint, // start position suffixEndPoint, // start position
endPoint, // end position endPoint, // end position
&m_filter, // polygon search filter &m_filter, // polygon search filter
m_pathPolyRefs + prefixPolyLength - 1, // [out] path m_pathPolyRefs + prefixPolyLength - 1, // [out] path
(int*)&suffixPolyLength, (int*)&suffixPolyLength,
MAX_PATH_LENGTH - prefixPolyLength); // max number of polygons in output path MAX_PATH_LENGTH - prefixPolyLength); // max number of polygons in output path
if (!suffixPolyLength || dtResult != DT_SUCCESS) if (!suffixPolyLength || dtStatusFailed(dtResult))
{ {
// this is probably an error state, but we'll leave it // this is probably an error state, but we'll leave it
// and hopefully recover on the next Update // and hopefully recover on the next Update
@ -363,17 +369,17 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
// free and invalidate old path data // free and invalidate old path data
clear(); clear();
dtStatus dtResult = m_navMeshQuery->findPath( dtResult = m_navMeshQuery->findPath(
startPoly, // start polygon startPoly, // start polygon
endPoly, // end polygon endPoly, // end polygon
startPoint, // start position startPoint, // start position
endPoint, // end position endPoint, // end position
&m_filter, // polygon search filter &m_filter, // polygon search filter
m_pathPolyRefs, // [out] path m_pathPolyRefs, // [out] path
(int*)&m_polyLength, (int*)&m_polyLength,
MAX_PATH_LENGTH); // max number of polygons in output path MAX_PATH_LENGTH); // max number of polygons in output path
if (!m_polyLength || dtResult != DT_SUCCESS) if (!m_polyLength || dtStatusFailed(dtResult))
{ {
// only happens if we passed bad data to findPath(), or navmesh is messed up // only happens if we passed bad data to findPath(), or navmesh is messed up
sLog.outError("%u's Path Build failed: 0 length path", m_sourceUnit->GetGUIDLow()); sLog.outError("%u's Path Build failed: 0 length path", m_sourceUnit->GetGUIDLow());
@ -385,9 +391,9 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
// by now we know what type of path we can get // by now we know what type of path we can get
if (m_pathPolyRefs[m_polyLength - 1] == endPoly && !(m_type & PATHFIND_INCOMPLETE)) if (m_pathPolyRefs[m_polyLength - 1] == endPoly && !(m_type & PATHFIND_INCOMPLETE))
m_type = PATHFIND_NORMAL; { m_type = PATHFIND_NORMAL; }
else else
m_type = PATHFIND_INCOMPLETE; { m_type = PATHFIND_INCOMPLETE; }
// generate the point-path out of our up-to-date poly-path // generate the point-path out of our up-to-date poly-path
BuildPointPath(startPoint, endPoint); BuildPointPath(startPoint, endPoint);
@ -423,7 +429,7 @@ void PathFinder::BuildPointPath(const float* startPoint, const float* endPoint)
m_pointPathLimit); // maximum number of points m_pointPathLimit); // maximum number of points
} }
if (pointCount < 2 || dtResult != DT_SUCCESS) if (pointCount < 2 || dtStatusFailed(dtResult))
{ {
// only happens if pass bad data to findStraightPath or navmesh is broken // only happens if pass bad data to findStraightPath or navmesh is broken
// single point paths can be generated here // single point paths can be generated here
@ -436,18 +442,18 @@ void PathFinder::BuildPointPath(const float* startPoint, const float* endPoint)
m_pathPoints.resize(pointCount); m_pathPoints.resize(pointCount);
for (uint32 i = 0; i < pointCount; ++i) for (uint32 i = 0; i < pointCount; ++i)
m_pathPoints[i] = Vector3(pathPoints[i * VERTEX_SIZE + 2], pathPoints[i * VERTEX_SIZE], pathPoints[i * VERTEX_SIZE + 1]); { m_pathPoints[i] = Vector3(pathPoints[i * VERTEX_SIZE + 2], pathPoints[i * VERTEX_SIZE], pathPoints[i * VERTEX_SIZE + 1]); }
// first point is always our current location - we need the next one // first point is always our current location - we need the next one
setActualEndPosition(m_pathPoints[pointCount - 1]); setActualEndPosition(m_pathPoints[pointCount - 1]);
// force the given destination, if needed // force the given destination, if needed
if (m_forceDestination && if (m_forceDestination &&
(!(m_type & PATHFIND_NORMAL) || !inRange(getEndPosition(), getActualEndPosition(), 1.0f, 1.0f))) (!(m_type & PATHFIND_NORMAL) || !inRange(getEndPosition(), getActualEndPosition(), 1.0f, 1.0f)))
{ {
// we may want to keep partial subpath // we may want to keep partial subpath
if (dist3DSqr(getActualEndPosition(), getEndPosition()) < if (dist3DSqr(getActualEndPosition(), getEndPosition()) <
0.3f * dist3DSqr(getStartPosition(), getEndPosition())) 0.3f * dist3DSqr(getStartPosition(), getEndPosition()))
{ {
setActualEndPosition(getEndPosition()); setActualEndPosition(getEndPosition());
m_pathPoints[m_pathPoints.size() - 1] = getEndPosition(); m_pathPoints[m_pathPoints.size() - 1] = getEndPosition();
@ -489,11 +495,11 @@ void PathFinder::createFilter()
{ {
Creature* creature = (Creature*)m_sourceUnit; Creature* creature = (Creature*)m_sourceUnit;
if (creature->CanWalk()) if (creature->CanWalk())
includeFlags |= NAV_GROUND; // walk { includeFlags |= NAV_GROUND; } // walk
// creatures don't take environmental damage // creatures don't take environmental damage
if (creature->CanSwim()) if (creature->CanSwim())
includeFlags |= (NAV_WATER | NAV_MAGMA | NAV_SLIME); // swim { includeFlags |= (NAV_WATER | NAV_MAGMA | NAV_SLIME); } // swim
} }
else if (m_sourceUnit->GetTypeId() == TYPEID_PLAYER) else if (m_sourceUnit->GetTypeId() == TYPEID_PLAYER)
{ {
@ -547,7 +553,7 @@ bool PathFinder::HaveTile(const Vector3& p) const
float point[VERTEX_SIZE] = {p.y, p.z, p.x}; float point[VERTEX_SIZE] = {p.y, p.z, p.x};
m_navMesh->calcTileLoc(point, &tx, &ty); m_navMesh->calcTileLoc(point, &tx, &ty);
return (m_navMesh->getTileAt(tx, ty) != NULL); return (m_navMesh->getTileAt(tx, ty, 0) != NULL);
} }
uint32 PathFinder::fixupCorridor(dtPolyRef* path, uint32 npath, uint32 maxPath, uint32 PathFinder::fixupCorridor(dtPolyRef* path, uint32 npath, uint32 maxPath,
@ -570,12 +576,12 @@ uint32 PathFinder::fixupCorridor(dtPolyRef* path, uint32 npath, uint32 maxPath,
} }
} }
if (found) if (found)
break; { break; }
} }
// If no intersection found just return current path. // If no intersection found just return current path.
if (furthestPath == -1 || furthestVisited == -1) if (furthestPath == -1 || furthestVisited == -1)
return npath; { return npath; }
// Concatenate paths. // Concatenate paths.
@ -584,14 +590,14 @@ uint32 PathFinder::fixupCorridor(dtPolyRef* path, uint32 npath, uint32 maxPath,
uint32 orig = uint32(furthestPath + 1) < npath ? furthestPath + 1 : npath; uint32 orig = uint32(furthestPath + 1) < npath ? furthestPath + 1 : npath;
uint32 size = npath > orig ? npath - orig : 0; uint32 size = npath > orig ? npath - orig : 0;
if (req + size > maxPath) if (req + size > maxPath)
size = maxPath - req; { size = maxPath - req; }
if (size) if (size)
memmove(path + req, path + orig, size * sizeof(dtPolyRef)); { memmove(path + req, path + orig, size * sizeof(dtPolyRef)); }
// Store visited // Store visited
for (uint32 i = 0; i < req; ++i) for (uint32 i = 0; i < req; ++i)
path[i] = visited[(nvisited - 1) - i]; { path[i] = visited[(nvisited - 1) - i]; }
return req + size; return req + size;
} }
@ -608,8 +614,8 @@ bool PathFinder::getSteerTarget(const float* startPos, const float* endPos,
uint32 nsteerPath = 0; uint32 nsteerPath = 0;
dtStatus dtResult = m_navMeshQuery->findStraightPath(startPos, endPos, path, pathSize, dtStatus dtResult = m_navMeshQuery->findStraightPath(startPos, endPos, path, pathSize,
steerPath, steerPathFlags, steerPathPolys, (int*)&nsteerPath, MAX_STEER_POINTS); steerPath, steerPathFlags, steerPathPolys, (int*)&nsteerPath, MAX_STEER_POINTS);
if (!nsteerPath || DT_SUCCESS != dtResult) if (!nsteerPath || dtStatusFailed(dtResult))
return false; { return false; }
// Find vertex far enough to steer to. // Find vertex far enough to steer to.
uint32 ns = 0; uint32 ns = 0;
@ -617,13 +623,13 @@ bool PathFinder::getSteerTarget(const float* startPos, const float* endPos,
{ {
// Stop at Off-Mesh link or when point is further than slop away. // Stop at Off-Mesh link or when point is further than slop away.
if ((steerPathFlags[ns] & DT_STRAIGHTPATH_OFFMESH_CONNECTION) || if ((steerPathFlags[ns] & DT_STRAIGHTPATH_OFFMESH_CONNECTION) ||
!inRangeYZX(&steerPath[ns * VERTEX_SIZE], startPos, minTargetDist, 1000.0f)) !inRangeYZX(&steerPath[ns * VERTEX_SIZE], startPos, minTargetDist, 1000.0f))
break; { break; }
++ns; ++ns;
} }
// Failed to find good point to steer to. // Failed to find good point to steer to.
if (ns >= nsteerPath) if (ns >= nsteerPath)
return false; { return false; }
dtVcopy(steerPos, &steerPath[ns * VERTEX_SIZE]); dtVcopy(steerPos, &steerPath[ns * VERTEX_SIZE]);
steerPos[1] = startPos[1]; // keep Z value steerPos[1] = startPos[1]; // keep Z value
@ -645,11 +651,13 @@ dtStatus PathFinder::findSmoothPath(const float* startPos, const float* endPos,
uint32 npolys = polyPathSize; uint32 npolys = polyPathSize;
float iterPos[VERTEX_SIZE], targetPos[VERTEX_SIZE]; float iterPos[VERTEX_SIZE], targetPos[VERTEX_SIZE];
if (DT_SUCCESS != m_navMeshQuery->closestPointOnPolyBoundary(polys[0], startPos, iterPos)) dtStatus dtResult = m_navMeshQuery->closestPointOnPolyBoundary(polys[0], startPos, iterPos);
return DT_FAILURE; if (dtStatusFailed(dtResult))
{ return DT_FAILURE; }
if (DT_SUCCESS != m_navMeshQuery->closestPointOnPolyBoundary(polys[npolys - 1], endPos, targetPos)) dtResult = m_navMeshQuery->closestPointOnPolyBoundary(polys[npolys - 1], endPos, targetPos);
return DT_FAILURE; if (dtStatusFailed(dtResult))
{ return DT_FAILURE; }
dtVcopy(&smoothPath[nsmoothPath * VERTEX_SIZE], iterPos); dtVcopy(&smoothPath[nsmoothPath * VERTEX_SIZE], iterPos);
++nsmoothPath; ++nsmoothPath;
@ -664,7 +672,7 @@ dtStatus PathFinder::findSmoothPath(const float* startPos, const float* endPos,
dtPolyRef steerPosRef = INVALID_POLYREF; dtPolyRef steerPosRef = INVALID_POLYREF;
if (!getSteerTarget(iterPos, targetPos, SMOOTH_PATH_SLOP, polys, npolys, steerPos, steerPosFlag, steerPosRef)) if (!getSteerTarget(iterPos, targetPos, SMOOTH_PATH_SLOP, polys, npolys, steerPos, steerPosFlag, steerPosRef))
break; { break; }
bool endOfPath = (steerPosFlag & DT_STRAIGHTPATH_END); bool endOfPath = (steerPosFlag & DT_STRAIGHTPATH_END);
bool offMeshConnection = (steerPosFlag & DT_STRAIGHTPATH_OFFMESH_CONNECTION); bool offMeshConnection = (steerPosFlag & DT_STRAIGHTPATH_OFFMESH_CONNECTION);
@ -675,9 +683,9 @@ dtStatus PathFinder::findSmoothPath(const float* startPos, const float* endPos,
float len = dtSqrt(dtVdot(delta, delta)); float len = dtSqrt(dtVdot(delta, delta));
// If the steer target is end of path or off-mesh link, do not move past the location. // If the steer target is end of path or off-mesh link, do not move past the location.
if ((endOfPath || offMeshConnection) && len < SMOOTH_PATH_STEP_SIZE) if ((endOfPath || offMeshConnection) && len < SMOOTH_PATH_STEP_SIZE)
len = 1.0f; { len = 1.0f; }
else else
len = SMOOTH_PATH_STEP_SIZE / len; { len = SMOOTH_PATH_STEP_SIZE / len; }
float moveTgt[VERTEX_SIZE]; float moveTgt[VERTEX_SIZE];
dtVmad(moveTgt, iterPos, delta, len); dtVmad(moveTgt, iterPos, delta, len);
@ -721,13 +729,14 @@ dtStatus PathFinder::findSmoothPath(const float* startPos, const float* endPos,
} }
for (uint32 i = npos; i < npolys; ++i) for (uint32 i = npos; i < npolys; ++i)
polys[i - npos] = polys[i]; { polys[i - npos] = polys[i]; }
npolys -= npos; npolys -= npos;
// Handle the connection. // Handle the connection.
float startPos[VERTEX_SIZE], endPos[VERTEX_SIZE]; float startPos[VERTEX_SIZE], endPos[VERTEX_SIZE];
if (DT_SUCCESS == m_navMesh->getOffMeshConnectionPolyEndPoints(prevRef, polyRef, startPos, endPos)) dtResult = m_navMesh->getOffMeshConnectionPolyEndPoints(prevRef, polyRef, startPos, endPos);
if (dtStatusSucceed(dtResult))
{ {
if (nsmoothPath < maxSmoothPathSize) if (nsmoothPath < maxSmoothPathSize)
{ {

View file

@ -25,10 +25,10 @@
#ifndef MANGOS_PATH_FINDER_H #ifndef MANGOS_PATH_FINDER_H
#define MANGOS_PATH_FINDER_H #define MANGOS_PATH_FINDER_H
#include "MoveMapSharedDefines.h" #include "DetourNavMesh.h"
#include "../recastnavigation/Detour/Include/DetourNavMesh.h" #include "DetourNavMeshQuery.h"
#include "../recastnavigation/Detour/Include/DetourNavMeshQuery.h"
#include "MoveMapSharedDefines.h"
#include "movement/MoveSplineInitArgs.h" #include "movement/MoveSplineInitArgs.h"
using Movement::Vector3; using Movement::Vector3;
@ -102,9 +102,9 @@ class PathFinder
dtQueryFilter m_filter; // use single filter for all movements, update it when needed dtQueryFilter m_filter; // use single filter for all movements, update it when needed
void setStartPosition(Vector3 point) { m_startPosition = point; } void setStartPosition(const Vector3 &point) { m_startPosition = point; }
void setEndPosition(Vector3 point) { m_actualEndPosition = point; m_endPosition = point; } void setEndPosition(const Vector3 &point) { m_actualEndPosition = point; m_endPosition = point; }
void setActualEndPosition(Vector3 point) { m_actualEndPosition = point; } void setActualEndPosition(const Vector3 &point) { m_actualEndPosition = point; }
void clear() void clear()
{ {

View file

@ -125,7 +125,7 @@ void AssistanceMovementGenerator::Finalize(Unit& unit)
((Creature*)&unit)->SetNoCallAssistance(false); ((Creature*)&unit)->SetNoCallAssistance(false);
((Creature*)&unit)->CallAssistance(); ((Creature*)&unit)->CallAssistance();
if (unit.isAlive()) if (unit.IsAlive())
unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY)); unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY));
} }
@ -142,7 +142,7 @@ void EffectMovementGenerator::Finalize(Unit& unit)
if (((Creature&)unit).AI() && unit.movespline->Finalized()) if (((Creature&)unit).AI() && unit.movespline->Finalized())
((Creature&)unit).AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id); ((Creature&)unit).AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id);
// Need restore previous movement since we have no proper states system // Need restore previous movement since we have no proper states system
if (unit.isAlive() && !unit.hasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_NO_COMBAT_MOVEMENT)) if (unit.IsAlive() && !unit.hasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_NO_COMBAT_MOVEMENT))
{ {
if (Unit* victim = unit.getVictim()) if (Unit* victim = unit.getVictim())
unit.GetMotionMaster()->MoveChase(victim); unit.GetMotionMaster()->MoveChase(victim);

View file

@ -73,7 +73,7 @@ void RandomMovementGenerator<Creature>::Initialize(Creature& creature)
{ {
creature.addUnitState(UNIT_STAT_ROAMING); // _MOVE set in _setRandomLocation creature.addUnitState(UNIT_STAT_ROAMING); // _MOVE set in _setRandomLocation
if (!creature.isAlive() || creature.hasUnitState(UNIT_STAT_NOT_MOVE)) if (!creature.IsAlive() || creature.hasUnitState(UNIT_STAT_NOT_MOVE))
return; return;
_setRandomLocation(creature); _setRandomLocation(creature);

View file

@ -103,7 +103,7 @@ bool TargetedMovementGeneratorMedium<T, D>::Update(T& owner, const uint32& time_
if (!i_target.isValid() || !i_target->IsInWorld()) if (!i_target.isValid() || !i_target->IsInWorld())
return false; return false;
if (!owner.isAlive()) if (!owner.IsAlive())
return true; return true;
if (owner.hasUnitState(UNIT_STAT_NOT_MOVE)) if (owner.hasUnitState(UNIT_STAT_NOT_MOVE))

View file

@ -179,7 +179,7 @@ void WaypointMovementGenerator<Creature>::StartMove(Creature& creature)
if (Stopped(creature)) if (Stopped(creature))
return; return;
if (!creature.isAlive() || creature.hasUnitState(UNIT_STAT_NOT_MOVE)) if (!creature.IsAlive() || creature.hasUnitState(UNIT_STAT_NOT_MOVE))
return; return;
WaypointPath::const_iterator currPoint = i_path->find(i_currentNode); WaypointPath::const_iterator currPoint = i_path->find(i_currentNode);

View file

@ -54,7 +54,7 @@ AggressorAI::MoveInLineOfSight(Unit* u)
if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE) if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE)
return; return;
if (m_creature->CanInitiateAttack() && u->isTargetableForAttack() && if (m_creature->CanInitiateAttack() && u->IsTargetableForAttack() &&
m_creature->IsHostileTo(u) && u->isInAccessablePlaceFor(m_creature)) m_creature->IsHostileTo(u) && u->isInAccessablePlaceFor(m_creature))
{ {
float attackRadius = m_creature->GetAttackDistance(u); float attackRadius = m_creature->GetAttackDistance(u);
@ -76,7 +76,7 @@ AggressorAI::MoveInLineOfSight(Unit* u)
void AggressorAI::EnterEvadeMode() void AggressorAI::EnterEvadeMode()
{ {
if (!m_creature->isAlive()) if (!m_creature->IsAlive())
{ {
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, he is dead [guid=%u]", m_creature->GetGUIDLow()); DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, he is dead [guid=%u]", m_creature->GetGUIDLow());
i_victimGuid.Clear(); i_victimGuid.Clear();
@ -91,7 +91,7 @@ void AggressorAI::EnterEvadeMode()
{ {
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, no victim [guid=%u]", m_creature->GetGUIDLow()); DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, no victim [guid=%u]", m_creature->GetGUIDLow());
} }
else if (!victim->isAlive()) else if (!victim->IsAlive())
{ {
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, victim is dead [guid=%u]", m_creature->GetGUIDLow()); DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, victim is dead [guid=%u]", m_creature->GetGUIDLow());
} }
@ -141,7 +141,7 @@ bool
AggressorAI::IsVisible(Unit* pl) const AggressorAI::IsVisible(Unit* pl) const
{ {
return m_creature->IsWithinDist(pl, sWorld.getConfig(CONFIG_FLOAT_SIGHT_MONSTER)) return m_creature->IsWithinDist(pl, sWorld.getConfig(CONFIG_FLOAT_SIGHT_MONSTER))
&& pl->isVisibleForOrDetect(m_creature, m_creature, true); && pl->IsVisibleForOrDetect(m_creature, m_creature, true);
} }
void void

View file

@ -565,7 +565,7 @@ void Creature::Update(uint32 update_diff, uint32 diff)
// creature can be dead after Unit::Update call // creature can be dead after Unit::Update call
// CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly) // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
if (!isAlive()) if (!IsAlive())
break; break;
if (!IsInEvadeMode()) if (!IsInEvadeMode())
@ -581,7 +581,7 @@ void Creature::Update(uint32 update_diff, uint32 diff)
// creature can be dead after UpdateAI call // creature can be dead after UpdateAI call
// CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly) // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
if (!isAlive()) if (!IsAlive())
break; break;
RegenerateAll(update_diff); RegenerateAll(update_diff);
break; break;
@ -621,7 +621,7 @@ void Creature::RegenerateAll(uint32 update_diff)
if (m_regenTimer != 0) if (m_regenTimer != 0)
return; return;
if (!isInCombat() || IsPolymorphed()) if (!IsInCombat() || IsPolymorphed())
RegenerateHealth(); RegenerateHealth();
RegenerateMana(); RegenerateMana();
@ -640,7 +640,7 @@ void Creature::RegenerateMana()
uint32 addvalue = 0; uint32 addvalue = 0;
// Combat and any controlled creature // Combat and any controlled creature
if (isInCombat() || GetCharmerOrOwnerGuid()) if (IsInCombat() || GetCharmerOrOwnerGuid())
{ {
float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA); float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA);
float Spirit = GetStat(STAT_SPIRIT); float Spirit = GetStat(STAT_SPIRIT);
@ -781,7 +781,7 @@ bool Creature::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo cons
bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const
{ {
if (!isTrainer()) if (!IsTrainer())
return false; return false;
// pet trainers not have spells in fact now // pet trainers not have spells in fact now
@ -1344,11 +1344,11 @@ bool Creature::LoadFromDB(uint32 guidlow, Map* map)
AIM_Initialize(); AIM_Initialize();
// Creature Linking, Initial load is handled like respawn // Creature Linking, Initial load is handled like respawn
if (m_isCreatureLinkingTrigger && isAlive()) if (m_isCreatureLinkingTrigger && IsAlive())
GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, this); GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, this);
// check if it is rabbit day // check if it is rabbit day
if (isAlive() && sWorld.getConfig(CONFIG_UINT32_RABBIT_DAY)) if (IsAlive() && sWorld.getConfig(CONFIG_UINT32_RABBIT_DAY))
{ {
time_t rabbit_day = time_t(sWorld.getConfig(CONFIG_UINT32_RABBIT_DAY)); time_t rabbit_day = time_t(sWorld.getConfig(CONFIG_UINT32_RABBIT_DAY));
tm rabbit_day_tm = *localtime(&rabbit_day); tm rabbit_day_tm = *localtime(&rabbit_day);
@ -1571,7 +1571,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn)
if (IsDespawned()) if (IsDespawned())
return; return;
if (isAlive()) if (IsAlive())
SetDeathState(JUST_DIED); SetDeathState(JUST_DIED);
RemoveCorpse(); RemoveCorpse();
@ -1732,13 +1732,13 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const
return false; return false;
// Live player (or with not release body see live creatures or death creatures with corpse disappearing time > 0 // Live player (or with not release body see live creatures or death creatures with corpse disappearing time > 0
if (pl->isAlive() || pl->GetDeathTimer() > 0) if (pl->IsAlive() || pl->GetDeathTimer() > 0)
{ {
return (isAlive() || m_corpseDecayTimer > 0 || (m_isDeadByDefault && m_deathState == CORPSE)); return (IsAlive() || m_corpseDecayTimer > 0 || (m_isDeadByDefault && m_deathState == CORPSE));
} }
// Dead player see live creatures near own corpse // Dead player see live creatures near own corpse
if (isAlive()) if (IsAlive())
{ {
Corpse* corpse = pl->GetCorpse(); Corpse* corpse = pl->GetCorpse();
if (corpse) if (corpse)
@ -1793,7 +1793,7 @@ void Creature::CallForHelp(float fRadius)
bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /*= true*/) const bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /*= true*/) const
{ {
// we don't need help from zombies :) // we don't need help from zombies :)
if (!isAlive()) if (!IsAlive())
return false; return false;
// we don't need help from non-combatant ;) // we don't need help from non-combatant ;)
@ -1804,7 +1804,7 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
return false; return false;
// skip fighting creature // skip fighting creature
if (enemy && isInCombat()) if (enemy && IsInCombat())
return false; return false;
// only free creature // only free creature
@ -1863,13 +1863,13 @@ bool Creature::IsOutOfThreatArea(Unit* pVictim) const
if (!pVictim->IsInMap(this)) if (!pVictim->IsInMap(this))
return true; return true;
if (!pVictim->isTargetableForAttack()) if (!pVictim->IsTargetableForAttack())
return true; return true;
if (!pVictim->isInAccessablePlaceFor(this)) if (!pVictim->isInAccessablePlaceFor(this))
return true; return true;
if (!pVictim->isVisibleForOrDetect(this, this, false)) if (!pVictim->IsVisibleForOrDetect(this, this, false))
return true; return true;
if (sMapStore.LookupEntry(GetMapId())->IsDungeon()) if (sMapStore.LookupEntry(GetMapId())->IsDungeon())
@ -2002,7 +2002,7 @@ void Creature::SetInCombatWithZone()
if (pPlayer->isGameMaster()) if (pPlayer->isGameMaster())
continue; continue;
if (pPlayer->isAlive() && !IsFriendlyTo(pPlayer)) if (pPlayer->IsAlive() && !IsFriendlyTo(pPlayer))
{ {
pPlayer->SetInCombatWith(this); pPlayer->SetInCombatWith(this);
AddThreat(pPlayer); AddThreat(pPlayer);
@ -2064,7 +2064,7 @@ Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, S
return NULL; return NULL;
// ThreatList m_threatlist; // ThreatList m_threatlist;
ThreatList const& threatlist = getThreatManager().getThreatList(); ThreatList const& threatlist = GetThreatManager().getThreatList();
ThreatList::const_iterator itr = threatlist.begin(); ThreatList::const_iterator itr = threatlist.begin();
ThreatList::const_reverse_iterator ritr = threatlist.rbegin(); ThreatList::const_reverse_iterator ritr = threatlist.rbegin();
@ -2416,7 +2416,7 @@ void Creature::ClearTemporaryFaction()
// Reset UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_OOC_NOT_ATTACKABLE or UNIT_FLAG_PASSIVE flags // Reset UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_OOC_NOT_ATTACKABLE or UNIT_FLAG_PASSIVE flags
if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_NON_ATTACKABLE && GetCreatureInfo()->unit_flags & UNIT_FLAG_NON_ATTACKABLE) if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_NON_ATTACKABLE && GetCreatureInfo()->unit_flags & UNIT_FLAG_NON_ATTACKABLE)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_OOC_NOT_ATTACK && GetCreatureInfo()->unit_flags & UNIT_FLAG_OOC_NOT_ATTACKABLE && !isInCombat()) if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_OOC_NOT_ATTACK && GetCreatureInfo()->unit_flags & UNIT_FLAG_OOC_NOT_ATTACKABLE && !IsInCombat())
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_PASSIVE && GetCreatureInfo()->unit_flags & UNIT_FLAG_PASSIVE) if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_PASSIVE && GetCreatureInfo()->unit_flags & UNIT_FLAG_PASSIVE)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE);
@ -2454,7 +2454,7 @@ void Creature::FillGuidsListFromThreatList(GuidVector& guids, uint32 maxamount /
if (!CanHaveThreatList()) if (!CanHaveThreatList())
return; return;
ThreatList const& threats = getThreatManager().getThreatList(); ThreatList const& threats = GetThreatManager().getThreatList();
maxamount = maxamount > 0 ? std::min(maxamount, uint32(threats.size())) : threats.size(); maxamount = maxamount > 0 ? std::min(maxamount, uint32(threats.size())) : threats.size();

View file

@ -199,7 +199,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
switch (event.event_type) switch (event.event_type)
{ {
case EVENT_T_TIMER_IN_COMBAT: case EVENT_T_TIMER_IN_COMBAT:
if (!m_creature->isInCombat()) if (!m_creature->IsInCombat())
return false; return false;
LOG_PROCESS_EVENT; LOG_PROCESS_EVENT;
@ -207,7 +207,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
pHolder.UpdateRepeatTimer(m_creature, event.timer.repeatMin, event.timer.repeatMax); pHolder.UpdateRepeatTimer(m_creature, event.timer.repeatMin, event.timer.repeatMax);
break; break;
case EVENT_T_TIMER_OOC: case EVENT_T_TIMER_OOC:
if (m_creature->isInCombat() || m_creature->IsInEvadeMode()) if (m_creature->IsInCombat() || m_creature->IsInEvadeMode())
return false; return false;
LOG_PROCESS_EVENT; LOG_PROCESS_EVENT;
@ -221,7 +221,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
break; break;
case EVENT_T_HP: case EVENT_T_HP:
{ {
if (!m_creature->isInCombat() || !m_creature->GetMaxHealth()) if (!m_creature->IsInCombat() || !m_creature->GetMaxHealth())
return false; return false;
uint32 perc = (m_creature->GetHealth() * 100) / m_creature->GetMaxHealth(); uint32 perc = (m_creature->GetHealth() * 100) / m_creature->GetMaxHealth();
@ -236,7 +236,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
} }
case EVENT_T_MANA: case EVENT_T_MANA:
{ {
if (!m_creature->isInCombat() || !m_creature->GetMaxPower(POWER_MANA)) if (!m_creature->IsInCombat() || !m_creature->GetMaxPower(POWER_MANA))
return false; return false;
uint32 perc = (m_creature->GetPower(POWER_MANA) * 100) / m_creature->GetMaxPower(POWER_MANA); uint32 perc = (m_creature->GetPower(POWER_MANA) * 100) / m_creature->GetMaxPower(POWER_MANA);
@ -276,7 +276,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
break; break;
case EVENT_T_TARGET_HP: case EVENT_T_TARGET_HP:
{ {
if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxHealth()) if (!m_creature->IsInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxHealth())
return false; return false;
uint32 perc = (m_creature->getVictim()->GetHealth() * 100) / m_creature->getVictim()->GetMaxHealth(); uint32 perc = (m_creature->getVictim()->GetHealth() * 100) / m_creature->getVictim()->GetMaxHealth();
@ -290,7 +290,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
break; break;
} }
case EVENT_T_TARGET_CASTING: case EVENT_T_TARGET_CASTING:
if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->IsNonMeleeSpellCasted(false, false, true)) if (!m_creature->IsInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->IsNonMeleeSpellCasted(false, false, true))
return false; return false;
LOG_PROCESS_EVENT; LOG_PROCESS_EVENT;
@ -299,7 +299,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
break; break;
case EVENT_T_FRIENDLY_HP: case EVENT_T_FRIENDLY_HP:
{ {
if (!m_creature->isInCombat()) if (!m_creature->IsInCombat())
return false; return false;
Unit* pUnit = DoSelectLowestHpFriendly((float)event.friendly_hp.radius, event.friendly_hp.hpDeficit); Unit* pUnit = DoSelectLowestHpFriendly((float)event.friendly_hp.radius, event.friendly_hp.hpDeficit);
@ -315,7 +315,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
} }
case EVENT_T_FRIENDLY_IS_CC: case EVENT_T_FRIENDLY_IS_CC:
{ {
if (!m_creature->isInCombat()) if (!m_creature->IsInCombat())
return false; return false;
std::list<Creature*> pList; std::list<Creature*> pList;
@ -366,7 +366,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
} }
case EVENT_T_TARGET_MANA: case EVENT_T_TARGET_MANA:
{ {
if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxPower(POWER_MANA)) if (!m_creature->IsInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxPower(POWER_MANA))
return false; return false;
uint32 perc = (m_creature->getVictim()->GetPower(POWER_MANA) * 100) / m_creature->getVictim()->GetMaxPower(POWER_MANA); uint32 perc = (m_creature->getVictim()->GetPower(POWER_MANA) * 100) / m_creature->getVictim()->GetMaxPower(POWER_MANA);
@ -394,7 +394,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
} }
case EVENT_T_TARGET_AURA: case EVENT_T_TARGET_AURA:
{ {
if (!m_creature->isInCombat() || !m_creature->getVictim()) if (!m_creature->IsInCombat() || !m_creature->getVictim())
return false; return false;
SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId); SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId);
@ -419,7 +419,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
} }
case EVENT_T_TARGET_MISSING_AURA: case EVENT_T_TARGET_MISSING_AURA:
{ {
if (!m_creature->isInCombat() || !m_creature->getVictim()) if (!m_creature->IsInCombat() || !m_creature->getVictim())
return false; return false;
SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId); SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId);
@ -672,16 +672,16 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
} }
case ACTION_T_THREAT_SINGLE_PCT: case ACTION_T_THREAT_SINGLE_PCT:
if (Unit* target = GetTargetByType(action.threat_single_pct.target, pActionInvoker, pAIEventSender, reportTargetError)) if (Unit* target = GetTargetByType(action.threat_single_pct.target, pActionInvoker, pAIEventSender, reportTargetError))
m_creature->getThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent); m_creature->GetThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent);
else if (reportTargetError) else if (reportTargetError)
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_THREAT_SINGLE_PCT(%u), target-type %u", EventId, action.type, action.threat_single_pct.target); sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_THREAT_SINGLE_PCT(%u), target-type %u", EventId, action.type, action.threat_single_pct.target);
break; break;
case ACTION_T_THREAT_ALL_PCT: case ACTION_T_THREAT_ALL_PCT:
{ {
ThreatList const& threatList = m_creature->getThreatManager().getThreatList(); ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i) for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
if (Unit* Temp = m_creature->GetMap()->GetUnit((*i)->getUnitGuid())) if (Unit* Temp = m_creature->GetMap()->GetUnit((*i)->getUnitGuid()))
m_creature->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent); m_creature->GetThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent);
break; break;
} }
case ACTION_T_QUEST_EVENT: case ACTION_T_QUEST_EVENT:
@ -737,9 +737,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
SetCombatMovement(action.combat_movement.state != 0, true); SetCombatMovement(action.combat_movement.state != 0, true);
if (m_isCombatMovement && action.combat_movement.melee && m_creature->isInCombat() && m_creature->getVictim()) if (m_isCombatMovement && action.combat_movement.melee && m_creature->IsInCombat() && m_creature->getVictim())
m_creature->SendMeleeAttackStart(m_creature->getVictim()); m_creature->SendMeleeAttackStart(m_creature->getVictim());
else if (action.combat_movement.melee && m_creature->isInCombat() && m_creature->getVictim()) else if (action.combat_movement.melee && m_creature->IsInCombat() && m_creature->getVictim())
m_creature->SendMeleeAttackStop(m_creature->getVictim()); m_creature->SendMeleeAttackStop(m_creature->getVictim());
break; break;
case ACTION_T_SET_PHASE: case ACTION_T_SET_PHASE:
@ -777,7 +777,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break; break;
case ACTION_T_CAST_EVENT_ALL: case ACTION_T_CAST_EVENT_ALL:
{ {
ThreatList const& threatList = m_creature->getThreatManager().getThreatList(); ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i) for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
if (Player* temp = m_creature->GetMap()->GetPlayer((*i)->getUnitGuid())) if (Player* temp = m_creature->GetMap()->GetPlayer((*i)->getUnitGuid()))
temp->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetObjectGuid(), action.cast_event_all.spellId); temp->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetObjectGuid(), action.cast_event_all.spellId);
@ -898,7 +898,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->UpdateEntry(action.update_template.creatureId, action.update_template.team ? HORDE : ALLIANCE); m_creature->UpdateEntry(action.update_template.creatureId, action.update_template.team ? HORDE : ALLIANCE);
break; break;
case ACTION_T_DIE: case ACTION_T_DIE:
if (m_creature->isDead()) if (m_creature->IsDead())
{ {
sLog.outErrorEventAI("Event %d ACTION_T_DIE on dead creature. Creature %d", EventId, m_creature->GetEntry()); sLog.outErrorEventAI("Event %d ACTION_T_DIE on dead creature. Creature %d", EventId, m_creature->GetEntry());
@ -1093,7 +1093,7 @@ void CreatureEventAI::EnterEvadeMode()
m_creature->DeleteThreatList(); m_creature->DeleteThreatList();
m_creature->CombatStop(true); m_creature->CombatStop(true);
if (m_creature->isAlive()) if (m_creature->IsAlive())
m_creature->GetMotionMaster()->MoveTargetedHome(); m_creature->GetMotionMaster()->MoveTargetedHome();
m_creature->SetLootRecipient(NULL); m_creature->SetLootRecipient(NULL);
@ -1259,7 +1259,7 @@ void CreatureEventAI::MoveInLineOfSight(Unit* who)
if (m_creature->IsCivilian() || m_creature->IsNeutralToAll()) if (m_creature->IsCivilian() || m_creature->IsNeutralToAll())
return; return;
if (m_creature->CanInitiateAttack() && who->isTargetableForAttack() && if (m_creature->CanInitiateAttack() && who->IsTargetableForAttack() &&
m_creature->IsHostileTo(who) && who->isInAccessablePlaceFor(m_creature)) m_creature->IsHostileTo(who) && who->isInAccessablePlaceFor(m_creature))
{ {
if (!m_creature->CanFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) if (!m_creature->CanFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
@ -1370,7 +1370,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
bool CreatureEventAI::IsVisible(Unit* pl) const bool CreatureEventAI::IsVisible(Unit* pl) const
{ {
return m_creature->IsWithinDist(pl, sWorld.getConfig(CONFIG_FLOAT_SIGHT_MONSTER)) return m_creature->IsWithinDist(pl, sWorld.getConfig(CONFIG_FLOAT_SIGHT_MONSTER))
&& pl->isVisibleForOrDetect(m_creature, m_creature, true); && pl->IsVisibleForOrDetect(m_creature, m_creature, true);
} }
inline uint32 CreatureEventAI::GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3) inline uint32 CreatureEventAI::GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3)
@ -1409,22 +1409,22 @@ inline Unit* CreatureEventAI::GetTargetByType(uint32 Target, Unit* pActionInvoke
return resTarget; return resTarget;
case TARGET_T_HOSTILE_SECOND_AGGRO: case TARGET_T_HOSTILE_SECOND_AGGRO:
resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 1, forSpellId, selectFlags); resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 1, forSpellId, selectFlags);
if (!resTarget && ((forSpellId == 0 && selectFlags == 0 && m_creature->getThreatManager().getThreatList().size() > 1) || m_creature->getThreatManager().getThreatList().empty())) if (!resTarget && ((forSpellId == 0 && selectFlags == 0 && m_creature->GetThreatManager().getThreatList().size() > 1) || m_creature->GetThreatManager().getThreatList().empty()))
isError = true; isError = true;
return resTarget; return resTarget;
case TARGET_T_HOSTILE_LAST_AGGRO: case TARGET_T_HOSTILE_LAST_AGGRO:
resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_BOTTOMAGGRO, 0, forSpellId, selectFlags); resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_BOTTOMAGGRO, 0, forSpellId, selectFlags);
if (!resTarget && m_creature->getThreatManager().getThreatList().empty()) if (!resTarget && m_creature->GetThreatManager().getThreatList().empty())
isError = true; isError = true;
return resTarget; return resTarget;
case TARGET_T_HOSTILE_RANDOM: case TARGET_T_HOSTILE_RANDOM:
resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, forSpellId, selectFlags); resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, forSpellId, selectFlags);
if (!resTarget && m_creature->getThreatManager().getThreatList().empty()) if (!resTarget && m_creature->GetThreatManager().getThreatList().empty())
isError = true; isError = true;
return resTarget; return resTarget;
case TARGET_T_HOSTILE_RANDOM_NOT_TOP: case TARGET_T_HOSTILE_RANDOM_NOT_TOP:
resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, forSpellId, selectFlags); resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, forSpellId, selectFlags);
if (!resTarget && ((forSpellId == 0 && selectFlags == 0 && m_creature->getThreatManager().getThreatList().size() > 1) || m_creature->getThreatManager().getThreatList().empty())) if (!resTarget && ((forSpellId == 0 && selectFlags == 0 && m_creature->GetThreatManager().getThreatList().size() > 1) || m_creature->GetThreatManager().getThreatList().empty()))
isError = true; isError = true;
return resTarget; return resTarget;
case TARGET_T_HOSTILE_RANDOM_PLAYER: case TARGET_T_HOSTILE_RANDOM_PLAYER:
@ -1434,7 +1434,7 @@ inline Unit* CreatureEventAI::GetTargetByType(uint32 Target, Unit* pActionInvoke
return resTarget; return resTarget;
case TARGET_T_HOSTILE_RANDOM_NOT_TOP_PLAYER: case TARGET_T_HOSTILE_RANDOM_NOT_TOP_PLAYER:
resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, forSpellId, SELECT_FLAG_PLAYER | selectFlags); resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, forSpellId, SELECT_FLAG_PLAYER | selectFlags);
if (!resTarget && ((forSpellId == 0 && selectFlags == 0 && m_creature->getThreatManager().getThreatList().size() > 1) || m_creature->getThreatManager().getThreatList().empty())) if (!resTarget && ((forSpellId == 0 && selectFlags == 0 && m_creature->GetThreatManager().getThreatList().size() > 1) || m_creature->GetThreatManager().getThreatList().empty()))
isError = true; isError = true;
return resTarget; return resTarget;
case TARGET_T_ACTION_INVOKER: case TARGET_T_ACTION_INVOKER:

View file

@ -242,7 +242,7 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
{ {
// Arming Time for GAMEOBJECT_TYPE_TRAP (6) // Arming Time for GAMEOBJECT_TYPE_TRAP (6)
Unit* owner = GetOwner(); Unit* owner = GetOwner();
if (owner && owner->isInCombat()) if (owner && owner->IsInCombat())
m_cooldownTime = time(NULL) + GetGOInfo()->trap.startDelay; m_cooldownTime = time(NULL) + GetGOInfo()->trap.startDelay;
m_lootState = GO_READY; m_lootState = GO_READY;
break; break;

View file

@ -46,7 +46,7 @@ void GuardAI::MoveInLineOfSight(Unit* u)
if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE) if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE)
return; return;
if (!m_creature->getVictim() && u->isTargetableForAttack() && if (!m_creature->getVictim() && u->IsTargetableForAttack() &&
(u->IsHostileToPlayers() || m_creature->IsHostileTo(u) /*|| u->getVictim() && m_creature->IsFriendlyTo(u->getVictim())*/) && (u->IsHostileToPlayers() || m_creature->IsHostileTo(u) /*|| u->getVictim() && m_creature->IsFriendlyTo(u->getVictim())*/) &&
u->isInAccessablePlaceFor(m_creature)) u->isInAccessablePlaceFor(m_creature))
{ {
@ -62,7 +62,7 @@ void GuardAI::MoveInLineOfSight(Unit* u)
void GuardAI::EnterEvadeMode() void GuardAI::EnterEvadeMode()
{ {
if (!m_creature->isAlive()) if (!m_creature->IsAlive())
{ {
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking because he's dead [guid=%u]", m_creature->GetGUIDLow()); DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking because he's dead [guid=%u]", m_creature->GetGUIDLow());
m_creature->StopMoving(); m_creature->StopMoving();
@ -82,7 +82,7 @@ void GuardAI::EnterEvadeMode()
{ {
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, no victim [guid=%u]", m_creature->GetGUIDLow()); DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, no victim [guid=%u]", m_creature->GetGUIDLow());
} }
else if (!victim->isAlive()) else if (!victim->IsAlive())
{ {
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, victim is dead [guid=%u]", m_creature->GetGUIDLow()); DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, victim is dead [guid=%u]", m_creature->GetGUIDLow());
} }
@ -124,7 +124,7 @@ void GuardAI::UpdateAI(const uint32 /*diff*/)
bool GuardAI::IsVisible(Unit* pl) const bool GuardAI::IsVisible(Unit* pl) const
{ {
return m_creature->IsWithinDist(pl, sWorld.getConfig(CONFIG_FLOAT_SIGHT_GUARDER)) return m_creature->IsWithinDist(pl, sWorld.getConfig(CONFIG_FLOAT_SIGHT_GUARDER))
&& pl->isVisibleForOrDetect(m_creature, m_creature, true); && pl->IsVisibleForOrDetect(m_creature, m_creature, true);
} }
void GuardAI::AttackStart(Unit* u) void GuardAI::AttackStart(Unit* u)

View file

@ -1345,9 +1345,9 @@ bool ItemRequiredTarget::IsFitToRequirements(Unit* pUnitTarget) const
switch (m_uiType) switch (m_uiType)
{ {
case ITEM_TARGET_TYPE_CREATURE: case ITEM_TARGET_TYPE_CREATURE:
return pUnitTarget->isAlive(); return pUnitTarget->IsAlive();
case ITEM_TARGET_TYPE_DEAD: case ITEM_TARGET_TYPE_DEAD:
return !pUnitTarget->isAlive(); return !pUnitTarget->IsAlive();
default: default:
return false; return false;
} }

View file

@ -8155,7 +8155,7 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
switch (m_value1) switch (m_value1)
{ {
case 0: // Player dead or out of range case 0: // Player dead or out of range
return !player || !player->isAlive() || (m_value2 && source && !source->IsWithinDistInMap(player, m_value2)); return !player || !player->IsAlive() || (m_value2 && source && !source->IsWithinDistInMap(player, m_value2));
case 1: // All players in Group dead or out of range case 1: // All players in Group dead or out of range
if (!player) if (!player)
return true; return true;
@ -8164,23 +8164,23 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
for (GroupReference const* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) for (GroupReference const* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{ {
Player const* pl = itr->getSource(); Player const* pl = itr->getSource();
if (pl && pl->isAlive() && !pl->isGameMaster() && (!m_value2 || !source || source->IsWithinDistInMap(pl, m_value2))) if (pl && pl->IsAlive() && !pl->isGameMaster() && (!m_value2 || !source || source->IsWithinDistInMap(pl, m_value2)))
return false; return false;
} }
return true; return true;
} }
else else
return !player->isAlive() || (m_value2 && source && !source->IsWithinDistInMap(player, m_value2)); return !player->IsAlive() || (m_value2 && source && !source->IsWithinDistInMap(player, m_value2));
case 2: // All players in instance dead or out of range case 2: // All players in instance dead or out of range
for (Map::PlayerList::const_iterator itr = map->GetPlayers().begin(); itr != map->GetPlayers().end(); ++itr) for (Map::PlayerList::const_iterator itr = map->GetPlayers().begin(); itr != map->GetPlayers().end(); ++itr)
{ {
Player const* plr = itr->getSource(); Player const* plr = itr->getSource();
if (plr && plr->isAlive() && !plr->isGameMaster() && (!m_value2 || !source || source->IsWithinDistInMap(plr, m_value2))) if (plr && plr->IsAlive() && !plr->isGameMaster() && (!m_value2 || !source || source->IsWithinDistInMap(plr, m_value2)))
return false; return false;
} }
return true; return true;
case 3: // Creature source is dead case 3: // Creature source is dead
return !source || source->GetTypeId() != TYPEID_UNIT || !((Unit*)source)->isAlive(); return !source || source->GetTypeId() != TYPEID_UNIT || !((Unit*)source)->IsAlive();
} }
default: default:
return false; return false;

View file

@ -575,7 +575,7 @@ void Pet::RegenerateAll(uint32 update_diff)
break; break;
} }
if (!isInCombat() || IsPolymorphed()) if (!IsInCombat() || IsPolymorphed())
RegenerateHealth(); RegenerateHealth();
RegenerateMana(); RegenerateMana();
@ -750,7 +750,7 @@ void Pet::GivePetXP(uint32 xp)
if (xp < 1) if (xp < 1)
return; return;
if (!isAlive()) if (!IsAlive())
return; return;
uint32 level = getLevel(); uint32 level = getLevel();

View file

@ -59,7 +59,7 @@ void PetAI::MoveInLineOfSight(Unit* u)
if (!m_creature->GetCharmInfo() || !m_creature->GetCharmInfo()->HasReactState(REACT_AGGRESSIVE)) if (!m_creature->GetCharmInfo() || !m_creature->GetCharmInfo()->HasReactState(REACT_AGGRESSIVE))
return; return;
if (u->isTargetableForAttack() && m_creature->IsHostileTo(u) && if (u->IsTargetableForAttack() && m_creature->IsHostileTo(u) &&
u->isInAccessablePlaceFor(m_creature)) u->isInAccessablePlaceFor(m_creature))
{ {
float attackRadius = m_creature->GetAttackDistance(u); float attackRadius = m_creature->GetAttackDistance(u);
@ -105,7 +105,7 @@ bool PetAI::_needToStop() const
if (m_creature->isCharmed() && m_creature->getVictim() == m_creature->GetCharmer()) if (m_creature->isCharmed() && m_creature->getVictim() == m_creature->GetCharmer())
return true; return true;
return !m_creature->getVictim()->isTargetableForAttack(); return !m_creature->getVictim()->IsTargetableForAttack();
} }
void PetAI::_stopAttack() void PetAI::_stopAttack()
@ -128,7 +128,7 @@ void PetAI::_stopAttack()
void PetAI::UpdateAI(const uint32 diff) void PetAI::UpdateAI(const uint32 diff)
{ {
if (!m_creature->isAlive()) if (!m_creature->IsAlive())
return; return;
Unit* owner = m_creature->GetCharmerOrOwner(); Unit* owner = m_creature->GetCharmerOrOwner();
@ -180,7 +180,7 @@ void PetAI::UpdateAI(const uint32 diff)
} }
else if (owner && m_creature->GetCharmInfo()) else if (owner && m_creature->GetCharmInfo())
{ {
if (owner->isInCombat() && !(m_creature->GetCharmInfo()->HasReactState(REACT_PASSIVE) || m_creature->GetCharmInfo()->HasCommandState(COMMAND_STAY))) if (owner->IsInCombat() && !(m_creature->GetCharmInfo()->HasReactState(REACT_PASSIVE) || m_creature->GetCharmInfo()->HasCommandState(COMMAND_STAY)))
{ {
AttackStart(owner->getAttackerForHelper()); AttackStart(owner->getAttackerForHelper());
} }
@ -310,7 +310,7 @@ void PetAI::UpdateAI(const uint32 diff)
bool PetAI::_isVisible(Unit* u) const bool PetAI::_isVisible(Unit* u) const
{ {
return m_creature->IsWithinDist(u, sWorld.getConfig(CONFIG_FLOAT_SIGHT_GUARDER)) return m_creature->IsWithinDist(u, sWorld.getConfig(CONFIG_FLOAT_SIGHT_GUARDER))
&& u->isVisibleForOrDetect(m_creature, m_creature, true); && u->IsVisibleForOrDetect(m_creature, m_creature, true);
} }
void PetAI::UpdateAllies() void PetAI::UpdateAllies()

View file

@ -932,7 +932,7 @@ void Player::StopMirrorTimer(MirrorTimerType Type)
uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage) uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
{ {
if (!isAlive() || isGameMaster()) if (!IsAlive() || isGameMaster())
return 0; return 0;
// Absorb, resist some environmental damage type // Absorb, resist some environmental damage type
@ -957,7 +957,7 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
uint32 final_damage = DealDamage(this, damage, NULL, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); uint32 final_damage = DealDamage(this, damage, NULL, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
if (!isAlive()) if (!IsAlive())
{ {
if (type == DAMAGE_FALL) // DealDamage not apply item durability loss at self damage if (type == DAMAGE_FALL) // DealDamage not apply item durability loss at self damage
{ {
@ -984,7 +984,7 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
return sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FATIGUE_MAX) * IN_MILLISECONDS; return sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FATIGUE_MAX) * IN_MILLISECONDS;
case BREATH_TIMER: case BREATH_TIMER:
{ {
if (!isAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) || if (!IsAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) ||
GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_BREATH_GMLEVEL)) GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_BREATH_GMLEVEL))
return DISABLED_MIRROR_TIMER; return DISABLED_MIRROR_TIMER;
int32 UnderWaterTime = sWorld.getConfig(CONFIG_UINT32_TIMERBAR_BREATH_MAX) * IN_MILLISECONDS; int32 UnderWaterTime = sWorld.getConfig(CONFIG_UINT32_TIMERBAR_BREATH_MAX) * IN_MILLISECONDS;
@ -995,7 +995,7 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
} }
case FIRE_TIMER: case FIRE_TIMER:
{ {
if (!isAlive() || GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL)) if (!IsAlive() || GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL))
return DISABLED_MIRROR_TIMER; return DISABLED_MIRROR_TIMER;
return sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_MAX) * IN_MILLISECONDS; return sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_MAX) * IN_MILLISECONDS;
} }
@ -1047,7 +1047,7 @@ void Player::HandleDrowning(uint32 time_diff)
int32 UnderWaterTime = getMaxTimer(BREATH_TIMER); int32 UnderWaterTime = getMaxTimer(BREATH_TIMER);
// Need breath regen // Need breath regen
m_MirrorTimer[BREATH_TIMER] += 10 * time_diff; m_MirrorTimer[BREATH_TIMER] += 10 * time_diff;
if (m_MirrorTimer[BREATH_TIMER] >= UnderWaterTime || !isAlive()) if (m_MirrorTimer[BREATH_TIMER] >= UnderWaterTime || !IsAlive())
StopMirrorTimer(BREATH_TIMER); StopMirrorTimer(BREATH_TIMER);
else if (m_MirrorTimerFlagsLast & UNDERWATER_INWATER) else if (m_MirrorTimerFlagsLast & UNDERWATER_INWATER)
SendMirrorTimer(BREATH_TIMER, UnderWaterTime, m_MirrorTimer[BREATH_TIMER], 10); SendMirrorTimer(BREATH_TIMER, UnderWaterTime, m_MirrorTimer[BREATH_TIMER], 10);
@ -1069,7 +1069,7 @@ void Player::HandleDrowning(uint32 time_diff)
if (m_MirrorTimer[FATIGUE_TIMER] < 0) if (m_MirrorTimer[FATIGUE_TIMER] < 0)
{ {
m_MirrorTimer[FATIGUE_TIMER] += 2 * IN_MILLISECONDS; m_MirrorTimer[FATIGUE_TIMER] += 2 * IN_MILLISECONDS;
if (isAlive()) // Calculate and deal damage if (IsAlive()) // Calculate and deal damage
{ {
uint32 damage = GetMaxHealth() / 5 + urand(0, getLevel() - 1); uint32 damage = GetMaxHealth() / 5 + urand(0, getLevel() - 1);
EnvironmentalDamage(DAMAGE_EXHAUSTED, damage); EnvironmentalDamage(DAMAGE_EXHAUSTED, damage);
@ -1085,7 +1085,7 @@ void Player::HandleDrowning(uint32 time_diff)
{ {
int32 DarkWaterTime = getMaxTimer(FATIGUE_TIMER); int32 DarkWaterTime = getMaxTimer(FATIGUE_TIMER);
m_MirrorTimer[FATIGUE_TIMER] += 10 * time_diff; m_MirrorTimer[FATIGUE_TIMER] += 10 * time_diff;
if (m_MirrorTimer[FATIGUE_TIMER] >= DarkWaterTime || !isAlive()) if (m_MirrorTimer[FATIGUE_TIMER] >= DarkWaterTime || !IsAlive())
StopMirrorTimer(FATIGUE_TIMER); StopMirrorTimer(FATIGUE_TIMER);
else if (m_MirrorTimerFlagsLast & UNDERWATER_INDARKWATER) else if (m_MirrorTimerFlagsLast & UNDERWATER_INDARKWATER)
SendMirrorTimer(FATIGUE_TIMER, DarkWaterTime, m_MirrorTimer[FATIGUE_TIMER], 10); SendMirrorTimer(FATIGUE_TIMER, DarkWaterTime, m_MirrorTimer[FATIGUE_TIMER], 10);
@ -1331,7 +1331,7 @@ void Player::Update(uint32 update_diff, uint32 p_time)
m_timeSyncTimer -= update_diff; m_timeSyncTimer -= update_diff;
} }
if (isAlive()) if (IsAlive())
{ {
if (!HasAuraType(SPELL_AURA_STOP_NATURAL_MANA_REGEN)) if (!HasAuraType(SPELL_AURA_STOP_NATURAL_MANA_REGEN))
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER); SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
@ -1418,7 +1418,7 @@ void Player::SetDeathState(DeathState s)
{ {
uint32 ressSpellId = 0; uint32 ressSpellId = 0;
bool cur = isAlive(); bool cur = IsAlive();
if (s == JUST_DIED && cur) if (s == JUST_DIED && cur)
{ {
@ -1456,7 +1456,7 @@ void Player::SetDeathState(DeathState s)
if (s == JUST_DIED && cur && ressSpellId) if (s == JUST_DIED && cur && ressSpellId)
SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId); SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId);
if (isAlive() && !cur) if (IsAlive() && !cur)
{ {
// clear aura case after resurrection by another way (spells will be applied before next death) // clear aura case after resurrection by another way (spells will be applied before next death)
SetUInt32Value(PLAYER_SELF_RES_SPELL, 0); SetUInt32Value(PLAYER_SELF_RES_SPELL, 0);
@ -2072,11 +2072,11 @@ void Player::RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacke
void Player::RegenerateAll(uint32 diff) void Player::RegenerateAll(uint32 diff)
{ {
// Not in combat or they have regeneration // Not in combat or they have regeneration
if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) || if (!IsInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) ||
HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed() || m_baseHealthRegen) HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed() || m_baseHealthRegen)
{ {
RegenerateHealth(diff); RegenerateHealth(diff);
if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN)) if (!IsInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
{ {
Regenerate(POWER_RAGE, diff); Regenerate(POWER_RAGE, diff);
if (getClass() == CLASS_DEATH_KNIGHT) if (getClass() == CLASS_DEATH_KNIGHT)
@ -2096,7 +2096,7 @@ void Player::RegenerateAll(uint32 diff)
if (getClass() == CLASS_PALADIN) if (getClass() == CLASS_PALADIN)
{ {
if (isInCombat()) if (IsInCombat())
ResetHolyPowerRegenTimer(); ResetHolyPowerRegenTimer();
else if (m_holyPowerRegenTimer <= diff) else if (m_holyPowerRegenTimer <= diff)
m_holyPowerRegenTimer = 0; m_holyPowerRegenTimer = 0;
@ -2136,7 +2136,7 @@ void Player::Regenerate(Powers power, uint32 diff)
break; break;
float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA); float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA);
if (isInCombat()) if (IsInCombat())
{ {
// Mangos Updates Mana in intervals of 2s, which is correct // Mangos Updates Mana in intervals of 2s, which is correct
addvalue = GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER) * ManaIncreaseRate * 2.00f; addvalue = GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER) * ManaIncreaseRate * 2.00f;
@ -2245,10 +2245,10 @@ void Player::RegenerateHealth(uint32 diff)
if (IsPolymorphed()) if (IsPolymorphed())
addvalue = (float)GetMaxHealth() / 3; addvalue = (float)GetMaxHealth() / 3;
// normal regen case (maybe partly in combat case) // normal regen case (maybe partly in combat case)
else if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT)) else if (!IsInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT))
{ {
addvalue = HealthIncreaseRate; addvalue = HealthIncreaseRate;
if (!isInCombat()) if (!IsInCombat())
{ {
if (getLevel() < 15) if (getLevel() < 15)
addvalue = 0.20f * GetMaxHealth() * addvalue / getLevel(); addvalue = 0.20f * GetMaxHealth() * addvalue / getLevel();
@ -2307,10 +2307,10 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
} }
// if a dead unit should be able to talk - the creature must be alive and have special flags // if a dead unit should be able to talk - the creature must be alive and have special flags
if (!unit->isAlive()) if (!unit->IsAlive())
return NULL; return NULL;
if (isAlive() && unit->isInvisibleForAlive()) if (IsAlive() && unit->isInvisibleForAlive())
return NULL; return NULL;
// not allow interaction under control, but allow with own pets // not allow interaction under control, but allow with own pets
@ -2559,7 +2559,7 @@ void Player::GiveXP(uint32 xp, Unit* victim)
if (xp < 1) if (xp < 1)
return; return;
if (!isAlive()) if (!IsAlive())
return; return;
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_XP_USER_DISABLED)) if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_XP_USER_DISABLED))
@ -2663,7 +2663,7 @@ void Player::GiveLevel(uint32 level)
UpdateAllStats(); UpdateAllStats();
// set current level health and mana/energy to maximum after applying all mods. // set current level health and mana/energy to maximum after applying all mods.
if (isAlive()) if (IsAlive())
SetHealth(GetMaxHealth()); SetHealth(GetMaxHealth());
SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
@ -4978,7 +4978,7 @@ void Player::RepopAtGraveyard()
AreaTableEntry const* zone = GetAreaEntryByAreaID(GetAreaId()); AreaTableEntry const* zone = GetAreaEntryByAreaID(GetAreaId());
// Such zones are considered unreachable as a ghost and the player must be automatically revived // Such zones are considered unreachable as a ghost and the player must be automatically revived
if ((!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport()) if ((!IsAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport())
{ {
ResurrectPlayer(0.5f); ResurrectPlayer(0.5f);
SpawnCorpseBones(); SpawnCorpseBones();
@ -5001,7 +5001,7 @@ void Player::RepopAtGraveyard()
{ {
bool updateVisibility = IsInWorld() && GetMapId() == ClosestGrave->map_id; bool updateVisibility = IsInWorld() && GetMapId() == ClosestGrave->map_id;
TeleportTo(ClosestGrave->map_id, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, GetOrientation()); TeleportTo(ClosestGrave->map_id, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, GetOrientation());
if (isDead()) // not send if alive, because it used in TeleportTo() if (IsDead()) // not send if alive, because it used in TeleportTo()
{ {
WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4 * 4);// show spirit healer position on minimap WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4 * 4);// show spirit healer position on minimap
data << ClosestGrave->map_id; data << ClosestGrave->map_id;
@ -6242,7 +6242,7 @@ void Player::SendMovieStart(uint32 MovieId)
void Player::CheckAreaExploreAndOutdoor() void Player::CheckAreaExploreAndOutdoor()
{ {
if (!isAlive()) if (!IsAlive())
return; return;
if (IsTaxiFlying()) if (IsTaxiFlying())
@ -6867,7 +6867,7 @@ void Player::UpdateArea(uint32 newArea)
bool Player::CanUseCapturePoint() bool Player::CanUseCapturePoint()
{ {
return isAlive() && // living return IsAlive() && // living
!HasStealthAura() && // not stealthed !HasStealthAura() && // not stealthed
!HasInvisibilityAura() && // visible !HasInvisibilityAura() && // visible
(IsPvP() || sWorld.IsPvPRealm()) && (IsPvP() || sWorld.IsPvPRealm()) &&
@ -6959,7 +6959,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
// remove items with area/map limitations (delete only for alive player to allow back in ghost mode) // remove items with area/map limitations (delete only for alive player to allow back in ghost mode)
// if player resurrected at teleport this will be applied in resurrect code // if player resurrected at teleport this will be applied in resurrect code
if (isAlive()) if (IsAlive())
DestroyZoneLimitedItem(true, newZone); DestroyZoneLimitedItem(true, newZone);
// check some item equip limitations (in result lost CanTitanGrip at talent reset, for example) // check some item equip limitations (in result lost CanTitanGrip at talent reset, for example)
@ -8269,7 +8269,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
Creature* creature = GetMap()->GetCreature(guid); Creature* creature = GetMap()->GetCreature(guid);
// must be in range and creature must be alive for pickpocket and must be dead for another loot // must be in range and creature must be alive for pickpocket and must be dead for another loot
if (!creature || creature->isAlive() != (loot_type == LOOT_PICKPOCKETING) || !creature->IsWithinDistInMap(this, INTERACTION_DISTANCE)) if (!creature || creature->IsAlive() != (loot_type == LOOT_PICKPOCKETING) || !creature->IsWithinDistInMap(this, INTERACTION_DISTANCE))
{ {
SendLootRelease(guid); SendLootRelease(guid);
return; return;
@ -10437,7 +10437,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool
// - in-progress arenas // - in-progress arenas
if (!pProto->CanChangeEquipStateInCombat()) if (!pProto->CanChangeEquipStateInCombat())
{ {
if (isInCombat()) if (IsInCombat())
return EQUIP_ERR_NOT_IN_COMBAT; return EQUIP_ERR_NOT_IN_COMBAT;
if (BattleGround* bg = GetBattleGround()) if (BattleGround* bg = GetBattleGround())
@ -10449,7 +10449,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool
if (GetSession()->isLogingOut()) if (GetSession()->isLogingOut())
return EQUIP_ERR_YOU_ARE_STUNNED; return EQUIP_ERR_YOU_ARE_STUNNED;
if (isInCombat() && pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer != 0) if (IsInCombat() && pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer != 0)
return EQUIP_ERR_CANT_DO_RIGHT_NOW; // maybe exist better err return EQUIP_ERR_CANT_DO_RIGHT_NOW; // maybe exist better err
if (IsNonMeleeSpellCasted(false)) if (IsNonMeleeSpellCasted(false))
@ -10572,7 +10572,7 @@ InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const
// - in-progress arenas // - in-progress arenas
if (!pProto->CanChangeEquipStateInCombat()) if (!pProto->CanChangeEquipStateInCombat())
{ {
if (isInCombat()) if (IsInCombat())
return EQUIP_ERR_NOT_IN_COMBAT; return EQUIP_ERR_NOT_IN_COMBAT;
if (BattleGround* bg = GetBattleGround()) if (BattleGround* bg = GetBattleGround())
@ -10778,7 +10778,7 @@ InventoryResult Player::CanUseItem(Item* pItem, bool direct_action) const
{ {
DEBUG_LOG("STORAGE: CanUseItem item = %u", pItem->GetEntry()); DEBUG_LOG("STORAGE: CanUseItem item = %u", pItem->GetEntry());
if (!isAlive() && direct_action) if (!IsAlive() && direct_action)
return EQUIP_ERR_YOU_ARE_DEAD; return EQUIP_ERR_YOU_ARE_DEAD;
// if (isStunned()) // if (isStunned())
@ -10878,7 +10878,7 @@ InventoryResult Player::CanUseItem(ItemPrototype const* pProto) const
InventoryResult Player::CanUseAmmo(uint32 item) const InventoryResult Player::CanUseAmmo(uint32 item) const
{ {
DEBUG_LOG("STORAGE: CanUseAmmo item = %u", item); DEBUG_LOG("STORAGE: CanUseAmmo item = %u", item);
if (!isAlive()) if (!IsAlive())
return EQUIP_ERR_YOU_ARE_DEAD; return EQUIP_ERR_YOU_ARE_DEAD;
// if( isStunned() ) // if( isStunned() )
// return EQUIP_ERR_YOU_ARE_STUNNED; // return EQUIP_ERR_YOU_ARE_STUNNED;
@ -11112,7 +11112,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
{ {
VisualizeItem(slot, pItem); VisualizeItem(slot, pItem);
if (isAlive()) if (IsAlive())
{ {
ItemPrototype const* pProto = pItem->GetProto(); ItemPrototype const* pProto = pItem->GetProto();
@ -11125,7 +11125,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
ApplyItemOnStoreSpell(pItem, true); ApplyItemOnStoreSpell(pItem, true);
// Weapons and also Totem/Relic/Sigil/etc // Weapons and also Totem/Relic/Sigil/etc
if (pProto && isInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer == 0) if (pProto && IsInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer == 0)
{ {
uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s; uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s;
@ -11847,7 +11847,7 @@ void Player::SwapItem(uint16 src, uint16 dst)
DEBUG_LOG("STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry()); DEBUG_LOG("STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry());
if (!isAlive()) if (!IsAlive())
{ {
SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, pSrcItem, pDstItem); SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, pSrcItem, pDstItem);
return; return;
@ -13086,7 +13086,7 @@ void Player::PrepareGossipMenu(WorldObject* pSource, uint32 menuId)
hasMenuItem = false; // added in special mode hasMenuItem = false; // added in special mode
break; break;
case GOSSIP_OPTION_SPIRITHEALER: case GOSSIP_OPTION_SPIRITHEALER:
if (!isDead()) if (!IsDead())
hasMenuItem = false; hasMenuItem = false;
break; break;
case GOSSIP_OPTION_VENDOR: case GOSSIP_OPTION_VENDOR:
@ -13316,7 +13316,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
break; break;
} }
case GOSSIP_OPTION_SPIRITHEALER: case GOSSIP_OPTION_SPIRITHEALER:
if (isDead()) if (IsDead())
((Creature*)pSource)->CastSpell(((Creature*)pSource), 17251, true, NULL, NULL, GetObjectGuid()); ((Creature*)pSource)->CastSpell(((Creature*)pSource), 17251, true, NULL, NULL, GetObjectGuid());
break; break;
case GOSSIP_OPTION_QUESTGIVER: case GOSSIP_OPTION_QUESTGIVER:
@ -16193,7 +16193,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
// Spell code allow apply any auras to dead character in load time in aura/spell/item loading // Spell code allow apply any auras to dead character in load time in aura/spell/item loading
// Do now before stats re-calculation cleanup for ghost state unexpected auras // Do now before stats re-calculation cleanup for ghost state unexpected auras
if (!isAlive()) if (!IsAlive())
RemoveAllAurasOnDeath(); RemoveAllAurasOnDeath();
// apply all stat bonuses from items and auras // apply all stat bonuses from items and auras
@ -16487,7 +16487,7 @@ void Player::_LoadGlyphs(QueryResult* result)
void Player::LoadCorpse() void Player::LoadCorpse()
{ {
if (isAlive()) if (IsAlive())
{ {
sObjectAccessor.ConvertCorpseForPlayer(GetObjectGuid()); sObjectAccessor.ConvertCorpseForPlayer(GetObjectGuid());
} }
@ -16552,7 +16552,7 @@ void Player::_LoadInventory(QueryResult* result, uint32 timediff)
} }
// not allow have in alive state item limited to another map/zone // not allow have in alive state item limited to another map/zone
if (isAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zone)) if (IsAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zone))
{ {
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid); CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
item->FSetState(ITEM_REMOVED); item->FSetState(ITEM_REMOVED);
@ -16672,7 +16672,7 @@ void Player::_LoadInventory(QueryResult* result, uint32 timediff)
} }
} }
// if(isAlive()) // if(IsAlive())
_ApplyAllItemMods(); _ApplyAllItemMods();
} }
@ -18585,7 +18585,7 @@ void Player::UpdateAfkReport(time_t currTime)
void Player::UpdateContestedPvP(uint32 diff) void Player::UpdateContestedPvP(uint32 diff)
{ {
if (!m_contestedPvPTimer || isInCombat()) if (!m_contestedPvPTimer || IsInCombat())
return; return;
if (m_contestedPvPTimer <= diff) if (m_contestedPvPTimer <= diff)
{ {
@ -19062,7 +19062,7 @@ void Player::HandleStealthedUnitsDetection()
continue; continue;
bool hasAtClient = HaveAtClient((*i)); bool hasAtClient = HaveAtClient((*i));
bool hasDetected = (*i)->isVisibleForOrDetect(this, viewPoint, true); bool hasDetected = (*i)->IsVisibleForOrDetect(this, viewPoint, true);
if (hasDetected) if (hasDetected)
{ {
@ -19097,7 +19097,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
return false; return false;
// not let cheating with start flight in time of logout process || if casting not finished || while in combat || if not use Spell's with EffectSendTaxi // not let cheating with start flight in time of logout process || if casting not finished || while in combat || if not use Spell's with EffectSendTaxi
if (GetSession()->isLogingOut() || isInCombat()) if (GetSession()->isLogingOut() || IsInCombat())
{ {
GetSession()->SendActivateTaxiReply(ERR_TAXIPLAYERBUSY); GetSession()->SendActivateTaxiReply(ERR_TAXIPLAYERBUSY);
return false; return false;
@ -19469,7 +19469,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot, uin
// cheating attempt // cheating attempt
if (count < 1) count = 1; if (count < 1) count = 1;
if (!isAlive()) if (!IsAlive())
return false; return false;
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(item); ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(item);
@ -19696,7 +19696,7 @@ bool Player::BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot,
// cheating attempt // cheating attempt
if (count < 1) count = 1; if (count < 1) count = 1;
if (!isAlive()) if (!IsAlive())
return false; return false;
CurrencyTypesEntry const* pCurrency = sCurrencyTypesStore.LookupEntry(currencyId); CurrencyTypesEntry const* pCurrency = sCurrencyTypesStore.LookupEntry(currencyId);
@ -20023,7 +20023,7 @@ void Player::SendCooldownEvent(SpellEntry const* spellInfo, uint32 itemId, Spell
void Player::UpdatePotionCooldown(Spell* spell) void Player::UpdatePotionCooldown(Spell* spell)
{ {
// no potion used in combat or still in combat // no potion used in combat or still in combat
if (!m_lastPotionId || isInCombat()) if (!m_lastPotionId || IsInCombat())
return; return;
// Call not from spell cast, send cooldown event for item spells if no in combat // Call not from spell cast, send cooldown event for item spells if no in combat
@ -20331,15 +20331,15 @@ bool Player::IsVisibleInGridForPlayer(Player* pl) const
return true; return true;
// Live player see live player or dead player with not realized corpse // Live player see live player or dead player with not realized corpse
if (pl->isAlive() || pl->m_deathTimer > 0) if (pl->IsAlive() || pl->m_deathTimer > 0)
return isAlive() || m_deathTimer > 0; return IsAlive() || m_deathTimer > 0;
// Ghost see other friendly ghosts, that's for sure // Ghost see other friendly ghosts, that's for sure
if (!(isAlive() || m_deathTimer > 0) && IsFriendlyTo(pl)) if (!(IsAlive() || m_deathTimer > 0) && IsFriendlyTo(pl))
return true; return true;
// Dead player see live players near own corpse // Dead player see live players near own corpse
if (isAlive()) if (IsAlive())
{ {
if (Corpse* corpse = pl->GetCorpse()) if (Corpse* corpse = pl->GetCorpse())
{ {
@ -20403,7 +20403,7 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* targe
BeforeVisibilityDestroy<Creature>((Creature*)target, this); BeforeVisibilityDestroy<Creature>((Creature*)target, this);
// at remove from map (destroy) show kill animation (in different out of range/stealth case) // at remove from map (destroy) show kill animation (in different out of range/stealth case)
target->DestroyForPlayer(this, !target->IsInWorld() && ((Creature*)target)->isDead()); target->DestroyForPlayer(this, !target->IsInWorld() && ((Creature*)target)->IsDead());
} }
else else
target->DestroyForPlayer(this); target->DestroyForPlayer(this);
@ -20612,7 +20612,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
SendInitialActionButtons(); SendInitialActionButtons();
m_reputationMgr.SendInitialReputations(); m_reputationMgr.SendInitialReputations();
if (!isAlive()) if (!IsAlive())
SendCorpseReclaimDelay(true); SendCorpseReclaimDelay(true);
SendInitWorldStates(GetZoneId(), GetAreaId()); SendInitWorldStates(GetZoneId(), GetAreaId());
@ -21500,7 +21500,7 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar
continue; // member (alive or dead) or his corpse at req. distance continue; // member (alive or dead) or his corpse at req. distance
// quest objectives updated only for alive group member or dead but with not released body // quest objectives updated only for alive group member or dead but with not released body
if (pGroupGuy->isAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if (pGroupGuy->IsAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
pGroupGuy->KilledMonsterCredit(creature_id, creature_guid); pGroupGuy->KilledMonsterCredit(creature_id, creature_guid);
} }
} }
@ -21523,7 +21523,7 @@ void Player::RewardPlayerAndGroupAtCast(WorldObject* pRewardSource, uint32 spell
continue; // member (alive or dead) or his corpse at req. distance continue; // member (alive or dead) or his corpse at req. distance
// quest objectives updated only for alive group member or dead but with not released body // quest objectives updated only for alive group member or dead but with not released body
if (pGroupGuy->isAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if (pGroupGuy->IsAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
pGroupGuy->CastedCreatureOrGO(pRewardSource->GetEntry(), pRewardSource->GetObjectGuid(), spellid, pGroupGuy == this); pGroupGuy->CastedCreatureOrGO(pRewardSource->GetEntry(), pRewardSource->GetObjectGuid(), spellid, pGroupGuy == this);
} }
} }
@ -21536,7 +21536,7 @@ bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const
if (pRewardSource->IsWithinDistInMap(this, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE))) if (pRewardSource->IsWithinDistInMap(this, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE)))
return true; return true;
if (isAlive()) if (IsAlive())
return false; return false;
Corpse* corpse = GetCorpse(); Corpse* corpse = GetCorpse();
@ -21920,7 +21920,7 @@ bool Player::CanUseBattleGroundObject()
// TODO : some spells gives player ForceReaction to one faction (ReputationMgr::ApplyForceReaction) // TODO : some spells gives player ForceReaction to one faction (ReputationMgr::ApplyForceReaction)
// maybe gameobject code should handle that ForceReaction usage // maybe gameobject code should handle that ForceReaction usage
// BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet // BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet
return (isAlive() && // living return (IsAlive() && // living
// the following two are incorrect, because invisible/stealthed players should get visible when they click on flag // the following two are incorrect, because invisible/stealthed players should get visible when they click on flag
!HasStealthAura() && // not stealthed !HasStealthAura() && // not stealthed
!HasInvisibilityAura() && // visible !HasInvisibilityAura() && // visible
@ -22511,7 +22511,7 @@ void Player::HandleFall(MovementInfo const& movementInfo)
// Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored // Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored
// 14.57 can be calculated by resolving damageperc formula below to 0 // 14.57 can be calculated by resolving damageperc formula below to 0
if (z_diff >= 14.57f && !isDead() && !isGameMaster() && /*!HasMovementFlag(MOVEFLAG_ONTRANSPORT) &&*/ if (z_diff >= 14.57f && !IsDead() && !isGameMaster() && /*!HasMovementFlag(MOVEFLAG_ONTRANSPORT) &&*/
!HasAuraType(SPELL_AURA_HOVER) && !HasAuraType(SPELL_AURA_FEATHER_FALL) && !HasAuraType(SPELL_AURA_HOVER) && !HasAuraType(SPELL_AURA_FEATHER_FALL) &&
!HasAuraType(SPELL_AURA_FLY) && !IsImmunedToDamage(SPELL_SCHOOL_MASK_NORMAL)) !HasAuraType(SPELL_AURA_FLY) && !IsImmunedToDamage(SPELL_SCHOOL_MASK_NORMAL))
{ {
@ -22541,7 +22541,7 @@ void Player::HandleFall(MovementInfo const& movementInfo)
uint32 final_damage = EnvironmentalDamage(DAMAGE_FALL, damage); uint32 final_damage = EnvironmentalDamage(DAMAGE_FALL, damage);
// recheck alive, might have died of EnvironmentalDamage, avoid cases when player die in fact like Spirit of Redemption case // recheck alive, might have died of EnvironmentalDamage, avoid cases when player die in fact like Spirit of Redemption case
if (isAlive() && final_damage < original_health) if (IsAlive() && final_damage < original_health)
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING, uint32(z_diff * 100)); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING, uint32(z_diff * 100));
} }

View file

@ -2279,7 +2279,7 @@ class Player : public Unit
void SetTemporaryUnsummonedPetNumber(uint32 petnumber) { m_temporaryUnsummonedPetNumber = petnumber; } void SetTemporaryUnsummonedPetNumber(uint32 petnumber) { m_temporaryUnsummonedPetNumber = petnumber; }
void UnsummonPetTemporaryIfAny(); void UnsummonPetTemporaryIfAny();
void ResummonPetTemporaryUnSummonedIfAny(); void ResummonPetTemporaryUnSummonedIfAny();
bool IsPetNeedBeTemporaryUnsummoned() const { return !IsInWorld() || !isAlive() || IsMounted() /*+in flight*/; } bool IsPetNeedBeTemporaryUnsummoned() const { return !IsInWorld() || !IsAlive() || IsMounted() /*+in flight*/; }
void SendCinematicStart(uint32 CinematicSequenceId); void SendCinematicStart(uint32 CinematicSequenceId);
void SendMovieStart(uint32 MovieId); void SendMovieStart(uint32 MovieId);
@ -2625,13 +2625,13 @@ class Player : public Unit
{ {
// we should not execute delayed teleports for now dead players but has been alive at teleport // we should not execute delayed teleports for now dead players but has been alive at teleport
// because we don't want player's ghost teleported from graveyard // because we don't want player's ghost teleported from graveyard
return m_bHasDelayedTeleport && (isAlive() || !m_bHasBeenAliveAtDelayedTeleport); return m_bHasDelayedTeleport && (IsAlive() || !m_bHasBeenAliveAtDelayedTeleport);
} }
bool SetDelayedTeleportFlagIfCan() bool SetDelayedTeleportFlagIfCan()
{ {
m_bHasDelayedTeleport = m_bCanDelayTeleport; m_bHasDelayedTeleport = m_bCanDelayTeleport;
m_bHasBeenAliveAtDelayedTeleport = isAlive(); m_bHasBeenAliveAtDelayedTeleport = IsAlive();
return m_bHasDelayedTeleport; return m_bHasDelayedTeleport;
} }

View file

@ -85,7 +85,7 @@ ReactorAI::UpdateAI(const uint32 /*time_diff*/)
void void
ReactorAI::EnterEvadeMode() ReactorAI::EnterEvadeMode()
{ {
if (!m_creature->isAlive()) if (!m_creature->IsAlive())
{ {
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, he is dead [guid=%u]", m_creature->GetGUIDLow()); DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, he is dead [guid=%u]", m_creature->GetGUIDLow());
m_creature->GetMotionMaster()->MovementExpired(); m_creature->GetMotionMaster()->MovementExpired();
@ -112,7 +112,7 @@ ReactorAI::EnterEvadeMode()
} }
else else
{ {
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, victim %s [guid=%u]", victim->isAlive() ? "out run him" : "is dead", m_creature->GetGUIDLow()); DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, victim %s [guid=%u]", victim->IsAlive() ? "out run him" : "is dead", m_creature->GetGUIDLow());
} }
m_creature->RemoveAllAurasOnEvade(); m_creature->RemoveAllAurasOnEvade();

View file

@ -50,7 +50,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
} }
case TEMPSUMMON_TIMED_OOC_DESPAWN: case TEMPSUMMON_TIMED_OOC_DESPAWN:
{ {
if (!isInCombat()) if (!IsInCombat())
{ {
if (m_timer <= update_diff) if (m_timer <= update_diff)
{ {
@ -88,7 +88,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
case TEMPSUMMON_CORPSE_DESPAWN: case TEMPSUMMON_CORPSE_DESPAWN:
{ {
// if m_deathState is DEAD, CORPSE was skipped // if m_deathState is DEAD, CORPSE was skipped
if (isDead()) if (IsDead())
{ {
UnSummon(); UnSummon();
return; return;
@ -108,13 +108,13 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
case TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN: case TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN:
{ {
// if m_deathState is DEAD, CORPSE was skipped // if m_deathState is DEAD, CORPSE was skipped
if (isDead()) if (IsDead())
{ {
UnSummon(); UnSummon();
return; return;
} }
if (!isInCombat()) if (!IsInCombat())
{ {
if (m_timer <= update_diff) if (m_timer <= update_diff)
{ {
@ -137,7 +137,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
return; return;
} }
if (!isInCombat() && isAlive()) if (!IsInCombat() && IsAlive())
{ {
if (m_timer <= update_diff) if (m_timer <= update_diff)
{ {
@ -154,7 +154,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN: case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
{ {
// if m_deathState is DEAD, CORPSE was skipped // if m_deathState is DEAD, CORPSE was skipped
if (isDead()) if (IsDead())
{ {
UnSummon(); UnSummon();
return; return;

View file

@ -78,7 +78,7 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const*
void Totem::Update(uint32 update_diff, uint32 time) void Totem::Update(uint32 update_diff, uint32 time)
{ {
Unit* owner = GetOwner(); Unit* owner = GetOwner();
if (!owner || !owner->isAlive() || !isAlive()) if (!owner || !owner->IsAlive() || !IsAlive())
{ {
UnSummon(); // remove self UnSummon(); // remove self
return; return;
@ -151,7 +151,7 @@ void Totem::UnSummon()
} }
// any totem unsummon look like as totem kill, req. for proper animation // any totem unsummon look like as totem kill, req. for proper animation
if (isAlive()) if (IsAlive())
SetDeathState(DEAD); SetDeathState(DEAD);
AddObjectToRemoveList(); AddObjectToRemoveList();

View file

@ -61,7 +61,7 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
if (getTotem().GetTotemType() != TOTEM_ACTIVE) if (getTotem().GetTotemType() != TOTEM_ACTIVE)
return; return;
if (!m_creature->isAlive() || m_creature->IsNonMeleeSpellCasted(false)) if (!m_creature->IsAlive() || m_creature->IsNonMeleeSpellCasted(false))
return; return;
// Search spell // Search spell
@ -80,8 +80,8 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
// Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end)
if (!victim || if (!victim ||
!victim->isTargetableForAttack() || !m_creature->IsWithinDistInMap(victim, max_range) || !victim->IsTargetableForAttack() || !m_creature->IsWithinDistInMap(victim, max_range) ||
m_creature->IsFriendlyTo(victim) || !victim->isVisibleForOrDetect(m_creature, m_creature, false)) m_creature->IsFriendlyTo(victim) || !victim->IsVisibleForOrDetect(m_creature, m_creature, false))
{ {
victim = NULL; victim = NULL;

View file

@ -617,10 +617,10 @@ void Unit::Update(uint32 update_diff, uint32 p_time)
CleanupDeletedAuras(); CleanupDeletedAuras();
if (CanHaveThreatList()) if (CanHaveThreatList())
getThreatManager().UpdateForClient(update_diff); GetThreatManager().UpdateForClient(update_diff);
// update combat timer only for players and pets // update combat timer only for players and pets
if (isInCombat() && GetCharmerOrOwnerPlayerOrPlayerItself()) if (IsInCombat() && GetCharmerOrOwnerPlayerOrPlayerItself())
{ {
// Check UNIT_STAT_MELEE_ATTACKING or UNIT_STAT_CHASE (without UNIT_STAT_FOLLOW in this case) so pets can reach far away // Check UNIT_STAT_MELEE_ATTACKING or UNIT_STAT_CHASE (without UNIT_STAT_FOLLOW in this case) so pets can reach far away
// targets without stopping half way there and running off. // targets without stopping half way there and running off.
@ -648,7 +648,7 @@ void Unit::Update(uint32 update_diff, uint32 p_time)
if (IsVehicle()) if (IsVehicle())
{ {
// Initialize vehicle if not done // Initialize vehicle if not done
if (isAlive() && !m_vehicleInfo->IsInitialized()) if (IsAlive() && !m_vehicleInfo->IsInitialized())
m_vehicleInfo->Initialize(); m_vehicleInfo->Initialize();
// Update passenger positions if we are the first vehicle // Update passenger positions if we are the first vehicle
@ -839,7 +839,7 @@ void Unit::RemoveSpellsCausingAura(AuraType auraType, ObjectGuid casterGuid)
void Unit::DealDamageMods(Unit* pVictim, uint32& damage, uint32* absorb) void Unit::DealDamageMods(Unit* pVictim, uint32& damage, uint32* absorb)
{ {
if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())) if (!pVictim->IsAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()))
{ {
if (absorb) if (absorb)
*absorb += damage; *absorb += damage;
@ -1651,7 +1651,7 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage* damageInfo, int32 damage, S
if (!this || !pVictim) if (!this || !pVictim)
return; return;
if (!this->isAlive() || !pVictim->isAlive()) if (!this->IsAlive() || !pVictim->IsAlive())
return; return;
// Check spell crit chance // Check spell crit chance
@ -1732,7 +1732,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss)
if (!this || !pVictim) if (!this || !pVictim)
return; return;
if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())) if (!pVictim->IsAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()))
return; return;
SpellEntry const* spellProto = sSpellStore.LookupEntry(damageInfo->SpellID); SpellEntry const* spellProto = sSpellStore.LookupEntry(damageInfo->SpellID);
@ -1774,7 +1774,7 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, uint32 damage, CalcDamageInfo* da
if (!this || !pVictim) if (!this || !pVictim)
return; return;
if (!this->isAlive() || !pVictim->isAlive()) if (!this->IsAlive() || !pVictim->IsAlive())
return; return;
// Select HitInfo/procAttacker/procVictim flag based on attack type // Select HitInfo/procAttacker/procVictim flag based on attack type
@ -2026,7 +2026,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
if (!this || !pVictim) if (!this || !pVictim)
return; return;
if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())) if (!pVictim->IsAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()))
return; return;
// You don't lose health from damage taken from another player while in a sanctuary // You don't lose health from damage taken from another player while in a sanctuary
@ -2108,7 +2108,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
if (!(damageInfo->HitInfo & HITINFO_MISS)) if (!(damageInfo->HitInfo & HITINFO_MISS))
{ {
// on weapon hit casts // on weapon hit casts
if (GetTypeId() == TYPEID_PLAYER && pVictim->isAlive()) if (GetTypeId() == TYPEID_PLAYER && pVictim->IsAlive())
((Player*)this)->CastItemCombatSpell(pVictim, damageInfo->attackType); ((Player*)this)->CastItemCombatSpell(pVictim, damageInfo->attackType);
// victim's damage shield // victim's damage shield
@ -2256,7 +2256,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage)
void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32* absorb, uint32* resist, bool canReflect) void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32* absorb, uint32* resist, bool canReflect)
{ {
if (!pCaster || !isAlive() || !damage) if (!pCaster || !IsAlive() || !damage)
return; return;
// Magic damage, check for resists // Magic damage, check for resists
@ -2699,7 +2699,7 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
// Damage can be splitted only if aura has an alive caster // Damage can be splitted only if aura has an alive caster
Unit* caster = (*i)->GetCaster(); Unit* caster = (*i)->GetCaster();
if (!caster || caster == this || !caster->IsInWorld() || !caster->isAlive()) if (!caster || caster == this || !caster->IsInWorld() || !caster->IsAlive())
continue; continue;
uint32 splitted = uint32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f); uint32 splitted = uint32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f);
@ -2784,7 +2784,7 @@ void Unit::CalculateAbsorbResistBlock(Unit* pCaster, SpellNonMeleeDamage* damage
void Unit::CalculateHealAbsorb(const uint32 heal, uint32* absorb) void Unit::CalculateHealAbsorb(const uint32 heal, uint32* absorb)
{ {
if (!isAlive() || !heal) if (!IsAlive() || !heal)
return; return;
int32 RemainingHeal = heal; int32 RemainingHeal = heal;
@ -2847,7 +2847,7 @@ void Unit::AttackerStateUpdate(Unit* pVictim, WeaponAttackType attType, bool ext
if (hasUnitState(UNIT_STAT_CAN_NOT_REACT) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) if (hasUnitState(UNIT_STAT_CAN_NOT_REACT) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
return; return;
if (!pVictim->isAlive()) if (!pVictim->IsAlive())
return; return;
if (IsNonMeleeSpellCasted(false)) if (IsNonMeleeSpellCasted(false))
@ -3405,7 +3405,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* pVictim, SpellEntry const* spell)
SpellMissInfo Unit::MagicSpellHitResult(Unit* pVictim, SpellEntry const* spell) SpellMissInfo Unit::MagicSpellHitResult(Unit* pVictim, SpellEntry const* spell)
{ {
// Can`t miss on dead target (on skinning for example) // Can`t miss on dead target (on skinning for example)
if (!pVictim->isAlive()) if (!pVictim->IsAlive())
return SPELL_MISS_NONE; return SPELL_MISS_NONE;
SpellSchoolMask schoolMask = GetSpellSchoolMask(spell); SpellSchoolMask schoolMask = GetSpellSchoolMask(spell);
@ -4214,7 +4214,7 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder* holder)
SpellEntry const* aurSpellInfo = holder->GetSpellProto(); SpellEntry const* aurSpellInfo = holder->GetSpellProto();
// ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load) // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
if (!isAlive() && !IsDeathPersistentSpell(aurSpellInfo) && if (!IsAlive() && !IsDeathPersistentSpell(aurSpellInfo) &&
!IsDeathOnlySpell(aurSpellInfo) && !IsDeathOnlySpell(aurSpellInfo) &&
(GetTypeId() != TYPEID_PLAYER || !((Player*)this)->GetSession()->PlayerLoading())) (GetTypeId() != TYPEID_PLAYER || !((Player*)this)->GetSession()->PlayerLoading()))
{ {
@ -4740,7 +4740,7 @@ void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount
if (Aura* dotAura = GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, UI64LIT(0x10000000), 0x00000000, casterGuid)) if (Aura* dotAura = GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, UI64LIT(0x10000000), 0x00000000, casterGuid))
caster = dotAura->GetCaster(); caster = dotAura->GetCaster();
if (caster && !caster->isDead()) if (caster && !caster->IsDead())
{ {
Unit::AuraList const& auras = caster->GetAurasByType(SPELL_AURA_DUMMY); Unit::AuraList const& auras = caster->GetAurasByType(SPELL_AURA_DUMMY);
for (Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i) for (Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i)
@ -5598,7 +5598,7 @@ void Unit::ProcDamageAndSpell(Unit* pVictim, uint32 procAttacker, uint32 procVic
ProcDamageAndSpellFor(false, pVictim, procAttacker, procExtra, attType, procSpell, amount); ProcDamageAndSpellFor(false, pVictim, procAttacker, procExtra, attType, procSpell, amount);
// Now go on with a victim's events'n'auras // Now go on with a victim's events'n'auras
// Not much to do if no flags are set or there is no victim // Not much to do if no flags are set or there is no victim
if (pVictim && pVictim->isAlive() && procVictim) if (pVictim && pVictim->IsAlive() && procVictim)
pVictim->ProcDamageAndSpellFor(true, this, procVictim, procExtra, attType, procSpell, amount); pVictim->ProcDamageAndSpellFor(true, this, procVictim, procExtra, attType, procSpell, amount);
} }
@ -6014,7 +6014,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
return false; return false;
// dead units can neither attack nor be attacked // dead units can neither attack nor be attacked
if (!isAlive() || !victim->IsInWorld() || !victim->isAlive()) if (!IsAlive() || !victim->IsInWorld() || !victim->IsAlive())
return false; return false;
// player cannot attack in mount state // player cannot attack in mount state
@ -6518,7 +6518,7 @@ Unit* Unit::SelectMagnetTarget(Unit* victim, Spell* spell, SpellEffectIndex eff)
{ {
if (Unit* magnet = (*itr)->GetCaster()) if (Unit* magnet = (*itr)->GetCaster())
{ {
if (magnet->isAlive() && magnet->IsWithinLOSInMap(this) && spell->CheckTarget(magnet, eff)) if (magnet->IsAlive() && magnet->IsWithinLOSInMap(this) && spell->CheckTarget(magnet, eff))
return magnet; return magnet;
} }
} }
@ -6531,7 +6531,7 @@ Unit* Unit::SelectMagnetTarget(Unit* victim, Spell* spell, SpellEffectIndex eff)
{ {
if (Unit* magnet = (*i)->GetCaster()) if (Unit* magnet = (*i)->GetCaster())
{ {
if (magnet->isAlive() && magnet->IsWithinLOSInMap(this) && (!spell || spell->CheckTarget(magnet, eff))) if (magnet->IsAlive() && magnet->IsWithinLOSInMap(this) && (!spell || spell->CheckTarget(magnet, eff)))
{ {
if (roll_chance_i((*i)->GetModifier()->m_amount)) if (roll_chance_i((*i)->GetModifier()->m_amount))
return magnet; return magnet;
@ -8302,7 +8302,7 @@ void Unit::SetInCombatWith(Unit* enemy)
void Unit::SetInCombatState(bool PvP, Unit* enemy) void Unit::SetInCombatState(bool PvP, Unit* enemy)
{ {
// only alive units can be in combat // only alive units can be in combat
if (!isAlive()) if (!IsAlive())
return; return;
if (PvP) if (PvP)
@ -8371,7 +8371,7 @@ void Unit::ClearInCombat()
((Player*)this)->UpdatePotionCooldown(); ((Player*)this)->UpdatePotionCooldown();
} }
bool Unit::isTargetableForAttack(bool inverseAlive /*=false*/) const bool Unit::IsTargetableForAttack(bool inverseAlive /*=false*/) const
{ {
if (GetTypeId() == TYPEID_PLAYER && ((Player*)this)->isGameMaster()) if (GetTypeId() == TYPEID_PLAYER && ((Player*)this)->isGameMaster())
return false; return false;
@ -8384,7 +8384,7 @@ bool Unit::isTargetableForAttack(bool inverseAlive /*=false*/) const
return false; return false;
// inversealive is needed for some spells which need to be casted at dead targets (aoe) // inversealive is needed for some spells which need to be casted at dead targets (aoe)
if (isAlive() == inverseAlive) if (IsAlive() == inverseAlive)
return false; return false;
return IsInWorld() && !hasUnitState(UNIT_STAT_DIED) && !IsTaxiFlying(); return IsInWorld() && !hasUnitState(UNIT_STAT_DIED) && !IsTaxiFlying();
@ -8454,7 +8454,7 @@ int32 Unit::ModifyPower(Powers power, int32 dVal)
return gain; return gain;
} }
bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, bool detect, bool inVisibleList, bool is3dDistance) const bool Unit::IsVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, bool detect, bool inVisibleList, bool is3dDistance) const
{ {
if (!u || !IsInMap(u)) if (!u || !IsInMap(u))
return false; return false;
@ -8488,13 +8488,13 @@ bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
return false; return false;
// if player is dead then he can't detect anyone in any cases // if player is dead then he can't detect anyone in any cases
if (!u->isAlive()) if (!u->IsAlive())
detect = false; detect = false;
} }
else else
{ {
// all dead creatures/players not visible for any creatures // all dead creatures/players not visible for any creatures
if (!u->isAlive() || !isAlive()) if (!u->IsAlive() || !IsAlive())
return false; return false;
} }
@ -8519,7 +8519,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
// isInvisibleForAlive() those units can only be seen by dead or if other // isInvisibleForAlive() those units can only be seen by dead or if other
// unit is also invisible for alive.. if an isinvisibleforalive unit dies we // unit is also invisible for alive.. if an isinvisibleforalive unit dies we
// should be able to see it too // should be able to see it too
if (u->isAlive() && isAlive() && isInvisibleForAlive() != u->isInvisibleForAlive()) if (u->IsAlive() && IsAlive() && isInvisibleForAlive() != u->isInvisibleForAlive())
if (u->GetTypeId() != TYPEID_PLAYER || !((Player*)u)->isGameMaster()) if (u->GetTypeId() != TYPEID_PLAYER || !((Player*)u)->isGameMaster())
return false; return false;
@ -8675,7 +8675,7 @@ void Unit::UpdateVisibilityAndView()
Aura* aura = (*it); Aura* aura = (*it);
Unit* owner = aura->GetCaster(); Unit* owner = aura->GetCaster();
if (!owner || !isVisibleForOrDetect(owner, this, false)) if (!owner || !IsVisibleForOrDetect(owner, this, false))
{ {
alist.erase(it); alist.erase(it);
RemoveAura(aura); RemoveAura(aura);
@ -9169,7 +9169,7 @@ bool Unit::CanHaveThreatList(bool ignoreAliveState/*=false*/) const
return false; return false;
// only alive units can have threat list // only alive units can have threat list
if (!isAlive() && !ignoreAliveState) if (!IsAlive() && !ignoreAliveState)
return false; return false;
Creature const* creature = ((Creature const*)this); Creature const* creature = ((Creature const*)this);
@ -9305,7 +9305,7 @@ void Unit::FixateTarget(Unit* pVictim)
{ {
if (!pVictim) // Remove Fixation if (!pVictim) // Remove Fixation
m_fixateTargetGuid.Clear(); m_fixateTargetGuid.Clear();
else if (pVictim->isTargetableForAttack()) // Apply Fixation else if (pVictim->IsTargetableForAttack()) // Apply Fixation
m_fixateTargetGuid = pVictim->GetObjectGuid(); m_fixateTargetGuid = pVictim->GetObjectGuid();
// Start attacking the fixated target or the next proper one // Start attacking the fixated target or the next proper one
@ -9334,7 +9334,7 @@ bool Unit::SelectHostileTarget()
MANGOS_ASSERT(GetTypeId() == TYPEID_UNIT); MANGOS_ASSERT(GetTypeId() == TYPEID_UNIT);
if (!this->isAlive()) if (!this->IsAlive())
return false; return false;
// This function only useful once AI has been initialized // This function only useful once AI has been initialized
@ -9352,7 +9352,7 @@ bool Unit::SelectHostileTarget()
else else
{ {
Unit* pFixateTarget = GetMap()->GetUnit(m_fixateTargetGuid); Unit* pFixateTarget = GetMap()->GetUnit(m_fixateTargetGuid);
if (pFixateTarget && pFixateTarget->isAlive() && !IsSecondChoiceTarget(pFixateTarget, true)) if (pFixateTarget && pFixateTarget->IsAlive() && !IsSecondChoiceTarget(pFixateTarget, true))
target = pFixateTarget; target = pFixateTarget;
} }
} }
@ -9367,7 +9367,7 @@ bool Unit::SelectHostileTarget()
for (AuraList::const_reverse_iterator aura = tauntAuras.rbegin(); aura != tauntAuras.rend(); ++aura) for (AuraList::const_reverse_iterator aura = tauntAuras.rbegin(); aura != tauntAuras.rend(); ++aura)
{ {
if ((caster = (*aura)->GetCaster()) && caster->IsInMap(this) && if ((caster = (*aura)->GetCaster()) && caster->IsInMap(this) &&
caster->isTargetableForAttack() && caster->isInAccessablePlaceFor((Creature*)this) && caster->IsTargetableForAttack() && caster->isInAccessablePlaceFor((Creature*)this) &&
!IsSecondChoiceTarget(caster, true)) !IsSecondChoiceTarget(caster, true))
{ {
target = caster; target = caster;
@ -9419,7 +9419,7 @@ bool Unit::SelectHostileTarget()
} }
// no target but something prevent go to evade mode // no target but something prevent go to evade mode
if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_TAUNT)) if (!IsInCombat() || HasAuraType(SPELL_AURA_MOD_TAUNT))
return false; return false;
// last case when creature don't must go to evade mode: // last case when creature don't must go to evade mode:
@ -9430,7 +9430,7 @@ bool Unit::SelectHostileTarget()
{ {
for (AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr) for (AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
{ {
if ((*itr)->IsInMap(this) && (*itr)->isTargetableForAttack() && (*itr)->isInAccessablePlaceFor((Creature*)this)) if ((*itr)->IsInMap(this) && (*itr)->IsTargetableForAttack() && (*itr)->isInAccessablePlaceFor((Creature*)this))
return false; return false;
} }
} }
@ -9773,7 +9773,7 @@ void Unit::ApplyDiminishingAura(DiminishingGroup group, bool apply)
bool Unit::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const bool Unit::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const
{ {
return isVisibleForOrDetect(u, viewPoint, false, inVisibleList, false); return IsVisibleForOrDetect(u, viewPoint, false, inVisibleList, false);
} }
/// returns true if creature can't be seen by alive units /// returns true if creature can't be seen by alive units
@ -10925,7 +10925,7 @@ void Unit::SetFeared(bool apply, ObjectGuid casterGuid, uint32 spellID, uint32 t
GetMotionMaster()->MovementExpired(false); GetMotionMaster()->MovementExpired(false);
if (GetTypeId() != TYPEID_PLAYER && isAlive()) if (GetTypeId() != TYPEID_PLAYER && IsAlive())
{ {
Creature* c = ((Creature*)this); Creature* c = ((Creature*)this);
// restore appropriate movement generator // restore appropriate movement generator
@ -10960,7 +10960,7 @@ void Unit::SetConfused(bool apply, ObjectGuid casterGuid, uint32 spellID)
GetMotionMaster()->MovementExpired(false); GetMotionMaster()->MovementExpired(false);
if (GetTypeId() != TYPEID_PLAYER && isAlive()) if (GetTypeId() != TYPEID_PLAYER && IsAlive())
{ {
// restore appropriate movement generator // restore appropriate movement generator
if (getVictim()) if (getVictim())
@ -11024,7 +11024,7 @@ void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid, uint32 /*spellID*/)
clearUnitState(UNIT_STAT_DIED); clearUnitState(UNIT_STAT_DIED);
if (GetTypeId() != TYPEID_PLAYER && isAlive()) if (GetTypeId() != TYPEID_PLAYER && IsAlive())
{ {
// restore appropriate movement generator // restore appropriate movement generator
if (getVictim()) if (getVictim())
@ -11553,7 +11553,7 @@ uint32 Unit::GetCombatRatingDamageReduction(CombatRating cr, float rate, float c
void Unit::SendThreatUpdate() void Unit::SendThreatUpdate()
{ {
ThreatList const& tlist = getThreatManager().getThreatList(); ThreatList const& tlist = GetThreatManager().getThreatList();
if (uint32 count = tlist.size()) if (uint32 count = tlist.size())
{ {
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Send SMSG_THREAT_UPDATE Message"); DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Send SMSG_THREAT_UPDATE Message");
@ -11571,7 +11571,7 @@ void Unit::SendThreatUpdate()
void Unit::SendHighestThreatUpdate(HostileReference* pHostilReference) void Unit::SendHighestThreatUpdate(HostileReference* pHostilReference)
{ {
ThreatList const& tlist = getThreatManager().getThreatList(); ThreatList const& tlist = GetThreatManager().getThreatList();
if (uint32 count = tlist.size()) if (uint32 count = tlist.size())
{ {
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message"); DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message");

View file

@ -2153,9 +2153,9 @@ class Unit : public WorldObject
MeleeHitOutcome RollMeleeOutcomeAgainst(const Unit* pVictim, WeaponAttackType attType) const; MeleeHitOutcome RollMeleeOutcomeAgainst(const Unit* pVictim, WeaponAttackType attType) const;
MeleeHitOutcome RollMeleeOutcomeAgainst(const Unit* pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const; MeleeHitOutcome RollMeleeOutcomeAgainst(const Unit* pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const;
bool isVendor() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR); } bool IsVendor() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR); }
bool isTrainer() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER); } bool IsTrainer() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER); }
bool isQuestGiver() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } bool IsQuestGiver() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); }
bool isGossip() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } bool isGossip() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); }
bool isTaxi() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER); } bool isTaxi() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER); }
bool isGuildMaster() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PETITIONER); } bool isGuildMaster() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PETITIONER); }
@ -2179,7 +2179,7 @@ class Unit : public WorldObject
bool IsTaxiFlying() const { return hasUnitState(UNIT_STAT_TAXI_FLIGHT); } bool IsTaxiFlying() const { return hasUnitState(UNIT_STAT_TAXI_FLIGHT); }
bool isInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); } bool IsInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); }
void SetInCombatState(bool PvP, Unit* enemy = NULL); void SetInCombatState(bool PvP, Unit* enemy = NULL);
void SetInCombatWith(Unit* enemy); void SetInCombatWith(Unit* enemy);
void ClearInCombat(); void ClearInCombat();
@ -2214,7 +2214,7 @@ class Unit : public WorldObject
bool isFrozen() const; bool isFrozen() const;
bool IsIgnoreUnitState(SpellEntry const* spell, IgnoreUnitState ignoreState); bool IsIgnoreUnitState(SpellEntry const* spell, IgnoreUnitState ignoreState);
bool isTargetableForAttack(bool inversAlive = false) const; bool IsTargetableForAttack(bool inversAlive = false) const;
bool isPassiveToHostile() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); } bool isPassiveToHostile() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); }
virtual bool IsInWater() const; virtual bool IsInWater() const;
@ -2511,8 +2511,8 @@ class Unit : public WorldObject
void SendThreatRemove(HostileReference* pHostileReference); void SendThreatRemove(HostileReference* pHostileReference);
void SendThreatUpdate(); void SendThreatUpdate();
bool isAlive() const { return (m_deathState == ALIVE); }; bool IsAlive() const { return (m_deathState == ALIVE); };
bool isDead() const { return (m_deathState == DEAD || m_deathState == CORPSE); }; bool IsDead() const { return (m_deathState == DEAD || m_deathState == CORPSE); };
DeathState getDeathState() const { return m_deathState; }; DeathState getDeathState() const { return m_deathState; };
virtual void SetDeathState(DeathState s); // overwritten in Creature/Player/Pet virtual void SetDeathState(DeathState s); // overwritten in Creature/Player/Pet
@ -3025,7 +3025,7 @@ class Unit : public WorldObject
void UpdateVisibilityAndView() override; // overwrite WorldObject::UpdateVisibilityAndView() void UpdateVisibilityAndView() override; // overwrite WorldObject::UpdateVisibilityAndView()
// common function for visibility checks for player/creatures with detection code // common function for visibility checks for player/creatures with detection code
bool isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, bool detect, bool inVisibleList = false, bool is3dDistance = true) const; bool IsVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, bool detect, bool inVisibleList = false, bool is3dDistance = true) const;
bool canDetectInvisibilityOf(Unit const* u) const; bool canDetectInvisibilityOf(Unit const* u) const;
void SetPhaseMask(uint32 newPhaseMask, bool update) override;// overwrite WorldObject::SetPhaseMask void SetPhaseMask(uint32 newPhaseMask, bool update) override;// overwrite WorldObject::SetPhaseMask
@ -3050,8 +3050,8 @@ class Unit : public WorldObject
void TauntFadeOut(Unit* taunter); void TauntFadeOut(Unit* taunter);
void FixateTarget(Unit* pVictim); void FixateTarget(Unit* pVictim);
ObjectGuid GetFixateTargetGuid() const { return m_fixateTargetGuid; } ObjectGuid GetFixateTargetGuid() const { return m_fixateTargetGuid; }
ThreatManager& getThreatManager() { return m_ThreatManager; } ThreatManager& GetThreatManager() { return m_ThreatManager; }
ThreatManager const& getThreatManager() const { return m_ThreatManager; } ThreatManager const& GetThreatManager() const { return m_ThreatManager; }
void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); }; void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); };
void removeHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ } void removeHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ }
HostileRefManager& getHostileRefManager() { return m_HostileRefManager; } HostileRefManager& getHostileRefManager() { return m_HostileRefManager; }

View file

@ -113,7 +113,7 @@ class ThreatRefStatusChangeEvent : public UnitBaseEvent
void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; } void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; }
ThreatManager* getThreatManager() const { return iThreatManager; } ThreatManager* GetThreatManager() const { return iThreatManager; }
}; };
//============================================================== //==============================================================

View file

@ -68,7 +68,7 @@ void OutdoorPvPSI::HandlePlayerLeaveZone(Player* player, bool isMainZone)
// Handle case when player returns a silithyst // Handle case when player returns a silithyst
bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 triggerId) bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 triggerId)
{ {
if (player->isGameMaster() || player->isDead()) if (player->isGameMaster() || player->IsDead())
return false; return false;
switch (triggerId) switch (triggerId)

View file

@ -121,7 +121,7 @@ void HostileReference::addThreat(float pMod)
if (isValid() && pMod >= 0) if (isValid() && pMod >= 0)
{ {
Unit* victim_owner = getTarget()->GetOwner(); Unit* victim_owner = getTarget()->GetOwner();
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 getSource()->addThreat(victim_owner, 0.0f); // create a threat to the owner of a pet, if the pet attacks
} }
} }
@ -425,7 +425,7 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho
return; return;
// not to dead and not for dead // not to dead and not for dead
if (!pVictim->isAlive() || !getOwner()->isAlive()) if (!pVictim->IsAlive() || !getOwner()->IsAlive())
return; return;
MANGOS_ASSERT(getOwner()->GetTypeId() == TYPEID_UNIT); MANGOS_ASSERT(getOwner()->GetTypeId() == TYPEID_UNIT);
@ -438,7 +438,7 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho
{ {
if (Unit* redirectedTarget = pVictim->getHostileRefManager().GetThreatRedirectionTarget()) if (Unit* redirectedTarget = pVictim->getHostileRefManager().GetThreatRedirectionTarget())
{ {
if (redirectedTarget != getOwner() && redirectedTarget->isAlive()) if (redirectedTarget != getOwner() && redirectedTarget->IsAlive())
{ {
float redirectedThreat = threat * redirectedMod; float redirectedThreat = threat * redirectedMod;
threat -= redirectedThreat; threat -= redirectedThreat;

View file

@ -298,7 +298,7 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
return false; return false;
return target->GetHealth() * 100 <= health.percent * target->GetMaxHealth(); return target->GetHealth() * 100 <= health.percent * target->GetMaxHealth();
case ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_DEAD: case ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_DEAD:
if (!target || target->GetTypeId() != TYPEID_PLAYER || target->isAlive() || ((Player*)target)->GetDeathTimer() == 0) if (!target || target->GetTypeId() != TYPEID_PLAYER || target->IsAlive() || ((Player*)target)->GetDeathTimer() == 0)
return false; return false;
// flag set == must be same team, not set == different team // flag set == must be same team, not set == different team
return (((Player*)target)->GetTeam() == source->GetTeam()) == (player_dead.own_team_flag != 0); return (((Player*)target)->GetTeam() == source->GetTeam()) == (player_dead.own_team_flag != 0);

View file

@ -486,7 +486,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
std::string msg; std::string msg;
msg = recv_data.ReadString(recv_data.ReadBits(9)); msg = recv_data.ReadString(recv_data.ReadBits(9));
if (!_player->isInCombat()) if (!_player->IsInCombat())
{ {
if (_player->isAFK()) // Already AFK if (_player->isAFK()) // Already AFK
{ {
@ -649,7 +649,7 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
void WorldSession::HandleEmoteOpcode(WorldPacket& recv_data) void WorldSession::HandleEmoteOpcode(WorldPacket& recv_data)
{ {
if (!GetPlayer()->isAlive() || GetPlayer()->hasUnitState(UNIT_STAT_DIED)) if (!GetPlayer()->IsAlive() || GetPlayer()->hasUnitState(UNIT_STAT_DIED))
return; return;
uint32 emote; uint32 emote;
@ -695,7 +695,7 @@ namespace MaNGOS
void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data) void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data)
{ {
if (!GetPlayer()->isAlive()) if (!GetPlayer()->IsAlive())
return; return;
if (!GetPlayer()->CanSpeak()) if (!GetPlayer()->CanSpeak())

View file

@ -63,7 +63,7 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket& recv_data)
return; return;
} }
if (!pEnemy->isAlive()) if (!pEnemy->IsAlive())
{ {
// client can generate swing to known dead target if autoswitch between autoshot and autohit is enabled in client options // client can generate swing to known dead target if autoswitch between autoshot and autohit is enabled in client options
// stop attack state at client // stop attack state at client

View file

@ -465,17 +465,17 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp
if (pMaster->IsControlledByPlayer()) if (pMaster->IsControlledByPlayer())
return; return;
if (pMaster->isInCombat()) if (pMaster->IsInCombat())
pMaster->SetInCombatWith(pEnemy); pMaster->SetInCombatWith(pEnemy);
else else
pMaster->AI()->AttackStart(pEnemy); pMaster->AI()->AttackStart(pEnemy);
break; break;
case LINKING_EVENT_EVADE: case LINKING_EVENT_EVADE:
if (!pMaster->isAlive()) if (!pMaster->IsAlive())
pMaster->Respawn(); pMaster->Respawn();
break; break;
case LINKING_EVENT_RESPAWN: case LINKING_EVENT_RESPAWN:
if (pMaster->isAlive()) if (pMaster->IsAlive())
SetFollowing(pSource, pMaster); SetFollowing(pSource, pMaster);
break; break;
case LINKING_EVENT_DIE: // Nothing linked for this case case LINKING_EVENT_DIE: // Nothing linked for this case
@ -525,37 +525,37 @@ void CreatureLinkingHolder::ProcessSlave(CreatureLinkingEvent eventType, Creatur
if (pSlave->IsControlledByPlayer()) if (pSlave->IsControlledByPlayer())
return; return;
if (pSlave->isInCombat()) if (pSlave->IsInCombat())
pSlave->SetInCombatWith(pEnemy); pSlave->SetInCombatWith(pEnemy);
else else
pSlave->AI()->AttackStart(pEnemy); pSlave->AI()->AttackStart(pEnemy);
} }
break; break;
case LINKING_EVENT_EVADE: case LINKING_EVENT_EVADE:
if (flag & FLAG_DESPAWN_ON_EVADE && pSlave->isAlive()) if (flag & FLAG_DESPAWN_ON_EVADE && pSlave->IsAlive())
pSlave->ForcedDespawn(); pSlave->ForcedDespawn();
if (flag & FLAG_RESPAWN_ON_EVADE && !pSlave->isAlive()) if (flag & FLAG_RESPAWN_ON_EVADE && !pSlave->IsAlive())
pSlave->Respawn(); pSlave->Respawn();
break; break;
case LINKING_EVENT_DIE: case LINKING_EVENT_DIE:
if (flag & FLAG_SELFKILL_ON_DEATH && pSlave->isAlive()) if (flag & FLAG_SELFKILL_ON_DEATH && pSlave->IsAlive())
pSlave->DealDamage(pSlave, pSlave->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); pSlave->DealDamage(pSlave, pSlave->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
if (flag & FLAG_DESPAWN_ON_DEATH && pSlave->isAlive()) if (flag & FLAG_DESPAWN_ON_DEATH && pSlave->IsAlive())
pSlave->ForcedDespawn(); pSlave->ForcedDespawn();
if (flag & FLAG_RESPAWN_ON_DEATH && !pSlave->isAlive()) if (flag & FLAG_RESPAWN_ON_DEATH && !pSlave->IsAlive())
pSlave->Respawn(); pSlave->Respawn();
break; break;
case LINKING_EVENT_RESPAWN: case LINKING_EVENT_RESPAWN:
if (flag & FLAG_RESPAWN_ON_RESPAWN) if (flag & FLAG_RESPAWN_ON_RESPAWN)
{ {
// Additional check to prevent endless loops (in case whole group respawns on first respawn) // Additional check to prevent endless loops (in case whole group respawns on first respawn)
if (!pSlave->isAlive() && pSlave->GetRespawnTime() > time(NULL)) if (!pSlave->IsAlive() && pSlave->GetRespawnTime() > time(NULL))
pSlave->Respawn(); pSlave->Respawn();
} }
else if (flag & FLAG_DESPAWN_ON_RESPAWN && pSlave->isAlive()) else if (flag & FLAG_DESPAWN_ON_RESPAWN && pSlave->IsAlive())
pSlave->ForcedDespawn(); pSlave->ForcedDespawn();
if (flag & FLAG_FOLLOW && pSlave->isAlive() && !pSlave->isInCombat()) if (flag & FLAG_FOLLOW && pSlave->IsAlive() && !pSlave->IsInCombat())
SetFollowing(pSlave, pSource); SetFollowing(pSlave, pSource);
break; break;
@ -635,9 +635,9 @@ bool CreatureLinkingHolder::CanSpawn(Creature* pCreature)
if (pMaster && IsSlaveInRangeOfBoss(pCreature, pMaster, pInfo->searchRange)) if (pMaster && IsSlaveInRangeOfBoss(pCreature, pMaster, pInfo->searchRange))
{ {
if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_DEAD) if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_DEAD)
return pMaster->isAlive(); return pMaster->IsAlive();
else if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_ALIVE) else if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_ALIVE)
return !pMaster->isAlive(); return !pMaster->IsAlive();
else else
return true; return true;
} }
@ -671,7 +671,7 @@ bool CreatureLinkingHolder::TryFollowMaster(Creature* pCreature)
pMaster = pCreature->GetMap()->GetCreature(ObjectGuid(cInfo->GetHighGuid(), cInfo->Entry, pInfo->masterDBGuid)); pMaster = pCreature->GetMap()->GetCreature(ObjectGuid(cInfo->GetHighGuid(), cInfo->Entry, pInfo->masterDBGuid));
} }
if (pMaster && pMaster->isAlive()) if (pMaster && pMaster->IsAlive())
{ {
SetFollowing(pCreature, pMaster); SetFollowing(pCreature, pMaster);
return true; return true;

View file

@ -600,7 +600,7 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return *i_fobj; } WorldObject const& GetFocusObject() const { return *i_fobj; }
bool operator()(Player* u) bool operator()(Player* u)
{ {
if (i_fobj->IsFriendlyTo(u) || u->isAlive() || u->IsTaxiFlying()) if (i_fobj->IsFriendlyTo(u) || u->IsAlive() || u->IsTaxiFlying())
return false; return false;
return i_fobj->IsWithinDistInMap(u, i_range); return i_fobj->IsWithinDistInMap(u, i_range);
@ -608,7 +608,7 @@ namespace MaNGOS
bool operator()(Corpse* u); bool operator()(Corpse* u);
bool operator()(Creature* u) bool operator()(Creature* u)
{ {
if (i_fobj->IsFriendlyTo(u) || u->isAlive() || u->IsTaxiFlying() || if (i_fobj->IsFriendlyTo(u) || u->IsAlive() || u->IsTaxiFlying() ||
(u->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0) (u->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0)
return false; return false;
@ -808,7 +808,7 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return *i_obj; } WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u) bool operator()(Unit* u)
{ {
if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp) if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
{ {
i_hp = u->GetMaxHealth() - u->GetHealth(); i_hp = u->GetMaxHealth() - u->GetHealth();
return true; return true;
@ -828,7 +828,7 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return *i_obj; } WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u) bool operator()(Unit* u)
{ {
if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
(u->isCharmed() || u->isFrozen() || u->hasUnitState(UNIT_STAT_CAN_NOT_REACT))) (u->isCharmed() || u->isFrozen() || u->hasUnitState(UNIT_STAT_CAN_NOT_REACT)))
{ {
return true; return true;
@ -847,7 +847,7 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return *i_obj; } WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u) bool operator()(Unit* u)
{ {
if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
!(u->HasAura(i_spell, EFFECT_INDEX_0) || u->HasAura(i_spell, EFFECT_INDEX_1) || u->HasAura(i_spell, EFFECT_INDEX_2))) !(u->HasAura(i_spell, EFFECT_INDEX_0) || u->HasAura(i_spell, EFFECT_INDEX_1) || u->HasAura(i_spell, EFFECT_INDEX_2)))
{ {
return true; return true;
@ -870,7 +870,7 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return *i_obj; } WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u) bool operator()(Unit* u)
{ {
if (u->isAlive() && (i_controlledByPlayer ? !i_obj->IsFriendlyTo(u) : i_obj->IsHostileTo(u)) if (u->IsAlive() && (i_controlledByPlayer ? !i_obj->IsFriendlyTo(u) : i_obj->IsHostileTo(u))
&& i_obj->IsWithinDistInMap(u, i_range)) && i_obj->IsWithinDistInMap(u, i_range))
return true; return true;
else else
@ -890,10 +890,10 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return *i_obj; } WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u) bool operator()(Unit* u)
{ {
return u->isAlive() return u->IsAlive()
&& i_obj->IsWithinDistInMap(u, i_range) && i_obj->IsWithinDistInMap(u, i_range)
&& !i_funit->IsFriendlyTo(u) && !i_funit->IsFriendlyTo(u)
&& u->isVisibleForOrDetect(i_funit, i_funit, false); && u->IsVisibleForOrDetect(i_funit, i_funit, false);
} }
private: private:
WorldObject const* i_obj; WorldObject const* i_obj;
@ -908,7 +908,7 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return *i_obj; } WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u) bool operator()(Unit* u)
{ {
if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_obj->IsFriendlyTo(u)) if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_obj->IsFriendlyTo(u))
return true; return true;
else else
return false; return false;
@ -925,7 +925,7 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return *i_obj; } WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u) bool operator()(Unit* u)
{ {
if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range)) if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range))
return true; return true;
return false; return false;
@ -943,8 +943,8 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return *i_obj; } WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u) bool operator()(Unit* u)
{ {
if (u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) && if (u->IsTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) &&
!i_funit->IsFriendlyTo(u) && u->isVisibleForOrDetect(i_funit, i_funit, false)) !i_funit->IsFriendlyTo(u) && u->IsVisibleForOrDetect(i_funit, i_funit, false))
{ {
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
return true; return true;
@ -974,7 +974,7 @@ namespace MaNGOS
bool operator()(Unit* u) bool operator()(Unit* u)
{ {
// Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems // Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems
if (!u->isTargetableForAttack()) if (!u->IsTargetableForAttack())
return false; return false;
// ignore totems as AoE targets // ignore totems as AoE targets
@ -982,7 +982,7 @@ namespace MaNGOS
return false; return false;
// check visibility only for unit-like original casters // check visibility only for unit-like original casters
if (i_targetForUnit && !u->isVisibleForOrDetect((Unit const*)i_originalCaster, i_originalCaster, false)) if (i_targetForUnit && !u->IsVisibleForOrDetect((Unit const*)i_originalCaster, i_originalCaster, false))
return false; return false;
if ((i_targetForPlayer ? !i_originalCaster->IsFriendlyTo(u) : i_originalCaster->IsHostileTo(u)) && i_obj->IsWithinDistInMap(u, i_range)) if ((i_targetForPlayer ? !i_originalCaster->IsFriendlyTo(u) : i_originalCaster->IsHostileTo(u)) && i_obj->IsWithinDistInMap(u, i_range))
@ -1010,7 +1010,7 @@ namespace MaNGOS
bool operator()(Unit* u) bool operator()(Unit* u)
{ {
// Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems // Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems
if (!u->isTargetableForAttack()) if (!u->IsTargetableForAttack())
return false; return false;
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->IsTotem()) if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->IsTotem())
@ -1048,7 +1048,7 @@ namespace MaNGOS
public: public:
explicit AnyDeadUnitCheck(WorldObject const* fobj) : i_fobj(fobj) {} explicit AnyDeadUnitCheck(WorldObject const* fobj) : i_fobj(fobj) {}
WorldObject const& GetFocusObject() const { return *i_fobj; } WorldObject const& GetFocusObject() const { return *i_fobj; }
bool operator()(Unit* u) { return !u->isAlive(); } bool operator()(Unit* u) { return !u->IsAlive(); }
private: private:
WorldObject const* i_fobj; WorldObject const* i_fobj;
}; };
@ -1072,7 +1072,7 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return *i_funit; } WorldObject const& GetFocusObject() const { return *i_funit; }
bool operator()(Creature* u) bool operator()(Creature* u)
{ {
if (u->isAlive() && u->IsHostileTo(i_funit) && i_funit->IsWithinDistInMap(u, u->GetAttackDistance(i_funit))) if (u->IsAlive() && u->IsHostileTo(i_funit) && i_funit->IsWithinDistInMap(u, u->GetAttackDistance(i_funit)))
return true; return true;
return false; return false;
@ -1138,7 +1138,7 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return i_obj; } WorldObject const& GetFocusObject() const { return i_obj; }
bool operator()(Creature* u) bool operator()(Creature* u)
{ {
if (u->GetEntry() == i_entry && ((i_onlyAlive && u->isAlive()) || (i_onlyDead && u->IsCorpse()) || (!i_onlyAlive && !i_onlyDead)) if (u->GetEntry() == i_entry && ((i_onlyAlive && u->IsAlive()) || (i_onlyDead && u->IsCorpse()) || (!i_onlyAlive && !i_onlyDead))
&& (!i_excludeSelf || &i_obj != u) && i_obj.IsWithinDistInMap(u, i_range)) && (!i_excludeSelf || &i_obj != u) && i_obj.IsWithinDistInMap(u, i_range))
{ {
i_range = i_obj.GetDistance(u); // use found unit range as new range limit for next check i_range = i_obj.GetDistance(u); // use found unit range as new range limit for next check
@ -1190,7 +1190,7 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return *i_obj; } WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Player* u) bool operator()(Player* u)
{ {
if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range)) if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range))
return true; return true;
return false; return false;
@ -1208,7 +1208,7 @@ namespace MaNGOS
WorldObject const& GetFocusObject() const { return *i_obj; } WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Player* u) bool operator()(Player* u)
{ {
return u->isAlive() return u->IsAlive()
&& i_obj->IsWithinDistInMap(u, i_range) && i_obj->IsWithinDistInMap(u, i_range)
&& u->HasAura(i_spellId); && u->HasAura(i_spellId);
} }

View file

@ -81,13 +81,13 @@ inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2)
inline void MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType& m) inline void MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType& m)
{ {
if (!i_player.isAlive() || i_player.IsTaxiFlying()) if (!i_player.IsAlive() || i_player.IsTaxiFlying())
return; return;
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{ {
Creature* c = iter->getSource(); Creature* c = iter->getSource();
if (c->isAlive()) if (c->IsAlive())
PlayerCreatureRelocationWorker(&i_player, c); PlayerCreatureRelocationWorker(&i_player, c);
} }
} }
@ -95,13 +95,13 @@ inline void MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType& m)
template<> template<>
inline void MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType& m) inline void MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType& m)
{ {
if (!i_creature.isAlive()) if (!i_creature.IsAlive())
return; return;
for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter) for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{ {
Player* player = iter->getSource(); Player* player = iter->getSource();
if (player->isAlive() && !player->IsTaxiFlying()) if (player->IsAlive() && !player->IsTaxiFlying())
PlayerCreatureRelocationWorker(player, &i_creature); PlayerCreatureRelocationWorker(player, &i_creature);
} }
} }
@ -109,20 +109,20 @@ inline void MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType& m)
template<> template<>
inline void MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType& m) inline void MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType& m)
{ {
if (!i_creature.isAlive()) if (!i_creature.IsAlive())
return; return;
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{ {
Creature* c = iter->getSource(); Creature* c = iter->getSource();
if (c != &i_creature && c->isAlive()) if (c != &i_creature && c->IsAlive())
CreatureCreatureRelocationWorker(c, &i_creature); CreatureCreatureRelocationWorker(c, &i_creature);
} }
} }
inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
{ {
if (!target->isAlive() || target->IsTaxiFlying()) if (!target->IsAlive() || target->IsTaxiFlying())
return; return;
if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsTotem()) if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsTotem())

View file

@ -997,7 +997,7 @@ void Group::GetDataForXPAtKill(Unit const* victim, uint32& count, uint32& sum_le
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{ {
Player* member = itr->getSource(); Player* member = itr->getSource();
if (!member || !member->isAlive()) // only for alive if (!member || !member->IsAlive()) // only for alive
continue; continue;
// will proccesed later // will proccesed later
@ -1890,7 +1890,7 @@ void Group::_homebindIfInstance(Player* player)
static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 count, bool PvP, float group_rate, uint32 sum_level, bool is_dungeon, Player* not_gray_member_with_max_level, Player* member_with_max_level, uint32 xp) static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 count, bool PvP, float group_rate, uint32 sum_level, bool is_dungeon, Player* not_gray_member_with_max_level, Player* member_with_max_level, uint32 xp)
{ {
// honor can be in PvP and !PvP (racial leader) cases (for alive) // honor can be in PvP and !PvP (racial leader) cases (for alive)
if (pGroupGuy->isAlive()) if (pGroupGuy->IsAlive())
pGroupGuy->RewardHonor(pVictim, count); pGroupGuy->RewardHonor(pVictim, count);
// xp and reputation only in !PvP case // xp and reputation only in !PvP case
@ -1903,7 +1903,7 @@ static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 co
pGroupGuy->RewardReputation(pVictim, is_dungeon ? 1.0f : rate); pGroupGuy->RewardReputation(pVictim, is_dungeon ? 1.0f : rate);
// XP updated only for alive group member // XP updated only for alive group member
if (pGroupGuy->isAlive() && not_gray_member_with_max_level && if (pGroupGuy->IsAlive() && not_gray_member_with_max_level &&
pGroupGuy->getLevel() <= not_gray_member_with_max_level->getLevel()) pGroupGuy->getLevel() <= not_gray_member_with_max_level->getLevel())
{ {
uint32 itr_xp = (member_with_max_level == not_gray_member_with_max_level) ? uint32(xp * rate) : uint32((xp * rate / 2) + 1); uint32 itr_xp = (member_with_max_level == not_gray_member_with_max_level) ? uint32(xp * rate) : uint32((xp * rate / 2) + 1);
@ -1914,7 +1914,7 @@ static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 co
} }
// quest objectives updated only for alive group member or dead but with not released body // quest objectives updated only for alive group member or dead but with not released body
if (pGroupGuy->isAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if (pGroupGuy->IsAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
{ {
// normal creature (not pet/etc) can be only in !PvP case // normal creature (not pet/etc) can be only in !PvP case
if (pVictim->GetTypeId() == TYPEID_UNIT) if (pVictim->GetTypeId() == TYPEID_UNIT)

View file

@ -548,7 +548,7 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket& recv_data)
recv_data >> guid; recv_data >> guid;
if (!GetPlayer()->isAlive()) if (!GetPlayer()->IsAlive())
return; return;
DEBUG_LOG("WORLD: Received opcode CMSG_LIST_INVENTORY"); DEBUG_LOG("WORLD: Received opcode CMSG_LIST_INVENTORY");
@ -890,7 +890,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleSetAmmoOpcode(WorldPacket& recv_data) void WorldSession::HandleSetAmmoOpcode(WorldPacket& recv_data)
{ {
if (!GetPlayer()->isAlive()) if (!GetPlayer()->IsAlive())
{ {
GetPlayer()->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL); GetPlayer()->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL);
return; return;

View file

@ -94,7 +94,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recv_data)
{ {
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid); Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed); bool ok_loot = pCreature && pCreature->IsAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed);
if (!ok_loot || !pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) if (!ok_loot || !pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
{ {
@ -240,7 +240,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/)
{ {
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(guid); Creature* pCreature = GetPlayer()->GetMap()->GetCreature(guid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed); bool ok_loot = pCreature && pCreature->IsAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed);
if (ok_loot && pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) if (ok_loot && pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
pLoot = &pCreature->loot ; pLoot = &pCreature->loot ;
@ -309,7 +309,7 @@ void WorldSession::HandleLootOpcode(WorldPacket& recv_data)
recv_data >> guid; recv_data >> guid;
// Check possible cheat // Check possible cheat
if (!_player->isAlive()) if (!_player->IsAlive())
return; return;
GetPlayer()->SendLoot(guid, LOOT_CORPSE); GetPlayer()->SendLoot(guid, LOOT_CORPSE);
@ -493,7 +493,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
{ {
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid); Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed); bool ok_loot = pCreature && pCreature->IsAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed);
if (!ok_loot || !pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) if (!ok_loot || !pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
return; return;
@ -504,7 +504,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
if (group->GetLooterGuid() == player->GetObjectGuid()) if (group->GetLooterGuid() == player->GetObjectGuid())
group->UpdateLooterGuid(pCreature); group->UpdateLooterGuid(pCreature);
if (loot->isLooted() && !pCreature->isAlive()) if (loot->isLooted() && !pCreature->IsAlive())
{ {
// for example skinning after normal loot // for example skinning after normal loot
pCreature->PrepareBodyLootState(); pCreature->PrepareBodyLootState();

View file

@ -56,7 +56,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
recv_data.read_skip<uint8>(); recv_data.read_skip<uint8>();
if (GetPlayer()->isAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if (GetPlayer()->IsAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
return; return;
// the world update order is sessions, players, creatures // the world update order is sessions, players, creatures
@ -276,7 +276,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
DoLootRelease(lootGuid); DoLootRelease(lootGuid);
// Can not logout if... // Can not logout if...
if (GetPlayer()->isInCombat() || //...is in combat if (GetPlayer()->IsInCombat() || //...is in combat
GetPlayer()->duel || //...is in Duel GetPlayer()->duel || //...is in Duel
//...is jumping ...is falling //...is jumping ...is falling
GetPlayer()->m_movementInfo.HasMovementFlag(MovementFlags(MOVEFLAG_FALLING | MOVEFLAG_FALLINGFAR))) GetPlayer()->m_movementInfo.HasMovementFlag(MovementFlags(MOVEFLAG_FALLING | MOVEFLAG_FALLINGFAR)))
@ -629,7 +629,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data)
ObjectGuid guid; ObjectGuid guid;
recv_data >> guid; recv_data >> guid;
if (GetPlayer()->isAlive()) if (GetPlayer()->IsAlive())
return; return;
// do not allow corpse reclaim in arena // do not allow corpse reclaim in arena
@ -668,7 +668,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recv_data)
recv_data >> guid; recv_data >> guid;
recv_data >> status; recv_data >> status;
if (GetPlayer()->isAlive()) if (GetPlayer()->IsAlive())
return; return;
if (status == 0) if (status == 0)
@ -686,7 +686,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recv_data)
void WorldSession::HandleReturnToGraveyard(WorldPacket& /*recvPacket*/) void WorldSession::HandleReturnToGraveyard(WorldPacket& /*recvPacket*/)
{ {
Player* pPlayer = GetPlayer(); Player* pPlayer = GetPlayer();
if (pPlayer->isAlive() || !pPlayer->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if (pPlayer->IsAlive() || !pPlayer->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
return; return;
WorldSafeLocsEntry const* ClosestGrave = NULL; WorldSafeLocsEntry const* ClosestGrave = NULL;
@ -703,7 +703,7 @@ void WorldSession::HandleReturnToGraveyard(WorldPacket& /*recvPacket*/)
{ {
bool updateVisibility = pPlayer->IsInWorld() && pPlayer->GetCorpse()->GetMapId() == ClosestGrave->map_id; bool updateVisibility = pPlayer->IsInWorld() && pPlayer->GetCorpse()->GetMapId() == ClosestGrave->map_id;
pPlayer->TeleportTo(ClosestGrave->map_id, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, pPlayer->GetOrientation()); pPlayer->TeleportTo(ClosestGrave->map_id, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, pPlayer->GetOrientation());
if (pPlayer->isDead()) // not send if alive, because it used in TeleportTo() if (pPlayer->IsDead()) // not send if alive, because it used in TeleportTo()
{ {
WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4 * 4);// show spirit healer position on minimap WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4 * 4);// show spirit healer position on minimap
data << ClosestGrave->map_id; data << ClosestGrave->map_id;
@ -755,7 +755,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
return; return;
uint32 quest_id = sObjectMgr.GetQuestForAreaTrigger(Trigger_ID); uint32 quest_id = sObjectMgr.GetQuestForAreaTrigger(Trigger_ID);
if (quest_id && player->isAlive() && player->IsActiveQuest(quest_id)) if (quest_id && player->IsAlive() && player->IsActiveQuest(quest_id))
{ {
Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id); Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
if (pQuest) if (pQuest)
@ -795,7 +795,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
return; return;
// ghost resurrected at enter attempt to dungeon with corpse (including fail enter cases) // ghost resurrected at enter attempt to dungeon with corpse (including fail enter cases)
if (!player->isAlive() && targetMapEntry->IsDungeon()) if (!player->IsAlive() && targetMapEntry->IsDungeon())
{ {
int32 corpseMapId = 0; int32 corpseMapId = 0;
if (Corpse* corpse = player->GetCorpse()) if (Corpse* corpse = player->GetCorpse())

View file

@ -556,7 +556,7 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recv_data)
void WorldSession::HandleSummonResponseOpcode(WorldPacket& recv_data) void WorldSession::HandleSummonResponseOpcode(WorldPacket& recv_data)
{ {
if (!_player->isAlive() || _player->isInCombat()) if (!_player->IsAlive() || _player->IsInCombat())
return; return;
ObjectGuid summonerGuid; ObjectGuid summonerGuid;
@ -649,11 +649,11 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
// NOTE: this is actually called many times while falling // NOTE: this is actually called many times while falling
// even after the player has been teleported away // even after the player has been teleported away
// TODO: discard movement packets after the player is rooted // TODO: discard movement packets after the player is rooted
if (plMover->isAlive()) if (plMover->IsAlive())
{ {
plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, plMover->GetMaxHealth()); plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, plMover->GetMaxHealth());
// pl can be alive if GM/etc // pl can be alive if GM/etc
if (!plMover->isAlive()) if (!plMover->IsAlive())
{ {
// change the death state to CORPSE to prevent the death timer from // change the death state to CORPSE to prevent the death timer from
// starting in the next player update // starting in the next player update

View file

@ -482,7 +482,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket& recv_data)
ObjectGuid npcGuid; ObjectGuid npcGuid;
recv_data >> npcGuid; recv_data >> npcGuid;
if (!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive()) if (!GetPlayer()->IsInWorld() || !GetPlayer()->IsAlive())
return; return;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_INNKEEPER); Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_INNKEEPER);
@ -554,7 +554,7 @@ void WorldSession::SendStablePet(ObjectGuid guid)
uint8 num = 0; // counter for place holder uint8 num = 0; // counter for place holder
// not let move dead pet in slot // not let move dead pet in slot
if (pet && pet->isAlive() && pet->getPetType() == HUNTER_PET) if (pet && pet->IsAlive() && pet->getPetType() == HUNTER_PET)
{ {
data << uint32(pet->GetCharmInfo()->GetPetNumber()); data << uint32(pet->GetCharmInfo()->GetPetNumber());
data << uint32(pet->GetEntry()); data << uint32(pet->GetEntry());
@ -630,7 +630,7 @@ void WorldSession::HandleStablePet(WorldPacket& recv_data)
recv_data >> npcGUID; recv_data >> npcGUID;
if (!GetPlayer()->isAlive()) if (!GetPlayer()->IsAlive())
{ {
SendStableResult(STABLE_ERR_STABLE); SendStableResult(STABLE_ERR_STABLE);
return; return;
@ -649,7 +649,7 @@ void WorldSession::HandleStablePet(WorldPacket& recv_data)
Pet* pet = _player->GetPet(); Pet* pet = _player->GetPet();
// can't place in stable dead pet // can't place in stable dead pet
if (!pet || !pet->isAlive() || pet->getPetType() != HUNTER_PET) if (!pet || !pet->IsAlive() || pet->getPetType() != HUNTER_PET)
{ {
SendStableResult(STABLE_ERR_STABLE); SendStableResult(STABLE_ERR_STABLE);
return; return;
@ -737,7 +737,7 @@ void WorldSession::HandleUnstablePet(WorldPacket& recv_data)
} }
Pet* pet = _player->GetPet(); Pet* pet = _player->GetPet();
if (pet && pet->isAlive()) if (pet && pet->IsAlive())
{ {
SendStableResult(STABLE_ERR_STABLE); SendStableResult(STABLE_ERR_STABLE);
return; return;
@ -841,7 +841,7 @@ void WorldSession::HandleStableSwapPet(WorldPacket& recv_data)
} }
// move alive pet to slot or delete dead pet // move alive pet to slot or delete dead pet
pet->Unsummon(pet->isAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED, _player); pet->Unsummon(pet->IsAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED, _player);
// summon unstabled pet // summon unstabled pet
Pet* newpet = new Pet; Pet* newpet = new Pet;

View file

@ -66,7 +66,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data)
return; return;
} }
if (!pet->isAlive()) if (!pet->IsAlive())
return; return;
if (pet->GetTypeId() == TYPEID_PLAYER) if (pet->GetTypeId() == TYPEID_PLAYER)
@ -309,7 +309,7 @@ void WorldSession::HandlePetStopAttack(WorldPacket& recv_data)
return; return;
} }
if (!pet->isAlive()) if (!pet->IsAlive())
return; return;
pet->AttackStop(); pet->AttackStop();

View file

@ -698,7 +698,7 @@ bool WorldSession::CanInteractWithQuestGiver(ObjectGuid guid, char const* descr)
return false; return false;
} }
} }
else if (!_player->isAlive()) else if (!_player->IsAlive())
{ {
DEBUG_LOG("WORLD: %s - %s is dead, requested guid was %s", descr, _player->GetGuidStr().c_str(), guid.GetString().c_str()); DEBUG_LOG("WORLD: %s - %s is dead, requested guid was %s", descr, _player->GetGuidStr().c_str(), guid.GetString().c_str());
return false; return false;

View file

@ -944,7 +944,7 @@ bool ScriptAction::GetScriptProcessTargets(WorldObject* pOrigSource, WorldObject
CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(m_script->buddyEntry); CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(m_script->buddyEntry);
pBuddy = m_map->GetCreature(cinfo->GetObjectGuid(m_script->searchRadiusOrGuid)); pBuddy = m_map->GetCreature(cinfo->GetObjectGuid(m_script->searchRadiusOrGuid));
if (pBuddy && !((Creature*)pBuddy)->isAlive()) if (pBuddy && !((Creature*)pBuddy)->IsAlive())
{ {
sLog.outError(" DB-SCRIPTS: Process table `%s` id %u, command %u has buddy %u by guid %u but buddy is dead, skipping.", m_table, m_script->id, m_script->command, m_script->buddyEntry, m_script->searchRadiusOrGuid); sLog.outError(" DB-SCRIPTS: Process table `%s` id %u, command %u has buddy %u by guid %u but buddy is dead, skipping.", m_table, m_script->id, m_script->command, m_script->buddyEntry, m_script->searchRadiusOrGuid);
return false; return false;
@ -1248,7 +1248,7 @@ bool ScriptAction::HandleScriptStep()
bool failQuest = false; bool failQuest = false;
// Creature must be alive for giving credit // Creature must be alive for giving credit
if (pWorldObject && pWorldObject->GetTypeId() == TYPEID_UNIT && !((Creature*)pWorldObject)->isAlive()) if (pWorldObject && pWorldObject->GetTypeId() == TYPEID_UNIT && !((Creature*)pWorldObject)->IsAlive())
failQuest = true; failQuest = true;
else if (m_script->questExplored.distance != 0 && !pWorldObject->IsWithinDistInMap(pPlayer, float(m_script->questExplored.distance))) else if (m_script->questExplored.distance != 0 && !pWorldObject->IsWithinDistInMap(pPlayer, float(m_script->questExplored.distance)))
failQuest = true; failQuest = true;

View file

@ -1139,9 +1139,9 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
{ {
// can cause back attack (if detected) // can cause back attack (if detected)
if (!m_spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_INITIAL_AGGRO) && !IsPositiveSpell(m_spellInfo->Id) && if (!m_spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_INITIAL_AGGRO) && !IsPositiveSpell(m_spellInfo->Id) &&
m_caster->isVisibleForOrDetect(unit, unit, false)) m_caster->IsVisibleForOrDetect(unit, unit, false))
{ {
if (!unit->isInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI()) if (!unit->IsInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI())
((Creature*)unit)->AI()->AttackedBy(real_caster); ((Creature*)unit)->AI()->AttackedBy(real_caster);
unit->AddThreat(real_caster); unit->AddThreat(real_caster);
@ -1320,7 +1320,7 @@ void Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask)
{ {
// for delayed spells ignore not visible explicit target // for delayed spells ignore not visible explicit target
if (speed > 0.0f && unit == m_targets.getUnitTarget() && if (speed > 0.0f && unit == m_targets.getUnitTarget() &&
!unit->isVisibleForOrDetect(m_caster, m_caster, false)) !unit->IsVisibleForOrDetect(m_caster, m_caster, false))
{ {
realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE);
ResetEffectDamageAndHeal(); ResetEffectDamageAndHeal();
@ -1333,7 +1333,7 @@ void Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask)
// can cause back attack (if detected), stealth removed at Spell::cast if spell break it // can cause back attack (if detected), stealth removed at Spell::cast if spell break it
if (!m_spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_INITIAL_AGGRO) && !IsPositiveSpell(m_spellInfo->Id) && if (!m_spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_INITIAL_AGGRO) && !IsPositiveSpell(m_spellInfo->Id) &&
m_caster->isVisibleForOrDetect(unit, unit, false)) m_caster->IsVisibleForOrDetect(unit, unit, false))
{ {
// use speedup check to avoid re-remove after above lines // use speedup check to avoid re-remove after above lines
if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_NOT_BREAK_STEALTH)) if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_NOT_BREAK_STEALTH))
@ -1345,7 +1345,7 @@ void Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask)
if (!unit->IsStandState() && !unit->hasUnitState(UNIT_STAT_STUNNED)) if (!unit->IsStandState() && !unit->hasUnitState(UNIT_STAT_STUNNED))
unit->SetStandState(UNIT_STAND_STATE_STAND); unit->SetStandState(UNIT_STAND_STATE_STAND);
if (!unit->isInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI()) if (!unit->IsInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI())
unit->AttackedBy(realCaster); unit->AttackedBy(realCaster);
unit->AddThreat(realCaster); unit->AddThreat(realCaster);
@ -1370,7 +1370,7 @@ void Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask)
if (unit->hasUnitState(UNIT_STAT_ATTACK_PLAYER)) if (unit->hasUnitState(UNIT_STAT_ATTACK_PLAYER))
realCaster->SetContestedPvP(); realCaster->SetContestedPvP();
if (unit->isInCombat() && !m_spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_INITIAL_AGGRO)) if (unit->IsInCombat() && !m_spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_INITIAL_AGGRO))
{ {
realCaster->SetInCombatState(unit->GetCombatTimer() > 0); realCaster->SetInCombatState(unit->GetCombatTimer() > 0);
unit->getHostileRefManager().threatAssist(realCaster, 0.0f, m_spellInfo); unit->getHostileRefManager().threatAssist(realCaster, 0.0f, m_spellInfo);
@ -1584,7 +1584,7 @@ bool Spell::IsAliveUnitPresentInTargetList()
Unit* unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); Unit* unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
// either unit is alive and normal spell, or unit dead and deathonly-spell // either unit is alive and normal spell, or unit dead and deathonly-spell
if (unit && (unit->isAlive() != IsDeathOnlySpell(m_spellInfo))) if (unit && (unit->IsAlive() != IsDeathOnlySpell(m_spellInfo)))
needAliveTargetMask &= ~ihit->effectMask; // remove from need alive mask effect that have alive target needAliveTargetMask &= ~ihit->effectMask; // remove from need alive mask effect that have alive target
} }
} }
@ -2045,7 +2045,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
{ {
targetUnitMap.push_back((*iter)); targetUnitMap.push_back((*iter));
} }
else if (i_spellST->type == SPELL_TARGET_TYPE_CREATURE && (*iter)->isAlive()) else if (i_spellST->type == SPELL_TARGET_TYPE_CREATURE && (*iter)->IsAlive())
{ {
targetUnitMap.push_back((*iter)); targetUnitMap.push_back((*iter));
} }
@ -2097,7 +2097,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
{ {
targetUnitMap.push_back((*iter)); targetUnitMap.push_back((*iter));
} }
else if (i_spellST->type == SPELL_TARGET_TYPE_CREATURE && (*iter)->isAlive()) else if (i_spellST->type == SPELL_TARGET_TYPE_CREATURE && (*iter)->IsAlive())
{ {
targetUnitMap.push_back((*iter)); targetUnitMap.push_back((*iter));
} }
@ -2112,7 +2112,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
// remove not targetable units if spell has no script targets // remove not targetable units if spell has no script targets
for (UnitList::iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end();) for (UnitList::iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end();)
{ {
if (!(*itr)->isTargetableForAttack(m_spellInfo->HasAttribute(SPELL_ATTR_EX3_CAST_ON_DEAD))) if (!(*itr)->IsTargetableForAttack(m_spellInfo->HasAttribute(SPELL_ATTR_EX3_CAST_ON_DEAD)))
targetUnitMap.erase(itr++); targetUnitMap.erase(itr++);
else else
++itr; ++itr;
@ -3152,7 +3152,7 @@ void Spell::cancel()
if (ihit->missCondition == SPELL_MISS_NONE) if (ihit->missCondition == SPELL_MISS_NONE)
{ {
Unit* unit = m_caster->GetObjectGuid() == (*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); Unit* unit = m_caster->GetObjectGuid() == (*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if (unit && unit->isAlive()) if (unit && unit->IsAlive())
unit->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid()); unit->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid());
// prevent other effects applying if spell is already interrupted // prevent other effects applying if spell is already interrupted
@ -3835,7 +3835,7 @@ void Spell::finish(bool ok)
{ {
// check m_caster->GetGUID() let load auras at login and speedup most often case // check m_caster->GetGUID() let load auras at login and speedup most often case
Unit* unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); Unit* unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if (unit && unit->isAlive()) if (unit && unit->IsAlive())
{ {
SpellEntry const* auraSpellInfo = (*i)->GetSpellProto(); SpellEntry const* auraSpellInfo = (*i)->GetSpellProto();
SpellEffectIndex auraSpellIdx = (*i)->GetEffIndex(); SpellEffectIndex auraSpellIdx = (*i)->GetEffIndex();
@ -5050,7 +5050,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_DONT_REPORT; return SPELL_FAILED_DONT_REPORT;
if (!m_IsTriggeredSpell && IsNonCombatSpell(m_spellInfo) && if (!m_IsTriggeredSpell && IsNonCombatSpell(m_spellInfo) &&
m_caster->isInCombat() && !m_caster->IsIgnoreUnitState(m_spellInfo, IGNORE_UNIT_COMBAT_STATE)) m_caster->IsInCombat() && !m_caster->IsIgnoreUnitState(m_spellInfo, IGNORE_UNIT_COMBAT_STATE))
return SPELL_FAILED_AFFECTING_COMBAT; return SPELL_FAILED_AFFECTING_COMBAT;
if (m_caster->GetTypeId() == TYPEID_PLAYER && !((Player*)m_caster)->isGameMaster() && if (m_caster->GetTypeId() == TYPEID_PLAYER && !((Player*)m_caster)->isGameMaster() &&
@ -5126,7 +5126,7 @@ SpellCastResult Spell::CheckCast(bool strict)
} }
// Spells like Disengage are allowed only in combat // Spells like Disengage are allowed only in combat
if (!m_caster->isInCombat() && m_spellInfo->HasAttribute(SPELL_ATTR_STOP_ATTACK_TARGET) && m_spellInfo->HasAttribute(SPELL_ATTR_EX2_UNK26)) if (!m_caster->IsInCombat() && m_spellInfo->HasAttribute(SPELL_ATTR_STOP_ATTACK_TARGET) && m_spellInfo->HasAttribute(SPELL_ATTR_EX2_UNK26))
return SPELL_FAILED_CASTER_AURASTATE; return SPELL_FAILED_CASTER_AURASTATE;
SpellClassOptionsEntry const* classOptions = m_spellInfo->GetSpellClassOptions(); SpellClassOptionsEntry const* classOptions = m_spellInfo->GetSpellClassOptions();
@ -5137,7 +5137,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if(auraRestrictions && auraRestrictions->TargetAuraStateNot && target->HasAuraState(AuraState(auraRestrictions->TargetAuraStateNot))) if(auraRestrictions && auraRestrictions->TargetAuraStateNot && target->HasAuraState(AuraState(auraRestrictions->TargetAuraStateNot)))
return SPELL_FAILED_TARGET_AURASTATE; return SPELL_FAILED_TARGET_AURASTATE;
if (!m_IsTriggeredSpell && IsDeathOnlySpell(m_spellInfo) && target->isAlive()) if (!m_IsTriggeredSpell && IsDeathOnlySpell(m_spellInfo) && target->IsAlive())
return SPELL_FAILED_TARGET_NOT_DEAD; return SPELL_FAILED_TARGET_NOT_DEAD;
// Target aura req check if need // Target aura req check if need
@ -5261,7 +5261,7 @@ SpellCastResult Spell::CheckCast(bool strict)
else else
return SPELL_FAILED_NO_PET; return SPELL_FAILED_NO_PET;
} }
else if (!pet->isAlive()) else if (!pet->IsAlive())
return SPELL_FAILED_TARGETS_DEAD; return SPELL_FAILED_TARGETS_DEAD;
break; break;
} }
@ -5374,7 +5374,7 @@ SpellCastResult Spell::CheckCast(bool strict)
} }
// check if target is in combat // check if target is in combat
if (non_caster_target && m_spellInfo->HasAttribute(SPELL_ATTR_EX_NOT_IN_COMBAT_TARGET) && target->isInCombat()) if (non_caster_target && m_spellInfo->HasAttribute(SPELL_ATTR_EX_NOT_IN_COMBAT_TARGET) && target->IsInCombat())
return SPELL_FAILED_TARGET_AFFECTING_COMBAT; return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
} }
// zone check // zone check
@ -5509,7 +5509,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (pTarget->IsWithinDistInMap(m_caster, GetSpellMaxRange(srange))) if (pTarget->IsWithinDistInMap(m_caster, GetSpellMaxRange(srange)))
targetExplicit = (Creature*)pTarget; targetExplicit = (Creature*)pTarget;
} }
else if (i_spellST->type == SPELL_TARGET_TYPE_CREATURE && pTarget->isAlive()) else if (i_spellST->type == SPELL_TARGET_TYPE_CREATURE && pTarget->IsAlive())
{ {
// always use spellMaxRange, in case GetLastRange returned different in a previous pass // always use spellMaxRange, in case GetLastRange returned different in a previous pass
if (pTarget->IsWithinDistInMap(m_caster, GetSpellMaxRange(srange))) if (pTarget->IsWithinDistInMap(m_caster, GetSpellMaxRange(srange)))
@ -5641,7 +5641,7 @@ SpellCastResult Spell::CheckCast(bool strict)
Pet* target = m_caster->GetMap()->GetPet(((Player*)m_caster)->GetSelectionGuid()); Pet* target = m_caster->GetMap()->GetPet(((Player*)m_caster)->GetSelectionGuid());
// alive // alive
if (!target || target->isDead()) if (!target || target->IsDead())
return SPELL_FAILED_BAD_IMPLICIT_TARGETS; return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
// undead // undead
if (target->GetCreatureType() != CREATURE_TYPE_UNDEAD) if (target->GetCreatureType() != CREATURE_TYPE_UNDEAD)
@ -5679,7 +5679,7 @@ SpellCastResult Spell::CheckCast(bool strict)
} }
else if (m_spellInfo->Id == 68996) // Two forms else if (m_spellInfo->Id == 68996) // Two forms
{ {
if (m_caster->isInCombat()) if (m_caster->IsInCombat())
return SPELL_FAILED_AFFECTING_COMBAT; return SPELL_FAILED_AFFECTING_COMBAT;
} }
else if (m_spellInfo->SpellIconID == 156) // Holy Shock else if (m_spellInfo->SpellIconID == 156) // Holy Shock
@ -5711,7 +5711,7 @@ SpellCastResult Spell::CheckCast(bool strict)
break; break;
for (UnitList::iterator itr = targetsCombat.begin(); itr != targetsCombat.end(); ++itr) for (UnitList::iterator itr = targetsCombat.begin(); itr != targetsCombat.end(); ++itr)
if ((*itr)->isInCombat()) if ((*itr)->IsInCombat())
return SPELL_FAILED_TARGET_IN_COMBAT; return SPELL_FAILED_TARGET_IN_COMBAT;
} }
break; break;
@ -5852,7 +5852,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel)) if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel))
return SPELL_FAILED_FOOD_LOWLEVEL; return SPELL_FAILED_FOOD_LOWLEVEL;
if (pet->isInCombat()) if (pet->IsInCombat())
return SPELL_FAILED_AFFECTING_COMBAT; return SPELL_FAILED_AFFECTING_COMBAT;
break; break;
@ -5971,7 +5971,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!pet) if (!pet)
return SPELL_FAILED_NO_PET; return SPELL_FAILED_NO_PET;
if (pet->isAlive()) if (pet->IsAlive())
return SPELL_FAILED_ALREADY_HAVE_SUMMON; return SPELL_FAILED_ALREADY_HAVE_SUMMON;
break; break;
@ -6211,7 +6211,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{ {
// not allow cast fly spells if not have req. skills (all spells is self target) // not allow cast fly spells if not have req. skills (all spells is self target)
// allow always ghost flight spells // allow always ghost flight spells
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isAlive()) if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->IsAlive())
{ {
if (!((Player*)m_caster)->CanStartFlyInArea(m_caster->GetMapId(), zone, area)) if (!((Player*)m_caster)->CanStartFlyInArea(m_caster->GetMapId(), zone, area))
return m_IsTriggeredSpell ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE; return m_IsTriggeredSpell ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE;
@ -6317,18 +6317,18 @@ SpellCastResult Spell::CheckCast(bool strict)
SpellCastResult Spell::CheckPetCast(Unit* target) SpellCastResult Spell::CheckPetCast(Unit* target)
{ {
if (!m_caster->isAlive()) if (!m_caster->IsAlive())
return SPELL_FAILED_CASTER_DEAD; return SPELL_FAILED_CASTER_DEAD;
if (m_caster->IsNonMeleeSpellCasted(false)) // prevent spellcast interruption by another spellcast if (m_caster->IsNonMeleeSpellCasted(false)) // prevent spellcast interruption by another spellcast
return SPELL_FAILED_SPELL_IN_PROGRESS; return SPELL_FAILED_SPELL_IN_PROGRESS;
if (m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo)) if (m_caster->IsInCombat() && IsNonCombatSpell(m_spellInfo))
return SPELL_FAILED_AFFECTING_COMBAT; return SPELL_FAILED_AFFECTING_COMBAT;
if (m_caster->GetTypeId() == TYPEID_UNIT && (((Creature*)m_caster)->IsPet() || m_caster->isCharmed())) if (m_caster->GetTypeId() == TYPEID_UNIT && (((Creature*)m_caster)->IsPet() || m_caster->isCharmed()))
{ {
// dead owner (pets still alive when owners ressed?) // dead owner (pets still alive when owners ressed?)
if (m_caster->GetCharmerOrOwner() && !m_caster->GetCharmerOrOwner()->isAlive()) if (m_caster->GetCharmerOrOwner() && !m_caster->GetCharmerOrOwner()->IsAlive())
return SPELL_FAILED_CASTER_DEAD; return SPELL_FAILED_CASTER_DEAD;
if (!target && m_targets.getUnitTarget()) if (!target && m_targets.getUnitTarget())
@ -6362,7 +6362,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
// for target dead/target not valid // for target dead/target not valid
if (_target && m_targets.m_targetMask & TARGET_FLAG_UNIT) if (_target && m_targets.m_targetMask & TARGET_FLAG_UNIT)
{ {
if (!_target->isTargetableForAttack()) if (!_target->IsTargetableForAttack())
return SPELL_FAILED_BAD_TARGETS; // guessed error return SPELL_FAILED_BAD_TARGETS; // guessed error
if (IsPositiveSpell(m_spellInfo->Id)) if (IsPositiveSpell(m_spellInfo->Id))
@ -7744,7 +7744,7 @@ void Spell::FillRaidOrPartyManaPriorityTargets(UnitList& targetUnitMap, Unit* me
PrioritizeManaUnitQueue manaUsers; PrioritizeManaUnitQueue manaUsers;
for (UnitList::const_iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end(); ++itr) for (UnitList::const_iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end(); ++itr)
if ((*itr)->getPowerType() == POWER_MANA && !(*itr)->isDead()) if ((*itr)->getPowerType() == POWER_MANA && !(*itr)->IsDead())
manaUsers.push(PrioritizeManaUnitWraper(*itr)); manaUsers.push(PrioritizeManaUnitWraper(*itr));
targetUnitMap.clear(); targetUnitMap.clear();
@ -7761,7 +7761,7 @@ void Spell::FillRaidOrPartyHealthPriorityTargets(UnitList& targetUnitMap, Unit*
PrioritizeHealthUnitQueue healthQueue; PrioritizeHealthUnitQueue healthQueue;
for (UnitList::const_iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end(); ++itr) for (UnitList::const_iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end(); ++itr)
if (!(*itr)->isDead()) if (!(*itr)->IsDead())
healthQueue.push(PrioritizeHealthUnitWraper(*itr)); healthQueue.push(PrioritizeHealthUnitWraper(*itr));
targetUnitMap.clear(); targetUnitMap.clear();

View file

@ -743,7 +743,7 @@ namespace MaNGOS
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{ {
Player* pPlayer = itr->getSource(); Player* pPlayer = itr->getSource();
if (!pPlayer->isAlive() || pPlayer->IsTaxiFlying()) if (!pPlayer->IsAlive() || pPlayer->IsTaxiFlying())
continue; continue;
if (i_originalCaster->IsFriendlyTo(pPlayer)) if (i_originalCaster->IsFriendlyTo(pPlayer))
@ -825,7 +825,7 @@ namespace MaNGOS
{ {
// there are still more spells which can be casted on dead, but // there are still more spells which can be casted on dead, but
// they are no AOE and don't have such a nice SPELL_ATTR flag // they are no AOE and don't have such a nice SPELL_ATTR flag
if ((i_TargetType != SPELL_TARGETS_ALL && !itr->getSource()->isTargetableForAttack(i_spell.m_spellInfo->HasAttribute(SPELL_ATTR_EX3_CAST_ON_DEAD))) if ((i_TargetType != SPELL_TARGETS_ALL && !itr->getSource()->IsTargetableForAttack(i_spell.m_spellInfo->HasAttribute(SPELL_ATTR_EX3_CAST_ON_DEAD)))
// mostly phase check // mostly phase check
|| !itr->getSource()->IsInMap(i_originalCaster)) || !itr->getSource()->IsInMap(i_originalCaster))
continue; continue;

View file

@ -668,12 +668,12 @@ void AreaAura::Update(uint32 diff)
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{ {
Player* Target = itr->getSource(); Player* Target = itr->getSource();
if (Target && Target->isAlive() && Target->GetSubGroup() == subgroup && caster->IsFriendlyTo(Target)) if (Target && Target->IsAlive() && Target->GetSubGroup() == subgroup && caster->IsFriendlyTo(Target))
{ {
if (caster->IsWithinDistInMap(Target, m_radius)) if (caster->IsWithinDistInMap(Target, m_radius))
targets.push_back(Target); targets.push_back(Target);
Pet* pet = Target->GetPet(); Pet* pet = Target->GetPet();
if (pet && pet->isAlive() && caster->IsWithinDistInMap(pet, m_radius)) if (pet && pet->IsAlive() && caster->IsWithinDistInMap(pet, m_radius))
targets.push_back(pet); targets.push_back(pet);
} }
} }
@ -702,12 +702,12 @@ void AreaAura::Update(uint32 diff)
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{ {
Player* Target = itr->getSource(); Player* Target = itr->getSource();
if (Target && Target->isAlive() && caster->IsFriendlyTo(Target)) if (Target && Target->IsAlive() && caster->IsFriendlyTo(Target))
{ {
if (caster->IsWithinDistInMap(Target, m_radius)) if (caster->IsWithinDistInMap(Target, m_radius))
targets.push_back(Target); targets.push_back(Target);
Pet* pet = Target->GetPet(); Pet* pet = Target->GetPet();
if (pet && pet->isAlive() && caster->IsWithinDistInMap(pet, m_radius)) if (pet && pet->IsAlive() && caster->IsWithinDistInMap(pet, m_radius))
targets.push_back(pet); targets.push_back(pet);
} }
} }
@ -1266,7 +1266,7 @@ void Aura::TriggerSpell()
Cell::VisitGridObjects(triggerTarget, searcher, 15.0f); Cell::VisitGridObjects(triggerTarget, searcher, 15.0f);
for (std::list<Creature*>::const_iterator itr = lList.begin(); itr != lList.end(); ++itr) for (std::list<Creature*>::const_iterator itr = lList.begin(); itr != lList.end(); ++itr)
if ((*itr)->isAlive()) if ((*itr)->IsAlive())
(*itr)->AddThreat(triggerTarget, float(5000)); (*itr)->AddThreat(triggerTarget, float(5000));
return; return;
@ -1282,13 +1282,13 @@ void Aura::TriggerSpell()
if (target->GetTypeId() != TYPEID_UNIT) if (target->GetTypeId() != TYPEID_UNIT)
return; return;
ThreatList const& tList = target->getThreatManager().getThreatList(); ThreatList const& tList = target->GetThreatManager().getThreatList();
for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr)
{ {
Unit* pUnit = target->GetMap()->GetUnit((*itr)->getUnitGuid()); Unit* pUnit = target->GetMap()->GetUnit((*itr)->getUnitGuid());
if (pUnit && target->getThreatManager().getThreat(pUnit)) if (pUnit && target->GetThreatManager().getThreat(pUnit))
target->getThreatManager().modifyThreatPercent(pUnit, -100); target->GetThreatManager().modifyThreatPercent(pUnit, -100);
} }
if (Unit* pEnemy = target->SelectRandomUnfriendlyTarget(target->getVictim(), 100.0f)) if (Unit* pEnemy = target->SelectRandomUnfriendlyTarget(target->getVictim(), 100.0f))
@ -1819,7 +1819,7 @@ void Aura::TriggerSpell()
case 69012: // Explosive Barrage case 69012: // Explosive Barrage
{ {
// Summon an Exploding Orb for each player in combat with the caster // Summon an Exploding Orb for each player in combat with the caster
ThreatList const& threatList = target->getThreatManager().getThreatList(); ThreatList const& threatList = target->GetThreatManager().getThreatList();
for (ThreatList::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) for (ThreatList::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
{ {
if (Unit* expectedTarget = target->GetMap()->GetUnit((*itr)->getUnitGuid())) if (Unit* expectedTarget = target->GetMap()->GetUnit((*itr)->getUnitGuid()))
@ -2627,10 +2627,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
// AT REMOVE // AT REMOVE
else else
{ {
if (IsQuestTameSpell(GetId()) && target->isAlive()) if (IsQuestTameSpell(GetId()) && target->IsAlive())
{ {
Unit* caster = GetCaster(); Unit* caster = GetCaster();
if (!caster || !caster->isAlive()) if (!caster || !caster->IsAlive())
return; return;
uint32 finalSpellId = 0; uint32 finalSpellId = 0;
@ -4721,7 +4721,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
if (!target->hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect if (!target->hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect
{ {
if (target->getVictim() && target->isAlive()) if (target->getVictim() && target->IsAlive())
target->SetTargetGuid(target->getVictim()->GetObjectGuid()); target->SetTargetGuid(target->getVictim()->GetObjectGuid());
target->SetRoot(false); target->SetRoot(false);
@ -4996,7 +4996,7 @@ void Aura::HandleAuraModRoot(bool apply, bool Real)
if (!target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect if (!target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect
{ {
if (target->getVictim() && target->isAlive()) if (target->getVictim() && target->IsAlive())
target->SetTargetGuid(target->getVictim()->GetObjectGuid()); target->SetTargetGuid(target->getVictim()->GetObjectGuid());
if (target->GetTypeId() == TYPEID_PLAYER) if (target->GetTypeId() == TYPEID_PLAYER)
@ -5041,7 +5041,7 @@ void Aura::HandleModThreat(bool apply, bool Real)
Unit* target = GetTarget(); Unit* target = GetTarget();
if (!target->isAlive()) if (!target->IsAlive())
return; return;
int level_diff = 0; int level_diff = 0;
@ -5077,12 +5077,12 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real)
Unit* target = GetTarget(); Unit* target = GetTarget();
if (!target->isAlive() || target->GetTypeId() != TYPEID_PLAYER) if (!target->IsAlive() || target->GetTypeId() != TYPEID_PLAYER)
return; return;
Unit* caster = GetCaster(); Unit* caster = GetCaster();
if (!caster || !caster->isAlive()) if (!caster || !caster->IsAlive())
return; return;
float threatMod = apply ? float(m_modifier.m_amount) : float(-m_modifier.m_amount); float threatMod = apply ? float(m_modifier.m_amount) : float(-m_modifier.m_amount);
@ -5098,12 +5098,12 @@ void Aura::HandleModTaunt(bool apply, bool Real)
Unit* target = GetTarget(); Unit* target = GetTarget();
if (!target->isAlive() || !target->CanHaveThreatList()) if (!target->IsAlive() || !target->CanHaveThreatList())
return; return;
Unit* caster = GetCaster(); Unit* caster = GetCaster();
if (!caster || !caster->isAlive()) if (!caster || !caster->IsAlive())
return; return;
if (apply) if (apply)
@ -7365,7 +7365,7 @@ void Aura::PeriodicTick()
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
{ {
// don't damage target if not alive, possible death persistent effects // don't damage target if not alive, possible death persistent effects
if (!target->isAlive()) if (!target->IsAlive())
return; return;
Unit* pCaster = GetCaster(); Unit* pCaster = GetCaster();
@ -7520,14 +7520,14 @@ void Aura::PeriodicTick()
case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
{ {
// don't damage target if not alive, possible death persistent effects // don't damage target if not alive, possible death persistent effects
if (!target->isAlive()) if (!target->IsAlive())
return; return;
Unit* pCaster = GetCaster(); Unit* pCaster = GetCaster();
if (!pCaster) if (!pCaster)
return; return;
if (!pCaster->isAlive()) if (!pCaster->IsAlive())
return; return;
if( spellProto->GetSpellEffectIdByIndex(GetEffIndex()) == SPELL_EFFECT_PERSISTENT_AREA_AURA && if( spellProto->GetSpellEffectIdByIndex(GetEffIndex()) == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
@ -7592,7 +7592,7 @@ void Aura::PeriodicTick()
pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, pdamage, BASE_ATTACK, spellProto); pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, pdamage, BASE_ATTACK, spellProto);
int32 new_damage = pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, false); int32 new_damage = pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, false);
if (!target->isAlive() && pCaster->IsNonMeleeSpellCasted(false)) if (!target->IsAlive() && pCaster->IsNonMeleeSpellCasted(false))
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
if (Spell* spell = pCaster->GetCurrentSpell(CurrentSpellTypes(i))) if (Spell* spell = pCaster->GetCurrentSpell(CurrentSpellTypes(i)))
if (spell->m_spellInfo->Id == GetId()) if (spell->m_spellInfo->Id == GetId())
@ -7614,7 +7614,7 @@ void Aura::PeriodicTick()
case SPELL_AURA_OBS_MOD_HEALTH: case SPELL_AURA_OBS_MOD_HEALTH:
{ {
// don't heal target if not alive, mostly death persistent effects from items // don't heal target if not alive, mostly death persistent effects from items
if (!target->isAlive()) if (!target->IsAlive())
return; return;
Unit* pCaster = GetCaster(); Unit* pCaster = GetCaster();
@ -7622,7 +7622,7 @@ void Aura::PeriodicTick()
return; return;
// heal for caster damage (must be alive) // heal for caster damage (must be alive)
if (target != pCaster && spellProto->SpellVisual[0] == 163 && !pCaster->isAlive()) if (target != pCaster && spellProto->SpellVisual[0] == 163 && !pCaster->IsAlive())
return; return;
// ignore non positive values (can be result apply spellmods to aura damage // ignore non positive values (can be result apply spellmods to aura damage
@ -7715,7 +7715,7 @@ void Aura::PeriodicTick()
case SPELL_AURA_PERIODIC_MANA_LEECH: case SPELL_AURA_PERIODIC_MANA_LEECH:
{ {
// don't damage target if not alive, possible death persistent effects // don't damage target if not alive, possible death persistent effects
if (!target->isAlive()) if (!target->IsAlive())
return; return;
if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS) if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS)
@ -7731,7 +7731,7 @@ void Aura::PeriodicTick()
if (!pCaster) if (!pCaster)
return; return;
if (!pCaster->isAlive()) if (!pCaster->IsAlive())
return; return;
if( GetSpellProto()->GetSpellEffectIdByIndex(GetEffIndex()) == SPELL_EFFECT_PERSISTENT_AREA_AURA && if( GetSpellProto()->GetSpellEffectIdByIndex(GetEffIndex()) == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
@ -7832,7 +7832,7 @@ void Aura::PeriodicTick()
case SPELL_AURA_PERIODIC_ENERGIZE: case SPELL_AURA_PERIODIC_ENERGIZE:
{ {
// don't energize target if not alive, possible death persistent effects // don't energize target if not alive, possible death persistent effects
if (!target->isAlive()) if (!target->IsAlive())
return; return;
// ignore non positive values (can be result apply spellmods to aura damage // ignore non positive values (can be result apply spellmods to aura damage
@ -7861,7 +7861,7 @@ void Aura::PeriodicTick()
case SPELL_AURA_OBS_MOD_MANA: case SPELL_AURA_OBS_MOD_MANA:
{ {
// don't energize target if not alive, possible death persistent effects // don't energize target if not alive, possible death persistent effects
if (!target->isAlive()) if (!target->IsAlive())
return; return;
// ignore non positive values (can be result apply spellmods to aura damage // ignore non positive values (can be result apply spellmods to aura damage
@ -7887,7 +7887,7 @@ void Aura::PeriodicTick()
case SPELL_AURA_POWER_BURN_MANA: case SPELL_AURA_POWER_BURN_MANA:
{ {
// don't mana burn target if not alive, possible death persistent effects // don't mana burn target if not alive, possible death persistent effects
if (!target->isAlive()) if (!target->IsAlive())
return; return;
Unit* pCaster = GetCaster(); Unit* pCaster = GetCaster();
@ -7902,7 +7902,7 @@ void Aura::PeriodicTick()
Powers powerType = Powers(m_modifier.m_miscvalue); Powers powerType = Powers(m_modifier.m_miscvalue);
if (!target->isAlive() || target->getPowerType() != powerType) if (!target->IsAlive() || target->getPowerType() != powerType)
return; return;
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
@ -7938,7 +7938,7 @@ void Aura::PeriodicTick()
case SPELL_AURA_MOD_REGEN: case SPELL_AURA_MOD_REGEN:
{ {
// don't heal target if not alive, possible death persistent effects // don't heal target if not alive, possible death persistent effects
if (!target->isAlive()) if (!target->IsAlive())
return; return;
int32 gain = target->ModifyHealth(m_modifier.m_amount); int32 gain = target->ModifyHealth(m_modifier.m_amount);
@ -7949,7 +7949,7 @@ void Aura::PeriodicTick()
case SPELL_AURA_MOD_POWER_REGEN: case SPELL_AURA_MOD_POWER_REGEN:
{ {
// don't energize target if not alive, possible death persistent effects // don't energize target if not alive, possible death persistent effects
if (!target->isAlive()) if (!target->IsAlive())
return; return;
Powers pt = target->getPowerType(); Powers pt = target->getPowerType();

View file

@ -269,7 +269,7 @@ void Spell::EffectUnused(SpellEffectEntry const* /*effect*/)
void Spell::EffectResurrectNew(SpellEffectEntry const* effect) void Spell::EffectResurrectNew(SpellEffectEntry const* effect)
{ {
if (!unitTarget || unitTarget->isAlive()) if (!unitTarget || unitTarget->IsAlive())
return; return;
if (unitTarget->GetTypeId() != TYPEID_PLAYER) if (unitTarget->GetTypeId() != TYPEID_PLAYER)
@ -291,7 +291,7 @@ void Spell::EffectResurrectNew(SpellEffectEntry const* effect)
void Spell::EffectInstaKill(SpellEffectEntry const* /*effect*/) void Spell::EffectInstaKill(SpellEffectEntry const* /*effect*/)
{ {
if (!unitTarget || !unitTarget->isAlive()) if (!unitTarget || !unitTarget->IsAlive())
return; return;
if (m_caster == unitTarget) // prevent interrupt message if (m_caster == unitTarget) // prevent interrupt message
@ -327,7 +327,7 @@ void Spell::EffectEnvironmentalDMG(SpellEffectEntry const* effect)
void Spell::EffectSchoolDMG(SpellEffectEntry const* effect) void Spell::EffectSchoolDMG(SpellEffectEntry const* effect)
{ {
if (unitTarget && unitTarget->isAlive()) if (unitTarget && unitTarget->IsAlive())
{ {
SpellClassOptionsEntry const* classOptions = m_spellInfo->GetSpellClassOptions(); SpellClassOptionsEntry const* classOptions = m_spellInfo->GetSpellClassOptions();
@ -1098,8 +1098,8 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
// Spell used by Azuregos to teleport all the players to him // Spell used by Azuregos to teleport all the players to him
// This also resets the target threat // This also resets the target threat
if (m_caster->getThreatManager().getThreat(unitTarget)) if (m_caster->GetThreatManager().getThreat(unitTarget))
m_caster->getThreatManager().modifyThreatPercent(unitTarget, -100); m_caster->GetThreatManager().modifyThreatPercent(unitTarget, -100);
// cast summon player // cast summon player
m_caster->CastSpell(unitTarget, 21150, true); m_caster->CastSpell(unitTarget, 21150, true);
@ -1108,7 +1108,7 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
} }
case 23019: // Crystal Prison Dummy DND case 23019: // Crystal Prison Dummy DND
{ {
if (!unitTarget || !unitTarget->isAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || ((Creature*)unitTarget)->IsPet()) if (!unitTarget || !unitTarget->IsAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || ((Creature*)unitTarget)->IsPet())
return; return;
Creature* creatureTarget = (Creature*)unitTarget; Creature* creatureTarget = (Creature*)unitTarget;
@ -1593,7 +1593,7 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
// Spell can be used in combat and may affect different target than the expected. // Spell can be used in combat and may affect different target than the expected.
// If target is not the expected we need to prevent this effect. // If target is not the expected we need to prevent this effect.
if (pCreature->HasLootRecipient() || pCreature->isInCombat()) if (pCreature->HasLootRecipient() || pCreature->IsInCombat())
return; return;
// set loot recipient, prevent re-use same target // set loot recipient, prevent re-use same target
@ -3376,7 +3376,7 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
// Steady Shot // Steady Shot
if (huntClassOptions && huntClassOptions->SpellFamilyFlags & UI64LIT(0x100000000)) if (huntClassOptions && huntClassOptions->SpellFamilyFlags & UI64LIT(0x100000000))
{ {
if (!unitTarget || !unitTarget->isAlive()) if (!unitTarget || !unitTarget->IsAlive())
return; return;
bool found = false; bool found = false;
@ -3410,7 +3410,7 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
sLog.outError("Spell %u not handled propertly in EffectDummy(Disengage)", m_spellInfo->Id); sLog.outError("Spell %u not handled propertly in EffectDummy(Disengage)", m_spellInfo->Id);
return; return;
} }
if (!target || !target->isAlive()) if (!target || !target->IsAlive())
return; return;
m_caster->CastSpell(target, spellid, true, NULL); m_caster->CastSpell(target, spellid, true, NULL);
} }
@ -4344,7 +4344,7 @@ void Spell::EffectApplyAura(SpellEffectEntry const* effect)
return; return;
// ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load) // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
if ((!unitTarget->isAlive() && !(IsDeathOnlySpell(m_spellInfo) || IsDeathPersistentSpell(m_spellInfo))) && if ((!unitTarget->IsAlive() && !(IsDeathOnlySpell(m_spellInfo) || IsDeathPersistentSpell(m_spellInfo))) &&
(unitTarget->GetTypeId() != TYPEID_PLAYER || !((Player*)unitTarget)->GetSession()->PlayerLoading())) (unitTarget->GetTypeId() != TYPEID_PLAYER || !((Player*)unitTarget)->GetSession()->PlayerLoading()))
return; return;
@ -4388,7 +4388,7 @@ void Spell::EffectPowerDrain(SpellEffectEntry const* effect)
if (!unitTarget) if (!unitTarget)
return; return;
if (!unitTarget->isAlive()) if (!unitTarget->IsAlive())
return; return;
if (unitTarget->getPowerType() != drain_power) if (unitTarget->getPowerType() != drain_power)
return; return;
@ -4449,7 +4449,7 @@ void Spell::EffectPowerBurn(SpellEffectEntry const* effect)
if (!unitTarget) if (!unitTarget)
return; return;
if (!unitTarget->isAlive()) if (!unitTarget->IsAlive())
return; return;
if (unitTarget->getPowerType() != powertype) if (unitTarget->getPowerType() != powertype)
return; return;
@ -4486,7 +4486,7 @@ void Spell::EffectPowerBurn(SpellEffectEntry const* effect)
void Spell::EffectHeal(SpellEffectEntry const* /*effect*/) void Spell::EffectHeal(SpellEffectEntry const* /*effect*/)
{ {
if (unitTarget && unitTarget->isAlive() && damage >= 0) if (unitTarget && unitTarget->IsAlive() && damage >= 0)
{ {
// Try to get original caster // Try to get original caster
Unit* caster = GetAffectiveCaster(); Unit* caster = GetAffectiveCaster();
@ -4596,7 +4596,7 @@ void Spell::EffectHeal(SpellEffectEntry const* /*effect*/)
void Spell::EffectHealPct(SpellEffectEntry const* /*effect*/) void Spell::EffectHealPct(SpellEffectEntry const* /*effect*/)
{ {
if (unitTarget && unitTarget->isAlive() && damage >= 0) if (unitTarget && unitTarget->IsAlive() && damage >= 0)
{ {
// Try to get original caster // Try to get original caster
Unit* caster = GetAffectiveCaster(); Unit* caster = GetAffectiveCaster();
@ -4619,7 +4619,7 @@ void Spell::EffectHealPct(SpellEffectEntry const* /*effect*/)
void Spell::EffectHealMechanical(SpellEffectEntry const* /*effect*/) void Spell::EffectHealMechanical(SpellEffectEntry const* /*effect*/)
{ {
// Mechanic creature type should be correctly checked by targetCreatureType field // Mechanic creature type should be correctly checked by targetCreatureType field
if (unitTarget && unitTarget->isAlive() && damage >= 0) if (unitTarget && unitTarget->IsAlive() && damage >= 0)
{ {
// Try to get original caster // Try to get original caster
Unit* caster = GetAffectiveCaster(); Unit* caster = GetAffectiveCaster();
@ -4640,7 +4640,7 @@ void Spell::EffectHealthLeech(SpellEffectEntry const* effect)
{ {
if (!unitTarget) if (!unitTarget)
return; return;
if (!unitTarget->isAlive()) if (!unitTarget->IsAlive())
return; return;
if (damage < 0) if (damage < 0)
@ -4659,7 +4659,7 @@ void Spell::EffectHealthLeech(SpellEffectEntry const* effect)
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier); modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier);
int32 heal = int32(damage * multiplier); int32 heal = int32(damage * multiplier);
if (m_caster->isAlive()) if (m_caster->IsAlive())
{ {
heal = m_caster->SpellHealingBonusTaken(m_caster, m_spellInfo, heal, HEAL); heal = m_caster->SpellHealingBonusTaken(m_caster, m_spellInfo, heal, HEAL);
@ -4839,7 +4839,7 @@ void Spell::EffectEnergize(SpellEffectEntry const* effect)
{ {
if (!unitTarget) if (!unitTarget)
return; return;
if (!unitTarget->isAlive()) if (!unitTarget->IsAlive())
return; return;
if(effect->EffectMiscValue < 0 || effect->EffectMiscValue >= MAX_POWERS) if(effect->EffectMiscValue < 0 || effect->EffectMiscValue >= MAX_POWERS)
@ -4943,7 +4943,7 @@ void Spell::EffectEnergisePct(SpellEffectEntry const* effect)
{ {
if (!unitTarget) if (!unitTarget)
return; return;
if (!unitTarget->isAlive()) if (!unitTarget->IsAlive())
return; return;
if (effect->EffectMiscValue < 0 || effect->EffectMiscValue >= MAX_POWERS) if (effect->EffectMiscValue < 0 || effect->EffectMiscValue >= MAX_POWERS)
@ -5148,7 +5148,7 @@ void Spell::EffectApplyAreaAura(SpellEffectEntry const* effect)
{ {
if (!unitTarget) if (!unitTarget)
return; return;
if (!unitTarget->isAlive()) if (!unitTarget->IsAlive())
return; return;
AreaAura* Aur = new AreaAura(m_spellInfo, SpellEffectIndex(effect->EffectIndex), &m_currentBasePoints[effect->EffectIndex], m_spellAuraHolder, unitTarget, m_caster, m_CastItem); AreaAura* Aur = new AreaAura(m_spellInfo, SpellEffectIndex(effect->EffectIndex), &m_currentBasePoints[effect->EffectIndex], m_spellAuraHolder, unitTarget, m_caster, m_CastItem);
@ -6000,7 +6000,7 @@ void Spell::EffectPull(SpellEffectEntry const* /*effect*/)
void Spell::EffectDistract(SpellEffectEntry const* /*effect*/) void Spell::EffectDistract(SpellEffectEntry const* /*effect*/)
{ {
// Check for possible target // Check for possible target
if (!unitTarget || unitTarget->isInCombat()) if (!unitTarget || unitTarget->IsInCombat())
return; return;
// target must be OK to do this // target must be OK to do this
@ -6024,7 +6024,7 @@ void Spell::EffectPickPocket(SpellEffectEntry const* /*effect*/)
return; return;
// victim have to be alive and humanoid or undead // victim have to be alive and humanoid or undead
if (unitTarget->isAlive() && (unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) != 0) if (unitTarget->IsAlive() && (unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) != 0)
{ {
int32 chance = 10 + int32(m_caster->getLevel()) - int32(unitTarget->getLevel()); int32 chance = 10 + int32(m_caster->getLevel()) - int32(unitTarget->getLevel());
@ -6421,7 +6421,7 @@ void Spell::EffectSummonPet(SpellEffectEntry const* effect)
if ((petentry == 0 || OldSummon->GetEntry() == petentry) && OldSummon->getPetType() != SUMMON_PET) if ((petentry == 0 || OldSummon->GetEntry() == petentry) && OldSummon->getPetType() != SUMMON_PET)
{ {
// pet in corpse state can't be summoned // pet in corpse state can't be summoned
if (OldSummon->isDead()) if (OldSummon->IsDead())
return; return;
OldSummon->GetMap()->Remove((Creature*)OldSummon, false); OldSummon->GetMap()->Remove((Creature*)OldSummon, false);
@ -6554,7 +6554,7 @@ void Spell::EffectLearnPetSpell(SpellEffectEntry const* effect)
Pet* pet = _player->GetPet(); Pet* pet = _player->GetPet();
if (!pet) if (!pet)
return; return;
if (!pet->isAlive()) if (!pet->IsAlive())
return; return;
SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(effect->EffectTriggerSpell); SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(effect->EffectTriggerSpell);
@ -6587,15 +6587,15 @@ void Spell::EffectTaunt(SpellEffectEntry const* /*effect*/)
} }
// Also use this effect to set the taunter's threat to the taunted creature's highest value // Also use this effect to set the taunter's threat to the taunted creature's highest value
if (unitTarget->CanHaveThreatList() && unitTarget->getThreatManager().getCurrentVictim()) if (unitTarget->CanHaveThreatList() && unitTarget->GetThreatManager().getCurrentVictim())
unitTarget->getThreatManager().addThreat(m_caster, unitTarget->getThreatManager().getCurrentVictim()->getThreat()); unitTarget->GetThreatManager().addThreat(m_caster, unitTarget->GetThreatManager().getCurrentVictim()->getThreat());
} }
void Spell::EffectWeaponDmg(SpellEffectEntry const* effect) void Spell::EffectWeaponDmg(SpellEffectEntry const* effect)
{ {
if (!unitTarget) if (!unitTarget)
return; return;
if (!unitTarget->isAlive()) if (!unitTarget->IsAlive())
return; return;
// multiple weapon dmg effect workaround // multiple weapon dmg effect workaround
@ -6897,7 +6897,7 @@ void Spell::EffectWeaponDmg(SpellEffectEntry const* effect)
void Spell::EffectThreat(SpellEffectEntry const* /*effect*/) void Spell::EffectThreat(SpellEffectEntry const* /*effect*/)
{ {
if (!unitTarget || !unitTarget->isAlive() || !m_caster->isAlive()) if (!unitTarget || !unitTarget->IsAlive() || !m_caster->IsAlive())
return; return;
if (!unitTarget->CanHaveThreatList()) if (!unitTarget->CanHaveThreatList())
@ -6910,7 +6910,7 @@ void Spell::EffectHealMaxHealth(SpellEffectEntry const* /*effect*/)
{ {
if (!unitTarget) if (!unitTarget)
return; return;
if (!unitTarget->isAlive()) if (!unitTarget->IsAlive())
return; return;
uint32 heal = m_caster->GetMaxHealth(); uint32 heal = m_caster->GetMaxHealth();
@ -6922,7 +6922,7 @@ void Spell::EffectInterruptCast(SpellEffectEntry const* /*effect*/)
{ {
if (!unitTarget) if (!unitTarget)
return; return;
if (!unitTarget->isAlive()) if (!unitTarget->IsAlive())
return; return;
// TODO: not all spells that used this effect apply cooldown at school spells // TODO: not all spells that used this effect apply cooldown at school spells
@ -7067,7 +7067,7 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
case 22984: case 22984:
case 22985: case 22985:
{ {
if (!unitTarget || !unitTarget->isAlive()) if (!unitTarget || !unitTarget->IsAlive())
return; return;
// Onyxia Scale Cloak // Onyxia Scale Cloak
@ -9180,7 +9180,7 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
// Judgement (seal trigger) // Judgement (seal trigger)
if (m_spellInfo->GetCategory() == SPELLCATEGORY_JUDGEMENT) if (m_spellInfo->GetCategory() == SPELLCATEGORY_JUDGEMENT)
{ {
if (!unitTarget || !unitTarget->isAlive()) if (!unitTarget || !unitTarget->IsAlive())
return; return;
uint32 spellId1 = 0; uint32 spellId1 = 0;
@ -9789,7 +9789,7 @@ void Spell::EffectFeedPet(SpellEffectEntry const* effect)
if (!pet) if (!pet)
return; return;
if (!pet->isAlive()) if (!pet->IsAlive())
return; return;
int32 benefit = pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel); int32 benefit = pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel);
@ -9811,7 +9811,7 @@ void Spell::EffectDismissPet(SpellEffectEntry const* /*effect*/)
Pet* pet = m_caster->GetPet(); Pet* pet = m_caster->GetPet();
// not let dismiss dead pet // not let dismiss dead pet
if (!pet || !pet->isAlive()) if (!pet || !pet->IsAlive())
return; return;
pet->Unsummon(PET_SAVE_NOT_IN_SLOT, m_caster); pet->Unsummon(PET_SAVE_NOT_IN_SLOT, m_caster);
@ -9871,7 +9871,7 @@ void Spell::EffectResurrect(SpellEffectEntry const* /*effect*/)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return; return;
if (unitTarget->isAlive() || !unitTarget->IsInWorld()) if (unitTarget->IsAlive() || !unitTarget->IsInWorld())
return; return;
switch (m_spellInfo->Id) switch (m_spellInfo->Id)
@ -9915,7 +9915,7 @@ void Spell::EffectResurrect(SpellEffectEntry const* /*effect*/)
void Spell::EffectAddExtraAttacks(SpellEffectEntry const* /*effect*/) void Spell::EffectAddExtraAttacks(SpellEffectEntry const* /*effect*/)
{ {
if (!unitTarget || !unitTarget->isAlive()) if (!unitTarget || !unitTarget->IsAlive())
return; return;
if (unitTarget->m_extraAttacks) if (unitTarget->m_extraAttacks)
@ -10016,7 +10016,7 @@ void Spell::EffectQuestComplete(SpellEffectEntry const* effect)
void Spell::EffectSelfResurrect(SpellEffectEntry const* effect) void Spell::EffectSelfResurrect(SpellEffectEntry const* effect)
{ {
if (!unitTarget || unitTarget->isAlive()) if (!unitTarget || unitTarget->IsAlive())
return; return;
if (unitTarget->GetTypeId() != TYPEID_PLAYER) if (unitTarget->GetTypeId() != TYPEID_PLAYER)
return; return;
@ -10178,7 +10178,7 @@ void Spell::EffectSummonDeadPet(SpellEffectEntry const* /*effect*/)
Pet* pet = _player->GetPet(); Pet* pet = _player->GetPet();
if (!pet) if (!pet)
return; return;
if (pet->isAlive()) if (pet->IsAlive())
return; return;
if (damage < 0) if (damage < 0)
return; return;
@ -10298,7 +10298,7 @@ void Spell::EffectModifyThreatPercent(SpellEffectEntry const* /*effect*/)
if (!unitTarget) if (!unitTarget)
return; return;
unitTarget->getThreatManager().modifyThreatPercent(m_caster, damage); unitTarget->GetThreatManager().modifyThreatPercent(m_caster, damage);
} }
void Spell::EffectTransmitted(SpellEffectEntry const* effect) void Spell::EffectTransmitted(SpellEffectEntry const* effect)
@ -10477,7 +10477,7 @@ void Spell::EffectSkill(SpellEffectEntry const* /*effect*/)
void Spell::EffectSpiritHeal(SpellEffectEntry const* /*effect*/) void Spell::EffectSpiritHeal(SpellEffectEntry const* /*effect*/)
{ {
// TODO player can't see the heal-animation - he should respawn some ticks later // TODO player can't see the heal-animation - he should respawn some ticks later
if (!unitTarget || unitTarget->isAlive()) if (!unitTarget || unitTarget->IsAlive())
return; return;
if (unitTarget->GetTypeId() != TYPEID_PLAYER) if (unitTarget->GetTypeId() != TYPEID_PLAYER)
return; return;
@ -10494,7 +10494,7 @@ void Spell::EffectSpiritHeal(SpellEffectEntry const* /*effect*/)
void Spell::EffectSkinPlayerCorpse(SpellEffectEntry const* /*effect*/) void Spell::EffectSkinPlayerCorpse(SpellEffectEntry const* /*effect*/)
{ {
DEBUG_LOG("Effect: SkinPlayerCorpse"); DEBUG_LOG("Effect: SkinPlayerCorpse");
if ((m_caster->GetTypeId() != TYPEID_PLAYER) || (unitTarget->GetTypeId() != TYPEID_PLAYER) || (unitTarget->isAlive())) if ((m_caster->GetTypeId() != TYPEID_PLAYER) || (unitTarget->GetTypeId() != TYPEID_PLAYER) || (unitTarget->IsAlive()))
return; return;
((Player*)unitTarget)->RemovedInsignia((Player*)m_caster); ((Player*)unitTarget)->RemovedInsignia((Player*)m_caster);

View file

@ -123,7 +123,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
return; return;
} }
if (pUser->isInCombat()) if (pUser->IsInCombat())
{ {
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
{ {
@ -546,7 +546,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
return; return;
} }
if (!pet->isAlive()) if (!pet->IsAlive())
{ {
pet->SendPetActionFeedback(FEEDBACK_PET_DEAD); pet->SendPetActionFeedback(FEEDBACK_PET_DEAD);
return; return;
@ -617,11 +617,11 @@ void WorldSession::HandleSpellClick(WorldPacket& recv_data)
ObjectGuid guid; ObjectGuid guid;
recv_data >> guid; recv_data >> guid;
if (_player->isInCombat()) // client prevent click and set different icon at combat state if (_player->IsInCombat()) // client prevent click and set different icon at combat state
return; return;
Creature* unit = _player->GetMap()->GetAnyTypeCreature(guid); Creature* unit = _player->GetMap()->GetAnyTypeCreature(guid);
if (!unit || unit->isInCombat()) // client prevent click and set different icon at combat state if (!unit || unit->IsInCombat()) // client prevent click and set different icon at combat state
return; return;
SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(unit->GetEntry()); SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(unit->GetEntry());

View file

@ -585,7 +585,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
if (GetPlayer()->m_trade) if (GetPlayer()->m_trade)
return; return;
if (!GetPlayer()->isAlive()) if (!GetPlayer()->IsAlive())
{ {
SendTradeStatus(TRADE_STATUS_YOU_DEAD); SendTradeStatus(TRADE_STATUS_YOU_DEAD);
return; return;
@ -623,7 +623,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
return; return;
} }
if (!pOther->isAlive()) if (!pOther->IsAlive())
{ {
SendTradeStatus(TRADE_STATUS_TARGET_DEAD); SendTradeStatus(TRADE_STATUS_TARGET_DEAD);
return; return;

View file

@ -465,7 +465,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
continue; continue;
} }
if (plr->isDead() && !plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if (plr->IsDead() && !plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
{ {
plr->ResurrectPlayer(1.0); plr->ResurrectPlayer(1.0);
} }

View file

@ -540,7 +540,7 @@ SpellAuraProcResult Unit::HandleHasteAuraProc(Unit* pVictim, uint32 damage, Aura
} }
// default case // default case
if (!target || (target != this && !target->isAlive())) if (!target || (target != this && !target->IsAlive()))
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
if (cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) if (cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
@ -605,7 +605,7 @@ SpellAuraProcResult Unit::HandleSpellCritChanceAuraProc(Unit* pVictim, uint32 /*
} }
// default case // default case
if (!target || (target != this && !target->isAlive())) if (!target || (target != this && !target->IsAlive()))
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
if (cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) if (cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
@ -1196,7 +1196,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit* pVictim, uint32 damage, Aura
// Glyph of Polymorph // Glyph of Polymorph
case 56375: case 56375:
{ {
if (!pVictim || !pVictim->isAlive()) if (!pVictim || !pVictim->IsAlive())
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
pVictim->RemoveSpellsCausingAura(SPELL_AURA_PERIODIC_DAMAGE); pVictim->RemoveSpellsCausingAura(SPELL_AURA_PERIODIC_DAMAGE);
@ -1389,7 +1389,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit* pVictim, uint32 damage, Aura
// Vampiric Touch // Vampiric Touch
if (dummyClassOptions && dummyClassOptions->SpellFamilyFlags & UI64LIT(0x0000040000000000)) if (dummyClassOptions && dummyClassOptions->SpellFamilyFlags & UI64LIT(0x0000040000000000))
{ {
if (!pVictim || !pVictim->isAlive()) if (!pVictim || !pVictim->IsAlive())
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
// pVictim is caster of aura // pVictim is caster of aura
@ -2847,7 +2847,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit* pVictim, uint32 damage, Aura
} }
// default case // default case
if (!target || (target != this && !target->isAlive())) if (!target || (target != this && !target->IsAlive()))
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
if (cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) if (cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
@ -2930,9 +2930,9 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
case 40336: // Mana Drain Trigger case 40336: // Mana Drain Trigger
case 46939: // Black Bow of the Betrayer case 46939: // Black Bow of the Betrayer
// On successful melee or ranged attack gain 8 mana and if possible drain 8 mana from the target. // On successful melee or ranged attack gain 8 mana and if possible drain 8 mana from the target.
if (isAlive()) if (IsAlive())
CastSpell(this, 29471, true, castItem, triggeredByAura); CastSpell(this, 29471, true, castItem, triggeredByAura);
if (pVictim && pVictim->isAlive()) if (pVictim && pVictim->IsAlive())
CastSpell(pVictim, 27526, true, castItem, triggeredByAura); CastSpell(pVictim, 27526, true, castItem, triggeredByAura);
return SPELL_AURA_PROC_OK; return SPELL_AURA_PROC_OK;
case 31255: // Deadly Swiftness (Rank 1) case 31255: // Deadly Swiftness (Rank 1)
@ -3401,7 +3401,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
// Lightning Capacitor // Lightning Capacitor
else if (auraSpellInfo->Id == 37657) else if (auraSpellInfo->Id == 37657)
{ {
if (!pVictim || !pVictim->isAlive()) if (!pVictim || !pVictim->IsAlive())
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
// stacking // stacking
CastSpell(this, 37658, true, NULL, triggeredByAura); CastSpell(this, 37658, true, NULL, triggeredByAura);
@ -3425,7 +3425,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
// Thunder Capacitor // Thunder Capacitor
else if (auraSpellInfo->Id == 54841) else if (auraSpellInfo->Id == 54841)
{ {
if (!pVictim || !pVictim->isAlive()) if (!pVictim || !pVictim->IsAlive())
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
// stacking // stacking
CastSpell(this, 54842, true, NULL, triggeredByAura); CastSpell(this, 54842, true, NULL, triggeredByAura);
@ -3443,7 +3443,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
// Item - Coliseum 25 Normal and Heroic Caster Trinket // Item - Coliseum 25 Normal and Heroic Caster Trinket
else if (auraSpellInfo->Id == 67712 || auraSpellInfo->Id == 67758) else if (auraSpellInfo->Id == 67712 || auraSpellInfo->Id == 67758)
{ {
if (!pVictim || !pVictim->isAlive()) if (!pVictim || !pVictim->IsAlive())
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
uint32 castSpell = auraSpellInfo->Id == 67758 ? 67759 : 67713; uint32 castSpell = auraSpellInfo->Id == 67758 ? 67759 : 67713;
@ -3525,8 +3525,8 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
if (int32(GetHealth()) - int32(damage) >= health30) if (int32(GetHealth()) - int32(damage) >= health30)
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
if (pVictim && pVictim->isAlive()) if (pVictim && pVictim->IsAlive())
pVictim->getThreatManager().modifyThreatPercent(this, -10); pVictim->GetThreatManager().modifyThreatPercent(this, -10);
basepoints[0] = triggerAmount * GetMaxHealth() / 100; basepoints[0] = triggerAmount * GetMaxHealth() / 100;
trigger_spell_id = 31616; trigger_spell_id = 31616;
@ -3767,7 +3767,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
target = !(procFlags & PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL) && IsPositiveSpell(trigger_spell_id) ? this : pVictim; target = !(procFlags & PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL) && IsPositiveSpell(trigger_spell_id) ? this : pVictim;
// default case // default case
if (!target || (target != this && !target->isAlive())) if (!target || (target != this && !target->IsAlive()))
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
if (basepoints[EFFECT_INDEX_0] || basepoints[EFFECT_INDEX_1] || basepoints[EFFECT_INDEX_2]) if (basepoints[EFFECT_INDEX_0] || basepoints[EFFECT_INDEX_1] || basepoints[EFFECT_INDEX_2])
@ -3803,7 +3803,7 @@ SpellAuraProcResult Unit::HandleOverrideClassScriptAuraProc(Unit* pVictim, uint3
{ {
int32 scriptId = triggeredByAura->GetModifier()->m_miscvalue; int32 scriptId = triggeredByAura->GetModifier()->m_miscvalue;
if (!pVictim || !pVictim->isAlive()) if (!pVictim || !pVictim->IsAlive())
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId() == TYPEID_PLAYER Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId() == TYPEID_PLAYER
@ -4174,7 +4174,7 @@ SpellAuraProcResult Unit::HandleManaShieldAuraProc(Unit* pVictim, uint32 /*damag
} }
// default case // default case
if (!target || (target != this && !target->isAlive())) if (!target || (target != this && !target->IsAlive()))
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
if (cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) if (cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))

View file

@ -87,7 +87,7 @@ void usage(const char* prog)
extern int main(int argc, char** argv) extern int main(int argc, char** argv)
{ {
///- Command line parsing ///- Command line parsing
char const* cfg_file = _MANGOSD_CONFIG; char const* cfg_file = MANGOSD_CONFIG_LOCATION;
char const* options = ":a:c:s:"; char const* options = ":a:c:s:";
@ -109,22 +109,22 @@ extern int main(int argc, char** argv)
cfg_file = cmd_opts.opt_arg(); cfg_file = cmd_opts.opt_arg();
break; break;
case 'v': case 'v':
printf("%s\n", MANGOS_FULLVERSION(REVISION_DATE, REVISION_TIME, REVISION_NR, REVISION_ID)); printf("%s\n", REVISION_NR);
return 0; return 0;
case 's': case 's':
{ {
const char* mode = cmd_opts.opt_arg(); const char* mode = cmd_opts.opt_arg();
if (!strcmp(mode, "run")) if (!strcmp(mode, "run"))
serviceDaemonMode = 'r'; { serviceDaemonMode = 'r'; }
#ifdef WIN32 #ifdef WIN32
else if (!strcmp(mode, "install")) else if (!strcmp(mode, "install"))
serviceDaemonMode = 'i'; { serviceDaemonMode = 'i'; }
else if (!strcmp(mode, "uninstall")) else if (!strcmp(mode, "uninstall"))
serviceDaemonMode = 'u'; { serviceDaemonMode = 'u'; }
#else #else
else if (!strcmp(mode, "stop")) else if (!strcmp(mode, "stop"))
serviceDaemonMode = 's'; { serviceDaemonMode = 's'; }
#endif #endif
else else
{ {
@ -153,11 +153,11 @@ extern int main(int argc, char** argv)
{ {
case 'i': case 'i':
if (WinServiceInstall()) if (WinServiceInstall())
sLog.outString("Installing service"); { sLog.outString("Installing service"); }
return 1; return 1;
case 'u': case 'u':
if (WinServiceUninstall()) if (WinServiceUninstall())
sLog.outString("Uninstalling service"); { sLog.outString("Uninstalling service"); }
return 1; return 1;
case 'r': case 'r':
WinServiceRun(); WinServiceRun();
@ -184,7 +184,7 @@ extern int main(int argc, char** argv)
} }
#endif #endif
sLog.outString("%s [world-daemon]", MANGOS_FULLVERSION(REVISION_DATE, REVISION_TIME, REVISION_NR, REVISION_ID)); sLog.outString("%s [world-daemon]", REVISION_NR);
sLog.outString("<Ctrl-C> to stop.\n" sLog.outString("<Ctrl-C> to stop.\n"
" __ __ _ _ ___ ___ ___ \n" " __ __ _ _ ___ ___ ___ \n"
" | \\/ |__ _| \\| |/ __|/ _ \\/ __| \n" " | \\/ |__ _| \\| |/ __|/ _ \\/ __| \n"

View file

@ -46,9 +46,12 @@
#include "RASocket.h" #include "RASocket.h"
#include "Util.h" #include "Util.h"
#include "revision_sql.h" #include "revision_sql.h"
#include "MaNGOSsoap.h"
#include "MassMailMgr.h" #include "MassMailMgr.h"
#include "DBCStores.h" #include "DBCStores.h"
#include "ScriptMgr.h"
#ifdef ENABLE_SOAP
#include "MaNGOSsoap.h"
#endif
#include <ace/OS_NS_signal.h> #include <ace/OS_NS_signal.h>
#include <ace/TP_Reactor.h> #include <ace/TP_Reactor.h>
@ -74,7 +77,7 @@ class FreezeDetectorRunnable : public ACE_Based::Runnable
void run(void) void run(void)
{ {
if (!_delaytime) if (!_delaytime)
return; { return; }
sLog.outString("Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime / 1000); sLog.outString("Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime / 1000);
m_loops = 0; m_loops = 0;
w_loops = 0; w_loops = 0;
@ -151,14 +154,14 @@ class RARunnable : public ACE_Based::Runnable
sLog.outError("MaNGOS RA can not bind to port %d on %s", raport, stringip.c_str()); sLog.outError("MaNGOS RA can not bind to port %d on %s", raport, stringip.c_str());
} }
sLog.outString("Starting Remote access listner on port %d on %s", raport, stringip.c_str()); sLog.outString("Starting Remote access listener on port %d on %s", raport, stringip.c_str());
while (!m_Reactor->reactor_event_loop_done()) while (!m_Reactor->reactor_event_loop_done())
{ {
ACE_Time_Value interval(0, 10000); ACE_Time_Value interval(0, 10000);
if (m_Reactor->run_reactor_event_loop(interval) == -1) if (m_Reactor->run_reactor_event_loop(interval) == -1)
break; { break; }
if (World::IsStopped()) if (World::IsStopped())
{ {
@ -188,7 +191,7 @@ int Master::Run()
uint32 pid = CreatePIDFile(pidfile); uint32 pid = CreatePIDFile(pidfile);
if (!pid) if (!pid)
{ {
sLog.outError("Cannot create PID file %s.\n", pidfile.c_str()); sLog.outError("Can not create PID file %s.\n", pidfile.c_str());
Log::WaitBeforeContinueIfNeed(); Log::WaitBeforeContinueIfNeed();
return 1; return 1;
} }
@ -203,6 +206,9 @@ int Master::Run()
return 1; return 1;
} }
///- Set Realm to Offline, if crash happens. Only used once.
LoginDatabase.DirectPExecute("UPDATE realmlist SET realmflags = realmflags | %u WHERE id = '%u'", REALM_FLAG_OFFLINE, realmID);
///- Initialize the World ///- Initialize the World
sWorld.SetInitialWorldSettings(); sWorld.SetInitialWorldSettings();
@ -269,9 +275,9 @@ int Master::Run()
else else
{ {
if (SetProcessAffinityMask(hProcess, curAff)) if (SetProcessAffinityMask(hProcess, curAff))
sLog.outString("Using processors (bitmask, hex): %x", curAff); { sLog.outString("Using processors (bitmask, hex): %x", curAff); }
else else
sLog.outError("Can't set used processors (hex): %x", curAff); { sLog.outError("Can't set used processors (hex): %x", curAff); }
} }
} }
sLog.outString(); sLog.outString();
@ -283,14 +289,15 @@ int Master::Run()
if (Prio) if (Prio)
{ {
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
sLog.outString("mangosd process priority class set to HIGH"); { sLog.outString("mangosd process priority class set to HIGH"); }
else else
sLog.outError("Can't set mangosd process priority class."); { sLog.outError("Can't set mangosd process priority class."); }
sLog.outString(); sLog.outString();
} }
} }
#endif #endif
#ifdef ENABLE_SOAP
///- Start soap serving thread ///- Start soap serving thread
ACE_Based::Thread* soap_thread = NULL; ACE_Based::Thread* soap_thread = NULL;
@ -301,6 +308,12 @@ int Master::Run()
runnable->setListenArguments(sConfig.GetStringDefault("SOAP.IP", "127.0.0.1"), sConfig.GetIntDefault("SOAP.Port", 7878)); runnable->setListenArguments(sConfig.GetStringDefault("SOAP.IP", "127.0.0.1"), sConfig.GetIntDefault("SOAP.Port", 7878));
soap_thread = new ACE_Based::Thread(runnable); soap_thread = new ACE_Based::Thread(runnable);
} }
#else /* ENABLE_SOAP */
if (sConfig.GetBoolDefault("SOAP.Enabled", false))
{
sLog.outError("SOAP is enabled but wasn't included during compilation, not activating it.");
}
#endif /* ENABLE_SOAP */
///- Start up freeze catcher thread ///- Start up freeze catcher thread
ACE_Based::Thread* freeze_thread = NULL; ACE_Based::Thread* freeze_thread = NULL;
@ -333,6 +346,7 @@ int Master::Run()
delete freeze_thread; delete freeze_thread;
} }
#ifdef ENABLE_SOAP
///- Stop soap thread ///- Stop soap thread
if (soap_thread) if (soap_thread)
{ {
@ -340,6 +354,7 @@ int Master::Run()
soap_thread->destroy(); soap_thread->destroy();
delete soap_thread; delete soap_thread;
} }
#endif
///- Set server offline in realmlist ///- Set server offline in realmlist
LoginDatabase.DirectPExecute("UPDATE realmlist SET realmflags = realmflags | %u WHERE id = '%u'", REALM_FLAG_OFFLINE, realmID); LoginDatabase.DirectPExecute("UPDATE realmlist SET realmflags = realmflags | %u WHERE id = '%u'", REALM_FLAG_OFFLINE, realmID);
@ -421,6 +436,11 @@ int Master::Run()
delete cliThread; delete cliThread;
} }
// This is done to make sure that we cleanup our so file before it's
// unloaded automatically, since the ~ScriptMgr() is called to late
// as it's allocated with static storage.
sScriptMgr.UnloadScriptLibrary();
///- Exit the process with specified return value ///- Exit the process with specified return value
return World::GetExitCode(); return World::GetExitCode();
} }
@ -441,7 +461,7 @@ bool Master::_StartDB()
///- Initialise the world database ///- Initialise the world database
if (!WorldDatabase.Initialize(dbstring.c_str(), nConnections)) if (!WorldDatabase.Initialize(dbstring.c_str(), nConnections))
{ {
sLog.outError("Cannot connect to world database %s", dbstring.c_str()); sLog.outError("Can not connect to world database %s", dbstring.c_str());
return false; return false;
} }
@ -467,7 +487,7 @@ bool Master::_StartDB()
///- Initialise the Character database ///- Initialise the Character database
if (!CharacterDatabase.Initialize(dbstring.c_str(), nConnections)) if (!CharacterDatabase.Initialize(dbstring.c_str(), nConnections))
{ {
sLog.outError("Cannot connect to Character database %s", dbstring.c_str()); sLog.outError("Can not connect to Character database %s", dbstring.c_str());
///- Wait for already started DB delay threads to end ///- Wait for already started DB delay threads to end
WorldDatabase.HaltDelayThread(); WorldDatabase.HaltDelayThread();
@ -499,7 +519,7 @@ bool Master::_StartDB()
sLog.outString("Login Database total connections: %i", nConnections + 1); sLog.outString("Login Database total connections: %i", nConnections + 1);
if (!LoginDatabase.Initialize(dbstring.c_str(), nConnections)) if (!LoginDatabase.Initialize(dbstring.c_str(), nConnections))
{ {
sLog.outError("Cannot connect to login database %s", dbstring.c_str()); sLog.outError("Can not connect to login database %s", dbstring.c_str());
///- Wait for already started DB delay threads to end ///- Wait for already started DB delay threads to end
WorldDatabase.HaltDelayThread(); WorldDatabase.HaltDelayThread();
@ -516,6 +536,8 @@ bool Master::_StartDB()
return false; return false;
} }
sLog.outString();
///- Get the realm Id from the configuration file ///- Get the realm Id from the configuration file
realmID = sConfig.GetIntDefault("RealmID", 0); realmID = sConfig.GetIntDefault("RealmID", 0);
if (!realmID) if (!realmID)
@ -530,6 +552,7 @@ bool Master::_StartDB()
} }
sLog.outString("Realm running as realm ID %d", realmID); sLog.outString("Realm running as realm ID %d", realmID);
sLog.outString();
///- Clean the database before starting ///- Clean the database before starting
clearOnlineAccounts(); clearOnlineAccounts();
@ -538,6 +561,7 @@ bool Master::_StartDB()
sLog.outString("Using World DB: %s", sWorld.GetDBVersion()); sLog.outString("Using World DB: %s", sWorld.GetDBVersion());
sLog.outString("Using creature EventAI: %s", sWorld.GetCreatureEventAIVersion()); sLog.outString("Using creature EventAI: %s", sWorld.GetCreatureEventAIVersion());
sLog.outString();
return true; return true;
} }

View file

@ -26,28 +26,66 @@
/// @{ /// @{
/// \file /// \file
#ifndef _MASTER_H #ifndef MANGOS_H_MASTER
#define _MASTER_H #define MANGOS_H_MASTER
#include "Common.h" #include "Common.h"
#include "Policies/Singleton.h" #include "Policies/Singleton.h"
/// Start the server /**
* @brief Start the server
*
*/
class Master class Master
{ {
public: public:
/**
* @brief
*
*/
Master(); Master();
/**
* @brief
*
*/
~Master(); ~Master();
/**
* @brief
*
* @return int
*/
int Run(); int Run();
static volatile uint32 m_masterLoopCounter; static volatile uint32 m_masterLoopCounter; /**< TODO */
private: private:
/**
* @brief
*
* @return bool
*/
bool _StartDB(); bool _StartDB();
/**
* @brief
*
*/
void _HookSignals(); void _HookSignals();
/**
* @brief
*
*/
void _UnhookSignals(); void _UnhookSignals();
/**
* @brief
*
* @param s
*/
static void _OnSignal(int s); static void _OnSignal(int s);
/**
* @brief
*
*/
void clearOnlineAccounts(); void clearOnlineAccounts();
}; };

View file

@ -138,7 +138,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* pWho)
} }
// experimental (unknown) flag not present // experimental (unknown) flag not present
if (!(m_creature->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_CAN_ASSIST)) if (!(m_creature->GetCreatureInfo()-> type_flags & CREATURE_TYPEFLAGS_CAN_ASSIST))
{ {
return false; return false;
} }

View file

@ -76,7 +76,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* pWho)
} }
// experimental (unknown) flag not present // experimental (unknown) flag not present
if (!(m_creature->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_CAN_ASSIST)) if (!(m_creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_CAN_ASSIST))
{ {
return false; return false;
} }

View file

@ -102,7 +102,7 @@ void ScriptedAI::MoveInLineOfSight(Unit* pWho)
*/ */
void ScriptedAI::AttackStart(Unit* pWho) void ScriptedAI::AttackStart(Unit* pWho)
{ {
if (!m_creature->CanAttackByItself()) if (!m_creature->CanInitiateAttack())
return; return;
if (pWho && m_creature->Attack(pWho, true)) // The Attack function also uses basic checks if pWho can be attacked if (pWho && m_creature->Attack(pWho, true)) // The Attack function also uses basic checks if pWho can be attacked
@ -713,7 +713,7 @@ void Scripted_NoMovementAI::GetAIInformation(ChatHandler& reader)
void Scripted_NoMovementAI::AttackStart(Unit* pWho) void Scripted_NoMovementAI::AttackStart(Unit* pWho)
{ {
if (!m_creature->CanAttackByItself()) if (!m_creature->CanInitiateAttack())
return; return;
if (pWho && m_creature->Attack(pWho, true)) if (pWho && m_creature->Attack(pWho, true))

View file

@ -124,7 +124,7 @@ struct generic_creatureAI : public ScriptedAI
else { info = SelectSpell(m_creature->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); } else { info = SelectSpell(m_creature->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); }
// 50% chance if elite or higher, 20% chance if not, to replace our white hit with a spell // 50% chance if elite or higher, 20% chance if not, to replace our white hit with a spell
if (info && (rand() % (m_creature->GetCreatureInfo()->Rank > 1 ? 2 : 5) == 0) && !GlobalCooldown) if (info && (rand() % (m_creature->GetCreatureInfo()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown)
{ {
// Cast the spell // Cast the spell
if (Healing) { DoCastSpell(m_creature, info); } if (Healing) { DoCastSpell(m_creature, info); }

View file

@ -554,14 +554,6 @@ void AddScripts()
// battlegrounds // battlegrounds
AddSC_battleground(); AddSC_battleground();
// custom
// examples
AddSC_example_creature();
AddSC_example_escort();
AddSC_example_gossip_codebox();
AddSC_example_misc();
// world // world
AddSC_areatrigger_scripts(); AddSC_areatrigger_scripts();
AddSC_bosses_emerald_dragons(); AddSC_bosses_emerald_dragons();

View file

@ -32,11 +32,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "game", "VC120\game.vcxproj"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsoap", "VC120\gsoap.vcxproj", "{53CF48ED-FEFE-4165-A9CA-F000ABC572B6}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsoap", "VC120\gsoap.vcxproj", "{53CF48ED-FEFE-4165-A9CA-F000ABC572B6}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmpq", "VC120\libmpq.vcxproj", "{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}"
ProjectSection(ProjectDependencies) = postProject
{BC139E42-505E-430B-8610-6ED2B1E358E8} = {BC139E42-505E-430B-8610-6ED2B1E358E8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "loadlib", "VC120\loadlib.vcxproj", "{29E1FE24-1C69-4E6B-945D-02544988A5FA}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "loadlib", "VC120\loadlib.vcxproj", "{29E1FE24-1C69-4E6B-945D-02544988A5FA}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{8D3CF9B7-05F2-4BCF-B833-27B279FDEAF3} = {8D3CF9B7-05F2-4BCF-B833-27B279FDEAF3} {8D3CF9B7-05F2-4BCF-B833-27B279FDEAF3} = {8D3CF9B7-05F2-4BCF-B833-27B279FDEAF3}
@ -236,24 +231,6 @@ Global
{53CF48ED-FEFE-4165-A9CA-F000ABC572B6}.ReleaseAS|Win32.ActiveCfg = Release|Win32 {53CF48ED-FEFE-4165-A9CA-F000ABC572B6}.ReleaseAS|Win32.ActiveCfg = Release|Win32
{53CF48ED-FEFE-4165-A9CA-F000ABC572B6}.ReleaseAS|Win32.Build.0 = Release|Win32 {53CF48ED-FEFE-4165-A9CA-F000ABC572B6}.ReleaseAS|Win32.Build.0 = Release|Win32
{53CF48ED-FEFE-4165-A9CA-F000ABC572B6}.ReleaseAS|x64.ActiveCfg = Release|Win32 {53CF48ED-FEFE-4165-A9CA-F000ABC572B6}.ReleaseAS|x64.ActiveCfg = Release|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.Debug|Win32.ActiveCfg = Debug|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.Debug|Win32.Build.0 = Debug|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.Debug|x64.ActiveCfg = Debug|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.DebugAD|Win32.ActiveCfg = Debug|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.DebugAD|Win32.Build.0 = Debug|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.DebugAD|x64.ActiveCfg = Debug|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.DebugAS|Win32.ActiveCfg = Debug|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.DebugAS|Win32.Build.0 = Debug|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.DebugAS|x64.ActiveCfg = Debug|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.Release|Win32.ActiveCfg = Release|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.Release|Win32.Build.0 = Release|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.Release|x64.ActiveCfg = Release|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.ReleaseAD|Win32.ActiveCfg = Release|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.ReleaseAD|Win32.Build.0 = Release|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.ReleaseAD|x64.ActiveCfg = Release|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.ReleaseAS|Win32.ActiveCfg = Release|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.ReleaseAS|Win32.Build.0 = Release|Win32
{449D15D0-B3B9-4195-AB9C-E205FF77ABBE}.ReleaseAS|x64.ActiveCfg = Release|Win32
{29E1FE24-1C69-4E6B-945D-02544988A5FA}.Debug|Win32.ActiveCfg = Debug|Win32 {29E1FE24-1C69-4E6B-945D-02544988A5FA}.Debug|Win32.ActiveCfg = Debug|Win32
{29E1FE24-1C69-4E6B-945D-02544988A5FA}.Debug|Win32.Build.0 = Debug|Win32 {29E1FE24-1C69-4E6B-945D-02544988A5FA}.Debug|Win32.Build.0 = Debug|Win32
{29E1FE24-1C69-4E6B-945D-02544988A5FA}.Debug|x64.ActiveCfg = Debug|Win32 {29E1FE24-1C69-4E6B-945D-02544988A5FA}.Debug|x64.ActiveCfg = Debug|Win32

View file

@ -113,7 +113,7 @@
</Midl> </Midl>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\dep\Stormlib\Stormlib.h" /> <ClCompile Include="..\..\dep\Stormlib\src\Stormlib.h" />
<ClCompile Include="..\..\dep\src\bzip2\blocksort.c" /> <ClCompile Include="..\..\dep\src\bzip2\blocksort.c" />
<ClCompile Include="..\..\dep\src\bzip2\bzlib.c" /> <ClCompile Include="..\..\dep\src\bzip2\bzlib.c" />
<ClCompile Include="..\..\dep\src\bzip2\compress.c" /> <ClCompile Include="..\..\dep\src\bzip2\compress.c" />

View file

@ -85,7 +85,7 @@
</Midl> </Midl>
<Link> <Link>
<AdditionalOptions> /machine:X86 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions> /machine:X86 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;$(Configuration)\game.lib;$(Configuration)\shared.lib;$(Configuration)\framework.lib;$(Configuration)\g3dlite.lib;$(Configuration)\ace.lib;$(Configuration)\gsoap.lib;$(Configuration)\zlib.lib;..\..\dep\lib\win32\libmySQL.lib;..\..\dep\lib\win32\libeay32.lib;$(Configuration)\detour.lib;$(Configuration)\mangosscript.lib;$(Configuration)\LuaEngine.lib;$(Configuration)\lualib.lib</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;$(Configuration)\game.lib;$(Configuration)\shared.lib;$(Configuration)\framework.lib;$(Configuration)\g3dlite.lib;$(Configuration)\ace.lib;$(Configuration)\gsoap.lib;$(Configuration)\zlib.lib;..\..\dep\lib\win32\libmySQL.lib;..\..\dep\lib\win32\libeay32.lib;$(Configuration)\detour.lib;$(Configuration)\mangosscript.lib;</AdditionalDependencies>
<AdditionalLibraryDirectories>../../dep/acelite/ace;../../dep/acelite/ace/$(Configuration);;../../src/mangosd/$(Configuration);../../src/mangosd/$(Configuration)/$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>../../dep/acelite/ace;../../dep/acelite/ace/$(Configuration);;../../src/mangosd/$(Configuration);../../src/mangosd/$(Configuration)/$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation> <GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>$(Configuration)/mangosd.lib</ImportLibrary> <ImportLibrary>$(Configuration)/mangosd.lib</ImportLibrary>
@ -134,7 +134,7 @@
</Midl> </Midl>
<Link> <Link>
<AdditionalOptions> /machine:X86 /debug %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions> /machine:X86 /debug %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;$(Configuration)\game.lib;$(Configuration)\shared.lib;$(Configuration)\framework.lib;$(Configuration)\g3dlite.lib;$(Configuration)\ace.lib;$(Configuration)\gsoap.lib;$(Configuration)\zlib.lib;..\..\dep\lib\win32\libmySQL.lib;..\..\dep\lib\win32\libeay32.lib;$(Configuration)\detour.lib;$(Configuration)\mangosscript.lib;$(Configuration)\LuaEngine.lib;$(Configuration)\lualib.lib</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;$(Configuration)\game.lib;$(Configuration)\shared.lib;$(Configuration)\framework.lib;$(Configuration)\g3dlite.lib;$(Configuration)\ace.lib;$(Configuration)\gsoap.lib;$(Configuration)\zlib.lib;..\..\dep\lib\win32\libmySQL.lib;..\..\dep\lib\win32\libeay32.lib;$(Configuration)\detour.lib;$(Configuration)\mangosscript.lib;</AdditionalDependencies>
<AdditionalLibraryDirectories>../../dep/acelite/ace;../../dep/acelite/ace/$(Configuration);;../../src/mangosd/$(Configuration);../../src/mangosd/$(Configuration)/$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>../../dep/acelite/ace;../../dep/acelite/ace/$(Configuration);;../../src/mangosd/$(Configuration);../../src/mangosd/$(Configuration)/$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>$(Configuration)/mangosd.lib</ImportLibrary> <ImportLibrary>$(Configuration)/mangosd.lib</ImportLibrary>
@ -169,9 +169,6 @@
<ResourceCompile Include="..\..\src\mangosd\mangosd.rc" /> <ResourceCompile Include="..\..\src\mangosd\mangosd.rc" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="LuaEngine.vcxproj">
<Project>61BCE72F-B726-48F3-9D02-7FD551F82DF8</Project>
</ProjectReference>
<ProjectReference Include="ace.vcxproj"> <ProjectReference Include="ace.vcxproj">
<Project>D70895A7-4EA1-48BE-A557-834D4357BAD3</Project> <Project>D70895A7-4EA1-48BE-A557-834D4357BAD3</Project>
</ProjectReference> </ProjectReference>

View file

@ -187,7 +187,6 @@
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\alterac_mountains.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\alterac_mountains.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\arathi_highlands.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\arathi_highlands.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\blasted_lands.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\blasted_lands.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\boss_kazzak.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\burning_steppes.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\burning_steppes.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\dun_morogh.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\dun_morogh.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\eastern_plaguelands.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\eastern_plaguelands.cpp" />
@ -285,22 +284,6 @@
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\blackrock_mountain\blackwing_lair\boss_vaelastrasz.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\blackrock_mountain\blackwing_lair\boss_vaelastrasz.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\blackrock_mountain\blackwing_lair\boss_victor_nefarius.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\blackrock_mountain\blackwing_lair\boss_victor_nefarius.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\blackrock_mountain\blackwing_lair\instance_blackwing_lair.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\blackrock_mountain\blackwing_lair\instance_blackwing_lair.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_anubrekhan.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_faerlina.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_four_horsemen.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_gluth.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_gothik.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_grobbulus.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_heigan.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_kelthuzad.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_loatheb.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_maexxna.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_noth.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_patchwerk.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_razuvious.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_sapphiron.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\boss_thaddius.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\naxxramas\instance_naxxramas.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\zulgurub\boss_arlokk.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\zulgurub\boss_arlokk.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\zulgurub\boss_hakkar.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\zulgurub\boss_hakkar.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\zulgurub\boss_hazzarah.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\eastern_kingdoms\zulgurub\boss_hazzarah.cpp" />
@ -316,7 +299,6 @@
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\dire_maul\dire_maul.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\dire_maul\dire_maul.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\dire_maul\instance_dire_maul.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\dire_maul\instance_dire_maul.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\maraudon\boss_noxxion.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\maraudon\boss_noxxion.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\maraudon\maraudon.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\razorfen_downs\razorfen_downs.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\razorfen_downs\razorfen_downs.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\razorfen_kraul\instance_razorfen_kraul.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\razorfen_kraul\instance_razorfen_kraul.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\razorfen_kraul\razorfen_kraul.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\razorfen_kraul\razorfen_kraul.cpp" />
@ -327,7 +309,6 @@
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\zulfarrak\zulfarrak.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\zulfarrak\zulfarrak.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\onyxias_lair\boss_onyxia.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\onyxias_lair\boss_onyxia.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\onyxias_lair\instance_onyxias_lair.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\onyxias_lair\instance_onyxias_lair.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\onyxias_lair\npc_onyxian_warder.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\ruins_of_ahnqiraj\boss_ayamiss.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\ruins_of_ahnqiraj\boss_ayamiss.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\ruins_of_ahnqiraj\boss_buru.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\ruins_of_ahnqiraj\boss_buru.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\ruins_of_ahnqiraj\boss_kurinnaxx.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\ruins_of_ahnqiraj\boss_kurinnaxx.cpp" />
@ -338,7 +319,6 @@
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\ruins_of_ahnqiraj\ruins_of_ahnqiraj.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\ruins_of_ahnqiraj\ruins_of_ahnqiraj.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\temple_of_ahnqiraj\boss_bug_trio.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\temple_of_ahnqiraj\boss_bug_trio.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\temple_of_ahnqiraj\boss_cthun.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\temple_of_ahnqiraj\boss_cthun.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\temple_of_ahnqiraj\boss_fankriss.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\temple_of_ahnqiraj\boss_huhuran.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\temple_of_ahnqiraj\boss_huhuran.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\temple_of_ahnqiraj\boss_ouro.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\temple_of_ahnqiraj\boss_ouro.cpp" />
<ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\temple_of_ahnqiraj\boss_sartura.cpp" /> <ClCompile Include="..\..\src\modules\SD2\scripts\kalimdor\temple_of_ahnqiraj\boss_sartura.cpp" />