Add gen4 seal data get/set

closes #2112
adds methods to give/remove all, and get/set to retrieve array or
individual.
This commit is contained in:
Kurt
2018-09-04 15:12:35 -07:00
parent 81f6988d3e
commit cf3aba4f84
2 changed files with 118 additions and 2 deletions

View File

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

View File

@@ -0,0 +1,105 @@
namespace PKHeX.Core
{
/// <summary>
/// Ball Capsule Seals used in Generation 4 save files.
/// </summary>
/// <remarks>80 bytes, one for each seal.</remarks>
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
}
}