## 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.
364 lines
9.6 KiB
JSON
364 lines
9.6 KiB
JSON
[
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "005c0fd4-1893-489e-9a09-14c53b246567",
|
|
"name": "Spawner (501)",
|
|
"location": [96, 540, -1],
|
|
"map": "Malas",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 15,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "FanDancer", "maxCount": 1, "probability": 100 },
|
|
{ "name": "Ronin", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "016a082b-0696-40c3-815b-c3dbef373d50",
|
|
"name": "Spawner (501)",
|
|
"location": [173, 615, -1],
|
|
"map": "Malas",
|
|
"count": 8,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 20,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "HordeMinion", "maxCount": 2, "probability": 100 },
|
|
{ "name": "FanDancer", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Oni", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Daemon", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "06d87817-7b93-45c4-9696-35c26ca4218d",
|
|
"name": "Spawner (501)",
|
|
"location": [120, 415, -1],
|
|
"map": "Malas",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "HordeMinion", "maxCount": 2, "probability": 100 },
|
|
{ "name": "HeadlessOne", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "12d3edf5-87f3-4fb4-9ca5-8462b94a81d8",
|
|
"name": "Spawner (501)",
|
|
"location": [134, 651, -1],
|
|
"map": "Malas",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 5,
|
|
"walkingRange": 5,
|
|
"entries": [
|
|
{ "name": "FanDancer", "maxCount": 2, "probability": 100 },
|
|
{ "name": "HellHound", "maxCount": 1, "probability": 100 },
|
|
{ "name": "HellCat", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "183ea3fc-7ed8-4f54-bd05-513be50f48d6",
|
|
"name": "Spawner (501)",
|
|
"location": [79, 521, -1],
|
|
"map": "Malas",
|
|
"count": 3,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 5,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "HeadlessOne", "maxCount": 3, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "1a384aa9-3d4c-4df7-82df-58e658f4bf5f",
|
|
"name": "Spawner (501)",
|
|
"location": [147, 646, -1],
|
|
"map": "Malas",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 5,
|
|
"walkingRange": 5,
|
|
"entries": [
|
|
{ "name": "HeadlessOne", "maxCount": 2, "probability": 100 },
|
|
{ "name": "FanDancer", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "24b2ba02-2289-4cb3-a957-e3ec7629c0b1",
|
|
"name": "Spawner (501)",
|
|
"location": [64, 488, -1],
|
|
"map": "Malas",
|
|
"count": 6,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 20,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "Daemon", "maxCount": 2, "probability": 100 },
|
|
{ "name": "HeadlessOne", "maxCount": 2, "probability": 100 },
|
|
{ "name": "HordeMinion", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "42b06210-4cd3-49d6-a5d1-74e5ab0cc77a",
|
|
"name": "Spawner (501)",
|
|
"location": [977, 218, 23],
|
|
"map": "Tokuno",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 15,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "FanDancer", "maxCount": 4, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "47256f4f-b709-4c19-866b-2d7bdd896fd6",
|
|
"name": "Spawner (501)",
|
|
"location": [78, 546, -1],
|
|
"map": "Malas",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 15,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "Daemon", "maxCount": 1, "probability": 100 },
|
|
{ "name": "HellHound", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Succubus", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "477ff85e-e7ac-4a85-a99f-75d1b3e9eb74",
|
|
"name": "Spawner (501)",
|
|
"location": [110, 649, -1],
|
|
"map": "Malas",
|
|
"count": 3,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "FanDancer", "maxCount": 1, "probability": 100 },
|
|
{ "name": "HellCat", "maxCount": 1, "probability": 100 },
|
|
{ "name": "Balron", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "4849d20d-77fc-4f0d-a513-a352a5849467",
|
|
"name": "Spawner (501)",
|
|
"location": [123, 387, -1],
|
|
"map": "Malas",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "HeadlessOne", "maxCount": 4, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "624d9055-be69-4b42-9aa8-f8876a6c3cbf",
|
|
"name": "Spawner (501)",
|
|
"location": [88, 332, -1],
|
|
"map": "Malas",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 20,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "FanDancer", "maxCount": 4, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "66d98c69-5788-471a-b93c-d82e252471b2",
|
|
"name": "Spawner (501)",
|
|
"location": [110, 540, -1],
|
|
"map": "Malas",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 15,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "Daemon", "maxCount": 1, "probability": 100 },
|
|
{ "name": "HellHound", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Succubus", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "752b7dfa-4f8c-4bb6-875e-2f18385881b5",
|
|
"name": "Spawner (501)",
|
|
"location": [111, 352, -1],
|
|
"map": "Malas",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "HordeMinion", "maxCount": 2, "probability": 100 },
|
|
{ "name": "HeadlessOne", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "9a661087-c1ec-4503-9451-8873a8c24bd9",
|
|
"name": "Spawner (501)",
|
|
"location": [175, 660, -1],
|
|
"map": "Malas",
|
|
"count": 6,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 20,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "HordeMinion", "maxCount": 3, "probability": 100 },
|
|
{ "name": "HellCat", "maxCount": 2, "probability": 100 },
|
|
{ "name": "Balron", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "a4392a5c-8729-40c2-bd31-4b145cba2f1a",
|
|
"name": "Spawner (501)",
|
|
"location": [106, 685, -1],
|
|
"map": "Malas",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 20,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "HellHound", "maxCount": 1, "probability": 100 },
|
|
{ "name": "Succubus", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "bd077bc0-b36c-41b4-9e4c-e3f067d6846e",
|
|
"name": "Spawner (501)",
|
|
"location": [99, 387, -1],
|
|
"map": "Malas",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "HeadlessOne", "maxCount": 4, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "cdd374da-1e88-4389-ac42-a6c63ba30d0b",
|
|
"name": "Spawner (501)",
|
|
"location": [97, 467, -1],
|
|
"map": "Malas",
|
|
"count": 4,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 20,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "HordeMinion", "maxCount": 2, "probability": 100 },
|
|
{ "name": "HeadlessOne", "maxCount": 1, "probability": 100 },
|
|
{ "name": "Succubus", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "e3fd2f65-4f1e-4af5-8cab-26493d9c5350",
|
|
"name": "Spawner (501)",
|
|
"location": [142, 692, -1],
|
|
"map": "Malas",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 20,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "FanDancer", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "f093fd90-d7b6-48a7-b5f3-c2524f4ca2ca",
|
|
"name": "Spawner (501)",
|
|
"location": [100, 499, -1],
|
|
"map": "Malas",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 20,
|
|
"walkingRange": 20,
|
|
"entries": [
|
|
{ "name": "Daemon", "maxCount": 1, "probability": 100 },
|
|
{ "name": "HeadlessOne", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "f3743807-ec35-485a-82b5-f3cd3ba27bc0",
|
|
"name": "Spawner (501)",
|
|
"location": [70, 376, -1],
|
|
"map": "Malas",
|
|
"count": 10,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 25,
|
|
"walkingRange": 30,
|
|
"entries": [
|
|
{ "name": "FanDancer", "maxCount": 3, "probability": 100 },
|
|
{ "name": "HeadlessOne", "maxCount": 3, "probability": 100 },
|
|
{ "name": "HordeMinion", "maxCount": 3, "probability": 100 },
|
|
{ "name": "Daemon", "maxCount": 1, "probability": 100 }
|
|
]
|
|
}
|
|
]
|