Skip to content

Bot gather fixed#267

Merged
billy1arm merged 3 commits intomangoszero:masterfrom
bozimmerman:bot_gather_fixed
Mar 9, 2026
Merged

Bot gather fixed#267
billy1arm merged 3 commits intomangoszero:masterfrom
bozimmerman:bot_gather_fixed

Conversation

@bozimmerman
Copy link
Contributor

@bozimmerman bozimmerman commented Mar 8, 2026

I have fought and fought with bot gathering, and this is it-- three fixes that together make bot gathering actually work:

  1. Bot skips nodes that aren't in ready state, fixing an infinite gather bug.
  2. Cancel gathering channels when the master enters combat. No more picking posies when your groupmates are dying.
  3. Gate the gathering action behind dungeon/distance checks in isUseful() where it belongs.

This change is Reviewable

Copilot AI review requested due to automatic review settings March 8, 2026 05:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make bot gathering behavior reliable by preventing selection of unusable nodes, stopping gathering casts when combat starts, and moving dungeon/distance gating into isUseful() for the gathering loot action.

Changes:

  • Skip gathering gameobjects unless they are in GO_READY loot state to avoid repeatedly targeting non-ready nodes.
  • Adjust AI update behavior to interrupt the bot’s current cast when the master enters combat (to avoid continuing gathering while the group is fighting).
  • Add AddGatheringLootAction::isUseful() to gate gathering by instance type and master distance, and delegate remaining usefulness checks to the base class.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/modules/Bots/playerbot/strategy/actions/AddLootAction.h Declares AddGatheringLootAction::isUseful() so gathering-specific gating can live at the action level.
src/modules/Bots/playerbot/strategy/actions/AddLootAction.cpp Moves dungeon/distance gating into isUseful() and simplifies AddLoot() to just add eligible gathering loot.
src/modules/Bots/playerbot/PlayerbotAI.cpp Attempts to interrupt bot spellcasting when master is in combat to avoid continuing gathering during fights.
src/modules/Bots/playerbot/LootObjectStack.cpp Filters gameobjects by GO_READY loot state when building loot targets to avoid “infinite gather” loops on non-ready nodes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +182 to +193
if (nextAICheckDelay > sPlayerbotAIConfig.maxWaitForMove &&
!bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
{
nextAICheckDelay = sPlayerbotAIConfig.maxWaitForMove;
if (bot->IsInCombat())
nextAICheckDelay = sPlayerbotAIConfig.maxWaitForMove;
else
{
Player* master = GetMaster();
if (master && master->IsInCombat())
{
InterruptSpell();
nextAICheckDelay = sPlayerbotAIConfig.maxWaitForMove;
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change intends to interrupt gathering "channels" when the master enters combat, but the new condition explicitly excludes CURRENT_CHANNELED_SPELL, and InterruptSpell() also returns early when a channeled spell is active. If gathering (or other relevant actions) can be implemented as channeled spells, this will not interrupt them; consider handling the channeled case explicitly (or adjusting InterruptSpell()/the condition) so the behavior matches the PR intent.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gathering spells aren't channeled, and the channel guard was inherited, so I can't say why. InterruptSpell is for cancelling casting times, not chanelling.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IOW, Copilot is just wrong here.

@AppVeyorBot
Copy link

@billy1arm billy1arm merged commit f039e60 into mangoszero:master Mar 9, 2026
11 of 12 checks passed
@bozimmerman bozimmerman deleted the bot_gather_fixed branch March 9, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants