Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

File diff suppressed because it is too large Load diff

View file

@ -28,34 +28,34 @@ namespace Server.Multis
Decaying
}
private static Rectangle2D[] m_BritWrap =
private static readonly Rectangle2D[] m_BritWrap =
{ new Rectangle2D(16, 16, 5120 - 32, 4096 - 32), new Rectangle2D(5136, 2320, 992, 1760) };
private static Rectangle2D[] m_IlshWrap = { new Rectangle2D(16, 16, 2304 - 32, 1600 - 32) };
private static Rectangle2D[] m_TokunoWrap = { new Rectangle2D(16, 16, 1448 - 32, 1448 - 32) };
private static readonly Rectangle2D[] m_IlshWrap = { new Rectangle2D(16, 16, 2304 - 32, 1600 - 32) };
private static readonly Rectangle2D[] m_TokunoWrap = { new Rectangle2D(16, 16, 1448 - 32, 1448 - 32) };
private static TimeSpan BoatDecayDelay = TimeSpan.FromDays(9.0);
private static readonly TimeSpan BoatDecayDelay = TimeSpan.FromDays(9.0);
private static TimeSpan SlowInterval = TimeSpan.FromSeconds(NewBoatMovement ? 0.50 : 0.75);
private static TimeSpan FastInterval = TimeSpan.FromSeconds(NewBoatMovement ? 0.25 : 0.75);
private static readonly TimeSpan SlowInterval = TimeSpan.FromSeconds(NewBoatMovement ? 0.50 : 0.75);
private static readonly TimeSpan FastInterval = TimeSpan.FromSeconds(NewBoatMovement ? 0.25 : 0.75);
private static int SlowSpeed = 1;
private static int FastSpeed = NewBoatMovement ? 1 : 3;
private static readonly int SlowSpeed = 1;
private static readonly int FastSpeed = NewBoatMovement ? 1 : 3;
private static TimeSpan SlowDriftInterval = TimeSpan.FromSeconds(NewBoatMovement ? 0.50 : 1.50);
private static TimeSpan FastDriftInterval = TimeSpan.FromSeconds(NewBoatMovement ? 0.25 : 0.75);
private static readonly TimeSpan SlowDriftInterval = TimeSpan.FromSeconds(NewBoatMovement ? 0.50 : 1.50);
private static readonly TimeSpan FastDriftInterval = TimeSpan.FromSeconds(NewBoatMovement ? 0.25 : 0.75);
private static int SlowDriftSpeed = 1;
private static int FastDriftSpeed = 1;
private static readonly int SlowDriftSpeed = 1;
private static readonly int FastDriftSpeed = 1;
private static Direction Forward = Direction.North;
private static Direction ForwardLeft = Direction.Up;
private static Direction ForwardRight = Direction.Right;
private static Direction Backward = Direction.South;
private static Direction BackwardLeft = Direction.Left;
private static Direction BackwardRight = Direction.Down;
private static Direction Left = Direction.West;
private static Direction Right = Direction.East;
private static readonly Direction Forward = Direction.North;
private static readonly Direction ForwardLeft = Direction.Up;
private static readonly Direction ForwardRight = Direction.Right;
private static readonly Direction Backward = Direction.South;
private static readonly Direction BackwardLeft = Direction.Left;
private static readonly Direction BackwardRight = Direction.Down;
private static readonly Direction Left = Direction.West;
private static readonly Direction Right = Direction.East;
private static Direction Port = Left;
private static Direction Starboard = Right;
@ -99,19 +99,19 @@ namespace Server.Multis
}
[CommandProperty(AccessLevel.GameMaster)]
public Hold Hold{ get; set; }
public Hold Hold { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public TillerMan TillerMan{ get; set; }
public TillerMan TillerMan { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Plank PPlank{ get; set; }
public Plank PPlank { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Plank SPlank{ get; set; }
public Plank SPlank { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Owner{ get; set; }
public Mobile Owner { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Direction Facing
@ -121,16 +121,16 @@ namespace Server.Multis
}
[CommandProperty(AccessLevel.GameMaster)]
public Direction Moving{ get; set; }
public Direction Moving { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool IsMoving => m_MoveTimer != null;
[CommandProperty(AccessLevel.GameMaster)]
public int Speed{ get; set; }
public int Speed { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool Anchored{ get; set; }
public bool Anchored { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string ShipName
@ -144,13 +144,13 @@ namespace Server.Multis
}
[CommandProperty(AccessLevel.GameMaster)]
public BoatOrder Order{ get; set; }
public BoatOrder Order { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public MapItem MapItem{ get; set; }
public MapItem MapItem { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int NextNavPoint{ get; set; }
public int NextNavPoint { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public DateTime TimeOfDecay
@ -201,7 +201,7 @@ namespace Server.Multis
public virtual BaseDockedBoat DockedBoat => null;
public static List<BaseBoat> Boats{ get; } = new List<BaseBoat>();
public static List<BaseBoat> Boats { get; } = new List<BaseBoat>();
/*
* Intervals:
@ -309,54 +309,54 @@ namespace Server.Multis
switch (version)
{
case 3:
{
MapItem = (MapItem)reader.ReadItem();
NextNavPoint = reader.ReadInt();
goto case 2;
}
case 2:
{
m_Facing = (Direction)reader.ReadInt();
goto case 1;
}
case 1:
{
m_DecayTime = reader.ReadDeltaTime();
goto case 0;
}
case 0:
{
if (version < 3)
NextNavPoint = -1;
if (version < 2)
{
if (ItemID == NorthID)
m_Facing = Direction.North;
else if (ItemID == SouthID)
m_Facing = Direction.South;
else if (ItemID == EastID)
m_Facing = Direction.East;
else if (ItemID == WestID)
m_Facing = Direction.West;
MapItem = (MapItem)reader.ReadItem();
NextNavPoint = reader.ReadInt();
goto case 2;
}
case 2:
{
m_Facing = (Direction)reader.ReadInt();
Owner = reader.ReadMobile();
PPlank = reader.ReadItem() as Plank;
SPlank = reader.ReadItem() as Plank;
TillerMan = reader.ReadItem() as TillerMan;
Hold = reader.ReadItem() as Hold;
Anchored = reader.ReadBool();
m_ShipName = reader.ReadString();
goto case 1;
}
case 1:
{
m_DecayTime = reader.ReadDeltaTime();
if (version < 1)
Refresh();
goto case 0;
}
case 0:
{
if (version < 3)
NextNavPoint = -1;
break;
}
if (version < 2)
{
if (ItemID == NorthID)
m_Facing = Direction.North;
else if (ItemID == SouthID)
m_Facing = Direction.South;
else if (ItemID == EastID)
m_Facing = Direction.East;
else if (ItemID == WestID)
m_Facing = Direction.West;
}
Owner = reader.ReadMobile();
PPlank = reader.ReadItem() as Plank;
SPlank = reader.ReadItem() as Plank;
TillerMan = reader.ReadItem() as TillerMan;
Hold = reader.ReadItem() as Hold;
Anchored = reader.ReadBool();
m_ShipName = reader.ReadString();
if (version < 1)
Refresh();
break;
}
}
Boats.Add(this);
@ -902,7 +902,7 @@ namespace Server.Multis
return false;
}
if (Map != Map.Trammel && Map != Map.Felucca || NextNavPoint < 0 || NextNavPoint >= MapItem.Pins.Count)
if ((Map != Map.Trammel && Map != Map.Felucca) || NextNavPoint < 0 || NextNavPoint >= MapItem.Pins.Count)
{
if (message)
TillerMan?.Say(1042551); // I don't see that navpoint, sir.
@ -1185,44 +1185,44 @@ namespace Server.Multis
MultiComponentList newComponents = MultiData.GetComponents(itemID);
for (int x = 0; x < newComponents.Width; ++x)
for (int y = 0; y < newComponents.Height; ++y)
{
int tx = p.X + newComponents.Min.X + x;
int ty = p.Y + newComponents.Min.Y + y;
if (newComponents.Tiles[x][y].Length == 0 || Contains(tx, ty))
continue;
LandTile landTile = map.Tiles.GetLandTile(tx, ty);
StaticTile[] tiles = map.Tiles.GetStaticTiles(tx, ty, true);
bool hasWater = landTile.Z == p.Z &&
(landTile.ID >= 168 && landTile.ID <= 171 || landTile.ID >= 310 && landTile.ID <= 311);
// int z = p.Z;
//int landZ = 0, landAvg = 0, landTop = 0;
//map.GetAverageZ( tx, ty, ref landZ, ref landAvg, ref landTop );
//if ( !landTile.Ignored && top > landZ && landTop > z )
// return false;
for (int i = 0; i < tiles.Length; ++i)
for (int y = 0; y < newComponents.Height; ++y)
{
StaticTile tile = tiles[i];
bool isWater = tile.ID >= 0x1796 && tile.ID <= 0x17B2;
int tx = p.X + newComponents.Min.X + x;
int ty = p.Y + newComponents.Min.Y + y;
if (tile.Z == p.Z && isWater)
hasWater = true;
else if (tile.Z >= p.Z && !isWater)
if (newComponents.Tiles[x][y].Length == 0 || Contains(tx, ty))
continue;
LandTile landTile = map.Tiles.GetLandTile(tx, ty);
StaticTile[] tiles = map.Tiles.GetStaticTiles(tx, ty, true);
bool hasWater = landTile.Z == p.Z &&
((landTile.ID >= 168 && landTile.ID <= 171) || (landTile.ID >= 310 && landTile.ID <= 311));
// int z = p.Z;
// int landZ = 0, landAvg = 0, landTop = 0;
// map.GetAverageZ( tx, ty, ref landZ, ref landAvg, ref landTop );
// if (!landTile.Ignored && top > landZ && landTop > z)
// return false;
for (int i = 0; i < tiles.Length; ++i)
{
StaticTile tile = tiles[i];
bool isWater = tile.ID >= 0x1796 && tile.ID <= 0x17B2;
if (tile.Z == p.Z && isWater)
hasWater = true;
else if (tile.Z >= p.Z && !isWater)
return false;
}
if (!hasWater)
return false;
}
if (!hasWater)
return false;
}
IPooledEnumerable<Item> eable = map.GetItemsInBounds(new Rectangle2D(p.X + newComponents.Min.X,
p.Y + newComponents.Min.Y, newComponents.Width, newComponents.Height));
@ -1234,8 +1234,8 @@ namespace Server.Multis
int x = item.X - p.X + newComponents.Min.X;
int y = item.Y - p.Y + newComponents.Min.Y;
return x >= 0 && x < newComponents.Width && y >= 0 && y < newComponents.Height &&
newComponents.Tiles[x][y].Length == 0 || Contains(item);
return (x >= 0 && x < newComponents.Width && y >= 0 && y < newComponents.Height &&
newComponents.Tiles[x][y].Length == 0) || Contains(item);
});
eable.Free();
@ -1259,10 +1259,10 @@ namespace Server.Multis
public override bool Contains(int x, int y) =>
base.Contains(x, y) ||
TillerMan?.X == x && y == TillerMan.Y ||
Hold?.X == x && Hold.Y == y ||
PPlank?.X == x && PPlank.Y == y ||
SPlank?.X == x && SPlank.Y == y;
(TillerMan?.X == x && y == TillerMan.Y) ||
(Hold?.X == x && Hold.Y == y) ||
(PPlank?.X == x && PPlank.Y == y) ||
(SPlank?.X == x && SPlank.Y == y);
public static bool IsValidLocation(Point3D p, Map map)
{
@ -1322,7 +1322,7 @@ namespace Server.Multis
return false;
}
else if (Map != Map.Trammel && Map != Map.Felucca || NextNavPoint < 0 || NextNavPoint >= MapItem.Pins.Count)
else if ((Map != Map.Trammel && Map != Map.Felucca) || NextNavPoint < 0 || NextNavPoint >= MapItem.Pins.Count)
{
if (message)
TillerMan?.Say(1042551); // I don't see that navpoint, sir.
@ -1535,8 +1535,7 @@ namespace Server.Multis
MultiComponentList mcl = Components;
foreach (IEntity o in map.GetObjectsInBounds(new Rectangle2D(X + mcl.Min.X, Y + mcl.Min.Y, mcl.Width, mcl.Height))
)
foreach (IEntity o in map.GetObjectsInBounds(new Rectangle2D(X + mcl.Min.X, Y + mcl.Min.Y, mcl.Width, mcl.Height)))
{
if (o == this || o is TillerMan || o is Hold || o is Plank)
continue;
@ -1657,7 +1656,7 @@ namespace Server.Multis
private class DecayTimer : Timer
{
private BaseBoat m_Boat;
private readonly BaseBoat m_Boat;
private int m_Count;
public DecayTimer(BaseBoat boat) : base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(5.0))
@ -1687,8 +1686,8 @@ namespace Server.Multis
private class TurnTimer : Timer
{
private BaseBoat m_Boat;
private int m_Offset;
private readonly BaseBoat m_Boat;
private readonly int m_Offset;
public TurnTimer(BaseBoat boat, int offset) : base(TimeSpan.FromSeconds(0.5))
{
@ -1707,7 +1706,7 @@ namespace Server.Multis
private class MoveTimer : Timer
{
private BaseBoat m_Boat;
private readonly BaseBoat m_Boat;
public MoveTimer(BaseBoat boat, TimeSpan interval, bool single) : base(interval, interval, single ? 1 : 0)
{
@ -1734,8 +1733,6 @@ namespace Server.Multis
}
}
#region High Seas
public override bool AllowsRelativeDrop => true;
/*
@ -1747,7 +1744,7 @@ namespace Server.Multis
/*
protected override Packet GetWorldPacketFor( NetState state )
{
if ( NewBoatMovement && state.HighSeas )
if (NewBoatMovement && state.HighSeas)
return new DisplayBoatHS( state.Mobile, this );
else
return base.GetWorldPacketFor( state );
@ -1762,14 +1759,14 @@ namespace Server.Multis
{
EnsureCapacity(3 + 15 + ents.Count * 10);
m_Stream.Write(boat.Serial);
m_Stream.Write((byte)speed);
m_Stream.Write((byte)d);
m_Stream.Write((byte)boat.Facing);
m_Stream.Write((short)(boat.X + xOffset));
m_Stream.Write((short)(boat.Y + yOffset));
m_Stream.Write((short)boat.Z);
m_Stream.Write((short)0); // count placeholder
Stream.Write(boat.Serial);
Stream.Write((byte)speed);
Stream.Write((byte)d);
Stream.Write((byte)boat.Facing);
Stream.Write((short)(boat.X + xOffset));
Stream.Write((short)(boat.Y + yOffset));
Stream.Write((short)boat.Z);
Stream.Write((short)0); // count placeholder
int count = 0;
@ -1778,15 +1775,15 @@ namespace Server.Multis
if (!beholder.CanSee(ent))
continue;
m_Stream.Write(ent.Serial);
m_Stream.Write((short)(ent.X + xOffset));
m_Stream.Write((short)(ent.Y + yOffset));
m_Stream.Write((short)ent.Z);
Stream.Write(ent.Serial);
Stream.Write((short)(ent.X + xOffset));
Stream.Write((short)(ent.Y + yOffset));
Stream.Write((short)ent.Z);
++count;
}
m_Stream.Seek(16, SeekOrigin.Begin);
m_Stream.Write((short)count);
Stream.Seek(16, SeekOrigin.Begin);
Stream.Write((short)count);
}
}
@ -1806,7 +1803,7 @@ namespace Server.Multis
EnsureCapacity(3 + 2 + ents.Count * 26);
m_Stream.Write((short)0); // count placeholder
Stream.Write((short)0); // count placeholder
int count = 0;
@ -1816,74 +1813,72 @@ namespace Server.Multis
continue;
// Embedded WorldItemHS packets
m_Stream.Write((byte)0xF3);
m_Stream.Write((short)0x1);
Stream.Write((byte)0xF3);
Stream.Write((short)0x1);
if (ent is BaseMulti bm)
{
m_Stream.Write((byte)0x02);
m_Stream.Write(bm.Serial);
Stream.Write((byte)0x02);
Stream.Write(bm.Serial);
// TODO: Mask no longer needed, merge with Item case?
m_Stream.Write((ushort)(bm.ItemID & 0x3FFF));
m_Stream.Write((byte)0);
Stream.Write((ushort)(bm.ItemID & 0x3FFF));
Stream.Write((byte)0);
m_Stream.Write((short)bm.Amount);
m_Stream.Write((short)bm.Amount);
Stream.Write((short)bm.Amount);
Stream.Write((short)bm.Amount);
m_Stream.Write((short)(bm.X & 0x7FFF));
m_Stream.Write((short)(bm.Y & 0x3FFF));
m_Stream.Write((sbyte)bm.Z);
Stream.Write((short)(bm.X & 0x7FFF));
Stream.Write((short)(bm.Y & 0x3FFF));
Stream.Write((sbyte)bm.Z);
m_Stream.Write((byte)bm.Light);
m_Stream.Write((short)bm.Hue);
m_Stream.Write((byte)bm.GetPacketFlags());
Stream.Write((byte)bm.Light);
Stream.Write((short)bm.Hue);
Stream.Write((byte)bm.GetPacketFlags());
}
else if (ent is Mobile m)
{
m_Stream.Write((byte)0x01);
m_Stream.Write(m.Serial);
m_Stream.Write((short)m.Body);
m_Stream.Write((byte)0);
Stream.Write((byte)0x01);
Stream.Write(m.Serial);
Stream.Write((short)m.Body);
Stream.Write((byte)0);
m_Stream.Write((short)1);
m_Stream.Write((short)1);
Stream.Write((short)1);
Stream.Write((short)1);
m_Stream.Write((short)(m.X & 0x7FFF));
m_Stream.Write((short)(m.Y & 0x3FFF));
m_Stream.Write((sbyte)m.Z);
Stream.Write((short)(m.X & 0x7FFF));
Stream.Write((short)(m.Y & 0x3FFF));
Stream.Write((sbyte)m.Z);
m_Stream.Write((byte)m.Direction);
m_Stream.Write((short)m.Hue);
m_Stream.Write((byte)m.GetPacketFlags());
Stream.Write((byte)m.Direction);
Stream.Write((short)m.Hue);
Stream.Write((byte)m.GetPacketFlags());
}
else if (ent is Item item)
{
m_Stream.Write((byte)0x00);
m_Stream.Write(item.Serial);
m_Stream.Write((ushort)(item.ItemID & 0xFFFF));
m_Stream.Write((byte)0);
Stream.Write((byte)0x00);
Stream.Write(item.Serial);
Stream.Write((ushort)(item.ItemID & 0xFFFF));
Stream.Write((byte)0);
m_Stream.Write((short)item.Amount);
m_Stream.Write((short)item.Amount);
Stream.Write((short)item.Amount);
Stream.Write((short)item.Amount);
m_Stream.Write((short)(item.X & 0x7FFF));
m_Stream.Write((short)(item.Y & 0x3FFF));
m_Stream.Write((sbyte)item.Z);
Stream.Write((short)(item.X & 0x7FFF));
Stream.Write((short)(item.Y & 0x3FFF));
Stream.Write((sbyte)item.Z);
m_Stream.Write((byte)item.Light);
m_Stream.Write((short)item.Hue);
m_Stream.Write((byte)item.GetPacketFlags());
Stream.Write((byte)item.Light);
Stream.Write((short)item.Hue);
Stream.Write((byte)item.GetPacketFlags());
}
m_Stream.Write((short)0x00);
Stream.Write((short)0x00);
++count;
}
m_Stream.Seek(3, SeekOrigin.Begin);
m_Stream.Write((short)count);
Stream.Seek(3, SeekOrigin.Begin);
Stream.Write((short)count);
}
}
#endregion
}
}

View file

@ -23,12 +23,12 @@ namespace Server.Multis
}
[CommandProperty(AccessLevel.GameMaster)]
public int MultiID{ get; set; }
public int MultiID { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Offset{ get; set; }
public Point3D Offset { get; set; }
public abstract BaseBoat Boat{ get; }
public abstract BaseBoat Boat { get; }
public override void Serialize(IGenericWriter writer)
{
@ -49,12 +49,12 @@ namespace Server.Multis
switch (version)
{
case 0:
{
MultiID = reader.ReadInt();
Offset = reader.ReadPoint3D();
{
MultiID = reader.ReadInt();
Offset = reader.ReadPoint3D();
break;
}
break;
}
}
if (Weight == 0.0)
@ -144,7 +144,7 @@ namespace Server.Multis
private class InternalTarget : MultiTarget
{
private BaseBoatDeed m_Deed;
private readonly BaseBoatDeed m_Deed;
public InternalTarget(BaseBoatDeed deed) : base(deed.MultiID, deed.Offset) => m_Deed = deed;

View file

@ -24,10 +24,10 @@ namespace Server.Multis
}
[CommandProperty(AccessLevel.GameMaster)]
public int MultiID{ get; set; }
public int MultiID { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Offset{ get; set; }
public Point3D Offset { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string ShipName
@ -40,7 +40,7 @@ namespace Server.Multis
}
}
public abstract BaseBoat Boat{ get; }
public abstract BaseBoat Boat { get; }
public override void Serialize(IGenericWriter writer)
{
@ -63,16 +63,16 @@ namespace Server.Multis
{
case 1:
case 0:
{
MultiID = reader.ReadInt();
Offset = reader.ReadPoint3D();
m_ShipName = reader.ReadString();
{
MultiID = reader.ReadInt();
Offset = reader.ReadPoint3D();
m_ShipName = reader.ReadString();
if (version == 0)
reader.ReadUInt();
if (version == 0)
reader.ReadUInt();
break;
}
break;
}
}
if (LootType == LootType.Newbied)
@ -163,7 +163,7 @@ namespace Server.Multis
private class InternalTarget : MultiTarget
{
private BaseDockedBoat m_Model;
private readonly BaseDockedBoat m_Model;
public InternalTarget(BaseDockedBoat model) : base(model.MultiID, model.Offset) => m_Model = model;

View file

@ -5,8 +5,8 @@ namespace Server.Multis
{
public class ConfirmDryDockGump : Gump
{
private BaseBoat m_Boat;
private Mobile m_From;
private readonly BaseBoat m_Boat;
private readonly Mobile m_From;
public ConfirmDryDockGump(Mobile from, BaseBoat boat) : base(150, 200)
{

View file

@ -96,16 +96,16 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Boat = reader.ReadItem() as BaseBoat;
{
m_Boat = reader.ReadItem() as BaseBoat;
if (m_Boat == null || Parent != null)
Delete();
if (m_Boat == null || Parent != null)
Delete();
Movable = false;
Movable = false;
break;
}
break;
}
}
}
}

View file

@ -32,10 +32,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public BaseBoat Boat{ get; set; }
public BaseBoat Boat { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public PlankSide Side{ get; set; }
public PlankSide Side { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool IsOpen => ItemID == 0x3ED5 || ItemID == 0x3ED4 || ItemID == 0x3E84 || ItemID == 0x3E89;
@ -44,16 +44,16 @@ namespace Server.Items
public bool Starboard => Side == PlankSide.Starboard;
[CommandProperty(AccessLevel.GameMaster)]
public bool Locked{ get; set; }
public bool Locked { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public uint KeyValue{ get; set; }
public uint KeyValue { get; set; }
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
writer.Write(Boat);
writer.Write((int)Side);
@ -70,17 +70,17 @@ namespace Server.Items
switch (version)
{
case 0:
{
Boat = reader.ReadItem() as BaseBoat;
Side = (PlankSide)reader.ReadInt();
Locked = reader.ReadBool();
KeyValue = reader.ReadUInt();
{
Boat = reader.ReadItem() as BaseBoat;
Side = (PlankSide)reader.ReadInt();
Locked = reader.ReadBool();
KeyValue = reader.ReadUInt();
if (Boat == null)
Delete();
if (Boat == null)
Delete();
break;
}
break;
}
}
if (IsOpen)
@ -95,19 +95,19 @@ namespace Server.Items
if (IsOpen)
ItemID = dir switch
{
Direction.North => (Starboard ? 0x3ED4 : 0x3ED5),
Direction.East => (Starboard ? 0x3E84 : 0x3E89),
Direction.South => (Starboard ? 0x3ED5 : 0x3ED4),
Direction.West => (Starboard ? 0x3E89 : 0x3E84),
Direction.North => Starboard ? 0x3ED4 : 0x3ED5,
Direction.East => Starboard ? 0x3E84 : 0x3E89,
Direction.South => Starboard ? 0x3ED5 : 0x3ED4,
Direction.West => Starboard ? 0x3E89 : 0x3E84,
_ => ItemID
};
else
ItemID = dir switch
{
Direction.North => (Starboard ? 0x3EB2 : 0x3EB1),
Direction.East => (Starboard ? 0x3E85 : 0x3E8A),
Direction.South => (Starboard ? 0x3EB1 : 0x3EB2),
Direction.West => (Starboard ? 0x3E8A : 0x3E85),
Direction.North => Starboard ? 0x3EB2 : 0x3EB1,
Direction.East => Starboard ? 0x3E85 : 0x3E8A,
Direction.South => Starboard ? 0x3EB1 : 0x3EB2,
Direction.West => Starboard ? 0x3E8A : 0x3E85,
_ => ItemID
};
}
@ -281,7 +281,7 @@ namespace Server.Items
private class CloseTimer : Timer
{
private Plank m_Plank;
private readonly Plank m_Plank;
public CloseTimer(Plank plank) : base(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(5.0))
{

View file

@ -4,7 +4,7 @@ namespace Server.Multis
{
public class RenameBoatPrompt : Prompt
{
private BaseBoat m_Boat;
private readonly BaseBoat m_Boat;
public RenameBoatPrompt(BaseBoat boat) => m_Boat = boat;

View file

@ -2,7 +2,7 @@ namespace Server.Misc
{
public class Strandedness
{
private static Point2D[] m_Felucca =
private static readonly Point2D[] m_Felucca =
{
new Point2D(2528, 3568), new Point2D(2376, 3400), new Point2D(2528, 3896),
new Point2D(2168, 3904), new Point2D(1136, 3416), new Point2D(1432, 3648),
@ -37,9 +37,9 @@ namespace Server.Misc
new Point2D(1840, 2640), new Point2D(1928, 2952), new Point2D(2120, 2712)
};
private static Point2D[] m_Trammel = m_Felucca;
private static readonly Point2D[] m_Trammel = m_Felucca;
private static Point2D[] m_Ilshenar =
private static readonly Point2D[] m_Ilshenar =
{
new Point2D(1252, 1180), new Point2D(1562, 1090), new Point2D(1444, 1016),
new Point2D(1324, 968), new Point2D(1418, 806), new Point2D(1722, 874),
@ -49,9 +49,9 @@ namespace Server.Misc
new Point2D(1358, 866), new Point2D(510, 302), new Point2D(510, 392)
};
private static Point2D[] m_Tokuno =
private static readonly Point2D[] m_Tokuno =
{
//Makoto-Jima
// Makoto-Jima
new Point2D(837, 1351), new Point2D(941, 1241), new Point2D(959, 1185),
new Point2D(923, 1091), new Point2D(904, 983), new Point2D(845, 944),
new Point2D(829, 896), new Point2D(794, 852), new Point2D(766, 821),
@ -61,7 +61,7 @@ namespace Server.Misc
new Point2D(526, 1271), new Point2D(562, 1295), new Point2D(616, 1335),
new Point2D(789, 1347), new Point2D(712, 1359),
//Homare-Jima
// Homare-Jima
new Point2D(202, 498), new Point2D(116, 600), new Point2D(107, 699),
new Point2D(162, 799), new Point2D(158, 889), new Point2D(169, 989),
new Point2D(194, 1101), new Point2D(250, 1163), new Point2D(295, 1176),
@ -72,7 +72,7 @@ namespace Server.Misc
new Point2D(672, 379), new Point2D(626, 332), new Point2D(494, 291),
new Point2D(371, 336), new Point2D(324, 334), new Point2D(270, 362),
//Isamu-Jima
// Isamu-Jima
new Point2D(1240, 1076), new Point2D(1189, 1115), new Point2D(1046, 1039),
new Point2D(1025, 885), new Point2D(907, 809), new Point2D(840, 506),
new Point2D(799, 396), new Point2D(720, 258), new Point2D(744, 158),
@ -101,8 +101,8 @@ namespace Server.Misc
{
int id = tile.ID;
return id >= 168 && id <= 171
|| id >= 310 && id <= 311;
return (id >= 168 && id <= 171)
|| (id >= 310 && id <= 311);
}
if (surface is StaticTile staticTile)
@ -157,17 +157,17 @@ namespace Server.Misc
canFit = map.CanSpawnMobile(x, y, z);
for (int i = 1; !canFit && i <= 40; i += 2)
for (int xo = -1; !canFit && xo <= 1; ++xo)
for (int yo = -1; !canFit && yo <= 1; ++yo)
{
if (xo == 0 && yo == 0)
continue;
for (int xo = -1; !canFit && xo <= 1; ++xo)
for (int yo = -1; !canFit && yo <= 1; ++yo)
{
if (xo == 0 && yo == 0)
continue;
x = p.X + xo * i;
y = p.Y + yo * i;
z = map.GetAverageZ(x, y);
canFit = map.CanSpawnMobile(x, y, z);
}
x = p.X + xo * i;
y = p.Y + yo * i;
z = map.GetAverageZ(x, y);
canFit = map.CanSpawnMobile(x, y, z);
}
if (canFit)
from.Location = new Point3D(x, y, z);

View file

@ -87,7 +87,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
writer.Write(m_Boat);
}
@ -101,14 +101,14 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Boat = reader.ReadItem() as BaseBoat;
{
m_Boat = reader.ReadItem() as BaseBoat;
if (m_Boat == null)
Delete();
if (m_Boat == null)
Delete();
break;
}
break;
}
}
}
}

View file

@ -155,15 +155,15 @@ namespace Server.Multis
switch (version)
{
case 0:
{
m_Items = reader.ReadStrongItemList();
m_Mobiles = reader.ReadStrongMobileList();
m_DecayTime = reader.ReadDeltaTime();
{
m_Items = reader.ReadStrongItemList();
m_Mobiles = reader.ReadStrongMobileList();
m_DecayTime = reader.ReadDeltaTime();
RefreshDecay(false);
RefreshDecay(false);
break;
}
break;
}
}
}
}

View file

@ -23,7 +23,7 @@ namespace Server.Multis
public override void AddComponents()
{
BaseCreature bc;
//BaseEscortable be;
// BaseEscortable be;
Visible = false;
DecayDelay = TimeSpan.FromMinutes(5.0);
@ -34,21 +34,21 @@ namespace Server.Multis
switch (Utility.Random(3))
{
case 0:
{
AddItem(new Item(0xDE3), 0, 7, 0); // Campfire
AddItem(new Item(0x974), 0, 7, 1); // Cauldron
break;
}
{
AddItem(new Item(0xDE3), 0, 7, 0); // Campfire
AddItem(new Item(0x974), 0, 7, 1); // Cauldron
break;
}
case 1:
{
AddItem(new Item(0x1E95), 0, 7, 1); // Rabbit on a spit
break;
}
{
AddItem(new Item(0x1E95), 0, 7, 1); // Rabbit on a spit
break;
}
default:
{
AddItem(new Item(0x1E94), 0, 7, 1); // Chicken on a spit
break;
}
{
AddItem(new Item(0x1E94), 0, 7, 1); // Chicken on a spit
break;
}
}
AddCampChests();
@ -61,8 +61,8 @@ namespace Server.Multis
_ => new SeekerOfAdventure()
};
//be = (BaseEscortable)m_Prisoner;
//be.m_Captive = true;
// be = (BaseEscortable)m_Prisoner;
// be.m_Captive = true;
bc = (BaseCreature)m_Prisoner;
bc.IsPrisoner = true;
@ -182,10 +182,10 @@ namespace Server.Multis
switch (version)
{
case 0:
{
m_Prisoner = reader.ReadMobile();
break;
}
{
m_Prisoner = reader.ReadMobile();
break;
}
}
}
}

View file

@ -22,7 +22,7 @@ namespace Server.Multis
public override void AddComponents()
{
BaseCreature bc;
//BaseEscortable be;
// BaseEscortable be;
Visible = false;
DecayDelay = TimeSpan.FromMinutes(5.0);
@ -32,21 +32,21 @@ namespace Server.Multis
switch (Utility.Random(3))
{
case 0:
{
AddItem(new Item(0xDE3), 0, 7, 0); // Campfire
AddItem(new Item(0x974), 0, 7, 1); // Cauldron
break;
}
{
AddItem(new Item(0xDE3), 0, 7, 0); // Campfire
AddItem(new Item(0x974), 0, 7, 1); // Cauldron
break;
}
case 1:
{
AddItem(new Item(0x1E95), 0, 7, 1); // Rabbit on a spit
break;
}
{
AddItem(new Item(0x1E95), 0, 7, 1); // Rabbit on a spit
break;
}
default:
{
AddItem(new Item(0x1E94), 0, 7, 1); // Chicken on a spit
break;
}
{
AddItem(new Item(0x1E94), 0, 7, 1); // Chicken on a spit
break;
}
}
AddItem(new Item(0x41F), 4, 4, 0); // Gruesome Standart South
@ -61,8 +61,8 @@ namespace Server.Multis
_ => new SeekerOfAdventure()
};
//be = (BaseEscortable)m_Prisoner;
//be.m_Captive = true;
// be = (BaseEscortable)m_Prisoner;
// be.m_Captive = true;
bc = (BaseCreature)m_Prisoner;
bc.IsPrisoner = true;
@ -182,10 +182,10 @@ namespace Server.Multis
switch (version)
{
case 0:
{
m_Prisoner = reader.ReadMobile();
break;
}
{
m_Prisoner = reader.ReadMobile();
break;
}
}
}
}

View file

@ -22,7 +22,7 @@ namespace Server.Multis
public override void AddComponents()
{
BaseCreature bc;
//BaseEscortable be;
// BaseEscortable be;
Visible = false;
DecayDelay = TimeSpan.FromMinutes(5.0);
@ -32,21 +32,21 @@ namespace Server.Multis
switch (Utility.Random(3))
{
case 0:
{
AddItem(new Item(0xDE3), 0, 7, 0); // Campfire
AddItem(new Item(0x974), 0, 7, 1); // Cauldron
break;
}
{
AddItem(new Item(0xDE3), 0, 7, 0); // Campfire
AddItem(new Item(0x974), 0, 7, 1); // Cauldron
break;
}
case 1:
{
AddItem(new Item(0x1E95), 0, 7, 1); // Rabbit on a spit
break;
}
{
AddItem(new Item(0x1E95), 0, 7, 1); // Rabbit on a spit
break;
}
default:
{
AddItem(new Item(0x1E94), 0, 7, 1); // Chicken on a spit
break;
}
{
AddItem(new Item(0x1E94), 0, 7, 1); // Chicken on a spit
break;
}
}
AddItem(new Item(0x428), -5, -4, 0); // Gruesome Standart West
@ -62,8 +62,8 @@ namespace Server.Multis
_ => new SeekerOfAdventure()
};
//be = (BaseEscortable)m_Prisoner;
//be.m_Captive = true;
// be = (BaseEscortable)m_Prisoner;
// be.m_Captive = true;
bc = (BaseCreature)m_Prisoner;
bc.IsPrisoner = true;
@ -183,16 +183,16 @@ namespace Server.Multis
switch (version)
{
case 1:
{
m_Prisoner = reader.ReadMobile();
break;
}
{
m_Prisoner = reader.ReadMobile();
break;
}
case 0:
{
m_Prisoner = reader.ReadMobile();
reader.ReadItem();
break;
}
{
m_Prisoner = reader.ReadMobile();
reader.ReadItem();
break;
}
}
}
}

View file

@ -22,7 +22,7 @@ namespace Server.Multis
public override void AddComponents()
{
BaseCreature bc;
//BaseEscortable be;
// BaseEscortable be;
Visible = false;
DecayDelay = TimeSpan.FromMinutes(5.0);
@ -32,21 +32,21 @@ namespace Server.Multis
switch (Utility.Random(3))
{
case 0:
{
AddItem(new Item(0xDE3), 0, 6, 0); // Campfire
AddItem(new Item(0x974), 0, 6, 1); // Cauldron
break;
}
{
AddItem(new Item(0xDE3), 0, 6, 0); // Campfire
AddItem(new Item(0x974), 0, 6, 1); // Cauldron
break;
}
case 1:
{
AddItem(new Item(0x1E95), 0, 6, 1); // Rabbit on a spit
break;
}
{
AddItem(new Item(0x1E95), 0, 6, 1); // Rabbit on a spit
break;
}
default:
{
AddItem(new Item(0x1E94), 0, 6, 1); // Chicken on a spit
break;
}
{
AddItem(new Item(0x1E94), 0, 6, 1); // Chicken on a spit
break;
}
}
AddItem(new Item(0x41F), 5, 5, 0); // Gruesome Standart South
@ -61,8 +61,8 @@ namespace Server.Multis
_ => new SeekerOfAdventure()
};
//be = (BaseEscortable)m_Prisoner;
//be.m_Captive = true;
// be = (BaseEscortable)m_Prisoner;
// be.m_Captive = true;
bc = (BaseCreature)m_Prisoner;
bc.IsPrisoner = true;
@ -182,16 +182,16 @@ namespace Server.Multis
switch (version)
{
case 1:
{
m_Prisoner = reader.ReadMobile();
break;
}
{
m_Prisoner = reader.ReadMobile();
break;
}
case 0:
{
m_Prisoner = reader.ReadMobile();
reader.ReadItem();
break;
}
{
m_Prisoner = reader.ReadMobile();
reader.ReadItem();
break;
}
}
}
}

View file

@ -6,8 +6,8 @@ namespace Server.Multis
{
public class ComponentVerification
{
private int[] m_ItemTable;
private int[] m_MultiTable;
private readonly int[] m_ItemTable;
private readonly int[] m_MultiTable;
public ComponentVerification()
{
@ -90,7 +90,7 @@ namespace Server.Multis
public class Spreadsheet
{
private ColumnInfo[] m_Columns;
private readonly ColumnInfo[] m_Columns;
public Spreadsheet(string path)
{
@ -118,15 +118,15 @@ namespace Server.Multis
switch (ci.m_Type)
{
case "int":
{
data[i] = Utility.ToInt32(values[ci.m_DataIndex]);
break;
}
{
data[i] = Utility.ToInt32(values[ci.m_DataIndex]);
break;
}
case "string":
{
data[i] = values[ci.m_DataIndex];
break;
}
{
data[i] = values[ci.m_DataIndex];
break;
}
}
}
@ -136,7 +136,7 @@ namespace Server.Multis
Records = records.ToArray();
}
public DataRecord[] Records{ get; }
public DataRecord[] Records { get; }
public int GetColumnID(string name)
{
@ -160,10 +160,10 @@ namespace Server.Multis
private class ColumnInfo
{
public int m_DataIndex;
public string m_Name;
public readonly int m_DataIndex;
public readonly string m_Name;
public string m_Type;
public readonly string m_Type;
public ColumnInfo(int dataIndex, string type, string name)
{
@ -183,9 +183,9 @@ namespace Server.Multis
Data = data;
}
public Spreadsheet Spreadsheet{ get; }
public Spreadsheet Spreadsheet { get; }
public object[] Data{ get; }
public object[] Data { get; }
public object this[string name] => this[Spreadsheet.GetColumnID(name)];

View file

@ -31,8 +31,8 @@ namespace Server.Multis
}
}
public BaseContestHouse(ContestHouseType type, int multiID, Mobile owner, int MaxLockDown, int MaxSecure)
: base(multiID, owner, MaxLockDown, MaxSecure)
public BaseContestHouse(ContestHouseType type, int multiID, Mobile owner, int maxLockDown, int maxSecure)
: base(multiID, owner, maxLockDown, maxSecure)
{
HouseType = type;
@ -71,9 +71,9 @@ namespace Server.Multis
{
base.OnLocationChange(oldLocation);
int x = base.Location.X - oldLocation.X;
int y = base.Location.Y - oldLocation.Y;
int z = base.Location.Z - oldLocation.Z;
int x = this.Location.X - oldLocation.X;
int y = this.Location.Y - oldLocation.Y;
int z = this.Location.Z - oldLocation.Z;
if (Fixtures == null) return;
@ -122,38 +122,38 @@ namespace Server.Multis
var teleporters = new Dictionary<int, List<MultiTileEntry>>();
foreach (var entry in components.List.Where(e => e.m_Flags == 0))
foreach (var entry in components.List.Where(e => e.Flags == 0))
// Teleporters
if (entry.m_ItemID >= 0x181D && entry.m_ItemID <= 0x1828)
if (entry.ItemId >= 0x181D && entry.ItemId <= 0x1828)
{
if (teleporters.ContainsKey(entry.m_ItemID))
teleporters[entry.m_ItemID].Add(entry);
if (teleporters.ContainsKey(entry.ItemId))
teleporters[entry.ItemId].Add(entry);
else
teleporters[entry.m_ItemID] = new List<MultiTileEntry> { entry };
teleporters[entry.ItemId] = new List<MultiTileEntry> { entry };
}
else
{
ItemData data = TileData.ItemTable[entry.m_ItemID & TileData.MaxItemValue];
ItemData data = TileData.ItemTable[entry.ItemId & TileData.MaxItemValue];
// door
if ((data.Flags & TileFlag.Door) != 0)
AddDoor(entry.m_ItemID, entry.m_OffsetX, entry.m_OffsetY, entry.m_OffsetZ);
AddDoor(entry.ItemId, entry.OffsetX, entry.OffsetY, entry.OffsetZ);
else
{
Item st = new Static((int)entry.m_ItemID);
Item st = new Static((int)entry.ItemId);
st.MoveToWorld(new Point3D(X + entry.m_OffsetX, Y + entry.m_OffsetY, entry.m_OffsetZ), Map);
st.MoveToWorld(new Point3D(X + entry.OffsetX, Y + entry.OffsetY, entry.OffsetZ), Map);
AddFixture(st);
}
}
foreach (var door in Doors)
foreach (var check in Doors.Where(d => d != door))
if (door.InRange(check.Location, 1))
{
door.Link = check;
check.Link = door;
}
foreach (var check in Doors.Where(d => d != door))
if (door.InRange(check.Location, 1))
{
door.Link = check;
check.Link = door;
}
foreach (var (key, value) in teleporters)
{
@ -168,9 +168,8 @@ namespace Server.Multis
AddTeleporters(
key,
new Point3D(value[0].m_OffsetX, value[0].m_OffsetY, value[0].m_OffsetZ),
new Point3D(value[1].m_OffsetX, value[1].m_OffsetY, value[1].m_OffsetZ)
);
new Point3D(value[0].OffsetX, value[0].OffsetY, value[0].OffsetZ),
new Point3D(value[1].OffsetX, value[1].OffsetY, value[1].OffsetZ));
}
teleporters.Clear();
@ -202,7 +201,7 @@ namespace Server.Multis
int count = reader.ReadInt();
for(int i = 0; i < count; i++)
for (int i = 0; i < count; i++)
AddFixture(reader.ReadItem());
}
}

View file

@ -6,7 +6,7 @@ namespace Server.Multis.Deeds
{
public class HousePlacementTarget : MultiTarget
{
private HouseDeed m_Deed;
private readonly HouseDeed m_Deed;
public HousePlacementTarget(HouseDeed deed) : base(deed.MultiID, deed.Offset) => m_Deed = deed;
@ -53,12 +53,12 @@ namespace Server.Multis.Deeds
}
[CommandProperty(AccessLevel.GameMaster)]
public int MultiID{ get; set; }
public int MultiID { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Offset{ get; set; }
public Point3D Offset { get; set; }
public abstract Rectangle2D[] Area{ get; }
public abstract Rectangle2D[] Area { get; }
public override void Serialize(IGenericWriter writer)
{
@ -80,17 +80,17 @@ namespace Server.Multis.Deeds
switch (version)
{
case 1:
{
Offset = reader.ReadPoint3D();
{
Offset = reader.ReadPoint3D();
goto case 0;
}
goto case 0;
}
case 0:
{
MultiID = reader.ReadInt();
{
MultiID = reader.ReadInt();
break;
}
break;
}
}
if (Weight == 0.0)
@ -109,9 +109,10 @@ namespace Server.Multis.Deeds
}
else
{
from.SendLocalizedMessage(1010433); /* House placement cancellation could result in a
* 60 second delay in the return of your deed.
*/
/* House placement cancellation could result in a
* 60 second delay in the return of your deed.
*/
from.SendLocalizedMessage(1010433);
from.Target = new HousePlacementTarget(this);
}
@ -140,55 +141,55 @@ namespace Server.Multis.Deeds
switch (res)
{
case HousePlacementResult.Valid:
{
BaseHouse house = GetHouse(from);
house.MoveToWorld(center, from.Map);
Delete();
for (int i = 0; i < toMove.Count; ++i)
{
object o = toMove[i];
BaseHouse house = GetHouse(from);
house.MoveToWorld(center, from.Map);
Delete();
if (o is Mobile mobile)
mobile.Location = house.BanLocation;
else if (o is Item item)
item.Location = house.BanLocation;
for (int i = 0; i < toMove.Count; ++i)
{
object o = toMove[i];
if (o is Mobile mobile)
mobile.Location = house.BanLocation;
else if (o is Item item)
item.Location = house.BanLocation;
}
break;
}
break;
}
case HousePlacementResult.BadItem:
case HousePlacementResult.BadLand:
case HousePlacementResult.BadStatic:
case HousePlacementResult.BadRegionHidden:
{
from.SendLocalizedMessage(
1043287); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
break;
}
{
from.SendLocalizedMessage(
1043287); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
break;
}
case HousePlacementResult.NoSurface:
{
from.SendMessage(
"The house could not be created here. Part of the foundation would not be on any surface.");
break;
}
{
from.SendMessage(
"The house could not be created here. Part of the foundation would not be on any surface.");
break;
}
case HousePlacementResult.BadRegion:
{
from.SendLocalizedMessage(501265); // Housing cannot be created in this area.
break;
}
{
from.SendLocalizedMessage(501265); // Housing cannot be created in this area.
break;
}
case HousePlacementResult.BadRegionTemp:
{
from.SendLocalizedMessage(
501270); //Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
break;
}
{
from.SendLocalizedMessage(
501270); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
break;
}
case HousePlacementResult.BadRegionRaffle:
{
from.SendLocalizedMessage(
1150493); // You must have a deed for this plot of land in order to build here.
break;
}
{
from.SendLocalizedMessage(
1150493); // You must have a deed for this plot of land in order to build here.
break;
}
}
}
}

View file

@ -5,7 +5,7 @@ namespace Server.Multis
{
public class DynamicDecay
{
private static Dictionary<DecayLevel, DecayStageInfo> m_Stages;
private static readonly Dictionary<DecayLevel, DecayStageInfo> m_Stages;
static DynamicDecay()
{
@ -48,8 +48,8 @@ namespace Server.Multis
MaxDuration = max;
}
public TimeSpan MinDuration{ get; }
public TimeSpan MinDuration { get; }
public TimeSpan MaxDuration{ get; }
public TimeSpan MaxDuration { get; }
}
}

View file

@ -35,7 +35,7 @@ namespace Server.Multis
/* Stair block IDs
* (sorted ascending)
*/
private static int[] m_BlockIDs =
private static readonly int[] m_BlockIDs =
{
0x3EE, 0x709, 0x71E, 0x721,
0x738, 0x750, 0x76C, 0x788,
@ -47,7 +47,7 @@ namespace Server.Multis
* (sorted ascending)
* Use this for stairs in the proper N,W,S,E sequence
*/
private static int[] m_StairSeqs =
private static readonly int[] m_StairSeqs =
{
0x3EF, 0x70A, 0x722, 0x739,
0x751, 0x76D, 0x789, 0x7A4
@ -57,7 +57,7 @@ namespace Server.Multis
* Listed in order: north, west, south, east
* Use this for stairs not in the proper sequence
*/
private static int[] m_StairIDs =
private static readonly int[] m_StairIDs =
{
0x71F, 0x736, 0x737, 0x749,
0x35D4, 0x35D3, 0x35D6, 0x35D5,
@ -99,19 +99,19 @@ namespace Server.Multis
{
}
public FoundationType Type{ get; set; }
public FoundationType Type { get; set; }
public int LastRevision{ get; set; }
public int LastRevision { get; set; }
public List<Item> Fixtures{ get; private set; }
public List<Item> Fixtures { get; private set; }
public Item SignHanger{ get; private set; }
public Item SignHanger { get; private set; }
public Item Signpost{ get; private set; }
public Item Signpost { get; private set; }
public int SignpostGraphic{ get; set; }
public int SignpostGraphic { get; set; }
public Mobile Customizer{ get; set; }
public Mobile Customizer { get; set; }
public override bool IsAosRules => true;
@ -307,7 +307,7 @@ namespace Server.Multis
for (int i = 0; i < list.Length; ++i)
{
MultiTileEntry mte = list[i];
int itemID = mte.m_ItemID;
int itemID = mte.ItemId;
if (itemID >= 0x181D && itemID < 0x1829)
{
@ -375,13 +375,13 @@ namespace Server.Multis
}
else if (itemID >= 0x241F && itemID < 0x2421)
{
//DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8);
// DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8);
door = new GenericHouseDoor(DoorFacing.NorthCCW, 0x2415, -1, -1);
}
else if (itemID >= 0x2423 && itemID < 0x2425)
{
//DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8);
//This one and the above one are 'special' cases, ie: OSI had the ItemID pattern discombobulated for these
// DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8);
// This one and the above one are 'special' cases, ie: OSI had the ItemID pattern discombobulated for these
door = new GenericHouseDoor(DoorFacing.WestCW, 0x2423, -1, -1);
}
else if (itemID >= 0x2A05 && itemID < 0x2A1D)
@ -415,7 +415,7 @@ namespace Server.Multis
}
else if (itemID >= 0x319C && itemID < 0x31AE)
{
//special case for 0x31aa <-> 0x31a8 (a9)
// special case for 0x31aa <-> 0x31a8 (a9)
int mod = (itemID - 0x319C) / 2 % 2;
@ -463,8 +463,8 @@ namespace Server.Multis
else if (itemID >= 0x436E && itemID < 0x437E)
{
/* These ones had to be different...
* Offset 0 2 4 6 8 10 12 14
* DoorFacing 2 3 2 3 6 7 6 7
* Offset 0 2 4 6 8 10 12 14
* DoorFacing 2 3 2 3 6 7 6 7
*/
int offset = itemID - 0x436E;
DoorFacing facing = (DoorFacing)((offset / 2 + 2 * ((1 + offset / 4) % 2)) % 8);
@ -499,7 +499,7 @@ namespace Server.Multis
door.Locked = true;
door.KeyValue = keyValue;
AddDoor(door, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ);
AddDoor(door, mte.OffsetX, mte.OffsetY, mte.OffsetZ);
Fixtures.Add(door);
}
}
@ -607,7 +607,7 @@ namespace Server.Multis
public void AddFixture(Item item, MultiTileEntry mte)
{
Fixtures.Add(item);
item.MoveToWorld(new Point3D(X + mte.m_OffsetX, Y + mte.m_OffsetY, Z + mte.m_OffsetZ), Map);
item.MoveToWorld(new Point3D(X + mte.OffsetX, Y + mte.OffsetY, Z + mte.OffsetZ), Map);
}
public static void GetFoundationGraphics(FoundationType type, out int east, out int south, out int post,
@ -847,48 +847,48 @@ namespace Server.Multis
{
case 5:
case 4:
{
Signpost = reader.ReadItem();
SignpostGraphic = reader.ReadInt();
{
Signpost = reader.ReadItem();
SignpostGraphic = reader.ReadInt();
goto case 3;
}
goto case 3;
}
case 3:
{
Type = (FoundationType)reader.ReadInt();
{
Type = (FoundationType)reader.ReadInt();
goto case 2;
}
goto case 2;
}
case 2:
{
SignHanger = reader.ReadItem();
{
SignHanger = reader.ReadItem();
goto case 1;
}
goto case 1;
}
case 1:
{
if (version < 5)
m_DefaultPrice = reader.ReadInt();
{
if (version < 5)
m_DefaultPrice = reader.ReadInt();
goto case 0;
}
goto case 0;
}
case 0:
{
if (version < 3)
Type = FoundationType.Stone;
{
if (version < 3)
Type = FoundationType.Stone;
if (version < 4)
SignpostGraphic = 9;
if (version < 4)
SignpostGraphic = 9;
LastRevision = reader.ReadInt();
Fixtures = reader.ReadStrongItemList();
LastRevision = reader.ReadInt();
Fixtures = reader.ReadStrongItemList();
m_Current = new DesignState(this, reader);
m_Design = new DesignState(this, reader);
m_Backup = new DesignState(this, reader);
m_Current = new DesignState(this, reader);
m_Design = new DesignState(this, reader);
m_Backup = new DesignState(this, reader);
break;
}
break;
}
}
base.Deserialize(reader);
@ -1216,7 +1216,7 @@ namespace Server.Multis
public static bool IsStair(int id, ref int dir)
{
//dir n=0 w=1 s=2 e=3
// dir n=0 w=1 s=2 e=3
int delta = -4;
for (int i = 0; delta < -3 && i < m_StairSeqs.Length; ++i)
@ -1281,37 +1281,37 @@ namespace Server.Multis
switch (dir)
{
default:
{
xStart = x;
yStart = y + height;
xInc = 0;
yInc = -1;
break;
}
{
xStart = x;
yStart = y + height;
xInc = 0;
yInc = -1;
break;
}
case 1: // West
{
xStart = x + height;
yStart = y;
xInc = -1;
yInc = 0;
break;
}
{
xStart = x + height;
yStart = y;
xInc = -1;
yInc = 0;
break;
}
case 2: // South
{
xStart = x;
yStart = y - height;
xInc = 0;
yInc = 1;
break;
}
{
xStart = x;
yStart = y - height;
xInc = 0;
yInc = 1;
break;
}
case 3: // East
{
xStart = x - height;
yStart = y;
xInc = 1;
yInc = 0;
break;
}
{
xStart = x - height;
yStart = y;
xInc = 1;
yInc = 0;
break;
}
}
int zStart = z - height * 5;
@ -1471,8 +1471,8 @@ namespace Server.Multis
{
MultiTileEntry entry = stairs.List[i];
if (entry.m_ItemID != 1)
mcl.Add(entry.m_ItemID, x + entry.m_OffsetX, y + entry.m_OffsetY, z + entry.m_OffsetZ);
if (entry.ItemId != 1)
mcl.Add(entry.ItemId, x + entry.OffsetX, y + entry.OffsetY, z + entry.OffsetZ);
}
// Update revision
@ -1628,7 +1628,7 @@ namespace Server.Multis
Mobile from = state.Mobile;
DesignContext context = DesignContext.Find(from);
if (context == null || !Core.SE && from.AccessLevel < AccessLevel.GameMaster)
if (context == null || (!Core.SE && from.AccessLevel < AccessLevel.GameMaster))
return;
// Read data detailing component graphic and location
@ -1658,10 +1658,10 @@ namespace Server.Multis
{
MultiTileEntry mte = list[i];
if (mte.m_OffsetX == x && mte.m_OffsetY == y &&
GetZLevel(mte.m_OffsetZ, context.Foundation) == context.Level &&
(TileData.ItemTable[mte.m_ItemID & TileData.MaxItemValue].Flags & TileFlag.Roof) != 0)
mcl.Remove(mte.m_ItemID, x, y, mte.m_OffsetZ);
if (mte.OffsetX == x && mte.OffsetY == y &&
GetZLevel(mte.OffsetZ, context.Foundation) == context.Level &&
(TileData.ItemTable[mte.ItemId & TileData.MaxItemValue].Flags & TileFlag.Roof) != 0)
mcl.Remove(mte.ItemId, x, y, mte.OffsetZ);
}
mcl.Add(itemID, x, y, z);
@ -1709,7 +1709,7 @@ namespace Server.Multis
{
Foundation = foundation;
Components = components;
Fixtures = new MultiTileEntry[0];
Fixtures = Array.Empty<MultiTileEntry>();
}
public DesignState(DesignState toCopy)
@ -1732,26 +1732,26 @@ namespace Server.Multis
switch (version)
{
case 0:
{
Components = new MultiComponentList(reader);
int length = reader.ReadInt();
Fixtures = new MultiTileEntry[length];
for (int i = 0; i < length; ++i)
{
Fixtures[i].m_ItemID = reader.ReadUShort();
Fixtures[i].m_OffsetX = reader.ReadShort();
Fixtures[i].m_OffsetY = reader.ReadShort();
Fixtures[i].m_OffsetZ = reader.ReadShort();
Fixtures[i].m_Flags = (TileFlag)reader.ReadInt();
Components = new MultiComponentList(reader);
int length = reader.ReadInt();
Fixtures = new MultiTileEntry[length];
for (int i = 0; i < length; ++i)
{
Fixtures[i].ItemId = reader.ReadUShort();
Fixtures[i].OffsetX = reader.ReadShort();
Fixtures[i].OffsetY = reader.ReadShort();
Fixtures[i].OffsetZ = reader.ReadShort();
Fixtures[i].Flags = (TileFlag)reader.ReadInt();
}
Revision = reader.ReadInt();
break;
}
Revision = reader.ReadInt();
break;
}
}
}
@ -1769,13 +1769,13 @@ namespace Server.Multis
}
}
public HouseFoundation Foundation{ get; }
public HouseFoundation Foundation { get; }
public MultiComponentList Components{ get; }
public MultiComponentList Components { get; }
public MultiTileEntry[] Fixtures{ get; private set; }
public MultiTileEntry[] Fixtures { get; private set; }
public int Revision{ get; set; }
public int Revision { get; set; }
public void Serialize(IGenericWriter writer)
{
@ -1789,11 +1789,11 @@ namespace Server.Multis
{
MultiTileEntry ent = Fixtures[i];
writer.Write(ent.m_ItemID);
writer.Write(ent.m_OffsetX);
writer.Write(ent.m_OffsetY);
writer.Write(ent.m_OffsetZ);
writer.Write((int)ent.m_Flags);
writer.Write(ent.ItemId);
writer.Write(ent.OffsetX);
writer.Write(ent.OffsetY);
writer.Write(ent.OffsetZ);
writer.Write((int)ent.Flags);
}
writer.Write(Revision);
@ -1836,10 +1836,10 @@ namespace Server.Multis
{
MultiTileEntry mte = Fixtures[i];
Components.Add(mte.m_ItemID, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ);
Components.Add(mte.ItemId, mte.OffsetX, mte.OffsetY, mte.OffsetZ);
}
Fixtures = new MultiTileEntry[0];
Fixtures = Array.Empty<MultiTileEntry>();
}
public void MeltFixtures()
@ -1853,7 +1853,7 @@ namespace Server.Multis
{
MultiTileEntry mte = list[i];
if (IsFixture(mte.m_ItemID))
if (IsFixture(mte.ItemId))
++length;
}
@ -1863,10 +1863,10 @@ namespace Server.Multis
{
MultiTileEntry mte = list[i];
if (IsFixture(mte.m_ItemID))
if (IsFixture(mte.ItemId))
{
Fixtures[--length] = mte;
Components.Remove(mte.m_ItemID, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ);
Components.Remove(mte.ItemId, mte.OffsetX, mte.OffsetY, mte.OffsetZ);
}
}
}
@ -1937,7 +1937,7 @@ namespace Server.Multis
public class ConfirmCommitGump : Gump
{
private HouseFoundation m_Foundation;
private readonly HouseFoundation m_Foundation;
public ConfirmCommitGump(Mobile from, HouseFoundation foundation, int bankBalance, int oldPrice, int newPrice)
: base(50, 50)
@ -2000,13 +2000,13 @@ namespace Server.Multis
Level = 1;
}
public HouseFoundation Foundation{ get; }
public HouseFoundation Foundation { get; }
public int Level{ get; set; }
public int Level { get; set; }
public int MaxLevels => Foundation.MaxLevels;
public static Dictionary<Mobile, DesignContext> Table{ get; } = new Dictionary<Mobile, DesignContext>();
public static Dictionary<Mobile, DesignContext> Table { get; } = new Dictionary<Mobile, DesignContext>();
public static DesignContext Find(Mobile from)
{
@ -2025,7 +2025,6 @@ namespace Server.Multis
m.SendLocalizedMessage(1062206); // You cannot do that while customizing a house.
return false;
}
public static void Add(Mobile from, HouseFoundation foundation)
@ -2112,13 +2111,13 @@ namespace Server.Multis
{
EnsureCapacity(17);
m_Stream.Write((short)0x20);
m_Stream.Write(house.Serial);
m_Stream.Write((byte)0x04);
m_Stream.Write((ushort)0x0000);
m_Stream.Write((ushort)0xFFFF);
m_Stream.Write((ushort)0xFFFF);
m_Stream.Write((byte)0xFF);
Stream.Write((short)0x20);
Stream.Write(house.Serial);
Stream.Write((byte)0x04);
Stream.Write((ushort)0x0000);
Stream.Write((ushort)0xFFFF);
Stream.Write((ushort)0xFFFF);
Stream.Write((byte)0xFF);
}
}
@ -2129,13 +2128,13 @@ namespace Server.Multis
{
EnsureCapacity(17);
m_Stream.Write((short)0x20);
m_Stream.Write(house.Serial);
m_Stream.Write((byte)0x05);
m_Stream.Write((ushort)0x0000);
m_Stream.Write((ushort)0xFFFF);
m_Stream.Write((ushort)0xFFFF);
m_Stream.Write((byte)0xFF);
Stream.Write((short)0x20);
Stream.Write(house.Serial);
Stream.Write((byte)0x05);
Stream.Write((ushort)0x0000);
Stream.Write((ushort)0xFFFF);
Stream.Write((ushort)0xFFFF);
Stream.Write((byte)0xFF);
}
}
@ -2146,9 +2145,9 @@ namespace Server.Multis
{
EnsureCapacity(13);
m_Stream.Write((short)0x1D);
m_Stream.Write(house.Serial);
m_Stream.Write(state.Revision);
Stream.Write((short)0x1D);
Stream.Write(house.Serial);
Stream.Write(state.Revision);
}
}
@ -2156,14 +2155,14 @@ namespace Server.Multis
{
public const int MaxItemsPerStairBuffer = 750;
private static ConcurrentQueue<SendQueueEntry> m_SendQueue;
private static AutoResetEvent m_Sync;
private static readonly ConcurrentQueue<SendQueueEntry> m_SendQueue;
private static readonly AutoResetEvent m_Sync;
private byte[][] m_PlaneBuffers;
private readonly byte[][] m_PlaneBuffers;
private bool[] m_PlaneUsed = new bool[9];
private byte[] m_PrimBuffer = new byte[4];
private byte[][] m_StairBuffers;
private readonly bool[] m_PlaneUsed = new bool[9];
private readonly byte[] m_PrimBuffer = new byte[4];
private readonly byte[][] m_StairBuffers;
static DesignStateDetailed()
{
@ -2214,10 +2213,10 @@ namespace Server.Multis
for (int i = 0; i < tiles.Length; ++i)
{
MultiTileEntry mte = tiles[i];
int x = mte.m_OffsetX - xMin;
int y = mte.m_OffsetY - yMin;
int z = mte.m_OffsetZ;
bool floor = TileData.ItemTable[mte.m_ItemID & TileData.MaxItemValue].Height <= 0;
int x = mte.OffsetX - xMin;
int y = mte.OffsetY - yMin;
int z = mte.OffsetZ;
bool floor = TileData.ItemTable[mte.ItemId & TileData.MaxItemValue].Height <= 0;
int plane, size;
switch (z)
@ -2238,23 +2237,23 @@ namespace Server.Multis
plane = 4;
break;
default:
{
int stairBufferIndex = totalStairsUsed / MaxItemsPerStairBuffer;
byte[] stairBuffer = m_StairBuffers[stairBufferIndex];
{
int stairBufferIndex = totalStairsUsed / MaxItemsPerStairBuffer;
byte[] stairBuffer = m_StairBuffers[stairBufferIndex];
int byteIndex = totalStairsUsed % MaxItemsPerStairBuffer * 5;
int byteIndex = totalStairsUsed % MaxItemsPerStairBuffer * 5;
stairBuffer[byteIndex++] = (byte)(mte.m_ItemID >> 8);
stairBuffer[byteIndex++] = (byte)mte.m_ItemID;
stairBuffer[byteIndex++] = (byte)(mte.ItemId >> 8);
stairBuffer[byteIndex++] = (byte)mte.ItemId;
stairBuffer[byteIndex++] = (byte)mte.m_OffsetX;
stairBuffer[byteIndex++] = (byte)mte.m_OffsetY;
stairBuffer[byteIndex++] = (byte)mte.m_OffsetZ;
stairBuffer[byteIndex++] = (byte)mte.OffsetX;
stairBuffer[byteIndex++] = (byte)mte.OffsetY;
stairBuffer[byteIndex++] = (byte)mte.OffsetZ;
++totalStairsUsed;
++totalStairsUsed;
continue;
}
continue;
}
}
if (plane == 0)
@ -2282,20 +2281,20 @@ namespace Server.Multis
int byteIndex = totalStairsUsed % MaxItemsPerStairBuffer * 5;
stairBuffer[byteIndex++] = (byte)(mte.m_ItemID >> 8);
stairBuffer[byteIndex++] = (byte)mte.m_ItemID;
stairBuffer[byteIndex++] = (byte)(mte.ItemId >> 8);
stairBuffer[byteIndex++] = (byte)mte.ItemId;
stairBuffer[byteIndex++] = (byte)mte.m_OffsetX;
stairBuffer[byteIndex++] = (byte)mte.m_OffsetY;
stairBuffer[byteIndex++] = (byte)mte.m_OffsetZ;
stairBuffer[byteIndex++] = (byte)mte.OffsetX;
stairBuffer[byteIndex++] = (byte)mte.OffsetY;
stairBuffer[byteIndex++] = (byte)mte.OffsetZ;
++totalStairsUsed;
}
else
{
m_PlaneUsed[plane] = true;
m_PlaneBuffers[plane][index] = (byte)(mte.m_ItemID >> 8);
m_PlaneBuffers[plane][index + 1] = (byte)mte.m_ItemID;
m_PlaneBuffers[plane][index] = (byte)(mte.ItemId >> 8);
m_PlaneBuffers[plane][index + 1] = (byte)mte.ItemId;
}
}
@ -2325,7 +2324,7 @@ namespace Server.Multis
byte[] inflatedBuffer = m_PlaneBuffers[i];
int deflatedLength = m_DeflatedBuffer.Length;
ZLibError ce = Compression.Pack(m_DeflatedBuffer, ref deflatedLength, inflatedBuffer, size,
ZLibError ce = NetworkCompression.Pack(m_DeflatedBuffer, ref deflatedLength, inflatedBuffer, size,
ZLibQuality.Default);
if (ce != ZLibError.Okay)
@ -2361,7 +2360,7 @@ namespace Server.Multis
byte[] inflatedBuffer = m_StairBuffers[i];
int deflatedLength = m_DeflatedBuffer.Length;
ZLibError ce = Compression.Pack(m_DeflatedBuffer, ref deflatedLength, inflatedBuffer, size,
ZLibError ce = NetworkCompression.Pack(m_DeflatedBuffer, ref deflatedLength, inflatedBuffer, size,
ZLibQuality.Default);
if (ce != ZLibError.Okay)
@ -2385,7 +2384,7 @@ namespace Server.Multis
ArrayPool<byte>.Shared.Return(m_DeflatedBuffer);
m_Stream.Seek(15, SeekOrigin.Begin);
Stream.Seek(15, SeekOrigin.Begin);
Write((short)totalLength); // Buffer length
Write((byte)planeCount); // Plane count
@ -2398,7 +2397,7 @@ namespace Server.Multis
m_PrimBuffer[2] = (byte)(value >> 8);
m_PrimBuffer[3] = (byte)value;
m_Stream.UnderlyingStream.Write(m_PrimBuffer, 0, 4);
Stream.UnderlyingStream.Write(m_PrimBuffer, 0, 4);
}
public void Write(uint value)
@ -2408,7 +2407,7 @@ namespace Server.Multis
m_PrimBuffer[2] = (byte)(value >> 8);
m_PrimBuffer[3] = (byte)value;
m_Stream.UnderlyingStream.Write(m_PrimBuffer, 0, 4);
Stream.UnderlyingStream.Write(m_PrimBuffer, 0, 4);
}
public void Write(short value)
@ -2416,17 +2415,17 @@ namespace Server.Multis
m_PrimBuffer[0] = (byte)(value >> 8);
m_PrimBuffer[1] = (byte)value;
m_Stream.UnderlyingStream.Write(m_PrimBuffer, 0, 2);
Stream.UnderlyingStream.Write(m_PrimBuffer, 0, 2);
}
public void Write(byte value)
{
m_Stream.UnderlyingStream.WriteByte(value);
Stream.UnderlyingStream.WriteByte(value);
}
public void Write(byte[] buffer, int offset, int size)
{
m_Stream.UnderlyingStream.Write(buffer, offset, size);
Stream.UnderlyingStream.Write(buffer, offset, size);
}
public static void Clear(byte[] buffer, int size)
@ -2498,12 +2497,15 @@ namespace Server.Multis
private class SendQueueEntry
{
public NetState m_NetState;
public DesignState m_Root;
public int m_Revision;
public uint m_Serial;
public MultiTileEntry[] m_Tiles;
public int m_xMin, m_yMin, m_xMax, m_yMax;
public readonly NetState m_NetState;
public readonly DesignState m_Root;
public readonly int m_Revision;
public readonly uint m_Serial;
public readonly MultiTileEntry[] m_Tiles;
public readonly int m_xMin;
public readonly int m_yMin;
public readonly int m_xMax;
public readonly int m_yMax;
public SendQueueEntry(NetState ns, HouseFoundation foundation, DesignState state)
{

View file

@ -23,7 +23,7 @@ namespace Server.Multis
private const int YardSize = 5;
// Any land tile which matches one of these ID numbers is considered a road and cannot be placed over.
private static int[] m_RoadIDs =
private static readonly int[] m_RoadIDs =
{
0x0071, 0x0078,
0x00E8, 0x00EB,
@ -84,190 +84,190 @@ namespace Server.Multis
*/
for (int x = 0; x < mcl.Width; ++x)
for (int y = 0; y < mcl.Height; ++y)
{
int tileX = start.X + x;
int tileY = start.Y + y;
StaticTile[] addTiles = mcl.Tiles[x][y];
if (addTiles.Length == 0)
continue; // There are no tiles here, continue checking somewhere else
Point3D testPoint = new Point3D(tileX, tileY, center.Z);
Region reg = Region.Find(testPoint, map);
if (!reg.AllowHousing(from, testPoint)) // Cannot place houses in dungeons, towns, treasure map areas etc
for (int y = 0; y < mcl.Height; ++y)
{
if (reg.IsPartOf<TempNoHousingRegion>())
return HousePlacementResult.BadRegionTemp;
int tileX = start.X + x;
int tileY = start.Y + y;
if (reg.IsPartOf<TreasureRegion>() || reg.IsPartOf<HouseRegion>())
return HousePlacementResult.BadRegionHidden;
StaticTile[] addTiles = mcl.Tiles[x][y];
if (reg.IsPartOf<HouseRaffleRegion>())
return HousePlacementResult.BadRegionRaffle;
if (addTiles.Length == 0)
continue; // There are no tiles here, continue checking somewhere else
return HousePlacementResult.BadRegion;
}
Point3D testPoint = new Point3D(tileX, tileY, center.Z);
LandTile landTile = map.Tiles.GetLandTile(tileX, tileY);
int landID = landTile.ID & TileData.MaxLandValue;
Region reg = Region.Find(testPoint, map);
StaticTile[] oldTiles = map.Tiles.GetStaticTiles(tileX, tileY, true);
Sector sector = map.GetSector(tileX, tileY);
items.Clear();
for (int i = 0; i < sector.Items.Count; ++i)
{
Item item = sector.Items[i];
if (item.Visible && item.X == tileX && item.Y == tileY)
items.Add(item);
}
mobiles.Clear();
for (int i = 0; i < sector.Mobiles.Count; ++i)
{
Mobile m = sector.Mobiles[i];
if (m.X == tileX && m.Y == tileY)
mobiles.Add(m);
}
int landStartZ = 0, landAvgZ = 0, landTopZ = 0;
map.GetAverageZ(tileX, tileY, ref landStartZ, ref landAvgZ, ref landTopZ);
bool hasFoundation = false;
for (int i = 0; i < addTiles.Length; ++i)
{
StaticTile addTile = addTiles[i];
if (addTile.ID == 0x1) // Nodraw
continue;
TileFlag addTileFlags = TileData.ItemTable[addTile.ID & TileData.MaxItemValue].Flags;
bool isFoundation = addTile.Z == 0 && (addTileFlags & TileFlag.Wall) != 0;
bool hasSurface = false;
if (isFoundation)
hasFoundation = true;
int addTileZ = center.Z + addTile.Z;
int addTileTop = addTileZ + addTile.Height;
if ((addTileFlags & TileFlag.Surface) != 0)
addTileTop += 16;
if (addTileTop > landStartZ && landAvgZ > addTileZ)
return HousePlacementResult.BadLand; // Broke rule #2
if (isFoundation &&
(TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Impassable) == 0 &&
landAvgZ == center.Z)
hasSurface = true;
for (int j = 0; j < oldTiles.Length; ++j)
if (!reg.AllowHousing(from, testPoint)) // Cannot place houses in dungeons, towns, treasure map areas etc
{
StaticTile oldTile = oldTiles[j];
ItemData id = TileData.ItemTable[oldTile.ID & TileData.MaxItemValue];
if (reg.IsPartOf<TempNoHousingRegion>())
return HousePlacementResult.BadRegionTemp;
if ((id.Impassable || id.Surface && (id.Flags & TileFlag.Background) == 0) &&
addTileTop > oldTile.Z && oldTile.Z + id.CalcHeight > addTileZ)
return HousePlacementResult.BadStatic; // Broke rule #2
/*else if ( isFoundation && !hasSurface && (id.Flags & TileFlag.Surface) != 0 && (oldTile.Z + id.CalcHeight) == center.Z )
hasSurface = true;*/
if (reg.IsPartOf<TreasureRegion>() || reg.IsPartOf<HouseRegion>())
return HousePlacementResult.BadRegionHidden;
if (reg.IsPartOf<HouseRaffleRegion>())
return HousePlacementResult.BadRegionRaffle;
return HousePlacementResult.BadRegion;
}
for (int j = 0; j < items.Count; ++j)
LandTile landTile = map.Tiles.GetLandTile(tileX, tileY);
int landID = landTile.ID & TileData.MaxLandValue;
StaticTile[] oldTiles = map.Tiles.GetStaticTiles(tileX, tileY, true);
Sector sector = map.GetSector(tileX, tileY);
items.Clear();
for (int i = 0; i < sector.Items.Count; ++i)
{
Item item = items[j];
ItemData id = item.ItemData;
Item item = sector.Items[i];
if (addTileTop > item.Z && item.Z + id.CalcHeight > addTileZ)
{
if (item.Movable)
toMove.Add(item);
else if (id.Impassable || id.Surface && (id.Flags & TileFlag.Background) == 0)
return HousePlacementResult.BadItem; // Broke rule #2
}
/*else if ( isFoundation && !hasSurface && (id.Flags & TileFlag.Surface) != 0 && (item.Z + id.CalcHeight) == center.Z )
{
hasSurface = true;
}*/
if (item.Visible && item.X == tileX && item.Y == tileY)
items.Add(item);
}
if (isFoundation && !hasSurface)
return HousePlacementResult.NoSurface; // Broke rule #4
mobiles.Clear();
for (int j = 0; j < mobiles.Count; ++j)
for (int i = 0; i < sector.Mobiles.Count; ++i)
{
Mobile m = mobiles[j];
Mobile m = sector.Mobiles[i];
if (addTileTop > m.Z && m.Z + 16 > addTileZ)
toMove.Add(m);
}
}
for (int i = 0; i < m_RoadIDs.Length; i += 2)
if (landID >= m_RoadIDs[i] && landID <= m_RoadIDs[i + 1])
return HousePlacementResult.BadLand; // Broke rule #5
if (hasFoundation)
{
for (int xOffset = -1; xOffset <= 1; ++xOffset)
for (int yOffset = -YardSize; yOffset <= YardSize; ++yOffset)
{
Point2D yardPoint = new Point2D(tileX + xOffset, tileY + yOffset);
if (!yard.Contains(yardPoint))
yard.Add(yardPoint);
if (m.X == tileX && m.Y == tileY)
mobiles.Add(m);
}
for (int xOffset = -1; xOffset <= 1; ++xOffset)
for (int yOffset = -1; yOffset <= 1; ++yOffset)
int landStartZ = 0, landAvgZ = 0, landTopZ = 0;
map.GetAverageZ(tileX, tileY, ref landStartZ, ref landAvgZ, ref landTopZ);
bool hasFoundation = false;
for (int i = 0; i < addTiles.Length; ++i)
{
if (xOffset == 0 && yOffset == 0)
StaticTile addTile = addTiles[i];
if (addTile.ID == 0x1) // Nodraw
continue;
// To ease this rule, we will not add to the border list if the tile here is under a base floor (z<=8)
TileFlag addTileFlags = TileData.ItemTable[addTile.ID & TileData.MaxItemValue].Flags;
int vx = x + xOffset;
int vy = y + yOffset;
bool isFoundation = addTile.Z == 0 && (addTileFlags & TileFlag.Wall) != 0;
bool hasSurface = false;
if (vx >= 0 && vx < mcl.Width && vy >= 0 && vy < mcl.Height)
if (isFoundation)
hasFoundation = true;
int addTileZ = center.Z + addTile.Z;
int addTileTop = addTileZ + addTile.Height;
if ((addTileFlags & TileFlag.Surface) != 0)
addTileTop += 16;
if (addTileTop > landStartZ && landAvgZ > addTileZ)
return HousePlacementResult.BadLand; // Broke rule #2
if (isFoundation &&
(TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Impassable) == 0 &&
landAvgZ == center.Z)
hasSurface = true;
for (int j = 0; j < oldTiles.Length; ++j)
{
StaticTile[] breakTiles = mcl.Tiles[vx][vy];
bool shouldBreak = false;
StaticTile oldTile = oldTiles[j];
ItemData id = TileData.ItemTable[oldTile.ID & TileData.MaxItemValue];
for (int i = 0; !shouldBreak && i < breakTiles.Length; ++i)
{
StaticTile breakTile = breakTiles[i];
if (breakTile.Height == 0 && breakTile.Z <= 8 &&
TileData.ItemTable[breakTile.ID & TileData.MaxItemValue].Surface)
shouldBreak = true;
}
if (shouldBreak)
continue;
if ((id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0)) &&
addTileTop > oldTile.Z && oldTile.Z + id.CalcHeight > addTileZ)
return HousePlacementResult.BadStatic; // Broke rule #2
/*else if (isFoundation && !hasSurface && (id.Flags & TileFlag.Surface) != 0 && (oldTile.Z + id.CalcHeight) == center.Z)
hasSurface = true;*/
}
Point2D borderPoint = new Point2D(tileX + xOffset, tileY + yOffset);
for (int j = 0; j < items.Count; ++j)
{
Item item = items[j];
ItemData id = item.ItemData;
if (!borders.Contains(borderPoint))
borders.Add(borderPoint);
if (addTileTop > item.Z && item.Z + id.CalcHeight > addTileZ)
{
if (item.Movable)
toMove.Add(item);
else if (id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0))
return HousePlacementResult.BadItem; // Broke rule #2
}
/*else if (isFoundation && !hasSurface && (id.Flags & TileFlag.Surface) != 0 && (item.Z + id.CalcHeight) == center.Z)
{
hasSurface = true;
}*/
}
if (isFoundation && !hasSurface)
return HousePlacementResult.NoSurface; // Broke rule #4
for (int j = 0; j < mobiles.Count; ++j)
{
Mobile m = mobiles[j];
if (addTileTop > m.Z && m.Z + 16 > addTileZ)
toMove.Add(m);
}
}
for (int i = 0; i < m_RoadIDs.Length; i += 2)
if (landID >= m_RoadIDs[i] && landID <= m_RoadIDs[i + 1])
return HousePlacementResult.BadLand; // Broke rule #5
if (hasFoundation)
{
for (int xOffset = -1; xOffset <= 1; ++xOffset)
for (int yOffset = -YardSize; yOffset <= YardSize; ++yOffset)
{
Point2D yardPoint = new Point2D(tileX + xOffset, tileY + yOffset);
if (!yard.Contains(yardPoint))
yard.Add(yardPoint);
}
for (int xOffset = -1; xOffset <= 1; ++xOffset)
for (int yOffset = -1; yOffset <= 1; ++yOffset)
{
if (xOffset == 0 && yOffset == 0)
continue;
// To ease this rule, we will not add to the border list if the tile here is under a base floor (z<=8)
int vx = x + xOffset;
int vy = y + yOffset;
if (vx >= 0 && vx < mcl.Width && vy >= 0 && vy < mcl.Height)
{
StaticTile[] breakTiles = mcl.Tiles[vx][vy];
bool shouldBreak = false;
for (int i = 0; !shouldBreak && i < breakTiles.Length; ++i)
{
StaticTile breakTile = breakTiles[i];
if (breakTile.Height == 0 && breakTile.Z <= 8 &&
TileData.ItemTable[breakTile.ID & TileData.MaxItemValue].Surface)
shouldBreak = true;
}
if (shouldBreak)
continue;
}
Point2D borderPoint = new Point2D(tileX + xOffset, tileY + yOffset);
if (!borders.Contains(borderPoint))
borders.Add(borderPoint);
}
}
}
}
for (int i = 0; i < borders.Count; ++i)
{
@ -290,8 +290,8 @@ namespace Server.Multis
StaticTile tile = tiles[j];
ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
if (id.Impassable || id.Surface && (id.Flags & TileFlag.Background) == 0 &&
tile.Z + id.CalcHeight > center.Z + 2)
if (id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0 &&
tile.Z + id.CalcHeight > center.Z + 2))
return HousePlacementResult.BadStatic; // Broke rule #1
}
@ -307,8 +307,8 @@ namespace Server.Multis
ItemData id = item.ItemData;
if (id.Impassable || id.Surface && (id.Flags & TileFlag.Background) == 0 &&
item.Z + id.CalcHeight > center.Z + 2)
if (id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0 &&
item.Z + id.CalcHeight > center.Z + 2))
return HousePlacementResult.BadItem; // Broke rule #1
}
}
@ -345,7 +345,7 @@ namespace Server.Multis
{
for ( int j = 0; j < tile.Length; ++j )
{
if ( (TileData.ItemTable[tile[j].ID & TileData.MaxItemValue].Flags & (TileFlag.Impassable | TileFlag.Surface)) != 0 )
if ((TileData.ItemTable[tile[j].ID & TileData.MaxItemValue].Flags & (TileFlag.Impassable | TileFlag.Surface)) != 0)
{
eable.Free();
return HousePlacementResult.BadStatic; // Broke rule #3

View file

@ -56,7 +56,7 @@ namespace Server.Items
{
private const int LabelColor = 0x7FFF;
private const int LabelColorDisabled = 0x4210;
private Mobile m_From;
private readonly Mobile m_From;
public HousePlacementCategoryGump(Mobile from) : base(50, 50)
{
@ -95,21 +95,21 @@ namespace Server.Items
switch (info.ButtonID)
{
case 1: // Classic Houses
{
// TODO: Add flag to use ClassicHouses or EJ
m_From.SendGump(new HousePlacementListGump(m_From, HousePlacementEntry.HousesEJ));
break;
}
{
// TODO: Add flag to use ClassicHouses or EJ
m_From.SendGump(new HousePlacementListGump(m_From, HousePlacementEntry.HousesEJ));
break;
}
case 2: // 2-Story Customizable Houses
{
m_From.SendGump(new HousePlacementListGump(m_From, HousePlacementEntry.TwoStoryFoundations));
break;
}
{
m_From.SendGump(new HousePlacementListGump(m_From, HousePlacementEntry.TwoStoryFoundations));
break;
}
case 3: // 3-Story Customizable Houses
{
m_From.SendGump(new HousePlacementListGump(m_From, HousePlacementEntry.ThreeStoryFoundations));
break;
}
{
m_From.SendGump(new HousePlacementListGump(m_From, HousePlacementEntry.ThreeStoryFoundations));
break;
}
}
}
}
@ -118,8 +118,8 @@ namespace Server.Items
{
private const int LabelColor = 0x7FFF;
private const int LabelHue = 0x480;
private HousePlacementEntry[] m_Entries;
private Mobile m_From;
private readonly HousePlacementEntry[] m_Entries;
private readonly Mobile m_From;
public HousePlacementListGump(Mobile from, HousePlacementEntry[] entries) : base(50, 50)
{
@ -218,8 +218,8 @@ namespace Server.Items
public class NewHousePlacementTarget : MultiTarget
{
private HousePlacementEntry[] m_Entries;
private HousePlacementEntry m_Entry;
private readonly HousePlacementEntry[] m_Entries;
private readonly HousePlacementEntry m_Entry;
private bool m_Placed;
@ -273,11 +273,11 @@ namespace Server.Items
public class HousePlacementEntry
{
private static Dictionary<Type, object> m_Table;
private int m_Lockdowns;
private int m_NewLockdowns;
private int m_NewStorage;
private int m_Storage;
private static readonly Dictionary<Type, object> m_Table;
private readonly int m_Lockdowns;
private readonly int m_NewLockdowns;
private readonly int m_NewStorage;
private readonly int m_Storage;
static HousePlacementEntry()
{
@ -305,19 +305,19 @@ namespace Server.Items
MultiID = multiID;
}
public Type Type{ get; }
public Type Type { get; }
public int Description{ get; }
public int Description { get; }
public int Storage => BaseHouse.NewVendorSystem ? m_NewStorage : m_Storage;
public int Lockdowns => BaseHouse.NewVendorSystem ? m_NewLockdowns : m_Lockdowns;
public int Vendors{ get; }
public int Vendors { get; }
public int Cost{ get; }
public int Cost { get; }
public int MultiID{ get; }
public int MultiID { get; }
public Point3D Offset{ get; }
public Point3D Offset { get; }
public static HousePlacementEntry[] ClassicHouses { get; } =
{
@ -343,50 +343,49 @@ namespace Server.Items
new HousePlacementEntry(typeof(Castle), 1011314, 4076, 2038, 4688, 2344, 78, 865250, 0, 16, 0, 0x007E)
};
public static HousePlacementEntry[] HousesEJ { get; } = {
new HousePlacementEntry(typeof(SmallOldHouse), 1011303, 425, 212, 489, 244, 10, 36750, 0, 4, 0, 0x0064),
new HousePlacementEntry(typeof(SmallOldHouse), 1011304, 425, 212, 489, 244, 10, 36750, 0, 4, 0, 0x0066),
new HousePlacementEntry(typeof(SmallOldHouse), 1011305, 425, 212, 489, 244, 10, 36500, 0, 4, 0, 0x0068),
new HousePlacementEntry(typeof(SmallOldHouse), 1011306, 425, 212, 489, 244, 10, 35000, 0, 4, 0, 0x006A),
new HousePlacementEntry(typeof(SmallOldHouse), 1011307, 425, 212, 489, 244, 10, 36500, 0, 4, 0, 0x006C),
new HousePlacementEntry(typeof(SmallOldHouse), 1011308, 425, 212, 489, 244, 10, 36500, 0, 4, 0, 0x006E),
new HousePlacementEntry(typeof(SmallShop), 1011321, 425, 212, 489, 244, 10, 50250, -1, 4, 0, 0x00A0),
new HousePlacementEntry(typeof(SmallShop), 1011322, 425, 212, 489, 244, 10, 52250, 0, 4, 0, 0x00A2),
new HousePlacementEntry(typeof(SmallTower), 1011317, 580, 290, 667, 333, 14, 73250, 3, 4, 0, 0x0098),
new HousePlacementEntry(typeof(TwoStoryVilla), 1011319, 1100, 550, 1265, 632, 24, 113500, 3, 6, 0, 0x009E),
new HousePlacementEntry(typeof(SandStonePatio), 1011320, 850, 425, 1265, 632, 24, 76250, -1, 4, 0, 0x009C),
new HousePlacementEntry(typeof(LogCabin), 1011318, 1100, 550, 1265, 632, 24, 81250, 1, 6, 0, 0x009A),
new HousePlacementEntry(typeof(GuildHouse), 1011309, 1370, 685, 1576, 788, 28, 131250, -1, 7, 0, 0x0074),
new HousePlacementEntry(typeof(TwoStoryHouse), 1011310, 1370, 685, 1576, 788, 28, 162500, -3, 7, 0, 0x0076),
new HousePlacementEntry(typeof(TwoStoryHouse), 1011311, 1370, 685, 1576, 788, 28, 162750, -3, 7, 0, 0x0078),
new HousePlacementEntry(typeof(LargePatioHouse), 1011315, 1370, 685, 1576, 788, 28, 129000, -4, 7, 0, 0x008C),
new HousePlacementEntry(typeof(LargeMarbleHouse), 1011316, 1370, 685, 1576, 788, 28, 160250, -4, 7, 0, 0x0096),
new HousePlacementEntry(typeof(Tower), 1011312, 2119, 1059, 2437, 1218, 42, 366250, 0, 7, 0, 0x007A),
new HousePlacementEntry(typeof(Keep), 1011313, 2625, 1312, 3019, 1509, 52, 562500, 0, 11, 0, 0x007C),
new HousePlacementEntry(typeof(Castle), 1011314, 4076, 2038, 4688, 2344, 78, 865000, 0, 16, 0, 0x007E),
public static HousePlacementEntry[] HousesEJ { get; } = {
new HousePlacementEntry(typeof(SmallOldHouse), 1011303, 425, 212, 489, 244, 10, 36750, 0, 4, 0, 0x0064),
new HousePlacementEntry(typeof(SmallOldHouse), 1011304, 425, 212, 489, 244, 10, 36750, 0, 4, 0, 0x0066),
new HousePlacementEntry(typeof(SmallOldHouse), 1011305, 425, 212, 489, 244, 10, 36500, 0, 4, 0, 0x0068),
new HousePlacementEntry(typeof(SmallOldHouse), 1011306, 425, 212, 489, 244, 10, 35000, 0, 4, 0, 0x006A),
new HousePlacementEntry(typeof(SmallOldHouse), 1011307, 425, 212, 489, 244, 10, 36500, 0, 4, 0, 0x006C),
new HousePlacementEntry(typeof(SmallOldHouse), 1011308, 425, 212, 489, 244, 10, 36500, 0, 4, 0, 0x006E),
new HousePlacementEntry(typeof(SmallShop), 1011321, 425, 212, 489, 244, 10, 50250, -1, 4, 0, 0x00A0),
new HousePlacementEntry(typeof(SmallShop), 1011322, 425, 212, 489, 244, 10, 52250, 0, 4, 0, 0x00A2),
new HousePlacementEntry(typeof(SmallTower), 1011317, 580, 290, 667, 333, 14, 73250, 3, 4, 0, 0x0098),
new HousePlacementEntry(typeof(TwoStoryVilla), 1011319, 1100, 550, 1265, 632, 24, 113500, 3, 6, 0, 0x009E),
new HousePlacementEntry(typeof(SandStonePatio), 1011320, 850, 425, 1265, 632, 24, 76250, -1, 4, 0, 0x009C),
new HousePlacementEntry(typeof(LogCabin), 1011318, 1100, 550, 1265, 632, 24, 81250, 1, 6, 0, 0x009A),
new HousePlacementEntry(typeof(GuildHouse), 1011309, 1370, 685, 1576, 788, 28, 131250, -1, 7, 0, 0x0074),
new HousePlacementEntry(typeof(TwoStoryHouse), 1011310, 1370, 685, 1576, 788, 28, 162500, -3, 7, 0, 0x0076),
new HousePlacementEntry(typeof(TwoStoryHouse), 1011311, 1370, 685, 1576, 788, 28, 162750, -3, 7, 0, 0x0078),
new HousePlacementEntry(typeof(LargePatioHouse), 1011315, 1370, 685, 1576, 788, 28, 129000, -4, 7, 0, 0x008C),
new HousePlacementEntry(typeof(LargeMarbleHouse), 1011316, 1370, 685, 1576, 788, 28, 160250, -4, 7, 0, 0x0096),
new HousePlacementEntry(typeof(Tower), 1011312, 2119, 1059, 2437, 1218, 42, 366250, 0, 7, 0, 0x007A),
new HousePlacementEntry(typeof(Keep), 1011313, 2625, 1312, 3019, 1509, 52, 562500, 0, 11, 0, 0x007C),
new HousePlacementEntry(typeof(Castle), 1011314, 4076, 2038, 4688, 2344, 78, 865000, 0, 16, 0, 0x007E),
new HousePlacementEntry(typeof(TrinsicKeep), 1158748, 2625, 1312, 3019, 1509, 52, 29643750, 0, 11, 0, 0x147E),
new HousePlacementEntry(typeof(GothicRoseCastle), 1158749, 4076, 2038, 4688, 2344, 78, 44808750, 0, 16, 0, 0x147F),
new HousePlacementEntry(typeof(ElsaCastle), 1158750, 4076, 2038, 4688, 2344, 78, 45450000, 0, 16, 0, 0x1480),
new HousePlacementEntry(typeof(Spires), 1158761, 4076, 2038, 4688, 2344, 78, 47025000, 0, 16, 0, 0x1481),
new HousePlacementEntry(typeof(CastleOfOceania), 1158760, 4076, 2038, 4688, 2344, 78, 48971250, 0, 16, 0, 0x1482),
new HousePlacementEntry(typeof(FeudalCastle), 1158762, 4076, 2038, 4688, 2344, 78, 27337500, 0, 16, 0, 0x1483),
new HousePlacementEntry(typeof(RobinsNest), 1158850, 2625, 1312, 3019, 1509, 52, 25301250, 0, 11, 0, 0x1484),
new HousePlacementEntry(typeof(TraditionalKeep), 1158851, 2625, 1312, 3019, 1509, 52, 26685000, 0, 11, 0, 0x1485),
new HousePlacementEntry(typeof(VillaCrowley), 1158852, 2625, 1312, 3019, 1509, 52, 21813750, 0, 11, 0, 0x1486),
new HousePlacementEntry(typeof(DarkthornKeep), 1158853, 2625, 1312, 3019, 1509, 52, 27990000, 0, 11, 0, 0x1487),
new HousePlacementEntry(typeof(SandalwoodKeep), 1158854, 2625, 1312, 3019, 1509, 52, 23456250, 0, 11, 0, 0x1488),
new HousePlacementEntry(typeof(CasaMoga), 1158855, 2625, 1312, 3019, 1509, 52, 26313750, 0, 11, 0, 0x1489),
new HousePlacementEntry(typeof(TrinsicKeep), 1158748, 2625, 1312, 3019, 1509, 52, 29643750, 0, 11, 0, 0x147E),
new HousePlacementEntry(typeof(GothicRoseCastle), 1158749, 4076, 2038, 4688, 2344, 78, 44808750, 0, 16, 0, 0x147F),
new HousePlacementEntry(typeof(ElsaCastle), 1158750, 4076, 2038, 4688, 2344, 78, 45450000, 0, 16, 0, 0x1480),
new HousePlacementEntry(typeof(Spires), 1158761, 4076, 2038, 4688, 2344, 78, 47025000, 0, 16, 0, 0x1481),
new HousePlacementEntry(typeof(CastleOfOceania), 1158760, 4076, 2038, 4688, 2344, 78, 48971250, 0, 16, 0, 0x1482),
new HousePlacementEntry(typeof(FeudalCastle), 1158762, 4076, 2038, 4688, 2344, 78, 27337500, 0, 16, 0, 0x1483),
new HousePlacementEntry(typeof(RobinsNest), 1158850, 2625, 1312, 3019, 1509, 52, 25301250, 0, 11, 0, 0x1484),
new HousePlacementEntry(typeof(TraditionalKeep), 1158851, 2625, 1312, 3019, 1509, 52, 26685000, 0, 11, 0, 0x1485),
new HousePlacementEntry(typeof(VillaCrowley), 1158852, 2625, 1312, 3019, 1509, 52, 21813750, 0, 11, 0, 0x1486),
new HousePlacementEntry(typeof(DarkthornKeep), 1158853, 2625, 1312, 3019, 1509, 52, 27990000, 0, 11, 0, 0x1487),
new HousePlacementEntry(typeof(SandalwoodKeep), 1158854, 2625, 1312, 3019, 1509, 52, 23456250, 0, 11, 0, 0x1488),
new HousePlacementEntry(typeof(CasaMoga), 1158855, 2625, 1312, 3019, 1509, 52, 26313750, 0, 11, 0, 0x1489),
new HousePlacementEntry(typeof(RobinsRoost), 1158960, 4076, 2038, 4688, 2344, 78, 43863750, 0, 16, 0, 0x148A),
new HousePlacementEntry(typeof(Camelot), 1158961, 4076, 2038, 4688, 2344, 78, 47092500, 0, 16, 0, 0x148B),
new HousePlacementEntry(typeof(LacrimaeInCaelo), 1158962, 4076, 2038, 4688, 2344, 78, 45315000, 0, 16, 0, 0x148C),
new HousePlacementEntry(typeof(OkinawaSweetDreamCastle), 1158963, 4076, 2038, 4688, 2344, 78, 40128750, 0, 16, 0, 0x148D),
new HousePlacementEntry(typeof(TheSandstoneCastle), 1158964, 4076, 2038, 4688, 2344, 78, 48690000, 0, 16, 0, 0x148E),
new HousePlacementEntry(typeof(RobinsRoost), 1158960, 4076, 2038, 4688, 2344, 78, 43863750, 0, 16, 0, 0x148A),
new HousePlacementEntry(typeof(Camelot), 1158961, 4076, 2038, 4688, 2344, 78, 47092500, 0, 16, 0, 0x148B),
new HousePlacementEntry(typeof(LacrimaeInCaelo), 1158962, 4076, 2038, 4688, 2344, 78, 45315000, 0, 16, 0, 0x148C),
new HousePlacementEntry(typeof(OkinawaSweetDreamCastle), 1158963, 4076, 2038, 4688, 2344, 78, 40128750, 0, 16, 0, 0x148D),
new HousePlacementEntry(typeof(TheSandstoneCastle), 1158964, 4076, 2038, 4688, 2344, 78, 48690000, 0, 16, 0, 0x148E),
new HousePlacementEntry(typeof(GrimswindSisters), 1158965, 4076, 2038, 4688, 2344, 78, 42142500, 0, 16, 0, 0x148F)
};
public static HousePlacementEntry[] TwoStoryFoundations { get; } =
{
new HousePlacementEntry(typeof(HouseFoundation), 1060241, 425, 212, 489, 244, 10, 30500, 0, 4, 0,
@ -485,7 +484,6 @@ namespace Server.Items
0x143A) // 13x13 2-Story Customizable House
};
public static HousePlacementEntry[] ThreeStoryFoundations { get; } =
{
new HousePlacementEntry(typeof(HouseFoundation), 1060272, 1150, 575, 1323, 661, 24, 73500, 0, 8, 0,
@ -648,94 +646,94 @@ namespace Server.Items
prevHouse.Delete();
//Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
// Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
HousePlacementResult res = HousePlacement.Check(from, MultiID, center, out List<IEntity> toMove);
switch (res)
{
case HousePlacementResult.Valid:
{
if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse(from))
{
from.SendLocalizedMessage(501271); // You already own a house, you may not place another!
}
else
{
BaseHouse house = ConstructHouse(from);
if (house == null)
return;
house.Price = Cost;
if (from.AccessLevel >= AccessLevel.GameMaster)
if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse(from))
{
from.SendMessage("{0} gold would have been withdrawn from your bank if you were not a GM.",
Cost.ToString());
from.SendLocalizedMessage(501271); // You already own a house, you may not place another!
}
else
{
if (Banker.Withdraw(from, Cost))
BaseHouse house = ConstructHouse(from);
if (house == null)
return;
house.Price = Cost;
if (from.AccessLevel >= AccessLevel.GameMaster)
{
from.SendLocalizedMessage(1060398,
Cost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
from.SendMessage("{0} gold would have been withdrawn from your bank if you were not a GM.",
Cost.ToString());
}
else
{
house.RemoveKeys(from);
house.Delete();
from.SendLocalizedMessage(
1060646); // You do not have the funds available in your bank box to purchase this house. Try placing a smaller house, or adding gold or checks to your bank box.
return;
if (Banker.Withdraw(from, Cost))
{
from.SendLocalizedMessage(1060398,
Cost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
}
else
{
house.RemoveKeys(from);
house.Delete();
from.SendLocalizedMessage(
1060646); // You do not have the funds available in your bank box to purchase this house. Try placing a smaller house, or adding gold or checks to your bank box.
return;
}
}
house.MoveToWorld(center, from.Map);
for (int i = 0; i < toMove.Count; ++i)
{
object o = toMove[i];
if (o is Mobile mobile)
mobile.Location = house.BanLocation;
else if (o is Item item)
item.Location = house.BanLocation;
}
}
house.MoveToWorld(center, from.Map);
for (int i = 0; i < toMove.Count; ++i)
{
object o = toMove[i];
if (o is Mobile mobile)
mobile.Location = house.BanLocation;
else if (o is Item item)
item.Location = house.BanLocation;
}
break;
}
break;
}
case HousePlacementResult.BadItem:
case HousePlacementResult.BadLand:
case HousePlacementResult.BadStatic:
case HousePlacementResult.BadRegionHidden:
case HousePlacementResult.NoSurface:
{
from.SendLocalizedMessage(
1043287); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
break;
}
{
from.SendLocalizedMessage(
1043287); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
break;
}
case HousePlacementResult.BadRegion:
{
from.SendLocalizedMessage(501265); // Housing cannot be created in this area.
break;
}
{
from.SendLocalizedMessage(501265); // Housing cannot be created in this area.
break;
}
case HousePlacementResult.BadRegionTemp:
{
from.SendLocalizedMessage(
501270); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
break;
}
{
from.SendLocalizedMessage(
501270); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
break;
}
case HousePlacementResult.BadRegionRaffle:
{
from.SendLocalizedMessage(1150493); // You must have a deed for this plot of land in order to build here.
break;
}
{
from.SendLocalizedMessage(1150493); // You must have a deed for this plot of land in order to build here.
break;
}
case HousePlacementResult.InvalidCastleKeep:
{
from.SendLocalizedMessage(1061122); // Castles and keeps cannot be created here.
break;
}
{
from.SendLocalizedMessage(1061122); // Castles and keeps cannot be created here.
break;
}
}
}
@ -750,96 +748,96 @@ namespace Server.Items
switch (res)
{
case HousePlacementResult.Valid:
{
if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse(from))
{
from.SendLocalizedMessage(501271); // You already own a house, you may not place another!
}
else
{
from.SendLocalizedMessage(1011576); // This is a valid location.
PreviewHouse prev = new PreviewHouse(MultiID);
MultiComponentList mcl = prev.Components;
Point3D banLoc = new Point3D(center.X + mcl.Min.X, center.Y + mcl.Max.Y + 1, center.Z);
for (int i = 0; i < mcl.List.Length; ++i)
if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse(from))
{
MultiTileEntry entry = mcl.List[i];
from.SendLocalizedMessage(501271); // You already own a house, you may not place another!
}
else
{
from.SendLocalizedMessage(1011576); // This is a valid location.
int itemID = entry.m_ItemID;
PreviewHouse prev = new PreviewHouse(MultiID);
if (itemID >= 0xBA3 && itemID <= 0xC0E)
MultiComponentList mcl = prev.Components;
Point3D banLoc = new Point3D(center.X + mcl.Min.X, center.Y + mcl.Max.Y + 1, center.Z);
for (int i = 0; i < mcl.List.Length; ++i)
{
banLoc = new Point3D(center.X + entry.m_OffsetX, center.Y + entry.m_OffsetY, center.Z);
break;
MultiTileEntry entry = mcl.List[i];
int itemID = entry.ItemId;
if (itemID >= 0xBA3 && itemID <= 0xC0E)
{
banLoc = new Point3D(center.X + entry.OffsetX, center.Y + entry.OffsetY, center.Z);
break;
}
}
for (int i = 0; i < toMove.Count; ++i)
{
object o = toMove[i];
if (o is Mobile mobile)
mobile.Location = banLoc;
else if (o is Item item)
item.Location = banLoc;
}
prev.MoveToWorld(center, from.Map);
/* You are about to place a new house.
* Placing this house will condemn any and all of your other houses that you may have.
* All of your houses on all shards will be affected.
*
* In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.
*
* Once you accept these terms, these effects cannot be reversed.
* Re-deeding or transferring your new house will not uncondemn your other house(s) nor will the one week timer be removed.
*
* If you are absolutely certain you wish to proceed, click the button next to OKAY below.
* If you do not wish to trade for this house, click CANCEL.
*/
from.SendGump(new WarningGump(1060635, 30720, 1049583, 32512, 420, 280, okay => PlacementWarning_Callback(from, okay, prev)));
return true;
}
for (int i = 0; i < toMove.Count; ++i)
{
object o = toMove[i];
if (o is Mobile mobile)
mobile.Location = banLoc;
else if (o is Item item)
item.Location = banLoc;
}
prev.MoveToWorld(center, from.Map);
/* You are about to place a new house.
* Placing this house will condemn any and all of your other houses that you may have.
* All of your houses on all shards will be affected.
*
* In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.
*
* Once you accept these terms, these effects cannot be reversed.
* Re-deeding or transferring your new house will not uncondemn your other house(s) nor will the one week timer be removed.
*
* If you are absolutely certain you wish to proceed, click the button next to OKAY below.
* If you do not wish to trade for this house, click CANCEL.
*/
from.SendGump(new WarningGump(1060635, 30720, 1049583, 32512, 420, 280, okay => PlacementWarning_Callback(from, okay, prev)));
return true;
break;
}
break;
}
case HousePlacementResult.BadItem:
case HousePlacementResult.BadLand:
case HousePlacementResult.BadStatic:
case HousePlacementResult.BadRegionHidden:
case HousePlacementResult.NoSurface:
{
from.SendLocalizedMessage(
1043287); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
break;
}
{
from.SendLocalizedMessage(
1043287); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
break;
}
case HousePlacementResult.BadRegion:
{
from.SendLocalizedMessage(501265); // Housing cannot be created in this area.
break;
}
{
from.SendLocalizedMessage(501265); // Housing cannot be created in this area.
break;
}
case HousePlacementResult.BadRegionTemp:
{
from.SendLocalizedMessage(
501270); //Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
break;
}
{
from.SendLocalizedMessage(
501270); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
break;
}
case HousePlacementResult.BadRegionRaffle:
{
from.SendLocalizedMessage(1150493); // You must have a deed for this plot of land in order to build here.
break;
}
{
from.SendLocalizedMessage(1150493); // You must have a deed for this plot of land in order to build here.
break;
}
case HousePlacementResult.InvalidCastleKeep:
{
from.SendLocalizedMessage(1061122); // Castles and keeps cannot be created here.
break;
}
{
from.SendLocalizedMessage(1061122); // Castles and keeps cannot be created here.
break;
}
}
return false;

View file

@ -18,7 +18,7 @@ namespace Server.Multis
{
}
public BaseHouse Owner{ get; private set; }
public BaseHouse Owner { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool RestrictDecay
@ -32,11 +32,11 @@ namespace Server.Multis
}
[CommandProperty(AccessLevel.GameMaster)]
public Mobile OriginalOwner{ get; private set; }
public Mobile OriginalOwner { get; private set; }
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
public bool GettingProperties{ get; private set; }
public bool GettingProperties { get; private set; }
public string GetName() => Name ?? "An Unnamed House";
@ -109,13 +109,9 @@ namespace Server.Multis
{
if (Owner.IsFriend(m) && m.AccessLevel < AccessLevel.GameMaster)
{
#region Mondain's Legacy
if (Core.ML && Owner.IsOwner(m) || !Core.ML)
if ((Core.ML && Owner.IsOwner(m)) || !Core.ML)
Owner.RefreshDecay();
#endregion
if (!Core.AOS)
m.SendLocalizedMessage(501293); // Welcome back to the house, friend!
}
@ -131,7 +127,7 @@ namespace Server.Multis
{
if (okay && Owner != null && Owner.Owner == null && Owner.DecayLevel != DecayLevel.DemolitionPending)
{
bool canClaim = Owner.CoOwners?.Count > 0 && Owner.IsCoOwner(from) || Owner.IsFriend(from);
bool canClaim = (Owner.CoOwners?.Count > 0 && Owner.IsCoOwner(from)) || Owner.IsFriend(from);
if (canClaim && !BaseHouse.HasAccountHouse(from))
{
@ -151,7 +147,7 @@ namespace Server.Multis
if (m.AccessLevel < AccessLevel.GameMaster && Owner.Owner == null &&
Owner.DecayLevel != DecayLevel.DemolitionPending)
{
bool canClaim = Owner?.CoOwners.Count > 0 && Owner.IsCoOwner(m) || Owner.IsFriend(m);
bool canClaim = (Owner?.CoOwners.Count > 0 && Owner.IsCoOwner(m)) || Owner.IsFriend(m);
if (canClaim && !BaseHouse.HasAccountHouse(m))
m.SendGump(new WarningGump(501036, 32512, 1049719, 32512, 420, 280, okay => ClaimGump_Callback(m, okay)));
@ -193,12 +189,12 @@ namespace Server.Multis
switch (version)
{
case 0:
{
Owner = reader.ReadItem() as BaseHouse;
OriginalOwner = reader.ReadMobile();
{
Owner = reader.ReadItem() as BaseHouse;
OriginalOwner = reader.ReadMobile();
break;
}
break;
}
}
if (Name == "a house sign")
@ -207,7 +203,7 @@ namespace Server.Multis
private class VendorsEntry : ContextMenuEntry
{
private HouseSign m_Sign;
private readonly HouseSign m_Sign;
public VendorsEntry(HouseSign sign) : base(6211) => m_Sign = sign;
@ -228,7 +224,7 @@ namespace Server.Multis
private class ReclaimVendorInventoryEntry : ContextMenuEntry
{
private HouseSign m_Sign;
private readonly HouseSign m_Sign;
public ReclaimVendorInventoryEntry(HouseSign sign) : base(6213) => m_Sign = sign;

View file

@ -23,16 +23,16 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public Item Target{ get; set; }
public Item Target { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level{ get; set; }
public SecureLevel Level { get; set; }
public bool CheckAccess(Mobile m)
{
BaseHouse house = BaseHouse.FindHouseAt(this);
return (house == null || house.Public && !house.IsBanned(m) || house.HasAccess(m)) &&
return (house == null || (house.Public && !house.IsBanned(m)) || house.HasAccess(m)) &&
house?.HasSecureAccess(m, Level) == true;
}
@ -82,28 +82,28 @@ namespace Server.Items
switch (version)
{
case 1:
{
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
{
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
Target = reader.ReadItem();
{
Target = reader.ReadItem();
if (version < 0)
Level = SecureLevel.Anyone;
if (version < 0)
Level = SecureLevel.Anyone;
break;
}
break;
}
}
}
private class EffectTimer : Timer
{
private int m_EffectID;
private Point3D m_Location;
private Map m_Map;
private int m_SoundID;
private readonly int m_EffectID;
private readonly Point3D m_Location;
private readonly Map m_Map;
private readonly int m_SoundID;
public EffectTimer(Point3D p, Map map, int effectID, int soundID, TimeSpan delay) : base(delay)
{
@ -125,8 +125,8 @@ namespace Server.Items
private class DelayTimer : Timer
{
private Mobile m_Mobile;
private HouseTeleporter m_Teleporter;
private readonly Mobile m_Mobile;
private readonly HouseTeleporter m_Teleporter;
public DelayTimer(HouseTeleporter tp, Mobile m) : base(TimeSpan.FromSeconds(1.0))
{

View file

@ -44,7 +44,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -88,7 +88,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -137,7 +137,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -185,7 +185,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -195,7 +195,7 @@ namespace Server.Multis
}
}
public class Keep : BaseHouse //warning: ODD shape!
public class Keep : BaseHouse // warning: ODD shape!
{
public static Rectangle2D[] AreaArray =
{
@ -227,7 +227,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -268,7 +268,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -312,7 +312,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -352,7 +352,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -391,7 +391,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -432,7 +432,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -472,7 +472,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -514,7 +514,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -543,7 +543,7 @@ namespace Server.Multis
AddDoor(door, -2, 0, id == 0xA2 ? 24 : 27);
//AddSouthDoor( false, -2, 0, 27 - (id == 0xA2 ? 3 : 0), keyValue );
// AddSouthDoor( false, -2, 0, 27 - (id == 0xA2 ? 3 : 0), keyValue );
SetSign(3, 4, 7 - (id == 0xA2 ? 2 : 0));
}
@ -572,7 +572,7 @@ namespace Server.Multis
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)

View file

@ -29,7 +29,7 @@ namespace Server.Multis
public override int LabelNumber => 1061690; // Packing Crate
public BaseHouse House{ get; set; }
public BaseHouse House { get; set; }
public override int DefaultMaxItems => 0;
public override int DefaultMaxWeight => 0;
@ -41,7 +41,7 @@ namespace Server.Multis
{
base.AddNameProperties( list );
if ( House != null && House.InternalizedVendors.Count > 0 )
if (House != null && House.InternalizedVendors.Count > 0)
list.Add( 1061833, House.InternalizedVendors.Count.ToString() ); // This packing crate contains ~1_COUNT~ vendors/barkeepers.
}
*/
@ -116,14 +116,14 @@ namespace Server.Multis
}
for (int i = 0; i < Rows; i++)
for (int j = 0; j < Columns; j++)
if (!positions[i, j])
{
int x = Bounds.X + j * HorizontalSpacing;
int y = Bounds.Y + i * VerticalSpacing;
for (int j = 0; j < Columns; j++)
if (!positions[i, j])
{
int x = Bounds.X + j * HorizontalSpacing;
int y = Bounds.Y + i * VerticalSpacing;
return new Point3D(x, y, 0);
}
return new Point3D(x, y, 0);
}
return Point3D.Zero;
}
@ -230,7 +230,7 @@ namespace Server.Multis
public class InternalizeTimer : Timer
{
private MovingCrate m_Crate;
private readonly MovingCrate m_Crate;
public InternalizeTimer(MovingCrate crate) : base(TimeSpan.FromMinutes(5.0))
{

View file

@ -19,11 +19,11 @@ namespace Server.Multis
{
MultiTileEntry entry = mcl.List[i];
if (entry.m_Flags == 0)
if (entry.Flags == 0)
{
Item item = new Static((int)entry.m_ItemID);
Item item = new Static((int)entry.ItemId);
item.MoveToWorld(new Point3D(X + entry.m_OffsetX, Y + entry.m_OffsetY, Z + entry.m_OffsetZ), Map);
item.MoveToWorld(new Point3D(X + entry.OffsetX, Y + entry.OffsetY, Z + entry.OffsetZ), Map);
m_Components.Add(item);
}
@ -113,11 +113,11 @@ namespace Server.Multis
switch (version)
{
case 0:
{
m_Components = reader.ReadStrongItemList();
{
m_Components = reader.ReadStrongItemList();
break;
}
break;
}
}
Timer.DelayCall(TimeSpan.Zero, Delete);
@ -125,7 +125,7 @@ namespace Server.Multis
private class DecayTimer : Timer
{
private Item m_Item;
private readonly Item m_Item;
public DecayTimer(Item item) : base(TimeSpan.FromSeconds(20.0))
{