Esempio n. 1
0
 private static void WriteSlot(BinaryWriter bw, EncounterSlot3 slot)
 {
     bw.Write((ushort)slot.Species);
     bw.Write((byte)slot.Form);
     bw.Write((byte)slot.SlotNumber);
     bw.Write((byte)slot.LevelMin);
     bw.Write((byte)slot.LevelMax);
     bw.Write((byte)slot.MagnetPullIndex);
     bw.Write((byte)slot.MagnetPullCount);
     bw.Write((byte)slot.StaticIndex);
     bw.Write((byte)slot.StaticCount);
 }
        private static void ReadFishingSlots(byte[] data, int ofs, int numslots, List <EncounterArea3> areas, short location)
        {
            var o = new List <EncounterSlot>();
            var g = new List <EncounterSlot>();
            var s = new List <EncounterSlot>();

            for (int i = 0; i < numslots; i++)
            {
                int species = BitConverter.ToInt16(data, ofs + 4 + (i * 4));
                if (species <= 0)
                {
                    continue;
                }

                var slot = new EncounterSlot3
                {
                    LevelMin = data[ofs + 2 + (i * 4)],
                    LevelMax = data[ofs + 3 + (i * 4)],
                    Species  = species,
                };

                if (i < 2)
                {
                    o.Add(slot);
                    slot.SlotNumber = i; // 0,1
                }
                else if (i < 5)
                {
                    g.Add(slot);
                    slot.SlotNumber = i - 2; // 0,1,2
                }
                else
                {
                    s.Add(slot);
                    slot.SlotNumber = i - 5; // 0,1,2,3,4
                }
            }

            var oa = new EncounterArea3 {
                Location = location, Type = SlotType.Old_Rod, Slots = o.ToArray()
            };
            var ga = new EncounterArea3 {
                Location = location, Type = SlotType.Good_Rod, Slots = g.ToArray()
            };
            var sa = new EncounterArea3 {
                Location = location, Type = SlotType.Super_Rod, Slots = s.ToArray()
            };

            areas.Add(oa);
            areas.Add(ga);
            areas.Add(sa);
        }