58 lines
1.9 KiB
C#
58 lines
1.9 KiB
C#
using System;
|
|
using Server;
|
|
using Server.Mobiles;
|
|
|
|
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)
|
|
{
|
|
}
|
|
|
|
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;
|
|
|
|
// Checks if they entered through the town door to get their saved location
|
|
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.");
|
|
|
|
// Clears the return location so they can't exploit it
|
|
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 Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int)0); }
|
|
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); }
|
|
}
|
|
}
|