mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-21 01:43:10 +00:00
61 lines
1.8 KiB
C#
61 lines
1.8 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
|
// ReSharper disable UnusedMember.Global
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
public sealed class RaidSevenStar9 : SaveBlock<SAV9SV>
|
|
{
|
|
public readonly int CountAll;
|
|
|
|
public RaidSevenStar9(SAV9SV sav, SCBlock block) : base(sav, block.Data)
|
|
{
|
|
CountAll = block.Data.Length / SevenStarRaidDetail.SIZE;
|
|
}
|
|
|
|
public SevenStarRaidDetail GetRaid(int entry) => new(Data, 0x00 + (entry * SevenStarRaidDetail.SIZE));
|
|
|
|
public SevenStarRaidDetail[] GetAllRaids()
|
|
{
|
|
var result = new SevenStarRaidDetail[CountAll];
|
|
for (int i = 0; i < result.Length; i++)
|
|
result[i] = GetRaid(i);
|
|
return result;
|
|
}
|
|
}
|
|
|
|
public sealed class SevenStarRaidDetail
|
|
{
|
|
public const int SIZE = 0x06;
|
|
|
|
private readonly byte[] Data;
|
|
private readonly int Offset;
|
|
|
|
public SevenStarRaidDetail(byte[] data, int ofs)
|
|
{
|
|
Data = data;
|
|
Offset = ofs;
|
|
}
|
|
|
|
private const string General = nameof(General);
|
|
|
|
[Category(General), Description("Identifier used for this 7 Star Raid. Matches the date this raid was first distributed.")]
|
|
public uint Identifier
|
|
{
|
|
get => ReadUInt32LittleEndian(Data.AsSpan(Offset + 0x00));
|
|
set => WriteUInt32LittleEndian(Data.AsSpan(Offset + 0x00), value);
|
|
}
|
|
[Category(General), Description("Indicates if this Tera Raid Boss has been captured by the player.")]
|
|
public bool Captured
|
|
{
|
|
get => Data[Offset + 4] == 1;
|
|
set => Data[Offset + 4] = (byte)(value ? 1 : 0);
|
|
}
|
|
[Category(General), Description("Indicates if this Tera Raid Boss has been defeated at least once by the player.")]
|
|
public bool Defeated
|
|
{
|
|
get => Data[Offset + 5] == 1;
|
|
set => Data[Offset + 5] = (byte)(value ? 1 : 0);
|
|
}
|
|
}
|