From 4f568b1497bd32e9872b5ec2126dcb566b4cfbb7 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 23 Feb 2024 13:20:59 -0600 Subject: [PATCH] Add slot-set Count update bypass setting --- PKHeX.Core/Saves/SAV6.cs | 3 ++- PKHeX.Core/Saves/SAV7.cs | 3 ++- PKHeX.Core/Saves/SAV8BS.cs | 3 ++- PKHeX.Core/Saves/SAV8SWSH.cs | 3 ++- PKHeX.Core/Saves/SAV9SV.cs | 3 ++- PKHeX.Core/Saves/SaveFile.cs | 1 + PKHeX.WinForms/MainWindow/Main.cs | 8 ++++++-- PKHeX.WinForms/Properties/PKHeXSettings.cs | 3 +++ 8 files changed, 20 insertions(+), 7 deletions(-) diff --git a/PKHeX.Core/Saves/SAV6.cs b/PKHeX.Core/Saves/SAV6.cs index 8a5356b56..06b9a1270 100644 --- a/PKHeX.Core/Saves/SAV6.cs +++ b/PKHeX.Core/Saves/SAV6.cs @@ -142,7 +142,8 @@ public abstract class SAV6 : SAV_BEEF, ITrainerStatRecord, ISaveBlock6Core, IReg } pk.RefreshChecksum(); - AddCountAcquired(pk); + if (SetUpdateRecords != PKMImportSetting.Skip) + AddCountAcquired(pk); } private void AddCountAcquired(PKM pk) diff --git a/PKHeX.Core/Saves/SAV7.cs b/PKHeX.Core/Saves/SAV7.cs index 6764941ac..c8f4a0d94 100644 --- a/PKHeX.Core/Saves/SAV7.cs +++ b/PKHeX.Core/Saves/SAV7.cs @@ -183,7 +183,8 @@ public abstract class SAV7 : SAV_BEEF, ITrainerStatRecord, ISaveBlock7Main, IReg pk7.FormArgumentRemain = (byte)GetFormArgument(pk); pk.RefreshChecksum(); - AddCountAcquired(pk); + if (SetUpdateRecords != PKMImportSetting.Skip) + AddCountAcquired(pk); } private void AddCountAcquired(PKM pk) diff --git a/PKHeX.Core/Saves/SAV8BS.cs b/PKHeX.Core/Saves/SAV8BS.cs index bd57bef71..346b9002c 100644 --- a/PKHeX.Core/Saves/SAV8BS.cs +++ b/PKHeX.Core/Saves/SAV8BS.cs @@ -308,7 +308,8 @@ public sealed class SAV8BS : SaveFile, ISaveFileRevision, ITrainerStatRecord, IE pb8.Trade(this, now.Day, now.Month, now.Year); pb8.RefreshChecksum(); - AddCountAcquired(pb8); + if (SetUpdateRecords != PKMImportSetting.Skip) + AddCountAcquired(pk); } private void AddCountAcquired(PKM pk) diff --git a/PKHeX.Core/Saves/SAV8SWSH.cs b/PKHeX.Core/Saves/SAV8SWSH.cs index daed71a51..53ec75eda 100644 --- a/PKHeX.Core/Saves/SAV8SWSH.cs +++ b/PKHeX.Core/Saves/SAV8SWSH.cs @@ -201,7 +201,8 @@ public sealed class SAV8SWSH : SaveFile, ISaveBlock8SWSH, ITrainerStatRecord, IS } pk8.RefreshChecksum(); - AddCountAcquired(pk8); + if (SetUpdateRecords != PKMImportSetting.Skip) + AddCountAcquired(pk8); } private static uint GetFormArgument(PKM pk) diff --git a/PKHeX.Core/Saves/SAV9SV.cs b/PKHeX.Core/Saves/SAV9SV.cs index a4e7dc6c2..890ae86d8 100644 --- a/PKHeX.Core/Saves/SAV9SV.cs +++ b/PKHeX.Core/Saves/SAV9SV.cs @@ -207,7 +207,8 @@ public sealed class SAV9SV : SaveFile, ISaveBlock9Main, ISCBlockArray, ISaveFile } pk9.RefreshChecksum(); - AddCountAcquired(pk9); + if (SetUpdateRecords != PKMImportSetting.Skip) + AddCountAcquired(pk9); } private static uint GetFormArgument(PKM pk) diff --git a/PKHeX.Core/Saves/SaveFile.cs b/PKHeX.Core/Saves/SaveFile.cs index 9ca3b413a..54bd49b81 100644 --- a/PKHeX.Core/Saves/SaveFile.cs +++ b/PKHeX.Core/Saves/SaveFile.cs @@ -318,6 +318,7 @@ public abstract class SaveFile : ITrainerInfo, IGameValueLimit, IBoxDetailWallpa #region Slot Storing public static PKMImportSetting SetUpdateDex { protected get; set; } = PKMImportSetting.Update; public static PKMImportSetting SetUpdatePKM { protected get; set; } = PKMImportSetting.Update; + public static PKMImportSetting SetUpdateRecords { protected get; set; } = PKMImportSetting.Update; public abstract Type PKMType { get; } protected abstract PKM GetPKM(byte[] data); diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index e87e08779..8cbc4146e 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -411,8 +411,12 @@ public partial class Main : Form PKME_Tabs.UpdateUnicode(GenderSymbols); SpriteName.AllowShinySprite = settings.Sprite.ShinySprites; SpriteBuilderUtil.SpriterPreference = settings.Sprite.SpritePreference; - SaveFile.SetUpdateDex = settings.SlotWrite.SetUpdateDex ? PKMImportSetting.Update : PKMImportSetting.Skip; - SaveFile.SetUpdatePKM = settings.SlotWrite.SetUpdatePKM ? PKMImportSetting.Update : PKMImportSetting.Skip; + + var write = settings.SlotWrite; + SaveFile.SetUpdateDex = write.SetUpdateDex ? PKMImportSetting.Update : PKMImportSetting.Skip; + SaveFile.SetUpdatePKM = write.SetUpdatePKM ? PKMImportSetting.Update : PKMImportSetting.Skip; + SaveFile.SetUpdateRecords = write.SetUpdateRecords ? PKMImportSetting.Update : PKMImportSetting.Skip; + C_SAV.ModifyPKM = PKME_Tabs.ModifyPKM = settings.SlotWrite.SetUpdatePKM; CommonEdits.ShowdownSetIVMarkings = settings.Import.ApplyMarkings; CommonEdits.ShowdownSetBehaviorNature = settings.Import.ApplyNature; diff --git a/PKHeX.WinForms/Properties/PKHeXSettings.cs b/PKHeX.WinForms/Properties/PKHeXSettings.cs index ad33f33ed..75e073e05 100644 --- a/PKHeX.WinForms/Properties/PKHeXSettings.cs +++ b/PKHeX.WinForms/Properties/PKHeXSettings.cs @@ -383,6 +383,9 @@ public sealed class SlotWriteSettings [LocalizedDescription("Automatically adapt the PKM Info to the Save File (Handler, Format)")] public bool SetUpdatePKM { get; set; } = true; + [LocalizedDescription("Automatically increment the Save File's counters for obtained Pokémon (eggs/captures) when injecting a PKM.")] + public bool SetUpdateRecords { get; set; } = true; + [LocalizedDescription("When enabled and closing/loading a save file, the program will alert if the current save file has been modified without saving.")] public bool ModifyUnset { get; set; } = true; }