From 2e8586f36448f742ed202b00d21138f073c5649b Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 13 Oct 2020 15:37:18 -0700 Subject: [PATCH] Read swarm slots correctly --- PKHeX.Core/Legality/Encounters/Data/Encounters3.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs index d4ece3d5a..336a172fb 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs @@ -9,14 +9,16 @@ namespace PKHeX.Core /// 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() {