Fixed SecretBase3Team (#4280)

* Fixed SecretBase3Team

* Fixed more offsets

* Fixed Species
This commit is contained in:
BlackShark
2024-05-24 04:00:11 +02:00
committed by GitHub
parent d4f8c2a5e5
commit 68ea86cc72
3 changed files with 14 additions and 7 deletions

View File

@@ -5,6 +5,8 @@ namespace PKHeX.Core;
public sealed class SecretBase3(Memory<byte> raw)
{
public const int SIZE = 160;
private Span<byte> Data => raw.Span;
private bool Japanese => Language == (int) LanguageID.Japanese;
@@ -59,7 +61,7 @@ public ushort SecretBasesReceived
public Span<byte> GetDecorationCoordinates() => Data.Slice(0x22, 0x10);
public void SetDecorationCoordinates(Span<byte> value) => value.CopyTo(GetDecorationCoordinates());
private Span<byte> TeamData => Data.Slice(50, 72);
private Span<byte> TeamData => Data.Slice(0x34, 108);
public SecretBase3Team Team
{
get => new(TeamData.ToArray());

View File

@@ -11,7 +11,12 @@ public sealed class SecretBase3PKM : ISpeciesForm
public ushort Move2 { get; set; }
public ushort Move3 { get; set; }
public ushort Move4 { get; set; }
public ushort Species { get; set; }
public ushort SpeciesInternal { get; set; }
public ushort Species
{
get => SpeciesConverter.GetNational3(SpeciesInternal);
set => SpeciesInternal = SpeciesConverter.GetInternal3(value);
}
public ushort HeldItem { get; set; }
public byte Level { get; set; }
public byte EVAll { get; set; }

View File

@@ -7,10 +7,10 @@ public sealed class SecretBase3Team
{
private const int O_PID = 0;
private const int O_Moves = 0x18;
private const int O_Species = 0x24;
private const int O_Item = 0x30;
private const int O_Level = 0x3C;
private const int O_EV = 0x42;
private const int O_Species = 0x48;
private const int O_Item = 0x54;
private const int O_Level = 0x60;
private const int O_EV = 0x66;
private static int GetOffsetPID(int index) => O_PID + (index * 4);
private static int GetOffsetMove(int index, int moveIndex) => O_Moves + (index * 8) + (moveIndex * 2);
@@ -22,10 +22,10 @@ public sealed class SecretBase3Team
public SecretBase3Team(byte[] data)
{
Data = data;
Team = new SecretBase3PKM[6];
for (int i = 0; i < Team.Length; i++)
Team[i] = GetPKM(i);
Data = data;
}
public byte[] Write()