From c9587c16c7357be1026e8f8b7cde38ff2981fdfd Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 30 Oct 2020 22:44:08 -0700 Subject: [PATCH] Adapt dropped/opened PKM to currently loaded savefile Closes #3067 --- PKHeX.Core/Saves/SaveFile.cs | 12 +++++++++++- PKHeX.WinForms/MainWindow/Main.cs | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/PKHeX.Core/Saves/SaveFile.cs b/PKHeX.Core/Saves/SaveFile.cs index 175b2eed1..955fb77d5 100644 --- a/PKHeX.Core/Saves/SaveFile.cs +++ b/PKHeX.Core/Saves/SaveFile.cs @@ -457,10 +457,20 @@ protected virtual void SetPartyValues(PKM pkm, bool isParty) pkm.Stat_Level = pkm.CurrentLevel; } - protected void UpdatePKM(PKM pkm, PKMImportSetting trade, PKMImportSetting dex) + /// + /// Conditions a for this save file as if it was traded to it. + /// + /// Entity to adapt + /// Setting on whether or not to adapt + public void AdaptPKM(PKM pkm, PKMImportSetting trade = PKMImportSetting.UseDefault) { if (GetTradeUpdateSetting(trade)) SetPKM(pkm); + } + + protected void UpdatePKM(PKM pkm, PKMImportSetting trade, PKMImportSetting dex) + { + AdaptPKM(pkm, trade); if (GetDexUpdateSetting(dex)) SetDex(pkm); } diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index 53a16d55c..fa5a4dd30 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -627,6 +627,7 @@ private bool OpenPKM(PKM pk) Debug.WriteLine(c); if (tmp == null) return false; + C_SAV.SAV.AdaptPKM(tmp); PKME_Tabs.PopulateFields(tmp); return true; } @@ -656,6 +657,7 @@ private bool OpenMysteryGift(MysteryGift tg, string path) return true; } + C_SAV.SAV.AdaptPKM(pk); PKME_Tabs.PopulateFields(pk); Debug.WriteLine(c); return true;