Core/SAI: Added SAI support for new areatriggers
Port From (https://github.com/TrinityCore/TrinityCore/commit/875fd4107f29c00f148ea77c6ff6d49f7ca92b76)
This commit is contained in:
@@ -969,7 +969,7 @@ namespace Game.Entities
|
||||
base.ClearUpdateMask(remove);
|
||||
}
|
||||
|
||||
AreaTriggerAI GetAI() { return _ai; }
|
||||
public T GetAI<T>() where T : AreaTriggerAI { return (T)_ai; }
|
||||
|
||||
public bool IsServerSide() { return _areaTriggerTemplate.Id.IsServerSide; }
|
||||
|
||||
|
||||
@@ -192,6 +192,12 @@ namespace Game.Entities
|
||||
public uint Id;
|
||||
public bool IsServerSide;
|
||||
|
||||
public AreaTriggerId(uint id, bool isServerSide)
|
||||
{
|
||||
Id = id;
|
||||
IsServerSide = isServerSide;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Id.GetHashCode() ^ IsServerSide.GetHashCode();
|
||||
|
||||
@@ -1540,7 +1540,7 @@ namespace Game.Entities
|
||||
|
||||
public override bool CanAlwaysSee(WorldObject obj)
|
||||
{
|
||||
if (IsAIEnabled && GetAI().CanSeeAlways(obj))
|
||||
if (IsAIEnabled && GetAI<CreatureAI>().CanSeeAlways(obj))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -3038,12 +3038,12 @@ namespace Game.Entities
|
||||
public bool IsInEvadeMode() { return HasUnitState(UnitState.Evade); }
|
||||
public bool IsEvadingAttacks() { return IsInEvadeMode() || CanNotReachTarget(); }
|
||||
|
||||
public new CreatureAI GetAI()
|
||||
public override CreatureAI GetAI()
|
||||
{
|
||||
return (CreatureAI)i_AI;
|
||||
}
|
||||
|
||||
public T GetAI<T>() where T : UnitAI
|
||||
public T GetAI<T>() where T : CreatureAI
|
||||
{
|
||||
return (T)i_AI;
|
||||
}
|
||||
|
||||
@@ -2779,6 +2779,8 @@ namespace Game.Entities
|
||||
|
||||
public GameObjectAI GetAI() { return m_AI; }
|
||||
|
||||
public T GetAI<T>() where T : GameObjectAI { return (T)m_AI; }
|
||||
|
||||
public uint GetDisplayId() { return m_gameObjectData.DisplayID; }
|
||||
|
||||
public uint GetFaction() { return m_gameObjectData.FactionTemplate; }
|
||||
|
||||
@@ -1112,7 +1112,7 @@ namespace Game.Entities
|
||||
return m_vehicle != null && m_vehicle == vehicle.GetVehicleKit();
|
||||
}
|
||||
|
||||
public UnitAI GetAI() { return i_AI; }
|
||||
public virtual UnitAI GetAI() { return i_AI; }
|
||||
public void SetAI(UnitAI newAI) { i_AI = newAI; }
|
||||
|
||||
public bool IsPossessing()
|
||||
|
||||
Reference in New Issue
Block a user