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
|
|
@ -172,6 +172,12 @@ public class Region : IComparable<Region>
|
|||
}
|
||||
}
|
||||
|
||||
// Used during deserialization only
|
||||
public Expansion MinExpansion { get; set; }
|
||||
|
||||
// Used during deserialization only
|
||||
public Expansion MaxExpansion { get; set; }
|
||||
|
||||
public static List<Region> Regions { get; } = new();
|
||||
|
||||
public static TimeSpan StaffLogoutDelay { get; set; } = TimeSpan.Zero;
|
||||
|
|
@ -448,6 +454,24 @@ public class Region : IComparable<Region>
|
|||
return null;
|
||||
}
|
||||
|
||||
// TODO: Memoize this
|
||||
public bool IsPartOf<T1, T2>() where T1 : Region where T2 : Region
|
||||
{
|
||||
var r = this;
|
||||
|
||||
do
|
||||
{
|
||||
if (r is T1 or T2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
r = r.Parent;
|
||||
} while (r != null);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Region GetRegion(Type regionType)
|
||||
{
|
||||
if (regionType == null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue