Rename Data -> BinLinker

This commit is contained in:
Kurt 2020-03-20 15:18:59 -07:00
parent 799e4852cf
commit aaf6642d31
10 changed files with 37 additions and 37 deletions

View file

@ -331,7 +331,7 @@ namespace PKHeX.Core
return;
HyperTraining.Verify(this);
Misc.VerifyVersionEvolution(this);
MiscVerifier.VerifyVersionEvolution(this);
}
private string GetLegalityReport()

View file

@ -2,7 +2,7 @@
namespace PKHeX.Core
{
public static class Data
public static class BinLinker
{
/// <summary>
/// Unpacks a BinLinkerAccessor generated file container into individual arrays.
@ -10,7 +10,7 @@ namespace PKHeX.Core
/// <param name="fileData">Packed data</param>
/// <param name="identifier">Signature expected in the first two bytes (ASCII)</param>
/// <returns>Unpacked array containing all files that were packed.</returns>
public static byte[][] UnpackMini(byte[]? fileData, string identifier)
public static byte[][] Unpack(byte[]? fileData, string identifier)
{
if (fileData == null || fileData.Length < 4)
throw new ArgumentException(nameof(fileData));

View file

@ -26,40 +26,40 @@ namespace PKHeX.Core
internal static readonly Learnset[] LevelUpC = LearnsetReader.GetArray(Util.GetBinaryResource("lvlmove_c.pkl"), MaxSpeciesID_2);
// Gen 3
internal static readonly Learnset[] LevelUpE = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_e.pkl"), "em"));
internal static readonly Learnset[] LevelUpRS = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_rs.pkl"), "rs"));
internal static readonly Learnset[] LevelUpFR = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_fr.pkl"), "fr"));
internal static readonly Learnset[] LevelUpLG = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_lg.pkl"), "lg"));
internal static readonly EggMoves6[] EggMovesRS = EggMoves6.GetArray(Data.UnpackMini(Util.GetBinaryResource("eggmove_rs.pkl"), "rs"));
internal static readonly Learnset[] LevelUpE = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_e.pkl"), "em"));
internal static readonly Learnset[] LevelUpRS = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_rs.pkl"), "rs"));
internal static readonly Learnset[] LevelUpFR = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_fr.pkl"), "fr"));
internal static readonly Learnset[] LevelUpLG = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_lg.pkl"), "lg"));
internal static readonly EggMoves6[] EggMovesRS = EggMoves6.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_rs.pkl"), "rs"));
// Gen 4
internal static readonly Learnset[] LevelUpDP = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_dp.pkl"), "dp"));
internal static readonly Learnset[] LevelUpPt = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_pt.pkl"), "pt"));
internal static readonly Learnset[] LevelUpHGSS = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_hgss.pkl"), "hs"));
internal static readonly EggMoves6[] EggMovesDPPt = EggMoves6.GetArray(Data.UnpackMini(Util.GetBinaryResource("eggmove_dppt.pkl"), "dp"));
internal static readonly EggMoves6[] EggMovesHGSS = EggMoves6.GetArray(Data.UnpackMini(Util.GetBinaryResource("eggmove_hgss.pkl"), "hs"));
internal static readonly Learnset[] LevelUpDP = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_dp.pkl"), "dp"));
internal static readonly Learnset[] LevelUpPt = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_pt.pkl"), "pt"));
internal static readonly Learnset[] LevelUpHGSS = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_hgss.pkl"), "hs"));
internal static readonly EggMoves6[] EggMovesDPPt = EggMoves6.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_dppt.pkl"), "dp"));
internal static readonly EggMoves6[] EggMovesHGSS = EggMoves6.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_hgss.pkl"), "hs"));
// Gen 5
internal static readonly Learnset[] LevelUpBW = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_bw.pkl"), "51"));
internal static readonly Learnset[] LevelUpB2W2 = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_b2w2.pkl"), "52"));
internal static readonly EggMoves6[] EggMovesBW = EggMoves6.GetArray(Data.UnpackMini(Util.GetBinaryResource("eggmove_bw.pkl"), "bw"));
internal static readonly Learnset[] LevelUpBW = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_bw.pkl"), "51"));
internal static readonly Learnset[] LevelUpB2W2 = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_b2w2.pkl"), "52"));
internal static readonly EggMoves6[] EggMovesBW = EggMoves6.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_bw.pkl"), "bw"));
// Gen 6
internal static readonly EggMoves6[] EggMovesXY = EggMoves6.GetArray(Data.UnpackMini(Util.GetBinaryResource("eggmove_xy.pkl"), "xy"));
internal static readonly Learnset[] LevelUpXY = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_xy.pkl"), "xy"));
internal static readonly EggMoves6[] EggMovesAO = EggMoves6.GetArray(Data.UnpackMini(Util.GetBinaryResource("eggmove_ao.pkl"), "ao"));
internal static readonly Learnset[] LevelUpAO = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_ao.pkl"), "ao"));
internal static readonly EggMoves6[] EggMovesXY = EggMoves6.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_xy.pkl"), "xy"));
internal static readonly Learnset[] LevelUpXY = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_xy.pkl"), "xy"));
internal static readonly EggMoves6[] EggMovesAO = EggMoves6.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_ao.pkl"), "ao"));
internal static readonly Learnset[] LevelUpAO = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_ao.pkl"), "ao"));
// Gen 7
internal static readonly EggMoves7[] EggMovesSM = EggMoves7.GetArray(Data.UnpackMini(Util.GetBinaryResource("eggmove_sm.pkl"), "sm"));
internal static readonly Learnset[] LevelUpSM = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_sm.pkl"), "sm"));
internal static readonly EggMoves7[] EggMovesUSUM = EggMoves7.GetArray(Data.UnpackMini(Util.GetBinaryResource("eggmove_uu.pkl"), "uu"));
internal static readonly Learnset[] LevelUpUSUM = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_uu.pkl"), "uu"));
internal static readonly Learnset[] LevelUpGG = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_gg.pkl"), "gg"));
internal static readonly EggMoves7[] EggMovesSM = EggMoves7.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_sm.pkl"), "sm"));
internal static readonly Learnset[] LevelUpSM = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_sm.pkl"), "sm"));
internal static readonly EggMoves7[] EggMovesUSUM = EggMoves7.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_uu.pkl"), "uu"));
internal static readonly Learnset[] LevelUpUSUM = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_uu.pkl"), "uu"));
internal static readonly Learnset[] LevelUpGG = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_gg.pkl"), "gg"));
// Gen 8
internal static readonly EggMoves7[] EggMovesSWSH = EggMoves7.GetArray(Data.UnpackMini(Util.GetBinaryResource("eggmove_swsh.pkl"), "ss"));
internal static readonly Learnset[] LevelUpSWSH = LearnsetReader.GetArray(Data.UnpackMini(Util.GetBinaryResource("lvlmove_swsh.pkl"), "ss"));
internal static readonly EggMoves7[] EggMovesSWSH = EggMoves7.GetArray(BinLinker.Unpack(Util.GetBinaryResource("eggmove_swsh.pkl"), "ss"));
internal static readonly Learnset[] LevelUpSWSH = LearnsetReader.GetArray(BinLinker.Unpack(Util.GetBinaryResource("lvlmove_swsh.pkl"), "ss"));
internal static IReadOnlyList<int>[] GetValidMovesAllGens(PKM pkm, IReadOnlyList<EvoCriteria>[] evoChains, int minLvLG1 = 1, int minLvLG2 = 1, bool LVL = true, bool Tutor = true, bool Machine = true, bool MoveReminder = true, bool RemoveTransferHM = true)
{

View file

@ -28,7 +28,7 @@ namespace PKHeX.Core
internal static T[] GetEncounterTables<T>(string ident, string resource) where T : EncounterArea32, new()
{
byte[] mini = Util.GetBinaryResource($"encounter_{resource}.pkl");
return EncounterArea32.GetArray<T>(Data.UnpackMini(mini, ident));
return EncounterArea32.GetArray<T>(BinLinker.Unpack(mini, ident));
}
/// <summary>
@ -40,7 +40,7 @@ namespace PKHeX.Core
internal static T[] GetEncounterTables8<T>(string ident, string resource) where T : EncounterAreaSH, new()
{
byte[] mini = Util.GetBinaryResource($"encounter_{resource}.pkl");
return EncounterAreaSH.GetArray<T>(Data.UnpackMini(mini, ident));
return EncounterAreaSH.GetArray<T>(BinLinker.Unpack(mini, ident));
}
/// <summary>

View file

@ -11,7 +11,7 @@ namespace PKHeX.Core
{
internal static readonly EncounterArea2[] SlotsGSC, SlotsGS, SlotsC;
internal static readonly EncounterStatic[] StaticGSC, StaticGS, StaticC;
private static readonly TreesArea[] HeadbuttTreesC = TreesArea.GetArray(Data.UnpackMini(Util.GetBinaryResource("trees_h_c.pkl"), "ch"));
private static readonly TreesArea[] HeadbuttTreesC = TreesArea.GetArray(BinLinker.Unpack(Util.GetBinaryResource("trees_h_c.pkl"), "ch"));
static Encounters2()
{

View file

@ -27,7 +27,7 @@ namespace PKHeX.Core
StaticLG = GetStaticEncounters(Encounter_FRLG, GameVersion.LG);
static EncounterArea3[] get(string resource, string ident)
=> EncounterArea3.GetArray3(Data.UnpackMini(Util.GetBinaryResource($"encounter_{resource}.pkl"), ident));
=> EncounterArea3.GetArray3(BinLinker.Unpack(Util.GetBinaryResource($"encounter_{resource}.pkl"), ident));
var R_Slots = get("r", "ru");
var S_Slots = get("s", "sa");

View file

@ -25,7 +25,7 @@ namespace PKHeX.Core
StaticSS = GetStaticEncounters(staticHGSS, GameVersion.SS);
static byte[][] get(string resource, string ident)
=> Data.UnpackMini(Util.GetBinaryResource($"encounter_{resource}.pkl"), ident);
=> BinLinker.Unpack(Util.GetBinaryResource($"encounter_{resource}.pkl"), ident);
var D_Slots = EncounterArea4DPPt.GetArray4DPPt(get("d", "da"));
var P_Slots = EncounterArea4DPPt.GetArray4DPPt(get("p", "pe"));

View file

@ -27,7 +27,7 @@ namespace PKHeX.Core
{
// Evolution tables need Personal Tables initialized beforehand, hence why the EvolutionTree data is initialized here.
static byte[] get(string resource) => Util.GetBinaryResource($"evos_{resource}.pkl");
static byte[][] unpack(string resource) => Data.UnpackMini(get(resource), resource);
static byte[][] unpack(string resource) => BinLinker.Unpack(get(resource), resource);
Evolves1 = new EvolutionTree(new[] { get("rby") }, Gen1, PersonalTable.Y, Legal.MaxSpeciesID_1);
Evolves2 = new EvolutionTree(new[] { get("gsc") }, Gen2, PersonalTable.C, Legal.MaxSpeciesID_2);

View file

@ -279,7 +279,7 @@ namespace PKHeX.Core
data.AddLine(result);
}
public static void VerifyVersionEvolution(LegalityAnalysis data)
public void VerifyVersionEvolution(LegalityAnalysis data)
{
var pkm = data.pkm;
if (pkm.Format < 7 || data.EncounterMatch.Species == pkm.Species)

View file

@ -192,8 +192,8 @@ namespace PKHeX.Core
private static void PopulateGen3Tutors()
{
// Update Gen3 data with Emerald's data, FR/LG is a subset of Emerald's compatibility.
var TMHM = Data.UnpackMini(Util.GetBinaryResource("hmtm_g3.pkl"), "g3");
var tutors = Data.UnpackMini(Util.GetBinaryResource("tutors_g3.pkl"), "g3");
var TMHM = BinLinker.Unpack(Util.GetBinaryResource("hmtm_g3.pkl"), "g3");
var tutors = BinLinker.Unpack(Util.GetBinaryResource("tutors_g3.pkl"), "g3");
for (int i = 0; i <= Legal.MaxSpeciesID_3; i++)
{
E[i].AddTMHM(TMHM[i]);
@ -203,7 +203,7 @@ namespace PKHeX.Core
private static void PopulateGen4Tutors()
{
var tutors = Data.UnpackMini(Util.GetBinaryResource("tutors_g4.pkl"), "g4");
var tutors = BinLinker.Unpack(Util.GetBinaryResource("tutors_g4.pkl"), "g4");
for (int i = 0; i < tutors.Length; i++)
HGSS[i].AddTypeTutors(tutors[i]);
}