2023-01-21 20:02:33 -08:00
|
|
|
using System;
|
2024-03-03 23:13:16 -06:00
|
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
2023-01-21 20:02:33 -08:00
|
|
|
|
|
|
|
namespace PKHeX.Core;
|
2022-06-18 11:04:24 -07:00
|
|
|
|
2024-03-03 23:13:16 -06:00
|
|
|
public sealed class Daycare7(SAV7 sav, Memory<byte> raw) : SaveBlock<SAV7>(sav, raw), IDaycareStorage, IDaycareEggState, IDaycareRandomState<UInt128>
|
2019-06-08 19:56:11 -07:00
|
|
|
{
|
2024-03-03 23:13:16 -06:00
|
|
|
private const int SlotSize = PokeCrypto.SIZE_6STORED + 1;
|
2019-06-08 19:56:11 -07:00
|
|
|
|
2024-03-03 23:13:16 -06:00
|
|
|
public int DaycareSlotCount => 2;
|
2019-06-08 19:56:11 -07:00
|
|
|
|
2024-03-03 23:13:16 -06:00
|
|
|
public bool IsDaycareOccupied(int slot) => Data[SlotSize * slot] != 0;
|
|
|
|
public void SetDaycareOccupied(int slot, bool occupied) => Data[SlotSize * slot] = occupied ? (byte)1 : (byte)0;
|
2019-06-08 19:56:11 -07:00
|
|
|
|
2024-03-03 23:13:16 -06:00
|
|
|
public Memory<byte> GetDaycareSlot(int slot) => Raw.Slice(1 + (slot * SlotSize), PokeCrypto.SIZE_6STORED);
|
2019-06-08 19:56:11 -07:00
|
|
|
|
2024-03-03 23:13:16 -06:00
|
|
|
public bool IsEggAvailable
|
2022-06-18 11:04:24 -07:00
|
|
|
{
|
2024-03-03 23:13:16 -06:00
|
|
|
get => Data[0x1D8] == 1;
|
|
|
|
set => Data[0x1D8] = value ? (byte)1 : (byte)0;
|
2022-06-18 11:04:24 -07:00
|
|
|
}
|
2019-06-08 19:56:11 -07:00
|
|
|
|
2024-03-03 23:13:16 -06:00
|
|
|
public UInt128 Seed
|
2022-06-18 11:04:24 -07:00
|
|
|
{
|
2024-03-03 23:13:16 -06:00
|
|
|
get => ReadUInt128LittleEndian(Data[0x1DC..]);
|
|
|
|
set => WriteUInt128LittleEndian(Data[0x1DC..], value);
|
2019-06-08 19:56:11 -07:00
|
|
|
}
|
2022-06-18 11:04:24 -07:00
|
|
|
}
|