2022-08-27 06:43:36 +00:00
|
|
|
using System;
|
2022-01-03 05:35:59 +00:00
|
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
2017-04-07 04:47:28 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Honey Tree in Sinnoh (Gen4)
|
|
|
|
/// </summary>
|
|
|
|
public sealed class HoneyTreeValue
|
2017-04-07 04:47:28 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
public const int Size = 8;
|
2017-04-07 04:47:28 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public readonly byte[] Data;
|
2017-04-07 04:47:28 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public uint Time { get => ReadUInt32LittleEndian(Data.AsSpan(0)); set => WriteUInt32LittleEndian(Data.AsSpan(0), value); }
|
|
|
|
public int Slot { get => Data[4]; set => Data[4] = (byte)value; }
|
|
|
|
public int SubTable { get => Data[5]; set => Data[5] = (byte)value; } // offset by 1 with respect to Group
|
|
|
|
public int Group { get => Data[6]; set { Data[6] = (byte)value; SubTable = Math.Max(0, Group - 1); } }
|
|
|
|
public int Shake { get => Data[7]; set => Data[7] = (byte)value; }
|
2017-04-07 04:47:28 +00:00
|
|
|
|
2023-03-26 00:55:55 +00:00
|
|
|
public HoneyTreeValue(byte[] data) => Data = data;
|
2017-04-07 04:47:28 +00:00
|
|
|
}
|