From 6611e874c39aa8da0906f48b0cd1e80b45e8b60e Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 18 Sep 2017 22:36:06 -0700 Subject: [PATCH] more usum prep species added requires the 'latest personal table' reference to be USUM's; the other referencs for .SM are fine as there's no possibility to have a species ID high enough for it to matter. --- PKHeX.Core/Legality/Checks.cs | 2 +- PKHeX.Core/MysteryGifts/WC7.cs | 2 +- PKHeX.Core/PKM/PK7.cs | 2 +- PKHeX.Core/PKM/PKX.cs | 2 +- PKHeX.Core/Saves/SAV7.cs | 2 +- PKHeX.Core/Saves/SaveFile.cs | 1 + PKHeX.Core/Saves/Substructures/QR7.cs | 4 ++-- Tests/PKHeX.Tests/PKM/PIDIVTests.cs | 4 ++-- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/PKHeX.Core/Legality/Checks.cs b/PKHeX.Core/Legality/Checks.cs index f2f1a2859..e8c127727 100644 --- a/PKHeX.Core/Legality/Checks.cs +++ b/PKHeX.Core/Legality/Checks.cs @@ -1373,7 +1373,7 @@ private CheckResult VerifyHistory() } else if (EncounterMatch is WC7 wc7 && wc7.OT.Length > 0) { - if (pkm.OT_Friendship != PersonalTable.SM[EncounterMatch.Species].BaseFriendship) + if (pkm.OT_Friendship != PersonalTable.USUM[EncounterMatch.Species].BaseFriendship) return new CheckResult(Severity.Invalid, V132, CheckIdentifier.History); if (pkm.OT_Affection != 0) return new CheckResult(Severity.Invalid, V133, CheckIdentifier.History); diff --git a/PKHeX.Core/MysteryGifts/WC7.cs b/PKHeX.Core/MysteryGifts/WC7.cs index 9a17fd43a..71f0031e3 100644 --- a/PKHeX.Core/MysteryGifts/WC7.cs +++ b/PKHeX.Core/MysteryGifts/WC7.cs @@ -305,7 +305,7 @@ public override PKM ConvertToPKM(SaveFile SAV) int currentLevel = Level > 0 ? Level : (int)(Util.Rand32()%100 + 1); int metLevel = MetLevel > 0 ? MetLevel : currentLevel; - var pi = PersonalTable.SM.GetFormeEntry(Species, Form); + var pi = PersonalTable.USUM.GetFormeEntry(Species, Form); PK7 pk = new PK7 { Species = Species, diff --git a/PKHeX.Core/PKM/PK7.cs b/PKHeX.Core/PKM/PK7.cs index 97330e515..21609e7e9 100644 --- a/PKHeX.Core/PKM/PK7.cs +++ b/PKHeX.Core/PKM/PK7.cs @@ -14,7 +14,7 @@ public class PK7 : PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetCommon3, I public sealed override int SIZE_PARTY => PKX.SIZE_6PARTY; public override int SIZE_STORED => PKX.SIZE_6STORED; public override int Format => 7; - public override PersonalInfo PersonalInfo => PersonalTable.SM.GetFormeEntry(Species, AltForm); + public override PersonalInfo PersonalInfo => PersonalTable.USUM.GetFormeEntry(Species, AltForm); public PK7(byte[] decryptedData = null, string ident = null) { diff --git a/PKHeX.Core/PKM/PKX.cs b/PKHeX.Core/PKM/PKX.cs index 5e8b1a559..fc745c811 100644 --- a/PKHeX.Core/PKM/PKX.cs +++ b/PKHeX.Core/PKM/PKX.cs @@ -9,7 +9,7 @@ namespace PKHeX.Core /// public static class PKX { - private static readonly PersonalTable Personal = PersonalTable.SM; + private static readonly PersonalTable Personal = PersonalTable.USUM; private const int Generation = 7; internal const int SIZE_1ULIST = 69; diff --git a/PKHeX.Core/Saves/SAV7.cs b/PKHeX.Core/Saves/SAV7.cs index 517c6366c..9d5f264f1 100644 --- a/PKHeX.Core/Saves/SAV7.cs +++ b/PKHeX.Core/Saves/SAV7.cs @@ -28,7 +28,7 @@ public SAV7(byte[] data = null) GetSAVOffsets(); HeldItems = Legal.HeldItems_SM; - Personal = PersonalTable.SM; + Personal = USUM ? PersonalTable.USUM : PersonalTable.SM; if (!Exportable) ClearBoxes(); diff --git a/PKHeX.Core/Saves/SaveFile.cs b/PKHeX.Core/Saves/SaveFile.cs index d77c6635f..b8b3bf831 100644 --- a/PKHeX.Core/Saves/SaveFile.cs +++ b/PKHeX.Core/Saves/SaveFile.cs @@ -65,6 +65,7 @@ protected virtual byte[] Write(bool DSV) public abstract int Generation { get; } public PersonalTable Personal { get; set; } + public bool USUM => Data.Length == SaveUtil.SIZE_G7USUM; public bool SM => Data.Length == SaveUtil.SIZE_G7SM; public bool ORASDEMO => Data.Length == SaveUtil.SIZE_G6ORASDEMO; public bool ORAS => Data.Length == SaveUtil.SIZE_G6ORAS; diff --git a/PKHeX.Core/Saves/Substructures/QR7.cs b/PKHeX.Core/Saves/Substructures/QR7.cs index b5ded5945..531036549 100644 --- a/PKHeX.Core/Saves/Substructures/QR7.cs +++ b/PKHeX.Core/Saves/Substructures/QR7.cs @@ -35,8 +35,8 @@ private static byte[] GetRawQR(int species, int formnum, bool shiny, int gender) BitConverter.GetBytes((ushort)species).CopyTo(basedata, 0x28); basedata[0x2A] = (byte)formnum; basedata[0x2C] = (byte)(shiny ? 1 : 0); - var forme_index = PersonalTable.SM[species].FormeIndex(species, formnum); - var raw_gender = PersonalTable.SM[forme_index].Gender; + var forme_index = PersonalTable.USUM[species].FormeIndex(species, formnum); + var raw_gender = PersonalTable.USUM[forme_index].Gender; switch (raw_gender) { case 0: diff --git a/Tests/PKHeX.Tests/PKM/PIDIVTests.cs b/Tests/PKHeX.Tests/PKM/PIDIVTests.cs index e971dbe9a..6f1aea2b1 100644 --- a/Tests/PKHeX.Tests/PKM/PIDIVTests.cs +++ b/Tests/PKHeX.Tests/PKM/PIDIVTests.cs @@ -54,8 +54,8 @@ public void PIDIVMatchingTest3Misc() var gk3 = new PK3(); PIDGenerator.SetValuesFromSeed(gk3, PIDType.CXD, ak3.OriginSeed); - Assert.AreEqual(pk3.PID, gk3.PID, "Unable to match generated PID to Channel spread"); - Assert.IsTrue(pk3.IVs.SequenceEqual(gk3.IVs), "Unable to match generated IVs to Channel spread"); + Assert.AreEqual(pk3.PID, gk3.PID, "Unable to match generated PID to CXD spread"); + Assert.IsTrue(pk3.IVs.SequenceEqual(gk3.IVs), "Unable to match generated IVs to CXD spread"); // Channel Jirachi var pkC = new PK3 {PID = 0x264750D9, IVs = new[] {06, 31, 14, 27, 05, 27}, SID = 45819, OT_Gender = 1, Version = (int)GameVersion.R};