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
|
|
@ -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