コード例 #1
0
        private static EncounterArea7g GetArea(byte[] data)
        {
            var sf      = BitConverter.ToInt16(data, 0);
            int species = sf & 0x7FF;
            int form    = sf >> 11;

            // Files are padded to be multiples of 4 bytes. The last entry might actually be padding.
            // Since we aren't saving a count up-front, just check if the last entry is valid.
            int count = (data.Length - 2) / entrySize;

            if (data[data.Length - 1] == 0) // type of "None" is not valid
            {
                count--;
            }

            var result = new EncounterSlot7GO[count];
            var area   = new EncounterArea7g(species, form)
            {
                Slots = result
            };

            for (int i = 0; i < result.Length; i++)
            {
                var offset = (i * entrySize) + 2;
                var shiny  = (Shiny)data[offset];
                var type   = (PogoType)data[offset + 1];
                result[i] = new EncounterSlot7GO(area, species, form, shiny, type);
            }

            return(area);
        }
コード例 #2
0
        private static EncounterArea7g[] GetGoParkArea()
        {
            var area = new EncounterArea7g {
                Location = 50
            };

            EncounterSlot GetSlot(int species, int form)
            {
                return(new EncounterSlot
                {
                    Area = area,
                    Generation = 7,
                    Species = species,
                    LevelMin = 1,
                    LevelMax = 40,
                    Form = form,
                    Type = SlotType.GoPark,
                    Version = GameVersion.GO,
                });
            }

            var obtainable  = Enumerable.Range(1, 150).Concat(Enumerable.Range(808, 2)); // count : 152
            var AlolanKanto = new byte[]
            {
                // Level 1+
                019, // Rattata
                020, // Raticate
                027, // Sandshrew
                028, // Sandslash
                037, // Vulpix
                038, // Ninetales
                050, // Diglett
                051, // Dugtrio
                052, // Meowth
                053, // Persian
                074, // Geodude
                075, // Graveler
                076, // Golem
                088, // Grimer
                089, // Muk
                103, // Exeggutor
                105, // Marowak

                // Level 15+
                026, // Raichu
            };

            var regular = obtainable.Select(z => GetSlot(z, 0));
            var alolan  = AlolanKanto.Select(z => GetSlot(z, 1));
            var slots   = regular.Concat(alolan).ToArray();

            slots[slots.Length - 1].LevelMin          = 15; // Raichu
            slots[(int)Species.Mewtwo - 1].LevelMin   = 15;
            slots[(int)Species.Articuno - 1].LevelMin = 15;
            slots[(int)Species.Zapdos - 1].LevelMin   = 15;
            slots[(int)Species.Moltres - 1].LevelMin  = 15;

            area.Slots = slots;
            return(new[] { area });
        }
コード例 #3
0
        private static EncounterSlot7GO ReadSlot(byte[] data, int offset, EncounterArea7g area, int species, int form)
        {
            int start = BitConverter.ToInt32(data, offset);
            int end   = BitConverter.ToInt32(data, offset + 4);
            var shiny = (Shiny)data[offset + 8];
            var type  = (PogoType)data[offset + 9];

            return(new EncounterSlot7GO(area, species, form, start, end, shiny, type));
        }
コード例 #4
0
        internal static EncounterArea7g[] GetArea(byte[][] data)
        {
            var areas = new EncounterArea7g[data.Length];

            for (int i = 0; i < areas.Length; i++)
            {
                areas[i] = GetArea(data[i]);
            }
            return(areas);
        }
コード例 #5
0
ファイル: EncounterArea7g.cs プロジェクト: MWisBest/PKHeX
        internal static EncounterArea7g[] GetArea(HashSet <int> raid15)
        {
            var noForm = Enumerable.Range(1, 150).Concat(Enumerable.Range(808, 2)); // count : 152
            var forms  = new[]
            {
                (byte)Rattata,
                (byte)Raticate,
                (byte)Raichu,
                (byte)Sandshrew,
                (byte)Sandslash,
                (byte)Vulpix,
                (byte)Ninetales,
                (byte)Diglett,
                (byte)Dugtrio,
                (byte)Meowth,
                (byte)Persian,
                (byte)Geodude,
                (byte)Graveler,
                (byte)Golem,
                (byte)Grimer,
                (byte)Muk,
                (byte)Exeggutor,
                (byte)Marowak,
            };

            var area = new EncounterArea7g {
                Location = 50, Type = SlotType.GoPark
            };

            EncounterSlot7GO GetSlot(EncounterArea7g a, int species, int form)
            {
                var min = raid15.Contains(species | (form << 11)) ? 15 : 1;

                return(new EncounterSlot7GO(a, species, form, min, 40));
            }

            var regular = noForm.Select(z => GetSlot(area, z, 0));
            var alolan  = forms.Select(z => GetSlot(area, z, 1));
            var slots   = regular.Concat(alolan).ToArray();

            area.Slots = slots;
            return(new[] { area });
        }
コード例 #6
0
        private static EncounterArea7g GetArea(byte[] data)
        {
            var sf      = BitConverter.ToInt16(data, 0);
            int species = sf & 0x7FF;
            int form    = sf >> 11;

            var result = new EncounterSlot7GO[(data.Length - 2) / entrySize];
            var area   = new EncounterArea7g(species, form)
            {
                Slots = result
            };

            for (int i = 0; i < result.Length; i++)
            {
                var offset = (i * entrySize) + 2;
                result[i] = ReadSlot(data, offset, area, species, form);
            }

            return(area);
        }
コード例 #7
0
 static EncounterSlot7GO GetSlot(EncounterArea7g area, int species, int form)
 {
     return(new EncounterSlot7GO(area, species, form, 1, 40));
 }
コード例 #8
0
 internal static EncounterArea7g[] GetArea()
 {
     var area = new EncounterArea7g {
         Location = 50, Type = SlotType.GoPark
     };