2016-11-10 16:14:54 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
2017-01-08 07:54:09 +00:00
|
|
|
|
namespace PKHeX.Core
|
2016-11-10 16:14:54 +00:00
|
|
|
|
{
|
|
|
|
|
public class BV7 : BattleVideo
|
|
|
|
|
{
|
|
|
|
|
internal const int SIZE = 0x2BC0;
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
internal new static bool IsValid(byte[] data)
|
2016-11-10 16:14:54 +00:00
|
|
|
|
{
|
|
|
|
|
return data.Length == SIZE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BV7(byte[] data)
|
|
|
|
|
{
|
|
|
|
|
Data = (byte[])data.Clone();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly byte[] Data;
|
|
|
|
|
public override PKM[] BattlePKMs => PlayerTeams.SelectMany(t => t).ToArray();
|
|
|
|
|
public override int Generation => 7;
|
|
|
|
|
|
|
|
|
|
private PKM[][] PlayerTeams
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
var Teams = new PKM[4][];
|
|
|
|
|
int[] offsets = {0xE41, 0x145E, 0x1A7B, 0x2098};
|
|
|
|
|
for (int t = 0; t < 4; t++)
|
|
|
|
|
{
|
|
|
|
|
Teams[t] = new PKM[6];
|
|
|
|
|
for (int p = 0; p < 6; p++)
|
|
|
|
|
{
|
2018-09-15 05:37:47 +00:00
|
|
|
|
int offset = offsets[t] + (PKX.SIZE_6PARTY * p);
|
2016-11-10 16:14:54 +00:00
|
|
|
|
Teams[t][p] = new PK7(Data.Skip(offset).Take(PKX.SIZE_6STORED).ToArray(), $"Team {t}, Slot {p}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Teams;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
var Teams = value;
|
|
|
|
|
int[] offsets = { 0xE41, 0x145E, 0x1A7B, 0x2098 };
|
|
|
|
|
for (int t = 0; t < 4; t++)
|
|
|
|
|
{
|
|
|
|
|
for (int p = 0; p < 6; p++)
|
|
|
|
|
{
|
2018-09-15 05:37:47 +00:00
|
|
|
|
int offset = offsets[t] + (PKX.SIZE_6PARTY * p);
|
2016-11-10 16:14:54 +00:00
|
|
|
|
Teams[t][p].EncryptedPartyData.CopyTo(Data, offset);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-01-12 06:29:30 +00:00
|
|
|
|
|
2017-05-13 03:32:36 +00:00
|
|
|
|
public int MusicID { get => Data[0x21C]; set => Data[0x21C] = (byte)value; }
|
|
|
|
|
public bool SilentBGM { get => MusicID == 0xFF; set => MusicID = (byte)(value ? 0xFF : MusicID); }
|
2016-11-10 16:14:54 +00:00
|
|
|
|
}
|
|
|
|
|
}
|