[Configuration] Make more options for ReviveBotWhenSummoned

This commit is contained in:
Yunfan Li
2024-07-24 21:13:32 +08:00
parent ed80744891
commit 1f7ab72b04
4 changed files with 6 additions and 5 deletions

View File

@@ -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)

View File

@@ -279,7 +279,7 @@ bool PlayerbotAIConfig::Initialize()
allowSummonInCombat = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowSummonInCombat", true);
allowSummonWhenMasterIsDead = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowSummonWhenMasterIsDead", true);
allowSummonWhenBotIsDead = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowSummonWhenBotIsDead", true);
reviveBotWhenSummoned = sConfigMgr->GetOption<bool>("AiPlayerbot.ReviveBotWhenSummoned", true);
reviveBotWhenSummoned = sConfigMgr->GetOption<int32>("AiPlayerbot.ReviveBotWhenSummoned", 1);
botRepairWhenSummon = sConfigMgr->GetOption<bool>("AiPlayerbot.BotRepairWhenSummon", true);
autoInitOnly = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoInitOnly", false);
autoInitEquipLevelLimitRatio = sConfigMgr->GetOption<float>("AiPlayerbot.AutoInitEquipLevelLimitRatio", 1.0);

View File

@@ -220,7 +220,7 @@ class PlayerbotAIConfig
bool allowSummonInCombat;
bool allowSummonWhenMasterIsDead;
bool allowSummonWhenBotIsDead;
bool reviveBotWhenSummoned;
int reviveBotWhenSummoned;
bool botRepairWhenSummon;
bool autoInitOnly;
float autoInitEquipLevelLimitRatio;

View File

@@ -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!");