Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/modules/Bots/playerbot/LootObjectStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void LootObject::Refresh(Player* bot, ObjectGuid guid)
}

GameObject* go = ai->GetGameObject(guid);
if (go && go->isSpawned())
if (go && go->isSpawned() && go->getLootState() == GO_READY)
{
uint32 lockId = go->GetGOInfo()->GetLockId();
LockEntry const *lockInfo = sLockStore.LookupEntry(lockId);
Expand Down
15 changes: 13 additions & 2 deletions src/modules/Bots/playerbot/PlayerbotAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,20 @@ void PlayerbotAI::UpdateAI(uint32 elapsed)
}
}

if (nextAICheckDelay > sPlayerbotAIConfig.maxWaitForMove && bot->IsInCombat() && !bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
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;
Comment on lines +182 to +193
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.

}
}
}

PlayerbotAIBase::UpdateAI(elapsed);
Expand Down
17 changes: 14 additions & 3 deletions src/modules/Bots/playerbot/strategy/actions/AddLootAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,27 @@ bool AddGatheringLootAction::AddLoot(ObjectGuid guid)
return false;
}

return AddAllLootAction::AddLoot(guid);
}

bool AddGatheringLootAction::isUseful()
{
// Don't gather in dungeons or raids
if (bot->GetMap()->IsDungeon())
{
return false;
}

// NC gathering is a problem if you are supposed to be following
Player* master = ai->GetMaster();
if (master && ai->HasStrategy("follow master", BOT_STATE_NON_COMBAT))
if (master && bot->GetGroup())
{
float masterDist = bot->GetDistance(master);
if (masterDist > sPlayerbotAIConfig.reactDistance / 2)
if (masterDist > sPlayerbotAIConfig.reactDistance)
{
return false;
}
}

return AddAllLootAction::AddLoot(guid);
return AddAllLootAction::isUseful();
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace ai
class AddGatheringLootAction : public AddAllLootAction {
public:
AddGatheringLootAction(PlayerbotAI* ai) : AddAllLootAction(ai, "add gathering loot") {}
virtual bool isUseful();

protected:
virtual bool AddLoot(ObjectGuid guid);
Expand Down
Loading