128 lines
3.8 KiB
C#
128 lines
3.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Server;
|
|
using Server.Mobiles;
|
|
using Server.Multis;
|
|
using Server.ContextMenus;
|
|
|
|
namespace Server.Custom.InnRooms
|
|
{
|
|
public class InnExitDoor : Item
|
|
{
|
|
[Constructable]
|
|
public InnExitDoor() : this(0x6E5)
|
|
{
|
|
}
|
|
|
|
[Constructable]
|
|
public InnExitDoor(int itemID) : base(itemID)
|
|
{
|
|
Movable = false;
|
|
Name = "Room Exit";
|
|
}
|
|
|
|
public InnExitDoor(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
public bool ForceEviction
|
|
{
|
|
get { return false; }
|
|
set
|
|
{
|
|
if (value)
|
|
{
|
|
foreach (Item item in World.Items.Values)
|
|
{
|
|
if (item is InnRoomHouse)
|
|
{
|
|
InnRoomHouse house = (InnRoomHouse)item;
|
|
if (house.Map == this.Map && house.IsInside(this.Location, 16))
|
|
{
|
|
house.Evict();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void OnDoubleClick(Mobile from)
|
|
{
|
|
if (!from.InRange(GetWorldLocation(), 2))
|
|
{
|
|
from.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, 1019045);
|
|
return;
|
|
}
|
|
|
|
if (from is PlayerMobile)
|
|
{
|
|
PlayerMobile pm = (PlayerMobile)from;
|
|
|
|
if (pm.LastInnMap != null && pm.LastInnMap != Map.Internal && pm.LastInnLocation != Point3D.Zero)
|
|
{
|
|
pm.PlaySound(0x1EA);
|
|
pm.MoveToWorld(pm.LastInnLocation, pm.LastInnMap);
|
|
pm.SendMessage(68, "You step out of your room and back into the inn.");
|
|
|
|
pm.LastInnLocation = Point3D.Zero;
|
|
pm.LastInnMap = null;
|
|
}
|
|
else
|
|
{
|
|
from.SendMessage(33, "Your return location was lost. Please use a runebook or page a GameMaster.");
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
|
{
|
|
base.GetContextMenuEntries(from, list);
|
|
|
|
if (from.Alive && from is PlayerMobile)
|
|
{
|
|
List<BaseHouse> houses = BaseHouse.GetHouses(from);
|
|
foreach (BaseHouse h in houses)
|
|
{
|
|
if (h is InnRoomHouse && h.IsInside(this.Location, 16))
|
|
{
|
|
// Cliloc 6171 displays as "Open House Menu"
|
|
list.Add(new ManageRoomEntry(from, (InnRoomHouse)h));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private class ManageRoomEntry : ContextMenuEntry
|
|
{
|
|
private Mobile m_From;
|
|
private InnRoomHouse m_House;
|
|
|
|
public ManageRoomEntry(Mobile from, InnRoomHouse house) : base(1063490, 2)
|
|
{
|
|
m_From = from;
|
|
m_House = house;
|
|
}
|
|
|
|
public override void OnClick()
|
|
{
|
|
m_From.SendGump(new InnRoomManagementGump((PlayerMobile)m_From, m_House));
|
|
}
|
|
}
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
writer.Write((int)0);
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
int version = reader.ReadInt();
|
|
}
|
|
}
|
|
}
|