From 6dd5494cfd4113dd9cb0efc56e7f8820c584b8cf Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Sat, 13 Jul 2024 21:42:47 +0800 Subject: [PATCH] [Initialization] Disable init command during combat --- src/PlayerbotMgr.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/PlayerbotMgr.cpp b/src/PlayerbotMgr.cpp index 1de95c56..665c7fdf 100644 --- a/src/PlayerbotMgr.cpp +++ b/src/PlayerbotMgr.cpp @@ -575,6 +575,13 @@ std::string const PlayerbotHolder::ProcessBotCommand(std::string const cmd, Obje return "ERROR: You can not use this command on non-summoned random bot."; } + if (!admin) { + Player* master = ObjectAccessor::FindConnectedPlayer(masterguid); + if (master && (master->IsInCombat() || bot->IsInCombat())) { + return "ERROR: You can not use this command during combat."; + } + } + if (GET_PLAYERBOT_AI(bot)) { if (Player* master = GET_PLAYERBOT_AI(bot)->GetMaster()) {