2018-07-08 07:26:31 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2019-10-04 02:09:02 +00:00
|
|
|
|
public sealed class SecretBase3
|
2018-07-08 07:26:31 +00:00
|
|
|
|
{
|
|
|
|
|
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; }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2018-07-08 07:26:31 +00:00
|
|
|
|
public int OT_Gender
|
|
|
|
|
{
|
|
|
|
|
get => (Data[Offset + 1] >> 4) & 1;
|
|
|
|
|
set => Data[Offset + 1] = (byte) ((Data[Offset + 1] & 0xEF) | (value & 1) << 4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string OT_Name
|
|
|
|
|
{
|
2019-03-21 04:50:44 +00:00
|
|
|
|
get => StringConverter3.GetString3(Data, Offset + 2, 7, Japanese);
|
|
|
|
|
set => StringConverter3.SetString3(value, 7, Japanese, 7).CopyTo(Data, Offset + 2);
|
2018-07-08 07:26:31 +00:00
|
|
|
|
}
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2018-07-08 07:26:31 +00:00
|
|
|
|
public uint OT_ID
|
|
|
|
|
{
|
|
|
|
|
get => BitConverter.ToUInt32(Data, Offset + 9);
|
|
|
|
|
set => BitConverter.GetBytes(value).CopyTo(Data, Offset + 9);
|
|
|
|
|
}
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2018-07-08 16:54:17 +00:00
|
|
|
|
public int OT_Class { get => Data[Offset + 9] % 5; }
|
2018-07-08 07:26:31 +00:00
|
|
|
|
public int Language { get => Data[Offset + 0x0D]; set => Data[Offset + 0x0D] = (byte)value; }
|
|
|
|
|
public int _E { get => Data[Offset + 0x0E]; set => Data[Offset + 0x0E] = (byte)value; }
|
|
|
|
|
public int _F { get => Data[Offset + 0x0F]; set => Data[Offset + 0x0F] = (byte)value; }
|
|
|
|
|
public int _10 { get => Data[Offset + 0x10]; set => Data[Offset + 0x10] = (byte)value; }
|
|
|
|
|
public int _11 { get => Data[Offset + 0x11]; set => Data[Offset + 0x11] = (byte)value; }
|
|
|
|
|
|
|
|
|
|
public byte[] Decorations
|
|
|
|
|
{
|
2019-09-23 22:13:22 +00:00
|
|
|
|
get => Data.Slice(Offset + 0x12, 0x10);
|
2018-07-08 07:26:31 +00:00
|
|
|
|
set => value.CopyTo(Data, Offset + 0x12);
|
|
|
|
|
}
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2018-07-08 07:26:31 +00:00
|
|
|
|
public byte[] DecorationCoordinates
|
|
|
|
|
{
|
2019-09-23 22:13:22 +00:00
|
|
|
|
get => Data.Slice(Offset + 0x22, 0x10);
|
2018-07-08 07:26:31 +00:00
|
|
|
|
set => value.CopyTo(Data, Offset + 0x22);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public SecretBase3Team Team
|
|
|
|
|
{
|
2019-09-23 22:13:22 +00:00
|
|
|
|
get => new SecretBase3Team(Data.Slice(Offset + 50, 72));
|
2018-07-08 07:26:31 +00:00
|
|
|
|
set => value.Write().CopyTo(Data, Offset + 50);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int TID
|
|
|
|
|
{
|
|
|
|
|
get => (ushort)OT_ID;
|
|
|
|
|
set => OT_ID = (ushort)(SID | (ushort)value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int SID
|
|
|
|
|
{
|
|
|
|
|
get => (ushort)OT_ID >> 8;
|
|
|
|
|
set => OT_ID = (ushort)(((ushort)value << 16) | TID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|