fix: Fixes regions having the wrong type (#1260)
## Possible Breaking Change * Reverted regions.json back to RunUO until newer regions are implemented and proper expansion checks are added. ### Other Changes - [X] Adds `Region.IsPartOf<T1, T2>()` to check for multiple types. - [X] Fixes regions.json being wrong - [X] Adds lots of missing regions. **They are not implemented properly yet** - [X] Adds regions.xml -> regions.json (check ModernUO Discord) - [X] Adds expansion specific regions.
This commit is contained in:
parent
f9c72a62df
commit
1f778cfacf
38 changed files with 3424 additions and 2949 deletions
|
|
@ -59,7 +59,7 @@ public static class RegionJsonSerializer
|
|||
}
|
||||
};
|
||||
|
||||
public static void RegisterRegionForSerialization<TDto, TRegion>()
|
||||
public static void Register<TDto, TRegion>()
|
||||
where TDto : RegionJsonDto, new() where TRegion : Region
|
||||
{
|
||||
for (var i = 0; i < _derivedTypes.Length; i++)
|
||||
|
|
@ -91,10 +91,15 @@ public static class RegionJsonSerializer
|
|||
throw new JsonException($"Failed to deserialize {path}.");
|
||||
}
|
||||
|
||||
var count = 0;
|
||||
foreach (var dto in regions)
|
||||
{
|
||||
var region = dto.ToRegion();
|
||||
region.Register();
|
||||
if (Core.Expansion >= dto.MinExpansion && Core.Expansion <= dto.MaxExpansion)
|
||||
{
|
||||
var region = dto.ToRegion();
|
||||
region.Register();
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
stopwatch.Stop();
|
||||
|
|
@ -102,7 +107,7 @@ public static class RegionJsonSerializer
|
|||
logger.Information(
|
||||
"Loading regions {Status} ({Count} regions) ({Duration:F2} seconds)",
|
||||
"done",
|
||||
regions.Count,
|
||||
count,
|
||||
stopwatch.Elapsed.TotalSeconds
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue