public WallSafeGump(PlayerMobile pm, WallSafe safe) : base(50, 50) { User = pm; Safe = safe; AddGumpLayout(); }
public override void OnDoubleClick(Mobile m) { if (IsChildOf(m.Backpack)) { m.BeginTarget(8, false, Targeting.TargetFlags.None, (from, targeted) => { if (targeted is IPoint3D) { IPoint3D p = targeted as IPoint3D; BaseHouse house = BaseHouse.FindHouseAt(new Point3D(p), m.Map, 16); if (house != null && BaseHouse.FindHouseAt(m) == house && house.IsCoOwner(m)) { Point3D pnt = new Point3D(p.X, p.Y, m.Z); bool northWall = BaseAddon.IsWall(pnt.X, pnt.Y - 1, pnt.Z, m.Map); bool westWall = BaseAddon.IsWall(pnt.X - 1, pnt.Y, pnt.Z, m.Map); if (northWall && westWall) { switch (from.Direction & Direction.Mask) { case Direction.North: case Direction.South: northWall = true; westWall = false; break; case Direction.East: case Direction.West: northWall = false; westWall = true; break; default: from.SendMessage("Turn to face the wall on which to place the safe."); return; } } int itemID = 0; if (northWall) { itemID = 0x8B8F; } else if (westWall) { itemID = 0x8B90; } else { m.SendLocalizedMessage(500268); // This object needs to be mounted on something. } if (itemID != 0) { Item safe = new WallSafe(m); safe.MoveToWorld(pnt, m.Map); safe.ItemID = itemID; house.Addons[safe] = m; Delete(); } } else { m.SendLocalizedMessage(500274); // You can only place this in a house that you own! } } }); } else { m.SendLocalizedMessage(1080058); // This must be in your backpack to use it. } }
public override void OnDoubleClick(Mobile m) { if (IsChildOf(m.Backpack)) { m.BeginTarget(8, false, Server.Targeting.TargetFlags.None, (from, targeted) => { if (targeted is IPoint3D) { IPoint3D p = targeted as IPoint3D; BaseHouse house = BaseHouse.FindHouseAt(new Point3D(p), m.Map, 16); if (house != null && BaseHouse.FindHouseAt(m) == house && house.IsCoOwner(m)) { Point3D pnt = new Point3D(p.X, p.Y, m.Z); bool northWall = BaseAddon.IsWall(pnt.X, pnt.Y - 1, pnt.Z, m.Map); bool westWall = BaseAddon.IsWall(pnt.X - 1, pnt.Y, pnt.Z, m.Map); if (northWall && westWall) { switch (from.Direction & Direction.Mask) { case Direction.North: case Direction.South: northWall = true; westWall = false; break; case Direction.East: case Direction.West: northWall = false; westWall = true; break; default: from.SendMessage("Turn to face the wall on which to place the safe."); return; } } int itemID = 0; if (northWall) itemID = 0x8B8F; else if(westWall) itemID = 0x8B90; else m.SendLocalizedMessage(500268); // This object needs to be mounted on something. if (itemID != 0) { Item safe = new WallSafe(m); safe.MoveToWorld(pnt, m.Map); safe.ItemID = itemID; house.Addons.Add(safe); Delete(); } } else m.SendLocalizedMessage(500274); // You can only place this in a house that you own! } }); } else m.SendLocalizedMessage(1080058); // This must be in your backpack to use it. }