Adds style cop (#109)
This commit is contained in:
parent
3e715bcb60
commit
556a17aba8
1725 changed files with 33831 additions and 38046 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue