mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-15 12:42:43 -04:00
Properly stop attacking after player leaves ffa area (like Gurubashi Arena) (#18952)
This commit is contained in:
@@ -7060,9 +7060,14 @@ void Player::UpdateArea(uint32 newArea)
|
||||
m_areaUpdateId = newArea;
|
||||
|
||||
AreaTableEntry const* area = sAreaTableStore.LookupEntry(newArea);
|
||||
bool oldFFAPvPArea = pvpInfo.IsInFFAPvPArea;
|
||||
pvpInfo.IsInFFAPvPArea = area && (area->flags & AREA_FLAG_ARENA);
|
||||
UpdatePvPState(true);
|
||||
|
||||
// check if we were in ffa arena and we left
|
||||
if (oldFFAPvPArea && !pvpInfo.IsInFFAPvPArea)
|
||||
ValidateAttackersAndOwnTarget();
|
||||
|
||||
UpdateAreaDependentAuras(newArea);
|
||||
|
||||
// previously this was in UpdateZone (but after UpdateArea) so nothing will break
|
||||
|
||||
@@ -5874,6 +5874,24 @@ bool Unit::AttackStop()
|
||||
return true;
|
||||
}
|
||||
|
||||
void Unit::ValidateAttackersAndOwnTarget()
|
||||
{
|
||||
// iterate attackers
|
||||
UnitVector toRemove;
|
||||
AttackerSet const& attackers = getAttackers();
|
||||
for (Unit* attacker : attackers)
|
||||
if (!attacker->IsValidAttackTarget(this))
|
||||
toRemove.push_back(attacker);
|
||||
|
||||
for (Unit* attacker : toRemove)
|
||||
attacker->AttackStop();
|
||||
|
||||
// remove our own victim
|
||||
if (Unit* victim = GetVictim())
|
||||
if (!IsValidAttackTarget(victim))
|
||||
AttackStop();
|
||||
}
|
||||
|
||||
void Unit::CombatStop(bool includingCast)
|
||||
{
|
||||
if (includingCast && IsNonMeleeSpellCast(false))
|
||||
|
||||
@@ -1264,6 +1264,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
public:
|
||||
typedef std::set<Unit*> AttackerSet;
|
||||
typedef std::set<Unit*> ControlList;
|
||||
typedef std::vector<Unit*> UnitVector;
|
||||
|
||||
typedef std::multimap<uint32, Aura*> AuraMap;
|
||||
typedef std::pair<AuraMap::const_iterator, AuraMap::const_iterator> AuraMapBounds;
|
||||
@@ -1340,6 +1341,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
return m_attacking;
|
||||
}
|
||||
|
||||
void ValidateAttackersAndOwnTarget();
|
||||
void CombatStop(bool includingCast = false);
|
||||
void CombatStopWithPets(bool includingCast = false);
|
||||
void StopAttackFaction(uint32 faction_id);
|
||||
|
||||
Reference in New Issue
Block a user