#W# Inn room size and price now set in inndoors.cfg.

This commit is contained in:
WarrentyExpired 2026-08-25 13:16:08 -04:00
parent 9415670556
commit 8f44a3fe50
8 changed files with 114 additions and 84 deletions

View file

@ -17,9 +17,13 @@ namespace Server.Custom.InnRooms
private Point3D m_RoomLocation;
private Map m_RoomMap;
private bool m_AutoRenew;
private int m_RentCost = 5000;
private bool m_AutoRenew;
private TimeSpan m_RentDuration = TimeSpan.FromDays(7);
private Rectangle2D m_RoomArea;
private int m_RentCost;
[CommandProperty(AccessLevel.GameMaster)]
public Rectangle2D RoomArea { get { return m_RoomArea; } set { m_RoomArea = value; } }
[CommandProperty(AccessLevel.GameMaster)]
public bool AutoRenew { get { return m_AutoRenew; } set { m_AutoRenew = value; } }
@ -47,10 +51,12 @@ namespace Server.Custom.InnRooms
}
[Constructable]
public InnDoor(int itemID) : base(itemID)
public InnDoor(int itemID, Rectangle2D roomArea, int rentCost) : base(itemID)
{
Movable = false;
Name = "A Vacant Inn Room";
m_RoomArea = roomArea;
m_RentCost = rentCost;
}
public InnDoor(Serial serial) : base(serial)
@ -102,7 +108,7 @@ namespace Server.Custom.InnRooms
m_AutoRenew = true;
Name = from.Name + "'s Inn Room";
m_House = new InnRoomHouse(from);
m_House = new InnRoomHouse(from, m_RoomArea);
Point3D buriedLocation = new Point3D(RoomLocation.X, RoomLocation.Y, RoomLocation.Z - 20);
m_House.MoveToWorld(buriedLocation, RoomMap);
@ -262,8 +268,11 @@ namespace Server.Custom.InnRooms
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)1);
writer.Write((int)3);
writer.Write(m_RentCost);
writer.Write(m_RoomArea);
writer.Write(m_AutoRenew);
writer.Write(m_Renter);
@ -278,6 +287,19 @@ namespace Server.Custom.InnRooms
base.Deserialize(reader);
int version = reader.ReadInt();
if (version >= 3)
{
m_RentCost = reader.ReadInt();
}
else
{
m_RentCost = 5000;
}
if (version >= 2)
{
m_RoomArea = reader.ReadRect2D();
}
if (version >= 1)
{
m_AutoRenew = reader.ReadBool();

View file

@ -6,9 +6,15 @@ namespace Server.Custom.InnRooms
{
public class InnRoomHouse : BaseHouse
{
private Rectangle2D m_CustomArea;
// Dynamically computes the relative coordinates for the core engine
public override Rectangle2D[] Area
{
get { return new Rectangle2D[] { new Rectangle2D(-5, -5, 10, 10) }; }
get
{
return new Rectangle2D[] { new Rectangle2D(m_CustomArea.Start.X - this.X, m_CustomArea.Start.Y - this.Y, m_CustomArea.Width, m_CustomArea.Height) };
}
}
public override Point3D BaseBanLocation
@ -16,58 +22,37 @@ namespace Server.Custom.InnRooms
get { return new Point3D(this.X, this.Y - 5, this.Z + 20); }
}
// --- THE STORAGE FIXES ---
// 1. Negate the 20% Mondain's Legacy bonus so they get exactly 250 items!
public override double BonusStorageScalar { get { return 1.0; } }
// 2. Both base values are passed as 250
public InnRoomHouse(Mobile owner) : base(0xA26, owner, 250, 250)
// Added the Rectangle2D area parameter to the constructor
public InnRoomHouse(Mobile owner, Rectangle2D area) : base(0xA26, owner, 250, 250)
{
RestrictDecay = true;
// Force the initial properties to 250
m_CustomArea = area;
MaxLockDowns = 250;
MaxSecures = 250;
// Stretches the internal physical footprint to match your .cfg
Components.Resize(area.Width, area.Height);
Components.Add(0x520, area.Width - 1, area.Height - 1, -5);
}
public InnRoomHouse(Serial serial) : base(serial)
{
}
// The absolute maximum number of floor items
public override int GetAosMaxLockdowns()
{
return 250;
}
// The absolute maximum number of total items (chests + floor items + inside chests)
public override int GetAosMaxSecures()
{
return 250;
}
// -------------------------
public override int GetAosMaxLockdowns() { return 250; }
public override int GetAosMaxSecures() { return 250; }
public override bool IsInside(Point3D p, int height)
{
if (Deleted)
return false;
int rx = p.X - this.X;
int ry = p.Y - this.Y;
bool inArea = false;
foreach (Rectangle2D rect in Area)
{
if (rect.Contains(new Point2D(rx, ry)))
{
inArea = true;
break;
}
}
if (!inArea)
// Absolute map bounds check ensures exact precision and stops bleeding!
if (!m_CustomArea.Contains(new Point2D(p.X, p.Y)))
return false;
if (p.Z >= this.Z && (p.Z + height) <= this.Z + 40)
@ -79,13 +64,28 @@ namespace Server.Custom.InnRooms
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
writer.Write((int)1); // Version bumped to 1
writer.Write(m_CustomArea);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
if (version >= 1)
{
m_CustomArea = reader.ReadRect2D();
}
else
{
// Safety net for existing rooms using the old hardcoded offsets
m_CustomArea = new Rectangle2D(this.X - 5, this.Y - 5, 6, 5);
}
// Restores the stretched footprint on server restart
Components.Resize(m_CustomArea.Width, m_CustomArea.Height);
Components.Add(0x520, m_CustomArea.Width - 1, m_CustomArea.Height - 1, -5);
}
}
}