Read swarm slots correctly

This commit is contained in:
Kurt 2020-10-13 15:37:18 -07:00
parent 367859c536
commit 2e8586f364

View file

@ -9,14 +9,16 @@ namespace PKHeX.Core
/// </summary>
internal static class Encounters3
{
private static readonly EncounterArea3[] SlotsSwarmRSE = Get("rse_swarm", "rs", RSE);
private static readonly EncounterArea3[] SlotsSwarmRSE = GetSwarm("rse_swarm", "rs", RSE);
internal static readonly EncounterArea3[] SlotsR = ArrayUtil.ConcatAll(Get("r", "ru", R), SlotsSwarmRSE);
internal static readonly EncounterArea3[] SlotsS = ArrayUtil.ConcatAll(Get("s", "sa", S), SlotsSwarmRSE);
internal static readonly EncounterArea3[] SlotsE = ArrayUtil.ConcatAll(Get("e", "em", E), SlotsSwarmRSE);
internal static readonly EncounterArea3[] SlotsFR = Get("fr", "fr", FR);
internal static readonly EncounterArea3[] SlotsLG = Get("lg", "lg", LG);
private static EncounterArea3[] Get(string resource, string ident, GameVersion game)
=> EncounterArea3.GetAreas(BinLinker.Unpack(Util.GetBinaryResource($"encounter_{resource}.pkl"), ident), game);
private static byte[][] ReadUnpack(string resource, string ident) => BinLinker.Unpack(Util.GetBinaryResource($"encounter_{resource}.pkl"), ident);
private static EncounterArea3[] Get(string resource, string ident, GameVersion game) => EncounterArea3.GetAreas(ReadUnpack(resource, ident), game);
private static EncounterArea3[] GetSwarm(string resource, string ident, GameVersion game) => EncounterArea3.GetAreasSwarm(ReadUnpack(resource, ident), game);
static Encounters3()
{