From 01e37d09ae23b9484f32d40352c451e1a8b50033 Mon Sep 17 00:00:00 2001 From: Karrz1 <127596890+Karrz1@users.noreply.github.com> Date: Mon, 16 Nov 2026 17:01:08 +0000 Subject: [PATCH] Bots: a companion answers its player's guild invite 0141 did not do it: Chaelanna, grouped with her player, had the invite pending and never ran idle:guild_invite_accept. Every "idle:guild_" rule counts as a world errand, and world errands are skipped for a bot led by a player, so the accept rule never reached its gate. Accepting an invite takes the bot nowhere; it is no errand now. IsWorldErrand moves to Bot/IdleRuleErrands.h so a Catch2 case can check the list. --- src/modules/PlayerbotV2/Bot/IdleRule.cpp | 34 ++------------- src/modules/PlayerbotV2/Bot/IdleRuleErrands.h | 41 +++++++++++++++++++ tests/game/ClassicBotGroupRules.cpp | 15 +++++++ 3 files changed, 59 insertions(+), 31 deletions(-) create mode 100644 src/modules/PlayerbotV2/Bot/IdleRuleErrands.h diff --git a/src/modules/PlayerbotV2/Bot/IdleRule.cpp b/src/modules/PlayerbotV2/Bot/IdleRule.cpp index d4c2c04a51..57eaab66e0 100644 --- a/src/modules/PlayerbotV2/Bot/IdleRule.cpp +++ b/src/modules/PlayerbotV2/Bot/IdleRule.cpp @@ -1,6 +1,7 @@ // IdleRule — registry implementation. #include "IdleRule.h" +#include "IdleRuleErrands.h" #include "BotSnapshotView.h" #include "BotAI.h" #include "BotIntentEmitter.h" @@ -31,36 +32,7 @@ void IdleRuleRegistry::register_rule(IdleRule r) rules_.push_back(std::move(r)); } -namespace -{ -// Rules a companion in its owner's group must not run: each sends the bot about the world on its own business. Upkeep -// (food, buffs, heals, rez, supplies, loot, rolls, equipping), survival, owner orders and assisting the group stay, and -// so do accepting the group's LFG proposal or BG port and playing the dungeon/BG once inside (bg_*, dungeon_dispatch, -// lfg_proposal_accept): the owner queued the group. Repairs and new trainer spells come free (BackfillOne). -bool IsWorldErrand(std::string_view name) -{ - // Taking the quest from an item already in the bags goes nowhere, so a companion does it too. - if (name == "idle:quest_start_item") - return false; - static constexpr std::string_view kPrefixes[] = { - "idle:ah_", "idle:autoact_dispatch", "idle:bag_hearth", "idle:bags_full_recover", "idle:bank_deposit", - "idle:calendar_", "idle:capital_bag_run", "idle:craft_order_", "idle:critical_repair", "idle:dual_spec_switch", - "idle:dungeon_loop_requeue", "idle:dungeon_quest_approach", "idle:far_same_map_travel", "idle:gather", - "idle:guild_", "idle:homebind", "idle:invite_nearby_player", "idle:legacy_vendor_dispatch", - "idle:look_at_npc", "idle:loot_chest", "idle:mail_drain", "idle:mat_share_to_owner", - "idle:pet_swap_from_stable", "idle:pursue_quest_", "idle:pvp_help_callout", "idle:assist_friend_pvp", - "idle:quest_", "idle:react_to_passerby", "idle:resolve_junk_quests", "idle:swim_stuck_hearth", - "idle:swim_stuck_walk_to_hub", "idle:tame_beast", "idle:taxi_discover", "idle:transport_ride", "idle:vendor_visit", - "idle:bag_hearth", "idle:fidget", "idle:inn_rest", "idle:mailbox", "idle:town_duel", "idle:town_errand", "idle:town_linger", "idle:wander", - "idle:walk_", - "idle:wq_", "idle:yell_lfg", "idle:ambient_sit", "idle:rpg_", - }; - for (std::string_view prefix : kPrefixes) - if (name.starts_with(prefix)) - return true; - return false; -} -} +// IsWorldErrand: Bot/IdleRuleErrands.h // A member of a bot-led group whose leader is here: State_InGroup keeps it at the leader's side (follow slack 6-13 y), so an // errand of its own pulls it away, the follow pulls it back, and it runs to and fro (Stormwind 2026-11-06: follow_recall against @@ -83,7 +55,7 @@ void IdleRuleRegistry::finalize() { for (IdleRule& rule : rules_) { - rule.world_errand = IsWorldErrand(rule.name); + rule.world_errand = Playerbot::IsWorldErrand(rule.name); rule.owner_gather = rule.name == "idle:gather" || rule.name == "idle:gather_detour"; rule.quest_seek = rule.name == "idle:walk_to_known_hub" || rule.name == "idle:wander_to_quest_hub"; rule.fight_exempt = rule.name.starts_with("idle:autoact_dispatch"); diff --git a/src/modules/PlayerbotV2/Bot/IdleRuleErrands.h b/src/modules/PlayerbotV2/Bot/IdleRuleErrands.h new file mode 100644 index 0000000000..de768af7fc --- /dev/null +++ b/src/modules/PlayerbotV2/Bot/IdleRuleErrands.h @@ -0,0 +1,41 @@ +#ifndef PLAYERBOT_IDLE_RULE_ERRANDS_H +#define PLAYERBOT_IDLE_RULE_ERRANDS_H + +#include + +namespace Playerbot +{ +// Rules a companion in its owner's group must not run: each sends the bot about the world on its own business. Upkeep +// (food, buffs, heals, rez, supplies, loot, rolls, equipping), survival, owner orders and assisting the group stay, and +// so do accepting the group's LFG proposal or BG port and playing the dungeon/BG once inside (bg_*, dungeon_dispatch, +// lfg_proposal_accept): the owner queued the group. Repairs and new trainer spells come free (BackfillOne). +inline bool IsWorldErrand(std::string_view name) +{ + // Taking the quest from an item already in the bags goes nowhere, so a companion does it too. + if (name == "idle:quest_start_item") + return false; + // Accepting a guild invite goes nowhere either, and it is the player's own invite: "idle:guild_" below caught it, so a + // companion following its player never answered a /ginvite (chris 2026-11-16: Kathleen, then Chaelanna, never joined). + if (name == "idle:guild_invite_accept") + return false; + static constexpr std::string_view kPrefixes[] = { + "idle:ah_", "idle:autoact_dispatch", "idle:bag_hearth", "idle:bags_full_recover", "idle:bank_deposit", + "idle:calendar_", "idle:capital_bag_run", "idle:craft_order_", "idle:critical_repair", "idle:dual_spec_switch", + "idle:dungeon_loop_requeue", "idle:dungeon_quest_approach", "idle:far_same_map_travel", "idle:gather", + "idle:guild_", "idle:homebind", "idle:invite_nearby_player", "idle:legacy_vendor_dispatch", + "idle:look_at_npc", "idle:loot_chest", "idle:mail_drain", "idle:mat_share_to_owner", + "idle:pet_swap_from_stable", "idle:pursue_quest_", "idle:pvp_help_callout", "idle:assist_friend_pvp", + "idle:quest_", "idle:react_to_passerby", "idle:resolve_junk_quests", "idle:swim_stuck_hearth", + "idle:swim_stuck_walk_to_hub", "idle:tame_beast", "idle:taxi_discover", "idle:transport_ride", "idle:vendor_visit", + "idle:bag_hearth", "idle:fidget", "idle:inn_rest", "idle:mailbox", "idle:town_duel", "idle:town_errand", "idle:town_linger", "idle:wander", + "idle:walk_", + "idle:wq_", "idle:yell_lfg", "idle:ambient_sit", "idle:rpg_", + }; + for (std::string_view prefix : kPrefixes) + if (name.starts_with(prefix)) + return true; + return false; +} +} + +#endif diff --git a/tests/game/ClassicBotGroupRules.cpp b/tests/game/ClassicBotGroupRules.cpp index ab5174dfe2..c2017f6c64 100644 --- a/tests/game/ClassicBotGroupRules.cpp +++ b/tests/game/ClassicBotGroupRules.cpp @@ -17,6 +17,7 @@ #include "tc_catch2.h" #include "../../src/server/game/Groups/BotGroupRules.h" +#include "../../src/modules/PlayerbotV2/Bot/IdleRuleErrands.h" using namespace BotGroupRules; @@ -113,3 +114,17 @@ TEST_CASE("A raid of a player and bots that fits a party goes back to one", "[Cl // already a party REQUIRE_FALSE(RevertBotRaidToParty(false, false, 3, 5, true, true, false)); } + +TEST_CASE("A companion following its player still answers the player's guild invite", "[ClassicBotGroupRules]") +{ + // chris 2026-11-16: Chaelanna (grouped with her player) had the invite pending and never accepted: "idle:guild_" errands + // are skipped for a bot led by a player, and the accept rule matched that prefix. + CHECK_FALSE(Playerbot::IsWorldErrand("idle:guild_invite_accept")); + // the guild errands that do take a bot about the world stay errands + CHECK(Playerbot::IsWorldErrand("idle:guild_recruit_nearby")); + CHECK(Playerbot::IsWorldErrand("idle:guild_bank_deposit")); + // and so do the other accept-free prefixes it sits next to + CHECK_FALSE(Playerbot::IsWorldErrand("idle:quest_start_item")); + CHECK(Playerbot::IsWorldErrand("idle:quest_turnin")); + CHECK_FALSE(Playerbot::IsWorldErrand("idle:group_invite_accept")); +}