private static EncounterSlot2[] GetSlots2GrassWater(byte[] data, ref int ofs, SlotType t, int slotSets, int slotCount) { byte[] rates = new byte[slotSets]; for (int i = 0; i < rates.Length; i++) { rates[i] = data[ofs++]; } var slots = EncounterSlot2.ReadSlots(data, ref ofs, slotSets * slotCount, t, rates[0]); if (slotSets <= 1) { return(slots); } for (int i = 0; i < slotCount; i++) { slots[i].Time = EncounterTime.Morning; } for (int r = 1; r < slotSets; r++) { for (int i = 0; i < slotCount; i++) { int index = i + (r * slotCount); slots[index].Rate = rates[r]; slots[index].SlotNumber = i; slots[index].Time = r == 1 ? EncounterTime.Day : EncounterTime.Night; } } return(slots); }
private EncounterSlot2[] ReadSlots(byte[] data, int count, int start) { var slots = new EncounterSlot2[count]; for (int i = 0; i < slots.Length; i++) { int offset = start + (4 * i); int species = data[offset + 0]; int slotNum = data[offset + 1]; int min = data[offset + 2]; int max = data[offset + 3]; slots[i] = new EncounterSlot2(this, species, min, max, slotNum); } return(slots); }
private static EncounterSlot2[] GetSlots2Fishing(byte[] data, ref int ofs, SlotType t) { // slot set ends with final slot having 0xFF 0x** 0x** const int size = 3; int end = ofs; // scan for count while (data[end] != 0xFF) { end += size; } var count = ((end - ofs) / size) + 1; var slots = new EncounterSlot2[count]; for (int i = 0; i < slots.Length; i++) { int rate = data[ofs++]; int species = data[ofs++]; int level = data[ofs++]; var type = species == 0 ? SlotType.Special : t; // day/night specific; slots[i] = new EncounterSlot2(species, level, level, rate, type, i); } return(slots); }