From 68eed8dd59d189994e6005a12fec3df55ced3f8d Mon Sep 17 00:00:00 2001 From: Keleborn <22352763+Celandriel@users.noreply.github.com> Date: Mon, 2 Feb 2026 16:03:49 -0800 Subject: [PATCH 1/2] clean unused variables --- .../Base/Actions/BattleGroundJoinAction.cpp | 10 - src/Ai/Base/Actions/BattleGroundTactics.cpp | 2 - src/Ai/Base/Actions/ChatShortcutActions.cpp | 5 +- src/Ai/Base/Actions/ChooseRpgTargetAction.cpp | 2 - .../Base/Actions/ChooseTravelTargetAction.cpp | 13 - src/Ai/Base/Actions/DebugAction.cpp | 2 +- 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 | 28 +- 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 | 4 - 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 | 3 +- src/Ai/Base/Value/PartyMemberToDispel.cpp | 1 + .../Base/Value/PartyMemberWithoutAuraValue.h | 4 +- src/Ai/Base/Value/PossibleRpgTargetsValue.cpp | 7 +- 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 | 47 +-- .../Multiplier/RaidIccMultipliers.cpp | 2 - .../Raid/Icecrown/Trigger/RaidIccTriggers.cpp | 1 - .../Karazhan/Action/RaidKarazhanActions.cpp | 1 - .../Multiplier/RaidMagtheridonMultipliers.cpp | 1 - .../ObsidianSanctum/Action/RaidOsActions.cpp | 3 - .../Raid/Ulduar/Action/RaidUlduarActions.cpp | 133 +------- .../Ulduar/Trigger/RaidUlduarTriggers.cpp | 290 ++---------------- src/Ai/World/Rpg/Action/NewRpgAction.cpp | 3 - src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp | 5 +- src/Ai/World/Rpg/NewRpgInfo.cpp | 5 +- src/Bot/Factory/AiFactory.h | 1 - src/Bot/Factory/PlayerbotFactory.cpp | 57 +--- src/Bot/PlayerbotMgr.cpp | 1 - src/Bot/RandomPlayerbotMgr.cpp | 16 +- src/Mgr/Item/RandomItemMgr.cpp | 2 - 69 files changed, 127 insertions(+), 696 deletions(-) diff --git a/src/Ai/Base/Actions/BattleGroundJoinAction.cpp b/src/Ai/Base/Actions/BattleGroundJoinAction.cpp index 418b0f1fa72..ab2605b0558 100644 --- a/src/Ai/Base/Actions/BattleGroundJoinAction.cpp +++ b/src/Ai/Base/Actions/BattleGroundJoinAction.cpp @@ -25,8 +25,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); @@ -38,12 +36,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; @@ -409,8 +403,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 @@ -487,8 +479,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 2b198022e03..a80030ac07f 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 85b141d4d14..29cc5ead360 100644 --- a/src/Ai/Base/Actions/ChatShortcutActions.cpp +++ b/src/Ai/Base/Actions/ChatShortcutActions.cpp @@ -68,9 +68,8 @@ 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 +82,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 7d83c2b2bcb..6bf176cf91b 100644 --- a/src/Ai/Base/Actions/ChooseRpgTargetAction.cpp +++ b/src/Ai/Base/Actions/ChooseRpgTargetAction.cpp @@ -114,7 +114,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()) @@ -126,7 +125,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 0f75a307983..c9220b12565 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 578ece17c41..f4ac16d2712 100644 --- a/src/Ai/Base/Actions/DebugAction.cpp +++ b/src/Ai/Base/Actions/DebugAction.cpp @@ -516,7 +516,7 @@ bool DebugAction::Execute(Event event) botPos.setY(botPos.getY() + (dy - 5) * 5); botPos.setZ(botPos.getHeight()); - Creature* wpCreature = bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0, + bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f); } } diff --git a/src/Ai/Base/Actions/EquipAction.cpp b/src/Ai/Base/Actions/EquipAction.cpp index 32508ef2e52..2f696d7c1b0 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 0fc09c3bce2..77ed10a8a0e 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 350b465b83a..478e6000130 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 c9f9e689eba..f7e5ad285c7 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 14f943f76c7..5f9eece2823 100644 --- a/src/Ai/Base/Actions/InviteToGroupAction.cpp +++ b/src/Ai/Base/Actions/InviteToGroupAction.cpp @@ -168,8 +168,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 e600f1f2041..7143d0a1384 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) @@ -186,7 +185,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 68f8089c2ec..b5f328b0412 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 4ee2fee6d7e..6fd07e1e94f 100644 --- a/src/Ai/Base/Actions/MailAction.cpp +++ b/src/Ai/Base/Actions/MailAction.cpp @@ -134,7 +134,7 @@ class TakeMailProcessor : public MailProcessor 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 c595dff6e43..2b9d1d97f26 100644 --- a/src/Ai/Base/Actions/MovementActions.cpp +++ b/src/Ai/Base/Actions/MovementActions.cpp @@ -100,9 +100,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); @@ -120,7 +117,6 @@ bool MovementAction::MoveNear(WorldObject* target, float distance, MovementPrior return true; } - // botAI->TellError("All paths not in LOS"); return false; } @@ -129,9 +125,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(); @@ -264,7 +257,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) @@ -779,8 +771,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); @@ -812,10 +802,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(); @@ -1417,7 +1403,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; @@ -1438,8 +1423,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); @@ -2782,9 +2765,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; @@ -2906,14 +2887,11 @@ 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; - } + std::vector debuffedPlayers; diff --git a/src/Ai/Base/Actions/MovementActions.h b/src/Ai/Base/Actions/MovementActions.h index 7db911baa42..377e8360a3d 100644 --- a/src/Ai/Base/Actions/MovementActions.h +++ b/src/Ai/Base/Actions/MovementActions.h @@ -332,7 +332,6 @@ class MoveAwayFromPlayerWithDebuffAction : public MovementAction 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 f9334e31941..6828b4420d9 100644 --- a/src/Ai/Base/Actions/PetsAction.h +++ b/src/Ai/Base/Actions/PetsAction.h @@ -22,7 +22,6 @@ class PetsAction : public Action 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 5f5d63e08c4..a95cda972eb 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 dfe7bb9f1eb..981ce929efd 100644 --- a/src/Ai/Base/Actions/QuestAction.cpp +++ b/src/Ai/Base/Actions/QuestAction.cpp @@ -350,7 +350,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) { @@ -405,8 +404,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]; @@ -446,8 +443,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 af5a5403701..4dd6b57ec03 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 050d7ddbbaa..009d9e31765 100644 --- a/src/Ai/Base/Actions/SayAction.cpp +++ b/src/Ai/Base/Actions/SayAction.cpp @@ -159,7 +159,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 ede59440e34..549952bee45 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 f062ce5c236..fb9fc465aad 100644 --- a/src/Ai/Base/Actions/SetCraftAction.cpp +++ b/src/Ai/Base/Actions/SetCraftAction.cpp @@ -68,7 +68,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 44f3c7b49f2..8e416830ef3 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 a9fe32c9733..a778d33fb8b 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) { - 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 dbc7abd0907..7b13edd906e 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 9012443beb2..fd22b8ff144 100644 --- a/src/Ai/Base/Actions/SuggestWhatToDoAction.cpp +++ b/src/Ai/Base/Actions/SuggestWhatToDoAction.cpp @@ -69,7 +69,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; @@ -227,7 +226,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 8fd120d6058..35e8584b82e 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 5b3eda1034a..e91ffa50c01 100644 --- a/src/Ai/Base/Actions/TameAction.cpp +++ b/src/Ai/Base/Actions/TameAction.cpp @@ -53,7 +53,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 13852bdc0ac..7f31d853974 100644 --- a/src/Ai/Base/Actions/TellLosAction.cpp +++ b/src/Ai/Base/Actions/TellLosAction.cpp @@ -97,7 +97,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 3057fff0977..de2e7820fb8 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 f0afef01bf5..97da7f0c83c 100644 --- a/src/Ai/Base/Actions/TravelAction.cpp +++ b/src/Ai/Base/Actions/TravelAction.cpp @@ -132,8 +132,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 473816e3ece..b403483c18b 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 8f83b6e489f..1cc325038fb 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) { std::ostringstream out; diff --git a/src/Ai/Base/Actions/WipeAction.cpp b/src/Ai/Base/Actions/WipeAction.cpp index bbd1997d6c2..f9fd44925d2 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 94653aeabfb..0ac35ab1b2e 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 2acc2aec85e..9e71a6e5630 100644 --- a/src/Ai/Base/Trigger/RangeTriggers.cpp +++ b/src/Ai/Base/Trigger/RangeTriggers.cpp @@ -11,10 +11,6 @@ #include "ServerFacade.h" #include "SharedDefines.h" -static float GetSpeedInMotion(Unit* target) -{ - return target->GetSpeed(Movement::SelectSpeedType(target->GetUnitMovementFlags())); -} bool EnemyTooCloseForSpellTrigger::IsActive() { diff --git a/src/Ai/Base/Value/Arrow.cpp b/src/Ai/Base/Value/Arrow.cpp index 5fd710220c5..c860b7ec016 100644 --- a/src/Ai/Base/Value/Arrow.cpp +++ b/src/Ai/Base/Value/Arrow.cpp @@ -143,8 +143,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); } @@ -159,17 +157,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 ce021a2d9a3..5db278107ec 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 6f48fa97395..4aaa723d2cd 100644 --- a/src/Ai/Base/Value/ItemUsageValue.cpp +++ b/src/Ai/Base/Value/ItemUsageValue.cpp @@ -79,8 +79,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 8b9f1a55fce..27a102b1254 100644 --- a/src/Ai/Base/Value/LeastHpTargetValue.cpp +++ b/src/Ai/Base/Value/LeastHpTargetValue.cpp @@ -6,7 +6,6 @@ #include "LeastHpTargetValue.h" #include "AttackersValue.h" -#include "Playerbots.h" class FindLeastHpTargetStrategy : public FindNonCcTargetStrategy { @@ -15,7 +14,6 @@ class FindLeastHpTargetStrategy : public FindNonCcTargetStrategy void CheckAttacker(Unit* attacker, ThreatMgr* threatMgr) override { - Player* bot = botAI->GetBot(); if (IsCcTarget(attacker)) return; @@ -30,5 +28,6 @@ class FindLeastHpTargetStrategy : public FindNonCcTargetStrategy Unit* LeastHpTargetValue::Calculate() { FindLeastHpTargetStrategy strategy(botAI); + return FindTarget(&strategy); } diff --git a/src/Ai/Base/Value/PartyMemberToDispel.cpp b/src/Ai/Base/Value/PartyMemberToDispel.cpp index 91b1955b27b..d2200fb746a 100644 --- a/src/Ai/Base/Value/PartyMemberToDispel.cpp +++ b/src/Ai/Base/Value/PartyMemberToDispel.cpp @@ -7,6 +7,7 @@ #include "Playerbots.h" + class PartyMemberToDispelPredicate : public FindPlayerPredicate, public PlayerbotAIAware { public: diff --git a/src/Ai/Base/Value/PartyMemberWithoutAuraValue.h b/src/Ai/Base/Value/PartyMemberWithoutAuraValue.h index 4ba9558ffe0..6d95a313137 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 f2b6aef105d..a588ce272cc 100644 --- a/src/Ai/Base/Value/PossibleRpgTargetsValue.cpp +++ b/src/Ai/Base/Value/PossibleRpgTargetsValue.cpp @@ -13,6 +13,7 @@ #include "ServerFacade.h" #include "SharedDefines.h" #include "NearestGameObjects.h" +#include "TravelMgr.h" std::vector PossibleRpgTargetsValue::allowedNpcFlags; @@ -73,8 +74,10 @@ bool PossibleRpgTargetsValue::AcceptUnit(Unit* unit) } TravelTarget* travelTarget = context->GetValue("travel target")->Get(); - if (travelTarget && travelTarget->getDestination() && - travelTarget->getDestination()->getEntry() == unit->GetEntry()) + + + if (travelTarget != nullptr && travelTarget->getDestination() && + (uint32_t)travelTarget->getDestination()->getEntry() == unit->GetEntry()) return true; if (urand(1, 100) < 25 && unit->IsFriendlyTo(bot)) diff --git a/src/Ai/Base/Value/SnareTargetValue.cpp b/src/Ai/Base/Value/SnareTargetValue.cpp index 7965198aa4d..0562883ffc8 100644 --- a/src/Ai/Base/Value/SnareTargetValue.cpp +++ b/src/Ai/Base/Value/SnareTargetValue.cpp @@ -13,7 +13,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 615f39f019a..92ae37b9c08 100644 --- a/src/Ai/Base/Value/StatsValues.cpp +++ b/src/Ai/Base/Value/StatsValues.cpp @@ -204,7 +204,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); @@ -214,7 +213,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 190ecb264a8..e780c3d26a4 100644 --- a/src/Ai/Class/Paladin/Action/PaladinActions.cpp +++ b/src/Ai/Class/Paladin/Action/PaladinActions.cpp @@ -19,7 +19,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) @@ -56,11 +55,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 753edb83fd0..c8b36135a97 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 abf4ed566cb..6ffbb4b4eea 100644 --- a/src/Ai/Class/Shaman/Trigger/ShamanTriggers.h +++ b/src/Ai/Class/Shaman/Trigger/ShamanTriggers.h @@ -361,10 +361,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) @@ -372,7 +370,6 @@ class SetTotemTrigger : public Trigger bool IsActive() override; private: - uint32 requiredSpellId; uint32 const* totemSpellIds; size_t totemSpellIdsCount; int actionButtonId; @@ -382,119 +379,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 e72fe98d5f5..e62fcb13484 100644 --- a/src/Ai/Dungeon/ForgeOfSouls/Action/ForgeOfSoulsActions.cpp +++ b/src/Ai/Dungeon/ForgeOfSouls/Action/ForgeOfSoulsActions.cpp @@ -19,11 +19,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); @@ -32,8 +30,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 4e9910993df..0ee1b33e456 100644 --- a/src/Ai/Dungeon/Gundrak/Action/GundrakActions.cpp +++ b/src/Ai/Dungeon/Gundrak/Action/GundrakActions.cpp @@ -24,7 +24,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 92b687b2921..5c5cf5e7f06 100644 --- a/src/Ai/Dungeon/TrialOfTheChampion/Action/TrialOfTheChampionActions.cpp +++ b/src/Ai/Dungeon/TrialOfTheChampion/Action/TrialOfTheChampionActions.cpp @@ -58,10 +58,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) { diff --git a/src/Ai/Raid/GruulsLair/Action/RaidGruulsLairActions.cpp b/src/Ai/Raid/GruulsLair/Action/RaidGruulsLairActions.cpp index 1a98135cac3..09f6e36e1d4 100644 --- a/src/Ai/Raid/GruulsLair/Action/RaidGruulsLairActions.cpp +++ b/src/Ai/Raid/GruulsLair/Action/RaidGruulsLairActions.cpp @@ -436,7 +436,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 (!assignedFelStalker->HasAura(SPELL_BANISH) && botAI->CanCastSpell(SPELL_BANISH, assignedFelStalker, true)) @@ -546,7 +548,6 @@ bool GruulTheDragonkillerMainTankPositionBossAction::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 = tankPosition.z; diff --git a/src/Ai/Raid/Icecrown/Action/RaidIccActions.cpp b/src/Ai/Raid/Icecrown/Action/RaidIccActions.cpp index d6a91d04775..ad243e19f9d 100644 --- a/src/Ai/Raid/Icecrown/Action/RaidIccActions.cpp +++ b/src/Ai/Raid/Icecrown/Action/RaidIccActions.cpp @@ -1037,8 +1037,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); @@ -1059,70 +1057,60 @@ bool IccDbsTankPositionAction::CrowdControlBloodBeasts() 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: @@ -1467,7 +1455,6 @@ int IccFestergutGroupPositionAction::CalculatePositionIndex(Group* group) else { // Fill remaining spots in second row - int spotsInFirstRow = 6; int spotsInSecondRow = healerSpotsUsed - 6; int remainingInSecondRow = 6 - spotsInSecondRow; @@ -1514,7 +1501,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 @@ -1662,7 +1648,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(), @@ -1831,21 +1817,14 @@ 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); @@ -2017,7 +1996,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); @@ -2073,7 +2052,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"); @@ -2238,7 +2216,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; @@ -2281,7 +2258,6 @@ Unit* IccPutricideGrowingOozePuddleAction::FindClosestThreateningPuddle() Unit* closestPuddle = nullptr; float closestDistance = FLT_MAX; - float closestSafeDistance = BASE_RADIUS; for (auto const& npc : npcs) { @@ -2298,7 +2274,6 @@ Unit* IccPutricideGrowingOozePuddleAction::FindClosestThreateningPuddle() if (currentDistance < safeDistance && currentDistance < closestDistance) { closestDistance = currentDistance; - closestSafeDistance = safeDistance; closestPuddle = unit; } } @@ -3657,7 +3632,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}; @@ -4021,7 +3995,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 @@ -4092,7 +4065,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 @@ -4373,7 +4345,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) @@ -5572,7 +5543,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; @@ -6709,7 +6679,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); @@ -6792,7 +6761,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; } @@ -7031,10 +6999,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) @@ -7812,7 +7777,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); @@ -8485,8 +8449,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) { @@ -8723,7 +8685,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"); @@ -8735,10 +8696,7 @@ void IccLichKingAddsAction::HandleDefileMechanics(Unit* boss, Difficulty diff) defiles.push_back(unit); float dist = bot->GetDistance(unit); if (dist < closestDistance) - { closestDistance = dist; - closestDefile = unit; - } } } @@ -9078,7 +9036,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 fc02d56bea3..3328d47a37b 100644 --- a/src/Ai/Raid/Icecrown/Multiplier/RaidIccMultipliers.cpp +++ b/src/Ai/Raid/Icecrown/Multiplier/RaidIccMultipliers.cpp @@ -25,8 +25,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 b34fe003fc0..70ad1758e3d 100644 --- a/src/Ai/Raid/Icecrown/Trigger/RaidIccTriggers.cpp +++ b/src/Ai/Raid/Icecrown/Trigger/RaidIccTriggers.cpp @@ -1107,7 +1107,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 adf0eac488d..c1b68740f9d 100644 --- a/src/Ai/Raid/Karazhan/Action/RaidKarazhanActions.cpp +++ b/src/Ai/Raid/Karazhan/Action/RaidKarazhanActions.cpp @@ -869,7 +869,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/Magtheridon/Multiplier/RaidMagtheridonMultipliers.cpp b/src/Ai/Raid/Magtheridon/Multiplier/RaidMagtheridonMultipliers.cpp index 9580fd923a9..cfc0ec2abba 100644 --- a/src/Ai/Raid/Magtheridon/Multiplier/RaidMagtheridonMultipliers.cpp +++ b/src/Ai/Raid/Magtheridon/Multiplier/RaidMagtheridonMultipliers.cpp @@ -59,7 +59,6 @@ float MagtheridonWaitToAttackMultiplier::GetValue(Action* action) float MagtheridonDisableOffTankAssistMultiplier::GetValue(Action* action) { Unit* magtheridon = AI_VALUE2(Unit*, "find target", "magtheridon"); - Unit* channeler = AI_VALUE2(Unit*, "find target", "hellfire channeler"); if (!magtheridon) return 1.0f; diff --git a/src/Ai/Raid/ObsidianSanctum/Action/RaidOsActions.cpp b/src/Ai/Raid/ObsidianSanctum/Action/RaidOsActions.cpp index 2ee68bca4b3..762b68845b3 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; diff --git a/src/Ai/Raid/Ulduar/Action/RaidUlduarActions.cpp b/src/Ai/Raid/Ulduar/Action/RaidUlduarActions.cpp index b20425d224e..8b30e1b6544 100644 --- a/src/Ai/Raid/Ulduar/Action/RaidUlduarActions.cpp +++ b/src/Ai/Raid/Ulduar/Action/RaidUlduarActions.cpp @@ -1249,7 +1249,6 @@ bool KologarnMarkDpsTargetAction::Execute(Event event) if (!target) continue; - uint32 creatureId = target->GetEntry(); if (target->GetEntry() == NPC_RUBBLE && target->IsAlive()) { targetToMark = target; @@ -2481,7 +2480,6 @@ bool MimironRocketStrikeAction::isUseful() bool MimironRocketStrikeAction::Execute(Event event) { - Unit* leviathanMkII = nullptr; Unit* vx001 = nullptr; Unit* aerialCommandUnit = nullptr; @@ -2493,26 +2491,18 @@ bool MimironRocketStrikeAction::Execute(Event event) if (!target || !target->IsAlive()) continue; - if (target->GetEntry() == NPC_LEVIATHAN_MKII) - { - leviathanMkII = target; - } - else if (target->GetEntry() == NPC_VX001) - { + if (target->GetEntry() == NPC_VX001) vx001 = target; - } + else if (target->GetEntry() == NPC_AERIAL_COMMAND_UNIT) - { aerialCommandUnit = target; - } + } Creature* rocketStrikeN = bot->FindNearestCreature(NPC_ROCKET_STRIKE_N, 100.0f); if (!rocketStrikeN) - { return false; - } if (!vx001 && !aerialCommandUnit) { @@ -2561,23 +2551,17 @@ 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) - { + + else if (target->GetEntry() == NPC_AERIAL_COMMAND_UNIT) aerialCommandUnit = target; - } } if (!leviathanMkII || !vx001 || !aerialCommandUnit) - { return false; - } if (botAI->IsMainTank(bot)) { @@ -2602,17 +2586,13 @@ bool MimironPhase4MarkDpsAction::Execute(Event event) 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"); @@ -2639,13 +2619,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; @@ -2656,9 +2632,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; } @@ -2668,9 +2642,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(); @@ -2689,9 +2661,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; @@ -2721,15 +2691,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; @@ -2755,9 +2721,7 @@ bool YoggSaronMarkTargetAction::Execute(Event event) { Group* group = bot->GetGroup(); if (!group) - { return false; - } YoggSaronTrigger yoggSaronTrigger(botAI); if (yoggSaronTrigger.IsPhase2()) @@ -2766,9 +2730,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); @@ -2786,9 +2748,7 @@ bool YoggSaronMarkTargetAction::Execute(Event event) { nextPossibleTarget = bot->FindNearestCreature(NPC_CORRUPTOR_TENTACLE, 200.0f, true); if (!nextPossibleTarget) - { return false; - } } if (currentSkullTarget) @@ -2797,9 +2757,7 @@ bool YoggSaronMarkTargetAction::Execute(Event event) if (currentSkullUnit && currentSkullUnit->IsAlive() && currentSkullUnit->GetGUID() == nextPossibleTarget->GetGUID()) - { return false; - } } group->SetTargetIcon(RtiTargetValue::skullIndex, bot->GetGUID(), nextPossibleTarget->GetGUID()); @@ -2808,15 +2766,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"); @@ -2826,9 +2780,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) @@ -2846,13 +2798,10 @@ 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; } @@ -2860,9 +2809,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) { @@ -2884,17 +2831,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; @@ -2904,17 +2847,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)) @@ -2927,9 +2866,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()) @@ -2940,15 +2877,11 @@ bool YoggSaronMoveToEnterPortalAction::Execute(Event event) brainRoomTeamCount--; if (brainRoomTeamCount == 0) - { break; - } } if (!isInBrainRoomTeam) - { return false; - } Position assignedPortalPosition = yoggPortalLoc[portalNumber - 1]; @@ -3005,33 +2938,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); + + 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()); @@ -3039,19 +2963,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) @@ -3092,15 +3012,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)) @@ -3115,9 +3031,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()); @@ -3129,23 +3043,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()); @@ -3180,9 +3088,7 @@ bool YoggSaronMoveToExitPortalAction::Execute(Event event) { GameObject* portal = bot->FindNearestGameObject(GO_FLEE_TO_THE_SURFACE_PORTAL, 100.0f); if (!portal) - { return false; - } if (botAI->HasCheat(BotCheatMask::raid)) { @@ -3197,9 +3103,7 @@ bool YoggSaronMoveToExitPortalAction::Execute(Event event) } if (bot->GetDistance2d(portal) > 2.0f) - { return false; - } portal->Use(bot); @@ -3211,9 +3115,8 @@ bool YoggSaronLunaticGazeAction::Execute(Event event) { Unit* boss = AI_VALUE2(Unit*, "find target", "yogg-saron"); if (!boss || !boss->IsAlive()) - { return false; - } + float angle = bot->GetAngle(boss); float newAngle = Position::NormalizeOrientation(angle + M_PI); // Add 180 degrees (PI radians) bot->SetFacingTo(newAngle); @@ -3221,9 +3124,7 @@ bool YoggSaronLunaticGazeAction::Execute(Event event) if (botAI->IsRangedDps(bot)) { 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 a4bc2cf9a27..0d1f6d362ac 100644 --- a/src/Ai/Raid/Ulduar/Trigger/RaidUlduarTriggers.cpp +++ b/src/Ai/Raid/Ulduar/Trigger/RaidUlduarTriggers.cpp @@ -854,8 +854,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; @@ -1181,8 +1179,6 @@ bool MimironPhase1PositioningTrigger::IsActive() } Unit* leviathanMkII = nullptr; - Unit* vx001 = nullptr; - Unit* aerialCommandUnit = nullptr; GuidVector targets = AI_VALUE(GuidVector, "possible targets"); Unit* target = nullptr; @@ -1193,23 +1189,17 @@ bool MimironPhase1PositioningTrigger::IsActive() continue; 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; } @@ -1220,9 +1210,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) || @@ -1235,9 +1223,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; } @@ -1257,51 +1243,35 @@ bool MimironRapidBurstTrigger::IsActive() continue; if (target->GetEntry() == NPC_LEVIATHAN_MKII) - { leviathanMkII = target; - } - else if (target->GetEntry() == NPC_VX001) - { + + 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; @@ -1360,9 +1330,7 @@ bool MimironRapidBurstTrigger::IsActive() memberSpotNumber++; if (memberSpotNumber == 3) - { memberSpotNumber = 0; - } } GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs"); @@ -1395,7 +1363,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"); @@ -1407,69 +1374,44 @@ 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) - { + + 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; } @@ -1480,16 +1422,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; } @@ -1502,9 +1440,7 @@ bool MimironPhase4MarkDpsTrigger::IsActive() Group* group = bot->GetGroup(); if (!group) - { return false; - } GuidVector targets = AI_VALUE(GuidVector, "possible targets"); Unit* target = nullptr; @@ -1515,23 +1451,17 @@ 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)) { @@ -1549,22 +1479,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; } @@ -1572,14 +1496,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) @@ -1589,13 +1509,11 @@ bool MimironCheatTrigger::IsActive() continue; if (unit->GetEntry() == NPC_PROXIMITY_MINE) - { return true; - } + else if (unit->GetEntry() == NPC_BOMB_BOT) - { return true; - } + } return false; @@ -1604,22 +1522,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; } @@ -1630,9 +1542,7 @@ bool VezaxShadowCrashTrigger::IsActive() // Check boss and it is alive if (!boss || !boss->IsAlive()) - { return false; - } return botAI->HasAura(SPELL_SHADOW_CRASH, bot); } @@ -1643,14 +1553,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()); @@ -1662,9 +1568,8 @@ Unit* YoggSaronTrigger::GetSaraIfAlive() { Unit* sara = AI_VALUE2(Unit*, "find target", "sara"); if (!sara || !sara->IsAlive()) - { return nullptr; - } + return sara; } @@ -1694,9 +1599,7 @@ bool YoggSaronTrigger::IsYoggSaronFight() Unit* yoggsaron = AI_VALUE2(Unit*, "find target", "yogg-saron"); if ((sara && sara->IsAlive()) || (yoggsaron && yoggsaron->IsAlive())) - { return true; - } return false; } @@ -1704,24 +1607,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; } @@ -1758,9 +1653,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()) < @@ -1771,43 +1664,32 @@ 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; - } uint8 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; } @@ -1816,21 +1698,16 @@ 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; - } GuidVector targets = AI_VALUE(GuidVector, "nearest npcs"); @@ -1840,9 +1717,7 @@ Unit* YoggSaronTrigger::GetNextIllusionRoomRtiTarget() { Unit* unit = botAI->GetUnit(guid); if (unit && unit->IsAlive() && unit->GetEntry() == NPC_LAUGHING_SKULL) - { return unit; - } } } @@ -1867,17 +1742,13 @@ Unit* YoggSaronTrigger::GetNextIllusionRoomRtiTarget() } if (nextIllusionRoomRtiTarget) - { return nextIllusionRoomRtiTarget; - } if (IsInStormwindKeeperIllusion()) { Creature* target = bot->FindNearestCreature(NPC_SUIT_OF_ARMOR, detectionRadius, true); if (target) - { return target; - } } return nullptr; @@ -1886,25 +1757,17 @@ Unit* YoggSaronTrigger::GetNextIllusionRoomRtiTarget() bool YoggSaronOminousCloudCheatTrigger::IsActive() { if (!botAI->HasCheat(BotCheatMask::raid)) - { return false; - } Unit* boss = GetSaraIfAlive(); if (!boss) - { return false; - } if (!botAI->IsBotMainTank(bot)) - { return false; - } if (bot->GetDistance2d(boss->GetPositionX(), boss->GetPositionY()) > 50.0f) - { return false; - } Creature* target = boss->FindNearestCreature(NPC_OMINOUS_CLOUD, 25.0f, true); @@ -1914,14 +1777,10 @@ bool YoggSaronOminousCloudCheatTrigger::IsActive() bool YoggSaronGuardianPositioningTrigger::IsActive() { if (!GetSaraIfAlive()) - { return false; - } if (!botAI->IsTank(bot)) - { return false; - } GuidVector targets = AI_VALUE(GuidVector, "nearest npcs"); bool thereIsAnyGuardian = false; @@ -1930,9 +1789,7 @@ bool YoggSaronGuardianPositioningTrigger::IsActive() { Unit* unit = botAI->GetUnit(guid); if (!unit || !unit->IsAlive()) - { continue; - } if (unit->GetEntry() == NPC_GUARDIAN_OF_YS) { @@ -1940,9 +1797,7 @@ bool YoggSaronGuardianPositioningTrigger::IsActive() ObjectGuid unitTargetGuid = unit->GetTarget(); Player* targetedPlayer = botAI->GetPlayer(unitTargetGuid); if (!targetedPlayer || !botAI->IsTank(targetedPlayer)) - { return false; - } } } @@ -1955,18 +1810,14 @@ bool YoggSaronSanityTrigger::IsActive() Aura* sanityAura = bot->GetAura(SPELL_SANITY); if (!sanityAura) - { return false; - } int sanityAuraStacks = sanityAura->GetStackAmount(); Creature* sanityWell = bot->FindNearestCreature(NPC_SANITY_WELL, 200.0f); if (!sanityWell) - { return false; - } float distanceToSanityWell = bot->GetDistance(sanityWell); @@ -1989,29 +1840,21 @@ bool YoggSaronMaladyOfTheMindTrigger::IsActive() bool YoggSaronMarkTargetTrigger::IsActive() { if (!IsYoggSaronFight()) - { return false; - } if (!botAI->IsBotMainTank(bot)) - { return false; - } Group* group = bot->GetGroup(); if (!group) - { return false; - } if (IsPhase2()) { 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); @@ -2020,9 +1863,7 @@ bool YoggSaronMarkTargetTrigger::IsActive() { nextPossibleTarget = bot->FindNearestCreature(NPC_CORRUPTOR_TENTACLE, 200.0f, true); if (!nextPossibleTarget) - { return false; - } } if (currentSkullTarget) @@ -2030,14 +1871,10 @@ bool YoggSaronMarkTargetTrigger::IsActive() Unit* currentSkullUnit = botAI->GetUnit(currentSkullTarget); if (!currentSkullUnit) - { return true; - } if (currentSkullUnit->IsAlive() && currentSkullUnit->GetGUID() == nextPossibleTarget->GetGUID()) - { return false; - } } return true; @@ -2047,9 +1884,8 @@ bool YoggSaronMarkTargetTrigger::IsActive() ObjectGuid currentSkullTarget = group->GetTargetIcon(RtiTargetValue::skullIndex); Unit* currentSkullUnit = nullptr; if (currentSkullTarget) - { + currentSkullUnit = botAI->GetUnit(currentSkullTarget); - } if (currentSkullUnit && (currentSkullUnit->GetEntry() == NPC_IMMORTAL_GUARDIAN || @@ -2064,21 +1900,15 @@ bool YoggSaronMarkTargetTrigger::IsActive() { 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) - { return true; - } } if (!currentSkullUnit || currentSkullUnit->GetEntry() != NPC_YOGG_SARON) - { return true; - } return false; } @@ -2096,61 +1926,41 @@ bool YoggSaronBrainLinkTrigger::IsActive() bool YoggSaronMoveToEnterPortalTrigger::IsActive() { if (!IsPhase2()) - { return false; - } Creature* portal = bot->FindNearestCreature(NPC_DESCEND_INTO_MADNESS, 100.0f, true); if (!portal) - { return false; - } if (bot->GetDistance2d(portal->GetPositionX(), portal->GetPositionY()) < 2.0f) - { return false; - } if (AI_VALUE(std::string, "rti") != "skull") - { return false; - } Group* group = bot->GetGroup(); if (!group) - { return false; - } int brainRoomTeamCount = 10; if (bot->GetRaidDifficulty() == Difficulty::RAID_DIFFICULTY_10MAN_NORMAL) - { brainRoomTeamCount = 4; - } if (IsMasterIsInIllusionGroup()) - { brainRoomTeamCount--; - } for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next()) { Player* member = gref->GetSource(); if (!member || !member->IsAlive() || botAI->IsTank(member)) - { continue; - } if (member->GetGUID() == bot->GetGUID()) - { return true; - } brainRoomTeamCount--; if (brainRoomTeamCount == 0) - { break; - } } return false; @@ -2159,20 +1969,15 @@ bool YoggSaronMoveToEnterPortalTrigger::IsActive() bool YoggSaronFallFromFloorTrigger::IsActive() { if (!IsYoggSaronFight()) - { return false; - } std::string rtiMark = AI_VALUE(std::string, "rti"); if (rtiMark == "skull" && bot->GetPositionZ() < ULDUAR_YOGG_SARON_BOSS_ROOM_AXIS_Z_PATHING_ISSUE_DETECT) - { return true; - } + if ((rtiMark == "cross" || rtiMark == "circle" || rtiMark == "star") && bot->GetPositionZ() < ULDUAR_YOGG_SARON_BRAIN_ROOM_AXIS_Z_PATHING_ISSUE_DETECT) - { return true; - } return false; } @@ -2180,44 +1985,31 @@ bool YoggSaronFallFromFloorTrigger::IsActive() bool YoggSaronBossRoomMovementCheatTrigger::IsActive() { if (!IsYoggSaronFight() || !IsPhase2()) - { return false; - } FollowMasterStrategy followMasterStrategy(botAI); if (botAI->HasStrategy(followMasterStrategy.getName(), BotState::BOT_STATE_NON_COMBAT)) - { return true; - } if (!botAI->HasCheat(BotCheatMask::raid)) - { return false; - } if (AI_VALUE(std::string, "rti") != "skull") - { 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() || bot->GetDistance2d(currentSkullUnit->GetPositionX(), currentSkullUnit->GetPositionY()) < 40.0f) - { return false; - } return true; } @@ -2225,14 +2017,10 @@ bool YoggSaronBossRoomMovementCheatTrigger::IsActive() bool YoggSaronUsePortalTrigger::IsActive() { if (!IsPhase2()) - { return false; - } if (AI_VALUE(std::string, "rti") != "diamond") - { return false; - } return bot->FindNearestCreature(NPC_DESCEND_INTO_MADNESS, 2.0f, true) != nullptr; } @@ -2240,24 +2028,16 @@ bool YoggSaronUsePortalTrigger::IsActive() bool YoggSaronIllusionRoomTrigger::IsActive() { if (!IsYoggSaronFight() || !IsInIllusionRoom() || AI_VALUE(std::string, "rti") == "square") - { return false; - } if (SetRtiMarkRequired()) - { return true; - } if (SetRtiTargetRequired()) - { return true; - } if (GoToBrainRoomRequired()) - { return true; - } return false; } @@ -2265,9 +2045,7 @@ bool YoggSaronIllusionRoomTrigger::IsActive() bool YoggSaronIllusionRoomTrigger::GoToBrainRoomRequired() { if (AI_VALUE(std::string, "rti") == "square") - { return false; - } return IsMasterIsInBrainRoom(); } @@ -2281,9 +2059,7 @@ bool YoggSaronIllusionRoomTrigger::SetRtiTargetRequired() { Unit const* currentRtiTarget = GetIllusionRoomRtiTarget(); if (currentRtiTarget != nullptr) - { return false; - } return GetNextIllusionRoomRtiTarget() != nullptr; } @@ -2291,15 +2067,11 @@ bool YoggSaronIllusionRoomTrigger::SetRtiTargetRequired() bool YoggSaronMoveToExitPortalTrigger::IsActive() { if (!IsYoggSaronFight() || !IsInBrainLevel()) - { return false; - } Creature const* brain = bot->FindNearestCreature(NPC_BRAIN, 60.0f, true); if (!brain || !brain->IsAlive()) - { return false; - } if (brain->HasUnitState(UNIT_STATE_CASTING)) { @@ -2316,9 +2088,7 @@ bool YoggSaronMoveToExitPortalTrigger::IsActive() } } else if (brain->GetHealth() < brain->GetMaxHealth() * 0.3f) - { return true; - } return false; } @@ -2331,9 +2101,7 @@ bool YoggSaronLunaticGazeTrigger::IsActive() { Spell* currentSpell = yoggsaron->GetCurrentSpell(CURRENT_CHANNELED_SPELL); if (currentSpell && currentSpell->m_spellInfo->Id == SPELL_LUNATIC_GAZE_YS) - { return true; - } } return false; @@ -2342,21 +2110,15 @@ bool YoggSaronLunaticGazeTrigger::IsActive() bool YoggSaronPhase3PositioningTrigger::IsActive() { if (!IsYoggSaronFight() || !IsPhase3()) - { return false; - } YoggSaronSanityTrigger sanityTrigger(botAI); if (sanityTrigger.IsActive()) - { return false; - } 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(), @@ -2368,9 +2130,7 @@ bool YoggSaronPhase3PositioningTrigger::IsActive() if (botAI->IsTank(bot)) { if (bot->GetDistance(ULDUAR_YOGG_SARON_PHASE_3_MELEE_SPOT) > 30.0f) - { return true; - } GuidVector targets = AI_VALUE(GuidVector, "nearest npcs"); bool thereIsAnyGuardian = false; @@ -2379,9 +2139,7 @@ bool YoggSaronPhase3PositioningTrigger::IsActive() { Unit* unit = botAI->GetUnit(guid); if (!unit || !unit->IsAlive()) - { continue; - } if (unit->GetEntry() == NPC_IMMORTAL_GUARDIAN || unit->GetEntry() == NPC_MARKED_IMMORTAL_GUARDIAN) { @@ -2389,9 +2147,7 @@ bool YoggSaronPhase3PositioningTrigger::IsActive() ObjectGuid unitTargetGuid = unit->GetTarget(); Player* targetedPlayer = botAI->GetPlayer(unitTargetGuid); if (!targetedPlayer || !botAI->IsTank(targetedPlayer)) - { return false; - } } } diff --git a/src/Ai/World/Rpg/Action/NewRpgAction.cpp b/src/Ai/World/Rpg/Action/NewRpgAction.cpp index 41fec2291c0..d696339ee5c 100644 --- a/src/Ai/World/Rpg/Action/NewRpgAction.cpp +++ b/src/Ai/World/Rpg/Action/NewRpgAction.cpp @@ -221,9 +221,7 @@ bool NewRpgDoQuestAction::Execute(Event event) if (SearchQuestGiverAndAcceptOrReward()) return true; - NewRpgInfo& info = botAI->rpgInfo; uint32 questId = RPG_INFO(quest, questId); - const Quest* quest = RPG_INFO(quest, quest); uint8 questStatus = bot->GetQuestStatus(questId); switch (questStatus) { @@ -421,7 +419,6 @@ bool NewRpgTravelFlightAction::Execute(Event event) botAI->rpgInfo.ChangeToIdle(); return true; } - const TaxiNodesEntry* entry = sTaxiNodesStore.LookupEntry(botAI->rpgInfo.flight.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 0204a21331c..c3d24a14e63 100644 --- a/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp +++ b/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp @@ -371,7 +371,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)) @@ -557,7 +556,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 889fb1ff929..063250b7e28 100644 --- a/src/Ai/World/Rpg/NewRpgInfo.cpp +++ b/src/Ai/World/Rpg/NewRpgInfo.cpp @@ -66,7 +66,10 @@ void NewRpgInfo::ChangeToIdle() status = RPG_IDLE; } -bool NewRpgInfo::CanChangeTo(NewRpgStatus status) { return true; } +bool NewRpgInfo::CanChangeTo(NewRpgStatus) +{ + return true; +} void NewRpgInfo::Reset() { diff --git a/src/Bot/Factory/AiFactory.h b/src/Bot/Factory/AiFactory.h index 3d11d80aebe..b853bf6705f 100644 --- a/src/Bot/Factory/AiFactory.h +++ b/src/Bot/Factory/AiFactory.h @@ -7,7 +7,6 @@ #define _PLAYERBOT_AIFACTORY_H #include - #include "Common.h" class AiObjectContext; diff --git a/src/Bot/Factory/PlayerbotFactory.cpp b/src/Bot/Factory/PlayerbotFactory.cpp index dfefd323c27..bfc98b2a437 100644 --- a/src/Bot/Factory/PlayerbotFactory.cpp +++ b/src/Bot/Factory/PlayerbotFactory.cpp @@ -954,8 +954,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 @@ -1916,7 +1914,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) // { @@ -1947,7 +1945,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]; @@ -1977,21 +1975,14 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance) } if (bestItemForSlot == 0) - { continue; - } + uint16 dest; if (!CanEquipUnseenItem(slot, dest, bestItemForSlot)) - { continue; - } - Item* newItem = bot->EquipNewItem(dest, bestItemForSlot, true); + + bot->EquipNewItem(dest, bestItemForSlot, true); bot->AutoUnequipOffhandIfNeed(); - // if (newItem) - // { - // newItem->AddToWorld(); - // newItem->AddToUpdateQueueOf(bot); - // } } } } @@ -2004,16 +1995,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) @@ -2023,9 +2008,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; @@ -2147,22 +2130,19 @@ void PlayerbotFactory::InitBags(bool destroyOld) uint32 newItemId = 51809; Item* old_bag = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot); if (old_bag && old_bag->GetTemplate()->ItemId == newItemId) - { continue; - } + uint16 dest; if (!CanEquipUnseenItem(slot, dest, newItemId)) continue; if (old_bag && destroyOld) - { bot->DestroyItem(INVENTORY_SLOT_BAG_0, slot, true); - } + if (old_bag) - { continue; - } - Item* newItem = bot->EquipNewItem(dest, newItemId, true); + + bot->EquipNewItem(dest, newItemId, true); // if (newItem) // { // newItem->AddToWorld(); @@ -2891,7 +2871,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; @@ -3296,7 +3275,6 @@ void PlayerbotFactory::InitFood() void PlayerbotFactory::InitReagents() { - int specTab = AiFactory::GetPlayerSpecTab(bot); std::vector> items; switch (bot->getClass()) { @@ -4352,15 +4330,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) @@ -4380,9 +4354,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))) @@ -4390,9 +4363,8 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destroyOld) continue; } if (enchant->requiredLevel > bot->GetLevel()) - { continue; - } + float score = calculator.CalculateEnchant(enchant_id); if (score >= bestScore) { @@ -4415,11 +4387,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) @@ -4464,7 +4434,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 79850ab24ec..2a82511bc16 100644 --- a/src/Bot/PlayerbotMgr.cpp +++ b/src/Bot/PlayerbotMgr.cpp @@ -74,7 +74,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 4707d854ff9..6580fafe146 100644 --- a/src/Bot/RandomPlayerbotMgr.cpp +++ b/src/Bot/RandomPlayerbotMgr.cpp @@ -995,7 +995,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; @@ -1082,7 +1082,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); @@ -1987,13 +1987,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()); @@ -3147,10 +3143,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. @@ -3190,7 +3186,7 @@ void RandomPlayerbotMgr::PrintStats() if (botAI->AllowActivity()) ++active; - + /* TODO: Review statistics on rpg merge if (botAI->GetAiObjectContext()->GetValue("random bot update")->Get()) ++update; @@ -3203,7 +3199,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 5c0e8c94ab2..35e75c47edc 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]; } } From ba00041c00ee45a280aa261edbfbdee0cc415d4f Mon Sep 17 00:00:00 2001 From: Keleborn <22352763+Celandriel@users.noreply.github.com> Date: Sun, 8 Feb 2026 09:33:51 -0800 Subject: [PATCH 2/2] codestyle. --- src/Ai/Base/Actions/MovementActions.cpp | 1 - src/Ai/Base/Trigger/RangeTriggers.cpp | 1 - src/Ai/Base/Value/PartyMemberToDispel.cpp | 1 - src/Ai/Base/Value/PossibleRpgTargetsValue.cpp | 1 - 4 files changed, 4 deletions(-) diff --git a/src/Ai/Base/Actions/MovementActions.cpp b/src/Ai/Base/Actions/MovementActions.cpp index 2b9d1d97f26..4af41605042 100644 --- a/src/Ai/Base/Actions/MovementActions.cpp +++ b/src/Ai/Base/Actions/MovementActions.cpp @@ -2892,7 +2892,6 @@ bool MoveAwayFromPlayerWithDebuffAction::Execute(Event event) if (!group) return false; - std::vector debuffedPlayers; for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next()) diff --git a/src/Ai/Base/Trigger/RangeTriggers.cpp b/src/Ai/Base/Trigger/RangeTriggers.cpp index 9e71a6e5630..67a367eab1f 100644 --- a/src/Ai/Base/Trigger/RangeTriggers.cpp +++ b/src/Ai/Base/Trigger/RangeTriggers.cpp @@ -11,7 +11,6 @@ #include "ServerFacade.h" #include "SharedDefines.h" - bool EnemyTooCloseForSpellTrigger::IsActive() { Unit* target = AI_VALUE(Unit*, "current target"); diff --git a/src/Ai/Base/Value/PartyMemberToDispel.cpp b/src/Ai/Base/Value/PartyMemberToDispel.cpp index d2200fb746a..91b1955b27b 100644 --- a/src/Ai/Base/Value/PartyMemberToDispel.cpp +++ b/src/Ai/Base/Value/PartyMemberToDispel.cpp @@ -7,7 +7,6 @@ #include "Playerbots.h" - class PartyMemberToDispelPredicate : public FindPlayerPredicate, public PlayerbotAIAware { public: diff --git a/src/Ai/Base/Value/PossibleRpgTargetsValue.cpp b/src/Ai/Base/Value/PossibleRpgTargetsValue.cpp index a588ce272cc..f130efafc3a 100644 --- a/src/Ai/Base/Value/PossibleRpgTargetsValue.cpp +++ b/src/Ai/Base/Value/PossibleRpgTargetsValue.cpp @@ -75,7 +75,6 @@ bool PossibleRpgTargetsValue::AcceptUnit(Unit* unit) TravelTarget* travelTarget = context->GetValue("travel target")->Get(); - if (travelTarget != nullptr && travelTarget->getDestination() && (uint32_t)travelTarget->getDestination()->getEntry() == unit->GetEntry()) return true;