2018-08-02 01:30:51 +00:00
|
|
|
using System;
|
2018-03-06 06:19:56 +00:00
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
{
|
2018-07-21 03:22:46 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Levelup Learn Movepool Information
|
|
|
|
/// </summary>
|
2018-07-02 02:55:23 +00:00
|
|
|
public sealed class Learnset6 : Learnset
|
2018-03-06 06:19:56 +00:00
|
|
|
{
|
|
|
|
private Learnset6(byte[] data)
|
|
|
|
{
|
|
|
|
if (data.Length < 4 || data.Length % 4 != 0)
|
2018-08-02 01:30:51 +00:00
|
|
|
{ Count = 0; Levels = Moves = Array.Empty<int>(); return; }
|
2018-07-02 02:55:23 +00:00
|
|
|
Count = (data.Length / 4) - 1;
|
2018-03-06 06:19:56 +00:00
|
|
|
Moves = new int[Count];
|
|
|
|
Levels = new int[Count];
|
2018-07-02 02:55:23 +00:00
|
|
|
using (var ms = new MemoryStream(data))
|
|
|
|
using (var br = new BinaryReader(ms))
|
2018-08-02 01:30:51 +00:00
|
|
|
{
|
2018-03-06 06:19:56 +00:00
|
|
|
for (int i = 0; i < Count; i++)
|
|
|
|
{
|
|
|
|
Moves[i] = br.ReadInt16();
|
|
|
|
Levels[i] = br.ReadInt16();
|
|
|
|
}
|
2018-08-02 01:30:51 +00:00
|
|
|
}
|
2018-03-06 06:19:56 +00:00
|
|
|
}
|
2018-08-02 01:30:51 +00:00
|
|
|
|
2018-03-06 06:19:56 +00:00
|
|
|
public static Learnset[] GetArray(byte[][] entries)
|
|
|
|
{
|
|
|
|
Learnset[] data = new Learnset[entries.Length];
|
|
|
|
for (int i = 0; i < data.Length; i++)
|
|
|
|
data[i] = new Learnset6(entries[i]);
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|