Пример #1
0
        private void LoadSlots(byte[] areaData)
        {
            Location = areaData[0];
            Slots    = new EncounterSlot[areaData[1]];

            int ctr = 0;
            int ofs = 2;

            do
            {
                var flags = (AreaWeather8)BitConverter.ToUInt16(areaData, ofs);
                var min   = areaData[ofs + 2];
                var max   = areaData[ofs + 3];
                var count = areaData[ofs + 4];
                // ofs+5 reserved
                ofs += 6;
                for (int i = 0; i < count; i++, ctr++, ofs += 2)
                {
                    var specForm = BitConverter.ToUInt16(areaData, ofs);
                    Slots[ctr] = new EncounterSlot8(specForm, min, max, flags);
                }
            } while (ctr != Slots.Length);
            foreach (var slot in Slots)
            {
                slot.Area = this;
            }
        }
Пример #2
0
        private EncounterSlot[] ReadSlots(byte[] areaData, byte slotCount)
        {
            var slots = new EncounterSlot[slotCount];

            int ctr = 0;
            int ofs = 2;

            do
            {
                var flags = (AreaWeather8)BitConverter.ToUInt16(areaData, ofs);
                var min   = areaData[ofs + 2];
                var max   = areaData[ofs + 3];
                var count = areaData[ofs + 4];
                // ofs+5 reserved
                ofs += 6;
                for (int i = 0; i < count; i++, ctr++, ofs += 2)
                {
                    var specForm = BitConverter.ToUInt16(areaData, ofs);
                    slots[ctr] = new EncounterSlot8(this, specForm, min, max, flags);
                }
            } while (ctr != slots.Length);

            return(slots);
        }