From 6e94eaaaeed85ac6b970d3f043453c59d262fd35 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 6 May 2022 10:42:08 -0700 Subject: [PATCH] Add overload for ITrainerInfo blank fetch --- PKHeX.Core/PKM/Util/EntityBlank.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/PKHeX.Core/PKM/Util/EntityBlank.cs b/PKHeX.Core/PKM/Util/EntityBlank.cs index de892f037..aa2e804d9 100644 --- a/PKHeX.Core/PKM/Util/EntityBlank.cs +++ b/PKHeX.Core/PKM/Util/EntityBlank.cs @@ -30,8 +30,20 @@ public static PKM GetBlank(Type type) _ => GetBlank(gen), }; + /// + /// Gets a Blank object compatible with the provided inputs. + /// + public static PKM GetBlank(ITrainerInfo tr) + { + if (tr is SaveFile s) + return s.BlankPKM; + return GetBlank(tr.Generation, tr.Game); + } + + /// public static PKM GetBlank(int gen, int ver) => GetBlank(gen, (GameVersion)ver); + /// public static PKM GetBlank(int gen) { var type = Type.GetType($"PKHeX.Core.PK{gen}");