public static Point3D GetSurfaceTop(this IPoint3D p, Map map, bool items = true) { if (map == null || map == Map.Internal) { return(Clone3D(p)); } var point = ToPoint3D(p, Region.MaxZ); var o = map.GetTopSurface(point); if (o != null) { if (o is LandTile) { var t = (LandTile)o; point = ToPoint3D(point, t.Z + t.Height); } else if (o is StaticTile) { var t = (StaticTile)o; point = ToPoint3D(point, t.Z + TileData.ItemTable[t.ID].CalcHeight); } else if (o is Item && items) { var t = (Item)o; point = ToPoint3D(point, t.Z + t.ItemData.CalcHeight); } } return(point); }
public static Point3D GetSurfaceTop(this IPoint3D p, Map map, bool items = true) { if (map == null || map == Map.Internal) { return(p.ToPoint3D()); } Point3D point = Point3D.Zero; if (p is Item) { point = p.Clone3D(0, 0, ((Item)p).ItemData.Height); } else if (p is Mobile) { point = p.Clone3D(0, 0, 20); } /*else * { * point = p.Clone3D(0, 0, 5); * }*/ object o = map.GetTopSurface(point); if (o != null && o != p) { if (o is LandTile) { point.Z = ((LandTile)o).Z + ((LandTile)o).Height + 1; } else if (o is StaticTile) { point.Z = ((StaticTile)o).Z + ((StaticTile)o).Height + 1; } else if (o is Item && items) { point = ((Item)o).GetSurfaceTop(); } } return(point); }
public static Point3D GetSurfaceTop(this IPoint3D p, Map map, bool items = true) { if (map == null || map == Map.Internal) { return(Clone3D(p)); } Point3D point; if (p is Item) { point = Clone3D(p, 0, 0, ((Item)p).ItemData.Height); } else if (p is Mobile) { point = Clone3D(p, 0, 0, 20); } else { point = Clone3D(p, 0, 0, 1); } object o = map.GetTopSurface(point); if (o != null) { if (o is LandTile) { point = ToPoint3D(point, ((LandTile)o).Z + ((LandTile)o).Height + 1); } else if (o is StaticTile) { point = ToPoint3D(point, ((StaticTile)o).Z + ((StaticTile)o).Height + 1); } else if (o is Item && items) { point = ((Item)o).GetSurfaceTop(); } } return(point); }
public static Point3D GetSurfaceTop(this IPoint3D p, Map map, bool items = true) { if (map == null || map == Map.Internal) { return Clone3D(p); } Point3D point; if (p is Item) { point = Clone3D(p, 0, 0, ((Item)p).ItemData.Height); } else if (p is Mobile) { point = Clone3D(p, 0, 0, 20); } else { point = Clone3D(p, 0, 0, 1); } object o = map.GetTopSurface(point); if (o != null) { if (o is LandTile) { point = ToPoint3D(point, ((LandTile)o).Z + ((LandTile)o).Height + 1); } else if (o is StaticTile) { point = ToPoint3D(point, ((StaticTile)o).Z + ((StaticTile)o).Height + 1); } else if (o is Item && items) { point = ((Item)o).GetSurfaceTop(); } } return point; }
public static Point3D GetSurfaceTop(this IPoint3D p, Map map, bool items = true) { if (map == null || map == Map.Internal) { return Clone3D(p); } var point = ToPoint3D(p, Region.MaxZ); var o = map.GetTopSurface(point); if (o != null) { if (o is LandTile) { var t = (LandTile)o; point = ToPoint3D(point, t.Z + t.Height); } else if (o is StaticTile) { var t = (StaticTile)o; point = ToPoint3D(point, t.Z + TileData.ItemTable[t.ID].CalcHeight); } else if (o is Item && items) { var t = (Item)o; point = ToPoint3D(point, t.Z + t.ItemData.CalcHeight); } } return point; }
public static Point3D GetSurfaceTop(this IPoint3D p, Map map, bool items = true) { if (map == null || map == Map.Internal) { return p.ToPoint3D(); } Point3D point = Point3D.Zero; if (p is Item) { point = p.Clone3D(0, 0, ((Item)p).ItemData.Height); } else if (p is Mobile) { point = p.Clone3D(0, 0, 20); } /*else { point = p.Clone3D(0, 0, 5); }*/ object o = map.GetTopSurface(point); if (o != null && o != p) { if (o is LandTile) { point.Z = ((LandTile)o).Z + ((LandTile)o).Height + 1; } else if (o is StaticTile) { point.Z = ((StaticTile)o).Z + ((StaticTile)o).Height + 1; } else if (o is Item && items) { point = ((Item)o).GetSurfaceTop(); } } return point; }