fix(codegen): Codegens books (#697)
This commit is contained in:
parent
488f1044fa
commit
f7e7fa424b
68 changed files with 452 additions and 1109 deletions
|
|
@ -1,7 +1,8 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
[Serializable(0, false)]
|
||||
[Flippable(0x1B09, 0x1B10)]
|
||||
public class BonePile : Item, IScissorable
|
||||
public partial class BonePile : Item, IScissorable
|
||||
{
|
||||
[Constructible]
|
||||
public BonePile() : base(0x1B09 + Utility.Random(8))
|
||||
|
|
@ -10,10 +11,6 @@ namespace Server.Items
|
|||
Weight = 10.0;
|
||||
}
|
||||
|
||||
public BonePile(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Scissor(Mobile from, Scissors scissors)
|
||||
{
|
||||
if (Deleted || !from.CanSee(this))
|
||||
|
|
@ -25,19 +22,5 @@ namespace Server.Items
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,100 +7,51 @@ namespace Server.Items
|
|||
Tournament
|
||||
}
|
||||
|
||||
public class Head : Item
|
||||
[Serializable(1, false)]
|
||||
public partial class Head : Item
|
||||
{
|
||||
[SerializableField(0)]
|
||||
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
|
||||
private string _playerName;
|
||||
|
||||
[SerializableField(1)]
|
||||
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
|
||||
private HeadType _headType;
|
||||
|
||||
[Constructible]
|
||||
public Head(string playerName) : this(HeadType.Regular, playerName)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Head(HeadType headType = HeadType.Regular, string playerName = null)
|
||||
: base(0x1DA0)
|
||||
public Head(HeadType headType = HeadType.Regular, string playerName = null) : base(0x1DA0)
|
||||
{
|
||||
HeadType = headType;
|
||||
PlayerName = playerName;
|
||||
_headType = headType;
|
||||
_playerName = playerName;
|
||||
}
|
||||
|
||||
public Head(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string PlayerName { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HeadType HeadType { get; set; }
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (PlayerName == null)
|
||||
if (_playerName == null)
|
||||
{
|
||||
return base.DefaultName;
|
||||
}
|
||||
|
||||
return HeadType switch
|
||||
return _headType switch
|
||||
{
|
||||
HeadType.Duel => $"the head of {PlayerName}, taken in a duel",
|
||||
HeadType.Tournament => $"the head of {PlayerName}, taken in a tournament",
|
||||
_ => $"the head of {PlayerName}"
|
||||
HeadType.Duel => $"the head of {_playerName}, taken in a duel",
|
||||
HeadType.Tournament => $"the head of {_playerName}, taken in a tournament",
|
||||
_ => $"the head of {_playerName}"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
private void Deserialize(IGenericReader reader, int version)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write(PlayerName);
|
||||
writer.WriteEncodedInt((int)HeadType);
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
PlayerName = reader.ReadString();
|
||||
HeadType = (HeadType)reader.ReadEncodedInt();
|
||||
break;
|
||||
|
||||
case 0:
|
||||
var format = Name;
|
||||
|
||||
if (format != null)
|
||||
{
|
||||
if (format.StartsWithOrdinal("the head of "))
|
||||
{
|
||||
format = format[14..]; // "the head of|..."
|
||||
}
|
||||
|
||||
if (format.EndsWithOrdinal(", taken in a duel"))
|
||||
{
|
||||
format = format[..^", taken in a duel".Length];
|
||||
HeadType = HeadType.Duel;
|
||||
}
|
||||
else if (format.EndsWithOrdinal(", taken in a tournament"))
|
||||
{
|
||||
format = format[..^", taken in a tournament".Length];
|
||||
HeadType = HeadType.Tournament;
|
||||
}
|
||||
}
|
||||
|
||||
PlayerName = format;
|
||||
Name = null;
|
||||
|
||||
break;
|
||||
}
|
||||
_playerName = reader.ReadString();
|
||||
_headType = (HeadType)reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,11 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class LeftArm : Item
|
||||
[Serializable(0, false)]
|
||||
public partial class LeftArm : Item
|
||||
{
|
||||
[Constructible]
|
||||
public LeftArm() : base(0x1DA1)
|
||||
{
|
||||
}
|
||||
|
||||
public LeftArm(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,11 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class LeftLeg : Item
|
||||
[Serializable(0, false)]
|
||||
public partial class LeftLeg : Item
|
||||
{
|
||||
[Constructible]
|
||||
public LeftLeg() : base(0x1DA3)
|
||||
{
|
||||
}
|
||||
|
||||
public LeftLeg(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
[Serializable(0, false)]
|
||||
[Flippable(0x1B17, 0x1B18)]
|
||||
public class RibCage : Item, IScissorable
|
||||
public partial class RibCage : Item, IScissorable
|
||||
{
|
||||
[Constructible]
|
||||
public RibCage() : base(0x1B17 + Utility.Random(2))
|
||||
|
|
@ -10,10 +11,6 @@ namespace Server.Items
|
|||
Weight = 5.0;
|
||||
}
|
||||
|
||||
public RibCage(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Scissor(Mobile from, Scissors scissors)
|
||||
{
|
||||
if (Deleted || !from.CanSee(this))
|
||||
|
|
@ -25,19 +22,5 @@ namespace Server.Items
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,11 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class RightArm : Item
|
||||
[Serializable(0, false)]
|
||||
public partial class RightArm : Item
|
||||
{
|
||||
[Constructible]
|
||||
public RightArm() : base(0x1DA2)
|
||||
{
|
||||
}
|
||||
|
||||
public RightArm(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,11 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class RightLeg : Item
|
||||
[Serializable(0, false)]
|
||||
public partial class RightLeg : Item
|
||||
{
|
||||
[Constructible]
|
||||
public RightLeg() : base(0x1DA4)
|
||||
{
|
||||
}
|
||||
|
||||
public RightLeg(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,9 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class Torso : Item
|
||||
[Serializable(0, false)]
|
||||
public partial class Torso : Item
|
||||
{
|
||||
[Constructible]
|
||||
public Torso() : base(0x1D9F) => Weight = 2.0;
|
||||
|
||||
public Torso(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue