From 1f7ab72b0449827476353da47f60b19b394e7f8e Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Wed, 24 Jul 2024 21:13:32 +0800 Subject: [PATCH] [Configuration] Make more options for ReviveBotWhenSummoned --- 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 5f0e64d3..e7826de0 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -172,8 +172,8 @@ AiPlayerbot.AllowSummonWhenMasterIsDead = 1 # default: 1 (always) AiPlayerbot.AllowSummonWhenBotIsDead = 1 -# Enable/Disable reviving the bots when summoning them -# default: 1 (enable) +# Enable/Disable reviving the bots when summoning them (0 = disable, 1 = disable in combat, 2 = enable) +# default: 1 (disable in combat) AiPlayerbot.ReviveBotWhenSummoned = 1 # Enable/Disable bot repair gear when summon (0 = no, 1 = yes) diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index b28aeeba..94e290fe 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -279,7 +279,7 @@ bool PlayerbotAIConfig::Initialize() allowSummonInCombat = sConfigMgr->GetOption("AiPlayerbot.AllowSummonInCombat", true); allowSummonWhenMasterIsDead = sConfigMgr->GetOption("AiPlayerbot.AllowSummonWhenMasterIsDead", true); allowSummonWhenBotIsDead = sConfigMgr->GetOption("AiPlayerbot.AllowSummonWhenBotIsDead", true); - reviveBotWhenSummoned = sConfigMgr->GetOption("AiPlayerbot.ReviveBotWhenSummoned", true); + reviveBotWhenSummoned = sConfigMgr->GetOption("AiPlayerbot.ReviveBotWhenSummoned", 1); botRepairWhenSummon = sConfigMgr->GetOption("AiPlayerbot.BotRepairWhenSummon", true); autoInitOnly = sConfigMgr->GetOption("AiPlayerbot.AutoInitOnly", false); autoInitEquipLevelLimitRatio = sConfigMgr->GetOption("AiPlayerbot.AutoInitEquipLevelLimitRatio", 1.0); diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index 32bd1c59..5ce7d39e 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -220,7 +220,7 @@ class PlayerbotAIConfig bool allowSummonInCombat; bool allowSummonWhenMasterIsDead; bool allowSummonWhenBotIsDead; - bool reviveBotWhenSummoned; + int reviveBotWhenSummoned; bool botRepairWhenSummon; bool autoInitOnly; float autoInitEquipLevelLimitRatio; diff --git a/src/strategy/actions/UseMeetingStoneAction.cpp b/src/strategy/actions/UseMeetingStoneAction.cpp index 5cf93e14..2bc87266 100644 --- a/src/strategy/actions/UseMeetingStoneAction.cpp +++ b/src/strategy/actions/UseMeetingStoneAction.cpp @@ -206,7 +206,8 @@ bool SummonAction::Teleport(Player* summoner, Player* player) return false; } - if (bot->isDead() && sPlayerbotAIConfig->reviveBotWhenSummoned) + bool revive = sPlayerbotAIConfig->reviveBotWhenSummoned == 2 || (sPlayerbotAIConfig->reviveBotWhenSummoned == 1 && !master->IsInCombat()); + if (bot->isDead() && revive) { bot->ResurrectPlayer(1.0f, false); botAI->TellMasterNoFacing("I live, again!");