mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 01:59:09 +00:00
fix(Core/Entities): contested guards attacking after bg/recent pvp (#7518)
* fix(Core/Entities): contested guards attacking after bg/recent pvp * fix(Core/Entities): contested guards attacking after bg/recent pvp * Update Unit.cpp * fix(Core/Entities): contested guards attacking after bg/recent pvp * fix(Core/Entities): contested guards attacking after bg/recent pvp * Update Unit.cpp
This commit is contained in:
@@ -16393,9 +16393,21 @@ void Unit::SetContestedPvP(Player* attackedPlayer)
|
||||
{
|
||||
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
|
||||
if (!player || (attackedPlayer && (attackedPlayer == player || (player->duel && player->duel->opponent == attackedPlayer))))
|
||||
if (!player || ((attackedPlayer && (attackedPlayer == player || (player->duel && player->duel->opponent == attackedPlayer))) || player->InBattleground()))
|
||||
return;
|
||||
|
||||
// check if there any guards that should care about the contested flag on player
|
||||
std::list<Unit*> targets;
|
||||
Acore::NearestVisibleDetectableContestedGuardUnitCheck u_check(this);
|
||||
Acore::UnitListSearcher<Acore::NearestVisibleDetectableContestedGuardUnitCheck> 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);
|
||||
if (!player->HasUnitState(UNIT_STATE_ATTACK_PLAYER))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user