mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-07 12:41:09 +00:00
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:
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user