mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-01 15:50:21 -05:00
Add raid spawn initial docs
linq dump code I used for ez vis: var sav = new SAV8SWSH(File.ReadAllBytes(@"D:\Kurt\Downloads\main (7)")); var blocks = sav.Blocks; var raid = blocks.Raid; raid.GetAllRaids().Dump();
This commit is contained in:
@@ -1,7 +1,45 @@
|
||||
namespace PKHeX.Core
|
||||
using System;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
public sealed class RaidSpawnList8 : SaveBlock
|
||||
{
|
||||
public RaidSpawnList8(SaveFile sav, SCBlock block) : base(sav, block.Data) { }
|
||||
|
||||
private const int RaidCount = 111;
|
||||
|
||||
public RaidSpawnDetail GetRaid(int entry) => new RaidSpawnDetail(Data, entry * RaidSpawnDetail.SIZE);
|
||||
|
||||
public RaidSpawnDetail[] GetAllRaids()
|
||||
{
|
||||
var result = new RaidSpawnDetail[RaidCount];
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
result[i] = GetRaid(i);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class RaidSpawnDetail
|
||||
{
|
||||
public const int SIZE = 0x18;
|
||||
|
||||
private readonly byte[] Data;
|
||||
private readonly int Offset;
|
||||
|
||||
public RaidSpawnDetail(byte[] data, int ofs)
|
||||
{
|
||||
Data = data;
|
||||
Offset = ofs;
|
||||
}
|
||||
|
||||
public ulong Hash => BitConverter.ToUInt64(Data, Offset + 0);
|
||||
public ulong Seed => BitConverter.ToUInt64(Data, Offset + 8);
|
||||
|
||||
public byte V10 => Data[Offset + 0x10];
|
||||
public byte V11 => Data[Offset + 0x11];
|
||||
public byte V12 => Data[Offset + 0x12];
|
||||
public byte V13 => Data[Offset + 0x13];
|
||||
|
||||
// The games use a xoroshiro RNG to create the PKM from the stored seed.
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user