## 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.
368 lines
9.8 KiB
JSON
368 lines
9.8 KiB
JSON
[
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "16798caa-188d-4b2d-8494-c3b56cbaa4c7",
|
|
"name": "Spawner (102)",
|
|
"location": [6049, 1470, 5],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "1fb937a2-b8d8-4796-8f7e-62dc86db4541",
|
|
"name": "Spawner (102)",
|
|
"location": [6052, 1463, 0],
|
|
"map": "Trammel",
|
|
"count": 8,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 5,
|
|
"walkingRange": 25,
|
|
"entries": [
|
|
{ "name": "Alligator", "maxCount": 8, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "2059e438-3ea0-4553-9d80-2c4b3e179956",
|
|
"name": "Spawner (102)",
|
|
"location": [6092, 1448, 5],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "308b2558-7402-46d1-a300-11eb22feaf0b",
|
|
"name": "Spawner (102)",
|
|
"location": [6049, 1447, 4],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "31142c48-f400-4b04-a235-4df3d184432a",
|
|
"name": "Spawner (102)",
|
|
"location": [6115, 1491, -15],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "424591d5-810a-4248-b002-51d2d993b09e",
|
|
"name": "Spawner (102)",
|
|
"location": [6108, 1471, 0],
|
|
"map": "Trammel",
|
|
"count": 2,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "Alligator", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "4502169a-d510-4779-a2d4-7ecff61c32a1",
|
|
"name": "Spawner (102)",
|
|
"location": [6091, 1491, 10],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "551ba232-804a-48e2-a289-048ac2c5952c",
|
|
"name": "Spawner (102)",
|
|
"location": [6087, 1443, 0],
|
|
"map": "Trammel",
|
|
"count": 2,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "Alligator", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "5873288f-b3d0-4ffc-b937-1a938b0ab0a3",
|
|
"name": "Spawner (102)",
|
|
"location": [6039, 1438, 4],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "5e47e277-8d43-46c0-b43a-a15ce3623ceb",
|
|
"name": "Spawner (102)",
|
|
"location": [6112, 1462, 5],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "639f6230-75e9-4633-8e2b-cfd6f35f4fdc",
|
|
"name": "Spawner (102)",
|
|
"location": [6077, 1492, 0],
|
|
"map": "Trammel",
|
|
"count": 2,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "Alligator", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "70842ac5-c2f9-490b-8fca-603396002f94",
|
|
"name": "Spawner (102)",
|
|
"location": [6048, 1487, 5],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "73483117-862e-472d-b856-13fbe0f2cb04",
|
|
"name": "Spawner (102)",
|
|
"location": [6065, 1459, 5],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "80883952-a77b-466d-b01e-f810fca42c11",
|
|
"name": "Spawner (102)",
|
|
"location": [6090, 1483, 0],
|
|
"map": "Trammel",
|
|
"count": 8,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 5,
|
|
"walkingRange": 25,
|
|
"entries": [
|
|
{ "name": "Alligator", "maxCount": 8, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "82cbfa7a-4ea4-476b-ac8c-a3963746fffd",
|
|
"name": "Spawner (102)",
|
|
"location": [6061, 1490, 5],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "bda24adb-c409-4c12-a0c0-8aacd36ab3d9",
|
|
"name": "Spawner (102)",
|
|
"location": [6034, 1467, 5],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "cb41f5b8-add1-42be-8bbe-48b76f9a4dd9",
|
|
"name": "Spawner (102)",
|
|
"location": [6107, 1452, 25],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "dd1b022d-98d5-4f06-aac1-7751d2416304",
|
|
"name": "Spawner (102)",
|
|
"location": [6059, 1438, 4],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "e40a3f76-4701-425c-a806-06cb36504593",
|
|
"name": "Spawner (102)",
|
|
"location": [6037, 1494, 0],
|
|
"map": "Trammel",
|
|
"count": 2,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "Alligator", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "e5f0bff7-c610-4923-8c17-b32a00911628",
|
|
"name": "Spawner (102)",
|
|
"location": [6041, 1486, 5],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 2,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "ed8f2188-17cd-4235-86d8-54d62209ef93",
|
|
"name": "Spawner (102)",
|
|
"location": [6084, 1470, 5],
|
|
"map": "Trammel",
|
|
"count": 3,
|
|
"minDelay": "00:00:00",
|
|
"maxDelay": "00:01:00",
|
|
"team": 0,
|
|
"homeRange": 1,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "SewerRat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Rat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "BullFrog", "maxCount": 1, "probability": 100 }
|
|
]
|
|
}
|
|
]
|