SAV1 can implement IEventWorkArray<byte> (#4061)

This commit is contained in:
Fábio H. Attard
2023-11-13 04:05:55 -03:00
committed by GitHub
parent 9df8f16ed3
commit 5ede6feb38
2 changed files with 9 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ namespace PKHeX.Core;
/// <summary>
/// Generation 1 <see cref="SaveFile"/> object.
/// </summary>
public sealed class SAV1 : SaveFile, ILangDeviantSave, IEventFlagArray
public sealed class SAV1 : SaveFile, ILangDeviantSave, IEventFlagArray, IEventWorkArray<byte>
{
protected internal override string ShortSummary => $"{OT} ({Version}) - {PlayTimeString}";
public override string Extension => ".sav";
@@ -164,6 +164,11 @@ public void SetEventFlag(int flagNumber, bool value)
SetFlag(Offsets.EventFlag + (flagNumber >> 3), flagNumber & 7, value);
}
// Event Work
public int EventWorkCount => 0x100;
public byte GetWork(int index) => Data[Offsets.EventWork + index];
public void SetWork(int index, byte value) => Data[Offsets.EventWork + index] = value;
protected override byte[] GetFinalData()
{
var capacity = Japanese ? PokeListType.StoredJP : PokeListType.Stored;

View File

@@ -22,6 +22,7 @@ private static SAV1Offsets GetINT() => new()
CurrentBoxIndex = 0x284C,
Coin = 0x2850,
ObjectSpawnFlags = 0x2852, // 2 bytes after Coin
EventWork = 0x289C,
Starter = 0x29C3,
EventFlag = 0x29F3,
PlayTime = 0x2CED,
@@ -48,6 +49,7 @@ private static SAV1Offsets GetJPN() => new()
CurrentBoxIndex = 0x2842,
Coin = 0x2846,
ObjectSpawnFlags = 0x2848, // 2 bytes after Coin
EventWork = 0x2892,
Starter = 0x29B9,
EventFlag = 0x29E9,
PlayTime = 0x2CA0,
@@ -75,6 +77,7 @@ private static SAV1Offsets GetJPN() => new()
public int ObjectSpawnFlags { get; private init; }
public int Starter { get; private init; }
public int EventFlag { get; private init; }
public int EventWork { get; private init; }
public int PlayTime { get; private init; }
public int Daycare { get; private init; }
public int Party { get; private init; }