Add config options for the new summon conditions

This commit is contained in:
Revision
2024-07-11 23:46:59 +02:00
parent 321ce4ed8f
commit 7309d8f3c9
4 changed files with 35 additions and 20 deletions

View File

@@ -273,6 +273,9 @@ bool PlayerbotAIConfig::Initialize()
equipmentPersistence = sConfigMgr->GetOption<bool>("AiPlayerbot.EquipmentPersistence", false);
equipmentPersistenceLevel = sConfigMgr->GetOption<int32>("AiPlayerbot.EquipmentPersistenceLevel", 80);
groupInvitationPermission = sConfigMgr->GetOption<int32>("AiPlayerbot.GroupInvitationPermission", 1);
allowSummonInCombat = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowSummonInCombat", true);
allowSummonWhenMasterIsDead = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowSummonWhenMasterIsDead", true);
allowSummonWhenBotIsDead = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowSummonWhenBotIsDead", true);
botReviveWhenSummon = sConfigMgr->GetOption<int>("AiPlayerbot.BotReviveWhenSummon", 1);
botRepairWhenSummon = sConfigMgr->GetOption<bool>("AiPlayerbot.BotRepairWhenSummon", true);
autoInitOnly = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoInitOnly", false);

View File

@@ -214,6 +214,9 @@ class PlayerbotAIConfig
bool equipmentPersistence;
int32 equipmentPersistenceLevel;
int32 groupInvitationPermission;
bool allowSummonInCombat;
bool allowSummonWhenMasterIsDead;
bool allowSummonWhenBotIsDead;
int32 botReviveWhenSummon;
bool botRepairWhenSummon;
bool autoInitOnly;

View File

@@ -179,28 +179,25 @@ bool SummonAction::Teleport(Player* summoner, Player* player)
if (sPlayerbotAIConfig->botRepairWhenSummon) // .conf option to repair bot gear when summoned 0 = off, 1 = on
bot->DurabilityRepairAll(false, 1.0f, false);
if (sPlayerbotAIConfig->botReviveWhenSummon < 2)
if (master->IsInCombat() && !sPlayerbotAIConfig->allowSummonInCombat)
{
if (master->IsInCombat())
{
botAI->TellError("You cannot summon me while you're in combat");
return false;
}
if (!master->IsAlive())
{
botAI->TellError("You cannot summon me while you're dead");
return false;
}
if (bot->isDead() && !bot->HasPlayerFlag(PLAYER_FLAGS_GHOST))
{
botAI->TellError("You cannot summon me while I'm dead, you need to release my spirit first");
return false;
}
botAI->TellError("You cannot summon me while you're in combat");
return false;
}
if (sPlayerbotAIConfig->botReviveWhenSummon > 0 && bot->isDead())
if (!master->IsAlive() && !sPlayerbotAIConfig->allowSummonWhenMasterIsDead)
{
botAI->TellError("You cannot summon me while you're dead");
return false;
}
if (bot->isDead() && !bot->HasPlayerFlag(PLAYER_FLAGS_GHOST) && !sPlayerbotAIConfig->allowSummonWhenBotIsDead)
{
botAI->TellError("You cannot summon me while I'm dead, you need to release my spirit first");
return false;
}
if (sPlayerbotAIConfig->botReviveWhenSummon == 2 || (sPlayerbotAIConfig->botReviveWhenSummon == 1 && !master->IsInCombat() && master->IsAlive()))
{
bot->ResurrectPlayer(1.0f, false);
botAI->TellMasterNoFacing("I live, again!");