Merge remote-tracking branch 'refs/remotes/kwsch/master'

This commit is contained in:
wwwwwwzx 2017-03-19 13:27:18 -07:00
commit 37a906d6ed
35 changed files with 3944 additions and 2775 deletions

View file

@ -268,7 +268,7 @@ namespace PKHeX.WinForms
#region Path Variables
public static string WorkingDirectory => WinFormsUtil.IsClickonceDeployed ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PKHeX") : Environment.CurrentDirectory;
public static string WorkingDirectory => WinFormsUtil.IsClickonceDeployed ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PKHeX") : Application.StartupPath;
public static string DatabasePath => Path.Combine(WorkingDirectory, "pkmdb");
public static string MGDatabasePath => Path.Combine(WorkingDirectory, "mgdb");
private static string BackupPath => Path.Combine(WorkingDirectory, "bak");

View file

@ -203,7 +203,6 @@ namespace PKHeX.Core
verifyRibbons();
verifyAbility();
verifyBall();
verifyRegion();
verifyForm();
verifyMisc();
verifyGender();
@ -217,8 +216,9 @@ namespace PKHeX.Core
verifyHTMemory();
verifyHyperTraining();
verifyMedals();
verifyRegion();
}
if (pkm.GenNumber < 5 || pkm.VC)
if (pkm.GenNumber < 5)
verifyEggMoves();
verifyVersionEvolution();

View file

@ -1924,6 +1924,16 @@ namespace PKHeX.Core
}
if (pkm.FatefulEncounter)
AddLine(Severity.Invalid, "Fateful Encounter should not be checked.", CheckIdentifier.Fateful);
if (pkm.Format == 5)
{
var enc = EncounterMatch as EncounterStatic;
bool req = enc?.NSparkle ?? false;
bool has = ((PK5) pkm).NPokémon;
if (req && !has)
AddLine(Severity.Invalid, "Special ingame N's Sparkle flag missing.", CheckIdentifier.Fateful);
if (!req && has)
AddLine(Severity.Invalid, "Special ingame N's Sparkle flag should not be checked.", CheckIdentifier.Fateful);
}
}
}
private void verifyVersionEvolution()

View file

@ -35,8 +35,6 @@ namespace PKHeX.Core
private static readonly Learnset[] LevelUpFR = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_fr, "fr"));
private static readonly Learnset[] LevelUpLG = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_lg, "lg"));
private static readonly EggMoves[] EggMovesRS = EggMoves6.getArray(Data.unpackMini(Resources.eggmove_rs, "rs"));
//private static readonly TMHMTutorMoves[] TutorsG3 = TMHMTutorMoves.getArray(Data.unpackMini(Properties.Resources.tutors_g3, "g3"));
//private static readonly TMHMTutorMoves[] HMTMG3 = TMHMTutorMoves.getArray(Data.unpackMini(Properties.Resources.hmtm_g3, "g3"));
private static readonly EvolutionTree Evolves3;
private static readonly EncounterArea[] SlotsR, SlotsS, SlotsE, SlotsFR, SlotsLG;
private static readonly EncounterStatic[] StaticR, StaticS, StaticE, StaticFR, StaticLG;
@ -127,6 +125,16 @@ namespace PKHeX.Core
byte[] tables = null;
switch (Game)
{
case GameVersion.R: return EncounterArea.getArray3(Data.unpackMini(Resources.encounter_r, "ru"));
case GameVersion.S: return EncounterArea.getArray3(Data.unpackMini(Resources.encounter_s, "sa"));
case GameVersion.E: return EncounterArea.getArray3(Data.unpackMini(Resources.encounter_e, "em"));
case GameVersion.FR: return EncounterArea.getArray3(Data.unpackMini(Resources.encounter_fr, "fr"));
case GameVersion.LG: return EncounterArea.getArray3(Data.unpackMini(Resources.encounter_lg, "lg"));
case GameVersion.D: return EncounterArea.getArray4DPPt(Data.unpackMini(Resources.encounter_d, "da"));
case GameVersion.P: return EncounterArea.getArray4DPPt(Data.unpackMini(Resources.encounter_p, "pe"));
case GameVersion.Pt: return EncounterArea.getArray4DPPt(Data.unpackMini(Resources.encounter_pt, "pt"));
case GameVersion.HG: return EncounterArea.getArray4HGSS(Data.unpackMini(Resources.encounter_hg, "hg"));
case GameVersion.SS: return EncounterArea.getArray4HGSS(Data.unpackMini(Resources.encounter_ss, "ss"));
case GameVersion.B: ident = "51"; tables = Resources.encounter_b; break;
case GameVersion.W: ident = "51"; tables = Resources.encounter_w; break;
case GameVersion.B2: ident = "52"; tables = Resources.encounter_b2; break;
@ -156,7 +164,33 @@ namespace PKHeX.Core
}
return GameSlots;
}
private static void MarkG3Slots_FRLG(ref EncounterArea[] Areas)
{
// Remove slots for unown, those slots does not contains alt form info, it will be added manually in SlotsRFLGAlt
// Group areas by location id, the raw data have areas with different slots but the same location id
Areas = Areas.Where(a => (a.Location < 188 || a.Location > 194)).
GroupBy(a => a.Location).
Select(a =>
new EncounterArea { Location = a.First().Location, Slots = a.SelectMany(m => m.Slots).ToArray() }).
ToArray();
}
private static void MarkG3Slots_RSE(ref EncounterArea[] Areas)
{
// Group areas by location id, the raw data have areas with different slots but the same location id
Areas = Areas.GroupBy(a => a.Location).
Select(a =>
new EncounterArea { Location = a.First().Location, Slots = a.SelectMany(m => m.Slots).ToArray() }).
ToArray();
}
private static void MarkG4Slots(ref EncounterArea[] Areas)
{
// Group areas by location id, the raw data have areas with different slots but the same location id
Areas = Areas.GroupBy(a => a.Location).
Select(a =>
new EncounterArea { Location = a.First().Location, Slots = a.SelectMany(m => m.Slots).ToArray() }).
ToArray();
}
private static void MarkG5Slots(ref EncounterArea[] Areas)
{
foreach (var area in Areas)
@ -187,6 +221,11 @@ namespace PKHeX.Core
} while (ctr != area.Slots.Length);
area.Slots = area.Slots.Where(slot => slot.Species != 0).ToArray();
}
// Group areas by location id, the raw data have areas with different slots but the same location id
Areas = Areas.GroupBy(a => a.Location).
Select(a =>
new EncounterArea { Location = a.First().Location, Slots = a.SelectMany(m => m.Slots).ToArray() }).
ToArray();
}
private static void MarkG6XYSlots(ref EncounterArea[] Areas)
{
@ -272,13 +311,25 @@ namespace PKHeX.Core
StaticFR = getStaticEncounters(GameVersion.FR);
StaticLG = getStaticEncounters(GameVersion.LG);
SlotsR = getEncounterTables(GameVersion.R);
SlotsS = getEncounterTables(GameVersion.S);
SlotsE = getEncounterTables(GameVersion.E);
SlotsFR = getEncounterTables(GameVersion.FR);
SlotsLG = getEncounterTables(GameVersion.LG);
var R_Slots = getEncounterTables(GameVersion.R);
var S_Slots = getEncounterTables(GameVersion.S);
var E_Slots = getEncounterTables(GameVersion.E);
var FR_Slots = getEncounterTables(GameVersion.FR);
var LG_Slots = getEncounterTables(GameVersion.LG);
//Evolves3 = new EvolutionTree(Data.unpackMini(Resources.evos_rs, "rs"), GameVersion.RS, PersonalTable.RS, MaxSpeciesID_3);
MarkG3Slots_RSE(ref R_Slots);
MarkG3Slots_RSE(ref S_Slots);
MarkG3Slots_RSE(ref E_Slots);
MarkG3Slots_FRLG(ref FR_Slots);
MarkG3Slots_FRLG(ref LG_Slots);
SlotsR = addExtraTableSlots(R_Slots, SlotsRSEAlt);
SlotsS = addExtraTableSlots(S_Slots, SlotsRSEAlt);
SlotsE = addExtraTableSlots(E_Slots, SlotsRSEAlt);
SlotsFR = addExtraTableSlots(FR_Slots, SlotsFRLGAlt);
SlotsLG = addExtraTableSlots(LG_Slots, SlotsFRLGAlt);
Evolves3 = new EvolutionTree(new[] { Resources.evos_g3 }, GameVersion.RS, PersonalTable.RS, MaxSpeciesID_3);
// Update Personal Entries with TM/Tutor Data
var TMHM = Data.unpackMini(Resources.hmtm_g3, "g3");
@ -296,13 +347,33 @@ namespace PKHeX.Core
StaticHG = getStaticEncounters(GameVersion.HG);
StaticSS = getStaticEncounters(GameVersion.SS);
SlotsD = getEncounterTables(GameVersion.D);
SlotsP = getEncounterTables(GameVersion.P);
SlotsPt = getEncounterTables(GameVersion.Pt);
SlotsHG = getEncounterTables(GameVersion.HG);
SlotsSS = getEncounterTables(GameVersion.SS);
var D_Slots = getEncounterTables(GameVersion.D);
var P_Slots = getEncounterTables(GameVersion.P);
var Pt_Slots = getEncounterTables(GameVersion.Pt);
var HG_Slots = getEncounterTables(GameVersion.HG);
var SS_Slots = getEncounterTables(GameVersion.SS);
var HG_Headbutt_Slots = EncounterArea.getArray4HGSS_Headbutt(Data.unpackMini(Resources.encunters_hb_hg, "hg"));
var SS_Headbutt_Slots = EncounterArea.getArray4HGSS_Headbutt(Data.unpackMini(Resources.encunters_hb_ss, "ss"));
//Evolves4 = new EvolutionTree(Data.unpackMini(Resources.evos_dp, "dp"), GameVersion.DP, PersonalTable.DP, MaxSpeciesID_4);
var D_HoneyTrees_Slots = SlotsD_HoneyTree.Clone(HoneyTreesLocation);
var P_HoneyTrees_Slots = SlotsP_HoneyTree.Clone(HoneyTreesLocation);
var Pt_HoneyTrees_Slots = SlotsPt_HoneyTree.Clone(HoneyTreesLocation);
MarkG4Slots(ref D_Slots);
MarkG4Slots(ref P_Slots);
MarkG4Slots(ref Pt_Slots);
MarkG4Slots(ref HG_Slots);
MarkG4Slots(ref SS_Slots);
MarkG4Slots(ref HG_Headbutt_Slots);
MarkG4Slots(ref SS_Headbutt_Slots);
SlotsD = addExtraTableSlots(addExtraTableSlots(D_Slots, D_HoneyTrees_Slots), SlotsDPPPtAlt);
SlotsP = addExtraTableSlots(addExtraTableSlots(P_Slots, P_HoneyTrees_Slots), SlotsDPPPtAlt);
SlotsPt = addExtraTableSlots(addExtraTableSlots(Pt_Slots, Pt_HoneyTrees_Slots), SlotsDPPPtAlt);
SlotsHG = addExtraTableSlots(addExtraTableSlots(HG_Slots, HG_Headbutt_Slots), SlotsHGSSAlt);
SlotsSS = addExtraTableSlots(addExtraTableSlots(SS_Slots, SS_Headbutt_Slots), SlotsHGSSAlt);
Evolves4 = new EvolutionTree(new[] { Resources.evos_g4 }, GameVersion.DP, PersonalTable.DP, MaxSpeciesID_4);
// Update Personal Entries with Tutor Data
var tutors = Data.unpackMini(Resources.tutors_g4, "g4");
@ -325,7 +396,7 @@ namespace PKHeX.Core
MarkG5Slots(ref SlotsB2);
MarkG5Slots(ref SlotsW2);
//Evolves5 = new EvolutionTree(Data.unpackMini(Resources.evos_bw, "bw"), GameVersion.BW, PersonalTable.BW, MaxSpeciesID_5);
Evolves5 = new EvolutionTree(new[] { Resources.evos_g5 }, GameVersion.BW, PersonalTable.BW, MaxSpeciesID_5);
}
// Gen 6
{
@ -363,10 +434,6 @@ namespace PKHeX.Core
Evolves7 = new EvolutionTree(Data.unpackMini(Resources.evos_sm, "sm"), GameVersion.SM, PersonalTable.SM, MaxSpeciesID_7);
}
// Temp
Evolves3 = Evolves4 = Evolves5 = Evolves6;
}
// Moves

View file

@ -27,6 +27,28 @@ namespace PKHeX.Core
}
}
public EncounterArea Clone(int location)
{
EncounterArea Areas = new EncounterArea
{
Location = location,
Slots = new EncounterSlot[Slots.Length]
};
for (int i = 0; i < Slots.Length; i++)
{
Areas.Slots[i] = Slots[i].Clone();
}
return Areas;
}
public EncounterArea[] Clone(int[] locations)
{
EncounterArea[] Areas = new EncounterArea[locations.Length];
for (int i = 0; i < locations.Length; i++)
Areas[i] = Clone(locations[i]);
return Areas;
}
private static EncounterSlot1[] getSlots1_GW(byte[] data, ref int ofs, SlotType t)
{
int rate = data[ofs++];
@ -224,6 +246,423 @@ namespace PKHeX.Core
return head.Concat(rock);
}
private static IEnumerable<EncounterSlot> getSlots3(byte[] data, ref int ofs, int numslots, SlotType t)
{
var slots = new List<EncounterSlot>();
int Ratio = data[ofs];
//1 byte padding
if (Ratio > 0)
{
for (int i = 0; i < numslots; i++)
{
int Species = BitConverter.ToInt16(data, ofs + 4 + i * 4);
if (Species <= 0)
continue;
slots.Add(new EncounterSlot
{
LevelMin = data[ofs + 2 + i * 4],
LevelMax = data[ofs + 3 + i * 4],
Species = Species,
SlotNumber = i,
Type = t
});
}
}
ofs += 2 + numslots * 4;
return slots;
}
private static IEnumerable<EncounterSlot> getSlots3_F(byte[] data, ref int ofs, int numslots)
{
var slots = new List<EncounterSlot>();
int Ratio = data[ofs];
//1 byte padding
if (Ratio > 0)
{
for (int i = 0; i < numslots; i++)
{
int Species = BitConverter.ToInt16(data, ofs + 4 + i * 4);
if (Species <= 0)
continue;
var slot = new EncounterSlot
{
LevelMin = data[ofs + 2 + i*4],
LevelMax = data[ofs + 3 + i*4],
Species = Species,
};
if (i < 2)
{
slot.Type = SlotType.Old_Rod;
slot.SlotNumber = i; // 0,1
}
else if (i < 5)
{
slot.Type = SlotType.Good_Rod;
slot.SlotNumber = i - 2; // 0,1,2
}
else
{
slot.Type = SlotType.Super_Rod;
slot.SlotNumber = i - 5; // 0,1,2,3,4
}
slots.Add(slot);
}
}
ofs += 2 + numslots * 4;
return slots;
}
private static EncounterSlot[] getSlots4_DPPt_G(byte[] data, ref int ofs, int numslots, SlotType t)
{
var slots = new EncounterSlot[numslots];
for (int i = 0; i < numslots; i++)
{
int level = BitConverter.ToInt32(data, ofs + i * 8);
int species = BitConverter.ToInt32(data, ofs + i * 8);
slots[i] = new EncounterSlot
{
LevelMax = level,
LevelMin = level,
Species = species,
SlotNumber = i,
Type = t
};
}
ofs += numslots * 8;
return slots;
}
private static EncounterSlot[] getSlots4_HGSS_G(byte[] data, ref int ofs, int numslots, SlotType t)
{
var slots = new EncounterSlot[numslots * 3];
// First 36 slots are morning, day and night grass slots
// The order is 12 level values, 12 morning species, 12 day species and 12 night species
for (int i = 0; i < numslots; i++)
{
int level = data[ofs + i];
int species = BitConverter.ToUInt16(data, ofs + numslots + i * 2);
slots[i] = new EncounterSlot
{
LevelMin = level,
LevelMax = level,
Species = species,
SlotNumber = i,
Type = t
};
}
for (int i = 0; i < numslots; i++)
{
slots[numslots + i] = slots[i].Clone();
slots[numslots + i].Species = BitConverter.ToUInt16(data, ofs + numslots * 3 + i * 2);
slots[numslots + i].Type = t;
}
for (int i = 0; i < numslots; i++)
{
slots[numslots * 2 + i] = slots[i].Clone();
slots[numslots * 2 + i].Species = BitConverter.ToUInt16(data, ofs + numslots * 5 + i * 2);
slots[numslots * 2 + i].Type = t;
}
ofs += numslots * 7;
return slots;
}
private static IEnumerable<EncounterSlot> getSlots4_G_Replace(byte[] data, ref int ofs, int slotSize, EncounterSlot[] ReplacedSlots, int[] slotnums, SlotType t = SlotType.Grass)
{
//Special slots like GBA Dual Slot. Those slot only contain the info the species, the level is copy from one of the first grass slots
var slots = new List<EncounterSlot>();
int numslots = slotnums.Length;
for (int i = 0; i < numslots; i++)
{
var baseSlot = ReplacedSlots[slotnums[i]];
if (baseSlot.LevelMin <= 0)
continue;
int species = BitConverter.ToInt32(data, ofs + i * slotSize);
if (species <= 0)
continue;
var slot = baseSlot.Clone();
slot.Species = species;
slot.Type = t;
slots.Add(slot);
}
ofs += numslots * slotSize;
return slots;
}
private static IEnumerable<EncounterSlot> getSlots4_G_TimeReplace(byte[] data, ref int ofs, EncounterSlot[] GrassSlots, SlotType t, int[] slotnums)
{
var slots = new List<EncounterSlot>();
int[] CountReplaced = new int[2];
// Slots for day, morning and night slots in DPPt. Only contain species data, level is copy from grass slot
for (int i = 0; i < 3; i++)
{
int species = BitConverter.ToInt32(data, ofs + i * 4);
if (species <= 0)
continue;
for (int j = 0; j < 2; j++)
{
var slot = GrassSlots[slotnums[j]].Clone();
slot.Species = species;
slot.Type = t;
slots.Add(slot);
CountReplaced[j]++;
}
ofs += 8;
}
// If the grass slot is replaced by all the time slots that means the species in the grass slot will never be used
// Unlike raid slot and gba dual slot the time of the day is always day, morning or night
if (CountReplaced[0] == 3)
GrassSlots[2].Species = 0;
if (CountReplaced[1] == 3)
GrassSlots[3].Species = 0;
return GrassSlots.Where(s => s.Species > 0).Concat(slots);
}
private static IEnumerable<EncounterSlot> getSlots4DPPt_WFR(byte[] data, ref int ofs, int numslots, SlotType t)
{
var slots = new List<EncounterSlot>();
for (int i = 0; i < numslots; i++)
{
// min, max, unused, unused, [32bit species]
int Species = BitConverter.ToInt32(data, ofs + 4 + i * 8);
if (Species <= 0)
continue;
slots.Add(new EncounterSlot
{
LevelMin = data[ofs + 0 + i * 8],
LevelMax = data[ofs + 1 + i * 8],
Species = Species,
Type = t
});
}
ofs += numslots * 8;
return slots;
}
private static IEnumerable<EncounterSlot> getSlots4HGSS_WFR(byte[] data, ref int ofs, int numslots, SlotType t)
{
var slots = new List<EncounterSlot>();
for (int i = 0; i < numslots; i++)
{
// min, max, [16bit species]
int Species = BitConverter.ToInt16(data, ofs + 2 + i * 4);
if (Species <= 0)
continue;
slots.Add(new EncounterSlot
{
LevelMin = data[ofs + 0 + i * 4],
LevelMax = data[ofs + 1 + i * 4],
Species = Species,
Type = t
});
}
ofs += numslots * 4;
return slots;
}
private static EncounterArea getArea3(byte[] data)
{
EncounterArea Area3 = new EncounterArea();
if (data.Length < 6)
{ Area3.Location = 0; Area3.Slots = new EncounterSlot[0]; return Area3; }
Area3.Location = data[0];
var HaveGrassSlots = data[1] == 1;
var HaveSurfSlots = data[2] == 1;
var HaveRockSmashSlots = data[3] == 1;
var HaveFishingSlots = data[4] == 1;
int offset = 5;
var slots = new List<EncounterSlot>();
if (HaveGrassSlots)
slots.AddRange(getSlots3(data, ref offset, 12, SlotType.Grass));
if (HaveSurfSlots)
slots.AddRange(getSlots3(data, ref offset, 5, SlotType.Surf));
if (HaveRockSmashSlots)
slots.AddRange(getSlots3(data, ref offset, 5, SlotType.Rock_Smash));
if (HaveFishingSlots)
slots.AddRange(getSlots3_F(data, ref offset, 10));
Area3.Slots = slots.ToArray();
return Area3;
}
private static EncounterArea getArea4DPPt(byte[] data)
{
EncounterArea Area4 = new EncounterArea();
if (data.Length != 426)
{ Area4.Location = 0; Area4.Slots = new EncounterSlot[0]; return Area4; }
var Slots = new List<EncounterSlot>();
Area4.Location = BitConverter.ToUInt16(data, 0);
var GrassRatio = BitConverter.ToInt32(data, 2);
var ofs = 6;
if (GrassRatio > 0)
{
EncounterSlot[] GrassSlots = getSlots4_DPPt_G(data, ref ofs, 12, SlotType.Grass);
//Morning, Day and Night slots replace slots 2 and 3
Slots.AddRange(getSlots4_G_TimeReplace(data, ref ofs, GrassSlots, SlotType.Grass, Legal.Slot4_Time));
//Pokéradar slots replace slots 6,7,10 and 11
//Pokeradar is marked with different slot type because it have different PID-IV generationn
Slots.AddRange(getSlots4_G_Replace(data, ref ofs, 4, GrassSlots, Legal.Slot4_Radar, SlotType.Pokeradar));
ofs += 24; //24 bytes padding
//Dual Slots replace slots 8 and 9
Slots.AddRange(getSlots4_G_Replace(data, ref ofs, 4, GrassSlots, Legal.Slot4_Dual)); // Ruby
Slots.AddRange(getSlots4_G_Replace(data, ref ofs, 4, GrassSlots, Legal.Slot4_Dual)); // Sapphire
Slots.AddRange(getSlots4_G_Replace(data, ref ofs, 4, GrassSlots, Legal.Slot4_Dual)); // Emerald
Slots.AddRange(getSlots4_G_Replace(data, ref ofs, 4, GrassSlots, Legal.Slot4_Dual)); // FireRed
Slots.AddRange(getSlots4_G_Replace(data, ref ofs, 4, GrassSlots, Legal.Slot4_Dual)); // LeafGreen
}
else
ofs = 206;
var SurfRatio = BitConverter.ToInt32(data, ofs);
ofs += 4;
if (SurfRatio > 0)
Slots.AddRange(getSlots4DPPt_WFR(data, ref ofs, 5, SlotType.Surf));
else
ofs += 40;
ofs += 44; //44 bytes padding
var OldRodRatio = BitConverter.ToInt32(data, 294);
ofs += 4;
if (OldRodRatio > 0)
Slots.AddRange(getSlots4DPPt_WFR(data, ref ofs, 5, SlotType.Old_Rod));
else
ofs += 40;
var GoodRodRatio = BitConverter.ToInt32(data, 338);
ofs += 4;
if (GoodRodRatio > 0)
Slots.AddRange(getSlots4DPPt_WFR(data, ref ofs, 5, SlotType.Good_Rod));
else
ofs += 40;
var SuperRodRatio = BitConverter.ToInt32(data, 382);
ofs += 4;
if (SuperRodRatio > 0)
Slots.AddRange(getSlots4DPPt_WFR(data, ref ofs, 5, SlotType.Super_Rod));
else
ofs += 40;
Area4.Slots = Slots.ToArray();
return Area4;
}
private static EncounterArea getArea4HGSS(byte[] data)
{
EncounterArea Area4 = new EncounterArea();
if (data.Length != 198)
{ Area4.Location = 0; Area4.Slots = new EncounterSlot[0]; return Area4; }
var Slots = new List<EncounterSlot>();
Area4.Location = BitConverter.ToUInt16(data, 0);
int GrassRatio = data[2];
int SurfRatio = data[3];
int RockSmashRatio = data[4];
int OldRodRatio = data[5];
int GoodRodRatio = data[6];
int SuperRodRatio = data[7];
// 2 bytes padding
int ofs = 10;
EncounterSlot[] GrassSlots = null;
if (GrassRatio > 0)
{
// First 36 slots are morning, day and night grass slots
// The order is 12 level values, 12 morning species, 12 day species and 12 night species
GrassSlots = getSlots4_HGSS_G(data, ref ofs, 12, SlotType.Grass);
Slots.AddRange(GrassSlots.Where(s => s.Species > 0));
// Hoenn Sound and Sinnoh Sound replace slots 4 and 5
Slots.AddRange(getSlots4_G_Replace(data, ref ofs, 2, GrassSlots, Legal.Slot4_Sound)); // Hoenn
Slots.AddRange(getSlots4_G_Replace(data, ref ofs, 2, GrassSlots, Legal.Slot4_Sound)); // Sinnoh
}
else
ofs = 102;
if (SurfRatio > 0)
Slots.AddRange(getSlots4HGSS_WFR(data, ref ofs, 5, SlotType.Surf));
else
ofs += 20;
if (RockSmashRatio > 0)
Slots.AddRange(getSlots4HGSS_WFR(data, ref ofs, 2, SlotType.Rock_Smash));
else
ofs += 8;
if (OldRodRatio > 0)
Slots.AddRange(getSlots4HGSS_WFR(data, ref ofs, 5, SlotType.Old_Rod));
else
ofs += 20;
if (GoodRodRatio > 0)
Slots.AddRange(getSlots4HGSS_WFR(data, ref ofs, 5, SlotType.Good_Rod));
else
ofs += 20;
if (SuperRodRatio > 0)
Slots.AddRange(getSlots4HGSS_WFR(data, ref ofs, 5, SlotType.Super_Rod));
else
ofs += 20;
if (GrassRatio > 0)
{
// National Radio replaces slots 4 and 5
Slots.AddRange(getSlots4_G_Replace(data, ref ofs, 2, GrassSlots, Legal.Slot4_Sound)); // Radio
}
// 4 bytes padding
Area4.Slots = Slots.ToArray();
return Area4;
}
private static EncounterArea getArea4HGSS_Headbutt(byte[] data)
{
if (data.Length < 78)
return new EncounterArea(); // bad data
//2 byte location ID (defer to end)
//4 bytes padding
var Slots = new List<EncounterSlot>();
// 00-11 Normal trees
// 12-17 Special trees
for (int i = 0; i < 18; i++)
{
int Species = BitConverter.ToInt16(data, 6 + i*4);
if (Species <= 0)
continue;
Slots.Add(new EncounterSlot
{
Species = Species,
LevelMin = data[8 + i*4],
LevelMax = data[9 + i*4],
Type = SlotType.Headbutt
});
}
return new EncounterArea
{
Location = BitConverter.ToUInt16(data, 0),
Slots = Slots.ToArray()
};
}
/// <summary>
/// RBY Format Slot Getter from data.
/// </summary>
@ -375,6 +814,56 @@ namespace PKHeX.Core
return getAreas2_H(data, ref ofs).ToArray();
}
/// <summary>
/// Gets the encounter areas with <see cref="EncounterSlot"/> information from Generation 3 data.
/// </summary>
/// <param name="entries">Raw data, one byte array per encounter area</param>
/// <returns>Array of encounter areas.</returns>
public static EncounterArea[] getArray3(byte[][] entries)
{
if (entries == null)
return null;
var Areas = new List<EncounterArea>();
foreach (byte[] t in entries)
{
EncounterArea Area = getArea3(t);
if (Area.Slots.Any())
Areas.Add(Area);
}
return Areas.ToArray();
}
/// <summary>
/// Gets the encounter areas with <see cref="EncounterSlot"/> information from Generation 4 Diamond, Pearl and Platinum data.
/// </summary>
/// <param name="entries">Raw data, one byte array per encounter area</param>
/// <returns>Array of encounter areas.</returns>
public static EncounterArea[] getArray4DPPt(byte[][] entries)
{
return entries?.Select(getArea4DPPt).Where(Area => Area.Slots.Any()).ToArray();
}
/// <summary>
/// Gets the encounter areas with <see cref="EncounterSlot"/> information from Generation 4 Hearth Gold and Soul Silver data.
/// </summary>
/// <param name="entries">Raw data, one byte array per encounter area</param>
/// <returns>Array of encounter areas.</returns>
public static EncounterArea[] getArray4HGSS(byte[][] entries)
{
return entries?.Select(getArea4HGSS).Where(Area => Area.Slots.Any()).ToArray();
}
/// <summary>
/// Gets the encounter areas with <see cref="EncounterSlot"/> information from Generation 4 Hearth Gold and Soul Silver Headbutt tree data.
/// </summary>
/// <param name="entries">Raw data, one byte array per encounter area</param>
/// <returns>Array of encounter areas.</returns>
public static EncounterArea[] getArray4HGSS_Headbutt(byte[][] entries)
{
return entries?.Select(getArea4HGSS_Headbutt).Where(Area => Area.Slots.Any()).ToArray();
}
public static EncounterArea[] getArray(byte[][] entries)
{
if (entries == null)

View file

@ -25,6 +25,7 @@
public bool Fateful = false;
public bool RibbonWishing = false;
public bool SkipFormCheck = false;
public bool NSparkle = false;
public string Name
{

View file

@ -25,6 +25,15 @@ namespace PKHeX.Core
case GameVersion.GSC:
Entries = EvolutionSet2.getArray(data[0], maxSpeciesTree);
break;
case GameVersion.RS:
Entries = EvolutionSet3.getArray(data[0]);
break;
case GameVersion.DP:
Entries = EvolutionSet4.getArray(data[0]);
break;
case GameVersion.BW:
Entries = EvolutionSet5.getArray(data[0]);
break;
case GameVersion.ORAS:
Entries.AddRange(data.Select(d => new EvolutionSet6(d)));
break;
@ -256,6 +265,164 @@ namespace PKHeX.Core
return evos;
}
}
public class EvolutionSet3 : EvolutionSet
{
private static EvolutionMethod getMethod(byte[] data, int offset)
{
int method = BitConverter.ToUInt16(data, offset + 0);
int arg = BitConverter.ToUInt16(data, offset + 2);
int species = PKX.getG4Species(BitConverter.ToUInt16(data, offset + 4));
//2 bytes padding
switch (method)
{
case 1: /* Friendship*/
case 2: /* Friendship day*/
case 3: /* Friendship night*/
case 5: /* Trade */
case 6: /* Trade while holding */
return new EvolutionMethod { Method = method, Species = species, Argument = arg };
case 4: /* Level Up */
return new EvolutionMethod { Method = 4, Species = species, Level = arg, Argument = arg };
case 7: /* Use item */
case 15: /* Beauty evolution*/
return new EvolutionMethod { Method = method + 1, Species = species, Argument = arg };
case 8: /* Tyrogue -> Hitmonchan */
case 9: /* Tyrogue -> Hitmonlee */
case 10: /* Tyrogue -> Hitmontop*/
case 11: /* Wurmple -> Silcoon evolution */
case 12: /* Wurmple -> Cascoon evolution */
case 13: /* Nincada -> Ninjask evolution */
case 14: /* Shedinja spawn in Nincada -> Ninjask evolution */
return new EvolutionMethod { Method = method + 1, Species = species, Level = arg, Argument = arg };
}
return null;
}
public static List<EvolutionSet> getArray(byte[] data)
{
EvolutionSet[] evos = new EvolutionSet[Legal.MaxSpeciesID_3 + 1];
evos[0] = new EvolutionSet3 { PossibleEvolutions = new EvolutionMethod[0] };
for (int i = 0; i <= Legal.MaxSpeciesIndex_3; i++)
{
int g4species = PKX.getG4Species(i);
if (g4species == 0)
continue;
int offset = i * 40;
var m_list = new List<EvolutionMethod>();
for (int j = 0; j < 5; j++)
{
EvolutionMethod m = getMethod(data, offset);
if(m!=null)
m_list.Add(m);
else
break;
offset += 8;
}
evos[g4species] = new EvolutionSet3 { PossibleEvolutions = m_list.ToArray() };
}
return evos.ToList();
}
}
public class EvolutionSet4 : EvolutionSet
{
private static EvolutionMethod getMethod(byte[] data, int offset)
{
int[] argEvos = { 6, 8, 16, 17, 18, 19, 20, 21, 22 };
int method = BitConverter.ToUInt16(data, offset + 0);
int arg = BitConverter.ToUInt16(data, offset + 2);
int species = BitConverter.ToUInt16(data, offset + 4);
if (method == 0)
return null;
// To have the same estructure as gen 6
// Gen 4 Method 6 is Gen 6 Method 7, G4 7 = G6 8, and so on
if (method > 6)
method++;
var evo = new EvolutionMethod
{
Method = method,
Argument = arg,
Species = species,
Level = arg,
};
if (argEvos.Contains(evo.Method))
evo.Level = 0;
return evo;
}
public static List<EvolutionSet> getArray(byte[] data)
{
var evos = new List<EvolutionSet>();
for (int i = 0; i <= Legal.MaxSpeciesIndex_4_HGSSPt; i++)
{
/* 44 bytes per species,
* for every species 7 evolutions with 6 bytes per evolution,
* last 2 bytes of every specie is padding*/
int offset = i * 44;
var m_list = new List<EvolutionMethod>();
for (int j = 0; j < 7; j++)
{
EvolutionMethod m = getMethod(data, offset);
if (m != null)
m_list.Add(m);
else
break;
offset += 6;
}
evos.Add(new EvolutionSet4 { PossibleEvolutions = m_list.ToArray() });
}
return evos.ToList();
}
}
public class EvolutionSet5 : EvolutionSet
{
private static EvolutionMethod getMethod(byte[] data, int offset)
{
int[] argEvos = { 6, 8, 16, 17, 18, 19, 20, 21, 22 };
int method = BitConverter.ToUInt16(data, offset + 0);
int arg = BitConverter.ToUInt16(data, offset + 2);
int species = BitConverter.ToUInt16(data, offset + 4);
if (method == 0)
return null;
var evo = new EvolutionMethod
{
Method = method,
Argument = arg,
Species = species,
Level = arg,
};
if (argEvos.Contains(evo.Method))
evo.Level = 0;
return evo;
}
public static List<EvolutionSet> getArray(byte[] data)
{
var evos = new List<EvolutionSet>();
for (int i = 0; i <= Legal.MaxSpeciesIndex_5_B2W2; i++)
{
/* 42 bytes per species,
* for every species 7 evolutions with 6 bytes per evolution*/
int offset = i * 42;
var m_list = new List<EvolutionMethod>();
for (int j = 0; j < 7; j++)
{
EvolutionMethod m = getMethod(data, offset);
if (m != null)
m_list.Add(m);
else
break;
offset += 6;
}
evos.Add(new EvolutionSet5 { PossibleEvolutions = m_list.ToArray() });
}
return evos.ToList();
}
}
public class EvolutionSet6 : EvolutionSet
{
private const int SIZE = 6;

View file

@ -19,5 +19,7 @@
SOS,
Swarm,
Headbutt,
Pokeradar,
HoneyTree
}
}

View file

@ -4,6 +4,7 @@ namespace PKHeX.Core
{
public static partial class Legal
{
internal const int MaxSpeciesIndex_3 = 412;
internal const int MaxSpeciesID_3 = 386;
internal const int MaxMoveID_3 = 354;
internal const int MaxItemID_3 = 374;
@ -143,5 +144,83 @@ namespace PKHeX.Core
//todo
};
#region AltSlots
private static readonly EncounterArea[] SlotsRSEAlt =
{
new EncounterArea {
Location = 34, // Route 119
Slots = new[]
{
new EncounterSlot { Species = 349, LevelMin = 20, LevelMax = 25, Type = SlotType.Super_Rod, Form = 25 }, // Feebas
},}
};
private static readonly EncounterArea[] SlotsFRLGAlt =
{
new EncounterArea {
Location = 188, // Monean Chamber
Slots = new[]
{
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 0 }, // Unown A
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 26 }, // Unown ?
},},
new EncounterArea {
Location = 189, // Liptoo Chamber
Slots = new[]
{
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 2 }, // Unown C
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 3 }, // Unown D
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 7 }, // Unown H
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 14 }, // Unown O
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 20 }, // Unown U
},},
new EncounterArea {
Location = 190, // Weepth Chamber
Slots = new[]
{
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 4 }, // Unown E
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 8 }, // Unown I
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 13 }, // Unown N
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 18 }, // Unown S
},},
new EncounterArea {
Location = 191, // Dilford Chamber
Slots = new[]
{
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 9 }, // Unown J
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 11 }, // Unown L
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 15 }, // Unown P
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 16 }, // Unown Q
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 17 }, // Unown R
},},
new EncounterArea {
Location = 192, // Scufib Chamber
Slots = new[]
{
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 5 }, // Unown F
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 6 }, // Unown G
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 10 }, // Unown K
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 19 }, // Unown T
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 24 }, // Unown Y
},},
new EncounterArea {
Location = 193, // Rixy Chamber
Slots = new[]
{
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 1 }, // Unown B
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 12 }, // Unown M
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 21 }, // Unown V
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 22 }, // Unown W
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 23 }, // Unown X
},},
new EncounterArea {
Location = 193, // Viapois Chamber
Slots = new[]
{
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 25 }, // Unown Z
new EncounterSlot { Species = 201, LevelMin = 25, LevelMax = 25, Type = SlotType.Grass, Form = 27 }, // Unown !
},}
};
#endregion
}
}

View file

@ -4,6 +4,8 @@ namespace PKHeX.Core
{
public static partial class Legal
{
internal const int MaxSpeciesIndex_4_DP = 500;
internal const int MaxSpeciesIndex_4_HGSSPt = 507;
internal const int MaxSpeciesID_4 = 493;
internal const int MaxMoveID_4 = 467;
internal const int MaxItemID_4_DP = 464;
@ -320,8 +322,8 @@ namespace PKHeX.Core
//Gift
new EncounterStatic { Gift = true, Species = 133, Level = 5, Location = 131, }, // Eevee @ Goldenrod Cityx
new EncounterStatic { Gift = true, Species = 147, Level = 15, Location = 222, Moves = new int[] {245, 086, 239, 082}, }, // Dratini @ Dragon's Den (ExtremeSpeed)
new EncounterStatic { Gift = true, Species = 147, Level = 15, Location = 222, Moves = new int[] {043, 086, 239, 082}, }, // Dratini @ Dragon's Den (Non-ExtremeSpeed)
new EncounterStatic { Gift = true, Species = 147, Level = 15, Location = 222, Moves = new[] {245, 086, 239, 082}, }, // Dratini @ Dragon's Den (ExtremeSpeed)
new EncounterStatic { Gift = true, Species = 147, Level = 15, Location = 222, Moves = new[] {043, 086, 239, 082}, }, // Dratini @ Dragon's Den (Non-ExtremeSpeed)
new EncounterStatic { Gift = true, Species = 236, Level = 10, Location = 216, }, // Tyrogue @ Mt. Mortar
new EncounterStatic { Gift = true, Species = 175, Level = 1, EggLocation = 128,}, // Togepi Egg @ Violet City
new EncounterStatic { Gift = true, Species = 179, Level = 1, EggLocation = 128,}, // Mareep Egg @ Violet City
@ -397,27 +399,168 @@ namespace PKHeX.Core
};
internal static readonly EncounterTrade[] TradeGift_DPPt =
{
new EncounterTrade { Species = 063, Ability = 1, TID = 25643, SID = 00000, OTGender = 1, Gender = 0, IVs = new int[] {15,15,15,25,25,20}, Nature = Nature.Quiet,}, // Abra
new EncounterTrade { Species = 441, Ability = 2, TID = 44142, SID = 00000, OTGender = 0, Gender = 1, IVs = new int[] {15,20,15,25,15,25}, Nature = Nature.Lonely, }, // Chatot
new EncounterTrade { Species = 093, Ability = 1, TID = 19248, SID = 00000, OTGender = 1, Gender = 0, IVs = new int[] {20,25,15,15,15,25}, Nature = Nature.Hasty,}, // Haunter
new EncounterTrade { Species = 129, Ability = 1, TID = 53277, SID = 00000, OTGender = 0, Gender = 1, IVs = new int[] {15,25,15,25,15,20}, Nature = Nature.Mild}, // Magikarp
new EncounterTrade { Species = 063, Ability = 1, TID = 25643, SID = 00000, OTGender = 1, Gender = 0, IVs = new[] {15,15,15,25,25,20}, Nature = Nature.Quiet,}, // Abra
new EncounterTrade { Species = 441, Ability = 2, TID = 44142, SID = 00000, OTGender = 0, Gender = 1, IVs = new[] {15,20,15,25,15,25}, Nature = Nature.Lonely, }, // Chatot
new EncounterTrade { Species = 093, Ability = 1, TID = 19248, SID = 00000, OTGender = 1, Gender = 0, IVs = new[] {20,25,15,15,15,25}, Nature = Nature.Hasty,}, // Haunter
new EncounterTrade { Species = 129, Ability = 1, TID = 53277, SID = 00000, OTGender = 0, Gender = 1, IVs = new[] {15,25,15,25,15,20}, Nature = Nature.Mild}, // Magikarp
};
internal static readonly EncounterTrade[] TradeGift_HGSS =
{
new EncounterTrade { Species = 095, Ability = 2, TID = 48926, SID = 00000, OTGender = 0, Gender = 0, IVs = new int[] {25,20,25,15,15,15}, Nature = Nature.Hasty,}, // Onix
new EncounterTrade { Species = 066, Ability = 1, TID = 37460, SID = 00000, OTGender = 0, Gender = 1, IVs = new int[] {15,25,20,15,15,20}, Nature = Nature.Lonely,}, // Machop
new EncounterTrade { Species = 100, Ability = 2, TID = 29189, SID = 00000, OTGender = 0, Gender = 2, IVs = new int[] {15,20,15,25,15,25}, Nature = Nature.Hardy,}, // Voltorb
new EncounterTrade { Species = 085, Ability = 1, TID = 00283, SID = 00000, OTGender = 1, Gender = 1, IVs = new int[] {20,20,20,15,15,15}, Nature = Nature.Impish,}, // Dodrio
new EncounterTrade { Species = 082, Ability = 1, TID = 50082, SID = 00000, OTGender = 0, Gender = 2, IVs = new int[] {15,20,15,20,20,20}, Nature = Nature.Impish,}, // Magneton
new EncounterTrade { Species = 178, Ability = 1, TID = 15616, SID = 00000, OTGender = 0, Gender = 0, IVs = new int[] {15,20,15,20,20,20}, Nature = Nature.Modest,}, // Xatu
new EncounterTrade { Species = 025, Ability = 1, TID = 33038, SID = 00000, OTGender = 0, Gender = 1, IVs = new int[] {20,25,18,25,13,31}, Nature = Nature.Jolly,}, // Pikachu
new EncounterTrade { Species = 374, Ability = 1, TID = 23478, SID = 00000, OTGender = 0, Gender = 2, IVs = new int[] {28,29,24,24,25,23}, Nature = Nature.Brave,}, // Beldum
new EncounterTrade { Species = 111, Ability = 1, TID = 06845, SID = 00000, OTGender = 0, Gender = 1, IVs = new int[] {22,31,13,22,9,0}, Nature = Nature.Relaxed, Moves= new int[]{422,-1,-1,-1} }, // Rhyhorn
new EncounterTrade { Species = 208, Ability = 1, TID = 26491, SID = 00000, OTGender = 1, Gender = 0, IVs = new int[] {8,30,28,18,20,6}, Nature = Nature.Brave,}, // Steelix
new EncounterTrade { Species = 095, Ability = 2, TID = 48926, SID = 00000, OTGender = 0, Gender = 0, IVs = new[] {25,20,25,15,15,15}, Nature = Nature.Hasty,}, // Onix
new EncounterTrade { Species = 066, Ability = 1, TID = 37460, SID = 00000, OTGender = 0, Gender = 1, IVs = new[] {15,25,20,15,15,20}, Nature = Nature.Lonely,}, // Machop
new EncounterTrade { Species = 100, Ability = 2, TID = 29189, SID = 00000, OTGender = 0, Gender = 2, IVs = new[] {15,20,15,25,15,25}, Nature = Nature.Hardy,}, // Voltorb
new EncounterTrade { Species = 085, Ability = 1, TID = 00283, SID = 00000, OTGender = 1, Gender = 1, IVs = new[] {20,20,20,15,15,15}, Nature = Nature.Impish,}, // Dodrio
new EncounterTrade { Species = 082, Ability = 1, TID = 50082, SID = 00000, OTGender = 0, Gender = 2, IVs = new[] {15,20,15,20,20,20}, Nature = Nature.Impish,}, // Magneton
new EncounterTrade { Species = 178, Ability = 1, TID = 15616, SID = 00000, OTGender = 0, Gender = 0, IVs = new[] {15,20,15,20,20,20}, Nature = Nature.Modest,}, // Xatu
new EncounterTrade { Species = 025, Ability = 1, TID = 33038, SID = 00000, OTGender = 0, Gender = 1, IVs = new[] {20,25,18,25,13,31}, Nature = Nature.Jolly,}, // Pikachu
new EncounterTrade { Species = 374, Ability = 1, TID = 23478, SID = 00000, OTGender = 0, Gender = 2, IVs = new[] {28,29,24,24,25,23}, Nature = Nature.Brave,}, // Beldum
new EncounterTrade { Species = 111, Ability = 1, TID = 06845, SID = 00000, OTGender = 0, Gender = 1, IVs = new[] {22,31,13,22,9,0}, Nature = Nature.Relaxed, Moves= new[]{422,-1,-1,-1} }, // Rhyhorn
new EncounterTrade { Species = 208, Ability = 1, TID = 26491, SID = 00000, OTGender = 1, Gender = 0, IVs = new[] {8,30,28,18,20,6}, Nature = Nature.Brave,}, // Steelix
//Gift
new EncounterTrade { Species = 021, Ability = 1, TID = 01001, SID = 00000, OTGender = 0, Gender = 1, Nature = Nature.Hasty, Level = 20, Location = 183, Moves= new int[]{043,031,228,332}},//Webster's Spearow
new EncounterTrade { Species = 213, Ability = 2, TID = 04336, SID = 00000, OTGender = 0, Gender = 1, Nature = Nature.Relaxed, Level = 20, Location = 130, Moves= new int[]{132,117,227,219}},//Kirk's Shuckle
new EncounterTrade { Species = 021, Ability = 1, TID = 01001, SID = 00000, OTGender = 0, Gender = 1, Nature = Nature.Hasty, Level = 20, Location = 183, Moves= new[]{043,031,228,332}},//Webster's Spearow
new EncounterTrade { Species = 213, Ability = 2, TID = 04336, SID = 00000, OTGender = 0, Gender = 1, Nature = Nature.Relaxed, Level = 20, Location = 130, Moves= new[]{132,117,227,219}},//Kirk's Shuckle
};
// Encounter Slots that are replaced
internal static readonly int[] Slot4_Time = {2, 3};
internal static readonly int[] Slot4_Sound = {4, 5};
internal static readonly int[] Slot4_Radar = {6, 7, 10, 11};
internal static readonly int[] Slot4_Dual = {8, 9};
#region Alt Slots
private static readonly EncounterArea[] SlotsDPPPtAlt =
{
new EncounterArea {
Location = 50, // Mount Coronet
Slots = new[]
{
new EncounterSlot { Species = 349, LevelMin = 10, LevelMax = 20, Type = SlotType.Old_Rod }, // Feebas
new EncounterSlot { Species = 349, LevelMin = 10, LevelMax = 20, Type = SlotType.Good_Rod }, // Feebas
new EncounterSlot { Species = 349, LevelMin = 10, LevelMax = 20, Type = SlotType.Super_Rod }, // Feebas
},},
new EncounterArea {
Location = 53, //Solaceon Ruins
Slots = new[]
{
//new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 0 }, // Unown A
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 1 }, // Unown B
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 2 }, // Unown C
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 3 }, // Unown D
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 4 }, // Unown E
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 5 }, // Unown F
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 6 }, // Unown G
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 7 }, // Unown H
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 8 }, // Unown I
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 9 }, // Unown J
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 10 }, // Unown K
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 11 }, // Unown L
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 12 }, // Unown M
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 13 }, // Unown N
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 14 }, // Unown O
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 15 }, // Unown P
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 16 }, // Unown Q
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 17 }, // Unown R
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 18 }, // Unown S
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 19 }, // Unown T
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 20 }, // Unown U
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 21 }, // Unown V
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 22 }, // Unown W
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 23 }, // Unown X
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 24 }, // Unown Y
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 25 }, // Unown !
new EncounterSlot { Species = 201, LevelMin = 14, LevelMax = 30, Type = SlotType.Grass, Form = 26 }, // Unown ?
},},
};
private static readonly EncounterArea[] SlotsHGSSAlt =
{
new EncounterArea {
Location = 209, // Ruins of Alph
Slots = new[]
{
//new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 0 }, // Unown A
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 1 }, // Unown B
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 2 }, // Unown C
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 3 }, // Unown D
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 4 }, // Unown E
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 5 }, // Unown F
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 6 }, // Unown G
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 7 }, // Unown H
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 8 }, // Unown I
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 9 }, // Unown J
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 10 }, // Unown K
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 11 }, // Unown L
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 12 }, // Unown M
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 13 }, // Unown N
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 14 }, // Unown O
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 15 }, // Unown P
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 16 }, // Unown Q
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 17 }, // Unown R
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 18 }, // Unown S
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 19 }, // Unown T
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 20 }, // Unown U
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 21 }, // Unown V
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 22 }, // Unown W
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 23 }, // Unown X
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 24 }, // Unown Y
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 25 }, // Unown !
new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = 26 }, // Unown ?
},},
};
private static readonly EncounterArea SlotsPt_HoneyTree =
new EncounterArea
{
Slots = new[]
{
new EncounterSlot { Species = 190, LevelMin = 5, LevelMax = 15, Type = SlotType.HoneyTree }, // Aipom
new EncounterSlot { Species = 214, LevelMin = 5, LevelMax = 15, Type = SlotType.HoneyTree }, // Heracross
new EncounterSlot { Species = 265, LevelMin = 5, LevelMax = 15, Type = SlotType.HoneyTree }, // Wurmple
new EncounterSlot { Species = 412, LevelMin = 5, LevelMax = 15, Form = 0, Type = SlotType.HoneyTree }, // Burmy Plant Cloak
new EncounterSlot { Species = 415, LevelMin = 5, LevelMax = 15, Type = SlotType.HoneyTree }, // Combee
new EncounterSlot { Species = 420, LevelMin = 5, LevelMax = 15, Type = SlotType.HoneyTree }, // Cheruby
new EncounterSlot { Species = 446, LevelMin = 5, LevelMax = 15, Type = SlotType.HoneyTree }, // Munchlax
},
};
private static readonly EncounterArea SlotsD_HoneyTree =
new EncounterArea {
Slots = SlotsPt_HoneyTree.Slots.Concat( new[]
{
new EncounterSlot { Species = 266, LevelMin = 5, LevelMax = 15, Type = SlotType.HoneyTree }, // Silcoon
}).ToArray()
};
private static readonly EncounterArea SlotsP_HoneyTree =
new EncounterArea
{
Slots = SlotsPt_HoneyTree.Slots.Concat(new[]
{
new EncounterSlot { Species = 268, LevelMin = 5, LevelMax = 15, Type = SlotType.HoneyTree }, // Cascoon
}).ToArray()
};
private static readonly int[] HoneyTreesLocation = new[]
{
20, // Route 205
21, // Route 206
22, // Route 207
23, // Route 208
24, // Route 209
25, // Route 210
26, // Route 211
27, // Route 212
28, // Route 213
29, // Route 214
30, // Route 215
33, // Route 218
36, // Route 221
37, // Route 222
47, // Valley Windworks
49, // Fuego Ironworks
58, //Floaroma Meadow
};
#endregion
}
}

View file

@ -4,6 +4,8 @@ namespace PKHeX.Core
{
public static partial class Legal
{
internal const int MaxSpeciesIndex_5_BW = 667;
internal const int MaxSpeciesIndex_5_B2W2 = 708;
internal const int MaxSpeciesID_5 = 649;
internal const int MaxMoveID_5 = 559;
internal const int MaxItemID_5_BW = 632;

View file

@ -272,21 +272,36 @@
<None Include="Resources\byte\encounter_blue.pkl" />
<None Include="Resources\byte\encounter_crystal.pkl" />
<None Include="Resources\byte\encounter_crystal_h.pkl" />
<None Include="Resources\byte\encounter_d.pkl" />
<None Include="Resources\byte\encounter_e.pkl" />
<None Include="Resources\byte\encounter_fr.pkl" />
<None Include="Resources\byte\encounter_gold.pkl" />
<None Include="Resources\byte\encounter_gold_h.pkl" />
<None Include="Resources\byte\encounter_gsc_f.pkl" />
<None Include="Resources\byte\encounter_hg.pkl" />
<None Include="Resources\byte\encounter_lg.pkl" />
<None Include="Resources\byte\encounter_mn.pkl" />
<None Include="Resources\byte\encounter_mn_sos.pkl" />
<None Include="Resources\byte\encounter_p.pkl" />
<None Include="Resources\byte\encounter_pt.pkl" />
<None Include="Resources\byte\encounter_r.pkl" />
<None Include="Resources\byte\encounter_rb_f.pkl" />
<None Include="Resources\byte\encounter_red.pkl" />
<None Include="Resources\byte\encounter_s.pkl" />
<None Include="Resources\byte\encounter_silver.pkl" />
<None Include="Resources\byte\encounter_silver_h.pkl" />
<None Include="Resources\byte\encounter_sn.pkl" />
<None Include="Resources\byte\encounter_sn_sos.pkl" />
<None Include="Resources\byte\encounter_ss.pkl" />
<None Include="Resources\byte\encounter_w.pkl" />
<None Include="Resources\byte\encounter_w2.pkl" />
<None Include="Resources\byte\encounter_yellow.pkl" />
<None Include="Resources\byte\encounter_yellow_f.pkl" />
<None Include="Resources\byte\encunters_hb_hg.pkl" />
<None Include="Resources\byte\encunters_hb_ss.pkl" />
<None Include="Resources\byte\evos_g3.pkl" />
<None Include="Resources\byte\evos_g4.pkl" />
<None Include="Resources\byte\evos_g5.pkl" />
<None Include="Resources\byte\evos_gsc.pkl" />
<None Include="Resources\byte\evos_rby.pkl" />
<None Include="Resources\byte\evos_sm.pkl" />

View file

@ -1395,7 +1395,7 @@ namespace PKHeX.Core
}
}
#region Gen 3 Species Table
public static int[] newindex => new[]
private static readonly int[] newindex =
{
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,
@ -1417,7 +1417,7 @@ namespace PKHeX.Core
385,386,358,
};
public static int[] oldindex => new[]
private static readonly int[] oldindex =
{
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,

View file

@ -74,9 +74,8 @@ namespace PKHeX.Core
case GameVersion.E:
case GameVersion.FR:
case GameVersion.LG:
Array.Resize(ref d, 387);
for (int i = 0; i < d.Length; i++) // entries are not in order of natdexID
d[i] = new PersonalInfoG3(entries[PKX.getG3Species(i)]);
for (int i = 0; i < d.Length; i++)
d[i] = new PersonalInfoG3(entries[i]);
break;
case GameVersion.DP:
case GameVersion.Pt:

File diff suppressed because it is too large Load diff

View file

@ -7510,4 +7510,49 @@
<data name="encounter_w2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encounter_w2.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="encounter_d" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encounter_d.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="encounter_e" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encounter_e.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="encounter_fr" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encounter_fr.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="encounter_hg" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encounter_hg.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="encounter_lg" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encounter_lg.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="encounter_p" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encounter_p.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="encounter_pt" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encounter_pt.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="encounter_r" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encounter_r.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="encounter_s" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encounter_s.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="encounter_ss" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encounter_ss.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="evos_g3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\evos_g3.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="evos_g4" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\evos_g4.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="evos_g5" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\evos_g5.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="encunters_hb_hg" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encunters_hb_hg.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="encunters_hb_ss" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\encunters_hb_ss.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.