diff --git a/.github/workflows/codestyle_cpp.yml b/.github/workflows/codestyle_cpp.yml index 0afaf4b7..b868e30b 100644 --- a/.github/workflows/codestyle_cpp.yml +++ b/.github/workflows/codestyle_cpp.yml @@ -14,7 +14,7 @@ jobs: triage: runs-on: ubuntu-latest name: C++ - if: github.repository == 'mod-playerbots/mod-playerbots' && !github.event.pull_request.draft + if: github.event.pull_request.draft == false steps: - uses: actions/checkout@v4 - name: Setup python diff --git a/var/.suppress.cppcheck b/.suppress.cppcheck similarity index 100% rename from var/.suppress.cppcheck rename to .suppress.cppcheck diff --git a/apps/codestyle-cpp.py b/apps/codestyle/codestyle-cpp.py similarity index 100% rename from apps/codestyle-cpp.py rename to apps/codestyle/codestyle-cpp.py diff --git a/src/AiFactory.cpp b/src/AiFactory.cpp index 3ec1418a..5d6377f4 100644 --- a/src/AiFactory.cpp +++ b/src/AiFactory.cpp @@ -413,10 +413,12 @@ void AiFactory::AddDefaultCombatStrategies(Player* player, PlayerbotAI* const fa break; } - if (PlayerbotAI::IsTank(player, true)) { + if (PlayerbotAI::IsTank(player, true)) + { engine->addStrategy("tank face", false); } - if (PlayerbotAI::IsMelee(player, true) && PlayerbotAI::IsDps(player, true)) { + if (PlayerbotAI::IsMelee(player, true) && PlayerbotAI::IsDps(player, true)) + { engine->addStrategy("behind", false); } if (PlayerbotAI::IsHeal(player, true)) @@ -706,7 +708,9 @@ void AiFactory::AddDefaultNonCombatStrategies(Player* player, PlayerbotAI* const // { // // nonCombatEngine->addStrategy("travel"); // nonCombatEngine->addStrategy("rpg"); - // } else { + // } + // else + // { // nonCombatEngine->addStrategy("move random"); // } diff --git a/src/BroadcastHelper.cpp b/src/BroadcastHelper.cpp index 85bc5221..19979d3d 100644 --- a/src/BroadcastHelper.cpp +++ b/src/BroadcastHelper.cpp @@ -70,7 +70,7 @@ bool BroadcastHelper::BroadcastToChannelWithGlobalChance(PlayerbotAI* ai, std::s return false; } - for (const auto& pair : toChannels) + for (auto const& pair : toChannels) { uint32 roll = urand(1, 100); uint32 chance = pair.second; @@ -166,7 +166,7 @@ bool BroadcastHelper::BroadcastToChannelWithGlobalChance(PlayerbotAI* ai, std::s return false; } -bool BroadcastHelper::BroadcastLootingItem(PlayerbotAI* ai, Player* bot, const ItemTemplate *proto) +bool BroadcastHelper::BroadcastLootingItem(PlayerbotAI* ai, Player* bot, ItemTemplate const* proto) { if (!sPlayerbotAIConfig->enableBroadcasts) return false; @@ -410,7 +410,6 @@ bool BroadcastHelper::BroadcastQuestUpdateComplete(PlayerbotAI* ai, Player* bot, placeholders["%my_race"] = ai->GetChatHelper()->FormatRace(bot->getRace()); placeholders["%my_level"] = std::to_string(bot->GetLevel()); - return BroadcastToChannelWithGlobalChance( ai, BOT_TEXT2("broadcast_quest_update_complete", placeholders), diff --git a/src/ChatFilter.cpp b/src/ChatFilter.cpp index 9a6b6700..6025a562 100644 --- a/src/ChatFilter.cpp +++ b/src/ChatFilter.cpp @@ -373,7 +373,7 @@ private: bool ParseSpecPrefix(const std::string& message, std::string& specPrefix, std::string& rest) { std::string msgLower = ToLower(message); - for (const auto& entry : specTabNames) + for (auto const& entry : specTabNames) { std::string prefix = "@" + entry.second; if (msgLower.find(ToLower(prefix)) == 0) @@ -555,7 +555,7 @@ public: const float radius = 100.0f; GuidVector npcs = botAI->GetAiObjectContext()->GetValue("nearest npcs")->Get(); bool match = false; - for (const auto& guid : npcs) + for (auto const& guid : npcs) { Creature* c = botAI->GetCreature(guid); if (!c) diff --git a/src/ChatHelper.cpp b/src/ChatHelper.cpp index d1a50509..bf288747 100644 --- a/src/ChatHelper.cpp +++ b/src/ChatHelper.cpp @@ -329,9 +329,11 @@ ItemWithRandomProperty ChatHelper::parseItemWithRandomProperty(std::string const while (currentPos < text.length()) { size_t nextColon = text.find(':', currentPos); - if (nextColon == std::string::npos) { + if (nextColon == std::string::npos) + { size_t hTag = text.find("|h", currentPos); - if (hTag != std::string::npos) { + if (hTag != std::string::npos) + { params.push_back(text.substr(currentPos, hTag - currentPos)); } break; @@ -341,7 +343,8 @@ ItemWithRandomProperty ChatHelper::parseItemWithRandomProperty(std::string const currentPos = nextColon + 1; } - if (params.size() >= 6) { + if (params.size() >= 6) + { res.randomPropertyId = atoi(params[5].c_str()); } diff --git a/src/GuildTaskMgr.cpp b/src/GuildTaskMgr.cpp index a689abdb..37589ebd 100644 --- a/src/GuildTaskMgr.cpp +++ b/src/GuildTaskMgr.cpp @@ -1067,7 +1067,7 @@ void GuildTaskMgr::SendCompletionMessage(Player* player, std::string const verb) void GuildTaskMgr::CheckKillTaskInternal(Player* player, Unit* victim) { ObjectGuid::LowType owner = player->GetGUID().GetCounter(); - if (victim->GetTypeId() != TYPEID_UNIT) + if (victim->IsCreature()) return; Creature* creature = reinterpret_cast(victim); diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index f014151e..414b4b22 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -1442,22 +1442,22 @@ void PlayerbotAI::ApplyInstanceStrategies(uint32 mapId, bool tellMaster) switch (mapId) { case 249: - strategyName = "onyxia"; // Onyxia's Lair + strategyName = "onyxia"; // Onyxia's Lair break; case 409: - strategyName = "mc"; // Molten Core + strategyName = "mc"; // Molten Core break; case 469: - strategyName = "bwl"; // Blackwing Lair + strategyName = "bwl"; // Blackwing Lair break; case 509: - strategyName = "aq20"; // Ruins of Ahn'Qiraj + strategyName = "aq20"; // Ruins of Ahn'Qiraj break; case 532: strategyName = "karazhan"; // Karazhan break; case 533: - strategyName = "naxx"; // Naxxramas + strategyName = "naxx"; // Naxxramas break; case 544: strategyName = "magtheridon"; // Magtheridon's Lair @@ -3097,8 +3097,10 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell, SpellCastResult result = spell->CheckCast(true); delete spell; - // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { - // if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) { + // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) + // { + // if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) + // { // LOG_DEBUG("playerbots", "CanCastSpell - target name: {}, spellid: {}, bot name: {}, result: {}", // target->GetName(), spellid, bot->GetName(), result); // } @@ -3121,7 +3123,6 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell, default: if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { - // if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) { LOG_DEBUG("playerbots", "CanCastSpell Check Failed. - target name: {}, spellid: {}, bot name: {}, result: {}", target->GetName(), spellid, bot->GetName(), result); @@ -3304,7 +3305,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget) if (bot->IsFlying() || bot->HasUnitState(UNIT_STATE_IN_FLIGHT)) { - // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { + // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) + // { // LOG_DEBUG("playerbots", "Spell cast is flying - target name: {}, spellid: {}, bot name: {}}", // target->GetName(), spellId, bot->GetName()); // } @@ -3349,7 +3351,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget) { bot->GetTradeData()->SetSpell(spellId); delete spell; - // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { + // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) + // { // LOG_DEBUG("playerbots", "Spell cast no item - target name: {}, spellid: {}, bot name: {}", // target->GetName(), spellId, bot->GetName()); // } @@ -3418,7 +3421,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget) // spell->m_targets.SetUnitTarget(target); // SpellCastResult spellSuccess = spell->CheckCast(true); - // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { + // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) + // { // LOG_DEBUG("playerbots", "Spell cast result - target name: {}, spellid: {}, bot name: {}, result: {}", // target->GetName(), spellId, bot->GetName(), spellSuccess); // } @@ -3429,7 +3433,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget) if (result != SPELL_CAST_OK) { - // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { + // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) + // { // LOG_DEBUG("playerbots", "Spell cast failed. - target name: {}, spellid: {}, bot name: {}, result: {}", // target->GetName(), spellId, bot->GetName(), result); // } @@ -3496,7 +3501,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget) // { // spell->cancel(); // delete spell; - // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { + // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) + // { // LOG_DEBUG("playerbots", "Spell cast loot - target name: {}, spellid: {}, bot name: {}", // target->GetName(), spellId, bot->GetName()); // } @@ -4727,7 +4733,6 @@ uint32 PlayerbotAI::GetEquipGearScore(Player* player) sum += gearScore[i]; } - if (count) { uint32 res = uint32(sum / count); @@ -5264,7 +5269,7 @@ Item* PlayerbotAI::FindOpenableItem() const return FindItemInInventory( [this](ItemTemplate const* itemTemplate) -> bool { - return (itemTemplate->Flags & ITEM_FLAG_HAS_LOOT) && + return itemTemplate->HasFlag(ITEM_FLAG_HAS_LOOT) && (itemTemplate->LockID == 0 || !this->bot->GetItemByEntry(itemTemplate->ItemId)->IsLocked()); }); } @@ -5415,7 +5420,7 @@ Item* PlayerbotAI::FindOilFor(Item* weapon) const if (prioritizedOils) { - for (const auto& id : *prioritizedOils) + for (auto const& id : *prioritizedOils) { oil = FindConsumable(id); if (oil) diff --git a/src/PlayerbotAI.h b/src/PlayerbotAI.h index b5dacd76..8c8cff14 100644 --- a/src/PlayerbotAI.h +++ b/src/PlayerbotAI.h @@ -530,7 +530,7 @@ public: Player* GetBot() { return bot; } Player* GetMaster() { return master; } Player* FindNewMaster(); - + // Checks if the bot is really a player. Players always have themselves as master. bool IsRealPlayer() { return master ? (master == bot) : false; } // Bot has a master that is a player. diff --git a/src/PlayerbotMgr.cpp b/src/PlayerbotMgr.cpp index b2b1a0f3..6bdbf9b6 100644 --- a/src/PlayerbotMgr.cpp +++ b/src/PlayerbotMgr.cpp @@ -1736,7 +1736,8 @@ PlayerbotAI* PlayerbotsMgr::GetPlayerbotAI(Player* player) { return nullptr; } - // if (player->GetSession()->isLogingOut() || player->IsDuringRemoveFromWorld()) { + // if (player->GetSession()->isLogingOut() || player->IsDuringRemoveFromWorld()) + // { // return nullptr; // } auto itr = _playerbotsAIMap.find(player->GetGUID()); diff --git a/src/RandomItemMgr.cpp b/src/RandomItemMgr.cpp index f99c4959..a6e143ae 100644 --- a/src/RandomItemMgr.cpp +++ b/src/RandomItemMgr.cpp @@ -982,7 +982,7 @@ void RandomItemMgr::BuildItemInfoCache() continue; } - if (proto->Flags & ITEM_FLAG_DEPRECATED) + if (proto->HasFlag(ITEM_FLAG_DEPRECATED)) { itemForTest.insert(proto->ItemId); continue; @@ -1072,10 +1072,10 @@ void RandomItemMgr::BuildItemInfoCache() // cacheInfo.team = TEAM_NEUTRAL; // // check faction - // if (proto->Flags2 & ITEM_FLAG2_FACTION_HORDE) + // if (proto->HasFlag2(ITEM_FLAG2_FACTION_HORDE)) // cacheInfo.team = TEAM_HORDE; - // if (proto->Flags2 & ITEM_FLAG2_FACTION_ALLIANCE) + // if (proto->HasFlag2(ITEM_FLAG2_FACTION_ALLIANCE)) // cacheInfo.team = TEAM_ALLIANCE; // if (cacheInfo.team == TEAM_NEUTRAL && proto->AllowableRace > 1 && proto->AllowableRace < 8388607) @@ -1099,7 +1099,7 @@ void RandomItemMgr::BuildItemInfoCache() // // check item source - // if (proto->Flags & ITEM_FLAG_NO_DISENCHANT) + // if (proto->HasFlag(ITEM_FLAG_NO_DISENCHANT)) // { // cacheInfo.source = ITEM_SOURCE_PVP; // LOG_DEBUG("playerbots", "Item: {}, source: PvP Reward", proto->ItemId); @@ -1367,7 +1367,7 @@ uint32 RandomItemMgr::CalculateStatWeight(uint8 playerclass, uint8 spec, ItemTem } // check item spells - for (const auto& spellData : proto->Spells) + for (auto const& spellData : proto->Spells) { // no spell if (!spellData.SpellId) @@ -2374,7 +2374,6 @@ void RandomItemMgr::BuildPotionCache() if (proto->Duration & 0x80000000) continue; - if (proto->AllowableClass != -1) continue; diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index 12713cbb..abd2b402 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -633,7 +633,7 @@ void RandomPlayerbotMgr::AssignAccountTypes() uint32 existingRndBotAccounts = 0; uint32 existingAddClassAccounts = 0; - for (const auto& [accountId, accountType] : currentAssignments) + for (auto const& [accountId, accountType] : currentAssignments) { if (accountType == 1) existingRndBotAccounts++; else if (accountType == 2) existingAddClassAccounts++; @@ -688,7 +688,7 @@ void RandomPlayerbotMgr::AssignAccountTypes() } // Populate filtered account lists with ALL accounts of each type - for (const auto& [accountId, accountType] : currentAssignments) + for (auto const& [accountId, accountType] : currentAssignments) { if (accountType == 1) rndBotTypeAccounts.push_back(accountId); else if (accountType == 2) addClassTypeAccounts.push_back(accountId); @@ -798,7 +798,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots() std::vector allianceChars; std::vector hordeChars; - for (const auto& charInfo : allCharacters) + for (auto const& charInfo : allCharacters) { if (IsAlliance(charInfo.rRace)) allianceChars.push_back(charInfo); @@ -832,7 +832,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots() }; // PHASE 1: Log-in Alliance bots up to allowedAllianceCount - for (const auto& charInfo : allianceChars) + for (auto const& charInfo : allianceChars) { if (!allowedAllianceCount) break; @@ -845,7 +845,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots() } // PHASE 2: Log-in Horde bots up to maxAllowedBotCount - for (const auto& charInfo : hordeChars) + for (auto const& charInfo : hordeChars) { if (!maxAllowedBotCount) break; @@ -855,7 +855,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots() } // PHASE 3: If maxAllowedBotCount wasn't reached, log-in more Alliance bots - for (const auto& charInfo : allianceChars) + for (auto const& charInfo : allianceChars) { if (!maxAllowedBotCount) break; @@ -1248,7 +1248,7 @@ void RandomPlayerbotMgr::CheckBgQueue() void RandomPlayerbotMgr::LogBattlegroundInfo() { - for (const auto& queueTypePair : BattlegroundData) + for (auto const& queueTypePair : BattlegroundData) { uint8 queueType = queueTypePair.first; @@ -1256,7 +1256,7 @@ void RandomPlayerbotMgr::LogBattlegroundInfo() if (uint8 type = BattlegroundMgr::BGArenaType(queueTypeId)) { - for (const auto& bracketIdPair : queueTypePair.second) + for (auto const& bracketIdPair : queueTypePair.second) { auto& bgInfo = bracketIdPair.second; if (bgInfo.minLevel == 0) @@ -1306,7 +1306,7 @@ void RandomPlayerbotMgr::LogBattlegroundInfo() break; } - for (const auto& bracketIdPair : queueTypePair.second) + for (auto const& bracketIdPair : queueTypePair.second) { auto& bgInfo = bracketIdPair.second; if (bgInfo.minLevel == 0) @@ -1576,7 +1576,7 @@ bool RandomPlayerbotMgr::ProcessBot(Player* bot) { idleBot = true; } - + if (idleBot) { // randomize @@ -1704,7 +1704,6 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector& return; } - PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "RandomTeleportByLocations"); std::shuffle(std::begin(tlocs), std::end(tlocs), RandomEngine::Instance()); @@ -2256,7 +2255,7 @@ void RandomPlayerbotMgr::RandomTeleportForLevel(Player* bot) // Pick a weighted city randomly, then a random banker in that city // then teleport to that banker CityId selectedCity = weightedCities[urand(0, weightedCities.size() - 1)]; - const auto& bankers = cityToBankers.at(selectedCity); + auto const& bankers = cityToBankers.at(selectedCity); uint32 selectedBankerEntry = bankers[urand(0, bankers.size() - 1)]; auto locIt = bankerEntryToLocation.find(selectedBankerEntry); if (locIt != bankerEntryToLocation.end()) diff --git a/src/ServerFacade.cpp b/src/ServerFacade.cpp index 61b9b0d4..f85525bc 100644 --- a/src/ServerFacade.cpp +++ b/src/ServerFacade.cpp @@ -56,7 +56,7 @@ Unit* ServerFacade::GetChaseTarget(Unit* target) MovementGenerator* movementGen = target->GetMotionMaster()->top(); if (movementGen && movementGen->GetMovementGeneratorType() == CHASE_MOTION_TYPE) { - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { return static_cast const*>(movementGen)->GetTarget(); } diff --git a/src/TravelMgr.cpp b/src/TravelMgr.cpp index f8df8bfe..8dfbbe45 100644 --- a/src/TravelMgr.cpp +++ b/src/TravelMgr.cpp @@ -480,7 +480,7 @@ std::string const WorldPosition::getAreaName(bool fullName, bool zoneName) std::set WorldPosition::getTransports(uint32 entry) { /* - if(!entry) + if (!entry) return getMap()->m_transports; else { @@ -488,7 +488,7 @@ std::set WorldPosition::getTransports(uint32 entry) std::set transports; /* for (auto transport : getMap()->m_transports) - if(transport->GetEntry() == entry) + if (transport->GetEntry() == entry) transports.insert(transport); return transports; @@ -1272,7 +1272,7 @@ std::string const RpgTravelDestination::getTitle() { std::ostringstream out; - if(entry > 0) + if (entry > 0) out << "rpg npc "; out << " " << ChatHelper::FormatWorldEntry(entry); @@ -2076,7 +2076,6 @@ void TravelMgr::LoadQuestTravelTable() continue; } - if (r.role == 0) { container->questGivers.push_back(loc); @@ -2591,7 +2590,7 @@ void TravelMgr::LoadQuestTravelTable() //if (data->displayId == 3015) // pos.setZ(pos.getZ() + 6.0f); - //else if(data->displayId == 3031) + //else if (data->displayId == 3031) // pos.setZ(pos.getZ() - 17.0f); if (prevNode) diff --git a/src/TravelNode.cpp b/src/TravelNode.cpp index 8e880067..d3c03ed9 100644 --- a/src/TravelNode.cpp +++ b/src/TravelNode.cpp @@ -180,7 +180,7 @@ uint32 TravelNodePath::getPrice() if (!taxiPath) return 0; - + return taxiPath->price; } @@ -470,7 +470,6 @@ bool TravelNode::cropUselessLinks() for (auto& firstLink : getLinks()) { - TravelNode* firstNode = firstLink.first; float firstLength = firstLink.second.getDistance(); for (auto& secondLink : getLinks()) @@ -1302,7 +1301,7 @@ TravelNodeRoute TravelNodeMap::getRoute(TravelNode* start, TravelNode* goal, Pla return TravelNodeRoute(path); } - for (const auto& link : *currentNode->dataNode->getLinks()) // for each successor n' of n + for (auto const& link : *currentNode->dataNode->getLinks()) // for each successor n' of n { TravelNode* linkNode = link.first; float linkCost = link.second->getCost(bot, currentNode->currentGold); @@ -1351,7 +1350,7 @@ TravelNodeRoute TravelNodeMap::getRoute(WorldPosition startPos, WorldPosition en std::vector newStartPath; std::vector startNodes = m_nodes, endNodes = m_nodes; - if(!startNodes.size() || !endNodes.size()) + if (!startNodes.size() || !endNodes.size()) return TravelNodeRoute(); // Partial sort to get the closest 5 nodes at the begin of the array. @@ -1902,7 +1901,7 @@ void TravelNodeMap::generateTransportNodes() // if (data->displayId == 3015) // pos.setZ(pos.getZ() + 6.0f); - // else if(data->displayId == 3031) + // else if (data->displayId == 3031) // pos.setZ(pos.getZ() - 17.0f); if (prevNode) diff --git a/src/factory/PlayerbotFactory.cpp b/src/factory/PlayerbotFactory.cpp index af1552a3..65ffc444 100644 --- a/src/factory/PlayerbotFactory.cpp +++ b/src/factory/PlayerbotFactory.cpp @@ -180,7 +180,7 @@ void PlayerbotFactory::Init() continue; } - if (proto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE) + if (proto->HasFlag(ITEM_FLAG_UNIQUE_EQUIPPABLE)) { continue; } @@ -1391,7 +1391,7 @@ bool PlayerbotFactory::CanEquipArmor(ItemTemplate const* proto) // for (uint8 j = 0; j < MAX_ITEM_PROTO_STATS; ++j) // { // // for ItemStatValue != 0 - // if(!proto->ItemStat[j].ItemStatValue) + // if (!proto->ItemStat[j].ItemStatValue) // continue; // AddItemStats(proto->ItemStat[j].ItemStatType, sp, ap, tank); @@ -1600,7 +1600,8 @@ void Shuffle(std::vector& items) // bool noItem = false; // uint32 quality = urand(ITEM_QUALITY_UNCOMMON, ITEM_QUALITY_EPIC); // uint32 attempts = 10; -// if (urand(0, 100) < 100 * sPlayerbotAIConfig->randomGearLoweringChance && quality > ITEM_QUALITY_NORMAL) { +// if (urand(0, 100) < 100 * sPlayerbotAIConfig->randomGearLoweringChance && quality > ITEM_QUALITY_NORMAL) +// { // quality--; // } // // current item; @@ -1705,7 +1706,8 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance) if (incremental && !sPlayerbotAIConfig->incrementalGearInit) return; - if (level < 5) { + if (level < 5) + { // original items if (CharStartOutfitEntry const* oEntry = GetCharStartOutfitEntry(bot->getRace(), bot->getClass(), bot->getGender())) { @@ -1734,7 +1736,8 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance) continue; } - if (bot->HasItemCount(itemId, count)) { + if (bot->HasItemCount(itemId, count)) + { continue; } @@ -2771,7 +2774,8 @@ void PlayerbotFactory::InitTalents(uint32 specNo) void PlayerbotFactory::InitTalentsByTemplate(uint32 specTab) { - // if (sPlayerbotAIConfig->parsedSpecLinkOrder[bot->getClass()][specNo][80].size() == 0) { + // if (sPlayerbotAIConfig->parsedSpecLinkOrder[bot->getClass()][specNo][80].size() == 0) + // { // return; // } uint32 cls = bot->getClass(); diff --git a/src/factory/StatsWeightCalculator.cpp b/src/factory/StatsWeightCalculator.cpp index fa9e8a83..8a304891 100644 --- a/src/factory/StatsWeightCalculator.cpp +++ b/src/factory/StatsWeightCalculator.cpp @@ -97,7 +97,7 @@ float StatsWeightCalculator::CalculateItem(uint32 itemId, int32 randomPropertyId // Use player level as effective item level for heirlooms - Quality EPIC // Else - Blend with item quality and level for normal items if (proto->Quality == ITEM_QUALITY_HEIRLOOM) - weight_ *= PlayerbotFactory::CalcMixedGearScore(lvl, ITEM_QUALITY_EPIC); + weight_ *= PlayerbotFactory::CalcMixedGearScore(lvl, ITEM_QUALITY_EPIC); else weight_ *= PlayerbotFactory::CalcMixedGearScore(proto->ItemLevel, proto->Quality); diff --git a/src/strategy/Engine.cpp b/src/strategy/Engine.cpp index c1072ff9..2e36e057 100644 --- a/src/strategy/Engine.cpp +++ b/src/strategy/Engine.cpp @@ -77,7 +77,8 @@ Engine::~Engine(void) // for (std::map::iterator i = strategies.begin(); i != strategies.end(); i++) // { // Strategy* strategy = i->second; - // if (strategy) { + // if (strategy) + // { // delete strategy; // } // } @@ -402,7 +403,6 @@ void Engine::addStrategiesNoInit(std::string first, ...) va_end(vl); } - bool Engine::removeStrategy(std::string const name, bool init) { std::map::iterator i = strategies.find(name); diff --git a/src/strategy/NamedObjectContext.h b/src/strategy/NamedObjectContext.h index af8c4ece..b60232a5 100644 --- a/src/strategy/NamedObjectContext.h +++ b/src/strategy/NamedObjectContext.h @@ -148,7 +148,7 @@ public: void Add(NamedObjectContext* context) { contexts.push_back(context); - for (const auto& iter : context->creators) + for (auto const& iter : context->creators) creators[iter.first] = iter.second; } }; @@ -294,7 +294,7 @@ public: void Add(NamedObjectFactory* context) { factories.push_back(context); - for (const auto& iter : context->creators) + for (auto const& iter : context->creators) creators[iter.first] = iter.second; } diff --git a/src/strategy/actions/AttackAction.cpp b/src/strategy/actions/AttackAction.cpp index 94c95418..4ea86943 100644 --- a/src/strategy/actions/AttackAction.cpp +++ b/src/strategy/actions/AttackAction.cpp @@ -161,17 +161,21 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/) bot->Attack(target, shouldMelee); /* prevent pet dead immediately in group */ - // if (bot->GetMap()->IsDungeon() && bot->GetGroup() && !target->IsInCombat()) { + // if (bot->GetMap()->IsDungeon() && bot->GetGroup() && !target->IsInCombat()) + // { // with_pet = false; // } // if (Pet* pet = bot->GetPet()) // { - // if (with_pet) { + // if (with_pet) + // { // pet->SetReactState(REACT_DEFENSIVE); // pet->SetTarget(target->GetGUID()); // pet->GetCharmInfo()->SetIsCommandAttack(true); // pet->AI()->AttackStart(target); - // } else { + // } + // else + // { // pet->SetReactState(REACT_PASSIVE); // pet->GetCharmInfo()->SetIsCommandFollow(true); // pet->GetCharmInfo()->IsReturning(); diff --git a/src/strategy/actions/AutoMaintenanceOnLevelupAction.cpp b/src/strategy/actions/AutoMaintenanceOnLevelupAction.cpp index b83936da..ad6a00c6 100644 --- a/src/strategy/actions/AutoMaintenanceOnLevelupAction.cpp +++ b/src/strategy/actions/AutoMaintenanceOnLevelupAction.cpp @@ -176,4 +176,3 @@ void AutoMaintenanceOnLevelupAction::AutoUpgradeEquip() factory.InitEquipment(true); } } - diff --git a/src/strategy/actions/BankAction.cpp b/src/strategy/actions/BankAction.cpp index 19804da8..4d8d6c4d 100644 --- a/src/strategy/actions/BankAction.cpp +++ b/src/strategy/actions/BankAction.cpp @@ -17,7 +17,7 @@ bool BankAction::Execute(Event event) for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++) { Unit* npc = botAI->GetUnit(*i); - if (!npc || !npc->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BANKER)) + if (!npc || !npc->HasNpcFlag(UNIT_NPC_FLAG_BANKER)) continue; return ExecuteBank(text, npc); diff --git a/src/strategy/actions/BattleGroundTactics.cpp b/src/strategy/actions/BattleGroundTactics.cpp index 5e9e7daf..db5235f5 100644 --- a/src/strategy/actions/BattleGroundTactics.cpp +++ b/src/strategy/actions/BattleGroundTactics.cpp @@ -1894,13 +1894,13 @@ bool BGTactics::selectObjective(bool reset) bool isDefender = role < defendersProhab; bool isAdvanced = !isDefender && role > 8; - const auto& attackObjectives = + auto const& attackObjectives = (team == TEAM_HORDE) ? AV_AttackObjectives_Horde : AV_AttackObjectives_Alliance; - const auto& defendObjectives = + auto const& defendObjectives = (team == TEAM_HORDE) ? AV_DefendObjectives_Horde : AV_DefendObjectives_Alliance; uint32 destroyedNodes = 0; - for (const auto& [nodeId, _] : defendObjectives) + for (auto const& [nodeId, _] : defendObjectives) if (av->GetAVNodeInfo(nodeId).State == POINT_DESTROYED) destroyedNodes++; @@ -2000,7 +2000,7 @@ bool BGTactics::selectObjective(bool reset) std::vector contestedObjectives; std::vector availableObjectives; - for (const auto& [nodeId, goId] : defendObjectives) + for (auto const& [nodeId, goId] : defendObjectives) { const BG_AV_NodeInfo& node = av->GetAVNodeInfo(nodeId); if (node.State == POINT_DESTROYED) @@ -2026,7 +2026,7 @@ bool BGTactics::selectObjective(bool reset) if (!BgObjective) { uint32 towersDown = 0; - for (const auto& [nodeId, _] : attackObjectives) + for (auto const& [nodeId, _] : attackObjectives) if (av->GetAVNodeInfo(nodeId).State == POINT_DESTROYED) towersDown++; @@ -2053,7 +2053,7 @@ bool BGTactics::selectObjective(bool reset) { std::vector candidates; - for (const auto& [nodeId, goId] : attackObjectives) + for (auto const& [nodeId, goId] : attackObjectives) { const BG_AV_NodeInfo& node = av->GetAVNodeInfo(nodeId); GameObject* go = bg->GetBGObject(goId); @@ -2105,13 +2105,13 @@ bool BGTactics::selectObjective(bool reset) Position objPos = BgObjective->GetPosition(); Optional linkedNodeId; - for (const auto& [nodeId, goId] : attackObjectives) + for (auto const& [nodeId, goId] : attackObjectives) if (bg->GetBGObject(goId) == BgObjective) linkedNodeId = nodeId; if (!linkedNodeId) { - for (const auto& [nodeId, goId] : defendObjectives) + for (auto const& [nodeId, goId] : defendObjectives) if (bg->GetBGObject(goId) == BgObjective) linkedNodeId = nodeId; } @@ -2543,7 +2543,7 @@ bool BGTactics::selectObjective(bool reset) float bestDist = FLT_MAX; uint32 bestTrigger = 0; - for (const auto& [nodeId, _, areaTrigger] : EY_AttackObjectives) + for (auto const& [nodeId, _, areaTrigger] : EY_AttackObjectives) { if (!IsOwned(nodeId)) continue; @@ -2610,7 +2610,7 @@ bool BGTactics::selectObjective(bool reset) // --- PRIORITY 2: Nearby unowned contested node --- if (!foundObjective) { - for (const auto& [nodeId, _, __] : EY_AttackObjectives) + for (auto const& [nodeId, _, __] : EY_AttackObjectives) { if (IsOwned(nodeId)) continue; @@ -2711,7 +2711,7 @@ bool BGTactics::selectObjective(bool reset) if (!foundObjective && strategy == EY_STRATEGY_FLAG_FOCUS) { bool ownsAny = false; - for (const auto& [nodeId, _, __] : EY_AttackObjectives) + for (auto const& [nodeId, _, __] : EY_AttackObjectives) { if (IsOwned(nodeId)) { @@ -2739,7 +2739,7 @@ bool BGTactics::selectObjective(bool reset) float bestDist = FLT_MAX; Optional bestNode; - for (const auto& [nodeId, _, __] : EY_AttackObjectives) + for (auto const& [nodeId, _, __] : EY_AttackObjectives) { if (IsOwned(nodeId)) continue; @@ -2974,7 +2974,7 @@ bool BGTactics::selectObjective(bool reset) uint32 len = end(IC_AttackObjectives) - begin(IC_AttackObjectives); for (uint32 i = 0; i < len; i++) { - const auto& objective = + auto const& objective = IC_AttackObjectives[(i + role) % len]; // use role to determine which objective checked first if (isleOfConquestBG->GetICNodePoint(objective.first).nodeState != NODE_STATE_CONTROLLED_H) @@ -3126,7 +3126,7 @@ bool BGTactics::selectObjective(bool reset) uint32 len = end(IC_AttackObjectives) - begin(IC_AttackObjectives); for (uint32 i = 0; i < len; i++) { - const auto& objective = + auto const& objective = IC_AttackObjectives[(i + role) % len]; // use role to determine which objective checked first if (isleOfConquestBG->GetICNodePoint(objective.first).nodeState != NODE_STATE_CONTROLLED_H) diff --git a/src/strategy/actions/CheckMountStateAction.cpp b/src/strategy/actions/CheckMountStateAction.cpp index 7bbcd58e..0366c56d 100644 --- a/src/strategy/actions/CheckMountStateAction.cpp +++ b/src/strategy/actions/CheckMountStateAction.cpp @@ -370,7 +370,7 @@ bool CheckMountStateAction::TryPreferredMount(Player* master) const bool CheckMountStateAction::TryRandomMountFiltered(const std::map>& spells, int32 masterSpeed) const { - for (const auto& pair : spells) + for (auto const& pair : spells) { int32 currentSpeed = pair.first; @@ -378,7 +378,7 @@ bool CheckMountStateAction::TryRandomMountFiltered(const std::map 10) { @@ -673,7 +672,7 @@ bool ChooseTravelTargetAction::SetExploreTarget(TravelTarget* target) //271 south shore //35 booty bay //380 The Barrens The Crossroads - if(((ExploreTravelDestination * )activeTarget)->getAreaId() == 380) + if (((ExploreTravelDestination * )activeTarget)->getAreaId() == 380) { activePoints.push_back(activeTarget->getPoints(true)[0]); } diff --git a/src/strategy/actions/DropQuestAction.cpp b/src/strategy/actions/DropQuestAction.cpp index ddcdaef5..48e571eb 100644 --- a/src/strategy/actions/DropQuestAction.cpp +++ b/src/strategy/actions/DropQuestAction.cpp @@ -58,7 +58,6 @@ bool DropQuestAction::Execute(Event event) return true; } - bool CleanQuestLogAction::Execute(Event event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); @@ -165,7 +164,6 @@ bool CleanQuestLogAction::Execute(Event event) return true; } - void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isGreen, bool hasProgress, bool isComplete) { std::vector slots; diff --git a/src/strategy/actions/EmoteAction.cpp b/src/strategy/actions/EmoteAction.cpp index 72952e66..1770ca2b 100644 --- a/src/strategy/actions/EmoteAction.cpp +++ b/src/strategy/actions/EmoteAction.cpp @@ -837,8 +837,8 @@ uint32 TalkAction::GetRandomEmote(Unit* unit, bool textEmote) types.push_back(TEXT_EMOTE_TALKEX); types.push_back(TEXT_EMOTE_TALKQ); - if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) || - unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))) + if (unit && (unit->HasNpcFlag(UNIT_NPC_FLAG_TRAINER) || + unit->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER))) { types.push_back(TEXT_EMOTE_SALUTE); } @@ -864,8 +864,8 @@ uint32 TalkAction::GetRandomEmote(Unit* unit, bool textEmote) types.push_back(EMOTE_ONESHOT_EXCLAMATION); types.push_back(EMOTE_ONESHOT_QUESTION); - if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) || - unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))) + if (unit && (unit->HasNpcFlag(UNIT_NPC_FLAG_TRAINER) || + unit->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER))) { types.push_back(EMOTE_ONESHOT_SALUTE); } diff --git a/src/strategy/actions/EquipAction.cpp b/src/strategy/actions/EquipAction.cpp index f24d89f7..71a2df01 100644 --- a/src/strategy/actions/EquipAction.cpp +++ b/src/strategy/actions/EquipAction.cpp @@ -328,7 +328,6 @@ void EquipAction::EquipItem(Item* item) botAI->TellMaster(out); } - bool EquipUpgradesAction::Execute(Event event) { if (!sPlayerbotAIConfig->autoEquipUpgradeLoot && !sRandomPlayerbotMgr->IsRandomBot(bot)) @@ -357,9 +356,12 @@ bool EquipUpgradesAction::Execute(Event event) int32 randomProperty = item->GetItemRandomPropertyId(); uint32 itemId = item->GetTemplate()->ItemId; std::string itemUsageParam; - if (randomProperty != 0) { + if (randomProperty != 0) + { itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty); - } else { + } + else + { itemUsageParam = std::to_string(itemId); } ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam); @@ -388,9 +390,12 @@ bool EquipUpgradeAction::Execute(Event event) int32 randomProperty = item->GetItemRandomPropertyId(); uint32 itemId = item->GetTemplate()->ItemId; std::string itemUsageParam; - if (randomProperty != 0) { + if (randomProperty != 0) + { itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty); - } else { + } + else + { itemUsageParam = std::to_string(itemId); } ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam); diff --git a/src/strategy/actions/GenericBuffUtils.cpp b/src/strategy/actions/GenericBuffUtils.cpp index 9e227caf..1ac71bad 100644 --- a/src/strategy/actions/GenericBuffUtils.cpp +++ b/src/strategy/actions/GenericBuffUtils.cpp @@ -61,7 +61,7 @@ namespace ai::buff return false; if (SpellInfo const* info = sSpellMgr->GetSpellInfo(spellId)) - { + { for (int i = 0; i < MAX_SPELL_REAGENTS; ++i) { if (info->Reagent[i] > 0) diff --git a/src/strategy/actions/GenericBuffUtils.h b/src/strategy/actions/GenericBuffUtils.h index d9cfc842..c893de59 100644 --- a/src/strategy/actions/GenericBuffUtils.h +++ b/src/strategy/actions/GenericBuffUtils.h @@ -29,7 +29,6 @@ namespace ai::buff // Returns false if the spellId is invalid. bool HasRequiredReagents(Player* bot, uint32 spellId); - // Applies the "switch to group buff" policy if: the bot is in a group of size x+, // the group variant is known/useful, and reagents are available. Otherwise, returns baseName. // If announceOnMissing == true and reagents are missing, calls the 'announce' callback diff --git a/src/strategy/actions/GenericSpellActions.cpp b/src/strategy/actions/GenericSpellActions.cpp index 3a36d9cc..b30975ad 100644 --- a/src/strategy/actions/GenericSpellActions.cpp +++ b/src/strategy/actions/GenericSpellActions.cpp @@ -190,8 +190,8 @@ CastEnchantItemAction::CastEnchantItemAction(PlayerbotAI* botAI, std::string con bool CastEnchantItemAction::isPossible() { - // if (!CastSpellAction::isPossible()) { - + // if (!CastSpellAction::isPossible()) + // { // botAI->TellMasterNoFacing("Impossible: " + spell); // return false; // } @@ -364,7 +364,8 @@ bool UseTrinketAction::UseTrinket(Item* item) for (int i = 0; i < MAX_SPELL_EFFECTS; i++) { const SpellEffectInfo& effectInfo = spellInfo->Effects[i]; - if (effectInfo.Effect == SPELL_EFFECT_APPLY_AURA) { + if (effectInfo.Effect == SPELL_EFFECT_APPLY_AURA) + { applyAura = true; break; } diff --git a/src/strategy/actions/GuildManagementActions.cpp b/src/strategy/actions/GuildManagementActions.cpp index af5a1f01..4ab6d72c 100644 --- a/src/strategy/actions/GuildManagementActions.cpp +++ b/src/strategy/actions/GuildManagementActions.cpp @@ -193,7 +193,7 @@ bool GuildManageNearbyAction::Execute(Event event) if (guild->GetMemberSize() > 1000) return false; - if ( (guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_INVITE) == 0) + if ((guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_INVITE) == 0) continue; if (player->GetGuildIdInvited()) diff --git a/src/strategy/actions/LfgActions.cpp b/src/strategy/actions/LfgActions.cpp index 406a0ec0..15f8b92f 100644 --- a/src/strategy/actions/LfgActions.cpp +++ b/src/strategy/actions/LfgActions.cpp @@ -16,7 +16,6 @@ using namespace lfg; - bool LfgJoinAction::Execute(Event event) { return JoinLFG(); } uint32 LfgJoinAction::GetRoles() @@ -113,7 +112,7 @@ bool LfgJoinAction::JoinLFG() dungeon->TypeID != LFG_TYPE_HEROIC && dungeon->TypeID != LFG_TYPE_RAID)) continue; - const auto& botLevel = bot->GetLevel(); + auto const& botLevel = bot->GetLevel(); /*LFG_TYPE_RANDOM on classic is 15-58 so bot over level 25 will never queue*/ if (dungeon->MinLevel && (botLevel < dungeon->MinLevel || botLevel > dungeon->MaxLevel) || @@ -180,7 +179,6 @@ bool LfgRoleCheckAction::Execute(Event event) // if (currentRoles == newRoles) // return false; - WorldPacket* packet = new WorldPacket(CMSG_LFG_SET_ROLES); *packet << (uint8)newRoles; bot->GetSession()->QueuePacket(packet); @@ -267,7 +265,6 @@ bool LfgAcceptAction::Execute(Event event) return false; } - bool LfgLeaveAction::Execute(Event event) { // Don't leave if lfg strategy enabled diff --git a/src/strategy/actions/LootRollAction.cpp b/src/strategy/actions/LootRollAction.cpp index 3b3a4240..912f75fd 100644 --- a/src/strategy/actions/LootRollAction.cpp +++ b/src/strategy/actions/LootRollAction.cpp @@ -41,9 +41,12 @@ bool LootRollAction::Execute(Event event) continue; std::string itemUsageParam; - if (randomProperty != 0) { + if (randomProperty != 0) + { itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty); - } else { + } + else + { itemUsageParam = std::to_string(itemId); } ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam); @@ -120,7 +123,6 @@ bool LootRollAction::Execute(Event event) return false; } - RollVote LootRollAction::CalculateRollVote(ItemTemplate const* proto) { std::ostringstream out; diff --git a/src/strategy/actions/MovementActions.cpp b/src/strategy/actions/MovementActions.cpp index 0598a39d..04a89fa1 100644 --- a/src/strategy/actions/MovementActions.cpp +++ b/src/strategy/actions/MovementActions.cpp @@ -248,7 +248,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, // bot->CastStop(); // botAI->InterruptSpell(); // } - + MotionMaster& mm = *bot->GetMotionMaster(); // No ground pathfinding if the bot/master are flying => allow true 3D (Z) movement auto isFlying = [](Unit* u){ return u && (u->HasUnitMovementFlag(MOVEMENTFLAG_FLYING) || u->IsInFlight()); }; @@ -530,7 +530,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, // { // AI_VALUE(LastMovement&, "last area trigger").lastAreaTrigger = entry; // } - // else { + // else + // { // LOG_DEBUG("playerbots", "!entry"); // return bot->TeleportTo(movePosition.getMapId(), movePosition.getX(), movePosition.getY(), // movePosition.getZ(), movePosition.getO(), 0); @@ -876,7 +877,8 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance) deltaAngle -= 2.0f * M_PI; // -PI..PI // if target is moving forward and moving far away, predict the position bool behind = fabs(deltaAngle) > M_PI_2; - if (target->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD) && behind) { + if (target->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD) && behind) + { float predictDis = std::min(3.0f, target->GetObjectSize() * 2); tx += cos(target->GetOrientation()) * predictDis; ty += sin(target->GetOrientation()) * predictDis; @@ -1009,7 +1011,8 @@ bool MovementAction::IsMovingAllowed() return false; } - // if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) { + // if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) + // { // return false; // } return bot->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLIGHT_MOTION_TYPE; @@ -1094,9 +1097,12 @@ void MovementAction::UpdateMovementState() wasMovementRestricted = isCurrentlyRestricted; // Temporary speed increase in group - // if (botAI->HasRealPlayerMaster()) { + // if (botAI->HasRealPlayerMaster()) + // { // bot->SetSpeedRate(MOVE_RUN, 1.1f); - // } else { + // } + // else + // { // bot->SetSpeedRate(MOVE_RUN, 1.0f); // } // check if target is not reachable (from Vmangos) @@ -1105,7 +1111,7 @@ void MovementAction::UpdateMovementState() // { // if (Unit* pTarget = sServerFacade->GetChaseTarget(bot)) // { - // if (!bot->IsWithinMeleeRange(pTarget) && pTarget->GetTypeId() == TYPEID_UNIT) + // if (!bot->IsWithinMeleeRange(pTarget) && pTarget->IsCreature()) // { // float angle = bot->GetAngle(pTarget); // float distance = 5.0f; @@ -1721,7 +1727,8 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d // float MovementAction::SearchBestGroundZForPath(float x, float y, float z, bool generatePath, float range, bool // normal_only, float step) // { -// if (!generatePath) { +// if (!generatePath) +// { // return z; // } // float min_length = 100000.0f; @@ -1732,10 +1739,12 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d // modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta); // PathGenerator gen(bot); // gen.CalculatePath(x, y, modified_z); -// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length) { +// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length) +// { // min_length = gen.getPathLength(); // current_z = modified_z; -// if (abs(current_z - z) < 0.5f) { +// if (abs(current_z - z) < 0.5f) +// { // return current_z; // } // } @@ -1744,10 +1753,12 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d // modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta); // PathGenerator gen(bot); // gen.CalculatePath(x, y, modified_z); -// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length) { +// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length) +// { // min_length = gen.getPathLength(); // current_z = modified_z; -// if (abs(current_z - z) < 0.5f) { +// if (abs(current_z - z) < 0.5f) +// { // return current_z; // } // } @@ -1756,18 +1767,22 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d // modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta); // PathGenerator gen(bot); // gen.CalculatePath(x, y, modified_z); -// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length) { +// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length) +// { // min_length = gen.getPathLength(); // current_z = modified_z; -// if (abs(current_z - z) < 0.5f) { +// if (abs(current_z - z) < 0.5f) +// { // return current_z; // } // } // } -// if (current_z == INVALID_HEIGHT && normal_only) { +// if (current_z == INVALID_HEIGHT && normal_only) +// { // return INVALID_HEIGHT; // } -// if (current_z == INVALID_HEIGHT && !normal_only) { +// if (current_z == INVALID_HEIGHT && !normal_only) +// { // return z; // } // return current_z; @@ -2818,7 +2833,7 @@ bool MoveAwayFromCreatureAction::Execute(Event event) // Find all creatures with the specified Id std::vector creatures; - for (const auto& guid : targets) + for (auto const& guid : targets) { Unit* unit = botAI->GetUnit(guid); if (unit && (alive && unit->IsAlive()) && unit->GetEntry() == creatureId) diff --git a/src/strategy/actions/MovementActions.h b/src/strategy/actions/MovementActions.h index b5f7a389..f50e4b95 100644 --- a/src/strategy/actions/MovementActions.h +++ b/src/strategy/actions/MovementActions.h @@ -119,7 +119,6 @@ protected: int moveInterval; }; - class CombatFormationMoveAction : public MovementAction { public: diff --git a/src/strategy/actions/NonCombatActions.cpp b/src/strategy/actions/NonCombatActions.cpp index e810ad27..f87aa891 100644 --- a/src/strategy/actions/NonCombatActions.cpp +++ b/src/strategy/actions/NonCombatActions.cpp @@ -47,16 +47,16 @@ bool DrinkAction::Execute(Event event) return UseItemAction::Execute(event); } -bool DrinkAction::isUseful() -{ - return UseItemAction::isUseful() && +bool DrinkAction::isUseful() +{ + return UseItemAction::isUseful() && AI_VALUE2(bool, "has mana", "self target") && AI_VALUE2(uint8, "mana", "self target") < 100; } bool DrinkAction::isPossible() { - return !bot->IsInCombat() && + return !bot->IsInCombat() && !bot->IsMounted() && !botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form", "aquatic form","flight form", "swift flight form", nullptr) && @@ -102,15 +102,15 @@ bool EatAction::Execute(Event event) return UseItemAction::Execute(event); } -bool EatAction::isUseful() -{ - return UseItemAction::isUseful() && +bool EatAction::isUseful() +{ + return UseItemAction::isUseful() && AI_VALUE2(uint8, "health", "self target") < 100; } bool EatAction::isPossible() { - return !bot->IsInCombat() && + return !bot->IsInCombat() && !bot->IsMounted() && !botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form", "aquatic form","flight form", "swift flight form", nullptr) && diff --git a/src/strategy/actions/QuestAction.cpp b/src/strategy/actions/QuestAction.cpp index 39e8e1ba..b96c5394 100644 --- a/src/strategy/actions/QuestAction.cpp +++ b/src/strategy/actions/QuestAction.cpp @@ -48,7 +48,7 @@ bool QuestAction::Execute(Event event) // Check the nearest NPCs GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs"); - for (const auto& npc : npcs) + for (auto const& npc : npcs) { Unit* unit = botAI->GetUnit(npc); if (unit && bot->GetDistance(unit) <= INTERACTION_DISTANCE) @@ -59,7 +59,7 @@ bool QuestAction::Execute(Event event) // Checks the nearest game objects GuidVector gos = AI_VALUE(GuidVector, "nearest game objects"); - for (const auto& go : gos) + for (auto const& go : gos) { GameObject* gameobj = botAI->GetGameObject(go); if (gameobj && bot->GetDistance(gameobj) <= INTERACTION_DISTANCE) @@ -359,7 +359,7 @@ bool QuestUpdateAddItemAction::Execute(Event event) uint32 availableItemsCount = botAI->GetInventoryItemsCountWithId(itemId); placeholders["%quest_obj_available"] = std::to_string(availableItemsCount); - for (const auto& pair : botAI->GetCurrentQuestsRequiringItemId(itemId)) + for (auto const& pair : botAI->GetCurrentQuestsRequiringItemId(itemId)) { placeholders["%quest_link"] = chat->FormatQuest(pair.first); uint32 requiredItemsCount = pair.second; diff --git a/src/strategy/actions/QuestAction.h b/src/strategy/actions/QuestAction.h index b9ca10e5..c19faf9e 100644 --- a/src/strategy/actions/QuestAction.h +++ b/src/strategy/actions/QuestAction.h @@ -49,7 +49,7 @@ class QuestUpdateAddItemAction : public Action { public: QuestUpdateAddItemAction(PlayerbotAI* ai) : Action(ai, "quest update add item") {} - bool Execute(Event event) override;; + bool Execute(Event event) override; }; class QuestUpdateFailedAction : public Action @@ -70,7 +70,7 @@ class QuestItemPushResultAction : public Action { public: QuestItemPushResultAction(PlayerbotAI* ai) : Action(ai, "quest item push result") {} - bool Execute(Event event) override;; + bool Execute(Event event) override; }; #endif diff --git a/src/strategy/actions/ReleaseSpiritAction.cpp b/src/strategy/actions/ReleaseSpiritAction.cpp index 666e42ab..b06fc892 100644 --- a/src/strategy/actions/ReleaseSpiritAction.cpp +++ b/src/strategy/actions/ReleaseSpiritAction.cpp @@ -128,7 +128,7 @@ bool AutoReleaseSpiritAction::HandleBattlegroundSpiritHealer() GuidVector npcs = NearestNpcsValue(botAI, bgRange); Unit* spiritHealer = nullptr; - for (const auto& guid : npcs) + for (auto const& guid : npcs) { Unit* unit = botAI->GetUnit(guid); if (unit && unit->IsFriendlyTo(bot) && unit->IsSpiritService()) diff --git a/src/strategy/actions/RevealGatheringItemAction.cpp b/src/strategy/actions/RevealGatheringItemAction.cpp index 00f1cc1d..9725dce5 100644 --- a/src/strategy/actions/RevealGatheringItemAction.cpp +++ b/src/strategy/actions/RevealGatheringItemAction.cpp @@ -12,24 +12,7 @@ #include "GridNotifiersImpl.h" #include "Playerbots.h" #include "ServerFacade.h" - -class AnyGameObjectInObjectRangeCheck -{ -public: - AnyGameObjectInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {} - WorldObject const& GetFocusObject() const { return *i_obj; } - bool operator()(GameObject* go) - { - if (go && i_obj->IsWithinDistInMap(go, i_range) && go->isSpawned() && go->GetGOInfo()) - return true; - - return false; - } - -private: - WorldObject const* i_obj; - float i_range; -}; +#include "NearestGameObjects.h" bool RevealGatheringItemAction::Execute(Event event) { diff --git a/src/strategy/actions/ReviveFromCorpseAction.cpp b/src/strategy/actions/ReviveFromCorpseAction.cpp index 83897dc2..74237670 100644 --- a/src/strategy/actions/ReviveFromCorpseAction.cpp +++ b/src/strategy/actions/ReviveFromCorpseAction.cpp @@ -314,7 +314,7 @@ bool SpiritHealerAction::Execute(Event event) for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++) { Unit* unit = botAI->GetUnit(*i); - if (unit && unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER)) + if (unit && unit->HasNpcFlag(UNIT_NPC_FLAG_SPIRITHEALER)) { LOG_DEBUG("playerbots", "Bot {} {}:{} <{}> revives at spirit healer", bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName()); diff --git a/src/strategy/actions/RpgAction.cpp b/src/strategy/actions/RpgAction.cpp index 21b68d6b..ae6a50fd 100644 --- a/src/strategy/actions/RpgAction.cpp +++ b/src/strategy/actions/RpgAction.cpp @@ -50,7 +50,6 @@ bool RpgAction::SetNextRpgAction() std::vector relevances; std::vector triggerNodes; - for (auto& strategy : botAI->GetAiObjectContext()->GetSupportedStrategies()) { if (strategy.find("rpg") == std::string::npos) diff --git a/src/strategy/actions/SayAction.cpp b/src/strategy/actions/SayAction.cpp index 474f37e4..00fae652 100644 --- a/src/strategy/actions/SayAction.cpp +++ b/src/strategy/actions/SayAction.cpp @@ -195,7 +195,7 @@ void ChatReplyAction::ChatReplyDo(Player* bot, uint32& type, uint32& guid1, uint } ChatChannelSource chatChannelSource = GET_PLAYERBOT_AI(bot)->GetChatChannelSource(bot, type, chanName); - if ( (msg.starts_with("LFG") || msg.starts_with("LFM")) && HandleLFGQuestsReply(bot, chatChannelSource, msg, name)) + if ((msg.starts_with("LFG") || msg.starts_with("LFM")) && HandleLFGQuestsReply(bot, chatChannelSource, msg, name)) { return; } diff --git a/src/strategy/actions/SetHomeAction.cpp b/src/strategy/actions/SetHomeAction.cpp index 36893f4a..44f3c7b4 100644 --- a/src/strategy/actions/SetHomeAction.cpp +++ b/src/strategy/actions/SetHomeAction.cpp @@ -24,7 +24,7 @@ bool SetHomeAction::Execute(Event event) } if (Unit* unit = botAI->GetUnit(selection)) - if (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER)) + if (unit->HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER)) { if (isRpgAction) { diff --git a/src/strategy/actions/SuggestWhatToDoAction.cpp b/src/strategy/actions/SuggestWhatToDoAction.cpp index 468b1f50..96cc7f52 100644 --- a/src/strategy/actions/SuggestWhatToDoAction.cpp +++ b/src/strategy/actions/SuggestWhatToDoAction.cpp @@ -120,7 +120,8 @@ void SuggestWhatToDoAction::grindMaterials() for (std::map::iterator i = categories.begin(); i != categories.end(); ++i) { - if (urand(0, 10) < 3) { + if (urand(0, 10) < 3) + { std::string name = i->first; double multiplier = i->second; diff --git a/src/strategy/actions/TameAction.cpp b/src/strategy/actions/TameAction.cpp index b414b478..5b3eda10 100644 --- a/src/strategy/actions/TameAction.cpp +++ b/src/strategy/actions/TameAction.cpp @@ -81,7 +81,7 @@ bool TameAction::Execute(Event event) std::ostringstream oss; oss << "Available pet families: "; size_t count = 0; - for (const auto& name : normalFamilies) + for (auto const& name : normalFamilies) { if (count++ != 0) oss << ", "; @@ -93,7 +93,7 @@ bool TameAction::Execute(Event event) oss << " | "; oss << "Exotic: "; count = 0; - for (const auto& name : exoticFamilies) + for (auto const& name : exoticFamilies) { if (count++ != 0) oss << ", "; diff --git a/src/strategy/actions/TellGlyphsAction.h b/src/strategy/actions/TellGlyphsAction.h index 6f3e0dac..77bb5b1c 100644 --- a/src/strategy/actions/TellGlyphsAction.h +++ b/src/strategy/actions/TellGlyphsAction.h @@ -18,4 +18,3 @@ public: }; #endif - diff --git a/src/strategy/actions/TradeAction.cpp b/src/strategy/actions/TradeAction.cpp index 9ac7aca2..ad81d9f9 100644 --- a/src/strategy/actions/TradeAction.cpp +++ b/src/strategy/actions/TradeAction.cpp @@ -15,7 +15,7 @@ bool TradeAction::Execute(Event event) std::string const text = event.getParam(); // If text starts with any excluded prefix, don't process it further. - for (const auto& prefix : sPlayerbotAIConfig->tradeActionExcludedPrefixes) + for (auto const& prefix : sPlayerbotAIConfig->tradeActionExcludedPrefixes) { if (text.find(prefix) == 0) return false; diff --git a/src/strategy/actions/TrainerAction.cpp b/src/strategy/actions/TrainerAction.cpp index c5509cf8..e2e89115 100644 --- a/src/strategy/actions/TrainerAction.cpp +++ b/src/strategy/actions/TrainerAction.cpp @@ -172,7 +172,7 @@ bool MaintenanceAction::Execute(Event event) PlayerbotFactory factory(bot, bot->GetLevel()); if (!botAI->IsAlt()) - { + { factory.InitAttunementQuests(); factory.InitBags(false); factory.InitAmmo(); @@ -194,7 +194,7 @@ bool MaintenanceAction::Execute(Event event) if (bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel) factory.ApplyEnchantAndGemsNew(); } - else + else { if (sPlayerbotAIConfig->altMaintenanceAttunementQs) factory.InitAttunementQuests(); diff --git a/src/strategy/actions/UseMeetingStoneAction.cpp b/src/strategy/actions/UseMeetingStoneAction.cpp index 24d58aff..6e902730 100644 --- a/src/strategy/actions/UseMeetingStoneAction.cpp +++ b/src/strategy/actions/UseMeetingStoneAction.cpp @@ -9,6 +9,7 @@ #include "Event.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" +#include "NearestGameObjects.h" #include "PlayerbotAIConfig.h" #include "Playerbots.h" #include "PositionValue.h" @@ -54,24 +55,6 @@ bool UseMeetingStoneAction::Execute(Event event) return Teleport(master, bot); } -class AnyGameObjectInObjectRangeCheck -{ -public: - AnyGameObjectInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {} - WorldObject const& GetFocusObject() const { return *i_obj; } - bool operator()(GameObject* go) - { - if (go && i_obj->IsWithinDistInMap(go, i_range) && go->isSpawned() && go->GetGOInfo()) - return true; - - return false; - } - -private: - WorldObject const* i_obj; - float i_range; -}; - bool SummonAction::Execute(Event event) { Player* master = GetMaster(); @@ -134,7 +117,7 @@ bool SummonAction::SummonUsingNpcs(Player* summoner, Player* player) for (Unit* unit : targets) { - if (unit && unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER)) + if (unit && unit->HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER)) { if (!player->HasItemCount(6948, 1, false)) { @@ -242,7 +225,7 @@ bool SummonAction::Teleport(Player* summoner, Player* player) } } - if(summoner != player) + if (summoner != player) botAI->TellError("Not enough place to summon"); return false; } diff --git a/src/strategy/actions/WorldBuffAction.cpp b/src/strategy/actions/WorldBuffAction.cpp index b4708385..3cd770e4 100644 --- a/src/strategy/actions/WorldBuffAction.cpp +++ b/src/strategy/actions/WorldBuffAction.cpp @@ -97,4 +97,3 @@ std::vector WorldBuffAction::NeedWorldBuffs(Unit* unit) return retVec; } - diff --git a/src/strategy/actions/XpGainAction.cpp b/src/strategy/actions/XpGainAction.cpp index 446be3bb..4048ce3a 100644 --- a/src/strategy/actions/XpGainAction.cpp +++ b/src/strategy/actions/XpGainAction.cpp @@ -15,7 +15,6 @@ bool XpGainAction::Execute(Event event) { context->GetValue("death count")->Set(0); - WorldPacket p(event.getPacket()); // (8+4+1+4+8) ObjectGuid guid; // uint32 xpgain; diff --git a/src/strategy/deathknight/DKActions.cpp b/src/strategy/deathknight/DKActions.cpp index 52061036..2b5ce977 100644 --- a/src/strategy/deathknight/DKActions.cpp +++ b/src/strategy/deathknight/DKActions.cpp @@ -43,7 +43,7 @@ bool CastRaiseDeadAction::Execute(Event event) return false; } uint32 spellId = AI_VALUE2(uint32, "spell id", spell); - // const SpellInfo *spellInfo = sSpellMgr->GetSpellInfo(spellId); + // SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId); bot->AddSpellCooldown(spellId, 0, 3 * 60 * 1000); return true; -} \ No newline at end of file +} diff --git a/src/strategy/druid/DruidActions.h b/src/strategy/druid/DruidActions.h index f7a4ef32..402073d2 100644 --- a/src/strategy/druid/DruidActions.h +++ b/src/strategy/druid/DruidActions.h @@ -311,7 +311,6 @@ public: CastEnrageAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "enrage") {} }; - class CastRejuvenationOnNotFullAction : public HealPartyMemberAction { public: diff --git a/src/strategy/dungeons/DungeonStrategyContext.h b/src/strategy/dungeons/DungeonStrategyContext.h index ce982b14..cc606afe 100644 --- a/src/strategy/dungeons/DungeonStrategyContext.h +++ b/src/strategy/dungeons/DungeonStrategyContext.h @@ -35,8 +35,6 @@ Bronjahm, Devourer of Souls */ - - class DungeonStrategyContext : public NamedObjectContext { public: @@ -84,8 +82,6 @@ class DungeonStrategyContext : public NamedObjectContext static Strategy* wotlk_toc(PlayerbotAI* botAI) { return new WotlkDungeonToCStrategy(botAI); } // NYI from here down static Strategy* wotlk_hor(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); } - - }; #endif diff --git a/src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h b/src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h index 057d25e0..1a3d7a94 100644 --- a/src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h +++ b/src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h @@ -18,5 +18,4 @@ #include "trialofthechampion/TrialOfTheChampionTriggerContext.h" // #include "hallsofreflection/HallsOfReflectionTriggerContext.h" - #endif diff --git a/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubActions.cpp b/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubActions.cpp index 2b7e7c9f..e31ffd00 100644 --- a/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubActions.cpp +++ b/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubActions.cpp @@ -2,7 +2,6 @@ #include "AzjolNerubActions.h" #include "AzjolNerubStrategy.h" - bool AttackWebWrapAction::isUseful() { return !botAI->IsHeal(bot); } bool AttackWebWrapAction::Execute(Event event) { diff --git a/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubStrategy.cpp b/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubStrategy.cpp index dcefbae5..1a30e98c 100644 --- a/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubStrategy.cpp +++ b/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubStrategy.cpp @@ -1,7 +1,6 @@ #include "AzjolNerubStrategy.h" #include "AzjolNerubMultipliers.h" - void WotlkDungeonANStrategy::InitTriggers(std::vector &triggers) { // Krik'thir the Gatewatcher diff --git a/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubStrategy.h b/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubStrategy.h index bf5a7917..70196e6e 100644 --- a/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubStrategy.h +++ b/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubStrategy.h @@ -5,7 +5,6 @@ #include "AiObjectContext.h" #include "Strategy.h" - class WotlkDungeonANStrategy : public Strategy { public: diff --git a/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubTriggers.cpp b/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubTriggers.cpp index df52374c..f9ef4ff9 100644 --- a/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubTriggers.cpp +++ b/src/strategy/dungeons/wotlk/azjolnerub/AzjolNerubTriggers.cpp @@ -3,7 +3,6 @@ #include "AiObject.h" #include "AiObjectContext.h" - bool KrikthirWebWrapTrigger::IsActive() { if (!botAI->IsDps(bot)) { return false; } diff --git a/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeActions.cpp b/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeActions.cpp index dd857569..15121f4a 100644 --- a/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeActions.cpp +++ b/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeActions.cpp @@ -2,7 +2,6 @@ #include "CullingOfStratholmeActions.h" #include "CullingOfStratholmeStrategy.h" - bool ExplodeGhoulSpreadAction::Execute(Event event) { Unit* boss = AI_VALUE2(Unit*, "find target", "salramm the fleshcrafter"); @@ -32,7 +31,7 @@ bool EpochStackAction::isUseful() // Hunter bots will try and melee in between ranged attacks, or just melee entirely at 5 as they are in range. // 7.5 or 8.0 solves this for this boss. // Unfortunately at this range the boss will charge. So I guess just don't stack as a hunter.. - // if(bot->getClass() == CLASS_HUNTER) + // if (bot->getClass() == CLASS_HUNTER) // { // return AI_VALUE2(float, "distance", "current target") > 7.5f; // } @@ -45,7 +44,7 @@ bool EpochStackAction::Execute(Event event) if (!boss) { return false; } float maxMovement = 10.0f; - // if(bot->getClass() == CLASS_HUNTER) + // if (bot->getClass() == CLASS_HUNTER) // { // return Move(bot->GetAngle(boss), fmin(bot->GetExactDist2d(boss) - 6.5f, maxMovement)); // } diff --git a/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeStrategy.cpp b/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeStrategy.cpp index b9081ba8..e9011ee7 100644 --- a/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeStrategy.cpp +++ b/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeStrategy.cpp @@ -1,7 +1,6 @@ #include "CullingOfStratholmeStrategy.h" #include "CullingOfStratholmeMultipliers.h" - void WotlkDungeonCoSStrategy::InitTriggers(std::vector &triggers) { // Meathook diff --git a/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeStrategy.h b/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeStrategy.h index 9c687da9..bff12674 100644 --- a/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeStrategy.h +++ b/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeStrategy.h @@ -5,7 +5,6 @@ #include "AiObjectContext.h" #include "Strategy.h" - class WotlkDungeonCoSStrategy : public Strategy { public: diff --git a/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeTriggers.cpp b/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeTriggers.cpp index a2b7dc11..cb67ad07 100644 --- a/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeTriggers.cpp +++ b/src/strategy/dungeons/wotlk/cullingofstratholme/CullingOfStratholmeTriggers.cpp @@ -3,7 +3,6 @@ #include "AiObject.h" #include "AiObjectContext.h" - bool ExplodeGhoulTrigger::IsActive() { Unit* boss = AI_VALUE2(Unit*, "find target", "salramm the fleshcrafter"); diff --git a/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepActions.cpp b/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepActions.cpp index 0ab72c1b..8cbbe49c 100644 --- a/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepActions.cpp +++ b/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepActions.cpp @@ -2,7 +2,6 @@ #include "DrakTharonKeepActions.h" #include "DrakTharonKeepStrategy.h" - bool CorpseExplodeSpreadAction::Execute(Event event) { Unit* boss = AI_VALUE2(Unit*, "find target", "trollgore"); diff --git a/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepStrategy.cpp b/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepStrategy.cpp index 4166f2f5..a32d5231 100644 --- a/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepStrategy.cpp +++ b/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepStrategy.cpp @@ -1,7 +1,6 @@ #include "DrakTharonKeepStrategy.h" #include "DrakTharonKeepMultipliers.h" - void WotlkDungeonDTKStrategy::InitTriggers(std::vector &triggers) { // Trollgore diff --git a/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepStrategy.h b/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepStrategy.h index b819ad38..41ef0ced 100644 --- a/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepStrategy.h +++ b/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepStrategy.h @@ -5,7 +5,6 @@ #include "AiObjectContext.h" #include "Strategy.h" - class WotlkDungeonDTKStrategy : public Strategy { public: diff --git a/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepTriggers.cpp b/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepTriggers.cpp index 9ed4b191..406f4d43 100644 --- a/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepTriggers.cpp +++ b/src/strategy/dungeons/wotlk/draktharonkeep/DrakTharonKeepTriggers.cpp @@ -3,7 +3,6 @@ #include "AiObject.h" #include "AiObjectContext.h" - bool CorpseExplodeTrigger::IsActive() { Unit* boss = AI_VALUE2(Unit*, "find target", "trollgore"); diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActions.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActions.cpp index 3bd21f34..e72fe98d 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActions.cpp +++ b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsActions.cpp @@ -17,7 +17,6 @@ bool MoveFromBronjahmAction::Execute(Event event) return false; } - bool AttackCorruptedSoulFragmentAction::Execute(Event event) { Unit* currentTarget = AI_VALUE(Unit*, "current target"); @@ -52,7 +51,6 @@ bool AttackCorruptedSoulFragmentAction::Execute(Event event) return false; } - bool BronjahmGroupPositionAction::Execute(Event event) { Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm"); @@ -165,5 +163,3 @@ bool DevourerOfSoulsAction::Execute(Event event) return false; } - - diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.cpp b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.cpp index 7ddcffb8..7873e7c1 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.cpp +++ b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.cpp @@ -6,7 +6,6 @@ #include "ForgeOfSoulsTriggers.h" #include "ForgeOfSoulsActions.h" - float BronjahmMultiplier::GetValue(Action* action) { Unit* boss = AI_VALUE2(Unit *, "find target", "bronjahm"); if (!boss) diff --git a/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.h b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.h index 99d7e47b..1c89bb09 100644 --- a/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.h +++ b/src/strategy/dungeons/wotlk/forgeofsouls/ForgeOfSoulsMultipliers.h @@ -20,5 +20,4 @@ public: float GetValue(Action* action) override; }; - #endif diff --git a/src/strategy/dungeons/wotlk/gundrak/GundrakStrategy.cpp b/src/strategy/dungeons/wotlk/gundrak/GundrakStrategy.cpp index ac7b909d..8c5612dc 100644 --- a/src/strategy/dungeons/wotlk/gundrak/GundrakStrategy.cpp +++ b/src/strategy/dungeons/wotlk/gundrak/GundrakStrategy.cpp @@ -1,7 +1,6 @@ #include "GundrakStrategy.h" #include "GundrakMultipliers.h" - void WotlkDungeonGDStrategy::InitTriggers(std::vector &triggers) { // Moorabi diff --git a/src/strategy/dungeons/wotlk/gundrak/GundrakStrategy.h b/src/strategy/dungeons/wotlk/gundrak/GundrakStrategy.h index c7910c1c..47f8617f 100644 --- a/src/strategy/dungeons/wotlk/gundrak/GundrakStrategy.h +++ b/src/strategy/dungeons/wotlk/gundrak/GundrakStrategy.h @@ -5,7 +5,6 @@ #include "AiObjectContext.h" #include "Strategy.h" - class WotlkDungeonGDStrategy : public Strategy { public: diff --git a/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningActions.cpp b/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningActions.cpp index a31699f8..047e0aee 100644 --- a/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningActions.cpp +++ b/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningActions.cpp @@ -126,7 +126,7 @@ bool LokenStackAction::isUseful() // Minimum hunter range is 5, but values too close to this seem to cause issues.. // Hunter bots will try and melee in between ranged attacks, or just melee entirely at 5 as they are in range. // 6.5 or 7.0 solves this for this boss. - if(bot->getClass() == CLASS_HUNTER) + if (bot->getClass() == CLASS_HUNTER) { return AI_VALUE2(float, "distance", "current target") > 6.5f; } @@ -141,7 +141,7 @@ bool LokenStackAction::Execute(Event event) float maxMovement = 10.0f; if (!boss->HasUnitState(UNIT_STATE_CASTING)) { - if(bot->getClass() == CLASS_HUNTER) + if (bot->getClass() == CLASS_HUNTER) { return Move(bot->GetAngle(boss), fmin(bot->GetExactDist2d(boss) - 6.5f, maxMovement)); } @@ -152,7 +152,6 @@ bool LokenStackAction::Execute(Event event) return false; } - bool AvoidLightningNovaAction::Execute(Event event) { Unit* boss = AI_VALUE2(Unit*, "find target", "loken"); diff --git a/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningMultipliers.cpp b/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningMultipliers.cpp index fa676822..3bf9fcfd 100644 --- a/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningMultipliers.cpp +++ b/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningMultipliers.cpp @@ -123,4 +123,3 @@ float LokenMultiplier::GetValue(Action* action) return 1.0f; // Default multiplier value for other cases. } - diff --git a/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningStrategy.cpp b/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningStrategy.cpp index dc17c3d8..42d30d96 100644 --- a/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningStrategy.cpp +++ b/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningStrategy.cpp @@ -1,7 +1,6 @@ #include "HallsOfLightningStrategy.h" #include "HallsOfLightningMultipliers.h" - void WotlkDungeonHoLStrategy::InitTriggers(std::vector &triggers) { // General Bjarngrim diff --git a/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningStrategy.h b/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningStrategy.h index 8ee265dd..6463033b 100644 --- a/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningStrategy.h +++ b/src/strategy/dungeons/wotlk/hallsoflightning/HallsOfLightningStrategy.h @@ -5,7 +5,6 @@ #include "AiObjectContext.h" #include "Strategy.h" - class WotlkDungeonHoLStrategy : public Strategy { public: diff --git a/src/strategy/dungeons/wotlk/hallsofstone/HallsOfStoneStrategy.cpp b/src/strategy/dungeons/wotlk/hallsofstone/HallsOfStoneStrategy.cpp index 78d73f4d..b13d4d63 100644 --- a/src/strategy/dungeons/wotlk/hallsofstone/HallsOfStoneStrategy.cpp +++ b/src/strategy/dungeons/wotlk/hallsofstone/HallsOfStoneStrategy.cpp @@ -1,7 +1,6 @@ #include "HallsOfStoneStrategy.h" #include "HallsOfStoneMultipliers.h" - void WotlkDungeonHoSStrategy::InitTriggers(std::vector &triggers) { // Maiden of Grief diff --git a/src/strategy/dungeons/wotlk/hallsofstone/HallsOfStoneStrategy.h b/src/strategy/dungeons/wotlk/hallsofstone/HallsOfStoneStrategy.h index 62084838..ee26aa2c 100644 --- a/src/strategy/dungeons/wotlk/hallsofstone/HallsOfStoneStrategy.h +++ b/src/strategy/dungeons/wotlk/hallsofstone/HallsOfStoneStrategy.h @@ -5,7 +5,6 @@ #include "AiObjectContext.h" #include "Strategy.h" - class WotlkDungeonHoSStrategy : public Strategy { public: diff --git a/src/strategy/dungeons/wotlk/nexus/NexusMultipliers.cpp b/src/strategy/dungeons/wotlk/nexus/NexusMultipliers.cpp index 764c9f34..7adc79b4 100644 --- a/src/strategy/dungeons/wotlk/nexus/NexusMultipliers.cpp +++ b/src/strategy/dungeons/wotlk/nexus/NexusMultipliers.cpp @@ -94,4 +94,3 @@ float OrmorokMultiplier::GetValue(Action* action) } return 1.0f; } - diff --git a/src/strategy/dungeons/wotlk/nexus/NexusStrategy.cpp b/src/strategy/dungeons/wotlk/nexus/NexusStrategy.cpp index e471d3b8..22a85f50 100644 --- a/src/strategy/dungeons/wotlk/nexus/NexusStrategy.cpp +++ b/src/strategy/dungeons/wotlk/nexus/NexusStrategy.cpp @@ -1,7 +1,6 @@ #include "NexusStrategy.h" #include "NexusMultipliers.h" - void WotlkDungeonNexStrategy::InitTriggers(std::vector &triggers) { // Horde Commander (Alliance N)/Commander Kolurg (Alliance H) diff --git a/src/strategy/dungeons/wotlk/nexus/NexusStrategy.h b/src/strategy/dungeons/wotlk/nexus/NexusStrategy.h index f9ecf426..c78225b9 100644 --- a/src/strategy/dungeons/wotlk/nexus/NexusStrategy.h +++ b/src/strategy/dungeons/wotlk/nexus/NexusStrategy.h @@ -5,7 +5,6 @@ #include "AiObjectContext.h" #include "Strategy.h" - class WotlkDungeonNexStrategy : public Strategy { public: diff --git a/src/strategy/dungeons/wotlk/oculus/OculusMultipliers.cpp b/src/strategy/dungeons/wotlk/oculus/OculusMultipliers.cpp index 5789d696..7be543ee 100644 --- a/src/strategy/dungeons/wotlk/oculus/OculusMultipliers.cpp +++ b/src/strategy/dungeons/wotlk/oculus/OculusMultipliers.cpp @@ -40,7 +40,7 @@ float OccFlyingMultiplier::GetValue(Action* action) float UromMultiplier::GetValue(Action* action) { - if(GetPhaseByCurrentPosition(bot) < 3) + if (GetPhaseByCurrentPosition(bot) < 3) { Unit* target = action->GetTarget(); if (target && target->GetEntry() == NPC_MAGE_LORD_UROM) diff --git a/src/strategy/dungeons/wotlk/oculus/OculusStrategy.cpp b/src/strategy/dungeons/wotlk/oculus/OculusStrategy.cpp index 1220e56f..3e98dfa6 100644 --- a/src/strategy/dungeons/wotlk/oculus/OculusStrategy.cpp +++ b/src/strategy/dungeons/wotlk/oculus/OculusStrategy.cpp @@ -1,7 +1,6 @@ #include "OculusStrategy.h" #include "OculusMultipliers.h" - void WotlkDungeonOccStrategy::InitTriggers(std::vector &triggers) { // Drakos the Interrogator diff --git a/src/strategy/dungeons/wotlk/oculus/OculusStrategy.h b/src/strategy/dungeons/wotlk/oculus/OculusStrategy.h index a734f2f4..2accfd8f 100644 --- a/src/strategy/dungeons/wotlk/oculus/OculusStrategy.h +++ b/src/strategy/dungeons/wotlk/oculus/OculusStrategy.h @@ -5,7 +5,6 @@ #include "AiObjectContext.h" #include "Strategy.h" - class WotlkDungeonOccStrategy : public Strategy { public: diff --git a/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomActions.cpp b/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomActions.cpp index 703c7454..916bf292 100644 --- a/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomActions.cpp +++ b/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomActions.cpp @@ -2,7 +2,6 @@ #include "OldKingdomActions.h" #include "OldKingdomStrategy.h" - bool AttackNadoxGuardianAction::Execute(Event event) { Unit* target = AI_VALUE2(Unit*, "find target", "ahn'kahar guardian"); diff --git a/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomStrategy.cpp b/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomStrategy.cpp index 850fcfcb..50a38412 100644 --- a/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomStrategy.cpp +++ b/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomStrategy.cpp @@ -1,7 +1,6 @@ #include "OldKingdomStrategy.h" #include "OldKingdomMultipliers.h" - void WotlkDungeonOKStrategy::InitTriggers(std::vector &triggers) { // Elder Nadox diff --git a/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomStrategy.h b/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomStrategy.h index 03c5085e..75c47555 100644 --- a/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomStrategy.h +++ b/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomStrategy.h @@ -5,7 +5,6 @@ #include "AiObjectContext.h" #include "Strategy.h" - class WotlkDungeonOKStrategy : public Strategy { public: diff --git a/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomTriggers.cpp b/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomTriggers.cpp index 2de9190c..6b72f656 100644 --- a/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomTriggers.cpp +++ b/src/strategy/dungeons/wotlk/oldkingdom/OldKingdomTriggers.cpp @@ -3,7 +3,6 @@ #include "AiObject.h" #include "AiObjectContext.h" - bool NadoxGuardianTrigger::IsActive() { if (botAI->IsHeal(bot)) { return false; } diff --git a/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronActions.cpp b/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronActions.cpp index fee0ed60..f34b9846 100644 --- a/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronActions.cpp +++ b/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronActions.cpp @@ -136,7 +136,6 @@ bool IckAndKrickAction::PoisonNova(bool poisonNova, Unit* boss) return false; } - bool IckAndKrickAction::ExplosiveBarrage(bool explosiveBarrage, Unit* boss) { std::vector orbs; diff --git a/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronMultipliers.cpp b/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronMultipliers.cpp index cbe18778..be36e480 100644 --- a/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronMultipliers.cpp +++ b/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronMultipliers.cpp @@ -5,8 +5,6 @@ #include "MovementActions.h" #include "PitOfSaronTriggers.h" - - float IckAndKrickMultiplier::GetValue(Action* action) { Unit* boss = AI_VALUE2(Unit*, "find target", "ick"); diff --git a/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronMultipliers.h b/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronMultipliers.h index fabf6319..bcafc01a 100644 --- a/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronMultipliers.h +++ b/src/strategy/dungeons/wotlk/pitofsaron/PitOfSaronMultipliers.h @@ -20,5 +20,4 @@ public: float GetValue(Action* action) override; }; - #endif diff --git a/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionActions.cpp b/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionActions.cpp index 0cb1ee0e..5dd1ef8b 100644 --- a/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionActions.cpp +++ b/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionActions.cpp @@ -9,7 +9,6 @@ #include "GenericActions.h" #include - bool ToCLanceAction::Execute(Event event) { // If already has lance equipped, do nothing diff --git a/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionStrategy.cpp b/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionStrategy.cpp index 4c439e18..e1f97000 100644 --- a/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionStrategy.cpp +++ b/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionStrategy.cpp @@ -1,7 +1,6 @@ #include "TrialOfTheChampionStrategy.h" #include "TrialOfTheChampionMultipliers.h" - void WotlkDungeonToCStrategy::InitTriggers(std::vector &triggers) { triggers.push_back(new TriggerNode("toc lance", diff --git a/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionTriggers.cpp b/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionTriggers.cpp index 81cfefec..6c388382 100644 --- a/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionTriggers.cpp +++ b/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionTriggers.cpp @@ -3,7 +3,6 @@ #include "AiObject.h" #include "AiObjectContext.h" - bool ToCLanceTrigger::IsActive() { if (bot->GetVehicle()) @@ -82,4 +81,3 @@ bool ToCEadricTrigger::IsActive() return true; } - diff --git a/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionTriggers.h b/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionTriggers.h index c92cd878..0daaf914 100644 --- a/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionTriggers.h +++ b/src/strategy/dungeons/wotlk/trialofthechampion/TrialOfTheChampionTriggers.h @@ -16,20 +16,16 @@ enum TocC_IDs //Eadric SPELL_RADIANCE = 66935, - // Objects OBJECT_LANCE_RACK = 196398, - // Items ITEM_LANCE = 46106, - // Vehicles NPC_ARGENT_WARHORSE = 35644, NPC_ARGENT_BATTLEWORG = 36558, - // Horde Champions NPC_MOKRA = 35572, NPC_ERESSEA = 35569, @@ -37,7 +33,6 @@ enum TocC_IDs NPC_ZULTORE = 35570, NPC_VISCERI = 35617, - // Alliance Champions NPC_JACOB = 34705, NPC_AMBROSE = 34702, @@ -45,7 +40,6 @@ enum TocC_IDs NPC_JAELYNE = 34657, NPC_LANA = 34703, - // Grand Champion Minions NPC_IRONFORGE_MINION = 35329, NPC_STORMWIND_MINION = 35328, @@ -58,7 +52,6 @@ enum TocC_IDs NPC_SENJIN_MINION = 35323, NPC_UNDERCITY_MINION = 35327, - // Rest of the bosses and npcs NPC_EADRIC = 35119, NPC_EADRIC_H = 35518, diff --git a/src/strategy/dungeons/wotlk/utgardekeep/UtgardeKeepStrategy.cpp b/src/strategy/dungeons/wotlk/utgardekeep/UtgardeKeepStrategy.cpp index 681083ef..ee7d102a 100644 --- a/src/strategy/dungeons/wotlk/utgardekeep/UtgardeKeepStrategy.cpp +++ b/src/strategy/dungeons/wotlk/utgardekeep/UtgardeKeepStrategy.cpp @@ -1,7 +1,6 @@ #include "UtgardeKeepStrategy.h" #include "UtgardeKeepMultipliers.h" - void WotlkDungeonUKStrategy::InitTriggers(std::vector &triggers) { // Prince Keleseth diff --git a/src/strategy/dungeons/wotlk/utgardekeep/UtgardeKeepStrategy.h b/src/strategy/dungeons/wotlk/utgardekeep/UtgardeKeepStrategy.h index 90873feb..41ce1e76 100644 --- a/src/strategy/dungeons/wotlk/utgardekeep/UtgardeKeepStrategy.h +++ b/src/strategy/dungeons/wotlk/utgardekeep/UtgardeKeepStrategy.h @@ -5,7 +5,6 @@ #include "AiObjectContext.h" #include "Strategy.h" - class WotlkDungeonUKStrategy : public Strategy { public: diff --git a/src/strategy/dungeons/wotlk/utgardepinnacle/UtgardePinnacleStrategy.cpp b/src/strategy/dungeons/wotlk/utgardepinnacle/UtgardePinnacleStrategy.cpp index b6e33449..bcc4399c 100644 --- a/src/strategy/dungeons/wotlk/utgardepinnacle/UtgardePinnacleStrategy.cpp +++ b/src/strategy/dungeons/wotlk/utgardepinnacle/UtgardePinnacleStrategy.cpp @@ -1,7 +1,6 @@ #include "UtgardePinnacleStrategy.h" #include "UtgardePinnacleMultipliers.h" - void WotlkDungeonUPStrategy::InitTriggers(std::vector &triggers) { // Svala Sorrowgrave diff --git a/src/strategy/dungeons/wotlk/utgardepinnacle/UtgardePinnacleStrategy.h b/src/strategy/dungeons/wotlk/utgardepinnacle/UtgardePinnacleStrategy.h index e8f45363..8ce816f8 100644 --- a/src/strategy/dungeons/wotlk/utgardepinnacle/UtgardePinnacleStrategy.h +++ b/src/strategy/dungeons/wotlk/utgardepinnacle/UtgardePinnacleStrategy.h @@ -5,7 +5,6 @@ #include "AiObjectContext.h" #include "Strategy.h" - class WotlkDungeonUPStrategy : public Strategy { public: diff --git a/src/strategy/dungeons/wotlk/violethold/VioletHoldActions.cpp b/src/strategy/dungeons/wotlk/violethold/VioletHoldActions.cpp index 009da3b1..b590642d 100644 --- a/src/strategy/dungeons/wotlk/violethold/VioletHoldActions.cpp +++ b/src/strategy/dungeons/wotlk/violethold/VioletHoldActions.cpp @@ -2,7 +2,6 @@ #include "VioletHoldActions.h" #include "VioletHoldStrategy.h" - bool AttackErekemAction::Execute(Event event) { // Focus boss first, adds after diff --git a/src/strategy/dungeons/wotlk/violethold/VioletHoldStrategy.cpp b/src/strategy/dungeons/wotlk/violethold/VioletHoldStrategy.cpp index 59f2225b..5b610300 100644 --- a/src/strategy/dungeons/wotlk/violethold/VioletHoldStrategy.cpp +++ b/src/strategy/dungeons/wotlk/violethold/VioletHoldStrategy.cpp @@ -1,7 +1,6 @@ #include "VioletHoldStrategy.h" #include "VioletHoldMultipliers.h" - void WotlkDungeonVHStrategy::InitTriggers(std::vector &triggers) { // Erekem diff --git a/src/strategy/dungeons/wotlk/violethold/VioletHoldStrategy.h b/src/strategy/dungeons/wotlk/violethold/VioletHoldStrategy.h index 16708871..a06f64ce 100644 --- a/src/strategy/dungeons/wotlk/violethold/VioletHoldStrategy.h +++ b/src/strategy/dungeons/wotlk/violethold/VioletHoldStrategy.h @@ -5,7 +5,6 @@ #include "AiObjectContext.h" #include "Strategy.h" - class WotlkDungeonVHStrategy : public Strategy { public: diff --git a/src/strategy/dungeons/wotlk/violethold/VioletHoldTriggers.cpp b/src/strategy/dungeons/wotlk/violethold/VioletHoldTriggers.cpp index bd2eee76..87284b0e 100644 --- a/src/strategy/dungeons/wotlk/violethold/VioletHoldTriggers.cpp +++ b/src/strategy/dungeons/wotlk/violethold/VioletHoldTriggers.cpp @@ -3,7 +3,6 @@ #include "AiObject.h" #include "AiObjectContext.h" - bool ErekemTargetTrigger::IsActive() { Unit* boss = AI_VALUE2(Unit*, "find target", "erekem"); diff --git a/src/strategy/hunter/GenericHunterStrategy.h b/src/strategy/hunter/GenericHunterStrategy.h index 0fa9ed69..01aef4ce 100644 --- a/src/strategy/hunter/GenericHunterStrategy.h +++ b/src/strategy/hunter/GenericHunterStrategy.h @@ -21,7 +21,6 @@ public: uint32 GetType() const override { return CombatStrategy::GetType() | STRATEGY_TYPE_RANGED | STRATEGY_TYPE_DPS; } }; - class AoEHunterStrategy : public CombatStrategy { public: @@ -58,5 +57,4 @@ public: std::string const getName() override { return "trap weave"; } }; - #endif diff --git a/src/strategy/paladin/PaladinActions.cpp b/src/strategy/paladin/PaladinActions.cpp index 7dbf7c91..190ecb26 100644 --- a/src/strategy/paladin/PaladinActions.cpp +++ b/src/strategy/paladin/PaladinActions.cpp @@ -250,7 +250,6 @@ bool CastBlessingOfWisdomOnPartyAction::Execute(Event event) return botAI->CastSpell(castName, target); } - Value* CastBlessingOfSanctuaryOnPartyAction::GetTargetValue() { return context->GetValue( @@ -488,7 +487,6 @@ Unit* CastRighteousDefenseAction::GetTarget() return current_target->GetVictim(); } - bool CastDivineSacrificeAction::isUseful() { return GetTarget() && (GetTarget() != nullptr) && CastSpellAction::isUseful() && diff --git a/src/strategy/priest/GenericPriestStrategy.cpp b/src/strategy/priest/GenericPriestStrategy.cpp index cbd838ab..acf9d39d 100644 --- a/src/strategy/priest/GenericPriestStrategy.cpp +++ b/src/strategy/priest/GenericPriestStrategy.cpp @@ -109,4 +109,3 @@ void PriestHealerDpsStrategy::InitTriggers(std::vector& triggers) new NextAction("mind sear", ACTION_DEFAULT + 0.5f), nullptr))); } - diff --git a/src/strategy/raids/aq20/RaidAq20Actions.cpp b/src/strategy/raids/aq20/RaidAq20Actions.cpp index 9b7e4065..1bf33147 100644 --- a/src/strategy/raids/aq20/RaidAq20Actions.cpp +++ b/src/strategy/raids/aq20/RaidAq20Actions.cpp @@ -3,7 +3,6 @@ #include "Playerbots.h" #include "RaidAq20Utils.h" - bool Aq20UseCrystalAction::Execute(Event event) { if (Unit* boss = AI_VALUE2(Unit*, "find target", "ossirian the unscarred")) diff --git a/src/strategy/raids/aq20/RaidAq20Triggers.cpp b/src/strategy/raids/aq20/RaidAq20Triggers.cpp index fbda881a..1a580d6b 100644 --- a/src/strategy/raids/aq20/RaidAq20Triggers.cpp +++ b/src/strategy/raids/aq20/RaidAq20Triggers.cpp @@ -3,7 +3,6 @@ #include "SharedDefines.h" #include "RaidAq20Utils.h" - bool Aq20MoveToCrystalTrigger::IsActive() { if (Unit* boss = AI_VALUE2(Unit*, "find target", "ossirian the unscarred")) diff --git a/src/strategy/raids/gruulslair/RaidGruulsLairHelpers.h b/src/strategy/raids/gruulslair/RaidGruulsLairHelpers.h index aa5a83ac..8cd01c2e 100644 --- a/src/strategy/raids/gruulslair/RaidGruulsLairHelpers.h +++ b/src/strategy/raids/gruulslair/RaidGruulsLairHelpers.h @@ -6,57 +6,57 @@ namespace GruulsLairHelpers { - enum GruulsLairSpells - { - // High King Maulgar - SPELL_WHIRLWIND = 33238, + enum GruulsLairSpells + { + // High King Maulgar + SPELL_WHIRLWIND = 33238, - // Krosh Firehand - SPELL_SPELL_SHIELD = 33054, + // Krosh Firehand + SPELL_SPELL_SHIELD = 33054, - // Hunter - SPELL_MISDIRECTION = 34477, + // Hunter + SPELL_MISDIRECTION = 34477, - // Warlock - SPELL_BANISH = 18647, // Rank 2 + // Warlock + SPELL_BANISH = 18647, // Rank 2 - // Gruul the Dragonkiller - SPELL_GROUND_SLAM_1 = 33525, - SPELL_GROUND_SLAM_2 = 39187, - }; + // Gruul the Dragonkiller + SPELL_GROUND_SLAM_1 = 33525, + SPELL_GROUND_SLAM_2 = 39187, + }; - enum GruulsLairNPCs - { - NPC_WILD_FEL_STALKER = 18847, - }; + enum GruulsLairNPCs + { + NPC_WILD_FEL_STALKER = 18847, + }; - bool IsAnyOgreBossAlive(PlayerbotAI* botAI); - void MarkTargetWithIcon(Player* bot, Unit* target, uint8 iconId); - void MarkTargetWithSquare(Player* bot, Unit* target); - void MarkTargetWithStar(Player* bot, Unit* target); - void MarkTargetWithCircle(Player* bot, Unit* target); - void MarkTargetWithDiamond(Player* bot, Unit* target); - void MarkTargetWithTriangle(Player* bot, Unit* target); - void SetRtiTarget(PlayerbotAI* botAI, const std::string& rtiName, Unit* target); - bool IsKroshMageTank(PlayerbotAI* botAI, Player* bot); - bool IsKigglerMoonkinTank(PlayerbotAI* botAI, Player* bot); - bool IsPositionSafe(PlayerbotAI* botAI, Player* bot, Position pos); - bool TryGetNewSafePosition(PlayerbotAI* botAI, Player* bot, Position& outPos); + bool IsAnyOgreBossAlive(PlayerbotAI* botAI); + void MarkTargetWithIcon(Player* bot, Unit* target, uint8 iconId); + void MarkTargetWithSquare(Player* bot, Unit* target); + void MarkTargetWithStar(Player* bot, Unit* target); + void MarkTargetWithCircle(Player* bot, Unit* target); + void MarkTargetWithDiamond(Player* bot, Unit* target); + void MarkTargetWithTriangle(Player* bot, Unit* target); + void SetRtiTarget(PlayerbotAI* botAI, const std::string& rtiName, Unit* target); + bool IsKroshMageTank(PlayerbotAI* botAI, Player* bot); + bool IsKigglerMoonkinTank(PlayerbotAI* botAI, Player* bot); + bool IsPositionSafe(PlayerbotAI* botAI, Player* bot, Position pos); + bool TryGetNewSafePosition(PlayerbotAI* botAI, Player* bot, Position& outPos); - struct Location - { - float x, y, z; - }; + struct Location + { + float x, y, z; + }; - namespace GruulsLairLocations - { - extern const Location MaulgarTankPosition; - extern const Location OlmTankPosition; - extern const Location BlindeyeTankPosition; - extern const Location KroshTankPosition; - extern const Location MaulgarRoomCenter; - extern const Location GruulTankPosition; - } + namespace GruulsLairLocations + { + extern const Location MaulgarTankPosition; + extern const Location OlmTankPosition; + extern const Location BlindeyeTankPosition; + extern const Location KroshTankPosition; + extern const Location MaulgarRoomCenter; + extern const Location GruulTankPosition; + } } #endif diff --git a/src/strategy/raids/icecrown/RaidIccActions.cpp b/src/strategy/raids/icecrown/RaidIccActions.cpp index a1b7100f..4f763ecb 100644 --- a/src/strategy/raids/icecrown/RaidIccActions.cpp +++ b/src/strategy/raids/icecrown/RaidIccActions.cpp @@ -116,7 +116,7 @@ bool IccSpikeAction::HandleSpikeTargeting(Unit* boss) // First check for alive spikes for (const auto entry : spikeEntries) { - for (const auto& guid : spikes) + for (auto const& guid : spikes) { if (Unit* unit = botAI->GetUnit(guid)) { @@ -238,7 +238,7 @@ bool IccRangedPositionLadyDeathwhisperAction::MaintainRangedSpacing() float totalY = 0.0f; int nearbyCount = 0; - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* member = botAI->GetUnit(memberGuid); if (!member || !member->IsAlive() || member == bot) @@ -340,7 +340,7 @@ bool IccAddsLadyDeathwhisperAction::Execute(Event event) bool IccAddsLadyDeathwhisperAction::IsTargetedByShade(uint32 shadeEntry) { const GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - for (const auto& npcGuid : npcs) + for (auto const& npcGuid : npcs) { Unit* unit = botAI->GetUnit(npcGuid); if (unit && unit->GetEntry() == shadeEntry && unit->GetVictim() == bot) @@ -376,9 +376,9 @@ bool IccAddsLadyDeathwhisperAction::HandleAddTargeting(Unit* boss) bool hasValidAdds = false; // First check for alive adds - for (const auto& entry : addEntriesLady) + for (auto const& entry : addEntriesLady) { - for (const auto& guid : targets) + for (auto const& guid : targets) { Unit* unit = botAI->GetUnit(guid); if (unit && unit->IsAlive() && unit->GetEntry() == entry) @@ -427,7 +427,7 @@ bool IccShadeLadyDeathwhisperAction::Execute(Event event) // Get the nearest hostile NPCs const GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - for (const auto& npcGuid : npcs) + for (auto const& npcGuid : npcs) { Unit* shade = botAI->GetUnit(npcGuid); @@ -506,7 +506,7 @@ bool IccRottingFrostGiantTankPositionAction::Execute(Event event) std::map targetCounts; // First, identify all infected bots and their current targets (approximate) - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* member = botAI->GetUnit(memberGuid); if (!member || !member->IsAlive() || member == bot) @@ -520,7 +520,7 @@ bool IccRottingFrostGiantTankPositionAction::Execute(Event event) float minDist = 5.0f; // Only count if they're close enough to likely be targeting Unit* likelyTarget = nullptr; - for (const auto& targetGuid : members) + for (auto const& targetGuid : members) { Unit* potentialTarget = botAI->GetUnit(targetGuid); if (!potentialTarget || !potentialTarget->IsAlive() || potentialTarget == member) @@ -551,7 +551,7 @@ bool IccRottingFrostGiantTankPositionAction::Execute(Event event) std::vector> viableTargets; // First try to find ranged, non-infected, non-cured bots - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* member = botAI->GetUnit(memberGuid); if (!member || !member->IsAlive() || member == bot) @@ -630,7 +630,7 @@ bool IccRottingFrostGiantTankPositionAction::Execute(Event event) float totalY = 0.0f; int nearbyCount = 0; - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* member = botAI->GetUnit(memberGuid); if (!member || !member->IsAlive() || member == bot) @@ -726,7 +726,7 @@ Unit* IccCannonFireAction::FindValidCannonTarget() { const GuidVector attackers = AI_VALUE(GuidVector, "possible targets no los"); - for (const auto& attackerGuid : attackers) + for (auto const& attackerGuid : attackers) { Unit* unit = botAI->GetUnit(attackerGuid); if (!unit) @@ -774,7 +774,7 @@ Unit* IccGunshipEnterCannonAction::FindBestAvailableCannon() Unit* bestVehicle = nullptr; const GuidVector npcs = AI_VALUE(GuidVector, "nearest vehicles"); - for (const auto& npcGuid : npcs) + for (auto const& npcGuid : npcs) { Unit* vehicleBase = botAI->GetUnit(npcGuid); if (!IsValidCannon(vehicleBase, validCannonEntries)) @@ -1006,8 +1006,6 @@ bool IccDbsTankPositionAction::Execute(Event event) ICC_DBS_TANK_POSITION.GetPositionZ(), false, false, false, true, MovementPriority::MOVEMENT_NORMAL); - - // Early return if this tank has Rune of Blood if (botAI->GetAura("Rune of Blood", bot)) return true; @@ -1041,7 +1039,7 @@ bool IccDbsTankPositionAction::CrowdControlBloodBeasts() bool appliedCC = false; - for (const auto& npc : npcs) + for (auto const& npc : npcs) { Unit* unit = botAI->GetUnit(npc); if (!unit || !unit->IsAlive()) @@ -1143,7 +1141,7 @@ bool IccDbsTankPositionAction::EvadeBloodBeasts() // Get the nearest hostile NPCs const GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - for (const auto& npc : npcs) + for (auto const& npc : npcs) { Unit* unit = botAI->GetUnit(npc); if (!unit) @@ -1326,7 +1324,7 @@ bool IccFestergutGroupPositionAction::HasSporesInGroup() { const GuidVector members = AI_VALUE(GuidVector, "group members"); - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* unit = botAI->GetUnit(memberGuid); if (unit && unit->HasAura(SPELL_GAS_SPORE)) @@ -1564,7 +1562,7 @@ IccFestergutSporeAction::SporeInfo IccFestergutSporeAction::FindSporedPlayers() SporeInfo info; const GuidVector members = AI_VALUE(GuidVector, "group members"); - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* unit = botAI->GetUnit(memberGuid); if (!unit) @@ -1612,7 +1610,7 @@ bool IccFestergutSporeAction::CheckMainTankSpore() { const GuidVector members = AI_VALUE(GuidVector, "group members"); - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* unit = botAI->GetUnit(memberGuid); if (!unit) @@ -1702,14 +1700,13 @@ bool IccRotfaceTankPositionAction::HandleAssistTankPositioning(Unit* boss) return HandleBigOozePositioning(boss); } - bool IccRotfaceTankPositionAction::HandleBigOozePositioning(Unit* boss) { // Find all big oozes GuidVector bigOozes = AI_VALUE(GuidVector, "nearest hostile npcs"); std::vector activeBigOozes; - for (const auto& guid : bigOozes) + for (auto const& guid : bigOozes) { Unit* unit = botAI->GetUnit(guid); if (unit && unit->IsAlive() && unit->GetEntry() == NPC_BIG_OOZE && unit->IsVisible()) @@ -1799,7 +1796,7 @@ bool IccRotfaceTankPositionAction::HandleBigOozePositioning(Unit* boss) GuidVector puddles = AI_VALUE(GuidVector, "nearest hostile npcs"); bool isSafeFromPuddles = true; - for (const auto& puddleGuid : puddles) + for (auto const& puddleGuid : puddles) { Unit* puddle = botAI->GetUnit(puddleGuid); if (puddle && botAI->GetAura("Ooze Flood", puddle)) @@ -1827,7 +1824,6 @@ bool IccRotfaceTankPositionAction::HandleBigOozePositioning(Unit* boss) return false; } - bool IccRotfaceGroupPositionAction::Execute(Event event) { Unit* boss = AI_VALUE2(Unit*, "find target", "rotface"); @@ -1837,7 +1833,7 @@ bool IccRotfaceGroupPositionAction::Execute(Event event) const GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); bool floodPresent = false; - for (const auto& npc : npcs) + for (auto const& npc : npcs) { Unit* unit = botAI->GetUnit(npc); if (!unit || !botAI->HasAura("Ooze Flood", unit)) @@ -1876,7 +1872,7 @@ bool IccRotfaceGroupPositionAction::HandlePuddleAvoidance(Unit* boss) { const GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - for (const auto& npc : npcs) + for (auto const& npc : npcs) { Unit* unit = botAI->GetUnit(npc); if (!unit || !botAI->HasAura("Ooze Flood", unit)) @@ -2062,7 +2058,7 @@ bool IccRotfaceGroupPositionAction::FindAndMoveFromClosestMember(Unit* boss, Uni const GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); Unit* puddle = nullptr; - for (const auto& npc : npcs) + for (auto const& npc : npcs) { Unit* unit = botAI->GetUnit(npc); if (!unit || !botAI->HasAura("Ooze Flood", unit)) @@ -2087,11 +2083,11 @@ bool IccRotfaceGroupPositionAction::FindAndMoveFromClosestMember(Unit* boss, Uni float totalY = 0.0f; int nearbyCount = 0; - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* member = botAI->GetUnit(memberGuid); if (!member || !member->IsAlive() || member == bot || (smallOoze && smallOoze->GetVictim() == member) || - (member->GetTypeId() == TYPEID_PLAYER && botAI->IsAssistTank(static_cast(member)))) + (member->IsPlayer() && botAI->IsAssistTank(static_cast(member)))) continue; const float distance = bot->GetExactDist2d(member); @@ -2202,7 +2198,7 @@ bool IccRotfaceMoveAwayFromExplosionAction::MoveToRandomSafeLocation() // Ensure the position is at least 30 yards away from any puddle const GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - for (const auto& npc : npcs) + for (auto const& npc : npcs) { Unit* puddle = botAI->GetUnit(npc); if (!puddle || !botAI->HasAura("Ooze Flood", puddle)) @@ -2287,7 +2283,7 @@ Unit* IccPutricideGrowingOozePuddleAction::FindClosestThreateningPuddle() float closestDistance = FLT_MAX; float closestSafeDistance = BASE_RADIUS; - for (const auto& npc : npcs) + for (auto const& npc : npcs) { Unit* unit = botAI->GetUnit(npc); if (!unit || unit->GetEntry() != NPC_GROWING_OOZE_PUDDLE) @@ -2402,7 +2398,7 @@ bool IccPutricideGrowingOozePuddleAction::IsPositionTooCloseToOtherPuddles(float static const float STACK_MULTIPLIER = 0.6f; GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - for (const auto& npc : npcs) + for (auto const& npc : npcs) { Unit* unit = botAI->GetUnit(npc); if (!unit || unit == ignorePuddle || unit->GetEntry() != NPC_GROWING_OOZE_PUDDLE) @@ -2445,7 +2441,7 @@ bool IccPutricideVolatileOozeAction::Execute(Event event) // Find all alive oozes std::vector aliveOozes; const GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - for (const auto& guid : npcs) + for (auto const& guid : npcs) { Unit* unit = botAI->GetUnit(guid); if (unit && unit->IsAlive() && unit->GetEntry() == ooze->GetEntry()) @@ -2533,7 +2529,6 @@ Unit* IccPutricideVolatileOozeAction::FindAuraTarget() return nullptr; } - bool IccPutricideGasCloudAction::Execute(Event event) { Unit* gasCloud = AI_VALUE2(Unit*, "find target", "gas cloud"); @@ -2560,7 +2555,7 @@ bool IccPutricideGasCloudAction::Execute(Event event) // Find all alive gasCloud std::vector aliveGasCloud; const GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - for (const auto& guid : npcs) + for (auto const& guid : npcs) { Unit* unit = botAI->GetUnit(guid); if (unit && unit->IsAlive() && unit->GetEntry() == gasCloud->GetEntry()) @@ -2613,7 +2608,7 @@ bool IccPutricideGasCloudAction::HandleGaseousBloatMovement(Unit* gasCloud) // Gather all choking gas bombs GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); std::vector gasBombs; - for (const auto& guid : npcs) + for (auto const& guid : npcs) { Unit* unit = botAI->GetUnit(guid); if (unit && unit->IsAlive() && unit->GetEntry() == NPC_CHOKING_GAS_BOMB) @@ -3048,7 +3043,6 @@ bool IccPutricideAvoidMalleableGooAction::HandleUnboundPlague(Unit* boss) return false; } - bool IccPutricideAvoidMalleableGooAction::HandleBossPositioning(Unit* boss) { if (botAI->IsTank(bot)) @@ -3128,7 +3122,7 @@ Position IccPutricideAvoidMalleableGooAction::CalculateBossPosition(Unit* boss, bool IccPutricideAvoidMalleableGooAction::HasObstacleBetween(const Position& from, const Position& to) { GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - for (const auto& npc : npcs) + for (auto const& npc : npcs) { Unit* unit = botAI->GetUnit(npc); if (!unit || !unit->IsAlive()) @@ -3261,7 +3255,7 @@ bool IccBpcKelesethTankAction::Execute(Event event) if (boss->GetVictim() == bot) { GuidVector targets = AI_VALUE(GuidVector, "possible targets"); - for (const auto& targetGuid : targets) + for (auto const& targetGuid : targets) { Unit* nucleus = botAI->GetUnit(targetGuid); if (nucleus && nucleus->IsAlive() && nucleus->GetEntry() == NPC_DARK_NUCLEUS) @@ -3392,7 +3386,7 @@ void IccBpcMainTankAction::MarkEmpoweredPrince() Unit* empoweredPrince = nullptr; const GuidVector& targets = AI_VALUE(GuidVector, "possible targets"); - for (const auto& targetGuid : targets) + for (auto const& targetGuid : targets) { Unit* unit = botAI->GetUnit(targetGuid); if (!unit || !unit->IsAlive()) @@ -3478,7 +3472,7 @@ bool IccBpcEmpoweredVortexAction::MaintainRangedSpacing() float totalY = 0.0f; int nearbyCount = 0; - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* member = botAI->GetUnit(memberGuid); if (!member || !member->IsAlive() || member == bot) @@ -3557,7 +3551,7 @@ bool IccBpcEmpoweredVortexAction::HandleEmpoweredVortexSpread() float totalY = 0.0f; int nearbyCount = 0; - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* member = botAI->GetUnit(memberGuid); if (!member || !member->IsAlive() || member == bot) @@ -3676,7 +3670,7 @@ Unit* IccBpcKineticBombAction::FindOptimalKineticBomb() // Gather all valid kinetic bombs std::vector kineticBombs; - for (const auto& guid : targets) + for (auto const& guid : targets) { Unit* unit = botAI->GetUnit(guid); if (!unit || !unit->IsAlive()) @@ -3764,7 +3758,6 @@ bool IccBpcKineticBombAction::IsBombAlreadyHandled(Unit* bomb, Group* group) return false; } - bool IccBpcBallOfFlameAction::Execute(Event event) { Unit* boss = AI_VALUE2(Unit*, "find target", "prince taldaram"); @@ -3814,7 +3807,7 @@ bool IccBpcBallOfFlameAction::Execute(Event event) { const float SAFE_DIST = 15.0f; GuidVector members = AI_VALUE(GuidVector, "group members"); - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* member = botAI->GetUnit(memberGuid); if (!member || !member->IsAlive() || member == bot) @@ -4341,7 +4334,7 @@ bool IccBqlGroupPositionAction::HandleGroupPosition(Unit* boss, Aura* frenzyAura // Gather all ranged and healers, sort by GUID for deterministic assignment std::vector rangedBots; std::vector healers; - for (const auto& guid : members) + for (auto const& guid : members) { Unit* member = botAI->GetUnit(guid); if (!member || !member->IsAlive()) @@ -4457,7 +4450,7 @@ bool IccBqlGroupPositionAction::HandleGroupPosition(Unit* boss, Aura* frenzyAura } // Also spread from swarming shadows GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - for (const auto& npcGuid : npcs) + for (auto const& npcGuid : npcs) { Unit* unit = botAI->GetUnit(npcGuid); if (unit && unit->IsAlive() && unit->GetEntry() == NPC_SWARMING_SHADOWS) @@ -4605,7 +4598,6 @@ bool IccBqlGroupPositionAction::HandleGroupPosition(Unit* boss, Aura* frenzyAura return true; } - return false; } @@ -4798,7 +4790,7 @@ Player* IccBqlVampiricBiteAction::FindBestBiteTarget(Group* group) } // Sort by distance - auto sortByDistance = [](const auto& a, const auto& b) { return a.second < b.second; }; + auto sortByDistance = [](auto const& a, auto const& b) { return a.second < b.second; }; std::sort(dpsTargets.begin(), dpsTargets.end(), sortByDistance); std::sort(healTargets.begin(), healTargets.end(), sortByDistance); @@ -4955,7 +4947,7 @@ bool IccValithriaGroupAction::Execute(Event event) // Tank behavior if (botAI->IsTank(bot)) { - for (const auto& targetGuid : AI_VALUE(GuidVector, "possible targets")) + for (auto const& targetGuid : AI_VALUE(GuidVector, "possible targets")) { if (Unit* unit = botAI->GetUnit(targetGuid)) { @@ -4965,7 +4957,7 @@ bool IccValithriaGroupAction::Execute(Event event) // Skip if unit is already attacking any tank if (Unit* victim = unit->GetVictim()) { - if (victim->GetTypeId() == TYPEID_PLAYER && botAI->IsTank(static_cast(victim))) + if (victim->IsPlayer() && botAI->IsTank(static_cast(victim))) { continue; } @@ -5133,7 +5125,7 @@ bool IccValithriaGroupAction::Handle25ManGroupLogic() } // Sort by GUID for consistent ordering - std::sort(nonHeals.begin(), nonHeals.end(), [](const auto& a, const auto& b) { return a.first < b.first; }); + std::sort(nonHeals.begin(), nonHeals.end(), [](auto const& a, auto const& b) { return a.first < b.first; }); // Assign to groups std::vector group1, group2; @@ -5168,7 +5160,6 @@ bool IccValithriaGroupAction::Handle25ManGroupLogic() if (botAI->IsTank(bot) || botAI->IsDps(bot)) HandleMarkingLogic(inGroup1, inGroup2, group1Pos, group2Pos); - // Movement logic for non-healers if (!botAI->IsHeal(bot)) { @@ -5230,7 +5221,7 @@ bool IccValithriaGroupAction::HandleMarkingLogic(bool inGroup1, bool inGroup2, c for (uint32 entry : addPriority) { - for (const auto& guid : adds) + for (auto const& guid : adds) { if (Unit* unit = botAI->GetUnit(guid)) { @@ -5291,7 +5282,7 @@ bool IccValithriaGroupAction::Handle10ManGroupLogic() for (uint32 entry : addPriority) { - for (const auto& guid : adds) + for (auto const& guid : adds) { if (Unit* unit = botAI->GetUnit(guid)) { @@ -5337,7 +5328,7 @@ bool IccValithriaPortalAction::Execute(Event event) GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs"); std::vector preEffectPortals; std::vector realPortals; - for (const auto& guid : npcs) + for (auto const& guid : npcs) { Creature* c = dynamic_cast(botAI->GetUnit(guid)); if (!c) @@ -5564,7 +5555,7 @@ bool IccValithriaDreamCloudAction::Execute(Event event) // Gather all group members with dream state const GuidVector members = AI_VALUE(GuidVector, "group members"); std::vector dreamBots; - for (const auto& guid : members) + for (auto const& guid : members) { Unit* member = botAI->GetUnit(guid); if (member && member->IsAlive() && member->HasAura(SPELL_DREAM_STATE)) @@ -5615,7 +5606,6 @@ bool IccValithriaDreamCloudAction::Execute(Event event) } } - // All stacked: leader (lowest guid) moves to next cloud, others follow and stack at leader's new position // Find all dream and nightmare clouds GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); @@ -5997,7 +5987,7 @@ bool IccSindragosaGroupPositionAction::HandleNonTankPositioning() for (const auto entry : tombEntries) { - for (const auto& guid : tombGuids) + for (auto const& guid : tombGuids) { if (Unit* unit = botAI->GetUnit(guid)) { @@ -6160,7 +6150,7 @@ void IccSindragosaFrostBeaconAction::HandleSupportActions() if (botAI->IsHeal(bot) && !bot->HasAura(FROST_BEACON_AURA_ID)) { const auto members = AI_VALUE(GuidVector, "group members"); - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* member = botAI->GetUnit(memberGuid); if (!member || !member->IsAlive() || !member->HasAura(FROST_BEACON_AURA_ID)) @@ -6266,7 +6256,7 @@ bool IccSindragosaFrostBeaconAction::HandleNonBeaconedPlayer(const Unit* boss) // Collect beaconed players std::vector beaconedPlayers; const auto members = AI_VALUE(GuidVector, "group members"); - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* player = botAI->GetUnit(memberGuid); if (player && player->GetGUID() != bot->GetGUID() && player->HasAura(FROST_BEACON_AURA_ID)) @@ -6474,7 +6464,7 @@ bool IccSindragosaMysticBuffetAction::Execute(Event event) for (const auto entry : tombEntries) { - for (const auto& guid : tombGuids) + for (auto const& guid : tombGuids) { if (Unit* unit = botAI->GetUnit(guid)) { @@ -6518,7 +6508,6 @@ bool IccSindragosaMysticBuffetAction::Execute(Event event) return true; } - botAI->Reset(); // Move to LOS2 position return MoveTo(bot->GetMapId(), ICC_SINDRAGOSA_LOS2_POSITION.GetPositionX(), @@ -8062,7 +8051,7 @@ bool IccLichKingAddsAction::HandleSpiritBombAvoidance(Difficulty diff, Unit* ter float minDistAtPos = std::numeric_limits::max(); int bombCountInVicinity = 0; - for (const auto& bombPair : spiritBombs) + for (auto const& bombPair : spiritBombs) { Unit* bomb = bombPair.second; if (!bomb || !bomb->IsAlive()) @@ -8166,7 +8155,7 @@ void IccLichKingAddsAction::HandleSpiritMarkingAndTargeting(Difficulty diff, Uni if (currentMarkedTarget && currentMarkedTarget->IsAlive()) { Unit* spiritTarget = currentMarkedTarget->GetVictim(); - if (spiritTarget && spiritTarget->GetTypeId() == TYPEID_PLAYER) + if (spiritTarget && spiritTarget->IsPlayer()) { if (Group* spiritTargetGroup = spiritTarget->ToPlayer()->GetGroup()) { @@ -8206,7 +8195,7 @@ void IccLichKingAddsAction::HandleSpiritMarkingAndTargeting(Difficulty diff, Uni // Check if this spirit is targeting a group member bool targetingGroupMember = false; Unit* spiritTarget = unit->GetVictim(); - if (spiritTarget && spiritTarget->GetTypeId() == TYPEID_PLAYER) + if (spiritTarget && spiritTarget->IsPlayer()) { if (Group* spiritTargetGroup = spiritTarget->ToPlayer()->GetGroup()) { @@ -9347,4 +9336,3 @@ void IccLichKingAddsAction::HandleVileSpiritMechanics() } } } - diff --git a/src/strategy/raids/icecrown/RaidIccActions.h b/src/strategy/raids/icecrown/RaidIccActions.h index 17cab504..9ac2a48a 100644 --- a/src/strategy/raids/icecrown/RaidIccActions.h +++ b/src/strategy/raids/icecrown/RaidIccActions.h @@ -311,8 +311,6 @@ public: Unit* FindClosestThreateningPuddle(); Position CalculateSafeMovePosition(Unit* closestPuddle); bool IsPositionTooCloseToOtherPuddles(float x, float y, Unit* ignorePuddle); - - }; class IccPutricideVolatileOozeAction : public AttackAction @@ -599,7 +597,6 @@ class IccSindragosaTankSwapPositionAction : public AttackAction bool Execute(Event event) override; }; - //LK class IccLichKingShadowTrapAction : public MovementAction { @@ -633,7 +630,6 @@ class IccLichKingWinterAction : public AttackAction void HandleMainTankAddManagement(Unit* boss, const Position* tankPos); void HandleAssistTankAddManagement(Unit* boss, const Position* tankPos); - private: const Position* GetMainTankPosition(); const Position* GetMainTankRangedPosition(); @@ -670,6 +666,4 @@ class IccLichKingAddsAction : public AttackAction void HandleVileSpiritMechanics(); }; - - #endif diff --git a/src/strategy/raids/icecrown/RaidIccMultipliers.cpp b/src/strategy/raids/icecrown/RaidIccMultipliers.cpp index 8c711103..fc02d56b 100644 --- a/src/strategy/raids/icecrown/RaidIccMultipliers.cpp +++ b/src/strategy/raids/icecrown/RaidIccMultipliers.cpp @@ -51,7 +51,7 @@ float IccLadyDeathwhisperMultiplier::GetValue(Action* action) if (dynamic_cast(action)) return 1.0f; - for (const auto& npcGuid : npcs) + for (auto const& npcGuid : npcs) { Unit* shade = botAI->GetUnit(npcGuid); @@ -156,7 +156,6 @@ float IccFestergutMultiplier::GetValue(Action* action) if (bot->HasAura(SPELL_GAS_SPORE)) return 0.0f; - return 1.0f; } @@ -375,7 +374,7 @@ float IccBpcAssistMultiplier::GetValue(Action* action) for (const auto entry : bombEntries) { - for (const auto& guid : bombs) + for (auto const& guid : bombs) { if (Unit* unit = botAI->GetUnit(guid)) { @@ -491,7 +490,6 @@ float IccValithriaDreamCloudMultiplier::GetValue(Action* action) Aura* twistedNightmares = botAI->GetAura("Twisted Nightmares", bot); Aura* emeraldVigor = botAI->GetAura("Emerald Vigor", bot); - if (!boss && !bot->HasAura(SPELL_DREAM_STATE)) return 1.0f; diff --git a/src/strategy/raids/icecrown/RaidIccMultipliers.h b/src/strategy/raids/icecrown/RaidIccMultipliers.h index 8eb1f6f1..69d1ac51 100644 --- a/src/strategy/raids/icecrown/RaidIccMultipliers.h +++ b/src/strategy/raids/icecrown/RaidIccMultipliers.h @@ -99,5 +99,4 @@ public: virtual float GetValue(Action* action); }; - #endif diff --git a/src/strategy/raids/icecrown/RaidIccStrategy.cpp b/src/strategy/raids/icecrown/RaidIccStrategy.cpp index 6bdb0e6b..1acf1e78 100644 --- a/src/strategy/raids/icecrown/RaidIccStrategy.cpp +++ b/src/strategy/raids/icecrown/RaidIccStrategy.cpp @@ -115,7 +115,6 @@ void RaidIccStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode("icc sister svalna", NextAction::array(0, new NextAction("icc sister svalna", ACTION_RAID + 5), nullptr))); - //VDW triggers.push_back(new TriggerNode("icc valithria group", NextAction::array(0, new NextAction("icc valithria group", ACTION_RAID + 1), nullptr))); diff --git a/src/strategy/raids/icecrown/RaidIccTriggers.cpp b/src/strategy/raids/icecrown/RaidIccTriggers.cpp index 7ea7e845..44a2008b 100644 --- a/src/strategy/raids/icecrown/RaidIccTriggers.cpp +++ b/src/strategy/raids/icecrown/RaidIccTriggers.cpp @@ -299,7 +299,7 @@ bool IccPutricideGrowingOozePuddleTrigger::IsActive() } const GuidVector& npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - for (const auto& npc : npcs) + for (auto const& npc : npcs) { if (Unit* unit = botAI->GetUnit(npc)) { @@ -477,7 +477,7 @@ bool IccBpcKineticBombTrigger::IsActive() for (const auto entry : bombEntries) { - for (const auto& guid : bombs) + for (auto const& guid : bombs) { if (Unit* unit = botAI->GetUnit(guid)) { diff --git a/src/strategy/raids/icecrown/RaidIccTriggers.h b/src/strategy/raids/icecrown/RaidIccTriggers.h index e51f62ad..cd332e00 100644 --- a/src/strategy/raids/icecrown/RaidIccTriggers.h +++ b/src/strategy/raids/icecrown/RaidIccTriggers.h @@ -336,7 +336,6 @@ public: bool IsActive() override; }; - class IccRotfaceMoveAwayFromExplosionTrigger : public Trigger { public: @@ -359,7 +358,6 @@ public: bool IsActive() override; }; - class IccPutricideGrowingOozePuddleTrigger : public Trigger { public: @@ -454,7 +452,6 @@ public: bool IsActive() override; }; - // Valithria Dreamwalker class IccValithriaGroupTrigger : public Trigger @@ -485,7 +482,6 @@ public: bool IsActive() override; }; - //SINDRAGOSA class IccSindragosaGroupPositionTrigger : public Trigger { @@ -550,7 +546,6 @@ public: bool IsActive() override; }; - //LICH KING class IccLichKingShadowTrapTrigger : public Trigger { diff --git a/src/strategy/raids/karazhan/RaidKarazhanActions.cpp b/src/strategy/raids/karazhan/RaidKarazhanActions.cpp index 8ec3ea91..e45d63f7 100644 --- a/src/strategy/raids/karazhan/RaidKarazhanActions.cpp +++ b/src/strategy/raids/karazhan/RaidKarazhanActions.cpp @@ -7,7 +7,7 @@ #include "Playerbots.h" #include "Position.h" -namespace +namespace { // Big Bad Wolf static int currentIndex = 0; @@ -131,7 +131,7 @@ bool KarazhanMaidenOfVirtuePositionRangedAction::Execute(Event event) const GuidVector members = AI_VALUE(GuidVector, "group members"); - for (const auto& memberGuid : members) + for (auto const& memberGuid : members) { Unit* member = botAI->GetUnit(memberGuid); @@ -205,7 +205,7 @@ bool KarazhanBigBadWolfPositionBossAction::isUseful() { Unit* boss = AI_VALUE2(Unit*, "find target", "the big bad wolf"); - return boss && botAI->IsTank(bot) && botAI->HasAggro(boss) && boss->GetVictim() == bot && + return boss && botAI->IsTank(bot) && botAI->HasAggro(boss) && boss->GetVictim() == bot && !bot->HasAura(SPELL_LITTLE_RED_RIDING_HOOD); } @@ -369,16 +369,16 @@ bool KarazhanTerestianIllhoofMarkTargetAction::Execute(Event event) RaidKarazhanHelpers karazhanHelper(botAI); Unit* target = karazhanHelper.GetFirstAliveUnitByEntry(NPC_DEMON_CHAINS); - if (!target || !target->IsAlive()) + if (!target || !target->IsAlive()) { target = karazhanHelper.GetFirstAliveUnitByEntry(NPC_KILREK); - if (!target || !target->IsAlive()) + if (!target || !target->IsAlive()) { target = boss; } } karazhanHelper.MarkTargetWithSkull(target); - + return false; } @@ -420,7 +420,7 @@ bool KarazhanShadeOfAranFlameWreathStopMovementAction::Execute(Event event) } return true; } - + return false; } @@ -430,7 +430,7 @@ bool KarazhanShadeOfAranMarkConjuredElementalAction::Execute(Event event) Unit* boss = AI_VALUE2(Unit*, "find target", "shade of aran"); Unit* target = karazhanHelper.GetFirstAliveUnitByEntry(NPC_CONJURED_ELEMENTAL); - if (!boss || !boss->IsAlive() || + if (!boss || !boss->IsAlive() || !target || !target->IsAlive() || target->HasAura(SPELL_WARLOCK_BANISH)) { return false; @@ -522,12 +522,12 @@ bool KarazhanNetherspiteBlockRedBeamAction::Execute(Event event) lastBeamMoveSideways[botGuid] = !lastBeamMoveSideways[botGuid]; beamMoveTimes[botGuid] = time(nullptr); } - if (!lastBeamMoveSideways[botGuid]) + if (!lastBeamMoveSideways[botGuid]) { - return MoveTo(bot->GetMapId(), beamPos.GetPositionX(), beamPos.GetPositionY(), beamPos.GetPositionZ(), + return MoveTo(bot->GetMapId(), beamPos.GetPositionX(), beamPos.GetPositionY(), beamPos.GetPositionZ(), false, false, false, true, MovementPriority::MOVEMENT_FORCED); - } - else + } + else { float bx = boss->GetPositionX(); float by = boss->GetPositionY(); @@ -549,7 +549,7 @@ bool KarazhanNetherspiteBlockRedBeamAction::Execute(Event event) float sideY = beamPos.GetPositionY() + perpDy * 3.0f; float sideZ = beamPos.GetPositionZ(); - return MoveTo(bot->GetMapId(), sideX, sideY, sideZ, false, false, false, true, + return MoveTo(bot->GetMapId(), sideX, sideY, sideZ, false, false, false, true, MovementPriority::MOVEMENT_FORCED); } } @@ -602,7 +602,7 @@ bool KarazhanNetherspiteBlockBlueBeamAction::Execute(Event event) "netherspite_beam_leaving_blue", "%player is leaving the blue beam--next blocker up!", ph); bot->Yell(text, LANG_UNIVERSAL); wasBlockingBlueBeam[botGuid] = false; - + return false; } @@ -637,17 +637,17 @@ bool KarazhanNetherspiteBlockBlueBeamAction::Execute(Event event) float bestDist = 150.0f; Position bestPos; bool found = false; - for (float dist = 18.0f; dist <= 30.0f; dist += 0.5f) + for (float dist = 18.0f; dist <= 30.0f; dist += 0.5f) { float candidateX = bx + dx * dist; float candidateY = by + dy * dist; float candidateZ = bz; bool outsideAllVoidZones = true; - for (Unit* voidZone : voidZones) + for (Unit* voidZone : voidZones) { - float voidZoneDist = sqrt(pow(candidateX - voidZone->GetPositionX(), 2) + + float voidZoneDist = sqrt(pow(candidateX - voidZone->GetPositionX(), 2) + pow(candidateY - voidZone->GetPositionY(), 2)); - if (voidZoneDist < 4.0f) + if (voidZoneDist < 4.0f) { outsideAllVoidZones = false; break; @@ -658,14 +658,14 @@ bool KarazhanNetherspiteBlockBlueBeamAction::Execute(Event event) continue; } float distToIdeal = fabs(dist - 18.0f); - if (!found || distToIdeal < bestDist) + if (!found || distToIdeal < bestDist) { bestDist = distToIdeal; bestPos = Position(candidateX, candidateY, candidateZ); found = true; } } - if (found) + if (found) { bot->AttackStop(); bot->InterruptNonMeleeSpells(false); @@ -747,17 +747,17 @@ bool KarazhanNetherspiteBlockGreenBeamAction::Execute(Event event) float bestDist = 150.0f; Position bestPos; bool found = false; - for (float dist = 18.0f; dist <= 30.0f; dist += 0.5f) + for (float dist = 18.0f; dist <= 30.0f; dist += 0.5f) { float candidateX = bx + dx * dist; float candidateY = by + dy * dist; float candidateZ = bz; bool outsideAllVoidZones = true; - for (Unit* voidZone : voidZones) + for (Unit* voidZone : voidZones) { - float voidZoneDist = sqrt(pow(candidateX - voidZone->GetPositionX(), 2) + + float voidZoneDist = sqrt(pow(candidateX - voidZone->GetPositionX(), 2) + pow(candidateY - voidZone->GetPositionY(), 2)); - if (voidZoneDist < 4.0f) + if (voidZoneDist < 4.0f) { outsideAllVoidZones = false; break; @@ -768,19 +768,19 @@ bool KarazhanNetherspiteBlockGreenBeamAction::Execute(Event event) continue; } float distToIdeal = fabs(dist - 18.0f); - if (!found || distToIdeal < bestDist) + if (!found || distToIdeal < bestDist) { bestDist = distToIdeal; bestPos = Position(candidateX, candidateY, candidateZ); found = true; } } - if (found) + if (found) { bot->AttackStop(); bot->InterruptNonMeleeSpells(false); - return MoveTo(bot->GetMapId(), bestPos.GetPositionX(), bestPos.GetPositionY(), bestPos.GetPositionZ(), + return MoveTo(bot->GetMapId(), bestPos.GetPositionX(), bestPos.GetPositionY(), bestPos.GetPositionZ(), false, false, false, true, MovementPriority::MOVEMENT_FORCED); } @@ -820,7 +820,7 @@ bool KarazhanNetherspiteAvoidBeamAndVoidZoneAction::Execute(Event event) Unit* redPortal = bot->FindNearestCreature(NPC_RED_PORTAL, 150.0f); Unit* bluePortal = bot->FindNearestCreature(NPC_BLUE_PORTAL, 150.0f); Unit* greenPortal = bot->FindNearestCreature(NPC_GREEN_PORTAL, 150.0f); - if (redPortal) + if (redPortal) { float bx = boss->GetPositionX(), by = boss->GetPositionY(); float px = redPortal->GetPositionX(), py = redPortal->GetPositionY(); @@ -828,7 +828,7 @@ bool KarazhanNetherspiteAvoidBeamAndVoidZoneAction::Execute(Event event) float length = sqrt(dx*dx + dy*dy); beams.push_back({redPortal, 0.0f, length}); } - if (bluePortal) + if (bluePortal) { float bx = boss->GetPositionX(), by = boss->GetPositionY(); float px = bluePortal->GetPositionX(), py = bluePortal->GetPositionY(); @@ -836,7 +836,7 @@ bool KarazhanNetherspiteAvoidBeamAndVoidZoneAction::Execute(Event event) float length = sqrt(dx*dx + dy*dy); beams.push_back({bluePortal, 0.0f, length}); } - if (greenPortal) + if (greenPortal) { float bx = boss->GetPositionX(), by = boss->GetPositionY(); float px = greenPortal->GetPositionX(), py = greenPortal->GetPositionY(); @@ -845,7 +845,7 @@ bool KarazhanNetherspiteAvoidBeamAndVoidZoneAction::Execute(Event event) beams.push_back({greenPortal, 0.0f, length}); } bool nearBeam = false; - for (const auto& beam : beams) + for (auto const& beam : beams) { float bx = boss->GetPositionX(), by = boss->GetPositionY(); float px = beam.portal->GetPositionX(), py = beam.portal->GetPositionY(); @@ -888,13 +888,13 @@ bool KarazhanNetherspiteAvoidBeamAndVoidZoneAction::Execute(Event event) continue; } bool tooCloseToBeam = false; - for (const auto& beam : beams) + for (auto const& beam : beams) { float bx = boss->GetPositionX(), by = boss->GetPositionY(); float px = beam.portal->GetPositionX(), py = beam.portal->GetPositionY(); float dx = px - bx, dy = py - by; float length = sqrt(dx*dx + dy*dy); - if (length == 0.0f) + if (length == 0.0f) { continue; } @@ -918,7 +918,7 @@ bool KarazhanNetherspiteAvoidBeamAndVoidZoneAction::Execute(Event event) { continue; } - if (!found || moveDist < bestDist) + if (!found || moveDist < bestDist) { bestCandidate = Position(cx, cy, cz); bestDist = moveDist; @@ -926,17 +926,17 @@ bool KarazhanNetherspiteAvoidBeamAndVoidZoneAction::Execute(Event event) } } } - if (found && karazhanHelper.IsSafePosition(bestCandidate.GetPositionX(), - bestCandidate.GetPositionY(), bestCandidate.GetPositionZ(), + if (found && karazhanHelper.IsSafePosition(bestCandidate.GetPositionX(), + bestCandidate.GetPositionY(), bestCandidate.GetPositionZ(), voidZones, 4.0f)) { bot->AttackStop(); bot->InterruptNonMeleeSpells(false); - return MoveTo(bot->GetMapId(), bestCandidate.GetPositionX(), bestCandidate.GetPositionY(), + return MoveTo(bot->GetMapId(), bestCandidate.GetPositionX(), bestCandidate.GetPositionY(), bestCandidate.GetPositionZ(), false, false, false, true, MovementPriority::MOVEMENT_COMBAT); } - + return false; } @@ -984,7 +984,7 @@ bool KarazhanNetherspiteBanishPhaseAvoidVoidZoneAction::isUseful() RaidKarazhanHelpers karazhanHelper(botAI); std::vector voidZones = karazhanHelper.GetAllVoidZones(); - for (Unit* vz : voidZones) + for (Unit* vz : voidZones) { if (bot->GetExactDist2d(vz) < 4.0f) { @@ -1056,7 +1056,7 @@ bool KarazhanPrinceMalchezaarNonTankAvoidHazardAction::Execute(Event event) bot->AttackStop(); bot->InterruptNonMeleeSpells(false); - return MoveTo(bot->GetMapId(), bestDestX, bestDestY, bestDestZ, false, false, false, true, + return MoveTo(bot->GetMapId(), bestDestX, bestDestY, bestDestZ, false, false, false, true, MovementPriority::MOVEMENT_FORCED); } @@ -1123,7 +1123,7 @@ bool KarazhanPrinceMalchezaarNonTankAvoidHazardAction::Execute(Event event) bot->AttackStop(); bot->InterruptNonMeleeSpells(false); - return MoveTo(bot->GetMapId(), bestDestX, bestDestY, bestDestZ, false, false, false, true, + return MoveTo(bot->GetMapId(), bestDestX, bestDestY, bestDestZ, false, false, false, true, MovementPriority::MOVEMENT_COMBAT); } } @@ -1135,7 +1135,7 @@ bool KarazhanPrinceMalchezaarNonTankAvoidHazardAction::Execute(Event event) bool KarazhanPrinceMalchezaarNonTankAvoidHazardAction::isUseful() { Unit* boss = AI_VALUE2(Unit*, "find target", "prince malchezaar"); - + return boss && !(botAI->IsTank(bot) && botAI->HasAggro(boss) && boss->GetVictim() == bot); } @@ -1198,7 +1198,7 @@ bool KarazhanPrinceMalchezaarTankAvoidHazardAction::Execute(Event event) if (!destSafe) continue; - bool pathSafe = karazhanHelper.IsStraightPathSafe(Position(bx, by, bz), Position(destX, destY, destZ), + bool pathSafe = karazhanHelper.IsStraightPathSafe(Position(bx, by, bz), Position(destX, destY, destZ), infernals, safeInfernalDistance, stepSize); float moveDist = sqrt(pow(destX - bx, 2) + pow(destY - by, 2)); if (pathSafe && moveDist < bestMoveDist) @@ -1255,7 +1255,7 @@ bool KarazhanPrinceMalchezaarTankAvoidHazardAction::Execute(Event event) bot->AttackStop(); bot->InterruptNonMeleeSpells(false); - return MoveTo(bot->GetMapId(), bestDestX, bestDestY, bestDestZ, false, false, false, true, + return MoveTo(bot->GetMapId(), bestDestX, bestDestY, bestDestZ, false, false, false, true, MovementPriority::MOVEMENT_COMBAT); } } @@ -1266,6 +1266,6 @@ bool KarazhanPrinceMalchezaarTankAvoidHazardAction::Execute(Event event) bool KarazhanPrinceMalchezaarTankAvoidHazardAction::isUseful() { Unit* boss = AI_VALUE2(Unit*, "find target", "prince malchezaar"); - + return boss && botAI->IsTank(bot) && botAI->HasAggro(boss) && boss->GetVictim() == bot; } diff --git a/src/strategy/raids/karazhan/RaidKarazhanHelpers.cpp b/src/strategy/raids/karazhan/RaidKarazhanHelpers.cpp index b4d6d5df..29634174 100644 --- a/src/strategy/raids/karazhan/RaidKarazhanHelpers.cpp +++ b/src/strategy/raids/karazhan/RaidKarazhanHelpers.cpp @@ -22,11 +22,11 @@ const Position KARAZHAN_MAIDEN_OF_VIRTUE_RANGED_POSITION[8] = }; const Position KARAZHAN_BIG_BAD_WOLF_BOSS_POSITION = Position(-10913.391f, -1773.508f, 90.477f); -const Position KARAZHAN_BIG_BAD_WOLF_RUN_POSITION[4] = +const Position KARAZHAN_BIG_BAD_WOLF_RUN_POSITION[4] = { { -10875.456f, -1779.036f, 90.477f }, { -10872.281f, -1751.638f, 90.477f }, - { -10910.492f, -1747.401f, 90.477f }, + { -10910.492f, -1747.401f, 90.477f }, { -10913.391f, -1773.508f, 90.477f }, }; @@ -68,7 +68,7 @@ Unit* RaidKarazhanHelpers::GetFirstAliveUnitByEntry(uint32 entry) { const GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - for (const auto& npcGuid : npcs) + for (auto const& npcGuid : npcs) { Unit* unit = botAI->GetUnit(npcGuid); @@ -253,7 +253,7 @@ std::tuple RaidKarazhanHelpers::GetCurrentBeamBlocker std::vector redBlockers = GetRedBlockers(); if (!redBlockers.empty()) { - auto it = std::find_if(redBlockers.begin(), redBlockers.end(), [](Player* p) + auto it = std::find_if(redBlockers.begin(), redBlockers.end(), [](Player* p) { return p && p->GetGUID() == currentRedBlocker; }); @@ -276,7 +276,7 @@ std::tuple RaidKarazhanHelpers::GetCurrentBeamBlocker std::vector greenBlockers = GetGreenBlockers(); if (!greenBlockers.empty()) { - auto it = std::find_if(greenBlockers.begin(), greenBlockers.end(), [](Player* p) + auto it = std::find_if(greenBlockers.begin(), greenBlockers.end(), [](Player* p) { return p && p->GetGUID() == currentGreenBlocker; }); @@ -299,7 +299,7 @@ std::tuple RaidKarazhanHelpers::GetCurrentBeamBlocker std::vector blueBlockers = GetBlueBlockers(); if (!blueBlockers.empty()) { - auto it = std::find_if(blueBlockers.begin(), blueBlockers.end(), [](Player* p) + auto it = std::find_if(blueBlockers.begin(), blueBlockers.end(), [](Player* p) { return p && p->GetGUID() == currentBlueBlocker; }); @@ -327,7 +327,7 @@ std::vector RaidKarazhanHelpers::GetAllVoidZones() std::vector voidZones; const float radius = 30.0f; const GuidVector npcs = botAI->GetAiObjectContext()->GetValue("nearest npcs")->Get(); - for (const auto& npcGuid : npcs) + for (auto const& npcGuid : npcs) { Unit* unit = botAI->GetUnit(npcGuid); if (!unit || unit->GetEntry() != NPC_VOID_ZONE) @@ -363,7 +363,7 @@ std::vector RaidKarazhanHelpers::GetSpawnedInfernals() const { std::vector infernals; const GuidVector npcs = botAI->GetAiObjectContext()->GetValue("nearest npcs")->Get(); - for (const auto& npcGuid : npcs) + for (auto const& npcGuid : npcs) { Unit* unit = botAI->GetUnit(npcGuid); if (unit && unit->GetEntry() == NPC_NETHERSPITE_INFERNAL) @@ -388,7 +388,7 @@ bool RaidKarazhanHelpers::IsStraightPathSafe(const Position& start, const Positi { return true; } - + for (float checkDist = 0.0f; checkDist <= totalDist; checkDist += stepSize) { float t = checkDist / totalDist; @@ -404,6 +404,6 @@ bool RaidKarazhanHelpers::IsStraightPathSafe(const Position& start, const Positi } } } - + return true; } diff --git a/src/strategy/raids/karazhan/RaidKarazhanHelpers.h b/src/strategy/raids/karazhan/RaidKarazhanHelpers.h index 89d06a95..d26d8501 100644 --- a/src/strategy/raids/karazhan/RaidKarazhanHelpers.h +++ b/src/strategy/raids/karazhan/RaidKarazhanHelpers.h @@ -78,7 +78,7 @@ public: bool IsSafePosition (float x, float y, float z, const std::vector& hazards, float hazardRadius); std::vector GetSpawnedInfernals() const; - bool IsStraightPathSafe(const Position& start, const Position& target, + bool IsStraightPathSafe(const Position& start, const Position& target, const std::vector& hazards, float hazardRadius, float stepSize); }; diff --git a/src/strategy/raids/karazhan/RaidKarazhanMultipliers.cpp b/src/strategy/raids/karazhan/RaidKarazhanMultipliers.cpp index ac235603..f68cbe8b 100644 --- a/src/strategy/raids/karazhan/RaidKarazhanMultipliers.cpp +++ b/src/strategy/raids/karazhan/RaidKarazhanMultipliers.cpp @@ -40,7 +40,7 @@ float KarazhanBigBadWolfMultiplier::GetValue(Action* action) if (bot->HasAura(SPELL_LITTLE_RED_RIDING_HOOD)) { - if ((dynamic_cast(action) && !dynamic_cast(action)) || + if ((dynamic_cast(action) && !dynamic_cast(action)) || (dynamic_cast(action))) { return 0.0f; @@ -58,7 +58,7 @@ float KarazhanShadeOfAranMultiplier::GetValue(Action* action) return 1.0f; } - if (boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(SPELL_ARCANE_EXPLOSION)) + if (boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(SPELL_ARCANE_EXPLOSION)) { if (IsChargeAction(action)) { @@ -120,7 +120,7 @@ float KarazhanNetherspiteBlueAndGreenBeamMultiplier::GetValue(Action* action) Unit* bluePortal = bot->FindNearestCreature(NPC_BLUE_PORTAL, 150.0f); Unit* greenPortal = bot->FindNearestCreature(NPC_GREEN_PORTAL, 150.0f); bool inBeam = false; - for (Unit* portal : {bluePortal, greenPortal}) + for (Unit* portal : {bluePortal, greenPortal}) { if (!portal) { @@ -139,7 +139,7 @@ float KarazhanNetherspiteBlueAndGreenBeamMultiplier::GetValue(Action* action) float t = (botdx * dx + botdy * dy); float beamX = bx + dx * t, beamY = by + dy * t; float distToBeam = sqrt(pow(bot->GetPositionX() - beamX, 2) + pow(bot->GetPositionY() - beamY, 2)); - if (distToBeam < 0.3f && t > 0.0f && t < length) + if (distToBeam < 0.3f && t > 0.0f && t < length) { inBeam = true; break; @@ -149,7 +149,7 @@ float KarazhanNetherspiteBlueAndGreenBeamMultiplier::GetValue(Action* action) { std::vector voidZones = karazhanHelper.GetAllVoidZones(); bool inVoidZone = false; - for (Unit* vz : voidZones) + for (Unit* vz : voidZones) { if (bot->GetExactDist2d(vz) < 4.0f) { @@ -232,7 +232,7 @@ float KarazhanNetherspiteRedBeamMultiplier::GetValue(Action* action) } } } - + return 1.0f; } diff --git a/src/strategy/raids/naxxramas/RaidNaxxMultipliers.cpp b/src/strategy/raids/naxxramas/RaidNaxxMultipliers.cpp index 3b41ec0d..2ffe429d 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxMultipliers.cpp +++ b/src/strategy/raids/naxxramas/RaidNaxxMultipliers.cpp @@ -140,15 +140,18 @@ float ThaddiusGenericMultiplier::GetValue(Action* action) } // magnetic pull // uint32 curr_timer = eventMap->GetTimer(); - // // if (curr_phase == 2 && bot->GetPositionZ() > 312.5f && dynamic_cast(action)) { + // // if (curr_phase == 2 && bot->GetPositionZ() > 312.5f && dynamic_cast(action)) + // { // if (curr_phase == 2 && (curr_timer % 20000 >= 18000 || curr_timer % 20000 <= 2000) && - // dynamic_cast(action)) { + // dynamic_cast(action)) + // { // // MotionMaster *mm = bot->GetMotionMaster(); // // mm->Clear(); // return 0.0f; // } // thaddius phase - // if (curr_phase == 8 && dynamic_cast(action)) { + // if (curr_phase == 8 && dynamic_cast(action)) + // { // return 0.0f; // } return 1.0f; @@ -263,18 +266,22 @@ float FourhorsemanGenericMultiplier::GetValue(Action* action) // float GothikGenericMultiplier::GetValue(Action* action) // { // Unit* boss = AI_VALUE2(Unit*, "find target", "gothik the harvester"); -// if (!boss) { +// if (!boss) +// { // return 1.0f; // } // BossAI* boss_ai = dynamic_cast(boss->GetAI()); // EventMap* eventMap = boss_botAI->GetEvents(); // uint32 curr_phase = eventMap->GetPhaseMask(); -// if (curr_phase == 1 && (dynamic_cast(action))) { +// if (curr_phase == 1 && (dynamic_cast(action))) +// { // return 0.0f; // } -// if (curr_phase == 1 && (dynamic_cast(action))) { +// if (curr_phase == 1 && (dynamic_cast(action))) +// { // Unit* target = action->GetTarget(); -// if (target == boss) { +// if (target == boss) +// { // return 0.0f; // } // } diff --git a/src/strategy/raids/naxxramas/RaidNaxxTriggers.h b/src/strategy/raids/naxxramas/RaidNaxxTriggers.h index ec10c5de..a1f5bc2a 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxTriggers.h +++ b/src/strategy/raids/naxxramas/RaidNaxxTriggers.h @@ -178,7 +178,6 @@ private: SapphironBossHelper helper; }; - class SapphironFlightTrigger : public Trigger { public: @@ -221,4 +220,4 @@ private: LoathebBossHelper helper; }; -#endif \ No newline at end of file +#endif diff --git a/src/strategy/raids/obsidiansanctum/RaidOsTriggers.cpp b/src/strategy/raids/obsidiansanctum/RaidOsTriggers.cpp index 2deda7e8..2c375885 100644 --- a/src/strategy/raids/obsidiansanctum/RaidOsTriggers.cpp +++ b/src/strategy/raids/obsidiansanctum/RaidOsTriggers.cpp @@ -17,7 +17,6 @@ bool FlameTsunamiTrigger::IsActive() Unit* boss = AI_VALUE2(Unit*, "find target", "sartharion"); if (!boss) { return false; } - GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); for (auto& npc : npcs) { @@ -39,7 +38,6 @@ bool TwilightFissureTrigger::IsActive() Unit* boss = AI_VALUE2(Unit*, "find target", "sartharion"); if (!boss) { return false; } - GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); for (auto& npc : npcs) { @@ -98,7 +96,6 @@ bool TwilightPortalEnterTrigger::IsActive() // } // } - // Don't enter portal until drakes are dead if (bot->HasAura(SPELL_POWER_OF_SHADRON) || bot->HasAura(SPELL_POWER_OF_TENEBRON) || @@ -125,4 +122,4 @@ bool TwilightPortalEnterTrigger::IsActive() bool TwilightPortalExitTrigger::IsActive() { return bot->HasAura(SPELL_TWILIGHT_SHIFT) && !AI_VALUE2(Unit*, "find target", "acolyte of shadron"); -} \ No newline at end of file +} diff --git a/src/strategy/raids/ulduar/RaidUlduarActions.cpp b/src/strategy/raids/ulduar/RaidUlduarActions.cpp index 7f7af7ba..b7c3723b 100644 --- a/src/strategy/raids/ulduar/RaidUlduarActions.cpp +++ b/src/strategy/raids/ulduar/RaidUlduarActions.cpp @@ -1001,7 +1001,7 @@ bool RazorscaleHarpoonAction::Execute(Event event) float minDistance = std::numeric_limits::max(); // Find the nearest harpoon that hasn't been fired and is not on cooldown - for (const auto& harpoon : harpoonData) + for (auto const& harpoon : harpoonData) { if (razorscaleHelper.IsHarpoonFired(harpoon.chainSpellId)) continue; @@ -1087,7 +1087,7 @@ bool RazorscaleHarpoonAction::isUseful() const std::vector& harpoonData = razorscaleHelper.GetHarpoonData(); - for (const auto& harpoon : harpoonData) + for (auto const& harpoon : harpoonData) { if (razorscaleHelper.IsHarpoonFired(harpoon.chainSpellId)) continue; diff --git a/src/strategy/raids/ulduar/RaidUlduarBossHelper.cpp b/src/strategy/raids/ulduar/RaidUlduarBossHelper.cpp index b82d7045..72333a07 100644 --- a/src/strategy/raids/ulduar/RaidUlduarBossHelper.cpp +++ b/src/strategy/raids/ulduar/RaidUlduarBossHelper.cpp @@ -84,7 +84,7 @@ GameObject* RazorscaleBossHelper::FindNearestHarpoon(float x, float y, float z) GameObject* nearestHarpoon = nullptr; float minDistanceSq = std::numeric_limits::max(); - for (const auto& harpoon : GetHarpoonData()) + for (auto const& harpoon : GetHarpoonData()) { if (GameObject* harpoonGO = bot->FindNearestGameObject(harpoon.gameObjectEntry, 200.0f)) { @@ -158,7 +158,6 @@ bool RazorscaleBossHelper::CanSwapRoles() const return (currentTime - lastSwapTime) >= _roleSwapCooldown; } - void RazorscaleBossHelper::AssignRolesBasedOnHealth() { // Check if enough time has passed since last swap diff --git a/src/strategy/raids/ulduar/RaidUlduarTriggers.cpp b/src/strategy/raids/ulduar/RaidUlduarTriggers.cpp index 42222052..89ad7ac5 100644 --- a/src/strategy/raids/ulduar/RaidUlduarTriggers.cpp +++ b/src/strategy/raids/ulduar/RaidUlduarTriggers.cpp @@ -211,7 +211,7 @@ bool RazorscaleHarpoonAvailableTrigger::IsActive() } // Check each harpoon entry - for (const auto& harpoon : harpoonData) + for (auto const& harpoon : harpoonData) { // Skip harpoons whose chain spell is already active on the boss if (razorscaleHelper.IsHarpoonFired(harpoon.chainSpellId)) @@ -808,7 +808,6 @@ bool ThorimMarkDpsTargetTrigger::IsActive() if (!boss || !boss->IsAlive() || !boss->IsHostileTo(bot)) return false; - if (boss->GetPositionZ() < ULDUAR_THORIM_AXIS_Z_FLOOR_THRESHOLD && (!currentSkullUnit || !currentSkullUnit->IsAlive())) { group->SetTargetIcon(RtiTargetValue::skullIndex, bot->GetGUID(), boss->GetGUID()); diff --git a/src/strategy/rogue/RogueActions.cpp b/src/strategy/rogue/RogueActions.cpp index 8a04a01d..3019e0ec 100644 --- a/src/strategy/rogue/RogueActions.cpp +++ b/src/strategy/rogue/RogueActions.cpp @@ -19,7 +19,6 @@ bool CastStealthAction::isUseful() return true; } - bool CastStealthAction::isPossible() { // do not use with WSG flag or EYE flag diff --git a/src/strategy/rogue/RogueTriggers.h b/src/strategy/rogue/RogueTriggers.h index 4ef826a8..d9a18423 100644 --- a/src/strategy/rogue/RogueTriggers.h +++ b/src/strategy/rogue/RogueTriggers.h @@ -42,7 +42,6 @@ public: BladeFuryTrigger(PlayerbotAI* botAI) : BoostTrigger(botAI, "blade fury") {} }; - class RuptureTrigger : public DebuffTrigger { public: @@ -127,6 +126,4 @@ public: TricksOfTheTradeOnMainTankTrigger(PlayerbotAI* ai) : BuffOnMainTankTrigger(ai, "tricks of the trade", true) {} }; - - #endif diff --git a/src/strategy/shaman/ElementalShamanStrategy.cpp b/src/strategy/shaman/ElementalShamanStrategy.cpp index 3e058925..350b3472 100644 --- a/src/strategy/shaman/ElementalShamanStrategy.cpp +++ b/src/strategy/shaman/ElementalShamanStrategy.cpp @@ -73,4 +73,3 @@ void ElementalShamanStrategy::InitTriggers(std::vector& triggers) // Range Triggers triggers.push_back(new TriggerNode("enemy is close", NextAction::array(0, new NextAction("thunderstorm", 19.0f), nullptr))); } - diff --git a/src/strategy/shaman/ShamanActions.cpp b/src/strategy/shaman/ShamanActions.cpp index 4915aa27..e8ed1234 100644 --- a/src/strategy/shaman/ShamanActions.cpp +++ b/src/strategy/shaman/ShamanActions.cpp @@ -29,7 +29,7 @@ bool CastFireNovaAction::isUseful() { Unit* target = AI_VALUE(Unit*, "current target"); if (!target) return false; - + Creature* fireTotem = bot->GetMap()->GetCreature(bot->m_SummonSlot[1]); if (!fireTotem) return false; @@ -46,9 +46,9 @@ bool CastCleansingTotemAction::isUseful() } // Will only cast Stoneclaw Totem if low on health and not in a group -bool CastStoneclawTotemAction::isUseful() -{ - return !bot->GetGroup(); +bool CastStoneclawTotemAction::isUseful() +{ + return !bot->GetGroup(); } // Will only cast Lava Burst if Flame Shock is on the target diff --git a/src/strategy/shaman/ShamanActions.h b/src/strategy/shaman/ShamanActions.h index 3af01134..69f29f04 100644 --- a/src/strategy/shaman/ShamanActions.h +++ b/src/strategy/shaman/ShamanActions.h @@ -286,7 +286,6 @@ public: bool isUseful() override; }; - // Healing Actions class CastLesserHealingWaveAction : public CastHealingSpellAction diff --git a/src/strategy/shaman/ShamanTriggers.cpp b/src/strategy/shaman/ShamanTriggers.cpp index 574ab638..753edb83 100644 --- a/src/strategy/shaman/ShamanTriggers.cpp +++ b/src/strategy/shaman/ShamanTriggers.cpp @@ -19,7 +19,7 @@ bool MainHandWeaponNoImbueTrigger::IsActive() Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); if (!itemForSpell || itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT)) return false; - + return true; } @@ -28,18 +28,18 @@ bool OffHandWeaponNoImbueTrigger::IsActive() Item* const itemForSpell = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); if (!itemForSpell) return false; - + uint32 invType = itemForSpell->GetTemplate()->InventoryType; bool allowedType = (invType == INVTYPE_WEAPON) || (invType == INVTYPE_WEAPONOFFHAND); if (itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT) || !allowedType) return false; - + return true; } bool ShockTrigger::IsActive() { - return SpellTrigger::IsActive() && + return SpellTrigger::IsActive() && !botAI->HasAura("flame shock", GetTarget(), false, true) && !botAI->HasAura("frost shock", GetTarget(), false, true); } @@ -64,19 +64,19 @@ bool EarthShockExecuteTrigger::IsActive() bool TotemTrigger::IsActive() { - return AI_VALUE(uint8, "attacker count") >= attackerCount && + return AI_VALUE(uint8, "attacker count") >= attackerCount && !AI_VALUE2(bool, "has totem", name) && !botAI->HasAura(name, bot); } -bool WaterWalkingTrigger::IsActive() -{ - return BuffTrigger::IsActive() && AI_VALUE2(bool, "swimming", "self target"); +bool WaterWalkingTrigger::IsActive() +{ + return BuffTrigger::IsActive() && AI_VALUE2(bool, "swimming", "self target"); } -bool WaterBreathingTrigger::IsActive() -{ - return BuffTrigger::IsActive() && AI_VALUE2(bool, "swimming", "self target"); +bool WaterBreathingTrigger::IsActive() +{ + return BuffTrigger::IsActive() && AI_VALUE2(bool, "swimming", "self target"); } bool WaterWalkingOnPartyTrigger::IsActive() @@ -123,7 +123,7 @@ bool SpiritWalkTrigger::IsActive() } } } - + return false; } @@ -138,7 +138,7 @@ bool CallOfTheElementsTrigger::IsActive() int emptyCount = 0; static const uint8 slots[] = { - SUMMON_SLOT_TOTEM_EARTH, SUMMON_SLOT_TOTEM_FIRE, + SUMMON_SLOT_TOTEM_EARTH, SUMMON_SLOT_TOTEM_FIRE, SUMMON_SLOT_TOTEM_WATER, SUMMON_SLOT_TOTEM_AIR }; @@ -210,10 +210,10 @@ bool TotemicRecallTrigger::IsActive() Player* member = ref->GetSource(); if (!member) continue; - + if (member->IsInCombat()) return false; - + Pet* pet = member->GetPet(); if (pet && pet->IsInCombat()) return false; @@ -261,7 +261,7 @@ bool TotemicRecallTrigger::IsActive() } // Find the active totem strategy for this slot, and return the highest-rank spellId the bot knows for it -static uint32 GetRequiredTotemSpellId(PlayerbotAI* ai, const char* strategies[], +static uint32 GetRequiredTotemSpellId(PlayerbotAI* ai, const char* strategies[], const uint32* spellList[], const size_t spellCounts[], size_t numStrategies) { Player* bot = ai->GetBot(); @@ -279,7 +279,7 @@ static uint32 GetRequiredTotemSpellId(PlayerbotAI* ai, const char* strategies[], } } } - + return 0; // No relevant strategy active, or bot doesn't know any rank } @@ -289,11 +289,11 @@ static uint32 GetSummonedTotemSpellId(Player* bot, uint8 slot) ObjectGuid guid = bot->m_SummonSlot[slot]; if (guid.IsEmpty()) return 0; - + Creature* totem = bot->GetMap()->GetCreature(guid); if (!totem) return 0; - + return totem->GetUInt32Value(UNIT_CREATED_BY_SPELL); } @@ -309,7 +309,7 @@ bool NoEarthTotemTrigger::IsActive() if (!guid.IsEmpty()) { totem = bot->GetMap()->GetCreature(guid); - if (totem) + if (totem) { currentSpell = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL); } @@ -320,18 +320,18 @@ bool NoEarthTotemTrigger::IsActive() static const uint32* spells[] = {STRENGTH_OF_EARTH_TOTEM, STONESKIN_TOTEM, TREMOR_TOTEM, EARTHBIND_TOTEM}; static const size_t counts[] = {STRENGTH_OF_EARTH_TOTEM_COUNT, STONESKIN_TOTEM_COUNT, TREMOR_TOTEM_COUNT, EARTHBIND_TOTEM_COUNT}; - + uint32 requiredSpell = GetRequiredTotemSpellId(botAI, names, spells, counts, 4); // EXCEPTION: If Stoneclaw Totem is out and in range, consider the slot "occupied" (do not fire the trigger) - for (size_t i = 0; i < STONECLAW_TOTEM_COUNT; ++i) + for (size_t i = 0; i < STONECLAW_TOTEM_COUNT; ++i) { if (currentSpell == STONECLAW_TOTEM[i] && totem && totem->GetDistance(bot) <= 30.0f) return false; } // If no relevant strategy, only care if the slot is empty or totem is too far away - if (!requiredSpell) + if (!requiredSpell) return guid.IsEmpty() || !totem || totem->GetDistance(bot) > 30.0f; // Fire if slot is empty or wrong totem or totem is too far away @@ -350,7 +350,7 @@ bool NoFireTotemTrigger::IsActive() if (!guid.IsEmpty()) { totem = bot->GetMap()->GetCreature(guid); - if (totem) + if (totem) { currentSpell = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL); } @@ -366,7 +366,7 @@ bool NoFireTotemTrigger::IsActive() uint32 requiredSpell = GetRequiredTotemSpellId(botAI, names, spells, counts, 5); // EXCEPTION: If Fire Elemental is out and in range, consider the slot "occupied" (do not fire the trigger) - for (size_t i = 0; i < FIRE_ELEMENTAL_TOTEM_COUNT; ++i) + for (size_t i = 0; i < FIRE_ELEMENTAL_TOTEM_COUNT; ++i) { if (currentSpell == FIRE_ELEMENTAL_TOTEM[i] && totem && totem->GetDistance(bot) <= 30.0f) return false; @@ -407,14 +407,14 @@ bool NoWaterTotemTrigger::IsActive() uint32 requiredSpell = GetRequiredTotemSpellId(botAI, names, spells, counts, 4); // EXCEPTION: If Mana Tide is out and in range, consider the slot "occupied" (do not fire the trigger) - for (size_t i = 0; i < MANA_TIDE_TOTEM_COUNT; ++i) + for (size_t i = 0; i < MANA_TIDE_TOTEM_COUNT; ++i) { if (currentSpell == MANA_TIDE_TOTEM[i] && totem && totem->GetDistance(bot) <= 30.0f) return false; } // If no relevant strategy, only care if the slot is empty or totem is too far away - if (!requiredSpell) + if (!requiredSpell) { return guid.IsEmpty() || !totem || totem->GetDistance(bot) > 30.0f; } diff --git a/src/strategy/shaman/ShamanTriggers.h b/src/strategy/shaman/ShamanTriggers.h index 7fbaf2fd..abf4ed56 100644 --- a/src/strategy/shaman/ShamanTriggers.h +++ b/src/strategy/shaman/ShamanTriggers.h @@ -374,7 +374,7 @@ public: private: uint32 requiredSpellId; uint32 const* totemSpellIds; - size_t totemSpellIdsCount; + size_t totemSpellIdsCount; int actionButtonId; }; diff --git a/src/strategy/triggers/GenericTriggers.h b/src/strategy/triggers/GenericTriggers.h index 5f03f8a1..943e80b7 100644 --- a/src/strategy/triggers/GenericTriggers.h +++ b/src/strategy/triggers/GenericTriggers.h @@ -550,7 +550,7 @@ public: bool IsActive() override; }; -BEGIN_TRIGGER(PanicTrigger, Trigger) +BEGIN_TRIGGER(PanicTrigger, Trigger) // cppcheck-suppress unknownMacro std::string const getName() override { return "panic"; } END_TRIGGER() diff --git a/src/strategy/triggers/PvpTriggers.cpp b/src/strategy/triggers/PvpTriggers.cpp index f70ef1d7..c837d8b1 100644 --- a/src/strategy/triggers/PvpTriggers.cpp +++ b/src/strategy/triggers/PvpTriggers.cpp @@ -217,7 +217,6 @@ bool TeamHasFlag::IsActive() return ownTeamHasFlag && !enemyTeamHasFlag; } - bool EnemyTeamHasFlag::IsActive() { if (botAI->GetBot()->InBattleground()) diff --git a/src/strategy/triggers/RangeTriggers.cpp b/src/strategy/triggers/RangeTriggers.cpp index ee1266e6..3c60934f 100644 --- a/src/strategy/triggers/RangeTriggers.cpp +++ b/src/strategy/triggers/RangeTriggers.cpp @@ -22,7 +22,8 @@ bool EnemyTooCloseForSpellTrigger::IsActive() return target && (target->GetVictim() != bot || target->isFrozen() || target->HasRootAura()) && target->GetObjectSize() <= 10.0f && target->IsWithinCombatRange(bot, MIN_MELEE_REACH); // Unit* target = AI_VALUE(Unit*, "current target"); - // if (!target) { + // if (!target) + // { // return false; // } @@ -34,7 +35,7 @@ bool EnemyTooCloseForSpellTrigger::IsActive() // bool isRaid = false; // float combatReach = bot->GetCombatReach() + target->GetCombatReach(); // float targetDistance = sServerFacade->GetDistance2d(bot, target) + combatReach; - // if (target->GetTypeId() == TYPEID_UNIT) + // if (target->IsCreature()) // { // Creature* creature = botAI->GetCreature(target->GetGUID()); // if (creature) @@ -80,7 +81,7 @@ bool EnemyTooCloseForAutoShotTrigger::IsActive() // bool isRaid = false; // float combatReach = bot->GetCombatReach() + target->GetCombatReach(); // float targetDistance = sServerFacade->GetDistance2d(bot, target) + combatReach; - // if (target->GetTypeId() == TYPEID_UNIT) + // if (target->IsCreature()) // { // Creature* creature = botAI->GetCreature(target->GetGUID()); // if (creature) @@ -115,7 +116,7 @@ bool EnemyTooCloseForShootTrigger::IsActive() // bool isRaid = false; // float combatReach = bot->GetCombatReach() + target->GetCombatReach(); // float targetDistance = sServerFacade->GetDistance2d(bot, target) + combatReach; - // if (target->GetTypeId() == TYPEID_UNIT) + // if (target->IsCreature()) // { // Creature* creature = botAI->GetCreature(target->GetGUID()); // if (creature) diff --git a/src/strategy/triggers/TriggerContext.h b/src/strategy/triggers/TriggerContext.h index 1323e653..1c829ae9 100644 --- a/src/strategy/triggers/TriggerContext.h +++ b/src/strategy/triggers/TriggerContext.h @@ -53,7 +53,6 @@ public: creators["almost full mana"] = &TriggerContext::AlmostFullMana; creators["enough mana"] = &TriggerContext::EnoughMana; - creators["party member critical health"] = &TriggerContext::PartyMemberCriticalHealth; creators["party member low health"] = &TriggerContext::PartyMemberLowHealth; creators["party member medium health"] = &TriggerContext::PartyMemberMediumHealth; diff --git a/src/strategy/triggers/WorldPacketTriggerContext.h b/src/strategy/triggers/WorldPacketTriggerContext.h index 0f7f4c6e..1e730952 100644 --- a/src/strategy/triggers/WorldPacketTriggerContext.h +++ b/src/strategy/triggers/WorldPacketTriggerContext.h @@ -45,7 +45,6 @@ public: creators["quest update complete"] = &WorldPacketTriggerContext::quest_update_complete; creators["questgiver quest details"] = &WorldPacketTriggerContext::questgiver_quest_details; - creators["item push result"] = &WorldPacketTriggerContext::item_push_result; creators["party command"] = &WorldPacketTriggerContext::party_command; creators["taxi done"] = &WorldPacketTriggerContext::taxi_done; diff --git a/src/strategy/values/EnemyPlayerValue.cpp b/src/strategy/values/EnemyPlayerValue.cpp index 9c2a4130..2325c9c0 100644 --- a/src/strategy/values/EnemyPlayerValue.cpp +++ b/src/strategy/values/EnemyPlayerValue.cpp @@ -83,7 +83,7 @@ Unit* EnemyPlayerValue::Calculate() GuidVector players = AI_VALUE(GuidVector, "nearest enemy players"); float const maxAggroDistance = GetMaxAttackDistance(); - for (const auto& gTarget : players) + for (auto const& gTarget : players) { Unit* pUnit = botAI->GetUnit(gTarget); if (!pUnit) diff --git a/src/strategy/values/HasTotemValue.cpp b/src/strategy/values/HasTotemValue.cpp index 94a51837..0968b2e0 100644 --- a/src/strategy/values/HasTotemValue.cpp +++ b/src/strategy/values/HasTotemValue.cpp @@ -57,7 +57,8 @@ bool HasTotemValue::Calculate() // continue; // Creature* creature = dynamic_cast(unit); -// if (creature->GetOwner() != bot) { +// if (creature->GetOwner() != bot) +// { // continue; // } diff --git a/src/strategy/values/ItemUsageValue.cpp b/src/strategy/values/ItemUsageValue.cpp index 136c74f8..3be0db2c 100644 --- a/src/strategy/values/ItemUsageValue.cpp +++ b/src/strategy/values/ItemUsageValue.cpp @@ -22,10 +22,13 @@ ItemUsage ItemUsageValue::Calculate() uint32 itemId = 0; uint32 randomPropertyId = 0; size_t pos = qualifier.find(","); - if (pos != std::string::npos) { + if (pos != std::string::npos) + { itemId = atoi(qualifier.substr(0, pos).c_str()); randomPropertyId = atoi(qualifier.substr(pos + 1).c_str()); - } else { + } + else + { itemId = atoi(qualifier.c_str()); } @@ -261,7 +264,7 @@ ItemUsage ItemUsageValue::QueryItemUsageForEquip(ItemTemplate const* itemProto, { needToCheckUnique = true; } - else if (itemProto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE) + else if (itemProto->HasFlag(ITEM_FLAG_UNIQUE_EQUIPPABLE)) { needToCheckUnique = true; } @@ -373,7 +376,6 @@ ItemUsage ItemUsageValue::QueryItemUsageForEquip(ItemTemplate const* itemProto, } } - for (uint8 i = 0; i < possibleSlots; i++) { bool shouldEquipInSlot = shouldEquip; diff --git a/src/strategy/values/PossibleRpgTargetsValue.cpp b/src/strategy/values/PossibleRpgTargetsValue.cpp index 1b136c82..6e78f37f 100644 --- a/src/strategy/values/PossibleRpgTargetsValue.cpp +++ b/src/strategy/values/PossibleRpgTargetsValue.cpp @@ -54,18 +54,18 @@ void PossibleRpgTargetsValue::FindUnits(std::list& targets) bool PossibleRpgTargetsValue::AcceptUnit(Unit* unit) { - if (unit->IsHostileTo(bot) || unit->GetTypeId() == TYPEID_PLAYER) + if (unit->IsHostileTo(bot) || unit->IsPlayer()) return false; if (sServerFacade->GetDistance2d(bot, unit) <= sPlayerbotAIConfig->tooCloseDistance) return false; - if (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER)) + if (unit->HasNpcFlag(UNIT_NPC_FLAG_SPIRITHEALER)) return false; for (uint32 npcFlag : allowedNpcFlags) { - if (unit->HasFlag(UNIT_NPC_FLAGS, npcFlag)) + if (unit->HasNpcFlag(static_cast(npcFlag))) return true; } @@ -82,7 +82,6 @@ bool PossibleRpgTargetsValue::AcceptUnit(Unit* unit) return false; } - std::vector PossibleNewRpgTargetsValue::allowedNpcFlags; PossibleNewRpgTargetsValue::PossibleNewRpgTargetsValue(PlayerbotAI* botAI, float range) @@ -127,11 +126,11 @@ GuidVector PossibleNewRpgTargetsValue::Calculate() guidDistancePairs.push_back({unit->GetGUID(), bot->GetExactDist(unit)}); } // Override to sort by distance - std::sort(guidDistancePairs.begin(), guidDistancePairs.end(), [](const auto& a, const auto& b) { + std::sort(guidDistancePairs.begin(), guidDistancePairs.end(), [](auto const& a, auto const& b) { return a.second < b.second; }); - for (const auto& pair : guidDistancePairs) { + for (auto const& pair : guidDistancePairs) { results.push_back(pair.first); } return results; @@ -146,15 +145,15 @@ void PossibleNewRpgTargetsValue::FindUnits(std::list& targets) bool PossibleNewRpgTargetsValue::AcceptUnit(Unit* unit) { - if (unit->IsHostileTo(bot) || unit->GetTypeId() == TYPEID_PLAYER) + if (unit->IsHostileTo(bot) || unit->IsPlayer()) return false; - if (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER)) + if (unit->HasNpcFlag(UNIT_NPC_FLAG_SPIRITHEALER)) return false; for (uint32 npcFlag : allowedNpcFlags) { - if (unit->HasFlag(UNIT_NPC_FLAGS, npcFlag)) + if (unit->HasNpcFlag(static_cast(npcFlag))) return true; } @@ -170,7 +169,6 @@ GuidVector PossibleNewRpgGameObjectsValue::Calculate() Acore::GameObjectListSearcher searcher(bot, targets, u_check); Cell::VisitObjects(bot, searcher, range); - std::vector> guidDistancePairs; for (GameObject* go : targets) { @@ -194,11 +192,11 @@ GuidVector PossibleNewRpgGameObjectsValue::Calculate() GuidVector results; // Sort by distance - std::sort(guidDistancePairs.begin(), guidDistancePairs.end(), [](const auto& a, const auto& b) { + std::sort(guidDistancePairs.begin(), guidDistancePairs.end(), [](auto const& a, auto const& b) { return a.second < b.second; }); - for (const auto& pair : guidDistancePairs) { + for (auto const& pair : guidDistancePairs) { results.push_back(pair.first); } return results; diff --git a/src/strategy/warlock/WarlockTriggers.h b/src/strategy/warlock/WarlockTriggers.h index 295b6d89..85125490 100644 --- a/src/strategy/warlock/WarlockTriggers.h +++ b/src/strategy/warlock/WarlockTriggers.h @@ -121,7 +121,6 @@ public: bool IsActive() override; }; - // CC and Pet Triggers class BanishTrigger : public HasCcTargetTrigger diff --git a/src/strategy/warrior/WarriorActions.cpp b/src/strategy/warrior/WarriorActions.cpp index c679a6b5..9733226a 100644 --- a/src/strategy/warrior/WarriorActions.cpp +++ b/src/strategy/warrior/WarriorActions.cpp @@ -126,7 +126,7 @@ bool CastRetaliationAction::isUseful() continue; // Check if the attacker is melee-based using unit_class - if (attacker->GetTypeId() == TYPEID_UNIT) + if (attacker->IsCreature()) { Creature* creature = attacker->ToCreature(); if (creature && (creature->IsClass(CLASS_WARRIOR) @@ -136,7 +136,7 @@ bool CastRetaliationAction::isUseful() ++meleeAttackers; } } - else if (attacker->GetTypeId() == TYPEID_PLAYER) + else if (attacker->IsPlayer()) { Player* playerAttacker = attacker->ToPlayer(); if (playerAttacker && botAI->IsMelee(playerAttacker)) // Reuse existing Player melee check diff --git a/src/strategy/warrior/WarriorTriggers.cpp b/src/strategy/warrior/WarriorTriggers.cpp index 4ca2e5b9..b561c481 100644 --- a/src/strategy/warrior/WarriorTriggers.cpp +++ b/src/strategy/warrior/WarriorTriggers.cpp @@ -119,4 +119,3 @@ bool ShatteringThrowTrigger::IsActive() return false; // No valid targets within range } - diff --git a/src/strategy/warrior/WarriorTriggers.h b/src/strategy/warrior/WarriorTriggers.h index 4e4f4cab..563d7076 100644 --- a/src/strategy/warrior/WarriorTriggers.h +++ b/src/strategy/warrior/WarriorTriggers.h @@ -80,7 +80,6 @@ public: bool IsActive() override; }; - // class SlamTrigger : public HasAuraTrigger // { // public: