From e5e05988b2494d7f24f6f9002335061b2679e327 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Tue, 17 Oct 2023 21:02:59 +0800 Subject: [PATCH] modify bot revive when summon behaviour --- conf/playerbots.conf.dist | 4 ++-- src/PlayerbotAIConfig.cpp | 2 +- src/PlayerbotAIConfig.h | 2 +- src/strategy/actions/UseMeetingStoneAction.cpp | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 39e67963..13535388 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -128,8 +128,8 @@ AiPlayerbot.EquipmentPersistenceLevel = 80 # default: 1 (accept based on level) AiPlayerbot.GroupInvitationPermission = 1 -# Enable/Disable bot revive and repair gear when summon -# default: 1 (enable) +# Enable/Disable bot revive and repair gear when summon (0 = never, 1 = enable when non-combat and alive, 2 = enable always) +# default: 1 (enable for non-combat) AiPlayerbot.BotReviveWhenSummon = 1 # Non-GM player can only use init=auto to initialize bots based on their own level and gear score diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index b4e67acf..16b7fe7a 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -313,7 +313,7 @@ bool PlayerbotAIConfig::Initialize() equipmentPersistence = sConfigMgr->GetOption("AiPlayerbot.EquipmentPersistence", false); equipmentPersistenceLevel = sConfigMgr->GetOption("AiPlayerbot.EquipmentPersistenceLevel", 80); groupInvitationPermission = sConfigMgr->GetOption("AiPlayerbot.GroupInvitationPermission", 1); - botReviveWhenSummon = sConfigMgr->GetOption("AiPlayerbot.BotReviveWhenSummon", true); + botReviveWhenSummon = sConfigMgr->GetOption("AiPlayerbot.BotReviveWhenSummon", 1); autoInitOnly = sConfigMgr->GetOption("AiPlayerbot.AutoInitOnly", false); autoInitEquipLevelLimitRatio = sConfigMgr->GetOption("AiPlayerbot.AutoInitEquipLevelLimitRatio", 1.0); addClassCommand = sConfigMgr->GetOption("AiPlayerbot.AddClassCommand", 1); diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index 0973f15a..7e2236fa 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -171,7 +171,7 @@ class PlayerbotAIConfig bool equipmentPersistence; int32 equipmentPersistenceLevel; int32 groupInvitationPermission; - bool botReviveWhenSummon; + int32 botReviveWhenSummon; bool autoInitOnly; float autoInitEquipLevelLimitRatio; int32 addClassCommand; diff --git a/src/strategy/actions/UseMeetingStoneAction.cpp b/src/strategy/actions/UseMeetingStoneAction.cpp index f0bfeeef..422fc3e9 100644 --- a/src/strategy/actions/UseMeetingStoneAction.cpp +++ b/src/strategy/actions/UseMeetingStoneAction.cpp @@ -173,7 +173,8 @@ bool SummonAction::Teleport(Player* summoner, Player* player) if (summoner->IsWithinLOS(x, y, z)) { - if (sPlayerbotAIConfig->botReviveWhenSummon && bot->isDead()) + bool allowed = sPlayerbotAIConfig->botReviveWhenSummon == 2 || (sPlayerbotAIConfig->botReviveWhenSummon == 1 && !master->IsInCombat() && master->IsAlive()); + if (allowed && bot->isDead()) { bot->ResurrectPlayer(1.0f, false); bot->DurabilityRepairAll(false, 1.0f, false);