From ead4a2fe56a66374c1ae252fc02c4c630d7f0efc Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Mon, 31 Jul 2023 12:47:24 +0800 Subject: [PATCH] fix IsInPvpProhibitedZone --- src/strategy/actions/ChooseTargetActions.cpp | 2 +- src/strategy/actions/RpgSubActions.cpp | 2 +- src/strategy/values/EnemyPlayerValue.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/strategy/actions/ChooseTargetActions.cpp b/src/strategy/actions/ChooseTargetActions.cpp index 0157ae70..b3d08f20 100644 --- a/src/strategy/actions/ChooseTargetActions.cpp +++ b/src/strategy/actions/ChooseTargetActions.cpp @@ -16,7 +16,7 @@ bool AttackEnemyPlayerAction::isUseful() if (bot->HasAura(23333) || bot->HasAura(23335) || bot->HasAura(34976)) return false; - return !sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetAreaId()); + return !sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId()); } bool AttackEnemyFlagCarrierAction::isUseful() diff --git a/src/strategy/actions/RpgSubActions.cpp b/src/strategy/actions/RpgSubActions.cpp index 8304c800..e7f5e382 100644 --- a/src/strategy/actions/RpgSubActions.cpp +++ b/src/strategy/actions/RpgSubActions.cpp @@ -459,7 +459,7 @@ bool RpgTradeUsefulAction::Execute(Event event) bool RpgDuelAction::isUseful() { // do not offer duel in non pvp areas - if (sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetAreaId())) + if (sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId())) return false; // Players can only fight a duel with each other outside (=not inside dungeons and not in capital cities) diff --git a/src/strategy/values/EnemyPlayerValue.cpp b/src/strategy/values/EnemyPlayerValue.cpp index abc579b1..7dbb9202 100644 --- a/src/strategy/values/EnemyPlayerValue.cpp +++ b/src/strategy/values/EnemyPlayerValue.cpp @@ -10,7 +10,7 @@ bool NearestEnemyPlayersValue::AcceptUnit(Unit* unit) { bool inCannon = botAI->IsInVehicle(false, true); Player* enemy = dynamic_cast(unit); - if (enemy && botAI->IsOpposing(enemy) && enemy->IsPvP() && !sPlayerbotAIConfig->IsInPvpProhibitedZone(enemy->GetAreaId()) && + if (enemy && botAI->IsOpposing(enemy) && enemy->IsPvP() && !sPlayerbotAIConfig->IsInPvpProhibitedZone(enemy->GetZoneId()) && !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))) return true;