## 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.
286 lines
9.4 KiB
JSON
286 lines
9.4 KiB
JSON
[
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "02cf36b9-6188-4bda-9e7f-66d0aac930b8",
|
|
"name": "Spawner (115)",
|
|
"location": [6416, 447, -40],
|
|
"map": "Trammel",
|
|
"count": 15,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 20,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "PlagueBeast", "maxCount": 8, "probability": 100 },
|
|
{ "name": "PlagueSpawn", "maxCount": 8, "probability": 100 },
|
|
{ "name": "AcidElemental", "maxCount": 7, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 7, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "4b986151-c607-40ec-b8b2-3b8a09e1e828",
|
|
"name": "Spawner (115)",
|
|
"location": [6292, 462, -50],
|
|
"map": "Trammel",
|
|
"count": 18,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 40,
|
|
"walkingRange": 40,
|
|
"entries": [
|
|
{ "name": "ChaosDaemon", "maxCount": 7, "probability": 100 },
|
|
{ "name": "Moloch", "maxCount": 7, "probability": 100 },
|
|
{ "name": "Succubus", "maxCount": 7, "probability": 100 },
|
|
{ "name": "Daemon", "maxCount": 7, "probability": 100 },
|
|
{ "name": "Balron", "maxCount": 4, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "546847b9-bd52-4a7b-be03-bd9b9f26cb17",
|
|
"name": "Spawner (115)",
|
|
"location": [6249, 352, 60],
|
|
"map": "Trammel",
|
|
"count": 9,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 15,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "AcidElemental", "maxCount": 6, "probability": 100 },
|
|
{ "name": "EarthElemental", "maxCount": 6, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 6, "probability": 100 },
|
|
{ "name": "AcidElemental", "maxCount": 1, "probability": 100 },
|
|
{ "name": "EarthElemental", "maxCount": 1, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "676cc139-9378-4935-9667-0cbd86e0b2b1",
|
|
"name": "Spawner (115)",
|
|
"location": [6285, 353, 60],
|
|
"map": "Trammel",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 5,
|
|
"walkingRange": 5,
|
|
"entries": [
|
|
{ "name": "PoisonElemental", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "851856f8-49a9-4dfd-95bc-e969d748bd9c",
|
|
"name": "Spawner (115)",
|
|
"location": [6404, 378, -40],
|
|
"map": "Trammel",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 18,
|
|
"walkingRange": 18,
|
|
"entries": [
|
|
{ "name": "AcidElemental", "maxCount": 2, "probability": 100 },
|
|
{ "name": "PlagueSpawn", "maxCount": 2, "probability": 100 },
|
|
{ "name": "AcidElemental", "maxCount": 1, "probability": 100 },
|
|
{ "name": "PlagueSpawn", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "8bbbe927-ffbd-4f1c-aa89-4982088f1dca",
|
|
"name": "Spawner (115)",
|
|
"location": [6298, 395, 60],
|
|
"map": "Trammel",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 8,
|
|
"walkingRange": 8,
|
|
"entries": [
|
|
{ "name": "EarthElemental", "maxCount": 2, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "9599a1e0-f678-49f5-8ec6-c4f01998f96f",
|
|
"name": "Spawner (115)",
|
|
"location": [6295, 616, -50],
|
|
"map": "Trammel",
|
|
"count": 27,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 50,
|
|
"walkingRange": 50,
|
|
"entries": [
|
|
{ "name": "Daemon", "maxCount": 6, "probability": 100 },
|
|
{ "name": "Succubus", "maxCount": 6, "probability": 100 },
|
|
{ "name": "InterredGrizzle", "maxCount": 6, "probability": 100 },
|
|
{ "name": "PoisonElemental", "maxCount": 6, "probability": 100 },
|
|
{ "name": "PlagueBeast", "maxCount": 6, "probability": 100 },
|
|
{ "name": "PlagueSpawn", "maxCount": 6, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 3, "probability": 100 },
|
|
{ "name": "Putrefier", "maxCount": 3, "probability": 100 },
|
|
{ "name": "PlagueBeastLord", "maxCount": 3, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "ad7e7828-7b85-416c-8ca6-6a9e7de99d95",
|
|
"name": "Spawner (115)",
|
|
"location": [6319, 348, 60],
|
|
"map": "Trammel",
|
|
"count": 9,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 20,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "EarthElemental", "maxCount": 5, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 5, "probability": 100 },
|
|
{ "name": "AcidElemental", "maxCount": 5, "probability": 100 },
|
|
{ "name": "PlagueSpawn", "maxCount": 5, "probability": 100 },
|
|
{ "name": "EarthElemental", "maxCount": 1, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 1, "probability": 100 },
|
|
{ "name": "AcidElemental", "maxCount": 1, "probability": 100 },
|
|
{ "name": "PlagueSpawn", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "bae60d5d-cbc7-4fed-ae27-75eb68d79870",
|
|
"name": "Spawner (115)",
|
|
"location": [6384, 580, -50],
|
|
"map": "Trammel",
|
|
"count": 31,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 30,
|
|
"walkingRange": 30,
|
|
"entries": [
|
|
{ "name": "InterredGrizzle", "maxCount": 4, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 4, "probability": 100 },
|
|
{ "name": "PoisonElemental", "maxCount": 3, "probability": 100 },
|
|
{ "name": "Balron", "maxCount": 9, "probability": 100 },
|
|
{ "name": "Succubus", "maxCount": 9, "probability": 100 },
|
|
{ "name": "Daemon", "maxCount": 9, "probability": 100 },
|
|
{ "name": "PlagueBeastLord", "maxCount": 11, "probability": 100 },
|
|
{ "name": "PlagueBeast", "maxCount": 11, "probability": 100 },
|
|
{ "name": "PlagueSpawn", "maxCount": 11, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "c32b93fc-8549-4d80-8d8a-de99e885a477",
|
|
"name": "Spawner (115)",
|
|
"location": [6353, 400, 60],
|
|
"map": "Trammel",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "EarthElemental", "maxCount": 4, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 4, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "c3c0fc01-0e9e-420e-a994-ce64bc57a96e",
|
|
"name": "Spawner (115)",
|
|
"location": [6354, 455, -40],
|
|
"map": "Trammel",
|
|
"count": 10,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 20,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "PlagueBeast", "maxCount": 5, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 5, "probability": 100 },
|
|
{ "name": "PoisonElemental", "maxCount": 5, "probability": 100 },
|
|
{ "name": "PlagueSpawn", "maxCount": 5, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "c68cc7ec-9447-455e-ac60-ab1d1f319bc5",
|
|
"name": "Spawner (115)",
|
|
"location": [6466, 543, -50],
|
|
"map": "Trammel",
|
|
"count": 22,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 30,
|
|
"walkingRange": 30,
|
|
"entries": [
|
|
{ "name": "Balron", "maxCount": 6, "probability": 100 },
|
|
{ "name": "Succubus", "maxCount": 6, "probability": 100 },
|
|
{ "name": "Daemon", "maxCount": 6, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 3, "probability": 100 },
|
|
{ "name": "PlagueBeastLord", "maxCount": 8, "probability": 100 },
|
|
{ "name": "PlagueBeast", "maxCount": 8, "probability": 100 },
|
|
{ "name": "PlagueSpawn", "maxCount": 8, "probability": 100 },
|
|
{ "name": "InterredGrizzle", "maxCount": 5, "probability": 100 },
|
|
{ "name": "PoisonElemental", "maxCount": 5, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "cb00720f-c41e-413f-8cec-b90e2fe72b4a",
|
|
"name": "Spawner (115)",
|
|
"location": [6328, 517, -50],
|
|
"map": "Trammel",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "PoisonElemental", "maxCount": 4, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "dcc7984a-1911-4368-81df-344fa7b0a2b5",
|
|
"name": "Spawner (115)",
|
|
"location": [6418, 358, -40],
|
|
"map": "Trammel",
|
|
"count": 22,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 25,
|
|
"walkingRange": 25,
|
|
"entries": [
|
|
{ "name": "PlagueSpawn", "maxCount": 12, "probability": 100 },
|
|
{ "name": "PlagueBeast", "maxCount": 12, "probability": 100 },
|
|
{ "name": "AcidElemental", "maxCount": 12, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 12, "probability": 100 },
|
|
{ "name": "PoisonElemental", "maxCount": 12, "probability": 100 },
|
|
{ "name": "PlagueSpawn", "maxCount": 2, "probability": 100 },
|
|
{ "name": "PlagueBeast", "maxCount": 2, "probability": 100 },
|
|
{ "name": "AcidElemental", "maxCount": 2, "probability": 100 },
|
|
{ "name": "CorrosiveSlime", "maxCount": 2, "probability": 100 },
|
|
{ "name": "PoisonElemental", "maxCount": 2, "probability": 100 }
|
|
]
|
|
}
|
|
]
|