parent
096d39609e
commit
8e9221bb5a
400 changed files with 3688 additions and 5969 deletions
|
|
@ -231,10 +231,8 @@ namespace Server.Multis
|
|||
Sector sector = map.GetSector(loc);
|
||||
|
||||
for (int i = 0; i < sector.Multis.Count; i++)
|
||||
{
|
||||
if (sector.Multis[i] is BaseBoat boat && boat.Contains(loc.X, loc.Y))
|
||||
return boat;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1121,7 +1119,7 @@ namespace Server.Multis
|
|||
return false;
|
||||
}
|
||||
|
||||
if (SetFacing((Direction)(((int)m_Facing + offset) & 0x7))) return true;
|
||||
if (SetFacing((Direction)((int)m_Facing + offset & 0x7))) return true;
|
||||
if (message)
|
||||
TillerMan.Say(501423); // Ar, can't turn sir.
|
||||
|
||||
|
|
@ -1296,7 +1294,7 @@ namespace Server.Multis
|
|||
else // Right, Down, Left and Up
|
||||
maxSpeed = Math.Min(adx, ady);
|
||||
|
||||
return (Direction)((iDir - (int)Facing) & 0x7);
|
||||
return (Direction)(iDir - (int)Facing & 0x7);
|
||||
}
|
||||
|
||||
public bool DoMovement(bool message)
|
||||
|
|
@ -1397,7 +1395,7 @@ namespace Server.Multis
|
|||
}
|
||||
|
||||
int rx = 0, ry = 0;
|
||||
Direction d = (Direction)(((int)m_Facing + (int)dir) & 0x7);
|
||||
Direction d = (Direction)((int)m_Facing + (int)dir & 0x7);
|
||||
Movement.Movement.Offset(d, ref rx, ref ry);
|
||||
|
||||
for (int i = 1; i <= speed; ++i)
|
||||
|
|
@ -1519,13 +1517,8 @@ namespace Server.Multis
|
|||
IEntity e = toMove[i];
|
||||
|
||||
if (e is Item item)
|
||||
{
|
||||
item.Location = new Point3D(item.X + xOffset, item.Y + yOffset, item.Z + zOffset);
|
||||
}
|
||||
else if (e is Mobile m)
|
||||
{
|
||||
m.Location = new Point3D(m.X + xOffset, m.Y + yOffset, m.Z + zOffset);
|
||||
}
|
||||
else if (e is Mobile m) m.Location = new Point3D(m.X + xOffset, m.Y + yOffset, m.Z + zOffset);
|
||||
}
|
||||
|
||||
Location = new Point3D(X + xOffset, Y + yOffset, Z + zOffset);
|
||||
|
|
@ -1615,7 +1608,7 @@ namespace Server.Multis
|
|||
if (Hold != null)
|
||||
Hold.Location = new Point3D(X + xOffset * HoldDistance, Y + yOffset * HoldDistance, Hold.Z);
|
||||
|
||||
int count = (m_Facing - old) & 0x7;
|
||||
int count = m_Facing - old & 0x7;
|
||||
count /= 2;
|
||||
|
||||
for (int i = 0; i < toMove.Count; ++i)
|
||||
|
|
@ -1628,26 +1621,19 @@ namespace Server.Multis
|
|||
}
|
||||
else if (e is Mobile m)
|
||||
{
|
||||
m.Direction = (m.Direction - old + facing) & Direction.Mask;
|
||||
m.Direction = m.Direction - old + facing & Direction.Mask;
|
||||
m.Location = Rotate(m.Location, count);
|
||||
}
|
||||
}
|
||||
|
||||
switch (facing)
|
||||
ItemID = facing switch
|
||||
{
|
||||
case Direction.North:
|
||||
ItemID = NorthID;
|
||||
break;
|
||||
case Direction.East:
|
||||
ItemID = EastID;
|
||||
break;
|
||||
case Direction.South:
|
||||
ItemID = SouthID;
|
||||
break;
|
||||
case Direction.West:
|
||||
ItemID = WestID;
|
||||
break;
|
||||
}
|
||||
Direction.North => NorthID,
|
||||
Direction.East => EastID,
|
||||
Direction.South => SouthID,
|
||||
Direction.West => WestID,
|
||||
_ => ItemID
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,26 +21,19 @@ namespace Server.Items
|
|||
|
||||
public void SetFacing(Direction dir)
|
||||
{
|
||||
switch (dir)
|
||||
ItemID = dir switch
|
||||
{
|
||||
case Direction.East:
|
||||
ItemID = 0x3E65;
|
||||
break;
|
||||
case Direction.West:
|
||||
ItemID = 0x3E93;
|
||||
break;
|
||||
case Direction.North:
|
||||
ItemID = 0x3EAE;
|
||||
break;
|
||||
case Direction.South:
|
||||
ItemID = 0x3EB9;
|
||||
break;
|
||||
}
|
||||
Direction.East => 0x3E65,
|
||||
Direction.West => 0x3E93,
|
||||
Direction.North => 0x3EAE,
|
||||
Direction.South => 0x3EB9,
|
||||
_ => ItemID
|
||||
};
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item item)
|
||||
{
|
||||
if (m_Boat == null || !m_Boat.Contains(from) || m_Boat.IsMoving)
|
||||
if (m_Boat?.Contains(from) != true || m_Boat.IsMoving)
|
||||
return false;
|
||||
|
||||
return base.OnDragDrop(from, item);
|
||||
|
|
@ -48,7 +41,7 @@ namespace Server.Items
|
|||
|
||||
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
||||
{
|
||||
if (m_Boat == null || !m_Boat.Contains(from) || m_Boat.IsMoving)
|
||||
if (m_Boat?.Contains(from) != true || m_Boat.IsMoving)
|
||||
return false;
|
||||
|
||||
return base.OnDragDropInto(from, item, p);
|
||||
|
|
@ -56,7 +49,7 @@ namespace Server.Items
|
|||
|
||||
public override bool CheckItemUse(Mobile from, Item item)
|
||||
{
|
||||
if (item != this && (m_Boat == null || !m_Boat.Contains(from) || m_Boat.IsMoving))
|
||||
if (item != this && (m_Boat?.Contains(from) != true || m_Boat.IsMoving))
|
||||
return false;
|
||||
|
||||
return base.CheckItemUse(from, item);
|
||||
|
|
@ -64,7 +57,7 @@ namespace Server.Items
|
|||
|
||||
public override bool CheckLift(Mobile from, Item item, ref LRReason reject)
|
||||
{
|
||||
if (m_Boat == null || !m_Boat.Contains(from) || m_Boat.IsMoving)
|
||||
if (m_Boat?.Contains(from) != true || m_Boat.IsMoving)
|
||||
return false;
|
||||
|
||||
return base.CheckLift(from, item, ref reject);
|
||||
|
|
@ -77,7 +70,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Boat == null || !m_Boat.Contains(from))
|
||||
if (m_Boat?.Contains(from) != true)
|
||||
m_Boat.TillerMan?.Say(502490); // You must be on the ship to open the hold.
|
||||
else if (m_Boat.IsMoving)
|
||||
m_Boat.TillerMan?.Say(502491); // I can not open the hold while the ship is moving.
|
||||
|
|
@ -116,4 +109,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,37 +93,23 @@ namespace Server.Items
|
|||
public void SetFacing(Direction dir)
|
||||
{
|
||||
if (IsOpen)
|
||||
switch (dir)
|
||||
ItemID = dir switch
|
||||
{
|
||||
case Direction.North:
|
||||
ItemID = Starboard ? 0x3ED4 : 0x3ED5;
|
||||
break;
|
||||
case Direction.East:
|
||||
ItemID = Starboard ? 0x3E84 : 0x3E89;
|
||||
break;
|
||||
case Direction.South:
|
||||
ItemID = Starboard ? 0x3ED5 : 0x3ED4;
|
||||
break;
|
||||
case Direction.West:
|
||||
ItemID = Starboard ? 0x3E89 : 0x3E84;
|
||||
break;
|
||||
}
|
||||
Direction.North => (Starboard ? 0x3ED4 : 0x3ED5),
|
||||
Direction.East => (Starboard ? 0x3E84 : 0x3E89),
|
||||
Direction.South => (Starboard ? 0x3ED5 : 0x3ED4),
|
||||
Direction.West => (Starboard ? 0x3E89 : 0x3E84),
|
||||
_ => ItemID
|
||||
};
|
||||
else
|
||||
switch (dir)
|
||||
ItemID = dir switch
|
||||
{
|
||||
case Direction.North:
|
||||
ItemID = Starboard ? 0x3EB2 : 0x3EB1;
|
||||
break;
|
||||
case Direction.East:
|
||||
ItemID = Starboard ? 0x3E85 : 0x3E8A;
|
||||
break;
|
||||
case Direction.South:
|
||||
ItemID = Starboard ? 0x3EB1 : 0x3EB2;
|
||||
break;
|
||||
case Direction.West:
|
||||
ItemID = Starboard ? 0x3E8A : 0x3E85;
|
||||
break;
|
||||
}
|
||||
Direction.North => (Starboard ? 0x3EB2 : 0x3EB1),
|
||||
Direction.East => (Starboard ? 0x3E85 : 0x3E8A),
|
||||
Direction.South => (Starboard ? 0x3EB1 : 0x3EB2),
|
||||
Direction.West => (Starboard ? 0x3E8A : 0x3E85),
|
||||
_ => ItemID
|
||||
};
|
||||
}
|
||||
|
||||
public void Open()
|
||||
|
|
@ -136,21 +122,14 @@ namespace Server.Items
|
|||
m_CloseTimer = new CloseTimer(this);
|
||||
m_CloseTimer.Start();
|
||||
|
||||
switch (ItemID)
|
||||
ItemID = ItemID switch
|
||||
{
|
||||
case 0x3EB1:
|
||||
ItemID = 0x3ED5;
|
||||
break;
|
||||
case 0x3E8A:
|
||||
ItemID = 0x3E89;
|
||||
break;
|
||||
case 0x3EB2:
|
||||
ItemID = 0x3ED4;
|
||||
break;
|
||||
case 0x3E85:
|
||||
ItemID = 0x3E84;
|
||||
break;
|
||||
}
|
||||
0x3EB1 => 0x3ED5,
|
||||
0x3E8A => 0x3E89,
|
||||
0x3EB2 => 0x3ED4,
|
||||
0x3E85 => 0x3E84,
|
||||
_ => ItemID
|
||||
};
|
||||
|
||||
Boat?.Refresh();
|
||||
}
|
||||
|
|
@ -235,21 +214,14 @@ namespace Server.Items
|
|||
|
||||
m_CloseTimer = null;
|
||||
|
||||
switch (ItemID)
|
||||
ItemID = ItemID switch
|
||||
{
|
||||
case 0x3ED5:
|
||||
ItemID = 0x3EB1;
|
||||
break;
|
||||
case 0x3E89:
|
||||
ItemID = 0x3E8A;
|
||||
break;
|
||||
case 0x3ED4:
|
||||
ItemID = 0x3EB2;
|
||||
break;
|
||||
case 0x3E84:
|
||||
ItemID = 0x3E85;
|
||||
break;
|
||||
}
|
||||
0x3ED5 => 0x3EB1,
|
||||
0x3E89 => 0x3E8A,
|
||||
0x3ED4 => 0x3EB2,
|
||||
0x3E84 => 0x3E85,
|
||||
_ => ItemID
|
||||
};
|
||||
|
||||
Boat?.Refresh();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,21 +19,14 @@ namespace Server.Items
|
|||
|
||||
public void SetFacing(Direction dir)
|
||||
{
|
||||
switch (dir)
|
||||
ItemID = dir switch
|
||||
{
|
||||
case Direction.South:
|
||||
ItemID = 0x3E4B;
|
||||
break;
|
||||
case Direction.North:
|
||||
ItemID = 0x3E4E;
|
||||
break;
|
||||
case Direction.West:
|
||||
ItemID = 0x3E50;
|
||||
break;
|
||||
case Direction.East:
|
||||
ItemID = 0x3E55;
|
||||
break;
|
||||
}
|
||||
Direction.South => 0x3E4B,
|
||||
Direction.North => 0x3E4E,
|
||||
Direction.West => 0x3E50,
|
||||
Direction.East => 0x3E55,
|
||||
_ => ItemID
|
||||
};
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
|
|
@ -71,7 +64,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Boat != null && m_Boat.Contains(from))
|
||||
if (m_Boat?.Contains(from) == true)
|
||||
m_Boat.BeginRename(from);
|
||||
else
|
||||
m_Boat?.BeginDryDock(from);
|
||||
|
|
@ -79,7 +72,7 @@ namespace Server.Items
|
|||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (dropped is MapItem item && m_Boat != null && m_Boat.CanCommand(from) && m_Boat.Contains(from))
|
||||
if (dropped is MapItem item && m_Boat?.CanCommand(from) == true && m_Boat.Contains(from))
|
||||
m_Boat.AssociateMap(item);
|
||||
|
||||
return false;
|
||||
|
|
@ -119,4 +112,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue