From 0a9bfb055814609816d54160b2f280d7e5be009d Mon Sep 17 00:00:00 2001
From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com>
Date: Fri, 19 May 2023 16:39:40 -0700
Subject: [PATCH] fix: Drastically simplifies regions (#1400)
### Summary
- [X] Gets rid of the Dtos
- [X] Simplifies the json serializer registration
- [X] Adds a custom `RegionByName` JsonConverter that can look up other regions that have already been registered.
### BREAKING CHANGE
1. **Child regions must appear after their parents in the JSON file**
2. In the regions json file, _"Parent"_ can no longer be just a string. It must be an object that includes the map.
- ```json
"Parent": { "Name": "Britain", "Map": "Felucca" }
```
---
Distribution/Data/regions.json | 228 +++++++++---------
.../Json/Converters/RegionByNameConverter.cs | 85 +++++++
.../RegionByNameConverterFactory.cs | 28 +++
Projects/Server/Regions/Region.cs | 12 +-
Projects/Server/Regions/RegionJsonDto.cs | 67 -----
.../Server/Regions/RegionJsonSerializer.cs | 80 ++----
Projects/UOContent/Regions/AcidRiverRegion.cs | 9 +-
.../UOContent/Regions/ApprenticeRegion.cs | 9 +-
Projects/UOContent/Regions/BaseRegion.cs | 2 +
Projects/UOContent/Regions/BattleRegion.cs | 9 +-
.../Regions/BlackthornCastleRegion.cs | 5 +-
.../Regions/BlackthornDungeonRegion.cs | 9 +-
.../Regions/CousteauPerronHouseRegion.cs | 2 +
.../UOContent/Regions/CrystalFieldRegion.cs | 9 +-
.../UOContent/Regions/DoomGuardianRegion.cs | 9 +-
Projects/UOContent/Regions/DungeonRegion.cs | 7 +
.../UOContent/Regions/ExodusDungeonRegion.cs | 9 +-
.../Regions/ExploringDeepCreaturesRegion.cs | 9 +-
.../UOContent/Regions/GreenAcresRegion.cs | 6 +
Projects/UOContent/Regions/GuardedRegion.cs | 2 +
Projects/UOContent/Regions/IcyRiverRegion.cs | 9 +-
Projects/UOContent/Regions/JailRegion.cs | 6 +
.../Regions/JsonDtos/BaseRegionJsonDto.cs | 29 ---
.../Regions/JsonDtos/DungeonRegionJsonDto.cs | 26 --
.../Regions/JsonDtos/GenericRegionJsonDto.cs | 34 ---
.../Regions/JsonDtos/GuardedRegionJsonDto.cs | 30 ---
.../Regions/JsonDtos/RegionJsonDtoExt.cs | 63 -----
.../Regions/JsonDtos/TownRegionJsonDto.cs | 26 --
.../Regions/LostCityEntranceRegion.cs | 9 +-
Projects/UOContent/Regions/MondainRegion.cs | 7 +
.../UOContent/Regions/NewMaginciaRegion.cs | 7 +
.../Regions/NoHousingGuardedRegion.cs | 2 +
Projects/UOContent/Regions/NoHousingRegion.cs | 8 +-
.../Regions/NoTravelSpellsAllowedRegion.cs | 6 +
.../UOContent/Regions/PoisonedTreeRegion.cs | 9 +-
.../Regions/PolisonedCemeteryRegion.cs | 9 +-
.../Regions/RegionJsonRegistration.cs | 63 +++++
Projects/UOContent/Regions/SeaMarketRegion.cs | 9 +-
Projects/UOContent/Regions/ToKBridgeRegion.cs | 9 +-
.../UOContent/Regions/TokunoDocksRegion.cs | 2 +
.../UOContent/Regions/TombOfKingsRegion.cs | 9 +-
Projects/UOContent/Regions/TownRegion.cs | 9 +-
.../Regions/TwistedWealdDesertRegion.cs | 6 +
.../UOContent/Regions/UnderwaterRegion.cs | 9 +-
Projects/UOContent/Regions/WrongJailRegion.cs | 9 +-
.../UOContent/Regions/WrongLevel3Region.cs | 9 +-
version.json | 2 +-
47 files changed, 542 insertions(+), 470 deletions(-)
create mode 100644 Projects/Server/Json/Converters/RegionByNameConverter.cs
create mode 100644 Projects/Server/Json/Converters/RegionByNameConverterFactory.cs
delete mode 100644 Projects/Server/Regions/RegionJsonDto.cs
delete mode 100644 Projects/UOContent/Regions/JsonDtos/BaseRegionJsonDto.cs
delete mode 100644 Projects/UOContent/Regions/JsonDtos/DungeonRegionJsonDto.cs
delete mode 100644 Projects/UOContent/Regions/JsonDtos/GenericRegionJsonDto.cs
delete mode 100644 Projects/UOContent/Regions/JsonDtos/GuardedRegionJsonDto.cs
delete mode 100644 Projects/UOContent/Regions/JsonDtos/RegionJsonDtoExt.cs
delete mode 100644 Projects/UOContent/Regions/JsonDtos/TownRegionJsonDto.cs
create mode 100644 Projects/UOContent/Regions/RegionJsonRegistration.cs
diff --git a/Distribution/Data/regions.json b/Distribution/Data/regions.json
index 862097d69..757397b20 100644
--- a/Distribution/Data/regions.json
+++ b/Distribution/Data/regions.json
@@ -134,7 +134,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 1492, "y1": 1602, "z1": 0, "x2": 1500, "y2": 1621, "z2": 128},
@@ -155,7 +155,7 @@
{
"$type": "TownRegion",
"Map": "Felucca",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Felucca" },
"Name": "A Wheatfield in Britain 1",
"Priority": 50,
"Area": [{"x1": 1120, "y1": 1776, "x2": 1152, "y2": 1808}],
@@ -164,7 +164,7 @@
{
"$type": "TownRegion",
"Map": "Felucca",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Felucca" },
"Name": "A Wheatfield in Britain 2",
"Priority": 50,
"Area": [{"x1": 1184, "y1": 1808, "x2": 1216, "y2": 1840}],
@@ -173,7 +173,7 @@
{
"$type": "TownRegion",
"Map": "Felucca",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Felucca" },
"Name": "A Wheatfield in Britain 3",
"Priority": 50,
"Area": [{"x1": 1216, "y1": 1872, "x2": 1248, "y2": 1904}],
@@ -182,7 +182,7 @@
{
"$type": "TownRegion",
"Map": "Felucca",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Felucca" },
"Name": "A Carrot Field in Britain 1",
"Priority": 50,
"Area": [{"x1": 1208, "y1": 1712, "x2": 1224, "y2": 1736}],
@@ -191,7 +191,7 @@
{
"$type": "TownRegion",
"Map": "Felucca",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Felucca" },
"Name": "An Onion Field in Britain 1",
"Priority": 50,
"Area": [{"x1": 1224, "y1": 1712, "x2": 1240, "y2": 1736}],
@@ -200,7 +200,7 @@
{
"$type": "TownRegion",
"Map": "Felucca",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Felucca" },
"Name": "A Cabbage Field in Britain 1",
"Priority": 50,
"Area": [{"x1": 1176, "y1": 1672, "x2": 1192, "y2": 1695}],
@@ -209,7 +209,7 @@
{
"$type": "TownRegion",
"Map": "Felucca",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Felucca" },
"Name": "A Turnip Field in Britain 1",
"Priority": 50,
"Area": [{"x1": 1192, "y1": 1672, "x2": 1208, "y2": 1696}],
@@ -218,7 +218,7 @@
{
"$type": "TownRegion",
"Map": "Felucca",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Felucca" },
"Name": "A Wheatfield in Britain 4",
"Priority": 50,
"Area": [{"x1": 1104, "y1": 1608, "x2": 1136, "y2": 1640}],
@@ -227,7 +227,7 @@
{
"$type": "TownRegion",
"Map": "Felucca",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Felucca" },
"Name": "A Wheatfield in Britain 5",
"Priority": 50,
"Area": [{"x1": 1136, "y1": 1560, "x2": 1168, "y2": 1592}],
@@ -236,7 +236,7 @@
{
"$type": "TownRegion",
"Map": "Felucca",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Felucca" },
"Name": "A Turnip Field in Britain 2",
"Priority": 50,
"Area": [{"x1": 1208, "y1": 1592, "x2": 1224, "y2": 1616}],
@@ -245,7 +245,7 @@
{
"$type": "TownRegion",
"Map": "Felucca",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Felucca" },
"Name": "A Carrot Field in Britain 2",
"Priority": 50,
"Area": [{"x1": 1224, "y1": 1592, "x2": 1240, "y2": 1616}],
@@ -275,7 +275,7 @@
{
"$type": "TownRegion",
"Map": "Felucca",
- "Parent": "Jhelom Islands",
+ "Parent": { "Name": "Jhelom Islands", "Map": "Felucca" },
"Name": "Jhelom",
"Priority": 50,
"Area": [
@@ -289,7 +289,7 @@
"$type": "NoHousingRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Jhelom",
+ "Parent": { "Name": "Jhelom", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 1352, "y1": 3800, "z1": -20, "x2": 1368, "y2": 3832, "z2": 128},
@@ -317,7 +317,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Minoc",
+ "Parent": { "Name": "Minoc", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 2457, "y1": 397, "x2": 2497, "y2": 405},
@@ -347,7 +347,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Ocllo",
+ "Parent": { "Name": "Ocllo", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 3664, "y1": 2608, "x2": 3680, "y2": 2624},
@@ -375,7 +375,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Trinsic",
+ "Parent": { "Name": "Trinsic", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 1834, "y1": 2728, "x2": 1856, "y2": 2744},
@@ -404,7 +404,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Vesper",
+ "Parent": { "Name": "Vesper", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 2952, "y1": 864, "x2": 2968, "y2": 896},
@@ -435,7 +435,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Yew",
+ "Parent": { "Name": "Yew", "Map": "Felucca" },
"Priority": 50,
"Area": [{"x1": 600, "y1": 808, "z1": 0, "x2": 624, "y2": 832, "z2": 39}]
},
@@ -443,7 +443,7 @@
"$type": "TownRegion",
"RuneName": "A Field of Sheep in Yew",
"Map": "Felucca",
- "Parent": "Yew",
+ "Parent": { "Name": "Yew", "Map": "Felucca" },
"Name": "A Field of Sheep in Yew 1",
"Priority": 50,
"Area": [{"x1": 664, "y1": 928, "x2": 686, "y2": 950}],
@@ -453,7 +453,7 @@
"$type": "TownRegion",
"RuneName": "A Field of Sheep in Yew",
"Map": "Felucca",
- "Parent": "Yew",
+ "Parent": { "Name": "Yew", "Map": "Felucca" },
"Name": "A Field of Sheep in Yew 2",
"Priority": 50,
"Area": [{"x1": 664, "y1": 1168, "x2": 686, "y2": 1190}],
@@ -463,7 +463,7 @@
"$type": "TownRegion",
"RuneName": "A Farm in Yew",
"Map": "Felucca",
- "Parent": "Yew",
+ "Parent": { "Name": "Yew", "Map": "Felucca" },
"Name": "A Farm in Yew",
"Priority": 50,
"Area": [{"x1": 560, "y1": 1088, "x2": 582, "y2": 1110}],
@@ -473,7 +473,7 @@
"$type": "TownRegion",
"RuneName": "A Wheatfield in Yew",
"Map": "Felucca",
- "Parent": "Yew",
+ "Parent": { "Name": "Yew", "Map": "Felucca" },
"Name": "A Wheatfield in Yew 1",
"Priority": 50,
"Area": [{"x1": 560, "y1": 1232, "x2": 576, "y2": 1248}],
@@ -483,7 +483,7 @@
"$type": "TownRegion",
"RuneName": "A Wheatfield in Yew",
"Map": "Felucca",
- "Parent": "Yew",
+ "Parent": { "Name": "Yew", "Map": "Felucca" },
"Name": "A Wheatfield in Yew 2",
"Priority": 50,
"Area": [{"x1": 368, "y1": 1176, "x2": 382, "y2": 1208}],
@@ -514,7 +514,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Wind",
+ "Parent": { "Name": "Wind", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 5159, "y1": 15, "x2": 5184, "y2": 24},
@@ -541,7 +541,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Serpent's Hold",
+ "Parent": { "Name": "Serpent's Hold", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 2960, "y1": 3400, "z1": 0, "x2": 2976, "y2": 3416, "z2": 128},
@@ -562,7 +562,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Skara Brae",
+ "Parent": { "Name": "Skara Brae", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 600, "y1": 2232, "x2": 616, "y2": 2256},
@@ -587,7 +587,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Nujel'm",
+ "Parent": { "Name": "Nujel'm", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 3736, "y1": 1184, "z1": 0, "x2": 3752, "y2": 1207, "z2": 128},
@@ -643,7 +643,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Moonglow",
+ "Parent": { "Name": "Moonglow", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 4384, "y1": 1152, "z1": 0, "x2": 4392, "y2": 1176, "z2": 128},
@@ -673,7 +673,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Magincia",
+ "Parent": { "Name": "Magincia", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 3680, "y1": 2152, "x2": 3704, "y2": 2160},
@@ -696,7 +696,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Buccaneer's Den",
+ "Parent": { "Name": "Buccaneer's Den", "Map": "Felucca" },
"Priority": 50,
"Area": [
{"x1": 2712, "y1": 2080, "x2": 2728, "y2": 2096},
@@ -1031,7 +1031,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Delucia",
+ "Parent": { "Name": "Delucia", "Map": "Felucca" },
"Priority": 50,
"Area": [{"x1": 5194, "y1": 4053, "x2": 5204, "y2": 4073}]
},
@@ -1050,7 +1050,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Felucca",
- "Parent": "Papua",
+ "Parent": { "Name": "Papua", "Map": "Felucca" },
"Priority": 50,
"Area": [{"x1": 5757, "y1": 3150, "x2": 5781, "y2": 3174}]
},
@@ -1304,7 +1304,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Trammel" },
"Priority": 50,
"Area": [
{"x1": 1492, "y1": 1602, "z1": 0, "x2": 1500, "y2": 1621, "z2": 128},
@@ -1325,7 +1325,7 @@
{
"$type": "TownRegion",
"Map": "Trammel",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Trammel" },
"Name": "A Wheatfield in Britain 1",
"Priority": 50,
"Area": [{"x1": 1120, "y1": 1776, "x2": 1152, "y2": 1808}],
@@ -1334,7 +1334,7 @@
{
"$type": "TownRegion",
"Map": "Trammel",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Trammel" },
"Name": "A Wheatfield in Britain 2",
"Priority": 50,
"Area": [{"x1": 1184, "y1": 1808, "x2": 1216, "y2": 1840}],
@@ -1343,7 +1343,7 @@
{
"$type": "TownRegion",
"Map": "Trammel",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Trammel" },
"Name": "A Wheatfield in Britain 3",
"Priority": 50,
"Area": [{"x1": 1216, "y1": 1872, "x2": 1248, "y2": 1904}],
@@ -1352,7 +1352,7 @@
{
"$type": "TownRegion",
"Map": "Trammel",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Trammel" },
"Name": "A Carrot Field in Britain 1",
"Priority": 50,
"Area": [{"x1": 1208, "y1": 1712, "x2": 1224, "y2": 1736}],
@@ -1361,7 +1361,7 @@
{
"$type": "TownRegion",
"Map": "Trammel",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Trammel" },
"Name": "An Onion Field in Britain 1",
"Priority": 50,
"Area": [{"x1": 1224, "y1": 1712, "x2": 1240, "y2": 1736}],
@@ -1370,7 +1370,7 @@
{
"$type": "TownRegion",
"Map": "Trammel",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Trammel" },
"Name": "A Cabbage Field in Britain 1",
"Priority": 50,
"Area": [{"x1": 1176, "y1": 1672, "x2": 1192, "y2": 1695}],
@@ -1379,7 +1379,7 @@
{
"$type": "TownRegion",
"Map": "Trammel",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Trammel" },
"Name": "A Turnip Field in Britain 1",
"Priority": 50,
"Area": [{"x1": 1192, "y1": 1672, "x2": 1208, "y2": 1696}],
@@ -1388,7 +1388,7 @@
{
"$type": "TownRegion",
"Map": "Trammel",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Trammel" },
"Name": "A Wheatfield in Britain 4",
"Priority": 50,
"Area": [{"x1": 1104, "y1": 1608, "x2": 1136, "y2": 1640}],
@@ -1397,7 +1397,7 @@
{
"$type": "TownRegion",
"Map": "Trammel",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Trammel" },
"Name": "A Wheatfield in Britain 5",
"Priority": 50,
"Area": [{"x1": 1136, "y1": 1560, "x2": 1168, "y2": 1592}],
@@ -1406,7 +1406,7 @@
{
"$type": "TownRegion",
"Map": "Trammel",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Trammel" },
"Name": "A Turnip Field in Britain 2",
"Priority": 50,
"Area": [{"x1": 1208, "y1": 1592, "x2": 1224, "y2": 1616}],
@@ -1415,7 +1415,7 @@
{
"$type": "TownRegion",
"Map": "Trammel",
- "Parent": "Britain",
+ "Parent": { "Name": "Britain", "Map": "Trammel" },
"Name": "A Carrot Field in Britain 2",
"Priority": 50,
"Area": [{"x1": 1224, "y1": 1592, "x2": 1240, "y2": 1616}],
@@ -1445,7 +1445,7 @@
{
"$type": "TownRegion",
"Map": "Trammel",
- "Parent": "Jhelom Islands",
+ "Parent": { "Name": "Jhelom Islands", "Map": "Trammel" },
"Name": "Jhelom",
"Priority": 50,
"Area": [
@@ -1459,7 +1459,7 @@
"$type": "NoHousingRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Jhelom",
+ "Parent": { "Name": "Jhelom", "Map": "Trammel" },
"Priority": 50,
"Area": [
{"x1": 1352, "y1": 3800, "z1": -20, "x2": 1368, "y2": 3832, "z2": 128},
@@ -1487,7 +1487,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Minoc",
+ "Parent": { "Name": "Minoc", "Map": "Trammel" },
"Priority": 50,
"Area": [
{"x1": 2457, "y1": 397, "x2": 2497, "y2": 405},
@@ -1506,7 +1506,7 @@
{
"$type": "GuardedRegion",
"Map": "Trammel",
- "Parent": "Haven Island",
+ "Parent": { "Name": "Haven Island", "Map": "Trammel" },
"Name": "New Haven Moongate",
"Priority": 50,
"Area": [{"x1": 3446, "y1": 2674, "x2": 3456, "y2": 2684}]
@@ -1516,7 +1516,7 @@
"RuneName": "New Haven",
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "Haven Island",
+ "Parent": { "Name": "Haven Island", "Map": "Trammel" },
"Name": "New Haven",
"Priority": 50,
"Area": [{"x1": 3416, "y1": 2480, "x2": 3545, "y2": 2648}],
@@ -1528,7 +1528,7 @@
"RuneName": "The Little Shop of Alchemy in New Haven",
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "New Haven",
+ "Parent": { "Name": "New Haven", "Map": "Trammel" },
"Name": "the New Haven Alchemist",
"Priority": 50,
"Area": [{"x1": 3457, "y1": 2563, "x2": 3466, "y2": 2572}]
@@ -1538,7 +1538,7 @@
"RuneName": "the Bardic Guild in New Haven",
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "New Haven",
+ "Parent": { "Name": "New Haven", "Map": "Trammel" },
"Name": "the New Haven Bard",
"Priority": 50,
"Area": [
@@ -1552,7 +1552,7 @@
"RuneName": "the Warrior Guild Hall in New Haven",
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "New Haven",
+ "Parent": { "Name": "New Haven", "Map": "Trammel" },
"Name": "Warrior's Guild Hall",
"Priority": 50,
"Area": [
@@ -1564,7 +1564,7 @@
"$type": "NoHousingRegion",
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "Warrior's Guild Hall",
+ "Parent": { "Name": "Warrior's Guild Hall", "Map": "Trammel" },
"Name": "the New Haven Warrior",
"Priority": 50,
"Area": [
@@ -1576,7 +1576,7 @@
"$type": "NoHousingRegion",
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "Warrior's Guild Hall",
+ "Parent": { "Name": "Warrior's Guild Hall", "Map": "Trammel" },
"Name": "the New Haven Bowyer",
"Priority": 50,
"Area": [{"x1": 3529, "y1": 2531, "x2": 3541, "y2": 2550}]
@@ -1586,7 +1586,7 @@
"RuneName": "A Stitch In Time in New Haven",
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "New Haven",
+ "Parent": { "Name": "New Haven", "Map": "Trammel" },
"Name": "the New Haven Tailor",
"Priority": 50,
"Area": [
@@ -1599,7 +1599,7 @@
"RuneName": "Carpenters of New Haven",
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "New Haven",
+ "Parent": { "Name": "New Haven", "Map": "Trammel" },
"Name": "the New Haven Carpenter",
"Priority": 50,
"Area": [
@@ -1612,7 +1612,7 @@
"RuneName": "Mapmakers of New Haven",
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "New Haven",
+ "Parent": { "Name": "New Haven", "Map": "Trammel" },
"Name": "the New Haven Mapmaker",
"Priority": 50,
"Area": [{"x1": 3490, "y1": 2588, "x2": 3497, "y2": 2595}]
@@ -1622,7 +1622,7 @@
"RuneName": "New Haven Magery School",
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "New Haven",
+ "Parent": { "Name": "New Haven", "Map": "Trammel" },
"Name": "the New Haven Mage",
"Priority": 50,
"Area": [{"x1": 3464, "y1": 2488, "x2": 3491, "y2": 2504}]
@@ -1633,7 +1633,7 @@
"NoLogoutDelay": true,
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "New Haven",
+ "Parent": { "Name": "New Haven", "Map": "Trammel" },
"Name": "the New Haven Inn",
"Priority": 50,
"Area": [
@@ -1646,7 +1646,7 @@
"RuneName": "the docks in New Haven",
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "New Haven",
+ "Parent": { "Name": "New Haven", "Map": "Trammel" },
"Name": "the New Haven Docks",
"Priority": 50,
"Area": [
@@ -1660,7 +1660,7 @@
"RuneName": "the First Bank of New Haven",
"MinExpansion": "ML",
"Map": "Trammel",
- "Parent": "New Haven",
+ "Parent": { "Name": "New Haven", "Map": "Trammel" },
"Name": "the New Haven Bank",
"Priority": 50,
"Area": [{"x1": 3479, "y1": 2565, "x2": 3492, "y2": 2580}]
@@ -1670,7 +1670,7 @@
"RuneName": "Haven City",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven Island",
+ "Parent": { "Name": "Haven Island", "Map": "Trammel" },
"Name": "Haven",
"Priority": 50,
"Area": [
@@ -1687,7 +1687,7 @@
"RuneName": "the Woodsman in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "the Woodsman in Haven",
"Priority": 50,
"Area": [
@@ -1700,7 +1700,7 @@
"RuneName": "the Prime Cut Butcher Shop in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "the Prime Cut Butcher Shop in Haven",
"Priority": 50,
"Area": [{"x1": 3704, "y1": 2648, "x2": 3720, "y2": 2656}]
@@ -1710,7 +1710,7 @@
"RuneName": "a farm in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Priority": 50,
"Area": [{"x1": 3728, "y1": 2632, "x2": 3736, "y2": 2640}]
},
@@ -1719,7 +1719,7 @@
"RuneName": "a farm in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Priority": 50,
"Area": [{"x1": 3704, "y1": 2584, "x2": 3712, "y2": 2592}]
},
@@ -1728,7 +1728,7 @@
"RuneName": "a farm in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Priority": 50,
"Area": [{"x1": 3736, "y1": 2561, "x2": 3744, "y2": 2568}]
},
@@ -1737,7 +1737,7 @@
"RuneName": "Mapmakers of Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "Mapmakers of Haven",
"Priority": 50,
"Area": [{"x1": 3624, "y1": 2632, "x2": 3640, "y2": 2640}]
@@ -1747,7 +1747,7 @@
"RuneName": "The Haven Blacksmith",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "The Haven Blacksmith",
"Priority": 50,
"Area": [{"x1": 3641, "y1": 2613, "x2": 3646, "y2": 2624}]
@@ -1757,7 +1757,7 @@
"RuneName": "the Second Bank of Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "the Second Bank of Haven",
"Priority": 50,
"Area": [
@@ -1770,7 +1770,7 @@
"RuneName": "Uzeraan's Mansion",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "Uzeraan's Mansion",
"Priority": 50,
"Area": [
@@ -1784,7 +1784,7 @@
"$type": "NoHousingRegion",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Uzeraan's Mansion",
+ "Parent": { "Name": "Uzeraan's Mansion", "Map": "Trammel" },
"Priority": 50,
"Area": [
{"x1": 3592, "y1": 2595, "x2": 3612, "y2": 2599},
@@ -1797,7 +1797,7 @@
"RuneName": "Last Chance Provisioners in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "Last Chance Provisioners in Haven",
"Priority": 50,
"Area": [
@@ -1810,7 +1810,7 @@
"RuneName": "the Healers of Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "the Healers of Haven",
"Priority": 50,
"Area": [
@@ -1826,7 +1826,7 @@
"RuneName": "The Little Shop of Magic in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "The Little Shop of Magic in Haven",
"Priority": 50,
"Area": [
@@ -1840,7 +1840,7 @@
"RuneName": "The Shakin' Bakery in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "The Shakin' Bakery in Haven",
"Priority": 50,
"Area": [
@@ -1854,7 +1854,7 @@
"RuneName": "the Bardic Guild in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "the Bardic Guild in Haven",
"Priority": 50,
"Area": [
@@ -1867,7 +1867,7 @@
"RuneName": "Carpenters of Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "Carpenters of Haven",
"Priority": 50,
"Area": [
@@ -1880,7 +1880,7 @@
"RuneName": "Haven Clockworks and Tinker Shop",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "Haven Clockworks and Tinker Shop",
"Priority": 50,
"Area": [
@@ -1893,7 +1893,7 @@
"RuneName": "The Haven Thieves' Guild",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "The Haven Thieves' Guild",
"Priority": 50,
"Area": [
@@ -1906,7 +1906,7 @@
"RuneName": "A Stitch in Time in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "A Stitch in Time in Haven",
"Priority": 50,
"Area": [
@@ -1919,7 +1919,7 @@
"RuneName": "the Haven Public Library",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "the Haven Public Library",
"Priority": 50,
"Area": [
@@ -1933,7 +1933,7 @@
"NoLogoutDelay": true,
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "The Gentle Rest Inn in New Haven",
"Priority": 50,
"Area": [
@@ -1947,7 +1947,7 @@
"NoLogoutDelay": true,
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "The Albatross Bar and Grill in Haven",
"Priority": 50,
"Area": [
@@ -1961,7 +1961,7 @@
"RuneName": "the Proving Grounds in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "the Proving Grounds in Haven",
"Priority": 50,
"Area": [
@@ -1974,7 +1974,7 @@
"RuneName": "the Bullseye Marksmen in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "the Bullseye Marksmen in Haven",
"Priority": 50,
"Area": [{"x1": 3742, "y1": 2575, "x2": 3750, "y2": 2586}]
@@ -1984,7 +1984,7 @@
"RuneName": "the docks in Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "the docks in Haven",
"Priority": 50,
"Area": [
@@ -1998,7 +1998,7 @@
"RuneName": "the Mystic Mines of Haven",
"MaxExpansion": "SE",
"Map": "Trammel",
- "Parent": "Haven",
+ "Parent": { "Name": "Haven", "Map": "Trammel" },
"Name": "the Mystic Mines of Haven",
"Priority": 50,
"Area": [{"x1": 3752, "y1": 2698, "x2": 3757, "y2": 2707}]
@@ -2023,7 +2023,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Trinsic",
+ "Parent": { "Name": "Trinsic", "Map": "Trammel" },
"Priority": 50,
"Area": [
{"x1": 1834, "y1": 2728, "x2": 1856, "y2": 2744},
@@ -2052,7 +2052,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Vesper",
+ "Parent": { "Name": "Vesper", "Map": "Trammel" },
"Priority": 50,
"Area": [
{"x1": 2952, "y1": 864, "x2": 2968, "y2": 896},
@@ -2083,7 +2083,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Yew",
+ "Parent": { "Name": "Yew", "Map": "Trammel" },
"Priority": 50,
"Area": [{"x1": 600, "y1": 808, "z1": 0, "x2": 624, "y2": 832, "z2": 39}]
},
@@ -2091,7 +2091,7 @@
"$type": "TownRegion",
"RuneName": "A Field of Sheep in Yew",
"Map": "Trammel",
- "Parent": "Yew",
+ "Parent": { "Name": "Yew", "Map": "Trammel" },
"Name": "A Field of Sheep in Yew 1",
"Priority": 50,
"Area": [{"x1": 664, "y1": 928, "x2": 686, "y2": 950}],
@@ -2101,7 +2101,7 @@
"$type": "TownRegion",
"RuneName": "A Field of Sheep in Yew",
"Map": "Trammel",
- "Parent": "Yew",
+ "Parent": { "Name": "Yew", "Map": "Trammel" },
"Name": "A Field of Sheep in Yew 2",
"Priority": 50,
"Area": [{"x1": 664, "y1": 1168, "x2": 686, "y2": 1190}],
@@ -2111,7 +2111,7 @@
"$type": "TownRegion",
"RuneName": "A Farm in Yew",
"Map": "Trammel",
- "Parent": "Yew",
+ "Parent": { "Name": "Yew", "Map": "Trammel" },
"Name": "A Farm in Yew",
"Priority": 50,
"Area": [{"x1": 560, "y1": 1088, "x2": 582, "y2": 1110}],
@@ -2121,7 +2121,7 @@
"$type": "TownRegion",
"RuneName": "A Wheatfield in Yew",
"Map": "Trammel",
- "Parent": "Yew",
+ "Parent": { "Name": "Yew", "Map": "Trammel" },
"Name": "A Wheatfield in Yew 1",
"Priority": 50,
"Area": [{"x1": 560, "y1": 1232, "x2": 576, "y2": 1248}],
@@ -2131,7 +2131,7 @@
"$type": "TownRegion",
"RuneName": "A Wheatfield in Yew",
"Map": "Trammel",
- "Parent": "Yew",
+ "Parent": { "Name": "Yew", "Map": "Trammel" },
"Name": "A Wheatfield in Yew 2",
"Priority": 50,
"Area": [{"x1": 368, "y1": 1176, "x2": 382, "y2": 1208}],
@@ -2162,7 +2162,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Wind",
+ "Parent": { "Name": "Wind", "Map": "Trammel" },
"Priority": 50,
"Area": [
{"x1": 5159, "y1": 15, "x2": 5184, "y2": 24},
@@ -2189,7 +2189,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Serpent's Hold",
+ "Parent": { "Name": "Serpent's Hold", "Map": "Trammel" },
"Priority": 50,
"Area": [
{"x1": 2960, "y1": 3400, "z1": 0, "x2": 2976, "y2": 3416, "z2": 128},
@@ -2210,7 +2210,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Skara Brae",
+ "Parent": { "Name": "Skara Brae", "Map": "Trammel" },
"Priority": 50,
"Area": [
{"x1": 600, "y1": 2232, "x2": 616, "y2": 2256},
@@ -2235,7 +2235,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Nujel'm",
+ "Parent": { "Name": "Nujel'm", "Map": "Trammel" },
"Priority": 50,
"Area": [
{"x1": 3736, "y1": 1184, "z1": 0, "x2": 3752, "y2": 1207, "z2": 128},
@@ -2291,7 +2291,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Moonglow",
+ "Parent": { "Name": "Moonglow", "Map": "Trammel" },
"Name": "The Scholar's Inn",
"Priority": 50,
"Area": [
@@ -2322,7 +2322,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Magincia",
+ "Parent": { "Name": "Magincia", "Map": "Trammel" },
"Priority": 50,
"Area": [
{"x1": 3680, "y1": 2152, "x2": 3704, "y2": 2160},
@@ -2345,7 +2345,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Buccaneer's Den",
+ "Parent": { "Name": "Buccaneer's Den", "Map": "Trammel" },
"Priority": 50,
"Area": [
{"x1": 2712, "y1": 2080, "x2": 2728, "y2": 2096},
@@ -2670,7 +2670,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Delucia",
+ "Parent": { "Name": "Delucia", "Map": "Trammel" },
"Priority": 50,
"Area": [{"x1": 5194, "y1": 4053, "x2": 5204, "y2": 4073}]
},
@@ -2689,7 +2689,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Trammel",
- "Parent": "Papua",
+ "Parent": { "Name": "Papua", "Map": "Trammel" },
"Priority": 50,
"Area": [{"x1": 5757, "y1": 3150, "x2": 5781, "y2": 3174}]
},
@@ -2927,7 +2927,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Ilshenar",
- "Parent": "Gargoyle City",
+ "Parent": { "Name": "Gargoyle City", "Map": "Ilshenar" },
"Priority": 50,
"Area": [{"x1": 827, "y1": 694, "x2": 853, "y2": 727}]
},
@@ -3089,7 +3089,7 @@
"$type": "BaseRegion",
"NoLogoutDelay": true,
"Map": "Ilshenar",
- "Parent": "Twin Oaks",
+ "Parent": { "Name": "Twin Oaks", "Map": "Ilshenar" },
"Priority": 48,
"Area": [{"x1": 1546, "y1": 1037, "x2": 1567, "y2": 1057}]
},
@@ -3209,7 +3209,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Ilshenar",
- "Parent": "Mistas",
+ "Parent": { "Name": "Mistas", "Map": "Ilshenar" },
"Priority": 48,
"Area": [{"x1": 752, "y1": 1131, "x2": 768, "y2": 1152}]
},
@@ -3369,7 +3369,7 @@
"$type": "BaseRegion",
"NoLogoutDelay": true,
"Map": "Ilshenar",
- "Parent": "Gypsy Camp 2",
+ "Parent": { "Name": "Gypsy Camp 2", "Map": "Ilshenar" },
"Priority": 48,
"Area": [{"x1": 1617, "y1": 546, "x2": 1629, "y2": 554}]
},
@@ -3462,7 +3462,7 @@
"$type": "BaseRegion",
"NoLogoutDelay": true,
"Map": "Ilshenar",
- "Parent": "Vinculum Inn",
+ "Parent": { "Name": "Vinculum Inn", "Map": "Ilshenar" },
"Priority": 50,
"Area": [{"x1": 658, "y1": 654, "x2": 671, "y2": 678}]
},
@@ -3507,7 +3507,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Malas",
- "Parent": "Luna",
+ "Parent": { "Name": "Luna", "Map": "Malas" },
"Priority": 50,
"Area": [{"x1": 986, "y1": 509, "x2": 1004, "y2": 530}]
},
@@ -3527,7 +3527,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Malas",
- "Parent": "Umbra",
+ "Parent": { "Name": "Umbra", "Map": "Malas" },
"Priority": 50,
"Area": [{"x1": 2031, "y1": 1311, "x2": 2046, "y2": 1325}]
},
@@ -3680,7 +3680,7 @@
"$type": "TownRegion",
"NoLogoutDelay": true,
"Map": "Tokuno",
- "Parent": "Zento",
+ "Parent": { "Name": "Zento", "Map": "Tokuno" },
"Priority": 50,
"Area": [{"x1": 674, "y1": 1203, "x2": 699, "y2": 1219}]
},
diff --git a/Projects/Server/Json/Converters/RegionByNameConverter.cs b/Projects/Server/Json/Converters/RegionByNameConverter.cs
new file mode 100644
index 000000000..df0209c47
--- /dev/null
+++ b/Projects/Server/Json/Converters/RegionByNameConverter.cs
@@ -0,0 +1,85 @@
+/*************************************************************************
+ * ModernUO *
+ * Copyright 2019-2023 - ModernUO Development Team *
+ * Email: hi@modernuo.com *
+ * File: RegionByNameConverter.cs *
+ * *
+ * This program is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ *************************************************************************/
+
+using System;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace Server.Json;
+
+public class RegionByNameConverter : JsonConverter
+{
+ public override Region Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+ {
+ string name = null;
+ Map map = null;
+
+ if (reader.TokenType != JsonTokenType.StartObject)
+ {
+ throw new JsonException("Invalid json for RegionByName");
+ }
+
+ while (true)
+ {
+ reader.Read();
+ if (reader.TokenType == JsonTokenType.EndObject)
+ {
+ break;
+ }
+
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Invalid json for RegionByName");
+ }
+
+ string property = reader.GetString()?.ToLower();
+
+ if (property != "name" && property != "map")
+ {
+ continue;
+ }
+
+ reader.Read();
+ if (reader.TokenType != JsonTokenType.String)
+ {
+ throw new JsonException($"Value for {property} must be a string");
+ }
+
+ if (property == "name")
+ {
+ name = reader.GetString();
+ }
+ else
+ {
+ map = Map.Parse(reader.GetString());
+ }
+ }
+
+ if (name == null || map == null)
+ {
+ throw new JsonException("Invalid json for RegionByName");
+ }
+
+ return Region.Find(name, map);
+ }
+
+ public override void Write(Utf8JsonWriter writer, Region value, JsonSerializerOptions options)
+ {
+ writer.WriteStartObject();
+ writer.WriteString("Name", value.Name);
+ writer.WriteString("Map", value.Map.Name);
+ writer.WriteEndObject();
+ }
+}
diff --git a/Projects/Server/Json/Converters/RegionByNameConverterFactory.cs b/Projects/Server/Json/Converters/RegionByNameConverterFactory.cs
new file mode 100644
index 000000000..15faa0e14
--- /dev/null
+++ b/Projects/Server/Json/Converters/RegionByNameConverterFactory.cs
@@ -0,0 +1,28 @@
+/*************************************************************************
+ * ModernUO *
+ * Copyright 2019-2023 - ModernUO Development Team *
+ * Email: hi@modernuo.com *
+ * File: RegionByNameConverterFactory.cs *
+ * *
+ * This program is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ *************************************************************************/
+
+using System;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace Server.Json;
+
+public class RegionByNameConverterFactory : JsonConverterFactory
+{
+ public override bool CanConvert(Type typeToConvert) => typeToConvert == typeof(Region);
+
+ public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) =>
+ new RegionByNameConverter();
+}
diff --git a/Projects/Server/Regions/Region.cs b/Projects/Server/Regions/Region.cs
index e7c90d76b..15524dddc 100644
--- a/Projects/Server/Regions/Region.cs
+++ b/Projects/Server/Regions/Region.cs
@@ -1,5 +1,8 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Text.Json.Serialization;
+using Server.Json;
using Server.Logging;
using Server.Network;
using Server.Targeting;
@@ -136,6 +139,7 @@ public class Region : IComparable
{
}
+ [JsonConstructor] // Don't include parent, since it is special
public Region(string name, Map map, int priority, params Rectangle3D[] area) : this(name, map, null, area) =>
Priority = priority;
@@ -173,10 +177,10 @@ public class Region : IComparable
}
// Used during deserialization only
- public Expansion MinExpansion { get; set; }
+ public Expansion MinExpansion { get; set; } = Expansion.None;
// Used during deserialization only
- public Expansion MaxExpansion { get; set; }
+ public Expansion MaxExpansion { get; set; } = Expansion.EJ;
public static List Regions { get; } = new();
@@ -188,7 +192,9 @@ public class Region : IComparable
public Map Map { get; }
- public Region Parent { get; }
+ [JsonInclude]
+ [JsonConverter(typeof(RegionByNameConverter))]
+ public Region Parent { get; private set; }
public List Children { get; } = new();
diff --git a/Projects/Server/Regions/RegionJsonDto.cs b/Projects/Server/Regions/RegionJsonDto.cs
deleted file mode 100644
index b546ee6ce..000000000
--- a/Projects/Server/Regions/RegionJsonDto.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-/*************************************************************************
- * ModernUO *
- * Copyright 2019-2022 - ModernUO Development Team *
- * Email: hi@modernuo.com *
- * File: RegionJsonDto.cs *
- * *
- * This program is free software: you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation, either version 3 of the License, or *
- * (at your option) any later version. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see . *
- *************************************************************************/
-
-using System;
-using System.Text.Json.Serialization;
-using Server.Utilities;
-
-namespace Server;
-
-public class RegionJsonDto
-{
- public Expansion MinExpansion { get; set; } = Expansion.None;
-
- public Expansion? MaxExpansion { get; set; } = Expansion.EJ;
-
- [JsonIgnore]
- public virtual Type RegionType => typeof(Region);
-
- public Map Map { get; set; }
- public string? Parent { get; set; }
- public string Name { get; set; }
- public int? Priority { get; set; }
- public Rectangle3D[] Area { get; set; }
- public Point3D GoLocation { get; set; }
- public MusicName? Music { get; set; }
-
- public virtual void FromRegion(Region region)
- {
- Map = region.Map;
- Parent = region.Parent?.Name;
- Name = region.Name;
- Priority = region.Priority;
- Area = region.Area;
- GoLocation = region.GoLocation;
- Music = region.Music != MusicName.Invalid && region.Music != region.DefaultMusic ? region.Music : null;
- MaxExpansion = region.MaxExpansion == Expansion.EJ ? null : region.MaxExpansion;
- MinExpansion = region.MinExpansion;
- }
-
- public Region ToRegion()
- {
- var region = Priority != null
- ? RegionType.CreateInstance(Name, Map, Region.Find(Parent, Map), Priority, Area)
- : RegionType.CreateInstance(Name, Map, Region.Find(Parent, Map), Area);
-
- HydrateRegion(region);
- return region;
- }
-
- protected virtual void HydrateRegion(Region region)
- {
- region.GoLocation = GoLocation;
- region.Music = Music ?? region.DefaultMusic;
- }
-}
diff --git a/Projects/Server/Regions/RegionJsonSerializer.cs b/Projects/Server/Regions/RegionJsonSerializer.cs
index 755631ddd..ae311ee7c 100644
--- a/Projects/Server/Regions/RegionJsonSerializer.cs
+++ b/Projects/Server/Regions/RegionJsonSerializer.cs
@@ -22,7 +22,6 @@ using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Metadata;
using Server.Json;
using Server.Logging;
-using Server.Utilities;
namespace Server;
@@ -30,10 +29,7 @@ public static class RegionJsonSerializer
{
private static readonly ILogger logger = LogFactory.GetLogger(typeof(RegionJsonSerializer));
- // Note: This is filled during the `Configure` phase by RegisterRegionForSerialization,
- // so it is not available to a JsonConverter which might be used during earlier phases.
- private static Dictionary _regionToDtoLookup = new() { { typeof(Region), typeof(RegionJsonDto) } };
- private static JsonDerivedType[] _derivedTypes = { new(typeof(RegionJsonDto), nameof(Region)) };
+ private static JsonDerivedType[] _derivedTypes = { new(typeof(Region), nameof(Region)) };
private static JsonSerializerOptions _options = new(JsonConfig.DefaultOptions)
{
@@ -44,7 +40,7 @@ public static class RegionJsonSerializer
{
static typeInfo =>
{
- if (typeInfo.Type != typeof(RegionJsonDto))
+ if (typeInfo.Type != typeof(Region))
{
return;
}
@@ -55,26 +51,39 @@ public static class RegionJsonSerializer
typeInfo.PolymorphismOptions.DerivedTypes.Add(_derivedTypes[i]);
}
},
+ static typeInfo =>
+ {
+ if (!typeInfo.Type.IsAssignableTo(typeof(Region)))
+ {
+ return;
+ }
+
+ typeInfo.OnDeserialized = o =>
+ {
+ if (o is Region region && Core.Expansion >= region.MinExpansion && Core.Expansion <= region.MaxExpansion)
+ {
+ region.Register();
+ }
+ };
+ }
}
}
};
- public static void Register()
- where TDto : RegionJsonDto, new() where TRegion : Region
+ public static void Register() where TRegion : Region
{
for (var i = 0; i < _derivedTypes.Length; i++)
{
- if (_derivedTypes[i].DerivedType == typeof(TDto))
+ if (_derivedTypes[i].DerivedType == typeof(TRegion))
{
throw new Exception(
- $"Type '{typeof(TDto)}' has already been registered for serialization with the region loader."
+ $"Type '{typeof(TRegion)}' has already been registered for serialization with the region loader."
);
}
}
Array.Resize(ref _derivedTypes, _derivedTypes.Length + 1);
- _derivedTypes[^1] = new JsonDerivedType(typeof(TDto), typeof(TRegion).Name);
- _regionToDtoLookup[typeof(TRegion)] = typeof(TDto);
+ _derivedTypes[^1] = new JsonDerivedType(typeof(TRegion), typeof(TRegion).Name);
}
internal static void LoadRegions()
@@ -85,19 +94,17 @@ public static class RegionJsonSerializer
var stopwatch = Stopwatch.StartNew();
- var regions = JsonConfig.Deserialize>(path, _options);
+ var regions = JsonConfig.Deserialize>(path, _options);
if (regions == null)
{
throw new JsonException($"Failed to deserialize {path}.");
}
var count = 0;
- foreach (var dto in regions)
+ foreach (var region in regions)
{
- if (Core.Expansion >= dto.MinExpansion && Core.Expansion <= dto.MaxExpansion)
+ if (Core.Expansion >= region.MinExpansion && Core.Expansion <= region.MaxExpansion)
{
- var region = dto.ToRegion();
- region.Register();
count++;
}
}
@@ -111,43 +118,4 @@ public static class RegionJsonSerializer
stopwatch.Elapsed.TotalSeconds
);
}
-
- // Note: This is not thread safe. To make `SerializeRegions` threadsafe, use `[ThreadStatic]` or just create the lists
- // in the function and take the GC hit.
- private static List _regionJsonDtos;
-
- public static void SerializeRegions(string path, IEnumerable regions)
- {
- _regionJsonDtos ??= new List();
- foreach (var region in regions)
- {
- if (_regionToDtoLookup.TryGetValue(region.GetType(), out var dtoType))
- {
- var dto = dtoType.CreateInstance();
- dto.FromRegion(region);
- _regionJsonDtos.Add(dto);
- }
- }
-
- JsonConfig.Serialize(path, _regionJsonDtos, _options);
- _regionJsonDtos.Clear();
- }
-
- public static string SerializeRegions(IEnumerable regions)
- {
- _regionJsonDtos ??= new List();
- foreach (var region in regions)
- {
- if (_regionToDtoLookup.TryGetValue(region.GetType(), out var dtoType))
- {
- var dto = dtoType.CreateInstance();
- dto.FromRegion(region);
- _regionJsonDtos.Add(dto);
- }
- }
-
- var output = JsonConfig.Serialize(_regionJsonDtos, _options);
- _regionJsonDtos.Clear();
- return output;
- }
}
diff --git a/Projects/UOContent/Regions/AcidRiverRegion.cs b/Projects/UOContent/Regions/AcidRiverRegion.cs
index 4c9a27a2a..5f9799660 100644
--- a/Projects/UOContent/Regions/AcidRiverRegion.cs
+++ b/Projects/UOContent/Regions/AcidRiverRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement damage boost regions
public class AcidRiverRegion : MondainRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public AcidRiverRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public AcidRiverRegion(string name, Map map, Region parent, params Rectangle3D[] area): base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/ApprenticeRegion.cs b/Projects/UOContent/Regions/ApprenticeRegion.cs
index 670590934..475f847a0 100644
--- a/Projects/UOContent/Regions/ApprenticeRegion.cs
+++ b/Projects/UOContent/Regions/ApprenticeRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement
public class ApprenticeRegion : BaseRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public ApprenticeRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public ApprenticeRegion(string name, Map map, Region parent, int priority, params Rectangle3D[] area) : base(name, map, parent, priority, area)
{
}
diff --git a/Projects/UOContent/Regions/BaseRegion.cs b/Projects/UOContent/Regions/BaseRegion.cs
index ce450bd66..e0e4e615f 100644
--- a/Projects/UOContent/Regions/BaseRegion.cs
+++ b/Projects/UOContent/Regions/BaseRegion.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Text.Json.Serialization;
using Server.Gumps;
using Server.Mobiles;
using Server.Spells;
@@ -15,6 +16,7 @@ public class BaseRegion : Region
{
}
+ [JsonConstructor] // Don't include parent, since it is special
public BaseRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
{
}
diff --git a/Projects/UOContent/Regions/BattleRegion.cs b/Projects/UOContent/Regions/BattleRegion.cs
index 7380c84af..230ec2d5d 100644
--- a/Projects/UOContent/Regions/BattleRegion.cs
+++ b/Projects/UOContent/Regions/BattleRegion.cs
@@ -1,7 +1,14 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
public class BattleRegion : DungeonRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public BattleRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public BattleRegion(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/BlackthornCastleRegion.cs b/Projects/UOContent/Regions/BlackthornCastleRegion.cs
index 305de0003..1d3256228 100644
--- a/Projects/UOContent/Regions/BlackthornCastleRegion.cs
+++ b/Projects/UOContent/Regions/BlackthornCastleRegion.cs
@@ -1,8 +1,11 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement
public class BlackthornCastleRegion : GuardedRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
public BlackthornCastleRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
{
}
diff --git a/Projects/UOContent/Regions/BlackthornDungeonRegion.cs b/Projects/UOContent/Regions/BlackthornDungeonRegion.cs
index 55aa1911f..cd84b855c 100644
--- a/Projects/UOContent/Regions/BlackthornDungeonRegion.cs
+++ b/Projects/UOContent/Regions/BlackthornDungeonRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement
public class BlackthornDungeonRegion : DungeonRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public BlackthornDungeonRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public BlackthornDungeonRegion(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/CousteauPerronHouseRegion.cs b/Projects/UOContent/Regions/CousteauPerronHouseRegion.cs
index 1130e9d18..bec68cefb 100644
--- a/Projects/UOContent/Regions/CousteauPerronHouseRegion.cs
+++ b/Projects/UOContent/Regions/CousteauPerronHouseRegion.cs
@@ -1,9 +1,11 @@
using System;
+using System.Text.Json.Serialization;
namespace Server.Regions;
public class CousteauPerronHouseRegion : GuardedRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
public CousteauPerronHouseRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
{
}
diff --git a/Projects/UOContent/Regions/CrystalFieldRegion.cs b/Projects/UOContent/Regions/CrystalFieldRegion.cs
index 5236aa5f8..ea08ed9b0 100644
--- a/Projects/UOContent/Regions/CrystalFieldRegion.cs
+++ b/Projects/UOContent/Regions/CrystalFieldRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement damage boost regions
public class CrystalFieldRegion : MondainRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public CrystalFieldRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public CrystalFieldRegion(string name, Map map, Region parent, params Rectangle3D[] area): base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/DoomGuardianRegion.cs b/Projects/UOContent/Regions/DoomGuardianRegion.cs
index 8fed156de..697acc585 100644
--- a/Projects/UOContent/Regions/DoomGuardianRegion.cs
+++ b/Projects/UOContent/Regions/DoomGuardianRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement
public class DoomGuardianRegion : DungeonRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public DoomGuardianRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public DoomGuardianRegion(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/DungeonRegion.cs b/Projects/UOContent/Regions/DungeonRegion.cs
index c930ce285..0c53fed71 100644
--- a/Projects/UOContent/Regions/DungeonRegion.cs
+++ b/Projects/UOContent/Regions/DungeonRegion.cs
@@ -1,7 +1,14 @@
+using System.Text.Json.Serialization;
+
namespace Server.Regions;
public class DungeonRegion : BaseRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public DungeonRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public DungeonRegion(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/ExodusDungeonRegion.cs b/Projects/UOContent/Regions/ExodusDungeonRegion.cs
index 47ba9a820..7d65afa80 100644
--- a/Projects/UOContent/Regions/ExodusDungeonRegion.cs
+++ b/Projects/UOContent/Regions/ExodusDungeonRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement
public class ExodusDungeonRegion : DungeonRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public ExodusDungeonRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public ExodusDungeonRegion(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/ExploringDeepCreaturesRegion.cs b/Projects/UOContent/Regions/ExploringDeepCreaturesRegion.cs
index d09dfe1a2..a08bf9488 100644
--- a/Projects/UOContent/Regions/ExploringDeepCreaturesRegion.cs
+++ b/Projects/UOContent/Regions/ExploringDeepCreaturesRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement
public class ExploringDeepCreaturesRegion : DungeonRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public ExploringDeepCreaturesRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public ExploringDeepCreaturesRegion(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/GreenAcresRegion.cs b/Projects/UOContent/Regions/GreenAcresRegion.cs
index 1eee08276..14ec6ad01 100644
--- a/Projects/UOContent/Regions/GreenAcresRegion.cs
+++ b/Projects/UOContent/Regions/GreenAcresRegion.cs
@@ -1,3 +1,4 @@
+using System.Text.Json.Serialization;
using Server.Spells;
using Server.Spells.Sixth;
@@ -5,6 +6,11 @@ namespace Server.Regions;
public class GreenAcresRegion : BaseRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public GreenAcresRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public GreenAcresRegion(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/GuardedRegion.cs b/Projects/UOContent/Regions/GuardedRegion.cs
index e173b86dd..a724c62e2 100644
--- a/Projects/UOContent/Regions/GuardedRegion.cs
+++ b/Projects/UOContent/Regions/GuardedRegion.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Text.Json.Serialization;
using Server.Mobiles;
using Server.Utilities;
@@ -12,6 +13,7 @@ public class GuardedRegion : BaseRegion
private readonly Dictionary m_GuardCandidates = new();
+ [JsonConstructor] // Don't include parent, since it is special
public GuardedRegion(string name, Map map, int priority, params Rectangle3D[] area) :
base(name, map, priority, area) => GuardType = DefaultGuardType;
diff --git a/Projects/UOContent/Regions/IcyRiverRegion.cs b/Projects/UOContent/Regions/IcyRiverRegion.cs
index f2047befa..4c3661eec 100644
--- a/Projects/UOContent/Regions/IcyRiverRegion.cs
+++ b/Projects/UOContent/Regions/IcyRiverRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement damage boost regions
public class IcyRiverRegion : MondainRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public IcyRiverRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public IcyRiverRegion(string name, Map map, Region parent, params Rectangle3D[] area): base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/JailRegion.cs b/Projects/UOContent/Regions/JailRegion.cs
index 5f15aee09..dffc1ada1 100644
--- a/Projects/UOContent/Regions/JailRegion.cs
+++ b/Projects/UOContent/Regions/JailRegion.cs
@@ -1,9 +1,15 @@
+using System.Text.Json.Serialization;
using Server.Spells;
namespace Server.Regions;
public class JailRegion : BaseRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public JailRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public JailRegion(string name, Map map, Region parent, params Rectangle3D[] area)
: base(name, map, parent, area)
{
diff --git a/Projects/UOContent/Regions/JsonDtos/BaseRegionJsonDto.cs b/Projects/UOContent/Regions/JsonDtos/BaseRegionJsonDto.cs
deleted file mode 100644
index 3c9becffb..000000000
--- a/Projects/UOContent/Regions/JsonDtos/BaseRegionJsonDto.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace Server.Regions;
-
-public class BaseRegionJsonDto : GenericRegionJsonDto where TRegion : BaseRegion
-{
- public string RuneName { get; set; }
- public bool NoLogoutDelay { get; set; }
-
- public override void FromRegion(Region region)
- {
- base.FromRegion(region);
-
- if (region is BaseRegion baseRegion)
- {
- RuneName = baseRegion.RuneName;
- NoLogoutDelay = baseRegion.NoLogoutDelay;
- }
- }
-
- protected override void HydrateRegion(Region region)
- {
- base.HydrateRegion(region);
-
- if (region is BaseRegion baseRegion)
- {
- baseRegion.RuneName = RuneName;
- baseRegion.NoLogoutDelay = NoLogoutDelay;
- }
- }
-}
diff --git a/Projects/UOContent/Regions/JsonDtos/DungeonRegionJsonDto.cs b/Projects/UOContent/Regions/JsonDtos/DungeonRegionJsonDto.cs
deleted file mode 100644
index 7e85b9915..000000000
--- a/Projects/UOContent/Regions/JsonDtos/DungeonRegionJsonDto.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-namespace Server.Regions;
-
-public class DungeonRegionJsonDto : BaseRegionJsonDto where TRegion : DungeonRegion
-{
- public Point3D Entrance { get; set; }
-
- public override void FromRegion(Region region)
- {
- base.FromRegion(region);
-
- if (region is DungeonRegion dungeonRegion)
- {
- Entrance = dungeonRegion.Entrance;
- }
- }
-
- protected override void HydrateRegion(Region region)
- {
- base.HydrateRegion(region);
-
- if (region is DungeonRegion dungeonRegion)
- {
- dungeonRegion.Entrance = Entrance;
- }
- }
-}
diff --git a/Projects/UOContent/Regions/JsonDtos/GenericRegionJsonDto.cs b/Projects/UOContent/Regions/JsonDtos/GenericRegionJsonDto.cs
deleted file mode 100644
index f80617c08..000000000
--- a/Projects/UOContent/Regions/JsonDtos/GenericRegionJsonDto.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-using System.Text.Json.Serialization;
-
-namespace Server.Regions;
-
-public class GenericRegionJsonDto : RegionJsonDto where TRegion : BaseRegion
-{
- [JsonIgnore]
- public override Type RegionType => typeof(TRegion);
- public string RuneName { get; set; }
- public bool NoLogoutDelay { get; set; }
-
- public override void FromRegion(Region region)
- {
- base.FromRegion(region);
-
- if (region is BaseRegion baseRegion)
- {
- RuneName = baseRegion.RuneName;
- NoLogoutDelay = baseRegion.NoLogoutDelay;
- }
- }
-
- protected override void HydrateRegion(Region region)
- {
- base.HydrateRegion(region);
-
- if (region is BaseRegion baseRegion)
- {
- baseRegion.RuneName = RuneName;
- baseRegion.NoLogoutDelay = NoLogoutDelay;
- }
- }
-}
diff --git a/Projects/UOContent/Regions/JsonDtos/GuardedRegionJsonDto.cs b/Projects/UOContent/Regions/JsonDtos/GuardedRegionJsonDto.cs
deleted file mode 100644
index bd19f9956..000000000
--- a/Projects/UOContent/Regions/JsonDtos/GuardedRegionJsonDto.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System;
-
-namespace Server.Regions;
-
-public class GuardedRegionJsonDto : BaseRegionJsonDto where TRegion : GuardedRegion
-{
- public bool GuardsDisabled { get; set; }
- public Type? GuardType { get; set; }
-
- public override void FromRegion(Region region)
- {
- base.FromRegion(region);
-
- if (region is GuardedRegion guardedRegion)
- {
- GuardsDisabled = guardedRegion.GuardsDisabled;
- GuardType = guardedRegion.GuardType == guardedRegion.DefaultGuardType ? null : guardedRegion.GuardType;
- }
- }
-
- protected override void HydrateRegion(Region region)
- {
- base.HydrateRegion(region);
- if (region is GuardedRegion guardedRegion)
- {
- guardedRegion.GuardsDisabled = GuardsDisabled;
- guardedRegion.GuardType = GuardType ?? guardedRegion.DefaultGuardType;
- }
- }
-}
diff --git a/Projects/UOContent/Regions/JsonDtos/RegionJsonDtoExt.cs b/Projects/UOContent/Regions/JsonDtos/RegionJsonDtoExt.cs
deleted file mode 100644
index 7c191ec67..000000000
--- a/Projects/UOContent/Regions/JsonDtos/RegionJsonDtoExt.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-namespace Server.Regions;
-
-public static class RegionJsonDtoExt
-{
- public static void Configure()
- {
- RegionJsonSerializer.Register, BaseRegion>();
-
- RegionJsonSerializer.Register, DungeonRegion>();
- RegionJsonSerializer.Register, GuardedRegion>();
-
- RegionJsonSerializer.Register, GreenAcresRegion>();
- RegionJsonSerializer.Register, JailRegion>();
- RegionJsonSerializer.Register, MondainRegion>();
- RegionJsonSerializer.Register, NewMaginciaRegion>();
- RegionJsonSerializer.Register, NoHousingRegion>();
- RegionJsonSerializer.Register, NoHousingGuardedRegion>();
- RegionJsonSerializer.Register, NoTravelSpellsAllowedRegion>();
- RegionJsonSerializer.Register, TownRegion>();
- RegionJsonSerializer.Register, TwistedWealdDesertRegion>();
-
- // Damage boost regions
- RegionJsonSerializer.Register, CrystalFieldRegion>();
- RegionJsonSerializer.Register, IcyRiverRegion>();
- RegionJsonSerializer.Register, AcidRiverRegion>();
- RegionJsonSerializer.Register, PoisonedTreeRegion>();
- RegionJsonSerializer.Register, LostCityEntranceRegion>();
- RegionJsonSerializer.Register, PoisonedCemeteryRegion>();
-
- // Wrong Jail
- RegionJsonSerializer.Register, WrongLevel3Region>();
- RegionJsonSerializer.Register, WrongJailRegion>();
-
- // Blackthorn Dungeon
- RegionJsonSerializer.Register, BlackthornDungeonRegion>();
-
- RegionJsonSerializer.Register, CousteauPerronHouseRegion>();
-
- RegionJsonSerializer.Register, ApprenticeRegion>();
-
- RegionJsonSerializer.Register, SeaMarketRegion>();
-
- // Exploring the Deep
- RegionJsonSerializer.Register, ExploringDeepCreaturesRegion>();
- RegionJsonSerializer.Register, UnderwaterRegion>();
-
- // Exodus Dungeon
- RegionJsonSerializer.Register, ExodusDungeonRegion>();
-
- // Doom
- RegionJsonSerializer.Register, DoomGuardianRegion>();
-
- // Tokuno
- RegionJsonSerializer.Register, TokunoDocksRegion>();
-
- // Tomb of Kings
- RegionJsonSerializer.Register, TombOfKingsRegion>();
- RegionJsonSerializer.Register, ToKBridgeRegion>();
-
- // Myrmidex
- RegionJsonSerializer.Register, BattleRegion>();
- }
-}
diff --git a/Projects/UOContent/Regions/JsonDtos/TownRegionJsonDto.cs b/Projects/UOContent/Regions/JsonDtos/TownRegionJsonDto.cs
deleted file mode 100644
index 4317e5567..000000000
--- a/Projects/UOContent/Regions/JsonDtos/TownRegionJsonDto.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-namespace Server.Regions;
-
-public class TownRegionJsonDto : BaseRegionJsonDto where TRegion : TownRegion
-{
- public Point3D Entrance { get; set; }
-
- public override void FromRegion(Region region)
- {
- base.FromRegion(region);
-
- if (region is TownRegion townRegion)
- {
- Entrance = townRegion.Entrance;
- }
- }
-
- protected override void HydrateRegion(Region region)
- {
- base.HydrateRegion(region);
-
- if (region is TownRegion townRegion)
- {
- townRegion.Entrance = Entrance;
- }
- }
-}
diff --git a/Projects/UOContent/Regions/LostCityEntranceRegion.cs b/Projects/UOContent/Regions/LostCityEntranceRegion.cs
index 358aebc89..4762ad4e7 100644
--- a/Projects/UOContent/Regions/LostCityEntranceRegion.cs
+++ b/Projects/UOContent/Regions/LostCityEntranceRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement damage boost regions
public class LostCityEntranceRegion : MondainRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public LostCityEntranceRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public LostCityEntranceRegion(string name, Map map, Region parent, params Rectangle3D[] area): base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/MondainRegion.cs b/Projects/UOContent/Regions/MondainRegion.cs
index 0cc8c80c7..feedd15a1 100644
--- a/Projects/UOContent/Regions/MondainRegion.cs
+++ b/Projects/UOContent/Regions/MondainRegion.cs
@@ -1,7 +1,14 @@
+using System.Text.Json.Serialization;
+
namespace Server.Regions;
public class MondainRegion : NoTravelSpellsAllowedRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public MondainRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public MondainRegion(string name, Map map, Region parent, params Rectangle3D[] area)
: base(name, map, parent, area)
{
diff --git a/Projects/UOContent/Regions/NewMaginciaRegion.cs b/Projects/UOContent/Regions/NewMaginciaRegion.cs
index ba2e3d53e..3a8f20fd2 100644
--- a/Projects/UOContent/Regions/NewMaginciaRegion.cs
+++ b/Projects/UOContent/Regions/NewMaginciaRegion.cs
@@ -1,7 +1,14 @@
+using System.Text.Json.Serialization;
+
namespace Server.Regions;
public class NewMaginciaRegion : TownRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public NewMaginciaRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public NewMaginciaRegion(string name, Map map, Region parent, params Rectangle3D[] area)
: base(name, map, parent, area)
{
diff --git a/Projects/UOContent/Regions/NoHousingGuardedRegion.cs b/Projects/UOContent/Regions/NoHousingGuardedRegion.cs
index 1e4ae356c..049b38b57 100644
--- a/Projects/UOContent/Regions/NoHousingGuardedRegion.cs
+++ b/Projects/UOContent/Regions/NoHousingGuardedRegion.cs
@@ -1,9 +1,11 @@
using System;
+using System.Text.Json.Serialization;
namespace Server.Regions;
public class NoHousingGuardedRegion : GuardedRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
public NoHousingGuardedRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
{
}
diff --git a/Projects/UOContent/Regions/NoHousingRegion.cs b/Projects/UOContent/Regions/NoHousingRegion.cs
index eba537f97..6fb027894 100644
--- a/Projects/UOContent/Regions/NoHousingRegion.cs
+++ b/Projects/UOContent/Regions/NoHousingRegion.cs
@@ -1,8 +1,13 @@
+using System.Text.Json.Serialization;
+
namespace Server.Regions;
public class NoHousingRegion : BaseRegion
{
- // We don't set AllowHousing to false because it is manually checked so that a part of a house cannot overlap
+ [JsonConstructor] // Don't include parent, since it is special
+ public NoHousingRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
public NoHousingRegion(string name, Map map, Region parent, params Rectangle3D[] area)
: base(name, map, parent, area)
@@ -14,5 +19,6 @@ public class NoHousingRegion : BaseRegion
{
}
+ // We don't set AllowHousing to false because it is manually checked so that a part of a house cannot overlap
public override bool AllowHousing(Mobile from, Point3D p) => true;
}
diff --git a/Projects/UOContent/Regions/NoTravelSpellsAllowedRegion.cs b/Projects/UOContent/Regions/NoTravelSpellsAllowedRegion.cs
index 1cca19728..2b7be4a74 100644
--- a/Projects/UOContent/Regions/NoTravelSpellsAllowedRegion.cs
+++ b/Projects/UOContent/Regions/NoTravelSpellsAllowedRegion.cs
@@ -1,9 +1,15 @@
+using System.Text.Json.Serialization;
using Server;
using Server.Regions;
using Server.Spells;
public class NoTravelSpellsAllowedRegion : DungeonRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public NoTravelSpellsAllowedRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public NoTravelSpellsAllowedRegion(string name, Map map, Region parent, params Rectangle3D[] area)
: base(name, map, parent, area)
{
diff --git a/Projects/UOContent/Regions/PoisonedTreeRegion.cs b/Projects/UOContent/Regions/PoisonedTreeRegion.cs
index 3bc97be1a..acfacd211 100644
--- a/Projects/UOContent/Regions/PoisonedTreeRegion.cs
+++ b/Projects/UOContent/Regions/PoisonedTreeRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement damage boost regions
public class PoisonedTreeRegion : MondainRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public PoisonedTreeRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public PoisonedTreeRegion(string name, Map map, Region parent, params Rectangle3D[] area): base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/PolisonedCemeteryRegion.cs b/Projects/UOContent/Regions/PolisonedCemeteryRegion.cs
index 89faacc29..217992232 100644
--- a/Projects/UOContent/Regions/PolisonedCemeteryRegion.cs
+++ b/Projects/UOContent/Regions/PolisonedCemeteryRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement damage boost regions
public class PoisonedCemeteryRegion : MondainRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public PoisonedCemeteryRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public PoisonedCemeteryRegion(string name, Map map, Region parent, params Rectangle3D[] area): base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/RegionJsonRegistration.cs b/Projects/UOContent/Regions/RegionJsonRegistration.cs
new file mode 100644
index 000000000..64cc195e7
--- /dev/null
+++ b/Projects/UOContent/Regions/RegionJsonRegistration.cs
@@ -0,0 +1,63 @@
+namespace Server.Regions;
+
+public static class RegionJsonRegistration
+{
+ public static void Configure()
+ {
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+
+ // Travel registricted regions
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+
+ // Damage boost regions
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+
+ // Wrong Jail
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+
+ // Blackthorn Dungeon
+ RegionJsonSerializer.Register();
+
+ RegionJsonSerializer.Register();
+
+ RegionJsonSerializer.Register();
+
+ RegionJsonSerializer.Register();
+
+ // Exploring the Deep
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+
+ // Exodus Dungeon
+ RegionJsonSerializer.Register();
+
+ // Doom
+ RegionJsonSerializer.Register();
+
+ // Tokuno
+ RegionJsonSerializer.Register();
+
+ // Tomb of Kings
+ RegionJsonSerializer.Register();
+ RegionJsonSerializer.Register();
+
+ // Myrmidex
+ RegionJsonSerializer.Register();
+ }
+}
diff --git a/Projects/UOContent/Regions/SeaMarketRegion.cs b/Projects/UOContent/Regions/SeaMarketRegion.cs
index 60d30b3d1..5712b2c91 100644
--- a/Projects/UOContent/Regions/SeaMarketRegion.cs
+++ b/Projects/UOContent/Regions/SeaMarketRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement
public class SeaMarketRegion : BaseRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public SeaMarketRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public SeaMarketRegion(string name, Map map, Region parent, int priority, params Rectangle3D[] area) : base(name, map, parent, priority, area)
{
}
diff --git a/Projects/UOContent/Regions/ToKBridgeRegion.cs b/Projects/UOContent/Regions/ToKBridgeRegion.cs
index 4acbe4ef5..a70fc62c0 100644
--- a/Projects/UOContent/Regions/ToKBridgeRegion.cs
+++ b/Projects/UOContent/Regions/ToKBridgeRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement
public class ToKBridgeRegion : BaseRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public ToKBridgeRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public ToKBridgeRegion(string name, Map map, Region parent, int priority, params Rectangle3D[] area) : base(name, map, parent, priority, area)
{
}
diff --git a/Projects/UOContent/Regions/TokunoDocksRegion.cs b/Projects/UOContent/Regions/TokunoDocksRegion.cs
index 486747754..66913db3d 100644
--- a/Projects/UOContent/Regions/TokunoDocksRegion.cs
+++ b/Projects/UOContent/Regions/TokunoDocksRegion.cs
@@ -1,9 +1,11 @@
using System;
+using System.Text.Json.Serialization;
namespace Server.Regions;
public class TokunoDocksRegion : NoHousingGuardedRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
public TokunoDocksRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
{
}
diff --git a/Projects/UOContent/Regions/TombOfKingsRegion.cs b/Projects/UOContent/Regions/TombOfKingsRegion.cs
index 8b2a3a000..caa6030d3 100644
--- a/Projects/UOContent/Regions/TombOfKingsRegion.cs
+++ b/Projects/UOContent/Regions/TombOfKingsRegion.cs
@@ -1,7 +1,14 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
public class TombOfKingsRegion : BaseRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public TombOfKingsRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public TombOfKingsRegion(string name, Map map, Region parent, int priority, params Rectangle3D[] area) : base(name, map, parent, priority, area)
{
}
diff --git a/Projects/UOContent/Regions/TownRegion.cs b/Projects/UOContent/Regions/TownRegion.cs
index 8ae77c904..3520be4d9 100644
--- a/Projects/UOContent/Regions/TownRegion.cs
+++ b/Projects/UOContent/Regions/TownRegion.cs
@@ -1,8 +1,13 @@
+using System.Text.Json.Serialization;
+
namespace Server.Regions;
public class TownRegion : GuardedRegion
{
- public Point3D Entrance { get; set; }
+ [JsonConstructor] // Don't include parent, since it is special
+ public TownRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
public TownRegion(string name, Map map, Region parent, params Rectangle3D[] area)
: base(name, map, parent, area)
@@ -13,4 +18,6 @@ public class TownRegion : GuardedRegion
: base(name, map, parent, priority, area)
{
}
+
+ public Point3D Entrance { get; set; }
}
diff --git a/Projects/UOContent/Regions/TwistedWealdDesertRegion.cs b/Projects/UOContent/Regions/TwistedWealdDesertRegion.cs
index 4eb237c9a..0d6cc9032 100644
--- a/Projects/UOContent/Regions/TwistedWealdDesertRegion.cs
+++ b/Projects/UOContent/Regions/TwistedWealdDesertRegion.cs
@@ -1,3 +1,4 @@
+using System.Text.Json.Serialization;
using Server.Network;
using Server.Spells;
using Server.Spells.Ninjitsu;
@@ -6,6 +7,11 @@ namespace Server.Regions;
public class TwistedWealdDesertRegion : MondainRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public TwistedWealdDesertRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public TwistedWealdDesertRegion(string name, Map map, Region parent, params Rectangle3D[] area)
: base(name, map, parent, area)
{
diff --git a/Projects/UOContent/Regions/UnderwaterRegion.cs b/Projects/UOContent/Regions/UnderwaterRegion.cs
index f85c3401a..401faf363 100644
--- a/Projects/UOContent/Regions/UnderwaterRegion.cs
+++ b/Projects/UOContent/Regions/UnderwaterRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement
public class UnderwaterRegion : BaseRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public UnderwaterRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public UnderwaterRegion(string name, Map map, Region parent, int priority, params Rectangle3D[] area) : base(name, map, parent, priority, area)
{
}
diff --git a/Projects/UOContent/Regions/WrongJailRegion.cs b/Projects/UOContent/Regions/WrongJailRegion.cs
index 9abe8acb2..9d1d13629 100644
--- a/Projects/UOContent/Regions/WrongJailRegion.cs
+++ b/Projects/UOContent/Regions/WrongJailRegion.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement jail safe zone
public class WrongJailRegion : DungeonRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public WrongJailRegion(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public WrongJailRegion(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
{
}
diff --git a/Projects/UOContent/Regions/WrongLevel3Region.cs b/Projects/UOContent/Regions/WrongLevel3Region.cs
index 382a1f66a..6c7c41efb 100644
--- a/Projects/UOContent/Regions/WrongLevel3Region.cs
+++ b/Projects/UOContent/Regions/WrongLevel3Region.cs
@@ -1,8 +1,15 @@
-namespace Server.Regions;
+using System.Text.Json.Serialization;
+
+namespace Server.Regions;
// TODO: Implement jail
public class WrongLevel3Region : DungeonRegion
{
+ [JsonConstructor] // Don't include parent, since it is special
+ public WrongLevel3Region(string name, Map map, int priority, params Rectangle3D[] area) : base(name, map, priority, area)
+ {
+ }
+
public WrongLevel3Region(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
{
}
diff --git a/version.json b/version.json
index a47c242d4..72b0d928f 100644
--- a/version.json
+++ b/version.json
@@ -1,4 +1,4 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
- "version": "0.9.6"
+ "version": "0.9.7"
}