2019-09-23 23:56:47 +00:00
|
|
|
|
using System;
|
2020-01-16 04:48:19 +00:00
|
|
|
|
using System.Text;
|
2022-01-03 05:35:59 +00:00
|
|
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
2019-09-23 23:56:47 +00:00
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2019-10-04 02:09:02 +00:00
|
|
|
|
public sealed class MyStatus8 : SaveBlock
|
2019-09-23 23:56:47 +00:00
|
|
|
|
{
|
2020-09-09 19:47:24 +00:00
|
|
|
|
public const uint MaxWatt = 9999999;
|
|
|
|
|
|
2019-11-16 01:34:18 +00:00
|
|
|
|
public MyStatus8(SAV8SWSH sav, SCBlock block) : base(sav, block.Data) { }
|
2019-09-23 23:56:47 +00:00
|
|
|
|
|
2020-01-16 04:48:19 +00:00
|
|
|
|
public string Number
|
|
|
|
|
{
|
|
|
|
|
get => Encoding.ASCII.GetString(Data, 0x01, 3);
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
|
Data[0x01 + i] = (byte)(value.Length > i ? value[i] : '\0');
|
2020-12-05 13:36:23 +00:00
|
|
|
|
SAV.State.Edited = true;
|
2020-01-16 04:48:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-24 02:31:10 +00:00
|
|
|
|
public ulong Skin // aka the base model
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x08));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x08), value);
|
2020-01-24 02:31:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-12-02 21:40:09 +00:00
|
|
|
|
public ulong Hair
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x10));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x10), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Brow
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x18));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x18), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Lashes
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x20));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x20), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Contacts
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x28));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x28), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Lips
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x30));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x30), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Glasses
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x38));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x38), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Hat
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x40));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x40), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Jacket
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x48));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x48), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Top
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x50));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x50), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Bag
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x58));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x58), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Gloves
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x60));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x60), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-12-03 18:39:57 +00:00
|
|
|
|
public ulong BottomOrDress
|
2019-12-02 21:40:09 +00:00
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x68));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x68), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Sock
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x70));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x70), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Shoe
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x78));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x78), value);
|
2019-12-02 21:40:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-01-24 02:31:10 +00:00
|
|
|
|
// 80 - 87
|
|
|
|
|
|
|
|
|
|
public ulong MomSkin // aka the base model
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt64LittleEndian(Data.AsSpan(0x88));
|
|
|
|
|
set => WriteUInt64LittleEndian(Data.AsSpan(0x88), value);
|
2020-01-24 02:31:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 8C - 9F
|
2019-12-02 21:40:09 +00:00
|
|
|
|
|
2019-09-23 23:56:47 +00:00
|
|
|
|
public int TID
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt16LittleEndian(Data.AsSpan(0xA0));
|
|
|
|
|
set => WriteUInt16LittleEndian(Data.AsSpan(0xA0), (ushort)value);
|
2019-09-23 23:56:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int SID
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt16LittleEndian(Data.AsSpan(0xA2));
|
|
|
|
|
set => WriteUInt16LittleEndian(Data.AsSpan(0xA2), (ushort)value);
|
2019-09-23 23:56:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Game
|
|
|
|
|
{
|
2019-11-16 01:34:18 +00:00
|
|
|
|
get => Data[0xA4];
|
|
|
|
|
set => Data[0xA4] = (byte)value;
|
2019-09-23 23:56:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Gender
|
|
|
|
|
{
|
2019-11-16 01:34:18 +00:00
|
|
|
|
get => Data[0xA5];
|
|
|
|
|
set => Data[0xA5] = (byte)value;
|
2019-09-23 23:56:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-16 01:34:18 +00:00
|
|
|
|
// A6
|
2019-09-23 23:56:47 +00:00
|
|
|
|
public int Language
|
|
|
|
|
{
|
2019-11-16 01:34:18 +00:00
|
|
|
|
get => Data[Offset + 0xA7];
|
2020-01-18 05:53:51 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
2020-02-04 03:16:30 +00:00
|
|
|
|
if (value == Language)
|
|
|
|
|
return;
|
2020-01-18 05:53:51 +00:00
|
|
|
|
Data[Offset + 0xA7] = (byte) value;
|
2020-02-04 03:16:30 +00:00
|
|
|
|
|
|
|
|
|
// For runtime language, the game shifts all languages above Language 6 (unused) down one.
|
|
|
|
|
if (value >= 6)
|
|
|
|
|
value--;
|
2020-01-24 07:22:54 +00:00
|
|
|
|
((SAV8SWSH)SAV).SetValue(SaveBlockAccessor8SWSH.KGameLanguage, (uint)value);
|
2020-01-18 05:53:51 +00:00
|
|
|
|
}
|
2019-09-23 23:56:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-03 05:35:59 +00:00
|
|
|
|
private Span<byte> OT_Trash =>Data.AsSpan(0xB0, 0x1A);
|
|
|
|
|
|
2019-09-23 23:56:47 +00:00
|
|
|
|
public string OT
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => SAV.GetString(OT_Trash);
|
|
|
|
|
set => SAV.SetString(OT_Trash, value.AsSpan(), SAV.OTLength, StringConverterOption.ClearZero);
|
2019-09-23 23:56:47 +00:00
|
|
|
|
}
|
2019-12-13 00:27:01 +00:00
|
|
|
|
|
|
|
|
|
// D0
|
|
|
|
|
public uint Watt
|
|
|
|
|
{
|
2022-01-03 05:35:59 +00:00
|
|
|
|
get => ReadUInt32LittleEndian(Data.AsSpan(Offset + 0xD0));
|
2019-12-13 00:27:01 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value > MaxWatt)
|
|
|
|
|
value = MaxWatt;
|
2022-01-03 05:35:59 +00:00
|
|
|
|
WriteUInt32LittleEndian(Data.AsSpan(Offset + 0xD0), value);
|
2019-12-13 00:27:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-23 23:56:47 +00:00
|
|
|
|
}
|
2019-12-03 18:39:57 +00:00
|
|
|
|
}
|