From ced051b16c62ee6bea81198959a155882955cbc7 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Sun, 17 Dec 2023 23:04:05 +0800 Subject: [PATCH] summon when group config --- conf/playerbots.conf.dist | 3 +++ src/PlayerbotAIConfig.cpp | 1 + src/PlayerbotAIConfig.h | 1 + src/strategy/actions/AcceptInvitationAction.cpp | 4 ++++ src/strategy/actions/AcceptInvitationAction.h | 5 +++-- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index cb64f599..0d9a9a4a 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -78,6 +78,9 @@ AiPlayerbot.RandombotsWalkingRPG.InDoors = 0 # Bots greet to the players AiPlayerbot.EnableGreet = 0 +# Bots will be summoned to player when accept group invitation +AiPlayerbot.SummonWhenGroup = 1 + # Show helmet and cloak on randombots (reset required) AiPlayerbot.RandomBotShowHelmet = 1 AiPlayerbot.RandomBotShowCloak = 1 diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index c58553ec..a60c845d 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -310,6 +310,7 @@ bool PlayerbotAIConfig::Initialize() // SPP switches enableGreet = sConfigMgr->GetOption("AiPlayerbot.EnableGreet", true); + summonWhenGroup = sConfigMgr->GetOption("AiPlayerbot.SummonWhenGroup", true); disableRandomLevels = sConfigMgr->GetOption("AiPlayerbot.DisableRandomLevels", false); randomBotRandomPassword = sConfigMgr->GetOption("AiPlayerbot.RandomBotRandomPassword", true); downgradeMaxLevelBot = sConfigMgr->GetOption("AiPlayerbot.DowngradeMaxLevelBot", true); diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index 81b1296b..ca6477ce 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -142,6 +142,7 @@ class PlayerbotAIConfig bool perfMonEnabled; bool enableGreet; + bool summonWhenGroup; bool randomBotShowHelmet; bool randomBotShowCloak; bool disableRandomLevels; diff --git a/src/strategy/actions/AcceptInvitationAction.cpp b/src/strategy/actions/AcceptInvitationAction.cpp index 1b2fbe7d..c7a8563c 100644 --- a/src/strategy/actions/AcceptInvitationAction.cpp +++ b/src/strategy/actions/AcceptInvitationAction.cpp @@ -41,5 +41,9 @@ bool AcceptInvitationAction::Execute(Event event) botAI->Reset(); botAI->TellMaster("Hello"); + + if (sPlayerbotAIConfig->summonWhenGroup) { + Teleport(inviter, bot); + } return true; } diff --git a/src/strategy/actions/AcceptInvitationAction.h b/src/strategy/actions/AcceptInvitationAction.h index 4ddfe559..fd4154bd 100644 --- a/src/strategy/actions/AcceptInvitationAction.h +++ b/src/strategy/actions/AcceptInvitationAction.h @@ -6,13 +6,14 @@ #define _PLAYERBOT_ACCEPTINVITATIONACTION_H #include "Action.h" +#include "UseMeetingStoneAction.h" class PlayerbotAI; -class AcceptInvitationAction : public Action +class AcceptInvitationAction : public SummonAction { public: - AcceptInvitationAction(PlayerbotAI* botAI) : Action(botAI, "accept invitation") { } + AcceptInvitationAction(PlayerbotAI* botAI) : SummonAction(botAI, "accept invitation") { } bool Execute(Event event) override; };