## 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.
347 lines
8.6 KiB
JSON
347 lines
8.6 KiB
JSON
[
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "3ccfb405-2b18-4397-9d18-5b37302d62e4",
|
|
"name": "Spawner (216)",
|
|
"location": [6521, 139, -20],
|
|
"map": "Felucca",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 4,
|
|
"entries": [
|
|
{ "name": "Wisp", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "49f09e2e-fb04-42a9-96e2-d930c04f729f",
|
|
"name": "Spawner (216)",
|
|
"location": [6530, 139, -20],
|
|
"map": "Felucca",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 4,
|
|
"entries": [
|
|
{ "name": "Wisp", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "4e01097c-b1f4-4d22-ad9b-dcd117eeaeec",
|
|
"name": "Spawner (216)",
|
|
"location": [6566, 120, 0],
|
|
"map": "Felucca",
|
|
"count": 7,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 15,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "CrystalVortex", "maxCount": 7, "probability": 100 },
|
|
{ "name": "IceElemental", "maxCount": 7, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "50809274-807a-49ee-b9f9-6c13693a56d0",
|
|
"name": "Spawner (216)",
|
|
"location": [6572, 89, 0],
|
|
"map": "Felucca",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 4,
|
|
"entries": [
|
|
{ "name": "CrystalHydra", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "539ddfd6-d1ad-4e3f-b9cf-414a6dc0553a",
|
|
"name": "Spawner (216)",
|
|
"location": [6509, 176, 0],
|
|
"map": "Felucca",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 4,
|
|
"entries": [
|
|
{ "name": "UnfrozenMummy", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "6912561a-5610-4441-8c64-16f4bd9f73f8",
|
|
"name": "Spawner (216)",
|
|
"location": [6510, 171, 0],
|
|
"map": "Felucca",
|
|
"count": 3,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 8,
|
|
"walkingRange": 8,
|
|
"entries": [
|
|
{ "name": "Protector", "maxCount": 3, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "84ae0146-70ef-44e4-9159-db9a045c14c9",
|
|
"name": "Spawner (216)",
|
|
"location": [6536, 79, -10],
|
|
"map": "Felucca",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 4,
|
|
"entries": [
|
|
{ "name": "CrystalDaemon", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "8f88efe1-68b8-478e-8166-b03984e956e1",
|
|
"name": "Spawner (216)",
|
|
"location": [6504, 181, 0],
|
|
"map": "Felucca",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 1,
|
|
"walkingRange": 1,
|
|
"entries": [
|
|
{ "name": "TreasureChestLevel4", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "8fe6c0c3-9fcb-4725-b6b2-ee89df036d80",
|
|
"name": "Spawner (216)",
|
|
"location": [6532, 79, -10],
|
|
"map": "Felucca",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 4,
|
|
"entries": [
|
|
{ "name": "CrystalDaemon", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "93922052-811a-473e-b3b2-eddf5380829a",
|
|
"name": "Spawner (216)",
|
|
"location": [6475, 101, -44],
|
|
"map": "Felucca",
|
|
"count": 5,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 5,
|
|
"walkingRange": 5,
|
|
"entries": [
|
|
{ "name": "ShadowWisp", "maxCount": 5, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "9c7afc30-19c5-4034-a344-8b75e52b6b40",
|
|
"name": "Spawner (216)",
|
|
"location": [6547, 91, -10],
|
|
"map": "Felucca",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 4,
|
|
"entries": [
|
|
{ "name": "CrystalDaemon", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "9ce6b636-4bca-44d7-adf2-5ef841d08a61",
|
|
"name": "Spawner (216)",
|
|
"location": [6535, 179, 0],
|
|
"map": "Felucca",
|
|
"count": 6,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 15,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "CrystalWisp", "maxCount": 5, "probability": 100 },
|
|
{ "name": "CrystalLatticeSeeker", "maxCount": 5, "probability": 100 },
|
|
{ "name": "TreasureChestLevel2", "maxCount": 5, "probability": 100 },
|
|
{ "name": "TreasureChestLevel2", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "9dc74009-4df1-4872-874f-fcc908ec105b",
|
|
"name": "Spawner (216)",
|
|
"location": [6534, 178, 0],
|
|
"map": "Felucca",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 4,
|
|
"entries": [
|
|
{ "name": "CrystalWisp", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "adf86a17-213e-408b-be55-3cb37b9a1a36",
|
|
"name": "Spawner (216)",
|
|
"location": [6502, 120, -10],
|
|
"map": "Felucca",
|
|
"count": 1,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 0,
|
|
"walkingRange": 0,
|
|
"entries": [
|
|
{ "name": "TreasureChestLevel3", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "b87b2fe5-b1dc-46b1-9c35-f1627c33ad04",
|
|
"name": "Spawner (216)",
|
|
"location": [6553, 157, 0],
|
|
"map": "Felucca",
|
|
"count": 3,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 8,
|
|
"walkingRange": 8,
|
|
"entries": [
|
|
{ "name": "CrystalLatticeSeeker", "maxCount": 3, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "c04125c7-bad1-4747-8e55-7664e9797a6d",
|
|
"name": "Spawner (216)",
|
|
"location": [6474, 74, -34],
|
|
"map": "Felucca",
|
|
"count": 9,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 4,
|
|
"entries": [
|
|
{ "name": "Rat", "maxCount": 9, "probability": 100 },
|
|
{ "name": "IceSnake", "maxCount": 9, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "c66d4bde-6308-44bb-80fe-f6f0070beda7",
|
|
"name": "Spawner (216)",
|
|
"location": [6478, 174, 4],
|
|
"map": "Felucca",
|
|
"count": 6,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 10,
|
|
"walkingRange": 10,
|
|
"entries": [
|
|
{ "name": "Wisp", "maxCount": 6, "probability": 100 },
|
|
{ "name": "CrystalWisp", "maxCount": 6, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "e82c7115-8675-4d30-b321-c5e6a3b43ea0",
|
|
"name": "Spawner (216)",
|
|
"location": [6507, 151, 0],
|
|
"map": "Felucca",
|
|
"count": 3,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 5,
|
|
"walkingRange": 5,
|
|
"entries": [
|
|
{ "name": "Protector", "maxCount": 3, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "ed613a4e-b19f-422e-943c-c94a29411ff8",
|
|
"name": "Spawner (216)",
|
|
"location": [6578, 183, 31],
|
|
"map": "Felucca",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 5,
|
|
"walkingRange": 5,
|
|
"entries": [
|
|
{ "name": "Ferret", "maxCount": 2, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "f083b3bb-c6c8-4774-a9d7-65d6b2cfc831",
|
|
"name": "Spawner (216)",
|
|
"location": [6552, 155, 0],
|
|
"map": "Felucca",
|
|
"count": 6,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 15,
|
|
"walkingRange": 15,
|
|
"entries": [
|
|
{ "name": "Wisp", "maxCount": 5, "probability": 100 },
|
|
{ "name": "CrystalWisp", "maxCount": 5, "probability": 100 },
|
|
{ "name": "TreasureChestLevel2", "maxCount": 5, "probability": 100 },
|
|
{ "name": "TreasureChestLevel2", "maxCount": 1, "probability": 100 }
|
|
]
|
|
},
|
|
{
|
|
"$type": "Spawner",
|
|
"guid": "f620b501-c242-4301-a813-b4d7a44e141f",
|
|
"name": "Spawner (216)",
|
|
"location": [6576, 91, 0],
|
|
"map": "Felucca",
|
|
"count": 2,
|
|
"minDelay": "00:05:00",
|
|
"maxDelay": "00:10:00",
|
|
"team": 0,
|
|
"homeRange": 4,
|
|
"walkingRange": 4,
|
|
"entries": [
|
|
{ "name": "CrystalSeaSerpent", "maxCount": 2, "probability": 100 }
|
|
]
|
|
}
|
|
]
|