mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-28 03:15:27 -05:00
Un-nest 3ds console region bitflags
Insert 3DS into the name to indicate that it's for the 3DS
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/// <summary>
|
||||
/// 3DS Console Region Identifiers used for Generation 6 & 7 Mystery Gifts
|
||||
/// </summary>
|
||||
public enum RegionID : byte
|
||||
public enum Region3DSIndex : byte
|
||||
{
|
||||
None = 0,
|
||||
Japan = 1,
|
||||
@@ -20,12 +20,12 @@ public enum MysteryGiftRestriction
|
||||
RegionBase = LangKorean,
|
||||
LangRestrict = LangJapanese | LangEnglish | LangFrench | LangItalian | LangGerman | LangSpanish | LangKorean,
|
||||
|
||||
RegJP = RegionBase << RegionID.Japan,
|
||||
RegNA = RegionBase << RegionID.NorthAmerica,
|
||||
RegEU = RegionBase << RegionID.Europe,
|
||||
RegZH = RegionBase << RegionID.China,
|
||||
RegKO = RegionBase << RegionID.Korea,
|
||||
RegTW = RegionBase << RegionID.Taiwan,
|
||||
RegJP = RegionBase << Region3DSIndex.Japan,
|
||||
RegNA = RegionBase << Region3DSIndex.NorthAmerica,
|
||||
RegEU = RegionBase << Region3DSIndex.Europe,
|
||||
RegZH = RegionBase << Region3DSIndex.China,
|
||||
RegKO = RegionBase << Region3DSIndex.Korea,
|
||||
RegTW = RegionBase << Region3DSIndex.Taiwan,
|
||||
|
||||
RegionRestrict = RegJP | RegNA | RegEU | RegZH | RegKO | RegTW,
|
||||
|
||||
@@ -56,7 +56,7 @@ public static int GetSuggestedLanguage(this MysteryGiftRestriction value)
|
||||
|
||||
public static int GetSuggestedRegion(this MysteryGiftRestriction value)
|
||||
{
|
||||
for (int i = (int)RegionID.Japan; i <= (int)RegionID.Taiwan; i++)
|
||||
for (int i = (int)Region3DSIndex.Japan; i <= (int)Region3DSIndex.Taiwan; i++)
|
||||
{
|
||||
if (value.HasFlagFast((MysteryGiftRestriction)((int)MysteryGiftRestriction.RegionBase << i)))
|
||||
return i;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using static PKHeX.Core.Region3DSFlags;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
@@ -37,40 +38,29 @@ internal FormSubregionTable(byte form, byte[] regions)
|
||||
/// <summary>
|
||||
/// List of valid regions as bitflags indexed by Vivillon form.
|
||||
/// </summary>
|
||||
private static readonly RegionFlags[] VivillonRegionTable =
|
||||
private static readonly Region3DSFlags[] VivillonRegionTable =
|
||||
{
|
||||
/* 0 Icy Snow */ RegionFlags.Americas | RegionFlags.Europe,
|
||||
/* 1 Polar */ RegionFlags.Americas | RegionFlags.Europe | RegionFlags.China,
|
||||
/* 2 Tundra */ RegionFlags.Japan | RegionFlags.Europe,
|
||||
/* 3 Continental */ RegionFlags.Americas | RegionFlags.Europe | RegionFlags.China | RegionFlags.Korea | RegionFlags.Taiwan,
|
||||
/* 4 Garden */ RegionFlags.Europe,
|
||||
/* 5 Elegant */ RegionFlags.Japan,
|
||||
/* 6 Meadow */ RegionFlags.Europe,
|
||||
/* 7 Modern */ RegionFlags.Americas,
|
||||
/* 8 Marine */ RegionFlags.Americas | RegionFlags.Europe,
|
||||
/* 9 Archipelago */ RegionFlags.Americas | RegionFlags.Europe,
|
||||
/*10 High Plains */ RegionFlags.Americas | RegionFlags.Europe | RegionFlags.China,
|
||||
/*11 Sandstorm */ RegionFlags.Americas | RegionFlags.Europe,
|
||||
/*12 River */ RegionFlags.Europe,
|
||||
/*13 Monsoon */ RegionFlags.Japan | RegionFlags.Europe | RegionFlags.China | RegionFlags.Taiwan,
|
||||
/*14 Savanna */ RegionFlags.Americas,
|
||||
/*15 Sun */ RegionFlags.Americas | RegionFlags.Europe,
|
||||
/*16 Ocean */ RegionFlags.Americas | RegionFlags.Europe,
|
||||
/*17 Jungle */ RegionFlags.Americas | RegionFlags.Europe,
|
||||
/* 0 Icy Snow */ Americas | Europe,
|
||||
/* 1 Polar */ Americas | Europe | China,
|
||||
/* 2 Tundra */ Japan | Europe,
|
||||
/* 3 Continental */ Americas | Europe | China | Korea | Taiwan,
|
||||
/* 4 Garden */ Europe,
|
||||
/* 5 Elegant */ Japan,
|
||||
/* 6 Meadow */ Europe,
|
||||
/* 7 Modern */ Americas,
|
||||
/* 8 Marine */ Americas | Europe,
|
||||
/* 9 Archipelago */ Americas | Europe,
|
||||
/*10 High Plains */ Americas | Europe | China,
|
||||
/*11 Sandstorm */ Americas | Europe,
|
||||
/*12 River */ Europe,
|
||||
/*13 Monsoon */ Japan | Europe | China | Taiwan,
|
||||
/*14 Savanna */ Americas,
|
||||
/*15 Sun */ Americas | Europe,
|
||||
/*16 Ocean */ Americas | Europe,
|
||||
/*17 Jungle */ Americas | Europe,
|
||||
};
|
||||
|
||||
[Flags]
|
||||
public enum RegionFlags : ushort
|
||||
{
|
||||
Japan = 1,
|
||||
Americas = 1 << 1,
|
||||
Europe = 1 << 2,
|
||||
China = 1 << 4,
|
||||
Korea = 1 << 5,
|
||||
Taiwan = 1 << 6,
|
||||
};
|
||||
|
||||
public static RegionFlags GetConsoleRegionFlag(int consoleRegion) => (RegionFlags)(1 << consoleRegion);
|
||||
public static Region3DSFlags GetConsoleRegionFlag(int consoleRegion) => (Region3DSFlags)(1 << consoleRegion);
|
||||
|
||||
/// <summary>
|
||||
/// List of valid countries for each Vivillon form.
|
||||
@@ -271,4 +261,20 @@ private static int GetPattern(byte country)
|
||||
return Math.Max(0, form);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Console Region Flags for the 3DS.
|
||||
/// </summary>
|
||||
/// <remarks>Not to be confused with <see cref="Region3DSIndex"/>.</remarks>
|
||||
[Flags]
|
||||
public enum Region3DSFlags : ushort
|
||||
{
|
||||
None,
|
||||
Japan = 1,
|
||||
Americas = 1 << 1,
|
||||
Europe = 1 << 2,
|
||||
China = 1 << 4,
|
||||
Korea = 1 << 5,
|
||||
Taiwan = 1 << 6,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
public interface IRegionOrigin
|
||||
{
|
||||
/// <summary> Console hardware region. </summary>
|
||||
/// <see cref="RegionID"/>
|
||||
/// <see cref="Region3DSIndex"/>
|
||||
byte ConsoleRegion { get; set; }
|
||||
/// <summary> Console's configured Country via System Settings. </summary>
|
||||
byte Country { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user