mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-12 05:32:40 +00:00
024bd85cc3
make PL6 use memory instead of byte[] make GP1 use memory instead of byte[] move IEncounterable properties higher to IEncounterTemplate
24 lines
727 B
C#
24 lines
727 B
C#
using System;
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
public sealed class LinkBlock6 : SaveBlock<SAV6>
|
|
{
|
|
public LinkBlock6(SAV6XY sav, Memory<byte> raw) : base(sav, raw) { }
|
|
public LinkBlock6(SAV6AO sav, Memory<byte> raw) : base(sav, raw) { }
|
|
|
|
public Memory<byte> PL6 => Raw.Slice(0x1FF, Core.PL6.Size);
|
|
|
|
public PL6 Gifts => new(PL6);
|
|
|
|
public void RefreshChecksum() => Checksum = GetCalculatedChecksum(); // [app,chk)
|
|
|
|
private ushort GetCalculatedChecksum() => Checksums.CRC16_CCITT(Data[0x200..^4]); // [app,chk)
|
|
|
|
public ushort Checksum
|
|
{
|
|
get => ReadUInt16LittleEndian(Data[^4..]);
|
|
set => WriteUInt16LittleEndian(Data[^4..], value);
|
|
}
|
|
}
|