mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Reduce size of display-able met location arrays
shaves 5KB off the core DLL
This commit is contained in:
parent
fadcf92dc8
commit
a4533b62d8
11 changed files with 41 additions and 60 deletions
|
@ -30,7 +30,7 @@ namespace PKHeX.Core
|
|||
private List<ComboItem> GetItems(int memoryGen)
|
||||
{
|
||||
var permit = Memories.GetMemoryItemParams(memoryGen);
|
||||
var asInt = permit.Select(z => (int) z).ToArray();
|
||||
var asInt = permit.ToArray();
|
||||
return Util.GetCBList(s.itemlist, asInt);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace PKHeX.Core
|
|||
internal const int MaxBallID_4 = 0x18;
|
||||
internal const int MaxGameID_4 = 15; // CXD
|
||||
|
||||
internal static readonly int[] Met_HGSS_0 =
|
||||
internal static readonly ushort[] Met_HGSS_0 =
|
||||
{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
||||
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
|
||||
|
@ -29,13 +29,13 @@ namespace PKHeX.Core
|
|||
232, 233, 234,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_HGSS_2 =
|
||||
internal static readonly ushort[] Met_HGSS_2 =
|
||||
{
|
||||
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011,
|
||||
2012, 2013, 2014,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_HGSS_3 =
|
||||
internal static readonly ushort[] Met_HGSS_3 =
|
||||
{
|
||||
3000, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010,
|
||||
3011, 3012, 3013, 3014, 3015, 3016, 3017, 3018, 3019, 3020, 3021, 3022, 3023, 3024, 3025, 3026, 3027, 3028,
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace PKHeX.Core
|
|||
internal const int MaxBallID_5 = 0x19;
|
||||
internal const int MaxGameID_5 = 23; // B2
|
||||
|
||||
internal static readonly int[] Met_BW2_0 =
|
||||
internal static readonly ushort[] Met_BW2_0 =
|
||||
{
|
||||
1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
||||
|
@ -23,13 +23,13 @@ namespace PKHeX.Core
|
|||
147, 148, 149, 150, 151, 152, 153,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_BW2_3 =
|
||||
internal static readonly ushort[] Met_BW2_3 =
|
||||
{
|
||||
30001, 30002, 30004, 30005, 30006, 30007, 30008, 30010, 30011, 30012,
|
||||
30013, 30014, 30015,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_BW2_4 =
|
||||
internal static readonly ushort[] Met_BW2_4 =
|
||||
{
|
||||
40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009, 40010,
|
||||
40011, 40012, 40013, 40014, 40015, 40016, 40017, 40018, 40019, 40020, 40021, 40022, 40023, 40024, 40025,
|
||||
|
@ -41,7 +41,7 @@ namespace PKHeX.Core
|
|||
40101, 40102, 40103, 40104, 40105, 40106, 40107, 40108, 40109,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_BW2_6 = { 60001, 60003 };
|
||||
internal static readonly ushort[] Met_BW2_6 = { 60001, 60003 };
|
||||
|
||||
internal static readonly ushort[] Pouch_Items_BW = {
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 116, 117, 118, 119, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 492, 493, 494, 495, 496, 497, 498, 499, 500, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 571, 572, 573, 575, 576, 577, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590,
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace PKHeX.Core
|
|||
internal const int MaxGameID_6 = 27; // OR
|
||||
|
||||
#region Met Locations
|
||||
public static readonly int[] Met_XY_0 =
|
||||
public static readonly ushort[] Met_XY_0 =
|
||||
{
|
||||
/* XY */ 2, 6, 8, 10, 12, 14, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32,
|
||||
34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 82, 84, 86, 88,
|
||||
|
@ -28,12 +28,12 @@ namespace PKHeX.Core
|
|||
350, 352, 354,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_XY_3 =
|
||||
internal static readonly ushort[] Met_XY_3 =
|
||||
{
|
||||
30001, 30003, 30004, 30005, 30006, 30007, 30008, 30009, 30010, 30011,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_XY_4 =
|
||||
internal static readonly ushort[] Met_XY_4 =
|
||||
{
|
||||
40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009, 40010,
|
||||
40011, 40012, 40013, 40014, 40015, 40016, 40017, 40018, 40019, 40020, 40021, 40022, 40023, 40024, 40025,
|
||||
|
@ -43,7 +43,7 @@ namespace PKHeX.Core
|
|||
40071, 40072, 40073, 40074, 40075, 40076, 40077, 40078, 40079,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_XY_6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
internal static readonly ushort[] Met_XY_6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace PKHeX.Core
|
|||
|
||||
#region Met Locations
|
||||
|
||||
internal static readonly int[] Met_SM_0 =
|
||||
internal static readonly ushort[] Met_SM_0 =
|
||||
{
|
||||
002, 004, // Invalid
|
||||
006, 008, 010, 012, 014, 016, 018, 020, 022, 024, 026, 028, 030, 032, 034, 036, 038, 040, 042, 044, 046, 048,
|
||||
|
@ -32,12 +32,12 @@ namespace PKHeX.Core
|
|||
200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_SM_3 =
|
||||
internal static readonly ushort[] Met_SM_3 =
|
||||
{
|
||||
30001, 30003, 30004, 30005, 30006, 30007, 30008, 30009, 30010, 30011, 30012, 30013, 30014, 30015, 30016, 30017,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_SM_4 =
|
||||
internal static readonly ushort[] Met_SM_4 =
|
||||
{
|
||||
40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009, 40010,
|
||||
40011, 40012, 40013, 40014, 40015, 40016, 40017, 40018, 40019, 40020, 40021, 40022, 40023, 40024, 40025,
|
||||
|
@ -49,7 +49,7 @@ namespace PKHeX.Core
|
|||
40080, 40081, 40082, 40083, 40084, 40085, 40086, 40087, 40088,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_SM_6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
internal static readonly ushort[] Met_SM_6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace PKHeX.Core
|
|||
|
||||
#region Met Locations
|
||||
|
||||
internal static readonly int[] Met_GG_0 =
|
||||
internal static readonly ushort[] Met_GG_0 =
|
||||
{
|
||||
002, // Invalid
|
||||
003, 004, 005, 006, 007, 008, 009,
|
||||
|
@ -27,12 +27,12 @@ namespace PKHeX.Core
|
|||
050, 051, 052, 053,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_GG_3 =
|
||||
internal static readonly ushort[] Met_GG_3 =
|
||||
{
|
||||
30001, 30003, 30004, 30005, 30006, 30007, 30008, 30009, 30010, 30011, 30012, 30013, 30014, 30015, 30016, 30017,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_GG_4 =
|
||||
internal static readonly ushort[] Met_GG_4 =
|
||||
{
|
||||
40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009,
|
||||
40010, 40011, 40012, 40013, 40014, 40015, 40016, 40017, 40018, 40019,
|
||||
|
@ -44,7 +44,7 @@ namespace PKHeX.Core
|
|||
40070, 40071, 40072, 40073, 40074, 40075, 40076, 40077,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_GG_6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
internal static readonly ushort[] Met_GG_6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace PKHeX.Core
|
|||
internal const int MaxGameID_8 = 45; // Shield
|
||||
|
||||
#region Met Locations
|
||||
internal static readonly int[] Met_SWSH_0 =
|
||||
internal static readonly ushort[] Met_SWSH_0 =
|
||||
{
|
||||
002, 004, 006, 008,
|
||||
012, 014, 016, 018,
|
||||
|
@ -63,12 +63,12 @@ namespace PKHeX.Core
|
|||
240, 242, 244, 246,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_SWSH_3 =
|
||||
internal static readonly ushort[] Met_SWSH_3 =
|
||||
{
|
||||
30001, 30003, 30004, 30005, 30006, 30007, 30008, 30009, 30010, 30011, 30012, 30013, 30014, 30015, 30016, 30017, 30018,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_SWSH_4 =
|
||||
internal static readonly ushort[] Met_SWSH_4 =
|
||||
{
|
||||
40001, 40002, 40003, 40005, 40006, 40007, 40008, 40009, 40010,
|
||||
40011, 40012, 40013, 40014, 40016, 40017, 40018, 40019, 40020,
|
||||
|
@ -81,7 +81,7 @@ namespace PKHeX.Core
|
|||
40081, 40082, 40083, 40084, 40085, 40086,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_SWSH_6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
internal static readonly ushort[] Met_SWSH_6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
#endregion
|
||||
|
||||
internal static readonly ushort[] Pouch_Regular_SWSH =
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace PKHeX.Core
|
|||
|
||||
#region Met Locations
|
||||
|
||||
internal static readonly int[] Met_LA_0 =
|
||||
internal static readonly ushort[] Met_LA_0 =
|
||||
{
|
||||
000, 002, 004, 006, 007, 008, 009,
|
||||
010, 011, 012, 013, 014, 015, 016, 017, 018, 019,
|
||||
|
@ -33,12 +33,12 @@ namespace PKHeX.Core
|
|||
150, 151, 152, 153, 154, 155,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_LA_3 =
|
||||
internal static readonly ushort[] Met_LA_3 =
|
||||
{
|
||||
30001, 30002, 30003, 30004, 30005, 30006, 30007, 30008, 30009, 30010, 30011, 30012, 30013, 30014, 30015, 30016, 30017, 30018, 30019, 30020, 30021, 30022,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_LA_4 =
|
||||
internal static readonly ushort[] Met_LA_4 =
|
||||
{
|
||||
40001, 40002, 40003, 40005, 40006, 40007, 40008, 40009,
|
||||
40010, 40011, 40012, 40013, 40014, 40016, 40017, 40018, 40019,
|
||||
|
@ -51,7 +51,7 @@ namespace PKHeX.Core
|
|||
40080, 40081, 40082, 40083, 40084, 40085, 40086,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_LA_6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
internal static readonly ushort[] Met_LA_6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ namespace PKHeX.Core
|
|||
|
||||
#region Met Locations
|
||||
|
||||
// TODO
|
||||
internal static readonly int[] Met_BS_0 =
|
||||
internal static readonly ushort[] Met_BS_0 =
|
||||
{
|
||||
000, 001, 002, 003, 004, 005, 006, 007, 008, 009,
|
||||
010, 011, 012, 013, 014, 015, 016, 017, 018, 019,
|
||||
|
@ -86,12 +85,12 @@ namespace PKHeX.Core
|
|||
648, 649, 650, 651, 652, 653, 654, 655, 656, 657,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_BS_3 =
|
||||
internal static readonly ushort[] Met_BS_3 =
|
||||
{
|
||||
30001, 30003, 30004, 30005, 30006, 30007, 30009, 30010, 30011, 30012, 30013, 30014, 30015, 30016, 30017, 30018, 30019, 30020, 30022,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_BS_4 =
|
||||
internal static readonly ushort[] Met_BS_4 =
|
||||
{
|
||||
40001, 40002, 40003, 40005, 40006, 40007, 40008, 40009,
|
||||
40010, 40011, 40012, 40013, 40014, 40016, 40017, 40018, 40019,
|
||||
|
@ -103,7 +102,7 @@ namespace PKHeX.Core
|
|||
40070, 40071, 40072, 40074, 40075, 40076, 40077,
|
||||
};
|
||||
|
||||
internal static readonly int[] Met_BS_6 = {/* XY */ 60001, 60003, /* ORAS */ 60004, /* BDSP */ 60005, 60006, 60007, 60010 };
|
||||
internal static readonly ushort[] Met_BS_6 = {/* XY */ 60001, 60003, /* ORAS */ 60004, /* BDSP */ 60005, 60006, 60007, 60010 };
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -309,15 +308,16 @@ namespace PKHeX.Core
|
|||
{
|
||||
if ((uint)location > MaxValidHatchLocation8b)
|
||||
return false;
|
||||
if (LocationsNoHatchBDSP.Contains(location))
|
||||
var loc16 = (ushort)location;
|
||||
if (LocationsNoHatchBDSP.Contains(loc16))
|
||||
return false;
|
||||
|
||||
// Check if the location isn't an exclusive location that is only accessible in the other game.
|
||||
var table = version == GameVersion.BD ? LocationsExclusiveSP : LocationsExclusiveBD;
|
||||
return !table.Contains(location);
|
||||
return !table.Contains(loc16);
|
||||
}
|
||||
|
||||
private static readonly HashSet<int> LocationsExclusiveBD = new()
|
||||
private static readonly HashSet<ushort> LocationsExclusiveBD = new()
|
||||
{
|
||||
216, // Spear Pillar
|
||||
218, // Hall of Origin
|
||||
|
@ -327,7 +327,7 @@ namespace PKHeX.Core
|
|||
655, // Ramanas Park (Rainbow Room)
|
||||
};
|
||||
|
||||
private static readonly HashSet<int> LocationsExclusiveSP = new()
|
||||
private static readonly HashSet<ushort> LocationsExclusiveSP = new()
|
||||
{
|
||||
217, // Spear Pillar
|
||||
497, // Ramanas Park (Kanto Room)
|
||||
|
@ -337,7 +337,7 @@ namespace PKHeX.Core
|
|||
656, // Ramanas Park (Squall Room)
|
||||
};
|
||||
|
||||
private static readonly HashSet<int> LocationsNoHatchBDSP = new()
|
||||
private static readonly HashSet<ushort> LocationsNoHatchBDSP = new()
|
||||
{
|
||||
035, // Canalave City
|
||||
094, 103, 107, // Hearthome City
|
||||
|
|
|
@ -224,10 +224,10 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (ShadowID != 0)
|
||||
return true;
|
||||
return IsOriginXD(Species, Met_Level);
|
||||
return IsOriginXD((ushort)Species, Met_Level);
|
||||
}
|
||||
|
||||
private static bool IsOriginXD(int species, int metLevel) => species switch
|
||||
private static bool IsOriginXD(ushort species, int metLevel) => species switch
|
||||
{
|
||||
296 or 297 => metLevel != 30, // Makuhita 30 Colo 18 XD
|
||||
175 or 176 => metLevel != 20, // Togepi 20 Colo 25 XD, also 20 as Togetic in Colo
|
||||
|
|
|
@ -66,20 +66,13 @@ namespace PKHeX.Core
|
|||
return list;
|
||||
}
|
||||
|
||||
public static List<ComboItem> GetCBList(IReadOnlyList<string> inStrings, int[] allowed)
|
||||
{
|
||||
var list = new List<ComboItem>(allowed.Length);
|
||||
AddCB(list, inStrings, allowed);
|
||||
return list;
|
||||
}
|
||||
|
||||
public static void AddCBWithOffset(List<ComboItem> list, IReadOnlyList<string> inStrings, int offset, int index)
|
||||
{
|
||||
var item = new ComboItem(inStrings[index - offset], index);
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
public static void AddCBWithOffset(List<ComboItem> cbList, IReadOnlyList<string> inStrings, int offset, int[] allowed)
|
||||
public static void AddCBWithOffset(List<ComboItem> cbList, IReadOnlyList<string> inStrings, int offset, ushort[] allowed)
|
||||
{
|
||||
int beginCount = cbList.Count;
|
||||
cbList.Capacity += allowed.Length;
|
||||
|
@ -104,18 +97,6 @@ namespace PKHeX.Core
|
|||
cbList.Sort(beginCount, inStrings.Length, Comparer);
|
||||
}
|
||||
|
||||
public static void AddCB(List<ComboItem> cbList, IReadOnlyList<string> inStrings, int[] allowed)
|
||||
{
|
||||
int beginCount = cbList.Count;
|
||||
cbList.Capacity += allowed.Length;
|
||||
foreach (var index in allowed)
|
||||
{
|
||||
var item = new ComboItem(inStrings[index], index);
|
||||
cbList.Add(item);
|
||||
}
|
||||
cbList.Sort(beginCount, allowed.Length, Comparer);
|
||||
}
|
||||
|
||||
public static ComboItem[] GetVariedCBListBall(string[] inStrings, ReadOnlySpan<ushort> stringNum, ReadOnlySpan<byte> stringVal)
|
||||
{
|
||||
const int forcedTop = 3; // 3 Balls are preferentially first
|
||||
|
|
Loading…
Reference in a new issue