From 778052084e43a881c014cfd2077a181fe9be2462 Mon Sep 17 00:00:00 2001 From: Antz Date: Sat, 7 Feb 2015 22:46:39 +0000 Subject: [PATCH] [Build] Most errors fixed --- src/game/BattleGround/BattleGround.cpp | 6 +- src/game/BattleGround/BattleGroundEY.cpp | 2 +- src/game/BattleGround/BattleGroundHandler.cpp | 4 +- src/game/ChatCommands/Level0.cpp | 2 +- src/game/ChatCommands/Level2.cpp | 22 +-- src/game/ChatCommands/Level3.cpp | 6 +- .../ConfusedMovementGenerator.cpp | 4 +- .../FleeingMovementGenerator.cpp | 6 +- .../IdleMovementGenerator.cpp | 2 +- src/game/MotionGenerators/PathFinder.cpp | 153 +++++++++--------- src/game/MotionGenerators/PathFinder.h | 12 +- .../PointMovementGenerator.cpp | 4 +- .../RandomMovementGenerator.cpp | 2 +- .../TargetedMovementGenerator.cpp | 2 +- .../WaypointMovementGenerator.cpp | 2 +- src/game/Object/AggressorAI.cpp | 8 +- src/game/Object/Creature.cpp | 38 ++--- src/game/Object/CreatureEventAI.cpp | 52 +++--- src/game/Object/GameObject.cpp | 2 +- src/game/Object/GuardAI.cpp | 8 +- src/game/Object/Item.cpp | 4 +- src/game/Object/ObjectMgr.cpp | 10 +- src/game/Object/Pet.cpp | 4 +- src/game/Object/PetAI.cpp | 10 +- src/game/Object/Player.cpp | 116 ++++++------- src/game/Object/Player.h | 6 +- src/game/Object/ReactorAI.cpp | 4 +- src/game/Object/TemporarySummon.cpp | 12 +- src/game/Object/Totem.cpp | 4 +- src/game/Object/TotemAI.cpp | 6 +- src/game/Object/Unit.cpp | 82 +++++----- src/game/Object/Unit.h | 20 +-- src/game/Object/UnitEvents.h | 2 +- src/game/OutdoorPvP/OutdoorPvPSI.cpp | 2 +- src/game/References/ThreatManager.cpp | 6 +- src/game/WorldHandlers/AchievementMgr.cpp | 2 +- src/game/WorldHandlers/ChatHandler.cpp | 6 +- src/game/WorldHandlers/CombatHandler.cpp | 2 +- src/game/WorldHandlers/CreatureLinkingMgr.cpp | 30 ++-- src/game/WorldHandlers/GridNotifiers.h | 40 ++--- src/game/WorldHandlers/GridNotifiersImpl.h | 14 +- src/game/WorldHandlers/Group.cpp | 8 +- src/game/WorldHandlers/ItemHandler.cpp | 4 +- src/game/WorldHandlers/LootHandler.cpp | 10 +- src/game/WorldHandlers/MiscHandler.cpp | 16 +- src/game/WorldHandlers/MovementHandler.cpp | 6 +- src/game/WorldHandlers/NPCHandler.cpp | 12 +- src/game/WorldHandlers/PetHandler.cpp | 4 +- src/game/WorldHandlers/QuestHandler.cpp | 2 +- src/game/WorldHandlers/ScriptMgr.cpp | 4 +- src/game/WorldHandlers/Spell.cpp | 60 +++---- src/game/WorldHandlers/Spell.h | 4 +- src/game/WorldHandlers/SpellAuras.cpp | 64 ++++---- src/game/WorldHandlers/SpellEffects.cpp | 82 +++++----- src/game/WorldHandlers/SpellHandler.cpp | 8 +- src/game/WorldHandlers/TradeHandler.cpp | 4 +- src/game/WorldHandlers/Transports.cpp | 2 +- .../WorldHandlers/UnitAuraProcHandler.cpp | 30 ++-- src/mangosd/Main.cpp | 18 +-- src/mangosd/Master.cpp | 48 ++++-- src/mangosd/Master.h | 46 +++++- src/modules/SD2/base/escort_ai.cpp | 2 +- src/modules/SD2/base/follower_ai.cpp | 2 +- src/modules/SD2/include/sc_creature.cpp | 4 +- .../scripts/world/mob_generic_creature.cpp | 2 +- src/modules/SD2/system/ScriptLoader.cpp | 8 - win/BuildEverything_vc120.sln | 23 --- win/VC120/bzip2.vcxproj | 2 +- win/VC120/mangosd.vcxproj | 7 +- win/VC120/mangosscript.vcxproj | 20 --- 70 files changed, 619 insertions(+), 602 deletions(-) diff --git a/src/game/BattleGround/BattleGround.cpp b/src/game/BattleGround/BattleGround.cpp index cde8dceb8..bfec280d6 100644 --- a/src/game/BattleGround/BattleGround.cpp +++ b/src/game/BattleGround/BattleGround.cpp @@ -761,7 +761,7 @@ void BattleGround::EndBattleGround(Team winner) if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT); - if (!plr->isAlive()) + if (!plr->IsAlive()) { plr->ResurrectPlayer(1.0f); plr->SpawnCorpseBones(); @@ -1026,7 +1026,7 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen 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->SpawnCorpseBones(); @@ -1715,7 +1715,7 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(Team team) const if (itr->second.PlayerTeam == team) { Player* pl = sObjectMgr.GetPlayer(itr->first); - if (pl && pl->isAlive()) + if (pl && pl->IsAlive()) ++count; } } diff --git a/src/game/BattleGround/BattleGroundEY.cpp b/src/game/BattleGround/BattleGroundEY.cpp index bb5d38b87..4e78064f3 100644 --- a/src/game/BattleGround/BattleGroundEY.cpp +++ b/src/game/BattleGround/BattleGroundEY.cpp @@ -281,7 +281,7 @@ void BattleGroundEY::HandleAreaTrigger(Player* source, uint32 trigger) if (GetStatus() != STATUS_IN_PROGRESS) return; - if (!source->isAlive()) // hack code, must be removed later + if (!source->IsAlive()) // hack code, must be removed later return; switch (trigger) diff --git a/src/game/BattleGround/BattleGroundHandler.cpp b/src/game/BattleGround/BattleGroundHandler.cpp index f780f3556..46669ab57 100644 --- a/src/game/BattleGround/BattleGroundHandler.cpp +++ b/src/game/BattleGround/BattleGroundHandler.cpp @@ -428,7 +428,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data) _player->SetBattleGroundEntryPoint(); // resurrect the player - if (!_player->isAlive()) + if (!_player->IsAlive()) { _player->ResurrectPlayer(1.0f); _player->SpawnCorpseBones(); @@ -491,7 +491,7 @@ void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data) DEBUG_LOG("WORLD: Received opcode CMSG_LEAVE_BATTLEFIELD"); // not allow leave battleground in combat - if (_player->isInCombat()) + if (_player->IsInCombat()) if (BattleGround* bg = _player->GetBattleGround()) if (bg->GetStatus() != STATUS_WAIT_LEAVE) return; diff --git a/src/game/ChatCommands/Level0.cpp b/src/game/ChatCommands/Level0.cpp index b57ab8338..5a9a10188 100644 --- a/src/game/ChatCommands/Level0.cpp +++ b/src/game/ChatCommands/Level0.cpp @@ -81,7 +81,7 @@ bool ChatHandler::HandleStartCommand(char* /*args*/) return false; } - if (chr->isInCombat()) + if (chr->IsInCombat()) { SendSysMessage(LANG_YOU_IN_COMBAT); SetSentErrorMessage(true); diff --git a/src/game/ChatCommands/Level2.cpp b/src/game/ChatCommands/Level2.cpp index 3d0d69d29..b831f4d68 100644 --- a/src/game/ChatCommands/Level2.cpp +++ b/src/game/ChatCommands/Level2.cpp @@ -1698,7 +1698,7 @@ bool ChatHandler::HandleNpcDelVendorCurrencyCommand(char* args) return false; Creature* vendor = getSelectedCreature(); - if (!vendor || !vendor->isVendor()) + if (!vendor || !vendor->IsVendor()) { SendSysMessage(LANG_COMMAND_VENDORSELECTION); SetSentErrorMessage(true); @@ -1733,7 +1733,7 @@ bool ChatHandler::HandleNpcDelVendorItemCommand(char* args) return false; Creature* vendor = getSelectedCreature(); - if (!vendor || !vendor->isVendor()) + if (!vendor || !vendor->IsVendor()) { SendSysMessage(LANG_COMMAND_VENDORSELECTION); SetSentErrorMessage(true); @@ -1828,7 +1828,7 @@ bool ChatHandler::HandleNpcAddMoveCommand(char* args) { pCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); 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->Respawn(); @@ -2014,7 +2014,7 @@ bool ChatHandler::HandleNpcMoveCommand(char* args) } pCreature->GetMap()->CreatureRelocation(pCreature, x, y, z, o); 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->Respawn(); @@ -2108,7 +2108,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args) { pCreature->SetDefaultMovementType(move_type); 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->Respawn(); @@ -2217,7 +2217,7 @@ bool ChatHandler::HandleNpcSpawnDistCommand(char* args) pCreature->SetRespawnRadius((float)option); pCreature->SetDefaultMovementType(mtype); 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->Respawn(); @@ -3077,7 +3077,7 @@ bool ChatHandler::HandleWpAddCommand(char* args) { target->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); 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->Respawn(); @@ -3297,7 +3297,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args) if (npcCreature) { 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->Respawn(); @@ -3377,7 +3377,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args) delete result2; } 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->Respawn(); @@ -3441,7 +3441,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args) if (npcCreature) { 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->Respawn(); @@ -3475,7 +3475,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args) { npcCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); 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->Respawn(); diff --git a/src/game/ChatCommands/Level3.cpp b/src/game/ChatCommands/Level3.cpp index 77102007e..b57504c84 100644 --- a/src/game/ChatCommands/Level3.cpp +++ b/src/game/ChatCommands/Level3.cpp @@ -3963,7 +3963,7 @@ bool ChatHandler::HandleDieCommand(char* /*args*/) return false; } - if (target->isAlive()) + if (target->IsAlive()) { 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; } - if (!target->isAlive()) + if (!target->IsAlive()) return true; int32 damage_int; @@ -6066,7 +6066,7 @@ bool ChatHandler::HandleRespawnCommand(char* /*args*/) return false; } - if (target->isDead()) + if (target->IsDead()) ((Creature*)target)->Respawn(); return true; } diff --git a/src/game/MotionGenerators/ConfusedMovementGenerator.cpp b/src/game/MotionGenerators/ConfusedMovementGenerator.cpp index b319310ef..927f0d0c6 100644 --- a/src/game/MotionGenerators/ConfusedMovementGenerator.cpp +++ b/src/game/MotionGenerators/ConfusedMovementGenerator.cpp @@ -38,7 +38,7 @@ void ConfusedMovementGenerator::Initialize(T& unit) // set initial position 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; unit.StopMoving(); @@ -58,7 +58,7 @@ void ConfusedMovementGenerator::Reset(T& unit) { i_nextMoveTime.Reset(0); - if (!unit.isAlive() || unit.hasUnitState(UNIT_STAT_NOT_MOVE)) + if (!unit.IsAlive() || unit.hasUnitState(UNIT_STAT_NOT_MOVE)) return; unit.StopMoving(); diff --git a/src/game/MotionGenerators/FleeingMovementGenerator.cpp b/src/game/MotionGenerators/FleeingMovementGenerator.cpp index 309315dd7..a9c868e90 100644 --- a/src/game/MotionGenerators/FleeingMovementGenerator.cpp +++ b/src/game/MotionGenerators/FleeingMovementGenerator.cpp @@ -161,7 +161,7 @@ void FleeingMovementGenerator::Reset(T& owner) template bool FleeingMovementGenerator::Update(T& owner, const uint32& time_diff) { - if (!&owner || !owner.isAlive()) + if (!&owner || !owner.IsAlive()) return false; // 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); if (Unit* victim = owner.getVictim()) { - if (owner.isAlive()) + if (owner.IsAlive()) { owner.AttackStop(true); ((Creature*)&owner)->AI()->AttackStart(victim); @@ -206,7 +206,7 @@ void TimedFleeingMovementGenerator::Finalize(Unit& owner) bool TimedFleeingMovementGenerator::Update(Unit& owner, const uint32& time_diff) { - if (!owner.isAlive()) + if (!owner.IsAlive()) return false; // ignore in case other no reaction state diff --git a/src/game/MotionGenerators/IdleMovementGenerator.cpp b/src/game/MotionGenerators/IdleMovementGenerator.cpp index fbfb02a00..3aadacbb6 100644 --- a/src/game/MotionGenerators/IdleMovementGenerator.cpp +++ b/src/game/MotionGenerators/IdleMovementGenerator.cpp @@ -72,7 +72,7 @@ AssistanceDistractMovementGenerator::Finalize(Unit& unit) unit.clearUnitState(UNIT_STAT_DISTRACTED); if (Unit* victim = unit.getVictim()) { - if (unit.isAlive()) + if (unit.IsAlive()) { unit.AttackStop(true); ((Creature*)&unit)->AI()->AttackStart(victim); diff --git a/src/game/MotionGenerators/PathFinder.cpp b/src/game/MotionGenerators/PathFinder.cpp index 89d0b3b15..d75088627 100644 --- a/src/game/MotionGenerators/PathFinder.cpp +++ b/src/game/MotionGenerators/PathFinder.cpp @@ -1,4 +1,4 @@ -/* +/** * 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 * @@ -22,14 +22,14 @@ * and lore are copyrighted by Blizzard Entertainment, Inc. */ +#include "../recastnavigation/Detour/Include/DetourCommon.h" + #include "MoveMap.h" #include "GridMap.h" #include "Creature.h" #include "PathFinder.h" #include "Log.h" -#include "../recastnavigation/Detour/Include/DetourCommon.h" - ////////////////// PathFinder ////////////////// PathFinder::PathFinder(const Unit* owner) : m_polyLength(0), m_type(PATHFIND_BLANK), @@ -56,7 +56,7 @@ PathFinder::~PathFinder() bool PathFinder::calculate(float destX, float destY, float destZ, bool forceDest) { - Vector3 oldDest = getEndPosition(); + // Vector3 oldDest = getEndPosition(); Vector3 dest(destX, destY, destZ); 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 // 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) || - !HaveTile(start) || !HaveTile(dest)) + !HaveTile(start) || !HaveTile(dest)) { BuildShortcut(); 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 { if (!polyPath || !polyPathSize) - return INVALID_POLYREF; + { return INVALID_POLYREF; } dtPolyRef nearestPoly = INVALID_POLYREF; float minDist2d = FLT_MAX; @@ -97,7 +97,8 @@ dtPolyRef PathFinder::getPathPolyByPosition(const dtPolyRef* polyPath, uint32 po for (uint32 i = 0; i < polyPathSize; ++i) { 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; 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 - break; + { break; } } if (distance) - *distance = dtSqrt(minDist3d); + { *distance = dtSqrt(minDist3d); } 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 dtPolyRef polyRef = getPathPolyByPosition(m_pathPolyRefs, m_polyLength, point, distance); if (polyRef != INVALID_POLYREF) - return polyRef; + { return polyRef; } // we don't have it in our old path // try to get it by findNearestPoly() // first try with low search box 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}; - dtStatus result = m_navMeshQuery->findNearestPoly(point, extents, &m_filter, &polyRef, closestPoint); - if (DT_SUCCESS == result && polyRef != INVALID_POLYREF) + dtStatus dtResult = m_navMeshQuery->findNearestPoly(point, extents, &m_filter, &polyRef, closestPoint); + if (dtStatusSucceed(dtResult) && polyRef != INVALID_POLYREF) { *distance = dtVdist(closestPoint, point); return polyRef; @@ -142,8 +143,8 @@ dtPolyRef PathFinder::getPolyByLocation(const float* point, float* distance) con // still nothing .. // try with bigger search box extents[1] = 200.0f; - result = m_navMeshQuery->findNearestPoly(point, extents, &m_filter, &polyRef, closestPoint); - if (DT_SUCCESS == result && polyRef != INVALID_POLYREF) + dtResult = m_navMeshQuery->findNearestPoly(point, extents, &m_filter, &polyRef, closestPoint); + if (dtStatusSucceed(dtResult) && polyRef != INVALID_POLYREF) { *distance = dtVdist(closestPoint, point); return polyRef; @@ -163,6 +164,8 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos) dtPolyRef startPoly = getPolyByLocation(startPoint, &distToStartPoly); dtPolyRef endPoly = getPolyByLocation(endPoint, &distToEndPoly); + dtStatus dtResult; + // we have a hole in our mesh // make shortcut path and mark it as NOPATH ( with flying exception ) // 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 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))) - m_type = ((Creature*)m_sourceUnit)->CanSwim() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH; + (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; } 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 - m_type = PATHFIND_NOPATH; + { m_type = PATHFIND_NOPATH; } return; } @@ -202,13 +205,13 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos) { DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ BuildPolyPath :: underWater case\n"); if (owner->CanSwim()) - buildShotrcut = true; + { buildShotrcut = true; } } else { DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ BuildPolyPath :: flying case\n"); if (owner->CanFly()) - buildShotrcut = true; + { buildShotrcut = true; } } } @@ -222,7 +225,8 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos) { float closestPoint[VERTEX_SIZE]; // 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); setActualEndPosition(Vector3(endPoint[2], endPoint[0], endPoint[1])); @@ -299,7 +303,7 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos) m_polyLength -= pathStartIndex; // 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 // 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 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 // try to recover by using prev polyref --prefixPolyLength; 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 BuildShortcut(); @@ -329,17 +335,17 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos) // generate suffix uint32 suffixPolyLength = 0; - dtStatus dtResult = m_navMeshQuery->findPath( - suffixStartPoly, // start polygon - endPoly, // end polygon - suffixEndPoint, // start position - endPoint, // end position - &m_filter, // polygon search filter - m_pathPolyRefs + prefixPolyLength - 1, // [out] path - (int*)&suffixPolyLength, - MAX_PATH_LENGTH - prefixPolyLength); // max number of polygons in output path + dtResult = m_navMeshQuery->findPath( + suffixStartPoly, // start polygon + endPoly, // end polygon + suffixEndPoint, // start position + endPoint, // end position + &m_filter, // polygon search filter + m_pathPolyRefs + prefixPolyLength - 1, // [out] path + (int*)&suffixPolyLength, + 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 // 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 clear(); - dtStatus dtResult = m_navMeshQuery->findPath( - startPoly, // start polygon - endPoly, // end polygon - startPoint, // start position - endPoint, // end position - &m_filter, // polygon search filter - m_pathPolyRefs, // [out] path - (int*)&m_polyLength, - MAX_PATH_LENGTH); // max number of polygons in output path + dtResult = m_navMeshQuery->findPath( + startPoly, // start polygon + endPoly, // end polygon + startPoint, // start position + endPoint, // end position + &m_filter, // polygon search filter + m_pathPolyRefs, // [out] path + (int*)&m_polyLength, + 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 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 if (m_pathPolyRefs[m_polyLength - 1] == endPoly && !(m_type & PATHFIND_INCOMPLETE)) - m_type = PATHFIND_NORMAL; + { m_type = PATHFIND_NORMAL; } else - m_type = PATHFIND_INCOMPLETE; + { m_type = PATHFIND_INCOMPLETE; } // generate the point-path out of our up-to-date poly-path BuildPointPath(startPoint, endPoint); @@ -423,7 +429,7 @@ void PathFinder::BuildPointPath(const float* startPoint, const float* endPoint) 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 // single point paths can be generated here @@ -436,18 +442,18 @@ void PathFinder::BuildPointPath(const float* startPoint, const float* endPoint) m_pathPoints.resize(pointCount); 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 setActualEndPosition(m_pathPoints[pointCount - 1]); // force the given destination, if needed 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 if (dist3DSqr(getActualEndPosition(), getEndPosition()) < - 0.3f * dist3DSqr(getStartPosition(), getEndPosition())) + 0.3f * dist3DSqr(getStartPosition(), getEndPosition())) { setActualEndPosition(getEndPosition()); m_pathPoints[m_pathPoints.size() - 1] = getEndPosition(); @@ -489,11 +495,11 @@ void PathFinder::createFilter() { Creature* creature = (Creature*)m_sourceUnit; if (creature->CanWalk()) - includeFlags |= NAV_GROUND; // walk + { includeFlags |= NAV_GROUND; } // walk // creatures don't take environmental damage 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) { @@ -547,7 +553,7 @@ bool PathFinder::HaveTile(const Vector3& p) const float point[VERTEX_SIZE] = {p.y, p.z, p.x}; 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, @@ -570,12 +576,12 @@ uint32 PathFinder::fixupCorridor(dtPolyRef* path, uint32 npath, uint32 maxPath, } } if (found) - break; + { break; } } // If no intersection found just return current path. if (furthestPath == -1 || furthestVisited == -1) - return npath; + { return npath; } // 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 size = npath > orig ? npath - orig : 0; if (req + size > maxPath) - size = maxPath - req; + { size = maxPath - req; } if (size) - memmove(path + req, path + orig, size * sizeof(dtPolyRef)); + { memmove(path + req, path + orig, size * sizeof(dtPolyRef)); } // Store visited for (uint32 i = 0; i < req; ++i) - path[i] = visited[(nvisited - 1) - i]; + { path[i] = visited[(nvisited - 1) - i]; } return req + size; } @@ -608,8 +614,8 @@ bool PathFinder::getSteerTarget(const float* startPos, const float* endPos, uint32 nsteerPath = 0; dtStatus dtResult = m_navMeshQuery->findStraightPath(startPos, endPos, path, pathSize, steerPath, steerPathFlags, steerPathPolys, (int*)&nsteerPath, MAX_STEER_POINTS); - if (!nsteerPath || DT_SUCCESS != dtResult) - return false; + if (!nsteerPath || dtStatusFailed(dtResult)) + { return false; } // Find vertex far enough to steer to. 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. if ((steerPathFlags[ns] & DT_STRAIGHTPATH_OFFMESH_CONNECTION) || - !inRangeYZX(&steerPath[ns * VERTEX_SIZE], startPos, minTargetDist, 1000.0f)) - break; + !inRangeYZX(&steerPath[ns * VERTEX_SIZE], startPos, minTargetDist, 1000.0f)) + { break; } ++ns; } // Failed to find good point to steer to. if (ns >= nsteerPath) - return false; + { return false; } dtVcopy(steerPos, &steerPath[ns * VERTEX_SIZE]); steerPos[1] = startPos[1]; // keep Z value @@ -645,11 +651,13 @@ dtStatus PathFinder::findSmoothPath(const float* startPos, const float* endPos, uint32 npolys = polyPathSize; float iterPos[VERTEX_SIZE], targetPos[VERTEX_SIZE]; - if (DT_SUCCESS != m_navMeshQuery->closestPointOnPolyBoundary(polys[0], startPos, iterPos)) - return DT_FAILURE; + dtStatus dtResult = m_navMeshQuery->closestPointOnPolyBoundary(polys[0], startPos, iterPos); + if (dtStatusFailed(dtResult)) + { return DT_FAILURE; } - if (DT_SUCCESS != m_navMeshQuery->closestPointOnPolyBoundary(polys[npolys - 1], endPos, targetPos)) - return DT_FAILURE; + dtResult = m_navMeshQuery->closestPointOnPolyBoundary(polys[npolys - 1], endPos, targetPos); + if (dtStatusFailed(dtResult)) + { return DT_FAILURE; } dtVcopy(&smoothPath[nsmoothPath * VERTEX_SIZE], iterPos); ++nsmoothPath; @@ -664,7 +672,7 @@ dtStatus PathFinder::findSmoothPath(const float* startPos, const float* endPos, dtPolyRef steerPosRef = INVALID_POLYREF; if (!getSteerTarget(iterPos, targetPos, SMOOTH_PATH_SLOP, polys, npolys, steerPos, steerPosFlag, steerPosRef)) - break; + { break; } bool endOfPath = (steerPosFlag & DT_STRAIGHTPATH_END); 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)); // 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) - len = 1.0f; + { len = 1.0f; } else - len = SMOOTH_PATH_STEP_SIZE / len; + { len = SMOOTH_PATH_STEP_SIZE / len; } float moveTgt[VERTEX_SIZE]; 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) - polys[i - npos] = polys[i]; + { polys[i - npos] = polys[i]; } npolys -= npos; // Handle the connection. 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) { diff --git a/src/game/MotionGenerators/PathFinder.h b/src/game/MotionGenerators/PathFinder.h index 1e9cdcc94..b06233adb 100644 --- a/src/game/MotionGenerators/PathFinder.h +++ b/src/game/MotionGenerators/PathFinder.h @@ -25,10 +25,10 @@ #ifndef MANGOS_PATH_FINDER_H #define MANGOS_PATH_FINDER_H -#include "MoveMapSharedDefines.h" -#include "../recastnavigation/Detour/Include/DetourNavMesh.h" -#include "../recastnavigation/Detour/Include/DetourNavMeshQuery.h" +#include "DetourNavMesh.h" +#include "DetourNavMeshQuery.h" +#include "MoveMapSharedDefines.h" #include "movement/MoveSplineInitArgs.h" using Movement::Vector3; @@ -102,9 +102,9 @@ class PathFinder dtQueryFilter m_filter; // use single filter for all movements, update it when needed - void setStartPosition(Vector3 point) { m_startPosition = point; } - void setEndPosition(Vector3 point) { m_actualEndPosition = point; m_endPosition = point; } - void setActualEndPosition(Vector3 point) { m_actualEndPosition = point; } + void setStartPosition(const Vector3 &point) { m_startPosition = point; } + void setEndPosition(const Vector3 &point) { m_actualEndPosition = point; m_endPosition = point; } + void setActualEndPosition(const Vector3 &point) { m_actualEndPosition = point; } void clear() { diff --git a/src/game/MotionGenerators/PointMovementGenerator.cpp b/src/game/MotionGenerators/PointMovementGenerator.cpp index 99b7fc0b6..440d167cb 100644 --- a/src/game/MotionGenerators/PointMovementGenerator.cpp +++ b/src/game/MotionGenerators/PointMovementGenerator.cpp @@ -125,7 +125,7 @@ void AssistanceMovementGenerator::Finalize(Unit& unit) ((Creature*)&unit)->SetNoCallAssistance(false); ((Creature*)&unit)->CallAssistance(); - if (unit.isAlive()) + if (unit.IsAlive()) 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()) ((Creature&)unit).AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id); // 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()) unit.GetMotionMaster()->MoveChase(victim); diff --git a/src/game/MotionGenerators/RandomMovementGenerator.cpp b/src/game/MotionGenerators/RandomMovementGenerator.cpp index 49d8f8900..28c49158f 100644 --- a/src/game/MotionGenerators/RandomMovementGenerator.cpp +++ b/src/game/MotionGenerators/RandomMovementGenerator.cpp @@ -73,7 +73,7 @@ void RandomMovementGenerator::Initialize(Creature& creature) { 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; _setRandomLocation(creature); diff --git a/src/game/MotionGenerators/TargetedMovementGenerator.cpp b/src/game/MotionGenerators/TargetedMovementGenerator.cpp index 89cabccb4..9ee233138 100644 --- a/src/game/MotionGenerators/TargetedMovementGenerator.cpp +++ b/src/game/MotionGenerators/TargetedMovementGenerator.cpp @@ -103,7 +103,7 @@ bool TargetedMovementGeneratorMedium::Update(T& owner, const uint32& time_ if (!i_target.isValid() || !i_target->IsInWorld()) return false; - if (!owner.isAlive()) + if (!owner.IsAlive()) return true; if (owner.hasUnitState(UNIT_STAT_NOT_MOVE)) diff --git a/src/game/MotionGenerators/WaypointMovementGenerator.cpp b/src/game/MotionGenerators/WaypointMovementGenerator.cpp index 33374bda4..d2bd57bcd 100644 --- a/src/game/MotionGenerators/WaypointMovementGenerator.cpp +++ b/src/game/MotionGenerators/WaypointMovementGenerator.cpp @@ -179,7 +179,7 @@ void WaypointMovementGenerator::StartMove(Creature& creature) if (Stopped(creature)) return; - if (!creature.isAlive() || creature.hasUnitState(UNIT_STAT_NOT_MOVE)) + if (!creature.IsAlive() || creature.hasUnitState(UNIT_STAT_NOT_MOVE)) return; WaypointPath::const_iterator currPoint = i_path->find(i_currentNode); diff --git a/src/game/Object/AggressorAI.cpp b/src/game/Object/AggressorAI.cpp index 27a3d25e8..f4d7285fc 100644 --- a/src/game/Object/AggressorAI.cpp +++ b/src/game/Object/AggressorAI.cpp @@ -54,7 +54,7 @@ AggressorAI::MoveInLineOfSight(Unit* u) if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE) return; - if (m_creature->CanInitiateAttack() && u->isTargetableForAttack() && + if (m_creature->CanInitiateAttack() && u->IsTargetableForAttack() && m_creature->IsHostileTo(u) && u->isInAccessablePlaceFor(m_creature)) { float attackRadius = m_creature->GetAttackDistance(u); @@ -76,7 +76,7 @@ AggressorAI::MoveInLineOfSight(Unit* u) 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()); 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()); } - 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()); } @@ -141,7 +141,7 @@ bool AggressorAI::IsVisible(Unit* pl) const { 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 diff --git a/src/game/Object/Creature.cpp b/src/game/Object/Creature.cpp index 82b460473..ec63f881f 100644 --- a/src/game/Object/Creature.cpp +++ b/src/game/Object/Creature.cpp @@ -565,7 +565,7 @@ void Creature::Update(uint32 update_diff, uint32 diff) // 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) - if (!isAlive()) + if (!IsAlive()) break; if (!IsInEvadeMode()) @@ -581,7 +581,7 @@ void Creature::Update(uint32 update_diff, uint32 diff) // creature can be dead after UpdateAI call // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly) - if (!isAlive()) + if (!IsAlive()) break; RegenerateAll(update_diff); break; @@ -621,7 +621,7 @@ void Creature::RegenerateAll(uint32 update_diff) if (m_regenTimer != 0) return; - if (!isInCombat() || IsPolymorphed()) + if (!IsInCombat() || IsPolymorphed()) RegenerateHealth(); RegenerateMana(); @@ -640,7 +640,7 @@ void Creature::RegenerateMana() uint32 addvalue = 0; // Combat and any controlled creature - if (isInCombat() || GetCharmerOrOwnerGuid()) + if (IsInCombat() || GetCharmerOrOwnerGuid()) { float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA); 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 { - if (!isTrainer()) + if (!IsTrainer()) return false; // pet trainers not have spells in fact now @@ -1344,11 +1344,11 @@ bool Creature::LoadFromDB(uint32 guidlow, Map* map) AIM_Initialize(); // Creature Linking, Initial load is handled like respawn - if (m_isCreatureLinkingTrigger && isAlive()) + if (m_isCreatureLinkingTrigger && IsAlive()) GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, this); // 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)); tm rabbit_day_tm = *localtime(&rabbit_day); @@ -1571,7 +1571,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn) if (IsDespawned()) return; - if (isAlive()) + if (IsAlive()) SetDeathState(JUST_DIED); RemoveCorpse(); @@ -1732,13 +1732,13 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const return false; // 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 - if (isAlive()) + if (IsAlive()) { Corpse* corpse = pl->GetCorpse(); if (corpse) @@ -1793,7 +1793,7 @@ void Creature::CallForHelp(float fRadius) bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /*= true*/) const { // we don't need help from zombies :) - if (!isAlive()) + if (!IsAlive()) return false; // 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; // skip fighting creature - if (enemy && isInCombat()) + if (enemy && IsInCombat()) return false; // only free creature @@ -1863,13 +1863,13 @@ bool Creature::IsOutOfThreatArea(Unit* pVictim) const if (!pVictim->IsInMap(this)) return true; - if (!pVictim->isTargetableForAttack()) + if (!pVictim->IsTargetableForAttack()) return true; if (!pVictim->isInAccessablePlaceFor(this)) return true; - if (!pVictim->isVisibleForOrDetect(this, this, false)) + if (!pVictim->IsVisibleForOrDetect(this, this, false)) return true; if (sMapStore.LookupEntry(GetMapId())->IsDungeon()) @@ -2002,7 +2002,7 @@ void Creature::SetInCombatWithZone() if (pPlayer->isGameMaster()) continue; - if (pPlayer->isAlive() && !IsFriendlyTo(pPlayer)) + if (pPlayer->IsAlive() && !IsFriendlyTo(pPlayer)) { pPlayer->SetInCombatWith(this); AddThreat(pPlayer); @@ -2064,7 +2064,7 @@ Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, S return NULL; // ThreatList m_threatlist; - ThreatList const& threatlist = getThreatManager().getThreatList(); + ThreatList const& threatlist = GetThreatManager().getThreatList(); ThreatList::const_iterator itr = threatlist.begin(); 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 if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_NON_ATTACKABLE && GetCreatureInfo()->unit_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); if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_PASSIVE && GetCreatureInfo()->unit_flags & UNIT_FLAG_PASSIVE) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); @@ -2454,7 +2454,7 @@ void Creature::FillGuidsListFromThreatList(GuidVector& guids, uint32 maxamount / if (!CanHaveThreatList()) return; - ThreatList const& threats = getThreatManager().getThreatList(); + ThreatList const& threats = GetThreatManager().getThreatList(); maxamount = maxamount > 0 ? std::min(maxamount, uint32(threats.size())) : threats.size(); diff --git a/src/game/Object/CreatureEventAI.cpp b/src/game/Object/CreatureEventAI.cpp index b4107c6ee..474593da2 100644 --- a/src/game/Object/CreatureEventAI.cpp +++ b/src/game/Object/CreatureEventAI.cpp @@ -199,7 +199,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction switch (event.event_type) { case EVENT_T_TIMER_IN_COMBAT: - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) return false; LOG_PROCESS_EVENT; @@ -207,7 +207,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction pHolder.UpdateRepeatTimer(m_creature, event.timer.repeatMin, event.timer.repeatMax); break; case EVENT_T_TIMER_OOC: - if (m_creature->isInCombat() || m_creature->IsInEvadeMode()) + if (m_creature->IsInCombat() || m_creature->IsInEvadeMode()) return false; LOG_PROCESS_EVENT; @@ -221,7 +221,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction break; case EVENT_T_HP: { - if (!m_creature->isInCombat() || !m_creature->GetMaxHealth()) + if (!m_creature->IsInCombat() || !m_creature->GetMaxHealth()) return false; uint32 perc = (m_creature->GetHealth() * 100) / m_creature->GetMaxHealth(); @@ -236,7 +236,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction } case EVENT_T_MANA: { - if (!m_creature->isInCombat() || !m_creature->GetMaxPower(POWER_MANA)) + if (!m_creature->IsInCombat() || !m_creature->GetMaxPower(POWER_MANA)) return false; 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; 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; uint32 perc = (m_creature->getVictim()->GetHealth() * 100) / m_creature->getVictim()->GetMaxHealth(); @@ -290,7 +290,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction break; } 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; LOG_PROCESS_EVENT; @@ -299,7 +299,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction break; case EVENT_T_FRIENDLY_HP: { - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) return false; 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: { - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) return false; std::list pList; @@ -366,7 +366,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction } 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; 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: { - if (!m_creature->isInCombat() || !m_creature->getVictim()) + if (!m_creature->IsInCombat() || !m_creature->getVictim()) return false; 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: { - if (!m_creature->isInCombat() || !m_creature->getVictim()) + if (!m_creature->IsInCombat() || !m_creature->getVictim()) return false; 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: 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) 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; 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) 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; } case ACTION_T_QUEST_EVENT: @@ -737,9 +737,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 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()); - 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()); break; case ACTION_T_SET_PHASE: @@ -777,7 +777,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 break; 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) if (Player* temp = m_creature->GetMap()->GetPlayer((*i)->getUnitGuid())) 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); break; 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()); @@ -1093,7 +1093,7 @@ void CreatureEventAI::EnterEvadeMode() m_creature->DeleteThreatList(); m_creature->CombatStop(true); - if (m_creature->isAlive()) + if (m_creature->IsAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); m_creature->SetLootRecipient(NULL); @@ -1259,7 +1259,7 @@ void CreatureEventAI::MoveInLineOfSight(Unit* who) if (m_creature->IsCivilian() || m_creature->IsNeutralToAll()) return; - if (m_creature->CanInitiateAttack() && who->isTargetableForAttack() && + if (m_creature->CanInitiateAttack() && who->IsTargetableForAttack() && m_creature->IsHostileTo(who) && who->isInAccessablePlaceFor(m_creature)) { 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 { 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) @@ -1409,22 +1409,22 @@ inline Unit* CreatureEventAI::GetTargetByType(uint32 Target, Unit* pActionInvoke return resTarget; case TARGET_T_HOSTILE_SECOND_AGGRO: 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; return resTarget; case TARGET_T_HOSTILE_LAST_AGGRO: 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; return resTarget; case TARGET_T_HOSTILE_RANDOM: 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; return resTarget; case TARGET_T_HOSTILE_RANDOM_NOT_TOP: 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; return resTarget; case TARGET_T_HOSTILE_RANDOM_PLAYER: @@ -1434,7 +1434,7 @@ inline Unit* CreatureEventAI::GetTargetByType(uint32 Target, Unit* pActionInvoke return resTarget; case TARGET_T_HOSTILE_RANDOM_NOT_TOP_PLAYER: 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; return resTarget; case TARGET_T_ACTION_INVOKER: diff --git a/src/game/Object/GameObject.cpp b/src/game/Object/GameObject.cpp index d27cb9a8f..dc1e77c89 100644 --- a/src/game/Object/GameObject.cpp +++ b/src/game/Object/GameObject.cpp @@ -242,7 +242,7 @@ void GameObject::Update(uint32 update_diff, uint32 p_time) { // Arming Time for GAMEOBJECT_TYPE_TRAP (6) Unit* owner = GetOwner(); - if (owner && owner->isInCombat()) + if (owner && owner->IsInCombat()) m_cooldownTime = time(NULL) + GetGOInfo()->trap.startDelay; m_lootState = GO_READY; break; diff --git a/src/game/Object/GuardAI.cpp b/src/game/Object/GuardAI.cpp index 55672ff6f..3cb5a7b60 100644 --- a/src/game/Object/GuardAI.cpp +++ b/src/game/Object/GuardAI.cpp @@ -46,7 +46,7 @@ void GuardAI::MoveInLineOfSight(Unit* u) if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE) 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->isInAccessablePlaceFor(m_creature)) { @@ -62,7 +62,7 @@ void GuardAI::MoveInLineOfSight(Unit* u) 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()); 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()); } - 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()); } @@ -124,7 +124,7 @@ void GuardAI::UpdateAI(const uint32 /*diff*/) bool GuardAI::IsVisible(Unit* pl) const { 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) diff --git a/src/game/Object/Item.cpp b/src/game/Object/Item.cpp index a227651da..ffdea054d 100644 --- a/src/game/Object/Item.cpp +++ b/src/game/Object/Item.cpp @@ -1345,9 +1345,9 @@ bool ItemRequiredTarget::IsFitToRequirements(Unit* pUnitTarget) const switch (m_uiType) { case ITEM_TARGET_TYPE_CREATURE: - return pUnitTarget->isAlive(); + return pUnitTarget->IsAlive(); case ITEM_TARGET_TYPE_DEAD: - return !pUnitTarget->isAlive(); + return !pUnitTarget->IsAlive(); default: return false; } diff --git a/src/game/Object/ObjectMgr.cpp b/src/game/Object/ObjectMgr.cpp index e907f5912..38a4bd6cf 100644 --- a/src/game/Object/ObjectMgr.cpp +++ b/src/game/Object/ObjectMgr.cpp @@ -8155,7 +8155,7 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co switch (m_value1) { 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 if (!player) 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()) { 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 true; } 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 for (Map::PlayerList::const_iterator itr = map->GetPlayers().begin(); itr != map->GetPlayers().end(); ++itr) { 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 true; 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: return false; diff --git a/src/game/Object/Pet.cpp b/src/game/Object/Pet.cpp index 9e4d0c926..90f56e8cc 100644 --- a/src/game/Object/Pet.cpp +++ b/src/game/Object/Pet.cpp @@ -575,7 +575,7 @@ void Pet::RegenerateAll(uint32 update_diff) break; } - if (!isInCombat() || IsPolymorphed()) + if (!IsInCombat() || IsPolymorphed()) RegenerateHealth(); RegenerateMana(); @@ -750,7 +750,7 @@ void Pet::GivePetXP(uint32 xp) if (xp < 1) return; - if (!isAlive()) + if (!IsAlive()) return; uint32 level = getLevel(); diff --git a/src/game/Object/PetAI.cpp b/src/game/Object/PetAI.cpp index cefd69e1c..b8e9a955b 100644 --- a/src/game/Object/PetAI.cpp +++ b/src/game/Object/PetAI.cpp @@ -59,7 +59,7 @@ void PetAI::MoveInLineOfSight(Unit* u) if (!m_creature->GetCharmInfo() || !m_creature->GetCharmInfo()->HasReactState(REACT_AGGRESSIVE)) return; - if (u->isTargetableForAttack() && m_creature->IsHostileTo(u) && + if (u->IsTargetableForAttack() && m_creature->IsHostileTo(u) && u->isInAccessablePlaceFor(m_creature)) { float attackRadius = m_creature->GetAttackDistance(u); @@ -105,7 +105,7 @@ bool PetAI::_needToStop() const if (m_creature->isCharmed() && m_creature->getVictim() == m_creature->GetCharmer()) return true; - return !m_creature->getVictim()->isTargetableForAttack(); + return !m_creature->getVictim()->IsTargetableForAttack(); } void PetAI::_stopAttack() @@ -128,7 +128,7 @@ void PetAI::_stopAttack() void PetAI::UpdateAI(const uint32 diff) { - if (!m_creature->isAlive()) + if (!m_creature->IsAlive()) return; Unit* owner = m_creature->GetCharmerOrOwner(); @@ -180,7 +180,7 @@ void PetAI::UpdateAI(const uint32 diff) } 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()); } @@ -310,7 +310,7 @@ void PetAI::UpdateAI(const uint32 diff) bool PetAI::_isVisible(Unit* u) const { 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() diff --git a/src/game/Object/Player.cpp b/src/game/Object/Player.cpp index 70c7ea8da..7d652ca68 100644 --- a/src/game/Object/Player.cpp +++ b/src/game/Object/Player.cpp @@ -932,7 +932,7 @@ void Player::StopMirrorTimer(MirrorTimerType Type) uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage) { - if (!isAlive() || isGameMaster()) + if (!IsAlive() || isGameMaster()) return 0; // 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); - if (!isAlive()) + if (!IsAlive()) { 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; 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)) return DISABLED_MIRROR_TIMER; int32 UnderWaterTime = sWorld.getConfig(CONFIG_UINT32_TIMERBAR_BREATH_MAX) * IN_MILLISECONDS; @@ -995,7 +995,7 @@ int32 Player::getMaxTimer(MirrorTimerType 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 sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_MAX) * IN_MILLISECONDS; } @@ -1047,7 +1047,7 @@ void Player::HandleDrowning(uint32 time_diff) int32 UnderWaterTime = getMaxTimer(BREATH_TIMER); // Need breath regen m_MirrorTimer[BREATH_TIMER] += 10 * time_diff; - if (m_MirrorTimer[BREATH_TIMER] >= UnderWaterTime || !isAlive()) + if (m_MirrorTimer[BREATH_TIMER] >= UnderWaterTime || !IsAlive()) StopMirrorTimer(BREATH_TIMER); else if (m_MirrorTimerFlagsLast & UNDERWATER_INWATER) 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) { 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); EnvironmentalDamage(DAMAGE_EXHAUSTED, damage); @@ -1085,7 +1085,7 @@ void Player::HandleDrowning(uint32 time_diff) { int32 DarkWaterTime = getMaxTimer(FATIGUE_TIMER); m_MirrorTimer[FATIGUE_TIMER] += 10 * time_diff; - if (m_MirrorTimer[FATIGUE_TIMER] >= DarkWaterTime || !isAlive()) + if (m_MirrorTimer[FATIGUE_TIMER] >= DarkWaterTime || !IsAlive()) StopMirrorTimer(FATIGUE_TIMER); else if (m_MirrorTimerFlagsLast & UNDERWATER_INDARKWATER) 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; } - if (isAlive()) + if (IsAlive()) { if (!HasAuraType(SPELL_AURA_STOP_NATURAL_MANA_REGEN)) SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER); @@ -1418,7 +1418,7 @@ void Player::SetDeathState(DeathState s) { uint32 ressSpellId = 0; - bool cur = isAlive(); + bool cur = IsAlive(); if (s == JUST_DIED && cur) { @@ -1456,7 +1456,7 @@ void Player::SetDeathState(DeathState s) if (s == JUST_DIED && cur && 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) SetUInt32Value(PLAYER_SELF_RES_SPELL, 0); @@ -2072,11 +2072,11 @@ void Player::RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacke void Player::RegenerateAll(uint32 diff) { // 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) { RegenerateHealth(diff); - if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN)) + if (!IsInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN)) { Regenerate(POWER_RAGE, diff); if (getClass() == CLASS_DEATH_KNIGHT) @@ -2096,7 +2096,7 @@ void Player::RegenerateAll(uint32 diff) if (getClass() == CLASS_PALADIN) { - if (isInCombat()) + if (IsInCombat()) ResetHolyPowerRegenTimer(); else if (m_holyPowerRegenTimer <= diff) m_holyPowerRegenTimer = 0; @@ -2136,7 +2136,7 @@ void Player::Regenerate(Powers power, uint32 diff) break; float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA); - if (isInCombat()) + if (IsInCombat()) { // Mangos Updates Mana in intervals of 2s, which is correct addvalue = GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER) * ManaIncreaseRate * 2.00f; @@ -2245,10 +2245,10 @@ void Player::RegenerateHealth(uint32 diff) if (IsPolymorphed()) addvalue = (float)GetMaxHealth() / 3; // 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; - if (!isInCombat()) + if (!IsInCombat()) { if (getLevel() < 15) 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 (!unit->isAlive()) + if (!unit->IsAlive()) return NULL; - if (isAlive() && unit->isInvisibleForAlive()) + if (IsAlive() && unit->isInvisibleForAlive()) return NULL; // not allow interaction under control, but allow with own pets @@ -2559,7 +2559,7 @@ void Player::GiveXP(uint32 xp, Unit* victim) if (xp < 1) return; - if (!isAlive()) + if (!IsAlive()) return; if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_XP_USER_DISABLED)) @@ -2663,7 +2663,7 @@ void Player::GiveLevel(uint32 level) UpdateAllStats(); // set current level health and mana/energy to maximum after applying all mods. - if (isAlive()) + if (IsAlive()) SetHealth(GetMaxHealth()); SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); @@ -4978,7 +4978,7 @@ void Player::RepopAtGraveyard() AreaTableEntry const* zone = GetAreaEntryByAreaID(GetAreaId()); // 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); SpawnCorpseBones(); @@ -5001,7 +5001,7 @@ void Player::RepopAtGraveyard() { bool updateVisibility = IsInWorld() && GetMapId() == ClosestGrave->map_id; 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 data << ClosestGrave->map_id; @@ -6242,7 +6242,7 @@ void Player::SendMovieStart(uint32 MovieId) void Player::CheckAreaExploreAndOutdoor() { - if (!isAlive()) + if (!IsAlive()) return; if (IsTaxiFlying()) @@ -6867,7 +6867,7 @@ void Player::UpdateArea(uint32 newArea) bool Player::CanUseCapturePoint() { - return isAlive() && // living + return IsAlive() && // living !HasStealthAura() && // not stealthed !HasInvisibilityAura() && // visible (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) // if player resurrected at teleport this will be applied in resurrect code - if (isAlive()) + if (IsAlive()) DestroyZoneLimitedItem(true, newZone); // 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); // 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); return; @@ -10437,7 +10437,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool // - in-progress arenas if (!pProto->CanChangeEquipStateInCombat()) { - if (isInCombat()) + if (IsInCombat()) return EQUIP_ERR_NOT_IN_COMBAT; if (BattleGround* bg = GetBattleGround()) @@ -10449,7 +10449,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool if (GetSession()->isLogingOut()) 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 if (IsNonMeleeSpellCasted(false)) @@ -10572,7 +10572,7 @@ InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const // - in-progress arenas if (!pProto->CanChangeEquipStateInCombat()) { - if (isInCombat()) + if (IsInCombat()) return EQUIP_ERR_NOT_IN_COMBAT; 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()); - if (!isAlive() && direct_action) + if (!IsAlive() && direct_action) return EQUIP_ERR_YOU_ARE_DEAD; // if (isStunned()) @@ -10878,7 +10878,7 @@ InventoryResult Player::CanUseItem(ItemPrototype const* pProto) const InventoryResult Player::CanUseAmmo(uint32 item) const { DEBUG_LOG("STORAGE: CanUseAmmo item = %u", item); - if (!isAlive()) + if (!IsAlive()) return EQUIP_ERR_YOU_ARE_DEAD; // if( isStunned() ) // return EQUIP_ERR_YOU_ARE_STUNNED; @@ -11112,7 +11112,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update) { VisualizeItem(slot, pItem); - if (isAlive()) + if (IsAlive()) { ItemPrototype const* pProto = pItem->GetProto(); @@ -11125,7 +11125,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update) ApplyItemOnStoreSpell(pItem, true); // 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; @@ -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()); - if (!isAlive()) + if (!IsAlive()) { SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, pSrcItem, pDstItem); return; @@ -13086,7 +13086,7 @@ void Player::PrepareGossipMenu(WorldObject* pSource, uint32 menuId) hasMenuItem = false; // added in special mode break; case GOSSIP_OPTION_SPIRITHEALER: - if (!isDead()) + if (!IsDead()) hasMenuItem = false; break; case GOSSIP_OPTION_VENDOR: @@ -13316,7 +13316,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me break; } case GOSSIP_OPTION_SPIRITHEALER: - if (isDead()) + if (IsDead()) ((Creature*)pSource)->CastSpell(((Creature*)pSource), 17251, true, NULL, NULL, GetObjectGuid()); break; 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 // Do now before stats re-calculation cleanup for ghost state unexpected auras - if (!isAlive()) + if (!IsAlive()) RemoveAllAurasOnDeath(); // apply all stat bonuses from items and auras @@ -16487,7 +16487,7 @@ void Player::_LoadGlyphs(QueryResult* result) void Player::LoadCorpse() { - if (isAlive()) + if (IsAlive()) { 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 - if (isAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zone)) + if (IsAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zone)) { CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid); item->FSetState(ITEM_REMOVED); @@ -16672,7 +16672,7 @@ void Player::_LoadInventory(QueryResult* result, uint32 timediff) } } - // if(isAlive()) + // if(IsAlive()) _ApplyAllItemMods(); } @@ -18585,7 +18585,7 @@ void Player::UpdateAfkReport(time_t currTime) void Player::UpdateContestedPvP(uint32 diff) { - if (!m_contestedPvPTimer || isInCombat()) + if (!m_contestedPvPTimer || IsInCombat()) return; if (m_contestedPvPTimer <= diff) { @@ -19062,7 +19062,7 @@ void Player::HandleStealthedUnitsDetection() continue; bool hasAtClient = HaveAtClient((*i)); - bool hasDetected = (*i)->isVisibleForOrDetect(this, viewPoint, true); + bool hasDetected = (*i)->IsVisibleForOrDetect(this, viewPoint, true); if (hasDetected) { @@ -19097,7 +19097,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc 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 - if (GetSession()->isLogingOut() || isInCombat()) + if (GetSession()->isLogingOut() || IsInCombat()) { GetSession()->SendActivateTaxiReply(ERR_TAXIPLAYERBUSY); return false; @@ -19469,7 +19469,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot, uin // cheating attempt if (count < 1) count = 1; - if (!isAlive()) + if (!IsAlive()) return false; ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(item); @@ -19696,7 +19696,7 @@ bool Player::BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot, // cheating attempt if (count < 1) count = 1; - if (!isAlive()) + if (!IsAlive()) return false; CurrencyTypesEntry const* pCurrency = sCurrencyTypesStore.LookupEntry(currencyId); @@ -20023,7 +20023,7 @@ void Player::SendCooldownEvent(SpellEntry const* spellInfo, uint32 itemId, Spell void Player::UpdatePotionCooldown(Spell* spell) { // no potion used in combat or still in combat - if (!m_lastPotionId || isInCombat()) + if (!m_lastPotionId || IsInCombat()) return; // 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; // Live player see live player or dead player with not realized corpse - if (pl->isAlive() || pl->m_deathTimer > 0) - return isAlive() || m_deathTimer > 0; + if (pl->IsAlive() || pl->m_deathTimer > 0) + return IsAlive() || m_deathTimer > 0; // 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; // Dead player see live players near own corpse - if (isAlive()) + if (IsAlive()) { if (Corpse* corpse = pl->GetCorpse()) { @@ -20403,7 +20403,7 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* targe BeforeVisibilityDestroy((Creature*)target, this); // 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 target->DestroyForPlayer(this); @@ -20612,7 +20612,7 @@ void Player::SendInitialPacketsBeforeAddToMap() SendInitialActionButtons(); m_reputationMgr.SendInitialReputations(); - if (!isAlive()) + if (!IsAlive()) SendCorpseReclaimDelay(true); 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 // 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); } } @@ -21523,7 +21523,7 @@ void Player::RewardPlayerAndGroupAtCast(WorldObject* pRewardSource, uint32 spell 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 - 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); } } @@ -21536,7 +21536,7 @@ bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const if (pRewardSource->IsWithinDistInMap(this, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE))) return true; - if (isAlive()) + if (IsAlive()) return false; Corpse* corpse = GetCorpse(); @@ -21920,7 +21920,7 @@ bool Player::CanUseBattleGroundObject() // TODO : some spells gives player ForceReaction to one faction (ReputationMgr::ApplyForceReaction) // 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 - return (isAlive() && // living + return (IsAlive() && // living // the following two are incorrect, because invisible/stealthed players should get visible when they click on flag !HasStealthAura() && // not stealthed !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 // 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_FLY) && !IsImmunedToDamage(SPELL_SCHOOL_MASK_NORMAL)) { @@ -22541,7 +22541,7 @@ void Player::HandleFall(MovementInfo const& movementInfo) 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 - if (isAlive() && final_damage < original_health) + if (IsAlive() && final_damage < original_health) GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING, uint32(z_diff * 100)); } diff --git a/src/game/Object/Player.h b/src/game/Object/Player.h index e8c2fb185..f890c5c53 100644 --- a/src/game/Object/Player.h +++ b/src/game/Object/Player.h @@ -2279,7 +2279,7 @@ class Player : public Unit void SetTemporaryUnsummonedPetNumber(uint32 petnumber) { m_temporaryUnsummonedPetNumber = petnumber; } void UnsummonPetTemporaryIfAny(); 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 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 // 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() { m_bHasDelayedTeleport = m_bCanDelayTeleport; - m_bHasBeenAliveAtDelayedTeleport = isAlive(); + m_bHasBeenAliveAtDelayedTeleport = IsAlive(); return m_bHasDelayedTeleport; } diff --git a/src/game/Object/ReactorAI.cpp b/src/game/Object/ReactorAI.cpp index 2f7b9a860..273ea8e31 100644 --- a/src/game/Object/ReactorAI.cpp +++ b/src/game/Object/ReactorAI.cpp @@ -85,7 +85,7 @@ ReactorAI::UpdateAI(const uint32 /*time_diff*/) void 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()); m_creature->GetMotionMaster()->MovementExpired(); @@ -112,7 +112,7 @@ ReactorAI::EnterEvadeMode() } 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(); diff --git a/src/game/Object/TemporarySummon.cpp b/src/game/Object/TemporarySummon.cpp index 2b1d4b5a4..3b59db0c3 100644 --- a/src/game/Object/TemporarySummon.cpp +++ b/src/game/Object/TemporarySummon.cpp @@ -50,7 +50,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) } case TEMPSUMMON_TIMED_OOC_DESPAWN: { - if (!isInCombat()) + if (!IsInCombat()) { if (m_timer <= update_diff) { @@ -88,7 +88,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) case TEMPSUMMON_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped - if (isDead()) + if (IsDead()) { UnSummon(); return; @@ -108,13 +108,13 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) case TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped - if (isDead()) + if (IsDead()) { UnSummon(); return; } - if (!isInCombat()) + if (!IsInCombat()) { if (m_timer <= update_diff) { @@ -137,7 +137,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) return; } - if (!isInCombat() && isAlive()) + if (!IsInCombat() && IsAlive()) { if (m_timer <= update_diff) { @@ -154,7 +154,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped - if (isDead()) + if (IsDead()) { UnSummon(); return; diff --git a/src/game/Object/Totem.cpp b/src/game/Object/Totem.cpp index eaadac16e..d995be2eb 100644 --- a/src/game/Object/Totem.cpp +++ b/src/game/Object/Totem.cpp @@ -78,7 +78,7 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* void Totem::Update(uint32 update_diff, uint32 time) { Unit* owner = GetOwner(); - if (!owner || !owner->isAlive() || !isAlive()) + if (!owner || !owner->IsAlive() || !IsAlive()) { UnSummon(); // remove self return; @@ -151,7 +151,7 @@ void Totem::UnSummon() } // any totem unsummon look like as totem kill, req. for proper animation - if (isAlive()) + if (IsAlive()) SetDeathState(DEAD); AddObjectToRemoveList(); diff --git a/src/game/Object/TotemAI.cpp b/src/game/Object/TotemAI.cpp index 8280ed4fa..dd9caa86a 100644 --- a/src/game/Object/TotemAI.cpp +++ b/src/game/Object/TotemAI.cpp @@ -61,7 +61,7 @@ TotemAI::UpdateAI(const uint32 /*diff*/) if (getTotem().GetTotemType() != TOTEM_ACTIVE) return; - if (!m_creature->isAlive() || m_creature->IsNonMeleeSpellCasted(false)) + if (!m_creature->IsAlive() || m_creature->IsNonMeleeSpellCasted(false)) return; // 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) if (!victim || - !victim->isTargetableForAttack() || !m_creature->IsWithinDistInMap(victim, max_range) || - m_creature->IsFriendlyTo(victim) || !victim->isVisibleForOrDetect(m_creature, m_creature, false)) + !victim->IsTargetableForAttack() || !m_creature->IsWithinDistInMap(victim, max_range) || + m_creature->IsFriendlyTo(victim) || !victim->IsVisibleForOrDetect(m_creature, m_creature, false)) { victim = NULL; diff --git a/src/game/Object/Unit.cpp b/src/game/Object/Unit.cpp index 449254578..7566f2c59 100644 --- a/src/game/Object/Unit.cpp +++ b/src/game/Object/Unit.cpp @@ -617,10 +617,10 @@ void Unit::Update(uint32 update_diff, uint32 p_time) CleanupDeletedAuras(); if (CanHaveThreatList()) - getThreatManager().UpdateForClient(update_diff); + GetThreatManager().UpdateForClient(update_diff); // 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 // targets without stopping half way there and running off. @@ -648,7 +648,7 @@ void Unit::Update(uint32 update_diff, uint32 p_time) if (IsVehicle()) { // Initialize vehicle if not done - if (isAlive() && !m_vehicleInfo->IsInitialized()) + if (IsAlive() && !m_vehicleInfo->IsInitialized()) m_vehicleInfo->Initialize(); // 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) { - 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) *absorb += damage; @@ -1651,7 +1651,7 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage* damageInfo, int32 damage, S if (!this || !pVictim) return; - if (!this->isAlive() || !pVictim->isAlive()) + if (!this->IsAlive() || !pVictim->IsAlive()) return; // Check spell crit chance @@ -1732,7 +1732,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss) if (!this || !pVictim) 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; SpellEntry const* spellProto = sSpellStore.LookupEntry(damageInfo->SpellID); @@ -1774,7 +1774,7 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, uint32 damage, CalcDamageInfo* da if (!this || !pVictim) return; - if (!this->isAlive() || !pVictim->isAlive()) + if (!this->IsAlive() || !pVictim->IsAlive()) return; // Select HitInfo/procAttacker/procVictim flag based on attack type @@ -2026,7 +2026,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) if (!this || !pVictim) 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; // 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)) { // on weapon hit casts - if (GetTypeId() == TYPEID_PLAYER && pVictim->isAlive()) + if (GetTypeId() == TYPEID_PLAYER && pVictim->IsAlive()) ((Player*)this)->CastItemCombatSpell(pVictim, damageInfo->attackType); // 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) { - if (!pCaster || !isAlive() || !damage) + if (!pCaster || !IsAlive() || !damage) return; // 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 Unit* caster = (*i)->GetCaster(); - if (!caster || caster == this || !caster->IsInWorld() || !caster->isAlive()) + if (!caster || caster == this || !caster->IsInWorld() || !caster->IsAlive()) continue; 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) { - if (!isAlive() || !heal) + if (!IsAlive() || !heal) return; 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)) return; - if (!pVictim->isAlive()) + if (!pVictim->IsAlive()) return; if (IsNonMeleeSpellCasted(false)) @@ -3405,7 +3405,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* pVictim, SpellEntry const* spell) SpellMissInfo Unit::MagicSpellHitResult(Unit* pVictim, SpellEntry const* spell) { // Can`t miss on dead target (on skinning for example) - if (!pVictim->isAlive()) + if (!pVictim->IsAlive()) return SPELL_MISS_NONE; SpellSchoolMask schoolMask = GetSpellSchoolMask(spell); @@ -4214,7 +4214,7 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder* holder) SpellEntry const* aurSpellInfo = holder->GetSpellProto(); // 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) && (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)) caster = dotAura->GetCaster(); - if (caster && !caster->isDead()) + if (caster && !caster->IsDead()) { Unit::AuraList const& auras = caster->GetAurasByType(SPELL_AURA_DUMMY); 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); // Now go on with a victim's events'n'auras // 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); } @@ -6014,7 +6014,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) return false; // dead units can neither attack nor be attacked - if (!isAlive() || !victim->IsInWorld() || !victim->isAlive()) + if (!IsAlive() || !victim->IsInWorld() || !victim->IsAlive()) return false; // 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 (magnet->isAlive() && magnet->IsWithinLOSInMap(this) && spell->CheckTarget(magnet, eff)) + if (magnet->IsAlive() && magnet->IsWithinLOSInMap(this) && spell->CheckTarget(magnet, eff)) return magnet; } } @@ -6531,7 +6531,7 @@ Unit* Unit::SelectMagnetTarget(Unit* victim, Spell* spell, SpellEffectIndex eff) { 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)) return magnet; @@ -8302,7 +8302,7 @@ void Unit::SetInCombatWith(Unit* enemy) void Unit::SetInCombatState(bool PvP, Unit* enemy) { // only alive units can be in combat - if (!isAlive()) + if (!IsAlive()) return; if (PvP) @@ -8371,7 +8371,7 @@ void Unit::ClearInCombat() ((Player*)this)->UpdatePotionCooldown(); } -bool Unit::isTargetableForAttack(bool inverseAlive /*=false*/) const +bool Unit::IsTargetableForAttack(bool inverseAlive /*=false*/) const { if (GetTypeId() == TYPEID_PLAYER && ((Player*)this)->isGameMaster()) return false; @@ -8384,7 +8384,7 @@ bool Unit::isTargetableForAttack(bool inverseAlive /*=false*/) const return false; // inversealive is needed for some spells which need to be casted at dead targets (aoe) - if (isAlive() == inverseAlive) + if (IsAlive() == inverseAlive) return false; return IsInWorld() && !hasUnitState(UNIT_STAT_DIED) && !IsTaxiFlying(); @@ -8454,7 +8454,7 @@ int32 Unit::ModifyPower(Powers power, int32 dVal) 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)) return false; @@ -8488,13 +8488,13 @@ bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo return false; // if player is dead then he can't detect anyone in any cases - if (!u->isAlive()) + if (!u->IsAlive()) detect = false; } else { // all dead creatures/players not visible for any creatures - if (!u->isAlive() || !isAlive()) + if (!u->IsAlive() || !IsAlive()) 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 // unit is also invisible for alive.. if an isinvisibleforalive unit dies we // 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()) return false; @@ -8675,7 +8675,7 @@ void Unit::UpdateVisibilityAndView() Aura* aura = (*it); Unit* owner = aura->GetCaster(); - if (!owner || !isVisibleForOrDetect(owner, this, false)) + if (!owner || !IsVisibleForOrDetect(owner, this, false)) { alist.erase(it); RemoveAura(aura); @@ -9169,7 +9169,7 @@ bool Unit::CanHaveThreatList(bool ignoreAliveState/*=false*/) const return false; // only alive units can have threat list - if (!isAlive() && !ignoreAliveState) + if (!IsAlive() && !ignoreAliveState) return false; Creature const* creature = ((Creature const*)this); @@ -9305,7 +9305,7 @@ void Unit::FixateTarget(Unit* pVictim) { if (!pVictim) // Remove Fixation m_fixateTargetGuid.Clear(); - else if (pVictim->isTargetableForAttack()) // Apply Fixation + else if (pVictim->IsTargetableForAttack()) // Apply Fixation m_fixateTargetGuid = pVictim->GetObjectGuid(); // Start attacking the fixated target or the next proper one @@ -9334,7 +9334,7 @@ bool Unit::SelectHostileTarget() MANGOS_ASSERT(GetTypeId() == TYPEID_UNIT); - if (!this->isAlive()) + if (!this->IsAlive()) return false; // This function only useful once AI has been initialized @@ -9352,7 +9352,7 @@ bool Unit::SelectHostileTarget() else { Unit* pFixateTarget = GetMap()->GetUnit(m_fixateTargetGuid); - if (pFixateTarget && pFixateTarget->isAlive() && !IsSecondChoiceTarget(pFixateTarget, true)) + if (pFixateTarget && pFixateTarget->IsAlive() && !IsSecondChoiceTarget(pFixateTarget, true)) target = pFixateTarget; } } @@ -9367,7 +9367,7 @@ bool Unit::SelectHostileTarget() for (AuraList::const_reverse_iterator aura = tauntAuras.rbegin(); aura != tauntAuras.rend(); ++aura) { if ((caster = (*aura)->GetCaster()) && caster->IsInMap(this) && - caster->isTargetableForAttack() && caster->isInAccessablePlaceFor((Creature*)this) && + caster->IsTargetableForAttack() && caster->isInAccessablePlaceFor((Creature*)this) && !IsSecondChoiceTarget(caster, true)) { target = caster; @@ -9419,7 +9419,7 @@ bool Unit::SelectHostileTarget() } // 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; // 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) { - if ((*itr)->IsInMap(this) && (*itr)->isTargetableForAttack() && (*itr)->isInAccessablePlaceFor((Creature*)this)) + if ((*itr)->IsInMap(this) && (*itr)->IsTargetableForAttack() && (*itr)->isInAccessablePlaceFor((Creature*)this)) 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 { - 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 @@ -10925,7 +10925,7 @@ void Unit::SetFeared(bool apply, ObjectGuid casterGuid, uint32 spellID, uint32 t GetMotionMaster()->MovementExpired(false); - if (GetTypeId() != TYPEID_PLAYER && isAlive()) + if (GetTypeId() != TYPEID_PLAYER && IsAlive()) { Creature* c = ((Creature*)this); // restore appropriate movement generator @@ -10960,7 +10960,7 @@ void Unit::SetConfused(bool apply, ObjectGuid casterGuid, uint32 spellID) GetMotionMaster()->MovementExpired(false); - if (GetTypeId() != TYPEID_PLAYER && isAlive()) + if (GetTypeId() != TYPEID_PLAYER && IsAlive()) { // restore appropriate movement generator if (getVictim()) @@ -11024,7 +11024,7 @@ void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid, uint32 /*spellID*/) clearUnitState(UNIT_STAT_DIED); - if (GetTypeId() != TYPEID_PLAYER && isAlive()) + if (GetTypeId() != TYPEID_PLAYER && IsAlive()) { // restore appropriate movement generator if (getVictim()) @@ -11553,7 +11553,7 @@ uint32 Unit::GetCombatRatingDamageReduction(CombatRating cr, float rate, float c void Unit::SendThreatUpdate() { - ThreatList const& tlist = getThreatManager().getThreatList(); + ThreatList const& tlist = GetThreatManager().getThreatList(); if (uint32 count = tlist.size()) { DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Send SMSG_THREAT_UPDATE Message"); @@ -11571,7 +11571,7 @@ void Unit::SendThreatUpdate() void Unit::SendHighestThreatUpdate(HostileReference* pHostilReference) { - ThreatList const& tlist = getThreatManager().getThreatList(); + ThreatList const& tlist = GetThreatManager().getThreatList(); if (uint32 count = tlist.size()) { DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message"); diff --git a/src/game/Object/Unit.h b/src/game/Object/Unit.h index 887ecd5c2..4d2701c04 100644 --- a/src/game/Object/Unit.h +++ b/src/game/Object/Unit.h @@ -2153,9 +2153,9 @@ class Unit : public WorldObject 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; - 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 isQuestGiver() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } + 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 IsQuestGiver() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } 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 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 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 SetInCombatWith(Unit* enemy); void ClearInCombat(); @@ -2214,7 +2214,7 @@ class Unit : public WorldObject bool isFrozen() const; 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); } virtual bool IsInWater() const; @@ -2511,8 +2511,8 @@ class Unit : public WorldObject void SendThreatRemove(HostileReference* pHostileReference); void SendThreatUpdate(); - bool isAlive() const { return (m_deathState == ALIVE); }; - bool isDead() const { return (m_deathState == DEAD || m_deathState == CORPSE); }; + bool IsAlive() const { return (m_deathState == ALIVE); }; + bool IsDead() const { return (m_deathState == DEAD || m_deathState == CORPSE); }; DeathState getDeathState() const { return m_deathState; }; virtual void SetDeathState(DeathState s); // overwritten in Creature/Player/Pet @@ -3025,7 +3025,7 @@ class Unit : public WorldObject void UpdateVisibilityAndView() override; // overwrite WorldObject::UpdateVisibilityAndView() // 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; void SetPhaseMask(uint32 newPhaseMask, bool update) override;// overwrite WorldObject::SetPhaseMask @@ -3050,8 +3050,8 @@ class Unit : public WorldObject void TauntFadeOut(Unit* taunter); void FixateTarget(Unit* pVictim); ObjectGuid GetFixateTargetGuid() const { return m_fixateTargetGuid; } - ThreatManager& getThreatManager() { return m_ThreatManager; } - ThreatManager const& getThreatManager() const { return m_ThreatManager; } + ThreatManager& GetThreatManager() { return m_ThreatManager; } + ThreatManager const& GetThreatManager() const { return m_ThreatManager; } void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); }; void removeHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ } HostileRefManager& getHostileRefManager() { return m_HostileRefManager; } diff --git a/src/game/Object/UnitEvents.h b/src/game/Object/UnitEvents.h index 2e7091b46..467e8ab1b 100644 --- a/src/game/Object/UnitEvents.h +++ b/src/game/Object/UnitEvents.h @@ -113,7 +113,7 @@ class ThreatRefStatusChangeEvent : public UnitBaseEvent void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; } - ThreatManager* getThreatManager() const { return iThreatManager; } + ThreatManager* GetThreatManager() const { return iThreatManager; } }; //============================================================== diff --git a/src/game/OutdoorPvP/OutdoorPvPSI.cpp b/src/game/OutdoorPvP/OutdoorPvPSI.cpp index c6bd2ecda..6a070ef11 100644 --- a/src/game/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/game/OutdoorPvP/OutdoorPvPSI.cpp @@ -68,7 +68,7 @@ void OutdoorPvPSI::HandlePlayerLeaveZone(Player* player, bool isMainZone) // Handle case when player returns a silithyst bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 triggerId) { - if (player->isGameMaster() || player->isDead()) + if (player->isGameMaster() || player->IsDead()) return false; switch (triggerId) diff --git a/src/game/References/ThreatManager.cpp b/src/game/References/ThreatManager.cpp index 620ae7914..f375fa13e 100644 --- a/src/game/References/ThreatManager.cpp +++ b/src/game/References/ThreatManager.cpp @@ -121,7 +121,7 @@ void HostileReference::addThreat(float pMod) if (isValid() && pMod >= 0) { 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 } } @@ -425,7 +425,7 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho return; // not to dead and not for dead - if (!pVictim->isAlive() || !getOwner()->isAlive()) + if (!pVictim->IsAlive() || !getOwner()->IsAlive()) return; 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 (redirectedTarget != getOwner() && redirectedTarget->isAlive()) + if (redirectedTarget != getOwner() && redirectedTarget->IsAlive()) { float redirectedThreat = threat * redirectedMod; threat -= redirectedThreat; diff --git a/src/game/WorldHandlers/AchievementMgr.cpp b/src/game/WorldHandlers/AchievementMgr.cpp index 9fc7bd05a..75f37ae2a 100644 --- a/src/game/WorldHandlers/AchievementMgr.cpp +++ b/src/game/WorldHandlers/AchievementMgr.cpp @@ -298,7 +298,7 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou return false; return target->GetHealth() * 100 <= health.percent * target->GetMaxHealth(); 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; // flag set == must be same team, not set == different team return (((Player*)target)->GetTeam() == source->GetTeam()) == (player_dead.own_team_flag != 0); diff --git a/src/game/WorldHandlers/ChatHandler.cpp b/src/game/WorldHandlers/ChatHandler.cpp index 4abed65fa..9047babc1 100644 --- a/src/game/WorldHandlers/ChatHandler.cpp +++ b/src/game/WorldHandlers/ChatHandler.cpp @@ -486,7 +486,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data) std::string msg; msg = recv_data.ReadString(recv_data.ReadBits(9)); - if (!_player->isInCombat()) + if (!_player->IsInCombat()) { if (_player->isAFK()) // Already AFK { @@ -649,7 +649,7 @@ void WorldSession::HandleAddonMessagechatOpcode(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; uint32 emote; @@ -695,7 +695,7 @@ namespace MaNGOS void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data) { - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) return; if (!GetPlayer()->CanSpeak()) diff --git a/src/game/WorldHandlers/CombatHandler.cpp b/src/game/WorldHandlers/CombatHandler.cpp index 88315f174..8f90dce4f 100644 --- a/src/game/WorldHandlers/CombatHandler.cpp +++ b/src/game/WorldHandlers/CombatHandler.cpp @@ -63,7 +63,7 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket& recv_data) 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 // stop attack state at client diff --git a/src/game/WorldHandlers/CreatureLinkingMgr.cpp b/src/game/WorldHandlers/CreatureLinkingMgr.cpp index 92b49b58d..899b7c12e 100644 --- a/src/game/WorldHandlers/CreatureLinkingMgr.cpp +++ b/src/game/WorldHandlers/CreatureLinkingMgr.cpp @@ -465,17 +465,17 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp if (pMaster->IsControlledByPlayer()) return; - if (pMaster->isInCombat()) + if (pMaster->IsInCombat()) pMaster->SetInCombatWith(pEnemy); else pMaster->AI()->AttackStart(pEnemy); break; case LINKING_EVENT_EVADE: - if (!pMaster->isAlive()) + if (!pMaster->IsAlive()) pMaster->Respawn(); break; case LINKING_EVENT_RESPAWN: - if (pMaster->isAlive()) + if (pMaster->IsAlive()) SetFollowing(pSource, pMaster); break; case LINKING_EVENT_DIE: // Nothing linked for this case @@ -525,37 +525,37 @@ void CreatureLinkingHolder::ProcessSlave(CreatureLinkingEvent eventType, Creatur if (pSlave->IsControlledByPlayer()) return; - if (pSlave->isInCombat()) + if (pSlave->IsInCombat()) pSlave->SetInCombatWith(pEnemy); else pSlave->AI()->AttackStart(pEnemy); } break; case LINKING_EVENT_EVADE: - if (flag & FLAG_DESPAWN_ON_EVADE && pSlave->isAlive()) + if (flag & FLAG_DESPAWN_ON_EVADE && pSlave->IsAlive()) pSlave->ForcedDespawn(); - if (flag & FLAG_RESPAWN_ON_EVADE && !pSlave->isAlive()) + if (flag & FLAG_RESPAWN_ON_EVADE && !pSlave->IsAlive()) pSlave->Respawn(); break; 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); - if (flag & FLAG_DESPAWN_ON_DEATH && pSlave->isAlive()) + if (flag & FLAG_DESPAWN_ON_DEATH && pSlave->IsAlive()) pSlave->ForcedDespawn(); - if (flag & FLAG_RESPAWN_ON_DEATH && !pSlave->isAlive()) + if (flag & FLAG_RESPAWN_ON_DEATH && !pSlave->IsAlive()) pSlave->Respawn(); break; case LINKING_EVENT_RESPAWN: if (flag & FLAG_RESPAWN_ON_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(); } - else if (flag & FLAG_DESPAWN_ON_RESPAWN && pSlave->isAlive()) + else if (flag & FLAG_DESPAWN_ON_RESPAWN && pSlave->IsAlive()) pSlave->ForcedDespawn(); - if (flag & FLAG_FOLLOW && pSlave->isAlive() && !pSlave->isInCombat()) + if (flag & FLAG_FOLLOW && pSlave->IsAlive() && !pSlave->IsInCombat()) SetFollowing(pSlave, pSource); break; @@ -635,9 +635,9 @@ bool CreatureLinkingHolder::CanSpawn(Creature* pCreature) if (pMaster && IsSlaveInRangeOfBoss(pCreature, pMaster, pInfo->searchRange)) { 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) - return !pMaster->isAlive(); + return !pMaster->IsAlive(); else return true; } @@ -671,7 +671,7 @@ bool CreatureLinkingHolder::TryFollowMaster(Creature* pCreature) pMaster = pCreature->GetMap()->GetCreature(ObjectGuid(cInfo->GetHighGuid(), cInfo->Entry, pInfo->masterDBGuid)); } - if (pMaster && pMaster->isAlive()) + if (pMaster && pMaster->IsAlive()) { SetFollowing(pCreature, pMaster); return true; diff --git a/src/game/WorldHandlers/GridNotifiers.h b/src/game/WorldHandlers/GridNotifiers.h index 594758894..c84ee82cb 100644 --- a/src/game/WorldHandlers/GridNotifiers.h +++ b/src/game/WorldHandlers/GridNotifiers.h @@ -600,7 +600,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_fobj; } 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 i_fobj->IsWithinDistInMap(u, i_range); @@ -608,7 +608,7 @@ namespace MaNGOS bool operator()(Corpse* 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) return false; @@ -808,7 +808,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } 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(); return true; @@ -828,7 +828,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } 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))) { return true; @@ -847,7 +847,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } 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))) { return true; @@ -870,7 +870,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } 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)) return true; else @@ -890,10 +890,10 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } bool operator()(Unit* u) { - return u->isAlive() + return u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u) - && u->isVisibleForOrDetect(i_funit, i_funit, false); + && u->IsVisibleForOrDetect(i_funit, i_funit, false); } private: WorldObject const* i_obj; @@ -908,7 +908,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } 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; else return false; @@ -925,7 +925,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } 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 false; @@ -943,8 +943,8 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } bool operator()(Unit* u) { - if (u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) && - !i_funit->IsFriendlyTo(u) && u->isVisibleForOrDetect(i_funit, i_funit, false)) + if (u->IsTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) && + !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 return true; @@ -974,7 +974,7 @@ namespace MaNGOS bool operator()(Unit* u) { // 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; // ignore totems as AoE targets @@ -982,7 +982,7 @@ namespace MaNGOS return false; // 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; 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) { // 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; if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->IsTotem()) @@ -1048,7 +1048,7 @@ namespace MaNGOS public: explicit AnyDeadUnitCheck(WorldObject const* fobj) : i_fobj(fobj) {} WorldObject const& GetFocusObject() const { return *i_fobj; } - bool operator()(Unit* u) { return !u->isAlive(); } + bool operator()(Unit* u) { return !u->IsAlive(); } private: WorldObject const* i_fobj; }; @@ -1072,7 +1072,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_funit; } 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 false; @@ -1138,7 +1138,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return i_obj; } 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_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; } 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 false; @@ -1208,7 +1208,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } bool operator()(Player* u) { - return u->isAlive() + return u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && u->HasAura(i_spellId); } diff --git a/src/game/WorldHandlers/GridNotifiersImpl.h b/src/game/WorldHandlers/GridNotifiersImpl.h index 603dc8177..b5109f21b 100644 --- a/src/game/WorldHandlers/GridNotifiersImpl.h +++ b/src/game/WorldHandlers/GridNotifiersImpl.h @@ -81,13 +81,13 @@ inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2) inline void MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType& m) { - if (!i_player.isAlive() || i_player.IsTaxiFlying()) + if (!i_player.IsAlive() || i_player.IsTaxiFlying()) return; for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* c = iter->getSource(); - if (c->isAlive()) + if (c->IsAlive()) PlayerCreatureRelocationWorker(&i_player, c); } } @@ -95,13 +95,13 @@ inline void MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType& m) template<> inline void MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType& m) { - if (!i_creature.isAlive()) + if (!i_creature.IsAlive()) return; for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Player* player = iter->getSource(); - if (player->isAlive() && !player->IsTaxiFlying()) + if (player->IsAlive() && !player->IsTaxiFlying()) PlayerCreatureRelocationWorker(player, &i_creature); } } @@ -109,20 +109,20 @@ inline void MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType& m) template<> inline void MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType& m) { - if (!i_creature.isAlive()) + if (!i_creature.IsAlive()) return; for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* c = iter->getSource(); - if (c != &i_creature && c->isAlive()) + if (c != &i_creature && c->IsAlive()) CreatureCreatureRelocationWorker(c, &i_creature); } } inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) { - if (!target->isAlive() || target->IsTaxiFlying()) + if (!target->IsAlive() || target->IsTaxiFlying()) return; if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsTotem()) diff --git a/src/game/WorldHandlers/Group.cpp b/src/game/WorldHandlers/Group.cpp index 1c8778f97..faa4a0aad 100644 --- a/src/game/WorldHandlers/Group.cpp +++ b/src/game/WorldHandlers/Group.cpp @@ -997,7 +997,7 @@ void Group::GetDataForXPAtKill(Unit const* victim, uint32& count, uint32& sum_le for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player* member = itr->getSource(); - if (!member || !member->isAlive()) // only for alive + if (!member || !member->IsAlive()) // only for alive continue; // 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) { // honor can be in PvP and !PvP (racial leader) cases (for alive) - if (pGroupGuy->isAlive()) + if (pGroupGuy->IsAlive()) pGroupGuy->RewardHonor(pVictim, count); // 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); // 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()) { 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 - 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 if (pVictim->GetTypeId() == TYPEID_UNIT) diff --git a/src/game/WorldHandlers/ItemHandler.cpp b/src/game/WorldHandlers/ItemHandler.cpp index 8d035913a..89329388c 100644 --- a/src/game/WorldHandlers/ItemHandler.cpp +++ b/src/game/WorldHandlers/ItemHandler.cpp @@ -548,7 +548,7 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket& recv_data) recv_data >> guid; - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) return; DEBUG_LOG("WORLD: Received opcode CMSG_LIST_INVENTORY"); @@ -890,7 +890,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleSetAmmoOpcode(WorldPacket& recv_data) { - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) { GetPlayer()->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL); return; diff --git a/src/game/WorldHandlers/LootHandler.cpp b/src/game/WorldHandlers/LootHandler.cpp index b9eb503cd..bad3bb47a 100644 --- a/src/game/WorldHandlers/LootHandler.cpp +++ b/src/game/WorldHandlers/LootHandler.cpp @@ -94,7 +94,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recv_data) { 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)) { @@ -240,7 +240,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/) { 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)) pLoot = &pCreature->loot ; @@ -309,7 +309,7 @@ void WorldSession::HandleLootOpcode(WorldPacket& recv_data) recv_data >> guid; // Check possible cheat - if (!_player->isAlive()) + if (!_player->IsAlive()) return; GetPlayer()->SendLoot(guid, LOOT_CORPSE); @@ -493,7 +493,7 @@ void WorldSession::DoLootRelease(ObjectGuid 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)) return; @@ -504,7 +504,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid) if (group->GetLooterGuid() == player->GetObjectGuid()) group->UpdateLooterGuid(pCreature); - if (loot->isLooted() && !pCreature->isAlive()) + if (loot->isLooted() && !pCreature->IsAlive()) { // for example skinning after normal loot pCreature->PrepareBodyLootState(); diff --git a/src/game/WorldHandlers/MiscHandler.cpp b/src/game/WorldHandlers/MiscHandler.cpp index c7499eabe..8a1ce5baa 100644 --- a/src/game/WorldHandlers/MiscHandler.cpp +++ b/src/game/WorldHandlers/MiscHandler.cpp @@ -56,7 +56,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data) recv_data.read_skip(); - if (GetPlayer()->isAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + if (GetPlayer()->IsAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) return; // the world update order is sessions, players, creatures @@ -276,7 +276,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/) DoLootRelease(lootGuid); // Can not logout if... - if (GetPlayer()->isInCombat() || //...is in combat + if (GetPlayer()->IsInCombat() || //...is in combat GetPlayer()->duel || //...is in Duel //...is jumping ...is falling GetPlayer()->m_movementInfo.HasMovementFlag(MovementFlags(MOVEFLAG_FALLING | MOVEFLAG_FALLINGFAR))) @@ -629,7 +629,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data) ObjectGuid guid; recv_data >> guid; - if (GetPlayer()->isAlive()) + if (GetPlayer()->IsAlive()) return; // do not allow corpse reclaim in arena @@ -668,7 +668,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recv_data) recv_data >> guid; recv_data >> status; - if (GetPlayer()->isAlive()) + if (GetPlayer()->IsAlive()) return; if (status == 0) @@ -686,7 +686,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recv_data) void WorldSession::HandleReturnToGraveyard(WorldPacket& /*recvPacket*/) { Player* pPlayer = GetPlayer(); - if (pPlayer->isAlive() || !pPlayer->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + if (pPlayer->IsAlive() || !pPlayer->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) return; WorldSafeLocsEntry const* ClosestGrave = NULL; @@ -703,7 +703,7 @@ void WorldSession::HandleReturnToGraveyard(WorldPacket& /*recvPacket*/) { bool updateVisibility = pPlayer->IsInWorld() && pPlayer->GetCorpse()->GetMapId() == ClosestGrave->map_id; 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 data << ClosestGrave->map_id; @@ -755,7 +755,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) return; 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); if (pQuest) @@ -795,7 +795,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) return; // 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; if (Corpse* corpse = player->GetCorpse()) diff --git a/src/game/WorldHandlers/MovementHandler.cpp b/src/game/WorldHandlers/MovementHandler.cpp index 27ebd86e0..0d9814f8a 100644 --- a/src/game/WorldHandlers/MovementHandler.cpp +++ b/src/game/WorldHandlers/MovementHandler.cpp @@ -556,7 +556,7 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recv_data) void WorldSession::HandleSummonResponseOpcode(WorldPacket& recv_data) { - if (!_player->isAlive() || _player->isInCombat()) + if (!_player->IsAlive() || _player->IsInCombat()) return; ObjectGuid summonerGuid; @@ -649,11 +649,11 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo) // NOTE: this is actually called many times while falling // even after the player has been teleported away // TODO: discard movement packets after the player is rooted - if (plMover->isAlive()) + if (plMover->IsAlive()) { plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, plMover->GetMaxHealth()); // 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 // starting in the next player update diff --git a/src/game/WorldHandlers/NPCHandler.cpp b/src/game/WorldHandlers/NPCHandler.cpp index 7f19ebab0..632904672 100644 --- a/src/game/WorldHandlers/NPCHandler.cpp +++ b/src/game/WorldHandlers/NPCHandler.cpp @@ -482,7 +482,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket& recv_data) ObjectGuid npcGuid; recv_data >> npcGuid; - if (!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive()) + if (!GetPlayer()->IsInWorld() || !GetPlayer()->IsAlive()) return; 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 // 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->GetEntry()); @@ -630,7 +630,7 @@ void WorldSession::HandleStablePet(WorldPacket& recv_data) recv_data >> npcGUID; - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) { SendStableResult(STABLE_ERR_STABLE); return; @@ -649,7 +649,7 @@ void WorldSession::HandleStablePet(WorldPacket& recv_data) Pet* pet = _player->GetPet(); // 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); return; @@ -737,7 +737,7 @@ void WorldSession::HandleUnstablePet(WorldPacket& recv_data) } Pet* pet = _player->GetPet(); - if (pet && pet->isAlive()) + if (pet && pet->IsAlive()) { SendStableResult(STABLE_ERR_STABLE); return; @@ -841,7 +841,7 @@ void WorldSession::HandleStableSwapPet(WorldPacket& recv_data) } // 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 Pet* newpet = new Pet; diff --git a/src/game/WorldHandlers/PetHandler.cpp b/src/game/WorldHandlers/PetHandler.cpp index 288c1d192..9c342689d 100644 --- a/src/game/WorldHandlers/PetHandler.cpp +++ b/src/game/WorldHandlers/PetHandler.cpp @@ -66,7 +66,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) return; } - if (!pet->isAlive()) + if (!pet->IsAlive()) return; if (pet->GetTypeId() == TYPEID_PLAYER) @@ -309,7 +309,7 @@ void WorldSession::HandlePetStopAttack(WorldPacket& recv_data) return; } - if (!pet->isAlive()) + if (!pet->IsAlive()) return; pet->AttackStop(); diff --git a/src/game/WorldHandlers/QuestHandler.cpp b/src/game/WorldHandlers/QuestHandler.cpp index f07fc81dd..45c7378fc 100644 --- a/src/game/WorldHandlers/QuestHandler.cpp +++ b/src/game/WorldHandlers/QuestHandler.cpp @@ -698,7 +698,7 @@ bool WorldSession::CanInteractWithQuestGiver(ObjectGuid guid, char const* descr) 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()); return false; diff --git a/src/game/WorldHandlers/ScriptMgr.cpp b/src/game/WorldHandlers/ScriptMgr.cpp index 7777519f6..4936b9575 100644 --- a/src/game/WorldHandlers/ScriptMgr.cpp +++ b/src/game/WorldHandlers/ScriptMgr.cpp @@ -944,7 +944,7 @@ bool ScriptAction::GetScriptProcessTargets(WorldObject* pOrigSource, WorldObject CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(m_script->buddyEntry); 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); return false; @@ -1248,7 +1248,7 @@ bool ScriptAction::HandleScriptStep() bool failQuest = false; // 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; else if (m_script->questExplored.distance != 0 && !pWorldObject->IsWithinDistInMap(pPlayer, float(m_script->questExplored.distance))) failQuest = true; diff --git a/src/game/WorldHandlers/Spell.cpp b/src/game/WorldHandlers/Spell.cpp index 057a09959..b34840fed 100644 --- a/src/game/WorldHandlers/Spell.cpp +++ b/src/game/WorldHandlers/Spell.cpp @@ -1139,9 +1139,9 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) { // can cause back attack (if detected) 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); unit->AddThreat(real_caster); @@ -1320,7 +1320,7 @@ void Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask) { // for delayed spells ignore not visible explicit target 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); 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 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 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)) 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->AddThreat(realCaster); @@ -1370,7 +1370,7 @@ void Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask) if (unit->hasUnitState(UNIT_STAT_ATTACK_PLAYER)) 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); 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); // 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 } } @@ -2045,7 +2045,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& { 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)); } @@ -2097,7 +2097,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& { 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)); } @@ -2112,7 +2112,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& // remove not targetable units if spell has no script targets 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++); else ++itr; @@ -3152,7 +3152,7 @@ void Spell::cancel() if (ihit->missCondition == SPELL_MISS_NONE) { 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()); // 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 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(); SpellEffectIndex auraSpellIdx = (*i)->GetEffIndex(); @@ -5050,7 +5050,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_DONT_REPORT; 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; 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 - 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; SpellClassOptionsEntry const* classOptions = m_spellInfo->GetSpellClassOptions(); @@ -5137,7 +5137,7 @@ SpellCastResult Spell::CheckCast(bool strict) if(auraRestrictions && auraRestrictions->TargetAuraStateNot && target->HasAuraState(AuraState(auraRestrictions->TargetAuraStateNot))) 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; // Target aura req check if need @@ -5261,7 +5261,7 @@ SpellCastResult Spell::CheckCast(bool strict) else return SPELL_FAILED_NO_PET; } - else if (!pet->isAlive()) + else if (!pet->IsAlive()) return SPELL_FAILED_TARGETS_DEAD; break; } @@ -5374,7 +5374,7 @@ SpellCastResult Spell::CheckCast(bool strict) } // 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; } // zone check @@ -5509,7 +5509,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (pTarget->IsWithinDistInMap(m_caster, GetSpellMaxRange(srange))) 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 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()); // alive - if (!target || target->isDead()) + if (!target || target->IsDead()) return SPELL_FAILED_BAD_IMPLICIT_TARGETS; // undead if (target->GetCreatureType() != CREATURE_TYPE_UNDEAD) @@ -5679,7 +5679,7 @@ SpellCastResult Spell::CheckCast(bool strict) } else if (m_spellInfo->Id == 68996) // Two forms { - if (m_caster->isInCombat()) + if (m_caster->IsInCombat()) return SPELL_FAILED_AFFECTING_COMBAT; } else if (m_spellInfo->SpellIconID == 156) // Holy Shock @@ -5711,7 +5711,7 @@ SpellCastResult Spell::CheckCast(bool strict) break; for (UnitList::iterator itr = targetsCombat.begin(); itr != targetsCombat.end(); ++itr) - if ((*itr)->isInCombat()) + if ((*itr)->IsInCombat()) return SPELL_FAILED_TARGET_IN_COMBAT; } break; @@ -5852,7 +5852,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel)) return SPELL_FAILED_FOOD_LOWLEVEL; - if (pet->isInCombat()) + if (pet->IsInCombat()) return SPELL_FAILED_AFFECTING_COMBAT; break; @@ -5971,7 +5971,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!pet) return SPELL_FAILED_NO_PET; - if (pet->isAlive()) + if (pet->IsAlive()) return SPELL_FAILED_ALREADY_HAVE_SUMMON; 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) // 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)) 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) { - if (!m_caster->isAlive()) + if (!m_caster->IsAlive()) return SPELL_FAILED_CASTER_DEAD; if (m_caster->IsNonMeleeSpellCasted(false)) // prevent spellcast interruption by another spellcast 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; if (m_caster->GetTypeId() == TYPEID_UNIT && (((Creature*)m_caster)->IsPet() || m_caster->isCharmed())) { // 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; if (!target && m_targets.getUnitTarget()) @@ -6362,7 +6362,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target) // for target dead/target not valid if (_target && m_targets.m_targetMask & TARGET_FLAG_UNIT) { - if (!_target->isTargetableForAttack()) + if (!_target->IsTargetableForAttack()) return SPELL_FAILED_BAD_TARGETS; // guessed error if (IsPositiveSpell(m_spellInfo->Id)) @@ -7744,7 +7744,7 @@ void Spell::FillRaidOrPartyManaPriorityTargets(UnitList& targetUnitMap, Unit* me PrioritizeManaUnitQueue manaUsers; 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)); targetUnitMap.clear(); @@ -7761,7 +7761,7 @@ void Spell::FillRaidOrPartyHealthPriorityTargets(UnitList& targetUnitMap, Unit* PrioritizeHealthUnitQueue healthQueue; for (UnitList::const_iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end(); ++itr) - if (!(*itr)->isDead()) + if (!(*itr)->IsDead()) healthQueue.push(PrioritizeHealthUnitWraper(*itr)); targetUnitMap.clear(); diff --git a/src/game/WorldHandlers/Spell.h b/src/game/WorldHandlers/Spell.h index ef7f0aa82..76f2fba9d 100644 --- a/src/game/WorldHandlers/Spell.h +++ b/src/game/WorldHandlers/Spell.h @@ -743,7 +743,7 @@ namespace MaNGOS for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { Player* pPlayer = itr->getSource(); - if (!pPlayer->isAlive() || pPlayer->IsTaxiFlying()) + if (!pPlayer->IsAlive() || pPlayer->IsTaxiFlying()) continue; if (i_originalCaster->IsFriendlyTo(pPlayer)) @@ -825,7 +825,7 @@ namespace MaNGOS { // 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 - 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 || !itr->getSource()->IsInMap(i_originalCaster)) continue; diff --git a/src/game/WorldHandlers/SpellAuras.cpp b/src/game/WorldHandlers/SpellAuras.cpp index 53acfc998..f6220c9eb 100644 --- a/src/game/WorldHandlers/SpellAuras.cpp +++ b/src/game/WorldHandlers/SpellAuras.cpp @@ -668,12 +668,12 @@ void AreaAura::Update(uint32 diff) for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { 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)) targets.push_back(Target); 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); } } @@ -702,12 +702,12 @@ void AreaAura::Update(uint32 diff) for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); - if (Target && Target->isAlive() && caster->IsFriendlyTo(Target)) + if (Target && Target->IsAlive() && caster->IsFriendlyTo(Target)) { if (caster->IsWithinDistInMap(Target, m_radius)) targets.push_back(Target); 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); } } @@ -1266,7 +1266,7 @@ void Aura::TriggerSpell() Cell::VisitGridObjects(triggerTarget, searcher, 15.0f); for (std::list::const_iterator itr = lList.begin(); itr != lList.end(); ++itr) - if ((*itr)->isAlive()) + if ((*itr)->IsAlive()) (*itr)->AddThreat(triggerTarget, float(5000)); return; @@ -1282,13 +1282,13 @@ void Aura::TriggerSpell() if (target->GetTypeId() != TYPEID_UNIT) return; - ThreatList const& tList = target->getThreatManager().getThreatList(); + ThreatList const& tList = target->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) { Unit* pUnit = target->GetMap()->GetUnit((*itr)->getUnitGuid()); - if (pUnit && target->getThreatManager().getThreat(pUnit)) - target->getThreatManager().modifyThreatPercent(pUnit, -100); + if (pUnit && target->GetThreatManager().getThreat(pUnit)) + target->GetThreatManager().modifyThreatPercent(pUnit, -100); } if (Unit* pEnemy = target->SelectRandomUnfriendlyTarget(target->getVictim(), 100.0f)) @@ -1819,7 +1819,7 @@ void Aura::TriggerSpell() case 69012: // Explosive Barrage { // 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) { if (Unit* expectedTarget = target->GetMap()->GetUnit((*itr)->getUnitGuid())) @@ -2627,10 +2627,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real) // AT REMOVE else { - if (IsQuestTameSpell(GetId()) && target->isAlive()) + if (IsQuestTameSpell(GetId()) && target->IsAlive()) { Unit* caster = GetCaster(); - if (!caster || !caster->isAlive()) + if (!caster || !caster->IsAlive()) return; 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->getVictim() && target->isAlive()) + if (target->getVictim() && target->IsAlive()) target->SetTargetGuid(target->getVictim()->GetObjectGuid()); 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->getVictim() && target->isAlive()) + if (target->getVictim() && target->IsAlive()) target->SetTargetGuid(target->getVictim()->GetObjectGuid()); if (target->GetTypeId() == TYPEID_PLAYER) @@ -5041,7 +5041,7 @@ void Aura::HandleModThreat(bool apply, bool Real) Unit* target = GetTarget(); - if (!target->isAlive()) + if (!target->IsAlive()) return; int level_diff = 0; @@ -5077,12 +5077,12 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real) Unit* target = GetTarget(); - if (!target->isAlive() || target->GetTypeId() != TYPEID_PLAYER) + if (!target->IsAlive() || target->GetTypeId() != TYPEID_PLAYER) return; Unit* caster = GetCaster(); - if (!caster || !caster->isAlive()) + if (!caster || !caster->IsAlive()) return; 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(); - if (!target->isAlive() || !target->CanHaveThreatList()) + if (!target->IsAlive() || !target->CanHaveThreatList()) return; Unit* caster = GetCaster(); - if (!caster || !caster->isAlive()) + if (!caster || !caster->IsAlive()) return; if (apply) @@ -7365,7 +7365,7 @@ void Aura::PeriodicTick() case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: { // don't damage target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; Unit* pCaster = GetCaster(); @@ -7520,14 +7520,14 @@ void Aura::PeriodicTick() case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: { // don't damage target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; Unit* pCaster = GetCaster(); if (!pCaster) return; - if (!pCaster->isAlive()) + if (!pCaster->IsAlive()) return; 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); 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) if (Spell* spell = pCaster->GetCurrentSpell(CurrentSpellTypes(i))) if (spell->m_spellInfo->Id == GetId()) @@ -7614,7 +7614,7 @@ void Aura::PeriodicTick() case SPELL_AURA_OBS_MOD_HEALTH: { // don't heal target if not alive, mostly death persistent effects from items - if (!target->isAlive()) + if (!target->IsAlive()) return; Unit* pCaster = GetCaster(); @@ -7622,7 +7622,7 @@ void Aura::PeriodicTick() return; // 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; // 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: { // don't damage target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS) @@ -7731,7 +7731,7 @@ void Aura::PeriodicTick() if (!pCaster) return; - if (!pCaster->isAlive()) + if (!pCaster->IsAlive()) return; if( GetSpellProto()->GetSpellEffectIdByIndex(GetEffIndex()) == SPELL_EFFECT_PERSISTENT_AREA_AURA && @@ -7832,7 +7832,7 @@ void Aura::PeriodicTick() case SPELL_AURA_PERIODIC_ENERGIZE: { // don't energize target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; // 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: { // don't energize target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; // 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: { // don't mana burn target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; Unit* pCaster = GetCaster(); @@ -7902,7 +7902,7 @@ void Aura::PeriodicTick() Powers powerType = Powers(m_modifier.m_miscvalue); - if (!target->isAlive() || target->getPowerType() != powerType) + if (!target->IsAlive() || target->getPowerType() != powerType) return; // 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: { // don't heal target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; int32 gain = target->ModifyHealth(m_modifier.m_amount); @@ -7949,7 +7949,7 @@ void Aura::PeriodicTick() case SPELL_AURA_MOD_POWER_REGEN: { // don't energize target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; Powers pt = target->getPowerType(); diff --git a/src/game/WorldHandlers/SpellEffects.cpp b/src/game/WorldHandlers/SpellEffects.cpp index 6b49e3e18..6b80cfd6e 100644 --- a/src/game/WorldHandlers/SpellEffects.cpp +++ b/src/game/WorldHandlers/SpellEffects.cpp @@ -269,7 +269,7 @@ void Spell::EffectUnused(SpellEffectEntry const* /*effect*/) void Spell::EffectResurrectNew(SpellEffectEntry const* effect) { - if (!unitTarget || unitTarget->isAlive()) + if (!unitTarget || unitTarget->IsAlive()) return; if (unitTarget->GetTypeId() != TYPEID_PLAYER) @@ -291,7 +291,7 @@ void Spell::EffectResurrectNew(SpellEffectEntry const* effect) void Spell::EffectInstaKill(SpellEffectEntry const* /*effect*/) { - if (!unitTarget || !unitTarget->isAlive()) + if (!unitTarget || !unitTarget->IsAlive()) return; if (m_caster == unitTarget) // prevent interrupt message @@ -327,7 +327,7 @@ void Spell::EffectEnvironmentalDMG(SpellEffectEntry const* effect) void Spell::EffectSchoolDMG(SpellEffectEntry const* effect) { - if (unitTarget && unitTarget->isAlive()) + if (unitTarget && unitTarget->IsAlive()) { 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 // This also resets the target threat - if (m_caster->getThreatManager().getThreat(unitTarget)) - m_caster->getThreatManager().modifyThreatPercent(unitTarget, -100); + if (m_caster->GetThreatManager().getThreat(unitTarget)) + m_caster->GetThreatManager().modifyThreatPercent(unitTarget, -100); // cast summon player m_caster->CastSpell(unitTarget, 21150, true); @@ -1108,7 +1108,7 @@ void Spell::EffectDummy(SpellEffectEntry const* effect) } 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; 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. // If target is not the expected we need to prevent this effect. - if (pCreature->HasLootRecipient() || pCreature->isInCombat()) + if (pCreature->HasLootRecipient() || pCreature->IsInCombat()) return; // set loot recipient, prevent re-use same target @@ -3376,7 +3376,7 @@ void Spell::EffectDummy(SpellEffectEntry const* effect) // Steady Shot if (huntClassOptions && huntClassOptions->SpellFamilyFlags & UI64LIT(0x100000000)) { - if (!unitTarget || !unitTarget->isAlive()) + if (!unitTarget || !unitTarget->IsAlive()) return; 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); return; } - if (!target || !target->isAlive()) + if (!target || !target->IsAlive()) return; m_caster->CastSpell(target, spellid, true, NULL); } @@ -4344,7 +4344,7 @@ void Spell::EffectApplyAura(SpellEffectEntry const* effect) return; // 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())) return; @@ -4388,7 +4388,7 @@ void Spell::EffectPowerDrain(SpellEffectEntry const* effect) if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; if (unitTarget->getPowerType() != drain_power) return; @@ -4449,7 +4449,7 @@ void Spell::EffectPowerBurn(SpellEffectEntry const* effect) if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; if (unitTarget->getPowerType() != powertype) return; @@ -4486,7 +4486,7 @@ void Spell::EffectPowerBurn(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 Unit* caster = GetAffectiveCaster(); @@ -4596,7 +4596,7 @@ void Spell::EffectHeal(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 Unit* caster = GetAffectiveCaster(); @@ -4619,7 +4619,7 @@ void Spell::EffectHealPct(SpellEffectEntry const* /*effect*/) void Spell::EffectHealMechanical(SpellEffectEntry const* /*effect*/) { // 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 Unit* caster = GetAffectiveCaster(); @@ -4640,7 +4640,7 @@ void Spell::EffectHealthLeech(SpellEffectEntry const* effect) { if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; if (damage < 0) @@ -4659,7 +4659,7 @@ void Spell::EffectHealthLeech(SpellEffectEntry const* effect) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier); int32 heal = int32(damage * multiplier); - if (m_caster->isAlive()) + if (m_caster->IsAlive()) { heal = m_caster->SpellHealingBonusTaken(m_caster, m_spellInfo, heal, HEAL); @@ -4839,7 +4839,7 @@ void Spell::EffectEnergize(SpellEffectEntry const* effect) { if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; if(effect->EffectMiscValue < 0 || effect->EffectMiscValue >= MAX_POWERS) @@ -4943,7 +4943,7 @@ void Spell::EffectEnergisePct(SpellEffectEntry const* effect) { if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; if (effect->EffectMiscValue < 0 || effect->EffectMiscValue >= MAX_POWERS) @@ -5148,7 +5148,7 @@ void Spell::EffectApplyAreaAura(SpellEffectEntry const* effect) { if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; 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*/) { // Check for possible target - if (!unitTarget || unitTarget->isInCombat()) + if (!unitTarget || unitTarget->IsInCombat()) return; // target must be OK to do this @@ -6024,7 +6024,7 @@ void Spell::EffectPickPocket(SpellEffectEntry const* /*effect*/) return; // 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()); @@ -6421,7 +6421,7 @@ void Spell::EffectSummonPet(SpellEffectEntry const* effect) if ((petentry == 0 || OldSummon->GetEntry() == petentry) && OldSummon->getPetType() != SUMMON_PET) { // pet in corpse state can't be summoned - if (OldSummon->isDead()) + if (OldSummon->IsDead()) return; OldSummon->GetMap()->Remove((Creature*)OldSummon, false); @@ -6554,7 +6554,7 @@ void Spell::EffectLearnPetSpell(SpellEffectEntry const* effect) Pet* pet = _player->GetPet(); if (!pet) return; - if (!pet->isAlive()) + if (!pet->IsAlive()) return; 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 - if (unitTarget->CanHaveThreatList() && unitTarget->getThreatManager().getCurrentVictim()) - unitTarget->getThreatManager().addThreat(m_caster, unitTarget->getThreatManager().getCurrentVictim()->getThreat()); + if (unitTarget->CanHaveThreatList() && unitTarget->GetThreatManager().getCurrentVictim()) + unitTarget->GetThreatManager().addThreat(m_caster, unitTarget->GetThreatManager().getCurrentVictim()->getThreat()); } void Spell::EffectWeaponDmg(SpellEffectEntry const* effect) { if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; // multiple weapon dmg effect workaround @@ -6897,7 +6897,7 @@ void Spell::EffectWeaponDmg(SpellEffectEntry const* effect) void Spell::EffectThreat(SpellEffectEntry const* /*effect*/) { - if (!unitTarget || !unitTarget->isAlive() || !m_caster->isAlive()) + if (!unitTarget || !unitTarget->IsAlive() || !m_caster->IsAlive()) return; if (!unitTarget->CanHaveThreatList()) @@ -6910,7 +6910,7 @@ void Spell::EffectHealMaxHealth(SpellEffectEntry const* /*effect*/) { if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; uint32 heal = m_caster->GetMaxHealth(); @@ -6922,7 +6922,7 @@ void Spell::EffectInterruptCast(SpellEffectEntry const* /*effect*/) { if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; // 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 22985: { - if (!unitTarget || !unitTarget->isAlive()) + if (!unitTarget || !unitTarget->IsAlive()) return; // Onyxia Scale Cloak @@ -9180,7 +9180,7 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect) // Judgement (seal trigger) if (m_spellInfo->GetCategory() == SPELLCATEGORY_JUDGEMENT) { - if (!unitTarget || !unitTarget->isAlive()) + if (!unitTarget || !unitTarget->IsAlive()) return; uint32 spellId1 = 0; @@ -9789,7 +9789,7 @@ void Spell::EffectFeedPet(SpellEffectEntry const* effect) if (!pet) return; - if (!pet->isAlive()) + if (!pet->IsAlive()) return; int32 benefit = pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel); @@ -9811,7 +9811,7 @@ void Spell::EffectDismissPet(SpellEffectEntry const* /*effect*/) Pet* pet = m_caster->GetPet(); // not let dismiss dead pet - if (!pet || !pet->isAlive()) + if (!pet || !pet->IsAlive()) return; 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) return; - if (unitTarget->isAlive() || !unitTarget->IsInWorld()) + if (unitTarget->IsAlive() || !unitTarget->IsInWorld()) return; switch (m_spellInfo->Id) @@ -9915,7 +9915,7 @@ void Spell::EffectResurrect(SpellEffectEntry const* /*effect*/) void Spell::EffectAddExtraAttacks(SpellEffectEntry const* /*effect*/) { - if (!unitTarget || !unitTarget->isAlive()) + if (!unitTarget || !unitTarget->IsAlive()) return; if (unitTarget->m_extraAttacks) @@ -10016,7 +10016,7 @@ void Spell::EffectQuestComplete(SpellEffectEntry const* effect) void Spell::EffectSelfResurrect(SpellEffectEntry const* effect) { - if (!unitTarget || unitTarget->isAlive()) + if (!unitTarget || unitTarget->IsAlive()) return; if (unitTarget->GetTypeId() != TYPEID_PLAYER) return; @@ -10178,7 +10178,7 @@ void Spell::EffectSummonDeadPet(SpellEffectEntry const* /*effect*/) Pet* pet = _player->GetPet(); if (!pet) return; - if (pet->isAlive()) + if (pet->IsAlive()) return; if (damage < 0) return; @@ -10298,7 +10298,7 @@ void Spell::EffectModifyThreatPercent(SpellEffectEntry const* /*effect*/) if (!unitTarget) return; - unitTarget->getThreatManager().modifyThreatPercent(m_caster, damage); + unitTarget->GetThreatManager().modifyThreatPercent(m_caster, damage); } void Spell::EffectTransmitted(SpellEffectEntry const* effect) @@ -10477,7 +10477,7 @@ void Spell::EffectSkill(SpellEffectEntry const* /*effect*/) void Spell::EffectSpiritHeal(SpellEffectEntry const* /*effect*/) { // TODO player can't see the heal-animation - he should respawn some ticks later - if (!unitTarget || unitTarget->isAlive()) + if (!unitTarget || unitTarget->IsAlive()) return; if (unitTarget->GetTypeId() != TYPEID_PLAYER) return; @@ -10494,7 +10494,7 @@ void Spell::EffectSpiritHeal(SpellEffectEntry const* /*effect*/) void Spell::EffectSkinPlayerCorpse(SpellEffectEntry const* /*effect*/) { 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; ((Player*)unitTarget)->RemovedInsignia((Player*)m_caster); diff --git a/src/game/WorldHandlers/SpellHandler.cpp b/src/game/WorldHandlers/SpellHandler.cpp index 5da27f03a..ca4523490 100644 --- a/src/game/WorldHandlers/SpellHandler.cpp +++ b/src/game/WorldHandlers/SpellHandler.cpp @@ -123,7 +123,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) return; } - if (pUser->isInCombat()) + if (pUser->IsInCombat()) { for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) { @@ -546,7 +546,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) return; } - if (!pet->isAlive()) + if (!pet->IsAlive()) { pet->SendPetActionFeedback(FEEDBACK_PET_DEAD); return; @@ -617,11 +617,11 @@ void WorldSession::HandleSpellClick(WorldPacket& recv_data) ObjectGuid 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; 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; SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(unit->GetEntry()); diff --git a/src/game/WorldHandlers/TradeHandler.cpp b/src/game/WorldHandlers/TradeHandler.cpp index 0192ac64d..69efd386d 100644 --- a/src/game/WorldHandlers/TradeHandler.cpp +++ b/src/game/WorldHandlers/TradeHandler.cpp @@ -585,7 +585,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) if (GetPlayer()->m_trade) return; - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) { SendTradeStatus(TRADE_STATUS_YOU_DEAD); return; @@ -623,7 +623,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) return; } - if (!pOther->isAlive()) + if (!pOther->IsAlive()) { SendTradeStatus(TRADE_STATUS_TARGET_DEAD); return; diff --git a/src/game/WorldHandlers/Transports.cpp b/src/game/WorldHandlers/Transports.cpp index bfb404355..7b7c2cccb 100644 --- a/src/game/WorldHandlers/Transports.cpp +++ b/src/game/WorldHandlers/Transports.cpp @@ -465,7 +465,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) 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); } diff --git a/src/game/WorldHandlers/UnitAuraProcHandler.cpp b/src/game/WorldHandlers/UnitAuraProcHandler.cpp index 528ad3ad9..ce387bc1d 100644 --- a/src/game/WorldHandlers/UnitAuraProcHandler.cpp +++ b/src/game/WorldHandlers/UnitAuraProcHandler.cpp @@ -540,7 +540,7 @@ SpellAuraProcResult Unit::HandleHasteAuraProc(Unit* pVictim, uint32 damage, Aura } // default case - if (!target || (target != this && !target->isAlive())) + if (!target || (target != this && !target->IsAlive())) return SPELL_AURA_PROC_FAILED; if (cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) @@ -605,7 +605,7 @@ SpellAuraProcResult Unit::HandleSpellCritChanceAuraProc(Unit* pVictim, uint32 /* } // default case - if (!target || (target != this && !target->isAlive())) + if (!target || (target != this && !target->IsAlive())) return SPELL_AURA_PROC_FAILED; 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 case 56375: { - if (!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->IsAlive()) return SPELL_AURA_PROC_FAILED; pVictim->RemoveSpellsCausingAura(SPELL_AURA_PERIODIC_DAMAGE); @@ -1389,7 +1389,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit* pVictim, uint32 damage, Aura // Vampiric Touch if (dummyClassOptions && dummyClassOptions->SpellFamilyFlags & UI64LIT(0x0000040000000000)) { - if (!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->IsAlive()) return SPELL_AURA_PROC_FAILED; // pVictim is caster of aura @@ -2847,7 +2847,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit* pVictim, uint32 damage, Aura } // default case - if (!target || (target != this && !target->isAlive())) + if (!target || (target != this && !target->IsAlive())) return SPELL_AURA_PROC_FAILED; 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 46939: // Black Bow of the Betrayer // 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); - if (pVictim && pVictim->isAlive()) + if (pVictim && pVictim->IsAlive()) CastSpell(pVictim, 27526, true, castItem, triggeredByAura); return SPELL_AURA_PROC_OK; case 31255: // Deadly Swiftness (Rank 1) @@ -3401,7 +3401,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d // Lightning Capacitor else if (auraSpellInfo->Id == 37657) { - if (!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->IsAlive()) return SPELL_AURA_PROC_FAILED; // stacking CastSpell(this, 37658, true, NULL, triggeredByAura); @@ -3425,7 +3425,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d // Thunder Capacitor else if (auraSpellInfo->Id == 54841) { - if (!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->IsAlive()) return SPELL_AURA_PROC_FAILED; // stacking 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 else if (auraSpellInfo->Id == 67712 || auraSpellInfo->Id == 67758) { - if (!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->IsAlive()) return SPELL_AURA_PROC_FAILED; uint32 castSpell = auraSpellInfo->Id == 67758 ? 67759 : 67713; @@ -3525,8 +3525,8 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d if (int32(GetHealth()) - int32(damage) >= health30) return SPELL_AURA_PROC_FAILED; - if (pVictim && pVictim->isAlive()) - pVictim->getThreatManager().modifyThreatPercent(this, -10); + if (pVictim && pVictim->IsAlive()) + pVictim->GetThreatManager().modifyThreatPercent(this, -10); basepoints[0] = triggerAmount * GetMaxHealth() / 100; 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; // default case - if (!target || (target != this && !target->isAlive())) + if (!target || (target != this && !target->IsAlive())) return SPELL_AURA_PROC_FAILED; 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; - if (!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->IsAlive()) return SPELL_AURA_PROC_FAILED; Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId() == TYPEID_PLAYER @@ -4174,7 +4174,7 @@ SpellAuraProcResult Unit::HandleManaShieldAuraProc(Unit* pVictim, uint32 /*damag } // default case - if (!target || (target != this && !target->isAlive())) + if (!target || (target != this && !target->IsAlive())) return SPELL_AURA_PROC_FAILED; if (cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) diff --git a/src/mangosd/Main.cpp b/src/mangosd/Main.cpp index 0cd6abd02..cd46f1147 100644 --- a/src/mangosd/Main.cpp +++ b/src/mangosd/Main.cpp @@ -87,7 +87,7 @@ void usage(const char* prog) extern int main(int argc, char** argv) { ///- Command line parsing - char const* cfg_file = _MANGOSD_CONFIG; + char const* cfg_file = MANGOSD_CONFIG_LOCATION; char const* options = ":a:c:s:"; @@ -109,22 +109,22 @@ extern int main(int argc, char** argv) cfg_file = cmd_opts.opt_arg(); break; case 'v': - printf("%s\n", MANGOS_FULLVERSION(REVISION_DATE, REVISION_TIME, REVISION_NR, REVISION_ID)); + printf("%s\n", REVISION_NR); return 0; case 's': { const char* mode = cmd_opts.opt_arg(); if (!strcmp(mode, "run")) - serviceDaemonMode = 'r'; + { serviceDaemonMode = 'r'; } #ifdef WIN32 else if (!strcmp(mode, "install")) - serviceDaemonMode = 'i'; + { serviceDaemonMode = 'i'; } else if (!strcmp(mode, "uninstall")) - serviceDaemonMode = 'u'; + { serviceDaemonMode = 'u'; } #else else if (!strcmp(mode, "stop")) - serviceDaemonMode = 's'; + { serviceDaemonMode = 's'; } #endif else { @@ -153,11 +153,11 @@ extern int main(int argc, char** argv) { case 'i': if (WinServiceInstall()) - sLog.outString("Installing service"); + { sLog.outString("Installing service"); } return 1; case 'u': if (WinServiceUninstall()) - sLog.outString("Uninstalling service"); + { sLog.outString("Uninstalling service"); } return 1; case 'r': WinServiceRun(); @@ -184,7 +184,7 @@ extern int main(int argc, char** argv) } #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(" to stop.\n" " __ __ _ _ ___ ___ ___ \n" " | \\/ |__ _| \\| |/ __|/ _ \\/ __| \n" diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index 7ef5b240f..8ddabd61e 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -46,9 +46,12 @@ #include "RASocket.h" #include "Util.h" #include "revision_sql.h" -#include "MaNGOSsoap.h" #include "MassMailMgr.h" #include "DBCStores.h" +#include "ScriptMgr.h" +#ifdef ENABLE_SOAP +#include "MaNGOSsoap.h" +#endif #include #include @@ -74,7 +77,7 @@ class FreezeDetectorRunnable : public ACE_Based::Runnable void run(void) { if (!_delaytime) - return; + { return; } sLog.outString("Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime / 1000); m_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.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()) { ACE_Time_Value interval(0, 10000); if (m_Reactor->run_reactor_event_loop(interval) == -1) - break; + { break; } if (World::IsStopped()) { @@ -188,7 +191,7 @@ int Master::Run() uint32 pid = CreatePIDFile(pidfile); 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(); return 1; } @@ -203,6 +206,9 @@ int Master::Run() 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 sWorld.SetInitialWorldSettings(); @@ -269,9 +275,9 @@ int Master::Run() else { if (SetProcessAffinityMask(hProcess, curAff)) - sLog.outString("Using processors (bitmask, hex): %x", curAff); + { sLog.outString("Using processors (bitmask, hex): %x", curAff); } else - sLog.outError("Can't set used processors (hex): %x", curAff); + { sLog.outError("Can't set used processors (hex): %x", curAff); } } } sLog.outString(); @@ -283,14 +289,15 @@ int Master::Run() if (Prio) { 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 - sLog.outError("Can't set mangosd process priority class."); + { sLog.outError("Can't set mangosd process priority class."); } sLog.outString(); } } #endif +#ifdef ENABLE_SOAP ///- Start soap serving thread 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)); 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 ACE_Based::Thread* freeze_thread = NULL; @@ -333,6 +346,7 @@ int Master::Run() delete freeze_thread; } +#ifdef ENABLE_SOAP ///- Stop soap thread if (soap_thread) { @@ -340,6 +354,7 @@ int Master::Run() soap_thread->destroy(); delete soap_thread; } +#endif ///- Set server offline in realmlist LoginDatabase.DirectPExecute("UPDATE realmlist SET realmflags = realmflags | %u WHERE id = '%u'", REALM_FLAG_OFFLINE, realmID); @@ -421,6 +436,11 @@ int Master::Run() 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 return World::GetExitCode(); } @@ -441,7 +461,7 @@ bool Master::_StartDB() ///- Initialise the world database 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; } @@ -467,7 +487,7 @@ bool Master::_StartDB() ///- Initialise the Character database 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 WorldDatabase.HaltDelayThread(); @@ -499,7 +519,7 @@ bool Master::_StartDB() sLog.outString("Login Database total connections: %i", nConnections + 1); 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 WorldDatabase.HaltDelayThread(); @@ -516,6 +536,8 @@ bool Master::_StartDB() return false; } + sLog.outString(); + ///- Get the realm Id from the configuration file realmID = sConfig.GetIntDefault("RealmID", 0); if (!realmID) @@ -530,6 +552,7 @@ bool Master::_StartDB() } sLog.outString("Realm running as realm ID %d", realmID); + sLog.outString(); ///- Clean the database before starting clearOnlineAccounts(); @@ -538,6 +561,7 @@ bool Master::_StartDB() sLog.outString("Using World DB: %s", sWorld.GetDBVersion()); sLog.outString("Using creature EventAI: %s", sWorld.GetCreatureEventAIVersion()); + sLog.outString(); return true; } diff --git a/src/mangosd/Master.h b/src/mangosd/Master.h index d45dfbaed..0462a09c1 100644 --- a/src/mangosd/Master.h +++ b/src/mangosd/Master.h @@ -26,28 +26,66 @@ /// @{ /// \file -#ifndef _MASTER_H -#define _MASTER_H +#ifndef MANGOS_H_MASTER +#define MANGOS_H_MASTER #include "Common.h" #include "Policies/Singleton.h" -/// Start the server +/** + * @brief Start the server + * + */ class Master { public: + /** + * @brief + * + */ Master(); + /** + * @brief + * + */ ~Master(); + /** + * @brief + * + * @return int + */ int Run(); - static volatile uint32 m_masterLoopCounter; + static volatile uint32 m_masterLoopCounter; /**< TODO */ private: + /** + * @brief + * + * @return bool + */ bool _StartDB(); + /** + * @brief + * + */ void _HookSignals(); + /** + * @brief + * + */ void _UnhookSignals(); + /** + * @brief + * + * @param s + */ static void _OnSignal(int s); + /** + * @brief + * + */ void clearOnlineAccounts(); }; diff --git a/src/modules/SD2/base/escort_ai.cpp b/src/modules/SD2/base/escort_ai.cpp index a6717792e..ba5fc5f0e 100644 --- a/src/modules/SD2/base/escort_ai.cpp +++ b/src/modules/SD2/base/escort_ai.cpp @@ -138,7 +138,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* pWho) } // 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; } diff --git a/src/modules/SD2/base/follower_ai.cpp b/src/modules/SD2/base/follower_ai.cpp index b786f4373..3a2c04622 100644 --- a/src/modules/SD2/base/follower_ai.cpp +++ b/src/modules/SD2/base/follower_ai.cpp @@ -76,7 +76,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* pWho) } // 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; } diff --git a/src/modules/SD2/include/sc_creature.cpp b/src/modules/SD2/include/sc_creature.cpp index f94285658..c4331aa41 100644 --- a/src/modules/SD2/include/sc_creature.cpp +++ b/src/modules/SD2/include/sc_creature.cpp @@ -102,7 +102,7 @@ void ScriptedAI::MoveInLineOfSight(Unit* pWho) */ void ScriptedAI::AttackStart(Unit* pWho) { - if (!m_creature->CanAttackByItself()) + if (!m_creature->CanInitiateAttack()) return; 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) { - if (!m_creature->CanAttackByItself()) + if (!m_creature->CanInitiateAttack()) return; if (pWho && m_creature->Attack(pWho, true)) diff --git a/src/modules/SD2/scripts/world/mob_generic_creature.cpp b/src/modules/SD2/scripts/world/mob_generic_creature.cpp index d61cc14e7..0922dd381 100644 --- a/src/modules/SD2/scripts/world/mob_generic_creature.cpp +++ b/src/modules/SD2/scripts/world/mob_generic_creature.cpp @@ -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); } // 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 if (Healing) { DoCastSpell(m_creature, info); } diff --git a/src/modules/SD2/system/ScriptLoader.cpp b/src/modules/SD2/system/ScriptLoader.cpp index b9c97995d..a2ceafab9 100644 --- a/src/modules/SD2/system/ScriptLoader.cpp +++ b/src/modules/SD2/system/ScriptLoader.cpp @@ -554,14 +554,6 @@ void AddScripts() // battlegrounds AddSC_battleground(); - // custom - - // examples - AddSC_example_creature(); - AddSC_example_escort(); - AddSC_example_gossip_codebox(); - AddSC_example_misc(); - // world AddSC_areatrigger_scripts(); AddSC_bosses_emerald_dragons(); diff --git a/win/BuildEverything_vc120.sln b/win/BuildEverything_vc120.sln index 7000bf66c..ae96ddb47 100644 --- a/win/BuildEverything_vc120.sln +++ b/win/BuildEverything_vc120.sln @@ -32,11 +32,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "game", "VC120\game.vcxproj" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsoap", "VC120\gsoap.vcxproj", "{53CF48ED-FEFE-4165-A9CA-F000ABC572B6}" 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}" ProjectSection(ProjectDependencies) = postProject {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.Build.0 = 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.Build.0 = Debug|Win32 {29E1FE24-1C69-4E6B-945D-02544988A5FA}.Debug|x64.ActiveCfg = Debug|Win32 diff --git a/win/VC120/bzip2.vcxproj b/win/VC120/bzip2.vcxproj index 37ebb42ce..c5d459437 100644 --- a/win/VC120/bzip2.vcxproj +++ b/win/VC120/bzip2.vcxproj @@ -113,7 +113,7 @@ - + diff --git a/win/VC120/mangosd.vcxproj b/win/VC120/mangosd.vcxproj index cd1fa9162..8b6becdf8 100644 --- a/win/VC120/mangosd.vcxproj +++ b/win/VC120/mangosd.vcxproj @@ -85,7 +85,7 @@ /machine:X86 %(AdditionalOptions) - 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 + 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; ../../dep/acelite/ace;../../dep/acelite/ace/$(Configuration);;../../src/mangosd/$(Configuration);../../src/mangosd/$(Configuration)/$(Configuration);%(AdditionalLibraryDirectories) false $(Configuration)/mangosd.lib @@ -134,7 +134,7 @@ /machine:X86 /debug %(AdditionalOptions) - 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 + 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; ../../dep/acelite/ace;../../dep/acelite/ace/$(Configuration);;../../src/mangosd/$(Configuration);../../src/mangosd/$(Configuration)/$(Configuration);%(AdditionalLibraryDirectories) true $(Configuration)/mangosd.lib @@ -169,9 +169,6 @@ - - 61BCE72F-B726-48F3-9D02-7FD551F82DF8 - D70895A7-4EA1-48BE-A557-834D4357BAD3 diff --git a/win/VC120/mangosscript.vcxproj b/win/VC120/mangosscript.vcxproj index 1706c8987..417700380 100644 --- a/win/VC120/mangosscript.vcxproj +++ b/win/VC120/mangosscript.vcxproj @@ -187,7 +187,6 @@ - @@ -285,22 +284,6 @@ - - - - - - - - - - - - - - - - @@ -316,7 +299,6 @@ - @@ -327,7 +309,6 @@ - @@ -338,7 +319,6 @@ -