2022-11-25 01:42:17 +00:00
|
|
|
using System;
|
|
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
|
|
|
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
2023-12-04 04:13:20 +00:00
|
|
|
public sealed class MyStatus9(SAV9SV sav, SCBlock block) : SaveBlock<SAV9SV>(sav, block.Data)
|
2022-11-25 01:42:17 +00:00
|
|
|
{
|
2023-01-22 04:02:33 +00:00
|
|
|
public uint ID32
|
|
|
|
{
|
|
|
|
get => ReadUInt32LittleEndian(Data);
|
|
|
|
set => WriteUInt32LittleEndian(Data, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public ushort TID16
|
2022-11-25 01:42:17 +00:00
|
|
|
{
|
|
|
|
get => ReadUInt16LittleEndian(Data.AsSpan(0x00));
|
2023-01-22 04:02:33 +00:00
|
|
|
set => WriteUInt16LittleEndian(Data.AsSpan(0x00), value);
|
2022-11-25 01:42:17 +00:00
|
|
|
}
|
|
|
|
|
2023-01-22 04:02:33 +00:00
|
|
|
public ushort SID16
|
2022-11-25 01:42:17 +00:00
|
|
|
{
|
|
|
|
get => ReadUInt16LittleEndian(Data.AsSpan(0x02));
|
2023-01-22 04:02:33 +00:00
|
|
|
set => WriteUInt16LittleEndian(Data.AsSpan(0x02), value);
|
2022-11-25 01:42:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public int Game
|
|
|
|
{
|
|
|
|
get => Data[0x04];
|
|
|
|
set => Data[0x04] = (byte)value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int Gender
|
|
|
|
{
|
|
|
|
get => Data[0x05];
|
|
|
|
set => Data[0x05] = (byte)value;
|
|
|
|
}
|
|
|
|
|
|
|
|
// A6
|
|
|
|
public int Language
|
|
|
|
{
|
|
|
|
get => Data[Offset + 0x07];
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value == Language)
|
|
|
|
return;
|
|
|
|
Data[Offset + 0x07] = (byte)value;
|
|
|
|
|
|
|
|
// For runtime language, the game shifts all languages above Language 6 (unused) down one.
|
|
|
|
if (value >= 6)
|
|
|
|
value--;
|
2022-11-27 18:52:01 +00:00
|
|
|
SAV.SetValue(SaveBlockAccessor9SV.KGameLanguage, value); // Int32
|
2022-11-25 01:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private Span<byte> OT_Trash => Data.AsSpan(0x10, 0x1A);
|
|
|
|
|
|
|
|
public string OT
|
|
|
|
{
|
|
|
|
get => SAV.GetString(OT_Trash);
|
2023-01-22 04:02:33 +00:00
|
|
|
set => SAV.SetString(OT_Trash, value, SAV.MaxStringLengthOT, StringConverterOption.ClearZero);
|
2022-11-25 01:42:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public byte BirthMonth { get => Data[0x5A]; set => Data[0x5A] = value; }
|
|
|
|
public byte BirthDay { get => Data[0x5B]; set => Data[0x5B] = value; }
|
|
|
|
}
|