PKHeX/PKHeX.Core/Saves/Storage/Bank4.cs
Kurt 034658b764 Remove extra Memory forcing
Closes #4133
Refactors most of the `Trade` methods
Fix default egg friendship to 120
Fix Version value exposed for Gen4 saves (and others)
2024-02-23 17:01:36 -06:00

27 lines
1.2 KiB
C#

using System;
namespace PKHeX.Core;
/// <summary>
/// Generation 4 <see cref="SaveFile"/> object that reads Generation 4 PokeStock .stk dumps.
/// </summary>
public sealed class Bank4 : BulkStorage
{
public Bank4(byte[] data) : base(data, typeof(PK4), 0) => Version = GameVersion.HGSS;
public override GameVersion Version { get => GameVersion.HGSS; set { } }
public override PersonalTable4 Personal => PersonalTable.HGSS;
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_HGSS;
protected override Bank4 CloneInternal() => new((byte[])Data.Clone());
public override string PlayTimeString => Checksums.CRC16Invert(Data).ToString("X4");
protected internal override string ShortSummary => PlayTimeString;
public override string Extension => ".stk";
public override int BoxCount => 64;
private const int BoxNameSize = 0x18;
private int BoxDataSize => SlotsPerBox * SIZE_STORED;
public override int GetBoxOffset(int box) => Box + (BoxDataSize * box);
public override string GetBoxName(int box) => GetString(Data.AsSpan(GetBoxNameOffset(box), BoxNameSize / 2));
private static int GetBoxNameOffset(int box) => 0x3FC00 + (0x19 * box);
}