From 439293e1006e519d6b3b63407948eb929eca15d6 Mon Sep 17 00:00:00 2001 From: Keleborn <22352763+Celandriel@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:04:33 -0800 Subject: [PATCH] Warnings PR 2 clean unused variables (#2107) # Pull Request Removed unused variables and fixed styling issues. ## How to Test the Changes - Step-by-step instructions to test the change - Any required setup (e.g. multiple players, bots, specific configuration) - Expected behavior and how to verify it ## Complexity & Impact - Does this change add new decision branches? - [x] No - [] Yes (**explain below**) - Does this change increase per-bot or per-tick processing? - [x] No - [ ] Yes (**describe and justify impact**) - Could this logic scale poorly under load? - [x] No - [ ] Yes (**explain why**) --- ## Defaults & Configuration - Does this change modify default bot behavior? - [x] No - [ ] Yes (**explain why**) If this introduces more advanced or AI-heavy logic: - [ ] Lightweight mode remains the default - [ ] More complex behavior is optional and thereby configurable --- ## AI Assistance - Was AI assistance (e.g. ChatGPT or similar tools) used while working on this change? - [x] No - [ ] Yes (**explain below**) --- ## Final Checklist - [x] Stability is not compromised - [x] Performance impact is understood, tested, and acceptable - [x] Added logic complexity is justified and explained - [x] Documentation updated if needed --- ## Notes for Reviewers This was filtered from the code provided by SmashingQuasar. Eliminated variables were confirmed to be not used, but unclear at times if that is due to mistakes in writing. --------- Co-authored-by: bashermens <31279994+hermensbas@users.noreply.github.com> --- .../Base/Actions/BattleGroundJoinAction.cpp | 10 - src/Ai/Base/Actions/BattleGroundTactics.cpp | 2 - src/Ai/Base/Actions/ChatShortcutActions.cpp | 4 - src/Ai/Base/Actions/ChooseRpgTargetAction.cpp | 2 - .../Base/Actions/ChooseTravelTargetAction.cpp | 13 - src/Ai/Base/Actions/DebugAction.cpp | 4 +- src/Ai/Base/Actions/EquipAction.cpp | 2 +- src/Ai/Base/Actions/FishingAction.cpp | 2 - src/Ai/Base/Actions/GiveItemAction.cpp | 2 - src/Ai/Base/Actions/GuildCreateActions.cpp | 3 - src/Ai/Base/Actions/InviteToGroupAction.cpp | 2 - src/Ai/Base/Actions/LootRollAction.cpp | 2 - src/Ai/Base/Actions/LootStrategyAction.cpp | 1 - src/Ai/Base/Actions/MailAction.cpp | 2 +- src/Ai/Base/Actions/MovementActions.cpp | 25 +- src/Ai/Base/Actions/MovementActions.h | 1 - src/Ai/Base/Actions/PetsAction.h | 1 - src/Ai/Base/Actions/QueryQuestAction.cpp | 1 - src/Ai/Base/Actions/QuestAction.cpp | 5 - src/Ai/Base/Actions/RememberTaxiAction.cpp | 2 +- src/Ai/Base/Actions/SayAction.cpp | 1 - src/Ai/Base/Actions/SecurityCheckAction.cpp | 6 +- src/Ai/Base/Actions/SetCraftAction.cpp | 3 +- src/Ai/Base/Actions/SetHomeAction.cpp | 18 +- src/Ai/Base/Actions/ShareQuestAction.cpp | 3 +- src/Ai/Base/Actions/StayActions.cpp | 1 - src/Ai/Base/Actions/SuggestWhatToDoAction.cpp | 3 +- .../Base/Actions/TalkToQuestGiverAction.cpp | 2 - src/Ai/Base/Actions/TameAction.cpp | 1 - src/Ai/Base/Actions/TellLosAction.cpp | 1 - src/Ai/Base/Actions/TradeStatusAction.cpp | 6 - src/Ai/Base/Actions/TravelAction.cpp | 4 +- src/Ai/Base/Actions/UseItemAction.cpp | 1 - src/Ai/Base/Actions/WhoAction.cpp | 2 +- src/Ai/Base/Actions/WipeAction.cpp | 6 +- src/Ai/Base/SharedValueContext.h | 2 +- src/Ai/Base/Trigger/RangeTriggers.cpp | 5 - src/Ai/Base/Value/Arrow.cpp | 6 - src/Ai/Base/Value/GrindTargetValue.cpp | 2 - src/Ai/Base/Value/ItemUsageValue.cpp | 4 +- src/Ai/Base/Value/LeastHpTargetValue.cpp | 4 +- .../Base/Value/PartyMemberWithoutAuraValue.h | 4 +- src/Ai/Base/Value/PossibleRpgTargetsValue.cpp | 19 +- src/Ai/Base/Value/SnareTargetValue.cpp | 1 - src/Ai/Base/Value/StatsValues.cpp | 2 - .../Class/Paladin/Action/PaladinActions.cpp | 6 - .../Class/Shaman/Trigger/ShamanTriggers.cpp | 14 - src/Ai/Class/Shaman/Trigger/ShamanTriggers.h | 39 ++- .../Action/ForgeOfSoulsActions.cpp | 4 - .../Dungeon/Gundrak/Action/GundrakActions.cpp | 1 - .../Action/TrialOfTheChampionActions.cpp | 4 - .../Action/RaidGruulsLairActions.cpp | 5 +- .../Raid/Icecrown/Action/RaidIccActions.cpp | 74 +---- .../Multiplier/RaidIccMultipliers.cpp | 2 - .../Raid/Icecrown/Trigger/RaidIccTriggers.cpp | 1 - .../Karazhan/Action/RaidKarazhanActions.cpp | 1 - .../ObsidianSanctum/Action/RaidOsActions.cpp | 34 +-- .../Raid/Ulduar/Action/RaidUlduarActions.cpp | 258 ++---------------- .../Ulduar/Trigger/RaidUlduarTriggers.cpp | 140 +--------- src/Ai/World/Rpg/Action/NewRpgAction.cpp | 1 - src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp | 5 +- src/Ai/World/Rpg/NewRpgInfo.cpp | 5 +- src/Bot/Factory/PlayerbotFactory.cpp | 40 +-- src/Bot/PlayerbotMgr.cpp | 1 - src/Bot/RandomPlayerbotMgr.cpp | 16 +- src/Mgr/Item/RandomItemMgr.cpp | 2 - 66 files changed, 104 insertions(+), 742 deletions(-) diff --git a/src/Ai/Base/Actions/BattleGroundJoinAction.cpp b/src/Ai/Base/Actions/BattleGroundJoinAction.cpp index 24b23cb9..fdc13120 100644 --- a/src/Ai/Base/Actions/BattleGroundJoinAction.cpp +++ b/src/Ai/Base/Actions/BattleGroundJoinAction.cpp @@ -24,8 +24,6 @@ bool BGJoinAction::Execute(Event /*event*/) BattlegroundQueueTypeId queueTypeId = (BattlegroundQueueTypeId)bgList[urand(0, bgList.size() - 1)]; BattlegroundTypeId bgTypeId = BattlegroundMgr::BGTemplateId(queueTypeId); - BattlegroundBracketId bracketId; - bool isArena = false; bool isRated = false; Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId); @@ -37,12 +35,8 @@ bool BGJoinAction::Execute(Event /*event*/) if (!pvpDiff) return false; - bracketId = pvpDiff->GetBracketId(); - if (ArenaType type = ArenaType(BattlegroundMgr::BGArenaType(queueTypeId))) { - isArena = true; - std::vector::iterator i = find(ratedList.begin(), ratedList.end(), queueTypeId); if (i != ratedList.end()) isRated = true; @@ -408,8 +402,6 @@ bool BGJoinAction::JoinQueue(uint32 type) bracketId = pvpDiff->GetBracketId(); - uint32 BracketSize = bg->GetMaxPlayersPerTeam() * 2; - uint32 TeamSize = bg->GetMaxPlayersPerTeam(); TeamId teamId = bot->GetTeamId(); // check if already in queue @@ -486,8 +478,6 @@ bool BGJoinAction::JoinQueue(uint32 type) if (isArena) { isArena = true; - BracketSize = type * 2; - TeamSize = type; isRated = botAI->GetAiObjectContext()->GetValue("arena type")->Get(); if (joinAsGroup) diff --git a/src/Ai/Base/Actions/BattleGroundTactics.cpp b/src/Ai/Base/Actions/BattleGroundTactics.cpp index 78c15628..efb2fce7 100644 --- a/src/Ai/Base/Actions/BattleGroundTactics.cpp +++ b/src/Ai/Base/Actions/BattleGroundTactics.cpp @@ -2497,7 +2497,6 @@ bool BGTactics::selectObjective(bool reset) EYBotStrategy strategyHorde = static_cast(GetBotStrategyForTeam(bg, TEAM_HORDE)); EYBotStrategy strategyAlliance = static_cast(GetBotStrategyForTeam(bg, TEAM_ALLIANCE)); EYBotStrategy strategy = (team == TEAM_ALLIANCE) ? strategyAlliance : strategyHorde; - EYBotStrategy enemyStrategy = (team == TEAM_ALLIANCE) ? strategyHorde : strategyAlliance; auto IsOwned = [&](uint32 nodeId) -> bool { return eyeOfTheStormBG->GetCapturePointInfo(nodeId)._ownerTeamId == team; }; @@ -3231,7 +3230,6 @@ bool BGTactics::selectObjectiveWp(std::vector const& vPaths) if (bgType == BATTLEGROUND_RB) bgType = bg->GetBgTypeID(true); - PositionMap& posMap = context->GetValue("position")->Get(); PositionInfo pos = context->GetValue("position")->Get()["bg objective"]; if (!pos.isSet()) return false; diff --git a/src/Ai/Base/Actions/ChatShortcutActions.cpp b/src/Ai/Base/Actions/ChatShortcutActions.cpp index 30563e8e..84ed3584 100644 --- a/src/Ai/Base/Actions/ChatShortcutActions.cpp +++ b/src/Ai/Base/Actions/ChatShortcutActions.cpp @@ -68,9 +68,7 @@ bool FollowChatShortcutAction::Execute(Event /*event*/) std::string const target = formation->GetTargetName(); bool moved = false; if (!target.empty()) - { moved = Follow(AI_VALUE(Unit*, target)); - } else { WorldLocation loc = formation->GetLocation(); @@ -83,9 +81,7 @@ bool FollowChatShortcutAction::Execute(Event /*event*/) } if (Pet* pet = bot->GetPet()) - { botAI->PetFollow(); - } if (moved) { diff --git a/src/Ai/Base/Actions/ChooseRpgTargetAction.cpp b/src/Ai/Base/Actions/ChooseRpgTargetAction.cpp index e14d0cf3..76e6fe05 100644 --- a/src/Ai/Base/Actions/ChooseRpgTargetAction.cpp +++ b/src/Ai/Base/Actions/ChooseRpgTargetAction.cpp @@ -112,7 +112,6 @@ float ChooseRpgTargetAction::getMaxRelevance(GuidPosition guidP) bool ChooseRpgTargetAction::Execute(Event /*event*/) { - //TravelTarget* travelTarget = AI_VALUE(TravelTarget*, "travel target"); //not used, line marked for removal. Player* master = botAI->GetMaster(); GuidPosition masterRpgTarget; if (master && master != bot && GET_PLAYERBOT_AI(master) && master->GetMapId() == bot->GetMapId() && !master->IsBeingTeleported()) @@ -124,7 +123,6 @@ bool ChooseRpgTargetAction::Execute(Event /*event*/) master = nullptr; std::unordered_map targets; - // uint32 num = 0; //not used, line marked for removal. GuidVector possibleTargets = AI_VALUE(GuidVector, "possible rpg targets"); GuidVector possibleObjects = AI_VALUE(GuidVector, "nearest game objects no los"); GuidVector possiblePlayers = AI_VALUE(GuidVector, "nearest friendly players"); diff --git a/src/Ai/Base/Actions/ChooseTravelTargetAction.cpp b/src/Ai/Base/Actions/ChooseTravelTargetAction.cpp index 695f0d31..7868b6ea 100644 --- a/src/Ai/Base/Actions/ChooseTravelTargetAction.cpp +++ b/src/Ai/Base/Actions/ChooseTravelTargetAction.cpp @@ -232,15 +232,6 @@ void ChooseTravelTargetAction::ReportTravelTarget(TravelTarget* newTarget, Trave QuestTravelDestination* QuestDestination = (QuestTravelDestination*)destination; Quest const* quest = QuestDestination->GetQuestTemplate(); WorldPosition botLocation(bot); - - CreatureTemplate const* cInfo = nullptr; - GameObjectTemplate const* gInfo = nullptr; - - if (destination->getEntry() > 0) - cInfo = sObjectMgr->GetCreatureTemplate(destination->getEntry()); - else - gInfo = sObjectMgr->GetGameObjectTemplate(destination->getEntry() * -1); - std::string Sub; if (newTarget->isGroupCopy()) @@ -823,10 +814,6 @@ char* strstri(char const* haystack, char const* needle); TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::string const name, bool zones, bool npcs, bool quests, bool mobs, bool bosses) { - PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot); - - // AiObjectContext* context = botAI->GetAiObjectContext(); //not used, line marked for removal. - std::vector dests; //Quests diff --git a/src/Ai/Base/Actions/DebugAction.cpp b/src/Ai/Base/Actions/DebugAction.cpp index 378cdab7..edf1ef92 100644 --- a/src/Ai/Base/Actions/DebugAction.cpp +++ b/src/Ai/Base/Actions/DebugAction.cpp @@ -520,8 +520,8 @@ bool DebugAction::Execute(Event event) botPos.setY(botPos.GetPositionY() + (dy - 5) * 5); botPos.setZ(botPos.getHeight()); - Creature* wpCreature = bot->SummonCreature(effect, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0, - TEMPSUMMON_TIMED_DESPAWN, 10000.0f); + bot->SummonCreature(effect, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0, + TEMPSUMMON_TIMED_DESPAWN, 10000.0f); } } return true; diff --git a/src/Ai/Base/Actions/EquipAction.cpp b/src/Ai/Base/Actions/EquipAction.cpp index d6900391..a4086f37 100644 --- a/src/Ai/Base/Actions/EquipAction.cpp +++ b/src/Ai/Base/Actions/EquipAction.cpp @@ -85,8 +85,8 @@ void EquipAction::EquipItem(Item* item) if (itemProto->Class == ITEM_CLASS_CONTAINER) { // Attempt to equip as a bag - Bag* pBag = reinterpret_cast(item); uint8 newBagSlot = GetSmallestBagSlot(); + if (newBagSlot > 0) { uint16 src = ((bagIndex << 8) | slot); diff --git a/src/Ai/Base/Actions/FishingAction.cpp b/src/Ai/Base/Actions/FishingAction.cpp index a6057cab..66c09cd4 100644 --- a/src/Ai/Base/Actions/FishingAction.cpp +++ b/src/Ai/Base/Actions/FishingAction.cpp @@ -292,7 +292,6 @@ bool MoveNearWaterAction::isPossible() // Water spot is out of range, lets look for a spot to move to for the fishing hole. if (distance > MAX_DISTANCE_TO_WATER || distance < MIN_DISTANCE_TO_WATER) { - float angle = bot->GetAngle(fishingHole.GetPositionX(), fishingHole.GetPositionY()); WorldPosition landSpot = FindLandRadialFromPosition(botAI, fishingHole, MIN_DISTANCE_TO_WATER, MAX_DISTANCE_TO_WATER, SEARCH_INCREMENT, fishingSearchWindow, 32); if (landSpot.IsValid()) { @@ -323,7 +322,6 @@ bool MoveNearWaterAction::isPossible() if (!water.IsValid()) return false; - bool hasLOS = bot->IsWithinLOS(water.GetPositionX(), water.GetPositionY(), water.GetPositionZ()); float angle = bot->GetAngle(water.GetPositionX(), water.GetPositionY()); WorldPosition landSpot = FindLandFromPosition(botAI, 0.0f, MAX_DISTANCE_TO_WATER, 1.0f, angle, water, fishingSearchWindow, false); diff --git a/src/Ai/Base/Actions/GiveItemAction.cpp b/src/Ai/Base/Actions/GiveItemAction.cpp index 6019d1e3..d374d062 100644 --- a/src/Ai/Base/Actions/GiveItemAction.cpp +++ b/src/Ai/Base/Actions/GiveItemAction.cpp @@ -28,7 +28,6 @@ bool GiveItemAction::Execute(Event /*event*/) if (receiverAi->GetAiObjectContext()->GetValue("item count", item)->Get()) return true; - bool moved = false; std::vector items = InventoryAction::parseItems(item, ITERATE_ITEMS_IN_BAGS); for (Item* item : items) { @@ -42,7 +41,6 @@ bool GiveItemAction::Execute(Event /*event*/) bot->MoveItemFromInventory(item->GetBagSlot(), item->GetSlot(), true); item->SetOwnerGUID(target->GetGUID()); receiver->MoveItemToInventory(dest, item, true); - moved = true; std::ostringstream out; out << "Got " << chat->FormatItem(item->GetTemplate(), item->GetCount()) << " from " << bot->GetName(); diff --git a/src/Ai/Base/Actions/GuildCreateActions.cpp b/src/Ai/Base/Actions/GuildCreateActions.cpp index 0e7098f1..c536475f 100644 --- a/src/Ai/Base/Actions/GuildCreateActions.cpp +++ b/src/Ai/Base/Actions/GuildCreateActions.cpp @@ -17,7 +17,6 @@ bool BuyPetitionAction::Execute(Event /*event*/) { GuidVector vendors = botAI->GetAiObjectContext()->GetValue("nearest npcs")->Get(); - bool vendored = false, result = false; for (GuidVector::iterator i = vendors.begin(); i != vendors.end(); ++i) { ObjectGuid vendorguid = *i; @@ -97,7 +96,6 @@ bool BuyPetitionAction::canBuyPetition(Player* bot) bool PetitionOfferAction::Execute(Event event) { - uint32 petitionEntry = 5863; // GUILD_CHARTER std::vector petitions = AI_VALUE2(std::vector, "inventory items", chat->FormatQItem(5863)); if (petitions.empty()) @@ -212,7 +210,6 @@ bool PetitionOfferNearbyAction::isUseful() bool PetitionTurnInAction::Execute(Event /*event*/) { GuidVector vendors = botAI->GetAiObjectContext()->GetValue("nearest npcs")->Get(); - bool vendored = false, result = false; std::vector petitions = AI_VALUE2(std::vector, "inventory items", chat->FormatQItem(5863)); if (petitions.empty()) diff --git a/src/Ai/Base/Actions/InviteToGroupAction.cpp b/src/Ai/Base/Actions/InviteToGroupAction.cpp index 136f1395..8b71eade 100644 --- a/src/Ai/Base/Actions/InviteToGroupAction.cpp +++ b/src/Ai/Base/Actions/InviteToGroupAction.cpp @@ -167,8 +167,6 @@ std::vector InviteGuildToGroupAction::getGuildMembers() bool InviteGuildToGroupAction::Execute(Event /*event*/) { - Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId()); - for (auto& member : getGuildMembers()) { Player* player = member; diff --git a/src/Ai/Base/Actions/LootRollAction.cpp b/src/Ai/Base/Actions/LootRollAction.cpp index 7bbdc95c..a3bf1304 100644 --- a/src/Ai/Base/Actions/LootRollAction.cpp +++ b/src/Ai/Base/Actions/LootRollAction.cpp @@ -27,7 +27,6 @@ bool LootRollAction::Execute(Event /*event*/) continue; } ObjectGuid guid = roll->itemGUID; - uint32 slot = roll->itemSlot; uint32 itemId = roll->itemid; int32 randomProperty = 0; if (roll->itemRandomPropId) @@ -184,7 +183,6 @@ bool MasterLootRollAction::Execute(Event event) if (!group) return false; - RollVote vote = CalculateRollVote(proto); group->CountRollVote(bot->GetGUID(), creatureGuid, CalculateRollVote(proto)); return true; diff --git a/src/Ai/Base/Actions/LootStrategyAction.cpp b/src/Ai/Base/Actions/LootStrategyAction.cpp index 68f8089c..b5f328b0 100644 --- a/src/Ai/Base/Actions/LootStrategyAction.cpp +++ b/src/Ai/Base/Actions/LootStrategyAction.cpp @@ -16,7 +16,6 @@ bool LootStrategyAction::Execute(Event event) { std::string const strategy = event.getParam(); - LootObjectStack* lootItems = AI_VALUE(LootObjectStack*, "available loot"); std::set& alwaysLootItems = AI_VALUE(std::set&, "always loot list"); Value* lootStrategy = context->GetValue("loot strategy"); diff --git a/src/Ai/Base/Actions/MailAction.cpp b/src/Ai/Base/Actions/MailAction.cpp index 4ee2fee6..6fd07e1e 100644 --- a/src/Ai/Base/Actions/MailAction.cpp +++ b/src/Ai/Base/Actions/MailAction.cpp @@ -134,7 +134,7 @@ public: private: bool CheckBagSpace(Player* bot) { - uint32 totalused = 0, total = 16; + uint32 totalused = 0; for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; slot++) if (bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) ++totalused; diff --git a/src/Ai/Base/Actions/MovementActions.cpp b/src/Ai/Base/Actions/MovementActions.cpp index 2b035925..6769a16c 100644 --- a/src/Ai/Base/Actions/MovementActions.cpp +++ b/src/Ai/Base/Actions/MovementActions.cpp @@ -93,9 +93,6 @@ bool MovementAction::MoveNear(WorldObject* target, float distance, MovementPrior distance += target->GetCombatReach(); - float x = target->GetPositionX(); - float y = target->GetPositionY(); - float z = target->GetPositionZ(); float followAngle = GetFollowAngle(); for (float angle = followAngle; angle <= followAngle + static_cast(2 * M_PI); @@ -113,7 +110,6 @@ bool MovementAction::MoveNear(WorldObject* target, float distance, MovementPrior return true; } - // botAI->TellError("All paths not in LOS"); return false; } @@ -122,9 +118,6 @@ bool MovementAction::MoveToLOS(WorldObject* target, bool ranged) if (!target) return false; - // std::ostringstream out; out << "Moving to LOS!"; - // bot->Say(out.str(), LANG_UNIVERSAL); - float x = target->GetPositionX(); float y = target->GetPositionY(); float z = target->GetPositionZ(); @@ -257,7 +250,6 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, // bot->CastStop(); // botAI->InterruptSpell(); // } - G3D::Vector3 endP = path.back(); DoMovePoint(bot, x, y, z, generatePath, backwards); float delay = 1000.0f * MoveDelay(distance, backwards); if (lessDelay) @@ -772,8 +764,6 @@ bool MovementAction::MoveTo(WorldObject* target, float distance, MovementPriorit float by = bot->GetPositionY(); float bz = bot->GetPositionZ(); - float tx = target->GetPositionX(); - float ty = target->GetPositionY(); float tz = target->GetPositionZ(); float distanceToTarget = bot->GetDistance(target); @@ -805,10 +795,6 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance) if (!IsMovingAllowed(target)) return false; - float bx = bot->GetPositionX(); - float by = bot->GetPositionY(); - float bz = bot->GetPositionZ(); - float tx = target->GetPositionX(); float ty = target->GetPositionY(); float tz = target->GetPositionZ(); @@ -1413,7 +1399,6 @@ bool MovementAction::Flee(Unit* target) if (botAI->IsTank(player)) { float distanceToTank = ServerFacade::instance().GetDistance2d(bot, player); - float distanceToTarget = ServerFacade::instance().GetDistance2d(bot, target); if (distanceToTank < fleeDistance) { fleeTarget = player; @@ -1434,8 +1419,6 @@ bool MovementAction::Flee(Unit* target) else // bot is not targeted, try to flee dps/healers { bool isHealer = botAI->IsHeal(bot); - bool isDps = !isHealer && !botAI->IsTank(bot); - bool isTank = botAI->IsTank(bot); bool needHealer = !isHealer && AI_VALUE2(uint8, "health", "self target") < 50; bool isRanged = botAI->IsRanged(bot); @@ -2771,9 +2754,7 @@ bool MoveRandomAction::Execute(Event /*event*/) float angle = (float)rand_norm() * static_cast(M_PI); x += urand(0, distance) * cos(angle); y += urand(0, distance) * sin(angle); - float ox = x; - float oy = y; - float oz = z; + if (!bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), x, y, z)) continue; @@ -2894,10 +2875,8 @@ bool MoveAwayFromCreatureAction::isPossible() { return bot->CanFreeMove(); } bool MoveAwayFromPlayerWithDebuffAction::Execute(Event /*event*/) { - Player* closestPlayer = nullptr; - float minDistance = 0.0f; + Group* const group = bot->GetGroup(); - Group* group = bot->GetGroup(); if (!group) return false; diff --git a/src/Ai/Base/Actions/MovementActions.h b/src/Ai/Base/Actions/MovementActions.h index 7db911ba..377e8360 100644 --- a/src/Ai/Base/Actions/MovementActions.h +++ b/src/Ai/Base/Actions/MovementActions.h @@ -332,7 +332,6 @@ public: private: uint32 spellId; float range; - bool alive; }; #endif diff --git a/src/Ai/Base/Actions/PetsAction.h b/src/Ai/Base/Actions/PetsAction.h index 78f9c0b5..eaccdcb1 100644 --- a/src/Ai/Base/Actions/PetsAction.h +++ b/src/Ai/Base/Actions/PetsAction.h @@ -20,7 +20,6 @@ public: bool Execute(Event event) override; private: - bool warningEnabled = true; std::string defaultCmd; }; diff --git a/src/Ai/Base/Actions/QueryQuestAction.cpp b/src/Ai/Base/Actions/QueryQuestAction.cpp index 9540a9bf..337f83a2 100644 --- a/src/Ai/Base/Actions/QueryQuestAction.cpp +++ b/src/Ai/Base/Actions/QueryQuestAction.cpp @@ -16,7 +16,6 @@ void QueryQuestAction::TellObjective(std::string const name, uint32 available, u bool QueryQuestAction::Execute(Event event) { - Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); Player* bot = botAI->GetBot(); WorldPosition botPos(bot); WorldPosition* ptr_botpos = &botPos; diff --git a/src/Ai/Base/Actions/QuestAction.cpp b/src/Ai/Base/Actions/QuestAction.cpp index f442f91a..d3c86008 100644 --- a/src/Ai/Base/Actions/QuestAction.cpp +++ b/src/Ai/Base/Actions/QuestAction.cpp @@ -352,7 +352,6 @@ bool QuestUpdateAddItemAction::Execute(Event event) uint32 itemId, count; p >> itemId >> count; - Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); auto const* itemPrototype = sObjectMgr->GetItemTemplate(itemId); if (itemPrototype) { @@ -407,8 +406,6 @@ bool QuestItemPushResultAction::Execute(Event event) if (!quest) return false; - const QuestStatusData& q_status = bot->getQuestStatusMap().at(questId); - for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++) { uint32 itemId = quest->RequiredItemId[i]; @@ -448,8 +445,6 @@ bool QuestUpdateFailedTimerAction::Execute(Event event) uint32 questId; p >> questId; - Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - Quest const* qInfo = sObjectMgr->GetQuestTemplate(questId); if (qInfo) diff --git a/src/Ai/Base/Actions/RememberTaxiAction.cpp b/src/Ai/Base/Actions/RememberTaxiAction.cpp index 16132d7c..b056f384 100644 --- a/src/Ai/Base/Actions/RememberTaxiAction.cpp +++ b/src/Ai/Base/Actions/RememberTaxiAction.cpp @@ -28,7 +28,7 @@ bool RememberTaxiAction::Execute(Event event) case CMSG_ACTIVATETAXIEXPRESS: { ObjectGuid guid; - uint32 node_count, totalcost; + uint32 node_count; p >> guid >> node_count; LastMovement& movement = context->GetValue("last taxi")->Get(); diff --git a/src/Ai/Base/Actions/SayAction.cpp b/src/Ai/Base/Actions/SayAction.cpp index 4505a76e..9580fe22 100644 --- a/src/Ai/Base/Actions/SayAction.cpp +++ b/src/Ai/Base/Actions/SayAction.cpp @@ -156,7 +156,6 @@ bool SayAction::isUseful() void ChatReplyAction::ChatReplyDo(Player* bot, uint32& type, uint32& guid1, uint32& guid2, std::string& msg, std::string& chanName, std::string& name) { - ChatReplyType replyType = REPLY_NOT_UNDERSTAND; // default not understand std::string respondsText = ""; // if we're just commanding bots around, don't respond... diff --git a/src/Ai/Base/Actions/SecurityCheckAction.cpp b/src/Ai/Base/Actions/SecurityCheckAction.cpp index 512d7357..3d1b4c60 100644 --- a/src/Ai/Base/Actions/SecurityCheckAction.cpp +++ b/src/Ai/Base/Actions/SecurityCheckAction.cpp @@ -10,8 +10,10 @@ bool SecurityCheckAction::isUseful() { - return sRandomPlayerbotMgr.IsRandomBot(bot) && botAI->GetMaster() && - botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER && !GET_PLAYERBOT_AI(botAI->GetMaster()); + return RandomPlayerbotMgr::instance().IsRandomBot(bot) + && botAI->GetMaster() + && botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER + && !GET_PLAYERBOT_AI(botAI->GetMaster()); } bool SecurityCheckAction::Execute(Event /*event*/) diff --git a/src/Ai/Base/Actions/SetCraftAction.cpp b/src/Ai/Base/Actions/SetCraftAction.cpp index f8682c45..40134821 100644 --- a/src/Ai/Base/Actions/SetCraftAction.cpp +++ b/src/Ai/Base/Actions/SetCraftAction.cpp @@ -66,7 +66,8 @@ bool SetCraftAction::Execute(Event event) if (!spellInfo) continue; - if (SkillLineAbilityEntry const* skillLine = skillSpells[spellId]) + SkillLineAbilityEntry const* skillLine = skillSpells[spellId]; + if (skillLine != nullptr) { for (uint8 i = 0; i < 3; ++i) { diff --git a/src/Ai/Base/Actions/SetHomeAction.cpp b/src/Ai/Base/Actions/SetHomeAction.cpp index 0fa2ef50..ed6bcbfa 100644 --- a/src/Ai/Base/Actions/SetHomeAction.cpp +++ b/src/Ai/Base/Actions/SetHomeAction.cpp @@ -26,20 +26,10 @@ bool SetHomeAction::Execute(Event /*event*/) if (Unit* unit = botAI->GetUnit(selection)) if (unit->HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER)) { - if (isRpgAction) - { - Creature* creature = botAI->GetCreature(selection); - bot->GetSession()->SendBindPoint(creature); - botAI->TellMaster("This inn is my new home"); - return true; - } - else - { - Creature* creature = botAI->GetCreature(selection); - bot->GetSession()->SendBindPoint(creature); - botAI->TellMaster("This inn is my new home"); - return true; - } + Creature* creature = botAI->GetCreature(selection); + bot->GetSession()->SendBindPoint(creature); + botAI->TellMaster("This inn is my new home"); + return true; } GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs"); diff --git a/src/Ai/Base/Actions/ShareQuestAction.cpp b/src/Ai/Base/Actions/ShareQuestAction.cpp index a9fe32c9..50ce2ac3 100644 --- a/src/Ai/Base/Actions/ShareQuestAction.cpp +++ b/src/Ai/Base/Actions/ShareQuestAction.cpp @@ -40,9 +40,8 @@ bool ShareQuestAction::Execute(Event event) return false; } -bool AutoShareQuestAction::Execute(Event event) +bool AutoShareQuestAction::Execute(Event /*event*/) { - Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bool shared = false; for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) diff --git a/src/Ai/Base/Actions/StayActions.cpp b/src/Ai/Base/Actions/StayActions.cpp index ad10e899..3be9c71d 100644 --- a/src/Ai/Base/Actions/StayActions.cpp +++ b/src/Ai/Base/Actions/StayActions.cpp @@ -47,7 +47,6 @@ bool StayAction::isUseful() PositionInfo stayPosition = AI_VALUE(PositionMap&, "position")["stay"]; if (stayPosition.isSet()) { - const float distance = bot->GetDistance(stayPosition.x, stayPosition.y, stayPosition.z); if (sPlayerbotAIConfig.followDistance) return false; } diff --git a/src/Ai/Base/Actions/SuggestWhatToDoAction.cpp b/src/Ai/Base/Actions/SuggestWhatToDoAction.cpp index 5bd19114..5d858eda 100644 --- a/src/Ai/Base/Actions/SuggestWhatToDoAction.cpp +++ b/src/Ai/Base/Actions/SuggestWhatToDoAction.cpp @@ -63,7 +63,6 @@ bool SuggestWhatToDoAction::Execute(Event /*event*/) fnct_ptr(); std::string const qualifier = "suggest what to do"; - time_t lastSaid = AI_VALUE2(time_t, "last said", qualifier); botAI->GetAiObjectContext()->GetValue("last said", qualifier)->Set(time(nullptr) + urand(1, 60)); return true; @@ -221,7 +220,7 @@ void SuggestWhatToDoAction::thunderfury() class FindTradeItemsVisitor : public IterateItemsVisitor { public: - FindTradeItemsVisitor(uint32 quality) : quality(quality), IterateItemsVisitor() {} + FindTradeItemsVisitor(uint32 quality) : IterateItemsVisitor(), quality(quality) {} bool Visit(Item* item) override { diff --git a/src/Ai/Base/Actions/TalkToQuestGiverAction.cpp b/src/Ai/Base/Actions/TalkToQuestGiverAction.cpp index 8fd120d6..35e8584b 100644 --- a/src/Ai/Base/Actions/TalkToQuestGiverAction.cpp +++ b/src/Ai/Base/Actions/TalkToQuestGiverAction.cpp @@ -231,7 +231,6 @@ void TalkToQuestGiverAction::AskToSelectReward(Quest const* quest, std::ostrings for (uint8 i = 0; i < quest->GetRewChoiceItemsCount(); ++i) { ItemTemplate const* item = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i]); - ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", quest->RewardChoiceItemId[i]); if (!forEquip || BestRewards(quest).count(i) > 0) { @@ -248,7 +247,6 @@ bool TurnInQueryQuestAction::Execute(Event event) WorldPacket pakcet = event.getPacket(); ObjectGuid guid; uint32 questId; - ObjectGuid unk1; pakcet >> guid >> questId; Object* object = ObjectAccessor::GetObjectByTypeMask(*bot, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM); diff --git a/src/Ai/Base/Actions/TameAction.cpp b/src/Ai/Base/Actions/TameAction.cpp index e968a0b0..b19626e5 100644 --- a/src/Ai/Base/Actions/TameAction.cpp +++ b/src/Ai/Base/Actions/TameAction.cpp @@ -51,7 +51,6 @@ bool TameAction::Execute(Event event) { std::set normalFamilies; std::set exoticFamilies; - Player* bot = botAI->GetBot(); // Loop over all creature templates and collect tameable families CreatureTemplateContainer const* creatures = sObjectMgr->GetCreatureTemplates(); diff --git a/src/Ai/Base/Actions/TellLosAction.cpp b/src/Ai/Base/Actions/TellLosAction.cpp index 3d18c582..0810a6af 100644 --- a/src/Ai/Base/Actions/TellLosAction.cpp +++ b/src/Ai/Base/Actions/TellLosAction.cpp @@ -95,7 +95,6 @@ bool TellAuraAction::Execute(Event /*event*/) std::string caster_name = caster ? caster->GetName() : "unknown"; bool is_area = aura->IsArea(); int32 duration = aura->GetDuration(); - const SpellInfo* spellInfo = aura->GetSpellInfo(); int32 spellId = aura->GetSpellInfo()->Id; bool isPositive = aura->GetSpellInfo()->IsPositive(); sLog->outMessage("playerbot", LOG_LEVEL_DEBUG, diff --git a/src/Ai/Base/Actions/TradeStatusAction.cpp b/src/Ai/Base/Actions/TradeStatusAction.cpp index 1c6ffc8e..96a7180a 100644 --- a/src/Ai/Base/Actions/TradeStatusAction.cpp +++ b/src/Ai/Base/Actions/TradeStatusAction.cpp @@ -64,8 +64,6 @@ bool TradeStatusAction::Execute(Event event) uint32 discount = sRandomPlayerbotMgr.GetTradeDiscount(bot, trader); if (CheckTrade()) { - int32 botMoney = CalculateCost(bot, true); - std::map givenItemIds, takenItemIds; for (uint32 slot = 0; slot < TRADE_SLOT_TRADED_COUNT; ++slot) { @@ -161,15 +159,11 @@ bool TradeStatusAction::CheckTrade() if (!botAI->HasActivePlayerMaster() && GET_PLAYERBOT_AI(bot->GetTrader())) { - bool isGivingItem = false; for (uint32 slot = 0; slot < TRADE_SLOT_TRADED_COUNT; ++slot) { Item* item = bot->GetTradeData()->GetItem((TradeSlots)slot); if (item) - { - isGivingItem = true; break; - } } bool isGettingItem = false; for (uint32 slot = 0; slot < TRADE_SLOT_TRADED_COUNT; ++slot) diff --git a/src/Ai/Base/Actions/TravelAction.cpp b/src/Ai/Base/Actions/TravelAction.cpp index 3516426c..5eda487e 100644 --- a/src/Ai/Base/Actions/TravelAction.cpp +++ b/src/Ai/Base/Actions/TravelAction.cpp @@ -134,8 +134,6 @@ bool MoveFromDarkPortalAction::Execute(Event /*event*/) if (bot->GetTeamId() == TEAM_ALLIANCE) return MoveTo(530, -319.261f, 1027.213, 54.172638f, false, true); - else - return MoveTo(530, -180.444f, 1027.947, 54.181538f, false, true); - return false; + return MoveTo(530, -180.444f, 1027.947, 54.181538f, false, true); } diff --git a/src/Ai/Base/Actions/UseItemAction.cpp b/src/Ai/Base/Actions/UseItemAction.cpp index 3483986f..dde06906 100644 --- a/src/Ai/Base/Actions/UseItemAction.cpp +++ b/src/Ai/Base/Actions/UseItemAction.cpp @@ -69,7 +69,6 @@ bool UseItemAction::UseItem(Item* item, ObjectGuid goGuid, Item* itemTarget, Uni uint8 bagIndex = item->GetBagSlot(); uint8 slot = item->GetSlot(); - uint8 spell_index = 0; uint8 cast_count = 1; ObjectGuid item_guid = item->GetGUID(); uint32 glyphIndex = 0; diff --git a/src/Ai/Base/Actions/WhoAction.cpp b/src/Ai/Base/Actions/WhoAction.cpp index 8f83b6e4..66525d78 100644 --- a/src/Ai/Base/Actions/WhoAction.cpp +++ b/src/Ai/Base/Actions/WhoAction.cpp @@ -108,7 +108,7 @@ std::string const WhoAction::QuerySkill(std::string const text) return out.str(); } -std::string const WhoAction::QuerySpec(std::string const text) +std::string const WhoAction::QuerySpec(std::string const /*text*/) { std::ostringstream out; diff --git a/src/Ai/Base/Actions/WipeAction.cpp b/src/Ai/Base/Actions/WipeAction.cpp index bbd1997d..f9fd4492 100644 --- a/src/Ai/Base/Actions/WipeAction.cpp +++ b/src/Ai/Base/Actions/WipeAction.cpp @@ -8,11 +8,13 @@ bool WipeAction::Execute(Event event) { - Player* master = event.getOwner(); + Player* const owner = event.getOwner(); + Player* const master = this->botAI->GetMaster(); - if (botAI->GetMaster()->GetGUID() != event.getOwner()->GetGUID()) + if (owner != nullptr && master != nullptr && master->GetGUID() != owner->GetGUID()) return false; bot->Kill(bot, bot); + return true; } diff --git a/src/Ai/Base/SharedValueContext.h b/src/Ai/Base/SharedValueContext.h index 94653aea..0ac35ab1 100644 --- a/src/Ai/Base/SharedValueContext.h +++ b/src/Ai/Base/SharedValueContext.h @@ -8,7 +8,7 @@ #include "LootValues.h" #include "NamedObjectContext.h" -#include "Playerbots.h" +#include "PlayerbotAI.h" #include "PvpValues.h" #include "QuestValues.h" diff --git a/src/Ai/Base/Trigger/RangeTriggers.cpp b/src/Ai/Base/Trigger/RangeTriggers.cpp index 01a4d0f6..e6892a04 100644 --- a/src/Ai/Base/Trigger/RangeTriggers.cpp +++ b/src/Ai/Base/Trigger/RangeTriggers.cpp @@ -11,11 +11,6 @@ #include "ServerFacade.h" #include "SharedDefines.h" -static float GetSpeedInMotion(Unit* target) -{ - return target->GetSpeed(Movement::SelectSpeedType(target->GetUnitMovementFlags())); -} - bool EnemyTooCloseForSpellTrigger::IsActive() { Unit* target = AI_VALUE(Unit*, "current target"); diff --git a/src/Ai/Base/Value/Arrow.cpp b/src/Ai/Base/Value/Arrow.cpp index 114b2c05..c993275f 100644 --- a/src/Ai/Base/Value/Arrow.cpp +++ b/src/Ai/Base/Value/Arrow.cpp @@ -144,8 +144,6 @@ UnitPosition MultiLineUnitPlacer::Place(FormationUnit* unit, uint32 index, uint3 uint32 lineNo = index / 6; uint32 indexInLine = index % 6; uint32 lineSize = std::max(count - lineNo * 6, uint32(6)); - float x = cos(orientation) * sPlayerbotAIConfig.followDistance * lineNo; - float y = sin(orientation) * sPlayerbotAIConfig.followDistance * lineNo; return placer.Place(unit, indexInLine, lineSize); } @@ -160,17 +158,13 @@ UnitPosition SingleLineUnitPlacer::Place(FormationUnit* unit, uint32 index, uint void FormationSlot::Move(float dx, float dy) { for (FormationUnit* unit : units) - { unit->SetLocation(unit->GetX() + dx, unit->GetY() + dy); - } } FormationSlot::~FormationSlot() { for (FormationUnit* unit : units) - { delete unit; - } units.clear(); } diff --git a/src/Ai/Base/Value/GrindTargetValue.cpp b/src/Ai/Base/Value/GrindTargetValue.cpp index 573de8fb..bb03e6c6 100644 --- a/src/Ai/Base/Value/GrindTargetValue.cpp +++ b/src/Ai/Base/Value/GrindTargetValue.cpp @@ -30,7 +30,6 @@ Unit* GrindTargetValue::Calculate() Unit* GrindTargetValue::FindTargetForGrinding(uint32 assistCount) { - uint32 memberCount = 1; Group* group = bot->GetGroup(); Player* master = GetMaster(); @@ -65,7 +64,6 @@ Unit* GrindTargetValue::FindTargetForGrinding(uint32 assistCount) if (!unit->IsInWorld() || unit->IsDuringRemoveFromWorld()) continue; - auto& rep = bot->ToPlayer()->GetReputationMgr(); if (unit->ToCreature() && !unit->ToCreature()->GetCreatureTemplate()->lootid && bot->GetReactionTo(unit) >= REP_NEUTRAL) continue; diff --git a/src/Ai/Base/Value/ItemUsageValue.cpp b/src/Ai/Base/Value/ItemUsageValue.cpp index c6183e30..7e5aae87 100644 --- a/src/Ai/Base/Value/ItemUsageValue.cpp +++ b/src/Ai/Base/Value/ItemUsageValue.cpp @@ -69,8 +69,10 @@ ItemUsage ItemUsageValue::Calculate() if (proto->Class == ITEM_CLASS_KEY) return ITEM_USAGE_USE; + const uint32_t maxCount = proto->MaxCount; + if (proto->Class == ITEM_CLASS_CONSUMABLE && - (proto->MaxCount == 0 || bot->GetItemCount(itemId, false) < proto->MaxCount)) + (maxCount == 0 || bot->GetItemCount(itemId, false) < maxCount)) { std::string const foodType = GetConsumableType(proto, bot->GetPower(POWER_MANA)); diff --git a/src/Ai/Base/Value/LeastHpTargetValue.cpp b/src/Ai/Base/Value/LeastHpTargetValue.cpp index 423db1de..2992952b 100644 --- a/src/Ai/Base/Value/LeastHpTargetValue.cpp +++ b/src/Ai/Base/Value/LeastHpTargetValue.cpp @@ -6,7 +6,7 @@ #include "LeastHpTargetValue.h" #include "AttackersValue.h" -#include "PlayerbotAI.h" +#include "Playerbots.h" class FindLeastHpTargetStrategy : public FindNonCcTargetStrategy { @@ -15,7 +15,6 @@ public: void CheckAttacker(Unit* attacker, ThreatMgr* threatMgr) override { - Player* bot = botAI->GetBot(); if (IsCcTarget(attacker)) return; @@ -30,5 +29,6 @@ protected: Unit* LeastHpTargetValue::Calculate() { FindLeastHpTargetStrategy strategy(botAI); + return FindTarget(&strategy); } diff --git a/src/Ai/Base/Value/PartyMemberWithoutAuraValue.h b/src/Ai/Base/Value/PartyMemberWithoutAuraValue.h index 4ba9558f..6d95a313 100644 --- a/src/Ai/Base/Value/PartyMemberWithoutAuraValue.h +++ b/src/Ai/Base/Value/PartyMemberWithoutAuraValue.h @@ -8,7 +8,6 @@ #include "NamedObjectContext.h" #include "PartyMemberValue.h" -#include "PlayerbotAIConfig.h" class PlayerbotAI; class Unit; @@ -16,8 +15,7 @@ class Unit; class PartyMemberWithoutAuraValue : public PartyMemberValue, public Qualified { public: - PartyMemberWithoutAuraValue(PlayerbotAI* botAI, std::string const name = "party member without aura", - float range = sPlayerbotAIConfig.sightDistance) + PartyMemberWithoutAuraValue(PlayerbotAI* botAI, std::string const name = "party member without aura") : PartyMemberValue(botAI, name) { } diff --git a/src/Ai/Base/Value/PossibleRpgTargetsValue.cpp b/src/Ai/Base/Value/PossibleRpgTargetsValue.cpp index fbcb8fb2..f2b6aef1 100644 --- a/src/Ai/Base/Value/PossibleRpgTargetsValue.cpp +++ b/src/Ai/Base/Value/PossibleRpgTargetsValue.cpp @@ -5,15 +5,14 @@ #include "PossibleRpgTargetsValue.h" -#include "AiObjectContext.h" +#include "CellImpl.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" #include "ObjectGuid.h" +#include "Playerbots.h" #include "ServerFacade.h" #include "SharedDefines.h" #include "NearestGameObjects.h" -#include "GridNotifiers.h" -#include "GridNotifiersImpl.h" -#include "CellImpl.h" -#include "TravelMgr.h" std::vector PossibleRpgTargetsValue::allowedNpcFlags; @@ -74,15 +73,9 @@ bool PossibleRpgTargetsValue::AcceptUnit(Unit* unit) } TravelTarget* travelTarget = context->GetValue("travel target")->Get(); - - if ( - travelTarget != nullptr - && travelTarget->getDestination() - && (uint32_t)travelTarget->getDestination()->getEntry() == unit->GetEntry() - ) - { + if (travelTarget && travelTarget->getDestination() && + travelTarget->getDestination()->getEntry() == unit->GetEntry()) return true; - } if (urand(1, 100) < 25 && unit->IsFriendlyTo(bot)) return true; diff --git a/src/Ai/Base/Value/SnareTargetValue.cpp b/src/Ai/Base/Value/SnareTargetValue.cpp index f2440fce..45ae35f0 100644 --- a/src/Ai/Base/Value/SnareTargetValue.cpp +++ b/src/Ai/Base/Value/SnareTargetValue.cpp @@ -14,7 +14,6 @@ Unit* SnareTargetValue::Calculate() std::string const spell = qualifier; GuidVector attackers = botAI->GetAiObjectContext()->GetValue("attackers")->Get(); - Unit* target = botAI->GetAiObjectContext()->GetValue("current target")->Get(); for (ObjectGuid const guid : attackers) { Unit* unit = botAI->GetUnit(guid); diff --git a/src/Ai/Base/Value/StatsValues.cpp b/src/Ai/Base/Value/StatsValues.cpp index 5205ec05..941750d3 100644 --- a/src/Ai/Base/Value/StatsValues.cpp +++ b/src/Ai/Base/Value/StatsValues.cpp @@ -208,7 +208,6 @@ uint8 BagSpaceValue::Calculate() ++totalused; } - uint32 totalfree = 16 - totalused; for (uint8 bag = INVENTORY_SLOT_BAG_START; bag < INVENTORY_SLOT_BAG_END; ++bag) { const Bag* const pBag = (Bag*)bot->GetItemByPos(INVENTORY_SLOT_BAG_0, bag); @@ -218,7 +217,6 @@ uint8 BagSpaceValue::Calculate() if (pBagProto->Class == ITEM_CLASS_CONTAINER && pBagProto->SubClass == ITEM_SUBCLASS_CONTAINER) { total += pBag->GetBagSize(); - totalfree += pBag->GetFreeSlots(); totalused += pBag->GetBagSize() - pBag->GetFreeSlots(); } } diff --git a/src/Ai/Class/Paladin/Action/PaladinActions.cpp b/src/Ai/Class/Paladin/Action/PaladinActions.cpp index 726f8354..d0bfbabb 100644 --- a/src/Ai/Class/Paladin/Action/PaladinActions.cpp +++ b/src/Ai/Class/Paladin/Action/PaladinActions.cpp @@ -16,7 +16,6 @@ #include "ObjectAccessor.h" using ai::buff::MakeAuraQualifierForBuff; -using ai::buff::UpgradeToGroupIfAppropriate; // Helper : detect tank role on the target (player bot or not) return true if spec is tank or if the bot have tank strategies (bear/tank/tank face). static inline bool IsTankRole(Player* p) @@ -53,11 +52,6 @@ static inline bool IsOnlyPaladinInGroup(Player* bot) return pals == 1u; } -static inline bool GroupHasTankOfClass(Group* g, uint8 classId) -{ - return GroupHasTankOfClass(g, static_cast(classId)); -} - inline std::string const GetActualBlessingOfMight(Unit* target) { if (!target->ToPlayer()) diff --git a/src/Ai/Class/Shaman/Trigger/ShamanTriggers.cpp b/src/Ai/Class/Shaman/Trigger/ShamanTriggers.cpp index 753edb83..c8b36135 100644 --- a/src/Ai/Class/Shaman/Trigger/ShamanTriggers.cpp +++ b/src/Ai/Class/Shaman/Trigger/ShamanTriggers.cpp @@ -283,20 +283,6 @@ static uint32 GetRequiredTotemSpellId(PlayerbotAI* ai, const char* strategies[], return 0; // No relevant strategy active, or bot doesn't know any rank } -// Get the spellId of the currently summoned totem in the slot -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); -} - bool NoEarthTotemTrigger::IsActive() { // Check if the bot has Stoneskin Totem (required level 4) and prevents the trigger firing if it doesn't diff --git a/src/Ai/Class/Shaman/Trigger/ShamanTriggers.h b/src/Ai/Class/Shaman/Trigger/ShamanTriggers.h index 65d5081c..9e1a86aa 100644 --- a/src/Ai/Class/Shaman/Trigger/ShamanTriggers.h +++ b/src/Ai/Class/Shaman/Trigger/ShamanTriggers.h @@ -359,10 +359,8 @@ class SetTotemTrigger : public Trigger public: // Template constructor: infers N (size of the id array) at compile time template - SetTotemTrigger(PlayerbotAI* ai, std::string const& spellName, uint32 requiredSpellId, - const uint32 (&ids)[N], int actionButtonId) + SetTotemTrigger(PlayerbotAI* ai, std::string const& spellName, const uint32 (&ids)[N], int actionButtonId) : Trigger(ai, "set " + spellName) - , requiredSpellId(requiredSpellId) , totemSpellIds(ids) , totemSpellIdsCount(N) , actionButtonId(actionButtonId) @@ -370,7 +368,6 @@ public: bool IsActive() override; private: - uint32 requiredSpellId; uint32 const* totemSpellIds; size_t totemSpellIdsCount; int actionButtonId; @@ -380,119 +377,119 @@ class SetStrengthOfEarthTotemTrigger : public SetTotemTrigger { public: SetStrengthOfEarthTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "strength of earth totem", SPELL_STRENGTH_OF_EARTH_TOTEM_RANK_1, STRENGTH_OF_EARTH_TOTEM, TOTEM_BAR_SLOT_EARTH) {} + : SetTotemTrigger(ai, "strength of earth totem", STRENGTH_OF_EARTH_TOTEM, TOTEM_BAR_SLOT_EARTH) {} }; class SetStoneskinTotemTrigger : public SetTotemTrigger { public: SetStoneskinTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "stoneskin totem", SPELL_STONESKIN_TOTEM_RANK_1, STONESKIN_TOTEM, TOTEM_BAR_SLOT_EARTH) {} + : SetTotemTrigger(ai, "stoneskin totem", STONESKIN_TOTEM, TOTEM_BAR_SLOT_EARTH) {} }; class SetTremorTotemTrigger : public SetTotemTrigger { public: SetTremorTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "tremor totem", SPELL_TREMOR_TOTEM_RANK_1, TREMOR_TOTEM, TOTEM_BAR_SLOT_EARTH) {} + : SetTotemTrigger(ai, "tremor totem", TREMOR_TOTEM, TOTEM_BAR_SLOT_EARTH) {} }; class SetEarthbindTotemTrigger : public SetTotemTrigger { public: SetEarthbindTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "earthbind totem", SPELL_EARTHBIND_TOTEM_RANK_1, EARTHBIND_TOTEM, TOTEM_BAR_SLOT_EARTH) {} + : SetTotemTrigger(ai, "earthbind totem", EARTHBIND_TOTEM, TOTEM_BAR_SLOT_EARTH) {} }; class SetSearingTotemTrigger : public SetTotemTrigger { public: SetSearingTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "searing totem", SPELL_SEARING_TOTEM_RANK_1, SEARING_TOTEM, TOTEM_BAR_SLOT_FIRE) {} + : SetTotemTrigger(ai, "searing totem", SEARING_TOTEM, TOTEM_BAR_SLOT_FIRE) {} }; class SetMagmaTotemTrigger : public SetTotemTrigger { public: SetMagmaTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "magma totem", SPELL_MAGMA_TOTEM_RANK_1, MAGMA_TOTEM, TOTEM_BAR_SLOT_FIRE) {} + : SetTotemTrigger(ai, "magma totem", MAGMA_TOTEM, TOTEM_BAR_SLOT_FIRE) {} }; class SetFlametongueTotemTrigger : public SetTotemTrigger { public: SetFlametongueTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "flametongue totem", SPELL_FLAMETONGUE_TOTEM_RANK_1, FLAMETONGUE_TOTEM, TOTEM_BAR_SLOT_FIRE) {} + : SetTotemTrigger(ai, "flametongue totem", FLAMETONGUE_TOTEM, TOTEM_BAR_SLOT_FIRE) {} }; class SetTotemOfWrathTrigger : public SetTotemTrigger { public: SetTotemOfWrathTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "totem of wrath", SPELL_TOTEM_OF_WRATH_RANK_1, TOTEM_OF_WRATH, TOTEM_BAR_SLOT_FIRE) {} + : SetTotemTrigger(ai, "totem of wrath", TOTEM_OF_WRATH, TOTEM_BAR_SLOT_FIRE) {} }; class SetFrostResistanceTotemTrigger : public SetTotemTrigger { public: SetFrostResistanceTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "frost resistance totem", SPELL_FROST_RESISTANCE_TOTEM_RANK_1, FROST_RESISTANCE_TOTEM, TOTEM_BAR_SLOT_FIRE) {} + : SetTotemTrigger(ai, "frost resistance totem", FROST_RESISTANCE_TOTEM, TOTEM_BAR_SLOT_FIRE) {} }; class SetHealingStreamTotemTrigger : public SetTotemTrigger { public: SetHealingStreamTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "healing stream totem", SPELL_HEALING_STREAM_TOTEM_RANK_1, HEALING_STREAM_TOTEM, TOTEM_BAR_SLOT_WATER) {} + : SetTotemTrigger(ai, "healing stream totem", HEALING_STREAM_TOTEM, TOTEM_BAR_SLOT_WATER) {} }; class SetManaSpringTotemTrigger : public SetTotemTrigger { public: SetManaSpringTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "mana spring totem", SPELL_MANA_SPRING_TOTEM_RANK_1, MANA_SPRING_TOTEM, TOTEM_BAR_SLOT_WATER) {} + : SetTotemTrigger(ai, "mana spring totem", MANA_SPRING_TOTEM, TOTEM_BAR_SLOT_WATER) {} }; class SetCleansingTotemTrigger : public SetTotemTrigger { public: SetCleansingTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "cleansing totem", SPELL_CLEANSING_TOTEM_RANK_1, CLEANSING_TOTEM, TOTEM_BAR_SLOT_WATER) {} + : SetTotemTrigger(ai, "cleansing totem", CLEANSING_TOTEM, TOTEM_BAR_SLOT_WATER) {} }; class SetFireResistanceTotemTrigger : public SetTotemTrigger { public: SetFireResistanceTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "fire resistance totem", SPELL_FIRE_RESISTANCE_TOTEM_RANK_1, FIRE_RESISTANCE_TOTEM, TOTEM_BAR_SLOT_WATER) {} + : SetTotemTrigger(ai, "fire resistance totem", FIRE_RESISTANCE_TOTEM, TOTEM_BAR_SLOT_WATER) {} }; class SetWrathOfAirTotemTrigger : public SetTotemTrigger { public: SetWrathOfAirTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "wrath of air totem", SPELL_WRATH_OF_AIR_TOTEM_RANK_1, WRATH_OF_AIR_TOTEM, TOTEM_BAR_SLOT_AIR) {} + : SetTotemTrigger(ai, "wrath of air totem", WRATH_OF_AIR_TOTEM, TOTEM_BAR_SLOT_AIR) {} }; class SetWindfuryTotemTrigger : public SetTotemTrigger { public: SetWindfuryTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "windfury totem", SPELL_WINDFURY_TOTEM_RANK_1, WINDFURY_TOTEM, TOTEM_BAR_SLOT_AIR) {} + : SetTotemTrigger(ai, "windfury totem", WINDFURY_TOTEM, TOTEM_BAR_SLOT_AIR) {} }; class SetNatureResistanceTotemTrigger : public SetTotemTrigger { public: SetNatureResistanceTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "nature resistance totem", SPELL_NATURE_RESISTANCE_TOTEM_RANK_1, NATURE_RESISTANCE_TOTEM, TOTEM_BAR_SLOT_AIR) {} + : SetTotemTrigger(ai, "nature resistance totem", NATURE_RESISTANCE_TOTEM, TOTEM_BAR_SLOT_AIR) {} }; class SetGroundingTotemTrigger : public SetTotemTrigger { public: SetGroundingTotemTrigger(PlayerbotAI* ai) - : SetTotemTrigger(ai, "grounding totem", SPELL_GROUNDING_TOTEM_RANK_1, GROUNDING_TOTEM, TOTEM_BAR_SLOT_AIR) {} + : SetTotemTrigger(ai, "grounding totem", GROUNDING_TOTEM, TOTEM_BAR_SLOT_AIR) {} }; #endif diff --git a/src/Ai/Dungeon/ForgeOfSouls/Action/ForgeOfSoulsActions.cpp b/src/Ai/Dungeon/ForgeOfSouls/Action/ForgeOfSoulsActions.cpp index d83b69bb..cb29453e 100644 --- a/src/Ai/Dungeon/ForgeOfSouls/Action/ForgeOfSoulsActions.cpp +++ b/src/Ai/Dungeon/ForgeOfSouls/Action/ForgeOfSoulsActions.cpp @@ -17,11 +17,9 @@ bool MoveFromBronjahmAction::Execute(Event /*event*/) bool AttackCorruptedSoulFragmentAction::Execute(Event /*event*/) { - Unit* currentTarget = AI_VALUE(Unit*, "current target"); GuidVector targets = AI_VALUE(GuidVector, "possible targets"); // If no valid skull target, search for corrupted soul fragment - Unit* empoweredPrince = nullptr; for (auto i = targets.begin(); i != targets.end(); ++i) { Unit* unit = botAI->GetUnit(*i); @@ -30,8 +28,6 @@ bool AttackCorruptedSoulFragmentAction::Execute(Event /*event*/) if (unit->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT) { - empoweredPrince = unit; - // Mark corrupted soul fragment with skull if in group and not already marked if (Group* group = bot->GetGroup()) { diff --git a/src/Ai/Dungeon/Gundrak/Action/GundrakActions.cpp b/src/Ai/Dungeon/Gundrak/Action/GundrakActions.cpp index 775e8ef2..7dbcb6d6 100644 --- a/src/Ai/Dungeon/Gundrak/Action/GundrakActions.cpp +++ b/src/Ai/Dungeon/Gundrak/Action/GundrakActions.cpp @@ -23,7 +23,6 @@ bool AttackSnakeWrapAction::Execute(Event /*event*/) Unit* boss = AI_VALUE2(Unit*, "find target", "slad'ran"); if (!boss) { return false; } - Unit* snakeWrap = nullptr; // Target is not findable from threat table using AI_VALUE2(), // therefore need to search manually for the unit name GuidVector targets = AI_VALUE(GuidVector, "possible targets no los"); diff --git a/src/Ai/Dungeon/TrialOfTheChampion/Action/TrialOfTheChampionActions.cpp b/src/Ai/Dungeon/TrialOfTheChampion/Action/TrialOfTheChampionActions.cpp index da865a2d..f3b071fe 100644 --- a/src/Ai/Dungeon/TrialOfTheChampion/Action/TrialOfTheChampionActions.cpp +++ b/src/Ai/Dungeon/TrialOfTheChampion/Action/TrialOfTheChampionActions.cpp @@ -55,10 +55,6 @@ bool ToCLanceAction::Execute(Event /*event*/) // If we found the lance, equip it if (lanceItem) { - // Store the lance's current position - uint8 srcBag = lanceItem->GetBagSlot(); - uint8 srcSlot = lanceItem->GetSlot(); - // First unequip current weapon if it exists if (oldWeapon) bot->SwapItem(oldWeapon->GetPos(), lanceItem->GetPos()); diff --git a/src/Ai/Raid/GruulsLair/Action/RaidGruulsLairActions.cpp b/src/Ai/Raid/GruulsLair/Action/RaidGruulsLairActions.cpp index 1a45b0c1..8f8519f5 100644 --- a/src/Ai/Raid/GruulsLair/Action/RaidGruulsLairActions.cpp +++ b/src/Ai/Raid/GruulsLair/Action/RaidGruulsLairActions.cpp @@ -399,7 +399,9 @@ bool HighKingMaulgarBanishFelstalkerAction::Execute(Event /*event*/) } } - if (warlockIndex >= 0 && warlockIndex < felStalkers.size()) + const int64_t felStalkersSize = felStalkers.size(); + + if (warlockIndex >= 0 && warlockIndex < felStalkersSize) { Unit* assignedFelStalker = felStalkers[warlockIndex]; if (!botAI->HasAura("banish", assignedFelStalker) && botAI->CanCastSpell("banish", assignedFelStalker)) @@ -511,7 +513,6 @@ bool GruulTheDragonkillerTanksPositionBossAction::Execute(Event /*event*/) if (distanceToTankPosition > maxDistance) { - float step = std::min(maxDistance, distanceToTankPosition); float moveX = bot->GetPositionX() + (dX / distanceToTankPosition) * maxDistance; float moveY = bot->GetPositionY() + (dY / distanceToTankPosition) * maxDistance; const float moveZ = position.GetPositionZ(); diff --git a/src/Ai/Raid/Icecrown/Action/RaidIccActions.cpp b/src/Ai/Raid/Icecrown/Action/RaidIccActions.cpp index 762f0287..336bd45e 100644 --- a/src/Ai/Raid/Icecrown/Action/RaidIccActions.cpp +++ b/src/Ai/Raid/Icecrown/Action/RaidIccActions.cpp @@ -1034,8 +1034,6 @@ bool IccDbsTankPositionAction::CrowdControlBloodBeasts() NPC_BLOOD_BEAST4}; const GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - bool appliedCC = false; - for (auto const& npc : npcs) { Unit* unit = botAI->GetUnit(npc); @@ -1054,73 +1052,43 @@ bool IccDbsTankPositionAction::CrowdControlBloodBeasts() { case CLASS_MAGE: if (!botAI->HasAura("Frost Nova", unit)) - { botAI->CastSpell("Frost Nova", unit); - appliedCC = true; - } break; case CLASS_DRUID: if (!botAI->HasAura("Entangling Roots", unit)) - { botAI->CastSpell("Entangling Roots", unit); - appliedCC = true; - } break; case CLASS_PALADIN: if (!botAI->HasAura("Hammer of Justice", unit)) - { botAI->CastSpell("Hammer of Justice", unit); - appliedCC = true; - } break; case CLASS_WARRIOR: if (!botAI->HasAura("Hamstring", unit)) - { botAI->CastSpell("Hamstring", unit); - appliedCC = true; - } break; case CLASS_HUNTER: if (!botAI->HasAura("Concussive Shot", unit)) - { botAI->CastSpell("Concussive Shot", unit); - appliedCC = true; - } break; case CLASS_ROGUE: if (!botAI->HasAura("Kidney Shot", unit)) - { botAI->CastSpell("Kidney Shot", unit); - appliedCC = true; - } break; case CLASS_SHAMAN: if (!botAI->HasAura("Frost Shock", unit)) - { botAI->CastSpell("Frost Shock", unit); - appliedCC = true; - } break; case CLASS_DEATH_KNIGHT: if (!botAI->HasAura("Chains of Ice", unit)) - { botAI->CastSpell("Chains of Ice", unit); - appliedCC = true; - } break; case CLASS_PRIEST: if (!botAI->HasAura("Psychic Scream", unit)) - { botAI->CastSpell("Psychic Scream", unit); - appliedCC = true; - } break; case CLASS_WARLOCK: if (!botAI->HasAura("Fear", unit)) - { botAI->CastSpell("Fear", unit); - appliedCC = true; - } break; default: break; @@ -1464,7 +1432,6 @@ int IccFestergutGroupPositionAction::CalculatePositionIndex(Group* group) else { // Fill remaining spots in second row - int spotsInFirstRow = 6; int spotsInSecondRow = healerSpotsUsed - 6; int remainingInSecondRow = 6 - spotsInSecondRow; @@ -1511,7 +1478,6 @@ int IccFestergutGroupPositionAction::CalculatePositionIndex(Group* group) bool IccFestergutSporeAction::Execute(Event /*event*/) { constexpr float POSITION_TOLERANCE = 4.0f; - constexpr float SPREAD_RADIUS = 2.0f; // Check if bot has spore bool hasSpore = bot->HasAura(SPELL_GAS_SPORE); // gas spore @@ -1661,7 +1627,7 @@ bool IccRotfaceTankPositionAction::PositionMainTankAndMelee(Unit* boss) { bool isBossCasting = false; if (boss && boss->HasUnitState(UNIT_STATE_CASTING) && boss->GetCurrentSpell(SPELL_SLIME_SPRAY)) - bool isBossCasting = true; + isBossCasting = true; if (bot->GetExactDist2d(ICC_ROTFACE_CENTER_POSITION) > 7.0f && botAI->HasAggro(boss) && botAI->IsMainTank(bot)) MoveTo(bot->GetMapId(), ICC_ROTFACE_CENTER_POSITION.GetPositionX(), @@ -1829,21 +1795,7 @@ bool IccRotfaceGroupPositionAction::Execute(Event /*event*/) return false; const GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); - bool floodPresent = false; - for (auto const& npc : npcs) - { - Unit* unit = botAI->GetUnit(npc); - if (!unit || !botAI->HasAura("Ooze Flood", unit)) - continue; - - float puddleDistance = bot->GetExactDist2d(unit); - - if (puddleDistance < 30.0f) - floodPresent = true; - } - - Unit* bigOoze = AI_VALUE2(Unit*, "find target", "big ooze"); bool hasOozeFlood = botAI->HasAura("Ooze Flood", bot); Unit* smallOoze = AI_VALUE2(Unit*, "find target", "little ooze"); bool hasMutatedInfection = botAI->HasAura("Mutated Infection", bot); @@ -2014,7 +1966,7 @@ bool IccRotfaceGroupPositionAction::PositionRangedAndHealers(Unit* boss,Unit *sm Difficulty diff = bot->GetRaidDifficulty(); bool isBossCasting = false; if (boss && boss->HasUnitState(UNIT_STATE_CASTING) && boss->GetCurrentSpell(SPELL_SLIME_SPRAY)) - bool isBossCasting = true; + isBossCasting = true; bool isHeroic = (diff == RAID_DIFFICULTY_10MAN_HEROIC || diff == RAID_DIFFICULTY_25MAN_HEROIC); @@ -2070,7 +2022,6 @@ bool IccRotfaceGroupPositionAction::FindAndMoveFromClosestMember(Unit* boss, Uni const float maxMoveDistance = 12.0f; // Limit maximum movement distance const float puddleSafeDistance = 30.0f; // Minimum distance to stay away from puddle const float minCenterDistance = 20.0f; // Minimum distance from center position - const bool isRanged = botAI->IsRanged(bot) || botAI->IsHeal(bot); // Ranged: spread from other members const GuidVector members = AI_VALUE(GuidVector, "group members"); @@ -2233,7 +2184,6 @@ bool IccRotfaceMoveAwayFromExplosionAction::MoveToRandomSafeLocation() // Move in increments of 5.0f towards the calculated position float currentX = bot->GetPositionX(); float currentY = bot->GetPositionY(); - float currentZ = bot->GetPositionZ(); float directionX = moveX - currentX; float directionY = moveY - currentY; @@ -2276,7 +2226,6 @@ Unit* IccPutricideGrowingOozePuddleAction::FindClosestThreateningPuddle() Unit* closestPuddle = nullptr; float closestDistance = FLT_MAX; - float closestSafeDistance = BASE_RADIUS; for (auto const& npc : npcs) { @@ -2293,7 +2242,6 @@ Unit* IccPutricideGrowingOozePuddleAction::FindClosestThreateningPuddle() if (currentDistance < safeDistance && currentDistance < closestDistance) { closestDistance = currentDistance; - closestSafeDistance = safeDistance; closestPuddle = unit; } } @@ -3648,7 +3596,6 @@ bool IccBpcKineticBombAction::Execute(Event /*event*/) Unit* IccBpcKineticBombAction::FindOptimalKineticBomb() { - static constexpr float MAX_HEIGHT_DIFF = 20.0f; static constexpr std::array KINETIC_BOMB_ENTRIES = {NPC_KINETIC_BOMB1, NPC_KINETIC_BOMB2, NPC_KINETIC_BOMB3, NPC_KINETIC_BOMB4}; @@ -4012,7 +3959,6 @@ bool IccBqlGroupPositionAction::HandleShadowsMovement() // Find closest safe point by searching in both directions from closest point Position safeMoveTarget = closestPoint; - float safeMoveTargetDist = FLT_MAX; bool foundSafe = closestIsSafe; // Only search for safe spots if the closest point isn't already safe @@ -4083,7 +4029,6 @@ bool IccBqlGroupPositionAction::HandleShadowsMovement() if (foundSafe) { // If we found a safe point, penalize based on travel distance along the curve to reach it - float stepsToCurve = minDist / 2.0f; // Approximate steps to reach the curve float safeDist = bot->GetExactDist2d(safeMoveTarget); // Add distance penalty based on how far we need to move along the curve @@ -4364,7 +4309,6 @@ bool IccBqlGroupPositionAction::HandleGroupPosition(Unit* boss, Aura* frenzyAura rangedBots.erase(std::remove(rangedBots.begin(), rangedBots.end(), h), rangedBots.end()); // Distribute remaining ranged evenly - size_t totalRanged = leftSide.size() + rightSide.size() + rangedBots.size(); size_t leftCount = leftSide.size(); size_t rightCount = rightSide.size(); for (Player* p : rangedBots) @@ -5562,7 +5506,6 @@ bool IccValithriaDreamCloudAction::Execute(Event /*event*/) auto it = std::find(dreamBots.begin(), dreamBots.end(), bot); if (it == dreamBots.end()) return false; - size_t myIndex = std::distance(dreamBots.begin(), it); // Check if all dream bots are stacked within 3f of the current leader (lowest guid) constexpr float STACK_RADIUS = 2.0f; @@ -6699,7 +6642,6 @@ bool IccSindragosaFrostBombAction::Execute(Event /*event*/) } } Unit* losTomb = myTombs[bestIdx]; - ObjectGuid losTombGuid = myTombGuids[bestIdx]; // Calculate position for LOS (stand at least 6.5f behind the tomb from the bomb) float angle = marker->GetAngle(losTomb); @@ -6782,7 +6724,6 @@ bool IccSindragosaFrostBombAction::Execute(Event /*event*/) // Clear the marker for our group's icon group->SetTargetIcon(iconIndex, bot->GetGUID(), ObjectGuid::Empty); } - Unit* boss = AI_VALUE2(Unit*, "find target", "sindragosa"); bot->AttackStop(); return true; } @@ -7021,10 +6962,7 @@ bool IccLichKingWinterAction::Execute(Event /*event*/) { const ObjectGuid currentSkullTarget = group->GetTargetIcon(7); if (!currentSkullTarget.IsEmpty()) - { - Unit* skullTarget = ObjectAccessor::GetUnit(*bot, currentSkullTarget); group->SetTargetIcon(7, bot->GetGUID(), ObjectGuid::Empty); - } } if (isVictim) @@ -7802,7 +7740,6 @@ bool IccLichKingAddsAction::Execute(Event /*event*/) //------CHEAT------- } - Unit* spiritWarden = AI_VALUE2(Unit*, "find target", "spirit warden"); bool hasPlague = botAI->HasAura("Necrotic Plague", bot); Unit* terenasMenethilHC = bot->FindNearestCreature(NPC_TERENAS_MENETHIL_HC, 55.0f); @@ -8475,8 +8412,6 @@ bool IccLichKingAddsAction::HandleAssistTankAddManagement(Unit* boss, Difficulty // In heroic mode, stay at melee position if (diff && (diff == RAID_DIFFICULTY_10MAN_HEROIC || diff == RAID_DIFFICULTY_25MAN_HEROIC)) { - Unit* mainTank = AI_VALUE(Unit*, "main tank"); - if (bot->GetExactDist2d(ICC_LICH_KING_ASSISTHC_POSITION.GetPositionX(), ICC_LICH_KING_ASSISTHC_POSITION.GetPositionY()) > 2.0f) { @@ -8713,7 +8648,6 @@ void IccLichKingAddsAction::HandleDefileMechanics(Unit* boss, Difficulty diff) // Gather all defile units std::vector defiles; - Unit* closestDefile = nullptr; float closestDistance = std::numeric_limits::max(); GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); @@ -8725,10 +8659,7 @@ void IccLichKingAddsAction::HandleDefileMechanics(Unit* boss, Difficulty diff) defiles.push_back(unit); float dist = bot->GetDistance(unit); if (dist < closestDistance) - { closestDistance = dist; - closestDefile = unit; - } } } @@ -9068,7 +8999,6 @@ void IccLichKingAddsAction::HandleValkyrMarking(const std::vector& grabbi std::sort(sortedValkyrs.begin(), sortedValkyrs.end(), [](Unit* a, Unit* b) { return a->GetGUID() < b->GetGUID(); }); static constexpr uint8_t ICON_INDICES[] = {7, 6, 0}; // Skull, Cross, Star - static constexpr const char* ICON_NAMES[] = {"skull", "cross", "star"}; // In heroic mode, clean up invalid markers for all possible icons if (diff && (diff == RAID_DIFFICULTY_10MAN_HEROIC || diff == RAID_DIFFICULTY_25MAN_HEROIC)) diff --git a/src/Ai/Raid/Icecrown/Multiplier/RaidIccMultipliers.cpp b/src/Ai/Raid/Icecrown/Multiplier/RaidIccMultipliers.cpp index c6a6fdee..c7f25e33 100644 --- a/src/Ai/Raid/Icecrown/Multiplier/RaidIccMultipliers.cpp +++ b/src/Ai/Raid/Icecrown/Multiplier/RaidIccMultipliers.cpp @@ -24,8 +24,6 @@ // LK global variables namespace { -uint32 g_lastPlagueTime = 0; -bool g_plagueAllowedToCure = false; std::map g_plagueTimes; std::map g_allowCure; std::mutex g_plagueMutex; // Lock before accessing shared variables diff --git a/src/Ai/Raid/Icecrown/Trigger/RaidIccTriggers.cpp b/src/Ai/Raid/Icecrown/Trigger/RaidIccTriggers.cpp index 75989ba1..40ee354e 100644 --- a/src/Ai/Raid/Icecrown/Trigger/RaidIccTriggers.cpp +++ b/src/Ai/Raid/Icecrown/Trigger/RaidIccTriggers.cpp @@ -1102,7 +1102,6 @@ bool IccLichKingShadowTrapTrigger::IsActive() // search for all nearby traps GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); std::vector nearbyTraps; - bool needToMove = false; for (auto& npc : npcs) { diff --git a/src/Ai/Raid/Karazhan/Action/RaidKarazhanActions.cpp b/src/Ai/Raid/Karazhan/Action/RaidKarazhanActions.cpp index b04e09d0..8f7f5f52 100644 --- a/src/Ai/Raid/Karazhan/Action/RaidKarazhanActions.cpp +++ b/src/Ai/Raid/Karazhan/Action/RaidKarazhanActions.cpp @@ -870,7 +870,6 @@ bool NetherspiteAvoidBeamAndVoidZoneAction::Execute(Event /*event*/) if (!netherspite) return false; - auto [redBlocker, greenBlocker, blueBlocker] = GetCurrentBeamBlockers(botAI, bot); std::vector voidZones = GetAllVoidZones(botAI, bot); bool nearVoidZone = !IsSafePosition(bot->GetPositionX(), bot->GetPositionY(), diff --git a/src/Ai/Raid/ObsidianSanctum/Action/RaidOsActions.cpp b/src/Ai/Raid/ObsidianSanctum/Action/RaidOsActions.cpp index ee9dfb0f..c4f398d6 100644 --- a/src/Ai/Raid/ObsidianSanctum/Action/RaidOsActions.cpp +++ b/src/Ai/Raid/ObsidianSanctum/Action/RaidOsActions.cpp @@ -8,9 +8,6 @@ bool SartharionTankPositionAction::Execute(Event /*event*/) Unit* boss = AI_VALUE2(Unit*, "find target", "sartharion"); if (!boss) { return false; } - // Unit* shadron = AI_VALUE2(Unit*, "find target", "shadron"); - // Unit* tenebron = AI_VALUE2(Unit*, "find target", "tenebron"); - // Unit* vesperon = AI_VALUE2(Unit*, "find target", "vesperon"); Unit* shadron = nullptr; Unit* tenebron = nullptr; Unit* vesperon = nullptr; @@ -96,9 +93,7 @@ bool AvoidTwilightFissureAction::Execute(Event /*event*/) { float currentDistance = bot->GetDistance2d(unit); if (currentDistance < radius) - { return MoveAway(unit, radius - currentDistance); - } } } return false; @@ -127,39 +122,29 @@ bool AvoidFlameTsunamiAction::Execute(Event /*event*/) { bool wavePassed = currentPos.GetPositionX() > unit->GetPositionX(); if (wavePassed) - { return false; - } if (bot->GetExactDist2d(currentPos.GetPositionX(), TSUNAMI_RIGHT_SAFE_ALL) > looseDistance) - { return MoveTo(OS_MAP_ID, currentPos.GetPositionX(), TSUNAMI_RIGHT_SAFE_ALL, currentPos.GetPositionZ(), false, false, false, false, MovementPriority::MOVEMENT_COMBAT); - } } else // LEFT WAVE { bool wavePassed = currentPos.GetPositionX() < unit->GetPositionX(); if (wavePassed) - { return false; - } if (botAI->IsMelee(bot)) { if (bot->GetExactDist2d(currentPos.GetPositionX(), TSUNAMI_LEFT_SAFE_MELEE) > looseDistance) - { return MoveTo(OS_MAP_ID, currentPos.GetPositionX(), TSUNAMI_LEFT_SAFE_MELEE, currentPos.GetPositionZ(), false, false, false, false, MovementPriority::MOVEMENT_COMBAT); - } } else // Ranged/healers { if (bot->GetExactDist2d(currentPos.GetPositionX(), TSUNAMI_LEFT_SAFE_RANGED) > looseDistance) - { return MoveTo(OS_MAP_ID, currentPos.GetPositionX(), TSUNAMI_LEFT_SAFE_RANGED, currentPos.GetPositionZ(), false, false, false, false, MovementPriority::MOVEMENT_COMBAT); - } } } } @@ -178,30 +163,18 @@ bool SartharionAttackPriorityAction::Execute(Event /*event*/) Unit* target = nullptr; if (acolyte) - { target = acolyte; - } else if (vesperon) - { target = vesperon; - } else if (tenebron) - { target = tenebron; - } else if (shadron) - { target = shadron; - } else if (sartharion) - { target = sartharion; - } if (target && AI_VALUE(Unit*, "current target") != target) - { return Attack(target); - } return false; } @@ -215,9 +188,7 @@ bool EnterTwilightPortalAction::Execute(Event /*event*/) if (!portal) { return false; } if (!portal->IsAtInteractDistance(bot)) - { return MoveTo(portal, fmaxf(portal->GetInteractionDistance() - 1.0f, 0.0f)); - } // Go through portal WorldPacket data1(CMSG_GAMEOBJ_USE); @@ -230,12 +201,11 @@ bool EnterTwilightPortalAction::Execute(Event /*event*/) bool ExitTwilightPortalAction::Execute(Event /*event*/) { GameObject* portal = bot->FindNearestGameObject(GO_NORMAL_PORTAL, 100.0f); - if (!portal) { return false; } + if (!portal) + return false; if (!portal->IsAtInteractDistance(bot)) - { return MoveTo(portal, fmaxf(portal->GetInteractionDistance() - 1.0f, 0.0f)); - } // Go through portal WorldPacket data1(CMSG_GAMEOBJ_USE); diff --git a/src/Ai/Raid/Ulduar/Action/RaidUlduarActions.cpp b/src/Ai/Raid/Ulduar/Action/RaidUlduarActions.cpp index 15db518a..798b7790 100644 --- a/src/Ai/Raid/Ulduar/Action/RaidUlduarActions.cpp +++ b/src/Ai/Raid/Ulduar/Action/RaidUlduarActions.cpp @@ -72,9 +72,7 @@ bool FlameLeviathanVehicleAction::Execute(Event /*event*/) continue; } if (!target || bot->GetExactDist(target) > bot->GetExactDist(unit)) - { target = unit; - } } // Flame Leviathan is chasing me if (flame && flame->GetVictim() == vehicleBase_) @@ -419,9 +417,7 @@ bool RazorscaleAvoidDevouringFlameAction::Execute(Event /*event*/) RazorscaleBossHelper razorscaleHelper(botAI); if (!razorscaleHelper.UpdateBossAI()) - { return false; - } bool isMainTank = botAI->IsMainTank(bot); const float flameRadius = 3.5f; @@ -433,9 +429,7 @@ bool RazorscaleAvoidDevouringFlameAction::Execute(Event /*event*/) // Get the boss Unit* boss = AI_VALUE2(Unit*, "find target", "razorscale"); if (!boss) - { return false; - } GuidVector npcs = AI_VALUE(GuidVector, "nearest hostile npcs"); Unit* closestFlame = nullptr; @@ -458,15 +452,12 @@ bool RazorscaleAvoidDevouringFlameAction::Execute(Event /*event*/) // Off tanks are following the main tank during grounded and should prioritise stacking if (razorscaleHelper.IsGroundPhase() && (botAI->IsTank(bot) && !botAI->IsMainTank(bot))) - { return false; - } // Handle movement from flames if (closestDistance < safeDistance) - { return MoveAway(closestFlame, safeDistance); - } + return false; } @@ -486,9 +477,7 @@ bool RazorscaleAvoidDevouringFlameAction::isUseful() { float distance = bot->GetDistance2d(unit); if (distance < safeDistance) - { return true; // Bot is within the danger distance - } } } @@ -522,9 +511,7 @@ bool RazorscaleAvoidSentinelAction::Execute(Event /*event*/) // Move away if ranged and too close if (isRanged && bot->GetDistance2d(unit) < radius) - { movedAway = MoveAway(unit, radius) || movedAway; - } } } @@ -547,9 +534,7 @@ bool RazorscaleAvoidSentinelAction::Execute(Event /*event*/) // If there's no skull set yet, or the skull is on a different target, set the sentinel if (!currentSkullTarget || (lowestHealthSentinel->GetGUID() != currentSkullTarget)) - { group->SetTargetIcon(skullIndex, bot->GetGUID(), lowestHealthSentinel->GetGUID()); - } } break; // Stop after finding the first valid bot tank } @@ -565,9 +550,7 @@ bool RazorscaleAvoidSentinelAction::Execute(Event /*event*/) // If there's no skull set yet, or the skull is on a different target, set the sentinel if (!currentSkullTarget || (lowestHealthSentinel->GetGUID() != currentSkullTarget)) - { group->SetTargetIcon(skullIndex, bot->GetGUID(), lowestHealthSentinel->GetGUID()); - } } } @@ -582,9 +565,7 @@ bool RazorscaleAvoidSentinelAction::isUseful() // If this bot is the main tank, it should always try to mark if (isMainTank) - { return true; - } // If the main tank is a human, check if this bot is one of the first three valid bot tanks if (mainTank && !GET_PLAYERBOT_AI(mainTank)) // Main tank is a human player @@ -592,9 +573,7 @@ bool RazorscaleAvoidSentinelAction::isUseful() for (int i = 0; i < 3; ++i) { if (botAI->IsAssistTankOfIndex(bot, i) && GET_PLAYERBOT_AI(bot)) // Bot is a valid tank - { return true; // This bot should assist with marking - } } } @@ -608,9 +587,7 @@ bool RazorscaleAvoidSentinelAction::isUseful() if (unit && unit->GetEntry() == RazorscaleBossHelper::UNIT_DARK_RUNE_SENTINEL) { if (isRanged && bot->GetDistance2d(unit) < radius) - { return true; - } } } @@ -633,9 +610,7 @@ bool RazorscaleAvoidWhirlwindAction::Execute(Event /*event*/) { float currentDistance = bot->GetDistance2d(unit); if (currentDistance < radius) - { return MoveAway(unit, radius); - } } } return false; @@ -690,23 +665,17 @@ bool RazorscaleIgnoreBossAction::isUseful() } if (!botAI->IsTank(bot)) - { return false; - } Group* group = bot->GetGroup(); if (!group) - { return false; - } // Check if the boss is already set as the moon marker int8 moonIndex = 4; // Moon marker index ObjectGuid currentMoonTarget = group->GetTargetIcon(moonIndex); if (currentMoonTarget == boss->GetGUID()) - { return false; // Moon marker is already correctly set, no further action needed - } // Proceed to tank-specific logic Unit* mainTankUnit = AI_VALUE(Unit*, "main tank"); @@ -714,9 +683,7 @@ bool RazorscaleIgnoreBossAction::isUseful() // If this bot is the main tank, it needs to set the moon marker if (mainTankUnit == bot) - { return true; - } // If the main tank is a human, check if this bot is the lowest-indexed bot tank if (mainTank && !GET_PLAYERBOT_AI(mainTank)) // Main tank is a human player @@ -724,9 +691,7 @@ bool RazorscaleIgnoreBossAction::isUseful() for (int i = 0; i < 3; ++i) // Only iterate through the first 3 indexes { if (botAI->IsAssistTankOfIndex(bot, i) && GET_PLAYERBOT_AI(bot)) // Valid bot tank - { return true; // This bot should assign the marker - } } } } @@ -1156,9 +1121,7 @@ bool IronAssemblyLightningTendrilsAction::Execute(Event /*event*/) float currentDistance = bot->GetDistance2d(boss); if (currentDistance < radius) - { return MoveAway(boss, radius - currentDistance); - } return false; } @@ -1180,9 +1143,7 @@ bool IronAssemblyOverloadAction::Execute(Event /*event*/) float currentDistance = bot->GetDistance2d(boss); if (currentDistance < radius) - { return MoveAway(boss, radius - currentDistance); - } return false; } @@ -1230,7 +1191,6 @@ bool KologarnMarkDpsTargetAction::Execute(Event /*event*/) if (!target) continue; - uint32 creatureId = target->GetEntry(); if (target->GetEntry() == NPC_RUBBLE && target->IsAlive()) { targetToMark = target; @@ -1252,21 +1212,15 @@ bool KologarnMarkDpsTargetAction::Execute(Event /*event*/) { Unit* boss = AI_VALUE2(Unit*, "find target", "kologarn"); if (boss && boss->IsAlive()) - { targetToMark = boss; - } } if (!targetToMark) - { return false; // No target to mark - } Unit* leftArm = AI_VALUE2(Unit*, "find target", "left arm"); if (leftArm && leftArm->IsAlive()) - { targetToCcMark = leftArm; - } bool isMainTank = botAI->IsMainTank(bot); Unit* mainTankUnit = AI_VALUE(Unit*, "main tank"); @@ -1284,13 +1238,10 @@ bool KologarnMarkDpsTargetAction::Execute(Event /*event*/) { group->SetTargetIcon(skullIndex, bot->GetGUID(), targetToMark->GetGUID()); if (targetToCcMark) - { group->SetTargetIcon(moonIndex, bot->GetGUID(), targetToCcMark->GetGUID()); - } + if (additionalTargetToMark) - { group->SetTargetIcon(crossIndex, bot->GetGUID(), additionalTargetToMark->GetGUID()); - } return true; } @@ -1305,13 +1256,11 @@ bool KologarnMarkDpsTargetAction::Execute(Event /*event*/) { group->SetTargetIcon(skullIndex, bot->GetGUID(), targetToMark->GetGUID()); if (targetToCcMark) - { group->SetTargetIcon(moonIndex, bot->GetGUID(), targetToCcMark->GetGUID()); - } + if (additionalTargetToMark) - { group->SetTargetIcon(crossIndex, bot->GetGUID(), additionalTargetToMark->GetGUID()); - } + return true; } } @@ -1326,13 +1275,11 @@ bool KologarnMarkDpsTargetAction::Execute(Event /*event*/) { group->SetTargetIcon(skullIndex, bot->GetGUID(), targetToMark->GetGUID()); if (targetToCcMark) - { group->SetTargetIcon(moonIndex, bot->GetGUID(), targetToCcMark->GetGUID()); - } + if (additionalTargetToMark) - { group->SetTargetIcon(crossIndex, bot->GetGUID(), additionalTargetToMark->GetGUID()); - } + return true; } break; // Stop after finding the first valid bot tank @@ -1379,17 +1326,11 @@ bool KologarnEyebeamAction::Execute(Event /*event*/) bool runToLeftSide; if (!distanceToLeftPoint) - { runToLeftSide = true; - } else if (!distanceToRightPoint) - { runToLeftSide = false; - } else - { runToLeftSide = distanceToRightPoint > distanceToLeftPoint; - } bool teleportedToPoint; KologarnEyebeamTrigger kologarnEyebeamTrigger(botAI); @@ -1418,9 +1359,7 @@ bool KologarnEyebeamAction::isUseful() { KologarnEyebeamTrigger kologarnEyebeamTrigger(botAI); if (!kologarnEyebeamTrigger.IsActive()) - { return false; - } return botAI->HasCheat(BotCheatMask::raid); } @@ -1447,9 +1386,7 @@ bool KologarnCrunchArmorAction::isUseful() { KologarnCrunchArmorTrigger kologarnCrunchArmorTrigger(botAI); if (!kologarnCrunchArmorTrigger.IsActive()) - { return false; - } return botAI->HasCheat(BotCheatMask::raid); } @@ -1482,15 +1419,11 @@ bool HodirMoveSnowpackedIcicleAction::isUseful() // Check boss and it is alive Unit* boss = AI_VALUE2(Unit*, "find target", "hodir"); if (!boss || !boss->IsAlive()) - { return false; - } // Check if boss is casting Flash Freeze if (!boss->HasUnitState(UNIT_STATE_CASTING) || !boss->FindCurrentSpellBySpellId(SPELL_FLASH_FREEZE)) - { return false; - } // Find the nearest Snowpacked Icicle Target Creature* target = bot->FindNearestCreature(NPC_SNOWPACKED_ICICLE, 100.0f); @@ -1499,9 +1432,7 @@ bool HodirMoveSnowpackedIcicleAction::isUseful() // Check that bot is stacked on Snowpacked Icicle if (bot->GetDistance2d(target->GetPositionX(), target->GetPositionY()) <= 5.0f) - { return false; - } return true; } @@ -1612,42 +1543,26 @@ bool FreyaMarkDpsTargetAction::Execute(Event /*event*/) continue; if (target->GetEntry() == NPC_EONARS_GIFT) - { eonarsGift = target; - } else if (target->GetEntry() == NPC_ANCIENT_CONSERVATOR) - { ancientConservator = target; - } else if (target->GetEntry() == NPC_SNAPLASHER) - { snaplasher = target; - } else if (target->GetEntry() == NPC_ANCIENT_WATER_SPIRIT) - { ancientWaterSpirit = target; - } else if (target->GetEntry() == NPC_STORM_LASHER) - { stormLasher = target; - } else if (target->GetEntry() == NPC_DETONATING_LASHER && !firstDetonatingLasher) - { firstDetonatingLasher = target; - } } // Check that eonars gift is need to be mark if (eonarsGift) - { targetToMark = eonarsGift; - } // Check that ancient conservator is need to be mark if (ancientConservator && !targetToMark) - { targetToMark = ancientConservator; - } // Check that trio of adds is need to be mark if ((snaplasher || ancientWaterSpirit || stormLasher) && !targetToMark) @@ -1679,14 +1594,10 @@ bool FreyaMarkDpsTargetAction::Execute(Event /*event*/) // Check that detonating lasher is need to be mark if (firstDetonatingLasher && !targetToMark) - { targetToMark = firstDetonatingLasher; - } if (!targetToMark) - { return false; // No target to mark - } bool isMainTank = botAI->IsMainTank(bot); Unit* mainTankUnit = AI_VALUE(Unit*, "main tank"); @@ -1778,9 +1689,7 @@ bool ThorimUnbalancingStrikeAction::isUseful() { ThorimUnbalancingStrikeTrigger thorimUnbalancingStrikeTrigger(botAI); if (!thorimUnbalancingStrikeTrigger.IsActive()) - { return false; - } return botAI->HasCheat(BotCheatMask::raid); } @@ -2188,23 +2097,15 @@ bool MimironShockBlastAction::Execute(Event /*event*/) continue; if (target->GetEntry() == NPC_LEVIATHAN_MKII) - { leviathanMkII = target; - } else if (target->GetEntry() == NPC_VX001) - { vx001 = target; - } else if (target->GetEntry() == NPC_AERIAL_COMMAND_UNIT) - { aerialCommandUnit = target; - } } if (!leviathanMkII) - { return false; - } if (!vx001 && !aerialCommandUnit) { @@ -2213,9 +2114,8 @@ bool MimironShockBlastAction::Execute(Event /*event*/) MoveAway(leviathanMkII, radius - currentDistance); if (botAI->IsMelee(bot)) - { botAI->SetNextCheckDelay(100); - } + return true; } else @@ -2261,15 +2161,11 @@ bool MimironP3Wx2LaserBarrageAction::Execute(Event /*event*/) { auto master = botAI->GetMaster(); if (!master || !master->IsAlive()) - { return false; - } if (bot->GetDistance2d(master) > 15.0f) - { return bot->TeleportTo(master->GetMapId(), master->GetPositionX(), master->GetPositionY(), master->GetPositionZ(), master->GetOrientation()); - } return MoveTo(master->GetMapId(), master->GetPositionX(), master->GetPositionY(), master->GetPositionZ(), false, false, false, true, MovementPriority::MOVEMENT_COMBAT, true); @@ -2294,18 +2190,14 @@ bool MimironRapidBurstAction::Execute(Event /*event*/) continue; if (target->GetEntry() == NPC_LEVIATHAN_MKII) - { leviathanMkII = target; - } } Position targetPosition; Group* group = bot->GetGroup(); if (!group) - { return false; - } uint32 memberSpotNumber = 0; for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next()) @@ -2359,28 +2251,21 @@ bool MimironRapidBurstAction::Execute(Event /*event*/) memberSpotNumber++; if (memberSpotNumber == 3) - { memberSpotNumber = 0; - } } MoveTo(bot->GetMapId(), targetPosition.GetPositionX(), targetPosition.GetPositionY(), targetPosition.GetPositionZ(), false, false, false, true, MovementPriority::MOVEMENT_FORCED, true, false); if (AI_VALUE(float, "disperse distance") != 0.0f) - { SET_AI_VALUE(float, "disperse distance", 0.0f); - } TankFaceStrategy tankFaceStrategy(botAI); if (botAI->HasStrategy(tankFaceStrategy.getName(), BotState::BOT_STATE_COMBAT)) - { botAI->ChangeStrategy(REMOVE_STRATEGY_CHAR + tankFaceStrategy.getName(), BotState::BOT_STATE_COMBAT); - } + if (botAI->HasStrategy(tankFaceStrategy.getName(), BotState::BOT_STATE_NON_COMBAT)) - { botAI->ChangeStrategy(REMOVE_STRATEGY_CHAR + tankFaceStrategy.getName(), BotState::BOT_STATE_NON_COMBAT); - } if (bot->GetDistance(targetPosition) > 1.0f) return false; @@ -2403,53 +2288,38 @@ bool MimironAerialCommandUnitAction::Execute(Event /*event*/) continue; if (target->GetEntry() == NPC_AERIAL_COMMAND_UNIT) - { boss = target; - } else if (target->GetEntry() == NPC_BOMB_BOT) - { bombBot = target; - } else if (target->GetEntry() == NPC_ASSAULT_BOT) - { assaultBot = target; - } } if (botAI->IsMainTank(bot) || botAI->IsAssistTankOfIndex(bot, 0)) { Group* group = bot->GetGroup(); if (!group) - { return false; - } if (bombBot) - { group->SetTargetIcon(RtiTargetValue::crossIndex, bot->GetGUID(), bombBot->GetGUID()); - } else if (boss) - { group->SetTargetIcon(RtiTargetValue::crossIndex, bot->GetGUID(), boss->GetGUID()); - } if (assaultBot) { ObjectGuid skullTarget = group->GetTargetIcon(RtiTargetValue::skullIndex); Unit* skullUnit = botAI->GetUnit(skullTarget); if (!skullTarget || !skullUnit || !skullUnit->IsAlive()) - { group->SetTargetIcon(RtiTargetValue::skullIndex, bot->GetGUID(), assaultBot->GetGUID()); - } } return true; } if (AI_VALUE(float, "disperse distance") != 5.0f) - { SET_AI_VALUE(float, "disperse distance", 5.0f); - } + botAI->GetAiObjectContext()->GetValue("rti")->Set("cross"); return true; } @@ -2476,10 +2346,8 @@ bool MimironRocketStrikeAction::Execute(Event /*event*/) if (target->GetEntry() == NPC_LEVIATHAN_MKII) leviathanMkII = target; - else if (target->GetEntry() == NPC_VX001) vx001 = target; - else if (target->GetEntry() == NPC_AERIAL_COMMAND_UNIT) aerialCommandUnit = target; } @@ -2536,23 +2404,15 @@ bool MimironPhase4MarkDpsAction::Execute(Event /*event*/) continue; if (target->GetEntry() == NPC_LEVIATHAN_MKII) - { leviathanMkII = target; - } else if (target->GetEntry() == NPC_VX001) - { vx001 = target; - } else if (target->GetEntry() == NPC_AERIAL_COMMAND_UNIT) - { aerialCommandUnit = target; - } } if (!leviathanMkII || !vx001 || !aerialCommandUnit) - { return false; - } if (botAI->IsMainTank(bot)) { @@ -2563,31 +2423,27 @@ bool MimironPhase4MarkDpsAction::Execute(Event /*event*/) highestHealth = leviathanMkII->GetHealth(); highestHealthUnit = leviathanMkII; } + if (vx001 && vx001->GetHealth() > highestHealth) { highestHealth = vx001->GetHealth(); highestHealthUnit = vx001; } + if (aerialCommandUnit && aerialCommandUnit->GetHealth() > highestHealth) - { highestHealthUnit = aerialCommandUnit; - } group->SetTargetIcon(RtiTargetValue::skullIndex, bot->GetGUID(), highestHealthUnit->GetGUID()); if (highestHealthUnit == leviathanMkII) { if (AI_VALUE(std::string, "rti") == "skull") - { botAI->GetAiObjectContext()->GetValue("rti")->Set("skull"); - } } else { group->SetTargetIcon(RtiTargetValue::crossIndex, bot->GetGUID(), leviathanMkII->GetGUID()); if (AI_VALUE(std::string, "rti") != "cross") - { botAI->GetAiObjectContext()->GetValue("rti")->Set("cross"); - } } botAI->DoSpecificAction("attack rti target"); @@ -2614,13 +2470,9 @@ bool MimironCheatAction::Execute(Event /*event*/) continue; if (unit->GetEntry() == NPC_PROXIMITY_MINE) - { unit->Kill(bot, unit); - } else if (unit->GetEntry() == NPC_BOMB_BOT) - { unit->Kill(bot, unit); - } } return true; @@ -2631,9 +2483,7 @@ bool VezaxCheatAction::Execute(Event /*event*/) // Restore bot's mana to full uint32 maxMana = bot->GetMaxPower(POWER_MANA); if (maxMana > 0) - { bot->SetPower(POWER_MANA, maxMana); - } return true; } @@ -2643,9 +2493,7 @@ bool VezaxShadowCrashAction::Execute(Event /*event*/) // Find General Vezax boss Unit* boss = AI_VALUE2(Unit*, "find target", "general vezax"); if (!boss || !boss->IsAlive()) - { return false; - } // Get bot's current position relative to boss float bossX = boss->GetPositionX(); @@ -2664,9 +2512,7 @@ bool VezaxShadowCrashAction::Execute(Event /*event*/) // If too close or too far, adjust distance first if (currentDistance < desiredDistance - 2.0f || currentDistance > desiredDistance + 2.0f) - { currentDistance = desiredDistance; - } // Calculate movement increment - move in increments around the boss float angleIncrement = M_PI / 10; @@ -2696,15 +2542,11 @@ bool YoggSaronOminousCloudCheatAction::Execute(Event /*event*/) Unit* boss = yoggSaronTrigger.GetSaraIfAlive(); if (!boss) - { return false; - } Creature* target = boss->FindNearestCreature(NPC_OMINOUS_CLOUD, 25.0f); if (!target || !target->IsAlive()) - { return false; - } target->Kill(bot, target); return true; @@ -2730,9 +2572,7 @@ bool YoggSaronMarkTargetAction::Execute(Event /*event*/) { Group* group = bot->GetGroup(); if (!group) - { return false; - } YoggSaronTrigger yoggSaronTrigger(botAI); if (yoggSaronTrigger.IsPhase2()) @@ -2741,9 +2581,7 @@ bool YoggSaronMarkTargetAction::Execute(Event /*event*/) { Unit* crusherTentacle = bot->FindNearestCreature(NPC_CRUSHER_TENTACLE, 200.0f, true); if (crusherTentacle) - { crusherTentacle->Kill(bot, crusherTentacle); - } } ObjectGuid currentMoonTarget = group->GetTargetIcon(RtiTargetValue::moonIndex); @@ -2761,9 +2599,7 @@ bool YoggSaronMarkTargetAction::Execute(Event /*event*/) { nextPossibleTarget = bot->FindNearestCreature(NPC_CORRUPTOR_TENTACLE, 200.0f, true); if (!nextPossibleTarget) - { return false; - } } if (currentSkullTarget) @@ -2772,9 +2608,7 @@ bool YoggSaronMarkTargetAction::Execute(Event /*event*/) if (currentSkullUnit && currentSkullUnit->IsAlive() && currentSkullUnit->GetGUID() == nextPossibleTarget->GetGUID()) - { return false; - } } group->SetTargetIcon(RtiTargetValue::skullIndex, bot->GetGUID(), nextPossibleTarget->GetGUID()); @@ -2783,15 +2617,11 @@ bool YoggSaronMarkTargetAction::Execute(Event /*event*/) { TankFaceStrategy tankFaceStrategy(botAI); if (botAI->HasStrategy(tankFaceStrategy.getName(), BotState::BOT_STATE_COMBAT)) - { botAI->ChangeStrategy(REMOVE_STRATEGY_CHAR + tankFaceStrategy.getName(), BotState::BOT_STATE_COMBAT); - } TankAssistStrategy tankAssistStrategy(botAI); if (!botAI->HasStrategy(tankAssistStrategy.getName(), BotState::BOT_STATE_COMBAT)) - { botAI->ChangeStrategy(ADD_STRATEGY_CHAR + tankAssistStrategy.getName(), BotState::BOT_STATE_COMBAT); - } GuidVector targets = AI_VALUE(GuidVector, "nearest npcs"); @@ -2801,9 +2631,7 @@ bool YoggSaronMarkTargetAction::Execute(Event /*event*/) { Unit* unit = botAI->GetUnit(guid); if (!unit || !unit->IsAlive()) - { continue; - } if ((unit->GetEntry() == NPC_IMMORTAL_GUARDIAN || unit->GetEntry() == NPC_MARKED_IMMORTAL_GUARDIAN) && unit->GetHealthPct() > 10) @@ -2821,13 +2649,9 @@ bool YoggSaronMarkTargetAction::Execute(Event /*event*/) // Added because lunatic gaze freeze all bots and they can't attack // If someone fix it then this cheat can be removed if (botAI->HasCheat(BotCheatMask::raid)) - { lowestHealthUnit->Kill(bot, lowestHealthUnit); - } else - { group->SetTargetIcon(RtiTargetValue::skullIndex, bot->GetGUID(), lowestHealthUnit->GetGUID()); - } return true; } @@ -2835,9 +2659,7 @@ bool YoggSaronMarkTargetAction::Execute(Event /*event*/) ObjectGuid currentSkullTarget = group->GetTargetIcon(RtiTargetValue::skullIndex); Unit* currentSkullUnit = nullptr; if (currentSkullTarget) - { currentSkullUnit = botAI->GetUnit(currentSkullTarget); - } if (!currentSkullUnit || currentSkullUnit->GetEntry() != NPC_YOGG_SARON) { @@ -2859,17 +2681,13 @@ bool YoggSaronBrainLinkAction::Execute(Event /*event*/) { Group* group = bot->GetGroup(); if (!group) - { return false; - } for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next()) { Player* player = gref->GetSource(); if (player && player->IsAlive() && player->HasAura(SPELL_BRAIN_LINK) && player->GetGUID() != bot->GetGUID()) - { return MoveNear(player, 10.0f, MovementPriority::MOVEMENT_FORCED); - } } return false; @@ -2879,17 +2697,13 @@ bool YoggSaronMoveToEnterPortalAction::Execute(Event /*event*/) { Group* group = bot->GetGroup(); if (!group) - { return false; - } bool isInBrainRoomTeam = false; int portalNumber = 0; int brainRoomTeamCount = 10; if (bot->GetRaidDifficulty() == Difficulty::RAID_DIFFICULTY_10MAN_NORMAL) - { brainRoomTeamCount = 4; - } Player* master = botAI->GetMaster(); if (master && !botAI->IsTank(master)) @@ -2902,9 +2716,7 @@ bool YoggSaronMoveToEnterPortalAction::Execute(Event /*event*/) { Player* member = gref->GetSource(); if (!member || !member->IsAlive() || botAI->IsTank(member) || botAI->GetMaster()->GetGUID() == member->GetGUID()) - { continue; - } portalNumber++; if (member->GetGUID() == bot->GetGUID()) @@ -2915,15 +2727,11 @@ bool YoggSaronMoveToEnterPortalAction::Execute(Event /*event*/) brainRoomTeamCount--; if (brainRoomTeamCount == 0) - { break; - } } if (!isInBrainRoomTeam) - { return false; - } Position assignedPortalPosition = yoggPortalLoc[portalNumber - 1]; @@ -2980,33 +2788,24 @@ bool YoggSaronBossRoomMovementCheatAction::Execute(Event /*event*/) { FollowMasterStrategy followMasterStrategy(botAI); if (botAI->HasStrategy(followMasterStrategy.getName(), BotState::BOT_STATE_NON_COMBAT)) - { botAI->ChangeStrategy(REMOVE_STRATEGY_CHAR + followMasterStrategy.getName(), BotState::BOT_STATE_NON_COMBAT); - } if (!botAI->HasCheat(BotCheatMask::raid)) - { return false; - } Group* group = bot->GetGroup(); if (!group) - { return false; - } + ObjectGuid currentSkullTarget = group->GetTargetIcon(RtiTargetValue::skullIndex); if (!currentSkullTarget) - { return false; - } Unit* currentSkullUnit = botAI->GetUnit(currentSkullTarget); if (!currentSkullUnit || !currentSkullUnit->IsAlive()) - { return false; - } return bot->TeleportTo(bot->GetMapId(), currentSkullUnit->GetPositionX(), currentSkullUnit->GetPositionY(), currentSkullUnit->GetPositionZ(), bot->GetOrientation()); @@ -3014,19 +2813,15 @@ bool YoggSaronBossRoomMovementCheatAction::Execute(Event /*event*/) bool YoggSaronUsePortalAction::Execute(Event /*event*/) { - Creature* assignedPortal = bot->FindNearestCreature(NPC_DESCEND_INTO_MADNESS, 2.0f, true); - if (!assignedPortal) - { - return false; - } + Creature* assignedPortal = bot->FindNearestCreature(NPC_DESCEND_INTO_MADNESS, 2.0f, true); + if (!assignedPortal) + return false; - FollowMasterStrategy followMasterStrategy(botAI); - if (botAI->HasStrategy(followMasterStrategy.getName(), BotState::BOT_STATE_NON_COMBAT)) - { - botAI->ChangeStrategy(ADD_STRATEGY_CHAR + followMasterStrategy.getName(), BotState::BOT_STATE_NON_COMBAT); - } + FollowMasterStrategy followMasterStrategy(botAI); + if (botAI->HasStrategy(followMasterStrategy.getName(), BotState::BOT_STATE_NON_COMBAT)) + botAI->ChangeStrategy(ADD_STRATEGY_CHAR + followMasterStrategy.getName(), BotState::BOT_STATE_NON_COMBAT); - return assignedPortal->HandleSpellClick(bot); + return assignedPortal->HandleSpellClick(bot); } bool YoggSaronIllusionRoomAction::Execute(Event /*event*/) @@ -3067,15 +2862,11 @@ bool YoggSaronIllusionRoomAction::SetIllusionRtiTarget(YoggSaronTrigger yoggSaro { Unit* currentRtiTarget = yoggSaronTrigger.GetIllusionRoomRtiTarget(); if (currentRtiTarget) - { return false; - } Unit* nextRtiTarget = yoggSaronTrigger.GetNextIllusionRoomRtiTarget(); if (!nextRtiTarget) - { return false; - } // If proper adds handling in illusion room will be implemented, then this can be removed if (botAI->HasCheat(BotCheatMask::raid)) @@ -3090,9 +2881,7 @@ bool YoggSaronIllusionRoomAction::SetIllusionRtiTarget(YoggSaronTrigger yoggSaro { Group* group = bot->GetGroup(); if (!group) - { return false; - } uint8 rtiIndex = RtiTargetValue::GetRtiIndex(AI_VALUE(std::string, "rti")); group->SetTargetIcon(rtiIndex, bot->GetGUID(), nextRtiTarget->GetGUID()); @@ -3104,23 +2893,17 @@ bool YoggSaronIllusionRoomAction::SetIllusionRtiTarget(YoggSaronTrigger yoggSaro bool YoggSaronIllusionRoomAction::SetBrainRtiTarget(YoggSaronTrigger yoggSaronTrigger) { if (AI_VALUE(std::string, "rti") == "square" || !yoggSaronTrigger.IsMasterIsInBrainRoom()) - { return false; - } botAI->GetAiObjectContext()->GetValue("rti")->Set("square"); Group* group = bot->GetGroup(); if (!group) - { return false; - } Creature* brain = bot->FindNearestCreature(NPC_BRAIN, 200.0f, true); if (!brain) - { return false; - } group->SetTargetIcon(RtiTargetValue::squareIndex, bot->GetGUID(), brain->GetGUID()); @@ -3160,7 +2943,6 @@ bool YoggSaronMoveToExitPortalAction::Execute(Event /*event*/) if (botAI->HasCheat(BotCheatMask::raid)) bot->TeleportTo(bot->GetMapId(), portal->GetPositionX(), portal->GetPositionY(), portal->GetPositionZ(), bot->GetOrientation()); - else MoveTo(bot->GetMapId(), portal->GetPositionX(), portal->GetPositionY(), portal->GetPositionZ(), false, false, false, true, MovementPriority::MOVEMENT_FORCED, @@ -3189,9 +2971,7 @@ bool YoggSaronLunaticGazeAction::Execute(Event /*event*/) { if (AI_VALUE(std::string, "rti") != "cross") botAI->GetAiObjectContext()->GetValue("rti")->Set("cross"); - } - return true; } diff --git a/src/Ai/Raid/Ulduar/Trigger/RaidUlduarTriggers.cpp b/src/Ai/Raid/Ulduar/Trigger/RaidUlduarTriggers.cpp index a99ea8db..7b269ac6 100644 --- a/src/Ai/Raid/Ulduar/Trigger/RaidUlduarTriggers.cpp +++ b/src/Ai/Raid/Ulduar/Trigger/RaidUlduarTriggers.cpp @@ -852,8 +852,6 @@ bool ThorimMarkDpsTargetTrigger::IsActive() Unit* runicColossus = AI_VALUE2(Unit*, "find target", "runic colossus"); Unit* ancientRuneGiant = AI_VALUE2(Unit*, "find target", "ancient rune giant"); - Unit* ironHonorGuard = AI_VALUE2(Unit*, "find target", "iron ring guard"); - Unit* ironRingGuard = AI_VALUE2(Unit*, "find target", "iron honor guard"); if (acolyte && acolyte->IsAlive() && (!currentCrossUnit || currentCrossUnit->GetEntry() != acolyte->GetEntry())) return true; @@ -1179,8 +1177,6 @@ bool MimironPhase1PositioningTrigger::IsActive() } Unit* leviathanMkII = nullptr; - Unit* vx001 = nullptr; - Unit* aerialCommandUnit = nullptr; GuidVector targets = AI_VALUE(GuidVector, "possible targets"); Unit* target = nullptr; @@ -1192,19 +1188,14 @@ bool MimironPhase1PositioningTrigger::IsActive() if (target->GetEntry() == NPC_LEVIATHAN_MKII) leviathanMkII = target; - else if (target->GetEntry() == NPC_VX001) return false; - else if (target->GetEntry() == NPC_AERIAL_COMMAND_UNIT) return false; - } if (!leviathanMkII || !leviathanMkII->IsAlive()) - { return false; - } return AI_VALUE(float, "disperse distance") != 6.0f; } @@ -1215,9 +1206,7 @@ bool MimironP3Wx2LaserBarrageTrigger::IsActive() // Check boss and it is alive if (!boss || !boss->IsAlive()) - { return false; - } bool isCasting = boss->HasUnitState(UNIT_STATE_CASTING); bool isP3WX2LaserBarrage = boss->FindCurrentSpellBySpellId(SPELL_SPINNING_UP) || @@ -1230,9 +1219,7 @@ bool MimironP3Wx2LaserBarrageTrigger::IsActive() boss->HasAura(SPELL_P3WX2_LASER_BARRAGE_AURA_1) || boss->HasAura(SPELL_P3WX2_LASER_BARRAGE_AURA_2); if ((!isCasting && !hasP3WX2LaserBarrageAura) || !isP3WX2LaserBarrage) - { return false; - } return true; } @@ -1252,51 +1239,33 @@ bool MimironRapidBurstTrigger::IsActive() continue; if (target->GetEntry() == NPC_LEVIATHAN_MKII) - { leviathanMkII = target; - } else if (target->GetEntry() == NPC_VX001) - { vx001 = target; - } else if (target->GetEntry() == NPC_AERIAL_COMMAND_UNIT) - { aerialCommandUnit = target; - } } if (!vx001 || !vx001->IsAlive()) - { return false; - } if (leviathanMkII && leviathanMkII->HasUnitState(UNIT_STATE_CASTING) && leviathanMkII->FindCurrentSpellBySpellId(SPELL_SHOCK_BLAST)) - { return false; - } if (botAI->IsMainTank(bot) && leviathanMkII && leviathanMkII->IsAlive() && leviathanMkII->GetVictim() != bot) - { return false; - } if (botAI->IsMelee(bot) && !botAI->IsMainTank(bot) && leviathanMkII && aerialCommandUnit) - { return false; - } MimironP3Wx2LaserBarrageTrigger mimironP3Wx2LaserBarrageTrigger(botAI); if (mimironP3Wx2LaserBarrageTrigger.IsActive()) - { return false; - } Group* group = bot->GetGroup(); if (!group) - { return false; - } uint32 memberSpotNumber = 0; Position memberPosition; @@ -1355,9 +1324,7 @@ bool MimironRapidBurstTrigger::IsActive() memberSpotNumber++; if (memberSpotNumber == 3) - { memberSpotNumber = 0; - } } GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs"); @@ -1390,7 +1357,6 @@ bool MimironAerialCommandUnitTrigger::IsActive() Unit* leviathanMkII = nullptr; Unit* vx001 = nullptr; Unit* aerialCommandUnit = nullptr; - //Unit* bombBot = nullptr; Unit* assaultBot = nullptr; GuidVector targets = AI_VALUE(GuidVector, "possible targets"); @@ -1402,69 +1368,41 @@ bool MimironAerialCommandUnitTrigger::IsActive() continue; if (target->GetEntry() == NPC_LEVIATHAN_MKII) - { leviathanMkII = target; - } else if (target->GetEntry() == NPC_VX001) - { vx001 = target; - } else if (target->GetEntry() == NPC_AERIAL_COMMAND_UNIT) - { aerialCommandUnit = target; - } - //else if (target->GetEntry() == NPC_BOMB_BOT) - //{ - // bombBot = target; - //} else if (target->GetEntry() == NPC_ASSAULT_BOT) - { assaultBot = target; - } } if (!aerialCommandUnit || !aerialCommandUnit->IsAlive() || leviathanMkII || vx001) - { return false; - } if (!botAI->IsRanged(bot) && !botAI->IsMainTank(bot) && !botAI->IsAssistTankOfIndex(bot, 0)) - { return false; - } if (botAI->IsMainTank(bot) || botAI->IsAssistTankOfIndex(bot, 0)) { Group* group = bot->GetGroup(); if (!group) - { return false; - } ObjectGuid skullTarget = group->GetTargetIcon(RtiTargetValue::skullIndex); ObjectGuid crossTarget = group->GetTargetIcon(RtiTargetValue::crossIndex); - //if (bombBot && bombBot->GetGUID() != crossTarget) - //{ - // return true; - //} if (!crossTarget || aerialCommandUnit->GetGUID() != crossTarget) - { return true; - } else if (assaultBot && (!skullTarget || assaultBot->GetGUID() != skullTarget)) - { return true; - } return false; } std::string rtiMark = AI_VALUE(std::string, "rti"); if (rtiMark != "cross") - { return true; - } return false; } @@ -1475,16 +1413,12 @@ bool MimironRocketStrikeTrigger::IsActive() // Check boss and it is alive if (!boss || !boss->IsAlive()) - { return false; - } Creature* rocketStrikeN = bot->FindNearestCreature(NPC_ROCKET_STRIKE_N, 100.0f); if (!rocketStrikeN) - { return false; - } return bot->GetDistance2d(rocketStrikeN->GetPositionX(), rocketStrikeN->GetPositionY()) <= 10.0f; } @@ -1497,9 +1431,7 @@ bool MimironPhase4MarkDpsTrigger::IsActive() Group* group = bot->GetGroup(); if (!group) - { return false; - } GuidVector targets = AI_VALUE(GuidVector, "possible targets"); Unit* target = nullptr; @@ -1510,23 +1442,15 @@ bool MimironPhase4MarkDpsTrigger::IsActive() continue; if (target->GetEntry() == NPC_LEVIATHAN_MKII) - { leviathanMkII = target; - } else if (target->GetEntry() == NPC_VX001) - { vx001 = target; - } else if (target->GetEntry() == NPC_AERIAL_COMMAND_UNIT) - { aerialCommandUnit = target; - } } if (!leviathanMkII || !vx001 || !aerialCommandUnit) - { return false; - } if (botAI->IsMainTank(bot)) { @@ -1544,22 +1468,16 @@ bool MimironPhase4MarkDpsTrigger::IsActive() highestHealthUnit = vx001; } if (aerialCommandUnit && aerialCommandUnit->GetHealth() > highestHealth) - { highestHealthUnit = aerialCommandUnit; - } ObjectGuid skullTarget = group->GetTargetIcon(RtiTargetValue::skullIndex); if (!skullTarget) - { return true; - } return highestHealthUnit->GetGUID() != skullTarget; } else - { return AI_VALUE(std::string, "rti") != "skull"; - } return false; } @@ -1567,14 +1485,10 @@ bool MimironPhase4MarkDpsTrigger::IsActive() bool MimironCheatTrigger::IsActive() { if (!botAI->HasCheat(BotCheatMask::raid)) - { return false; - } if (!botAI->IsMainTank(bot)) - { return false; - } GuidVector targets = AI_VALUE(GuidVector, "nearest npcs"); for (const ObjectGuid& guid : targets) @@ -1584,13 +1498,9 @@ bool MimironCheatTrigger::IsActive() continue; if (unit->GetEntry() == NPC_PROXIMITY_MINE) - { return true; - } else if (unit->GetEntry() == NPC_BOMB_BOT) - { return true; - } } return false; @@ -1599,22 +1509,16 @@ bool MimironCheatTrigger::IsActive() bool VezaxCheatTrigger::IsActive() { if (!botAI->HasCheat(BotCheatMask::raid)) - { return false; - } Unit* boss = AI_VALUE2(Unit*, "find target", "general vezax"); // Check boss and it is alive if (!boss || !boss->IsAlive()) - { return false; - } if (!AI_VALUE2(bool, "has mana", "self target")) - { return false; - } return AI_VALUE2(uint8, "mana", "self target") < sPlayerbotAIConfig.lowMana; } @@ -1625,9 +1529,7 @@ bool VezaxShadowCrashTrigger::IsActive() // Check boss and it is alive if (!boss || !boss->IsAlive()) - { return false; - } return botAI->HasAura(SPELL_VEZAX_SHADOW_CRASH, bot); } @@ -1638,14 +1540,10 @@ bool VezaxMarkOfTheFacelessTrigger::IsActive() // Check boss and it is alive if (!boss || !boss->IsAlive()) - { return false; - } if (!botAI->HasAura(SPELL_MARK_OF_THE_FACELESS, bot)) - { return false; - } float distance = bot->GetDistance2d(ULDUAR_VEZAX_MARK_OF_THE_FACELESS_SPOT.GetPositionX(), ULDUAR_VEZAX_MARK_OF_THE_FACELESS_SPOT.GetPositionY()); @@ -1657,9 +1555,8 @@ Unit* YoggSaronTrigger::GetSaraIfAlive() { Unit* sara = AI_VALUE2(Unit*, "find target", "sara"); if (!sara || !sara->IsAlive()) - { return nullptr; - } + return sara; } @@ -1689,9 +1586,7 @@ bool YoggSaronTrigger::IsYoggSaronFight() Unit* yoggsaron = AI_VALUE2(Unit*, "find target", "yogg-saron"); if ((sara && sara->IsAlive()) || (yoggsaron && yoggsaron->IsAlive())) - { return true; - } return false; } @@ -1699,24 +1594,16 @@ bool YoggSaronTrigger::IsYoggSaronFight() bool YoggSaronTrigger::IsInIllusionRoom() { if (!IsInBrainLevel()) - { return false; - } if (IsInStormwindKeeperIllusion()) - { return true; - } if (IsInIcecrownKeeperIllusion()) - { return true; - } if (IsInChamberOfTheAspectsIllusion()) - { return true; - } return false; } @@ -1753,9 +1640,7 @@ bool YoggSaronTrigger::IsMasterIsInBrainRoom() Player* master = botAI->GetMaster(); if (!master) - { return false; - } return master->GetDistance2d(ULDUAR_YOGG_SARON_BRAIN_ROOM_MIDDLE.GetPositionX(), ULDUAR_YOGG_SARON_BRAIN_ROOM_MIDDLE.GetPositionY()) < @@ -1766,43 +1651,29 @@ bool YoggSaronTrigger::IsMasterIsInBrainRoom() Position YoggSaronTrigger::GetIllusionRoomEntrancePosition() { if (IsInChamberOfTheAspectsIllusion()) - { return ULDUAR_YOGG_SARON_CHAMBER_OF_ASPECTS_ENTRANCE; - } else if (IsInIcecrownKeeperIllusion()) - { return ULDUAR_YOGG_SARON_ICECROWN_CITADEL_ENTRANCE; - } else if (IsInStormwindKeeperIllusion()) - { return ULDUAR_YOGG_SARON_STORMWIND_KEEPER_ENTRANCE; - } else - { return Position(); - } } Unit* YoggSaronTrigger::GetIllusionRoomRtiTarget() { Group* group = bot->GetGroup(); if (!group) - { return nullptr; - } int32_t rtiIndex = RtiTargetValue::GetRtiIndex(AI_VALUE(std::string, "rti")); if (rtiIndex == -1) - { return nullptr; // Invalid RTI mark - } ObjectGuid currentRtiTarget = group->GetTargetIcon(rtiIndex); Unit* currentRtiTargetUnit = botAI->GetUnit(currentRtiTarget); if (!currentRtiTargetUnit || !currentRtiTargetUnit->IsAlive()) - { currentRtiTargetUnit = nullptr; - } return currentRtiTargetUnit; } @@ -1812,13 +1683,10 @@ Unit* YoggSaronTrigger::GetNextIllusionRoomRtiTarget() float detectionRadius = 0.0f; if (IsInStormwindKeeperIllusion()) detectionRadius = ULDUAR_YOGG_SARON_STORMWIND_KEEPER_RADIUS; - else if (IsInIcecrownKeeperIllusion()) detectionRadius = ULDUAR_YOGG_SARON_ICECROWN_CITADEL_RADIUS; - else if (IsInChamberOfTheAspectsIllusion()) detectionRadius = ULDUAR_YOGG_SARON_CHAMBER_OF_ASPECTS_RADIUS; - else return nullptr; @@ -1855,9 +1723,7 @@ Unit* YoggSaronTrigger::GetNextIllusionRoomRtiTarget() } if (nextIllusionRoomRtiTarget) - { return nextIllusionRoomRtiTarget; - } if (IsInStormwindKeeperIllusion()) { @@ -1969,9 +1835,7 @@ bool YoggSaronMarkTargetTrigger::IsActive() ObjectGuid currentMoonTarget = group->GetTargetIcon(RtiTargetValue::moonIndex); Creature* yogg_saron = bot->FindNearestCreature(NPC_YOGG_SARON, 200.0f, true); if (!currentMoonTarget || currentMoonTarget != yogg_saron->GetGUID()) - { return true; - } ObjectGuid currentSkullTarget = group->GetTargetIcon(RtiTargetValue::skullIndex); @@ -2234,9 +2098,7 @@ bool YoggSaronPhase3PositioningTrigger::IsActive() if (botAI->IsRanged(bot) && bot->GetDistance2d(ULDUAR_YOGG_SARON_PHASE_3_RANGED_SPOT.GetPositionX(), ULDUAR_YOGG_SARON_PHASE_3_RANGED_SPOT.GetPositionY()) > 15.0f) - { return true; - } if (botAI->IsMelee(bot) && !botAI->IsTank(bot) && bot->GetDistance2d(ULDUAR_YOGG_SARON_PHASE_3_MELEE_SPOT.GetPositionX(), diff --git a/src/Ai/World/Rpg/Action/NewRpgAction.cpp b/src/Ai/World/Rpg/Action/NewRpgAction.cpp index 6ccb8454..6820c646 100644 --- a/src/Ai/World/Rpg/Action/NewRpgAction.cpp +++ b/src/Ai/World/Rpg/Action/NewRpgAction.cpp @@ -435,7 +435,6 @@ bool NewRpgTravelFlightAction::Execute(Event /*event*/) botAI->rpgInfo.ChangeToIdle(); return true; } - const TaxiNodesEntry* entry = sTaxiNodesStore.LookupEntry(data.toNode); if (bot->GetDistance(flightMaster) > INTERACTION_DISTANCE) return MoveFarTo(flightMaster); diff --git a/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp b/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp index 06645cd5..75392418 100644 --- a/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp +++ b/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp @@ -360,7 +360,6 @@ bool NewRpgBaseAction::IsWithinInteractionDist(Object* questGiver) case TYPEID_GAMEOBJECT: { ObjectGuid guid = questGiver->GetGUID(); - GameobjectTypes type = GAMEOBJECT_TYPE_QUESTGIVER; if (GameObject* go = bot->GetMap()->GetGameObject(guid)) { if (go->IsWithinDistInMap(bot)) @@ -546,7 +545,9 @@ bool NewRpgBaseAction::OrganizeQuestLog() continue; const Quest* quest = sObjectMgr->GetQuestTemplate(questId); - if (quest->GetZoneOrSort() < 0 || (quest->GetZoneOrSort() > 0 && quest->GetZoneOrSort() != bot->GetZoneId())) + const int64_t botZoneId = this->bot->GetZoneId(); + + if (quest->GetZoneOrSort() < 0 || (quest->GetZoneOrSort() > 0 && quest->GetZoneOrSort() != botZoneId)) { LOG_DEBUG("playerbots", "[New RPG] {} drop quest {}", bot->GetName(), questId); WorldPacket packet(CMSG_QUESTLOG_REMOVE_QUEST); diff --git a/src/Ai/World/Rpg/NewRpgInfo.cpp b/src/Ai/World/Rpg/NewRpgInfo.cpp index def0d472..20db8b04 100644 --- a/src/Ai/World/Rpg/NewRpgInfo.cpp +++ b/src/Ai/World/Rpg/NewRpgInfo.cpp @@ -60,7 +60,10 @@ void NewRpgInfo::ChangeToIdle() data = Idle{}; } -bool NewRpgInfo::CanChangeTo(NewRpgStatus status) { return true; } +bool NewRpgInfo::CanChangeTo(NewRpgStatus) +{ + return true; +} void NewRpgInfo::Reset() { diff --git a/src/Bot/Factory/PlayerbotFactory.cpp b/src/Bot/Factory/PlayerbotFactory.cpp index 279f749b..9e1b30a7 100644 --- a/src/Bot/Factory/PlayerbotFactory.cpp +++ b/src/Bot/Factory/PlayerbotFactory.cpp @@ -948,8 +948,6 @@ void PlayerbotFactory::InitPet() continue; if (co->Name.size() > 21) continue; - uint32 guid = map->GenerateLowGuid(); - uint32 pet_number = sObjectMgr->GeneratePetNumber(); if (bot->GetPetStable() && bot->GetPetStable()->CurrentPet) { auto petGuid = bot->GetPetStable()->CurrentPet.value(); // To correct the build warnin in VS @@ -1905,7 +1903,7 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance) if (oldItem) continue; - Item* newItem = bot->EquipNewItem(dest, bestItemForSlot, true); + bot->EquipNewItem(dest, bestItemForSlot, true); bot->AutoUnequipOffhandIfNeed(); // if (newItem) // { @@ -1936,7 +1934,7 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance) (slot != EQUIPMENT_SLOT_RANGED)) continue; - if (Item* oldItem = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) + if (bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot) != nullptr) bot->DestroyItem(INVENTORY_SLOT_BAG_0, slot, true); std::vector& ids = items[slot]; @@ -1973,12 +1971,9 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance) continue; Item* newItem = bot->EquipNewItem(dest, bestItemForSlot, true); + + bot->EquipNewItem(dest, bestItemForSlot, true); bot->AutoUnequipOffhandIfNeed(); - // if (newItem) - // { - // newItem->AddToWorld(); - // newItem->AddToUpdateQueueOf(bot); - // } } } } @@ -1991,16 +1986,10 @@ bool PlayerbotFactory::IsDesiredReplacement(Item* item) ItemTemplate const* proto = item->GetTemplate(); uint32 requiredLevel = proto->RequiredLevel; if (!requiredLevel) - { return true; - } - // if (!requiredLevel) - // { - // requiredLevel = sRandomItemMgr.GetMinLevelFromCache(proto->ItemId); - // } uint32 delta = 1 + (80 - bot->GetLevel()) / 10; - return proto->Quality < ITEM_QUALITY_RARE || int32(bot->GetLevel() - requiredLevel) > delta; + return proto->Quality < ITEM_QUALITY_RARE || (bot->GetLevel() - requiredLevel) > delta; } inline Item* StoreNewItemInInventorySlot(Player* player, uint32 newItemId, uint32 count) @@ -2010,9 +1999,7 @@ inline Item* StoreNewItemInInventorySlot(Player* player, uint32 newItemId, uint3 if (msg == EQUIP_ERR_OK) { if (Item* newItem = player->StoreNewItem(vDest, newItemId, true, Item::GenerateItemRandomPropertyId(newItemId))) - { return newItem; - } } return nullptr; @@ -2875,7 +2862,6 @@ void PlayerbotFactory::AddPrevQuests(uint32 questId, std::list& questIds void PlayerbotFactory::InitQuests(std::list& questMap, bool withRewardItem) { - uint32 count = 0; for (std::list::iterator i = questMap.begin(); i != questMap.end(); ++i) { uint32 questId = *i; @@ -3280,7 +3266,6 @@ void PlayerbotFactory::InitFood() void PlayerbotFactory::InitReagents() { - int specTab = AiFactory::GetPlayerSpecTab(bot); std::vector> items; switch (bot->getClass()) { @@ -4336,15 +4321,11 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destroyOld) continue; if (!item->IsFitToSpellRequirements(spellInfo)) - { continue; - } uint32 requiredLevel = spellInfo->BaseLevel; if (requiredLevel > bot->GetLevel()) - { continue; - } // disable next expansion enchantments if (sPlayerbotAIConfig.limitEnchantExpansion && bot->GetLevel() <= 60 && enchantSpell >= 27899) @@ -4364,9 +4345,8 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destroyOld) SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!enchant || (enchant->slot != PERM_ENCHANTMENT_SLOT && enchant->slot != TEMP_ENCHANTMENT_SLOT)) - { continue; - } + if (enchant->requiredSkill && (!bot->HasSkill(enchant->requiredSkill) || (bot->GetSkillValue(enchant->requiredSkill) < enchant->requiredSkillValue))) @@ -4374,9 +4354,8 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destroyOld) continue; } if (enchant->requiredLevel > bot->GetLevel()) - { continue; - } + float score = calculator.CalculateEnchant(enchant_id); if (score >= bestScore) { @@ -4399,11 +4378,9 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destroyOld) { uint8 socketColor = item->GetTemplate()->Socket[enchant_slot - SOCK_ENCHANTMENT_SLOT].Color; if (!socketColor) - { continue; - } + int32 enchantIdChosen = -1; - int32 colorChosen; bool jewelersGemChosen; float bestGemScore = -1; for (uint32& enchantGem : availableGems) @@ -4448,7 +4425,6 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destroyOld) if (score > bestGemScore) { enchantIdChosen = enchant_id; - colorChosen = gemProperties->color; bestGemScore = score; jewelersGemChosen = isJewelersGem; } diff --git a/src/Bot/PlayerbotMgr.cpp b/src/Bot/PlayerbotMgr.cpp index 03ee1a8f..ba0e3643 100644 --- a/src/Bot/PlayerbotMgr.cpp +++ b/src/Bot/PlayerbotMgr.cpp @@ -71,7 +71,6 @@ class PlayerbotLoginQueryHolder : public LoginQueryHolder { private: uint32 masterAccountId; - PlayerbotHolder* playerbotHolder; public: PlayerbotLoginQueryHolder(uint32 masterAccount, uint32 accountId, ObjectGuid guid) : LoginQueryHolder(accountId, guid), masterAccountId(masterAccount) diff --git a/src/Bot/RandomPlayerbotMgr.cpp b/src/Bot/RandomPlayerbotMgr.cpp index 412c27a9..62f3c7c6 100644 --- a/src/Bot/RandomPlayerbotMgr.cpp +++ b/src/Bot/RandomPlayerbotMgr.cpp @@ -994,7 +994,7 @@ void RandomPlayerbotMgr::CheckBgQueue() // Arena logic bool isRated = false; - if (uint8 arenaType = BattlegroundMgr::BGArenaType(queueTypeId)) + if (BattlegroundMgr::BGArenaType(queueTypeId)) { BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(queueTypeId); GroupQueueInfo ginfo; @@ -1081,7 +1081,7 @@ void RandomPlayerbotMgr::CheckBgQueue() BattlegroundData[queueTypeId][bracketId].minLevel = pvpDiff->minLevel; BattlegroundData[queueTypeId][bracketId].maxLevel = pvpDiff->maxLevel; - if (uint8 arenaType = BattlegroundMgr::BGArenaType(queueTypeId)) + if (BattlegroundMgr::BGArenaType(queueTypeId)) { bool isRated = false; BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(queueTypeId); @@ -1986,13 +1986,9 @@ void RandomPlayerbotMgr::PrepareTeleportCache() for (int i = bracket.low; i <= bracket.high; i++) { if (forHorde) - { hordeStarterPerLevelCache[i].push_back(loc); - } if (forAlliance) - { allianceStarterPerLevelCache[i].push_back(loc); - } } } while (results->NextRow()); @@ -3146,10 +3142,10 @@ void RandomPlayerbotMgr::PrintStats() uint32 heal = 0; uint32 tank = 0; uint32 active = 0; - uint32 update = 0; +/* uint32 update = 0; uint32 randomize = 0; uint32 teleport = 0; - uint32 changeStrategy = 0; + uint32 changeStrategy = 0;*/ uint32 dead = 0; uint32 combat = 0; // uint32 revive = 0; //not used, line marked for removal. @@ -3189,7 +3185,7 @@ void RandomPlayerbotMgr::PrintStats() if (botAI->AllowActivity()) ++active; - + /* TODO: Review statistics on rpg merge if (botAI->GetAiObjectContext()->GetValue("random bot update")->Get()) ++update; @@ -3202,7 +3198,7 @@ void RandomPlayerbotMgr::PrintStats() if (!GetEventValue(botId, "change_strategy")) ++changeStrategy; - + */ if (bot->isDead()) { ++dead; diff --git a/src/Mgr/Item/RandomItemMgr.cpp b/src/Mgr/Item/RandomItemMgr.cpp index 71fbb9f7..d2e7c866 100644 --- a/src/Mgr/Item/RandomItemMgr.cpp +++ b/src/Mgr/Item/RandomItemMgr.cpp @@ -1832,7 +1832,6 @@ std::vector RandomItemMgr::GetUpgradeList(Player* player, std::string sp // get old item statWeight uint32 oldStatWeight = 0; uint32 specId = 0; - uint32 closestUpgrade = 0; uint32 closestUpgradeWeight = 0; std::vector classspecs; @@ -1933,7 +1932,6 @@ std::vector RandomItemMgr::GetUpgradeList(Player* player, std::string sp // pick closest upgrade if (info.weights[specId] > closestUpgradeWeight) { - closestUpgrade = info.itemId; closestUpgradeWeight = info.weights[specId]; } }