From fc676ec64847e05b8479c8bc4ec3f52b067a5a70 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 17 May 2017 21:50:52 -0700 Subject: [PATCH] Flag unparsed pkms With every format now supported, can flag GameVersion=0 pkm --- PKHeX.Core/Legality/Analysis.cs | 13 +++++++------ PKHeX.Core/Legality/LegalityCheckStrings.cs | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/PKHeX.Core/Legality/Analysis.cs b/PKHeX.Core/Legality/Analysis.cs index b51b2d4a1..8265e71fb 100644 --- a/PKHeX.Core/Legality/Analysis.cs +++ b/PKHeX.Core/Legality/Analysis.cs @@ -40,7 +40,7 @@ private IEnumerable AllSuggestedMoves if (Error) return new int[4]; if (_allSuggestedMoves == null) - return _allSuggestedMoves = !pkm.IsOriginValid ? new int[4] : getSuggestedMoves(true, true, true); + return _allSuggestedMoves = pkm == null || !pkm.IsOriginValid ? new int[4] : getSuggestedMoves(true, true, true); return _allSuggestedMoves; } } @@ -51,7 +51,7 @@ private IEnumerable AllSuggestedRelearnMoves if (Error) return new int[4]; if (_allSuggestedRelearnMoves == null) - return _allSuggestedRelearnMoves = !pkm.IsOriginValid ? new int[4] : Legal.getValidRelearn(pkm, -1).ToArray(); + return _allSuggestedRelearnMoves = pkm == null || !pkm.IsOriginValid ? new int[4] : Legal.getValidRelearn(pkm, -1).ToArray(); return _allSuggestedRelearnMoves; } } @@ -86,8 +86,7 @@ public LegalityAnalysis(PKM pk) case 7: parsePK7(pk); break; } - Valid = Parsed = Parse.Any(); - if (Parsed) + if (Parse.Count > 0) { if (Parse.Any(chk => !chk.Valid)) Valid = false; @@ -95,6 +94,8 @@ public LegalityAnalysis(PKM pk) Valid = false; else if (vRelearn.Any(m => m.Valid != true)) Valid = false; + else + Valid = true; if (pkm.FatefulEncounter && vRelearn.Any(chk => !chk.Valid) && EncounterMatch == null) AddLine(Severity.Indeterminate, V188, CheckIdentifier.Fateful); @@ -104,10 +105,10 @@ public LegalityAnalysis(PKM pk) { Console.WriteLine(e.Message); Valid = false; - Parsed = true; AddLine(Severity.Invalid, V190, CheckIdentifier.Misc); Error = true; } + Parsed = true; } private void AddLine(Severity s, string c, CheckIdentifier i) @@ -321,7 +322,7 @@ private void updateChecks() } private string getLegalityReport() { - if (!Parsed) + if (!Parsed || pkm == null) return V189; var lines = new List(); diff --git a/PKHeX.Core/Legality/LegalityCheckStrings.cs b/PKHeX.Core/Legality/LegalityCheckStrings.cs index 52fa64f68..c05f50a2d 100644 --- a/PKHeX.Core/Legality/LegalityCheckStrings.cs +++ b/PKHeX.Core/Legality/LegalityCheckStrings.cs @@ -84,7 +84,7 @@ public static class LegalityCheckStrings public static string V187 {get; set;} = "Species does not exist in origin game."; public static string V188 {get; set;} = "Fateful Encounter with no matching Encounter. Has the Mystery Gift data been contributed?"; - public static string V194 { get; set;} = "Ingame Trade for Sun/Moon not implemented."; // Valid + public static string V194 {get; set;} = "Ingame Trade for Sun/Moon not implemented."; // Valid public static string V250 {get; set;} = "Gender matches PID."; public static string V251 {get; set;} = "PID-Gender mismatch.";