Conversation
There was a problem hiding this comment.
Pull request overview
This PR primarily removes unused variables/parameters and performs small refactors across the playerbot/AI code to reduce compiler warnings and improve code cleanliness.
Changes:
- Removed unused locals/temporaries and simplified a few conditionals to address unused-variable warnings.
- Minor refactors for readability (e.g., avoiding shadowing, removing redundant braces, small const/typing tweaks).
- Small include cleanup/adjustments to match actual usage.
Reviewed changes
Copilot reviewed 69 out of 69 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Mgr/Item/RandomItemMgr.cpp | Removes unused upgrade-tracking variable(s) in upgrade list logic. |
| src/Bot/RandomPlayerbotMgr.cpp | Cleans up unused vars/braces; comments out unused stats block. |
| src/Bot/PlayerbotMgr.cpp | Removes unused member from login query holder. |
| src/Bot/Factory/PlayerbotFactory.cpp | Removes unused locals and simplifies equip/bag/enchant logic. |
| src/Bot/Factory/AiFactory.h | Removes stray blank line in includes. |
| src/Ai/World/Rpg/NewRpgInfo.cpp | Removes unused parameter name / expands stub into block body. |
| src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp | Removes unused local; small refactor to reuse zone id. |
| src/Ai/World/Rpg/Action/NewRpgAction.cpp | Removes unused locals in quest/flight actions. |
| src/Ai/Raid/Ulduar/Trigger/RaidUlduarTriggers.cpp | Removes unused locals; brace/format cleanup in triggers. |
| src/Ai/Raid/Ulduar/Action/RaidUlduarActions.cpp | Removes unused locals; minor formatting adjustments. |
| src/Ai/Raid/ObsidianSanctum/Action/RaidOsActions.cpp | Removes commented/unused locals. |
| src/Ai/Raid/Magtheridon/Multiplier/RaidMagtheridonMultipliers.cpp | Removes unused target lookup. |
| src/Ai/Raid/Karazhan/Action/RaidKarazhanActions.cpp | Removes unused structured binding result. |
| src/Ai/Raid/Icecrown/Trigger/RaidIccTriggers.cpp | Removes unused boolean. |
| src/Ai/Raid/Icecrown/Multiplier/RaidIccMultipliers.cpp | Removes unused globals in anonymous namespace. |
| src/Ai/Raid/Icecrown/Action/RaidIccActions.cpp | Removes unused locals; fixes boolean shadowing. |
| src/Ai/Raid/GruulsLair/Action/RaidGruulsLairActions.cpp | Removes unused locals; minor typing tweak around sizes. |
| src/Ai/Dungeon/TrialOfTheChampion/Action/TrialOfTheChampionActions.cpp | Removes unused item position locals. |
| src/Ai/Dungeon/Gundrak/Action/GundrakActions.cpp | Removes unused local initialization. |
| src/Ai/Dungeon/ForgeOfSouls/Action/ForgeOfSoulsActions.cpp | Removes unused locals; cleans up loop body. |
| src/Ai/Class/Shaman/Trigger/ShamanTriggers.h | Simplifies SetTotemTrigger ctor/signature; removes unused member. |
| src/Ai/Class/Shaman/Trigger/ShamanTriggers.cpp | Removes unused helper; keeps active logic consolidated. |
| src/Ai/Class/Paladin/Action/PaladinActions.cpp | Removes unused using/import and unused helper overload. |
| src/Ai/Base/Value/StatsValues.cpp | Removes unused free-slot accumulator. |
| src/Ai/Base/Value/SnareTargetValue.cpp | Removes unused current-target fetch. |
| src/Ai/Base/Value/PossibleRpgTargetsValue.cpp | Adds needed include; minor null/typing cleanup. |
| src/Ai/Base/Value/PartyMemberWithoutAuraValue.h | Removes unused config include/parameter. |
| src/Ai/Base/Value/PartyMemberToDispel.cpp | Whitespace cleanup. |
| src/Ai/Base/Value/LeastHpTargetValue.cpp | Removes unused include/local; minor whitespace. |
| src/Ai/Base/Value/ItemUsageValue.cpp | Minor refactor to avoid repeated field access. |
| src/Ai/Base/Value/GrindTargetValue.cpp | Removes unused locals. |
| src/Ai/Base/Value/Arrow.cpp | Removes unused x/y computation; tightens loops. |
| src/Ai/Base/Trigger/RangeTriggers.cpp | Removes unused helper function (only referenced in commented code). |
| src/Ai/Base/SharedValueContext.h | Narrows include from Playerbots.h to PlayerbotAI.h. |
| src/Ai/Base/Actions/WipeAction.cpp | Adds null checks / refactors owner/master comparison. |
| src/Ai/Base/Actions/WhoAction.cpp | Removes unused parameter name. |
| src/Ai/Base/Actions/UseItemAction.cpp | Removes unused local. |
| src/Ai/Base/Actions/TravelAction.cpp | Simplifies control flow; removes unreachable return. |
| src/Ai/Base/Actions/TradeStatusAction.cpp | Removes unused locals; simplifies trade checks. |
| src/Ai/Base/Actions/TellLosAction.cpp | Removes unused spellInfo local. |
| src/Ai/Base/Actions/TameAction.cpp | Removes unused local. |
| src/Ai/Base/Actions/TalkToQuestGiverAction.cpp | Removes unused locals in reward/query parsing. |
| src/Ai/Base/Actions/SuggestWhatToDoAction.cpp | Removes unused local; ctor init order tweak. |
| src/Ai/Base/Actions/StayActions.cpp | Removes unused distance local. |
| src/Ai/Base/Actions/ShareQuestAction.cpp | Removes unused parameter usage. |
| src/Ai/Base/Actions/SetHomeAction.cpp | Removes duplicated branches. |
| src/Ai/Base/Actions/SetCraftAction.cpp | Avoids unchecked map lookup result; adds explicit null check. |
| src/Ai/Base/Actions/SecurityCheckAction.cpp | Uses RandomPlayerbotMgr singleton directly (equivalent to macro). |
| src/Ai/Base/Actions/SayAction.cpp | Removes unused local. |
| src/Ai/Base/Actions/RememberTaxiAction.cpp | Removes unused local. |
| src/Ai/Base/Actions/QuestAction.cpp | Removes unused locals in quest event handlers. |
| src/Ai/Base/Actions/QueryQuestAction.cpp | Removes unused requester local. |
| src/Ai/Base/Actions/PetsAction.h | Removes unused member. |
| src/Ai/Base/Actions/MovementActions.h | Removes unused member. |
| src/Ai/Base/Actions/MovementActions.cpp | Removes unused locals/comments; small refactors. |
| src/Ai/Base/Actions/MailAction.cpp | Removes unused local while retaining free-slot logic. |
| src/Ai/Base/Actions/LootStrategyAction.cpp | Removes unused available-loot local. |
| src/Ai/Base/Actions/LootRollAction.cpp | Removes unused locals; minor cleanup. |
| src/Ai/Base/Actions/InviteToGroupAction.cpp | Removes unused guild local. |
| src/Ai/Base/Actions/GuildCreateActions.cpp | Removes unused locals/constants. |
| src/Ai/Base/Actions/GiveItemAction.cpp | Removes unused moved flag. |
| src/Ai/Base/Actions/FishingAction.cpp | Removes unused locals. |
| src/Ai/Base/Actions/EquipAction.cpp | Removes unused bag cast local; keeps bag swap logic. |
| src/Ai/Base/Actions/DebugAction.cpp | Removes unused variable assignment. |
| src/Ai/Base/Actions/ChooseTravelTargetAction.cpp | Removes unused locals; minor cleanup. |
| src/Ai/Base/Actions/ChooseRpgTargetAction.cpp | Removes unused commented locals. |
| src/Ai/Base/Actions/ChatShortcutActions.cpp | Removes redundant braces; minor formatting. |
| src/Ai/Base/Actions/BattleGroundTactics.cpp | Removes unused locals; keeps objective selection logic. |
| src/Ai/Base/Actions/BattleGroundJoinAction.cpp | Removes unused locals in join flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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; |
There was a problem hiding this comment.
The null-check logic here can allow the action to proceed (and kill the bot) when either event.getOwner() or botAI->GetMaster() is null, because the early-return only triggers when both are non-null and GUIDs differ. If this action is intended to be restricted to the bot's master issuing the command, it should return false when owner is null, master is null, or the GUIDs don't match.
|
|
||
| ObjectGuid currentSkullTarget = group->GetTargetIcon(RtiTargetValue::skullIndex); | ||
|
|
There was a problem hiding this comment.
currentSkullTarget is indented as if it were guarded by the if (!group) check, but it is not. This can be misleading to readers and can also trigger -Wmisleading-indentation style warnings. Align this declaration with the surrounding block scope.
| 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); |
There was a problem hiding this comment.
This condition appears inverted compared to other usages in the same file (e.g. adding follow master only when it is not already present). As written, the strategy is only added when it already exists, so bots that don't currently have follow master won't get it enabled before portal use.
Pull Request
Describe what this change does and why it is needed...
Design Philosophy
We prioritize stability, performance, and predictability over behavioral realism.
Complex player-mimicking logic is intentionally limited due to its negative impact on scalability, maintainability, and
long-term robustness.
Excessive processing overhead can lead to server hiccups, increased CPU usage, and degraded performance for all
participants. Because every action and
decision tree is executed per bot and per trigger, even small increases in logic complexity can scale poorly and
negatively affect both players and
world (random) bots. Bots are not expected to behave perfectly, and perfect simulation of human decision-making is not a
project goal. Increased behavioral
realism often introduces disproportionate cost, reduced predictability, and significantly higher maintenance overhead.
Every additional branch of logic increases long-term responsibility. All decision paths must be tested, validated, and
maintained continuously as the system evolves.
If advanced or AI-intensive behavior is introduced, the default configuration must remain the lightweight decision
model. More complex behavior should only be
available as an explicit opt-in option, clearly documented as having a measurable performance cost.
Principles:
Stability before intelligence
A stable system is always preferred over a smarter one.
Performance is a shared resource
Any increase in bot cost affects all players and all bots.
Simple logic scales better than smart logic
Predictable behavior under load is more valuable than perfect decisions.
Complexity must justify itself
If a feature cannot clearly explain its cost, it should not exist.
Defaults must be cheap
Expensive behavior must always be optional and clearly communicated.
Bots should look reasonable, not perfect
The goal is believable behavior, not human simulation.
Before submitting, confirm that this change aligns with those principles.
Feature Evaluation
Please answer the following:
How to Test the Changes
Complexity & Impact
Does this change add new decision branches?
Does this change increase per-bot or per-tick processing?
Could this logic scale poorly under load?
Defaults & Configuration
Does this change modify default bot behavior?
If this introduces more advanced or AI-heavy logic:
AI Assistance
Was AI assistance (e.g. ChatGPT or similar tools) used while working on this change?
If yes, please specify:
AI assistance is allowed, but all submitted code must be fully understood, reviewed, and owned by the contributor.
Any AI-influenced changes must be verified against existing CORE and PB logic. We expect contributors to be honest
about what they do and do not understand.
Final Checklist
Notes for Reviewers
Anything that significantly improves realism at the cost of stability or performance should be carefully discussed
before merging.