Extend SummonWhenGroup to auto-added bots (#2034)

### Summary
Extend AiPlayerbot.SummonWhenGroup to apply when bots are auto-added to
a group (e.g., addclass bots or raidus style auto invites).

### Motivation
Bots added automatically to a group never accept a normal invite, so
they do not trigger the summon-on-accept path. When SummonWhenGroup is
enabled, these bots should also be teleported next to the master to
match expected behavior.

### Implementation details
Hook the summon behavior right after automatic group addition.
This commit is contained in:
Alex Dcnh
2026-02-06 23:20:31 +01:00
committed by GitHub
parent 026df0dabe
commit 76b6df9ea3
2 changed files with 12 additions and 1 deletions

View File

@@ -17,9 +17,9 @@ public:
SummonAction(PlayerbotAI* botAI, std::string const name = "summon") : MovementAction(botAI, name) {}
bool Execute(Event event) override;
bool Teleport(Player* summoner, Player* player, bool preserveAuras);
protected:
bool Teleport(Player* summoner, Player* player, bool preserveAuras);
bool SummonUsingGos(Player* summoner, Player* player, bool preserveAuras);
bool SummonUsingNpcs(Player* summoner, Player* player, bool preserveAuras);
};

View File

@@ -14,9 +14,11 @@
#include "PlayerbotOperation.h"
#include "Player.h"
#include "PlayerbotAI.h"
#include "PlayerbotAIConfig.h"
#include "PlayerbotMgr.h"
#include "PlayerbotRepository.h"
#include "RandomPlayerbotMgr.h"
#include "UseMeetingStoneAction.h"
#include "WorldSession.h"
#include "WorldSessionMgr.h"
@@ -74,6 +76,15 @@ public:
if (group->AddMember(target))
{
LOG_DEBUG("playerbots", "GroupInviteOperation: Successfully added {} to group", target->GetName());
if (sPlayerbotAIConfig.summonWhenGroup && target->GetDistance(bot) > sPlayerbotAIConfig.sightDistance)
{
PlayerbotAI* targetAI = sPlayerbotsMgr.GetPlayerbotAI(target);
if (targetAI)
{
SummonAction summonAction(targetAI, "group summon");
summonAction.Teleport(bot, target, true);
}
}
return true;
}
else