public override bool Equals(object obj) { //Check for null and compare run-time types. if (obj == null || GetType() != obj.GetType()) { return(false); } else { C_WoWObject p = (C_WoWObject)obj; return(Guid == p.Guid); } }
internal static bool TestCollision(C_WoWObject obj) { if (obj.CollisionResult && obj.Distance <= obj.InteractRange) { return(true); } if (!obj._collisionWaitTimer.IsFinished && (obj.Distance > 30f || obj.CollisionWaitTimer.TimeLeft.TotalMilliseconds > 750)) { return(obj.CollisionResult); } var result = GameWorld.TraceLine(Character.Player.TraceLinePosition, obj.Location, TraceLineHitFlags.DoodadCollision); obj.CollisionResult = result; obj.CollisionWaitTimer.Reset(); return(result); }
internal static bool TestLineOfSight(C_WoWObject obj) { if (obj.LineofsightResult && obj.Distance <= obj.InteractRange) { return(true); } if (!obj._lineofSightWaitTimer.IsFinished && (obj.Distance > 30f || obj.LineofSightWaitTimer.TimeLeft.TotalMilliseconds > 750)) { return(obj.LineofsightResult); } var neededFacing = WoWMathHelper.CalculateNeededFacing(Character.Player.Location, obj.Location); var testPoints = new List <WoWPoint> { WoWMathHelper.GetPointAt(obj.Location, obj.InteractRange, neededFacing - 3.141593f, 0f), WoWMathHelper.GetPointAt(obj.Location, obj.InteractRange, neededFacing - 2.356194f, 0f), WoWMathHelper.GetPointAt(obj.Location, obj.InteractRange, neededFacing - 1.570796f, 0f), WoWMathHelper.GetPointAt(obj.Location, obj.InteractRange, neededFacing - 0.7853982f, 0f), WoWMathHelper.GetPointAt(obj.Location, obj.InteractRange, neededFacing, 0f), WoWMathHelper.GetPointAt(obj.Location, obj.InteractRange, neededFacing + 3.141593f, 0f), WoWMathHelper.GetPointAt(obj.Location, obj.InteractRange, neededFacing + 2.356194f, 0f), WoWMathHelper.GetPointAt(obj.Location, obj.InteractRange, neededFacing + 1.570796f, 0f), WoWMathHelper.GetPointAt(obj.Location, obj.InteractRange, neededFacing + 0.7853982f, 0f) }; foreach (var testPoint in testPoints) { if (GameWorld.IsInLineOfSight(Character.Player.TraceLinePosition, testPoint.Add(0f, 0f, 1.24f))) { obj.LineofsightResult = true; obj._lineofsightPoint = testPoint; break; } } obj.LineofSightWaitTimer.Reset(); return(obj.LineofsightResult); }
public bool IsBehindObject(C_WoWObject obj) { return(WoWMathHelper.IsBehind(Location, obj.Location, obj.Rotation, 3.141593f)); }