Properly stop attacking after player leaves ffa area (like Gurubashi Arena)
Port From (https://github.com/TrinityCore/TrinityCore/commit/4380fe2751869e7a011d51ee9449e8723b00067f)
This commit is contained in:
@@ -110,9 +110,14 @@ namespace Game.Entities
|
|||||||
m_areaUpdateId = newArea;
|
m_areaUpdateId = newArea;
|
||||||
|
|
||||||
AreaTableRecord area = CliDB.AreaTableStorage.LookupByKey(newArea);
|
AreaTableRecord area = CliDB.AreaTableStorage.LookupByKey(newArea);
|
||||||
|
bool oldFFAPvPArea = pvpInfo.IsInFFAPvPArea;
|
||||||
pvpInfo.IsInFFAPvPArea = area != null && area.Flags[0].HasAnyFlag(AreaFlags.Arena);
|
pvpInfo.IsInFFAPvPArea = area != null && area.Flags[0].HasAnyFlag(AreaFlags.Arena);
|
||||||
UpdatePvPState(true);
|
UpdatePvPState(true);
|
||||||
|
|
||||||
|
// check if we were in ffa arena and we left
|
||||||
|
if (oldFFAPvPArea && !pvpInfo.IsInFFAPvPArea)
|
||||||
|
ValidateAttackersAndOwnTarget();
|
||||||
|
|
||||||
PhasingHandler.OnAreaChange(this);
|
PhasingHandler.OnAreaChange(this);
|
||||||
UpdateAreaDependentAuras(newArea);
|
UpdateAreaDependentAuras(newArea);
|
||||||
|
|
||||||
|
|||||||
@@ -225,6 +225,24 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ValidateAttackersAndOwnTarget()
|
||||||
|
{
|
||||||
|
// iterate attackers
|
||||||
|
List<Unit> toRemove = new List<Unit>();
|
||||||
|
foreach (Unit attacker in getAttackers())
|
||||||
|
if (!attacker.IsValidAttackTarget(this))
|
||||||
|
toRemove.Add(attacker);
|
||||||
|
|
||||||
|
foreach (Unit attacker in toRemove)
|
||||||
|
attacker.AttackStop();
|
||||||
|
|
||||||
|
// remove our own victim
|
||||||
|
Unit victim = GetVictim();
|
||||||
|
if (victim != null)
|
||||||
|
if (!IsValidAttackTarget(victim))
|
||||||
|
AttackStop();
|
||||||
|
}
|
||||||
|
|
||||||
public void CombatStop(bool includingCast = false)
|
public void CombatStop(bool includingCast = false)
|
||||||
{
|
{
|
||||||
if (includingCast && IsNonMeleeSpellCast(false))
|
if (includingCast && IsNonMeleeSpellCast(false))
|
||||||
|
|||||||
Reference in New Issue
Block a user