Add slot-set Count update bypass setting

This commit is contained in:
Kurt 2024-02-23 13:20:59 -06:00
parent 4974371100
commit 4f568b1497
8 changed files with 20 additions and 7 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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);

View file

@ -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;

View file

@ -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;
}