Pvp Prohibited Areas

This commit is contained in:
Yunfan Li
2023-10-28 19:22:58 +08:00
parent 917e55c92a
commit a28d096bef
6 changed files with 22 additions and 4 deletions

View File

@@ -311,7 +311,10 @@ AiPlayerbot.ProbTeleToBankers = 0.25
AiPlayerbot.RandomBotQuestItems = "6948,5175,5176,5177,5178,16309,12382,13704,11000" AiPlayerbot.RandomBotQuestItems = "6948,5175,5176,5177,5178,16309,12382,13704,11000"
# PvP Restricted Zones (bots don't pvp) # PvP Restricted Zones (bots don't pvp)
AiPlayerbot.PvpProhibitedZoneIds = "2255,656,2361,2362,2363,976,35,2268,3425,392,541,1446,3828,3712,3738,3565,3539,3623,4152,3988,4658,4284,4418,4436,4275,4323,4395,3703,33" AiPlayerbot.PvpProhibitedZoneIds = "2255,656,2361,2362,2363,976,35,2268,3425,392,541,1446,3828,3712,3738,3565,3539,3623,4152,3988,4658,4284,4418,4436,4275,4323,4395,3703" # 33(stranglethorn vale),440(tanaris)
# PvP Restricted Areas (bots don't pvp)
AiPlayerbot.PvpProhibitedAreaIds = "976,35"
# Spells every random bot will learn on randomize (54197 - cold weather flying) # Spells every random bot will learn on randomize (54197 - cold weather flying)
AiPlayerbot.RandomBotSpellIds = "54197" AiPlayerbot.RandomBotSpellIds = "54197"

View File

@@ -103,6 +103,8 @@ bool PlayerbotAIConfig::Initialize()
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotQuestItems", "6948,5175,5176,5177,5178,16309,12382,13704,11000"), randomBotQuestItems); LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotQuestItems", "6948,5175,5176,5177,5178,16309,12382,13704,11000"), randomBotQuestItems);
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotSpellIds", "54197"), randomBotSpellIds); LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotSpellIds", "54197"), randomBotSpellIds);
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.PvpProhibitedZoneIds", "2255,656,2361,2362,2363,976,35,2268,3425,392,541,1446,3828,3712,3738,3565,3539,3623,4152,3988,4658,4284,4418,4436,4275,4323,4395"), pvpProhibitedZoneIds); LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.PvpProhibitedZoneIds", "2255,656,2361,2362,2363,976,35,2268,3425,392,541,1446,3828,3712,3738,3565,3539,3623,4152,3988,4658,4284,4418,4436,4275,4323,4395"), pvpProhibitedZoneIds);
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.PvpProhibitedAreaIds", "976,35"), pvpProhibitedAreaIds);
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotQuestIds", "7848,3802,5505,6502,7761"), randomBotQuestIds); LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotQuestIds", "7848,3802,5505,6502,7761"), randomBotQuestIds);
botAutologin = sConfigMgr->GetOption<bool>("AiPlayerbot.BotAutologin", false); botAutologin = sConfigMgr->GetOption<bool>("AiPlayerbot.BotAutologin", false);
@@ -390,11 +392,21 @@ bool PlayerbotAIConfig::IsInRandomQuestItemList(uint32 id)
return find(randomBotQuestItems.begin(), randomBotQuestItems.end(), id) != randomBotQuestItems.end(); return find(randomBotQuestItems.begin(), randomBotQuestItems.end(), id) != randomBotQuestItems.end();
} }
bool PlayerbotAIConfig::IsPvpProhibited(uint32 zoneId, uint32 areaId)
{
return IsInPvpProhibitedZone(zoneId) || IsInPvpProhibitedArea(areaId);
}
bool PlayerbotAIConfig::IsInPvpProhibitedZone(uint32 id) bool PlayerbotAIConfig::IsInPvpProhibitedZone(uint32 id)
{ {
return find(pvpProhibitedZoneIds.begin(), pvpProhibitedZoneIds.end(), id) != pvpProhibitedZoneIds.end(); return find(pvpProhibitedZoneIds.begin(), pvpProhibitedZoneIds.end(), id) != pvpProhibitedZoneIds.end();
} }
bool PlayerbotAIConfig::IsInPvpProhibitedArea(uint32 id)
{
return find(pvpProhibitedAreaIds.begin(), pvpProhibitedAreaIds.end(), id) != pvpProhibitedAreaIds.end();
}
std::string const PlayerbotAIConfig::GetTimestampStr() std::string const PlayerbotAIConfig::GetTimestampStr()
{ {
time_t t = time(nullptr); time_t t = time(nullptr);

View File

@@ -35,7 +35,9 @@ class PlayerbotAIConfig
bool Initialize(); bool Initialize();
bool IsInRandomAccountList(uint32 id); bool IsInRandomAccountList(uint32 id);
bool IsInRandomQuestItemList(uint32 id); bool IsInRandomQuestItemList(uint32 id);
bool IsPvpProhibited(uint32 zoneId, uint32 areaId);
bool IsInPvpProhibitedZone(uint32 id); bool IsInPvpProhibitedZone(uint32 id);
bool IsInPvpProhibitedArea(uint32 id);
bool enabled; bool enabled;
bool allowGuildBots; bool allowGuildBots;
@@ -100,6 +102,7 @@ class PlayerbotAIConfig
bool deleteRandomBotGuilds; bool deleteRandomBotGuilds;
std::vector<uint32> randomBotGuilds; std::vector<uint32> randomBotGuilds;
std::vector<uint32> pvpProhibitedZoneIds; std::vector<uint32> pvpProhibitedZoneIds;
std::vector<uint32> pvpProhibitedAreaIds;
bool randombotsWalkingRPG; bool randombotsWalkingRPG;
bool randombotsWalkingRPGInDoors; bool randombotsWalkingRPGInDoors;

View File

@@ -16,7 +16,7 @@ bool AttackEnemyPlayerAction::isUseful()
if (bot->HasAura(23333) || bot->HasAura(23335) || bot->HasAura(34976)) if (bot->HasAura(23333) || bot->HasAura(23335) || bot->HasAura(34976))
return false; return false;
return !sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId()); return !sPlayerbotAIConfig->IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId());
} }
bool AttackEnemyFlagCarrierAction::isUseful() bool AttackEnemyFlagCarrierAction::isUseful()

View File

@@ -158,7 +158,7 @@ bool AttackersValue::IsPossibleTarget(Unit* attacker, Player* bot, float range)
!attacker->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && !attacker->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) &&
!attacker->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE) && !attacker->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE) &&
bot->CanSeeOrDetect(attacker) && bot->CanSeeOrDetect(attacker) &&
!(sPlayerbotAIConfig->IsInPvpProhibitedZone(attacker->GetZoneId()) && (attacker->GetGUID().IsPlayer() || attacker->GetGUID().IsPet())) && !(sPlayerbotAIConfig->IsPvpProhibited(attacker->GetZoneId(), attacker->GetAreaId()) && (attacker->GetGUID().IsPlayer() || attacker->GetGUID().IsPet())) &&
(!c || (!c->IsInEvadeMode() && ((!isMemberBotGroup && botAI->HasStrategy("attack tagged", BOT_STATE_NON_COMBAT)) || (!c || (!c->IsInEvadeMode() && ((!isMemberBotGroup && botAI->HasStrategy("attack tagged", BOT_STATE_NON_COMBAT)) ||
leaderHasThreat || (!c->hasLootRecipient() && (!c->GetVictim() || (c->GetVictim() && ((!c->GetVictim()->IsPlayer() || bot->IsInSameGroupWith(c->GetVictim()->ToPlayer())) || leaderHasThreat || (!c->hasLootRecipient() && (!c->GetVictim() || (c->GetVictim() && ((!c->GetVictim()->IsPlayer() || bot->IsInSameGroupWith(c->GetVictim()->ToPlayer())) ||
(botAI->GetMaster() && c->GetVictim() == botAI->GetMaster()))))) || c->isTappedBy(bot)))); (botAI->GetMaster() && c->GetVictim() == botAI->GetMaster()))))) || c->isTappedBy(bot))));

View File

@@ -10,7 +10,7 @@ bool NearestEnemyPlayersValue::AcceptUnit(Unit* unit)
{ {
bool inCannon = botAI->IsInVehicle(false, true); bool inCannon = botAI->IsInVehicle(false, true);
Player* enemy = dynamic_cast<Player*>(unit); Player* enemy = dynamic_cast<Player*>(unit);
if (enemy && botAI->IsOpposing(enemy) && enemy->IsPvP() && !sPlayerbotAIConfig->IsInPvpProhibitedZone(enemy->GetZoneId()) && if (enemy && botAI->IsOpposing(enemy) && enemy->IsPvP() && !sPlayerbotAIConfig->IsPvpProhibited(enemy->GetZoneId(), enemy->GetAreaId()) &&
!enemy->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NON_ATTACKABLE_2) && ((inCannon || !enemy->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))) && !enemy->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NON_ATTACKABLE_2) && ((inCannon || !enemy->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))) &&
/*!enemy->HasStealthAura() && !enemy->HasInvisibilityAura()*/ enemy->CanSeeOrDetect(bot) && !(enemy->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))) /*!enemy->HasStealthAura() && !enemy->HasInvisibilityAura()*/ enemy->CanSeeOrDetect(bot) && !(enemy->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)))
return true; return true;