From e0fb60cdeaa3ee44ac4881608c24d4955886548d Mon Sep 17 00:00:00 2001 From: Jonathan Herbert Date: Fri, 24 Nov 2023 11:50:04 -0400 Subject: [PATCH] =?UTF-8?q?Update=20Pok=C3=A9tch=20Unlocked=20Count=20(#40?= =?UTF-8?q?73)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4067 --- PKHeX.Core/Saves/SAV4Sinnoh.cs | 2 +- PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/PKHeX.Core/Saves/SAV4Sinnoh.cs b/PKHeX.Core/Saves/SAV4Sinnoh.cs index dc9aebabd..4f3b0eb1e 100644 --- a/PKHeX.Core/Saves/SAV4Sinnoh.cs +++ b/PKHeX.Core/Saves/SAV4Sinnoh.cs @@ -70,7 +70,7 @@ public PoketchColor PoketchColor public bool PoketchFlag6 { get => (PoketchPacked & 0x40) != 0; set => PoketchPacked = (byte)(value ? (PoketchPacked | 0x40) : (PoketchPacked & ~0x40)); } public bool PoketchFlag7 { get => (PoketchPacked & 0x80) != 0; set => PoketchPacked = (byte)(value ? (PoketchPacked | 0x80) : (PoketchPacked & ~0x80)); } - public byte Poketch1 { get => General[PoketchStart + 1]; set => General[PoketchStart + 1] = value; } + public byte PoketchUnlockedCount { get => General[PoketchStart + 1]; set => General[PoketchStart + 1] = value; } public sbyte CurrentPoketchApp { get => (sbyte)General[PoketchStart + 2]; set => General[PoketchStart + 2] = (byte)Math.Min((sbyte)PoketchApp.Alarm_Clock, value); } public bool GetPoketchAppUnlocked(PoketchApp index) diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs index 33144a239..f5ae7c834 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs @@ -249,13 +249,16 @@ private void ReadPoketch(SAV4Sinnoh s) private void SavePoketch(SAV4Sinnoh s) { + int unlockedCount = 0; s.CurrentPoketchApp = (sbyte)CB_CurrentApp.SelectedIndex; for (int i = 0; i < CLB_Poketch.Items.Count; i++) { var b = CLB_Poketch.GetItemChecked(i); s.SetPoketchAppUnlocked((PoketchApp)i, b); + if (b) unlockedCount++; } s.SetPoketchDotArtistData(DotArtistByte); + s.PoketchUnlockedCount = (byte)unlockedCount; } private void SetPictureBoxFromFlags(ReadOnlySpan inp)