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" }
```
This commit is contained in:
parent
734d20cbaf
commit
0a9bfb0558
47 changed files with 542 additions and 470 deletions
85
Projects/Server/Json/Converters/RegionByNameConverter.cs
Normal file
85
Projects/Server/Json/Converters/RegionByNameConverter.cs
Normal file
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Server.Json;
|
||||
|
||||
public class RegionByNameConverter : JsonConverter<Region>
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
@ -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<Region>
|
|||
{
|
||||
}
|
||||
|
||||
[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<Region>
|
|||
}
|
||||
|
||||
// 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<Region> Regions { get; } = new();
|
||||
|
||||
|
|
@ -188,7 +192,9 @@ public class Region : IComparable<Region>
|
|||
|
||||
public Map Map { get; }
|
||||
|
||||
public Region Parent { get; }
|
||||
[JsonInclude]
|
||||
[JsonConverter(typeof(RegionByNameConverter))]
|
||||
public Region Parent { get; private set; }
|
||||
|
||||
public List<Region> Children { get; } = new();
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
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<Region>(Name, Map, Region.Find(Parent, Map), Priority, Area)
|
||||
: RegionType.CreateInstance<Region>(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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Type, Type> _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<TDto, TRegion>()
|
||||
where TDto : RegionJsonDto, new() where TRegion : Region
|
||||
public static void Register<TRegion>() 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<List<RegionJsonDto>>(path, _options);
|
||||
var regions = JsonConfig.Deserialize<List<Region>>(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<RegionJsonDto> _regionJsonDtos;
|
||||
|
||||
public static void SerializeRegions(string path, IEnumerable<Region> regions)
|
||||
{
|
||||
_regionJsonDtos ??= new List<RegionJsonDto>();
|
||||
foreach (var region in regions)
|
||||
{
|
||||
if (_regionToDtoLookup.TryGetValue(region.GetType(), out var dtoType))
|
||||
{
|
||||
var dto = dtoType.CreateInstance<RegionJsonDto>();
|
||||
dto.FromRegion(region);
|
||||
_regionJsonDtos.Add(dto);
|
||||
}
|
||||
}
|
||||
|
||||
JsonConfig.Serialize(path, _regionJsonDtos, _options);
|
||||
_regionJsonDtos.Clear();
|
||||
}
|
||||
|
||||
public static string SerializeRegions(IEnumerable<Region> regions)
|
||||
{
|
||||
_regionJsonDtos ??= new List<RegionJsonDto>();
|
||||
foreach (var region in regions)
|
||||
{
|
||||
if (_regionToDtoLookup.TryGetValue(region.GetType(), out var dtoType))
|
||||
{
|
||||
var dto = dtoType.CreateInstance<RegionJsonDto>();
|
||||
dto.FromRegion(region);
|
||||
_regionJsonDtos.Add(dto);
|
||||
}
|
||||
}
|
||||
|
||||
var output = JsonConfig.Serialize(_regionJsonDtos, _options);
|
||||
_regionJsonDtos.Clear();
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Mobile, GuardTimer> 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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
namespace Server.Regions;
|
||||
|
||||
public class BaseRegionJsonDto<TRegion> : GenericRegionJsonDto<TRegion> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
namespace Server.Regions;
|
||||
|
||||
public class DungeonRegionJsonDto<TRegion> : BaseRegionJsonDto<TRegion> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Server.Regions;
|
||||
|
||||
public class GenericRegionJsonDto<TRegion> : 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Regions;
|
||||
|
||||
public class GuardedRegionJsonDto<TRegion> : BaseRegionJsonDto<TRegion> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
namespace Server.Regions;
|
||||
|
||||
public static class RegionJsonDtoExt
|
||||
{
|
||||
public static void Configure()
|
||||
{
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<BaseRegion>, BaseRegion>();
|
||||
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<DungeonRegion>, DungeonRegion>();
|
||||
RegionJsonSerializer.Register<GuardedRegionJsonDto<GuardedRegion>, GuardedRegion>();
|
||||
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<GreenAcresRegion>, GreenAcresRegion>();
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<JailRegion>, JailRegion>();
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<MondainRegion>, MondainRegion>();
|
||||
RegionJsonSerializer.Register<TownRegionJsonDto<NewMaginciaRegion>, NewMaginciaRegion>();
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<NoHousingRegion>, NoHousingRegion>();
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<NoHousingGuardedRegion>, NoHousingGuardedRegion>();
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<NoTravelSpellsAllowedRegion>, NoTravelSpellsAllowedRegion>();
|
||||
RegionJsonSerializer.Register<TownRegionJsonDto<TownRegion>, TownRegion>();
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<TwistedWealdDesertRegion>, TwistedWealdDesertRegion>();
|
||||
|
||||
// Damage boost regions
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<CrystalFieldRegion>, CrystalFieldRegion>();
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<IcyRiverRegion>, IcyRiverRegion>();
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<AcidRiverRegion>, AcidRiverRegion>();
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<PoisonedTreeRegion>, PoisonedTreeRegion>();
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<LostCityEntranceRegion>, LostCityEntranceRegion>();
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<PoisonedCemeteryRegion>, PoisonedCemeteryRegion>();
|
||||
|
||||
// Wrong Jail
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<WrongLevel3Region>, WrongLevel3Region>();
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<WrongJailRegion>, WrongJailRegion>();
|
||||
|
||||
// Blackthorn Dungeon
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<BlackthornDungeonRegion>, BlackthornDungeonRegion>();
|
||||
|
||||
RegionJsonSerializer.Register<GuardedRegionJsonDto<CousteauPerronHouseRegion>, CousteauPerronHouseRegion>();
|
||||
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<ApprenticeRegion>, ApprenticeRegion>();
|
||||
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<SeaMarketRegion>, SeaMarketRegion>();
|
||||
|
||||
// Exploring the Deep
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<ExploringDeepCreaturesRegion>, ExploringDeepCreaturesRegion>();
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<UnderwaterRegion>, UnderwaterRegion>();
|
||||
|
||||
// Exodus Dungeon
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<ExodusDungeonRegion>, ExodusDungeonRegion>();
|
||||
|
||||
// Doom
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<DoomGuardianRegion>, DoomGuardianRegion>();
|
||||
|
||||
// Tokuno
|
||||
RegionJsonSerializer.Register<GuardedRegionJsonDto<TokunoDocksRegion>, TokunoDocksRegion>();
|
||||
|
||||
// Tomb of Kings
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<TombOfKingsRegion>, TombOfKingsRegion>();
|
||||
RegionJsonSerializer.Register<BaseRegionJsonDto<ToKBridgeRegion>, ToKBridgeRegion>();
|
||||
|
||||
// Myrmidex
|
||||
RegionJsonSerializer.Register<DungeonRegionJsonDto<BattleRegion>, BattleRegion>();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
namespace Server.Regions;
|
||||
|
||||
public class TownRegionJsonDto<TRegion> : BaseRegionJsonDto<TRegion> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
63
Projects/UOContent/Regions/RegionJsonRegistration.cs
Normal file
63
Projects/UOContent/Regions/RegionJsonRegistration.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
namespace Server.Regions;
|
||||
|
||||
public static class RegionJsonRegistration
|
||||
{
|
||||
public static void Configure()
|
||||
{
|
||||
RegionJsonSerializer.Register<BaseRegion>();
|
||||
RegionJsonSerializer.Register<TownRegion>();
|
||||
RegionJsonSerializer.Register<DungeonRegion>();
|
||||
RegionJsonSerializer.Register<GuardedRegion>();
|
||||
|
||||
// Travel registricted regions
|
||||
RegionJsonSerializer.Register<GreenAcresRegion>();
|
||||
RegionJsonSerializer.Register<JailRegion>();
|
||||
RegionJsonSerializer.Register<MondainRegion>();
|
||||
RegionJsonSerializer.Register<NewMaginciaRegion>();
|
||||
RegionJsonSerializer.Register<NoHousingRegion>();
|
||||
RegionJsonSerializer.Register<NoHousingGuardedRegion>();
|
||||
RegionJsonSerializer.Register<NoTravelSpellsAllowedRegion>();
|
||||
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>();
|
||||
}
|
||||
}
|
||||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue