mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-21 18:03:09 +00:00
6002611c80
Closes #3657
61 lines
1.6 KiB
C#
61 lines
1.6 KiB
C#
using System;
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
public sealed class MyStatus9 : SaveBlock<SAV9SV>
|
|
{
|
|
public MyStatus9(SAV9SV sav, SCBlock block) : base(sav, block.Data) { }
|
|
|
|
public int TID
|
|
{
|
|
get => ReadUInt16LittleEndian(Data.AsSpan(0x00));
|
|
set => WriteUInt16LittleEndian(Data.AsSpan(0x00), (ushort)value);
|
|
}
|
|
|
|
public int SID
|
|
{
|
|
get => ReadUInt16LittleEndian(Data.AsSpan(0x02));
|
|
set => WriteUInt16LittleEndian(Data.AsSpan(0x02), (ushort)value);
|
|
}
|
|
|
|
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--;
|
|
SAV.SetValue(SaveBlockAccessor9SV.KGameLanguage, value); // Int32
|
|
}
|
|
}
|
|
|
|
private Span<byte> OT_Trash => Data.AsSpan(0x10, 0x1A);
|
|
|
|
public string OT
|
|
{
|
|
get => SAV.GetString(OT_Trash);
|
|
set => SAV.SetString(OT_Trash, value.AsSpan(), SAV.MaxStringLengthOT, StringConverterOption.ClearZero);
|
|
}
|
|
|
|
public byte BirthMonth { get => Data[0x5A]; set => Data[0x5A] = value; }
|
|
public byte BirthDay { get => Data[0x5B]; set => Data[0x5B] = value; }
|
|
}
|