public PokedexSaveData(byte[] data) { if (data.Length != POKEDEX_SAVE_DATA_SIZE) { throw new ArgumentException($"Unexpected {nameof(PokedexSaveData)} block size!"); } GlobalData = new PokedexSaveGlobalData(data, 0); LocalData = new PokedexSaveLocalData[5]; for (var i = 0; i < LocalData.Length; i++) { LocalData[i] = new PokedexSaveLocalData(data, 0x10 + (0x10 * i)); } ResearchEntries = new PokedexSaveResearchEntry[PokedexSave8a.MAX_SPECIES]; for (var i = 0; i < ResearchEntries.Length; i++) { ResearchEntries[i] = new PokedexSaveResearchEntry(data, 0x70 + (0x58 * i)); } StatisticsEntries = new PokedexSaveStatisticsEntry[STATISTICS_ENTRIES_MAX]; for (var i = 0; i < StatisticsEntries.Length; i++) { StatisticsEntries[i] = new PokedexSaveStatisticsEntry(data, 0x151A8 + (0x18 * i)); } }
public bool TryGetStatisticsEntry(int species, int form, out PokedexSaveStatisticsEntry entry) { var fstIdIndex = Array.BinarySearch(PokedexConstants8a.FormStorageIndexIds, (ushort)(species | (form << 11))); if (fstIdIndex >= 0) { entry = StatisticsEntries[PokedexConstants8a.FormStorageIndexValues[fstIdIndex]]; return(true); } else { entry = new PokedexSaveStatisticsEntry(new byte[0x18], 0); return(false); } }
public bool TryGetStatisticsEntry(PKM pk, out PokedexSaveStatisticsEntry entry, out int shift) { shift = 0; if (pk.IsShiny) { shift += 4; } if (((IAlpha)pk).IsAlpha) { shift += 2; } if ((pk.Gender & ~2) != 0) { shift++; } return(TryGetStatisticsEntry(pk.Species, pk.Form, out entry)); }