feat: adopt serialization generator v4 (field-side linkage, anchored timers) (#2586)
## Summary Adopts ModernUO.Serialization 4.0.0 across the engine. Three commits, reviewable independently: 1. **Package + tool bump to 4.0.0** (`Server.csproj`, `UOContent.csproj`, `dotnet-tools.json`). 2. **Timers → `[DeserializeTimer]`** — the 8 drifting timers (BaseLight, TreasureMapChest, MarkContainer, FillableContainer, DeathRobe, DecayedCorpse, Corpse, BaseEscortable) now store their next tick as **anchored time**: server downtime no longer consumes the remaining delay, and idle-world saves are byte-stable. This changes their wire format, so each class bumps its serialization version with a `MigrateFrom` that replays the old delta-time read through the migration schema (the new `vN.json` files carry `@AnchoredTimer`; the old ones keep `@TimerDrift`, which the generator reads forever). The 2 wall-clock timers (Aquarium, FountainOfLife) keep their exact format via `wallClock: true` — no bump. Restart methods drop their `TimeSpan.MinValue` sentinel checks: v4 invokes them **only when a timer was actually running at save**. 3. **Linkage → field-side declarations** — 175 conversions across 25 files: `[SerializableFieldSaveFlag(order)]`/`[SerializableFieldDefault(order)]` become `[SaveFlag(nameof(...), nameof(...))]` on the field, and `[SerializableFieldChanged(order)]` becomes the `fieldChanged:` argument of `[SerializableField]`. **Wire-neutral: zero migration schemas changed.** ## Verification - Solution builds with **0 errors, 0 warnings**; all three 4.0.0 packages verified indexed on nuget.org (no local feed needed). - **835 + 708 tests green.** - Generated output inspected: old-version content structs replay `ReadDeltaTime` (e.g. `V3Content.DecayTimerNext = reader.ReadDeltaTime()`), current versions write/read anchored time with the gated restart, and the wall-clock classes emit byte-identical `Write`/`ReadDateTime` framing. - Schema tool run is committed (CI's `git diff --exit-code` schema check passes): exactly the 8 expected new `vN.json` files, nothing else touched. - The conversion was scripted with a class-scoped resolver (order → same-class `[SerializableField(order)]`/`[SerializableProperty(order)]`); it planned 175/175 with zero ambiguities before applying. ## Notes - New `MigrateFrom`s use the content structs' provided `XxxDelay` property, matching the pre-existing idiom in Corpse's and TreasureMapChest's older migrations. - Follow-up candidate (separate PR, wire-neutral, any time): fold the ~150 eligible hand-written `[SerializableProperty]` setters (clamps, post-change side effects) down to `[SerializableField]` with `allowFieldChange`/`fieldChanged` hooks.
This commit is contained in:
parent
126a10ce53
commit
73f9688083
43 changed files with 667 additions and 278 deletions
|
|
@ -6,27 +6,27 @@ namespace Server.Engines.BulkOrders;
|
|||
public partial class BOBFilter
|
||||
{
|
||||
[SerializableField(0)]
|
||||
[SaveFlag(nameof(ShouldSerializeType))]
|
||||
private int _type;
|
||||
|
||||
[SerializableFieldSaveFlag(0)]
|
||||
private bool ShouldSerializeType() => _type != 0;
|
||||
|
||||
[SerializableField(1)]
|
||||
[SaveFlag(nameof(ShouldSerializeQuality))]
|
||||
private int _quality;
|
||||
|
||||
[SerializableFieldSaveFlag(1)]
|
||||
private bool ShouldSerializeQuality() => _quality != 0;
|
||||
|
||||
[SerializableField(2)]
|
||||
[SaveFlag(nameof(ShouldSerializeMaterial))]
|
||||
private int _material;
|
||||
|
||||
[SerializableFieldSaveFlag(2)]
|
||||
private bool ShouldSerializeMaterial() => _material != 0;
|
||||
|
||||
[SerializableField(3)]
|
||||
[SaveFlag(nameof(ShouldSerializeQuantity))]
|
||||
private int _quantity;
|
||||
|
||||
[SerializableFieldSaveFlag(3)]
|
||||
private bool ShouldSerializeQuantity() => _quantity != 0;
|
||||
|
||||
private void Deserialize(IGenericReader reader, int version)
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ public partial class ChampionTitleContext
|
|||
}
|
||||
|
||||
[SerializableField(1)]
|
||||
[SaveFlag(nameof(ShouldSerializeAbyss))]
|
||||
private ChampionTitle _abyss;
|
||||
|
||||
[SerializableFieldSaveFlag(1)]
|
||||
private bool ShouldSerializeAbyss() => _abyss != null;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
@ -71,9 +71,9 @@ public partial class ChampionTitleContext
|
|||
}
|
||||
|
||||
[SerializableField(2)]
|
||||
[SaveFlag(nameof(ShouldSerializeArachnid))]
|
||||
private ChampionTitle _arachnid;
|
||||
|
||||
[SerializableFieldSaveFlag(2)]
|
||||
private bool ShouldSerializeArachnid() => _arachnid != null;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
@ -91,9 +91,9 @@ public partial class ChampionTitleContext
|
|||
}
|
||||
|
||||
[SerializableField(3)]
|
||||
[SaveFlag(nameof(ShouldSerializeColdBlood))]
|
||||
private ChampionTitle _coldBlood;
|
||||
|
||||
[SerializableFieldSaveFlag(3)]
|
||||
private bool ShouldSerializeColdBlood() => _coldBlood != null;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
@ -111,9 +111,9 @@ public partial class ChampionTitleContext
|
|||
}
|
||||
|
||||
[SerializableField(4)]
|
||||
[SaveFlag(nameof(ShouldSerializeForestLord))]
|
||||
private ChampionTitle _forestLord;
|
||||
|
||||
[SerializableFieldSaveFlag(4)]
|
||||
private bool ShouldSerializeForestLord() => _forestLord != null;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
@ -131,9 +131,9 @@ public partial class ChampionTitleContext
|
|||
}
|
||||
|
||||
[SerializableField(5)]
|
||||
[SaveFlag(nameof(ShouldSerializeVerminHorde))]
|
||||
private ChampionTitle _verminHorde;
|
||||
|
||||
[SerializableFieldSaveFlag(5)]
|
||||
private bool ShouldSerializeVerminHorde() => _verminHorde != null;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
@ -151,9 +151,9 @@ public partial class ChampionTitleContext
|
|||
}
|
||||
|
||||
[SerializableField(6)]
|
||||
[SaveFlag(nameof(ShouldSerializeUnholyTerror))]
|
||||
private ChampionTitle _unholyTerror;
|
||||
|
||||
[SerializableFieldSaveFlag(6)]
|
||||
private bool ShouldSerializeUnholyTerror() => _unholyTerror != null;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
@ -171,9 +171,9 @@ public partial class ChampionTitleContext
|
|||
}
|
||||
|
||||
[SerializableField(7)]
|
||||
[SaveFlag(nameof(ShouldSerializeSleepingDragon))]
|
||||
private ChampionTitle _sleepingDragon;
|
||||
|
||||
[SerializableFieldSaveFlag(7)]
|
||||
private bool ShouldSerializeSleepingDragon() => _sleepingDragon != null;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
@ -191,9 +191,9 @@ public partial class ChampionTitleContext
|
|||
}
|
||||
|
||||
[SerializableField(8)]
|
||||
[SaveFlag(nameof(ShouldSerializeCorrupt))]
|
||||
private ChampionTitle _corrupt;
|
||||
|
||||
[SerializableFieldSaveFlag(8)]
|
||||
private bool ShouldSerializeCorrupt() => _corrupt != null;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
@ -211,9 +211,9 @@ public partial class ChampionTitleContext
|
|||
}
|
||||
|
||||
[SerializableField(9)]
|
||||
[SaveFlag(nameof(ShouldSerializeGlade))]
|
||||
private ChampionTitle _glade;
|
||||
|
||||
[SerializableFieldSaveFlag(9)]
|
||||
private bool ShouldSerializeGlade() => _glade != null;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
|
|||
|
|
@ -830,10 +830,9 @@ public partial class BRBomb : Item
|
|||
[SerializationGenerator(0, false)]
|
||||
public partial class BRGoal : BaseAddon
|
||||
{
|
||||
[SerializableField(0)]
|
||||
[SerializableField(0, fieldChanged: nameof(OnNorthChanged))]
|
||||
private bool _north;
|
||||
|
||||
[SerializableFieldChanged(0)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void OnNorthChanged(bool oldValue, bool newValue) => Remake();
|
||||
|
||||
|
|
|
|||
|
|
@ -252,10 +252,9 @@ public partial class HillOfTheKing : Item
|
|||
public partial class KHBoard : Item
|
||||
{
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
[SerializableField(0)]
|
||||
[SerializableField(0, fieldChanged: nameof(OnControllerChanged))]
|
||||
private KHController _controller;
|
||||
|
||||
[SerializableFieldChanged(0)]
|
||||
private void OnControllerChanged(KHController oldValue, KHController newValue)
|
||||
{
|
||||
oldValue?.RemoveBoard(this);
|
||||
|
|
|
|||
|
|
@ -37,17 +37,17 @@ public partial class PlantItem : Item, ISecurable
|
|||
|
||||
[SerializedIgnoreDupe]
|
||||
[SerializableField(0)]
|
||||
[SaveFlag(nameof(ShouldSerializeSecureLevel))]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private SecureLevel _level;
|
||||
|
||||
[SerializableFieldSaveFlag(0)]
|
||||
private bool ShouldSerializeSecureLevel() => (int)_level != 0;
|
||||
|
||||
[SerializedIgnoreDupe]
|
||||
[SerializableField(5, setter: "private")]
|
||||
[SaveFlag(nameof(ShouldSerializePlantSystem))]
|
||||
private PlantSystem _plantSystem;
|
||||
|
||||
[SerializableFieldSaveFlag(5)]
|
||||
private bool ShouldSerializePlantSystem() => _plantStatus < PlantStatus.DecorativePlant;
|
||||
|
||||
// For clients older than 7.0.12.0
|
||||
|
|
@ -82,6 +82,7 @@ public partial class PlantItem : Item, ISecurable
|
|||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
[SerializableProperty(1)]
|
||||
[SaveFlag(nameof(ShouldSerializePlantStatus))]
|
||||
public PlantStatus PlantStatus
|
||||
{
|
||||
get => _plantStatus;
|
||||
|
|
@ -120,10 +121,10 @@ public partial class PlantItem : Item, ISecurable
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(1)]
|
||||
private bool ShouldSerializePlantStatus() => _plantStatus != PlantStatus.BowlOfDirt;
|
||||
|
||||
[SerializableProperty(2)]
|
||||
[SaveFlag(nameof(ShouldSerializePlantType))]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public PlantType PlantType
|
||||
{
|
||||
|
|
@ -135,10 +136,10 @@ public partial class PlantItem : Item, ISecurable
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(2)]
|
||||
private bool ShouldSerializePlantType() => (int)_plantType != 0;
|
||||
|
||||
[SerializableProperty(3)]
|
||||
[SaveFlag(nameof(ShouldSerializePlantHue))]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public PlantHue PlantHue
|
||||
{
|
||||
|
|
@ -150,10 +151,10 @@ public partial class PlantItem : Item, ISecurable
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(3)]
|
||||
private bool ShouldSerializePlantHue() => _plantHue != PlantHue.None;
|
||||
|
||||
[SerializableProperty(4)]
|
||||
[SaveFlag(nameof(ShouldSerializeShowType))]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool ShowType
|
||||
{
|
||||
|
|
@ -166,7 +167,6 @@ public partial class PlantItem : Item, ISecurable
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(4)]
|
||||
private bool ShouldSerializeShowType() => _showType;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
|
|||
|
|
@ -33,24 +33,24 @@ namespace Server.Engines.Plants
|
|||
private PlantItem _plant;
|
||||
|
||||
[SerializableField(0)]
|
||||
[SaveFlag(nameof(ShouldSerializeFertileDirt))]
|
||||
private bool _fertileDirt;
|
||||
|
||||
[SerializableFieldSaveFlag(0)]
|
||||
private bool ShouldSerializeFertileDirt() => _fertileDirt;
|
||||
|
||||
[SerializableField(1)]
|
||||
private DateTime _nextGrowth;
|
||||
|
||||
[SerializableField(2, setter: "private")]
|
||||
[SaveFlag(nameof(ShouldSerializeGrowthIndicator))]
|
||||
private PlantGrowthIndicator _growthIndicator;
|
||||
|
||||
[SerializableFieldSaveFlag(2)]
|
||||
private bool ShouldSerializeGrowthIndicator() => _growthIndicator != PlantGrowthIndicator.None;
|
||||
|
||||
[SerializableField(13)]
|
||||
[SaveFlag(nameof(ShouldSerializePollinated))]
|
||||
private bool _pollinated;
|
||||
|
||||
[SerializableFieldSaveFlag(13)]
|
||||
private bool ShouldSerializePollinated() => _pollinated;
|
||||
|
||||
public PlantSystem(PlantItem plant)
|
||||
|
|
@ -98,6 +98,7 @@ namespace Server.Engines.Plants
|
|||
public bool IsFullWater => _water >= 4;
|
||||
|
||||
[SerializableProperty(3)]
|
||||
[SaveFlag(nameof(ShouldSerializeWater))]
|
||||
public int Water
|
||||
{
|
||||
get => _water;
|
||||
|
|
@ -109,10 +110,10 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(3)]
|
||||
private bool ShouldSerializeWater() => _water != 0;
|
||||
|
||||
[SerializableProperty(4)]
|
||||
[SaveFlag(nameof(ShouldSerializeHits))]
|
||||
public int Hits
|
||||
{
|
||||
get => _hits;
|
||||
|
|
@ -135,7 +136,6 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(4)]
|
||||
private bool ShouldSerializeHits() => _hits != 0;
|
||||
|
||||
public int MaxHits => 10 + (int)Plant.PlantStatus * 2;
|
||||
|
|
@ -150,6 +150,7 @@ namespace Server.Engines.Plants
|
|||
};
|
||||
|
||||
[SerializableProperty(5)]
|
||||
[SaveFlag(nameof(ShouldSerializeInfestation))]
|
||||
public int Infestation
|
||||
{
|
||||
get => _infestation;
|
||||
|
|
@ -160,10 +161,10 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(5)]
|
||||
private bool ShouldSerializeInfestation() => _infestation != 0;
|
||||
|
||||
[SerializableProperty(6)]
|
||||
[SaveFlag(nameof(ShouldSerializeFungus))]
|
||||
public int Fungus
|
||||
{
|
||||
get => _fungus;
|
||||
|
|
@ -174,10 +175,10 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(6)]
|
||||
private bool ShouldSerializeFungus() => _fungus != 0;
|
||||
|
||||
[SerializableProperty(7)]
|
||||
[SaveFlag(nameof(ShouldSerializePoison))]
|
||||
public int Poison
|
||||
{
|
||||
get => _poison;
|
||||
|
|
@ -188,10 +189,10 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(7)]
|
||||
private bool ShouldSerializePoison() => _poison != 0;
|
||||
|
||||
[SerializableProperty(8)]
|
||||
[SaveFlag(nameof(ShouldSerializeDisease))]
|
||||
public int Disease
|
||||
{
|
||||
get => _disease;
|
||||
|
|
@ -202,12 +203,12 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(8)]
|
||||
private bool ShouldSerializeDisease() => _disease != 0;
|
||||
|
||||
public bool IsFullPoisonPotion => _poisonPotion >= 2;
|
||||
|
||||
[SerializableProperty(9)]
|
||||
[SaveFlag(nameof(ShouldSerializePoisonPotion))]
|
||||
public int PoisonPotion
|
||||
{
|
||||
get => _poisonPotion;
|
||||
|
|
@ -218,12 +219,12 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(9)]
|
||||
private bool ShouldSerializePoisonPotion() => _poisonPotion != 0;
|
||||
|
||||
public bool IsFullCurePotion => _curePotion >= 2;
|
||||
|
||||
[SerializableProperty(10)]
|
||||
[SaveFlag(nameof(ShouldSerializeCurePotion))]
|
||||
public int CurePotion
|
||||
{
|
||||
get => _curePotion;
|
||||
|
|
@ -234,12 +235,12 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(10)]
|
||||
private bool ShouldSerializeCurePotion() => _curePotion != 0;
|
||||
|
||||
public bool IsFullHealPotion => _healPotion >= 2;
|
||||
|
||||
[SerializableProperty(11)]
|
||||
[SaveFlag(nameof(ShouldSerializeHealPotion))]
|
||||
public int HealPotion
|
||||
{
|
||||
get => _healPotion;
|
||||
|
|
@ -250,12 +251,12 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(11)]
|
||||
private bool ShouldSerializeHealPotion() => _healPotion != 0;
|
||||
|
||||
public bool IsFullStrengthPotion => _strengthPotion >= 2;
|
||||
|
||||
[SerializableProperty(12)]
|
||||
[SaveFlag(nameof(ShouldSerializeStrengthPotion))]
|
||||
public int StrengthPotion
|
||||
{
|
||||
get => _strengthPotion;
|
||||
|
|
@ -266,7 +267,6 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(12)]
|
||||
private bool ShouldSerializeStrengthPotion() => _strengthPotion != 0;
|
||||
|
||||
public bool HasMaladies => Infestation > 0 || Fungus > 0 || Poison > 0 || Disease > 0 || Water != 2;
|
||||
|
|
@ -274,6 +274,7 @@ namespace Server.Engines.Plants
|
|||
public bool PollenProducing => Plant.IsCrossable && Plant.PlantStatus >= PlantStatus.FullGrownPlant;
|
||||
|
||||
[SerializableProperty(14)]
|
||||
[SaveFlag(nameof(ShouldSerializeSeedType))]
|
||||
public PlantType SeedType
|
||||
{
|
||||
get => Pollinated ? _seedType : Plant.PlantType;
|
||||
|
|
@ -284,10 +285,10 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(14)]
|
||||
private bool ShouldSerializeSeedType() => _pollinated;
|
||||
|
||||
[SerializableProperty(15)]
|
||||
[SaveFlag(nameof(ShouldSerializeSeedHue))]
|
||||
public PlantHue SeedHue
|
||||
{
|
||||
get => Pollinated ? _seedHue : Plant.PlantHue;
|
||||
|
|
@ -298,53 +299,50 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(15)]
|
||||
private bool ShouldSerializeSeedHue() => _pollinated;
|
||||
|
||||
[SerializableProperty(16)]
|
||||
[SaveFlag(nameof(ShouldSerializeAvailableSeeds))]
|
||||
public int AvailableSeeds
|
||||
{
|
||||
get => _availableSeeds;
|
||||
set => _availableSeeds = Math.Max(value, 0);
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(16)]
|
||||
private bool ShouldSerializeAvailableSeeds() => _availableSeeds != 0;
|
||||
|
||||
[SerializableProperty(17)]
|
||||
[SaveFlag(nameof(ShouldSerializeLeftSeeds), nameof(LeftSeedsDefaultValue))]
|
||||
public int LeftSeeds
|
||||
{
|
||||
get => _leftSeeds;
|
||||
set => _leftSeeds = Math.Max(value, 0);
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(17)]
|
||||
private bool ShouldSerializeLeftSeeds() => _leftSeeds != 8;
|
||||
|
||||
[SerializableFieldDefault(17)]
|
||||
private int LeftSeedsDefaultValue() => 8;
|
||||
|
||||
[SerializableProperty(18)]
|
||||
[SaveFlag(nameof(ShouldSerializeAvailableResources))]
|
||||
public int AvailableResources
|
||||
{
|
||||
get => _availableResources;
|
||||
set => _availableResources = Math.Max(value, 0);
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(18)]
|
||||
private bool ShouldSerializeAvailableResources() => _availableResources != 0;
|
||||
|
||||
[SerializableProperty(19)]
|
||||
[SaveFlag(nameof(ShouldSerializeLeftResources), nameof(LeftResourcesDefaultValue))]
|
||||
public int LeftResources
|
||||
{
|
||||
get => _leftResources;
|
||||
set => _leftResources = Math.Max(value, 0);
|
||||
}
|
||||
|
||||
[SerializableFieldSaveFlag(19)]
|
||||
private bool ShouldSerializeLeftResources() => _leftResources != 8;
|
||||
|
||||
[SerializableFieldDefault(19)]
|
||||
private int LeftResourcesDefaultValue() => 8;
|
||||
|
||||
public void Reset(bool potions)
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ public abstract partial class BaseSpawner : Item, ISpawner
|
|||
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||
private Guid _guid;
|
||||
|
||||
[SerializableFieldSaveFlag(1)]
|
||||
private bool ShouldSerializeReturnOnDeactivate() => _returnOnDeactivate;
|
||||
|
||||
[SerializableField(1)]
|
||||
[SaveFlag(nameof(ShouldSerializeReturnOnDeactivate))]
|
||||
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||
private bool _returnOnDeactivate;
|
||||
|
||||
|
|
@ -67,48 +67,46 @@ public abstract partial class BaseSpawner : Item, ISpawner
|
|||
|
||||
private int _walkingRange = -1;
|
||||
|
||||
[SerializableFieldSaveFlag(4)]
|
||||
private bool ShouldSerializeWayPoint() => _wayPoint != null;
|
||||
|
||||
[SerializableField(4)]
|
||||
[SaveFlag(nameof(ShouldSerializeWayPoint))]
|
||||
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||
private WayPoint _wayPoint;
|
||||
|
||||
[SerializableFieldSaveFlag(5)]
|
||||
private bool ShouldSerializeGroup() => _group;
|
||||
|
||||
[InvalidateProperties]
|
||||
[SerializableField(5)]
|
||||
[SaveFlag(nameof(ShouldSerializeGroup))]
|
||||
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||
private bool _group;
|
||||
|
||||
[SerializableFieldSaveFlag(6)]
|
||||
private bool ShouldSerializeMinDelay() => _minDelay != DefaultMinDelay;
|
||||
|
||||
[SerializableFieldDefault(6)]
|
||||
private TimeSpan MinDelayDefault() => DefaultMinDelay;
|
||||
|
||||
[InvalidateProperties]
|
||||
[SerializableField(6)]
|
||||
[SaveFlag(nameof(ShouldSerializeMinDelay), nameof(MinDelayDefault))]
|
||||
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||
private TimeSpan _minDelay;
|
||||
|
||||
[SerializableFieldSaveFlag(7)]
|
||||
private bool ShouldSerializeMaxDelay() => _maxDelay != DefaultMaxDelay;
|
||||
|
||||
[SerializableFieldDefault(7)]
|
||||
private TimeSpan MaxDelayDefault() => DefaultMaxDelay;
|
||||
|
||||
[InvalidateProperties]
|
||||
[SerializableField(7)]
|
||||
[SaveFlag(nameof(ShouldSerializeMaxDelay), nameof(MaxDelayDefault))]
|
||||
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||
private TimeSpan _maxDelay;
|
||||
|
||||
[SerializableFieldSaveFlag(9)]
|
||||
private bool ShouldSerializeTeam() => _team != 0;
|
||||
|
||||
[InvalidateProperties]
|
||||
[SerializableField(9)]
|
||||
[SaveFlag(nameof(ShouldSerializeTeam))]
|
||||
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||
private int _team;
|
||||
|
||||
|
|
@ -125,29 +123,29 @@ public abstract partial class BaseSpawner : Item, ISpawner
|
|||
/// If true, the home location of the spawn is the location where it spawned
|
||||
/// If false, the home location of the spawn is the location of the spawner
|
||||
/// </summary>
|
||||
[SerializableFieldSaveFlag(11)]
|
||||
private bool ShouldSerializeSpawnLocationIsHome() => _spawnLocationIsHome;
|
||||
|
||||
[InvalidateProperties]
|
||||
[SerializableField(11)]
|
||||
[SaveFlag(nameof(ShouldSerializeSpawnLocationIsHome))]
|
||||
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||
private bool _spawnLocationIsHome;
|
||||
|
||||
[SerializableFieldSaveFlag(12)]
|
||||
private bool ShouldSerializeEnd() => _end != default;
|
||||
|
||||
[SerializableField(12)]
|
||||
[SaveFlag(nameof(ShouldSerializeEnd))]
|
||||
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||
private DateTime _end;
|
||||
|
||||
/// <summary>
|
||||
/// Controls how spawn position optimization is handled.
|
||||
/// </summary>
|
||||
[SerializableFieldSaveFlag(13)]
|
||||
private bool ShouldSerializeSpawnPositionMode() =>
|
||||
_spawnPositionMode is not SpawnPositionMode.Automatic and not SpawnPositionMode.Abandoned;
|
||||
|
||||
[SerializableField(13)]
|
||||
[SaveFlag(nameof(ShouldSerializeSpawnPositionMode))]
|
||||
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||
private SpawnPositionMode _spawnPositionMode;
|
||||
|
||||
|
|
@ -156,13 +154,12 @@ public abstract partial class BaseSpawner : Item, ISpawner
|
|||
/// <summary>
|
||||
/// Maximum number of random position attempts before engaging optimization.
|
||||
/// </summary>
|
||||
[SerializableFieldSaveFlag(14)]
|
||||
private bool ShouldSerializeMaxSpawnAttempts() => _maxSpawnAttempts != DefaultMaxSpawnAttempts;
|
||||
|
||||
[SerializableFieldDefault(14)]
|
||||
private int MaxSpawnAttemptsDefault() => DefaultMaxSpawnAttempts;
|
||||
|
||||
[SerializableField(14)]
|
||||
[SaveFlag(nameof(ShouldSerializeMaxSpawnAttempts), nameof(MaxSpawnAttemptsDefault))]
|
||||
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||
private int _maxSpawnAttempts;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,17 +10,17 @@ public partial class Spawner : BaseSpawner
|
|||
/// When true, enables proactive spiral scanning to find valid spawn positions.
|
||||
/// Only relevant when SpawnPositionMode is Automatic or Enabled.
|
||||
/// </summary>
|
||||
[SerializableFieldSaveFlag(0)]
|
||||
private bool ShouldSerializeUseSpiralScan() => _useSpiralScan;
|
||||
|
||||
[SerializableField(0)]
|
||||
[SaveFlag(nameof(ShouldSerializeUseSpiralScan))]
|
||||
[SerializedCommandProperty(AccessLevel.Developer)]
|
||||
private bool _useSpiralScan;
|
||||
|
||||
[SerializableFieldSaveFlag(1)]
|
||||
private bool ShouldSerializeSpawnBounds() => _spawnBounds != default;
|
||||
|
||||
[SerializableProperty(1)]
|
||||
[SaveFlag(nameof(ShouldSerializeSpawnBounds))]
|
||||
[CommandProperty(AccessLevel.Developer)]
|
||||
public override Rectangle3D SpawnBounds
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,97 +10,97 @@ public partial class VirtueContext
|
|||
{
|
||||
[DeltaDateTime]
|
||||
[SerializableField(0)]
|
||||
[SaveFlag(nameof(ShouldSerializeLastSacrificeGain))]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||
private DateTime _lastSacrificeGain;
|
||||
|
||||
[SerializableFieldSaveFlag(0)]
|
||||
private bool ShouldSerializeLastSacrificeGain() => !SacrificeVirtue.CanGain(this);
|
||||
|
||||
[DeltaDateTime]
|
||||
[SerializableField(1)]
|
||||
[SaveFlag(nameof(ShouldSerializeLastSacrificeLoss))]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||
private DateTime _lastSacrificeLoss;
|
||||
|
||||
[SerializableFieldSaveFlag(1)]
|
||||
private bool ShouldSerializeLastSacrificeLoss() => !SacrificeVirtue.CanAtrophy(this);
|
||||
|
||||
[SerializableField(2)]
|
||||
[SaveFlag(nameof(ShouldSerializeAvailableResurrects))]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private int _availableResurrects;
|
||||
|
||||
[SerializableFieldSaveFlag(2)]
|
||||
private bool ShouldSerializeAvailableResurrects() => _availableResurrects > 0;
|
||||
|
||||
[DeltaDateTime]
|
||||
[SerializableField(3)]
|
||||
[SaveFlag(nameof(ShouldSerializeLastJusticeLoss))]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||
private DateTime _lastJusticeLoss;
|
||||
|
||||
[SerializableFieldSaveFlag(3)]
|
||||
private bool ShouldSerializeLastJusticeLoss() => !JusticeVirtue.CanAtrophy(this);
|
||||
|
||||
[DeltaDateTime]
|
||||
[SerializableField(4)]
|
||||
[SaveFlag(nameof(ShouldSerializeLastCompassionLoss))]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||
private DateTime _lastCompassionLoss;
|
||||
|
||||
[SerializableFieldSaveFlag(4)]
|
||||
private bool ShouldSerializeLastCompassionLoss() => !CompassionVirtue.CanAtrophy(this);
|
||||
|
||||
[DeltaDateTime]
|
||||
[SerializableField(5)]
|
||||
[SaveFlag(nameof(ShouldSerializeNextCompassionDay))]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private DateTime _nextCompassionDay;
|
||||
|
||||
[SerializableFieldSaveFlag(5)]
|
||||
private bool ShouldSerializeNextCompassionDay() => _nextCompassionDay > Core.Now;
|
||||
|
||||
[SerializableField(6)]
|
||||
[SaveFlag(nameof(ShouldSerializeCompassionGains))]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private int _compassionGains;
|
||||
|
||||
[SerializableFieldSaveFlag(6)]
|
||||
private bool ShouldSerializeCompassionGains() => _compassionGains > 0;
|
||||
|
||||
[DeltaDateTime]
|
||||
[SerializableField(7)]
|
||||
[SaveFlag(nameof(ShouldSerializeValorLoss))]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||
private DateTime _lastValorLoss;
|
||||
|
||||
[SerializableFieldSaveFlag(7)]
|
||||
private bool ShouldSerializeValorLoss() => !ValorVirtue.CanAtrophy(this);
|
||||
|
||||
[DeltaDateTime]
|
||||
[SerializableField(8)]
|
||||
[SaveFlag(nameof(ShouldSerializeLastHonorUse))]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private DateTime _lastHonorUse;
|
||||
|
||||
[SerializableFieldSaveFlag(8)]
|
||||
private bool ShouldSerializeLastHonorUse() => !HonorVirtue.CanUse(this);
|
||||
|
||||
[SerializableField(9)]
|
||||
[SaveFlag(nameof(ShouldSerializeHonorActive))]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||
private bool _honorActive;
|
||||
|
||||
[SerializableFieldSaveFlag(9)]
|
||||
private bool ShouldSerializeHonorActive() => _honorActive;
|
||||
|
||||
[SerializableField(10)]
|
||||
[SaveFlag(nameof(ShouldSerializeJusticeProtection))]
|
||||
private PlayerMobile _justiceProtection;
|
||||
|
||||
[SerializableFieldSaveFlag(10)]
|
||||
private bool ShouldSerializeJusticeProtection() => _justiceProtection != null && _justiceStatus != JusticeProtectorStatus.None;
|
||||
|
||||
[SerializableField(11)]
|
||||
[SaveFlag(nameof(ShouldSerializeJusticeStatus))]
|
||||
private JusticeProtectorStatus _justiceStatus;
|
||||
|
||||
[SerializableFieldSaveFlag(11)]
|
||||
private bool ShouldSerializeJusticeStatus() => _justiceProtection != null && _justiceStatus != JusticeProtectorStatus.None;
|
||||
|
||||
[SerializableField(12, setter: "private")]
|
||||
[SaveFlag(nameof(ShouldSerializeValues))]
|
||||
private int[] _values;
|
||||
|
||||
[SerializableFieldSaveFlag(12)]
|
||||
private bool ShouldSerializeValues()
|
||||
{
|
||||
if (_values == null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue