diff --git a/Data/Decoration/Towns/InnExitDoors.cfg b/Data/Decoration/Towns/InnExitDoors.cfg
new file mode 100644
index 0000000..ab27b4e
--- /dev/null
+++ b/Data/Decoration/Towns/InnExitDoors.cfg
@@ -0,0 +1,2 @@
+InnExitDoor 1765
+7138 4075 0
diff --git a/Data/Locations/felucca.xml b/Data/Locations/felucca.xml
index 6d4594c..bb3b04c 100644
--- a/Data/Locations/felucca.xml
+++ b/Data/Locations/felucca.xml
@@ -1,11 +1,41 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -16,254 +46,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Scripts/Engines/InnRooms/InnDoor.cs b/Scripts/Engines/InnRooms/InnDoor.cs
index 38a4d13..dc6887b 100644
--- a/Scripts/Engines/InnRooms/InnDoor.cs
+++ b/Scripts/Engines/InnRooms/InnDoor.cs
@@ -134,8 +134,33 @@ namespace Server.Custom.InnRooms
private void TeleportToRoom(Mobile m)
{
+ Point3D dest = RoomLocation;
+
+ // Scans the void room (up to 12 tiles away from center) to find your physical exit door
+ if (RoomMap != null)
+ {
+ IPooledEnumerable eable = RoomMap.GetItemsInRange(RoomLocation, 12);
+ foreach (Item item in eable)
+ {
+ if (item is InnExitDoor)
+ {
+ dest = item.Location; // Teleports them exactly where you placed the exit!
+ break;
+ }
+ }
+ eable.Free();
+ }
+
+ // Save their exact spot in the tavern so the exit door knows where to return them
+ if (m is PlayerMobile)
+ {
+ PlayerMobile pm = (PlayerMobile)m;
+ pm.LastInnLocation = m.Location;
+ pm.LastInnMap = m.Map;
+ }
+
m.PlaySound(0x1EA);
- m.MoveToWorld(RoomLocation, RoomMap);
+ m.MoveToWorld(dest, RoomMap);
m.SendMessage(0x3B2, "You enter the inn room.");
}
@@ -187,6 +212,20 @@ namespace Server.Custom.InnRooms
}
m_House.Delete();
+ // Kick anyone currently inside the room back to the tavern door
+ List insideMobiles = m_House.GetMobiles();
+ foreach (Mobile m in insideMobiles)
+ {
+ if (m is PlayerMobile)
+ {
+ PlayerMobile pm = (PlayerMobile)m;
+ // Send them right back to this physical InnDoor in the town
+ pm.MoveToWorld(this.Location, this.Map);
+ pm.LastInnLocation = Point3D.Zero;
+ pm.LastInnMap = null;
+ pm.SendMessage(33, "The rent has expired and you have been evicted from the room.");
+ }
+ }
}
m_Renter = null;
diff --git a/Scripts/Engines/InnRooms/InnExitDoor.cs b/Scripts/Engines/InnRooms/InnExitDoor.cs
new file mode 100644
index 0000000..a0ae1d0
--- /dev/null
+++ b/Scripts/Engines/InnRooms/InnExitDoor.cs
@@ -0,0 +1,58 @@
+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(); }
+ }
+}
diff --git a/Scripts/Mobiles/PlayerMobile.cs b/Scripts/Mobiles/PlayerMobile.cs
index d37da4f..bce2753 100644
--- a/Scripts/Mobiles/PlayerMobile.cs
+++ b/Scripts/Mobiles/PlayerMobile.cs
@@ -201,6 +201,11 @@ namespace Server.Mobiles
private List m_AllFollowers;
private List m_RecentlyReported;
+ // -- Inn Room Start
+ private Point3D m_LastInnLocation;
+ private Map m_LastInnMap;
+ // -- Inn Room End
+
#region Getters & Setters
public List RecentlyReported
@@ -374,6 +379,22 @@ namespace Server.Mobiles
set { CandyCane.SetToothAche( this, value ); }
}
+ // -- Inn Room Start
+ [CommandProperty(AccessLevel.GameMaster)]
+ public Point3D LastInnLocation
+ {
+ get { return m_LastInnLocation; }
+ set { m_LastInnLocation = value; }
+ }
+
+ [CommandProperty(AccessLevel.GameMaster)]
+ public Map LastInnMap
+ {
+ get { return m_LastInnMap; }
+ set { m_LastInnMap = value; }
+ }
+ // -- Inn Room End
+
#endregion
#region PlayerFlags
@@ -3358,6 +3379,12 @@ namespace Server.Mobiles
switch ( version )
{
+ case 30:
+ {
+ m_LastInnLocation = reader.ReadPoint3D();
+ m_LastInnMap = reader.ReadMap();
+ goto case 29;
+ }
case 29:
{
if (reader.ReadBool())
@@ -3667,7 +3694,12 @@ namespace Server.Mobiles
base.Serialize( writer );
- writer.Write( (int) 29 ); // version
+ writer.Write( (int) 30 ); // version
+
+ // -- Inn Room Start
+ writer.Write(m_LastInnLocation);
+ writer.Write(m_LastInnMap);
+ // -- Inn Room End
if (m_StuckMenuUses != null)
{
@@ -5175,4 +5207,4 @@ namespace Server.Mobiles
m_AutoStabled.Clear();
}
}
-}
\ No newline at end of file
+}