From 270807b04c77ddcc18ba82fc2ff2df9f4b09bf1d Mon Sep 17 00:00:00 2001 From: wwwwwwzx Date: Sun, 26 Mar 2017 04:14:00 -0700 Subject: [PATCH] Fix sound slots level --- PKHeX/Legality/Structures/EncounterArea.cs | 5 +++-- PKHeX/Legality/Tables4.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/PKHeX/Legality/Structures/EncounterArea.cs b/PKHeX/Legality/Structures/EncounterArea.cs index c2f305e29..5c751ccdd 100644 --- a/PKHeX/Legality/Structures/EncounterArea.cs +++ b/PKHeX/Legality/Structures/EncounterArea.cs @@ -371,6 +371,7 @@ private static EncounterSlot[] getSlots4_HGSS_G(byte[] data, ref int ofs, int nu private static IEnumerable 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 of species id, the level is copied from one of the first grass slots + //for dppt slotSize = 4, for hgss slotSize = 2 var slots = new List(); int numslots = slotnums.Length; @@ -380,7 +381,7 @@ private static IEnumerable getSlots4_G_Replace(byte[] data, ref i if (baseSlot.LevelMin <= 0) continue; - int species = BitConverter.ToUInt16(data, ofs + i * slotSize); + int species = BitConverter.ToUInt16(data, ofs + i / (4 / slotSize) * slotSize); if (species <= 0) continue; @@ -390,7 +391,7 @@ private static IEnumerable getSlots4_G_Replace(byte[] data, ref i slots.Add(slot); } - ofs += numslots * slotSize; + ofs += numslots * slotSize * slotSize / 4; return slots; } diff --git a/PKHeX/Legality/Tables4.cs b/PKHeX/Legality/Tables4.cs index b11d9a91d..1efe38bb3 100644 --- a/PKHeX/Legality/Tables4.cs +++ b/PKHeX/Legality/Tables4.cs @@ -558,7 +558,7 @@ public static partial class Legal // 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_Sound = {2, 3, 4, 5}; internal static readonly int[] Slot4_Radar = {6, 7, 10, 11}; internal static readonly int[] Slot4_Dual = {8, 9}; #region Alt Slots