private static bool GetFloorZ( Map map, int x, int y, out int z ) { LandTile lt = map.Tiles.GetLandTile(x, y); if ( IsFloor( lt.ID ) && map.CanFit( x, y, lt.Z, 16, false, false ) ) { z = lt.Z; return true; } StaticTile[] tiles = map.Tiles.GetStaticTiles(x, y); for ( int i = 0; i < tiles.Length; ++i ) { StaticTile t = tiles[i]; ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue]; if ( IsStaticFloor( t.ID ) && map.CanFit( x, y, t.Z + (id.Surface ? id.CalcHeight : 0), 16, false, false ) ) { z = t.Z + (id.Surface ? id.CalcHeight : 0); return true; } } z = 0; return false; }
public static AddonFitResult CouldFit( Point3D p, Map map, Mobile from, ref BaseHouse house ) { if ( !map.CanFit( p.X, p.Y, p.Z, 20, false, true, true ) ) return AddonFitResult.Blocked; else if ( !BaseAddon.CheckHouse( from, p, map, 20, ref house ) ) return AddonFitResult.NotInHouse; else return CheckDoors( p, 20, house ); }
public static int GetSpawnerZ( int x, int y, Map map ) { int z = map.GetAverageZ( x, y ); if ( map.CanFit( x, y, z, 16, false, false ) ) return z; for ( int i = 1; i <= 20; ++i ) { if ( map.CanFit( x, y, z + i, 16, false, false ) ) return z + i; if ( map.CanFit( x, y, z - i, 16, false, false ) ) return z - i; } return z; }
public bool CouldFit( IPoint3D p, Map map ) { if ( !map.CanFit( p.X, p.Y, p.Z, this.ItemData.Height ) ) return false; if ( this.ItemID == 0x232C ) return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // North wall else return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // West wall }
public bool CouldFit( IPoint3D p, Map map ) { if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) ) return false; if ( FacingSouth ) return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall else return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall }
public bool CouldFit( IPoint3D p, Map map ) { if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) ) return false; if ( Type == StoneFaceTrapType.NorthWestWall ) return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ) && BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // north and west wall else if ( Type == StoneFaceTrapType.NorthWall ) return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall else if ( Type == StoneFaceTrapType.WestWall ) return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall return false; }
public virtual bool CouldFit( IPoint3D p, Map map ) { Point3D point = new Point3D( p.X, p.Y, p.Z ); if ( map == null || !map.CanFit( point, 20 ) ) return false; BaseHouse house = BaseHouse.FindHouseAt( point, map, 20 ); if ( house == null ) return false; AddonFitResult result = CharacterStatueTarget.CheckDoors( point, 20, house ); if ( result == AddonFitResult.Valid ) return true; return false; }
public AddonFitResult CouldFit( IPoint3D p, Map map, Mobile from, ref List<BaseHouse> houses ) { if ( PlayerGovernmentSystem.IsAtCity( this ) ) return AddonFitResult.Valid; if ( Deleted ) return AddonFitResult.Blocked; if ( houses == null ) houses = new List<BaseHouse>(); foreach ( AddonComponent c in m_Components ) { Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); if ( !map.CanFit( p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, ( c.Z == 0 ) ) ) { //World.Broadcast(1154, true, "Blocked"); return AddonFitResult.Blocked; } else if ( !CheckHouse( from, p3D, map, c.ItemData.Height, ref houses ) ) { //World.Broadcast(1154, true, "Not in House"); return AddonFitResult.NotInHouse; } if ( c.NeedsWall ) { Point3D wall = c.WallPosition; if ( !IsWall( p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map ) ) return AddonFitResult.NoWall; } } foreach ( BaseHouse house in houses ) { ArrayList doors = house.Doors; for ( int i = 0; i < doors.Count; ++i ) { BaseDoor door = doors[i] as BaseDoor; if ( door != null && door.Open ) return AddonFitResult.DoorsNotClosed; Point3D doorLoc = door.GetWorldLocation(); int doorHeight = door.ItemData.CalcHeight; foreach ( AddonComponent c in m_Components ) { Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); int addonHeight = c.ItemData.CalcHeight; if ( Utility.InRange( doorLoc, addonLoc, 1 ) && (addonLoc.Z == doorLoc.Z || ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z)) ) return AddonFitResult.DoorTooClose; } } } return AddonFitResult.Valid; }
public static bool AdjustField( ref Point3D p, Map map, int height, bool mobsBlock ) { if( map == null ) return false; for( int offset = 0; offset < 10; ++offset ) { Point3D loc = new Point3D( p.X, p.Y, p.Z - offset ); if( map.CanFit( loc, height, true, mobsBlock ) ) { p = loc; return true; } } return false; }
public virtual AddonFitResult CouldFit( bool blocking, IPoint3D p, Map map, Mobile from, ref ArrayList houseList ) { if ( Deleted ) return AddonFitResult.Blocked; ArrayList houses = new ArrayList(); foreach ( AddonComponent c in m_Components ) { Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); CanFitFlags flags = CanFitFlags.checkMobiles; if (c.Z == 0) flags |= CanFitFlags.requireSurface; if ( !map.CanFit( p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, flags ) ) return AddonFitResult.Blocked; else if ( !CheckHouse( from, p3D, map, c.ItemData.Height, houses ) ) return AddonFitResult.NotInHouse; } foreach ( BaseHouse house in houses ) { ArrayList doors = house.Doors; for ( int i = 0; i < doors.Count; ++i ) { BaseDoor door = doors[i] as BaseDoor; if ( door != null && door.Open ) return AddonFitResult.DoorsNotClosed; Point3D doorLoc = door.GetWorldLocation(); int doorHeight = door.ItemData.CalcHeight; foreach ( AddonComponent c in m_Components ) { Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); int addonHeight = c.ItemData.CalcHeight; if ( Utility.InRange( doorLoc, addonLoc, 1 ) && (addonLoc.Z == doorLoc.Z || ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z)) ) if (blocking == true) return AddonFitResult.DoorTooClose; } } } houseList = houses; return AddonFitResult.Valid; }
public virtual void Explode( Mobile from, Point3D loc, Map map ) { if ( Deleted || map == null ) return; Consume(); // Check if any other players are using this potion for ( int i = 0; i < m_Users.Count; i ++ ) { ThrowTarget targ = m_Users[ i ].Target as ThrowTarget; if ( targ != null && targ.Potion == this ) Target.Cancel( from ); } // Effects Effects.PlaySound( loc, map, 0x20C ); for ( int i = -2; i <= 2; i ++ ) { for ( int j = -2; j <= 2; j ++ ) { Point3D p = new Point3D( loc.X + i, loc.Y + j, loc.Z ); if ( map.CanFit( p, 12, true, false ) && from.InLOS( p ) ) new InternalItem( from, p, map, MinDamage, MaxDamage ); } } }
public virtual void BlastEffect( Point3D p, Map map ) { if ( map.CanFit( p, 12, true, false ) ) Effects.SendLocationEffect( p, map, 0x376A, 4, 9 ); }
public virtual AddonFitResult CouldFit( IPoint3D p, Map map, Mobile from, ref BaseHouse house ) { if ( Deleted ) return AddonFitResult.Blocked; foreach ( AddonComponent c in m_Components ) { Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); if ( !map.CanFit( p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, ( c.Z == 0 ) ) ) return AddonFitResult.Blocked; else if ( !CheckHouse( from, p3D, map, c.ItemData.Height, ref house ) ) return AddonFitResult.NotInHouse; if ( c.NeedsWall ) { Point3D wall = c.WallPosition; if ( !IsWall( p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map ) ) return AddonFitResult.NoWall; } } ArrayList doors = house.Doors; for ( int i = 0; i < doors.Count; ++i ) { BaseDoor door = doors[i] as BaseDoor; Point3D doorLoc = door.GetWorldLocation(); int doorHeight = door.ItemData.CalcHeight; foreach ( AddonComponent c in m_Components ) { Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); int addonHeight = c.ItemData.CalcHeight; if ( Utility.InRange( doorLoc, addonLoc, 1 ) && (addonLoc.Z == doorLoc.Z || ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z)) ) return AddonFitResult.DoorTooClose; } } return AddonFitResult.Valid; }
public static bool IsValidLandLocation( Point3D p, Map map ) { return map.CanFit( p.X, p.Y, p.Z, 16, false, false ); }
public static void EffectLine( Point3D start, Point3D end, Map map ) { if( start.Equals( end ) ) return; int difX = Math.Abs( start.X - end.X ); int difY = Math.Abs( start.Y - end.Y ); int x = start.X; int y = start.Y; int avgX = (int) Math.Round( difY != 0 ? difX / (double) difY : 0 ); int avgY = (int) Math.Round( difX != 0 ? difY / (double) difX : 0 ); while ( x != end.X && y != end.Y ) { Point3D p = new Point3D( x, y, start.Z ); if ( map.CanFit( p, 12, true, false ) ) Effects.SendLocationEffect( p, map, 0x376A, 4, 9 ); if ( avgX <= 0 ) { if ( x < end.X ) x += 1; else if ( x > end.X ) x -= 1; avgX = (int) Math.Round( difY != 0 ? difX / (double) difY : 0 ); } if ( avgY <= 0 ) { if ( y < end.Y ) y += 1; else if ( y > end.Y ) y -= 1; avgY = (int) Math.Round( difX != 0 ? difY / (double) difX : 0 ); } avgX -= 1; avgY -= 1; } }
public static bool AdjustField(ref Point3D p, Map map, int height, bool mobsBlock, bool ignoreDeadMobiles) { if ( map == null ) return false; for ( int offset = 0; offset < 10; ++offset ) { Point3D loc = new Point3D( p.X, p.Y, p.Z - offset ); CanFitFlags flags = CanFitFlags.checkBlocksFit | CanFitFlags.requireSurface; if (mobsBlock) flags |= CanFitFlags.checkMobiles; if (ignoreDeadMobiles) flags |= CanFitFlags.ignoreDeadMobiles; if ( map.CanFit( loc, height, flags ) ) { p = loc; return true; } } return false; }
public override AddonFitResult CouldFit(bool blocking, IPoint3D p, Map map, Mobile from, ref System.Collections.ArrayList houseList) { // rewritten, because we don't use the component list if (Deleted) return AddonFitResult.Blocked; ArrayList houses = new ArrayList(); if (!map.CanFit(p.X, p.Y, p.Z, m_Door.ItemData.Height)) return AddonFitResult.Blocked; else if ( !CheckHouse( from, new Point3D(p), map, m_Door.ItemData.Height, houses ) ) return AddonFitResult.NotInHouse; foreach ( BaseHouse house in houses ) { ArrayList doors = house.Doors; for ( int i = 0; i < doors.Count; ++i ) { BaseDoor door = doors[i] as BaseDoor; if ( door != null && door.Open ) return AddonFitResult.DoorsNotClosed; } } houseList = houses; return AddonFitResult.Valid; }
public static AddonFitResult CouldFit( Point3D p, Map map, Mobile from, ref BaseHouse house ) { ArrayList houses = new ArrayList(); if ( house != null ) houses.Add( house ); if ( !map.CanFit( p.X, p.Y, p.Z, 20, true, true, true ) ) return AddonFitResult.Blocked; else if ( !BaseAddon.CheckHouse( from, p, map, 20, houses ) ) return AddonFitResult.NotInHouse; else return CheckDoors( p, 20, house ); }
public AddonFitResult CouldFit(IPoint3D p, Map map, Mobile from, ref List<BaseHouse> houses) { if (Deleted) return AddonFitResult.Blocked; Point3D p3D = new Point3D(p); if (!map.CanFit(p3D.X, p3D.Y, p3D.Z, 0, false, true, true)) return AddonFitResult.Blocked; else if (!CheckHouse(from, p3D, map, 0, ref houses)) return AddonFitResult.NotInHouse; if (houses != null) { foreach (BaseHouse house in houses) { ArrayList doors = house.Doors; for (int i = 0; i < doors.Count; ++i) { BaseDoor door = (BaseDoor)doors[i]; if (door != null && door.Open) return AddonFitResult.DoorsNotClosed; Point3D doorLoc = door.GetWorldLocation(); int doorHeight = door.ItemData.CalcHeight; if (Utility.InRange(doorLoc, p3D, 1) && (p3D.Z == doorLoc.Z || (p3D.Z > doorLoc.Z && (doorLoc.Z + doorHeight) > p3D.Z))) return AddonFitResult.DoorTooClose; } } } return AddonFitResult.Valid; }
public static bool IsValidWater( Map map, int x, int y, int z ) { if ( !Region.Find( new Point3D( x, y, z ), map ).AllowSpawn() || !map.CanFit( x, y, z, 16, false, true, false ) ) return false; LandTile landTile = map.Tiles.GetLandTile( x, y ); if ( landTile.Z == z && ( TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Wet ) != 0 ) return true; StaticTile[] staticTiles = map.Tiles.GetStaticTiles( x, y, true ); for ( int i = 0; i < staticTiles.Length; ++i ) { StaticTile staticTile = staticTiles[i]; if ( staticTile.Z == z && ( TileData.ItemTable[staticTile.ID & TileData.MaxItemValue].Flags & TileFlag.Wet ) != 0 ) return true; } return false; }
public AddonFitResult CouldFit( IPoint3D p, Map map, Mobile from, ref ArrayList houseList ) { if ( Deleted ) { return AddonFitResult.Blocked; } ArrayList houses = new ArrayList(); foreach ( AddonComponent c in m_Components ) { Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); if ( !map.CanFit( p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, ( c.Z == 0 ) ) ) { return AddonFitResult.Blocked; } else if ( !CheckHouse( from, p3D, map, c.ItemData.Height, houses ) ) { return AddonFitResult.NotInHouse; } if ( c.NeedsWall ) { Point3D wall = c.WallPosition; if ( !IsWall( p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map ) ) { return AddonFitResult.NoWall; } } } foreach ( IHouse house in houses ) { ArrayList doors = house.Doors; for ( int i = 0; i < doors.Count; ++i ) { BaseDoor door = doors[i] as BaseDoor; if ( door != null && door.Open ) { return AddonFitResult.DoorsNotClosed; } Point3D doorLoc = door.GetWorldLocation(); int doorHeight = door.ItemData.CalcHeight; foreach ( AddonComponent c in m_Components ) { Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); int addonHeight = c.ItemData.CalcHeight; if ( doorLoc.InRange( addonLoc, 1 ) && ( addonLoc.Z == doorLoc.Z || ( ( addonLoc.Z + addonHeight ) > doorLoc.Z && ( doorLoc.Z + doorHeight ) > addonLoc.Z ) ) ) return AddonFitResult.DoorTooClose; } } } houseList = houses; return AddonFitResult.Valid; }