## 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": "07b03a23-af40-4539-be8b-6834573838df",
|
|
"name": "Spawner (202)",
|
|
"location": [6065, 1459, 5],
|
|
"map": "Felucca",
|
|
"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": "099f6832-75ef-4f46-91b2-0d64509897c2",
|
|
"name": "Spawner (202)",
|
|
"location": [6052, 1463, 0],
|
|
"map": "Felucca",
|
|
"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": "2fd77ead-e282-4216-aa6c-0273391bdd4e",
|
|
"name": "Spawner (202)",
|
|
"location": [6090, 1483, 0],
|
|
"map": "Felucca",
|
|
"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": "3237bbc2-29a2-488c-a918-d8db1f5e7f60",
|
|
"name": "Spawner (202)",
|
|
"location": [6087, 1443, 0],
|
|
"map": "Felucca",
|
|
"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": "371c3545-e908-4d18-8dbb-3b86c422566a",
|
|
"name": "Spawner (202)",
|
|
"location": [6112, 1462, 5],
|
|
"map": "Felucca",
|
|
"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": "5da0bc6b-dfdb-47b8-a0df-0ff3eaf5c212",
|
|
"name": "Spawner (202)",
|
|
"location": [6048, 1487, 5],
|
|
"map": "Felucca",
|
|
"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": "62ba5343-d337-495e-aaf4-9dfb4d46c8b3",
|
|
"name": "Spawner (202)",
|
|
"location": [6061, 1490, 5],
|
|
"map": "Felucca",
|
|
"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": "75adb4cb-b0a7-44db-a5fe-d4e9b139ce7b",
|
|
"name": "Spawner (202)",
|
|
"location": [6059, 1438, 4],
|
|
"map": "Felucca",
|
|
"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": "75e04bc3-078d-40c2-9ca8-d3a11a97965f",
|
|
"name": "Spawner (202)",
|
|
"location": [6108, 1471, 0],
|
|
"map": "Felucca",
|
|
"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": "77bf6da3-ca32-446e-8d0b-239bb4520afd",
|
|
"name": "Spawner (202)",
|
|
"location": [6037, 1494, 0],
|
|
"map": "Felucca",
|
|
"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": "8674d509-c36a-4ab8-9399-6329f1379984",
|
|
"name": "Spawner (202)",
|
|
"location": [6091, 1491, 10],
|
|
"map": "Felucca",
|
|
"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": "a8680e6d-12db-4ef9-8107-9df6850893db",
|
|
"name": "Spawner (202)",
|
|
"location": [6115, 1491, -15],
|
|
"map": "Felucca",
|
|
"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": "a9a6ccfe-d9b7-40f3-bfa8-d00994214056",
|
|
"name": "Spawner (202)",
|
|
"location": [6039, 1438, 4],
|
|
"map": "Felucca",
|
|
"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": "aca1fcd4-cc2b-4472-ab6e-89e0322f9fec",
|
|
"name": "Spawner (202)",
|
|
"location": [6049, 1447, 4],
|
|
"map": "Felucca",
|
|
"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": "b8273eff-be93-4ab9-8642-c1e9a92ddbbc",
|
|
"name": "Spawner (202)",
|
|
"location": [6092, 1448, 5],
|
|
"map": "Felucca",
|
|
"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": "ba6cecc1-f3c1-4e95-a624-ac4d5d668265",
|
|
"name": "Spawner (202)",
|
|
"location": [6034, 1467, 5],
|
|
"map": "Felucca",
|
|
"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": "c93d730a-8c5a-4580-8952-14008d80b395",
|
|
"name": "Spawner (202)",
|
|
"location": [6049, 1470, 5],
|
|
"map": "Felucca",
|
|
"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": "d0d1dbda-9b50-4646-9509-d5d32eb9f081",
|
|
"name": "Spawner (202)",
|
|
"location": [6041, 1486, 5],
|
|
"map": "Felucca",
|
|
"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": "da9f7dcc-c64d-4a72-ba8a-b5846258a093",
|
|
"name": "Spawner (202)",
|
|
"location": [6084, 1470, 5],
|
|
"map": "Felucca",
|
|
"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 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "e8b1dc3e-cc13-4253-b228-12abe499061b",
|
|
"name": "Spawner (202)",
|
|
"location": [6077, 1492, 0],
|
|
"map": "Felucca",
|
|
"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": "ebace9c4-5941-4346-9ebf-6ca7ff7e33c5",
|
|
"name": "Spawner (202)",
|
|
"location": [6107, 1452, 25],
|
|
"map": "Felucca",
|
|
"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 }
|
|
]
|
|
}
|
|
]
|