mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-23 19:03:11 +00:00
88830e0d00
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)
85 lines
2.7 KiB
C#
85 lines
2.7 KiB
C#
using System;
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
public sealed class SecretBase3
|
|
{
|
|
private readonly byte[] Data;
|
|
private readonly int Offset;
|
|
private bool Japanese => Language == (int) LanguageID.Japanese;
|
|
|
|
public SecretBase3(byte[] data, int offset)
|
|
{
|
|
Data = data;
|
|
Offset = offset;
|
|
}
|
|
|
|
public int SecretBaseLocation { get => Data[Offset + 0]; set => Data[Offset + 0] = (byte) value; }
|
|
|
|
public int OT_Gender
|
|
{
|
|
get => (Data[Offset + 1] >> 4) & 1;
|
|
set => Data[Offset + 1] = (byte) ((Data[Offset + 1] & 0xEF) | ((value & 1) << 4));
|
|
}
|
|
|
|
public bool BattledToday
|
|
{
|
|
get => ((Data[Offset + 1] >> 5) & 1) == 1;
|
|
set => Data[Offset + 1] = (byte)((Data[Offset + 1] & 0xDF) | ((value ? 1 : 0) << 5));
|
|
}
|
|
|
|
public int RegistryStatus
|
|
{
|
|
get => (Data[Offset + 1] >> 6) & 3;
|
|
set => Data[Offset + 1] = (byte)((Data[Offset + 1] & 0x3F) | ((value & 3) << 6));
|
|
}
|
|
|
|
public string OT_Name
|
|
{
|
|
get => StringConverter3.GetString(Data.AsSpan(Offset + 2, 7), Japanese);
|
|
set => StringConverter3.SetString(Data.AsSpan(Offset + 2, 7), value, 7, Japanese, StringConverterOption.ClearFF);
|
|
}
|
|
|
|
public uint OT_ID
|
|
{
|
|
get => ReadUInt32LittleEndian(Data.AsSpan(Offset + 9));
|
|
set => WriteUInt32LittleEndian(Data.AsSpan(Offset + 9), value);
|
|
}
|
|
|
|
public int OT_Class => Data[Offset + 9] % 5;
|
|
public int Language { get => Data[Offset + 0x0D]; set => Data[Offset + 0x0D] = (byte)value; }
|
|
|
|
public ushort SecretBasesReceived
|
|
{
|
|
get => ReadUInt16LittleEndian(Data.AsSpan(Offset + 0x0E));
|
|
set => WriteUInt16LittleEndian(Data.AsSpan(Offset + 0x0E), value);
|
|
}
|
|
|
|
public byte TimesEntered { get => Data[Offset + 0x10]; set => Data[Offset + 0x10] = value; }
|
|
public int Unused11 { get => Data[Offset + 0x11]; set => Data[Offset + 0x11] = (byte)value; } // alignment padding
|
|
|
|
public Span<byte> GetDecorations() => Data.AsSpan(Offset + 0x12, 0x10);
|
|
public void SetDecorations(Span<byte> value) => value.CopyTo(Data.AsSpan(Offset + 0x12, 0x10));
|
|
|
|
public Span<byte> GetDecorationCoordinates() => Data.Slice(Offset + 0x22, 0x10);
|
|
public void SetDecorationCoordinates(Span<byte> value) => value.CopyTo(Data.AsSpan(Offset + 0x22, 0x10));
|
|
|
|
public SecretBase3Team Team
|
|
{
|
|
get => new(Data.Slice(Offset + 50, 72));
|
|
set => value.Write().CopyTo(Data, Offset + 50);
|
|
}
|
|
|
|
public int TID16
|
|
{
|
|
get => (ushort)OT_ID;
|
|
set => OT_ID = (ushort)(SID16 | (ushort)value);
|
|
}
|
|
|
|
public int SID16
|
|
{
|
|
get => (ushort)OT_ID >> 8;
|
|
set => OT_ID = (ushort)(((ushort)value << 16) | TID16);
|
|
}
|
|
}
|