diff --git a/src/framework/GameSystem/Grid.h b/src/framework/GameSystem/Grid.h index 1996180e9..5bc1ac93b 100644 --- a/src/framework/GameSystem/Grid.h +++ b/src/framework/GameSystem/Grid.h @@ -130,7 +130,7 @@ class Grid */ bool AddGridObject(SPECIFIC_OBJECT* obj) { - if (obj->isActiveObject()) + if (obj->IsActiveObject()) { m_activeGridObjects.insert(obj); } return i_container.template insert(obj); @@ -145,7 +145,7 @@ class Grid */ bool RemoveGridObject(SPECIFIC_OBJECT* obj) { - if (obj->isActiveObject()) + if (obj->IsActiveObject()) { m_activeGridObjects.erase(obj); } return i_container.template remove(obj); diff --git a/src/game/BattleGround/BattleGround.cpp b/src/game/BattleGround/BattleGround.cpp index 71514c2ad..7624dc5f9 100644 --- a/src/game/BattleGround/BattleGround.cpp +++ b/src/game/BattleGround/BattleGround.cpp @@ -1138,7 +1138,7 @@ void BattleGround::SendRewardMarkByMail(Player* plr, uint32 mark, uint32 count) /// The PLR. void BattleGround::RewardQuestComplete(Player* plr) { - uint32 quest; + uint32 quest = 0; switch (GetTypeID()) { case BATTLEGROUND_AV: @@ -2072,6 +2072,11 @@ void BattleGround::CheckArenaWinConditions() EndBattleGround(ALLIANCE); } +/// +/// Sets the bg raid. +/// +/// The team. +/// The bg_raid. void BattleGround::SetBgRaid(Team team, Group* bg_raid) { Group*& old_raid = m_BgRaids[GetTeamIndexByTeamId(team)]; diff --git a/src/game/ChatCommands/Level1.cpp b/src/game/ChatCommands/Level1.cpp index 820bace19..3c5b74b71 100644 --- a/src/game/ChatCommands/Level1.cpp +++ b/src/game/ChatCommands/Level1.cpp @@ -911,9 +911,9 @@ bool ChatHandler::HandleModifyFactionCommand(char* args) { uint32 factionid = chr->getFaction(); uint32 flag = chr->GetUInt32Value(UNIT_FIELD_FLAGS); - uint32 NpcFlags = chr->GetUInt32Value(UNIT_NPC_FLAGS); + uint32 npcflag = chr->GetUInt32Value(UNIT_NPC_FLAGS); uint32 dyflag = chr->GetUInt32Value(UNIT_DYNAMIC_FLAGS); - PSendSysMessage(LANG_CURRENT_FACTION, chr->GetGUIDLow(), factionid, flag, NpcFlags, dyflag); + PSendSysMessage(LANG_CURRENT_FACTION, chr->GetGUIDLow(), factionid, flag, npcflag, dyflag); } return true; } @@ -940,19 +940,19 @@ bool ChatHandler::HandleModifyFactionCommand(char* args) if (!ExtractOptUInt32(&args, flag, chr->GetUInt32Value(UNIT_FIELD_FLAGS))) { return false; } - uint32 NpcFlags; - if (!ExtractOptUInt32(&args, NpcFlags, chr->GetUInt32Value(UNIT_NPC_FLAGS))) + uint32 npcflag; + if (!ExtractOptUInt32(&args, npcflag, chr->GetUInt32Value(UNIT_NPC_FLAGS))) { return false; } uint32 dyflag; if (!ExtractOptUInt32(&args, dyflag, chr->GetUInt32Value(UNIT_DYNAMIC_FLAGS))) { return false; } - PSendSysMessage(LANG_YOU_CHANGE_FACTION, chr->GetGUIDLow(), factionid, flag, NpcFlags, dyflag); + PSendSysMessage(LANG_YOU_CHANGE_FACTION, chr->GetGUIDLow(), factionid, flag, npcflag, dyflag); chr->setFaction(factionid); chr->SetUInt32Value(UNIT_FIELD_FLAGS, flag); - chr->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags); + chr->SetUInt32Value(UNIT_NPC_FLAGS, npcflag); chr->SetUInt32Value(UNIT_DYNAMIC_FLAGS, dyflag); return true; @@ -2288,14 +2288,15 @@ bool ChatHandler::HandleGoGridCommand(char* args) bool ChatHandler::HandleModifyDrunkCommand(char* args) { - if (!*args) { return false; } + if (!*args) + return false; uint8 drunkValue = (uint8)atoi(args); if (drunkValue > 100) drunkValue = 100; if (Player* target = getSelectedPlayer()) - target->SetDrunkValue(drunkValue); + target->SetDrunkValue(drunkValue); return true; } diff --git a/src/game/ChatCommands/Level2.cpp b/src/game/ChatCommands/Level2.cpp index be34866a1..41a089763 100644 --- a/src/game/ChatCommands/Level2.cpp +++ b/src/game/ChatCommands/Level2.cpp @@ -271,7 +271,7 @@ bool ChatHandler::HandleTriggerCommand(char* args) AreaTrigger const* at = sObjectMgr.GetAreaTrigger(atEntry->id); if (at) - PSendSysMessage(LANG_TRIGGER_REQ_LEVEL, at->requiredLevel); + { PSendSysMessage(LANG_TRIGGER_REQ_LEVEL, at->requiredLevel); } if (uint32 quest_id = sObjectMgr.GetQuestForAreaTrigger(atEntry->id)) { @@ -286,9 +286,9 @@ bool ChatHandler::HandleTriggerCommand(char* args) SendSysMessage(LANG_TRIGGER_REQ_ITEMS); if (at->requiredItem) - ShowItemListHelper(at->requiredItem, loc_idx, pl); + { ShowItemListHelper(at->requiredItem, loc_idx, pl); } if (at->requiredItem2) - ShowItemListHelper(at->requiredItem2, loc_idx, pl); + { ShowItemListHelper(at->requiredItem2, loc_idx, pl); } } if (at->requiredQuest) @@ -1369,6 +1369,7 @@ bool ChatHandler::HandleCharacterAchievementsCommand(char* args) void ChatHandler::ShowFactionListHelper(FactionEntry const* factionEntry, LocaleConstant loc, FactionState const* repState /*= NULL*/, Player* target /*= NULL */) { std::string name = factionEntry->name[loc]; + // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format // or "id - [faction] [no reputation]" format std::ostringstream ss; @@ -1921,6 +1922,7 @@ bool ChatHandler::HandleNpcMoveCommand(char* args) Player* player = m_session->GetPlayer(); Creature* pCreature = getSelectedCreature(); + if (!pCreature) { // number or [name] Shift-click form |color|Hcreature:creature_guid|h[name]|h|r @@ -2476,7 +2478,6 @@ bool ChatHandler::HandleDeMorphCommand(char* /*args*/) if (!target) { target = m_session->GetPlayer(); } - // check online security else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target)) { return false; } @@ -2679,11 +2680,11 @@ bool ChatHandler::HandleTicketCommand(char* args) PSendSysMessage(LANG_COMMAND_TICKETCOUNT, count, GetOnOffStr(accept)); } else - PSendSysMessage(LANG_COMMAND_TICKETCOUNT_CONSOLE, count); + { PSendSysMessage(LANG_COMMAND_TICKETCOUNT_CONSOLE, count); } return true; } - + // ticket accept on if (strncmp(px, "on", 3) == 0) { @@ -2756,7 +2757,7 @@ bool ChatHandler::HandleTicketCommand(char* args) // no response text? if (!*args) - return false; + { return false; } ticket->SetResponseText(args); @@ -2771,7 +2772,7 @@ bool ChatHandler::HandleTicketCommand(char* args) if (ExtractUInt32(&px, num)) { if (num == 0) - return false; + { return false; } // mgr numbering tickets start from 0 GMTicket* ticket = sTicketMgr.GetGMTicketByOrderPos(num - 1); @@ -2789,7 +2790,7 @@ bool ChatHandler::HandleTicketCommand(char* args) ObjectGuid target_guid; std::string target_name; if (!ExtractPlayerTarget(&px, NULL, &target_guid, &target_name)) - return false; + { return false; } // ticket $char_name GMTicket* ticket = sTicketMgr.GetGMTicket(target_guid); @@ -2849,7 +2850,7 @@ bool ChatHandler::HandleDelTicketCommand(char* args) PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL, GetNameLink(pl).c_str()); } else - PSendSysMessage(LANG_COMMAND_TICKETDEL); + { PSendSysMessage(LANG_COMMAND_TICKETDEL); } return true; } @@ -3139,7 +3140,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args) // Did user provide a GUID or did the user select a creature? Creature* targetCreature = getSelectedCreature(); // Expect a visual waypoint to be selected - Creature* wpOwner; // Who moves along the waypoint + Creature* wpOwner = NULL; // Who moves along the waypoint uint32 wpId = 0; WaypointPathOrigin wpSource = PATH_NO_PATH; int32 wpPathId = 0; @@ -3392,7 +3393,7 @@ bool ChatHandler::HandleWpShowCommand(char* args) } } - Creature* wpOwner; ///< Npc that is moving + Creature* wpOwner = NULL; ///< Npc that is moving TemporarySummonWaypoint* wpTarget = NULL; // Define here for wp-info command // Show info for the selected waypoint (Step one: get moving npc) @@ -3543,7 +3544,7 @@ bool ChatHandler::HandleWpExportCommand(char* args) if (!*args) return false; - Creature* wpOwner; + Creature* wpOwner = NULL; WaypointPathOrigin wpOrigin = PATH_NO_PATH; int32 wpPathId = 0; diff --git a/src/game/ChatCommands/Level3.cpp b/src/game/ChatCommands/Level3.cpp index 25a7bd198..873a45bb0 100644 --- a/src/game/ChatCommands/Level3.cpp +++ b/src/game/ChatCommands/Level3.cpp @@ -4352,7 +4352,7 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/) } uint32 faction = target->getFaction(); - uint32 NpcFlagss = target->GetUInt32Value(UNIT_NPC_FLAGS); + uint32 npcflags = target->GetUInt32Value(UNIT_NPC_FLAGS); uint32 displayid = target->GetDisplayId(); uint32 nativeid = target->GetNativeDisplayId(); uint32 Entry = target->GetEntry(); @@ -4372,11 +4372,11 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/) break; if (diff < MAX_DIFFICULTY) - PSendSysMessage(LANG_NPCINFO_CHAR_DIFFICULTY, target->GetGuidStr().c_str(), faction, NpcFlagss, + PSendSysMessage(LANG_NPCINFO_CHAR_DIFFICULTY, target->GetGuidStr().c_str(), faction, npcflags, Entry, target->GetCreatureInfo()->Entry, diff, displayid, nativeid); else - PSendSysMessage(LANG_NPCINFO_CHAR, target->GetGuidStr().c_str(), faction, NpcFlagss, Entry, displayid, nativeid); + PSendSysMessage(LANG_NPCINFO_CHAR, target->GetGuidStr().c_str(), faction, npcflags, Entry, displayid, nativeid); PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel()); PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth()); @@ -4386,11 +4386,11 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/) PSendSysMessage(LANG_NPCINFO_DUNGEON_ID, target->GetInstanceId()); PSendSysMessage(LANG_NPCINFO_POSITION, float(target->GetPositionX()), float(target->GetPositionY()), float(target->GetPositionZ())); - if ((NpcFlagss & UNIT_NPC_FLAG_VENDOR)) + if ((npcflags & UNIT_NPC_FLAG_VENDOR)) { SendSysMessage(LANG_NPCINFO_VENDOR); } - if ((NpcFlagss & UNIT_NPC_FLAG_TRAINER)) + if ((npcflags & UNIT_NPC_FLAG_TRAINER)) { SendSysMessage(LANG_NPCINFO_TRAINER); } @@ -5387,17 +5387,17 @@ bool ChatHandler::HandleServerRestartCommand(char* args) { uint32 delay; if (!ExtractUInt32(&args, delay)) - return false; + { return false; } uint32 exitcode; if (!ExtractOptUInt32(&args, exitcode, RESTART_EXIT_CODE)) - return false; + { return false; } // Exit code should be in range of 0-125, 126-255 is used // in many shells for their own return codes and code > 255 // is not supported in many others if (exitcode > 125) - return false; + { return false; } sWorld.ShutdownServ(delay, SHUTDOWN_MASK_RESTART, exitcode); return true; diff --git a/src/game/ChatCommands/debugcmds.cpp b/src/game/ChatCommands/debugcmds.cpp index 6ca97eb2d..118107d39 100644 --- a/src/game/ChatCommands/debugcmds.cpp +++ b/src/game/ChatCommands/debugcmds.cpp @@ -311,7 +311,7 @@ bool ChatHandler::HandleDebugSendChannelNotifyCommand(char* args) // Send notification in chat bool ChatHandler::HandleDebugSendChatMsgCommand(char* args) { - const char* msg = "testtest"; + const char* msg = args; uint32 type; if (!ExtractUInt32(&args, type) || type > 255) @@ -1120,7 +1120,7 @@ bool ChatHandler::HandleDebugSpellCoefsCommand(char* args) direct_calc, direct_calc * SCALE_SPELLPOWER_HEALING, bonus ? bonus->direct_damage : 0.0f, bonus ? bonus->ap_bonus : 0.0f); PSendSysMessage(LANG_SPELLCOEFS, spellid, isDotHeal ? dotHealStr : dotDamageStr, dot_calc, dot_calc * SCALE_SPELLPOWER_HEALING, bonus ? bonus->dot_damage : 0.0f, bonus ? bonus->ap_dot_bonus : 0.0f); - + return true; } diff --git a/src/game/MotionGenerators/ConfusedMovementGenerator.cpp b/src/game/MotionGenerators/ConfusedMovementGenerator.cpp index 07e7db874..9b6ab2ef4 100644 --- a/src/game/MotionGenerators/ConfusedMovementGenerator.cpp +++ b/src/game/MotionGenerators/ConfusedMovementGenerator.cpp @@ -37,7 +37,7 @@ void ConfusedMovementGenerator::Initialize(T& unit) unit.GetPosition(i_x, i_y, i_z); if (!unit.IsAlive() || unit.hasUnitState(UNIT_STAT_NOT_MOVE)) - return; + { return; } unit.StopMoving(); unit.addUnitState(UNIT_STAT_CONFUSED_MOVE); @@ -57,7 +57,7 @@ void ConfusedMovementGenerator::Reset(T& unit) i_nextMoveTime.Reset(0); if (!unit.IsAlive() || unit.hasUnitState(UNIT_STAT_NOT_MOVE)) - return; + { return; } unit.StopMoving(); unit.addUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_CONFUSED_MOVE); @@ -68,7 +68,7 @@ bool ConfusedMovementGenerator::Update(T& unit, const uint32& diff) { // ignore in case other no reaction state if (unit.hasUnitState(UNIT_STAT_CAN_NOT_REACT & ~UNIT_STAT_CONFUSED)) - return true; + { return true; } if (i_nextMoveTime.Passed()) { @@ -76,7 +76,7 @@ bool ConfusedMovementGenerator::Update(T& unit, const uint32& diff) unit.addUnitState(UNIT_STAT_CONFUSED_MOVE); if (unit.movespline->Finalized()) - i_nextMoveTime.Reset(urand(800, 1500)); + { i_nextMoveTime.Reset(urand(800, 1500)); } } else { diff --git a/src/game/MotionGenerators/ConfusedMovementGenerator.h b/src/game/MotionGenerators/ConfusedMovementGenerator.h index e08fdd40b..175e94daf 100644 --- a/src/game/MotionGenerators/ConfusedMovementGenerator.h +++ b/src/game/MotionGenerators/ConfusedMovementGenerator.h @@ -28,7 +28,7 @@ #include "MovementGenerator.h" template -class ConfusedMovementGenerator +class ConfusedMovementGenerator : public MovementGeneratorMedium< T, ConfusedMovementGenerator > { public: diff --git a/src/game/MotionGenerators/FleeingMovementGenerator.cpp b/src/game/MotionGenerators/FleeingMovementGenerator.cpp index 9b3d961c7..39292d9fd 100644 --- a/src/game/MotionGenerators/FleeingMovementGenerator.cpp +++ b/src/game/MotionGenerators/FleeingMovementGenerator.cpp @@ -39,7 +39,7 @@ void FleeingMovementGenerator::_setTargetLocation(T& owner) { // ignore in case other no reaction state if (owner.hasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_NOT_MOVE) & ~UNIT_STAT_FLEEING)) - return; + { return; } float x, y, z; if (!_getPoint(owner, x, y, z)) @@ -76,9 +76,9 @@ bool FleeingMovementGenerator::_getPoint(T& owner, float& x, float& y, float& { dist_from_caster = fright->GetDistance(&owner); if (dist_from_caster > 0.2f) - angle_to_caster = fright->GetAngle(&owner); + { angle_to_caster = fright->GetAngle(&owner); } else - angle_to_caster = frand(0, 2 * M_PI_F); + { angle_to_caster = frand(0, 2 * M_PI_F); } } else { @@ -113,7 +113,7 @@ bool FleeingMovementGenerator::_getPoint(T& owner, float& x, float& y, float& // try to fix z if (!owner.GetMap()->GetHeightInRange(owner.GetPhaseMask(), x, y, z)) return false; - + if (owner.GetTypeId() == TYPEID_PLAYER) { // check any collision @@ -172,7 +172,7 @@ template bool FleeingMovementGenerator::Update(T& owner, const uint32& time_diff) { if (!owner.IsAlive()) - return false; + { return false; } // ignore in case other no reaction state if (owner.hasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_NOT_MOVE) & ~UNIT_STAT_FLEEING)) @@ -183,7 +183,7 @@ bool FleeingMovementGenerator::Update(T& owner, const uint32& time_diff) i_nextCheckTime.Update(time_diff); if (i_nextCheckTime.Passed() && owner.movespline->Finalized()) - _setTargetLocation(owner); + { _setTargetLocation(owner); } return true; } @@ -217,7 +217,7 @@ void TimedFleeingMovementGenerator::Finalize(Unit& owner) bool TimedFleeingMovementGenerator::Update(Unit& owner, const uint32& time_diff) { if (!owner.IsAlive()) - return false; + { return false; } // ignore in case other no reaction state if (owner.hasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_NOT_MOVE) & ~UNIT_STAT_FLEEING)) @@ -228,7 +228,7 @@ bool TimedFleeingMovementGenerator::Update(Unit& owner, const uint32& time_diff) i_totalFleeTime.Update(time_diff); if (i_totalFleeTime.Passed()) - return false; + { return false; } // This calls grant-parent Update method hiden by FleeingMovementGenerator::Update(Creature &, const uint32 &) version // This is done instead of casting Unit& to Creature& and call parent method, then we can use Unit directly diff --git a/src/game/MotionGenerators/FleeingMovementGenerator.h b/src/game/MotionGenerators/FleeingMovementGenerator.h index 02f3db60b..8480538fe 100644 --- a/src/game/MotionGenerators/FleeingMovementGenerator.h +++ b/src/game/MotionGenerators/FleeingMovementGenerator.h @@ -29,7 +29,7 @@ #include "ObjectGuid.h" template -class FleeingMovementGenerator +class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovementGenerator > { public: @@ -51,7 +51,7 @@ class FleeingMovementGenerator TimeTracker i_nextCheckTime; }; -class TimedFleeingMovementGenerator +class TimedFleeingMovementGenerator : public FleeingMovementGenerator { public: diff --git a/src/game/MotionGenerators/HomeMovementGenerator.cpp b/src/game/MotionGenerators/HomeMovementGenerator.cpp index de5ad12c5..04da339e3 100644 --- a/src/game/MotionGenerators/HomeMovementGenerator.cpp +++ b/src/game/MotionGenerators/HomeMovementGenerator.cpp @@ -42,7 +42,7 @@ void HomeMovementGenerator::Reset(Creature&) void HomeMovementGenerator::_setTargetLocation(Creature& owner) { if (owner.hasUnitState(UNIT_STAT_NOT_MOVE)) - return; + { return; } Movement::MoveSplineInit init(owner); float x, y, z, o; @@ -72,7 +72,7 @@ void HomeMovementGenerator::Finalize(Creature& owner) if (arrived) { if (owner.GetTemporaryFactionFlags() & TEMPFACTION_RESTORE_REACH_HOME) - owner.ClearTemporaryFaction(); + { owner.ClearTemporaryFaction(); } owner.SetWalk(!owner.hasUnitState(UNIT_STAT_RUNNING_STATE) && !owner.IsLevitating(), false); owner.LoadCreatureAddon(true); diff --git a/src/game/MotionGenerators/HomeMovementGenerator.h b/src/game/MotionGenerators/HomeMovementGenerator.h index fb733acdd..8e38992c0 100644 --- a/src/game/MotionGenerators/HomeMovementGenerator.h +++ b/src/game/MotionGenerators/HomeMovementGenerator.h @@ -30,10 +30,10 @@ class Creature; template < class T > -class HomeMovementGenerator; +class HomeMovementGenerator; template <> -class HomeMovementGenerator +class HomeMovementGenerator : public MovementGeneratorMedium< Creature, HomeMovementGenerator > { public: diff --git a/src/game/MotionGenerators/IdleMovementGenerator.cpp b/src/game/MotionGenerators/IdleMovementGenerator.cpp index 43b191bf5..9df90a7a1 100644 --- a/src/game/MotionGenerators/IdleMovementGenerator.cpp +++ b/src/game/MotionGenerators/IdleMovementGenerator.cpp @@ -60,7 +60,7 @@ bool DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff) { if (time_diff > m_timer) - return false; + { return false; } m_timer -= time_diff; return true; diff --git a/src/game/MotionGenerators/IdleMovementGenerator.h b/src/game/MotionGenerators/IdleMovementGenerator.h index 5f0ccffc5..bb95d8b14 100644 --- a/src/game/MotionGenerators/IdleMovementGenerator.h +++ b/src/game/MotionGenerators/IdleMovementGenerator.h @@ -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 * @@ -27,7 +27,7 @@ #include "MovementGenerator.h" -class IdleMovementGenerator : public MovementGenerator +class IdleMovementGenerator : public MovementGenerator { public: @@ -41,7 +41,7 @@ class IdleMovementGenerator : public MovementGenerator extern IdleMovementGenerator si_idleMovement; -class DistractMovementGenerator : public MovementGenerator +class DistractMovementGenerator : public MovementGenerator { public: explicit DistractMovementGenerator(uint32 timer) : m_timer(timer) {} @@ -57,7 +57,7 @@ class DistractMovementGenerator : public MovementGenerator uint32 m_timer; }; -class AssistanceDistractMovementGenerator : public DistractMovementGenerator +class AssistanceDistractMovementGenerator : public DistractMovementGenerator { public: AssistanceDistractMovementGenerator(uint32 timer) : diff --git a/src/game/MotionGenerators/MotionMaster.cpp b/src/game/MotionGenerators/MotionMaster.cpp index c3d9105ac..bf4e924be 100644 --- a/src/game/MotionGenerators/MotionMaster.cpp +++ b/src/game/MotionGenerators/MotionMaster.cpp @@ -65,7 +65,7 @@ void MotionMaster::Initialize() (static_cast*>(top()))->InitializeWaypointPath(*((Creature*)(m_owner)), 0, PATH_NO_PATH, 0, 0); } else - push(&si_idleMovement); + { push(&si_idleMovement); } } MotionMaster::~MotionMaster() @@ -76,14 +76,14 @@ MotionMaster::~MotionMaster() MovementGenerator* m = top(); pop(); if (!isStatic(m)) - delete m; + { delete m; } } } void MotionMaster::UpdateMotion(uint32 diff) { if (m_owner->hasUnitState(UNIT_STAT_CAN_NOT_MOVE)) - return; + { return; } MANGOS_ASSERT(!empty()); m_cleanFlag |= MMCF_UPDATE; @@ -94,7 +94,7 @@ void MotionMaster::UpdateMotion(uint32 diff) MovementExpired(); } else - m_cleanFlag &= ~MMCF_UPDATE; + { m_cleanFlag &= ~MMCF_UPDATE; } if (m_expList) { @@ -102,14 +102,14 @@ void MotionMaster::UpdateMotion(uint32 diff) { MovementGenerator* mg = (*m_expList)[i]; if (!isStatic(mg)) - delete mg; + { delete mg; } } delete m_expList; m_expList = NULL; if (empty()) - Initialize(); + { Initialize(); } if (m_cleanFlag & MMCF_RESET) { @@ -128,7 +128,7 @@ void MotionMaster::DirectClean(bool reset, bool all) curr->Finalize(*m_owner); if (!isStatic(curr)) - delete curr; + { delete curr; } } if (!all && reset) @@ -141,15 +141,15 @@ void MotionMaster::DirectClean(bool reset, bool all) void MotionMaster::DelayedClean(bool reset, bool all) { if (reset) - m_cleanFlag |= MMCF_RESET; + { m_cleanFlag |= MMCF_RESET; } else - m_cleanFlag &= ~MMCF_RESET; + { m_cleanFlag &= ~MMCF_RESET; } if (empty() || (!all && size() == 1)) - return; + { return; } if (!m_expList) - m_expList = new ExpireList(); + { m_expList = new ExpireList(); } while (all ? !empty() : size() > 1) { @@ -158,14 +158,14 @@ void MotionMaster::DelayedClean(bool reset, bool all) curr->Finalize(*m_owner); if (!isStatic(curr)) - m_expList->push_back(curr); + { m_expList->push_back(curr); } } } void MotionMaster::DirectExpire(bool reset) { if (empty() || size() == 1) - return; + { return; } MovementGenerator* curr = top(); pop(); @@ -185,31 +185,31 @@ void MotionMaster::DirectExpire(bool reset) curr->Finalize(*m_owner); if (!isStatic(curr)) - delete curr; + { delete curr; } if (empty()) - Initialize(); + { Initialize(); } // Prevent reseting possible new pushed MMGen if (reset && top() == nowTop) - top()->Reset(*m_owner); + { top()->Reset(*m_owner); } } void MotionMaster::DelayedExpire(bool reset) { if (reset) - m_cleanFlag |= MMCF_RESET; + { m_cleanFlag |= MMCF_RESET; } else - m_cleanFlag &= ~MMCF_RESET; + { m_cleanFlag &= ~MMCF_RESET; } if (empty() || size() == 1) - return; + { return; } MovementGenerator* curr = top(); pop(); if (!m_expList) - m_expList = new ExpireList(); + { m_expList = new ExpireList(); } // also drop stored under top() targeted motions while (!empty() && (top()->GetMovementGeneratorType() == CHASE_MOTION_TYPE || top()->GetMovementGeneratorType() == FOLLOW_MOTION_TYPE)) @@ -223,13 +223,13 @@ void MotionMaster::DelayedExpire(bool reset) curr->Finalize(*m_owner); if (!isStatic(curr)) - m_expList->push_back(curr); + { m_expList->push_back(curr); } } void MotionMaster::MoveIdle() { if (empty() || !isStatic(top())) - push(&si_idleMovement); + { push(&si_idleMovement); } } void MotionMaster::MoveRandomAroundPoint(float x, float y, float z, float radius, float verticalZ) @@ -248,7 +248,7 @@ void MotionMaster::MoveRandomAroundPoint(float x, float y, float z, float radius void MotionMaster::MoveTargetedHome() { if (m_owner->hasUnitState(UNIT_STAT_LOST_CONTROL)) - return; + { return; } Clear(false); @@ -256,7 +256,7 @@ void MotionMaster::MoveTargetedHome() { // Manual exception for linked mobs if (m_owner->IsLinkingEventTrigger() && m_owner->GetMap()->GetCreatureLinkingHolder()->TryFollowMaster((Creature*)m_owner)) - DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s refollowed linked master", m_owner->GetGuidStr().c_str()); + { DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s refollowed linked master", m_owner->GetGuidStr().c_str()); } else { DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s targeted home", m_owner->GetGuidStr().c_str()); @@ -276,7 +276,7 @@ void MotionMaster::MoveTargetedHome() } } else - sLog.outError("%s attempt targeted home", m_owner->GetGuidStr().c_str()); + { sLog.outError("%s attempt targeted home", m_owner->GetGuidStr().c_str()); } } void MotionMaster::MoveConfused() @@ -284,42 +284,42 @@ void MotionMaster::MoveConfused() DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s move confused", m_owner->GetGuidStr().c_str()); if (m_owner->GetTypeId() == TYPEID_PLAYER) - Mutate(new ConfusedMovementGenerator()); + { Mutate(new ConfusedMovementGenerator()); } else - Mutate(new ConfusedMovementGenerator()); + { Mutate(new ConfusedMovementGenerator()); } } void MotionMaster::MoveChase(Unit* target, float dist, float angle) { // ignore movement request if target not exist if (!target) - return; + { return; } DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s chase to %s", m_owner->GetGuidStr().c_str(), target->GetGuidStr().c_str()); if (m_owner->GetTypeId() == TYPEID_PLAYER) - Mutate(new ChaseMovementGenerator(*target, dist, angle)); + { Mutate(new ChaseMovementGenerator(*target, dist, angle)); } else - Mutate(new ChaseMovementGenerator(*target, dist, angle)); + { Mutate(new ChaseMovementGenerator(*target, dist, angle)); } } void MotionMaster::MoveFollow(Unit* target, float dist, float angle) { if (m_owner->hasUnitState(UNIT_STAT_LOST_CONTROL)) - return; + { return; } Clear(); // ignore movement request if target not exist if (!target) - return; + { return; } DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s follow to %s", m_owner->GetGuidStr().c_str(), target->GetGuidStr().c_str()); if (m_owner->GetTypeId() == TYPEID_PLAYER) - Mutate(new FollowMovementGenerator(*target, dist, angle)); + { Mutate(new FollowMovementGenerator(*target, dist, angle)); } else - Mutate(new FollowMovementGenerator(*target, dist, angle)); + { Mutate(new FollowMovementGenerator(*target, dist, angle)); } } void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generatePath) @@ -327,9 +327,9 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s targeted point (Id: %u X: %f Y: %f Z: %f)", m_owner->GetGuidStr().c_str(), id, x, y, z); if (m_owner->GetTypeId() == TYPEID_PLAYER) - Mutate(new PointMovementGenerator(id, x, y, z, generatePath)); + { Mutate(new PointMovementGenerator(id, x, y, z, generatePath)); } else - Mutate(new PointMovementGenerator(id, x, y, z, generatePath)); + { Mutate(new PointMovementGenerator(id, x, y, z, generatePath)); } } void MotionMaster::MoveSeekAssistance(float x, float y, float z) @@ -363,18 +363,18 @@ void MotionMaster::MoveSeekAssistanceDistract(uint32 time) void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) { if (!enemy) - return; + { return; } DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s flee from %s", m_owner->GetGuidStr().c_str(), enemy->GetGuidStr().c_str()); if (m_owner->GetTypeId() == TYPEID_PLAYER) - Mutate(new FleeingMovementGenerator(enemy->GetObjectGuid())); + { Mutate(new FleeingMovementGenerator(enemy->GetObjectGuid())); } else { if (time) - Mutate(new TimedFleeingMovementGenerator(enemy->GetObjectGuid(), time)); + { Mutate(new TimedFleeingMovementGenerator(enemy->GetObjectGuid(), time)); } else - Mutate(new FleeingMovementGenerator(enemy->GetObjectGuid())); + { Mutate(new FleeingMovementGenerator(enemy->GetObjectGuid())); } } } @@ -434,7 +434,7 @@ void MotionMaster::MoveDistract(uint32 timer) void MotionMaster::MoveFlyOrLand(uint32 id, float x, float y, float z, bool liftOff) { if (m_owner->GetTypeId() != TYPEID_UNIT) - return; + { return; } DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s targeted point for %s (Id: %u X: %f Y: %f Z: %f)", m_owner->GetGuidStr().c_str(), liftOff ? "liftoff" : "landing", id, x, y, z); Mutate(new FlyOrLandMovementGenerator(id, x, y, z, liftOff)); @@ -457,7 +457,7 @@ void MotionMaster::Mutate(MovementGenerator* m) } if (!empty()) - top()->Interrupt(*m_owner); + { top()->Interrupt(*m_owner); } } m->Initialize(*m_owner); @@ -488,7 +488,7 @@ uint32 MotionMaster::getLastReachedWaypoint() const for (Impl::container_type::const_reverse_iterator rItr = Impl::c.rbegin(); rItr != Impl::c.rend(); ++rItr) { if ((*rItr)->GetMovementGeneratorType() == WAYPOINT_MOTION_TYPE) - return (static_cast*>(*rItr))->getLastReachedWaypoint(); + { return (static_cast*>(*rItr))->getLastReachedWaypoint(); } } return 0; } @@ -496,7 +496,7 @@ uint32 MotionMaster::getLastReachedWaypoint() const MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const { if (empty()) - return IDLE_MOTION_TYPE; + { return IDLE_MOTION_TYPE; } return top()->GetMovementGeneratorType(); } @@ -516,7 +516,7 @@ void MotionMaster::GetWaypointPathInformation(std::ostringstream& oss) const bool MotionMaster::GetDestination(float& x, float& y, float& z) { if (m_owner->movespline->Finalized()) - return false; + { return false; } const G3D::Vector3& dest = m_owner->movespline->FinalDestination(); x = dest.x; @@ -558,7 +558,7 @@ void MotionMaster::MoveFall() // Abort too if the ground is very near if (fabs(m_owner->GetPositionZ() - tz) < 0.1f) - return; + { return; } Movement::MoveSplineInit init(*m_owner); init.MoveTo(m_owner->GetPositionX(), m_owner->GetPositionY(), tz); diff --git a/src/game/MotionGenerators/MotionMaster.h b/src/game/MotionGenerators/MotionMaster.h index 0279ab063..80a6aed84 100644 --- a/src/game/MotionGenerators/MotionMaster.h +++ b/src/game/MotionGenerators/MotionMaster.h @@ -68,7 +68,7 @@ enum MMCleanFlag MMCF_RESET = 2 // Flag if need top()->Reset() }; -class MotionMaster : private std::stack +class MotionMaster : private std::stack { private: typedef std::stack Impl; @@ -95,16 +95,16 @@ class MotionMaster : private std::stack void Clear(bool reset = true, bool all = false) { if (m_cleanFlag & MMCF_UPDATE) - DelayedClean(reset, all); + { DelayedClean(reset, all); } else - DirectClean(reset, all); + { DirectClean(reset, all); } } void MovementExpired(bool reset = true) { if (m_cleanFlag & MMCF_UPDATE) - DelayedExpire(reset); + { DelayedExpire(reset); } else - DirectExpire(reset); + { DirectExpire(reset); } } void MoveIdle(); @@ -129,9 +129,9 @@ class MotionMaster : private std::stack void propagateSpeedChange(); bool SetNextWaypoint(uint32 pointId); + uint32 getLastReachedWaypoint() const; void GetWaypointPathInformation(std::ostringstream& oss) const; - bool GetDestination(float& x, float& y, float& z); private: diff --git a/src/game/MotionGenerators/MovementGenerator.h b/src/game/MotionGenerators/MovementGenerator.h index 0958e01a0..e7e060427 100644 --- a/src/game/MotionGenerators/MovementGenerator.h +++ b/src/game/MotionGenerators/MovementGenerator.h @@ -37,7 +37,7 @@ class Unit; class Creature; class Player; -class MovementGenerator +class MovementGenerator { public: virtual ~MovementGenerator(); @@ -70,7 +70,7 @@ class MovementGenerator }; template -class MANGOS_DLL_SPEC MovementGeneratorMedium : public MovementGenerator +class MovementGeneratorMedium : public MovementGenerator { public: void Initialize(Unit& u) override diff --git a/src/game/MotionGenerators/PathFinder.h b/src/game/MotionGenerators/PathFinder.h index 3b62ecca2..14054f796 100644 --- a/src/game/MotionGenerators/PathFinder.h +++ b/src/game/MotionGenerators/PathFinder.h @@ -101,7 +101,6 @@ class PathFinder const dtNavMeshQuery* m_navMeshQuery; // the nav mesh query used to find the path dtQueryFilter m_filter; // use single filter for all movements, update it when needed - void setStartPosition(const Vector3& point) { m_startPosition = point; } void setEndPosition(const Vector3& point) { m_actualEndPosition = point; m_endPosition = point; } diff --git a/src/game/MotionGenerators/PointMovementGenerator.cpp b/src/game/MotionGenerators/PointMovementGenerator.cpp index 0ad5eddbf..28c600eeb 100644 --- a/src/game/MotionGenerators/PointMovementGenerator.cpp +++ b/src/game/MotionGenerators/PointMovementGenerator.cpp @@ -36,7 +36,7 @@ template void PointMovementGenerator::Initialize(T& unit) { if (unit.hasUnitState(UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_NOT_MOVE)) - return; + { return; } unit.StopMoving(); @@ -52,7 +52,7 @@ void PointMovementGenerator::Finalize(T& unit) unit.clearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); if (unit.movespline->Finalized()) - MovementInform(unit); + { MovementInform(unit); } } template @@ -79,7 +79,7 @@ bool PointMovementGenerator::Update(T& unit, const uint32& diff) } if (!unit.hasUnitState(UNIT_STAT_ROAMING_MOVE) && unit.movespline->Finalized()) - Initialize(unit); + { Initialize(unit); } return !unit.movespline->Finalized(); } @@ -93,7 +93,7 @@ template <> void PointMovementGenerator::MovementInform(Creature& unit) { if (unit.AI()) - unit.AI()->MovementInform(POINT_MOTION_TYPE, id); + { unit.AI()->MovementInform(POINT_MOTION_TYPE, id); } if (unit.IsTemporarySummon()) { @@ -101,7 +101,7 @@ void PointMovementGenerator::MovementInform(Creature& unit) if (pSummon->GetSummonerGuid().IsCreatureOrVehicle()) if (Creature* pSummoner = unit.GetMap()->GetCreature(pSummon->GetSummonerGuid())) if (pSummoner->AI()) - pSummoner->AI()->SummonedMovementInform(&unit, POINT_MOTION_TYPE, id); + { pSummoner->AI()->SummonedMovementInform(&unit, POINT_MOTION_TYPE, id); } } } @@ -123,7 +123,7 @@ void AssistanceMovementGenerator::Finalize(Unit& unit) ((Creature*)&unit)->SetNoCallAssistance(false); ((Creature*)&unit)->CallAssistance(); if (unit.IsAlive()) - unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY)); + { unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY)); } } bool EffectMovementGenerator::Update(Unit& unit, const uint32&) @@ -134,24 +134,24 @@ bool EffectMovementGenerator::Update(Unit& unit, const uint32&) void EffectMovementGenerator::Finalize(Unit& unit) { if (unit.GetTypeId() != TYPEID_UNIT) - return; + { return; } if (((Creature&)unit).AI() && unit.movespline->Finalized()) - ((Creature&)unit).AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id); + { ((Creature&)unit).AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id); } // Need restore previous movement since we have no proper states system 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); + { unit.GetMotionMaster()->MoveChase(victim); } else - unit.GetMotionMaster()->Initialize(); + { unit.GetMotionMaster()->Initialize(); } } } void FlyOrLandMovementGenerator::Initialize(Unit& unit) { if (unit.hasUnitState(UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_NOT_MOVE)) - return; + { return; } unit.StopMoving(); diff --git a/src/game/MotionGenerators/PointMovementGenerator.h b/src/game/MotionGenerators/PointMovementGenerator.h index aa95670e9..06bda38ca 100644 --- a/src/game/MotionGenerators/PointMovementGenerator.h +++ b/src/game/MotionGenerators/PointMovementGenerator.h @@ -28,7 +28,7 @@ #include "MovementGenerator.h" template -class PointMovementGenerator +class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementGenerator > { public: @@ -52,7 +52,7 @@ class PointMovementGenerator bool m_generatePath; }; -class AssistanceMovementGenerator +class AssistanceMovementGenerator : public PointMovementGenerator { public: @@ -78,7 +78,7 @@ class EffectMovementGenerator : public MovementGenerator uint32 m_Id; }; -class FlyOrLandMovementGenerator : public PointMovementGenerator +class FlyOrLandMovementGenerator : public PointMovementGenerator { public: FlyOrLandMovementGenerator(uint32 _id, float _x, float _y, float _z, bool liftOff) : diff --git a/src/game/MotionGenerators/RandomMovementGenerator.cpp b/src/game/MotionGenerators/RandomMovementGenerator.cpp index 32d1980f2..2c65d0b75 100644 --- a/src/game/MotionGenerators/RandomMovementGenerator.cpp +++ b/src/game/MotionGenerators/RandomMovementGenerator.cpp @@ -104,7 +104,7 @@ void RandomMovementGenerator::Initialize(Creature& creature) creature.addUnitState(UNIT_STAT_ROAMING); // _MOVE set in _setRandomLocation if (!creature.IsAlive() || creature.hasUnitState(UNIT_STAT_NOT_MOVE)) - return; + { return; } _setRandomLocation(creature); } @@ -144,7 +144,7 @@ bool RandomMovementGenerator::Update(Creature& creature, const uint32& { i_nextMoveTime.Update(diff); if (i_nextMoveTime.Passed()) - _setRandomLocation(creature); + { _setRandomLocation(creature); } } return true; } diff --git a/src/game/MotionGenerators/RandomMovementGenerator.h b/src/game/MotionGenerators/RandomMovementGenerator.h index 626ffd873..dbae312aa 100644 --- a/src/game/MotionGenerators/RandomMovementGenerator.h +++ b/src/game/MotionGenerators/RandomMovementGenerator.h @@ -31,7 +31,7 @@ #define MOVEMENT_RANDOM_MMGEN_CHANCE_NO_BREAK 30 template -class RandomMovementGenerator +class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator > { public: diff --git a/src/game/MotionGenerators/TargetedMovementGenerator.cpp b/src/game/MotionGenerators/TargetedMovementGenerator.cpp index 6e94e6186..669e00ae9 100644 --- a/src/game/MotionGenerators/TargetedMovementGenerator.cpp +++ b/src/game/MotionGenerators/TargetedMovementGenerator.cpp @@ -38,10 +38,10 @@ template void TargetedMovementGeneratorMedium::_setTargetLocation(T& owner, bool updateDestination) { if (!i_target.isValid() || !i_target->IsInWorld()) - return; + { return; } if (owner.hasUnitState(UNIT_STAT_NOT_MOVE)) - return; + { return; } float x, y, z; @@ -55,7 +55,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T& owner, bool up if (!RequiresNewPosition(owner, x, y, z)) { if (!owner.movespline->Finalized()) - return; + { return; } } // Chase Movement and angle == 0 case: Chase to current angle else if (this->GetMovementGeneratorType() == CHASE_MOTION_TYPE && i_angle == 0.0f) @@ -78,14 +78,14 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T& owner, bool up } if (!i_path) - i_path = new PathFinder(&owner); + { i_path = new PathFinder(&owner); } // allow pets following their master to cheat while generating paths bool forceDest = (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->IsPet() && owner.hasUnitState(UNIT_STAT_FOLLOW)); i_path->calculate(x, y, z, forceDest); if (i_path->getPathType() & PATHFIND_NOPATH) - return; + { return; } D::_addUnitStateMove(owner); i_targetReached = false; @@ -101,10 +101,10 @@ template bool TargetedMovementGeneratorMedium::Update(T& owner, const uint32& time_diff) { if (!i_target.isValid() || !i_target->IsInWorld()) - return false; + { return false; } if (!owner.IsAlive()) - return true; + { return true; } if (owner.hasUnitState(UNIT_STAT_NOT_MOVE)) { @@ -122,7 +122,7 @@ bool TargetedMovementGeneratorMedium::Update(T& owner, const uint32& time_ if (owner.IsNonMeleeSpellCasted(false, false, true)) { if (!owner.IsStopped()) - owner.StopMoving(); + { owner.StopMoving(); } return true; } @@ -139,17 +139,16 @@ bool TargetedMovementGeneratorMedium::Update(T& owner, const uint32& time_ { i_recheckDistance.Reset(this->GetMovementGeneratorType() == FOLLOW_MOTION_TYPE ? 50 : 100); G3D::Vector3 dest = owner.movespline->FinalDestination(); - targetMoved = RequiresNewPosition(owner, dest.x, dest.y, dest.z); } if (m_speedChanged || targetMoved) - _setTargetLocation(owner, targetMoved); + { _setTargetLocation(owner, targetMoved); } if (owner.movespline->Finalized()) { if (i_angle == 0.f && !owner.HasInArc(0.01f, i_target.getTarget())) - owner.SetInFront(i_target.getTarget()); + { owner.SetInFront(i_target.getTarget()); } if (!i_targetReached) { @@ -171,9 +170,9 @@ bool TargetedMovementGeneratorMedium::RequiresNewPosition(T& owner, float { // More distance let have better performance, less distance let have more sensitive reaction at target move. if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->CanFly()) - return !i_target->IsWithinDist3d(x, y, z, this->GetDynamicTargetDistance(owner, true)); + { return !i_target->IsWithinDist3d(x, y, z, this->GetDynamicTargetDistance(owner, true)); } else - return !i_target->IsWithinDist2d(x, y, this->GetDynamicTargetDistance(owner, true)); + { return !i_target->IsWithinDist2d(x, y, this->GetDynamicTargetDistance(owner, true)); } } //-----------------------------------------------// @@ -192,7 +191,7 @@ template void ChaseMovementGenerator::_reachTarget(T& owner) { if (owner.CanReachWithMeleeAttack(this->i_target.getTarget())) - owner.Attack(this->i_target.getTarget(), true); + { owner.Attack(this->i_target.getTarget(), true); } } template<> @@ -237,7 +236,7 @@ template float ChaseMovementGenerator::GetDynamicTargetDistance(T& owner, bool forRangeCheck) const { if (!forRangeCheck) - return this->i_offset + CHASE_DEFAULT_RANGE_FACTOR * this->i_target->GetCombatReach(&owner); + { return this->i_offset + CHASE_DEFAULT_RANGE_FACTOR * this->i_target->GetCombatReach(&owner); } return CHASE_RECHASE_RANGE_FACTOR * this->i_target->GetCombatReach(&owner) - this->i_target->GetObjectBoundingRadius(); } @@ -261,7 +260,7 @@ bool FollowMovementGenerator::EnableWalking() const } template<> -void FollowMovementGenerator::_updateSpeed(Player &/*u*/) +void FollowMovementGenerator::_updateSpeed(Player& /*u*/) { // nothing to do for Player } @@ -271,7 +270,7 @@ void FollowMovementGenerator::_updateSpeed(Creature& u) { // pet only sync speed with owner if (!((Creature&)u).IsPet() || !i_target.isValid() || i_target->GetObjectGuid() != u.GetOwnerGuid()) - return; + { return; } u.UpdateSpeed(MOVE_RUN, true); u.UpdateSpeed(MOVE_WALK, true); @@ -327,12 +326,12 @@ template float FollowMovementGenerator::GetDynamicTargetDistance(T& owner, bool forRangeCheck) const { if (!forRangeCheck) - return this->i_offset + owner.GetObjectBoundingRadius() + this->i_target->GetObjectBoundingRadius(); + { return this->i_offset + owner.GetObjectBoundingRadius() + this->i_target->GetObjectBoundingRadius(); } float allowed_dist = sWorld.getConfig(CONFIG_FLOAT_RATE_TARGET_POS_RECALCULATION_RANGE) - this->i_target->GetObjectBoundingRadius(); allowed_dist += FOLLOW_RECALCULATE_FACTOR * (owner.GetObjectBoundingRadius() + this->i_target->GetObjectBoundingRadius()); if (this->i_offset > FOLLOW_DIST_GAP_FOR_DIST_FACTOR) - allowed_dist += FOLLOW_DIST_RECALCULATE_FACTOR * this->i_offset; + { allowed_dist += FOLLOW_DIST_RECALCULATE_FACTOR * this->i_offset; } return allowed_dist; } diff --git a/src/game/MotionGenerators/TargetedMovementGenerator.h b/src/game/MotionGenerators/TargetedMovementGenerator.h index eebf69d48..47ce75d11 100644 --- a/src/game/MotionGenerators/TargetedMovementGenerator.h +++ b/src/game/MotionGenerators/TargetedMovementGenerator.h @@ -30,7 +30,7 @@ class PathFinder; -class TargetedMovementGeneratorBase +class TargetedMovementGeneratorBase { public: TargetedMovementGeneratorBase(Unit& target) { i_target.link(&target, this); } @@ -40,7 +40,7 @@ class TargetedMovementGeneratorBase }; template -class TargetedMovementGeneratorMedium +class TargetedMovementGeneratorMedium : public MovementGeneratorMedium< T, D >, public TargetedMovementGeneratorBase { protected: @@ -78,7 +78,7 @@ class TargetedMovementGeneratorMedium }; template -class ChaseMovementGenerator : public TargetedMovementGeneratorMedium > +class ChaseMovementGenerator : public TargetedMovementGeneratorMedium > { public: ChaseMovementGenerator(Unit& target, float offset, float angle) @@ -103,7 +103,7 @@ class ChaseMovementGenerator : public TargetedMovementGeneratorMedium -class FollowMovementGenerator : public TargetedMovementGeneratorMedium > +class FollowMovementGenerator : public TargetedMovementGeneratorMedium > { public: FollowMovementGenerator(Unit& target) diff --git a/src/game/MotionGenerators/WaypointMovementGenerator.cpp b/src/game/MotionGenerators/WaypointMovementGenerator.cpp index 407152f30..b09587688 100644 --- a/src/game/MotionGenerators/WaypointMovementGenerator.cpp +++ b/src/game/MotionGenerators/WaypointMovementGenerator.cpp @@ -65,7 +65,7 @@ void WaypointMovementGenerator::LoadPath(Creature& creature, int32 pat } if (i_path->empty()) - return; + { return; } // Initialize the i_currentNode to point to the first node i_currentNode = i_path->begin()->first; m_lastReachedWaypoint = 0; @@ -101,18 +101,18 @@ void WaypointMovementGenerator::Interrupt(Creature& creature) void WaypointMovementGenerator::Reset(Creature& creature) { creature.addUnitState(UNIT_STAT_ROAMING); - StartMove(creature); + StartMove(creature); } void WaypointMovementGenerator::OnArrived(Creature& creature) { if (!i_path || i_path->empty()) - return; + { return; } m_lastReachedWaypoint = i_currentNode; if (m_isArrivalDone) - return; + { return; } creature.clearUnitState(UNIT_STAT_ROAMING_MOVE); m_isArrivalDone = true; @@ -131,13 +131,13 @@ void WaypointMovementGenerator::OnArrived(Creature& creature) if (WaypointBehavior* behavior = node.behavior) { if (behavior->emote != 0) - creature.HandleEmote(behavior->emote); + { creature.HandleEmote(behavior->emote); } if (behavior->spell != 0) - creature.CastSpell(&creature, behavior->spell, false); + { creature.CastSpell(&creature, behavior->spell, false); } if (behavior->model1 != 0) - creature.SetDisplayId(behavior->model1); + { creature.SetDisplayId(behavior->model1); } if (behavior->textid[0]) { @@ -150,16 +150,16 @@ void WaypointMovementGenerator::OnArrived(Creature& creature) for (; i < MAX_WAYPOINT_TEXT; ++i) { if (!behavior->textid[i]) - break; + { break; } } textId = behavior->textid[urand(0, i - 1)]; } if (MangosStringLocale const* textData = sObjectMgr.GetMangosStringLocale(textId)) - creature.MonsterText(textData, NULL); + { creature.MonsterText(textData, NULL); } else - sLog.outErrorDb("%s reached waypoint %u, attempted to do text %i, but required text-data could not be found", creature.GetGuidStr().c_str(), i_currentNode, textId); + { sLog.outErrorDb("%s reached waypoint %u, attempted to do text %i, but required text-data could not be found", creature.GetGuidStr().c_str(), i_currentNode, textId); } } } @@ -179,13 +179,13 @@ void WaypointMovementGenerator::OnArrived(Creature& creature) void WaypointMovementGenerator::StartMove(Creature& creature) { if (!i_path || i_path->empty()) - return; + { return; } if (Stopped(creature)) - return; + { return; } if (!creature.IsAlive() || creature.hasUnitState(UNIT_STAT_NOT_MOVE)) - return; + { return; } WaypointPath::const_iterator currPoint = i_path->find(i_currentNode); MANGOS_ASSERT(currPoint != i_path->end()); @@ -193,7 +193,7 @@ void WaypointMovementGenerator::StartMove(Creature& creature) if (WaypointBehavior* behavior = currPoint->second.behavior) { if (behavior->model2 != 0) - creature.SetDisplayId(behavior->model2); + { creature.SetDisplayId(behavior->model2); } creature.SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); } @@ -231,7 +231,7 @@ void WaypointMovementGenerator::StartMove(Creature& creature) init.MoveTo(nextNode.x, nextNode.y, nextNode.z, true); if (nextNode.orientation != 100 && nextNode.delay != 0) - init.SetFacing(nextNode.orientation); + { init.SetFacing(nextNode.orientation); } creature.SetWalk(!creature.hasUnitState(UNIT_STAT_RUNNING_STATE) && !creature.IsLevitating(), false); init.Launch(); } @@ -256,12 +256,12 @@ bool WaypointMovementGenerator::Update(Creature& creature, const uint3 if (Stopped(creature)) { if (CanMove(diff, creature)) - StartMove(creature); + { StartMove(creature); } } else { if (creature.IsStopped()) - Stop(STOP_TIME_FOR_PLAYER); + { Stop(STOP_TIME_FOR_PLAYER); } else if (creature.movespline->Finalized()) { OnArrived(creature); @@ -289,12 +289,12 @@ bool WaypointMovementGenerator::GetResetPosition(Creature&, float& x, { // prevent a crash at empty waypoint path. if (!i_path || i_path->empty()) - return false; + { return false; } WaypointPath::const_iterator lastPoint = i_path->find(m_lastReachedWaypoint); // Special case: Before the first waypoint is reached, m_lastReachedWaypoint is set to 0 (which may not be contained in i_path) if (!m_lastReachedWaypoint && lastPoint == i_path->end()) - return false; + { return false; } MANGOS_ASSERT(lastPoint != i_path->end()); @@ -367,14 +367,14 @@ bool WaypointMovementGenerator::SetNextWaypoint(uint32 pointId) uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const { if (i_currentNode >= i_path->size()) - return i_path->size(); + { return i_path->size(); } uint32 curMapId = (*i_path)[i_currentNode].mapid; for (uint32 i = i_currentNode; i < i_path->size(); ++i) { if ((*i_path)[i].mapid != curMapId) - return i; + { return i; } } return i_path->size(); @@ -398,7 +398,7 @@ void FlightPathMovementGenerator::Finalize(Player& player) { player.GetHostileRefManager().setOnlineOfflineState(true); if (player.pvpInfo.inHostileArea) - player.CastSpell(&player, 2479, true); + { player.CastSpell(&player, 2479, true); } // update z position to ground and orientation for landing point // this prevent cheating with landing point at lags @@ -446,7 +446,7 @@ bool FlightPathMovementGenerator::Update(Player& player, const uint32& diff) { DoEventIfAny(player, (*i_path)[i_currentNode], departureEvent); if (pointId == i_currentNode) - break; + { break; } i_currentNode += (uint32)departureEvent; departureEvent = !departureEvent; } @@ -459,7 +459,7 @@ bool FlightPathMovementGenerator::Update(Player& player, const uint32& diff) void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport() { if (i_path->empty()) - return; + { return; } uint32 map0 = (*i_path)[0].mapid; diff --git a/src/game/MotionGenerators/WaypointMovementGenerator.h b/src/game/MotionGenerators/WaypointMovementGenerator.h index e7e387f72..cba8e5e26 100644 --- a/src/game/MotionGenerators/WaypointMovementGenerator.h +++ b/src/game/MotionGenerators/WaypointMovementGenerator.h @@ -39,10 +39,10 @@ #include #define FLIGHT_TRAVEL_UPDATE 100 -#define STOP_TIME_FOR_PLAYER (3 * MINUTE * IN_MILLISECONDS) // 3 Minutes +#define STOP_TIME_FOR_PLAYER (3 * MINUTE * IN_MILLISECONDS)// 3 Minutes template -class MANGOS_DLL_SPEC PathMovementBase +class PathMovementBase { public: PathMovementBase() : i_currentNode(0) {} @@ -63,12 +63,12 @@ class MANGOS_DLL_SPEC PathMovementBase */ template -class WaypointMovementGenerator; +class WaypointMovementGenerator; template<> -class MANGOS_DLL_SPEC WaypointMovementGenerator +class WaypointMovementGenerator : public MovementGeneratorMedium< Creature, WaypointMovementGenerator >, - public PathMovementBase + public PathMovementBase { public: WaypointMovementGenerator(Creature&) : i_nextMoveTime(0), m_isArrivalDone(false), m_lastReachedWaypoint(0) {} @@ -111,7 +111,7 @@ class MANGOS_DLL_SPEC WaypointMovementGenerator /** FlightPathMovementGenerator generates movement of the player for the paths * and hence generates ground and activities for the player. */ -class FlightPathMovementGenerator +class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, FlightPathMovementGenerator >, public PathMovementBase { diff --git a/src/game/Object/AggressorAI.cpp b/src/game/Object/AggressorAI.cpp index 517c1b443..e88ad63a2 100644 --- a/src/game/Object/AggressorAI.cpp +++ b/src/game/Object/AggressorAI.cpp @@ -34,7 +34,7 @@ int AggressorAI::Permissible(const Creature* creature) { // have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight if (!creature->IsCivilian() && !creature->IsNeutralToAll()) - return PERMIT_BASE_PROACTIVE; + { return PERMIT_BASE_PROACTIVE; } return PERMIT_BASE_NO; } @@ -47,10 +47,10 @@ void AggressorAI::MoveInLineOfSight(Unit* u) { // Ignore Z for flying creatures if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE) - return; + { return; } if (m_creature->CanInitiateAttack() && u->IsTargetableForAttack() && - m_creature->IsHostileTo(u) && u->isInAccessablePlaceFor(m_creature)) + m_creature->IsHostileTo(u) && u->isInAccessablePlaceFor(m_creature)) { float attackRadius = m_creature->GetAttackDistance(u); if (m_creature->IsWithinDistInMap(u, attackRadius) && m_creature->IsWithinLOSInMap(u)) @@ -111,7 +111,7 @@ void AggressorAI::EnterEvadeMode() // Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) - m_creature->GetMotionMaster()->MoveTargetedHome(); + { m_creature->GetMotionMaster()->MoveTargetedHome(); } } m_creature->DeleteThreatList(); @@ -124,7 +124,7 @@ void AggressorAI::UpdateAI(const uint32 /*diff*/) { // update i_victimGuid if m_creature->getVictim() !=0 and changed if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) - return; + { return; } i_victimGuid = m_creature->getVictim()->GetObjectGuid(); @@ -140,7 +140,7 @@ bool AggressorAI::IsVisible(Unit* pl) const void AggressorAI::AttackStart(Unit* u) { if (!u || !m_creature->CanAttackByItself()) - return; + { return; } if (m_creature->Attack(u, true)) { diff --git a/src/game/Object/ArenaTeam.cpp b/src/game/Object/ArenaTeam.cpp index 67a22ae89..2eacec4a4 100644 --- a/src/game/Object/ArenaTeam.cpp +++ b/src/game/Object/ArenaTeam.cpp @@ -580,7 +580,7 @@ uint32 ArenaTeam::GetPoints(uint32 MemberRating) else if (m_Type == ARENA_TYPE_3v3) points *= 0.88f; - return (uint32)points; + return (uint32) points; } bool ArenaTeam::HaveMember(ObjectGuid guid) const @@ -736,8 +736,8 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map& PlayerPoints) if (m_stats.games_week < 10) return; // to get points, a player has to participate in at least 30% of the matches - uint32 min_plays = (uint32)ceil(m_stats.games_week * 0.3); - for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + uint32 min_plays = (uint32) ceil(m_stats.games_week * 0.3); + for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) { // the player participated in enough games, update his points uint32 points_to_add = 0; diff --git a/src/game/Object/ArenaTeam.h b/src/game/Object/ArenaTeam.h index 683b1831a..03cfc51b0 100644 --- a/src/game/Object/ArenaTeam.h +++ b/src/game/Object/ArenaTeam.h @@ -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 * diff --git a/src/game/Object/AuctionHouseMgr.cpp b/src/game/Object/AuctionHouseMgr.cpp index 101b2d0cb..46bd33924 100644 --- a/src/game/Object/AuctionHouseMgr.cpp +++ b/src/game/Object/AuctionHouseMgr.cpp @@ -56,7 +56,7 @@ AuctionHouseMgr::AuctionHouseMgr() AuctionHouseMgr::~AuctionHouseMgr() { for (ItemMap::const_iterator itr = mAitems.begin(); itr != mAitems.end(); ++itr) - delete itr->second; + { delete itr->second; } } @@ -143,7 +143,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction) } } else if (!bidder) - bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid); + { bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid); } if (auction_owner) auction_owner->GetSession()->SendAuctionOwnerNotification(auction); @@ -412,29 +412,29 @@ void AuctionHouseMgr::LoadAuctions() auction->itemGuidLow = 0; // must be 0 if auction delivery pending else { - // check if sold item exists for guid - // and item_template in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems) - Item* pItem = GetAItem(auction->itemGuidLow); - if (!pItem) - { - auction->DeleteFromDB(); - sLog.outError("Auction %u has not a existing item : %u, deleted", auction->Id, auction->itemGuidLow); - delete auction; - continue; - } + // check if sold item exists for guid + // and item_template in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems) + Item* pItem = GetAItem(auction->itemGuidLow); + if (!pItem) + { + auction->DeleteFromDB(); + sLog.outError("Auction %u has not a existing item : %u, deleted", auction->Id, auction->itemGuidLow); + delete auction; + continue; + } - // overwrite by real item data - if ((auction->itemTemplate != pItem->GetEntry()) || - (auction->itemCount != pItem->GetCount()) || - (auction->itemRandomPropertyId != pItem->GetItemRandomPropertyId())) - { - auction->itemTemplate = pItem->GetEntry(); - auction->itemCount = pItem->GetCount(); - auction->itemRandomPropertyId = pItem->GetItemRandomPropertyId(); + // overwrite by real item data + if ((auction->itemTemplate != pItem->GetEntry()) || + (auction->itemCount != pItem->GetCount()) || + (auction->itemRandomPropertyId != pItem->GetItemRandomPropertyId())) + { + auction->itemTemplate = pItem->GetEntry(); + auction->itemCount = pItem->GetCount(); + auction->itemRandomPropertyId = pItem->GetItemRandomPropertyId(); - // No SQL injection (no strings) - CharacterDatabase.PExecute("UPDATE auction SET item_template = %u, item_count = %u, item_randompropertyid = %i WHERE itemguid = %u", - auction->itemTemplate, auction->itemCount, auction->itemRandomPropertyId, auction->itemGuidLow); + // No SQL injection (no strings) + CharacterDatabase.PExecute("UPDATE auction SET item_template = %u, item_count = %u, item_randompropertyid = %i WHERE itemguid = %u", + auction->itemTemplate, auction->itemCount, auction->itemRandomPropertyId, auction->itemGuidLow); } } @@ -844,7 +844,7 @@ void WorldSession::BuildListAuctionItems(std::vector const& aucti { continue; } if (levelmin != 0x00 && (proto->RequiredLevel < levelmin || (levelmax != 0x00 && proto->RequiredLevel > levelmax))) - continue; + { continue; } if (usable != 0x00) { diff --git a/src/game/Object/AuctionHouseMgr.h b/src/game/Object/AuctionHouseMgr.h index f085ad43e..07e4ef0fc 100644 --- a/src/game/Object/AuctionHouseMgr.h +++ b/src/game/Object/AuctionHouseMgr.h @@ -22,12 +22,30 @@ * and lore are copyrighted by Blizzard Entertainment, Inc. */ +/** + * This is part of the code that takes care of the Auction House and all that can happen with it, + * it takes care of adding new items to it, bidding/buyouting them etc. Also handles the errors + * that can happen, ie: you don't have enough money, your account isn't paid for (won't really + * happen on these servers), the item you are trying to buy doesn't exist etc. + * + * This is also what is partly used by the \ref AuctionHouseBot as an interface to what it needs + * for performing the usual operations such as checking what has been bidded on etc. + * + * \todo Add more info about how the auction house system works. + */ + + #ifndef _AUCTION_HOUSE_MGR_H #define _AUCTION_HOUSE_MGR_H #include "Common.h" #include "DBCStructure.h" +/** \addtogroup auctionhouse + * @{ + * \file + */ + class Item; class Player; class Unit; @@ -37,24 +55,28 @@ class WorldPacket; #define MAX_AUCTION_SORT 12 #define AUCTION_SORT_REVERSED 0x10 +/** + * Documentation for this taken directly from comments in source + * \todo Needs real documentation of what these values mean and where they are sent etc. + */ enum AuctionError { - AUCTION_OK = 0, // depends on enum AuctionAction - AUCTION_ERR_INVENTORY = 1, // depends on enum InventoryChangeResult - AUCTION_ERR_DATABASE = 2, // ERR_AUCTION_DATABASE_ERROR (default) - AUCTION_ERR_NOT_ENOUGH_MONEY = 3, // ERR_NOT_ENOUGH_MONEY - AUCTION_ERR_ITEM_NOT_FOUND = 4, // ERR_ITEM_NOT_FOUND - AUCTION_ERR_HIGHER_BID = 5, // ERR_AUCTION_HIGHER_BID - AUCTION_ERR_BID_INCREMENT = 7, // ERR_AUCTION_BID_INCREMENT - AUCTION_ERR_BID_OWN = 10, // ERR_AUCTION_BID_OWN - AUCTION_ERR_RESTRICTED_ACCOUNT = 13 // ERR_RESTRICTED_ACCOUNT + AUCTION_OK = 0, ///< depends on enum AuctionAction + AUCTION_ERR_INVENTORY = 1, ///< depends on enum InventoryChangeResult + AUCTION_ERR_DATABASE = 2, ///< ERR_AUCTION_DATABASE_ERROR (default) + AUCTION_ERR_NOT_ENOUGH_MONEY = 3, ///< ERR_NOT_ENOUGH_MONEY + AUCTION_ERR_ITEM_NOT_FOUND = 4, ///< ERR_ITEM_NOT_FOUND + AUCTION_ERR_HIGHER_BID = 5, ///< ERR_AUCTION_HIGHER_BID + AUCTION_ERR_BID_INCREMENT = 7, ///< ERR_AUCTION_BID_INCREMENT + AUCTION_ERR_BID_OWN = 10, ///< ERR_AUCTION_BID_OWN + AUCTION_ERR_RESTRICTED_ACCOUNT = 13 ///< ERR_RESTRICTED_ACCOUNT }; enum AuctionAction { - AUCTION_STARTED = 0, // ERR_AUCTION_STARTED - AUCTION_REMOVED = 1, // ERR_AUCTION_REMOVED - AUCTION_BID_PLACED = 2 // ERR_AUCTION_BID_PLACED + AUCTION_STARTED = 0, ///< ERR_AUCTION_STARTED + AUCTION_REMOVED = 1, ///< ERR_AUCTION_REMOVED + AUCTION_BID_PLACED = 2 ///< ERR_AUCTION_BID_PLACED }; struct AuctionEntry @@ -99,7 +121,7 @@ class AuctionHouseObject ~AuctionHouseObject() { for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) - delete itr->second; + { delete itr->second; } } typedef std::map AuctionEntryMap; @@ -150,11 +172,16 @@ class AuctionSorter Player* m_viewPlayer; }; +/** + * This describes the type of auction house that we are dealing with, they can be either: + * - neutral (anyone can do their shopping there) + * - alliance/horde (only the respective faction can shop there) + */ enum AuctionHouseType { - AUCTION_HOUSE_ALLIANCE = 0, - AUCTION_HOUSE_HORDE = 1, - AUCTION_HOUSE_NEUTRAL = 2 + AUCTION_HOUSE_ALLIANCE = 0, ///< Alliance only auction house + AUCTION_HOUSE_HORDE = 1, ///< Horde only auction house + AUCTION_HOUSE_NEUTRAL = 2 ///< Neutral auction house, anyone can do business here }; #define MAX_AUCTION_HOUSE_TYPE 3 @@ -205,6 +232,9 @@ class AuctionHouseMgr ItemMap mAitems; }; +/// Convenience define to access the singleton object for the Auction House Manager #define sAuctionMgr MaNGOS::Singleton::Instance() +/** @} */ + #endif diff --git a/src/game/Object/Bag.cpp b/src/game/Object/Bag.cpp index 206a4b31c..105eb4579 100644 --- a/src/game/Object/Bag.cpp +++ b/src/game/Object/Bag.cpp @@ -40,7 +40,7 @@ Bag::Bag(): Item() Bag::~Bag() { for (int i = 0; i < MAX_BAG_SIZE; ++i) - delete m_bagslot[i]; + { delete m_bagslot[i]; } } void Bag::AddToWorld() @@ -49,14 +49,14 @@ void Bag::AddToWorld() for (uint32 i = 0; i < GetBagSize(); ++i) if (m_bagslot[i]) - m_bagslot[i]->AddToWorld(); + { m_bagslot[i]->AddToWorld(); } } void Bag::RemoveFromWorld() { for (uint32 i = 0; i < GetBagSize(); ++i) if (m_bagslot[i]) - m_bagslot[i]->RemoveFromWorld(); + { m_bagslot[i]->RemoveFromWorld(); } Item::RemoveFromWorld(); } @@ -66,7 +66,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner) ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(itemid); if (!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE) - return false; + { return false; } Object::_Create(guidlow, 0, HIGHGUID_CONTAINER); @@ -101,7 +101,7 @@ void Bag::SaveToDB() bool Bag::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid) { if (!Item::LoadFromDB(guidLow, fields, ownerGuid)) - return false; + { return false; } // cleanup bag content related item value fields (its will be filled correctly from `character_inventory`) for (int i = 0; i < MAX_BAG_SIZE; ++i) @@ -119,7 +119,7 @@ void Bag::DeleteFromDB() { for (int i = 0; i < MAX_BAG_SIZE; ++i) if (m_bagslot[i]) - m_bagslot[i]->DeleteFromDB(); + { m_bagslot[i]->DeleteFromDB(); } Item::DeleteFromDB(); } @@ -129,7 +129,7 @@ uint32 Bag::GetFreeSlots() const uint32 slots = 0; for (uint32 i = 0; i < GetBagSize(); ++i) if (!m_bagslot[i]) - ++slots; + { ++slots; } return slots; } @@ -139,7 +139,7 @@ void Bag::RemoveItem(uint8 slot, bool /*update*/) MANGOS_ASSERT(slot < MAX_BAG_SIZE); if (m_bagslot[slot]) - m_bagslot[slot]->SetContainer(NULL); + { m_bagslot[slot]->SetContainer(NULL); } m_bagslot[slot] = NULL; SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), ObjectGuid()); @@ -166,7 +166,7 @@ void Bag::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) cons for (uint32 i = 0; i < GetBagSize(); ++i) if (m_bagslot[i]) - m_bagslot[i]->BuildCreateUpdateBlockForPlayer(data, target); + { m_bagslot[i]->BuildCreateUpdateBlockForPlayer(data, target); } } // If the bag is empty returns true @@ -174,7 +174,7 @@ bool Bag::IsEmpty() const { for (uint32 i = 0; i < GetBagSize(); ++i) if (m_bagslot[i]) - return false; + { return false; } return true; } @@ -183,7 +183,7 @@ Item* Bag::GetItemByEntry(uint32 item) const { for (uint32 i = 0; i < GetBagSize(); ++i) if (m_bagslot[i] && m_bagslot[i]->GetEntry() == item) - return m_bagslot[i]; + { return m_bagslot[i]; } return NULL; } @@ -204,7 +204,7 @@ uint32 Bag::GetItemCount(uint32 item, Item* eItem) const for (uint32 i = 0; i < GetBagSize(); ++i) if (m_bagslot[i]) if (m_bagslot[i] != eItem && m_bagslot[i]->GetEntry() == item) - count += m_bagslot[i]->GetCount(); + { count += m_bagslot[i]->GetCount(); } if (eItem && eItem->GetProto()->GemProperties) for (uint32 i = 0; i < GetBagSize(); ++i) @@ -232,7 +232,7 @@ uint8 Bag::GetSlotByItemGUID(ObjectGuid guid) const for (uint32 i = 0; i < GetBagSize(); ++i) if (m_bagslot[i] != 0) if (m_bagslot[i]->GetObjectGuid() == guid) - return i; + { return i; } return NULL_SLOT; } @@ -240,7 +240,7 @@ uint8 Bag::GetSlotByItemGUID(ObjectGuid guid) const Item* Bag::GetItemByPos(uint8 slot) const { if (slot < GetBagSize()) - return m_bagslot[slot]; + { return m_bagslot[slot]; } return NULL; } diff --git a/src/game/Object/Bag.h b/src/game/Object/Bag.h index 53d39c1e6..79bd8677a 100644 --- a/src/game/Object/Bag.h +++ b/src/game/Object/Bag.h @@ -78,7 +78,7 @@ class Bag : public Item inline Item* NewItemOrBag(ItemPrototype const* proto) { if (proto->InventoryType == INVTYPE_BAG) - return new Bag; + { return new Bag; } return new Item; } diff --git a/src/game/Object/Camera.cpp b/src/game/Object/Camera.cpp index 0633608d1..b21f82557 100644 --- a/src/game/Object/Camera.cpp +++ b/src/game/Object/Camera.cpp @@ -53,7 +53,7 @@ void Camera::UpdateForCurrentViewPoint() m_gridRef.unlink(); if (GridType* grid = m_source->GetViewPoint().m_grid) - grid->AddWorldObject(this); + { grid->AddWorldObject(this); } UpdateVisibilityForOwner(); } @@ -63,7 +63,7 @@ void Camera::SetView(WorldObject* obj, bool update_far_sight_field /*= true*/) MANGOS_ASSERT(obj); if (m_source == obj) - return; + { return; } if (!m_owner.IsInMap(obj)) { @@ -79,18 +79,18 @@ void Camera::SetView(WorldObject* obj, bool update_far_sight_field /*= true*/) // detach and deregister from active objects if there are no more reasons to be active m_source->GetViewPoint().Detach(this); - if (!m_source->isActiveObject()) - m_source->GetMap()->RemoveFromActive(m_source); + if (!m_source->IsActiveObject()) + { m_source->GetMap()->RemoveFromActive(m_source); } m_source = obj; - if (!m_source->isActiveObject()) - m_source->GetMap()->AddToActive(m_source); + if (!m_source->IsActiveObject()) + { m_source->GetMap()->AddToActive(m_source); } m_source->GetViewPoint().Attach(this); if (update_far_sight_field) - m_owner.SetGuidValue(PLAYER_FARSIGHT, (m_source == &m_owner ? ObjectGuid() : m_source->GetObjectGuid())); + { m_owner.SetGuidValue(PLAYER_FARSIGHT, (m_source == &m_owner ? ObjectGuid() : m_source->GetObjectGuid())); } UpdateForCurrentViewPoint(); } @@ -98,7 +98,7 @@ void Camera::SetView(WorldObject* obj, bool update_far_sight_field /*= true*/) void Camera::Event_ViewPointVisibilityChanged() { if (!m_owner.HaveAtClient(m_source)) - ResetView(); + { ResetView(); } } void Camera::ResetView(bool update_far_sight_field /*= true*/) diff --git a/src/game/Object/Camera.h b/src/game/Object/Camera.h index a6c56f494..9abb7d300 100644 --- a/src/game/Object/Camera.h +++ b/src/game/Object/Camera.h @@ -35,7 +35,7 @@ class WorldPacket; class Player; /// Camera - object-receiver. Receives broadcast packets from nearby worldobjects, object visibility changes and sends them to client -class Camera +class Camera { friend class ViewPoint; public: @@ -77,13 +77,13 @@ class Camera public: GridReference& GetGridRef() { return m_gridRef; } - bool isActiveObject() const { return false; } + bool IsActiveObject() const { return false; } private: GridReference m_gridRef; }; /// Object-observer, notifies farsight object state to cameras that attached to it -class ViewPoint +class ViewPoint { friend class Camera; diff --git a/src/game/Object/Corpse.cpp b/src/game/Object/Corpse.cpp index 36c698ed0..d2ab29753 100644 --- a/src/game/Object/Corpse.cpp +++ b/src/game/Object/Corpse.cpp @@ -55,7 +55,7 @@ void Corpse::AddToWorld() { ///- Register the corpse for guid lookup if (!IsInWorld()) - sObjectAccessor.AddObject(this); + { sObjectAccessor.AddObject(this); } Object::AddToWorld(); } @@ -64,7 +64,7 @@ void Corpse::RemoveFromWorld() { ///- Remove the corpse from the accessor if (IsInWorld()) - sObjectAccessor.RemoveObject(this); + { sObjectAccessor.RemoveObject(this); } Object::RemoveFromWorld(); } @@ -232,9 +232,9 @@ bool Corpse::LoadFromDB(uint32 lowguid, Field* fields) uint32 flags = CORPSE_FLAG_UNK2; if (playerFlags & PLAYER_FLAGS_HIDE_HELM) - flags |= CORPSE_FLAG_HIDE_HELM; + { flags |= CORPSE_FLAG_HIDE_HELM; } if (playerFlags & PLAYER_FLAGS_HIDE_CLOAK) - flags |= CORPSE_FLAG_HIDE_CLOAK; + { flags |= CORPSE_FLAG_HIDE_CLOAK; } SetUInt32Value(CORPSE_FIELD_FLAGS, flags); // no need to mark corpse as lootable, because corpses are not saved in battle grounds @@ -265,23 +265,23 @@ bool Corpse::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool Corpse::IsHostileTo(Unit const* unit) const { if (Player* owner = sObjectMgr.GetPlayer(GetOwnerGuid())) - return owner->IsHostileTo(unit); + { return owner->IsHostileTo(unit); } else - return false; + { return false; } } bool Corpse::IsFriendlyTo(Unit const* unit) const { if (Player* owner = sObjectMgr.GetPlayer(GetOwnerGuid())) - return owner->IsFriendlyTo(unit); + { return owner->IsFriendlyTo(unit); } else - return true; + { return true; } } bool Corpse::IsExpired(time_t t) const { if (m_type == CORPSE_BONES) - return m_time < t - 60 * MINUTE; + { return m_time < t - 60 * MINUTE; } else - return m_time < t - 3 * DAY; + { return m_time < t - 3 * DAY; } } diff --git a/src/game/Object/Corpse.h b/src/game/Object/Corpse.h index 76dde2a9a..4b64f4c67 100644 --- a/src/game/Object/Corpse.h +++ b/src/game/Object/Corpse.h @@ -89,7 +89,7 @@ class Corpse : public WorldObject Player* lootRecipient; bool lootForBody; - GridReference &GetGridRef() { return m_gridRef; } + GridReference& GetGridRef() { return m_gridRef; } bool IsExpired(time_t t) const; private: diff --git a/src/game/Object/Creature.cpp b/src/game/Object/Creature.cpp index 9bf1680f4..97b5c50ac 100644 --- a/src/game/Object/Creature.cpp +++ b/src/game/Object/Creature.cpp @@ -116,7 +116,7 @@ VendorItem const* VendorItemData::FindItemCostPair(uint32 item_id, uint8 type, u { // Skip checking for conditions, condition system is powerfull enough to not require additional entries only for the conditions if ((*i)->item == item_id && (*i)->ExtendedCost == extendedCost && (*i)->type == type) - return *i; + { return *i; } } return NULL; } @@ -139,7 +139,7 @@ void CreatureCreatePos::SelectFinalPoint(Creature* cr) m_pos.z = m_closeObject->GetPositionZ(); } else - m_closeObject->GetClosePoint(m_pos.x, m_pos.y, m_pos.z, cr->GetObjectBoundingRadius(), m_dist, m_angle); + { m_closeObject->GetClosePoint(m_pos.x, m_pos.y, m_pos.z, cr->GetObjectBoundingRadius(), m_dist, m_angle); } } } @@ -260,7 +260,7 @@ void Creature::RemoveCorpse() GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_DESPAWN, this); if (InstanceData* mapInstance = GetInstanceData()) - mapInstance->OnCreatureDespawn(this); + { mapInstance->OnCreatureDespawn(this); } // script can set time (in seconds) explicit, override the original if (respawnDelay) @@ -370,10 +370,10 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE } else if (!data || data->equipmentId == 0) { - if (cinfo->EquipmentTemplateId == 0) - LoadEquipment(normalInfo->EquipmentTemplateId); // use default from normal template if diff does not have any + if (cinfo->EquipmentTemplateId== 0) + LoadEquipment(normalInfo->EquipmentTemplateId); // use default from normal template if diff does not have any else - LoadEquipment(cinfo->EquipmentTemplateId); // else use from diff template + LoadEquipment(cinfo->EquipmentTemplateId); // else use from diff template } else if (data && data->equipmentId != -1) { @@ -392,11 +392,11 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE SetLevitate((cinfo->InhabitType & INHABIT_AIR) != 0); // TODO: may not be correct to send opcode at this point (already handled by UPDATE_OBJECT createObject) // check if we need to add swimming movement. TODO: i thing movement flags should be computed automatically at each movement of creature so we need a sort of UpdateMovementFlags() method - if (cinfo->InhabitType & INHABIT_WATER && // check inhabit type water + if (cinfo->InhabitType & INHABIT_WATER && // check inhabit type water !(cinfo->ExtraFlags & CREATURE_EXTRA_FLAG_WALK_IN_WATER) && // check if creature is forced to walk (crabs, giant,...) - data && // check if there is data to get creature spawn pos + data && // check if there is data to get creature spawn pos GetMap()->GetTerrain()->IsSwimmable(data->posX, data->posY, data->posZ, minfo->bounding_radius)) // check if creature is in water and have enough space to swim - m_movementInfo.AddMovementFlag(MOVEFLAG_SWIMMING); // add swimming movement + m_movementInfo.AddMovementFlag(MOVEFLAG_SWIMMING); // add swimming movement // checked at loading m_defaultMovementType = MovementGeneratorType(cinfo->MovementType); @@ -407,7 +407,7 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=NULL*/, GameEventCreatureData const* eventData /*=NULL*/, bool preserveHPAndPower /*=true*/) { if (!InitEntry(Entry, data, eventData)) - return false; + { return false; } // creatures always have melee weapon ready if any SetSheath(SHEATH_STATE_MELEE); @@ -422,16 +422,16 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*= SelectLevel(); if (team == HORDE) - setFaction(GetCreatureInfo()->FactionHorde); + { setFaction(GetCreatureInfo()->FactionHorde); } else - setFaction(GetCreatureInfo()->FactionAlliance); + { setFaction(GetCreatureInfo()->FactionAlliance); } SetUInt32Value(UNIT_NPC_FLAGS, GetCreatureInfo()->NpcFlags); uint32 attackTimer = GetCreatureInfo()->MeleeBaseAttackTime; - SetAttackTime(BASE_ATTACK, attackTimer); - SetAttackTime(OFF_ATTACK, attackTimer - attackTimer / 4); + SetAttackTime(BASE_ATTACK, attackTimer); + SetAttackTime(OFF_ATTACK, attackTimer - attackTimer / 4); SetAttackTime(RANGED_ATTACK, GetCreatureInfo()->RangedBaseAttackTime); uint32 unitFlags = GetCreatureInfo()->UnitFlags; @@ -439,7 +439,7 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*= // we may need to append or remove additional flags if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT)) - unitFlags |= UNIT_FLAG_IN_COMBAT; + { unitFlags |= UNIT_FLAG_IN_COMBAT; } SetUInt32Value(UNIT_FIELD_FLAGS, unitFlags); SetUInt32Value(UNIT_FIELD_FLAGS_2, unitFlags2); @@ -463,24 +463,24 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*= if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetCreatureInfo()->FactionAlliance)) { if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_PVP) - SetPvP(true); + { SetPvP(true); } else - SetPvP(false); + { SetPvP(false); } } // Try difficulty dependend version before falling back to base entry CreatureTemplateSpells const* templateSpells = sCreatureTemplateSpellsStorage.LookupEntry(GetCreatureInfo()->Entry); if (!templateSpells) - templateSpells = sCreatureTemplateSpellsStorage.LookupEntry(GetEntry()); + { templateSpells = sCreatureTemplateSpellsStorage.LookupEntry(GetEntry()); } if (templateSpells) for (int i = 0; i < CREATURE_MAX_SPELLS; ++i) - m_spells[i] = templateSpells->spells[i]; + { m_spells[i] = templateSpells->spells[i]; } SetVehicleId(GetCreatureInfo()->VehicleTemplateId, 0); // if eventData set then event active and need apply spell_start if (eventData) - ApplyGameEventSpells(eventData, true); + { ApplyGameEventSpells(eventData, true); } return true; } @@ -489,11 +489,11 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo* cinfo, const CreatureData* { // Use creature event model explicit, override any other static models if (eventData && eventData->modelid) - return eventData->modelid; + { return eventData->modelid; } // Use creature model explicit, override template (creature.modelid) if (data && data->modelid_override) - return data->modelid_override; + { return data->modelid_override; } // use defaults from the template uint32 display_id = 0; @@ -508,6 +508,7 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo* cinfo, const CreatureData* static_assert(MAX_CREATURE_MODEL == 4, "Need to update model selection code for new or removed model fields"); // model selected here may be replaced with other_gender using own function + if (cinfo->ModelId[3] && cinfo->ModelId[2] && cinfo->ModelId[1] && cinfo->ModelId[0]) { display_id = cinfo->ModelId[urand(0, 3)]; @@ -536,7 +537,7 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo* cinfo, const CreatureData* sLog.outErrorDb("Call customer support, ChooseDisplayId can not select native model for creature entry %u, model from creature entry 1 will be used instead.", cinfo->Entry); if (const CreatureInfo* creatureDefault = ObjectMgr::GetCreatureTemplate(1)) - display_id = creatureDefault->ModelId[0]; + { display_id = creatureDefault->ModelId[0]; } } return display_id; @@ -589,14 +590,14 @@ void Creature::Update(uint32 update_diff, uint32 diff) LoadCreatureAddon(true); } else - SetDeathState(JUST_ALIVED); + { SetDeathState(JUST_ALIVED); } // Call AI respawn virtual function if (AI()) - AI()->JustRespawned(); + { AI()->JustRespawned(); } if (m_isCreatureLinkingTrigger) - GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, this); + { GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, this); } GetMap()->Add(this); } @@ -607,7 +608,7 @@ void Creature::Update(uint32 update_diff, uint32 diff) Unit::Update(update_diff, diff); if (m_IsDeadByDefault) - break; + { break; } if (m_corpseDecayTimer <= update_diff) { @@ -616,12 +617,13 @@ void Creature::Update(uint32 update_diff, uint32 diff) } else m_corpseDecayTimer -= update_diff; + if (m_groupLootId) // Loot is stopped already if corpse got removed. { if (m_groupLootTimer <= update_diff) - StopGroupLoot(); + { StopGroupLoot(); } else - m_groupLootTimer -= update_diff; + { m_groupLootTimer -= update_diff; } } break; @@ -649,7 +651,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()) - break; + { break; } if (!IsInEvadeMode()) { @@ -665,7 +667,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()) - break; + { break; } RegenerateAll(update_diff); break; } @@ -683,10 +685,10 @@ void Creature::StartGroupLoot(Group* group, uint32 timer) void Creature::StopGroupLoot() { if (!m_groupLootId) - return; + { return; } if (Group* group = sObjectMgr.GetGroupById(m_groupLootId)) - group->EndRoll(); + { group->EndRoll(); } m_groupLootTimer = 0; m_groupLootId = 0; @@ -697,15 +699,15 @@ void Creature::RegenerateAll(uint32 update_diff) if (m_regenTimer > 0) { if (update_diff >= m_regenTimer) - m_regenTimer = 0; + { m_regenTimer = 0; } else - m_regenTimer -= update_diff; + { m_regenTimer -= update_diff; } } if (m_regenTimer != 0) - return; + { return; } if (!IsInCombat() || IsPolymorphed()) - RegenerateHealth(); + { RegenerateHealth(); } RegeneratePower(); @@ -722,7 +724,7 @@ void Creature::RegeneratePower() uint32 maxValue = GetMaxPower(powerType); if (curValue >= maxValue) - return; + { return; } float addValue = 0.0f; @@ -753,7 +755,7 @@ void Creature::RegeneratePower() // Apply modifiers (if any) AuraList const& ModPowerRegenAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN); - for (AuraList::const_iterator i = ModPowerRegenAuras.begin(); i != ModPowerRegenAuras.end(); ++i) + for(AuraList::const_iterator i = ModPowerRegenAuras.begin(); i != ModPowerRegenAuras.end(); ++i) { Modifier const* modifier = (*i)->GetModifier(); if (modifier->m_miscvalue == int32(powerType)) @@ -761,7 +763,7 @@ void Creature::RegeneratePower() } AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); - for (AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) + for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) { Modifier const* modifier = (*i)->GetModifier(); if (modifier->m_miscvalue == int32(powerType)) @@ -774,13 +776,13 @@ void Creature::RegeneratePower() void Creature::RegenerateHealth() { if (!IsRegeneratingHealth()) - return; + { return; } uint32 curValue = GetHealth(); uint32 maxValue = GetMaxHealth(); if (curValue >= maxValue) - return; + { return; } uint32 addvalue = 0; @@ -791,12 +793,12 @@ void Creature::RegenerateHealth() float Spirit = GetStat(STAT_SPIRIT); if (GetPower(POWER_MANA) > 0) - addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate); + { addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate); } else - addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate); + { addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate); } } else - addvalue = maxValue / 3; + { addvalue = maxValue / 3; } ModifyHealth(addvalue); } @@ -804,7 +806,7 @@ void Creature::RegenerateHealth() void Creature::DoFleeToGetAssistance() { if (!getVictim()) - return; + { return; } float radius = sWorld.getConfig(CONFIG_FLOAT_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS); if (radius > 0) @@ -819,7 +821,7 @@ void Creature::DoFleeToGetAssistance() UpdateSpeed(MOVE_RUN, false); if (!pCreature) - SetFeared(true, getVictim()->GetObjectGuid(), 0 , sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_FLEE_DELAY)); + { SetFeared(true, getVictim()->GetObjectGuid(), 0 , sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_FLEE_DELAY)); } else GetMotionMaster()->MoveSeekAssistance(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ()); } @@ -850,22 +852,22 @@ bool Creature::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo cons SetPhaseMask(cPos.GetPhaseMask(), false); if (!CreateFromProto(guidlow, cinfo, team, data, eventData)) - return false; + { return false; } cPos.SelectFinalPoint(this); if (!cPos.Relocate(this)) - return false; + { return false; } // Notify the outdoor pvp script if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId())) - outdoorPvP->HandleCreatureCreate(this); + { outdoorPvP->HandleCreatureCreate(this); } // Notify the map's instance data. // Only works if you create the object in it, not if it is moves to that map. // Normally non-players do not teleport to other maps. if (InstanceData* iData = GetMap()->GetInstanceData()) - iData->OnCreatureCreate(this); + { iData->OnCreatureCreate(this); } switch (GetCreatureInfo()->Rank) { @@ -888,7 +890,7 @@ bool Creature::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo cons // Add to CreatureLinkingHolder if needed if (sCreatureLinkingMgr.GetLinkedTriggerInformation(this)) - cPos.GetMap()->GetCreatureLinkingHolder()->AddSlaveToHolder(this); + { cPos.GetMap()->GetCreatureLinkingHolder()->AddSlaveToHolder(this); } if (sCreatureLinkingMgr.IsLinkedEventTrigger(this)) { m_isCreatureLinkingTrigger = true; @@ -903,7 +905,7 @@ bool Creature::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo cons bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const { if (!IsTrainer()) - return false; + { return false; } // pet trainers not have spells in fact now if (GetCreatureInfo()->TrainerType != TRAINER_TYPE_PETS) @@ -962,7 +964,7 @@ bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const if (FactionTemplateEntry const* faction_template = getFactionTemplateEntry()) { if (pPlayer->GetReputationRank(faction_template->faction) == REP_EXALTED) - return true; + { return true; } } if (msg) @@ -1005,14 +1007,14 @@ bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const bool Creature::CanInteractWithBattleMaster(Player* pPlayer, bool msg) const { if (!IsBattleMaster()) - return false; + { return false; } BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(GetEntry()); if (bgTypeId == BATTLEGROUND_TYPE_NONE) - return false; + { return false; } if (!msg) - return pPlayer->GetBGAccessByLevel(bgTypeId); + { return pPlayer->GetBGAccessByLevel(bgTypeId); } if (!pPlayer->GetBGAccessByLevel(bgTypeId)) { @@ -1061,14 +1063,14 @@ void Creature::PrepareBodyLootState() } } - lootForBody = true; // pass this loot mode + lootForBody = true; // pass this loot mode // if not have normal loot allow skinning if need if (!lootForSkin && GetCreatureInfo()->SkinningLootId) { - RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); - return; + RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); + return; } RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); @@ -1109,18 +1111,18 @@ Player* Creature::GetLootRecipient() const // if group not set or disbanded return original recipient player if any if (!group) - return player; + { return player; } // group case // return player if it still be in original recipient group if (player && player->GetGroup() == group) - return player; + { return player; } // find any in group for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* p = itr->getSource()) - return p; + { return p; } return NULL; } @@ -1145,14 +1147,14 @@ void Creature::SetLootRecipient(Unit* unit) Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself(); if (!player) // normal creature, no player involved - return; + { return; } // set player for non group case or if group will disbanded m_lootRecipientGuid = player->GetObjectGuid(); // set group for group existing case including if player will leave group at loot time if (Group* group = player->GetGroup()) - m_lootGroupRecipientId = group->GetId(); + { m_lootGroupRecipientId = group->GetId(); } SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED); SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED_BY_PLAYER); @@ -1165,7 +1167,7 @@ void Creature::SaveToDB() CreatureData const* data = sObjectMgr.GetCreatureData(GetGUIDLow()); if (!data) { - sLog.outError("Creature::SaveToDB failed, cannot get creature data!"); + sLog.outError("Creature::SaveToDB failed, can not get creature data!"); return; } @@ -1187,16 +1189,16 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) static_assert(MAX_CREATURE_MODEL == 4, "Need to update custom model check for new/removed model fields."); if (displayId != cinfo->ModelId[0] && displayId != cinfo->ModelId[1] && - displayId != cinfo->ModelId[2] && displayId != cinfo->ModelId[3]) + displayId != cinfo->ModelId[2] && displayId != cinfo->ModelId[3]) { for (int i = 0; i < MAX_CREATURE_MODEL && displayId; ++i) if (cinfo->ModelId[i]) if (CreatureModelInfo const* minfo = sObjectMgr.GetCreatureModelInfo(cinfo->ModelId[i])) if (displayId == minfo->modelid_other_gender) - displayId = 0; + { displayId = 0; } } else - displayId = 0; + { displayId = 0; } } // data->guid = guid don't must be update at save @@ -1384,7 +1386,7 @@ void Creature::SelectLevel(const CreatureInfo* cinfo, float percentHealth /*= 10 SetLevel(level); ////////////////////////////////////////////////////////////////////////// - // Calculate level dependend stats + // Calculate level dependent stats ////////////////////////////////////////////////////////////////////////// uint32 health; @@ -1429,9 +1431,9 @@ void Creature::SelectLevel(const CreatureInfo* cinfo, float percentHealth /*= 10 SetMaxHealth(health); if (percentHealth == 100.0f) - SetHealth(health); + { SetHealth(health); } else - SetHealthPercent(percentHealth); + { SetHealthPercent(percentHealth); } SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, float(health)); @@ -1544,7 +1546,7 @@ bool Creature::CreateFromProto(uint32 guidlow, CreatureInfo const* cinfo, Team t Object::_Create(guidlow, cinfo->Entry, cinfo->GetHighGuid()); if (!UpdateEntry(cinfo->Entry, team, data, eventData, false)) - return false; + { return false; } return true; } @@ -1570,12 +1572,12 @@ bool Creature::LoadFromDB(uint32 guidlow, Map* map) // Creature can be loaded already in map if grid has been unloaded while creature walk to another grid if (map->GetCreature(cinfo->GetObjectGuid(guidlow))) - return false; + { return false; } CreatureCreatePos pos(map, data->posX, data->posY, data->posZ, data->orientation, data->phaseMask); if (!Create(guidlow, pos, cinfo, TEAM_NONE, data, eventData)) - return false; + { return false; } SetRespawnCoord(pos); m_respawnradius = data->spawndist; @@ -1594,7 +1596,7 @@ bool Creature::LoadFromDB(uint32 guidlow, Map* map) { float tz = GetTerrain()->GetHeightStatic(data->posX, data->posY, data->posZ, false); if (data->posZ - tz > 0.1) - Relocate(data->posX, data->posY, tz); + { Relocate(data->posX, data->posY, tz); } } } else if (m_respawnTime) // respawn time set but expired @@ -1609,7 +1611,7 @@ bool Creature::LoadFromDB(uint32 guidlow, Map* map) { curhealth = uint32(curhealth * _GetHealthMod(GetCreatureInfo()->Rank)); if (curhealth < 1) - curhealth = 1; + { curhealth = 1; } } if (sCreatureLinkingMgr.IsSpawnedByLinkedMob(this)) @@ -1624,7 +1626,7 @@ bool Creature::LoadFromDB(uint32 guidlow, Map* map) { float tz = GetTerrain()->GetHeightStatic(data->posX, data->posY, data->posZ, false); if (data->posZ - tz > 0.1) - Relocate(data->posX, data->posY, tz); + { Relocate(data->posX, data->posY, tz); } } } } @@ -1641,7 +1643,7 @@ bool Creature::LoadFromDB(uint32 guidlow, Map* map) // Creature Linking, Initial load is handled like respawn if (m_isCreatureLinkingTrigger && IsAlive()) - GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, this); + { GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, this); } // check if it is rabbit day if (IsAlive() && sWorld.getConfig(CONFIG_UINT32_RABBIT_DAY)) @@ -1651,7 +1653,7 @@ bool Creature::LoadFromDB(uint32 guidlow, Map* map) tm now_tm = *localtime(&sWorld.GetGameTime()); if (now_tm.tm_mon == rabbit_day_tm.tm_mon && now_tm.tm_mday == rabbit_day_tm.tm_mday) - CastSpell(this, 10710 + urand(0, 2), true); + { CastSpell(this, 10710 + urand(0, 2), true); } } return true; @@ -1664,7 +1666,7 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force) if (force) { for (uint8 i = 0; i < MAX_VIRTUAL_ITEM_SLOT; ++i) - SetVirtualItem(VirtualItemSlot(i), 0); + { SetVirtualItem(VirtualItemSlot(i), 0); } m_equipmentId = 0; } return; @@ -1685,7 +1687,7 @@ bool Creature::HasQuest(uint32 quest_id) const for (QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) { if (itr->second == quest_id) - return true; + { return true; } } return false; } @@ -1696,11 +1698,12 @@ bool Creature::HasInvolvedQuest(uint32 quest_id) const for (QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) { if (itr->second == quest_id) - return true; + { return true; } } return false; } + struct CreatureRespawnDeleteWorker { explicit CreatureRespawnDeleteWorker(uint32 guid) : i_guid(guid) {} @@ -1747,7 +1750,7 @@ float Creature::GetAttackDistance(Unit const* pl) const { float aggroRate = sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_AGGRO); if (aggroRate == 0) - return 0.0f; + { return 0.0f; } uint32 playerlevel = pl->GetLevelForTarget(this); uint32 creaturelevel = GetLevelForTarget(pl); @@ -1756,7 +1759,7 @@ float Creature::GetAttackDistance(Unit const* pl) const // "The maximum Aggro Radius has a cap of 25 levels under. Example: A level 30 char has the same Aggro Radius of a level 5 char on a level 60 mob." if (leveldif < - 25) - leveldif = -25; + { leveldif = -25; } // "The aggro radius of a mob having the same level as the player is roughly 20 yards" float RetDistance = 20; @@ -1776,7 +1779,7 @@ float Creature::GetAttackDistance(Unit const* pl) const // "Minimum Aggro Radius for a mob seems to be combat range (5 yards)" if (RetDistance < 5) - RetDistance = 5; + { RetDistance = 5; } return (RetDistance * aggroRate); } @@ -1790,7 +1793,7 @@ void Creature::SetDeathState(DeathState s) // always save boss respawn time at death to prevent crash cheating if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY) || IsWorldBoss()) - SaveRespawnTime(); + { SaveRespawnTime(); } } Unit::SetDeathState(s); @@ -1807,7 +1810,7 @@ void Creature::SetDeathState(DeathState s) } if (CanFly()) - i_motionMaster.MoveFall(); + { i_motionMaster.MoveFall(); } Unit::SetDeathState(CORPSE); } @@ -1821,7 +1824,7 @@ void Creature::SetDeathState(DeathState s) SetHealth(GetMaxHealth()); SetLootRecipient(NULL); if (GetTemporaryFactionFlags() & TEMPFACTION_RESTORE_RESPAWN) - ClearTemporaryFaction(); + { ClearTemporaryFaction(); } SetMeleeDamageSchool(SpellSchools(GetCreatureInfo()->DamageSchool)); @@ -1843,14 +1846,14 @@ void Creature::SetDeathState(DeathState s) void Creature::Respawn() { if (!IsInWorld()) // Could be removed as part of a pool (in which case respawn-time is handled with pool-system) - return; + { return; } RemoveCorpse(); if (IsDespawned()) { if (HasStaticDBSpawnData()) - GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), 0); + { GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), 0); } m_respawnTime = time(NULL); // respawn at next tick } } @@ -1864,24 +1867,25 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn) m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn)); return; } + if (IsDespawned()) - return; + { return; } if (IsAlive()) - SetDeathState(JUST_DIED); + { SetDeathState(JUST_DIED); } RemoveCorpse(); - + SetHealth(0); // just for nice GM-mode view } bool Creature::IsImmuneToSpell(SpellEntry const* spellInfo, bool castOnSelf) { if (!spellInfo) - return false; + { return false; } if (!castOnSelf && GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->GetMechanic() - 1))) - return true; + { return true; } return Unit::IsImmuneToSpell(spellInfo, castOnSelf); } @@ -1893,7 +1897,7 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd return false; if (!castOnSelf && GetCreatureInfo()->MechanicImmuneMask & (1 << (spellEffect->EffectMechanic - 1))) - return true; + { return true; } // Taunt immunity special flag check if (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NOT_TAUNTABLE) @@ -1902,11 +1906,11 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd if (spellEffect->Effect == SPELL_EFFECT_APPLY_AURA) { if (spellEffect->EffectApplyAuraName == SPELL_AURA_MOD_TAUNT) - return true; + { return true; } } // Spell effect taunt check else if (spellEffect->Effect == SPELL_EFFECT_ATTACK_ME) - return true; + { return true; } } return Unit::IsImmuneToSpellEffect(spellInfo, index, castOnSelf); @@ -1966,12 +1970,12 @@ bool Creature::IsTappedBy(Player* plr) const SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim) { if (!pVictim) - return NULL; + { return NULL; } for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) { if (!m_spells[i]) - continue; + { continue; } SpellEntry const* spellInfo = sSpellStore.LookupEntry(m_spells[i]); if (!spellInfo) { @@ -1995,11 +1999,10 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim) break; } } - if (bcontinue) - continue; + if (bcontinue) { continue; } if(spellInfo->GetManaCost() > GetPower(POWER_MANA)) - continue; + { continue; } SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); float range = GetSpellMaxRange(srange); float minrange = GetSpellMinRange(srange); @@ -2009,11 +2012,11 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim) // if(!isInFront( pVictim, range ) && spellInfo->AttributesEx ) // continue; if (dist > range || dist < minrange) - continue; + { continue; } if(spellInfo->GetPreventionType() == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) - continue; + { continue; } if(spellInfo->GetPreventionType() == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) - continue; + { continue; } return spellInfo; } return NULL; @@ -2022,12 +2025,12 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim) SpellEntry const* Creature::ReachWithSpellCure(Unit* pVictim) { if (!pVictim) - return NULL; + { return NULL; } for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) { if (!m_spells[i]) - continue; + { continue; } SpellEntry const* spellInfo = sSpellStore.LookupEntry(m_spells[i]); if (!spellInfo) { @@ -2046,10 +2049,10 @@ SpellEntry const* Creature::ReachWithSpellCure(Unit* pVictim) } } if (bcontinue) - continue; + { continue; } if(spellInfo->GetManaCost() > GetPower(POWER_MANA)) - continue; + { continue; } SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); float range = GetSpellMaxRange(srange); float minrange = GetSpellMinRange(srange); @@ -2059,11 +2062,11 @@ SpellEntry const* Creature::ReachWithSpellCure(Unit* pVictim) // if(!isInFront( pVictim, range ) && spellInfo->AttributesEx ) // continue; if (dist > range || dist < minrange) - continue; + { continue; } if(spellInfo->GetPreventionType() == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) - continue; + { continue; } if(spellInfo->GetPreventionType() == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) - continue; + { continue; } return spellInfo; } return NULL; @@ -2073,10 +2076,10 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const { // gamemaster in GM mode see all, including ghosts if (pl->isGameMaster()) - return true; + { return true; } if (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_INVISIBLE) - return false; + { 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) @@ -2092,13 +2095,13 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const { // 20 - aggro distance for same level, 25 - max additional distance if player level less that creature level if (corpse->IsWithinDistInMap(this, (20 + 25)*sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_AGGRO))) - return true; + { return true; } } } // Dead player can see ghosts if (GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_GHOST_VISIBLE) - return true; + { return true; } // and not see any other return false; @@ -2133,7 +2136,7 @@ void Creature::CallAssistance() void Creature::CallForHelp(float fRadius) { if (fRadius <= 0.0f || !getVictim() || IsPet() || IsCharmed()) - return; + { return; } MaNGOS::CallOfHelpCreatureInRangeDo u_do(this, getVictim(), fRadius); MaNGOS::CreatureWorker worker(this, u_do); @@ -2145,38 +2148,38 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction / { // we don't need help from zombies :) if (!IsAlive()) - return false; + { return false; } // we don't need help from non-combatant ;) if (IsCivilian()) - return false; + { return false; } if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PASSIVE)) - return false; + { return false; } // skip fighting creature if (enemy && IsInCombat()) - return false; + { return false; } // only free creature if (GetCharmerOrOwnerGuid()) - return false; + { return false; } // only from same creature faction if (checkfaction) { if (getFaction() != u->getFaction()) - return false; + { return false; } } else { if (!IsFriendlyTo(u)) - return false; + { return false; } } // skip non hostile to caster enemy creatures if (enemy && !IsHostileTo(enemy)) - return false; + { return false; } return true; } @@ -2184,13 +2187,13 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction / bool Creature::CanInitiateAttack() { if (hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED)) - return false; + { return false; } if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) - return false; + { return false; } if (isPassiveToHostile()) - return false; + { return false; } if (m_aggroDelay != 0) return false; @@ -2204,10 +2207,10 @@ bool Creature::CanInitiateAttack() void Creature::SaveRespawnTime() { if (IsPet() || !HasStaticDBSpawnData()) - return; + { return; } if (m_respawnTime > time(NULL)) // dead (no corpse) - GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), m_respawnTime); + { GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), m_respawnTime); } else if (m_corpseDecayTimer > 0) // dead (corpse) GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), time(NULL) + m_respawnDelay + m_corpseDecayTimer / IN_MILLISECONDS); } @@ -2215,22 +2218,22 @@ void Creature::SaveRespawnTime() bool Creature::IsOutOfThreatArea(Unit* pVictim) const { if (!pVictim) - return true; + { return true; } if (!pVictim->IsInMap(this)) - return true; + { return true; } if (!pVictim->IsTargetableForAttack()) - return true; + { return true; } if (!pVictim->isInAccessablePlaceFor(this)) - return true; + { return true; } if (!pVictim->IsVisibleForOrDetect(this, this, false)) - return true; + { return true; } if (sMapStore.LookupEntry(GetMapId())->IsDungeon()) - return false; + { return false; } float AttackDist = GetAttackDistance(pVictim); float ThreatRadius = sWorld.getConfig(CONFIG_FLOAT_THREAT_RADIUS); @@ -2244,7 +2247,7 @@ CreatureDataAddon const* Creature::GetCreatureAddon() const { if (!(GetObjectGuid().GetHigh() == HIGHGUID_PET)) // pets have guidlow that is conflicting with normal guidlows hence GetGUIDLow() gives wrong info if (CreatureDataAddon const* addon = ObjectMgr::GetCreatureAddon(GetGUIDLow())) - return addon; + { return addon; } // dependent from difficulty mode entry if (GetEntry() != GetCreatureInfo()->Entry) @@ -2263,10 +2266,10 @@ bool Creature::LoadCreatureAddon(bool reload) { CreatureDataAddon const* cainfo = GetCreatureAddon(); if (!cainfo) - return false; + { return false; } if (cainfo->mount != 0) - Mount(cainfo->mount); + { Mount(cainfo->mount); } if (cainfo->bytes1 != 0) { @@ -2296,7 +2299,7 @@ bool Creature::LoadCreatureAddon(bool reload) // SetByteValue(UNIT_FIELD_BYTES_2, 3, 0); if (cainfo->emote != 0) - SetUInt32Value(UNIT_NPC_EMOTESTATE, cainfo->emote); + { SetUInt32Value(UNIT_NPC_EMOTESTATE, cainfo->emote); } if (cainfo->splineFlags & SPLINEFLAG_FLYING) SetLevitate(true); @@ -2308,7 +2311,7 @@ bool Creature::LoadCreatureAddon(bool reload) if (HasAuraOfDifficulty(*cAura)) { if (!reload) - sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u) has spell %u in `auras` field, but aura is already applied.", GetGUIDLow(), GetEntry(), *cAura); + { sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u) has spell %u in `auras` field, but aura is already applied.", GetGUIDLow(), GetEntry(), *cAura); } continue; } @@ -2336,7 +2339,7 @@ void Creature::SetInCombatWithZone() { if (!CanHaveThreatList()) { - sLog.outError("Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry()); + sLog.outError("Creature entry %u call SetInCombatWithZone but creature can not have threat list.", GetEntry()); return; } @@ -2351,14 +2354,14 @@ void Creature::SetInCombatWithZone() Map::PlayerList const& PlList = pMap->GetPlayers(); if (PlList.isEmpty()) - return; + { return; } for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) { if (Player* pPlayer = i->getSource()) { if (pPlayer->isGameMaster()) - continue; + { continue; } if (pPlayer->IsAlive() && !IsFriendlyTo(pPlayer)) { @@ -2372,24 +2375,24 @@ void Creature::SetInCombatWithZone() bool Creature::MeetsSelectAttackingRequirement(Unit* pTarget, SpellEntry const* pSpellInfo, uint32 selectFlags) const { if (selectFlags & SELECT_FLAG_PLAYER && pTarget->GetTypeId() != TYPEID_PLAYER) - return false; + { return false; } if (selectFlags & SELECT_FLAG_POWER_MANA && pTarget->GetPowerType() != POWER_MANA) - return false; + { return false; } else if (selectFlags & SELECT_FLAG_POWER_RAGE && pTarget->GetPowerType() != POWER_RAGE) - return false; + { return false; } else if (selectFlags & SELECT_FLAG_POWER_ENERGY && pTarget->GetPowerType() != POWER_ENERGY) - return false; + { return false; } else if (selectFlags & SELECT_FLAG_POWER_RUNIC && pTarget->GetPowerType() != POWER_RUNIC_POWER) - return false; + { return false; } if (selectFlags & SELECT_FLAG_IN_MELEE_RANGE && !CanReachWithMeleeAttack(pTarget)) - return false; + { return false; } if (selectFlags & SELECT_FLAG_NOT_IN_MELEE_RANGE && CanReachWithMeleeAttack(pTarget)) - return false; + { return false; } if (selectFlags & SELECT_FLAG_IN_LOS && !IsWithinLOSInMap(pTarget)) - return false; + { return false; } if (pSpellInfo) { @@ -2419,7 +2422,7 @@ Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, u Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, SpellEntry const* pSpellInfo /*= NULL*/, uint32 selectFlags/*= 0*/) const { if (!CanHaveThreatList()) - return NULL; + { return NULL; } // ThreatList m_threatlist; ThreatList const& threatlist = GetThreatManager().getThreatList(); @@ -2427,7 +2430,7 @@ Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, S ThreatList::const_reverse_iterator ritr = threatlist.rbegin(); if (position >= threatlist.size() || !threatlist.size()) - return NULL; + { return NULL; } switch (target) { @@ -2439,10 +2442,10 @@ Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, S for (; itr != threatlist.end(); ++itr) if (Unit* pTarget = GetMap()->GetUnit((*itr)->getUnitGuid())) if (!selectFlags || MeetsSelectAttackingRequirement(pTarget, pSpellInfo, selectFlags)) - suitableUnits.push_back(pTarget); + { suitableUnits.push_back(pTarget); } if (!suitableUnits.empty()) - return suitableUnits[urand(0, suitableUnits.size() - 1)]; + { return suitableUnits[urand(0, suitableUnits.size() - 1)]; } break; } @@ -2452,7 +2455,7 @@ Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, S for (; itr != threatlist.end(); ++itr) if (Unit* pTarget = GetMap()->GetUnit((*itr)->getUnitGuid())) if (!selectFlags || MeetsSelectAttackingRequirement(pTarget, pSpellInfo, selectFlags)) - return pTarget; + { return pTarget; } break; } @@ -2462,7 +2465,7 @@ Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, S for (; ritr != threatlist.rend(); ++ritr) if (Unit* pTarget = GetMap()->GetUnit((*itr)->getUnitGuid())) if (!selectFlags || MeetsSelectAttackingRequirement(pTarget, pSpellInfo, selectFlags)) - return pTarget; + { return pTarget; } break; } @@ -2485,11 +2488,11 @@ void Creature::AddCreatureSpellCooldown(uint32 spellid) { SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid); if (!spellInfo) - return; + { return; } uint32 cooldown = GetSpellRecoveryTime(spellInfo); if (cooldown) - _AddCreatureSpellCooldown(spellid, time(NULL) + cooldown / IN_MILLISECONDS); + { _AddCreatureSpellCooldown(spellid, time(NULL) + cooldown / IN_MILLISECONDS); } if(uint32 category = spellInfo->GetCategory()) _AddCreatureCategoryCooldown(category, time(NULL)); @@ -2499,7 +2502,7 @@ bool Creature::HasCategoryCooldown(uint32 spell_id) const { SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id); if (!spellInfo) - return false; + { return false; } CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->GetCategory()); return (itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->GetCategoryRecoveryTime() / IN_MILLISECONDS)) > time(NULL)); @@ -2534,7 +2537,7 @@ bool Creature::HasSpell(uint32 spellID) const uint8 i; for (i = 0; i < CREATURE_MAX_SPELLS; ++i) if (spellID == m_spells[i]) - break; + { break; } return i < CREATURE_MAX_SPELLS; // break before end of iteration of known spells } @@ -2542,11 +2545,11 @@ time_t Creature::GetRespawnTimeEx() const { time_t now = time(NULL); if (m_respawnTime > now) // dead (no corpse) - return m_respawnTime; + { return m_respawnTime; } else if (m_corpseDecayTimer > 0) // dead (corpse) return now + m_respawnDelay + m_corpseDecayTimer / IN_MILLISECONDS; else - return now; + { return now; } } void Creature::GetRespawnCoord(float& x, float& y, float& z, float* ori, float* dist) const @@ -2556,10 +2559,10 @@ void Creature::GetRespawnCoord(float& x, float& y, float& z, float* ori, float* z = m_respawnPos.z; if (ori) - *ori = m_respawnPos.o; + { *ori = m_respawnPos.o; } if (dist) - *dist = GetRespawnRadius(); + { *dist = GetRespawnRadius(); } // lets check if our creatures have valid spawn coordinates MANGOS_ASSERT(MaNGOS::IsValidMapCoord(x, y, z) || PrintCoordinatesError(x, y, z, "respawn")); @@ -2628,13 +2631,13 @@ void Creature::AllLootRemovedFromCorpse() uint32 Creature::GetLevelForTarget(Unit const* target) const { if (!IsWorldBoss()) - return Unit::GetLevelForTarget(target); + { return Unit::GetLevelForTarget(target); } uint32 level = target->getLevel() + sWorld.getConfig(CONFIG_UINT32_WORLD_BOSS_LEVEL_DIFF); if (level < 1) - return 1; + { return 1; } if (level > 255) - return 255; + { return 255; } return level; } @@ -2668,15 +2671,15 @@ VendorItemData const* Creature::GetVendorTemplateItems() const uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) { if (!vItem->maxcount) - return vItem->maxcount; + { return vItem->maxcount; } VendorItemCounts::iterator itr = m_vendorItemCounts.begin(); for (; itr != m_vendorItemCounts.end(); ++itr) if (itr->itemId == vItem->item) - break; + { break; } if (itr == m_vendorItemCounts.end()) - return vItem->maxcount; + { return vItem->maxcount; } VendorItemCount* vCount = &*itr; @@ -2703,12 +2706,12 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 used_count) { if (!vItem->maxcount) - return 0; + { return 0; } VendorItemCounts::iterator itr = m_vendorItemCounts.begin(); for (; itr != m_vendorItemCounts.end(); ++itr) if (itr->itemId == vItem->item) - break; + { break; } if (itr == m_vendorItemCounts.end()) { @@ -2727,9 +2730,9 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us uint32 diff = uint32((ptime - vCount->lastIncrementTime) / vItem->incrtime); if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount) - vCount->count += diff * pProto->BuyCount; + { vCount->count += diff * pProto->BuyCount; } else - vCount->count = vItem->maxcount; + { vCount->count = vItem->maxcount; } } vCount->count = vCount->count > used_count ? vCount->count - used_count : 0; @@ -2762,15 +2765,15 @@ void Creature::SetFactionTemporary(uint32 factionId, uint32 tempFactionFlags) setFaction(factionId); if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_NON_ATTACKABLE) - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + { RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_OOC_NOT_ATTACK) - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + { RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_PASSIVE) - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); + { RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); } if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_PACIFIED) - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + { RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); } if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_NOT_SELECTABLE) - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + { RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } } void Creature::ClearTemporaryFaction() @@ -2779,21 +2782,21 @@ void Creature::ClearTemporaryFaction() // For later we may consider extend to restore to charmer faction where charmer is creature. // This can also be done by update any pet/charmed of creature at any faction change to charmer. if (IsCharmed()) - return; + { return; } // Reset to original faction setFaction(GetCreatureInfo()->FactionAlliance); // Reset UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_OOC_NOT_ATTACKABLE, UNIT_FLAG_PASSIVE, UNIT_FLAG_PACIFIED or UNIT_FLAG_NOT_SELECTABLE flags if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_NON_ATTACKABLE && GetCreatureInfo()->UnitFlags & UNIT_FLAG_NON_ATTACKABLE) - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + { SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_OOC_NOT_ATTACK && GetCreatureInfo()->UnitFlags & UNIT_FLAG_OOC_NOT_ATTACKABLE && !IsInCombat()) - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + { SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_PASSIVE && GetCreatureInfo()->UnitFlags & UNIT_FLAG_PASSIVE) - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); + { SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); } if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_PACIFIED && GetCreatureInfo()->UnitFlags & UNIT_FLAG_PACIFIED) - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + { SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); } if (m_temporaryFactionFlags & TEMPFACTION_TOGGLE_NOT_SELECTABLE && GetCreatureInfo()->UnitFlags & UNIT_FLAG_NOT_SELECTABLE) - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + { SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } m_temporaryFactionFlags = TEMPFACTION_NONE; } @@ -2802,7 +2805,7 @@ void Creature::SendAreaSpiritHealerQueryOpcode(Player* pl) { uint32 next_resurrect = 0; if (Spell* pcurSpell = GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - next_resurrect = pcurSpell->GetCastedTime(); + { next_resurrect = pcurSpell->GetCastedTime(); } WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 8 + 4); data << ObjectGuid(GetObjectGuid()); data << uint32(next_resurrect); @@ -2817,16 +2820,16 @@ void Creature::ApplyGameEventSpells(GameEventCreatureData const* eventData, bool if (remove_spell) if (SpellEntry const* spellEntry = sSpellStore.LookupEntry(remove_spell)) if (IsSpellAppliesAura(spellEntry)) - RemoveAurasDueToSpell(remove_spell); + { RemoveAurasDueToSpell(remove_spell); } if (cast_spell) - CastSpell(this, cast_spell, true); + { CastSpell(this, cast_spell, true); } } void Creature::FillGuidsListFromThreatList(GuidVector& guids, uint32 maxamount /*= 0*/) { if (!CanHaveThreatList()) - return; + { return; } ThreatList const& threats = GetThreatManager().getThreatList(); @@ -2835,7 +2838,7 @@ void Creature::FillGuidsListFromThreatList(GuidVector& guids, uint32 maxamount / guids.reserve(guids.size() + maxamount); for (ThreatList::const_iterator itr = threats.begin(); maxamount && itr != threats.end(); ++itr, --maxamount) - guids.push_back((*itr)->getUnitGuid()); + { guids.push_back((*itr)->getUnitGuid()); } } struct AddCreatureToRemoveListInMapsWorker @@ -2845,7 +2848,7 @@ struct AddCreatureToRemoveListInMapsWorker void operator()(Map* map) { if (Creature* pCreature = map->GetCreature(i_guid)) - pCreature->AddObjectToRemoveList(); + { pCreature->AddObjectToRemoveList(); } } ObjectGuid i_guid; @@ -2900,19 +2903,19 @@ void Creature::SetWalk(bool enable, bool asDefault) if (asDefault) { if (enable) - clearUnitState(UNIT_STAT_RUNNING); + { clearUnitState(UNIT_STAT_RUNNING); } else - addUnitState(UNIT_STAT_RUNNING); + { addUnitState(UNIT_STAT_RUNNING); } } // Nothing changed? if (enable == m_movementInfo.HasMovementFlag(MOVEFLAG_WALK_MODE)) - return; + { return; } if (enable) - m_movementInfo.AddMovementFlag(MOVEFLAG_WALK_MODE); + { m_movementInfo.AddMovementFlag(MOVEFLAG_WALK_MODE); } else - m_movementInfo.RemoveMovementFlag(MOVEFLAG_WALK_MODE); + { m_movementInfo.RemoveMovementFlag(MOVEFLAG_WALK_MODE); } if (IsInWorld()) { @@ -2935,9 +2938,9 @@ void Creature::SetWalk(bool enable, bool asDefault) void Creature::SetLevitate(bool enable) { if (enable) - m_movementInfo.AddMovementFlag(MOVEFLAG_LEVITATING); + { m_movementInfo.AddMovementFlag(MOVEFLAG_LEVITATING); } else - m_movementInfo.RemoveMovementFlag(MOVEFLAG_LEVITATING); + { m_movementInfo.RemoveMovementFlag(MOVEFLAG_LEVITATING); } if (IsInWorld()) { @@ -3008,9 +3011,9 @@ void Creature::SetHover(bool enable) void Creature::SetRoot(bool enable) { if (enable) - m_movementInfo.AddMovementFlag(MOVEFLAG_ROOT); + { m_movementInfo.AddMovementFlag(MOVEFLAG_ROOT); } else - m_movementInfo.RemoveMovementFlag(MOVEFLAG_ROOT); + { m_movementInfo.RemoveMovementFlag(MOVEFLAG_ROOT); } if (IsInWorld()) { diff --git a/src/game/Object/Creature.h b/src/game/Object/Creature.h index 290bb0b1b..170fc34a7 100644 --- a/src/game/Object/Creature.h +++ b/src/game/Object/Creature.h @@ -91,20 +91,20 @@ struct CreatureInfo uint32 FactionAlliance; uint32 FactionHorde; float Scale; - uint32 Family; // enum CreatureFamily values (optional) - uint32 CreatureType; // enum CreatureType values + uint32 Family; // enum CreatureFamily values (optional) + uint32 CreatureType; // enum CreatureType values uint32 InhabitType; uint32 RegenerateStats; int32 RacialLeader; uint32 NpcFlags; - uint32 UnitFlags; // enum UnitFlags mask values + uint32 UnitFlags; // enum UnitFlags mask values uint32 UnitFlags2; // enum UnitFlags2 mask values uint32 DynamicFlags; uint32 ExtraFlags; - uint32 CreatureTypeFlags; // enum CreatureTypeFlags mask values + uint32 CreatureTypeFlags; // enum CreatureTypeFlags mask values float SpeedWalk; float SpeedRun; - uint32 UnitClass; // enum Classes. Note only 4 classes are known for creatures. + uint32 UnitClass; // enum Classes. Note only 4 classes are known for creatures. uint32 Rank; int32 Expansion; // creature expansion, important for stats, CAN BE -1 as marker for some invalid cases. float HealthMultiplier; @@ -166,13 +166,13 @@ struct CreatureInfo SkillType GetRequiredLootSkill() const { if (CreatureTypeFlags & CREATURE_TYPEFLAGS_HERBLOOT) - return SKILL_HERBALISM; + { return SKILL_HERBALISM; } else if (CreatureTypeFlags & CREATURE_TYPEFLAGS_MININGLOOT) - return SKILL_MINING; + { return SKILL_MINING; } else if (CreatureTypeFlags & CREATURE_TYPEFLAGS_ENGINEERLOOT) return SKILL_ENGINEERING; else - return SKILL_SKINNING; // normal case + { return SKILL_SKINNING; } // normal case } bool IsExotic() const @@ -341,8 +341,8 @@ enum SelectFlags enum RegenStatsFlags { - REGEN_FLAG_HEALTH = 0x001, - REGEN_FLAG_POWER = 0x002, + REGEN_FLAG_HEALTH = 0x001, + REGEN_FLAG_POWER = 0x002, }; // Vendors @@ -377,7 +377,7 @@ struct VendorItemData VendorItem* GetItem(uint32 slot) const { - if (slot >= m_items.size()) return NULL; + if (slot >= m_items.size()) { return NULL; } return m_items[slot]; } bool Empty() const { return m_items.empty(); } @@ -690,6 +690,12 @@ class Creature : public Unit * \return ObjectGuid Player GUID. */ ObjectGuid GetLootRecipientGuid() const { return m_lootRecipientGuid; } + + /** + * function returning the group recipient ID. + * + * \return uint32 Group ID. + */ uint32 GetLootGroupRecipientId() const { return m_lootGroupRecipientId; } Player* GetLootRecipient() const; // use group cases as prefered Group* GetGroupLootRecipient() const; diff --git a/src/game/Object/CreatureAI.cpp b/src/game/Object/CreatureAI.cpp index 5f963c179..ed31ac630 100644 --- a/src/game/Object/CreatureAI.cpp +++ b/src/game/Object/CreatureAI.cpp @@ -117,7 +117,7 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32 } // Interrupt any previous spell - if (uiCastFlags & CAST_INTERRUPT_PREVIOUS && pCaster->IsNonMeleeSpellCasted(false)) + if ((uiCastFlags & CAST_INTERRUPT_PREVIOUS) && pCaster->IsNonMeleeSpellCasted(false)) { pCaster->InterruptNonMeleeSpells(false); } // Creature should always stop before it will cast a non-instant spell @@ -153,16 +153,16 @@ void CreatureAI::SetCombatMovement(bool enable, bool stopOrStartMovement /*=fals m_isCombatMovement = enable; if (enable) - m_creature->clearUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT); + { m_creature->clearUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT); } else - m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT); + { m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT); } if (stopOrStartMovement && m_creature->getVictim()) // Only change current movement while in combat { if (enable) - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), m_attackDistance, m_attackAngle); + { m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), m_attackDistance, m_attackAngle); } else if (!enable && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) - m_creature->StopMoving(); + { m_creature->StopMoving(); } } } @@ -261,7 +261,7 @@ void CreatureAI::SendAIEventAround(AIEventType eventType, Unit* pInvoker, uint32 } } -void CreatureAI::SendAIEvent(AIEventType eventType, Unit* pInvoker, Creature* pReceiver, uint32 miscValue /*=0*/) const +void CreatureAI::SendAIEvent(AIEventType eventType, Unit* pInvoker, Creature* pReceiver, uint32 miscValue /*=0*/) const { MANGOS_ASSERT(pReceiver); pReceiver->AI()->ReceiveAIEvent(eventType, m_creature, pInvoker, miscValue); diff --git a/src/game/Object/CreatureAI.h b/src/game/Object/CreatureAI.h index 7870f6594..a06802f2e 100644 --- a/src/game/Object/CreatureAI.h +++ b/src/game/Object/CreatureAI.h @@ -91,14 +91,14 @@ enum AIEventType // Internal Use AI_EVENT_CALL_ASSISTANCE = 13, // Sender = Attacked Npc, Invoker = Enemy - // Predefined for SD2 + // Predefined for SD3 AI_EVENT_START_ESCORT = 100, // Invoker = Escorting Player AI_EVENT_START_ESCORT_B = 101, // Invoker = Escorting Player AI_EVENT_START_EVENT = 102, // Invoker = EventStarter AI_EVENT_START_EVENT_A = 103, // Invoker = EventStarter AI_EVENT_START_EVENT_B = 104, // Invoker = EventStarter - // Some IDs for special cases in SD2 + // Some IDs for special cases in SD3 AI_EVENT_CUSTOM_A = 1000, AI_EVENT_CUSTOM_B = 1001, AI_EVENT_CUSTOM_C = 1002, @@ -121,7 +121,7 @@ class CreatureAI ///== Information about AI ======================== /** - * This function is used to display information about the AI. + * This funcion is used to display information about the AI. * It is called when the .npc aiinfo command is used. * Use this for on-the-fly debugging * @param reader is a ChatHandler to send messages to. @@ -327,7 +327,7 @@ class CreatureAI ///== Event Handling =============================== - /** + /* * Send an AI Event to nearby Creatures around * @param uiType number to specify the event, default cases listed in enum AIEventType * @param pInvoker Unit that triggered this event (like an attacker) @@ -336,7 +336,7 @@ class CreatureAI */ void SendAIEventAround(AIEventType eventType, Unit* pInvoker, uint32 uiDelay, float fRadius, uint32 miscValue = 0) const; - /** + /* * Send an AI Event to a Creature * @param eventType to specify the event, default cases listed in enum AIEventType * @param pInvoker Unit that triggered this event (like an attacker) @@ -344,7 +344,7 @@ class CreatureAI */ void SendAIEvent(AIEventType eventType, Unit* pInvoker, Creature* pReceiver, uint32 miscValue = 0) const; - /** + /* * Called when an AI Event is received * @param eventType to specify the event, default cases listed in enum AIEventType * @param pSender Creature that sent this event diff --git a/src/game/Object/CreatureAIImpl.h b/src/game/Object/CreatureAIImpl.h index c0a2c2490..58f17a032 100644 --- a/src/game/Object/CreatureAIImpl.h +++ b/src/game/Object/CreatureAIImpl.h @@ -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 * diff --git a/src/game/Object/CreatureAIRegistry.cpp b/src/game/Object/CreatureAIRegistry.cpp index 327586280..f57654261 100644 --- a/src/game/Object/CreatureAIRegistry.cpp +++ b/src/game/Object/CreatureAIRegistry.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 * diff --git a/src/game/Object/CreatureAIRegistry.h b/src/game/Object/CreatureAIRegistry.h index 0450912e0..22fc149a8 100644 --- a/src/game/Object/CreatureAIRegistry.h +++ b/src/game/Object/CreatureAIRegistry.h @@ -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 * diff --git a/src/game/Object/CreatureAISelector.cpp b/src/game/Object/CreatureAISelector.cpp index 8ef0ec580..58b1a294e 100644 --- a/src/game/Object/CreatureAISelector.cpp +++ b/src/game/Object/CreatureAISelector.cpp @@ -48,7 +48,7 @@ namespace FactorySelector // Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets) if (!creature->IsPet() || !static_cast(creature)->isControlled()) - return scriptedAI; + { return scriptedAI; } } CreatureAIRegistry& ai_registry(CreatureAIRepository::Instance()); @@ -64,17 +64,17 @@ namespace FactorySelector { Unit* controler = creature->GetOwner() ? creature->GetOwner() : creature->GetCharmer(); if (controler && controler->GetTypeId() == TYPEID_PLAYER && controler->IsAlive()) - ai_factory = ai_registry.GetRegistryItem("PetAI"); + { ai_factory = ai_registry.GetRegistryItem("PetAI"); } } else if (creature->IsTotem()) - ai_factory = ai_registry.GetRegistryItem("TotemAI"); + { ai_factory = ai_registry.GetRegistryItem("TotemAI"); } // select by script name if (!ai_factory && !ainame.empty()) - ai_factory = ai_registry.GetRegistryItem(ainame.c_str()); + { ai_factory = ai_registry.GetRegistryItem(ainame.c_str()); } if (!ai_factory && creature->IsGuard()) - ai_factory = ai_registry.GetRegistryItem("GuardAI"); + { ai_factory = ai_registry.GetRegistryItem("GuardAI"); } // select by permit check if (!ai_factory) diff --git a/src/game/Object/CreatureAISelector.h b/src/game/Object/CreatureAISelector.h index d02e5b7e0..73f67b7f3 100644 --- a/src/game/Object/CreatureAISelector.h +++ b/src/game/Object/CreatureAISelector.h @@ -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 * diff --git a/src/game/Object/CreatureEventAI.cpp b/src/game/Object/CreatureEventAI.cpp index b6d1d7187..03ada3620 100644 --- a/src/game/Object/CreatureEventAI.cpp +++ b/src/game/Object/CreatureEventAI.cpp @@ -40,9 +40,9 @@ bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatMin, uint32 repeatMax) { if (repeatMin == repeatMax) - Time = repeatMin; + { Time = repeatMin; } else if (repeatMax > repeatMin) - Time = urand(repeatMin, repeatMax); + { Time = urand(repeatMin, repeatMax); } else { sLog.outErrorEventAI("Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type); @@ -56,7 +56,7 @@ bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatM int CreatureEventAI::Permissible(const Creature* creature) { if (creature->GetAIName() == "EventAI") - return PERMIT_BASE_SPECIAL; + { return PERMIT_BASE_SPECIAL; } return PERMIT_BASE_NO; } @@ -67,17 +67,17 @@ void CreatureEventAI::GetAIInformation(ChatHandler& reader) reader.PSendSysMessage(LANG_NPC_EVENTAI_COMBAT, reader.GetOnOffStr(m_MeleeEnabled)); if (sLog.HasLogFilter(LOG_FILTER_EVENT_AI_DEV)) // Give some more details if in EventAI Dev Mode - return; + { return; } reader.PSendSysMessage("Current events of this creature:"); for (CreatureEventAIList::const_iterator itr = m_CreatureEventAIList.begin(); itr != m_CreatureEventAIList.end(); ++itr) { if (itr->Event.action[2].type != ACTION_T_NONE) - reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time/1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1, itr->Event.action[2].type, itr->Event.action[2].raw.param1); + { reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1, itr->Event.action[2].type, itr->Event.action[2].raw.param1); } else if (itr->Event.action[1].type != ACTION_T_NONE) - reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time/1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1); + { reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1); } else - reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) action[type(param1)]: %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time/1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1); + { reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) action[type(param1)]: %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1); } } } @@ -110,7 +110,7 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c), // Debug check #ifndef MANGOS_DEBUG if (i->event_flags & EFLAG_DEBUG_ONLY) - continue; + { continue; } #endif if (m_creature->GetMap()->IsDungeon()) { @@ -133,7 +133,7 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c), // Debug check #ifndef MANGOS_DEBUG if (i->event_flags & EFLAG_DEBUG_ONLY) - continue; + { continue; } #endif bool storeEvent = false; if (m_creature->GetMap()->IsDungeon()) @@ -155,7 +155,7 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c), } } else - sLog.outErrorEventAI("EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry()); + { sLog.outErrorEventAI("EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry()); } } #define LOG_PROCESS_EVENT \ @@ -186,21 +186,21 @@ inline bool IsTimerBasedEvent(EventAI_Type type) } } -bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker, Creature* pAIEventSender) +bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker, Creature* pAIEventSender /*=NULL*/) { if (!pHolder.Enabled || pHolder.Time) - return false; + { return false; } // Check the inverse phase mask (event doesn't trigger if current phase bit is set in mask) if (pHolder.Event.event_inverse_phase_mask & (1 << m_Phase)) { if (!IsTimerBasedEvent(pHolder.Event.event_type)) - DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: Event %u skipped because of phasemask %u. Current phase %u", pHolder.Event.event_id, pHolder.Event.event_inverse_phase_mask, m_Phase); + { DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: Event %u skipped because of phasemask %u. Current phase %u", pHolder.Event.event_id, pHolder.Event.event_inverse_phase_mask, m_Phase); } return false; } if (!IsTimerBasedEvent(pHolder.Event.event_type)) - LOG_PROCESS_EVENT; + { LOG_PROCESS_EVENT; } CreatureEventAI_Event const& event = pHolder.Event; @@ -209,7 +209,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction { case EVENT_T_TIMER_IN_COMBAT: if (!m_creature->IsInCombat()) - return false; + { return false; } LOG_PROCESS_EVENT; // Repeat Timers @@ -217,7 +217,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction break; case EVENT_T_TIMER_OOC: if (m_creature->IsInCombat() || m_creature->IsInEvadeMode()) - return false; + { return false; } LOG_PROCESS_EVENT; // Repeat Timers @@ -231,12 +231,12 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction case EVENT_T_HP: { if (!m_creature->IsInCombat() || !m_creature->GetMaxHealth()) - return false; + { return false; } uint32 perc = (m_creature->GetHealth() * 100) / m_creature->GetMaxHealth(); if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) - return false; + { return false; } LOG_PROCESS_EVENT; // Repeat Timers @@ -246,12 +246,12 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction case EVENT_T_MANA: { if (!m_creature->IsInCombat() || !m_creature->GetMaxPower(POWER_MANA)) - return false; + { return false; } uint32 perc = (m_creature->GetPower(POWER_MANA) * 100) / m_creature->GetMaxPower(POWER_MANA); if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) - return false; + { return false; } LOG_PROCESS_EVENT; // Repeat Timers @@ -293,12 +293,12 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction case EVENT_T_TARGET_HP: { if (!m_creature->IsInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxHealth()) - return false; + { return false; } uint32 perc = (m_creature->getVictim()->GetHealth() * 100) / m_creature->getVictim()->GetMaxHealth(); if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) - return false; + { return false; } LOG_PROCESS_EVENT; // Repeat Timers @@ -307,7 +307,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction } case EVENT_T_TARGET_CASTING: if (!m_creature->IsInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->IsNonMeleeSpellCasted(false, false, true)) - return false; + { return false; } LOG_PROCESS_EVENT; // Repeat Timers @@ -316,11 +316,11 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction case EVENT_T_FRIENDLY_HP: { if (!m_creature->IsInCombat()) - return false; + { return false; } Unit* pUnit = DoSelectLowestHpFriendly((float)event.friendly_hp.radius, event.friendly_hp.hpDeficit); if (!pUnit) - return false; + { return false; } pActionInvoker = pUnit; @@ -332,14 +332,14 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction case EVENT_T_FRIENDLY_IS_CC: { if (!m_creature->IsInCombat()) - return false; + { return false; } std::list pList; DoFindFriendlyCC(pList, (float)event.friendly_is_cc.radius); // List is empty if (pList.empty()) - return false; + { return false; } // We don't really care about the whole list, just return first available pActionInvoker = *(pList.begin()); @@ -355,7 +355,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction // List is empty if (pList.empty()) - return false; + { return false; } // We don't really care about the whole list, just return first available pActionInvoker = *(pList.begin()); @@ -370,11 +370,11 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction { // Prevent event from occuring on no unit or non creatures if (!pActionInvoker || pActionInvoker->GetTypeId() != TYPEID_UNIT) - return false; + { return false; } // Creature id doesn't match up if (((Creature*)pActionInvoker)->GetEntry() != event.summoned.creatureId) - return false; + { return false; } // Repeat Timers pHolder.UpdateRepeatTimer(m_creature, event.summoned.repeatMin, event.summoned.repeatMax); @@ -383,12 +383,12 @@ 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)) - return false; + { return false; } uint32 perc = (m_creature->getVictim()->GetPower(POWER_MANA) * 100) / m_creature->getVictim()->GetMaxPower(POWER_MANA); if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) - return false; + { return false; } // Repeat Timers pHolder.UpdateRepeatTimer(m_creature, event.percent_range.repeatMin, event.percent_range.repeatMax); @@ -404,7 +404,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId); if (!holder || holder->GetStackAmount() < event.buffed.amount) - return false; + { return false; } LOG_PROCESS_EVENT; // Repeat Timers @@ -414,11 +414,11 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction case EVENT_T_TARGET_AURA: { if (!m_creature->IsInCombat() || !m_creature->getVictim()) - return false; + { return false; } SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId); if (!holder || holder->GetStackAmount() < event.buffed.amount) - return false; + { return false; } LOG_PROCESS_EVENT; // Repeat Timers @@ -432,7 +432,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(event.buffed.spellId); if (holder && holder->GetStackAmount() >= event.buffed.amount) - return false; + { return false; } LOG_PROCESS_EVENT; // Repeat Timers @@ -442,11 +442,11 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction case EVENT_T_TARGET_MISSING_AURA: { if (!m_creature->IsInCombat() || !m_creature->getVictim()) - return false; + { return false; } SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId); if (holder && holder->GetStackAmount() >= event.buffed.amount) - return false; + { return false; } LOG_PROCESS_EVENT; // Repeat Timers @@ -458,13 +458,13 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction case EVENT_T_ENERGY: { if (!m_creature->IsInCombat() || !m_creature->GetMaxPower(POWER_ENERGY)) - return false; - + { return false; } + uint32 perc = (m_creature->GetPower(POWER_ENERGY) * 100) / m_creature->GetMaxPower(POWER_ENERGY); - + if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) - return false; - + { return false; } + LOG_PROCESS_EVENT; // Repeat Timers pHolder.UpdateRepeatTimer(m_creature, event.percent_range.repeatMin, event.percent_range.repeatMax); @@ -477,20 +477,20 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction // Disable non-repeatable events if (!(pHolder.Event.event_flags & EFLAG_REPEATABLE)) - pHolder.Enabled = false; + { pHolder.Enabled = false; } // Store random here so that all random actions match up uint32 rnd = rand(); // Return if chance for event is not met if (pHolder.Event.event_chance <= rnd % 100) - return false; + { return false; } // Process actions, normal case if (!(pHolder.Event.event_flags & EFLAG_RANDOM_ACTION)) { for (uint32 j = 0; j < MAX_ACTIONS; ++j) - ProcessAction(pHolder.Event.action[j], rnd, pHolder.Event.event_id, pActionInvoker, pAIEventSender); + { ProcessAction(pHolder.Event.action[j], rnd, pHolder.Event.event_id, pActionInvoker, pAIEventSender); } } // Process actions, random case else @@ -499,7 +499,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction uint32 count = 0; for (uint32 j = 0; j < MAX_ACTIONS; ++j) if (pHolder.Event.action[j].type != ACTION_T_NONE) - ++count; + { ++count; } if (count) { @@ -513,7 +513,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction if (pHolder.Event.action[j].type != ACTION_T_NONE) { if (!idx) - break; + { break; } --idx; } } @@ -527,7 +527,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 rnd, uint32 EventId, Unit* pActionInvoker, Creature* pAIEventSender) { if (action.type == ACTION_T_NONE) - return; + { return; } DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: Process action %u (script %u) triggered for %s (invoked by %s)", action.type, EventId, m_creature->GetGuidStr().c_str(), pActionInvoker ? pActionInvoker->GetGuidStr().c_str() : ""); @@ -539,7 +539,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_CHANCED_TEXT: { if (!action.text.TextId[0]) - return; + { return; } int32 textId = 0; @@ -548,9 +548,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 if (action.text.TextId[1] && action.text.TextId[2]) textId = action.text.TextId[rnd % 3]; else if (action.text.TextId[1] && (rnd % 2)) - textId = action.text.TextId[1]; + { textId = action.text.TextId[1]; } else - textId = action.text.TextId[0]; + { textId = action.text.TextId[0]; } } // ACTION_T_CHANCED_TEXT, chance hits else if ((rnd % 100) < action.chanced_text.chance) @@ -558,7 +558,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 if (action.chanced_text.TextId[0] && action.chanced_text.TextId[1]) textId = action.chanced_text.TextId[rnd % 2]; else - textId = action.chanced_text.TextId[0]; + { textId = action.chanced_text.TextId[0]; } } if (textId) @@ -568,11 +568,11 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 if (pActionInvoker) { if (pActionInvoker->GetTypeId() == TYPEID_PLAYER) - target = pActionInvoker; + { target = pActionInvoker; } else if (Unit* owner = pActionInvoker->GetOwner()) { if (owner->GetTypeId() == TYPEID_PLAYER) - target = owner; + { target = owner; } } } else if ((target = m_creature->getVictim())) @@ -580,20 +580,20 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 if (target->GetTypeId() != TYPEID_PLAYER) if (Unit* owner = target->GetOwner()) if (owner->GetTypeId() == TYPEID_PLAYER) - target = owner; + { target = owner; } } if (!DoDisplayText(m_creature, textId, target)) - sLog.outErrorEventAI("Error attempting to display text %i, used by script %u", textId, EventId); + { sLog.outErrorEventAI("Error attempting to display text %i, used by script %u", textId, EventId); } } break; } case ACTION_T_SET_FACTION: { if (action.set_faction.factionId) - m_creature->SetFactionTemporary(action.set_faction.factionId, action.set_faction.factionFlags); + { m_creature->SetFactionTemporary(action.set_faction.factionId, action.set_faction.factionFlags); } else // no id provided, assume reset and then use default - m_creature->ClearTemporaryFaction(); + { m_creature->ClearTemporaryFaction(); } break; } @@ -612,10 +612,10 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 } // if no param1, then use value from param2 (modelId) else - m_creature->SetDisplayId(action.morph.modelId); + { m_creature->SetDisplayId(action.morph.modelId); } } else - m_creature->DeMorph(); + { m_creature->DeMorph(); } break; } case ACTION_T_SOUND: @@ -628,14 +628,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 { int32 temp = GetRandActionParam(rnd, action.random_sound.soundId1, action.random_sound.soundId2, action.random_sound.soundId3); if (temp >= 0) - m_creature->PlayDirectSound(temp); + { m_creature->PlayDirectSound(temp); } break; } case ACTION_T_RANDOM_EMOTE: { int32 temp = GetRandActionParam(rnd, action.random_emote.emoteId1, action.random_emote.emoteId2, action.random_emote.emoteId3); if (temp >= 0) - m_creature->HandleEmote(temp); + { m_creature->HandleEmote(temp); } break; } case ACTION_T_CAST: @@ -652,7 +652,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 if (!target) { if (reportTargetError) - sLog.outErrorEventAI("NULL target for ACTION_T_CAST creature entry %u casting spell id %u", m_creature->GetEntry(), action.cast.spellId); + { sLog.outErrorEventAI("NULL target for ACTION_T_CAST creature entry %u casting spell id %u", m_creature->GetEntry(), action.cast.spellId); } return; } @@ -715,53 +715,52 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 { Unit* target = GetTargetByType(action.summon.target, pActionInvoker, pAIEventSender, reportTargetError); if (!target && reportTargetError) - sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SUMMON(%u), target-type %u", EventId, action.type, action.summon.target); + { sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SUMMON(%u), target-type %u", EventId, action.type, action.summon.target); } Creature* pCreature = NULL; if (action.summon.duration) - pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, action.summon.duration); + { pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, action.summon.duration); } else - pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 0); + { pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 0); } if (!pCreature) - sLog.outErrorEventAI("failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry()); + { sLog.outErrorEventAI("failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry()); } else if (action.summon.target != TARGET_T_SELF && target) - pCreature->AI()->AttackStart(target); + { pCreature->AI()->AttackStart(target); } break; } 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); + { 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(); 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: if (Unit* target = GetTargetByType(action.quest_event.target, pActionInvoker, pAIEventSender, reportTargetError)) { if (target->GetTypeId() == TYPEID_PLAYER) - ((Player*)target)->AreaExploredOrEventHappens(action.quest_event.questId); + { ((Player*)target)->AreaExploredOrEventHappens(action.quest_event.questId); } } else if (reportTargetError) - sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_QUEST_EVENT(%u), target-type %u", EventId, action.type, action.quest_event.target); - + { sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_QUEST_EVENT(%u), target-type %u", EventId, action.type, action.quest_event.target); } break; case ACTION_T_CAST_EVENT: if (Unit* target = GetTargetByType(action.cast_event.target, pActionInvoker, pAIEventSender, reportTargetError, 0, SELECT_FLAG_PLAYER)) { if (target->GetTypeId() == TYPEID_PLAYER) - ((Player*)target)->CastedCreatureOrGO(action.cast_event.creatureId, m_creature->GetObjectGuid(), action.cast_event.spellId); + { ((Player*)target)->CastedCreatureOrGO(action.cast_event.creatureId, m_creature->GetObjectGuid(), action.cast_event.spellId); } } else if (reportTargetError) - sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_CST_EVENT(%u), target-type %u", EventId, action.type, action.cast_event.target); + { sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_CST_EVENT(%u), target-type %u", EventId, action.type, action.cast_event.target); } break; case ACTION_T_SET_UNIT_FIELD: { @@ -769,38 +768,38 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 // not allow modify important for integrity object fields if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END) - return; + { return; } else if (reportTargetError) - sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FIELD(%u), target-type %u", EventId, action.type, action.set_unit_field.target); + { sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FIELD(%u), target-type %u", EventId, action.type, action.set_unit_field.target); } break; } case ACTION_T_SET_UNIT_FLAG: if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker, pAIEventSender, reportTargetError)) - target->SetFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); + { target->SetFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); } else if (reportTargetError) - sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); + { sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); } break; case ACTION_T_REMOVE_UNIT_FLAG: if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker, pAIEventSender, reportTargetError)) - target->RemoveFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); + { target->RemoveFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); } else if (reportTargetError) - sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVE_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); + { sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVE_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); } case ACTION_T_AUTO_ATTACK: m_MeleeEnabled = action.auto_attack.state != 0; break; case ACTION_T_COMBAT_MOVEMENT: // ignore no affect case if (m_isCombatMovement == (action.combat_movement.state != 0) || m_creature->IsNonMeleeSpellCasted(false)) - return; + { return; } SetCombatMovement(action.combat_movement.state != 0, true); if (m_isCombatMovement && action.combat_movement.melee && m_creature->IsInCombat() && m_creature->getVictim()) - m_creature->SendMeleeAttackStart(m_creature->getVictim()); + { m_creature->SendMeleeAttackStart(m_creature->getVictim()); } else if (action.combat_movement.melee && m_creature->IsInCombat() && m_creature->getVictim()) - m_creature->SendMeleeAttackStop(m_creature->getVictim()); + { m_creature->SendMeleeAttackStop(m_creature->getVictim()); } break; case ACTION_T_SET_PHASE: m_Phase = action.set_phase.phase; @@ -816,11 +815,11 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 } else if (new_phase >= MAX_PHASE) { - sLog.outErrorEventAI("Event %d incremented Phase above %u. Phase mask cannot be used with phases past %u. CreatureEntry = %d", EventId, MAX_PHASE - 1, MAX_PHASE - 1, m_creature->GetEntry()); + sLog.outErrorEventAI("Event %d incremented Phase above %u. Phase mask can not be used with phases past %u. CreatureEntry = %d", EventId, MAX_PHASE - 1, MAX_PHASE - 1, m_creature->GetEntry()); m_Phase = MAX_PHASE - 1; } else - m_Phase = new_phase; + { m_Phase = new_phase; } DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_INC_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase); break; @@ -840,21 +839,21 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 temp->GroupEventHappens(action.quest_event_all.questId, m_creature); } else if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER) - ((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature); + { ((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature); } break; case ACTION_T_CAST_EVENT_ALL: { 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); + { temp->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetObjectGuid(), action.cast_event_all.spellId); } break; } case ACTION_T_REMOVEAURASFROMSPELL: if (Unit* target = GetTargetByType(action.remove_aura.target, pActionInvoker, pAIEventSender, reportTargetError)) - target->RemoveAurasDueToSpell(action.remove_aura.spellId); + { target->RemoveAurasDueToSpell(action.remove_aura.spellId); } else if (reportTargetError) - sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVEAURASFROMSPELL(%u), target-type %u", EventId, action.type, action.remove_aura.target); + { sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVEAURASFROMSPELL(%u), target-type %u", EventId, action.type, action.remove_aura.target); } break; case ACTION_T_RANGED_MOVEMENT: m_attackDistance = (float)action.ranged_movement.distance; @@ -876,16 +875,16 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 break; case ACTION_T_RANDOM_PHASE_RANGE: if (action.random_phase_range.phaseMax > action.random_phase_range.phaseMin) - m_Phase = action.random_phase_range.phaseMin + (rnd % (action.random_phase_range.phaseMax - action.random_phase_range.phaseMin)); + { m_Phase = action.random_phase_range.phaseMin + (rnd % (action.random_phase_range.phaseMax - action.random_phase_range.phaseMin)); } else - sLog.outErrorEventAI("ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry()); + { sLog.outErrorEventAI("ACTION_T_RANDOM_PHASE_RANGE can not have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry()); } break; case ACTION_T_SUMMON_ID: { Unit* target = GetTargetByType(action.summon_id.target, pActionInvoker, pAIEventSender, reportTargetError); if (!target && reportTargetError) - sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SUMMON_ID(%u), target-type %u", EventId, action.type, action.summon_id.target); - + { sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SUMMON_ID(%u), target-type %u", EventId, action.type, action.summon_id.target); } + CreatureEventAI_Summon_Map::const_iterator i = sEventAIMgr.GetCreatureEventAISummonMap().find(action.summon_id.spawnId); if (i == sEventAIMgr.GetCreatureEventAISummonMap().end()) { @@ -900,26 +899,26 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_DESPAWN, 0); if (!pCreature) - sLog.outErrorEventAI("failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry()); + { sLog.outErrorEventAI("failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry()); } else if (action.summon_id.target != TARGET_T_SELF && target) - pCreature->AI()->AttackStart(target); + { pCreature->AI()->AttackStart(target); } break; } case ACTION_T_KILLED_MONSTER: // first attempt player/group who tapped creature if (Player* pPlayer = m_creature->GetLootRecipient()) - pPlayer->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, m_creature); + { pPlayer->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, m_creature); } else { // if not available, use pActionInvoker if (Unit* pTarget = GetTargetByType(action.killed_monster.target, pActionInvoker, pAIEventSender, reportTargetError, 0, SELECT_FLAG_PLAYER)) { if (Player* pPlayer2 = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself()) - pPlayer2->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, m_creature); + { pPlayer2->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, m_creature); } } else if (reportTargetError) - sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_KILLED_MONSTER(%u), target-type %u", EventId, action.type, action.killed_monster.target); + { sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_KILLED_MONSTER(%u), target-type %u", EventId, action.type, action.killed_monster.target); } } break; case ACTION_T_SET_INST_DATA: @@ -940,7 +939,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 if (!target) { if (reportTargetError) - sLog.outErrorEventAI("Event %d attempt to set instance data64 but Target == NULL. Creature %d", EventId, m_creature->GetEntry()); + { sLog.outErrorEventAI("Event %d attempt to set instance data64 but Target == NULL. Creature %d", EventId, m_creature->GetEntry()); } return; } @@ -957,7 +956,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_UPDATE_TEMPLATE: if (m_creature->GetEntry() == action.update_template.creatureId) { - sLog.outErrorEventAI("Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", EventId, m_creature->GetEntry()); return; } @@ -967,7 +965,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_DIE: if (m_creature->IsDead()) { - sLog.outErrorEventAI("Event %d ACTION_T_DIE on dead creature. Creature %d", EventId, m_creature->GetEntry()); return; } @@ -996,9 +993,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_SET_INVINCIBILITY_HP_LEVEL: { if (action.invincibility_hp_level.is_percent) - m_InvinceabilityHpLevel = m_creature->GetMaxHealth() * action.invincibility_hp_level.hp_level / 100; + { m_InvinceabilityHpLevel = m_creature->GetMaxHealth() * action.invincibility_hp_level.hp_level / 100; } else - m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level; + { m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level; } break; } case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL: @@ -1016,10 +1013,10 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 } // if no param1, then use value from param2 (modelId) else - m_creature->Mount(action.mount.modelId); + { m_creature->Mount(action.mount.modelId); } } else - m_creature->Unmount(); + { m_creature->Unmount(); } break; } @@ -1079,11 +1076,11 @@ void CreatureEventAI::JustRespawned() // NOTE that this is if (i->Event.event_type == EVENT_T_TIMER_GENERIC) { if (i->UpdateRepeatTimer(m_creature, i->Event.timer.initialMin, i->Event.timer.initialMax)) - i->Enabled = true; + { i->Enabled = true; } } // Handle Spawned Events else if (SpawnedEventConditionsCheck((*i).Event)) - ProcessEvent(*i); + { ProcessEvent(*i); } } } @@ -1099,7 +1096,7 @@ void CreatureEventAI::Reset() CreatureEventAI_Event const& event = i->Event; switch (event.event_type) { - // Reset all out of combat timers + // Reset all out of combat timers case EVENT_T_TIMER_OOC: { if (i->UpdateRepeatTimer(m_creature, event.timer.initialMin, event.timer.initialMax)) @@ -1120,7 +1117,7 @@ void CreatureEventAI::JustReachedHome() for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) { if (i->Event.event_type == EVENT_T_REACHED_HOME) - ProcessEvent(*i); + { ProcessEvent(*i); } } Reset(); @@ -1134,7 +1131,7 @@ void CreatureEventAI::EnterEvadeMode() // only alive creatures that are not on transport can return to home position if (m_creature->IsAlive() && !m_creature->IsBoarded()) - m_creature->GetMotionMaster()->MoveTargetedHome(); + { m_creature->GetMotionMaster()->MoveTargetedHome(); } m_creature->SetLootRecipient(NULL); @@ -1142,7 +1139,7 @@ void CreatureEventAI::EnterEvadeMode() for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) { if (i->Event.event_type == EVENT_T_EVADE) - ProcessEvent(*i); + { ProcessEvent(*i); } } } @@ -1154,17 +1151,17 @@ void CreatureEventAI::JustDied(Unit* killer) { // Send Zone Under Attack message to the LocalDefense and WorldDefense Channels if (Player* pKiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - m_creature->SendZoneUnderAttackMessage(pKiller); + { m_creature->SendZoneUnderAttackMessage(pKiller); } } if (m_throwAIEventMask & (1 << AI_EVENT_JUST_DIED)) - SendAIEventAround(AI_EVENT_JUST_DIED, killer, 0, AIEVENT_DEFAULT_THROW_RADIUS); + { SendAIEventAround(AI_EVENT_JUST_DIED, killer, 0, AIEVENT_DEFAULT_THROW_RADIUS); } // Handle On Death events for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) { if (i->Event.event_type == EVENT_T_DEATH) - ProcessEvent(*i, killer); + { ProcessEvent(*i, killer); } } // reset phase after any death state events @@ -1174,12 +1171,12 @@ void CreatureEventAI::JustDied(Unit* killer) void CreatureEventAI::KilledUnit(Unit* victim) { if (victim->GetTypeId() != TYPEID_PLAYER) - return; + { return; } for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) { if (i->Event.event_type == EVENT_T_KILL) - ProcessEvent(*i, victim); + { ProcessEvent(*i, victim); } } } @@ -1188,7 +1185,7 @@ void CreatureEventAI::JustSummoned(Creature* pUnit) for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) { if (i->Event.event_type == EVENT_T_SUMMONED_UNIT) - ProcessEvent(*i, pUnit); + { ProcessEvent(*i, pUnit); } } } @@ -1197,7 +1194,7 @@ void CreatureEventAI::SummonedCreatureJustDied(Creature* pUnit) for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) { if (i->Event.event_type == EVENT_T_SUMMONED_JUST_DIED) - ProcessEvent(*i, pUnit); + { ProcessEvent(*i, pUnit); } } } @@ -1206,7 +1203,7 @@ void CreatureEventAI::SummonedCreatureDespawn(Creature* pUnit) for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) { if (i->Event.event_type == EVENT_T_SUMMONED_JUST_DESPAWN) - ProcessEvent(*i, pUnit); + { ProcessEvent(*i, pUnit); } } } @@ -1217,8 +1214,8 @@ void CreatureEventAI::ReceiveAIEvent(AIEventType eventType, Creature* pSender, U for (CreatureEventAIList::iterator itr = m_CreatureEventAIList.begin(); itr != m_CreatureEventAIList.end(); ++itr) { if (itr->Event.event_type == EVENT_T_RECEIVE_AI_EVENT && - itr->Event.receiveAIEvent.eventType == eventType && (!itr->Event.receiveAIEvent.senderEntry || itr->Event.receiveAIEvent.senderEntry == pSender->GetEntry())) - ProcessEvent(*itr, pInvoker, pSender); + itr->Event.receiveAIEvent.eventType == eventType && (!itr->Event.receiveAIEvent.senderEntry || itr->Event.receiveAIEvent.senderEntry == pSender->GetEntry())) + { ProcessEvent(*itr, pInvoker, pSender); } } } @@ -1234,12 +1231,12 @@ void CreatureEventAI::EnterCombat(Unit* enemy) i->Enabled = true; ProcessEvent(*i, enemy); break; - // Reset all in combat timers + // Reset all in combat timers case EVENT_T_TIMER_IN_COMBAT: if (i->UpdateRepeatTimer(m_creature, event.timer.initialMin, event.timer.initialMax)) i->Enabled = true; break; - // All normal events need to be re-enabled and their time set to 0 + // All normal events need to be re-enabled and their time set to 0 default: i->Enabled = true; i->Time = 0; @@ -1254,7 +1251,7 @@ void CreatureEventAI::EnterCombat(Unit* enemy) void CreatureEventAI::AttackStart(Unit* who) { if (!who || !m_creature->CanAttackByItself()) - return; + { return; } if (m_creature->Attack(who, m_MeleeEnabled)) { @@ -1269,7 +1266,7 @@ void CreatureEventAI::AttackStart(Unit* who) void CreatureEventAI::MoveInLineOfSight(Unit* who) { if (!who) - return; + { return; } // Check for OOC LOS Event if (m_HasOOCLoSEvent && !m_creature->getVictim()) @@ -1294,13 +1291,13 @@ void CreatureEventAI::MoveInLineOfSight(Unit* who) } if (m_creature->IsCivilian() || m_creature->IsNeutralToAll()) - return; + { return; } if (m_creature->CanInitiateAttack() && who->IsTargetableForAttack() && - m_creature->IsHostileTo(who) && who->isInAccessablePlaceFor(m_creature)) + m_creature->IsHostileTo(who) && who->isInAccessablePlaceFor(m_creature)) { if (!m_creature->CanFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) - return; + { return; } float attackRadius = m_creature->GetAttackDistance(who); if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) @@ -1326,7 +1323,7 @@ void CreatureEventAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell) // If spell id matches (or no spell id) & if spell school matches (or no spell school) if (!i->Event.spell_hit.spellId || pSpell->Id == i->Event.spell_hit.spellId) if (pSpell->SchoolMask & i->Event.spell_hit.schoolMask) - ProcessEvent(*i, pUnit); + { ProcessEvent(*i, pUnit); } } void CreatureEventAI::UpdateAI(const uint32 diff) @@ -1347,7 +1344,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff) { if (i->Time > m_EventDiff) { - // Do not decrement timers if event cannot trigger in this phase + // Do not decrement timers if event can not trigger in this phase if (!(i->Event.event_inverse_phase_mask & (1 << m_Phase))) i->Time -= m_EventDiff; } @@ -1433,52 +1430,52 @@ inline Unit* CreatureEventAI::GetTargetByType(uint32 Target, Unit* pActionInvoke case TARGET_T_HOSTILE: resTarget = m_creature->getVictim(); if (!resTarget) - isError = true; + { isError = true; } 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())) - isError = true; + { isError = true; } return resTarget; - case TARGET_T_HOSTILE_LAST_AGGRO: + case TARGET_T_HOSTILE_LAST_AGGRO: resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_BOTTOMAGGRO, 0, forSpellId, selectFlags); if (!resTarget && m_creature->GetThreatManager().getThreatList().empty()) - isError = true; + { isError = true; } return resTarget; - case TARGET_T_HOSTILE_RANDOM: + case TARGET_T_HOSTILE_RANDOM: resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, forSpellId, selectFlags); if (!resTarget && m_creature->GetThreatManager().getThreatList().empty()) - isError = true; + { isError = true; } return resTarget; - case TARGET_T_HOSTILE_RANDOM_NOT_TOP: + case TARGET_T_HOSTILE_RANDOM_NOT_TOP: resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, forSpellId, selectFlags); if (!resTarget && ((forSpellId == 0 && selectFlags == 0 && m_creature->GetThreatManager().getThreatList().size() > 1) || m_creature->GetThreatManager().getThreatList().empty())) - isError = true; + { isError = true; } return resTarget; - case TARGET_T_HOSTILE_RANDOM_PLAYER: + case TARGET_T_HOSTILE_RANDOM_PLAYER: resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, forSpellId, SELECT_FLAG_PLAYER | selectFlags); if (!resTarget) - isError = true; + { isError = true; } return resTarget; - case TARGET_T_HOSTILE_RANDOM_NOT_TOP_PLAYER: + case TARGET_T_HOSTILE_RANDOM_NOT_TOP_PLAYER: resTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, forSpellId, SELECT_FLAG_PLAYER | selectFlags); if (!resTarget && ((forSpellId == 0 && selectFlags == 0 && m_creature->GetThreatManager().getThreatList().size() > 1) || m_creature->GetThreatManager().getThreatList().empty())) - isError = true; + { isError = true; } return resTarget; - case TARGET_T_ACTION_INVOKER: + case TARGET_T_ACTION_INVOKER: if (!pActionInvoker) - isError = true; + { isError = true; } return pActionInvoker; - case TARGET_T_ACTION_INVOKER_OWNER: + case TARGET_T_ACTION_INVOKER_OWNER: resTarget = pActionInvoker ? pActionInvoker->GetCharmerOrOwnerOrSelf() : NULL; if (!resTarget) - isError = true; + { isError = true; } return resTarget; - case TARGET_T_EVENT_SENDER: + case TARGET_T_EVENT_SENDER: if (!pAIEventSender) - isError = true; + { isError = true; } return pAIEventSender; - default: + default: isError = true; return NULL; }; @@ -1493,7 +1490,7 @@ Unit* CreatureEventAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff) /* typedef TYPELIST_4(GameObject, Creature*except pets*, DynamicObject, Corpse*Bones*) AllGridObjectTypes; - This means that if we only search grid then we cannot possibly return pets or players so this is safe + This means that if we only search grid then we can not possibly return pets or players so this is safe */ Cell::VisitGridObjects(m_creature, searcher, range); return pUnit; @@ -1542,9 +1539,9 @@ void CreatureEventAI::DamageTaken(Unit* dealer, uint32& damage) if (m_InvinceabilityHpLevel > 0 && m_creature->GetHealth() < m_InvinceabilityHpLevel + damage) { if (m_creature->GetHealth() <= m_InvinceabilityHpLevel) - damage = 0; + { damage = 0; } else - damage = m_creature->GetHealth() - m_InvinceabilityHpLevel; + { damage = m_creature->GetHealth() - m_InvinceabilityHpLevel; } } uint32 step = m_throwAIEventStep != 100 ? m_throwAIEventStep : 0; @@ -1556,7 +1553,7 @@ void CreatureEventAI::DamageTaken(Unit* dealer, uint32& damage) AIEventType sendEvent[HEALTH_STEPS] = { AI_EVENT_LOST_SOME_HEALTH, AI_EVENT_LOST_HEALTH, AI_EVENT_CRITICAL_HEALTH }; if (newHealthPercent > healthSteps[step]) - return; // Not reached the next mark + { return; } // Not reached the next mark // search for highest reached mark (with actual event attached) for (uint32 i = HEALTH_STEPS - 1; i > step; --i) @@ -1569,7 +1566,7 @@ void CreatureEventAI::DamageTaken(Unit* dealer, uint32& damage) } if (m_throwAIEventMask & (1 << sendEvent[step])) - SendAIEventAround(sendEvent[step], dealer, 0, AIEVENT_DEFAULT_THROW_RADIUS); + { SendAIEventAround(sendEvent[step], dealer, 0, AIEVENT_DEFAULT_THROW_RADIUS); } m_throwAIEventStep = step + 1; } @@ -1578,12 +1575,12 @@ void CreatureEventAI::DamageTaken(Unit* dealer, uint32& damage) void CreatureEventAI::HealedBy(Unit* healer, uint32& healedAmount) { if (m_throwAIEventStep == 100) - return; + { return; } if (m_creature->GetHealth() + healedAmount >= m_creature->GetMaxHealth()) { if (m_throwAIEventMask & (1 << AI_EVENT_GOT_FULL_HEALTH)) - SendAIEventAround(AI_EVENT_GOT_FULL_HEALTH, healer, 0, AIEVENT_DEFAULT_THROW_RADIUS); + { SendAIEventAround(AI_EVENT_GOT_FULL_HEALTH, healer, 0, AIEVENT_DEFAULT_THROW_RADIUS); } m_throwAIEventStep = 100; } } @@ -1591,7 +1588,7 @@ void CreatureEventAI::HealedBy(Unit* healer, uint32& healedAmount) bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& event) { if (event.event_type != EVENT_T_SPAWNED) - return false; + { return false; } switch (event.spawned.condition) { diff --git a/src/game/Object/CreatureEventAI.h b/src/game/Object/CreatureEventAI.h index f2b92ef97..4b0112127 100644 --- a/src/game/Object/CreatureEventAI.h +++ b/src/game/Object/CreatureEventAI.h @@ -176,7 +176,7 @@ enum SpawnedEventMode struct CreatureEventAI_Action { - EventAI_ActionType type : 16; + EventAI_ActionType type: 16; union { // ACTION_T_TEXT = 1 @@ -627,7 +627,7 @@ struct CreatureEventAIHolder bool UpdateRepeatTimer(Creature* creature, uint32 repeatMin, uint32 repeatMax); }; -class CreatureEventAI : public CreatureAI +class CreatureEventAI : public CreatureAI { public: explicit CreatureEventAI(Creature* c); @@ -656,7 +656,7 @@ class CreatureEventAI : public CreatureAI void ReceiveEmote(Player* pPlayer, uint32 text_emote) override; void SummonedCreatureJustDied(Creature* unit) override; void SummonedCreatureDespawn(Creature* unit) override; - void ReceiveAIEvent(AIEventType eventType, Creature* pSender, Unit* pInvoker, uint32 miscValue) override; + void ReceiveAIEvent(AIEventType eventType, Creature* pSender, Unit* pInvoker, uint32 miscValue) override; static int Permissible(const Creature*); @@ -666,7 +666,7 @@ class CreatureEventAI : public CreatureAI inline int32 GetRandActionParam(uint32 rnd, int32 param1, int32 param2, int32 param3); /// If the bool& param is true, an error should be reported inline Unit* GetTargetByType(uint32 Target, Unit* pActionInvoker, Creature* pAIEventSender, bool& isError, uint32 forSpellId = 0, uint32 selectFlags = 0); - + bool SpawnedEventConditionsCheck(CreatureEventAI_Event const& event); Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff); diff --git a/src/game/Object/CreatureEventAIMgr.cpp b/src/game/Object/CreatureEventAIMgr.cpp index df2fb17e8..eb64f9388 100644 --- a/src/game/Object/CreatureEventAIMgr.cpp +++ b/src/game/Object/CreatureEventAIMgr.cpp @@ -42,14 +42,15 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts(bool check_entry_use) { // Load EventAI Text sObjectMgr.LoadMangosStrings(WorldDatabase, "creature_ai_texts", MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID, true); + if (check_entry_use) - CheckUnusedAITexts(); + { CheckUnusedAITexts(); } } void CreatureEventAIMgr::CheckUnusedAITexts() { if (m_usedTextsAmount == sObjectMgr.GetLoadedStringsCount(MIN_CREATURE_AI_TEXT_STRING_ID)) - return; + { return; } sLog.outString("Checking EventAI for unused texts, this might take a while"); @@ -57,7 +58,7 @@ void CreatureEventAIMgr::CheckUnusedAITexts() // check not used strings this is negative range for (int32 i = MAX_CREATURE_AI_TEXT_STRING_ID + 1; i <= MIN_CREATURE_AI_TEXT_STRING_ID; ++i) if (sObjectMgr.GetMangosStringLocale(i)) - idx_set.insert(i); + { idx_set.insert(i); } for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr) { @@ -77,7 +78,7 @@ void CreatureEventAIMgr::CheckUnusedAITexts() int k = action.type == ACTION_T_TEXT ? 0 : 1; for (; k < 3; ++k) if (action.text.TextId[k]) - idx_set.erase(action.text.TextId[k]); + { idx_set.erase(action.text.TextId[k]); } break; } default: break; @@ -105,7 +106,7 @@ bool IsValidTargetType(EventAI_Type eventType, EventAI_ActionType actionType, ui case TARGET_T_HOSTILE_RANDOM: case TARGET_T_HOSTILE_RANDOM_NOT_TOP: if (actionType == ACTION_T_QUEST_EVENT || actionType == ACTION_T_CAST_EVENT || actionType == ACTION_T_QUEST_EVENT_ALL || actionType == ACTION_T_KILLED_MONSTER) - sLog.outErrorEventAI("Event %u Action%u uses LIKELY bad Target type %u for event-type %u (must target player)", eventId, action, targetType, eventType); + { sLog.outErrorEventAI("Event %u Action%u uses LIKELY bad Target type %u for event-type %u (must target player)", eventId, action, targetType, eventType); } // no break, check if valid at all case TARGET_T_HOSTILE: case TARGET_T_HOSTILE_SECOND_AGGRO: @@ -117,10 +118,10 @@ bool IsValidTargetType(EventAI_Type eventType, EventAI_ActionType actionType, ui case EVENT_T_TIMER_OOC: case EVENT_T_OOC_LOS: case EVENT_T_REACHED_HOME: - sLog.outErrorEventAI("Event %u Action%u uses incorrect Target type %u for event-type %u (cannot be used OOC)", eventId, action, targetType, eventType); + sLog.outErrorEventAI("Event %u Action%u uses incorrect Target type %u for event-type %u (can not be used OOC)", eventId, action, targetType, eventType); return false; case EVENT_T_TIMER_GENERIC: - sLog.outErrorEventAI("Event %u Action%u uses LIKELY incorrect Target type %u for event-type %u (cannot be used OOC)", eventId, action, targetType, eventType); + sLog.outErrorEventAI("Event %u Action%u uses LIKELY incorrect Target type %u for event-type %u (can not be used OOC)", eventId, action, targetType, eventType); return true; // Does not need to be an error default: return true; @@ -304,7 +305,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() // No chance of this event occuring if (temp.event_chance == 0) - sLog.outErrorEventAI("Event %u has 0 percent chance. Event will never trigger!", i); + { sLog.outErrorEventAI("Event %u has 0 percent chance. Event will never trigger!", i); } // Chance above 100, force it to be 100 else if (temp.event_chance > 100) { @@ -319,9 +320,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case EVENT_T_TIMER_OOC: case EVENT_T_TIMER_GENERIC: if (temp.timer.initialMax < temp.timer.initialMin) - sLog.outErrorEventAI("Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i); } if (temp.timer.repeatMax < temp.timer.repeatMin) - sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); } break; case EVENT_T_HP: case EVENT_T_MANA: @@ -329,14 +330,14 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case EVENT_T_TARGET_MANA: case EVENT_T_ENERGY: if (temp.percent_range.percentMax > 100) - sLog.outErrorEventAI("Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i); } if (temp.percent_range.percentMax <= temp.percent_range.percentMin) - sLog.outErrorEventAI("Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i); } if (temp.event_flags & EFLAG_REPEATABLE && !temp.percent_range.repeatMin && !temp.percent_range.repeatMax) { - sLog.outErrorEventAI("Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i); + sLog.outErrorEventAI("Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but can not be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i); temp.event_flags &= ~EFLAG_REPEATABLE; } break; @@ -351,24 +352,24 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } if ((temp.spell_hit.schoolMask & pSpell->SchoolMask) != pSpell->SchoolMask) - sLog.outErrorEventAI("Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i); + { sLog.outErrorEventAI("Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i); } } if (!temp.spell_hit.schoolMask) - sLog.outErrorEventAI("Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i); + { sLog.outErrorEventAI("Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i); } if (temp.spell_hit.repeatMax < temp.spell_hit.repeatMin) - sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); } break; case EVENT_T_RANGE: if (temp.range.maxDist < temp.range.minDist) - sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i); } if (temp.range.repeatMax < temp.range.repeatMin) - sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); } break; case EVENT_T_OOC_LOS: if (temp.ooc_los.repeatMax < temp.ooc_los.repeatMin) - sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); } break; case EVENT_T_SPAWNED: switch (temp.spawned.condition) @@ -377,11 +378,11 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; case SPAWNED_EVENT_MAP: if (!sMapStore.LookupEntry(temp.spawned.conditionValue1)) - sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'map specific' but map (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); + { sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'map specific' but map (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); } break; case SPAWNED_EVENT_ZONE: if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1)) - sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'area specific' but area (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); + { sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'area specific' but area (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); } break; default: sLog.outErrorEventAI("Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition); @@ -390,11 +391,11 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; case EVENT_T_FRIENDLY_HP: if (temp.friendly_hp.repeatMax < temp.friendly_hp.repeatMin) - sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); } break; case EVENT_T_FRIENDLY_IS_CC: if (temp.friendly_is_cc.repeatMax < temp.friendly_is_cc.repeatMin) - sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); } break; case EVENT_T_FRIENDLY_MISSING_BUFF: { @@ -410,29 +411,29 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() continue; } if (temp.friendly_buff.repeatMax < temp.friendly_buff.repeatMin) - sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); } break; } case EVENT_T_KILL: if (temp.kill.repeatMax < temp.kill.repeatMin) - sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); } break; case EVENT_T_TARGET_CASTING: if (temp.target_casting.repeatMax < temp.target_casting.repeatMin) - sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); } break; case EVENT_T_SUMMONED_UNIT: case EVENT_T_SUMMONED_JUST_DIED: case EVENT_T_SUMMONED_JUST_DESPAWN: if (!sCreatureStorage.LookupEntry(temp.summoned.creatureId)) - sLog.outErrorEventAI("Creature %u are using event(%u) with nonexistent creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summoned.creatureId); + { sLog.outErrorEventAI("Creature %u are using event(%u) with nonexistent creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summoned.creatureId); } if (temp.summoned.repeatMax < temp.summoned.repeatMin) - sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); } break; case EVENT_T_QUEST_ACCEPT: case EVENT_T_QUEST_COMPLETE: if (!sObjectMgr.GetQuestTemplate(temp.quest.questId)) - sLog.outErrorEventAI("Creature %u are using event(%u) with nonexistent quest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId); + { sLog.outErrorEventAI("Creature %u are using event(%u) with nonexistent quest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId); } sLog.outErrorEventAI("Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i); continue; @@ -490,7 +491,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() continue; } if (temp.buffed.repeatMax < temp.buffed.repeatMin) - sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + { sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); } break; } case EVENT_T_RECEIVE_AI_EVENT: @@ -539,9 +540,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case ACTION_T_CHANCED_TEXT: // Check first param as chance if (!action.chanced_text.chance) - sLog.outErrorEventAI("Event %u Action %u has not set chance param1. Text will not be displayed", i, j + 1); + { sLog.outErrorEventAI("Event %u Action %u has not set chance param1. Text will not be displayed", i, j + 1); } else if (action.chanced_text.chance >= 100) - sLog.outErrorEventAI("Event %u Action %u has set chance param1 >= 100. Text will always be displayed", i, j + 1); + { sLog.outErrorEventAI("Event %u Action %u has set chance param1 >= 100. Text will always be displayed", i, j + 1); } // no break here to check texts case ACTION_T_TEXT: { @@ -552,10 +553,10 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() if (action.text.TextId[k]) { if (k > firstTextParam && not_set) - sLog.outErrorEventAI("Event %u Action %u has param%d, but it follow after not set param. Required for randomized text.", i, j + 1, k + 1); + { sLog.outErrorEventAI("Event %u Action %u has param%d, but it follow after not set param. Required for randomized text.", i, j + 1, k + 1); } if (!action.text.TextId[k]) - not_set = true; + { not_set = true; } // range negative else if (action.text.TextId[k] > MIN_CREATURE_AI_TEXT_STRING_ID || action.text.TextId[k] <= MAX_CREATURE_AI_TEXT_STRING_ID) { @@ -568,7 +569,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() action.text.TextId[k] = 0; } else - usedTextIds.insert(action.text.TextId[k]); + { usedTextIds.insert(action.text.TextId[k]); } } } break; @@ -606,33 +607,33 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; case ACTION_T_SOUND: if (!sSoundEntriesStore.LookupEntry(action.sound.soundId)) - sLog.outErrorEventAI("Event %u Action %u uses nonexistent SoundID %u.", i, j + 1, action.sound.soundId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent SoundID %u.", i, j + 1, action.sound.soundId); } break; case ACTION_T_EMOTE: if (!sEmotesStore.LookupEntry(action.emote.emoteId)) - sLog.outErrorEventAI("Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j + 1, action.emote.emoteId); + { sLog.outErrorEventAI("Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j + 1, action.emote.emoteId); } break; case ACTION_T_RANDOM_SOUND: if (!sSoundEntriesStore.LookupEntry(action.random_sound.soundId1)) - sLog.outErrorEventAI("Event %u Action %u param1 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId1); + { sLog.outErrorEventAI("Event %u Action %u param1 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId1); } if (action.random_sound.soundId2 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId2)) - sLog.outErrorEventAI("Event %u Action %u param2 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId2); + { sLog.outErrorEventAI("Event %u Action %u param2 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId2); } if (action.random_sound.soundId3 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId3)) - sLog.outErrorEventAI("Event %u Action %u param3 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId3); + { sLog.outErrorEventAI("Event %u Action %u param3 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId3); } break; case ACTION_T_RANDOM_EMOTE: if (!sEmotesStore.LookupEntry(action.random_emote.emoteId1)) - sLog.outErrorEventAI("Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId1); + { sLog.outErrorEventAI("Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId1); } if (action.random_emote.emoteId2 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId2)) - sLog.outErrorEventAI("Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId2); + { sLog.outErrorEventAI("Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId2); } if (action.random_emote.emoteId3 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId3)) - sLog.outErrorEventAI("Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId3); + { sLog.outErrorEventAI("Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId3); } break; case ACTION_T_CAST: { const SpellEntry* spell = sSpellStore.LookupEntry(action.cast.spellId); if (!spell) - sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast.spellId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast.spellId); } /* FIXME: temp.raw.param3 not have event tipes with recovery time in it.... else { @@ -647,7 +648,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() // Cast is always triggered if target is forced to cast on self if (action.cast.castFlags & CAST_FORCE_TARGET_SELF) - action.cast.castFlags |= CAST_TRIGGERED; + { action.cast.castFlags |= CAST_TRIGGERED; } IsValidTargetType(temp.event_type, action.type, action.cast.target, i, j + 1); @@ -656,7 +657,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() { // spell must be cast on self, but is not if ((IsOnlySelfTargeting(spell) || spell->rangeIndex == SPELL_RANGE_IDX_SELF_ONLY) && action.cast.target != TARGET_T_SELF && !(action.cast.castFlags & CAST_FORCE_TARGET_SELF)) - sLog.outErrorEventAI("Event %u Action %u uses SpellID %u that must be self cast (target is %u)", i, j + 1, action.cast.spellId, action.cast.target); + { sLog.outErrorEventAI("Event %u Action %u uses SpellID %u that must be self cast (target is %u)", i, j + 1, action.cast.spellId, action.cast.target); } // TODO: spell must be cast on enemy, but is not @@ -664,51 +665,51 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() if (action.cast.target == TARGET_T_ACTION_INVOKER && (IsSpellHaveEffect(spell, SPELL_EFFECT_QUEST_COMPLETE) || IsSpellHaveEffect(spell, SPELL_EFFECT_CREATE_RANDOM_ITEM) || IsSpellHaveEffect(spell, SPELL_EFFECT_DUMMY) || IsSpellHaveEffect(spell, SPELL_EFFECT_KILL_CREDIT_PERSONAL) || IsSpellHaveEffect(spell, SPELL_EFFECT_KILL_CREDIT_GROUP))) - sLog.outErrorEventAI("Event %u Action %u has TARGET_T_ACTION_INVOKER(%u) target type, but should have TARGET_T_ACTION_INVOKER_OWNER(%u).", i, j + 1, TARGET_T_ACTION_INVOKER, TARGET_T_ACTION_INVOKER_OWNER); + { sLog.outErrorEventAI("Event %u Action %u has TARGET_T_ACTION_INVOKER(%u) target type, but should have TARGET_T_ACTION_INVOKER_OWNER(%u).", i, j + 1, TARGET_T_ACTION_INVOKER, TARGET_T_ACTION_INVOKER_OWNER); } // Spell that should only target players, but could get any if (spell->HasAttribute(SPELL_ATTR_EX3_TARGET_ONLY_PLAYER) && - (action.cast.target == TARGET_T_ACTION_INVOKER || action.cast.target == TARGET_T_HOSTILE_RANDOM || action.cast.target == TARGET_T_HOSTILE_RANDOM_NOT_TOP)) - sLog.outErrorEventAI("Event %u Action %u uses Target type %u for a spell (%u) that should only target players. This could be wrong.", i, j + 1, action.cast.target, action.cast.spellId); + (action.cast.target == TARGET_T_ACTION_INVOKER || action.cast.target == TARGET_T_HOSTILE_RANDOM || action.cast.target == TARGET_T_HOSTILE_RANDOM_NOT_TOP)) + { sLog.outErrorEventAI("Event %u Action %u uses Target type %u for a spell (%u) that should only target players. This could be wrong.", i, j + 1, action.cast.target, action.cast.spellId); } } break; } case ACTION_T_SUMMON: if (!sCreatureStorage.LookupEntry(action.summon.creatureId)) - sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.summon.creatureId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.summon.creatureId); } IsValidTargetType(temp.event_type, action.type, action.summon.target, i, j + 1); break; case ACTION_T_THREAT_SINGLE_PCT: if (std::abs(action.threat_single_pct.percent) > 100) - sLog.outErrorEventAI("Event %u Action %u uses invalid percent value %u.", i, j + 1, action.threat_single_pct.percent); + { sLog.outErrorEventAI("Event %u Action %u uses invalid percent value %u.", i, j + 1, action.threat_single_pct.percent); } IsValidTargetType(temp.event_type, action.type, action.threat_single_pct.target, i, j + 1); break; case ACTION_T_THREAT_ALL_PCT: if (std::abs(action.threat_all_pct.percent) > 100) - sLog.outErrorEventAI("Event %u Action %u uses invalid percent value %u.", i, j + 1, action.threat_all_pct.percent); + { sLog.outErrorEventAI("Event %u Action %u uses invalid percent value %u.", i, j + 1, action.threat_all_pct.percent); } break; case ACTION_T_QUEST_EVENT: if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event.questId)) { if (!qid->HasSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT)) - sLog.outErrorEventAI("Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j + 1, action.quest_event.questId); + { sLog.outErrorEventAI("Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j + 1, action.quest_event.questId); } } else - sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event.questId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event.questId); } IsValidTargetType(temp.event_type, action.type, action.quest_event.target, i, j + 1); break; case ACTION_T_CAST_EVENT: if (!sCreatureStorage.LookupEntry(action.cast_event.creatureId)) - sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.cast_event.creatureId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.cast_event.creatureId); } if (!sSpellStore.LookupEntry(action.cast_event.spellId)) - sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast_event.spellId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast_event.spellId); } IsValidTargetType(temp.event_type, action.type, action.cast_event.target, i, j + 1); break; case ACTION_T_SET_UNIT_FIELD: if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END) - sLog.outErrorEventAI("Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j + 1); + { sLog.outErrorEventAI("Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j + 1); } IsValidTargetType(temp.event_type, action.type, action.set_unit_field.target, i, j + 1); break; case ACTION_T_SET_UNIT_FLAG: @@ -717,47 +718,47 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; case ACTION_T_SET_PHASE: if (action.set_phase.phase >= MAX_PHASE) - sLog.outErrorEventAI("Event %u Action %u attempts to set phase >= %u. Phase mask cannot be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); + { sLog.outErrorEventAI("Event %u Action %u attempts to set phase >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); } break; case ACTION_T_INC_PHASE: if (action.set_inc_phase.step == 0) - sLog.outErrorEventAI("Event %u Action %u is incrementing phase by 0. Was this intended?", i, j + 1); + { sLog.outErrorEventAI("Event %u Action %u is incrementing phase by 0. Was this intended?", i, j + 1); } else if (std::abs(action.set_inc_phase.step) > MAX_PHASE - 1) - sLog.outErrorEventAI("Event %u Action %u is change phase by too large for any use %i.", i, j + 1, action.set_inc_phase.step); + { sLog.outErrorEventAI("Event %u Action %u is change phase by too large for any use %i.", i, j + 1, action.set_inc_phase.step); } break; case ACTION_T_QUEST_EVENT_ALL: if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event_all.questId)) { if (!qid->HasSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT)) - sLog.outErrorEventAI("Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j + 1, action.quest_event_all.questId); + { sLog.outErrorEventAI("Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j + 1, action.quest_event_all.questId); } } else - sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event_all.questId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event_all.questId); } break; case ACTION_T_CAST_EVENT_ALL: if (!sCreatureStorage.LookupEntry(action.cast_event_all.creatureId)) - sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.cast_event_all.creatureId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.cast_event_all.creatureId); } if (!sSpellStore.LookupEntry(action.cast_event_all.spellId)) - sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast_event_all.spellId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast_event_all.spellId); } break; case ACTION_T_REMOVEAURASFROMSPELL: if (!sSpellStore.LookupEntry(action.remove_aura.spellId)) - sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.remove_aura.spellId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.remove_aura.spellId); } IsValidTargetType(temp.event_type, action.type, action.remove_aura.target, i, j + 1); break; case ACTION_T_RANDOM_PHASE: // PhaseId1, PhaseId2, PhaseId3 if (action.random_phase.phase1 >= MAX_PHASE) - sLog.outErrorEventAI("Event %u Action %u attempts to set phase1 >= %u. Phase mask cannot be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); + { sLog.outErrorEventAI("Event %u Action %u attempts to set phase1 >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); } if (action.random_phase.phase2 >= MAX_PHASE) - sLog.outErrorEventAI("Event %u Action %u attempts to set phase2 >= %u. Phase mask cannot be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); + { sLog.outErrorEventAI("Event %u Action %u attempts to set phase2 >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); } if (action.random_phase.phase3 >= MAX_PHASE) - sLog.outErrorEventAI("Event %u Action %u attempts to set phase3 >= %u. Phase mask cannot be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); + { sLog.outErrorEventAI("Event %u Action %u attempts to set phase3 >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); } break; case ACTION_T_RANDOM_PHASE_RANGE: // PhaseMin, PhaseMax if (action.random_phase_range.phaseMin >= MAX_PHASE) - sLog.outErrorEventAI("Event %u Action %u attempts to set phaseMin >= %u. Phase mask cannot be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); + { sLog.outErrorEventAI("Event %u Action %u attempts to set phaseMin >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); } if (action.random_phase_range.phaseMin >= MAX_PHASE) - sLog.outErrorEventAI("Event %u Action %u attempts to set phaseMax >= %u. Phase mask cannot be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); + { sLog.outErrorEventAI("Event %u Action %u attempts to set phaseMax >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); } if (action.random_phase_range.phaseMin >= action.random_phase_range.phaseMax) { sLog.outErrorEventAI("Event %u Action %u attempts to set phaseMax <= phaseMin.", i, j + 1); @@ -767,21 +768,21 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; case ACTION_T_SUMMON_ID: if (!sCreatureStorage.LookupEntry(action.summon_id.creatureId)) - sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.summon_id.creatureId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.summon_id.creatureId); } IsValidTargetType(temp.event_type, action.type, action.summon_id.target, i, j + 1); if (m_CreatureEventAI_Summon_Map.find(action.summon_id.spawnId) == m_CreatureEventAI_Summon_Map.end()) - sLog.outErrorEventAI("Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j + 1, action.summon_id.spawnId); + { sLog.outErrorEventAI("Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j + 1, action.summon_id.spawnId); } break; case ACTION_T_KILLED_MONSTER: if (!sCreatureStorage.LookupEntry(action.killed_monster.creatureId)) - sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.killed_monster.creatureId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.killed_monster.creatureId); } IsValidTargetType(temp.event_type, action.type, action.killed_monster.target, i, j + 1); break; case ACTION_T_SET_INST_DATA: if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL)) sLog.outErrorEventAI("Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j + 1); if (action.set_inst_data.value > 4/*SPECIAL*/) - sLog.outErrorEventAI("Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j + 1); + { sLog.outErrorEventAI("Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j + 1); } break; case ACTION_T_SET_INST_DATA64: if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL)) @@ -790,7 +791,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; case ACTION_T_UPDATE_TEMPLATE: if (!sCreatureStorage.LookupEntry(action.update_template.creatureId)) - sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.update_template.creatureId); + { sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.update_template.creatureId); } break; case ACTION_T_SET_SHEATH: if (action.set_sheath.sheath >= MAX_SHEATH_STATE) @@ -858,7 +859,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() continue; } if (action.throwEvent.radius > SIZE_OF_GRIDS) - sLog.outErrorEventAI("Event %u Action %u uses unexpectedly huge radius %u (expected to be less than %f)", i, j + 1, action.throwEvent.radius, SIZE_OF_GRIDS); + { sLog.outErrorEventAI("Event %u Action %u uses unexpectedly huge radius %u (expected to be less than %f)", i, j + 1, action.throwEvent.radius, SIZE_OF_GRIDS); } if (action.throwEvent.radius == 0) { @@ -867,7 +868,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } break; - case ACTION_T_SET_THROW_MASK: if (action.setThrowMask.eventTypeMask & ~((1 << MAXIMAL_AI_EVENT_EVENTAI) - 1)) { @@ -913,9 +913,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() bool ainame = strcmp(cInfo->AIName, "EventAI") == 0; bool hasevent = m_CreatureEventAI_Event_Map.find(i) != m_CreatureEventAI_Event_Map.end(); if (ainame && !hasevent) - sLog.outErrorEventAI("EventAI not has script for creature entry (%u), but AIName = '%s'.", i, cInfo->AIName); + { sLog.outErrorEventAI("EventAI not has script for creature entry (%u), but AIName = '%s'.", i, cInfo->AIName); } else if (!ainame && hasevent) - sLog.outErrorEventAI("EventAI has script for creature entry (%u), but AIName = '%s' instead 'EventAI'.", i, cInfo->AIName); + { sLog.outErrorEventAI("EventAI has script for creature entry (%u), but AIName = '%s' instead 'EventAI'.", i, cInfo->AIName); } } } diff --git a/src/game/Object/DynamicObject.cpp b/src/game/Object/DynamicObject.cpp index 2e23a7081..5d6472703 100644 --- a/src/game/Object/DynamicObject.cpp +++ b/src/game/Object/DynamicObject.cpp @@ -134,9 +134,9 @@ void DynamicObject::Update(uint32 /*update_diff*/, uint32 p_time) bool deleteThis = false; if (m_aliveDuration > int32(p_time)) - m_aliveDuration -= p_time; + { m_aliveDuration -= p_time; } else - deleteThis = true; + { deleteThis = true; } // have radius and work as persistent effect if (m_radius) @@ -197,36 +197,35 @@ void DynamicObject::Delay(int32 delaytime) ++iter; } else - m_affected.erase(iter++); + { m_affected.erase(iter++); } } } bool DynamicObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const { if (!IsInWorld() || !u->IsInWorld()) - return false; + { return false; } // always seen by owner if (GetCasterGuid() == u->GetObjectGuid()) - return true; + { return true; } // normal case return IsWithinDistInMap(viewPoint, GetMap()->GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); } - bool DynamicObject::IsHostileTo(Unit const* unit) const { if (Unit* owner = GetCaster()) - return owner->IsHostileTo(unit); + { return owner->IsHostileTo(unit); } else - return false; + { return false; } } bool DynamicObject::IsFriendlyTo(Unit const* unit) const { if (Unit* owner = GetCaster()) - return owner->IsFriendlyTo(unit); + { return owner->IsFriendlyTo(unit); } else - return true; + { return true; } } diff --git a/src/game/Object/DynamicObject.h b/src/game/Object/DynamicObject.h index b9ad5bb90..9b927d849 100644 --- a/src/game/Object/DynamicObject.h +++ b/src/game/Object/DynamicObject.h @@ -72,7 +72,7 @@ class DynamicObject : public WorldObject bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const override; - GridReference &GetGridRef() { return m_gridRef; } + GridReference& GetGridRef() { return m_gridRef; } protected: uint32 m_spellId; diff --git a/src/game/Object/Formulas.h b/src/game/Object/Formulas.h index e8aedd9d9..b6ca7ee83 100644 --- a/src/game/Object/Formulas.h +++ b/src/game/Object/Formulas.h @@ -36,6 +36,8 @@ namespace MaNGOS return (float)ceil(count * (-0.53177f + 0.59357f * exp((level + 23.54042f) / 26.07859f))); } } + + namespace XP { enum XPColorChar { RED, ORANGE, YELLOW, GREEN, GRAY }; @@ -43,9 +45,9 @@ namespace MaNGOS inline uint32 GetGrayLevel(uint32 pl_level) { if (pl_level <= 5) - return 0; + { return 0; } else if (pl_level <= 39) - return pl_level - 5 - pl_level / 10; + { return pl_level - 5 - pl_level / 10; } else if (pl_level <= 59) return pl_level - 1 - pl_level / 5; else @@ -55,30 +57,30 @@ namespace MaNGOS inline XPColorChar GetColorCode(uint32 pl_level, uint32 mob_level) { if (mob_level >= pl_level + 5) - return RED; + { return RED; } else if (mob_level >= pl_level + 3) - return ORANGE; + { return ORANGE; } else if (mob_level >= pl_level - 2) - return YELLOW; + { return YELLOW; } else if (mob_level > GetGrayLevel(pl_level)) - return GREEN; + { return GREEN; } else - return GRAY; + { return GRAY; } } inline uint32 GetZeroDifference(uint32 pl_level) { - if (pl_level < 8) return 5; - if (pl_level < 10) return 6; - if (pl_level < 12) return 7; - if (pl_level < 16) return 8; - if (pl_level < 20) return 9; - if (pl_level < 30) return 11; - if (pl_level < 40) return 12; - if (pl_level < 45) return 13; - if (pl_level < 50) return 14; - if (pl_level < 55) return 15; - if (pl_level < 60) return 16; + if (pl_level < 8) { return 5; } + if (pl_level < 10) { return 6; } + if (pl_level < 12) { return 7; } + if (pl_level < 16) { return 8; } + if (pl_level < 20) { return 9; } + if (pl_level < 30) { return 11; } + if (pl_level < 40) { return 12; } + if (pl_level < 45) { return 13; } + if (pl_level < 50) { return 14; } + if (pl_level < 55) { return 15; } + if (pl_level < 60) { return 16; } return 17; } @@ -100,7 +102,7 @@ namespace MaNGOS { uint32 nLevelDiff = mob_level - pl_level; if (nLevelDiff > 4) - nLevelDiff = 4; + { nLevelDiff = 4; } return ((pl_level * 5 + nBaseExp) * (20 + nLevelDiff) / 10 + 1) / 2; } else @@ -118,16 +120,16 @@ namespace MaNGOS inline uint32 Gain(Player* pl, Unit* u) { if (u->GetTypeId() == TYPEID_UNIT && ( - ((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() || + ((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() || (((Creature*)u)->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_XP_AT_KILL))) - return 0; + { return 0; } uint32 xp_gain = BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(pl->GetMapId(), pl->GetZoneId())); if (xp_gain == 0) - return 0; + { return 0; } if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->IsElite()) - xp_gain *= 2; + { xp_gain *= 2; } return (uint32)(xp_gain * sWorld.getConfig(CONFIG_FLOAT_RATE_XP_KILL)); } diff --git a/src/game/Object/GMTicketMgr.cpp b/src/game/Object/GMTicketMgr.cpp index 1dec717d6..33aa1c5f9 100644 --- a/src/game/Object/GMTicketMgr.cpp +++ b/src/game/Object/GMTicketMgr.cpp @@ -63,10 +63,9 @@ void GMTicketMgr::LoadGMTickets() uint32 guidlow = fields[0].GetUInt32(); if (!guidlow) - continue; + { continue; } ObjectGuid guid = ObjectGuid(HIGHGUID_PLAYER, guidlow); - GMTicket& ticket = m_GMTicketMap[guid]; if (ticket.GetPlayerGuid()) // already exist @@ -90,7 +89,7 @@ void GMTicketMgr::DeleteAll() for (GMTicketMap::const_iterator itr = m_GMTicketMap.begin(); itr != m_GMTicketMap.end(); ++itr) { if (Player* owner = sObjectMgr.GetPlayer(itr->first)) - owner->GetSession()->SendGMTicketGetTicket(0x0A); + { owner->GetSession()->SendGMTicketGetTicket(0x0A); } } CharacterDatabase.Execute("DELETE FROM character_ticket"); m_GMTicketListByCreatingOrder.clear(); diff --git a/src/game/Object/GMTicketMgr.h b/src/game/Object/GMTicketMgr.h index 540c478da..5e41faba6 100644 --- a/src/game/Object/GMTicketMgr.h +++ b/src/game/Object/GMTicketMgr.h @@ -31,12 +31,63 @@ #include "ObjectGuid.h" #include +/** + * \addtogroup game + * @{ + * \file + */ + +/** + * This is the class that takes care of representing a ticket made to the GMs on the server + * with a question of some sort. + * + * The code responsible for taking care of the opcodes coming + * in can be found in: + * - \ref WorldSession::SendGMTicketStatusUpdate + * - \ref WorldSession::SendGMTicketGetTicket + * - \ref WorldSession::HandleGMTicketGetTicketOpcode + * - \ref WorldSession::HandleGMTicketUpdateTextOpcode + * - \ref WorldSession::HandleGMTicketDeleteTicketOpcode + * - \ref WorldSession::HandleGMTicketCreateOpcode + * - \ref WorldSession::HandleGMTicketSystemStatusOpcode + * - \ref WorldSession::HandleGMTicketSurveySubmitOpcode + * These in their turn will make calls to the \ref GMTicketMgr which will take + * care of what needs to be done by giving back a \ref GMTicket. The database table interesting + * in this case is character_ticket in the characaters database. + * + * Theres also some handling of tickets in \ref ChatHandler::HandleTicketCommand where + * you can turn on/off accepting tickets with your current GM char. You can also turn + * off tickets globally, this will show the client a message about tickets not being + * available at the moment. The commands that can be used are: + *
+ *
.ticket on/off
+ *
Turns on/off showing new incoming tickets for you character
+ *
.ticket system_on/off
+ *
Will turn the whole ticket reporting system on/off, ie: if it's off the clients + * will get a message that the system is unavailable when trying to submit a ticket
+ *
.ticket close $character_name/.ticket close #num_of_ticket
+ *
Will close a ticket for the given character name or the given number of the ticket, + * this will make the little icon in the top right go away for the player
+ *
.ticket close_survey $character_name/.ticket close_survey #num_of_ticket
+ *
Does the same as .ticket close but instead of just closing it it also asks the \ref Player + * to answer a survey about how please they were with the experience
+ *
.ticket respond $character_name/.ticket respond #num_of_ticket
+ *
Will respond to a ticket, this will whisper the \ref Player who asked the question and from + * there on you will have to explain the solution etc. and then close the ticket again.
+ *
.ticket
+ *
Shows the number of currently active tickets
+ *
.ticket $character_name/.ticket #num_of_ticket
+ *
Will show the question and name of the character for the given ticket
+ * + * \todo Do not remove tickets from db when closing but mark them as solved instead. + * \todo Log conversations between GM and the player receiving help. + */ class GMTicket { public: explicit GMTicket() : m_lastUpdate(0) - { - } + {} + void Init(ObjectGuid guid, const std::string& text, const std::string& responsetext, time_t update) { @@ -46,6 +97,10 @@ class GMTicket m_lastUpdate = update; } + /** + * Gets the \ref Player s \ref ObjectGuid which asked the question and created the ticket + * @return the \ref ObjectGuid for the \ref Player that asked the question + */ ObjectGuid const& GetPlayerGuid() const { return m_guid; @@ -66,6 +121,10 @@ class GMTicket return m_lastUpdate; } + /** + * Changes the tickets question text. + * @param text the text to change the question to + */ void SetText(const char* text) { m_text = text ? text : ""; @@ -128,7 +187,7 @@ class GMTicketMgr { GMTicketMap::iterator itr = m_GMTicketMap.find(guid); if (itr == m_GMTicketMap.end()) - return NULL; + { return NULL; } return &(itr->second); } @@ -140,21 +199,28 @@ class GMTicketMgr GMTicket* GetGMTicketByOrderPos(uint32 pos) { if (pos >= GetTicketCount()) - return NULL; + { return NULL; } GMTicketList::iterator itr = m_GMTicketListByCreatingOrder.begin(); std::advance(itr, pos); if (itr == m_GMTicketListByCreatingOrder.end()) - return NULL; + { return NULL; } return *itr; } - + /** + * This will delete a \ref GMTicket from this manager of tickets so that we don't + * need to handle it anymore, this should be used in conjunction with setting + * resolved = 1 in the character_ticket table. + * + * Note: This will _not_ remove anything from the DB + * @param guid guid of the \ref Player who created the ticket that we want to delete + */ void Delete(ObjectGuid guid) { GMTicketMap::iterator itr = m_GMTicketMap.find(guid); if (itr == m_GMTicketMap.end()) - return; + { return; } itr->second.DeleteFromDB(); m_GMTicketListByCreatingOrder.remove(&itr->second); m_GMTicketMap.erase(itr); @@ -162,6 +228,18 @@ class GMTicketMgr void DeleteAll(); + /** + * This will create a new \ref GMTicket and fill it with the given question so that + * a GM can find it and answer it. Should only be called if we've already checked + * that there are no open tickets already, as this function will close any other + * currently open tickets for the given \ref Player and open a new one with the given + * text. + * + * Tables of interest here are characters.character_ticket and possibly characaters. + * character_whispers + * @param guid \ref ObjectGuid of the creator of the \ref GMTicket + * @param text the question text sent + */ void Create(ObjectGuid guid, const char* text) { GMTicket& ticket = m_GMTicketMap[guid]; @@ -181,4 +259,6 @@ class GMTicketMgr }; #define sTicketMgr MaNGOS::Singleton::Instance() + +/** @} */ #endif diff --git a/src/game/Object/GameObject.cpp b/src/game/Object/GameObject.cpp index e05cfa3b6..f2d8659b0 100644 --- a/src/game/Object/GameObject.cpp +++ b/src/game/Object/GameObject.cpp @@ -772,7 +772,7 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi { // Not in world if (!IsInWorld() || !u->IsInWorld()) - return false; + { return false; } // invisible at client always if (!GetGOInfo()->displayId) @@ -780,14 +780,14 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi // Transport always visible at this step implementation if (IsTransport() && IsInMap(u)) - return true; + { return true; } // quick check visibility false cases for non-GM-mode if (!u->isGameMaster()) { // despawned and then not visible for non-GM in GM-mode if (!isSpawned()) - return false; + { return false; } // special invisibility cases if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && GetGOInfo()->trap.stealthed) @@ -1216,7 +1216,7 @@ void GameObject::Use(Unit* user) // TODO: Improve this when more information is available, currently these traps are known that must send the anim (Onyxia/ Heigan Fissures/ Trap in DireMaul) if (GetDisplayId() == 4392 || GetDisplayId() == 4472 || GetDisplayId() == 4491 || GetDisplayId() == 6785 || GetDisplayId() == 3073 || GetDisplayId() == 7998) - SendGameObjectCustomAnim(GetObjectGuid()); + { SendGameObjectCustomAnim(GetObjectGuid()); } // TODO: Despawning of traps? (Also related to code in ::Update) return; @@ -1354,7 +1354,7 @@ void GameObject::Use(Unit* user) if (!scriptReturnValue) { GetMap()->ScriptsStart(DBS_ON_GO_USE, GetGUIDLow(), spellCaster, this); } else - return; + { return; } // cast this spell later if provided spellId = info->goober.spellId; @@ -2143,19 +2143,19 @@ void GameObject::SetCapturePointSlider(float value, bool isLocked) // only activate non-locked capture point if (!isLocked) - SetLootState(GO_ACTIVATED); + { SetLootState(GO_ACTIVATED); } // set the state of the capture point based on the slider value if ((int)m_captureSlider == CAPTURE_SLIDER_ALLIANCE) - m_captureState = CAPTURE_STATE_WIN_ALLIANCE; + { m_captureState = CAPTURE_STATE_WIN_ALLIANCE; } else if ((int)m_captureSlider == CAPTURE_SLIDER_HORDE) - m_captureState = CAPTURE_STATE_WIN_HORDE; + { m_captureState = CAPTURE_STATE_WIN_HORDE; } else if (m_captureSlider > CAPTURE_SLIDER_MIDDLE + info->capturePoint.neutralPercent * 0.5f) - m_captureState = CAPTURE_STATE_PROGRESS_ALLIANCE; + { m_captureState = CAPTURE_STATE_PROGRESS_ALLIANCE; } else if (m_captureSlider < CAPTURE_SLIDER_MIDDLE - info->capturePoint.neutralPercent * 0.5f) - m_captureState = CAPTURE_STATE_PROGRESS_HORDE; + { m_captureState = CAPTURE_STATE_PROGRESS_HORDE; } else - m_captureState = CAPTURE_STATE_NEUTRAL; + { m_captureState = CAPTURE_STATE_NEUTRAL; } } void GameObject::TickCapturePoint() @@ -2499,3 +2499,4 @@ uint32 GameObject::GetScriptId() { return sScriptMgr.GetBoundScriptId(SCRIPTED_GAMEOBJECT, -int32(GetGUIDLow())) ? sScriptMgr.GetBoundScriptId(SCRIPTED_GAMEOBJECT, -int32(GetGUIDLow())) : sScriptMgr.GetBoundScriptId(SCRIPTED_GAMEOBJECT, GetEntry()); } + diff --git a/src/game/Object/GuardAI.cpp b/src/game/Object/GuardAI.cpp index ab4447e8c..8d63a3f05 100644 --- a/src/game/Object/GuardAI.cpp +++ b/src/game/Object/GuardAI.cpp @@ -31,7 +31,7 @@ int GuardAI::Permissible(const Creature* creature) { if (creature->IsGuard()) - return PERMIT_BASE_SPECIAL; + { return PERMIT_BASE_SPECIAL; } return PERMIT_BASE_NO; } @@ -44,11 +44,11 @@ void GuardAI::MoveInLineOfSight(Unit* u) { // Ignore Z for flying creatures if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE) - return; + { return; } if (!m_creature->getVictim() && u->IsTargetableForAttack() && - (u->IsHostileToPlayers() || m_creature->IsHostileTo(u) /*|| u->getVictim() && m_creature->IsFriendlyTo(u->getVictim())*/) && - u->isInAccessablePlaceFor(m_creature)) + (u->IsHostileToPlayers() || m_creature->IsHostileTo(u) /*|| u->getVictim() && m_creature->IsFriendlyTo(u->getVictim())*/) && + u->isInAccessablePlaceFor(m_creature)) { float attackRadius = m_creature->GetAttackDistance(u); if (m_creature->IsWithinDistInMap(u, attackRadius)) @@ -107,14 +107,14 @@ void GuardAI::EnterEvadeMode() // Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) - m_creature->GetMotionMaster()->MoveTargetedHome(); + { m_creature->GetMotionMaster()->MoveTargetedHome(); } } void GuardAI::UpdateAI(const uint32 /*diff*/) { // update i_victimGuid if i_creature.getVictim() !=0 and changed if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) - return; + { return; } i_victimGuid = m_creature->getVictim()->GetObjectGuid(); @@ -130,7 +130,7 @@ bool GuardAI::IsVisible(Unit* pl) const void GuardAI::AttackStart(Unit* u) { if (!u) - return; + { return; } if (m_creature->Attack(u, true)) { @@ -146,5 +146,5 @@ void GuardAI::AttackStart(Unit* u) void GuardAI::JustDied(Unit* killer) { if (Player* pkiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - m_creature->SendZoneUnderAttackMessage(pkiller); + { m_creature->SendZoneUnderAttackMessage(pkiller); } } diff --git a/src/game/Object/Guild.cpp b/src/game/Object/Guild.cpp index 4bb2e1542..50c974975 100644 --- a/src/game/Object/Guild.cpp +++ b/src/game/Object/Guild.cpp @@ -79,7 +79,7 @@ void MemberSlot::ChangeRank(uint32 newRank) Player* player = sObjectMgr.GetPlayer(guid); // If player not online data in data field will be loaded from guild tabs no need to update it !! if (player) - player->SetRank(newRank); + { player->SetRank(newRank); } CharacterDatabase.PExecute("UPDATE guild_member SET rank='%u' WHERE guid='%u'", newRank, guid.GetCounter()); } @@ -117,11 +117,11 @@ Guild::~Guild() bool Guild::Create(Player* leader, std::string gname) { if (sGuildMgr.GetGuildByName(gname)) - return false; + { return false; } WorldSession* lSession = leader->GetSession(); if (!lSession) - return false; + { return false; } m_LeaderGuid = leader->GetObjectGuid(); m_Name = gname; @@ -179,12 +179,12 @@ bool Guild::AddMember(ObjectGuid plGuid, uint32 plRank) if (pl) { if (pl->GetGuildId() != 0) - return false; + { return false; } } else { if (Player::GetGuildIdFromDB(plGuid) != 0) // player already in guild - return false; + { return false; } } // remove all player signs from another petitions @@ -211,7 +211,7 @@ bool Guild::AddMember(ObjectGuid plGuid, uint32 plRank) // 0 1 2 3 4 QueryResult* result = CharacterDatabase.PQuery("SELECT name,level,class,zone,account FROM characters WHERE guid = '%u'", lowguid); if (!result) - return false; // player doesn't exist + { return false; } // player doesn't exist Field* fields = result->Fetch(); newmember.Name = fields[0].GetCppString(); @@ -222,9 +222,9 @@ bool Guild::AddMember(ObjectGuid plGuid, uint32 plRank) delete result; if (newmember.Level < 1 || newmember.Level > STRONG_MAX_LEVEL || - !((1 << (newmember.Class - 1)) & CLASSMASK_ALL_PLAYABLE)) + !((1 << (newmember.Class - 1)) & CLASSMASK_ALL_PLAYABLE)) { - sLog.outError("%s has a broken data in field `characters` table, cannot add him to guild.", plGuid.GetString().c_str()); + sLog.outError("%s has a broken data in field `characters` table, can not add him to guild.", plGuid.GetString().c_str()); return false; } } @@ -296,7 +296,7 @@ void Guild::SetGINFO(std::string ginfo) bool Guild::LoadGuildFromDB(QueryResult* guildDataResult) { if (!guildDataResult) - return false; + { return false; } Field* fields = guildDataResult->Fetch(); @@ -335,10 +335,10 @@ bool Guild::CheckGuildStructure() if (GM_rights == -1) { if (DelMember(m_LeaderGuid)) - return false; // guild will disbanded and deleted in caller + { return false; } // guild will disbanded and deleted in caller } else if (GM_rights != GR_GUILDMASTER) - SetLeader(m_LeaderGuid); + { SetLeader(m_LeaderGuid); } // Allow only 1 guildmaster, set other to officer for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) @@ -365,7 +365,7 @@ bool Guild::LoadRanksFromDB(QueryResult* guildRanksResult) // GUILD RANKS are sequence starting from 0 = GUILD_MASTER (ALL PRIVILEGES) to max 9 (lowest privileges) // the lower rank id is considered higher rank - so promotion does rank-- and demotion does rank++ - // between ranks in sequence cannot be gaps - so 0,1,2,4 cannot be + // between ranks in sequence can not be gaps - so 0,1,2,4 can not be // min ranks count is 5 and max is 10. do @@ -373,7 +373,7 @@ bool Guild::LoadRanksFromDB(QueryResult* guildRanksResult) fields = guildRanksResult->Fetch(); // condition that would be true when all ranks in QueryResult will be processed and guild without ranks is being processed if (!fields) - break; + { break; } uint32 guildId = fields[0].GetUInt32(); if (guildId < m_Id) @@ -385,7 +385,7 @@ bool Guild::LoadRanksFromDB(QueryResult* guildRanksResult) } if (guildId > m_Id) // we loaded all ranks for this guild already, break cycle - break; + { break; } uint32 rankID = fields[1].GetUInt32(); std::string rankName = fields[2].GetCppString(); @@ -393,11 +393,11 @@ bool Guild::LoadRanksFromDB(QueryResult* guildRanksResult) uint32 rankMoney = fields[4].GetUInt32(); if (rankID != m_Ranks.size()) // guild_rank.ids are sequence 0,1,2,3.. - broken_ranks = true; + { broken_ranks = true; } // first rank is guildmaster, prevent loss leader rights if (m_Ranks.empty()) - rankRights |= GR_RIGHT_ALL; + { rankRights |= GR_RIGHT_ALL; } AddRank(rankName, rankRights, rankMoney); } @@ -432,14 +432,14 @@ bool Guild::LoadRanksFromDB(QueryResult* guildRanksResult) bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult) { if (!guildMembersResult) - return false; + { return false; } do { Field* fields = guildMembersResult->Fetch(); // this condition will be true when all rows in QueryResult are processed and new guild without members is going to be loaded - prevent crash if (!fields) - break; + { break; } uint32 guildId = fields[0].GetUInt32(); if (guildId < m_Id) { @@ -451,7 +451,7 @@ bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult) if (guildId > m_Id) // we loaded all members for this guild already, break cycle - break; + { break; } MemberSlot newmember; uint32 lowguid = fields[1].GetUInt32(); @@ -459,7 +459,7 @@ bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult) newmember.RankId = fields[2].GetUInt32(); // don't allow member to have not existing rank! if (newmember.RankId >= m_Ranks.size()) - newmember.RankId = GetLowestRank(); + { newmember.RankId = GetLowestRank(); } newmember.Pnote = fields[3].GetCppString(); newmember.OFFnote = fields[4].GetCppString(); @@ -467,8 +467,8 @@ bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult) newmember.BankRemMoney = fields[6].GetUInt32(); for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i) { - newmember.BankResetTimeTab[i] = fields[7 + (2 * i)].GetUInt32(); - newmember.BankRemSlotsTab[i] = fields[8 + (2 * i)].GetUInt32(); + newmember.BankResetTimeTab[i] = fields[7+(2*i)].GetUInt32(); + newmember.BankRemSlotsTab[i] = fields[8+(2*i)].GetUInt32(); } newmember.Name = fields[19].GetCppString(); @@ -504,7 +504,7 @@ bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult) while (guildMembersResult->NextRow()); if (members.empty()) - return false; + { return false; } UpdateAccountsNumber(); @@ -515,7 +515,7 @@ void Guild::SetLeader(ObjectGuid guid) { MemberSlot* slot = GetMemberSlot(guid); if (!slot) - return; + { return; } m_LeaderGuid = guid; slot->ChangeRank(GR_GUILDMASTER); @@ -558,13 +558,13 @@ bool Guild::DelMember(ObjectGuid guid, bool isDisbanding) } if (!best) - return true; + { return true; } SetLeader(newLeaderGUID); // If player not online data in data field will be loaded from guild tabs no need to update it !! if (Player* newLeader = sObjectMgr.GetPlayer(newLeaderGUID)) - newLeader->SetRank(GR_GUILDMASTER); + { newLeader->SetRank(GR_GUILDMASTER); } // when leader non-exist (at guild load with deleted leader only) not send broadcasts if (oldLeader) @@ -691,7 +691,7 @@ void Guild::BroadcastPacket(WorldPacket* packet) { Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first)); if (player) - player->GetSession()->SendPacket(packet); + { player->GetSession()->SendPacket(packet); } } } @@ -703,7 +703,7 @@ void Guild::BroadcastPacketToRank(WorldPacket* packet, uint32 rankId) { Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first)); if (player) - player->GetSession()->SendPacket(packet); + { player->GetSession()->SendPacket(packet); } } } } @@ -744,7 +744,7 @@ void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 max void Guild::CreateRank(std::string name_, uint32 rights) { if (m_Ranks.size() >= GUILD_RANKS_MAX_COUNT) - return; + { return; } // ranks are sequence 0,1,2,... where 0 means guildmaster uint32 new_rank_id = m_Ranks.size(); @@ -775,7 +775,7 @@ void Guild::DelRank(uint32 rankId) // client won't allow to have less than GUILD_RANKS_MIN_COUNT ranks in guild if (m_Ranks.size() <= GUILD_RANKS_MIN_COUNT || rankId < GUILD_RANKS_MIN_COUNT) - return; + { return; } RankList::iterator itr = m_Ranks.erase(m_Ranks.begin() + rankId); // delete lowest guild_rank @@ -826,7 +826,7 @@ void Guild::SwitchRank(uint32 rankId, bool up) std::string Guild::GetRankName(uint32 rankId) { if (rankId >= m_Ranks.size()) - return ""; + { return ""; } return m_Ranks[rankId].Name; } @@ -834,7 +834,7 @@ std::string Guild::GetRankName(uint32 rankId) uint32 Guild::GetRankRights(uint32 rankId) { if (rankId >= m_Ranks.size()) - return 0; + { return 0; } return m_Ranks[rankId].Rights; } @@ -842,7 +842,7 @@ uint32 Guild::GetRankRights(uint32 rankId) void Guild::SetRankName(uint32 rankId, std::string name_) { if (rankId >= m_Ranks.size()) - return; + { return; } m_Ranks[rankId].Name = name_; @@ -854,7 +854,7 @@ void Guild::SetRankName(uint32 rankId, std::string name_) void Guild::SetRankRights(uint32 rankId, uint32 rights) { if (rankId >= m_Ranks.size()) - return; + { return; } m_Ranks[rankId].Rights = rights; @@ -980,15 +980,15 @@ void Guild::Roster(WorldSession* session /*= NULL*/) data << uint32(0); if (session) - session->SendPacket(&data); + { session->SendPacket(&data); } else - BroadcastPacket(&data); + { BroadcastPacket(&data); } DEBUG_LOG("WORLD: Sent (SMSG_GUILD_ROSTER)"); } void Guild::Query(WorldSession* session) { - WorldPacket data(SMSG_GUILD_QUERY_RESPONSE, 8 * 32 + 200); // we can only guess size + WorldPacket data(SMSG_GUILD_QUERY_RESPONSE, (8 * 32 + 200)); // we can only guess size data << GetObjectGuid(); data << m_Name; @@ -996,9 +996,9 @@ void Guild::Query(WorldSession* session) for (size_t i = 0 ; i < GUILD_RANKS_MAX_COUNT; ++i) // show always 10 ranks { if (i < m_Ranks.size()) - data << m_Ranks[i].Name; + { data << m_Ranks[i].Name; } else - data << uint8(0); // null string + { data << uint8(0); } // null string } // Rank order of creation @@ -1079,12 +1079,12 @@ uint32 Guild::GetAccountsNumber() { // not need recalculation if (m_accountsNumber) - return m_accountsNumber; + { return m_accountsNumber; } // We use a set to be sure each element will be unique std::set accountsIdSet; for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr) - accountsIdSet.insert(itr->second.accountId); + { accountsIdSet.insert(itr->second.accountId); } m_accountsNumber = accountsIdSet.size(); @@ -1119,7 +1119,7 @@ void Guild::LoadGuildEventLogFromDB() // 0 1 2 3 4 5 QueryResult* result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp FROM guild_eventlog WHERE guildid=%u ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_EVENTLOG_MAX_RECORDS); if (!result) - return; + { return; } bool isNextLogGuidSet = false; // uint32 configCount = sWorld.getConfig(CONFIG_UINT32_GUILD_EVENT_LOG_COUNT); // First event in list will be the oldest and the latest event is last event in list @@ -1164,7 +1164,7 @@ void Guild::LogGuildEvent(uint8 EventType, ObjectGuid playerGuid1, ObjectGuid pl m_GuildEventLogNextGuid = (m_GuildEventLogNextGuid + 1) % sWorld.getConfig(CONFIG_UINT32_GUILD_EVENT_LOG_COUNT); // Check max records limit if (m_GuildEventLog.size() >= GUILD_EVENTLOG_MAX_RECORDS) - m_GuildEventLog.pop_front(); + { m_GuildEventLog.pop_front(); } // Add event to list m_GuildEventLog.push_back(NewEvent); // Save event to DB @@ -1510,6 +1510,12 @@ bool Guild::MemberMoneyWithdraw(uint64 amount, uint32 LowGuid) CharacterDatabase.PExecute("UPDATE guild_member SET BankRemMoney='%u' WHERE guildid='%u' AND guid='%u'", itr->second.BankRemMoney, m_Id, LowGuid); } + +//#ifdef ENABLE_ELUNA +// Player* player = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, LowGuid)); +// sEluna->OnMemberWitdrawMoney(this, player, amount, false); // IsRepair not a part of Mangos, implement? +//#endif + return true; } @@ -1877,6 +1883,10 @@ void Guild::LogBankEvent(uint8 EventType, uint8 TabId, uint32 PlayerGuidLow, uin m_GuildBankEventLog_Item[TabId].push_back(NewEvent); } +#ifdef ENABLE_ELUNA + sEluna->OnBankEvent(this, EventType, TabId, PlayerGuidLow, ItemOrMoney, ItemStackCount, DestTabId); +#endif + // save event to database CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE guildid='%u' AND LogGuid='%u' AND TabId='%u'", m_Id, currentLogGuid, currentTabId); @@ -2630,7 +2640,7 @@ void Guild::BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1 data << str2; } else if (str1) - data << str1; + { data << str1; } if (guid) data << ObjectGuid(guid); diff --git a/src/game/Object/Guild.h b/src/game/Object/Guild.h index 7e92bb744..6ec202f47 100644 --- a/src/game/Object/Guild.h +++ b/src/game/Object/Guild.h @@ -39,7 +39,7 @@ class Item; enum GuildDefaultRanks { - // these ranks can be modified, but they cannot be deleted + // these ranks can be modified, but they can not be deleted GR_GUILDMASTER = 0, GR_OFFICER = 1, GR_VETERAN = 2, @@ -401,7 +401,7 @@ class Guild for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first))) if (player != except) - _do(player); + { _do(player); } } void CreateRank(std::string name, uint32 rights); @@ -443,7 +443,7 @@ class Guild { for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) if (itr->second.Name == name) - return &itr->second; + { return &itr->second; } return NULL; } diff --git a/src/game/Object/ItemEnchantmentMgr.cpp b/src/game/Object/ItemEnchantmentMgr.cpp index 98e52fd00..449ca277c 100644 --- a/src/game/Object/ItemEnchantmentMgr.cpp +++ b/src/game/Object/ItemEnchantmentMgr.cpp @@ -104,8 +104,7 @@ void LoadRandomEnchantmentsTable() uint32 GetItemEnchantMod(int32 entry) { - if (!entry) - return 0; + if (!entry) { return 0; } EnchantmentStore::const_iterator tab; if (entry > 0) @@ -135,7 +134,7 @@ uint32 GetItemEnchantMod(int32 entry) { fCount += ench_iter->chance; - if (fCount > dRoll) return ench_iter->ench; + if (fCount > dRoll) { return ench_iter->ench; } } // we could get here only if sum of all enchantment chances is lower than 100% @@ -146,7 +145,7 @@ uint32 GetItemEnchantMod(int32 entry) { fCount += ench_iter->chance; - if (fCount > dRoll) return ench_iter->ench; + if (fCount > dRoll) { return ench_iter->ench; } } return 0; diff --git a/src/game/Object/ItemPrototype.h b/src/game/Object/ItemPrototype.h index 596da3920..25aece19c 100644 --- a/src/game/Object/ItemPrototype.h +++ b/src/game/Object/ItemPrototype.h @@ -598,7 +598,7 @@ struct ItemPrototype uint32 Delay; float RangedModRange; _Spell Spells[MAX_ITEM_PROTO_SPELLS]; - uint32 Bonding; + uint32 Bonding; ///< See \ref ItemBondingType char* Description; uint32 PageText; uint32 LanguageID; @@ -622,7 +622,7 @@ struct ItemPrototype float ArmorDamageModifier; uint32 Duration; uint32 ItemLimitCategory; // id from ItemLimitCategory.dbc - uint32 HolidayId; + uint32 HolidayId; // id from Holidays.dbc uint32 DisenchantID; uint32 FoodType; float StatScalingFactor; @@ -662,7 +662,7 @@ struct ItemPrototype float GetMinDamage() const { return floor(getDPS() * float(Delay) / 1000.0f * 0.7f + 0.5f); } float GetMaxDamage() const { return floor(getDPS() * float(Delay) / 1000.0f * 1.3f + 0.5f); } - bool IsPotion() const { return Class==ITEM_CLASS_CONSUMABLE && SubClass==ITEM_SUBCLASS_POTION; } + bool IsPotion() const { return Class == ITEM_CLASS_CONSUMABLE && SubClass == ITEM_SUBCLASS_POTION; } bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_FLAG_CONJURED); } bool IsVellum() const { diff --git a/src/game/Object/LootMgr.cpp b/src/game/Object/LootMgr.cpp index 589725a54..2c21df000 100644 --- a/src/game/Object/LootMgr.cpp +++ b/src/game/Object/LootMgr.cpp @@ -62,7 +62,7 @@ class LootTemplate::LootGroup // A set of loot def public: void AddEntry(LootStoreItem& item); // Adds an entry to the group (at loading stage) bool HasQuestDrop() const; // True if group includes at least 1 quest drop entry - bool HasQuestDropForPlayer(Player const* player) const; + bool HasQuestDropForPlayer(Player const* player) const; // The same for active quests of the player // The same for active quests of the player void Process(Loot& loot) const; // Rolls an item from the group (if any) and adds the item to the loot float RawTotalChance() const; // Overall chance for the group (without equal chanced items) @@ -82,7 +82,7 @@ class LootTemplate::LootGroup // A set of loot def void LootStore::Clear() { for (LootTemplateMap::const_iterator itr = m_LootTemplates.begin(); itr != m_LootTemplates.end(); ++itr) - delete itr->second; + { delete itr->second; } m_LootTemplates.clear(); } @@ -91,7 +91,7 @@ void LootStore::Clear() void LootStore::Verify() const { for (LootTemplateMap::const_iterator i = m_LootTemplates.begin(); i != m_LootTemplates.end(); ++i) - i->second->Verify(*this, i->first); + { i->second->Verify(*this, i->first); } } // Loads a *_loot_template DB table into loot store @@ -152,7 +152,7 @@ void LootStore::LoadLootTable() LootStoreItem storeitem = LootStoreItem(item, type, chanceOrQuestChance, group, conditionId, mincountOrRef, maxcount); if (!storeitem.IsValid(*this, entry)) // Validity checks - continue; + { continue; } // Looking for the template of the entry // often entries are put together @@ -193,7 +193,7 @@ bool LootStore::HaveQuestLootFor(uint32 loot_id) const { LootTemplateMap::const_iterator itr = m_LootTemplates.find(loot_id); if (itr == m_LootTemplates.end()) - return false; + { return false; } // scan loot for quest items return itr->second->HasQuestDrop(m_LootTemplates); @@ -204,7 +204,7 @@ bool LootStore::HaveQuestLootForPlayer(uint32 loot_id, Player* player) const LootTemplateMap::const_iterator tab = m_LootTemplates.find(loot_id); if (tab != m_LootTemplates.end()) if (tab->second->HasQuestDropForPlayer(m_LootTemplates, player)) - return true; + { return true; } return false; } @@ -214,7 +214,7 @@ LootTemplate const* LootStore::GetLootFor(uint32 loot_id) const LootTemplateMap::const_iterator tab = m_LootTemplates.find(loot_id); if (tab == m_LootTemplates.end()) - return NULL; + { return NULL; } return tab->second; } @@ -224,20 +224,20 @@ void LootStore::LoadAndCollectLootIds(LootIdSet& ids_set) LoadLootTable(); for (LootTemplateMap::const_iterator tab = m_LootTemplates.begin(); tab != m_LootTemplates.end(); ++tab) - ids_set.insert(tab->first); + { ids_set.insert(tab->first); } } void LootStore::CheckLootRefs(LootIdSet* ref_set) const { for (LootTemplateMap::const_iterator ltItr = m_LootTemplates.begin(); ltItr != m_LootTemplates.end(); ++ltItr) - ltItr->second->CheckLootRefs(ref_set); + { ltItr->second->CheckLootRefs(ref_set); } } void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const { // all still listed ids isn't referenced for (LootIdSet::const_iterator itr = ids_set.begin(); itr != ids_set.end(); ++itr) - sLog.outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName()); + { sLog.outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName()); } } void LootStore::ReportNotExistedId(uint32 id) const @@ -254,10 +254,10 @@ void LootStore::ReportNotExistedId(uint32 id) const bool LootStoreItem::Roll(bool rate) const { if (chance >= 100.0f) - return true; + { return true; } if (mincountOrRef < 0) // reference case - return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_ITEM_REFERENCED) : 1.0f)); + { return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_ITEM_REFERENCED) : 1.0f)); } if (type == LOOTITEM_TYPE_CURRENCY) return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_CURRENCY) : 1.0f)); @@ -473,7 +473,7 @@ LootSlotType LootItem::GetSlotTypeForSharedLoot(PermissionTypes permission, Play { // ignore currencies, looted items, FFA (each player get own copy) and not allowed items if (currency || is_looted || freeforall || (conditionId && !condition_ok) || !AllowedForPlayer(viewer, lootTarget)) - return MAX_LOOT_SLOT_TYPE; + { return MAX_LOOT_SLOT_TYPE; } switch (permission) { @@ -500,7 +500,7 @@ void Loot::AddItem(LootStoreItem const& item) if (item.needs_quest) // Quest drop { if (m_questItems.size() < MAX_NR_QUEST_ITEMS) - m_questItems.push_back(LootItem(item)); + { m_questItems.push_back(LootItem(item)); } } else if (items.size() < MAX_NR_LOOT_ITEMS) // Non-quest drop { @@ -514,7 +514,7 @@ void Loot::AddItem(LootStoreItem const& item) { ItemPrototype const* proto = ObjectMgr::GetItemPrototype(item.itemid); if (!proto || !(proto->Flags & ITEM_FLAG_PARTY_LOOT)) - ++unlootedCount; + { ++unlootedCount; } } } } @@ -524,14 +524,14 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, { // Must be provided if (!loot_owner) - return false; + { return false; } LootTemplate const* tab = store.GetLootFor(loot_id); if (!tab) { if (!noEmptyError) - sLog.outErrorDb("Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), loot_id); + { sLog.outErrorDb("Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), loot_id); } return false; } @@ -546,11 +546,11 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, { for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* pl = itr->getSource()) - FillNotNormalLootFor(pl); + { FillNotNormalLootFor(pl); } } // ... for personal loot else - FillNotNormalLootFor(loot_owner); + { FillNotNormalLootFor(loot_owner); } return true; } @@ -565,11 +565,11 @@ void Loot::FillNotNormalLootFor(Player* pl) qmapitr = m_playerQuestItems.find(plguid); if (qmapitr == m_playerQuestItems.end()) - FillQuestLoot(pl); + { FillQuestLoot(pl); } qmapitr = m_playerFFAItems.find(plguid); if (qmapitr == m_playerFFAItems.end()) - FillFFALoot(pl); + { FillFFALoot(pl); } qmapitr = m_playerNonQuestNonFFANonCurrencyConditionalItems.find(plguid); if (qmapitr == m_playerNonQuestNonFFANonCurrencyConditionalItems.end()) @@ -624,7 +624,7 @@ QuestItemList* Loot::FillFFALoot(Player* player) QuestItemList* Loot::FillQuestLoot(Player* player) { - if (items.size() == MAX_NR_LOOT_ITEMS) return NULL; + if (items.size() == MAX_NR_LOOT_ITEMS) { return NULL; } QuestItemList* ql = new QuestItemList(); for (uint8 i = 0; i < m_questItems.size(); ++i) @@ -639,12 +639,12 @@ QuestItemList* Loot::FillQuestLoot(Player* player) // // increase once if one looter only, looter-times if free for all if (item.freeforall || !item.is_blocked) - ++unlootedCount; + { ++unlootedCount; } item.is_blocked = true; if (items.size() + ql->size() == MAX_NR_LOOT_ITEMS) - break; + { break; } } } if (ql->empty()) @@ -696,9 +696,9 @@ void Loot::NotifyItemRemoved(uint8 lootIndex) i_next = i; ++i_next; if (Player* pl = ObjectAccessor::FindPlayer(*i)) - pl->SendNotifyLootItemRemoved(lootIndex); + { pl->SendNotifyLootItemRemoved(lootIndex); } else - m_playersLooting.erase(i); + { m_playersLooting.erase(i); } } } @@ -711,9 +711,9 @@ void Loot::NotifyMoneyRemoved() i_next = i; ++i_next; if (Player* pl = ObjectAccessor::FindPlayer(*i)) - pl->SendNotifyLootMoneyRemoved(); + { pl->SendNotifyLootMoneyRemoved(); } else - m_playersLooting.erase(i); + { m_playersLooting.erase(i); } } } @@ -740,14 +740,14 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex) uint8 j; for (j = 0; j < pql.size(); ++j) if (pql[j].index == questIndex) - break; + { break; } if (j < pql.size()) - pl->SendNotifyLootItemRemoved(items.size() + j); + { pl->SendNotifyLootItemRemoved(items.size() + j); } } } else - m_playersLooting.erase(i); + { m_playersLooting.erase(i); } } } @@ -756,11 +756,11 @@ void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount) if (maxAmount > 0) { if (maxAmount <= minAmount) - gold = uint32(maxAmount * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); + { gold = uint32(maxAmount * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); } else if ((maxAmount - minAmount) < 32700) - gold = uint32(urand(minAmount, maxAmount) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); + { gold = uint32(urand(minAmount, maxAmount) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); } else - gold = uint32(urand(minAmount >> 8, maxAmount >> 8) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)) << 8; + { gold = uint32(urand(minAmount >> 8, maxAmount >> 8) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)) << 8; } } } @@ -776,7 +776,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite { QuestItem* qitem2 = &itr->second->at(questSlot); if (qitem) - *qitem = qitem2; + { *qitem = qitem2; } item = &m_questItems[qitem2->index]; is_looted = qitem2->is_looted; } @@ -813,7 +813,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite { QuestItem* ffaitem2 = (QuestItem*) & (*iter); if (ffaitem) - *ffaitem = ffaitem2; + { *ffaitem = ffaitem2; } is_looted = ffaitem2->is_looted; break; } @@ -830,7 +830,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite { QuestItem* conditem2 = (QuestItem*) & (*iter); if (conditem) - *conditem = conditem2; + { *conditem = conditem2; } is_looted = conditem2->is_looted; break; } @@ -840,7 +840,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite } if (is_looted) - return NULL; + { return NULL; } return item; } @@ -897,7 +897,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { LootSlotType slot_type = l.items[i].GetSlotTypeForSharedLoot(lv.permission, lv.viewer, l.GetLootTarget()); if (slot_type >= MAX_LOOT_SLOT_TYPE) - continue; + { continue; } b << uint8(i) << l.items[i]; b << uint8(slot_type); // 0 - get 1 - look only 2 - master selection @@ -915,7 +915,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) LootSlotType slot_type = item.GetSlotTypeForSharedLoot(lv.permission, lv.viewer, l.GetLootTarget(), !ci->is_looted); if (slot_type >= MAX_LOOT_SLOT_TYPE) - continue; + { continue; } b << uint8(ci->index) << item; b << uint8(slot_type); // allow loot @@ -992,9 +992,9 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) void LootTemplate::LootGroup::AddEntry(LootStoreItem& item) { if (item.chance != 0) - ExplicitlyChanced.push_back(item); + { ExplicitlyChanced.push_back(item); } else - EqualChanced.push_back(item); + { EqualChanced.push_back(item); } } // Rolls an item from the group, returns NULL if all miss their chances @@ -1007,15 +1007,15 @@ LootStoreItem const* LootTemplate::LootGroup::Roll() const for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i) // check each explicitly chanced entry in the template and modify its chance based on quality. { if (ExplicitlyChanced[i].chance >= 100.0f) - return &ExplicitlyChanced[i]; + { return &ExplicitlyChanced[i]; } Roll -= ExplicitlyChanced[i].chance; if (Roll < 0) - return &ExplicitlyChanced[i]; + { return &ExplicitlyChanced[i]; } } } if (!EqualChanced.empty()) // If nothing selected yet - an item is taken from equal-chanced part - return &EqualChanced[irand(0, EqualChanced.size() - 1)]; + { return &EqualChanced[irand(0, EqualChanced.size() - 1)]; } return NULL; // Empty drop from the group } @@ -1025,10 +1025,10 @@ bool LootTemplate::LootGroup::HasQuestDrop() const { for (LootStoreItemList::const_iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i) if (i->needs_quest) - return true; + { return true; } for (LootStoreItemList::const_iterator i = EqualChanced.begin(); i != EqualChanced.end(); ++i) if (i->needs_quest) - return true; + { return true; } return false; } @@ -1037,10 +1037,10 @@ bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const* player) const { for (LootStoreItemList::const_iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i) if (player->HasQuestForItem(i->itemid)) - return true; + { return true; } for (LootStoreItemList::const_iterator i = EqualChanced.begin(); i != EqualChanced.end(); ++i) if (player->HasQuestForItem(i->itemid)) - return true; + { return true; } return false; } @@ -1049,7 +1049,7 @@ void LootTemplate::LootGroup::Process(Loot& loot) const { LootStoreItem const* item = Roll(); if (item != NULL) - loot.AddItem(*item); + { loot.AddItem(*item); } } // Overall chance for the group without equal chanced items @@ -1059,7 +1059,7 @@ float LootTemplate::LootGroup::RawTotalChance() const for (LootStoreItemList::const_iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i) if (!i->needs_quest) - result += i->chance; + { result += i->chance; } return result; } @@ -1070,7 +1070,7 @@ float LootTemplate::LootGroup::TotalChance() const float result = RawTotalChance(); if (!EqualChanced.empty() && result < 100.0f) - return 100.0f; + { return 100.0f; } return result; } @@ -1096,9 +1096,9 @@ void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const if (ieItr->mincountOrRef < 0) { if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef)) - LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef); + { LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef); } else if (ref_set) - ref_set->erase(-ieItr->mincountOrRef); + { ref_set->erase(-ieItr->mincountOrRef); } } } @@ -1107,9 +1107,9 @@ void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const if (ieItr->mincountOrRef < 0) { if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef)) - LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef); + { LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef); } else if (ref_set) - ref_set->erase(-ieItr->mincountOrRef); + { ref_set->erase(-ieItr->mincountOrRef); } } } } @@ -1124,11 +1124,11 @@ void LootTemplate::AddEntry(LootStoreItem& item) if (item.group > 0 && item.mincountOrRef > 0) // Group { if (item.group >= Groups.size()) - Groups.resize(item.group); // Adds new group the the loot template if needed + { Groups.resize(item.group); } // Adds new group the the loot template if needed Groups[item.group - 1].AddEntry(item); // Adds new entry to the group } else // Non-grouped entries and references are stored together - Entries.push_back(item); + { Entries.push_back(item); } } // Rolls for every item in the template and adds the rolled items the the loot @@ -1137,7 +1137,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8 if (groupId) // Group reference uses own processing of the group { if (groupId > Groups.size()) - return; // Error message already printed at loading stage + { return; } // Error message already printed at loading stage Groups[groupId - 1].Process(loot); return; @@ -1147,29 +1147,29 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8 for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end() ; ++i) { if (!i->Roll(rate)) - continue; // Bad luck for the entry + { continue; } // Bad luck for the entry if (i->mincountOrRef < 0 && i->type == LOOT_ITEM_TYPE_ITEM) // References processing { LootTemplate const* Referenced = LootTemplates_Reference.GetLootFor(-i->mincountOrRef); if (!Referenced) - continue; // Error message already printed at loading stage + { continue; } // Error message already printed at loading stage // Check condition if (i->conditionId && !sObjectMgr.IsPlayerMeetToCondition(i->conditionId, NULL, NULL, loot.GetLootTarget(), CONDITION_FROM_REFERING_LOOT)) - continue; + { continue; } for (uint32 loop = 0; loop < i->maxcount; ++loop) // Ref multiplicator - Referenced->Process(loot, store, rate, i->group); + { Referenced->Process(loot, store, rate, i->group); } } else // Plain entries (not a reference, not grouped) - loot.AddItem(*i); // Chance is already checked, just add + { loot.AddItem(*i); } // Chance is already checked, just add } // Now processing groups for (LootGroups::const_iterator i = Groups.begin() ; i != Groups.end() ; ++i) - i->Process(loot); + { i->Process(loot); } } // True if template includes at least 1 quest drop entry @@ -1178,7 +1178,7 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con if (groupId) // Group reference { if (groupId > Groups.size()) - return false; // Error message [should be] already printed at loading stage + { return false; } // Error message [should be] already printed at loading stage return Groups[groupId - 1].HasQuestDrop(); } @@ -1188,18 +1188,18 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con { LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef); if (Referenced == store.end()) - continue; // Error message [should be] already printed at loading stage + { continue; } // Error message [should be] already printed at loading stage if (Referenced->second->HasQuestDrop(store, i->group)) - return true; + { return true; } } else if (i->needs_quest) - return true; // quest drop found + { return true; } // quest drop found } // Now processing groups for (LootGroups::const_iterator i = Groups.begin() ; i != Groups.end() ; ++i) if (i->HasQuestDrop()) - return true; + { return true; } return false; } @@ -1210,7 +1210,7 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co if (groupId) // Group reference { if (groupId > Groups.size()) - return false; // Error message already printed at loading stage + { return false; } // Error message already printed at loading stage return Groups[groupId - 1].HasQuestDropForPlayer(player); } @@ -1221,18 +1221,18 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co { LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef); if (Referenced == store.end()) - continue; // Error message already printed at loading stage + { continue; } // Error message already printed at loading stage if (Referenced->second->HasQuestDropForPlayer(store, player, i->group)) - return true; + { return true; } } else if (player->HasQuestForItem(i->itemid)) - return true; // active quest drop found + { return true; } // active quest drop found } // Now checking groups for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i) if (i->HasQuestDropForPlayer(player)) - return true; + { return true; } return false; } @@ -1242,7 +1242,7 @@ void LootTemplate::Verify(LootStore const& lootstore, uint32 id) const { // Checking group chances for (uint32 i = 0; i < Groups.size(); ++i) - Groups[i].Verify(lootstore, id, i + 1); + { Groups[i].Verify(lootstore, id, i + 1); } // TODO: References validity checks } @@ -1254,14 +1254,14 @@ void LootTemplate::CheckLootRefs(LootIdSet* ref_set) const if (ieItr->mincountOrRef < 0) { if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef)) - LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef); + { LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef); } else if (ref_set) - ref_set->erase(-ieItr->mincountOrRef); + { ref_set->erase(-ieItr->mincountOrRef); } } } for (LootGroups::const_iterator grItr = Groups.begin(); grItr != Groups.end(); ++grItr) - grItr->CheckLootRefs(ref_set); + { grItr->CheckLootRefs(ref_set); } } void LoadLootTemplates_Creature() @@ -1284,7 +1284,7 @@ void LoadLootTemplates_Creature() } } for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr) - ids_set.erase(*itr); + { ids_set.erase(*itr); } // for alterac valley we've defined Player-loot inside creature_loot_template id=0 // this hack is used, so that we won't need to create an extra table player_loot_template for just one case @@ -1314,7 +1314,7 @@ void LoadLootTemplates_Disenchant() } } for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr) - ids_set.erase(*itr); + { ids_set.erase(*itr); } // output error for any still listed (not referenced from appropriate table) ids LootTemplates_Disenchant.ReportUnusedIds(ids_set); } @@ -1329,7 +1329,7 @@ void LoadLootTemplates_Fishing() { if (AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(i)) if (ids_set.find(areaEntry->ID) != ids_set.end()) - ids_set.erase(areaEntry->ID); + { ids_set.erase(areaEntry->ID); } } // by default (look config options) fishing at fail provide junk loot, entry 0 use for store this loot @@ -1356,7 +1356,7 @@ void LoadLootTemplates_Gameobject() } } for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr) - ids_set.erase(*itr); + { ids_set.erase(*itr); } // output error for any still listed (not referenced from appropriate table) ids LootTemplates_Gameobject.ReportUnusedIds(ids_set); @@ -1373,13 +1373,13 @@ void LoadLootTemplates_Item() if (ItemPrototype const* proto = sItemStorage.LookupEntry(i)) { if (!(proto->Flags & ITEM_FLAG_LOOTABLE)) - continue; + { continue; } if (ids_set.find(proto->ItemId) != ids_set.end() || proto->MaxMoneyLoot > 0) - ids_set.erase(proto->ItemId); + { ids_set.erase(proto->ItemId); } // wdb have wrong data cases, so skip by default else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) - LootTemplates_Item.ReportNotExistedId(proto->ItemId); + { LootTemplates_Item.ReportNotExistedId(proto->ItemId); } } } @@ -1432,7 +1432,7 @@ void LoadLootTemplates_Pickpocketing() } } for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr) - ids_set.erase(*itr); + { ids_set.erase(*itr); } // output error for any still listed (not referenced from appropriate table) ids LootTemplates_Pickpocketing.ReportUnusedIds(ids_set); @@ -1472,7 +1472,7 @@ void LoadLootTemplates_Mail() for (uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i) if (sMailTemplateStore.LookupEntry(i)) if (ids_set.find(i) != ids_set.end()) - ids_set.erase(i); + { ids_set.erase(i); } // output error for any still listed (not referenced from appropriate table) ids LootTemplates_Mail.ReportUnusedIds(ids_set); @@ -1498,7 +1498,7 @@ void LoadLootTemplates_Skinning() } } for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr) - ids_set.erase(*itr); + { ids_set.erase(*itr); } // output error for any still listed (not referenced from appropriate table) ids LootTemplates_Skinning.ReportUnusedIds(ids_set); diff --git a/src/game/Object/LootMgr.h b/src/game/Object/LootMgr.h index 0f0e7cb5b..222660553 100644 --- a/src/game/Object/LootMgr.h +++ b/src/game/Object/LootMgr.h @@ -38,7 +38,7 @@ class LootStore; class WorldObject; #define MAX_NR_LOOT_ITEMS 16 -// note: the client cannot show more than 16 items total +// note: the client can not show more than 16 items total #define MAX_NR_QUEST_ITEMS 32 // unrelated to the number of quest items shown, just for reserve @@ -196,7 +196,7 @@ class LootStore class LootTemplate { - class LootGroup; // A set of loot definitions for items (refs are not allowed inside) + class LootGroup; // A set of loot definitions for items (refs are not allowed inside) typedef std::vector LootGroups; public: @@ -281,15 +281,15 @@ struct Loot m_playerCurrencies.clear(); for (QuestItemMap::const_iterator itr = m_playerQuestItems.begin(); itr != m_playerQuestItems.end(); ++itr) - delete itr->second; + { delete itr->second; } m_playerQuestItems.clear(); for (QuestItemMap::const_iterator itr = m_playerFFAItems.begin(); itr != m_playerFFAItems.end(); ++itr) - delete itr->second; + { delete itr->second; } m_playerFFAItems.clear(); for (QuestItemMap::const_iterator itr = m_playerNonQuestNonFFANonCurrencyConditionalItems.begin(); itr != m_playerNonQuestNonFFANonCurrencyConditionalItems.end(); ++itr) - delete itr->second; + { delete itr->second; } m_playerNonQuestNonFFANonCurrencyConditionalItems.clear(); m_playersLooting.clear(); diff --git a/src/game/Object/Object.cpp b/src/game/Object/Object.cpp index fd58b9cd4..bb2d1575e 100644 --- a/src/game/Object/Object.cpp +++ b/src/game/Object/Object.cpp @@ -133,14 +133,14 @@ void Object::SendForcedObjectUpdate() void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const { if (!target) - return; + { return; } uint8 updatetype = UPDATETYPE_CREATE_OBJECT; uint16 updateFlags = m_updateFlag; /** lower flag1 **/ if (target == this) // building packet for yourself - updateFlags |= UPDATEFLAG_SELF; + { updateFlags |= UPDATEFLAG_SELF; } if (m_itsNewObject) { @@ -1493,7 +1493,7 @@ void WorldObject::UpdateGroundPositionZ(float x, float y, float& z) const void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap /*=NULL*/) const { if (!atMap) - atMap = GetMap(); + { atMap = GetMap(); } switch (GetTypeId()) { @@ -1511,16 +1511,16 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap if (max_z > INVALID_HEIGHT) { if (z > max_z) - z = max_z; + { z = max_z; } else if (z < ground_z) - z = ground_z; + { z = ground_z; } } } else { float ground_z = atMap->GetHeight(GetPhaseMask(), x, y, z); if (z < ground_z) - z = ground_z; + { z = ground_z; } } break; } @@ -1534,9 +1534,9 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap if (max_z > INVALID_HEIGHT) { if (z > max_z) - z = max_z; + { z = max_z; } else if (z < ground_z) - z = ground_z; + { z = ground_z; } } } else @@ -1551,7 +1551,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap { float ground_z = atMap->GetHeight(GetPhaseMask(), x, y, z); if (ground_z > INVALID_HEIGHT) - z = ground_z; + { z = ground_z; } break; } } @@ -1566,7 +1566,7 @@ void WorldObject::MonsterSay(const char* text, uint32 language, Unit const* targ { WorldPacket data(SMSG_MESSAGECHAT, 200); ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_SAY, text, LANG_UNIVERSAL, CHAT_TAG_NONE, GetObjectGuid(), GetName(), - target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : ""); + target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : ""); SendMessageToSetInRange(&data, sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY), true); } @@ -1574,7 +1574,7 @@ void WorldObject::MonsterYell(const char* text, uint32 language, Unit const* tar { WorldPacket data(SMSG_MESSAGECHAT, 200); ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, text, LANG_UNIVERSAL, CHAT_TAG_NONE, GetObjectGuid(), GetName(), - target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : ""); + target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : ""); SendMessageToSetInRange(&data, sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_YELL), true); } @@ -1582,7 +1582,7 @@ void WorldObject::MonsterTextEmote(const char* text, Unit const* target, bool Is { WorldPacket data(SMSG_MESSAGECHAT, 200); ChatHandler::BuildChatPacket(data, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, text, LANG_UNIVERSAL, CHAT_TAG_NONE, GetObjectGuid(), GetName(), - target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : ""); + target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : ""); SendMessageToSetInRange(&data, sWorld.getConfig(IsBossEmote ? CONFIG_FLOAT_LISTEN_RANGE_YELL : CONFIG_FLOAT_LISTEN_RANGE_TEXTEMOTE), true); } @@ -1593,7 +1593,7 @@ void WorldObject::MonsterWhisper(const char* text, Unit const* target, bool IsBo WorldPacket data(SMSG_MESSAGECHAT, 200); ChatHandler::BuildChatPacket(data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL, CHAT_TAG_NONE, GetObjectGuid(), GetName(), - target->GetObjectGuid(), target->GetName()); + target->GetObjectGuid(), target->GetName()); ((Player*)target)->GetSession()->SendPacket(&data); } @@ -1601,19 +1601,19 @@ namespace MaNGOS { class MonsterChatBuilder { - public: + public: MonsterChatBuilder(WorldObject const& obj, ChatMsg msgtype, MangosStringLocale const* textData, Language language, Unit const* target) : i_object(obj), i_msgtype(msgtype), i_textData(textData), i_language(language), i_target(target) {} void operator()(WorldPacket& data, int32 loc_idx) { char const* text = NULL; if ((int32)i_textData->Content.size() > loc_idx + 1 && !i_textData->Content[loc_idx + 1].empty()) - text = i_textData->Content[loc_idx + 1].c_str(); + { text = i_textData->Content[loc_idx + 1].c_str(); } else - text = i_textData->Content[0].c_str(); + { text = i_textData->Content[0].c_str(); } ChatHandler::BuildChatPacket(data, i_msgtype, text, i_language, CHAT_TAG_NONE, i_object.GetObjectGuid(), i_object.GetNameForLocaleIdx(loc_idx), - i_target ? i_target->GetObjectGuid() : ObjectGuid(), i_target ? i_target->GetNameForLocaleIdx(loc_idx) : ""); + i_target ? i_target->GetObjectGuid() : ObjectGuid(), i_target ? i_target->GetNameForLocaleIdx(loc_idx) : ""); } private: @@ -1656,7 +1656,7 @@ void WorldObject::MonsterText(MangosStringLocale const* textData, Unit const* ta case CHAT_TYPE_WHISPER: { if (!target || target->GetTypeId() != TYPEID_PLAYER) - return; + { return; } MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_WHISPER, textData, LANG_UNIVERSAL, target); MaNGOS::LocalizedPacketDo say_do(say_build); say_do((Player*)target); @@ -1665,7 +1665,7 @@ void WorldObject::MonsterText(MangosStringLocale const* textData, Unit const* ta case CHAT_TYPE_BOSS_WHISPER: { if (!target || target->GetTypeId() != TYPEID_PLAYER) - return; + { return; } MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_RAID_BOSS_WHISPER, textData, LANG_UNIVERSAL, target); MaNGOS::LocalizedPacketDo say_do(say_build); say_do((Player*)target); @@ -1679,7 +1679,7 @@ void WorldObject::MonsterText(MangosStringLocale const* textData, Unit const* ta Map::PlayerList const& pList = GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) if (itr->getSource()->GetZoneId() == zoneid) - say_do(itr->getSource()); + { say_do(itr->getSource()); } break; } } @@ -1771,12 +1771,12 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa Team team = TEAM_NONE; if (GetTypeId() == TYPEID_PLAYER) - team = ((Player*)this)->GetTeam(); + { team = ((Player*)this)->GetTeam(); } CreatureCreatePos pos(GetMap(), x, y, z, ang, GetPhaseMask()); if (x == 0.0f && y == 0.0f && z == 0.0f) - pos = CreatureCreatePos(this, GetOrientation(), CONTACT_DISTANCE, ang); + { pos = CreatureCreatePos(this, GetOrientation(), CONTACT_DISTANCE, ang); } if (!pCreature->Create(GetMap()->GenerateLocalLowGuid(cinfo->GetHighGuid()), pos, cinfo, team)) { @@ -1795,8 +1795,8 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa pCreature->Summon(spwtype, despwtime); // Also initializes the AI and MMGen if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->AI()) - ((Creature*)this)->AI()->JustSummoned(pCreature); - + { ((Creature*)this)->AI()->JustSummoned(pCreature); } + #ifdef ENABLE_ELUNA if (Unit* summoner = ToUnit()) sEluna->OnSummoned(pCreature, summoner); @@ -1804,7 +1804,7 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa // Creature Linking, Initial load is handled like respawn if (pCreature->IsLinkingEventTrigger()) - GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, pCreature); + { GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, pCreature); } // return the creature therewith the summoner has access to it return pCreature; @@ -1816,7 +1816,7 @@ GameObject* WorldObject::SummonGameObject(uint32 id, float x, float y, float z, Map *map = GetMap(); - if(!map) + if (!map) return NULL; if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), id, map, GetPhaseMask(), x, y, z, angle)) @@ -1934,9 +1934,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y, if (!sWorld.getConfig(CONFIG_BOOL_DETECT_POS_COLLISION)) { if (searcher) - searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); // update to LOS height if available + { searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available else - UpdateGroundPositionZ(x, y, z); + { UpdateGroundPositionZ(x, y, z); } return; } @@ -1962,12 +1962,12 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y, if (selector.CheckOriginalAngle()) { if (searcher) - searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); // update to LOS height if available + { searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available else - UpdateGroundPositionZ(x, y, z); + { UpdateGroundPositionZ(x, y, z); } if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z)) - return; + { return; } first_los_conflict = true; // first point have LOS problems } @@ -1984,12 +1984,12 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y, z = GetPositionZ(); if (searcher) - searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); // update to LOS height if available + { searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available else - UpdateGroundPositionZ(x, y, z); + { UpdateGroundPositionZ(x, y, z); } if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z)) - return; + { return; } } // BAD NEWS: not free pos (or used or have LOS problems) @@ -2000,9 +2000,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y, y = first_y; if (searcher) - searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); // update to LOS height if available + { searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available else - UpdateGroundPositionZ(x, y, z); + { UpdateGroundPositionZ(x, y, z); } return; } @@ -2016,12 +2016,12 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y, z = GetPositionZ(); if (searcher) - searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); // update to LOS height if available + { searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available else - UpdateGroundPositionZ(x, y, z); + { UpdateGroundPositionZ(x, y, z); } if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z)) - return; + { return; } } // BAD BAD NEWS: all found pos (free and used) have LOS problem :( @@ -2029,9 +2029,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y, y = first_y; if (searcher) - searcher->UpdateAllowedPositionZ(x, y, z, GetMap());// update to LOS height if available + { searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available else - UpdateGroundPositionZ(x, y, z); + { UpdateGroundPositionZ(x, y, z); } } void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update) @@ -2060,9 +2060,9 @@ void WorldObject::PlayDirectSound(uint32 sound_id, Player const* target /*= NULL data << uint32(sound_id); data << ObjectGuid(); if (target) - target->SendDirectMessage(&data); + { target->SendDirectMessage(&data); } else - SendMessageToSet(&data, true); + { SendMessageToSet(&data, true); } } void WorldObject::PlayMusic(uint32 sound_id, Player const* target /*= NULL*/) const @@ -2166,9 +2166,9 @@ void WorldObject::SetActiveObjectState(bool active) // player's update implemented in a different from other active worldobject's way // it's considired to use generic way in future { - if (isActiveObject() && !active) + if (IsActiveObject() && !active) { GetMap()->RemoveFromActive(this); } - else if (!isActiveObject() && active) + else if (!IsActiveObject() && active) { GetMap()->AddToActive(this); } } m_isActiveObject = active; diff --git a/src/game/Object/Object.h b/src/game/Object/Object.h index 7e612721d..64983a7b4 100644 --- a/src/game/Object/Object.h +++ b/src/game/Object/Object.h @@ -41,10 +41,10 @@ #define ATTACK_DISTANCE 5.0f #define INSPECT_DISTANCE 28.0f #define TRADE_DISTANCE 11.11f -#define MAX_VISIBILITY_DISTANCE 333.0f // max distance for visible object show, limited in 333 yards -#define DEFAULT_VISIBILITY_DISTANCE 90.0f // default visible distance, 90 yards on continents -#define DEFAULT_VISIBILITY_INSTANCE 120.0f // default visible distance in instances, 120 yards -#define DEFAULT_VISIBILITY_BGARENAS 180.0f // default visible distance in BG/Arenas, 180 yards +#define MAX_VISIBILITY_DISTANCE 333.0f // max distance for visible object show, limited in 333 yards +#define DEFAULT_VISIBILITY_DISTANCE 90.0f // default visible distance, 90 yards on continents +#define DEFAULT_VISIBILITY_INSTANCE 120.0f // default visible distance in instances, 120 yards +#define DEFAULT_VISIBILITY_BGARENAS 180.0f // default visible distance in BG/Arenas, 180 yards #define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // currently used (correctly?) for any non Unit world objects. This is actually the bounding_radius, like player/creature from creature_model_data #define DEFAULT_OBJECT_SCALE 1.0f // player/item scale as default, npc/go from database, pets from dbc @@ -545,7 +545,7 @@ class WorldObject : public Object bool IsPositionValid() const; void UpdateGroundPositionZ(float x, float y, float& z) const; - void UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap = NULL) const; + void UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap = NULL) const; void GetRandomPoint(float x, float y, float z, float distance, float& rand_x, float& rand_y, float& rand_z, float minDist = 0.0f, float const* ori = NULL) const; @@ -658,7 +658,7 @@ class WorldObject : public Object Creature* SummonCreature(uint32 id, float x, float y, float z, float ang, TempSummonType spwtype, uint32 despwtime, bool asActiveObject = false, bool setRun = false); GameObject* SummonGameObject(uint32 id, float x, float y, float z, float angle, uint32 despwtime); - bool isActiveObject() const { return m_isActiveObject || m_viewPoint.hasViewers(); } + bool IsActiveObject() const { return m_isActiveObject || m_viewPoint.hasViewers(); } void SetActiveObjectState(bool active); ViewPoint& GetViewPoint() { return m_viewPoint; } @@ -667,6 +667,7 @@ class WorldObject : public Object bool PrintCoordinatesError(float x, float y, float z, char const* descr) const; virtual void StartGroupLoot(Group* /*group*/, uint32 /*timer*/) { } + #ifdef ENABLE_ELUNA ElunaEventProcessor* elunaEvents; #endif /* ENABLE_ELUNA */ diff --git a/src/game/Object/ObjectAccessor.cpp b/src/game/Object/ObjectAccessor.cpp index 1eb2cdbf4..b36298c77 100644 --- a/src/game/Object/ObjectAccessor.cpp +++ b/src/game/Object/ObjectAccessor.cpp @@ -59,13 +59,13 @@ Unit* ObjectAccessor::GetUnit(WorldObject const& u, ObjectGuid guid) { if (!guid) - return NULL; + { return NULL; } if (guid.IsPlayer()) - return FindPlayer(guid); + { return FindPlayer(guid); } if (!u.IsInWorld()) - return NULL; + { return NULL; } return u.GetMap()->GetAnyTypeCreature(guid); } @@ -74,9 +74,9 @@ Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid) { Corpse* ret = HashMapHolder::Find(guid); if (!ret) - return NULL; + { return NULL; } if (ret->GetMapId() != mapid) - return NULL; + { return NULL; } return ret; } @@ -84,11 +84,11 @@ Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid) Player* ObjectAccessor::FindPlayer(ObjectGuid guid, bool inWorld /*= true*/) { if (!guid) - return NULL; + { return NULL; } Player* plr = HashMapHolder::Find(guid); if (!plr || (!plr->IsInWorld() && inWorld)) - return NULL; + { return NULL; } return plr; } @@ -99,8 +99,7 @@ Player* ObjectAccessor::FindPlayerByName(const char* name) HashMapHolder::MapType& m = sObjectAccessor.GetPlayers(); for (HashMapHolder::MapType::iterator iter = m.begin(); iter != m.end(); ++iter) if (iter->second->IsInWorld() && (::strcmp(name, iter->second->GetName()) == 0)) - return iter->second; - + { return iter->second; } return NULL; } @@ -129,11 +128,11 @@ ObjectAccessor::GetCorpseForPlayerGUID(ObjectGuid guid) Guard guard(i_corpseGuard); Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid); + if (iter == i_player2corpse.end()) - return NULL; + { return NULL; } MANGOS_ASSERT(iter->second->GetType() != CORPSE_BONES); - return iter->second; } @@ -143,9 +142,10 @@ ObjectAccessor::RemoveCorpse(Corpse* corpse) MANGOS_ASSERT(corpse && corpse->GetType() != CORPSE_BONES); Guard guard(i_corpseGuard); + Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGuid()); if (iter == i_player2corpse.end()) - return; + { return; } // build mapid*cellid -> guid_set map CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); @@ -163,6 +163,7 @@ ObjectAccessor::AddCorpse(Corpse* corpse) MANGOS_ASSERT(corpse && corpse->GetType() != CORPSE_BONES); Guard guard(i_corpseGuard); + MANGOS_ASSERT(i_player2corpse.find(corpse->GetOwnerGuid()) == i_player2corpse.end()); i_player2corpse[corpse->GetOwnerGuid()] = corpse; @@ -177,22 +178,23 @@ void ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair, GridType& grid, Map* map) { Guard guard(i_corpseGuard); + for (Player2CorpsesMapType::iterator iter = i_player2corpse.begin(); iter != i_player2corpse.end(); ++iter) - if (iter->second->GetGrid() == gridpair) - { - // verify, if the corpse in our instance (add only corpses which are) - if (map->Instanceable()) - { - if (iter->second->GetInstanceId() == map->GetInstanceId()) - { - grid.AddWorldObject(iter->second); - } - } - else - { - grid.AddWorldObject(iter->second); - } - } + if (iter->second->GetGrid() == gridpair) + { + // verify, if the corpse in our instance (add only corpses which are) + if (map->Instanceable()) + { + if (iter->second->GetInstanceId() == map->GetInstanceId()) + { + grid.AddWorldObject(iter->second); + } + } + else + { + grid.AddWorldObject(iter->second); + } + } } Corpse* @@ -216,7 +218,7 @@ ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia) // do not load the map if it's not loaded Map* map = sMapMgr.FindMap(corpse->GetMapId(), corpse->GetInstanceId()); if (map) - map->Remove(corpse, false); + { map->Remove(corpse, false); } // remove corpse from DB corpse->DeleteFromDB(); @@ -226,14 +228,14 @@ ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia) // ignore bones creating option in case insignia if (map && (insignia || (map->IsBattleGroundOrArena() ? sWorld.getConfig(CONFIG_BOOL_DEATH_BONES_BG_OR_ARENA) : sWorld.getConfig(CONFIG_BOOL_DEATH_BONES_WORLD))) && - !map->IsRemovalGrid(corpse->GetPositionX(), corpse->GetPositionY())) + !map->IsRemovalGrid(corpse->GetPositionX(), corpse->GetPositionY())) { // Create bones, don't change Corpse bones = new Corpse; bones->Create(corpse->GetGUIDLow()); for (int i = 3; i < CORPSE_END; ++i) // don't overwrite guid and object type - bones->SetUInt32Value(i, corpse->GetUInt32Value(i)); + { bones->SetUInt32Value(i, corpse->GetUInt32Value(i)); } bones->SetGrid(corpse->GetGrid()); // bones->m_time = m_time; // don't overwrite time @@ -248,7 +250,7 @@ ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia) for (int i = 0; i < EQUIPMENT_SLOT_END; ++i) { if (corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i)) - bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0); + { bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0); } } // add bones in grid store if grid loaded where corpse placed @@ -271,7 +273,7 @@ void ObjectAccessor::RemoveOldCorpses() ++next; if (!itr->second->IsExpired(now)) - continue; + { continue; } ConvertCorpseForPlayer(itr->first); } diff --git a/src/game/Object/ObjectGuid.cpp b/src/game/Object/ObjectGuid.cpp index 69b26688b..1620562a0 100644 --- a/src/game/Object/ObjectGuid.cpp +++ b/src/game/Object/ObjectGuid.cpp @@ -40,7 +40,7 @@ char const* ObjectGuid::GetTypeName(HighGuid high) case HIGHGUID_UNIT: return "Creature"; case HIGHGUID_PET: return "Pet"; case HIGHGUID_VEHICLE: return "Vehicle"; - case HIGHGUID_DYNAMICOBJECT:return "DynObject"; + case HIGHGUID_DYNAMICOBJECT: return "DynObject"; case HIGHGUID_CORPSE: return "Corpse"; case HIGHGUID_MO_TRANSPORT: return "MoTransport"; case HIGHGUID_INSTANCE: return "InstanceID"; @@ -60,12 +60,12 @@ std::string ObjectGuid::GetString() const { std::string name; if (sObjectMgr.GetPlayerNameByGUID(*this, name)) - str << " " << name; + { str << " " << name; } } str << " ("; if (HasEntry()) - str << (IsPet() ? "Petnumber: " : "Entry: ") << GetEntry() << " "; + { str << (IsPet() ? "Petnumber: " : "Entry: ") << GetEntry() << " "; } str << "Guid: " << GetCounter() << ")"; return str.str(); } diff --git a/src/game/Object/ObjectGuid.h b/src/game/Object/ObjectGuid.h index b79b9856d..66fe0a7ae 100644 --- a/src/game/Object/ObjectGuid.h +++ b/src/game/Object/ObjectGuid.h @@ -95,7 +95,7 @@ struct PackedGuidReader #define NUM_GUID_BYTES sizeof(uint64) -class ObjectGuid +class ObjectGuid { public: // constructors ObjectGuid() : m_guid(0) {} @@ -171,7 +171,7 @@ class ObjectGuid case HIGHGUID_PET: return TYPEID_UNIT; case HIGHGUID_PLAYER: return TYPEID_PLAYER; case HIGHGUID_GAMEOBJECT: return TYPEID_GAMEOBJECT; - case HIGHGUID_DYNAMICOBJECT:return TYPEID_DYNAMICOBJECT; + case HIGHGUID_DYNAMICOBJECT: return TYPEID_DYNAMICOBJECT; case HIGHGUID_CORPSE: return TYPEID_CORPSE; case HIGHGUID_MO_TRANSPORT: return TYPEID_GAMEOBJECT; case HIGHGUID_VEHICLE: return TYPEID_UNIT; diff --git a/src/game/Object/ObjectMgr.cpp b/src/game/Object/ObjectMgr.cpp index 6d8cfd9ce..385ac1ae9 100644 --- a/src/game/Object/ObjectMgr.cpp +++ b/src/game/Object/ObjectMgr.cpp @@ -64,20 +64,20 @@ INSTANTIATE_SINGLETON_1(ObjectMgr); bool normalizePlayerName(std::string& name) { if (name.empty()) - return false; + { return false; } wchar_t wstr_buf[MAX_INTERNAL_PLAYER_NAME + 1]; size_t wstr_len = MAX_INTERNAL_PLAYER_NAME; if (!Utf8toWStr(name, &wstr_buf[0], wstr_len)) - return false; + { return false; } wstr_buf[0] = wcharToUpper(wstr_buf[0]); for (size_t i = 1; i < wstr_len; ++i) - wstr_buf[i] = wcharToLower(wstr_buf[i]); + { wstr_buf[i] = wcharToLower(wstr_buf[i]); } if (!WStrToUtf8(wstr_buf, wstr_len, name)) - return false; + { return false; } return true; } @@ -112,7 +112,7 @@ LanguageDesc const* GetLanguageDescByID(uint32 lang) for (int i = 0; i < LANGUAGES_COUNT; ++i) { if (uint32(lang_description[i].lang_id) == lang) - return &lang_description[i]; + { return &lang_description[i]; } } return NULL; @@ -170,37 +170,37 @@ ObjectMgr::ObjectMgr() : ObjectMgr::~ObjectMgr() { for (QuestMap::iterator i = mQuestTemplates.begin(); i != mQuestTemplates.end(); ++i) - delete i->second; + { delete i->second; } for (PetLevelInfoMap::iterator i = petInfo.begin(); i != petInfo.end(); ++i) - delete[] i->second; + { delete[] i->second; } for (int race = 0; race < MAX_RACES; ++race) for (int class_ = 0; class_ < MAX_CLASSES; ++class_) - delete[] playerInfo[race][class_].levelInfo; + { delete[] playerInfo[race][class_].levelInfo; } // free objects for (GroupMap::iterator itr = mGroupMap.begin(); itr != mGroupMap.end(); ++itr) - delete itr->second; + { delete itr->second; } for (ArenaTeamMap::iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr) delete itr->second; for (CacheVendorItemMap::iterator itr = m_mCacheVendorTemplateItemMap.begin(); itr != m_mCacheVendorTemplateItemMap.end(); ++itr) - itr->second.Clear(); + { itr->second.Clear(); } for (CacheVendorItemMap::iterator itr = m_mCacheVendorItemMap.begin(); itr != m_mCacheVendorItemMap.end(); ++itr) - itr->second.Clear(); + { itr->second.Clear(); } for (CacheTrainerSpellMap::iterator itr = m_mCacheTrainerSpellMap.begin(); itr != m_mCacheTrainerSpellMap.end(); ++itr) - itr->second.Clear(); + { itr->second.Clear(); } } Group* ObjectMgr::GetGroupById(uint32 id) const { GroupMap::const_iterator itr = mGroupMap.find(id); if (itr != mGroupMap.end()) - return itr->second; + { return itr->second; } return NULL; } @@ -275,7 +275,7 @@ void ObjectMgr::LoadCreatureLocales() if (idx >= 0) { if ((int32)data.Name.size() <= idx) - data.Name.resize(idx + 1); + { data.Name.resize(idx + 1); } data.Name[idx] = str; } @@ -287,7 +287,7 @@ void ObjectMgr::LoadCreatureLocales() if (idx >= 0) { if ((int32)data.SubName.size() <= idx) - data.SubName.resize(idx + 1); + { data.SubName.resize(idx + 1); } data.SubName[idx] = str; } @@ -366,7 +366,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales() if (idx >= 0) { if ((int32)data.OptionText.size() <= idx) - data.OptionText.resize(idx + 1); + { data.OptionText.resize(idx + 1); } data.OptionText[idx] = str; } @@ -378,7 +378,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales() if (idx >= 0) { if ((int32)data.BoxText.size() <= idx) - data.BoxText.resize(idx + 1); + { data.BoxText.resize(idx + 1); } data.BoxText[idx] = str; } @@ -431,13 +431,13 @@ void ObjectMgr::LoadPointOfInterestLocales() { std::string str = fields[i].GetCppString(); if (str.empty()) - continue; + { continue; } int idx = GetOrNewIndexForLocale(LocaleConstant(i)); if (idx >= 0) { if ((int32)data.IconName.size() <= idx) - data.IconName.resize(idx + 1); + { data.IconName.resize(idx + 1); } data.IconName[idx] = str; } @@ -476,7 +476,7 @@ void ObjectMgr::LoadCreatureTemplates() { CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i); if (!cInfo) - continue; + { continue; } bool ok = true; // bool to allow continue outside this loop for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff) @@ -522,7 +522,7 @@ void ObjectMgr::LoadCreatureTemplates() if (cInfo->UnitClass != difficultyInfo->UnitClass) { - sLog.outErrorDb("Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).", + sLog.outErrorDb("Creature (Entry: %u, class %u) has different `UnitClass` in difficulty %u mode (Entry: %u, class %u).", i, cInfo->UnitClass, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->UnitClass); continue; } @@ -541,7 +541,7 @@ void ObjectMgr::LoadCreatureTemplates() if (cInfo->TrainerRace != difficultyInfo->TrainerRace) { - sLog.outErrorDb("Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]); + sLog.outErrorDb("Creature (Entry: %u) has different `TrainerRace` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]); continue; } @@ -553,7 +553,7 @@ void ObjectMgr::LoadCreatureTemplates() if (cInfo->TrainerSpell != difficultyInfo->TrainerSpell) { - sLog.outErrorDb("Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]); + sLog.outErrorDb("Creature (Entry: %u) has different `TrainerSpell` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]); continue; } @@ -580,11 +580,11 @@ void ObjectMgr::LoadCreatureTemplates() FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->FactionAlliance); if (!factionTemplate) - sLog.outErrorDb("Creature (Entry: %u) has nonexistent factionAlliance template (%u)", cInfo->Entry, cInfo->FactionAlliance); + { sLog.outErrorDb("Creature (Entry: %u) has nonexistent faction_A template (%u)", cInfo->Entry, cInfo->FactionAlliance); } factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->FactionHorde); if (!factionTemplate) - sLog.outErrorDb("Creature (Entry: %u) has nonexistent factionHorde template (%u)", cInfo->Entry, cInfo->FactionHorde); + { sLog.outErrorDb("Creature (Entry: %u) has nonexistent faction_H template (%u)", cInfo->Entry, cInfo->FactionHorde); } for (int k = 0; k < MAX_KILL_CREDIT; ++k) { @@ -598,7 +598,7 @@ void ObjectMgr::LoadCreatureTemplates() } } - // used later for Scale + // used later for scale CreatureDisplayInfoEntry const* displayScaleEntry = NULL; for (int i = 0; i < MAX_CREATURE_MODEL; ++i) @@ -612,11 +612,11 @@ void ObjectMgr::LoadCreatureTemplates() const_cast(cInfo)->ModelId[i] = 0; } else if (!displayScaleEntry) - displayScaleEntry = displayEntry; + { displayScaleEntry = displayEntry; } CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry(cInfo->ModelId[i]); if (!minfo) - sLog.outErrorDb("Creature (Entry: %u) are using modelid_%d (%u), but creature_model_info are missing for this model.", cInfo->Entry, i + 1, cInfo->ModelId[i]); + { sLog.outErrorDb("Creature (Entry: %u) are using modelid_%d (%u), but creature_model_info are missing for this model.", cInfo->Entry, i + 1, cInfo->ModelId[i]); } } } @@ -656,11 +656,11 @@ void ObjectMgr::LoadCreatureTemplates() if (!cInfo->UnitClass || (((1 << (cInfo->UnitClass - 1)) & CLASSMASK_ALL_CREATURES) == 0)) { ERROR_DB_STRICT_LOG("Creature (Entry: %u) does not have proper `UnitClass` (%u) in creature_template", cInfo->Entry, cInfo->UnitClass); - // Mark NPC as having improper data by his expansion + // Mark NPC as having improper data by his expansion const_cast(cInfo)->Expansion = -1; } - if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK) && cInfo->Expansion >= 0) // TODO - Remove the DB_STRICTED_CHECK after a while + if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK) && cInfo->Expansion >= 0) // TODO - Remove the DB_STRICTED_CHECK after a while { // check if ClassLevel data are available for all possible level of that creature for (uint32 level = cInfo->MinLevel; level <= cInfo->MaxLevel; ++level) @@ -668,7 +668,7 @@ void ObjectMgr::LoadCreatureTemplates() if (!GetCreatureClassLvlStats(level, cInfo->UnitClass, cInfo->Expansion)) { sLog.outErrorDb("Creature (Entry: %u), level(%u) has no data in `creature_template_classlevelstats`", cInfo->Entry, level); - // Deactivate using ClassLevelStats for this NPC + // Deactivate using ClassLevelStats for this NPC const_cast(cInfo)->Expansion = -1; } } @@ -693,7 +693,7 @@ void ObjectMgr::LoadCreatureTemplates() } if ((cInfo->NpcFlags & UNIT_NPC_FLAG_TRAINER) && cInfo->TrainerType >= MAX_TRAINER_TYPE) - sLog.outErrorDb("Creature (Entry: %u) has wrong trainer type %u", cInfo->Entry, cInfo->TrainerType); + { sLog.outErrorDb("Creature (Entry: %u) has wrong trainer type %u", cInfo->Entry, cInfo->TrainerType); } if (cInfo->CreatureType && !sCreatureTypeStore.LookupEntry(cInfo->CreatureType)) { @@ -704,7 +704,7 @@ void ObjectMgr::LoadCreatureTemplates() // must exist or used hidden but used in data horse case if (cInfo->Family && !sCreatureFamilyStore.LookupEntry(cInfo->Family) && cInfo->Family != CREATURE_FAMILY_HORSE_CUSTOM) { - sLog.outErrorDb("Creature (Entry: %u) has invalid creature family (%u) in `Family`", cInfo->Entry, cInfo->Family); + sLog.outErrorDb("Creature (Entry: %u) has invalid creature family (%u) in `family`", cInfo->Entry, cInfo->Family); const_cast(cInfo)->Family = 0; } @@ -718,7 +718,7 @@ void ObjectMgr::LoadCreatureTemplates() { CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId); if (!spellDataId) - sLog.outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u)", cInfo->Entry, cInfo->PetSpellDataId); + { sLog.outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u)", cInfo->Entry, cInfo->PetSpellDataId); } } if (cInfo->MovementType >= MAX_DB_MOTION_TYPE) @@ -737,7 +737,7 @@ void ObjectMgr::LoadCreatureTemplates() { if (!GetEquipmentInfo(cInfo->EquipmentTemplateId)) { - sLog.outErrorDb("Table `creature_template` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", cInfo->Entry, cInfo->EquipmentTemplateId); + sLog.outErrorDb("Table `creature_template` have creature (Entry: %u) with EquipmentTemplateId %u not found in table `creature_equip_template`, set to no equipment.", cInfo->Entry, cInfo->EquipmentTemplateId); const_cast(cInfo)->EquipmentTemplateId = 0; } } @@ -745,16 +745,16 @@ void ObjectMgr::LoadCreatureTemplates() if (cInfo->VendorTemplateId > 0) { if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_VENDOR)) - sLog.outErrorDb("Table `creature_template` have creature (Entry: %u) with vendor_id %u but not have flag UNIT_NPC_FLAG_VENDOR (%u), vendor items will ignored.", cInfo->Entry, cInfo->VendorTemplateId, UNIT_NPC_FLAG_VENDOR); + sLog.outErrorDb("Table `creature_template` have creature (Entry: %u) with VendorTemplateId %u but not have flag UNIT_NPC_FLAG_VENDOR (%u), vendor items will ignored.", cInfo->Entry, cInfo->VendorTemplateId, UNIT_NPC_FLAG_VENDOR); } - /// if not set custom creature Scale then load Scale from CreatureDisplayInfo.dbc + /// if not set custom creature scale then load scale from CreatureDisplayInfo.dbc if (cInfo->Scale <= 0.0f) { if (displayScaleEntry) - const_cast(cInfo)->Scale = displayScaleEntry->Scale; + { const_cast(cInfo)->Scale = displayScaleEntry->Scale; } else - const_cast(cInfo)->Scale = DEFAULT_OBJECT_SCALE; + { const_cast(cInfo)->Scale = DEFAULT_OBJECT_SCALE; } } } } @@ -777,7 +777,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* } } if (p != s) - val.push_back(atoi(s)); + { val.push_back(atoi(s)); } // free char* loaded memory delete[](char*)reinterpret_cast(addon->auras); @@ -851,7 +851,7 @@ void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entry { CreatureDataAddon const* addon = creatureaddons.LookupEntry(i); if (!addon) - continue; + { continue; } if (addon->mount) { @@ -863,7 +863,7 @@ void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entry } if (addon->sheath_state > SHEATH_STATE_RANGED) - sLog.outErrorDb("Creature (%s %u) has unknown sheath state (%u) defined in `%s`.", entryName, addon->guidOrEntry, addon->sheath_state, creatureaddons.GetTableName()); + { sLog.outErrorDb("Creature (%s %u) has unknown sheath state (%u) defined in `%s`.", entryName, addon->guidOrEntry, addon->sheath_state, creatureaddons.GetTableName()); } if (!sEmotesStore.LookupEntry(addon->emote)) { @@ -883,7 +883,7 @@ void ObjectMgr::LoadCreatureAddons() for (uint32 i = 1; i < sCreatureInfoAddonStorage.GetMaxEntry(); ++i) if (CreatureDataAddon const* addon = sCreatureInfoAddonStorage.LookupEntry(i)) if (!sCreatureStorage.LookupEntry(addon->guidOrEntry)) - sLog.outErrorDb("Creature (Entry: %u) does not exist but has a record in `%s`", addon->guidOrEntry, sCreatureInfoAddonStorage.GetTableName()); + { sLog.outErrorDb("Creature (Entry: %u) does not exist but has a record in `%s`", addon->guidOrEntry, sCreatureInfoAddonStorage.GetTableName()); } LoadCreatureAddons(sCreatureDataAddonStorage, "GUID", "creature addons"); @@ -891,7 +891,7 @@ void ObjectMgr::LoadCreatureAddons() for (uint32 i = 1; i < sCreatureDataAddonStorage.GetMaxEntry(); ++i) if (CreatureDataAddon const* addon = sCreatureDataAddonStorage.LookupEntry(i)) if (mCreatureDataMap.find(addon->guidOrEntry) == mCreatureDataMap.end()) - sLog.outErrorDb("Creature (GUID: %u) does not exist but has a record in `creature_addon`", addon->guidOrEntry); + { sLog.outErrorDb("Creature (GUID: %u) does not exist but has a record in `creature_addon`", addon->guidOrEntry); } } void ObjectMgr::LoadCreatureClassLvlStats() @@ -930,8 +930,8 @@ void ObjectMgr::LoadCreatureClassLvlStats() Field* fields = result->Fetch(); bar.step(); - uint32 creatureClass = fields[0].GetUInt32(); - uint32 creatureLevel = fields[1].GetUInt32(); + uint32 creatureClass = fields[0].GetUInt32(); + uint32 creatureLevel = fields[1].GetUInt32(); if (creatureLevel == 0 || creatureLevel > DEFAULT_MAX_CREATURE_LEVEL) { @@ -945,24 +945,25 @@ void ObjectMgr::LoadCreatureClassLvlStats() continue; } - uint32 baseMana = fields[2].GetUInt32(); - float baseMeleeAttackPower = fields[3].GetFloat(); - float baseRangedAttackPower = fields[4].GetFloat(); - uint32 baseArmor = fields[5].GetUInt32(); + uint32 baseMana = fields[2].GetUInt32(); + float baseMeleeAttackPower = fields[3].GetFloat(); + float baseRangedAttackPower = fields[4].GetFloat(); + uint32 baseArmor = fields[5].GetUInt32(); for (uint8 i = 0; i <= MAX_EXPANSION; ++i) { CreatureClassLvlStats &cCLS = m_creatureClassLvlStats[creatureLevel][classToIndex[creatureClass]][i - 1]; // values should start from 0 - cCLS.BaseMana = baseMana; - cCLS.BaseMeleeAttackPower = baseMeleeAttackPower; - cCLS.BaseRangedAttackPower = baseRangedAttackPower; - cCLS.BaseArmor = baseArmor; + cCLS.BaseMana = baseMana; + cCLS.BaseMeleeAttackPower = baseMeleeAttackPower; + cCLS.BaseRangedAttackPower = baseRangedAttackPower; + cCLS.BaseArmor = baseArmor; cCLS.BaseHealth = fields[6 + (i * 2)].GetUInt32(); cCLS.BaseDamage = fields[7 + (i * 2)].GetFloat(); } ++DataCount; - } while (result->NextRow()); + } + while (result->NextRow()); delete result; @@ -992,12 +993,12 @@ void ObjectMgr::LoadEquipmentTemplates() EquipmentInfo const* eqInfo = sEquipmentStorage.LookupEntry(i); if (!eqInfo) - continue; + { continue; } for (uint8 j = 0; j < 3; ++j) { if (!eqInfo->equipentry[j]) - continue; + { continue; } ItemEntry const* dbcitem = sItemStore.LookupEntry(eqInfo->equipentry[j]); if (!dbcitem) @@ -1041,7 +1042,7 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32 display_ { CreatureModelInfo const* minfo = GetCreatureModelInfo(display_id); if (!minfo) - return NULL; + { return NULL; } // If a model for another gender exists, 50% chance to use it if (minfo->modelid_other_gender != 0 && urand(0, 1) == 0) @@ -1053,10 +1054,10 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32 display_ return minfo; // not fatal, just use the previous one } else - return minfo_tmp; + { return minfo_tmp; } } else - return minfo; + { return minfo; } } uint32 ObjectMgr::GetModelForRace(uint32 sourceModelId, uint32 racemask) @@ -1093,10 +1094,10 @@ void ObjectMgr::LoadCreatureModelInfo() { CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry(i); if (!minfo) - continue; + { continue; } if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid)) - sLog.outErrorDb("Table `creature_model_info` has model for nonexistent model id (%u).", minfo->modelid); + { sLog.outErrorDb("Table `creature_model_info` has model for nonexistent model id (%u).", minfo->modelid); } if (minfo->gender >= MAX_GENDER) { @@ -1138,18 +1139,18 @@ void ObjectMgr::LoadCreatureModelInfo() { ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race); if (!raceEntry) - continue; + { continue; } if (!((1 << (race - 1)) & RACEMASK_ALL_PLAYABLE)) - continue; + { continue; } if (CreatureModelInfo const* minfo = GetCreatureModelInfo(raceEntry->model_f)) { if (minfo->gender != GENDER_FEMALE) - sLog.outErrorDb("Table `creature_model_info` have wrong gender %u for character race %u female model id %u", minfo->gender, race, raceEntry->model_f); + { sLog.outErrorDb("Table `creature_model_info` have wrong gender %u for character race %u female model id %u", minfo->gender, race, raceEntry->model_f); } if (minfo->modelid_other_gender != raceEntry->model_m) - sLog.outErrorDb("Table `creature_model_info` have wrong other gender model id %u for character race %u female model id %u", minfo->modelid_other_gender, race, raceEntry->model_f); + { sLog.outErrorDb("Table `creature_model_info` have wrong other gender model id %u for character race %u female model id %u", minfo->modelid_other_gender, race, raceEntry->model_f); } if (minfo->bounding_radius <= 0.0f) { @@ -1164,15 +1165,15 @@ void ObjectMgr::LoadCreatureModelInfo() } } else - sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", race, raceEntry->model_f); + { sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", race, raceEntry->model_f); } if (CreatureModelInfo const* minfo = GetCreatureModelInfo(raceEntry->model_m)) { if (minfo->gender != GENDER_MALE) - sLog.outErrorDb("Table `creature_model_info` have wrong gender %u for character race %u male model id %u", minfo->gender, race, raceEntry->model_m); + { sLog.outErrorDb("Table `creature_model_info` have wrong gender %u for character race %u male model id %u", minfo->gender, race, raceEntry->model_m); } if (minfo->modelid_other_gender != raceEntry->model_f) - sLog.outErrorDb("Table `creature_model_info` have wrong other gender model id %u for character race %u male model id %u", minfo->modelid_other_gender, race, raceEntry->model_m); + { sLog.outErrorDb("Table `creature_model_info` have wrong other gender model id %u for character race %u male model id %u", minfo->modelid_other_gender, race, raceEntry->model_m); } if (minfo->bounding_radius <= 0.0f) { @@ -1187,7 +1188,7 @@ void ObjectMgr::LoadCreatureModelInfo() } } else - sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m); + { sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m); } } sLog.outString(">> Loaded %u creature model based info", sCreatureModelStorage.GetRecordCount()); @@ -1197,7 +1198,7 @@ void ObjectMgr::LoadCreatureModelInfo() void ObjectMgr::LoadCreatureModelRace() { m_mCreatureModelRaceMap.clear(); // can be used for reload - + QueryResult* result = WorldDatabase.Query("SELECT modelid, racemask, creature_entry, modelid_racial FROM creature_model_race"); if (!result) @@ -1813,7 +1814,7 @@ Team ObjectMgr::GetPlayerTeamByGUID(ObjectGuid guid) const { // prevent DB access for online player if (Player* player = GetPlayer(guid)) - return Player::TeamForRace(player->getRace()); + { return Player::TeamForRace(player->getRace()); } uint32 lowguid = guid.GetCounter(); @@ -1832,11 +1833,11 @@ Team ObjectMgr::GetPlayerTeamByGUID(ObjectGuid guid) const uint32 ObjectMgr::GetPlayerAccountIdByGUID(ObjectGuid guid) const { if (!guid.IsPlayer()) - return 0; + { return 0; } // prevent DB access for online player if (Player* player = GetPlayer(guid)) - return player->GetSession()->GetAccountId(); + { return player->GetSession()->GetAccountId(); } uint32 lowguid = guid.GetCounter(); @@ -1907,7 +1908,7 @@ void ObjectMgr::LoadItemLocales() if (idx >= 0) { if ((int32)data.Name.size() <= idx) - data.Name.resize(idx + 1); + { data.Name.resize(idx + 1); } data.Name[idx] = str; } @@ -1920,7 +1921,7 @@ void ObjectMgr::LoadItemLocales() if (idx >= 0) { if ((int32)data.Description.size() <= idx) - data.Description.resize(idx + 1); + { data.Description.resize(idx + 1); } data.Description[idx] = str; } @@ -2117,10 +2118,10 @@ void ObjectMgr::LoadItemPrototypes() if (req) { if (!(proto->AllowableClass & CLASSMASK_ALL_PLAYABLE)) - sLog.outErrorDb("Item (Entry: %u) not have in `AllowableClass` any playable classes (%u) and can't be equipped or use.", i, proto->AllowableClass); + { sLog.outErrorDb("Item (Entry: %u) not have in `AllowableClass` any playable classes (%u) and can't be equipped or use.", i, proto->AllowableClass); } if (!(proto->AllowableRace & RACEMASK_ALL_PLAYABLE)) - sLog.outErrorDb("Item (Entry: %u) not have in `AllowableRace` any playable races (%u) and can't be equipped or use.", i, proto->AllowableRace); + { sLog.outErrorDb("Item (Entry: %u) not have in `AllowableRace` any playable races (%u) and can't be equipped or use.", i, proto->AllowableRace); } } } @@ -2131,7 +2132,7 @@ void ObjectMgr::LoadItemPrototypes() } if (proto->RequiredReputationRank >= MAX_REPUTATION_RANK) - sLog.outErrorDb("Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", i, proto->RequiredReputationRank); + { sLog.outErrorDb("Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", i, proto->RequiredReputationRank); } if (proto->RequiredReputationFaction) { @@ -2142,7 +2143,7 @@ void ObjectMgr::LoadItemPrototypes() } if (proto->RequiredReputationRank == MIN_REPUTATION_RANK) - sLog.outErrorDb("Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", i); + { sLog.outErrorDb("Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", i); } } else if (proto->RequiredReputationRank > MIN_REPUTATION_RANK) sLog.outErrorDb("Item (Entry: %u) has RequiredReputationFaction ==0 but RequiredReputationRank > 0, rank setting is useless.", i); @@ -2327,16 +2328,16 @@ void ObjectMgr::LoadItemPrototypes() } if (proto->Bonding >= MAX_BIND_TYPE) - sLog.outErrorDb("Item (Entry: %u) has wrong Bonding value (%u)", i, proto->Bonding); + { sLog.outErrorDb("Item (Entry: %u) has wrong Bonding value (%u)", i, proto->Bonding); } if (proto->PageText) { if (!sPageTextStore.LookupEntry(proto->PageText)) - sLog.outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", i, proto->PageText); + { sLog.outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", i, proto->PageText); } } if (proto->LockID && !sLockStore.LookupEntry(proto->LockID)) - sLog.outErrorDb("Item (Entry: %u) has wrong LockID (%u)", i, proto->LockID); + { sLog.outErrorDb("Item (Entry: %u) has wrong LockID (%u)", i, proto->LockID); } if (proto->Sheath >= MAX_SHEATHETYPE) { @@ -2371,10 +2372,10 @@ void ObjectMgr::LoadItemPrototypes() } if (proto->Area && !GetAreaEntryByAreaID(proto->Area)) - sLog.outErrorDb("Item (Entry: %u) has wrong Area (%u)", i, proto->Area); + { sLog.outErrorDb("Item (Entry: %u) has wrong Area (%u)", i, proto->Area); } if (proto->Map && !sMapStore.LookupEntry(proto->Map)) - sLog.outErrorDb("Item (Entry: %u) has wrong Map (%u)", i, proto->Map); + { sLog.outErrorDb("Item (Entry: %u) has wrong Map (%u)", i, proto->Map); } if (proto->BagFamily) { @@ -2488,7 +2489,7 @@ void ObjectMgr::LoadItemPrototypes() if (proto->ExtraFlags) { if (proto->ExtraFlags & ~ITEM_EXTRA_ALL) - sLog.outErrorDb("Item (Entry: %u) has wrong ExtraFlags (%u) with unused bits set", i, proto->ExtraFlags); + { sLog.outErrorDb("Item (Entry: %u) has wrong ExtraFlags (%u) with unused bits set", i, proto->ExtraFlags); } if (proto->ExtraFlags & ITEM_EXTRA_NON_CONSUMABLE) { @@ -2526,23 +2527,23 @@ void ObjectMgr::LoadItemPrototypes() { CharStartOutfitEntry const* entry = sCharStartOutfitStore.LookupEntry(i); if (!entry) - continue; + { continue; } for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j) { if (entry->ItemId[j] <= 0) - continue; + { continue; } uint32 item_id = entry->ItemId[j]; if (!GetItemPrototype(item_id)) if (item_id != 40582) // nonexistent item by default but referenced in DBC, skip it from errors - notFoundOutfit.insert(item_id); + { notFoundOutfit.insert(item_id); } } } for (std::set::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr) - sLog.outErrorDb("Item (Entry: %u) not exist in `item_template` but referenced in `CharStartOutfit.dbc`", *itr); + { sLog.outErrorDb("Item (Entry: %u) not exist in `item_template` but referenced in `CharStartOutfit.dbc`", *itr); } } void ObjectMgr::LoadItemConverts() @@ -2720,7 +2721,7 @@ void ObjectMgr::LoadItemRequiredTarget() { SQLMultiStorage::SQLMSIteratorBounds bounds = sSpellScriptTargetStorage.getBounds(pSpellInfo->Id); if (bounds.first != bounds.second) - break; + { break; } for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { @@ -2738,7 +2739,7 @@ void ObjectMgr::LoadItemRequiredTarget() } } if (bIsItemSpellValid) - break; + { break; } } } } @@ -2816,7 +2817,7 @@ void ObjectMgr::LoadPetLevelInfo() if (current_level > sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - sLog.outErrorDb("Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); + { sLog.outErrorDb("Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); } else { DETAIL_LOG("Unused (> MaxPlayerLevel in mangosd.conf) level %u in `pet_levelstats` table, ignoring.", current_level); @@ -2833,7 +2834,7 @@ void ObjectMgr::LoadPetLevelInfo() PetLevelInfo*& pInfoMapEntry = petInfo[creature_id]; if (pInfoMapEntry == NULL) - pInfoMapEntry = new PetLevelInfo[sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)]; + { pInfoMapEntry = new PetLevelInfo[sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)]; } // data for level 1 stored in [0] array element, ... PetLevelInfo* pLevelInfo = &pInfoMapEntry[current_level - 1]; @@ -2886,11 +2887,11 @@ void ObjectMgr::LoadPetLevelInfo() PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint32 level) const { if (level > sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) - level = sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL); + { level = sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL); } PetLevelInfoMap::const_iterator itr = petInfo.find(creature_id); if (itr == petInfo.end()) - return NULL; + { return NULL; } return &itr->second[level - 1]; // data for level 1 stored in [0] array element, ... } @@ -3162,7 +3163,7 @@ void ObjectMgr::LoadPlayerInfo() uint8 action_type = fields[4].GetUInt8(); if (!Player::IsActionButtonDataValid(action_button, action, action_type, NULL)) - continue; + { continue; } PlayerInfo* pInfo = &playerInfo[current_race][current_class]; pInfo->action.push_back(PlayerCreateInfoAction(action_button, action, action_type)); @@ -3224,7 +3225,7 @@ void ObjectMgr::LoadPlayerInfo() if (current_level > sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - sLog.outErrorDb("Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); + { sLog.outErrorDb("Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); } else { DETAIL_LOG("Unused (> MaxPlayerLevel in mangosd.conf) level %u in `player_levelstats` table, ignoring.", current_level); @@ -3236,12 +3237,12 @@ void ObjectMgr::LoadPlayerInfo() PlayerInfo* pInfo = &playerInfo[current_race][current_class]; if (!pInfo->levelInfo) - pInfo->levelInfo = new PlayerLevelInfo[sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)]; + { pInfo->levelInfo = new PlayerLevelInfo[sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)]; } PlayerLevelInfo* pLevelInfo = &pInfo->levelInfo[current_level - 1]; for (int i = 0; i < MAX_STATS; ++i) - pLevelInfo->stats[i] = fields[i + 3].GetUInt8(); + { pLevelInfo->stats[i] = fields[i + 3].GetUInt8(); } bar.step(); ++count; @@ -3259,19 +3260,19 @@ void ObjectMgr::LoadPlayerInfo() { // skip nonexistent races if (!((1 << (race - 1)) & RACEMASK_ALL_PLAYABLE) || !sChrRacesStore.LookupEntry(race)) - continue; + { continue; } for (int class_ = 0; class_ < MAX_CLASSES; ++class_) { // skip nonexistent classes if (!((1 << (class_ - 1)) & CLASSMASK_ALL_PLAYABLE) || !sChrClassesStore.LookupEntry(class_)) - continue; + { continue; } PlayerInfo* pInfo = &playerInfo[race][class_]; // skip non loaded combinations if (!pInfo->displayId_m || !pInfo->displayId_f) - continue; + { continue; } // skip expansion races if not playing with expansion if (sWorld.getConfig(CONFIG_UINT32_EXPANSION) < EXPANSION_TBC && (race == RACE_BLOODELF || race == RACE_DRAENEI)) @@ -3309,7 +3310,7 @@ void ObjectMgr::LoadPlayerInfo() { mPlayerXPperLevel.resize(sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)); for (uint32 level = 0; level < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL); ++level) - mPlayerXPperLevel[level] = 0; + { mPlayerXPperLevel[level] = 0; } // 0 1 QueryResult* result = WorldDatabase.Query("SELECT lvl, xp_for_next_level FROM player_xp_for_level"); @@ -3339,7 +3340,7 @@ void ObjectMgr::LoadPlayerInfo() if (current_level >= sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - sLog.outErrorDb("Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level); + { sLog.outErrorDb("Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level); } else { DETAIL_LOG("Unused (> MaxPlayerLevel in mangosd.conf) level %u in `player_xp_for_levels` table, ignoring.", current_level); @@ -3374,10 +3375,10 @@ void ObjectMgr::LoadPlayerInfo() void ObjectMgr::GetPlayerClassLevelInfo(uint32 class_, uint32 level, uint32& baseHP, uint32& baseMana) const { if (level < 1 || class_ >= MAX_CLASSES) - return; + { return; } if (level > sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) - level = sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL); + { level = sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL); } GtOCTBaseHPByClassEntry const* hp = sGtOCTBaseHPByClassStore.LookupEntry((class_-1) * GT_MAX_LEVEL + level-1); GtOCTBaseMPByClassEntry const* mp = sGtOCTBaseMPByClassStore.LookupEntry((class_-1) * GT_MAX_LEVEL + level-1); @@ -3395,16 +3396,16 @@ void ObjectMgr::GetPlayerClassLevelInfo(uint32 class_, uint32 level, uint32& bas void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, PlayerLevelInfo* info) const { if (level < 1 || race >= MAX_RACES || class_ >= MAX_CLASSES) - return; + { return; } PlayerInfo const* pInfo = &playerInfo[race][class_]; if (pInfo->displayId_m == 0 || pInfo->displayId_f == 0) - return; + { return; } if (level <= sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) - *info = pInfo->levelInfo[level - 1]; + { *info = pInfo->levelInfo[level - 1]; } else - BuildPlayerLevelInfo(race, class_, level, info); + { BuildPlayerLevelInfo(race, class_, level, info); } } void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, PlayerLevelInfo* info) const @@ -3635,7 +3636,7 @@ void ObjectMgr::LoadGroups() if (!group->LoadMemberFromDB(memberGuidlow, subgroup, assistent)) { - sLog.outErrorDb("Incorrect entry in group_member table : member %s cannot be added to group (Id: %u)!", + sLog.outErrorDb("Incorrect entry in group_member table : member %s can not be added to group (Id: %u)!", memberGuid.GetString().c_str(), groupId); CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%u'", memberGuidlow); } @@ -3655,7 +3656,7 @@ void ObjectMgr::LoadGroups() mGroupMap.erase(itr++); } else - ++itr; + { ++itr; } } // -- loading instances -- @@ -3733,7 +3734,7 @@ void ObjectMgr::LoadQuests() { // For reload case for (QuestMap::const_iterator itr = mQuestTemplates.begin(); itr != mQuestTemplates.end(); ++itr) - delete itr->second; + { delete itr->second; } mQuestTemplates.clear(); @@ -4203,7 +4204,7 @@ void ObjectMgr::LoadQuests() qinfo->RewChoiceItemId[j] = 0; // no changes, quest will not reward this } else - choice_found = true; + { choice_found = true; } if (!qinfo->RewChoiceItemCount[j]) { @@ -4342,7 +4343,7 @@ void ObjectMgr::LoadQuests() qinfo->RewMailDelaySecs = 0; // no mail will send to player } else - usedMailTemplates[qinfo->RewMailTemplateId] = qinfo->GetQuestId(); + { usedMailTemplates[qinfo->RewMailTemplateId] = qinfo->GetQuestId(); } } if (qinfo->NextQuestInChain) @@ -4355,7 +4356,7 @@ void ObjectMgr::LoadQuests() qinfo->NextQuestInChain = 0; } else - qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId()); + { qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId()); } } // fill additional data stores @@ -4526,10 +4527,10 @@ void ObjectMgr::LoadQuests() } if (qinfo->ExclusiveGroup) - m_ExclusiveQuestGroups.insert(ExclusiveQuestGroupsMap::value_type(qinfo->ExclusiveGroup, qinfo->GetQuestId())); + { m_ExclusiveQuestGroups.insert(ExclusiveQuestGroupsMap::value_type(qinfo->ExclusiveGroup, qinfo->GetQuestId())); } if (qinfo->LimitTime) - qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAG_TIMED); + { qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAG_TIMED); } } // check QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE @@ -4537,7 +4538,7 @@ void ObjectMgr::LoadQuests() { SpellEntry const* spellInfo = sSpellStore.LookupEntry(i); if (!spellInfo) - continue; + { continue; } for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { @@ -4545,7 +4546,7 @@ void ObjectMgr::LoadQuests() if(!spellEffect) continue; if (spellEffect->Effect != SPELL_EFFECT_QUEST_COMPLETE) - continue; + { continue; } uint32 quest_id = spellEffect->EffectMiscValue; @@ -4553,7 +4554,7 @@ void ObjectMgr::LoadQuests() // some quest referenced in spells not exist (outdated spells) if (!quest) - continue; + { continue; } // Exclude false positive of quest 10162 if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT) && spellInfo->Id != 33824 && quest_id != 10162) @@ -4624,7 +4625,7 @@ void ObjectMgr::LoadQuestLocales() if (idx >= 0) { if ((int32)data.Title.size() <= idx) - data.Title.resize(idx + 1); + { data.Title.resize(idx + 1); } data.Title[idx] = str; } @@ -4636,7 +4637,7 @@ void ObjectMgr::LoadQuestLocales() if (idx >= 0) { if ((int32)data.Details.size() <= idx) - data.Details.resize(idx + 1); + { data.Details.resize(idx + 1); } data.Details[idx] = str; } @@ -4648,7 +4649,7 @@ void ObjectMgr::LoadQuestLocales() if (idx >= 0) { if ((int32)data.Objectives.size() <= idx) - data.Objectives.resize(idx + 1); + { data.Objectives.resize(idx + 1); } data.Objectives[idx] = str; } @@ -4660,7 +4661,7 @@ void ObjectMgr::LoadQuestLocales() if (idx >= 0) { if ((int32)data.OfferRewardText.size() <= idx) - data.OfferRewardText.resize(idx + 1); + { data.OfferRewardText.resize(idx + 1); } data.OfferRewardText[idx] = str; } @@ -4672,7 +4673,7 @@ void ObjectMgr::LoadQuestLocales() if (idx >= 0) { if ((int32)data.RequestItemsText.size() <= idx) - data.RequestItemsText.resize(idx + 1); + { data.RequestItemsText.resize(idx + 1); } data.RequestItemsText[idx] = str; } @@ -4684,7 +4685,7 @@ void ObjectMgr::LoadQuestLocales() if (idx >= 0) { if ((int32)data.EndText.size() <= idx) - data.EndText.resize(idx + 1); + { data.EndText.resize(idx + 1); } data.EndText[idx] = str; } @@ -4710,7 +4711,7 @@ void ObjectMgr::LoadQuestLocales() if (idx >= 0) { if ((int32)data.ObjectiveText[k].size() <= idx) - data.ObjectiveText[k].resize(idx + 1); + { data.ObjectiveText[k].resize(idx + 1); } data.ObjectiveText[k][idx] = str; } @@ -4785,7 +4786,7 @@ void ObjectMgr::LoadPageTexts() // check data correctness PageText const* page = sPageTextStore.LookupEntry(i); if (!page) - continue; + { continue; } if (page->Next_Page && !sPageTextStore.LookupEntry(page->Next_Page)) { @@ -4798,14 +4799,14 @@ void ObjectMgr::LoadPageTexts() for (PageText const* pageItr = page; pageItr; pageItr = sPageTextStore.LookupEntry(pageItr->Next_Page)) { if (!pageItr->Next_Page) - break; + { break; } checkedPages.insert(pageItr->Page_ID); if (checkedPages.find(pageItr->Next_Page) != checkedPages.end()) { std::ostringstream ss; ss << "The text page(s) "; for (std::set::iterator itr = checkedPages.begin(); itr != checkedPages.end(); ++itr) - ss << *itr << " "; + { ss << *itr << " "; } ss << "create(s) a circular reference, which can cause the server to freeze. Changing Next_Page of page " << pageItr->Page_ID << " to 0"; sLog.outErrorDb("%s", ss.str().c_str()); @@ -4854,13 +4855,13 @@ void ObjectMgr::LoadPageTextLocales() { std::string str = fields[i].GetCppString(); if (str.empty()) - continue; + { continue; } int idx = GetOrNewIndexForLocale(LocaleConstant(i)); if (idx >= 0) { if ((int32)data.Text.size() <= idx) - data.Text.resize(idx + 1); + { data.Text.resize(idx + 1); } data.Text[idx] = str; } @@ -4965,7 +4966,7 @@ void ObjectMgr::LoadInstanceTemplate() { InstanceTemplate const* temp = GetInstanceTemplate(i); if (!temp) - continue; + { continue; } MapEntry const* mapEntry = sMapStore.LookupEntry(temp->map); if (!mapEntry) @@ -5057,7 +5058,7 @@ void ObjectMgr::LoadConditions() { const PlayerCondition* condition = sConditionStorage.LookupEntry(i); if (!condition) - continue; + { continue; } if (!condition->IsValid()) { @@ -5075,7 +5076,7 @@ GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const { GossipTextMap::const_iterator itr = mGossipText.find(Text_ID); if (itr != mGossipText.end()) - return &itr->second; + { return &itr->second; } return NULL; } @@ -5089,8 +5090,8 @@ void ObjectMgr::LoadGossipText() BarGoLink bar(1); bar.step(); - sLog.outString(">> Loaded %u npc texts", count); sLog.outString(); + sLog.outString(">> Loaded %u npc texts", count); return; } @@ -5131,8 +5132,8 @@ void ObjectMgr::LoadGossipText() } while (result->NextRow()); - sLog.outString(">> Loaded %u npc texts", count); sLog.outString(); + sLog.outString(">> Loaded %u npc texts", count); delete result; } @@ -5190,7 +5191,7 @@ void ObjectMgr::LoadGossipTextLocales() if (idx >= 0) { if ((int32)data.Text_0[j].size() <= idx) - data.Text_0[j].resize(idx + 1); + { data.Text_0[j].resize(idx + 1); } data.Text_0[j][idx] = str0; } @@ -5202,7 +5203,7 @@ void ObjectMgr::LoadGossipTextLocales() if (idx >= 0) { if ((int32)data.Text_1[j].size() <= idx) - data.Text_1[j].resize(idx + 1); + { data.Text_1[j].resize(idx + 1); } data.Text_1[j][idx] = str1; } @@ -5265,7 +5266,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) Player* pl = 0; if (serverUp) - pl = GetPlayer(m->receiverGuid); + { pl = GetPlayer(m->receiverGuid); } if (pl) { // this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail @@ -5297,7 +5298,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) { // mail open and then not returned for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2) - CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", itr2->item_guid); + { CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", itr2->item_guid); } } else { @@ -5448,14 +5449,14 @@ uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, Te { TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i); if (!node || node->map_id != mapid || !node->MountCreatureID[team == ALLIANCE ? 1 : 0]) - continue; + { continue; } uint8 field = (uint8)((i - 1) / 8); uint8 submask = 1 << ((i - 1) % 8); // skip not taxi network nodes if ((sTaxiNodesMask[field] & submask) == 0) - continue; + { continue; } float dist2 = (node->x - x) * (node->x - x) + (node->y - y) * (node->y - y) + (node->z - z) * (node->z - z); if (found) @@ -5513,28 +5514,28 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, Team team, bool allowed_alt_t { mount_entry = node->MountCreatureID[1]; if (!mount_entry && allowed_alt_team) - mount_entry = node->MountCreatureID[0]; + { mount_entry = node->MountCreatureID[0]; } } else if (team == HORDE) { mount_entry = node->MountCreatureID[0]; if (!mount_entry && allowed_alt_team) - mount_entry = node->MountCreatureID[1]; + { mount_entry = node->MountCreatureID[1]; } } } CreatureInfo const* mount_info = GetCreatureTemplate(mount_entry); if (!mount_info) - return 0; + { return 0; } uint16 mount_id = Creature::ChooseDisplayId(mount_info); if (!mount_id) - return 0; + { return 0; } CreatureModelInfo const* minfo = GetCreatureModelRandomGender(mount_id); if (minfo) - mount_id = minfo->modelid; + { mount_id = minfo->modelid; } return mount_id; } @@ -5597,7 +5598,7 @@ void ObjectMgr::LoadGraveyardZones() } if (!AddGraveYardLink(safeLocId, zoneId, Team(team), false)) - sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId); + { sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId); } } while (result->NextRow()); @@ -5653,7 +5654,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float // team == TEAM_BOTH_ALLOWED case can be at call from .neargrave // TEAM_INVALID != team for all teams if (data.team != TEAM_BOTH_ALLOWED && data.team != team && team != TEAM_BOTH_ALLOWED) - continue; + { continue; } // find now nearest graveyard at other (continent) map if (MapId != entry->map_id) @@ -5709,10 +5710,10 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float } if (entryNear) - return entryNear; + { return entryNear; } if (entryEntr) - return entryEntr; + { return entryEntr; } return entryFar; } @@ -5724,7 +5725,7 @@ GraveYardData const* ObjectMgr::FindGraveYardData(uint32 id, uint32 zoneId) cons for (GraveYardMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) { if (itr->second.safeLocId == id) - return &itr->second; + { return &itr->second; } } return NULL; @@ -5733,7 +5734,7 @@ GraveYardData const* ObjectMgr::FindGraveYardData(uint32 id, uint32 zoneId) cons bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, Team team, bool inDB) { if (FindGraveYardData(id, zoneId)) // This ensures that (safeLoc)Id, zoneId is unique in mGraveYardMap - return false; + { return false; } // add link to loaded data GraveYardData data; @@ -5744,7 +5745,7 @@ bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, Team team, bool inDB) // add link to DB if (inDB) - WorldDatabase.PExecuteLog("INSERT INTO game_graveyard_zone ( id,ghost_zone,faction) VALUES ('%u', '%u','%u')", id, zoneId, uint32(team)); + { WorldDatabase.PExecuteLog("INSERT INTO game_graveyard_zone ( id,ghost_zone,faction) VALUES ('%u', '%u','%u')", id, zoneId, uint32(team)); } return true; } @@ -5759,14 +5760,14 @@ void ObjectMgr::SetGraveYardLinkTeam(uint32 id, uint32 zoneId, Team team) // skip not matching safezone id if (data.safeLocId != id) - continue; + { continue; } data.team = team; // Validate link return; } if (team == TEAM_INVALID) - return; + { return; } // Link expected but not exist. sLog.outErrorDb("ObjectMgr::SetGraveYardLinkTeam called for safeLoc %u, zoneId %u, but no graveyard link for this found in database.", id, zoneId); @@ -5783,7 +5784,6 @@ void ObjectMgr::LoadAreaTriggerTeleports() QueryResult* result = WorldDatabase.Query("SELECT id, required_level, required_item, required_item2, heroic_key, heroic_key2, required_quest_done, required_quest_done_heroic, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport"); if (!result) { - BarGoLink bar(1); bar.step(); @@ -5917,7 +5917,7 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const { const MapEntry* mapEntry = sMapStore.LookupEntry(map_id); if (!mapEntry || mapEntry->ghost_entrance_map < 0) - return NULL; + { return NULL; } // Try to find one that teleports to the map we want to enter std::list ghostTrigger; @@ -5931,14 +5931,14 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const if ((!compareTrigger || itr->second.IsLessOrEqualThan(compareTrigger)) && sAreaTriggerStore.LookupEntry(itr->first)->mapid == map_id) { if (itr->second.IsMinimal()) - return &itr->second; + { return &itr->second; } compareTrigger = &itr->second; } } } if (compareTrigger) - return compareTrigger; + { return compareTrigger; } // Second attempt: take one fitting for (std::list::const_iterator itr = ghostTrigger.begin(); itr != ghostTrigger.end(); ++itr) @@ -5946,7 +5946,7 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const if (!compareTrigger || (*itr)->IsLessOrEqualThan(compareTrigger)) { if ((*itr)->IsMinimal()) - return *itr; + { return *itr; } compareTrigger = *itr; } @@ -5954,7 +5954,7 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const return compareTrigger; } -/* +/** * Searches for the areatrigger which teleports players to the given map */ AreaTrigger const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const @@ -5970,14 +5970,14 @@ AreaTrigger const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const { // Remark that IsLessOrEqualThan is no total order, and a->IsLeQ(b) != !b->IsLeQ(a) if (!compareTrigger || compareTrigger->IsLessOrEqualThan(&itr->second)) - compareTrigger = &itr->second; + { compareTrigger = &itr->second; } } else { if (!compareTrigger || itr->second.IsLessOrEqualThan(compareTrigger)) { if (itr->second.IsMinimal()) - return &itr->second; + { return &itr->second; } compareTrigger = &itr->second; } @@ -6236,7 +6236,7 @@ struct SQLGameObjectLoader : public SQLStorageLoaderBaseid, goInfo->type, N, dataN, dataN); @@ -6259,7 +6259,7 @@ inline void CheckGOLinkedTrapId(GameObjectInfo const* goInfo, uint32 dataN, uint inline void CheckGOSpellId(GameObjectInfo const* goInfo, uint32 dataN, uint32 N) { if (sSpellStore.LookupEntry(dataN)) - return; + { return; } sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.", goInfo->id, goInfo->type, N, dataN, dataN); @@ -6268,7 +6268,7 @@ inline void CheckGOSpellId(GameObjectInfo const* goInfo, uint32 dataN, uint32 N) inline void CheckAndFixGOChairHeightId(GameObjectInfo const* goInfo, uint32 const& dataN, uint32 N) { if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR - UNIT_STAND_STATE_SIT_LOW_CHAIR)) - return; + { return; } sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.", goInfo->id, goInfo->type, N, dataN, UNIT_STAND_STATE_SIT_HIGH_CHAIR - UNIT_STAND_STATE_SIT_LOW_CHAIR); @@ -6281,7 +6281,7 @@ inline void CheckGONoDamageImmuneId(GameObjectInfo const* goInfo, uint32 dataN, { // 0/1 correct values if (dataN <= 1) - return; + { return; } sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.", goInfo->id, goInfo->type, N, dataN); @@ -6291,7 +6291,7 @@ inline void CheckGOConsumable(GameObjectInfo const* goInfo, uint32 dataN, uint32 { // 0/1 correct values if (dataN <= 1) - return; + { return; } sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.", goInfo->id, goInfo->type, N, dataN); @@ -6300,7 +6300,7 @@ inline void CheckGOConsumable(GameObjectInfo const* goInfo, uint32 dataN, uint32 inline void CheckAndFixGOCaptureMinTime(GameObjectInfo const* goInfo, uint32 const& dataN, uint32 N) { if (dataN > 0) - return; + { return; } sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) has data%d=%u but minTime field value must be > 0.", goInfo->id, goInfo->type, N, dataN); @@ -6319,7 +6319,7 @@ void ObjectMgr::LoadGameobjectInfo() { GameObjectInfo const* goInfo = itr.getValue(); - if (goInfo->size <= 0.0f) // prevent use too small Scales + if (goInfo->size <= 0.0f) // prevent use too small scales { ERROR_DB_STRICT_LOG("Gameobject (Entry: %u GoType: %u) have too small size=%f", goInfo->id, goInfo->type, goInfo->size); @@ -6333,41 +6333,41 @@ void ObjectMgr::LoadGameobjectInfo() case GAMEOBJECT_TYPE_DOOR: // 0 { if (goInfo->door.lockId) - CheckGOLockId(goInfo, goInfo->door.lockId, 1); + { CheckGOLockId(goInfo, goInfo->door.lockId, 1); } CheckGONoDamageImmuneId(goInfo, goInfo->door.noDamageImmune, 3); break; } case GAMEOBJECT_TYPE_BUTTON: // 1 { if (goInfo->button.lockId) - CheckGOLockId(goInfo, goInfo->button.lockId, 1); + { CheckGOLockId(goInfo, goInfo->button.lockId, 1); } if (goInfo->button.linkedTrapId) // linked trap - CheckGOLinkedTrapId(goInfo, goInfo->button.linkedTrapId, 3); + { CheckGOLinkedTrapId(goInfo, goInfo->button.linkedTrapId, 3); } CheckGONoDamageImmuneId(goInfo, goInfo->button.noDamageImmune, 4); break; } case GAMEOBJECT_TYPE_QUESTGIVER: // 2 { if (goInfo->questgiver.lockId) - CheckGOLockId(goInfo, goInfo->questgiver.lockId, 0); + { CheckGOLockId(goInfo, goInfo->questgiver.lockId, 0); } CheckGONoDamageImmuneId(goInfo, goInfo->questgiver.noDamageImmune, 5); break; } case GAMEOBJECT_TYPE_CHEST: // 3 { if (goInfo->chest.lockId) - CheckGOLockId(goInfo, goInfo->chest.lockId, 0); + { CheckGOLockId(goInfo, goInfo->chest.lockId, 0); } CheckGOConsumable(goInfo, goInfo->chest.consumable, 3); if (goInfo->chest.linkedTrapId) // linked trap - CheckGOLinkedTrapId(goInfo, goInfo->chest.linkedTrapId, 7); + { CheckGOLinkedTrapId(goInfo, goInfo->chest.linkedTrapId, 7); } break; } case GAMEOBJECT_TYPE_TRAP: // 6 { if (goInfo->trap.lockId) - CheckGOLockId(goInfo, goInfo->trap.lockId, 0); + { CheckGOLockId(goInfo, goInfo->trap.lockId, 0); } /* disable check for while, too many nonexistent spells if (goInfo->trap.spellId) // spell CheckGOSpellId(goInfo,goInfo->trap.spellId,3); @@ -6387,13 +6387,13 @@ void ObjectMgr::LoadGameobjectInfo() } if (goInfo->spellFocus.linkedTrapId) // linked trap - CheckGOLinkedTrapId(goInfo, goInfo->spellFocus.linkedTrapId, 2); + { CheckGOLinkedTrapId(goInfo, goInfo->spellFocus.linkedTrapId, 2); } break; } case GAMEOBJECT_TYPE_GOOBER: // 10 { if (goInfo->goober.lockId) - CheckGOLockId(goInfo, goInfo->goober.lockId, 0); + { CheckGOLockId(goInfo, goInfo->goober.lockId, 0); } CheckGOConsumable(goInfo, goInfo->goober.consumable, 3); @@ -6409,7 +6409,7 @@ void ObjectMgr::LoadGameobjectInfo() */ CheckGONoDamageImmuneId(goInfo, goInfo->goober.noDamageImmune, 11); if (goInfo->goober.linkedTrapId) // linked trap - CheckGOLinkedTrapId(goInfo, goInfo->goober.linkedTrapId, 12); + { CheckGOLinkedTrapId(goInfo, goInfo->goober.linkedTrapId, 12); } break; } case GAMEOBJECT_TYPE_TRANSPORT: // 11 @@ -6462,13 +6462,13 @@ void ObjectMgr::LoadGameobjectInfo() case GAMEOBJECT_TYPE_AREADAMAGE: // 12 { if (goInfo->areadamage.lockId) - CheckGOLockId(goInfo, goInfo->areadamage.lockId, 0); + { CheckGOLockId(goInfo, goInfo->areadamage.lockId, 0); } break; } case GAMEOBJECT_TYPE_CAMERA: // 13 { if (goInfo->camera.lockId) - CheckGOLockId(goInfo, goInfo->camera.lockId, 0); + { CheckGOLockId(goInfo, goInfo->camera.lockId, 0); } break; } case GAMEOBJECT_TYPE_MO_TRANSPORT: // 15 @@ -6498,20 +6498,20 @@ void ObjectMgr::LoadGameobjectInfo() case GAMEOBJECT_TYPE_FLAGSTAND: // 24 { if (goInfo->flagstand.lockId) - CheckGOLockId(goInfo, goInfo->flagstand.lockId, 0); + { CheckGOLockId(goInfo, goInfo->flagstand.lockId, 0); } CheckGONoDamageImmuneId(goInfo, goInfo->flagstand.noDamageImmune, 5); break; } case GAMEOBJECT_TYPE_FISHINGHOLE: // 25 { if (goInfo->fishinghole.lockId) - CheckGOLockId(goInfo, goInfo->fishinghole.lockId, 4); + { CheckGOLockId(goInfo, goInfo->fishinghole.lockId, 4); } break; } case GAMEOBJECT_TYPE_FLAGDROP: // 26 { if (goInfo->flagdrop.lockId) - CheckGOLockId(goInfo, goInfo->flagdrop.lockId, 0); + { CheckGOLockId(goInfo, goInfo->flagdrop.lockId, 0); } CheckGONoDamageImmuneId(goInfo, goInfo->flagdrop.noDamageImmune, 3); break; } @@ -6575,7 +6575,7 @@ uint32 ObjectMgr::GetBaseXP(uint32 level) const uint32 ObjectMgr::GetXPForLevel(uint32 level) const { if (level < mPlayerXPperLevel.size()) - return mPlayerXPperLevel[level]; + { return mPlayerXPperLevel[level]; } return 0; } @@ -6606,9 +6606,9 @@ void ObjectMgr::LoadPetNames() uint32 entry = fields[1].GetUInt32(); bool half = fields[2].GetBool(); if (half) - PetHalfName1[entry].push_back(word); + { PetHalfName1[entry].push_back(word); } else - PetHalfName0[entry].push_back(word); + { PetHalfName0[entry].push_back(word); } ++count; } while (result->NextRow()); @@ -6645,7 +6645,7 @@ std::string ObjectMgr::GeneratePetName(uint32 entry) CreatureInfo const* cinfo = GetCreatureTemplate(entry); char const* petname = GetPetName(cinfo->Family, sWorld.GetDefaultDbcLocale()); if (!petname) - petname = cinfo->Name; + { petname = cinfo->Name; } return std::string(petname); } @@ -6976,8 +6976,8 @@ void ObjectMgr::LoadReputationSpilloverTemplate() delete result; - sLog.outString(); sLog.outString(">> Loaded %u reputation_spillover_template", count); + sLog.outString(); } void ObjectMgr::LoadPointsOfInterest() @@ -6992,11 +6992,9 @@ void ObjectMgr::LoadPointsOfInterest() if (!result) { BarGoLink bar(1); - bar.step(); - - sLog.outString(); sLog.outErrorDb(">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty."); + sLog.outString(); return; } @@ -7031,7 +7029,6 @@ void ObjectMgr::LoadPointsOfInterest() delete result; - sLog.outString(); sLog.outString(">> Loaded %u Points of Interest definitions", count); } @@ -7141,16 +7138,16 @@ void ObjectMgr::LoadDungeonFinderRequirements() Field* fields = result->Fetch(); bar.step(); - uint32 mapId = fields[0].GetUInt32(); - uint32 difficulty = fields[1].GetUInt32(); - uint32 dungeonKey = MAKE_PAIR32(mapId, difficulty); // for unique key + uint32 mapId = fields[0].GetUInt32(); + uint32 difficulty = fields[1].GetUInt32(); + uint32 dungeonKey = MAKE_PAIR32(mapId, difficulty); // for unique key - uint32 minItemLevel = fields[2].GetUInt32(); - uint32 item = fields[3].GetUInt32(); - uint32 item2 = fields[4].GetUInt32(); - uint32 allianceQuest = fields[5].GetUInt32(); - uint32 hordeQuest = fields[6].GetUInt32(); - uint32 achievement = fields[7].GetUInt32(); + uint32 minItemLevel = fields[2].GetUInt32(); + uint32 item = fields[3].GetUInt32(); + uint32 item2 = fields[4].GetUInt32(); + uint32 allianceQuest = fields[5].GetUInt32(); + uint32 hordeQuest = fields[6].GetUInt32(); + uint32 achievement = fields[7].GetUInt32(); const char* questText = fields[8].GetString(); // check that items, quests, & achievements are real @@ -7213,7 +7210,8 @@ void ObjectMgr::LoadDungeonFinderRequirements() mDungeonFinderRequirementsMap[dungeonKey] = requirement; ++count; - } while (result->NextRow()); + } + while (result->NextRow()); delete result; @@ -7247,15 +7245,16 @@ void ObjectMgr::LoadDungeonFinderRewards() Field* fields = result->Fetch(); bar.step(); - uint32 level = fields[1].GetUInt32(); - uint32 baseXP = fields[2].GetUInt32(); - int32 baseMoney = fields[3].GetInt32(); + uint32 level = fields[1].GetUInt32(); + uint32 baseXP = fields[2].GetUInt32(); + int32 baseMoney = fields[3].GetInt32(); DungeonFinderRewards reward(baseXP, baseMoney); mDungeonFinderRewardsMap[level] = reward; ++count; - } while (result->NextRow()); + } + while (result->NextRow()); delete result; @@ -7300,7 +7299,8 @@ void ObjectMgr::LoadDungeonFinderItems() mDungeonFinderItemsMap[id] = rewardItems; ++count; - } while (result->NextRow()); + } + while (result->NextRow()); delete result; @@ -7432,7 +7432,7 @@ struct SQLSpellLoader : public SQLStorageLoaderBase guid_set map CreatureData const* data = GetCreatureData(guid); if (data) - RemoveCreatureFromGrid(guid, data); + { RemoveCreatureFromGrid(guid, data); } mCreatureDataMap.erase(guid); } @@ -7487,7 +7487,7 @@ void ObjectMgr::DeleteGOData(uint32 guid) // remove mapid*cellid -> guid_set map GameObjectData const* data = GetGOData(guid); if (data) - RemoveGameobjectFromGrid(guid, data); + { RemoveGameobjectFromGrid(guid, data); } mGameObjectDataMap.erase(guid); } @@ -7621,9 +7621,8 @@ void ObjectMgr::LoadReservedPlayersNames() { BarGoLink bar(1); bar.step(); - - sLog.outString(); sLog.outString(">> Loaded %u reserved player names", count); + sLog.outString(); return; } @@ -7652,15 +7651,15 @@ void ObjectMgr::LoadReservedPlayersNames() delete result; - sLog.outString(); sLog.outString(">> Loaded %u reserved player names", count); + sLog.outString(); } bool ObjectMgr::IsReservedName(const std::string& name) const { std::wstring wstr; if (!Utf8toWStr(name, wstr)) - return false; + { return false; } wstrToLower(wstr); @@ -7709,11 +7708,11 @@ bool isValidString(const std::wstring& wstr, uint32 strictMask, bool numericOrSp if (strictMask == 0) // any language, ignore realm { if (isExtendedLatinString(wstr, numericOrSpace)) - return true; + { return true; } if (isCyrillicString(wstr, numericOrSpace)) - return true; + { return true; } if (isEastAsianString(wstr, numericOrSpace)) - return true; + { return true; } return false; } @@ -7722,19 +7721,19 @@ bool isValidString(const std::wstring& wstr, uint32 strictMask, bool numericOrSp LanguageType lt = GetRealmLanguageType(create); if (lt & LT_EXTENDEN_LATIN) if (isExtendedLatinString(wstr, numericOrSpace)) - return true; + { return true; } if (lt & LT_CYRILLIC) if (isCyrillicString(wstr, numericOrSpace)) - return true; + { return true; } if (lt & LT_EAST_ASIA) if (isEastAsianString(wstr, numericOrSpace)) - return true; + { return true; } } if (strictMask & 0x1) // basic Latin { if (isBasicLatinString(wstr, numericOrSpace)) - return true; + { return true; } } return false; @@ -7744,18 +7743,18 @@ uint8 ObjectMgr::CheckPlayerName(const std::string& name, bool create) { std::wstring wname; if (!Utf8toWStr(name, wname)) - return CHAR_NAME_INVALID_CHARACTER; + { return CHAR_NAME_INVALID_CHARACTER; } if (wname.size() > MAX_PLAYER_NAME) - return CHAR_NAME_TOO_LONG; + { return CHAR_NAME_TOO_LONG; } uint32 minName = sWorld.getConfig(CONFIG_UINT32_MIN_PLAYER_NAME); if (wname.size() < minName) - return CHAR_NAME_TOO_SHORT; + { return CHAR_NAME_TOO_SHORT; } uint32 strictMask = sWorld.getConfig(CONFIG_UINT32_STRICT_PLAYER_NAMES); if (!isValidString(wname, strictMask, false, create)) - return CHAR_NAME_MIXED_LANGUAGES; + { return CHAR_NAME_MIXED_LANGUAGES; } return CHAR_NAME_SUCCESS; } @@ -7764,14 +7763,14 @@ bool ObjectMgr::IsValidCharterName(const std::string& name) { std::wstring wname; if (!Utf8toWStr(name, wname)) - return false; + { return false; } if (wname.size() > MAX_CHARTER_NAME) - return false; + { return false; } uint32 minName = sWorld.getConfig(CONFIG_UINT32_MIN_CHARTER_NAME); if (wname.size() < minName) - return false; + { return false; } uint32 strictMask = sWorld.getConfig(CONFIG_UINT32_STRICT_CHARTER_NAMES); @@ -7782,18 +7781,18 @@ PetNameInvalidReason ObjectMgr::CheckPetName(const std::string& name) { std::wstring wname; if (!Utf8toWStr(name, wname)) - return PET_NAME_INVALID; + { return PET_NAME_INVALID; } if (wname.size() > MAX_PET_NAME) - return PET_NAME_TOO_LONG; + { return PET_NAME_TOO_LONG; } uint32 minName = sWorld.getConfig(CONFIG_UINT32_MIN_PET_NAME); if (wname.size() < minName) - return PET_NAME_TOO_SHORT; + { return PET_NAME_TOO_SHORT; } uint32 strictMask = sWorld.getConfig(CONFIG_UINT32_STRICT_PET_NAMES); if (!isValidString(wname, strictMask, false)) - return PET_NAME_MIXED_LANGUAGES; + { return PET_NAME_MIXED_LANGUAGES; } return PET_NAME_SUCCESS; } @@ -7801,11 +7800,11 @@ PetNameInvalidReason ObjectMgr::CheckPetName(const std::string& name) int ObjectMgr::GetIndexForLocale(LocaleConstant loc) { if (loc == LOCALE_enUS) - return -1; + { return -1; } for (size_t i = 0; i < m_LocalForIndex.size(); ++i) if (m_LocalForIndex[i] == loc) - return i; + { return i; } return -1; } @@ -7813,7 +7812,7 @@ int ObjectMgr::GetIndexForLocale(LocaleConstant loc) LocaleConstant ObjectMgr::GetLocaleForIndex(int i) { if (i < 0 || i >= (int32)m_LocalForIndex.size()) - return LOCALE_enUS; + { return LOCALE_enUS; } return m_LocalForIndex[i]; } @@ -7821,11 +7820,11 @@ LocaleConstant ObjectMgr::GetLocaleForIndex(int i) int ObjectMgr::GetOrNewIndexForLocale(LocaleConstant loc) { if (loc == LOCALE_enUS) - return -1; + { return -1; } for (size_t i = 0; i < m_LocalForIndex.size(); ++i) if (m_LocalForIndex[i] == loc) - return i; + { return i; } m_LocalForIndex.push_back(loc); return m_LocalForIndex.size() - 1; @@ -7839,8 +7838,8 @@ void ObjectMgr::LoadGameObjectForQuests() { BarGoLink bar(1); bar.step(); - sLog.outString(); sLog.outString(">> Loaded 0 GameObjects for quests"); + sLog.outString(); return; } @@ -7856,7 +7855,7 @@ void ObjectMgr::LoadGameObjectForQuests() case GAMEOBJECT_TYPE_QUESTGIVER: { if (m_GOQuestRelations.find(itr->id) != m_GOQuestRelations.end() || - m_GOQuestInvolvedRelations.find(itr->id) != m_GOQuestInvolvedRelations.end()) + m_GOQuestInvolvedRelations.find(itr->id) != m_GOQuestInvolvedRelations.end()) { mGameObjectForQuestSet.insert(itr->id); ++count; @@ -7909,8 +7908,8 @@ void ObjectMgr::LoadGameObjectForQuests() } } - sLog.outString(); sLog.outString(">> Loaded %u GameObjects for quests", count); + sLog.outString(); } inline void _DoStringError(int32 entry, char const* text, ...) @@ -7924,13 +7923,13 @@ inline void _DoStringError(int32 entry, char const* text, ...) va_end(ap); if (entry <= MAX_CREATURE_AI_TEXT_STRING_ID) // script library error - sLog.outErrorScriptLib("%s", buf); + { sLog.outErrorScriptLib("%s", buf); } else if (entry <= MIN_CREATURE_AI_TEXT_STRING_ID) // eventAI error - sLog.outErrorEventAI("%s", buf); + { sLog.outErrorEventAI("%s", buf); } else if (entry < MIN_DB_SCRIPT_STRING_ID) // mangos string error - sLog.outError("%s", buf); + { sLog.outError("%s", buf); } else // if (entry > MIN_DB_SCRIPT_STRING_ID) // DB script text error - sLog.outErrorDb("DB-SCRIPTS: %s", buf); + { sLog.outErrorDb("DB-SCRIPTS: %s", buf); } } bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value, bool extra_content) @@ -7964,15 +7963,16 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min for (MangosStringLocaleMap::iterator itr = mMangosStringLocaleMap.begin(); itr != mMangosStringLocaleMap.end();) { if (itr->first >= start_value && itr->first < end_value) - mMangosStringLocaleMap.erase(itr++); + { mMangosStringLocaleMap.erase(itr++); } else - ++itr; + { ++itr; } } sLog.outString("Loading texts from %s%s", table, extra_content ? ", with additional data" : ""); QueryResult* result = db.PQuery("SELECT entry,content_default,content_loc1,content_loc2,content_loc3,content_loc4,content_loc5,content_loc6,content_loc7,content_loc8 %s FROM %s", extra_content ? ",sound,type,language,emote" : "", table); + if (!result) { BarGoLink bar(1); @@ -7981,9 +7981,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min sLog.outString(); if (min_value == MIN_MANGOS_STRING_ID) // error only in case internal strings - sLog.outErrorDb(">> Loaded 0 mangos strings. DB table `%s` is empty. Cannot continue.", table); + { sLog.outErrorDb(">> Loaded 0 mangos strings. DB table `%s` is empty. Can not continue.", table); } else - sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.", table); + { sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.", table); } return false; } @@ -8033,7 +8033,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min { // 0 -> default, idx in to idx+1 if ((int32)data.Content.size() <= idx + 1) - data.Content.resize(idx + 2); + { data.Content.resize(idx + 2); } data.Content[idx + 1] = str; } @@ -8043,10 +8043,10 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min // Load additional string content if necessary if (extra_content) { - data.SoundId = fields[10].GetUInt32(); - data.Type = fields[11].GetUInt32(); - data.LanguageId = Language(fields[12].GetUInt32()); - data.Emote = fields[13].GetUInt32(); + data.SoundId = fields[10].GetUInt32(); + data.Type = fields[11].GetUInt32(); + data.LanguageId = Language(fields[12].GetUInt32()); + data.Emote = fields[13].GetUInt32(); if (data.SoundId && !sSoundEntriesStore.LookupEntry(data.SoundId)) { @@ -8077,11 +8077,10 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min delete result; - sLog.outString(); if (min_value == MIN_MANGOS_STRING_ID) - sLog.outString(">> Loaded %u MaNGOS strings from table %s", count, table); + { sLog.outString(">> Loaded %u MaNGOS strings from table %s", count, table); } else - sLog.outString(">> Loaded %u %s templates from %s", count, extra_content ? "text" : "string", table); + { sLog.outString(">> Loaded %u %s templates from %s", count, extra_content ? "text" : "string", table); } sLog.outString(); m_loadedStringCount[min_value] = count; @@ -8096,12 +8095,13 @@ const char* ObjectMgr::GetMangosString(int32 entry, int locale_idx) const if (MangosStringLocale const* msl = GetMangosStringLocale(entry)) { if ((int32)msl->Content.size() > locale_idx + 1 && !msl->Content[locale_idx + 1].empty()) - return msl->Content[locale_idx + 1].c_str(); + { return msl->Content[locale_idx + 1].c_str(); } else - return msl->Content[0].c_str(); + { return msl->Content[0].c_str(); } } _DoStringError(entry, "Entry %i not found but requested", entry); + return ""; } @@ -8115,11 +8115,9 @@ void ObjectMgr::LoadFishingBaseSkillLevel() if (!result) { BarGoLink bar(1); - bar.step(); - - sLog.outString(); sLog.outErrorDb(">> Loaded `skill_fishing_base_level`, table is empty!"); + sLog.outString(); return; } @@ -8147,15 +8145,15 @@ void ObjectMgr::LoadFishingBaseSkillLevel() delete result; - sLog.outString(); sLog.outString(">> Loaded %u areas for fishing base skill level", count); + sLog.outString(); } // Check if a player meets condition conditionId bool ObjectMgr::IsPlayerMeetToCondition(uint16 conditionId, Player const* pPlayer, Map const* map, WorldObject const* source, ConditionSource conditionSourceType) const { if (const PlayerCondition* condition = sConditionStorage.LookupEntry(conditionId)) - return condition->Meets(pPlayer, map, source, conditionSourceType); + { return condition->Meets(pPlayer, map, source, conditionSourceType); } return false; } @@ -8195,7 +8193,7 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co m_entry, m_condition, conditionSourceToStr[conditionSourceType], player ? player->GetGuidStr().c_str() : "", map ? map->GetId() : -1, source ? source->GetGuidStr().c_str() : ""); if (!CheckParamRequirements(player, map, source, conditionSourceType)) - return false; + { return false; } switch (m_condition) { @@ -8231,9 +8229,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co case CONDITION_TEAM: { if (conditionSourceType == CONDITION_FROM_REFERING_LOOT && sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) - return true; + { return true; } else - return uint32(player->GetTeam()) == m_value1; + { return uint32(player->GetTeam()) == m_value1; } } case CONDITION_SKILL: return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) >= m_value2; @@ -8246,7 +8244,7 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co Unit::SpellAuraHolderMap const& auras = player->GetSpellAuraHolderMap(); for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) if ((itr->second->GetSpellProto()->HasAttribute(SPELL_ATTR_CASTABLE_WHILE_MOUNTED) || itr->second->GetSpellProto()->HasAttribute(SPELL_ATTR_UNK4)) && itr->second->GetSpellProto()->SpellVisual[0] == 3580) - return true; + { return true; } return false; } case CONDITION_NO_AURA: @@ -8259,13 +8257,13 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co if (AreaTableEntry const* pAreaEntry = GetAreaEntryByAreaID(searcher->GetAreaId())) { if ((!m_value1 || (pAreaEntry->flags & m_value1)) && (!m_value2 || !(pAreaEntry->flags & m_value2))) - return true; + { return true; } } return false; } case CONDITION_RACE_CLASS: if ((!m_value1 || (player->getRaceMask() & m_value1)) && (!m_value2 || (player->getClassMask() & m_value2))) - return true; + { return true; } return false; case CONDITION_LEVEL: { @@ -8291,10 +8289,10 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co case CONDITION_INSTANCE_SCRIPT: { if (!map) - map = player ? player->GetMap() : source->GetMap(); + { map = player ? player->GetMap() : source->GetMap(); } if (InstanceData* data = map->GetInstanceData()) - return data->CheckConditionCriteriaMeet(player, m_value1, source, conditionSourceType); + { return data->CheckConditionCriteriaMeet(player, m_value1, source, conditionSourceType); } return false; } case CONDITION_QUESTAVAILABLE: @@ -8323,7 +8321,7 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co case CONDITION_QUEST_NONE: { if (!player->IsCurrentQuest(m_value1) && !player->GetQuestRewardStatus(m_value1)) - return true; + { return true; } return false; } case CONDITION_ITEM_WITH_BANK: @@ -8340,7 +8338,7 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co { // Already know the spell if (player->HasSpell(m_value1)) - return false; + { return false; } // If item defined, check if player has the item already. if (m_value2) @@ -8349,7 +8347,7 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co // a all-in-one check regarding items that learn some ability (primary/secondary tradeskills). // Commonly, items like this is unique and/or are not expected to be obtained more than once. if (player->HasItemCount(m_value2, 1, true)) - return false; + { return false; } } bool isSkillOk = false; @@ -8361,39 +8359,39 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co const SkillLineAbilityEntry* skillInfo = itr->second; if (!skillInfo) - continue; + { continue; } // doesn't have skill if (!player->HasSkill(skillInfo->skillId)) - return false; + { return false; } // doesn't match class if (skillInfo->classmask && (skillInfo->classmask & player->getClassMask()) == 0) - return false; + { return false; } // doesn't match race if (skillInfo->racemask && (skillInfo->racemask & player->getRaceMask()) == 0) - return false; + { return false; } // skill level too low if (skillInfo->min_value > player->GetSkillValue(skillInfo->skillId)) - return false; + { return false; } isSkillOk = true; break; } if (isSkillOk) - return true; + { return true; } return false; } case CONDITION_SKILL_BELOW: { if (m_value2 == 1) - return !player->HasSkill(m_value1); + { return !player->HasSkill(m_value1); } else - return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) < m_value2; + { return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) < m_value2; } } case CONDITION_REPUTATION_RANK_MAX: { @@ -8470,25 +8468,25 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co 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; + { return true; } if (Group const* grp = player->GetGroup()) { 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))) - return false; + { 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))) - return false; + { return false; } } return true; case 3: // Creature source is dead @@ -8563,10 +8561,10 @@ bool PlayerCondition::CheckParamRequirements(Player const* pPlayer, Map const* m return false; } if (m_value1 != 2) - return true; + { return true; } // Case 2 (Instance map only) if (!map && (pPlayer || source)) - map = source ? source->GetMap() : pPlayer->GetMap(); + { map = source ? source->GetMap() : pPlayer->GetMap(); } if (!map || !map->Instanceable()) { sLog.outErrorDb("CONDITION_DEAD_OR_AWAY %u (Player in instance case) - called from %s without map param or from non-instanceable map %i", m_entry, conditionSourceToStr[conditionSourceType], map ? map->GetId() : -1); @@ -8750,15 +8748,15 @@ bool PlayerCondition::IsValid(uint16 entry, ConditionType condition, uint32 valu } if (value2 && condition != CONDITION_QUESTTAKEN) - sLog.outErrorDb("Quest condition (entry %u, type %u) has useless data in value2 (%u)!", entry, condition, value2); + { sLog.outErrorDb("Quest condition (entry %u, type %u) has useless data in value2 (%u)!", entry, condition, value2); } break; } case CONDITION_AD_COMMISSION_AURA: { if (value1) - sLog.outErrorDb("Quest condition (entry %u, type %u) has useless data in value1 (%u)!", entry, condition, value1); + { sLog.outErrorDb("Quest condition (entry %u, type %u) has useless data in value1 (%u)!", entry, condition, value1); } if (value2) - sLog.outErrorDb("Quest condition (entry %u, type %u) has useless data in value2 (%u)!", entry, condition, value2); + { sLog.outErrorDb("Quest condition (entry %u, type %u) has useless data in value2 (%u)!", entry, condition, value2); } break; } case CONDITION_NO_AURA: @@ -8986,7 +8984,7 @@ bool PlayerCondition::CanBeUsedWithoutPlayer(uint16 entry) { PlayerCondition const* condition = sConditionStorage.LookupEntry(entry); if (!condition) - return false; + { return false; } switch (condition->m_condition) { @@ -9028,11 +9026,11 @@ SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial) case SKILL_CATEGORY_PROFESSION: // not set skills for professions and racial abilities if (IsProfessionSkill(pSkill->id)) - return SKILL_RANGE_RANK; + { return SKILL_RANGE_RANK; } else if (racial) - return SKILL_RANGE_NONE; + { return SKILL_RANGE_NONE; } else - return SKILL_RANGE_MONO; + { return SKILL_RANGE_MONO; } default: case SKILL_CATEGORY_ATTRIBUTES: // not found in dbc case SKILL_CATEGORY_GENERIC: // only GENERIC(DND) @@ -9050,11 +9048,9 @@ void ObjectMgr::LoadGameTele() if (!result) { BarGoLink bar(1); - bar.step(); - - sLog.outString(); sLog.outErrorDb(">> Loaded `game_tele`, table is empty!"); + sLog.outString(); return; } @@ -9098,8 +9094,8 @@ void ObjectMgr::LoadGameTele() while (result->NextRow()); delete result; - sLog.outString(); sLog.outString(">> Loaded %u GameTeleports", count); + sLog.outString(); } GameTele const* ObjectMgr::GetGameTele(const std::string& name) const @@ -9107,7 +9103,7 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const // explicit name case std::wstring wname; if (!Utf8toWStr(name, wname)) - return NULL; + { return NULL; } // converting string that we try to find to lower case wstrToLower(wname); @@ -9116,9 +9112,9 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const const GameTele* alt = NULL; for (GameTeleMap::const_iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr) if (itr->second.wnameLow == wname) - return &itr->second; + { return &itr->second; } else if (alt == NULL && itr->second.wnameLow.find(wname) != std::wstring::npos) - alt = &itr->second; + { alt = &itr->second; } return alt; } @@ -9129,13 +9125,13 @@ bool ObjectMgr::AddGameTele(GameTele& tele) uint32 new_id = 0; for (GameTeleMap::const_iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr) if (itr->first > new_id) - new_id = itr->first; + { new_id = itr->first; } // use next ++new_id; if (!Utf8toWStr(tele.name, tele.wnameLow)) - return false; + { return false; } wstrToLower(tele.wnameLow); @@ -9155,7 +9151,7 @@ bool ObjectMgr::DeleteGameTele(const std::string& name) // explicit name case std::wstring wname; if (!Utf8toWStr(name, wname)) - return false; + { return false; } // converting string that we try to find to lower case wstrToLower(wname); @@ -9245,7 +9241,7 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates) // For reload case for (CacheTrainerSpellMap::iterator itr = trainerList.begin(); itr != trainerList.end(); ++itr) - itr->second.Clear(); + { itr->second.Clear(); } trainerList.clear(); std::set skip_trainers; @@ -9255,11 +9251,9 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates) if (!result) { BarGoLink bar(1); - bar.step(); - - sLog.outString(); sLog.outString(">> Loaded `%s`, table is empty!", tableName); + sLog.outString(); return; } @@ -9399,13 +9393,12 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates) } ++count; - } while (result->NextRow()); delete result; - sLog.outString(); sLog.outString(">> Loaded %d trainer %sspells", count, isTemplates ? "template " : ""); + sLog.outString(); } void ObjectMgr::LoadTrainerTemplates() @@ -9429,7 +9422,7 @@ void ObjectMgr::LoadTrainerTemplates() { trainer_ids.erase(cInfo->TrainerTemplateId); } else { - sLog.outErrorDb("Creature (Entry: %u) has TrainerTemplateId = %u for nonexistent trainer template", cInfo->Entry, cInfo->TrainerTemplateId); + sLog.outErrorDb("Creature (Entry: %u) has `TrainerTemplateId` = %u for nonexistent trainer template", cInfo->Entry, cInfo->TrainerTemplateId); hasErrored = true; } } @@ -9449,7 +9442,7 @@ void ObjectMgr::LoadVendors(char const* tableName, bool isTemplates) // For reload case for (CacheVendorItemMap::iterator itr = vendorList.begin(); itr != vendorList.end(); ++itr) - itr->second.Clear(); + { itr->second.Clear(); } vendorList.clear(); std::set skip_vendors; @@ -9483,19 +9476,18 @@ void ObjectMgr::LoadVendors(char const* tableName, bool isTemplates) uint16 conditionId = fields[5].GetUInt16(); if (!IsVendorItemValid(isTemplates, tableName, entry, item_id, type, maxcount, incrtime, ExtendedCost, conditionId, NULL, &skip_vendors)) - continue; + { continue; } VendorItemData& vList = vendorList[entry]; vList.AddItem(item_id, type, maxcount, incrtime, ExtendedCost, conditionId); ++count; - } while (result->NextRow()); delete result; - sLog.outString(); sLog.outString(">> Loaded %u vendor %sitems", count, isTemplates ? "template " : ""); + sLog.outString(); } @@ -9507,7 +9499,7 @@ void ObjectMgr::LoadVendorTemplates() std::set vendor_ids; for (CacheVendorItemMap::const_iterator vItr = m_mCacheVendorTemplateItemMap.begin(); vItr != m_mCacheVendorTemplateItemMap.end(); ++vItr) - vendor_ids.insert(vItr->first); + { vendor_ids.insert(vItr->first); } for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) { @@ -9516,15 +9508,15 @@ void ObjectMgr::LoadVendorTemplates() if (cInfo->VendorTemplateId) { if (m_mCacheVendorTemplateItemMap.find(cInfo->VendorTemplateId) != m_mCacheVendorTemplateItemMap.end()) - vendor_ids.erase(cInfo->VendorTemplateId); + { vendor_ids.erase(cInfo->VendorTemplateId); } else - sLog.outErrorDb("Creature (Entry: %u) has VendorTemplateId = %u for nonexistent vendor template", cInfo->Entry, cInfo->VendorTemplateId); + sLog.outErrorDb("Creature (Entry: %u) has `VendorTemplateId` = %u for nonexistent vendor template", cInfo->Entry, cInfo->VendorTemplateId); } } } for (std::set::const_iterator vItr = vendor_ids.begin(); vItr != vendor_ids.end(); ++vItr) - sLog.outErrorDb("Table `npc_vendor_template` has vendor template %u not used by any vendors ", *vItr); + { sLog.outErrorDb("Table `npc_vendor_template` has vendor template %u not used by any vendors ", *vItr); } } /* This function is supposed to take care of three things: @@ -9699,11 +9691,11 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) { for (GossipMenusMap::const_iterator itr = m_mGossipMenusMap.begin(); itr != m_mGossipMenusMap.end(); ++itr) if (itr->first) - menu_ids.insert(itr->first); + { menu_ids.insert(itr->first); } for (SQLStorageBase::SQLSIterator itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) if (uint32 menuid = itr->GetGossipMenuId()) - menu_ids.erase(menuid); + { menu_ids.erase(menuid); } } // loading @@ -9722,7 +9714,7 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) // unused check data preparing part if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) - menu_ids.erase(cInfo->GossipMenuId); + { menu_ids.erase(cInfo->GossipMenuId); } } do @@ -9760,9 +9752,9 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) if (gMenuItem.action_menu_id > 0) { if (m_mGossipMenusMap.find(gMenuItem.action_menu_id) == m_mGossipMenusMap.end()) - sLog.outErrorDb("Gossip menu option (MenuId: %u Id: %u) have action_menu_id = %u for nonexistent menu", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_menu_id); + { sLog.outErrorDb("Gossip menu option (MenuId: %u Id: %u) have action_menu_id = %u for nonexistent menu", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_menu_id); } else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) - menu_ids.erase(gMenuItem.action_menu_id); + { menu_ids.erase(gMenuItem.action_menu_id); } } if (gMenuItem.option_icon >= GOSSIP_ICON_MAX) @@ -9772,10 +9764,10 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) } if (gMenuItem.option_id == GOSSIP_OPTION_NONE) - sLog.outErrorDb("Table gossip_menu_option for menu %u, id %u use option id GOSSIP_OPTION_NONE. Option will never be used", gMenuItem.menu_id, gMenuItem.id); + { sLog.outErrorDb("Table gossip_menu_option for menu %u, id %u use option id GOSSIP_OPTION_NONE. Option will never be used", gMenuItem.menu_id, gMenuItem.id); } if (gMenuItem.option_id >= GOSSIP_OPTION_MAX) - sLog.outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.menu_id, gMenuItem.id, gMenuItem.option_id); + { sLog.outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.menu_id, gMenuItem.id, gMenuItem.option_id); } if (gMenuItem.menu_id && gMenuItem.npc_option_NpcFlags) { @@ -9791,11 +9783,11 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) // some from creatures with gossip menu can use gossip option base at npc_flags if (gMenuItem.npc_option_NpcFlags & cInfo->NpcFlags) - found_flags_uses = true; + { found_flags_uses = true; } } if (found_menu_uses && !found_flags_uses) - sLog.outErrorDb("Table gossip_menu_option for menu %u, id %u has `npc_option_npcflag` = %u but creatures using this menu does not have corresponding `NpcFlags`. Option will not accessible in game.", gMenuItem.menu_id, gMenuItem.id, gMenuItem.npc_option_NpcFlags); + { sLog.outErrorDb("Table gossip_menu_option for menu %u, id %u has `npc_option_npcflag` = %u but creatures using this menu does not have corresponding`npcflag`. Option will not accessible in game.", gMenuItem.menu_id, gMenuItem.id, gMenuItem.npc_option_NpcFlags); } } if (gMenuItem.action_poi_id && !GetPointOfInterest(gMenuItem.action_poi_id)) @@ -9841,7 +9833,7 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) { for (std::set::const_iterator itr = menu_ids.begin(); itr != menu_ids.end(); ++itr) - sLog.outErrorDb("Table `gossip_menu` contain unused (in creature or GO or menu options) menu id %u.", *itr); + { sLog.outErrorDb("Table `gossip_menu` contain unused (in creature or GO or menu options) menu id %u.", *itr); } } sLog.outString(">> Loaded %u gossip_menu_option entries", count); @@ -9881,10 +9873,10 @@ bool ObjectMgr::RemoveVendorItem(uint32 entry, uint32 item, uint8 type) { CacheVendorItemMap::iterator iter = m_mCacheVendorItemMap.find(entry); if (iter == m_mCacheVendorItemMap.end()) - return false; + { return false; } if (!iter->second.RemoveItem(item, type)) - return false; + { return false; } WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%i'", entry, type == VENDOR_ITEM_TYPE_CURRENCY ? -int32(item) : item); return true; @@ -10249,17 +10241,18 @@ void ObjectMgr::RemoveArenaTeam(uint32 Id) mArenaTeamMap.erase(Id); } + void ObjectMgr::GetCreatureLocaleStrings(uint32 entry, int32 loc_idx, char const** namePtr, char const** subnamePtr) const { if (loc_idx >= 0) { - if (CreatureLocale const* il = GetCreatureLocale(entry)) + if (CreatureLocale const *il = GetCreatureLocale(entry)) { if (namePtr && il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty()) - *namePtr = il->Name[loc_idx].c_str(); + { *namePtr = il->Name[loc_idx].c_str(); } if (subnamePtr && il->SubName.size() > size_t(loc_idx) && !il->SubName[loc_idx].empty()) - *subnamePtr = il->SubName[loc_idx].c_str(); + { *subnamePtr = il->SubName[loc_idx].c_str(); } } } } @@ -10268,13 +10261,13 @@ void ObjectMgr::GetItemLocaleStrings(uint32 entry, int32 loc_idx, std::string* n { if (loc_idx >= 0) { - if (ItemLocale const* il = GetItemLocale(entry)) + if (ItemLocale const *il = GetItemLocale(entry)) { if (namePtr && il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty()) - *namePtr = il->Name[loc_idx]; + { *namePtr = il->Name[loc_idx]; } if (descriptionPtr && il->Description.size() > size_t(loc_idx) && !il->Description[loc_idx].empty()) - *descriptionPtr = il->Description[loc_idx]; + { *descriptionPtr = il->Description[loc_idx]; } } } } @@ -10283,10 +10276,10 @@ void ObjectMgr::GetQuestLocaleStrings(uint32 entry, int32 loc_idx, std::string* { if (loc_idx >= 0) { - if (QuestLocale const* il = GetQuestLocale(entry)) + if (QuestLocale const *il = GetQuestLocale(entry)) { if (titlePtr && il->Title.size() > size_t(loc_idx) && !il->Title[loc_idx].empty()) - *titlePtr = il->Title[loc_idx]; + { *titlePtr = il->Title[loc_idx]; } } } } @@ -10295,17 +10288,17 @@ void ObjectMgr::GetNpcTextLocaleStringsAll(uint32 entry, int32 loc_idx, ObjectMg { if (loc_idx >= 0) { - if (NpcTextLocale const* nl = GetNpcTextLocale(entry)) + if (NpcTextLocale const *nl = GetNpcTextLocale(entry)) { if (text0_Ptr) for (int i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i) if (nl->Text_0[i].size() > (size_t)loc_idx && !nl->Text_0[i][loc_idx].empty()) - (*text0_Ptr)[i] = nl->Text_0[i][loc_idx]; + { (*text0_Ptr)[i] = nl->Text_0[i][loc_idx]; } if (text1_Ptr) for (int i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i) if (nl->Text_1[i].size() > (size_t)loc_idx && !nl->Text_1[i][loc_idx].empty()) - (*text1_Ptr)[i] = nl->Text_1[i][loc_idx]; + { (*text1_Ptr)[i] = nl->Text_1[i][loc_idx]; } } } } @@ -10314,15 +10307,15 @@ void ObjectMgr::GetNpcTextLocaleStrings0(uint32 entry, int32 loc_idx, std::strin { if (loc_idx >= 0) { - if (NpcTextLocale const* nl = GetNpcTextLocale(entry)) + if (NpcTextLocale const *nl = GetNpcTextLocale(entry)) { if (text0_0_Ptr) if (nl->Text_0[0].size() > (size_t)loc_idx && !nl->Text_0[0][loc_idx].empty()) - *text0_0_Ptr = nl->Text_0[0][loc_idx]; + { *text0_0_Ptr = nl->Text_0[0][loc_idx]; } if (text1_0_Ptr) if (nl->Text_1[0].size() > (size_t)loc_idx && !nl->Text_1[0][loc_idx].empty()) - *text1_0_Ptr = nl->Text_1[0][loc_idx]; + { *text1_0_Ptr = nl->Text_1[0][loc_idx]; } } } } @@ -10385,18 +10378,18 @@ bool FindCreatureData::operator()(CreatureDataPair const& dataPair) { // skip wrong entry ids if (i_id && dataPair.second.id != i_id) - return false; + { return false; } if (!i_anyData) - i_anyData = &dataPair; + { i_anyData = &dataPair; } // without player we can't find more stricted cases, so use fouded if (!i_player) - return true; + { return true; } // skip diff. map cases if (dataPair.second.mapid != i_player->GetMapId()) - return false; + { return false; } float new_dist = i_player->GetDistance2d(dataPair.second.posX, dataPair.second.posY); @@ -10433,15 +10426,15 @@ bool DoDisplayText(WorldObject* source, int32 entry, Unit const* target /*=NULL* if (data->SoundId) { if (data->Type == CHAT_TYPE_ZONE_YELL) - source->GetMap()->PlayDirectSoundToMap(data->SoundId, source->GetZoneId()); + { source->GetMap()->PlayDirectSoundToMap(data->SoundId, source->GetZoneId()); } else if (data->Type == CHAT_TYPE_WHISPER || data->Type == CHAT_TYPE_BOSS_WHISPER) { // An error will be displayed for the text if (target && target->GetTypeId() == TYPEID_PLAYER) - source->PlayDirectSound(data->SoundId, (Player const*)target); + { source->PlayDirectSound(data->SoundId, (Player const*)target); } } else - source->PlayDirectSound(data->SoundId); + { source->PlayDirectSound(data->SoundId); } } if (data->Emote) @@ -10459,7 +10452,7 @@ bool DoDisplayText(WorldObject* source, int32 entry, Unit const* target /*=NULL* if ((data->Type == CHAT_TYPE_WHISPER || data->Type == CHAT_TYPE_BOSS_WHISPER) && (!target || target->GetTypeId() != TYPEID_PLAYER)) { - _DoStringError(entry, "DoDisplayText entry %i cannot whisper without target unit (TYPEID_PLAYER).", entry); + _DoStringError(entry, "DoDisplayText entry %i can not whisper without target unit (TYPEID_PLAYER).", entry); return false; } diff --git a/src/game/Object/ObjectMgr.h b/src/game/Object/ObjectMgr.h index 7e1953483..5fc645016 100644 --- a/src/game/Object/ObjectMgr.h +++ b/src/game/Object/ObjectMgr.h @@ -216,8 +216,10 @@ typedef std::pair= MAX_RACES) return NULL; - if (class_ >= MAX_CLASSES) return NULL; + if (race >= MAX_RACES) { return NULL; } + if (class_ >= MAX_CLASSES) { return NULL; } PlayerInfo const* info = &playerInfo[race][class_]; - if (info->displayId_m == 0 || info->displayId_f == 0) return NULL; + if (info->displayId_m == 0 || info->displayId_f == 0) { return NULL; } return info; } void GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, PlayerLevelInfo* info) const; @@ -629,13 +640,16 @@ class ObjectMgr QuestMap::const_iterator itr = mQuestTemplates.find(quest_id); return itr != mQuestTemplates.end() ? itr->second : NULL; } - QuestMap const& GetQuestTemplates() const { return mQuestTemplates; } + QuestMap const& GetQuestTemplates() const + { + return mQuestTemplates; + } uint32 GetQuestForAreaTrigger(uint32 Trigger_ID) const { QuestAreaTriggerMap::const_iterator itr = mQuestAreaTriggerMap.find(Trigger_ID); if (itr != mQuestAreaTriggerMap.end()) - return itr->second; + { return itr->second; } return 0; } bool IsTavernAreaTrigger(uint32 Trigger_ID) const @@ -660,7 +674,7 @@ class ObjectMgr { AreaTriggerMap::const_iterator itr = mAreaTriggers.find(trigger); if (itr != mAreaTriggers.end()) - return &itr->second; + { return &itr->second; } return NULL; } @@ -671,7 +685,7 @@ class ObjectMgr { RepRewardRateMap::const_iterator itr = m_RepRewardRateMap.find(factionId); if (itr != m_RepRewardRateMap.end()) - return &itr->second; + { return &itr->second; } return NULL; } @@ -680,7 +694,7 @@ class ObjectMgr { RepOnKillMap::const_iterator itr = mRepOnKill.find(id); if (itr != mRepOnKill.end()) - return &itr->second; + { return &itr->second; } return NULL; } @@ -688,7 +702,7 @@ class ObjectMgr { RepSpilloverTemplateMap::const_iterator itr = m_RepSpilloverTemplateMap.find(factionId); if (itr != m_RepSpilloverTemplateMap.end()) - return &itr->second; + { return &itr->second; } return NULL; } @@ -697,7 +711,7 @@ class ObjectMgr { PointOfInterestMap::const_iterator itr = mPointsOfInterest.find(id); if (itr != mPointsOfInterest.end()) - return &itr->second; + { return &itr->second; } return NULL; } @@ -721,9 +735,7 @@ class ObjectMgr { DungeonFinderRewardsMap::const_iterator itr = mDungeonFinderRewardsMap.find(level); if (itr != mDungeonFinderRewardsMap.end()) - { - return &itr->second; - } + { return &itr->second; } return NULL; } @@ -761,7 +773,10 @@ class ObjectMgr void LoadCreatureInvolvedRelations(); bool LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value, bool extra_content); - bool LoadMangosStrings() { return LoadMangosStrings(WorldDatabase, "mangos_string", MIN_MANGOS_STRING_ID, MAX_MANGOS_STRING_ID, false); } + bool LoadMangosStrings() + { + return LoadMangosStrings(WorldDatabase, "mangos_string", MIN_MANGOS_STRING_ID, MAX_MANGOS_STRING_ID, false); + } void LoadCreatureLocales(); void LoadCreatureTemplates(); void LoadCreatures(); @@ -826,10 +841,15 @@ class ObjectMgr void LoadGossipMenus(); void LoadVendorTemplates(); - void LoadVendors() { LoadVendors("npc_vendor", false); } + void LoadVendors() + { + LoadVendors("npc_vendor", false); + } void LoadTrainerTemplates(); - void LoadTrainers() { LoadTrainers("npc_trainer", false); } - + void LoadTrainers() + { + LoadTrainers("npc_trainer", false); + } /// @param _map Map* of the map for which to load active entities. If NULL active entities on continents are loaded void LoadActiveEntities(Map* _map); @@ -851,26 +871,63 @@ class ObjectMgr void SetHighestGuids(); // used for set initial guid counter for map local guids - uint32 GetFirstTemporaryCreatureLowGuid() const { return m_FirstTemporaryCreatureGuid; } - uint32 GetFirstTemporaryGameObjectLowGuid() const { return m_FirstTemporaryGameObjectGuid; } + uint32 GetFirstTemporaryCreatureLowGuid() const + { + return m_FirstTemporaryCreatureGuid; + } + uint32 GetFirstTemporaryGameObjectLowGuid() const + { + return m_FirstTemporaryGameObjectGuid; + } // used in .npc add/.gobject add commands for adding static spawns - uint32 GenerateStaticCreatureLowGuid() { if (m_StaticCreatureGuids.GetNextAfterMaxUsed() >= m_FirstTemporaryCreatureGuid) return 0; return m_StaticCreatureGuids.Generate(); } - uint32 GenerateStaticGameObjectLowGuid() { if (m_StaticGameObjectGuids.GetNextAfterMaxUsed() >= m_FirstTemporaryGameObjectGuid) return 0; return m_StaticGameObjectGuids.Generate(); } + uint32 GenerateStaticCreatureLowGuid() + { + if (m_StaticCreatureGuids.GetNextAfterMaxUsed() >= m_FirstTemporaryCreatureGuid) + { return 0; } + return m_StaticCreatureGuids.Generate(); + } + uint32 GenerateStaticGameObjectLowGuid() + { + if (m_StaticGameObjectGuids.GetNextAfterMaxUsed() >= m_FirstTemporaryGameObjectGuid) + { return 0; } + return m_StaticGameObjectGuids.Generate(); + } - uint32 GeneratePlayerLowGuid() { return m_CharGuids.Generate(); } - uint32 GenerateItemLowGuid() { return m_ItemGuids.Generate(); } - uint32 GenerateCorpseLowGuid() { return m_CorpseGuids.Generate(); } + uint32 GeneratePlayerLowGuid() + { + return m_CharGuids.Generate(); + } + uint32 GenerateItemLowGuid() + { + return m_ItemGuids.Generate(); + } + uint32 GenerateCorpseLowGuid() + { + return m_CorpseGuids.Generate(); + } uint32 GenerateInstanceLowGuid() { return m_InstanceGuids.Generate(); } uint32 GenerateGroupLowGuid() { return m_GroupGuids.Generate(); } uint32 GenerateArenaTeamId() { return m_ArenaTeamIds.Generate(); } - uint32 GenerateAuctionID() { return m_AuctionIds.Generate(); } + uint32 GenerateAuctionID() + { + return m_AuctionIds.Generate(); + } uint64 GenerateEquipmentSetGuid() { return m_EquipmentSetIds.Generate(); } - uint32 GenerateGuildId() { return m_GuildIds.Generate(); } + uint32 GenerateGuildId() + { + return m_GuildIds.Generate(); + } // uint32 GenerateItemTextID() { return m_ItemGuids.Generate(); } - uint32 GenerateMailID() { return m_MailIds.Generate(); } - uint32 GeneratePetNumber() { return m_PetNumbers.Generate(); } + uint32 GenerateMailID() + { + return m_MailIds.Generate(); + } + uint32 GeneratePetNumber() + { + return m_PetNumbers.Generate(); + } MailLevelReward const* GetMailLevelReward(uint32 level, uint32 raceMask) { @@ -888,7 +945,7 @@ class ObjectMgr CreatureDataPair const* GetCreatureDataPair(uint32 guid) const { CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid); - if (itr == mCreatureDataMap.end()) return NULL; + if (itr == mCreatureDataMap.end()) { return NULL; } return &*itr; } @@ -898,7 +955,10 @@ class ObjectMgr return dataPair ? &dataPair->second : NULL; } - CreatureData& NewOrExistCreatureData(uint32 guid) { return mCreatureDataMap[guid]; } + CreatureData& NewOrExistCreatureData(uint32 guid) + { + return mCreatureDataMap[guid]; + } void DeleteCreatureData(uint32 guid); template @@ -906,13 +966,13 @@ class ObjectMgr { for (CreatureDataMap::const_iterator itr = mCreatureDataMap.begin(); itr != mCreatureDataMap.end(); ++itr) if (worker(*itr)) - break; + { break; } } CreatureLocale const* GetCreatureLocale(uint32 entry) const { CreatureLocaleMap::const_iterator itr = mCreatureLocaleMap.find(entry); - if (itr == mCreatureLocaleMap.end()) return NULL; + if (itr == mCreatureLocaleMap.end()) { return NULL; } return &itr->second; } @@ -921,14 +981,14 @@ class ObjectMgr GameObjectLocale const* GetGameObjectLocale(uint32 entry) const { GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry); - if (itr == mGameObjectLocaleMap.end()) return NULL; + if (itr == mGameObjectLocaleMap.end()) { return NULL; } return &itr->second; } ItemLocale const* GetItemLocale(uint32 entry) const { ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry); - if (itr == mItemLocaleMap.end()) return NULL; + if (itr == mItemLocaleMap.end()) { return NULL; } return &itr->second; } @@ -937,7 +997,7 @@ class ObjectMgr QuestLocale const* GetQuestLocale(uint32 entry) const { QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry); - if (itr == mQuestLocaleMap.end()) return NULL; + if (itr == mQuestLocaleMap.end()) { return NULL; } return &itr->second; } @@ -946,39 +1006,39 @@ class ObjectMgr NpcTextLocale const* GetNpcTextLocale(uint32 entry) const { NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry); - if (itr == mNpcTextLocaleMap.end()) return NULL; + if (itr == mNpcTextLocaleMap.end()) { return NULL; } return &itr->second; } typedef std::string NpcTextArray[MAX_GOSSIP_TEXT_OPTIONS]; - void GetNpcTextLocaleStringsAll(uint32 entry, int32 loc_idx, NpcTextArray* text0_Ptr, NpcTextArray* text1_Ptr) const; + void GetNpcTextLocaleStringsAll(uint32 entry, int32 loc_idx, NpcTextArray *text0_Ptr, NpcTextArray* text1_Ptr) const; void GetNpcTextLocaleStrings0(uint32 entry, int32 loc_idx, std::string* text0_0_Ptr, std::string* text1_0_Ptr) const; PageTextLocale const* GetPageTextLocale(uint32 entry) const { PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry); - if (itr == mPageTextLocaleMap.end()) return NULL; + if (itr == mPageTextLocaleMap.end()) { return NULL; } return &itr->second; } GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const { GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry); - if (itr == mGossipMenuItemsLocaleMap.end()) return NULL; + if (itr == mGossipMenuItemsLocaleMap.end()) { return NULL; } return &itr->second; } PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const { PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id); - if (itr == mPointOfInterestLocaleMap.end()) return NULL; + if (itr == mPointOfInterestLocaleMap.end()) { return NULL; } return &itr->second; } GameObjectDataPair const* GetGODataPair(uint32 guid) const { GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid); - if (itr == mGameObjectDataMap.end()) return NULL; + if (itr == mGameObjectDataMap.end()) { return NULL; } return &*itr; } @@ -988,7 +1048,10 @@ class ObjectMgr return dataPair ? &dataPair->second : NULL; } - GameObjectData& NewGOData(uint32 guid) { return mGameObjectDataMap[guid]; } + GameObjectData& NewGOData(uint32 guid) + { + return mGameObjectDataMap[guid]; + } void DeleteGOData(uint32 guid); template @@ -996,21 +1059,20 @@ class ObjectMgr { for (GameObjectDataMap::const_iterator itr = mGameObjectDataMap.begin(); itr != mGameObjectDataMap.end(); ++itr) if (worker(*itr)) // arg = GameObjectDataPair - break; + { break; } } MangosStringLocale const* GetMangosStringLocale(int32 entry) const { MangosStringLocaleMap::const_iterator itr = mMangosStringLocaleMap.find(entry); - if (itr == mMangosStringLocaleMap.end()) return NULL; + if (itr == mMangosStringLocaleMap.end()) { return NULL; } return &itr->second; } - uint32 GetLoadedStringsCount(int32 minEntry) const { std::map::const_iterator itr = m_loadedStringCount.find(minEntry); if (itr != m_loadedStringCount.end()) - return itr->second; + { return itr->second; } return 0; } @@ -1056,12 +1118,15 @@ class ObjectMgr GameTele const* GetGameTele(uint32 id) const { GameTeleMap::const_iterator itr = m_GameTeleMap.find(id); - if (itr == m_GameTeleMap.end()) return NULL; + if (itr == m_GameTeleMap.end()) { return NULL; } return &itr->second; } GameTele const* GetGameTele(const std::string& name) const; - GameTeleMap const& GetGameTeleMap() const { return m_GameTeleMap; } + GameTeleMap const& GetGameTeleMap() const + { + return m_GameTeleMap; + } bool AddGameTele(GameTele& data); bool DeleteGameTele(const std::string& name); @@ -1069,7 +1134,7 @@ class ObjectMgr { CacheNpcTextIdMap::const_iterator iter = m_mCacheNpcTextIdMap.find(entry); if (iter == m_mCacheNpcTextIdMap.end()) - return 0; + { return 0; } return iter->second; } @@ -1078,7 +1143,7 @@ class ObjectMgr { CacheTrainerSpellMap::const_iterator iter = m_mCacheTrainerSpellMap.find(entry); if (iter == m_mCacheTrainerSpellMap.end()) - return NULL; + { return NULL; } return &iter->second; } @@ -1087,7 +1152,7 @@ class ObjectMgr { CacheTrainerSpellMap::const_iterator iter = m_mCacheTrainerTemplateSpellMap.find(entry); if (iter == m_mCacheTrainerTemplateSpellMap.end()) - return NULL; + { return NULL; } return &iter->second; } @@ -1096,7 +1161,7 @@ class ObjectMgr { CacheVendorItemMap::const_iterator iter = m_mCacheVendorItemMap.find(entry); if (iter == m_mCacheVendorItemMap.end()) - return NULL; + { return NULL; } return &iter->second; } @@ -1105,7 +1170,7 @@ class ObjectMgr { CacheVendorItemMap::const_iterator iter = m_mCacheVendorTemplateItemMap.find(entry); if (iter == m_mCacheVendorTemplateItemMap.end()) - return NULL; + { return NULL; } return &iter->second; } @@ -1190,14 +1255,16 @@ class ObjectMgr return m_GOQuestInvolvedRelations.equal_range(entry); } - QuestRelationsMap& GetCreatureQuestRelationsMap() { return m_CreatureQuestRelations; } - + QuestRelationsMap& GetCreatureQuestRelationsMap() + { + return m_CreatureQuestRelations; + } uint32 GetModelForRace(uint32 sourceModelId, uint32 racemask); /** * \brief: Data returned is used to compute health, mana, armor, damage of creatures. May be NULL. * \param uint32 level creature level * \param uint32 unitClass creature class, related to CLASSMASK_ALL_CREATURES - * \param uint32 expansion creature expansion (we could have creature exp = 0 for wotlk as well as exp = 1 or exp = 2) + * \param uint32 expansion creature expansion (we could have creature exp = 0 for vanilla, exp = 1 for tbc, exp = 2 for wotlk) * \return: CreatureClassLvlStats const* or NULL * * Description: GetCreatureClassLvlStats give fast access to creature stats data. @@ -1358,7 +1425,7 @@ class ObjectMgr NpcTextLocaleMap mNpcTextLocaleMap; PageTextLocaleMap mPageTextLocaleMap; MangosStringLocaleMap mMangosStringLocaleMap; - std::map m_loadedStringCount; + std::map < int32 /*minEntryOfBracket*/, uint32 /*count*/ > m_loadedStringCount; GossipMenuItemsLocaleMap mGossipMenuItemsLocaleMap; PointOfInterestLocaleMap mPointOfInterestLocaleMap; DungeonEncounterMap m_DungeonEncounters; diff --git a/src/game/WorldHandlers/Map.cpp b/src/game/WorldHandlers/Map.cpp index c62960675..45e5dc219 100644 --- a/src/game/WorldHandlers/Map.cpp +++ b/src/game/WorldHandlers/Map.cpp @@ -358,7 +358,7 @@ Map::Add(T* obj) obj->SetMap(this); Cell cell(p); - if (obj->isActiveObject()) + if (obj->IsActiveObject()) { EnsureGridLoadedAtEnter(cell); } else { EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); } @@ -369,7 +369,7 @@ Map::Add(T* obj) AddToGrid(obj, grid, cell); obj->AddToWorld(); - if (obj->isActiveObject()) + if (obj->IsActiveObject()) { AddToActive(obj); } DEBUG_LOG("%s enters grid[%u,%u]", obj->GetGuidStr().c_str(), cell.GridX(), cell.GridY()); @@ -685,7 +685,7 @@ Map::Remove(T* obj, bool remove) NGridType* grid = getNGrid(cell.GridX(), cell.GridY()); MANGOS_ASSERT(grid != NULL); - if (obj->isActiveObject()) + if (obj->IsActiveObject()) { RemoveFromActive(obj); } if (remove) @@ -776,7 +776,7 @@ bool Map::CreatureCellRelocation(Creature* c, const Cell& new_cell) Cell const& old_cell = c->GetCurrentCell(); if (old_cell.DiffGrid(new_cell)) { - if (!c->isActiveObject() && !loaded(new_cell.gridPair())) + if (!c->IsActiveObject() && !loaded(new_cell.gridPair())) { DEBUG_FILTER_LOG(LOG_FILTER_CREATURE_MOVES, "Creature (GUID: %u Entry: %u) attempt move from grid[%u,%u]cell[%u,%u] to unloaded grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); return false; diff --git a/src/game/WorldHandlers/ObjectGridLoader.cpp b/src/game/WorldHandlers/ObjectGridLoader.cpp index e75c853a4..e86b74c06 100644 --- a/src/game/WorldHandlers/ObjectGridLoader.cpp +++ b/src/game/WorldHandlers/ObjectGridLoader.cpp @@ -134,7 +134,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair& cell, GridRefManager& addUnitState(obj, cell); obj->SetMap(map); obj->AddToWorld(); - if (obj->isActiveObject()) + if (obj->IsActiveObject()) map->AddToActive(obj); obj->GetViewPoint().Event_AddedToWorld(&grid); @@ -167,7 +167,7 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellPair& cell, CorpseMapType addUnitState(obj, cell); obj->SetMap(map); obj->AddToWorld(); - if (obj->isActiveObject()) + if (obj->IsActiveObject()) map->AddToActive(obj); ++count; diff --git a/src/game/movement/MoveSpline.cpp b/src/game/movement/MoveSpline.cpp index de58217d1..857788c76 100644 --- a/src/game/movement/MoveSpline.cpp +++ b/src/game/movement/MoveSpline.cpp @@ -178,7 +178,7 @@ namespace Movement time_passed = 0; vertical_acceleration = 0.f; effect_start_time = 0; - + // detect Stop command if (splineflags.done) { diff --git a/src/game/movement/MoveSplineInit.cpp b/src/game/movement/MoveSplineInit.cpp index 91f9c9a0a..a9f331b30 100644 --- a/src/game/movement/MoveSplineInit.cpp +++ b/src/game/movement/MoveSplineInit.cpp @@ -68,10 +68,10 @@ namespace Movement if (transportInfo) transportInfo->GetLocalPosition(real_position.x, real_position.y, real_position.z, real_position.orientation); - // there is a big chane that current position is unknown if current state is not finalized, need compute it + // there is a big chance that current position is unknown if current state is not finalized, need compute it // this also allows calculate spline position and update map position in much greater intervals if (!move_spline.Finalized() && !transportInfo) - real_position = move_spline.ComputePosition(); + { real_position = move_spline.ComputePosition(); } if (args.path.empty()) { @@ -92,10 +92,10 @@ namespace Movement moveFlags |= MOVEFLAG_FORWARD; if (args.velocity == 0.f) - args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags)); + { args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags)); } if (!args.Validate(&unit)) - return 0; + { return 0; } unit.m_movementInfo.SetMovementFlags((MovementFlags)moveFlags); move_spline.Initialize(args); @@ -132,7 +132,7 @@ namespace Movement if (transportInfo) transportInfo->GetLocalPosition(real_position.x, real_position.y, real_position.z, real_position.orientation); - // there is a big chane that current position is unknown if current state is not finalized, need compute it + // there is a big chance that current position is unknown if current state is not finalized, need compute it // this also allows calculate spline position and update map position in much greater intervals if (!move_spline.Finalized() && !transportInfo) real_position = move_spline.ComputePosition(); @@ -143,7 +143,7 @@ namespace Movement MoveTo(real_position); } - // corrent first vertex + // current first vertex args.path[0] = real_position; args.flags = MoveSplineFlag::Done; diff --git a/src/game/movement/MoveSplineInit.h b/src/game/movement/MoveSplineInit.h index 0a5c86da3..aaddc3602 100644 --- a/src/game/movement/MoveSplineInit.h +++ b/src/game/movement/MoveSplineInit.h @@ -43,7 +43,7 @@ namespace Movement * @brief Initializes and launches spline movement * */ - class MANGOS_DLL_SPEC MoveSplineInit + class MoveSplineInit { public: @@ -60,8 +60,11 @@ namespace Movement * @return int32 duration - estimated travel time */ int32 Launch(); - - /* Stop any creature movement */ + + /** + * @brief Stop any creature movement + * + */ void Stop(); /* Adds movement by parabolic trajectory @@ -75,7 +78,7 @@ namespace Movement */ void SetAnimation(AnimType anim); - /** + /* * @brief Adds final facing animation * sets unit's facing to specified point/angle after all path done. * you can have only one final facing: previous will be overriden @@ -170,7 +173,9 @@ namespace Movement /* Sets ExitVehicle flag */ void SetExitVehicle(); + PointsArray& Path() { return args.path; } + protected: MoveSplineInitArgs args; /**< TODO */ diff --git a/src/game/movement/MoveSplineInitArgs.h b/src/game/movement/MoveSplineInitArgs.h index d664e9349..66290004d 100644 --- a/src/game/movement/MoveSplineInitArgs.h +++ b/src/game/movement/MoveSplineInitArgs.h @@ -80,6 +80,11 @@ namespace Movement */ struct MoveSplineInitArgs { + /** + * @brief + * + * @param path_capacity + */ MoveSplineInitArgs(size_t path_capacity = 16) : path_Idx_offset(0), velocity(0.f), parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f) { diff --git a/src/modules/Eluna/GameObjectMethods.h b/src/modules/Eluna/GameObjectMethods.h index 38d084539..5472d7ea3 100644 --- a/src/modules/Eluna/GameObjectMethods.h +++ b/src/modules/Eluna/GameObjectMethods.h @@ -59,7 +59,7 @@ namespace LuaGameObject */ int IsActive(lua_State* L, GameObject* go) { - Eluna::Push(L, go->isActiveObject()); + Eluna::Push(L, go->IsActiveObject()); return 1; }