mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 14:30:56 +00:00
4974371100
* SaveBlock Constructor Changes - Add primary constructor for SaveBlock with default offset - Update SaveBlock subclasses to specify offset in contructor rather than as the constructor body * Fix MyItem Subclasses Using SaveFile Rather Than Specific Classes
34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
using System;
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
public abstract class Encount5(SAV5 SAV, int offset) : SaveBlock<SAV5>(SAV, offset)
|
|
{
|
|
public ushort LastLocation { get => ReadUInt16LittleEndian(Data); set => WriteUInt16LittleEndian(Data, value); }
|
|
public ushort CaptureUnknown { get => ReadUInt16LittleEndian(Data.AsSpan()[0x02..]); set => WriteUInt16LittleEndian(Data.AsSpan()[0x02..], value); }
|
|
|
|
public Roamer5 Roamer1 => new(Data, Offset + 4);
|
|
public Roamer5 Roamer2 => new(Data, Offset + 4 + Roamer5.SIZE);
|
|
|
|
public abstract byte SwarmSeed { get; set; }
|
|
public abstract uint SwarmMaxCountModulo { get; }
|
|
|
|
public uint SwarmIndex
|
|
{
|
|
get => SwarmSeed % SwarmMaxCountModulo;
|
|
set => SwarmSeed = (byte)(value % SwarmMaxCountModulo);
|
|
}
|
|
}
|
|
|
|
public sealed class Encount5BW(SAV5BW SAV, int offset) : Encount5(SAV, offset)
|
|
{
|
|
public override byte SwarmSeed { get => Data[Offset + 0x30]; set => Data[Offset + 0x30] = value; }
|
|
public override uint SwarmMaxCountModulo => 17;
|
|
}
|
|
|
|
public sealed class Encount5B2W2(SAV5B2W2 SAV, int offset) : Encount5(SAV, offset)
|
|
{
|
|
public override byte SwarmSeed { get => Data[Offset + 0x2C]; set => Data[Offset + 0x2C] = value; }
|
|
public override uint SwarmMaxCountModulo => 19;
|
|
}
|