diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 85bc69070..b7c9434e9 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16391,7 +16391,7 @@ bool Unit::IsUnderLastManaUseEffect() const return getMSTimeDiff(m_lastManaUse, World::GetGameTimeMS()) < 5000; } -void Unit::SetContestedPvP(Player* attackedPlayer) +void Unit::SetContestedPvP(Player* attackedPlayer, bool lookForNearContestedGuards) { Player* player = GetCharmerOrOwnerPlayerOrPlayerItself(); @@ -16399,15 +16399,18 @@ void Unit::SetContestedPvP(Player* attackedPlayer) return; // check if there any guards that should care about the contested flag on player - std::list targets; - Acore::NearestVisibleDetectableContestedGuardUnitCheck u_check(this); - Acore::UnitListSearcher searcher(this, targets, u_check); - Cell::VisitAllObjects(this, searcher, MAX_AGGRO_RADIUS); - - // return if there are no contested guards found - if (!targets.size()) + if (lookForNearContestedGuards) { - return; + std::list targets; + Acore::NearestVisibleDetectableContestedGuardUnitCheck u_check(this); + Acore::UnitListSearcher searcher(this, targets, u_check); + Cell::VisitAllObjects(this, searcher, MAX_AGGRO_RADIUS); + + // return if there are no contested guards found + if (!targets.size()) + { + return; + } } player->SetContestedPvPTimer(30000); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 0b0ac246d..e05908e35 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2296,7 +2296,7 @@ public: void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; } [[nodiscard]] bool IsUnderLastManaUseEffect() const; - void SetContestedPvP(Player* attackedPlayer = nullptr); + void SetContestedPvP(Player* attackedPlayer = nullptr, bool lookForNearContestedGuards = true); uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const; float CalculateDefaultCoefficient(SpellInfo const* spellInfo, DamageEffectType damagetype) const; diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 2dd2fb415..4af1ca5ea 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -951,7 +951,9 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder) pCurrChar->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) - pCurrChar->SetContestedPvP(); + { + pCurrChar->SetContestedPvP(nullptr, false); + } // Apply at_login requests if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))