mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-04-25 08:04:27 -05:00
GenV battle subway structures
This commit is contained in:
parent
e6b8233fb3
commit
7a4c4644c8
|
|
@ -98,6 +98,8 @@ namespace PkmnFoundations.Data
|
|||
#endregion
|
||||
|
||||
#region Battle Subway 5
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Global Terminal 4
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@
|
|||
<Compile Include="Data\DataMysql.cs" />
|
||||
<Compile Include="Data\DataSqlite.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Structures\BattleSubwayPokemon5.cs" />
|
||||
<Compile Include="Structures\BattleSubwayProfile5.cs" />
|
||||
<Compile Include="Structures\BattleSubwayRecord5.cs" />
|
||||
<Compile Include="Structures\BattleTowerPokemon4.cs" />
|
||||
<Compile Include="Structures\BattleTowerRecord4.cs" />
|
||||
<Compile Include="Structures\BattleTowerProfile4.cs" />
|
||||
|
|
|
|||
127
library/Structures/BattleSubwayPokemon5.cs
Normal file
127
library/Structures/BattleSubwayPokemon5.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using PkmnFoundations.Support;
|
||||
|
||||
namespace PkmnFoundations.Structures
|
||||
{
|
||||
public class BattleSubwayPokemon5
|
||||
{
|
||||
public BattleSubwayPokemon5()
|
||||
{
|
||||
}
|
||||
|
||||
public BattleSubwayPokemon5(byte[] data)
|
||||
{
|
||||
Load(data, 0);
|
||||
}
|
||||
|
||||
public BattleSubwayPokemon5(byte[] data, int start)
|
||||
{
|
||||
Load(data, start);
|
||||
}
|
||||
|
||||
public ushort Species;
|
||||
public ushort HeldItem;
|
||||
public ushort[] Moveset;
|
||||
public uint OT;
|
||||
public uint Personality;
|
||||
public uint IVs;
|
||||
public byte[] EVs;
|
||||
public byte Unknown1;
|
||||
public Languages Language;
|
||||
public byte Ability;
|
||||
public byte Happiness;
|
||||
public EncodedString5 Nickname;
|
||||
public uint Unknown2;
|
||||
|
||||
// todo: add IVs class with indexer?
|
||||
// byte myHp = myPokemon.IVs[Stats.HP];
|
||||
public byte IV(Stats stat)
|
||||
{
|
||||
return BattleTowerPokemon4.UnpackIV(IVs, stat);
|
||||
}
|
||||
|
||||
public byte[] Save()
|
||||
{
|
||||
byte[] data = new byte[0x3c];
|
||||
MemoryStream ms = new MemoryStream(data);
|
||||
BinaryWriter writer = new BinaryWriter(ms);
|
||||
|
||||
writer.Write(Species);
|
||||
writer.Write(HeldItem);
|
||||
for (int x = 0; x < 4; x++)
|
||||
{
|
||||
writer.Write(Moveset[x]);
|
||||
}
|
||||
writer.Write(OT);
|
||||
writer.Write(Personality);
|
||||
writer.Write(IVs);
|
||||
for (int x = 0; x < 6; x++)
|
||||
{
|
||||
writer.Write(EVs[x]);
|
||||
}
|
||||
writer.Write(Unknown1);
|
||||
writer.Write((byte)Language);
|
||||
writer.Write(Ability);
|
||||
writer.Write(Happiness);
|
||||
writer.Write(Nickname.RawData, 0, 0x16);
|
||||
writer.Write(Unknown2); // new to G5
|
||||
|
||||
writer.Flush();
|
||||
ms.Flush();
|
||||
return data;
|
||||
}
|
||||
|
||||
public void Load(byte[] data, int start)
|
||||
{
|
||||
if (start + 0x3c > data.Length) throw new ArgumentOutOfRangeException("start");
|
||||
|
||||
Species = BitConverter.ToUInt16(data, 0x00 + start);
|
||||
HeldItem = BitConverter.ToUInt16(data, 0x02 + start);
|
||||
Moveset = new ushort[4];
|
||||
for (int x = 0; x < 4; x++)
|
||||
{
|
||||
Moveset[x] = BitConverter.ToUInt16(data, 0x04 + x * 2 + start);
|
||||
}
|
||||
OT = BitConverter.ToUInt32(data, 0x0c + start);
|
||||
Personality = BitConverter.ToUInt32(data, 0x10 + start);
|
||||
IVs = BitConverter.ToUInt32(data, 0x14 + start);
|
||||
|
||||
EVs = new byte[6];
|
||||
for (int x = 0; x < 6; x++)
|
||||
{
|
||||
EVs[x] = data[0x18 + x + start];
|
||||
}
|
||||
Unknown1 = data[0x1e + start];
|
||||
Language = (Languages)data[0x1f + start];
|
||||
Ability = data[0x20 + start];
|
||||
Happiness = data[0x21 + start];
|
||||
Nickname = new EncodedString5(data, 0x22 + start, 0x16);
|
||||
Unknown2 = BitConverter.ToUInt32(data, 0x38);
|
||||
}
|
||||
|
||||
public BattleSubwayPokemon5 Clone()
|
||||
{
|
||||
BattleSubwayPokemon5 result = new BattleSubwayPokemon5();
|
||||
result.Species = Species;
|
||||
result.HeldItem = HeldItem;
|
||||
result.Moveset = Moveset.ToArray();
|
||||
result.OT = OT;
|
||||
result.Personality = Personality;
|
||||
result.IVs = IVs;
|
||||
result.EVs = EVs.ToArray();
|
||||
result.Unknown1 = Unknown1;
|
||||
result.Language = Language;
|
||||
result.Ability = Ability;
|
||||
result.Happiness = Happiness;
|
||||
result.Nickname = new EncodedString5(Nickname.RawData.ToArray());
|
||||
result.Unknown2 = Unknown2;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
81
library/Structures/BattleSubwayProfile5.cs
Normal file
81
library/Structures/BattleSubwayProfile5.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using PkmnFoundations.Support;
|
||||
|
||||
namespace PkmnFoundations.Structures
|
||||
{
|
||||
public class BattleSubwayProfile5
|
||||
{
|
||||
public BattleSubwayProfile5()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BattleSubwayProfile5(byte[] data)
|
||||
{
|
||||
Load(data, 0);
|
||||
}
|
||||
|
||||
public BattleSubwayProfile5(byte[] data, int start)
|
||||
{
|
||||
Load(data, start);
|
||||
}
|
||||
|
||||
public EncodedString5 Name;
|
||||
public Versions Version;
|
||||
public Languages Language;
|
||||
public byte Country;
|
||||
public byte Region;
|
||||
public uint OT;
|
||||
public ushort Unknown1;
|
||||
// todo: TrendyPhrase4 class
|
||||
public ushort[] TrendyPhrase;
|
||||
public ushort Unknown2;
|
||||
|
||||
public byte[] Save()
|
||||
{
|
||||
byte[] data = new byte[0x22];
|
||||
MemoryStream ms = new MemoryStream(data);
|
||||
BinaryWriter writer = new BinaryWriter(ms);
|
||||
|
||||
writer.Write(Name.RawData);
|
||||
writer.Write((byte)Version);
|
||||
writer.Write((byte)Language);
|
||||
writer.Write(Country);
|
||||
writer.Write(Region);
|
||||
writer.Write(OT);
|
||||
writer.Write(Unknown1);
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
writer.Write(TrendyPhrase[x]);
|
||||
}
|
||||
writer.Write(Unknown2);
|
||||
|
||||
writer.Flush();
|
||||
ms.Flush();
|
||||
return data;
|
||||
}
|
||||
|
||||
public void Load(byte[] data, int start)
|
||||
{
|
||||
if (start + 0x22 > data.Length) throw new ArgumentOutOfRangeException("start");
|
||||
|
||||
Name = new EncodedString5(data, start, 0x10);
|
||||
Version = (Versions)data[0x10 + start];
|
||||
Language = (Languages)data[0x11 + start];
|
||||
Country = data[0x12 + start];
|
||||
Region = data[0x13 + start];
|
||||
OT = BitConverter.ToUInt32(data, 0x14 + start);
|
||||
Unknown1 = BitConverter.ToUInt16(data, 0x18 + start);
|
||||
TrendyPhrase = new ushort[3];
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
TrendyPhrase[x] = BitConverter.ToUInt16(data, 0x1a + x * 2 + start);
|
||||
}
|
||||
Unknown2 = BitConverter.ToUInt16(data, 0x20 + start);
|
||||
}
|
||||
}
|
||||
}
|
||||
68
library/Structures/BattleSubwayRecord5.cs
Normal file
68
library/Structures/BattleSubwayRecord5.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace PkmnFoundations.Structures
|
||||
{
|
||||
public class BattleSubwayRecord5
|
||||
{
|
||||
public BattleSubwayRecord5()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BattleSubwayRecord5(byte[] data)
|
||||
{
|
||||
Load(data, 0);
|
||||
}
|
||||
|
||||
public BattleSubwayRecord5(byte[] data, int start)
|
||||
{
|
||||
Load(data, start);
|
||||
}
|
||||
|
||||
public BattleSubwayPokemon5[] Party;
|
||||
public BattleSubwayProfile5 Profile;
|
||||
public byte[] Unknown3;
|
||||
|
||||
public byte Rank;
|
||||
public byte RoomNum;
|
||||
public byte BattlesWon;
|
||||
public ulong Unknown4;
|
||||
public int PID;
|
||||
|
||||
public byte[] Save()
|
||||
{
|
||||
byte[] data = new byte[0xf0];
|
||||
MemoryStream ms = new MemoryStream(data);
|
||||
BinaryWriter writer = new BinaryWriter(ms);
|
||||
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
writer.Write(Party[x].Save());
|
||||
}
|
||||
writer.Write(Profile.Save());
|
||||
writer.Write(Unknown3);
|
||||
|
||||
writer.Flush();
|
||||
ms.Flush();
|
||||
return data;
|
||||
}
|
||||
|
||||
public void Load(byte[] data, int start)
|
||||
{
|
||||
if (start + 0xf0 > data.Length) throw new ArgumentOutOfRangeException("start");
|
||||
|
||||
Party = new BattleSubwayPokemon5[3];
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
Party[x] = new BattleSubwayPokemon5(data, start + x * 0x3c);
|
||||
}
|
||||
Profile = new BattleSubwayProfile5(data, 0xb4 + start);
|
||||
Unknown3 = new byte[0x1a];
|
||||
Array.Copy(data, start + 0xd6, Unknown3, 0, 0x1a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ namespace PkmnFoundations.Structures
|
|||
writer.Write((byte)Language);
|
||||
writer.Write(Ability);
|
||||
writer.Write(Happiness);
|
||||
writer.Write(Nickname.RawData);
|
||||
writer.Write(Nickname.RawData, 0, 0x16);
|
||||
|
||||
writer.Flush();
|
||||
ms.Flush();
|
||||
|
|
|
|||
|
|
@ -307,6 +307,7 @@ namespace PkmnFoundations.Structures
|
|||
SearchColosseumSingleCupMatch = 0xfb,
|
||||
SearchColosseumDoubleNoRestrictions = 0xfc,
|
||||
SearchColosseumDoubleCupMatch = 0xfd,
|
||||
// fixme: There's a search type 0xfe showing in my logs.
|
||||
SearchLatest30 = 0xff,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user