Пример #1
0
        public override IEnumerable <EncounterSlot> GetMatchingSlots(PKM pkm, IReadOnlyList <EvoCriteria> chain)
        {
            if (pkm.TSV == 0) // HOME doesn't assign TSV=0 to accounts.
            {
                yield break;
            }

            bool exists = chain.Any(z => z.Species == Species && z.Form == Form);

            if (!exists)
            {
                yield break;
            }

            var ball  = (Ball)pkm.Ball;
            var stamp = EncounterSlot8GO.GetTimeStamp(pkm.Met_Year, pkm.Met_Month, pkm.Met_Day);

            foreach (var s in Slots)
            {
                var slot = (EncounterSlot8GO)s;
                if (!slot.IsLevelWithinRange(pkm.Met_Level))
                {
                    continue;
                }
                if (!slot.IsBallValid(ball))
                {
                    continue;
                }
                if (!slot.Shiny.IsValid(pkm))
                {
                    continue;
                }
                if (!slot.IsWithinStartEnd(stamp))
                {
                    continue;
                }

                yield return(slot);
            }
        }
Пример #2
0
        private static EncounterArea8g GetArea(byte[] data)
        {
            var sf      = BitConverter.ToInt16(data, 0);
            int species = sf & 0x7FF;
            int form    = sf >> 11;

            var group = GetGroup(species, form);

            var result = new EncounterSlot8GO[(data.Length - 2) / entrySize];
            var area   = new EncounterArea8g(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, group);
            }

            return(area);
        }