diff --git a/PKHeX.Core/Saves/SAV4.cs b/PKHeX.Core/Saves/SAV4.cs index b9c015005..1466646a3 100644 --- a/PKHeX.Core/Saves/SAV4.cs +++ b/PKHeX.Core/Saves/SAV4.cs @@ -232,7 +232,8 @@ private void GetSAVOffsets() OFS_UG_Stats = 0x3A2C + GBO; - _currentPoketchApp = 0x114E; + _currentPoketchApp = 0x114E + GBO; + Seal = 0x6178 + GBO; break; case GameVersion.Pt: AdventureInfo = 0 + GBO; @@ -268,7 +269,8 @@ private void GetSAVOffsets() OFS_UG_Stats = 0x3CB4 + GBO; - _currentPoketchApp = 0x1162; + _currentPoketchApp = 0x1162 + GBO; + Seal = 0x6494 + GBO; break; case GameVersion.HGSS: AdventureInfo = 0 + GBO; @@ -301,12 +303,14 @@ private void GetSAVOffsets() Daycare = 0x15FC + GBO; OFS_WALKER = 0xE70C + GBO; Box = 0xF700 + SBO; + Seal = 0x4E20 + GBO; break; } } private int WondercardFlags = int.MinValue; private int AdventureInfo = int.MinValue; + private int Seal = int.MinValue; // Inventory private ushort[] LegalItems, LegalKeyItems, LegalTMHMs, LegalMedicine, LegalBerries, LegalBalls, LegalBattleItems, LegalMailItems; @@ -1239,5 +1243,12 @@ public override byte[] SetString(string value, int maxLength, int PadToSize = 0, PadToSize = maxLength + 1; return StringConverter.SetString4(value, maxLength, PadToSize, PadWith); } + + // Seals + public byte[] SealCase { get => GetData(Seal, (int) Seal4.MAX); set => SetData(value, Seal); } + public byte GetSealCount(Seal4 id) => Data[Seal + (int)id]; + public byte SetSealCount(Seal4 id, byte value) => Data[Seal + (int)id] = value; + public void GiveAllSeals() => Enumerable.Repeat((byte)0xFF, (int) Seal4.MAX).CopyTo(Data, Seal); + public void ClearAllSeals() => Enumerable.Repeat((byte)0, (int)Seal4.MAX).CopyTo(Data, Seal); } } diff --git a/PKHeX.Core/Saves/Substructures/Gen4/Seal4.cs b/PKHeX.Core/Saves/Substructures/Gen4/Seal4.cs new file mode 100644 index 000000000..65ff0d221 --- /dev/null +++ b/PKHeX.Core/Saves/Substructures/Gen4/Seal4.cs @@ -0,0 +1,105 @@ +namespace PKHeX.Core +{ + /// + /// Ball Capsule Seals used in Generation 4 save files. + /// + /// 80 bytes, one for each seal. + public enum Seal4 + { + HeartA, + HeartB, + HeartC, + HeartD, + HeartE, + HeartF, + + StarA, + StarB, + StarC, + StarD, + StarE, + StarF, + + LineA, + LineB, + LineC, + LineD, + + SmokeA, + SmokeB, + SmokeC, + SmokeD, + + ElectricA, + ElectricB, + ElectricC, + ElectricD, + + FoamyA, + FoamyB, + FoamyC, + FoamyD, + + FireA, + FireB, + FireC, + FireD, + + PartyA, + PartyB, + PartyC, + PartyD, + + FloraA, + FloraB, + FloraC, + FloraD, + FloraE, + FloraF, + + SongA, + SongB, + SongC, + SongD, + SongE, + SongF, + SongG, + + LetterA, + LetterB, + LetterC, + LetterD, + LetterE, + LetterF, + LetterG, + LetterH, + LetterI, + LetterJ, + LetterK, + LetterL, + LetterM, + LetterN, + LetterO, + LetterP, + LetterQ, + LetterR, + LetterS, + LetterT, + LetterU, + LetterV, + LetterW, + LetterX, + LetterY, + LetterZ, + + Shock, + Mystery, + + // Unreleased + Liquid, + Burst, + Twinkle, + + MAX + } +}