private static void DeleteDoor(BaseDoor d) { if (d == null) { return; } if (d.Link != null) { DeleteDoor(d.Link); } d.Delete(); }
public override void OnClick() { Container c = m_From.Backpack; Gold t = new Gold(value); if (c.TryDropItem(m_From, t, true)) { m_Gate.Delete(); m_From.SendMessage("The item disolves and gives you a refund"); } else { t.Delete(); m_From.SendMessage("For some reason, the refund didn't work! Please page a GM"); } }
protected void ConvertDoor(BaseDoor door, uint k) { if (!Owned) { return; } if (door is Server.Gumps.ISecurable) { Console.WriteLine("Convert Door 1"); door.Locked = false; c_House.Doors.Add(door); door.KeyValue = k; m_HouseKeyVal = k; return; } door.Open = false; GenericHouseDoor newdoor = new GenericHouseDoor(0, door.ClosedID, door.OpenedSound, door.ClosedSound); newdoor.Offset = door.Offset; newdoor.ClosedID = door.ClosedID; newdoor.OpenedID = door.OpenedID; newdoor.Location = door.Location; newdoor.Hue = door.Hue; newdoor.GuildID = door.GuildID; newdoor.Map = door.Map; door.Delete(); /* Don't link doors * foreach( Item inneritem in newdoor.GetItemsInRange( 1 ) ) * if ( inneritem is BaseDoor && inneritem != newdoor && inneritem.Z == newdoor.Z ) * { * ((BaseDoor)inneritem).Link = newdoor; * newdoor.Link = (BaseDoor)inneritem; * } */ Console.WriteLine("Convert Door 2"); c_House.Doors.Add(newdoor); }
protected void ConvertDoor(BaseDoor door) { if (!Owned) { return; } if (door is Server.Gumps.ISecurable) { Console.WriteLine("Convert Door 1"); door.Locked = false; c_House.Doors.Add(door); return; } door.Open = false; GenericHouseDoor newdoor = new GenericHouseDoor((DoorFacing)0, door.ClosedID, door.OpenedSound, door.ClosedSound); newdoor.Offset = door.Offset; newdoor.ClosedID = door.ClosedID; newdoor.OpenedID = door.OpenedID; newdoor.Location = door.Location; newdoor.Map = door.Map; door.Delete(); foreach (Item inneritem in newdoor.GetItemsInRange(1)) { if (inneritem is BaseDoor && inneritem != newdoor && inneritem.Z == newdoor.Z) { ((BaseDoor)inneritem).Link = newdoor; newdoor.Link = (BaseDoor)inneritem; } } Console.WriteLine("Convert Door 2"); c_House.Doors.Add(newdoor); }
protected void ConvertDoor(BaseDoor door) { if (!Owned) { return; } if (door is ISecurable) { door.Locked = false; c_House.Doors.Add(door); return; } door.Open = false; var newdoor = new GenericHouseDoor(0, door.ClosedID, door.OpenedSound, door.ClosedSound) { Offset = door.Offset, ClosedID = door.ClosedID, OpenedID = door.OpenedID, Location = door.Location, Map = door.Map }; door.Delete(); foreach ( Item inneritem in newdoor.GetItemsInRange(1) .Where(inneritem => inneritem is BaseDoor && inneritem != newdoor && inneritem.Z == newdoor.Z)) { ((BaseDoor)inneritem).Link = newdoor; newdoor.Link = (BaseDoor)inneritem; } c_House.Doors.Add(newdoor); }
public static void Generate(Rectangle2D region) { for (int rx = 0; rx < region.Width; ++rx) { for (int ry = 0; ry < region.Height; ++ry) { int vx = rx + region.X; int vy = ry + region.Y; StaticTile[] tiles = m_Map.Tiles.GetStaticTiles(vx, vy); for (int i = 0; i < tiles.Length; ++i) { StaticTile tile = tiles[i]; int id = tile.ID; int z = tile.Z; if (IsWestFrame(id)) { if (IsEastFrame(vx + 2, vy, z)) { AddDoor(vx + 1, vy, z, DoorFacing.WestCW); } else if (IsEastFrame(vx + 3, vy, z)) { BaseDoor first = AddDoor(vx + 1, vy, z, DoorFacing.WestCW); BaseDoor second = AddDoor(vx + 2, vy, z, DoorFacing.EastCCW); if (first != null && second != null) { first.Link = second; second.Link = first; } else { first?.Delete(); second?.Delete(); } } } else if (IsNorthFrame(id)) { if (IsSouthFrame(vx, vy + 2, z)) { AddDoor(vx, vy + 1, z, DoorFacing.SouthCW); } else if (IsSouthFrame(vx, vy + 3, z)) { BaseDoor first = AddDoor(vx, vy + 1, z, DoorFacing.NorthCCW); BaseDoor second = AddDoor(vx, vy + 2, z, DoorFacing.SouthCW); if (first != null && second != null) { first.Link = second; second.Link = first; } else { first?.Delete(); second?.Delete(); } } } } } } }