2023-01-22 04:02:33 +00:00
|
|
|
using System;
|
2022-01-03 05:35:59 +00:00
|
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
2020-12-29 19:39:19 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
public sealed class FieldMenu7 : SaveBlock<SAV7>
|
2019-06-09 02:56:11 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
public FieldMenu7(SAV7SM sav, int offset) : base(sav) => Offset = offset;
|
|
|
|
public FieldMenu7(SAV7USUM sav, int offset) : base(sav) => Offset = offset;
|
2019-06-09 02:56:11 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
// USUM ONLY
|
|
|
|
public ushort RotomAffection
|
|
|
|
{
|
|
|
|
get => ReadUInt16LittleEndian(SAV.Data.AsSpan(Offset + 0x1A));
|
|
|
|
set => WriteUInt16LittleEndian(SAV.Data.AsSpan(Offset + 0x1A), Math.Min((ushort)1000, value));
|
|
|
|
}
|
2020-12-29 19:39:19 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public bool RotomLoto1 { get => (SAV.Data[Offset + 0x2A] & 1) == 1; set => SAV.Data[Offset + 0x2A] = (byte)((SAV.Data[Offset + 0x2A] & ~1) | (value ? 1 : 0)); }
|
|
|
|
public bool RotomLoto2 { get => (SAV.Data[Offset + 0x2A] & 2) == 2; set => SAV.Data[Offset + 0x2A] = (byte)((SAV.Data[Offset + 0x2A] & ~2) | (value ? 2 : 0)); }
|
2020-12-29 19:39:19 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public string RotomOT
|
|
|
|
{
|
2023-03-26 06:14:50 +00:00
|
|
|
get => SAV.GetString(RotomNameSpan);
|
|
|
|
set => SAV.SetString(RotomNameSpan, value, SAV.MaxStringLengthOT, StringConverterOption.ClearZero);
|
2019-06-09 02:56:11 +00:00
|
|
|
}
|
2023-03-26 06:14:50 +00:00
|
|
|
|
|
|
|
private Span<byte> RotomNameSpan => Data.AsSpan(Offset + 0x30, 0x1A);
|
2022-06-18 18:04:24 +00:00
|
|
|
}
|