mirror of
https://github.com/kwsch/pkNX.git
synced 2026-05-02 02:45:34 -05:00
pkNX.Sprites to be replaced with a pkhex.drawing dll once that is updated with swsh stuff (when the time comes)
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using System;
|
|
using System.IO;
|
|
|
|
namespace pkNX.Structures
|
|
{
|
|
public class EvolutionSet7 : EvolutionSet
|
|
{
|
|
private const int ENTRY_SIZE = 8;
|
|
private const int ENTRY_COUNT = 8;
|
|
public const int SIZE = ENTRY_COUNT * ENTRY_SIZE;
|
|
|
|
public EvolutionSet7(byte[] data)
|
|
{
|
|
if (data.Length != SIZE)
|
|
return;
|
|
PossibleEvolutions = data.GetArray(GetEvo, ENTRY_SIZE);
|
|
}
|
|
|
|
private static EvolutionMethod GetEvo(byte[] data, int offset)
|
|
{
|
|
return new EvolutionMethod
|
|
{
|
|
Method = (EvolutionType)BitConverter.ToUInt16(data, offset + 0),
|
|
Argument = BitConverter.ToUInt16(data, offset + 2),
|
|
Species = BitConverter.ToUInt16(data, offset + 4),
|
|
Form = (sbyte)data[offset + 6],
|
|
Level = data[offset + 7],
|
|
};
|
|
}
|
|
|
|
public override byte[] Write()
|
|
{
|
|
using MemoryStream ms = new MemoryStream();
|
|
using BinaryWriter bw = new BinaryWriter(ms);
|
|
foreach (EvolutionMethod evo in PossibleEvolutions)
|
|
{
|
|
bw.Write((ushort)evo.Method);
|
|
bw.Write((ushort)evo.Argument);
|
|
bw.Write((ushort)evo.Species);
|
|
bw.Write((sbyte)evo.Form);
|
|
bw.Write((byte)evo.Level);
|
|
}
|
|
return ms.ToArray();
|
|
}
|
|
}
|
|
} |