mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
Add gen1 learnset/evo information
Still need encounter info for all 3 games.
This commit is contained in:
parent
d248cdd280
commit
c9421f3c5b
8 changed files with 159 additions and 33 deletions
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using PKHeX.Core.Properties;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
|
@ -9,18 +10,22 @@ namespace PKHeX.Core
|
|||
// Event Database(s)
|
||||
public static MysteryGift[] MGDB_G6, MGDB_G7 = new MysteryGift[0];
|
||||
|
||||
// Gen 1
|
||||
private static readonly Learnset[] LevelUpRB = Learnset1.getArray(Resources.lvlmove_rby);
|
||||
private static readonly EvolutionTree Evolves1;
|
||||
|
||||
// Gen 6
|
||||
private static readonly EggMoves[] EggMovesXY = EggMoves6.getArray(Data.unpackMini(Properties.Resources.eggmove_xy, "xy"));
|
||||
private static readonly Learnset[] LevelUpXY = Learnset6.getArray(Data.unpackMini(Properties.Resources.lvlmove_xy, "xy"));
|
||||
private static readonly EggMoves[] EggMovesAO = EggMoves6.getArray(Data.unpackMini(Properties.Resources.eggmove_ao, "ao"));
|
||||
private static readonly Learnset[] LevelUpAO = Learnset6.getArray(Data.unpackMini(Properties.Resources.lvlmove_ao, "ao"));
|
||||
private static readonly EggMoves[] EggMovesXY = EggMoves6.getArray(Data.unpackMini(Resources.eggmove_xy, "xy"));
|
||||
private static readonly Learnset[] LevelUpXY = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_xy, "xy"));
|
||||
private static readonly EggMoves[] EggMovesAO = EggMoves6.getArray(Data.unpackMini(Resources.eggmove_ao, "ao"));
|
||||
private static readonly Learnset[] LevelUpAO = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_ao, "ao"));
|
||||
private static readonly EvolutionTree Evolves6;
|
||||
private static readonly EncounterArea[] SlotsX, SlotsY, SlotsA, SlotsO;
|
||||
private static readonly EncounterStatic[] StaticX, StaticY, StaticA, StaticO;
|
||||
|
||||
// Gen 7
|
||||
private static readonly EggMoves[] EggMovesSM = EggMoves7.getArray(Data.unpackMini(Properties.Resources.eggmove_sm, "sm"));
|
||||
private static readonly Learnset[] LevelUpSM = Learnset7.getArray(Data.unpackMini(Properties.Resources.lvlmove_sm, "sm"));
|
||||
private static readonly EggMoves[] EggMovesSM = EggMoves7.getArray(Data.unpackMini(Resources.eggmove_sm, "sm"));
|
||||
private static readonly Learnset[] LevelUpSM = Learnset7.getArray(Data.unpackMini(Resources.lvlmove_sm, "sm"));
|
||||
private static readonly EvolutionTree Evolves7;
|
||||
private static readonly EncounterArea[] SlotsSN, SlotsMN;
|
||||
private static readonly EncounterStatic[] StaticSN, StaticMN;
|
||||
|
@ -56,27 +61,27 @@ namespace PKHeX.Core
|
|||
{
|
||||
case GameVersion.X:
|
||||
ident = "xy";
|
||||
tables = Properties.Resources.encounter_x;
|
||||
tables = Resources.encounter_x;
|
||||
break;
|
||||
case GameVersion.Y:
|
||||
ident = "xy";
|
||||
tables = Properties.Resources.encounter_y;
|
||||
tables = Resources.encounter_y;
|
||||
break;
|
||||
case GameVersion.AS:
|
||||
ident = "ao";
|
||||
tables = Properties.Resources.encounter_a;
|
||||
tables = Resources.encounter_a;
|
||||
break;
|
||||
case GameVersion.OR:
|
||||
ident = "ao";
|
||||
tables = Properties.Resources.encounter_o;
|
||||
tables = Resources.encounter_o;
|
||||
break;
|
||||
case GameVersion.SN:
|
||||
ident = "sm";
|
||||
tables = Properties.Resources.encounter_sn;
|
||||
tables = Resources.encounter_sn;
|
||||
break;
|
||||
case GameVersion.MN:
|
||||
ident = "sm";
|
||||
tables = Properties.Resources.encounter_mn;
|
||||
tables = Resources.encounter_mn;
|
||||
break;
|
||||
}
|
||||
if (ident == null)
|
||||
|
@ -128,6 +133,10 @@ namespace PKHeX.Core
|
|||
|
||||
static Legal() // Setup
|
||||
{
|
||||
// Gen 1
|
||||
{
|
||||
Evolves1 = new EvolutionTree(new[] { Resources.evos_rby }, GameVersion.RBY, PersonalTable.RBY, MaxSpeciesID_1);
|
||||
}
|
||||
// Gen 6
|
||||
{
|
||||
StaticX = getStaticEncounters(GameVersion.X);
|
||||
|
@ -147,7 +156,7 @@ namespace PKHeX.Core
|
|||
MarkG6AOSlots(ref SlotsA);
|
||||
MarkG6AOSlots(ref SlotsO);
|
||||
|
||||
Evolves6 = new EvolutionTree(Data.unpackMini(Properties.Resources.evos_ao, "ao"), GameVersion.ORAS, PersonalTable.AO, 721);
|
||||
Evolves6 = new EvolutionTree(Data.unpackMini(Resources.evos_ao, "ao"), GameVersion.ORAS, PersonalTable.AO, MaxSpeciesID_6);
|
||||
}
|
||||
// Gen 7
|
||||
{
|
||||
|
@ -155,14 +164,14 @@ namespace PKHeX.Core
|
|||
StaticMN = getStaticEncounters(GameVersion.MN);
|
||||
var REG_SN = getEncounterTables(GameVersion.SN);
|
||||
var REG_MN = getEncounterTables(GameVersion.MN);
|
||||
var SOS_SN = getEncounterTables(Properties.Resources.encounter_sn_sos, "sm");
|
||||
var SOS_MN = getEncounterTables(Properties.Resources.encounter_mn_sos, "sm");
|
||||
var SOS_SN = getEncounterTables(Resources.encounter_sn_sos, "sm");
|
||||
var SOS_MN = getEncounterTables(Resources.encounter_mn_sos, "sm");
|
||||
MarkG7SMSlots(ref SOS_SN);
|
||||
MarkG7SMSlots(ref SOS_MN);
|
||||
SlotsSN = addExtraTableSlots(REG_SN, SOS_SN).Concat(Encounter_Pelago_SM).Concat(Encounter_Pelago_SN).ToArray();
|
||||
SlotsMN = addExtraTableSlots(REG_MN, SOS_MN).Concat(Encounter_Pelago_SM).Concat(Encounter_Pelago_MN).ToArray();
|
||||
|
||||
Evolves7 = new EvolutionTree(Data.unpackMini(Properties.Resources.evos_sm, "sm"), GameVersion.SM, PersonalTable.SM, 802);
|
||||
Evolves7 = new EvolutionTree(Data.unpackMini(Resources.evos_sm, "sm"), GameVersion.SM, PersonalTable.SM, MaxSpeciesID_7);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,15 @@ namespace PKHeX.Core
|
|||
MaxSpeciesTree = maxSpeciesTree;
|
||||
switch (game)
|
||||
{
|
||||
case GameVersion.SM:
|
||||
Entries.AddRange(data.Select(d => new EvolutionSet7(d)));
|
||||
case GameVersion.RBY:
|
||||
Entries = EvolutionSet1.getArray(data[0]);
|
||||
break;
|
||||
case GameVersion.ORAS:
|
||||
Entries.AddRange(data.Select(d => new EvolutionSet6(d)));
|
||||
break;
|
||||
case GameVersion.SM:
|
||||
Entries.AddRange(data.Select(d => new EvolutionSet7(d)));
|
||||
break;
|
||||
}
|
||||
|
||||
// Create Lineages
|
||||
|
@ -32,7 +35,7 @@ namespace PKHeX.Core
|
|||
for (int i = 0; i < Entries.Count; i++)
|
||||
Lineage[i] = new EvolutionLineage();
|
||||
if (Game == GameVersion.ORAS)
|
||||
Array.Resize(ref Lineage, maxSpeciesTree + 1);
|
||||
Array.Resize(ref Lineage, MaxSpeciesTree + 1);
|
||||
|
||||
// Populate Lineages
|
||||
for (int i = 1; i < Lineage.Length; i++)
|
||||
|
@ -162,6 +165,58 @@ namespace PKHeX.Core
|
|||
{
|
||||
public EvolutionMethod[] PossibleEvolutions;
|
||||
}
|
||||
public class EvolutionSet1 : EvolutionSet
|
||||
{
|
||||
private static EvolutionMethod getMethod(byte[] data, ref int offset)
|
||||
{
|
||||
switch (data[offset])
|
||||
{
|
||||
case 1: // Level
|
||||
var m1 = new EvolutionMethod
|
||||
{
|
||||
Method = 1, // Use Item
|
||||
Level = data[offset + 1],
|
||||
Species = data[offset + 2]
|
||||
};
|
||||
offset += 3;
|
||||
return m1;
|
||||
case 2: // Use Item
|
||||
var m2 = new EvolutionMethod
|
||||
{
|
||||
Method = 8, // Use Item
|
||||
Argument = data[offset + 1],
|
||||
// 1
|
||||
Species = data[offset + 3],
|
||||
};
|
||||
offset += 4;
|
||||
return m2;
|
||||
case 3: // Trade
|
||||
var m3 = new EvolutionMethod
|
||||
{
|
||||
Method = 5, // Trade
|
||||
// 1
|
||||
Species = data[offset + 2]
|
||||
};
|
||||
offset += 3;
|
||||
return m3;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static List<EvolutionSet> getArray(byte[] data)
|
||||
{
|
||||
var evos = new List<EvolutionSet>();
|
||||
int offset = 0;
|
||||
for (int i = 0; i <= Legal.MaxSpeciesID_1; i++)
|
||||
{
|
||||
var m = new List<EvolutionMethod>();
|
||||
while (data[offset] != 0)
|
||||
m.Add(getMethod(data, ref offset));
|
||||
++offset;
|
||||
evos.Add(new EvolutionSet1 { PossibleEvolutions = m.ToArray() });
|
||||
}
|
||||
return evos;
|
||||
}
|
||||
}
|
||||
public class EvolutionSet6 : EvolutionSet
|
||||
{
|
||||
private const int SIZE = 6;
|
||||
|
@ -172,7 +227,7 @@ namespace PKHeX.Core
|
|||
PossibleEvolutions = new EvolutionMethod[data.Length / SIZE];
|
||||
for (int i = 0; i < data.Length; i += SIZE)
|
||||
{
|
||||
PossibleEvolutions[i/SIZE] = new EvolutionMethod
|
||||
var evo = new EvolutionMethod
|
||||
{
|
||||
Method = BitConverter.ToUInt16(data, i + 0),
|
||||
Argument = BitConverter.ToUInt16(data, i + 2),
|
||||
|
@ -183,8 +238,10 @@ namespace PKHeX.Core
|
|||
};
|
||||
|
||||
// Argument is used by both Level argument and Item/Move/etc. Clear if appropriate.
|
||||
if (argEvos.Contains(PossibleEvolutions[i/SIZE].Method))
|
||||
PossibleEvolutions[i/SIZE].Level = 0;
|
||||
if (argEvos.Contains(evo.Method))
|
||||
evo.Level = 0;
|
||||
|
||||
PossibleEvolutions[i/SIZE] = evo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace PKHeX.Core
|
||||
|
@ -17,6 +18,35 @@ namespace PKHeX.Core
|
|||
return Moves;
|
||||
}
|
||||
}
|
||||
|
||||
public class Learnset1 : Learnset
|
||||
{
|
||||
private Learnset1(byte[] data, ref int offset)
|
||||
{
|
||||
var moves = new List<int>();
|
||||
var levels = new List<int>();
|
||||
while (data[offset] != 0)
|
||||
{
|
||||
levels.Add(data[offset++]);
|
||||
moves.Add(data[offset++]);
|
||||
}
|
||||
++offset;
|
||||
|
||||
Moves = moves.ToArray();
|
||||
Levels = levels.ToArray();
|
||||
Count = Moves.Length;
|
||||
}
|
||||
public static Learnset[] getArray(byte[] input)
|
||||
{
|
||||
var data = new Learnset[Legal.MaxSpeciesID_1 + 1];
|
||||
|
||||
int offset = 0;
|
||||
for (int s = 0; s < data.Length; s++)
|
||||
data[s] = new Learnset1(input, ref offset);
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
public class Learnset6 : Learnset
|
||||
{
|
||||
private Learnset6(byte[] data)
|
||||
|
|
|
@ -265,11 +265,13 @@
|
|||
<None Include="Resources\byte\encounter_mn_sos.pkl" />
|
||||
<None Include="Resources\byte\encounter_sn.pkl" />
|
||||
<None Include="Resources\byte\encounter_sn_sos.pkl" />
|
||||
<None Include="Resources\byte\evos_rby.pkl" />
|
||||
<None Include="Resources\byte\evos_sm.pkl" />
|
||||
<None Include="Resources\byte\fashion_f_sm" />
|
||||
<None Include="Resources\byte\fashion_f_sm_illegal" />
|
||||
<None Include="Resources\byte\fashion_m_sm" />
|
||||
<None Include="Resources\byte\fashion_m_sm_illegal" />
|
||||
<None Include="Resources\byte\lvlmove_rby.pkl" />
|
||||
<None Include="Resources\byte\lvlmove_sm.pkl" />
|
||||
<None Include="Resources\byte\personal_sm" />
|
||||
<None Include="Resources\byte\wc7.pkl" />
|
||||
|
|
42
PKHeX/Properties/Resources.Designer.cs
generated
42
PKHeX/Properties/Resources.Designer.cs
generated
|
@ -12324,12 +12324,14 @@ namespace PKHeX.Core.Properties {
|
|||
/// Looks up a localized string similar to PKHeX - By Kaphotics
|
||||
///http://projectpokemon.org/pkhex
|
||||
///
|
||||
///17/01/30 - New Update:
|
||||
/// - Added: Control right-clicking a PKM slot (box, party, etc) now allows direct legality checking.
|
||||
/// - Added: 6/7 detection preferential treatment & other detection methods. Thanks sora10pls!
|
||||
/// - Added: Remove All medals button now clears Unlocked/Complete flags even if not visible.
|
||||
/// - Fixed: Badly constructed ShowdownSets throw less exceptions (hopefully none). Thanks Sonic Blader!
|
||||
/// - Fixed: Cloning to all slots in a Gen1/2 [rest of string was truncated]";.
|
||||
///17/02/07 - New Update:
|
||||
/// - Legality:
|
||||
/// - - Added: Legality indication for exported QR images (if legality check is available for origin).
|
||||
/// - - Added: Legality indication for Box/Party pkm slots (^ + opt-in via Options->Set to SAV).
|
||||
/// - - Fixed: More edge cases for legality checks.
|
||||
/// - Added: More Generation 7 trainer stat record labels. Thanks skywalker25 & Holla!
|
||||
/// - Added: G7TID -> TID/SID generator for Generation 7 Trainer Editor. Thanks RoC!
|
||||
/// - [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
public static string changelog {
|
||||
get {
|
||||
|
@ -12539,6 +12541,16 @@ namespace PKHeX.Core.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
public static byte[] evos_rby {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("evos_rby", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
|
@ -17761,6 +17773,16 @@ namespace PKHeX.Core.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
public static byte[] lvlmove_rby {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("lvlmove_rby", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
|
@ -17992,7 +18014,7 @@ namespace PKHeX.Core.Properties {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 20170130.
|
||||
/// Looks up a localized string similar to 20170207.
|
||||
/// </summary>
|
||||
public static string ProgramVersion {
|
||||
get {
|
||||
|
@ -19071,7 +19093,7 @@ namespace PKHeX.Core.Properties {
|
|||
///// Main Window
|
||||
///
|
||||
///CTRL-O: Open
|
||||
///CTRL-S: Export PK6
|
||||
///CTRL-S: Export PKM
|
||||
///CTRL-E: Export SAV
|
||||
///CTRL-B: Export BAK
|
||||
///CTRL-Q: Quit
|
||||
|
@ -28889,7 +28911,7 @@ namespace PKHeX.Core.Properties {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Ningún objeto
|
||||
/// Looks up a localized string similar to Ninguno
|
||||
///Master Ball
|
||||
///Ultra Ball
|
||||
///Super Ball
|
||||
|
@ -28930,7 +28952,7 @@ namespace PKHeX.Core.Properties {
|
|||
///Éter
|
||||
///Éter Máximo
|
||||
///Elixir
|
||||
///Elixir M [rest of string was truncated]";.
|
||||
///Elixir Máximo
/// [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
public static string text_items_es {
|
||||
get {
|
||||
|
|
|
@ -7384,4 +7384,10 @@
|
|||
<data name="fashion_m_sm_illegal" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\byte\fashion_m_sm_illegal;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="evos_rby" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\byte\evos_rby.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="lvlmove_rby" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\byte\lvlmove_rby.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
BIN
PKHeX/Resources/byte/evos_rby.pkl
Normal file
BIN
PKHeX/Resources/byte/evos_rby.pkl
Normal file
Binary file not shown.
BIN
PKHeX/Resources/byte/lvlmove_rby.pkl
Normal file
BIN
PKHeX/Resources/byte/lvlmove_rby.pkl
Normal file
Binary file not shown.
Loading…
Reference in a new issue