PKHeX/PKHeX.Core/Saves/Substructures/Gen9/MyStatus9.cs
Kurt 88830e0d00
Update from .NET Framework 4.6 to .NET 7 (#3729)
Updates from net46->net7, dropping support for mono in favor of using the latest runtime (along with the performance/API improvements). Releases will be posted as 64bit only for now.

Refactors a good amount of internal API methods to be more performant and more customizable for future updates & fixes.

Adds functionality for Batch Editor commands to `>`, `<` and <=/>=

TID/SID properties renamed to TID16/SID16 for clarity; other properties exposed for Gen7 / display variants.

Main window has a new layout to account for DPI scaling (8 point grid)

Fixed: Tatsugiri and Paldean Tauros now output Showdown form names as Showdown expects
Changed: Gen9 species now interact based on the confirmed National Dex IDs (closes #3724)
Fixed: Pokedex set all no longer clears species with unavailable non-base forms (closes #3720)
Changed: Hyper Training suggestions now apply for level 50 in SV. (closes #3714)
Fixed: B2/W2 hatched egg met locations exclusive to specific versions are now explicitly checked (closes #3691)
Added: Properties for ribbon/mark count (closes #3659)
Fixed: Traded SV eggs are now checked correctly (closes #3692)
2023-01-21 20:02:33 -08:00

67 lines
1.7 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 uint ID32
{
get => ReadUInt32LittleEndian(Data);
set => WriteUInt32LittleEndian(Data, value);
}
public ushort TID16
{
get => ReadUInt16LittleEndian(Data.AsSpan(0x00));
set => WriteUInt16LittleEndian(Data.AsSpan(0x00), value);
}
public ushort SID16
{
get => ReadUInt16LittleEndian(Data.AsSpan(0x02));
set => WriteUInt16LittleEndian(Data.AsSpan(0x02), 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, SAV.MaxStringLengthOT, StringConverterOption.ClearZero);
}
public byte BirthMonth { get => Data[0x5A]; set => Data[0x5A] = value; }
public byte BirthDay { get => Data[0x5B]; set => Data[0x5B] = value; }
}