Fixes crash with AreaTriggers
This commit is contained in:
@@ -1555,7 +1555,7 @@ namespace Game.Entities
|
||||
public override ObjectGuid GetOwnerGUID() { return GetCasterGuid(); }
|
||||
public ObjectGuid GetCasterGuid() { return m_areaTriggerData.Caster; }
|
||||
|
||||
public bool HasSplines() { return !_spline.Empty(); }
|
||||
public bool HasSplines() { return _spline != null && !_spline.Empty(); }
|
||||
public Spline<float> GetSpline() { return _spline; }
|
||||
|
||||
bool HasOrbit() { return m_areaTriggerData.PathData.Is<AreaTriggerOrbit>(); }
|
||||
|
||||
@@ -353,15 +353,14 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public class VariantUpdateField(int blockBit, int bit, params Type[] types)
|
||||
public class VariantUpdateField(int blockBit, int bit)
|
||||
{
|
||||
public object _value;
|
||||
Type[] _types = types;
|
||||
|
||||
public int BlockBit = blockBit;
|
||||
public int Bit = bit;
|
||||
|
||||
public bool Is<T>() { return _types.Contains(typeof(T)); }
|
||||
public bool Is<T>() { return _value is T; }
|
||||
|
||||
public T Get<T>() where T : class, new()
|
||||
{
|
||||
@@ -466,7 +465,7 @@ namespace Game.Entities
|
||||
|
||||
public void ClearChangesMask(VariantUpdateField field)
|
||||
{
|
||||
if (typeof(IHasChangesMask).IsAssignableFrom(field._value.GetType()))
|
||||
if (field._value != null && typeof(IHasChangesMask).IsAssignableFrom(field._value.GetType()))
|
||||
((IHasChangesMask)field._value).ClearChangesMask();
|
||||
}
|
||||
|
||||
|
||||
@@ -856,7 +856,7 @@ namespace Game.Entities
|
||||
|
||||
public void RemoveAreaTrigger(AuraEffect aurEff)
|
||||
{
|
||||
foreach (AreaTrigger areaTrigger in m_areaTrigger)
|
||||
foreach (AreaTrigger areaTrigger in m_areaTrigger.ToList())
|
||||
{
|
||||
if (areaTrigger.GetAuraEffect() == aurEff)
|
||||
{
|
||||
@@ -868,7 +868,7 @@ namespace Game.Entities
|
||||
|
||||
public void RemoveAllAreaTriggers(AreaTriggerRemoveReason reason = AreaTriggerRemoveReason.Default)
|
||||
{
|
||||
foreach (AreaTrigger at in m_areaTrigger)
|
||||
foreach (AreaTrigger at in m_areaTrigger.ToList())
|
||||
{
|
||||
if (reason == AreaTriggerRemoveReason.UnitDespawn && at.GetTemplate().ActionSetFlags.HasFlag(AreaTriggerActionSetFlag.DontDespawnWithCreator))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user