feat: Adds SerializedCommandProperty (#1249)

## Breaking Change
* Removes `SerializableFieldAttrAttribute` in favor of `SerializedPropertyAttr`.

## Important Change
* Adds `SerializedCommandProperty`

Example:
```cs
    [InvalidateProperties]
    [SerializableField(0)]
    [SerializedCommandProperty(AccessLevel.GameMaster)]
    private Mobile _completedBy;
```
This commit is contained in:
Kamron Batman 2022-11-14 18:24:33 -08:00 • committed by GitHub
parent 5660f4636e
commit 936000ecf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 272 additions and 231 deletions

View file

@ -15,7 +15,7 @@ public partial class BankCheck : Item
{
[InvalidateProperties]
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _worth;
[Constructible]

View file

@ -51,12 +51,12 @@ public partial class BroadcastCrystal : Item
[InvalidateProperties]
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _charges;
[InvalidateProperties]
[SerializableField(1, getter: "private", setter: "private")]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private List<ReceiverCrystal> _receivers;
[Constructible]

View file

@ -12,11 +12,11 @@ public partial class DeceitBrazier : Item
private TimerExecutionToken _timerToken;
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _spawnRange;
[SerializableField(1)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private TimeSpan _nextSpawnDelay;
[Constructible]

View file

@ -24,15 +24,15 @@ public enum EffectTriggerType
public partial class EffectController : Item
{
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private TimeSpan _effectDelay;
[SerializableField(1)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private TimeSpan _triggerDelay;
[SerializableField(2)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private TimeSpan _soundDelay;
[SerializableField(3)]
@ -42,75 +42,75 @@ public partial class EffectController : Item
private IEntity _target;
[SerializableField(5)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private EffectController _sequence;
[SerializableField(6)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private bool _fixedDirection;
[SerializableField(7)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private bool _explodes;
[SerializableField(8)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private bool _playSoundAtTrigger;
[SerializableField(9)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private ECEffectType _effectType;
[SerializableField(10)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private EffectLayer _effectLayer;
[SerializableField(11)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private EffectTriggerType _triggerType;
[SerializableField(12)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _effectItemId;
[SerializableField(13)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _effectHue;
[SerializableField(14)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _renderMode;
[SerializableField(15)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _speed;
[SerializableField(16)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _duration;
[SerializableField(17)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _particleEffect;
[SerializableField(18)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _explodeParticleEffect;
[SerializableField(19)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _explodeSound;
[SerializableField(20)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _unknown;
[SerializableField(21)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _soundId;
[SerializableField(22)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _triggerRange;
[Constructible]

View file

@ -23,21 +23,21 @@ public interface ILockable
public partial class Key : Item
{
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _maxRange;
[SerializableField(1)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private Item _link;
[SerializableField(2)]
[InvalidateProperties]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private string _description;
[SerializableField(3)]
[InvalidateProperties]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private uint _keyValue;
[Constructible]

View file

@ -17,7 +17,7 @@ public partial class Moonstone : Item
{
[InvalidateProperties]
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private MoonstoneType _type;
[Constructible]

View file

@ -7,11 +7,11 @@ namespace Server.Items;
public partial class MorphItem : Item
{
[SerializableField(1)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _inactiveItemId;
[SerializableField(2)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _activeItemId;
[Constructible]

View file

@ -32,16 +32,16 @@ public partial class PlayerBBEast : BasePlayerBB
public abstract partial class BasePlayerBB : Item, ISecurable
{
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private SecureLevel _level;
[SerializableField(1)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private string _title;
[CanBeNull]
[SerializableField(2)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private PlayerBBMessage _greeting;
[SerializableField(3)]
@ -235,15 +235,15 @@ public abstract partial class BasePlayerBB : Item, ISecurable
public partial class PlayerBBMessage
{
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private DateTime _time;
[SerializableField(1)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private Mobile _poster;
[SerializableField(2)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private string _message;
public PlayerBBMessage()

View file

@ -7,15 +7,15 @@ namespace Server.Items;
public partial class SerpentPillar : Item
{
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private bool _active;
[SerializableField(1)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private string _word;
[SerializableField(2)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private Rectangle2D _destination;
[Constructible]

View file

@ -22,7 +22,7 @@ public partial class LocalizedStatic : Static
[EncodedInt]
[InvalidateProperties]
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _number;
[Constructible]

View file

@ -25,28 +25,28 @@ public partial class Teleporter : Item
{
[InvalidateProperties]
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private TeleporterFlags _flags;
[InvalidateProperties]
[SerializableField(1)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private TimeSpan _delay;
[EncodedInt]
[InvalidateProperties]
[SerializableField(2)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _soundID;
[InvalidateProperties]
[SerializableField(3)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private Point3D _pointDest;
[InvalidateProperties]
[SerializableField(4)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private Map _mapDest;
[Constructible]
@ -307,18 +307,18 @@ public partial class SkillTeleporter : Teleporter
{
[InvalidateProperties]
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private SkillName _skill;
[InvalidateProperties]
[SerializableField(1)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private double _required;
[CanBeNull]
[InvalidateProperties]
[SerializableField(2)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private TextDefinition _message;
[Constructible]
@ -423,15 +423,15 @@ public partial class SkillTeleporter : Teleporter
public partial class KeywordTeleporter : Teleporter
{
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private string _substring;
[SerializableField(1)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _keyword;
[SerializableField(2)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _range;
[Constructible]
@ -513,18 +513,18 @@ public partial class WaitTeleporter : KeywordTeleporter
[CanBeNull]
[InvalidateProperties]
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private TextDefinition _startMessage;
[CanBeNull]
[InvalidateProperties]
[SerializableField(1)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private TextDefinition _progressMessage;
[InvalidateProperties]
[SerializableField(2)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private bool _showTimeRemaining;
[Constructible]

View file

@ -11,7 +11,7 @@ public partial class WarningItem : Item
private bool m_Broadcasting;
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private TextDefinition _warningMessage;
// Field 1
@ -134,7 +134,7 @@ public partial class WarningItem : Item
public partial class HintItem : WarningItem
{
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private TextDefinition _hintMessage;
[Constructible]

View file

@ -8,7 +8,7 @@ namespace Server.Items;
public partial class WayPoint : Item
{
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private WayPoint _nextPoint;
[Constructible]

View file

@ -10,7 +10,7 @@ public abstract partial class BaseWindChimes : Item
{
[InvalidateProperties]
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private bool _turnedOn;
public BaseWindChimes(int itemID) : base(itemID)