public 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; 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 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, c.ItemData.Height)) { 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))) { return(AddonFitResult.DoorTooClose); } } } } houseList = houses; return(AddonFitResult.Valid); }
public static AddonFitResult CouldFit(Item item, IPoint3D p, Map map, Mobile from, ref BaseHouse house) { Point3D p3D = new Point3D(p); if (!map.CanFit(p3D.X, p3D.Y, p3D.Z, item.ItemData.Height, false, true, (item.Z == 0))) { return(AddonFitResult.Blocked); } else if (!BaseAddon.CheckHouse(from, p3D, map, item.ItemData.Height, ref house)) { return(AddonFitResult.NotInHouse); } else if (house is HouseFoundation) { return(AddonFitResult.BadHouse); } if (house != null) { System.Collections.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; int height = item.ItemData.CalcHeight; if (Utility.InRange(doorLoc, p3D, 1) && (p3D.Z == doorLoc.Z || ((p3D.Z + height) > doorLoc.Z && (doorLoc.Z + doorHeight) > p3D.Z))) { return(AddonFitResult.DoorTooClose); } } } return(AddonFitResult.Valid); }
public virtual AddonFitResult CouldFit(IPoint3D p, Map map, Mobile from, ref BaseHouse house, ref BaseGalleon boat) { if (this.Deleted) { return(AddonFitResult.Blocked); } foreach (AddonComponent c in this.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) && !CheckBoat(from, p3D, map, ref boat)) { 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); } } } if (house != null) { if (RestrictToClassicHouses && house is HouseFoundation) { return(AddonFitResult.BadHouse); } var 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 this.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 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, Math.Max(1, c.ItemData.Height), false, true, (c.Z == 0), true)) { return(AddonFitResult.Blocked); } if (!CheckHouse(from, p3D, map, c.ItemData.Height, ref house)) { return(AddonFitResult.NotInHouse); } if (from != null) { var fromHouse = BaseHouse.FindHouseAt(from.Location, map, 16); if (fromHouse == null || house != fromHouse) { return(AddonFitResult.OwnerNotInHouse); } } 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); } } if (house != null) { bool frontStairs; if (house.IsStairArea(p3D, out frontStairs) && frontStairs) { return(AddonFitResult.FoundationStairs); } } } if (house != null) { List <Item> 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); }
private int Verify( BaseDoor door ) { if( door.RequiredSkill > (int)(From.Skills.Tinkering.Value) ) return 1; if( door == null || door.HasLock == false ) return 1; if( From.Map != door.Map || !From.InRange( door.GetWorldLocation(), 1 ) ) return 1; if( !door.IsAccessibleTo( From ) ) return 1; if( door.Locked ) return 1; if( door.Open == false ) return 1; return 0; }
private string Message( BaseDoor door ) { if( door.RequiredSkill > (int)(From.Skills.Tinkering.Value) ) return "You have no idea how to work this lock."; if( door == null || door.HasLock == false ) return "This door doesn't have a lock."; if( From.Map != door.Map || !From.InRange( door.GetWorldLocation(), 1 ) ) return "That is too far away."; if( !door.IsAccessibleTo( From ) ) return "That is inaccessable."; if( door.Locked ) return "You must target an unlocked door."; if( door.Open == false ) return "You must target an open door."; return null; }
private int Verify( BaseDoor door ) { if (door is BaseHouseDoor) { BaseHouse house = ((BaseHouseDoor)door).FindHouse(); if (house != null) { if (!house.IsFriend(From)) return 1; } } if(door == null || door.HasLock) return 1; if(From.Map != door.Map || !From.InRange( door.GetWorldLocation(), 1 )) return 1; if(!door.IsAccessibleTo( From )) return 1; if(door.Locked) return 1; if(!door.Open) return 1; if (door.IsPublic) return 1; return 0; }
private string Message( BaseDoor door ) { if (door is BaseHouseDoor) { BaseHouse house = ((BaseHouseDoor)door).FindHouse(); if (house != null) { if (!house.IsFriend(From)) return "You do not have permission to modify this lock."; } } if( door == null || door.HasLock ) return "This door already has a lock."; if( From.Map != door.Map || !From.InRange( door.GetWorldLocation(), 1 ) ) return "That is too far away."; if( !door.IsAccessibleTo( From ) ) return "That is inaccessable."; if( door.Locked ) return "You must target an unlocked door."; if( !door.Open) return "You must target an open door."; if (door.IsPublic) return "You may not install locks on public buildings."; return null; }