mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Add config options for the new summon conditions
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -214,6 +214,9 @@ class PlayerbotAIConfig
|
||||
bool equipmentPersistence;
|
||||
int32 equipmentPersistenceLevel;
|
||||
int32 groupInvitationPermission;
|
||||
bool allowSummonInCombat;
|
||||
bool allowSummonWhenMasterIsDead;
|
||||
bool allowSummonWhenBotIsDead;
|
||||
int32 botReviveWhenSummon;
|
||||
bool botRepairWhenSummon;
|
||||
bool autoInitOnly;
|
||||
|
||||
@@ -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!");
|
||||
|
||||
Reference in New Issue
Block a user