Add PBR Poké Coupons accessor (#4230)

This commit is contained in:
abcboy101 2024-03-21 06:56:28 -07:00 committed by GitHub
parent c1b98025f7
commit 21a1d5fe6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -157,14 +157,14 @@ public static bool IsChecksumsValid(Span<byte> sav)
private string GetOTName(int slot)
{
var ofs = 0x390 + (0x6FF00 * slot);
var ofs = 0x390 + (SIZE_SLOT * slot);
var span = Data.AsSpan(ofs, 16);
return GetString(span);
}
private void SetOTName(int slot, ReadOnlySpan<char> name)
{
var ofs = 0x390 + (0x6FF00 * slot);
var ofs = 0x390 + (SIZE_SLOT * slot);
var span = Data.AsSpan(ofs, 16);
SetString(span, name, 7, StringConverterOption.ClearZero);
}
@ -175,6 +175,17 @@ private void SetOTName(int slot, ReadOnlySpan<char> name)
public override int GetPartyOffset(int slot) => Party + (SIZE_PARTY * slot);
public override int GetBoxOffset(int box) => Box + (SIZE_STORED * box * 30);
public override uint Money
{
get => (uint)((Data[(_currentSlot * SIZE_SLOT) + 0x12861] << 16) | (Data[(_currentSlot * SIZE_SLOT) + 0x12862] << 8) | Data[(_currentSlot * SIZE_SLOT) + 0x12863]);
set
{
Data[(_currentSlot * SIZE_SLOT) + 0x12861] = (byte)((value >> 16) & 0xFF);
Data[(_currentSlot * SIZE_SLOT) + 0x12862] = (byte)((value >> 8) & 0xFF);
Data[(_currentSlot * SIZE_SLOT) + 0x12863] = (byte)(value & 0xFF);
}
}
public override ushort TID16
{
get => (ushort)((Data[(_currentSlot * SIZE_SLOT) + 0x12867] << 8) | Data[(_currentSlot * SIZE_SLOT) + 0x12860]);