2023-01-22 04:02:33 +00:00
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace PKHeX.Core;
|
2022-06-18 18:04:24 +00:00
|
|
|
|
|
|
|
public sealed class Daycare7 : SaveBlock<SAV7>
|
2019-06-09 02:56:11 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
public const int DaycareSeedSize = 32; // 128 bits
|
2019-06-09 02:56:11 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public Daycare7(SAV7SM sav, int offset) : base(sav) => Offset = offset;
|
|
|
|
public Daycare7(SAV7USUM sav, int offset) : base(sav) => Offset = offset;
|
2019-06-09 02:56:11 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public bool GetIsOccupied(int slot)
|
|
|
|
{
|
|
|
|
return Data[Offset + ((PokeCrypto.SIZE_6STORED + 1) * slot)] != 0;
|
|
|
|
}
|
2019-06-09 02:56:11 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public void SetOccupied(int slot, bool occupied)
|
|
|
|
{
|
|
|
|
Data[Offset + ((PokeCrypto.SIZE_6STORED + 1) * slot)] = occupied ? (byte)1 : (byte)0;
|
|
|
|
}
|
2019-06-09 02:56:11 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public int GetDaycareSlotOffset(int slot)
|
|
|
|
{
|
|
|
|
return Offset + 1 + (slot * (PokeCrypto.SIZE_6STORED + 1));
|
|
|
|
}
|
2019-06-09 02:56:11 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public bool HasEgg
|
|
|
|
{
|
|
|
|
get => Data[Offset + 0x1D8] == 1;
|
|
|
|
set => Data[Offset + 0x1D8] = value ? (byte)1 : (byte)0;
|
|
|
|
}
|
2019-06-09 02:56:11 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public string RNGSeed
|
|
|
|
{
|
2023-01-22 04:02:33 +00:00
|
|
|
get => Util.GetHexStringFromBytes(Data.AsSpan(Offset + 0x1DC, DaycareSeedSize / 2));
|
2022-06-18 18:04:24 +00:00
|
|
|
set
|
2019-06-09 02:56:11 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
if (value.Length != DaycareSeedSize)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var data = Util.GetBytesFromHexString(value);
|
|
|
|
SAV.SetData(data, Offset + 0x1DC);
|
2019-06-09 02:56:11 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-18 18:04:24 +00:00
|
|
|
}
|