protected void createSpecialEncounterSlotArray(ref EncounterSlot[] slotArray, byte[] data, byte[] regularData, byte[] affectedSlots, decimal[] percentage) { Pokemon p; short speciesID; byte minLv, maxLv; int nbSlots = data.Length / 4; if (percentage.Length < nbSlots) { throw new Exception("percentage is smaller than Encounter slot data."); } if (affectedSlots.Length < nbSlots) { throw new Exception("Number of affected slots is smaller than Encounter slot data."); } slotArray = new EncounterSlot[nbSlots]; for (int s = 0; s < nbSlots; s++) { speciesID = BitConverter.ToInt16(data, 4 * s); p = PokemonTables.getPokemon(speciesID, version); maxLv = regularData[8 * affectedSlots[s]]; minLv = regularData[8 * affectedSlots[s] + 1]; if (minLv == 0) { minLv = maxLv; } slotArray[s] = new EncounterSlot(p, minLv, maxLv, percentage[affectedSlots[s]]); } }
protected override void createEncounterSlotArray(ref EncounterSlot[] slotArray, byte[] data, decimal[] percentArray) { Pokemon p; short speciesID; byte minLv, maxLv; int nbSlots = data.Length / 8; if (percentArray.Length < nbSlots) { throw new Exception("percentArray is smaller than Encounter slot data."); } slotArray = new EncounterSlot[nbSlots]; for (int i = 0; i < nbSlots; i++) { speciesID = BitConverter.ToInt16(data, 8 * i + 4); p = PokemonTables.getPokemon(speciesID, version); maxLv = data[8 * i]; minLv = data[8 * i + 1]; if (minLv == 0) { minLv = maxLv; } slotArray[i] = new EncounterSlot(p, minLv, maxLv, percentArray[i]); } }
protected void createEncounterSlotArray(ref EncounterSlot[] slotArray, byte[] data, decimal[] percentArray) { Pokemon p; short speciesID; int nbSlots = data.Length / 4; slotArray = new EncounterSlot[nbSlots]; for (int i = 0; i < nbSlots; i++) { speciesID = BitConverter.ToInt16(data, 4 * i); p = PokemonTables.getPokemon(speciesID, version); slotArray[i] = new EncounterSlot(p, data[4 * i + 2], data[4 * i + 2], percentArray[i]); } }
protected override void createEncounterSlotArray(ref EncounterSlot[] slotArray, byte[] data, decimal[] percentArray) { Pokemon p; short speciesID; int nbSlots = data.Length / 4; if (percentArray.Length > nbSlots) { throw new Exception("percentArray is smaller than Encounter slot data."); } slotArray = new EncounterSlot[nbSlots]; for (int i = 0; i < nbSlots; i++) { speciesID = BitConverter.ToInt16(data, 4 * i); p = PokemonTables.getPokemon(speciesID, version); slotArray[i] = new EncounterSlot(p, data[4 * i + 2], data[4 * i + 3], percentArray[i]); } }
protected void createSpecialEncounterSlotArray(ref EncounterSlot[] slotArray, byte[] data, byte[] regularData, byte[] affectedSlots, decimal[] percentage) { Pokemon p; short speciesID; int nbSlots = affectedSlots.Length; decimal r = data.Length / (decimal)(2 * nbSlots); if (percentage.Length < nbSlots) { throw new Exception("percentage is smaller than Encounter slot data."); } slotArray = new EncounterSlot[nbSlots]; for (int s = 0; s < nbSlots; s++) { speciesID = BitConverter.ToInt16(data, 2 * (int)(s * r)); p = PokemonTables.getPokemon(speciesID, version); slotArray[s] = new EncounterSlot(p, regularData[4 * affectedSlots[s]], regularData[4 * affectedSlots[s] + 1], percentage[affectedSlots[s]]); } }
internal AreaMapSuMo(byte[] data, Version version) { if (data.Length % 384 != 0) { return; //All tables should be 384-byte long } int nbTables = data.Length / 384; Slots = new EncounterSlot[nbTables][]; SOS_Slots = new EncounterSlot[nbTables][][]; for (int i = 0; i < nbTables; i++) { Slots[i] = new EncounterSlot[10]; // Regular Slots for (int j = 0; j < 10; j++) { Slots[i][j] = new EncounterSlot( PokemonTables.getPokemon(BitConverter.ToInt16(data, 384 * i + 4 * j + 16 - 28 * (i % 2)), version), data[384 * i + 4 - 28 * (i % 2)], data[384 * i + 5 - 28 * (i % 2)], data[384 * i + j + 6 - 28 * (i % 2)]); } // SOS Slots SOS_Slots[i] = new EncounterSlot[7][]; for (int sos = 0; sos < 7; sos++) { SOS_Slots[i][sos] = new EncounterSlot[10]; for (int j = 0; j < 10; j++) { SOS_Slots[i][sos][j] = new EncounterSlot( PokemonTables.getPokemon(BitConverter.ToInt16(data, 384 * i + 4 * j + sos * 20 + 56 - 28 * (i % 2)), version), data[384 * i + 4 - 28 * (i % 2)], data[384 * i + 5 - 28 * (i % 2)], data[384 * i + j + 6 - 28 * (i % 2)]); } } } }