fix: Codegens boats (#1625)
This commit is contained in:
parent
b29a79ac2d
commit
3a0d4b171b
31 changed files with 1280 additions and 1676 deletions
|
|
@ -3715,6 +3715,14 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
return Math.Sqrt(xDelta * xDelta + yDelta * yDelta);
|
||||
}
|
||||
|
||||
public double GetDistanceToSqrt(Point2D p)
|
||||
{
|
||||
var xDelta = m_Location.m_X - p.X;
|
||||
var yDelta = m_Location.m_Y - p.Y;
|
||||
|
||||
return Math.Sqrt(xDelta * xDelta + yDelta * yDelta);
|
||||
}
|
||||
|
||||
public double GetDistanceToSqrt(IPoint2D p)
|
||||
{
|
||||
var xDelta = m_Location.m_X - p.X;
|
||||
|
|
|
|||
4
Projects/UOContent/Migrations/Server.Multis.LargeBoat.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.LargeBoat.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.LargeBoat"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.LargeBoatDeed.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.LargeBoatDeed.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.LargeBoatDeed"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.LargeDockedBoat.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.LargeDockedBoat.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.LargeDockedBoat"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.LargeDockedDragonBoat.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.LargeDockedDragonBoat.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.LargeDockedDragonBoat"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.LargeDragonBoat.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.LargeDragonBoat.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.LargeDragonBoat"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.LargeDragonBoatDeed.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.LargeDragonBoatDeed.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.LargeDragonBoatDeed"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.MediumBoat.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.MediumBoat.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.MediumBoat"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.MediumBoatDeed.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.MediumBoatDeed.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.MediumBoatDeed"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.MediumDockedBoat.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.MediumDockedBoat.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.MediumDockedBoat"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.MediumDockedDragonBoat.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.MediumDockedDragonBoat.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.MediumDockedDragonBoat"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.MediumDragonBoat.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.MediumDragonBoat.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.MediumDragonBoat"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.MediumDragonBoatDeed.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.MediumDragonBoatDeed.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.MediumDragonBoatDeed"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.SmallBoat.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.SmallBoat.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.SmallBoat"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.SmallBoatDeed.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.SmallBoatDeed.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.SmallBoatDeed"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.SmallDockedBoat.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.SmallDockedBoat.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.SmallDockedBoat"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.SmallDockedDragonBoat.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.SmallDockedDragonBoat.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.SmallDockedDragonBoat"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.SmallDragonBoat.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.SmallDragonBoat.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.SmallDragonBoat"
|
||||
}
|
||||
4
Projects/UOContent/Migrations/Server.Multis.SmallDragonBoatDeed.v0.json
generated
Normal file
4
Projects/UOContent/Migrations/Server.Multis.SmallDragonBoatDeed.v0.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": 0,
|
||||
"type": "Server.Multis.SmallDragonBoatDeed"
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Collections;
|
||||
using Server.Engines.Spawners;
|
||||
using Server.Items;
|
||||
|
|
@ -16,7 +17,8 @@ namespace Server.Multis
|
|||
Single
|
||||
}
|
||||
|
||||
public abstract class BaseBoat : BaseMulti
|
||||
[SerializationGenerator(4, false)]
|
||||
public abstract partial class BaseBoat : BaseMulti
|
||||
{
|
||||
public enum DryDockResult
|
||||
{
|
||||
|
|
@ -30,22 +32,21 @@ namespace Server.Multis
|
|||
Decaying
|
||||
}
|
||||
|
||||
private static Rectangle2D[] m_BritWrap =
|
||||
private static readonly Rectangle2D[] BritWrap =
|
||||
{ new(16, 16, 5120 - 32, 4096 - 32), new(5136, 2320, 992, 1760) };
|
||||
private static readonly Rectangle2D[] IlshWrap = { new(16, 16, 2304 - 32, 1600 - 32) };
|
||||
private static readonly Rectangle2D[] TokunoWrap = { new(16, 16, 1448 - 32, 1448 - 32) };
|
||||
|
||||
private static Rectangle2D[] m_IlshWrap = { new(16, 16, 2304 - 32, 1600 - 32) };
|
||||
private static Rectangle2D[] m_TokunoWrap = { new(16, 16, 1448 - 32, 1448 - 32) };
|
||||
private static readonly TimeSpan BoatDecayDelay = TimeSpan.FromDays(9.0);
|
||||
|
||||
private static 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 const int SlowSpeed = 1;
|
||||
private static int FastSpeed = NewBoatMovement ? 1 : 3;
|
||||
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 const int SlowDriftSpeed = 1;
|
||||
private const int FastDriftSpeed = 1;
|
||||
|
|
@ -61,23 +62,47 @@ namespace Server.Multis
|
|||
private const Direction Port = Left;
|
||||
private const Direction Starboard = Right;
|
||||
|
||||
private int m_ClientSpeed;
|
||||
[SerializableField(0)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private MapItem _mapItem;
|
||||
|
||||
private bool m_Decaying;
|
||||
[SerializableField(1)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private int _nextNavPoint;
|
||||
|
||||
private DateTime m_DecayTime;
|
||||
[SerializableField(4)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private Mobile _owner;
|
||||
|
||||
private Direction m_Facing;
|
||||
[SerializableField(5)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private Plank _pPlank;
|
||||
|
||||
private string m_ShipName;
|
||||
[SerializableField(6)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private Plank _sPlank;
|
||||
|
||||
[SerializableField(7)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private TillerMan _tillerMan;
|
||||
|
||||
[SerializableField(8)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private Hold _hold;
|
||||
|
||||
[SerializableField(9)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private bool _anchored;
|
||||
|
||||
private int _clientSpeed;
|
||||
private bool _decaying;
|
||||
|
||||
private TurnTimer _turnTimer;
|
||||
private MoveTimer _moveTimer;
|
||||
|
||||
public BaseBoat() : base(0x0)
|
||||
{
|
||||
m_DecayTime = Core.Now + BoatDecayDelay;
|
||||
_timeOfDecay = Core.Now + BoatDecayDelay;
|
||||
|
||||
TillerMan = new TillerMan(this);
|
||||
Hold = new Hold(this);
|
||||
|
|
@ -97,30 +122,43 @@ namespace Server.Multis
|
|||
Boats.Add(this);
|
||||
}
|
||||
|
||||
public BaseBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Hold Hold { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TillerMan TillerMan { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Plank PPlank { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Plank SPlank { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Owner { get; set; }
|
||||
|
||||
[SerializableProperty(2)]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Direction Facing
|
||||
{
|
||||
get => m_Facing;
|
||||
set => SetFacing(value);
|
||||
get => _facing;
|
||||
set
|
||||
{
|
||||
SetFacing(value);
|
||||
this.MarkDirty();
|
||||
}
|
||||
}
|
||||
|
||||
[DeltaDateTime]
|
||||
[SerializableProperty(3)]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime TimeOfDecay
|
||||
{
|
||||
get => _timeOfDecay;
|
||||
set
|
||||
{
|
||||
_timeOfDecay = value;
|
||||
TillerMan?.InvalidateProperties();
|
||||
this.MarkDirty();
|
||||
}
|
||||
}
|
||||
|
||||
[SerializableProperty(10)]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string ShipName
|
||||
{
|
||||
get => _shipName;
|
||||
set
|
||||
{
|
||||
_shipName = value;
|
||||
TillerMan?.InvalidateProperties();
|
||||
this.MarkDirty();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
@ -132,40 +170,9 @@ namespace Server.Multis
|
|||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Speed { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Anchored { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string ShipName
|
||||
{
|
||||
get => m_ShipName;
|
||||
set
|
||||
{
|
||||
m_ShipName = value;
|
||||
TillerMan?.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public BoatOrder Order { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public MapItem MapItem { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int NextNavPoint { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime TimeOfDecay
|
||||
{
|
||||
get => m_DecayTime;
|
||||
set
|
||||
{
|
||||
m_DecayTime = value;
|
||||
TillerMan?.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public int Status
|
||||
{
|
||||
get
|
||||
|
|
@ -258,7 +265,7 @@ namespace Server.Multis
|
|||
{
|
||||
var p = new Point3D(X + x, Y + y, Z);
|
||||
|
||||
return Rotate(p, (int)m_Facing / 2);
|
||||
return Rotate(p, (int)_facing / 2);
|
||||
}
|
||||
|
||||
public void UpdateComponents()
|
||||
|
|
@ -266,132 +273,56 @@ namespace Server.Multis
|
|||
if (PPlank != null)
|
||||
{
|
||||
PPlank.MoveToWorld(GetRotatedLocation(PortOffset.X, PortOffset.Y), Map);
|
||||
PPlank.SetFacing(m_Facing);
|
||||
PPlank.SetFacing(_facing);
|
||||
}
|
||||
|
||||
if (SPlank != null)
|
||||
{
|
||||
SPlank.MoveToWorld(GetRotatedLocation(StarboardOffset.X, StarboardOffset.Y), Map);
|
||||
SPlank.SetFacing(m_Facing);
|
||||
SPlank.SetFacing(_facing);
|
||||
}
|
||||
|
||||
int xOffset = 0, yOffset = 0;
|
||||
Movement.Movement.Offset(m_Facing, ref xOffset, ref yOffset);
|
||||
Movement.Movement.Offset(_facing, ref xOffset, ref yOffset);
|
||||
|
||||
if (TillerMan != null)
|
||||
{
|
||||
TillerMan.Location = new Point3D(
|
||||
X + xOffset * TillerManDistance + (m_Facing == Direction.North ? 1 : 0),
|
||||
X + xOffset * TillerManDistance + (_facing == Direction.North ? 1 : 0),
|
||||
Y + yOffset * TillerManDistance,
|
||||
TillerMan.Z
|
||||
);
|
||||
TillerMan.SetFacing(m_Facing);
|
||||
TillerMan.SetFacing(_facing);
|
||||
TillerMan.InvalidateProperties();
|
||||
}
|
||||
|
||||
if (Hold != null)
|
||||
{
|
||||
Hold.Location = new Point3D(X + xOffset * HoldDistance, Y + yOffset * HoldDistance, Hold.Z);
|
||||
Hold.SetFacing(m_Facing);
|
||||
Hold.SetFacing(_facing);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
private void Deserialize(IGenericReader reader, int version)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(3);
|
||||
|
||||
writer.Write(MapItem);
|
||||
writer.Write(NextNavPoint);
|
||||
|
||||
writer.Write((int)m_Facing);
|
||||
|
||||
writer.WriteDeltaTime(m_DecayTime);
|
||||
|
||||
writer.Write(Owner);
|
||||
writer.Write(PPlank);
|
||||
writer.Write(SPlank);
|
||||
writer.Write(TillerMan);
|
||||
writer.Write(Hold);
|
||||
writer.Write(Anchored);
|
||||
writer.Write(m_ShipName);
|
||||
MapItem = (MapItem)reader.ReadEntity<Item>();
|
||||
NextNavPoint = reader.ReadInt();
|
||||
_facing = (Direction)reader.ReadInt();
|
||||
_timeOfDecay = reader.ReadDeltaTime();
|
||||
Owner = reader.ReadEntity<Mobile>();
|
||||
PPlank = reader.ReadEntity<Plank>();
|
||||
SPlank = reader.ReadEntity<Plank>();
|
||||
TillerMan = reader.ReadEntity<TillerMan>();
|
||||
Hold = reader.ReadEntity<Hold>();
|
||||
Anchored = reader.ReadBool();
|
||||
_shipName = reader.ReadString();
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
[AfterDeserialization(false)]
|
||||
private void AfterDeserialization()
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 3:
|
||||
{
|
||||
MapItem = (MapItem)reader.ReadEntity<Item>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Owner = reader.ReadEntity<Mobile>();
|
||||
PPlank = reader.ReadEntity<Plank>();
|
||||
SPlank = reader.ReadEntity<Plank>();
|
||||
TillerMan = reader.ReadEntity<TillerMan>();
|
||||
Hold = reader.ReadEntity<Hold>();
|
||||
Anchored = reader.ReadBool();
|
||||
m_ShipName = reader.ReadString();
|
||||
|
||||
if (version < 1)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Boats.Add(this);
|
||||
|
||||
Timer.DelayCall(() => CheckDecay());
|
||||
CheckDecay();
|
||||
}
|
||||
|
||||
public void RemoveKeys(Mobile m)
|
||||
|
|
@ -515,23 +446,23 @@ namespace Server.Multis
|
|||
{
|
||||
var p = new Point3D(X + MarkOffset.X, Y + MarkOffset.Y, Z + MarkOffset.Z);
|
||||
|
||||
return Rotate(p, (int)m_Facing / 2);
|
||||
return Rotate(p, (int)_facing / 2);
|
||||
}
|
||||
|
||||
public bool CheckKey(uint keyValue) => SPlank?.KeyValue == keyValue || PPlank?.KeyValue == keyValue;
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
m_DecayTime = Core.Now + BoatDecayDelay;
|
||||
_timeOfDecay = Core.Now + BoatDecayDelay;
|
||||
|
||||
TillerMan?.InvalidateProperties();
|
||||
}
|
||||
|
||||
private bool ShouldDecay => !IsMoving && Core.Now >= m_DecayTime;
|
||||
private bool ShouldDecay => !IsMoving && Core.Now >= _timeOfDecay;
|
||||
|
||||
public bool CheckDecay()
|
||||
{
|
||||
if (m_Decaying)
|
||||
if (_decaying)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -539,7 +470,7 @@ namespace Server.Multis
|
|||
if (ShouldDecay)
|
||||
{
|
||||
new DecayTimer(this).Start();
|
||||
m_Decaying = true;
|
||||
_decaying = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -869,7 +800,7 @@ namespace Server.Multis
|
|||
newName = newName[..40];
|
||||
}
|
||||
|
||||
if (m_ShipName == newName)
|
||||
if (_shipName == newName)
|
||||
{
|
||||
TillerMan?.Say(502531); // Yes, sir.
|
||||
|
||||
|
|
@ -878,9 +809,9 @@ namespace Server.Multis
|
|||
|
||||
ShipName = newName;
|
||||
|
||||
if (TillerMan != null && m_ShipName != null)
|
||||
if (TillerMan != null && _shipName != null)
|
||||
{
|
||||
TillerMan.Say(1042885, m_ShipName); // This ship is now called the ~1_NEW_SHIP_NAME~.
|
||||
TillerMan.Say(1042885, _shipName); // This ship is now called the ~1_NEW_SHIP_NAME~.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -909,7 +840,7 @@ namespace Server.Multis
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_ShipName == null)
|
||||
if (_shipName == null)
|
||||
{
|
||||
TillerMan?.Say(502526); // Ar, this ship has no name.
|
||||
|
||||
|
|
@ -928,13 +859,13 @@ namespace Server.Multis
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_ShipName == null)
|
||||
if (_shipName == null)
|
||||
{
|
||||
TillerMan.Say(502526); // Ar, this ship has no name.
|
||||
}
|
||||
else
|
||||
{
|
||||
TillerMan.Say(1042881, m_ShipName); // This is the ~1_BOAT_NAME~.
|
||||
TillerMan.Say(1042881, _shipName); // This is the ~1_BOAT_NAME~.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1123,128 +1054,208 @@ namespace Server.Multis
|
|||
switch (keyword)
|
||||
{
|
||||
case 0x42:
|
||||
SetName(e);
|
||||
break;
|
||||
{
|
||||
SetName(e);
|
||||
break;
|
||||
}
|
||||
case 0x43:
|
||||
RemoveName(e.Mobile);
|
||||
break;
|
||||
{
|
||||
RemoveName(e.Mobile);
|
||||
break;
|
||||
}
|
||||
case 0x44:
|
||||
GiveName(e.Mobile);
|
||||
break;
|
||||
{
|
||||
GiveName(e.Mobile);
|
||||
break;
|
||||
}
|
||||
case 0x45:
|
||||
StartMove(Forward, true);
|
||||
break;
|
||||
{
|
||||
StartMove(Forward, true);
|
||||
break;
|
||||
}
|
||||
case 0x46:
|
||||
StartMove(Backward, true);
|
||||
break;
|
||||
{
|
||||
StartMove(Backward, true);
|
||||
break;
|
||||
}
|
||||
case 0x47:
|
||||
StartMove(Left, true);
|
||||
break;
|
||||
{
|
||||
StartMove(Left, true);
|
||||
break;
|
||||
}
|
||||
case 0x48:
|
||||
StartMove(Right, true);
|
||||
break;
|
||||
{
|
||||
StartMove(Right, true);
|
||||
break;
|
||||
}
|
||||
case 0x4B:
|
||||
StartMove(ForwardLeft, true);
|
||||
break;
|
||||
{
|
||||
StartMove(ForwardLeft, true);
|
||||
break;
|
||||
}
|
||||
case 0x4C:
|
||||
StartMove(ForwardRight, true);
|
||||
break;
|
||||
{
|
||||
StartMove(ForwardRight, true);
|
||||
break;
|
||||
}
|
||||
case 0x4D:
|
||||
StartMove(BackwardLeft, true);
|
||||
break;
|
||||
{
|
||||
StartMove(BackwardLeft, true);
|
||||
break;
|
||||
}
|
||||
case 0x4E:
|
||||
StartMove(BackwardRight, true);
|
||||
break;
|
||||
{
|
||||
StartMove(BackwardRight, true);
|
||||
break;
|
||||
}
|
||||
case 0x4F:
|
||||
StopMove(true);
|
||||
break;
|
||||
{
|
||||
StopMove(true);
|
||||
break;
|
||||
}
|
||||
case 0x50:
|
||||
StartMove(Left, false);
|
||||
break;
|
||||
{
|
||||
StartMove(Left, false);
|
||||
break;
|
||||
}
|
||||
case 0x51:
|
||||
StartMove(Right, false);
|
||||
break;
|
||||
{
|
||||
StartMove(Right, false);
|
||||
break;
|
||||
}
|
||||
case 0x52:
|
||||
StartMove(Forward, false);
|
||||
break;
|
||||
{
|
||||
StartMove(Forward, false);
|
||||
break;
|
||||
}
|
||||
case 0x53:
|
||||
StartMove(Backward, false);
|
||||
break;
|
||||
{
|
||||
StartMove(Backward, false);
|
||||
break;
|
||||
}
|
||||
case 0x54:
|
||||
StartMove(ForwardLeft, false);
|
||||
break;
|
||||
{
|
||||
StartMove(ForwardLeft, false);
|
||||
break;
|
||||
}
|
||||
case 0x55:
|
||||
StartMove(ForwardRight, false);
|
||||
break;
|
||||
{
|
||||
StartMove(ForwardRight, false);
|
||||
break;
|
||||
}
|
||||
case 0x56:
|
||||
StartMove(BackwardRight, false);
|
||||
break;
|
||||
{
|
||||
StartMove(BackwardRight, false);
|
||||
break;
|
||||
}
|
||||
case 0x57:
|
||||
StartMove(BackwardLeft, false);
|
||||
break;
|
||||
{
|
||||
StartMove(BackwardLeft, false);
|
||||
break;
|
||||
}
|
||||
case 0x58:
|
||||
OneMove(Left);
|
||||
break;
|
||||
{
|
||||
OneMove(Left);
|
||||
break;
|
||||
}
|
||||
case 0x59:
|
||||
OneMove(Right);
|
||||
break;
|
||||
{
|
||||
OneMove(Right);
|
||||
break;
|
||||
}
|
||||
case 0x5A:
|
||||
OneMove(Forward);
|
||||
break;
|
||||
{
|
||||
OneMove(Forward);
|
||||
break;
|
||||
}
|
||||
case 0x5B:
|
||||
OneMove(Backward);
|
||||
break;
|
||||
{
|
||||
OneMove(Backward);
|
||||
break;
|
||||
}
|
||||
case 0x5C:
|
||||
OneMove(ForwardLeft);
|
||||
break;
|
||||
{
|
||||
OneMove(ForwardLeft);
|
||||
break;
|
||||
}
|
||||
case 0x5D:
|
||||
OneMove(ForwardRight);
|
||||
break;
|
||||
{
|
||||
OneMove(ForwardRight);
|
||||
break;
|
||||
}
|
||||
case 0x5E:
|
||||
OneMove(BackwardRight);
|
||||
break;
|
||||
{
|
||||
OneMove(BackwardRight);
|
||||
break;
|
||||
}
|
||||
case 0x5F:
|
||||
OneMove(BackwardLeft);
|
||||
break;
|
||||
{
|
||||
OneMove(BackwardLeft);
|
||||
break;
|
||||
}
|
||||
case 0x49:
|
||||
case 0x65:
|
||||
StartTurn(2, true);
|
||||
break; // turn right
|
||||
{
|
||||
StartTurn(2, true);
|
||||
break; // turn right
|
||||
}
|
||||
case 0x4A:
|
||||
case 0x66:
|
||||
StartTurn(-2, true);
|
||||
break; // turn left
|
||||
{
|
||||
StartTurn(-2, true);
|
||||
break; // turn left
|
||||
}
|
||||
case 0x67:
|
||||
StartTurn(-4, true);
|
||||
break; // turn around, come about
|
||||
{
|
||||
StartTurn(-4, true);
|
||||
break; // turn around, come about
|
||||
}
|
||||
case 0x68:
|
||||
StartMove(Forward, true);
|
||||
break;
|
||||
{
|
||||
StartMove(Forward, true);
|
||||
break;
|
||||
}
|
||||
case 0x69:
|
||||
StopMove(true);
|
||||
break;
|
||||
{
|
||||
StopMove(true);
|
||||
break;
|
||||
}
|
||||
case 0x6A:
|
||||
LowerAnchor(true);
|
||||
break;
|
||||
{
|
||||
LowerAnchor(true);
|
||||
break;
|
||||
}
|
||||
case 0x6B:
|
||||
RaiseAnchor(true);
|
||||
break;
|
||||
{
|
||||
RaiseAnchor(true);
|
||||
break;
|
||||
}
|
||||
case 0x60:
|
||||
GiveNavPoint();
|
||||
break; // nav
|
||||
{
|
||||
GiveNavPoint();
|
||||
break; // nav
|
||||
}
|
||||
case 0x61:
|
||||
NextNavPoint = 0;
|
||||
StartCourse(false, true);
|
||||
break; // start
|
||||
{
|
||||
NextNavPoint = 0;
|
||||
StartCourse(false, true);
|
||||
break; // start
|
||||
}
|
||||
case 0x62:
|
||||
StartCourse(false, true);
|
||||
break; // continue
|
||||
{
|
||||
StartCourse(false, true);
|
||||
break; // continue
|
||||
}
|
||||
case 0x63:
|
||||
StartCourse(e.Speech, false, true);
|
||||
break; // goto*
|
||||
{
|
||||
StartCourse(e.Speech, false, true);
|
||||
break; // goto*
|
||||
}
|
||||
case 0x64:
|
||||
StartCourse(e.Speech, true, true);
|
||||
break; // single*
|
||||
{
|
||||
StartCourse(e.Speech, true, true);
|
||||
break; // single*
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -1321,7 +1332,7 @@ namespace Server.Multis
|
|||
return false;
|
||||
}
|
||||
|
||||
if (SetFacing((Direction)(((int)m_Facing + offset) & 0x7)))
|
||||
if (SetFacing((Direction)(((int)_facing + offset) & 0x7)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1353,7 +1364,7 @@ namespace Server.Multis
|
|||
|
||||
Moving = dir;
|
||||
Speed = speed;
|
||||
m_ClientSpeed = clientSpeed;
|
||||
_clientSpeed = clientSpeed;
|
||||
Order = BoatOrder.Move;
|
||||
|
||||
SafelyStartMoveTimer(interval, single);
|
||||
|
|
@ -1429,7 +1440,7 @@ namespace Server.Multis
|
|||
|
||||
Moving = Direction.North;
|
||||
Speed = 0;
|
||||
m_ClientSpeed = 0;
|
||||
_clientSpeed = 0;
|
||||
_moveTimer?.Stop();
|
||||
|
||||
if (message)
|
||||
|
|
@ -1561,8 +1572,8 @@ namespace Server.Multis
|
|||
return false;
|
||||
}
|
||||
|
||||
public static Rectangle2D[] GetWrapFor(Map m) => m == Map.Ilshenar ? m_IlshWrap :
|
||||
m == Map.Tokuno ? m_TokunoWrap : m_BritWrap;
|
||||
public static Rectangle2D[] GetWrapFor(Map m) => m == Map.Ilshenar ? IlshWrap :
|
||||
m == Map.Tokuno ? TokunoWrap : BritWrap;
|
||||
|
||||
public Direction GetMovementFor(int x, int y, out int maxSpeed)
|
||||
{
|
||||
|
|
@ -1597,7 +1608,7 @@ namespace Server.Multis
|
|||
{
|
||||
dir = Moving;
|
||||
speed = Speed;
|
||||
clientSpeed = m_ClientSpeed;
|
||||
clientSpeed = _clientSpeed;
|
||||
}
|
||||
else if (MapItem?.Deleted != false)
|
||||
{
|
||||
|
|
@ -1711,7 +1722,7 @@ namespace Server.Multis
|
|||
}
|
||||
|
||||
int rx = 0, ry = 0;
|
||||
var d = (Direction)(((int)m_Facing + (int)dir) & 0x7);
|
||||
var d = (Direction)(((int)_facing + (int)dir) & 0x7);
|
||||
Movement.Movement.Offset(d, ref rx, ref ry);
|
||||
|
||||
for (var i = 1; i <= speed; ++i)
|
||||
|
|
@ -2024,39 +2035,47 @@ namespace Server.Multis
|
|||
switch (facing)
|
||||
{
|
||||
case Direction.North:
|
||||
if (!CanFit(Location, Map, NorthID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!CanFit(Location, Map, NorthID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case Direction.East:
|
||||
if (!CanFit(Location, Map, EastID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!CanFit(Location, Map, EastID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case Direction.South:
|
||||
if (!CanFit(Location, Map, SouthID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!CanFit(Location, Map, SouthID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case Direction.West:
|
||||
if (!CanFit(Location, Map, WestID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!CanFit(Location, Map, WestID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var old = m_Facing;
|
||||
var old = _facing;
|
||||
|
||||
m_Facing = facing;
|
||||
_facing = facing;
|
||||
|
||||
TillerMan?.SetFacing(facing);
|
||||
Hold?.SetFacing(facing);
|
||||
|
|
@ -2066,7 +2085,7 @@ namespace Server.Multis
|
|||
int xOffset = 0, yOffset = 0;
|
||||
Movement.Movement.Offset(facing, ref xOffset, ref yOffset);
|
||||
|
||||
var count = ((m_Facing - old) & 0x7) / 2;
|
||||
var count = ((_facing - old) & 0x7) / 2;
|
||||
|
||||
foreach (var e in GetMovingEntities())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,199 +1,162 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Engines.CannedEvil;
|
||||
using Server.Regions;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Multis
|
||||
namespace Server.Multis;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public abstract partial class BaseBoatDeed : Item
|
||||
{
|
||||
public abstract class BaseBoatDeed : Item
|
||||
[SerializableField(0)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private int _multiId;
|
||||
|
||||
[SerializableField(1)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private Point3D _offset;
|
||||
|
||||
public BaseBoatDeed(int id, Point3D offset) : base(0x14F2)
|
||||
{
|
||||
public BaseBoatDeed(int id, Point3D offset) : base(0x14F2)
|
||||
Weight = 1.0;
|
||||
|
||||
if (!Core.AOS)
|
||||
{
|
||||
Weight = 1.0;
|
||||
|
||||
if (!Core.AOS)
|
||||
{
|
||||
LootType = LootType.Newbied;
|
||||
}
|
||||
|
||||
MultiID = id;
|
||||
Offset = offset;
|
||||
LootType = LootType.Newbied;
|
||||
}
|
||||
|
||||
public BaseBoatDeed(Serial serial) : base(serial)
|
||||
_multiId = id;
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
public abstract BaseBoat Boat { get; }
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int MultiID { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Point3D Offset { get; set; }
|
||||
|
||||
public abstract BaseBoat Boat { get; }
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
else if (from.AccessLevel < AccessLevel.GameMaster && (from.Map == Map.Ilshenar || from.Map == Map.Malas))
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write(MultiID);
|
||||
writer.Write(Offset);
|
||||
from.SendLocalizedMessage(1010567, null, 0x25); // You may not place a boat from this location.
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
else
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
if (Core.SE)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
MultiID = reader.ReadInt();
|
||||
Offset = reader.ReadPoint3D();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Weight == 0.0)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
else if (from.AccessLevel < AccessLevel.GameMaster && (from.Map == Map.Ilshenar || from.Map == Map.Malas))
|
||||
{
|
||||
from.SendLocalizedMessage(1010567, null, 0x25); // You may not place a boat from this location.
|
||||
from.SendLocalizedMessage(502482); // Where do you wish to place the ship?
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Core.SE)
|
||||
{
|
||||
from.SendLocalizedMessage(502482); // Where do you wish to place the ship?
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502482); // Where do you wish to place the ship?
|
||||
}
|
||||
|
||||
from.Target = new InternalTarget(this);
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502482); // Where do you wish to place the ship?
|
||||
}
|
||||
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPlacement(Mobile from, Point3D p)
|
||||
{
|
||||
if (Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public void OnPlacement(Mobile from, Point3D p)
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
if (Deleted)
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
else
|
||||
{
|
||||
var map = from.Map;
|
||||
|
||||
if (map == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsChildOf(from.Backpack))
|
||||
if (from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
from.SendLocalizedMessage(1043284); // A ship can not be created here.
|
||||
return;
|
||||
}
|
||||
|
||||
if (from.Region.IsPartOf<HouseRegion>() || BaseBoat.FindBoatAt(from.Location, from.Map) != null)
|
||||
{
|
||||
// You may not place a ship while on another ship or inside a house.
|
||||
from.SendLocalizedMessage(1010568, null, 0x25);
|
||||
return;
|
||||
}
|
||||
|
||||
var boat = Boat;
|
||||
|
||||
if (boat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
p = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);
|
||||
|
||||
if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID))
|
||||
{
|
||||
Delete();
|
||||
|
||||
boat.Owner = from;
|
||||
boat.Anchored = true;
|
||||
|
||||
var keyValue = boat.CreateKeys(from);
|
||||
|
||||
if (boat.PPlank != null)
|
||||
{
|
||||
boat.PPlank.KeyValue = keyValue;
|
||||
}
|
||||
|
||||
if (boat.SPlank != null)
|
||||
{
|
||||
boat.SPlank.KeyValue = keyValue;
|
||||
}
|
||||
|
||||
boat.MoveToWorld(p, map);
|
||||
}
|
||||
else
|
||||
{
|
||||
var map = from.Map;
|
||||
boat.Delete();
|
||||
from.SendLocalizedMessage(1043284); // A ship can not be created here.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (map == null)
|
||||
private class InternalTarget : MultiTarget
|
||||
{
|
||||
private readonly BaseBoatDeed m_Deed;
|
||||
|
||||
public InternalTarget(BaseBoatDeed deed) : base(deed.MultiId, deed.Offset) => m_Deed = deed;
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is IPoint3D ip)
|
||||
{
|
||||
if (ip is Item item)
|
||||
{
|
||||
return;
|
||||
ip = from;
|
||||
}
|
||||
|
||||
if (from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas))
|
||||
var p = new Point3D(ip);
|
||||
|
||||
var region = Region.Find(p, from.Map);
|
||||
|
||||
if (region.IsPartOf<DungeonRegion>())
|
||||
{
|
||||
from.SendLocalizedMessage(1043284); // A ship can not be created here.
|
||||
return;
|
||||
from.SendLocalizedMessage(502488); // You can not place a ship inside a dungeon.
|
||||
}
|
||||
|
||||
if (from.Region.IsPartOf<HouseRegion>() || BaseBoat.FindBoatAt(from.Location, from.Map) != null)
|
||||
else if (region.IsPartOf<HouseRegion>() || region.IsPartOf<ChampionSpawnRegion>())
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1010568,
|
||||
null,
|
||||
0x25
|
||||
); // You may not place a ship while on another ship or inside a house.
|
||||
return;
|
||||
}
|
||||
|
||||
var boat = Boat;
|
||||
|
||||
if (boat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
p = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);
|
||||
|
||||
if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID))
|
||||
{
|
||||
Delete();
|
||||
|
||||
boat.Owner = from;
|
||||
boat.Anchored = true;
|
||||
|
||||
var keyValue = boat.CreateKeys(from);
|
||||
|
||||
if (boat.PPlank != null)
|
||||
{
|
||||
boat.PPlank.KeyValue = keyValue;
|
||||
}
|
||||
|
||||
if (boat.SPlank != null)
|
||||
{
|
||||
boat.SPlank.KeyValue = keyValue;
|
||||
}
|
||||
|
||||
boat.MoveToWorld(p, map);
|
||||
from.SendLocalizedMessage(1042549); // A boat may not be placed in this area.
|
||||
}
|
||||
else
|
||||
{
|
||||
boat.Delete();
|
||||
from.SendLocalizedMessage(1043284); // A ship can not be created here.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : MultiTarget
|
||||
{
|
||||
private readonly BaseBoatDeed m_Deed;
|
||||
|
||||
public InternalTarget(BaseBoatDeed deed) : base(deed.MultiID, deed.Offset) => m_Deed = deed;
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is IPoint3D ip)
|
||||
{
|
||||
if (ip is Item item)
|
||||
{
|
||||
ip = from;
|
||||
}
|
||||
|
||||
var p = new Point3D(ip);
|
||||
|
||||
var region = Region.Find(p, from.Map);
|
||||
|
||||
if (region.IsPartOf<DungeonRegion>())
|
||||
{
|
||||
from.SendLocalizedMessage(502488); // You can not place a ship inside a dungeon.
|
||||
}
|
||||
else if (region.IsPartOf<HouseRegion>() || region.IsPartOf<ChampionSpawnRegion>())
|
||||
{
|
||||
from.SendLocalizedMessage(1042549); // A boat may not be placed in this area.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Deed.OnPlacement(from, p);
|
||||
}
|
||||
m_Deed.OnPlacement(from, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,225 +1,170 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Engines.CannedEvil;
|
||||
using Server.Regions;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Multis
|
||||
namespace Server.Multis;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public abstract partial class BaseDockedBoat : Item
|
||||
{
|
||||
public abstract class BaseDockedBoat : Item
|
||||
[SerializableField(0)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private int _multiId;
|
||||
|
||||
[SerializableField(1)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private Point3D _offset;
|
||||
|
||||
[InvalidateProperties]
|
||||
[SerializableField(2)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private string _shipName;
|
||||
|
||||
public BaseDockedBoat(int id, Point3D offset, BaseBoat boat) : base(0x14F4)
|
||||
{
|
||||
private string m_ShipName;
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
public BaseDockedBoat(int id, Point3D offset, BaseBoat boat) : base(0x14F4)
|
||||
_multiId = id;
|
||||
_offset = offset;
|
||||
|
||||
_shipName = boat.ShipName;
|
||||
}
|
||||
|
||||
public abstract BaseBoat Boat { get; }
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502482); // Where do you wish to place the ship?
|
||||
|
||||
MultiID = id;
|
||||
Offset = offset;
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
m_ShipName = boat.ShipName;
|
||||
public override void AddNameProperty(IPropertyList list)
|
||||
{
|
||||
if (_shipName != null)
|
||||
{
|
||||
list.Add(_shipName);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.AddNameProperty(list);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (_shipName != null)
|
||||
{
|
||||
LabelTo(from, _shipName);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPlacement(Mobile from, Point3D p)
|
||||
{
|
||||
if (Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public BaseDockedBoat(Serial serial) : base(serial)
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int MultiID { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Point3D Offset { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string ShipName
|
||||
else
|
||||
{
|
||||
get => m_ShipName;
|
||||
set
|
||||
{
|
||||
m_ShipName = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
var map = from.Map;
|
||||
|
||||
public abstract BaseBoat Boat { get; }
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write(MultiID);
|
||||
writer.Write(Offset);
|
||||
writer.Write(m_ShipName);
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
MultiID = reader.ReadInt();
|
||||
Offset = reader.ReadPoint3D();
|
||||
m_ShipName = reader.ReadString();
|
||||
|
||||
if (version == 0)
|
||||
{
|
||||
reader.ReadUInt();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (LootType == LootType.Newbied)
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
if (Weight == 0.0)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502482); // Where do you wish to place the ship?
|
||||
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty(IPropertyList list)
|
||||
{
|
||||
if (m_ShipName != null)
|
||||
{
|
||||
list.Add(m_ShipName);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.AddNameProperty(list);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (m_ShipName != null)
|
||||
{
|
||||
LabelTo(from, m_ShipName);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPlacement(Mobile from, Point3D p)
|
||||
{
|
||||
if (Deleted)
|
||||
if (map == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsChildOf(from.Backpack))
|
||||
var boat = Boat;
|
||||
|
||||
if (boat == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
p = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);
|
||||
|
||||
if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID) && map != Map.Ilshenar &&
|
||||
map != Map.Malas)
|
||||
{
|
||||
Delete();
|
||||
|
||||
boat.Owner = from;
|
||||
boat.Anchored = true;
|
||||
boat.ShipName = _shipName;
|
||||
|
||||
var keyValue = boat.CreateKeys(from);
|
||||
|
||||
if (boat.PPlank != null)
|
||||
{
|
||||
boat.PPlank.KeyValue = keyValue;
|
||||
}
|
||||
|
||||
if (boat.SPlank != null)
|
||||
{
|
||||
boat.SPlank.KeyValue = keyValue;
|
||||
}
|
||||
|
||||
boat.MoveToWorld(p, map);
|
||||
}
|
||||
else
|
||||
{
|
||||
var map = from.Map;
|
||||
|
||||
if (map == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var boat = Boat;
|
||||
|
||||
if (boat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
p = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);
|
||||
|
||||
if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID) && map != Map.Ilshenar &&
|
||||
map != Map.Malas)
|
||||
{
|
||||
Delete();
|
||||
|
||||
boat.Owner = from;
|
||||
boat.Anchored = true;
|
||||
boat.ShipName = m_ShipName;
|
||||
|
||||
var keyValue = boat.CreateKeys(from);
|
||||
|
||||
if (boat.PPlank != null)
|
||||
{
|
||||
boat.PPlank.KeyValue = keyValue;
|
||||
}
|
||||
|
||||
if (boat.SPlank != null)
|
||||
{
|
||||
boat.SPlank.KeyValue = keyValue;
|
||||
}
|
||||
|
||||
boat.MoveToWorld(p, map);
|
||||
}
|
||||
else
|
||||
{
|
||||
boat.Delete();
|
||||
from.SendLocalizedMessage(1043284); // A ship can not be created here.
|
||||
}
|
||||
boat.Delete();
|
||||
from.SendLocalizedMessage(1043284); // A ship can not be created here.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : MultiTarget
|
||||
private class InternalTarget : MultiTarget
|
||||
{
|
||||
private readonly BaseDockedBoat m_Model;
|
||||
|
||||
public InternalTarget(BaseDockedBoat model) : base(model.MultiId, model.Offset) => m_Model = model;
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
private readonly BaseDockedBoat m_Model;
|
||||
|
||||
public InternalTarget(BaseDockedBoat model) : base(model.MultiID, model.Offset) => m_Model = model;
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
if (o is not IPoint3D ip)
|
||||
{
|
||||
if (o is not IPoint3D ip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Point3D p = ip switch
|
||||
{
|
||||
Item item => item.GetWorldTop(),
|
||||
Mobile m => m.Location,
|
||||
_ => new Point3D(ip)
|
||||
};
|
||||
Point3D p = ip switch
|
||||
{
|
||||
Item item => item.GetWorldTop(),
|
||||
Mobile m => m.Location,
|
||||
_ => new Point3D(ip)
|
||||
};
|
||||
|
||||
var region = Region.Find(p, from.Map);
|
||||
var region = Region.Find(p, from.Map);
|
||||
|
||||
if (region.IsPartOf<DungeonRegion>())
|
||||
{
|
||||
from.SendLocalizedMessage(502488); // You can not place a ship inside a dungeon.
|
||||
}
|
||||
else if (region.IsPartOf<HouseRegion>() || region.IsPartOf<ChampionSpawnRegion>())
|
||||
{
|
||||
from.SendLocalizedMessage(1042549); // A boat may not be placed in this area.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Model.OnPlacement(from, p);
|
||||
}
|
||||
if (region.IsPartOf<DungeonRegion>())
|
||||
{
|
||||
from.SendLocalizedMessage(502488); // You can not place a ship inside a dungeon.
|
||||
}
|
||||
else if (region.IsPartOf<HouseRegion>() || region.IsPartOf<ChampionSpawnRegion>())
|
||||
{
|
||||
from.SendLocalizedMessage(1042549); // A boat may not be placed in this area.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Model.OnPlacement(from, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,128 +1,74 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class Hold : Container
|
||||
{
|
||||
public class Hold : Container
|
||||
[SerializableField(0, setter: "private")]
|
||||
private BaseBoat _boat;
|
||||
|
||||
public Hold(BaseBoat boat) : base(0x3EAE)
|
||||
{
|
||||
private BaseBoat m_Boat;
|
||||
_boat = boat;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public Hold(BaseBoat boat) : base(0x3EAE)
|
||||
public override bool IsDecoContainer => false;
|
||||
|
||||
public void SetFacing(Direction dir)
|
||||
{
|
||||
ItemID = dir switch
|
||||
{
|
||||
m_Boat = boat;
|
||||
Movable = false;
|
||||
Direction.East => 0x3E65,
|
||||
Direction.West => 0x3E93,
|
||||
Direction.North => 0x3EAE,
|
||||
Direction.South => 0x3EB9,
|
||||
_ => ItemID
|
||||
};
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item item) =>
|
||||
_boat?.Contains(from) == true && !_boat.IsMoving && base.OnDragDrop(from, item);
|
||||
|
||||
public override bool OnDragDropInto(Mobile from, Item item, Point3D p) =>
|
||||
_boat?.Contains(from) == true && !_boat.IsMoving && base.OnDragDropInto(from, item, p);
|
||||
|
||||
public override bool CheckItemUse(Mobile from, Item item) =>
|
||||
(item == this || _boat?.Contains(from) == true && !_boat.IsMoving) && base.CheckItemUse(from, item);
|
||||
|
||||
public override bool CheckLift(Mobile from, Item item, ref LRReason reject) =>
|
||||
_boat?.Contains(from) == true && !_boat.IsMoving && base.CheckLift(from, item, ref reject);
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
_boat?.Delete();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (_boat?.Contains(from) != true)
|
||||
{
|
||||
_boat?.TillerMan?.Say(502490); // You must be on the ship to open the hold.
|
||||
}
|
||||
|
||||
public Hold(Serial serial) : base(serial)
|
||||
else if (_boat.IsMoving)
|
||||
{
|
||||
_boat.TillerMan?.Say(502491); // I can not open the hold while the ship is moving.
|
||||
}
|
||||
|
||||
public override bool IsDecoContainer => false;
|
||||
|
||||
public void SetFacing(Direction dir)
|
||||
else
|
||||
{
|
||||
ItemID = dir switch
|
||||
{
|
||||
Direction.East => 0x3E65,
|
||||
Direction.West => 0x3E93,
|
||||
Direction.North => 0x3EAE,
|
||||
Direction.South => 0x3EB9,
|
||||
_ => ItemID
|
||||
};
|
||||
base.OnDoubleClick(from);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item item)
|
||||
[AfterDeserialization]
|
||||
private void AfterDeserialization()
|
||||
{
|
||||
if (_boat == null || Parent != null)
|
||||
{
|
||||
if (m_Boat?.Contains(from) != true || m_Boat.IsMoving)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OnDragDrop(from, item);
|
||||
}
|
||||
|
||||
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
||||
{
|
||||
if (m_Boat?.Contains(from) != true || m_Boat.IsMoving)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OnDragDropInto(from, item, p);
|
||||
}
|
||||
|
||||
public override bool CheckItemUse(Mobile from, Item item)
|
||||
{
|
||||
if (item != this && (m_Boat?.Contains(from) != true || m_Boat.IsMoving))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckItemUse(from, item);
|
||||
}
|
||||
|
||||
public override bool CheckLift(Mobile from, Item item, ref LRReason reject)
|
||||
{
|
||||
if (m_Boat?.Contains(from) != true || m_Boat.IsMoving)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckLift(from, item, ref reject);
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
m_Boat?.Delete();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile 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.
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnDoubleClick(from);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(m_Boat);
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Boat = reader.ReadEntity<BaseBoat>();
|
||||
|
||||
if (m_Boat == null || Parent != null)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
|
||||
Movable = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
Timer.DelayCall(Delete);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,99 +1,49 @@
|
|||
namespace Server.Multis
|
||||
using ModernUO.Serialization;
|
||||
|
||||
namespace Server.Multis;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class LargeBoat : BaseBoat
|
||||
{
|
||||
public class LargeBoat : BaseBoat
|
||||
[Constructible]
|
||||
public LargeBoat()
|
||||
{
|
||||
[Constructible]
|
||||
public LargeBoat()
|
||||
{
|
||||
}
|
||||
|
||||
public LargeBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int NorthID => 0x10;
|
||||
public override int EastID => 0x11;
|
||||
public override int SouthID => 0x12;
|
||||
public override int WestID => 0x13;
|
||||
|
||||
public override int HoldDistance => 5;
|
||||
public override int TillerManDistance => -5;
|
||||
|
||||
public override Point2D StarboardOffset => new(2, -1);
|
||||
public override Point2D PortOffset => new(-2, -1);
|
||||
|
||||
public override Point3D MarkOffset => new(0, 0, 3);
|
||||
|
||||
public override BaseDockedBoat DockedBoat => new LargeDockedBoat(this);
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class LargeBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public LargeBoatDeed() : base(0x10, new Point3D(0, -1, 0))
|
||||
{
|
||||
}
|
||||
public override int NorthID => 0x10;
|
||||
public override int EastID => 0x11;
|
||||
public override int SouthID => 0x12;
|
||||
public override int WestID => 0x13;
|
||||
|
||||
public LargeBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
public override int HoldDistance => 5;
|
||||
public override int TillerManDistance => -5;
|
||||
|
||||
public override int LabelNumber => 1041209; // large ship deed
|
||||
public override BaseBoat Boat => new LargeBoat();
|
||||
public override Point2D StarboardOffset => new(2, -1);
|
||||
public override Point2D PortOffset => new(-2, -1);
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
public override Point3D MarkOffset => new(0, 0, 3);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class LargeDockedBoat : BaseDockedBoat
|
||||
{
|
||||
public LargeDockedBoat(BaseBoat boat) : base(0x10, new Point3D(0, -1, 0), boat)
|
||||
{
|
||||
}
|
||||
|
||||
public LargeDockedBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseBoat Boat => new LargeBoat();
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
public override BaseDockedBoat DockedBoat => new LargeDockedBoat(this);
|
||||
}
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class LargeBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public LargeBoatDeed() : base(0x10, new Point3D(0, -1, 0))
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1041209; // large ship deed
|
||||
public override BaseBoat Boat => new LargeBoat();
|
||||
}
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class LargeDockedBoat : BaseDockedBoat
|
||||
{
|
||||
public LargeDockedBoat(BaseBoat boat) : base(0x10, new Point3D(0, -1, 0), boat)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseBoat Boat => new LargeBoat();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,99 +1,49 @@
|
|||
namespace Server.Multis
|
||||
using ModernUO.Serialization;
|
||||
|
||||
namespace Server.Multis;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class LargeDragonBoat : BaseBoat
|
||||
{
|
||||
public class LargeDragonBoat : BaseBoat
|
||||
[Constructible]
|
||||
public LargeDragonBoat()
|
||||
{
|
||||
[Constructible]
|
||||
public LargeDragonBoat()
|
||||
{
|
||||
}
|
||||
|
||||
public LargeDragonBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int NorthID => 0x14;
|
||||
public override int EastID => 0x15;
|
||||
public override int SouthID => 0x16;
|
||||
public override int WestID => 0x17;
|
||||
|
||||
public override int HoldDistance => 5;
|
||||
public override int TillerManDistance => -5;
|
||||
|
||||
public override Point2D StarboardOffset => new(2, -1);
|
||||
public override Point2D PortOffset => new(-2, -1);
|
||||
|
||||
public override Point3D MarkOffset => new(0, 0, 3);
|
||||
|
||||
public override BaseDockedBoat DockedBoat => new LargeDockedDragonBoat(this);
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class LargeDragonBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public LargeDragonBoatDeed() : base(0x14, new Point3D(0, -1, 0))
|
||||
{
|
||||
}
|
||||
public override int NorthID => 0x14;
|
||||
public override int EastID => 0x15;
|
||||
public override int SouthID => 0x16;
|
||||
public override int WestID => 0x17;
|
||||
|
||||
public LargeDragonBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
public override int HoldDistance => 5;
|
||||
public override int TillerManDistance => -5;
|
||||
|
||||
public override int LabelNumber => 1041210; // large dragon ship deed
|
||||
public override BaseBoat Boat => new LargeDragonBoat();
|
||||
public override Point2D StarboardOffset => new(2, -1);
|
||||
public override Point2D PortOffset => new(-2, -1);
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
public override Point3D MarkOffset => new(0, 0, 3);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class LargeDockedDragonBoat : BaseDockedBoat
|
||||
{
|
||||
public LargeDockedDragonBoat(BaseBoat boat) : base(0x14, new Point3D(0, -1, 0), boat)
|
||||
{
|
||||
}
|
||||
|
||||
public LargeDockedDragonBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseBoat Boat => new LargeDragonBoat();
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
public override BaseDockedBoat DockedBoat => new LargeDockedDragonBoat(this);
|
||||
}
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class LargeDragonBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public LargeDragonBoatDeed() : base(0x14, new Point3D(0, -1, 0))
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1041210; // large dragon ship deed
|
||||
public override BaseBoat Boat => new LargeDragonBoat();
|
||||
}
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class LargeDockedDragonBoat : BaseDockedBoat
|
||||
{
|
||||
public LargeDockedDragonBoat(BaseBoat boat) : base(0x14, new Point3D(0, -1, 0), boat)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseBoat Boat => new LargeDragonBoat();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,99 +1,49 @@
|
|||
namespace Server.Multis
|
||||
using ModernUO.Serialization;
|
||||
|
||||
namespace Server.Multis;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class MediumBoat : BaseBoat
|
||||
{
|
||||
public class MediumBoat : BaseBoat
|
||||
[Constructible]
|
||||
public MediumBoat()
|
||||
{
|
||||
[Constructible]
|
||||
public MediumBoat()
|
||||
{
|
||||
}
|
||||
|
||||
public MediumBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int NorthID => 0x8;
|
||||
public override int EastID => 0x9;
|
||||
public override int SouthID => 0xA;
|
||||
public override int WestID => 0xB;
|
||||
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -5;
|
||||
|
||||
public override Point2D StarboardOffset => new(2, 0);
|
||||
public override Point2D PortOffset => new(-2, 0);
|
||||
|
||||
public override Point3D MarkOffset => new(0, 1, 3);
|
||||
|
||||
public override BaseDockedBoat DockedBoat => new MediumDockedBoat(this);
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class MediumBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public MediumBoatDeed() : base(0x8, Point3D.Zero)
|
||||
{
|
||||
}
|
||||
public override int NorthID => 0x8;
|
||||
public override int EastID => 0x9;
|
||||
public override int SouthID => 0xA;
|
||||
public override int WestID => 0xB;
|
||||
|
||||
public MediumBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -5;
|
||||
|
||||
public override int LabelNumber => 1041207; // medium ship deed
|
||||
public override BaseBoat Boat => new MediumBoat();
|
||||
public override Point2D StarboardOffset => new(2, 0);
|
||||
public override Point2D PortOffset => new(-2, 0);
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
public override Point3D MarkOffset => new(0, 1, 3);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class MediumDockedBoat : BaseDockedBoat
|
||||
{
|
||||
public MediumDockedBoat(BaseBoat boat) : base(0x8, Point3D.Zero, boat)
|
||||
{
|
||||
}
|
||||
|
||||
public MediumDockedBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseBoat Boat => new MediumBoat();
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
public override BaseDockedBoat DockedBoat => new MediumDockedBoat(this);
|
||||
}
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class MediumBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public MediumBoatDeed() : base(0x8, Point3D.Zero)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1041207; // medium ship deed
|
||||
public override BaseBoat Boat => new MediumBoat();
|
||||
}
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class MediumDockedBoat : BaseDockedBoat
|
||||
{
|
||||
public MediumDockedBoat(BaseBoat boat) : base(0x8, Point3D.Zero, boat)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseBoat Boat => new MediumBoat();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,99 +1,49 @@
|
|||
namespace Server.Multis
|
||||
using ModernUO.Serialization;
|
||||
|
||||
namespace Server.Multis;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class MediumDragonBoat : BaseBoat
|
||||
{
|
||||
public class MediumDragonBoat : BaseBoat
|
||||
[Constructible]
|
||||
public MediumDragonBoat()
|
||||
{
|
||||
[Constructible]
|
||||
public MediumDragonBoat()
|
||||
{
|
||||
}
|
||||
|
||||
public MediumDragonBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int NorthID => 0xC;
|
||||
public override int EastID => 0xD;
|
||||
public override int SouthID => 0xE;
|
||||
public override int WestID => 0xF;
|
||||
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -5;
|
||||
|
||||
public override Point2D StarboardOffset => new(2, 0);
|
||||
public override Point2D PortOffset => new(-2, 0);
|
||||
|
||||
public override Point3D MarkOffset => new(0, 1, 3);
|
||||
|
||||
public override BaseDockedBoat DockedBoat => new MediumDockedDragonBoat(this);
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class MediumDragonBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public MediumDragonBoatDeed() : base(0xC, Point3D.Zero)
|
||||
{
|
||||
}
|
||||
public override int NorthID => 0xC;
|
||||
public override int EastID => 0xD;
|
||||
public override int SouthID => 0xE;
|
||||
public override int WestID => 0xF;
|
||||
|
||||
public MediumDragonBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -5;
|
||||
|
||||
public override int LabelNumber => 1041208; // medium dragon ship deed
|
||||
public override BaseBoat Boat => new MediumDragonBoat();
|
||||
public override Point2D StarboardOffset => new(2, 0);
|
||||
public override Point2D PortOffset => new(-2, 0);
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
public override Point3D MarkOffset => new(0, 1, 3);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class MediumDockedDragonBoat : BaseDockedBoat
|
||||
{
|
||||
public MediumDockedDragonBoat(BaseBoat boat) : base(0xC, Point3D.Zero, boat)
|
||||
{
|
||||
}
|
||||
|
||||
public MediumDockedDragonBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseBoat Boat => new MediumDragonBoat();
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
public override BaseDockedBoat DockedBoat => new MediumDockedDragonBoat(this);
|
||||
}
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class MediumDragonBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public MediumDragonBoatDeed() : base(0xC, Point3D.Zero)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1041208; // medium dragon ship deed
|
||||
public override BaseBoat Boat => new MediumDragonBoat();
|
||||
}
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class MediumDockedDragonBoat : BaseDockedBoat
|
||||
{
|
||||
public MediumDockedDragonBoat(BaseBoat boat) : base(0xC, Point3D.Zero, boat)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseBoat Boat => new MediumDragonBoat();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,214 +1,184 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Factions;
|
||||
using Server.Multis;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
public enum PlankSide
|
||||
{
|
||||
public enum PlankSide
|
||||
Port,
|
||||
Starboard
|
||||
}
|
||||
|
||||
[SerializationGenerator(1, false)]
|
||||
public partial class Plank : Item, ILockable
|
||||
{
|
||||
[SerializableField(0)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private BaseBoat _boat;
|
||||
|
||||
[SerializableField(1)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private PlankSide _side;
|
||||
|
||||
[SerializableField(2)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private bool _locked;
|
||||
|
||||
[SerializableField(3)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private uint _keyValue;
|
||||
|
||||
private Timer _closeTimer;
|
||||
|
||||
public Plank(BaseBoat boat, PlankSide side, uint keyValue) : base(0x3EB1 + (int)side)
|
||||
{
|
||||
Port,
|
||||
Starboard
|
||||
Boat = boat;
|
||||
Side = side;
|
||||
KeyValue = keyValue;
|
||||
Locked = true;
|
||||
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public class Plank : Item, ILockable
|
||||
public Plank(bool locked) => Locked = locked;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsOpen => ItemID is 0x3ED5 or 0x3ED4 or 0x3E84 or 0x3E89;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Starboard => Side == PlankSide.Starboard;
|
||||
|
||||
private void Deserialize(IGenericReader reader, int version)
|
||||
{
|
||||
private Timer m_CloseTimer;
|
||||
Boat = reader.ReadEntity<BaseBoat>();
|
||||
Side = (PlankSide)reader.ReadInt();
|
||||
Locked = reader.ReadBool();
|
||||
KeyValue = reader.ReadUInt();
|
||||
}
|
||||
|
||||
public Plank(BaseBoat boat, PlankSide side, uint keyValue) : base(0x3EB1 + (int)side)
|
||||
[AfterDeserialization]
|
||||
private void AfterDeserialization()
|
||||
{
|
||||
if (Boat == null)
|
||||
{
|
||||
Boat = boat;
|
||||
Side = side;
|
||||
KeyValue = keyValue;
|
||||
Locked = true;
|
||||
|
||||
Movable = false;
|
||||
Timer.DelayCall(Delete);
|
||||
return;
|
||||
}
|
||||
|
||||
public Plank(Serial serial) : base(serial)
|
||||
if (IsOpen)
|
||||
{
|
||||
_closeTimer = new CloseTimer(this);
|
||||
_closeTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public BaseBoat Boat { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public PlankSide Side { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsOpen => ItemID is 0x3ED5 or 0x3ED4 or 0x3E84 or 0x3E89;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Starboard => Side == PlankSide.Starboard;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Locked { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public uint KeyValue { get; set; }
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
public void SetFacing(Direction dir)
|
||||
{
|
||||
if (IsOpen)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write(Boat);
|
||||
writer.Write((int)Side);
|
||||
writer.Write(Locked);
|
||||
writer.Write(KeyValue);
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
ItemID = dir switch
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Boat = reader.ReadEntity<BaseBoat>();
|
||||
Side = (PlankSide)reader.ReadInt();
|
||||
Locked = reader.ReadBool();
|
||||
KeyValue = reader.ReadUInt();
|
||||
|
||||
if (Boat == null)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsOpen)
|
||||
{
|
||||
m_CloseTimer = new CloseTimer(this);
|
||||
m_CloseTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetFacing(Direction dir)
|
||||
{
|
||||
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,
|
||||
_ => 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,
|
||||
_ => ItemID
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void Open()
|
||||
{
|
||||
if (IsOpen || Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_CloseTimer?.Stop();
|
||||
|
||||
m_CloseTimer = new CloseTimer(this);
|
||||
m_CloseTimer.Start();
|
||||
|
||||
ItemID = ItemID switch
|
||||
{
|
||||
0x3EB1 => 0x3ED5,
|
||||
0x3E8A => 0x3E89,
|
||||
0x3EB2 => 0x3ED4,
|
||||
0x3E85 => 0x3E84,
|
||||
_ => ItemID
|
||||
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,
|
||||
_ => ItemID
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Boat?.Refresh();
|
||||
public void Open()
|
||||
{
|
||||
if (IsOpen || Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public override bool OnMoveOver(Mobile from)
|
||||
_closeTimer?.Stop();
|
||||
|
||||
_closeTimer = new CloseTimer(this);
|
||||
_closeTimer.Start();
|
||||
|
||||
ItemID = ItemID switch
|
||||
{
|
||||
if (IsOpen)
|
||||
0x3EB1 => 0x3ED5,
|
||||
0x3E8A => 0x3E89,
|
||||
0x3EB2 => 0x3ED4,
|
||||
0x3E85 => 0x3E84,
|
||||
_ => ItemID
|
||||
};
|
||||
|
||||
Boat?.Refresh();
|
||||
}
|
||||
|
||||
public override bool OnMoveOver(Mobile from)
|
||||
{
|
||||
if (IsOpen)
|
||||
{
|
||||
if (from is BaseFactionGuard)
|
||||
{
|
||||
if (from is BaseFactionGuard)
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((from.Direction & Direction.Running) != 0 || Boat?.Contains(from) == false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var map = Map;
|
||||
|
||||
if (map == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int rx = 0, ry = 0;
|
||||
|
||||
if (ItemID == 0x3ED4)
|
||||
{
|
||||
rx = 1;
|
||||
}
|
||||
else if (ItemID == 0x3ED5)
|
||||
{
|
||||
rx = -1;
|
||||
}
|
||||
else if (ItemID == 0x3E84)
|
||||
{
|
||||
ry = 1;
|
||||
}
|
||||
else if (ItemID == 0x3E89)
|
||||
{
|
||||
ry = -1;
|
||||
}
|
||||
|
||||
for (var i = 1; i <= 6; ++i)
|
||||
{
|
||||
var x = X + i * rx;
|
||||
var y = Y + i * ry;
|
||||
int z;
|
||||
|
||||
for (var j = -8; j <= 8; ++j)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((from.Direction & Direction.Running) != 0 || Boat?.Contains(from) == false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var map = Map;
|
||||
|
||||
if (map == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int rx = 0, ry = 0;
|
||||
|
||||
if (ItemID == 0x3ED4)
|
||||
{
|
||||
rx = 1;
|
||||
}
|
||||
else if (ItemID == 0x3ED5)
|
||||
{
|
||||
rx = -1;
|
||||
}
|
||||
else if (ItemID == 0x3E84)
|
||||
{
|
||||
ry = 1;
|
||||
}
|
||||
else if (ItemID == 0x3E89)
|
||||
{
|
||||
ry = -1;
|
||||
}
|
||||
|
||||
for (var i = 1; i <= 6; ++i)
|
||||
{
|
||||
var x = X + i * rx;
|
||||
var y = Y + i * ry;
|
||||
int z;
|
||||
|
||||
for (var j = -8; j <= 8; ++j)
|
||||
{
|
||||
z = from.Z + j;
|
||||
|
||||
if (map.CanFit(x, y, z, 16, false, false) && !SpellHelper.CheckMulti(new Point3D(x, y, z), map) &&
|
||||
!Region.Find(new Point3D(x, y, z), map).IsPartOf<StrongholdRegion>())
|
||||
{
|
||||
if (i == 1 && j >= -2 && j <= 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
from.Location = new Point3D(x, y, z);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
z = map.GetAverageZ(x, y);
|
||||
z = from.Z + j;
|
||||
|
||||
if (map.CanFit(x, y, z, 16, false, false) && !SpellHelper.CheckMulti(new Point3D(x, y, z), map) &&
|
||||
!Region.Find(new Point3D(x, y, z), map).IsPartOf<StrongholdRegion>())
|
||||
{
|
||||
if (i == 1)
|
||||
if (i == 1 && j >= -2 && j <= 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -218,108 +188,105 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
z = map.GetAverageZ(x, y);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CanClose()
|
||||
{
|
||||
if (Map == null || Deleted)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (var item in GetItemsAt())
|
||||
{
|
||||
if (item != this)
|
||||
if (map.CanFit(x, y, z, 16, false, false) && !SpellHelper.CheckMulti(new Point3D(x, y, z), map) &&
|
||||
!Region.Find(new Point3D(x, y, z), map).IsPartOf<StrongholdRegion>())
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
from.Location = new Point3D(x, y, z);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var m in GetMobilesAt())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CanClose()
|
||||
{
|
||||
if (Map == null || Deleted)
|
||||
{
|
||||
if (!IsOpen || !CanClose() || Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_CloseTimer?.Stop();
|
||||
|
||||
m_CloseTimer = null;
|
||||
|
||||
ItemID = ItemID switch
|
||||
{
|
||||
0x3ED5 => 0x3EB1,
|
||||
0x3E89 => 0x3E8A,
|
||||
0x3ED4 => 0x3EB2,
|
||||
0x3E84 => 0x3E85,
|
||||
_ => ItemID
|
||||
};
|
||||
|
||||
Boat?.Refresh();
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnDoubleClickDead(Mobile from)
|
||||
foreach (var item in GetItemsAt())
|
||||
{
|
||||
OnDoubleClick(from);
|
||||
if (item != this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
foreach (var m in GetMobilesAt())
|
||||
{
|
||||
if (Boat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (from.InRange(GetWorldLocation(), 8))
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (!IsOpen || !CanClose() || Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_closeTimer?.Stop();
|
||||
|
||||
_closeTimer = null;
|
||||
|
||||
ItemID = ItemID switch
|
||||
{
|
||||
0x3ED5 => 0x3EB1,
|
||||
0x3E89 => 0x3E8A,
|
||||
0x3ED4 => 0x3EB2,
|
||||
0x3E84 => 0x3E85,
|
||||
_ => ItemID
|
||||
};
|
||||
|
||||
Boat?.Refresh();
|
||||
}
|
||||
|
||||
public override void OnDoubleClickDead(Mobile from)
|
||||
{
|
||||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (Boat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (from.InRange(GetWorldLocation(), 8))
|
||||
{
|
||||
if (Boat.Contains(from))
|
||||
{
|
||||
if (Boat.Contains(from))
|
||||
if (IsOpen)
|
||||
{
|
||||
if (IsOpen)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
Open();
|
||||
}
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsOpen)
|
||||
Open();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsOpen)
|
||||
{
|
||||
if (!Locked)
|
||||
{
|
||||
if (!Locked)
|
||||
{
|
||||
Open();
|
||||
}
|
||||
else if (from.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
from.LocalOverheadMessage(
|
||||
MessageType.Regular,
|
||||
0x00,
|
||||
502502
|
||||
); // That is locked but your godly powers allow access
|
||||
Open();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x00, 502503); // That is locked.
|
||||
}
|
||||
}
|
||||
else if (!Locked)
|
||||
{
|
||||
from.Location = new Point3D(X, Y, Z + 3);
|
||||
Open();
|
||||
}
|
||||
else if (from.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
|
|
@ -328,29 +295,40 @@ namespace Server.Items
|
|||
0x00,
|
||||
502502
|
||||
); // That is locked but your godly powers allow access
|
||||
from.Location = new Point3D(X, Y, Z + 3);
|
||||
Open();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x00, 502503); // That is locked.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CloseTimer : Timer
|
||||
{
|
||||
private readonly Plank m_Plank;
|
||||
|
||||
public CloseTimer(Plank plank) : base(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(5.0))
|
||||
{
|
||||
m_Plank = plank;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Plank.Close();
|
||||
else if (!Locked)
|
||||
{
|
||||
from.Location = new Point3D(X, Y, Z + 3);
|
||||
}
|
||||
else if (from.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
from.LocalOverheadMessage(
|
||||
MessageType.Regular,
|
||||
0x00,
|
||||
502502
|
||||
); // That is locked but your godly powers allow access
|
||||
from.Location = new Point3D(X, Y, Z + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x00, 502503); // That is locked.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CloseTimer : Timer
|
||||
{
|
||||
private readonly Plank _plank;
|
||||
|
||||
public CloseTimer(Plank plank) : base(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(5.0)) => _plank = plank;
|
||||
|
||||
protected override void OnTick() => _plank.Close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,99 +1,49 @@
|
|||
namespace Server.Multis
|
||||
using ModernUO.Serialization;
|
||||
|
||||
namespace Server.Multis;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class SmallBoat : BaseBoat
|
||||
{
|
||||
public class SmallBoat : BaseBoat
|
||||
[Constructible]
|
||||
public SmallBoat()
|
||||
{
|
||||
[Constructible]
|
||||
public SmallBoat()
|
||||
{
|
||||
}
|
||||
|
||||
public SmallBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int NorthID => 0x0;
|
||||
public override int EastID => 0x1;
|
||||
public override int SouthID => 0x2;
|
||||
public override int WestID => 0x3;
|
||||
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -4;
|
||||
|
||||
public override Point2D StarboardOffset => new(2, 0);
|
||||
public override Point2D PortOffset => new(-2, 0);
|
||||
|
||||
public override Point3D MarkOffset => new(0, 1, 3);
|
||||
|
||||
public override BaseDockedBoat DockedBoat => new SmallDockedBoat(this);
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class SmallBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public SmallBoatDeed() : base(0x0, Point3D.Zero)
|
||||
{
|
||||
}
|
||||
public override int NorthID => 0x0;
|
||||
public override int EastID => 0x1;
|
||||
public override int SouthID => 0x2;
|
||||
public override int WestID => 0x3;
|
||||
|
||||
public SmallBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -4;
|
||||
|
||||
public override int LabelNumber => 1041205; // small ship deed
|
||||
public override BaseBoat Boat => new SmallBoat();
|
||||
public override Point2D StarboardOffset => new(2, 0);
|
||||
public override Point2D PortOffset => new(-2, 0);
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
public override Point3D MarkOffset => new(0, 1, 3);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class SmallDockedBoat : BaseDockedBoat
|
||||
{
|
||||
public SmallDockedBoat(BaseBoat boat) : base(0x0, Point3D.Zero, boat)
|
||||
{
|
||||
}
|
||||
|
||||
public SmallDockedBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseBoat Boat => new SmallBoat();
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
public override BaseDockedBoat DockedBoat => new SmallDockedBoat(this);
|
||||
}
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class SmallBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public SmallBoatDeed() : base(0x0, Point3D.Zero)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1041205; // small ship deed
|
||||
public override BaseBoat Boat => new SmallBoat();
|
||||
}
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class SmallDockedBoat : BaseDockedBoat
|
||||
{
|
||||
public SmallDockedBoat(BaseBoat boat) : base(0x0, Point3D.Zero, boat)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseBoat Boat => new SmallBoat();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,99 +1,49 @@
|
|||
namespace Server.Multis
|
||||
using ModernUO.Serialization;
|
||||
|
||||
namespace Server.Multis;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class SmallDragonBoat : BaseBoat
|
||||
{
|
||||
public class SmallDragonBoat : BaseBoat
|
||||
[Constructible]
|
||||
public SmallDragonBoat()
|
||||
{
|
||||
[Constructible]
|
||||
public SmallDragonBoat()
|
||||
{
|
||||
}
|
||||
|
||||
public SmallDragonBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int NorthID => 0x4;
|
||||
public override int EastID => 0x5;
|
||||
public override int SouthID => 0x6;
|
||||
public override int WestID => 0x7;
|
||||
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -4;
|
||||
|
||||
public override Point2D StarboardOffset => new(2, 0);
|
||||
public override Point2D PortOffset => new(-2, 0);
|
||||
|
||||
public override Point3D MarkOffset => new(0, 1, 3);
|
||||
|
||||
public override BaseDockedBoat DockedBoat => new SmallDockedDragonBoat(this);
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class SmallDragonBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public SmallDragonBoatDeed() : base(0x4, Point3D.Zero)
|
||||
{
|
||||
}
|
||||
public override int NorthID => 0x4;
|
||||
public override int EastID => 0x5;
|
||||
public override int SouthID => 0x6;
|
||||
public override int WestID => 0x7;
|
||||
|
||||
public SmallDragonBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -4;
|
||||
|
||||
public override int LabelNumber => 1041206; // small dragon ship deed
|
||||
public override BaseBoat Boat => new SmallDragonBoat();
|
||||
public override Point2D StarboardOffset => new(2, 0);
|
||||
public override Point2D PortOffset => new(-2, 0);
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
public override Point3D MarkOffset => new(0, 1, 3);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class SmallDockedDragonBoat : BaseDockedBoat
|
||||
{
|
||||
public SmallDockedDragonBoat(BaseBoat boat) : base(0x4, Point3D.Zero, boat)
|
||||
{
|
||||
}
|
||||
|
||||
public SmallDockedDragonBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseBoat Boat => new SmallDragonBoat();
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
public override BaseDockedBoat DockedBoat => new SmallDockedDragonBoat(this);
|
||||
}
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class SmallDragonBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public SmallDragonBoatDeed() : base(0x4, Point3D.Zero)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1041206; // small dragon ship deed
|
||||
public override BaseBoat Boat => new SmallDragonBoat();
|
||||
}
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class SmallDockedDragonBoat : BaseDockedBoat
|
||||
{
|
||||
public SmallDockedDragonBoat(BaseBoat boat) : base(0x4, Point3D.Zero, boat)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseBoat Boat => new SmallDragonBoat();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,130 +1,103 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class TillerMan : Item
|
||||
{
|
||||
public class TillerMan : Item
|
||||
[SerializableField(0, setter: "private")]
|
||||
private BaseBoat _boat;
|
||||
|
||||
public TillerMan(BaseBoat boat) : base(0x3E4E)
|
||||
{
|
||||
private BaseBoat m_Boat;
|
||||
_boat = boat;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public TillerMan(BaseBoat boat) : base(0x3E4E)
|
||||
public void SetFacing(Direction dir)
|
||||
{
|
||||
ItemID = dir switch
|
||||
{
|
||||
m_Boat = boat;
|
||||
Movable = false;
|
||||
Direction.South => 0x3E4B,
|
||||
Direction.North => 0x3E4E,
|
||||
Direction.West => 0x3E50,
|
||||
Direction.East => 0x3E55,
|
||||
_ => ItemID
|
||||
};
|
||||
}
|
||||
|
||||
public override void GetProperties(IPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(_boat.Status);
|
||||
}
|
||||
|
||||
public void Say(int number)
|
||||
{
|
||||
PublicOverheadMessage(MessageType.Regular, 0x3B2, number);
|
||||
}
|
||||
|
||||
public void Say(int number, string args)
|
||||
{
|
||||
PublicOverheadMessage(MessageType.Regular, 0x3B2, number, args);
|
||||
}
|
||||
|
||||
public override void AddNameProperty(IPropertyList list)
|
||||
{
|
||||
if (_boat?.ShipName != null)
|
||||
{
|
||||
list.Add(1042884, _boat.ShipName); // the tiller man of the ~1_SHIP_NAME~
|
||||
}
|
||||
else
|
||||
{
|
||||
base.AddNameProperty(list);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (_boat?.ShipName != null)
|
||||
{
|
||||
LabelTo(from, 1042884, _boat.ShipName); // the tiller man of the ~1_SHIP_NAME~
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (_boat?.Contains(from) == true)
|
||||
{
|
||||
_boat.BeginRename(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
_boat?.BeginDryDock(from);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (dropped is MapItem item && _boat?.CanCommand(from) == true && _boat.Contains(from))
|
||||
{
|
||||
_boat.AssociateMap(item);
|
||||
}
|
||||
|
||||
public TillerMan(Serial serial) : base(serial)
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnAfterDelete() => _boat?.Delete();
|
||||
|
||||
[AfterDeserialization]
|
||||
private void AfterDeserialization()
|
||||
{
|
||||
if (_boat == null)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetFacing(Direction dir)
|
||||
{
|
||||
ItemID = dir switch
|
||||
{
|
||||
Direction.South => 0x3E4B,
|
||||
Direction.North => 0x3E4E,
|
||||
Direction.West => 0x3E50,
|
||||
Direction.East => 0x3E55,
|
||||
_ => ItemID
|
||||
};
|
||||
}
|
||||
|
||||
public override void GetProperties(IPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(m_Boat.Status);
|
||||
}
|
||||
|
||||
public void Say(int number)
|
||||
{
|
||||
PublicOverheadMessage(MessageType.Regular, 0x3B2, number);
|
||||
}
|
||||
|
||||
public void Say(int number, string args)
|
||||
{
|
||||
PublicOverheadMessage(MessageType.Regular, 0x3B2, number, args);
|
||||
}
|
||||
|
||||
public override void AddNameProperty(IPropertyList list)
|
||||
{
|
||||
if (m_Boat?.ShipName != null)
|
||||
{
|
||||
list.Add(1042884, m_Boat.ShipName); // the tiller man of the ~1_SHIP_NAME~
|
||||
}
|
||||
else
|
||||
{
|
||||
base.AddNameProperty(list);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (m_Boat?.ShipName != null)
|
||||
{
|
||||
LabelTo(from, 1042884, m_Boat.ShipName); // the tiller man of the ~1_SHIP_NAME~
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Boat?.Contains(from) == true)
|
||||
{
|
||||
m_Boat.BeginRename(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Boat?.BeginDryDock(from);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (dropped is MapItem item && m_Boat?.CanCommand(from) == true && m_Boat.Contains(from))
|
||||
{
|
||||
m_Boat.AssociateMap(item);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
m_Boat?.Delete();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write(m_Boat);
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Boat = reader.ReadEntity<BaseBoat>();
|
||||
|
||||
if (m_Boat == null)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
Timer.DelayCall(Delete);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue