#W# Move InnRoom folder to Item/Houses
This commit is contained in:
parent
eea0f9defb
commit
770b95bb64
7 changed files with 0 additions and 0 deletions
|
|
@ -1,204 +0,0 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Custom.StaticHousing
|
||||
{
|
||||
public class StaticHouseSign : Item
|
||||
{
|
||||
private Rectangle2D[] m_HouseAreas;
|
||||
private int m_MinZ;
|
||||
private int m_MaxZ;
|
||||
private int m_Price;
|
||||
private int m_CustomLockdowns;
|
||||
private int m_CustomSecures;
|
||||
|
||||
public Rectangle2D[] HouseAreas { get { return m_HouseAreas; } }
|
||||
public int MinZ { get { return m_MinZ; } }
|
||||
public int MaxZ { get { return m_MaxZ; } }
|
||||
public int Price { get { return m_Price; } }
|
||||
public int CustomLockdowns { get { return m_CustomLockdowns; } }
|
||||
public int CustomSecures { get { return m_CustomSecures; } }
|
||||
|
||||
[Constructable]
|
||||
public StaticHouseSign(int itemID, Rectangle2D[] areas, int minZ, int maxZ, int price, int locks, int secures) : base(itemID)
|
||||
{
|
||||
Name = "A Vacant House For Sale";
|
||||
Movable = false;
|
||||
|
||||
m_HouseAreas = areas;
|
||||
m_MinZ = minZ;
|
||||
m_MaxZ = maxZ;
|
||||
m_Price = price;
|
||||
m_CustomLockdowns = locks;
|
||||
m_CustomSecures = secures;
|
||||
}
|
||||
|
||||
public StaticHouseSign(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
list.Add(1060658, "Price\t{0} Gold", m_Price);
|
||||
list.Add(1060659, "Lockdowns\t{0}", m_CustomLockdowns);
|
||||
list.Add(1060660, "Secures\t{0}", m_CustomSecures);
|
||||
}
|
||||
|
||||
/*public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.InRange(GetWorldLocation(), 3))
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);
|
||||
return;
|
||||
}
|
||||
|
||||
if (from is PlayerMobile)
|
||||
{
|
||||
from.SendGump(new StaticPurchaseGump((PlayerMobile)from, this));
|
||||
}
|
||||
}*/
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.InRange(GetWorldLocation(), 3))
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);
|
||||
return;
|
||||
}
|
||||
|
||||
if (from is PlayerMobile)
|
||||
{
|
||||
if (BaseHouse.HasAccountHouse(from))
|
||||
{
|
||||
from.SendMessage(33, "You already own the maximum number of houses allowed on this account.");
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendGump(new StaticPurchaseGump((PlayerMobile)from, this));
|
||||
}
|
||||
}
|
||||
|
||||
public void Purchase(PlayerMobile pm)
|
||||
{
|
||||
if (Deleted) return;
|
||||
|
||||
if (Banker.Withdraw(pm, m_Price))
|
||||
{
|
||||
StaticHouse newHouse = new StaticHouse(pm, m_HouseAreas, m_MinZ, m_MaxZ, m_CustomLockdowns, m_CustomSecures, m_Price);
|
||||
|
||||
// 1. Move the house controller to the exact top-left corner of the property
|
||||
int minX = m_HouseAreas[0].Start.X;
|
||||
int minY = m_HouseAreas[0].Start.Y;
|
||||
foreach (Rectangle2D rect in m_HouseAreas)
|
||||
{
|
||||
if (rect.Start.X < minX) minX = rect.Start.X;
|
||||
if (rect.Start.Y < minY) minY = rect.Start.Y;
|
||||
}
|
||||
|
||||
Point3D houseLoc = new Point3D(minX, minY, m_MinZ);
|
||||
newHouse.MoveToWorld(houseLoc, this.Map);
|
||||
|
||||
// 2. Snap the brass House Sign back and match the orientation
|
||||
if (newHouse.Sign != null)
|
||||
{
|
||||
newHouse.Sign.Location = this.Location;
|
||||
|
||||
if (this.ItemID == 0xC0B)
|
||||
newHouse.Sign.ItemID = 0xBD1; // East Facing
|
||||
else
|
||||
newHouse.Sign.ItemID = 0xBD2; // North Facing
|
||||
}
|
||||
|
||||
// 3. Set the eviction drop point 1 step south of the sign
|
||||
newHouse.BanLocation = new Point3D(this.X, this.Y + 1, this.Z);
|
||||
|
||||
pm.PlaySound(0x249);
|
||||
pm.SendMessage(68, $"You have purchased this home for {m_Price} gold.");
|
||||
|
||||
// Destroy the "For Sale" sign now that the real house sign has spawned!
|
||||
this.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendMessage(33, $"You need {m_Price} gold in your bank to purchase this home.");
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)1); // Version bumped to 1 to support arrays!
|
||||
|
||||
writer.Write(m_HouseAreas.Length);
|
||||
for (int i = 0; i < m_HouseAreas.Length; i++)
|
||||
writer.Write(m_HouseAreas[i]);
|
||||
|
||||
writer.Write(m_MinZ);
|
||||
writer.Write(m_MaxZ);
|
||||
writer.Write(m_Price);
|
||||
writer.Write(m_CustomLockdowns);
|
||||
writer.Write(m_CustomSecures);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (version >= 1)
|
||||
{
|
||||
int count = reader.ReadInt();
|
||||
m_HouseAreas = new Rectangle2D[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
m_HouseAreas[i] = reader.ReadRect2D();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Backwards compatibility for the original houses
|
||||
m_HouseAreas = new Rectangle2D[] { reader.ReadRect2D() };
|
||||
}
|
||||
|
||||
m_MinZ = reader.ReadInt();
|
||||
m_MaxZ = reader.ReadInt();
|
||||
m_Price = reader.ReadInt();
|
||||
m_CustomLockdowns = reader.ReadInt();
|
||||
m_CustomSecures = reader.ReadInt();
|
||||
}
|
||||
|
||||
private class StaticPurchaseGump : Gump
|
||||
{
|
||||
private PlayerMobile m_Player;
|
||||
private StaticHouseSign m_Sign;
|
||||
|
||||
public StaticPurchaseGump(PlayerMobile pm, StaticHouseSign sign) : base(200, 200)
|
||||
{
|
||||
m_Player = pm;
|
||||
m_Sign = sign;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 300, 150, 9270);
|
||||
AddHtml(0, 15, 300, 20, "<CENTER><BASEFONT COLOR=#FFFFFF>Purchase Property?</BASEFONT></CENTER>", false, false);
|
||||
AddHtml(20, 50, 260, 40, $"<BASEFONT COLOR=#FFFFFF>This will deduct {sign.Price} gold from your bank box.</BASEFONT>", false, false);
|
||||
|
||||
AddButton(40, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtml(75, 100, 100, 20, "<BASEFONT COLOR=#FFFFFF>Confirm</BASEFONT>", false, false);
|
||||
|
||||
AddButton(160, 100, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtml(195, 100, 100, 20, "<BASEFONT COLOR=#FFFFFF>Cancel</BASEFONT>", false, false);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1 && m_Sign != null && !m_Sign.Deleted)
|
||||
{
|
||||
m_Sign.Purchase(m_Player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue