## Summary Removes the dated `DynamicJson` JSON helper and migrates spawner JSON (de)serialization to a polymorphic `record SpawnerDto` hierarchy. `DynamicJson` was the last remaining consumer (regions moved off it in #1400). The key correctness improvement: **System.Text.Json deserializes plain DTO records, never a live `Item`.** Previously, deserializing directly into an `Item` meant STJ constructed world-registered objects *before* the data was validated — a malformed/hand-edited spawn file could leave orphaned spawner Items in the world save. Now a parse failure is GC-only; `dto.ToSpawner()` constructs the spawner only from a fully-validated DTO and self-cleans on failure. ## What changed - **New:** `SpawnerDto` (abstract) + `SpawnerDataDto` / `RegionSpawnerDto` / `ProximitySpawnerDto`, each marked with a reusable `[JsonDiscoverableType]` opt-in attribute. Auto-discovered at the `Configure` phase — no manual registration list (avoids the regions `Register<T>()` footgun), open to custom spawner subtypes. - **Symmetric mapping:** `BaseSpawner.ToDto()` (export) ⇄ `SpawnerDto.ToSpawner()` (import). `ToSpawner()` deletes-and-rethrows on any failure, so the importer can never orphan an Item. - **`SpawnerJsonSerializer`** wires `$type` polymorphism on the `SpawnerDto` root with loud collision/constructibility validation. - **Import/export commands** rewired to the typed DTO path (reflection `FindTypeByName`/`CreateInstance` removed). - **Data migration:** the 109 `Distribution/Data/Spawns/**` files moved from `"type"`→`"$type"` and legacy `homeRange`→`spawnBounds`. The runtime still *reads* legacy `homeRange` for external files. The `homeRange→spawnBounds` formula is proven equivalent to the runtime conversion (`BoundsEquivalenceTests`, hr=0/1/3/7). - **Deleted:** `Projects/Server/Json/DynamicJson.cs`. Sparse export output matches the legacy `ToJson` (nullable DTO properties + `WhenWritingNull`). Binary world-save serialization is untouched. ## Tests - DTO round-trip per spawner type; sparse-default omission; legacy `homeRange` read; export/import file round-trip. - `Import_MalformedFile_LeaksNoWorldItems` — proves a mid-array parse failure constructs zero world Items. - `AllSpawnFilesLoadTests` — every migrated spawn file deserializes and builds. - Duplicate-discriminator validation. - UOContent.Tests 485/485, Server.Tests 710/710, build clean. ## Follow-up (not in this PR) `Rectangle3DConverter.Write` (in `Projects/Server/`) omits `z1/z2` when `Start.Z == -128`, so a future server-side export of a `homeRange`-style spawner round-trips depth 256→255. Pre-existing and out of scope here (Server change); the migrated data reads correctly. Worth a separate small converter PR.
366 lines
9.3 KiB
JSON
366 lines
9.3 KiB
JSON
[
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "1156d090-d270-4d2c-99b5-d9801dc4b411",
|
|
"name": "Spawner (304)",
|
|
"location": [1932, 196, -28],
|
|
"map": "Ilshenar",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 15,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "GolemController", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Golem", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "21934889-6573-468b-b7e9-40d090d3e9e3",
|
|
"name": "Spawner (304)",
|
|
"location": [1995, 67, -28],
|
|
"map": "Ilshenar",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "GolemController", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "224edb01-38bc-4e79-abee-c1754f857c1a",
|
|
"name": "Spawner (304)",
|
|
"location": [2063, 183, -28],
|
|
"map": "Ilshenar",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GargoyleEnforcer", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "2704244a-7822-45bf-bc70-120c145fc097",
|
|
"name": "Spawner (304)",
|
|
"location": [1979, 192, -28],
|
|
"map": "Ilshenar",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 15,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "ExodusOverseer", "maxCount": 2, "probability": 100 },
|
|
{ "name": "ExodusMinion", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "2cddb981-ac94-4967-9c20-2cc3de1a52c9",
|
|
"name": "Spawner (304)",
|
|
"location": [1980, 39, -28],
|
|
"map": "Ilshenar",
|
|
"count": 3,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "ExodusOverseer", "maxCount": 3, "probability": 100 },
|
|
{ "name": "ExodusMinion", "maxCount": 3, "probability": 100 },
|
|
{ "name": "GolemController", "maxCount": 3, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "35394aa1-6039-446f-b247-51d9f7926f6c",
|
|
"name": "Spawner (304)",
|
|
"location": [1894, 116, -28],
|
|
"map": "Ilshenar",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 20,
|
|
"walkingRange": 30,
|
|
"entries": [
|
|
{ "name": "GolemController", "maxCount": 2, "probability": 100 },
|
|
{ "name": "ExodusOverseer", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "3a54ee30-73d0-4f81-8889-ace39a951514",
|
|
"name": "Spawner (304)",
|
|
"location": [2032, 184, -28],
|
|
"map": "Ilshenar",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GargoyleEnforcer", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "412a318b-d693-413c-86e6-92996375f16e",
|
|
"name": "Spawner (304)",
|
|
"location": [1896, 72, -28],
|
|
"map": "Ilshenar",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GargoyleDestroyer", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "75b1d8fc-c98d-42c5-9445-12024a38f167",
|
|
"name": "Spawner (304)",
|
|
"location": [1895, 160, -28],
|
|
"map": "Ilshenar",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GargoyleDestroyer", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "8c609c03-ea54-4cb3-8e79-ae67bbe813a8",
|
|
"name": "Spawner (304)",
|
|
"location": [2044, 87, -28],
|
|
"map": "Ilshenar",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "ExodusMinion", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Golem", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "8e098781-936b-42cc-adfa-806111b9a9f2",
|
|
"name": "Spawner (304)",
|
|
"location": [1980, 116, -28],
|
|
"map": "Ilshenar",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 30,
|
|
"walkingRange": 40,
|
|
"entries": [
|
|
{ "name": "EnslavedGargoyle", "maxCount": 2, "probability": 100 },
|
|
{ "name": "GolemController", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "918f3735-8e70-42c3-a633-2fe03730f22d",
|
|
"name": "Spawner (304)",
|
|
"location": [1932, 164, -28],
|
|
"map": "Ilshenar",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GolemController", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "98c1814f-9347-402a-93aa-0d3fad5ca8e5",
|
|
"name": "Spawner (304)",
|
|
"location": [2071, 116, -28],
|
|
"map": "Ilshenar",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GolemController", "maxCount": 2, "probability": 100 },
|
|
{ "name": "ExodusOverseer", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "a2ff6be0-f521-42fa-8cda-0ca0436133d6",
|
|
"name": "Spawner (304)",
|
|
"location": [2044, 143, -28],
|
|
"map": "Ilshenar",
|
|
"count": 3,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GolemController", "maxCount": 3, "probability": 100 },
|
|
{ "name": "Golem", "maxCount": 3, "probability": 100 },
|
|
{ "name": "ExodusMinion", "maxCount": 3, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "a35646cf-0460-48d2-a4ea-5e9cc33ad9ab",
|
|
"name": "Spawner (304)",
|
|
"location": [1964, 164, -28],
|
|
"map": "Ilshenar",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GolemController", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "b44ae0e1-0a06-4385-b550-c72c58b6b41f",
|
|
"name": "Spawner (304)",
|
|
"location": [1931, 67, -28],
|
|
"map": "Ilshenar",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GolemController", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "c6d64523-ac82-4ad3-9f39-f2d80731a5a3",
|
|
"name": "Spawner (304)",
|
|
"location": [1932, 35, -28],
|
|
"map": "Ilshenar",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 15,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "GolemController", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Golem", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "d39e9374-f30b-488c-8a12-5f3a6315f391",
|
|
"name": "Spawner (304)",
|
|
"location": [1939, 116, -28],
|
|
"map": "Ilshenar",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 15,
|
|
"walkingRange": 25,
|
|
"entries": [
|
|
{ "name": "ExodusMinion", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "dddffe92-2c45-4677-9690-2e782e597530",
|
|
"name": "Spawner (304)",
|
|
"location": [2058, 163, -28],
|
|
"map": "Ilshenar",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GargoyleEnforcer", "maxCount": 2, "probability": 100 },
|
|
{ "name": "GargoyleDestroyer", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "e3d9b4cc-ec56-4fed-a26c-330d2bd4edac",
|
|
"name": "Spawner (304)",
|
|
"location": [2031, 48, -28],
|
|
"map": "Ilshenar",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GargoyleEnforcer", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "f226735c-6233-4aba-989b-d6f90cd48e2f",
|
|
"name": "Spawner (304)",
|
|
"location": [2038, 67, -28],
|
|
"map": "Ilshenar",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GargoyleDestroyer", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "f7bef168-af9c-4bc5-9928-348891d481c0",
|
|
"name": "Spawner (304)",
|
|
"location": [1996, 164, -28],
|
|
"map": "Ilshenar",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "GolemController", "maxCount": 1, "probability": 100 }
|
|
]
|
|
}
|
|
]
|