Esempio n. 1
0
        private void AddCaptureExisting(SniperInfo oldSniperInfo, SniperInfo sniperInfo)
        {
            if (PokemonId.Missingno.Equals(oldSniperInfo.Id))
            {
                oldSniperInfo.Id = sniperInfo.Id;
            }
            if (oldSniperInfo.IV == 0 && sniperInfo.IV != 0)
            {
                oldSniperInfo.IV = sniperInfo.IV;
            }
            if (!oldSniperInfo.Verified)
            {
                if (sniperInfo.Verified)
                {
                    oldSniperInfo.Verified   = sniperInfo.Verified;
                    oldSniperInfo.VerifiedOn = DateTime.Now;
                    if (oldSniperInfo.ExpirationTimestamp == default(DateTime))
                    {
                        if (sniperInfo.ExpirationTimestamp != default(DateTime))
                        {
                            oldSniperInfo.VerifiedOn = sniperInfo.ExpirationTimestamp;
                        }
                    }
                    if (oldSniperInfo.EncounterId == default(ulong))
                    {
                        if (sniperInfo.EncounterId != default(ulong))
                        {
                            oldSniperInfo.EncounterId = sniperInfo.EncounterId;
                        }
                    }
                    if (oldSniperInfo.Move1 == PokemonMove.MoveUnset)
                    {
                        if (sniperInfo.Move1 != PokemonMove.MoveUnset)
                        {
                            oldSniperInfo.Move1 = sniperInfo.Move1;
                        }
                    }
                    if (oldSniperInfo.Move2 == PokemonMove.MoveUnset)
                    {
                        if (sniperInfo.Move2 != PokemonMove.MoveUnset)
                        {
                            oldSniperInfo.Move2 = sniperInfo.Move2;
                        }
                    }
                    if (oldSniperInfo.SpawnPointId == default(string))
                    {
                        if (sniperInfo.SpawnPointId != default(string))
                        {
                            oldSniperInfo.SpawnPointId = sniperInfo.SpawnPointId;
                        }
                    }
                }
            }

            oldSniperInfo.OtherChannelInfos.Add(sniperInfo.ChannelInfo);
            var captures = _sniperInfoRepository.Increase(oldSniperInfo);

            Log.Pokemon($"Captured existing: {FormatPokemonLog(oldSniperInfo, sniperInfo.ChannelInfo, captures)}");
        }
Esempio n. 2
0
        public void FindTest3()
        {
            var sniperInfoRepository = new SniperInfoRepository();

            sniperInfoRepository.Increase(new SniperInfo()
            {
                Latitude = 40.762401, Longitude = -73.950447, Id = PokemonId.Vaporeon
            });
            var oldSniperInfo = sniperInfoRepository.Find(new SniperInfo()
            {
                Latitude  = 40.762858,
                Longitude = -73.950448,
                Id        = PokemonId.Vaporeon
            });

            Assert.IsNull(oldSniperInfo);
        }
Esempio n. 3
0
        public void FindTest()
        {
            var sniperInfoRepository = new SniperInfoRepository();

            sniperInfoRepository.Increase(new SniperInfo()
            {
                Latitude = 48.830168, Longitude = 2.316475, Id = PokemonId.Poliwrath
            });
            var oldSniperInfo = sniperInfoRepository.Find(new SniperInfo()
            {
                Latitude  = 48.830169,
                Longitude = 2.316475,
                Id        = PokemonId.Poliwrath
            });

            Assert.IsNotNull(oldSniperInfo);
        }
        private void AddCaptureExisting(SniperInfo oldSniperInfo, SniperInfo sniperInfo)
        {
            if (PokemonId.Missingno.Equals(oldSniperInfo.Id))
            {
                oldSniperInfo.Id = sniperInfo.Id;
            }
            if (oldSniperInfo.IV <= 0 && sniperInfo.IV > 0)
            {
                oldSniperInfo.IV = sniperInfo.IV;
            }
            if (!oldSniperInfo.Verified)
            {
                if (sniperInfo.Verified)
                {
                    oldSniperInfo.Verified   = sniperInfo.Verified;
                    oldSniperInfo.VerifiedOn = DateTime.Now;
                }
                if (sniperInfo.ChannelInfo != null &&
                    !oldSniperInfo.GetAllChannelInfos()
                    .Any(ci => object.Equals(ci.server, sniperInfo.ChannelInfo.server) &&
                         (object.Equals(ci.channel, sniperInfo.ChannelInfo.channel))))
                {
                    oldSniperInfo.OtherChannelInfos.Add(sniperInfo.ChannelInfo);
                }
            }
            if (oldSniperInfo.Move1 == PokemonMove.MoveUnset)
            {
                if (sniperInfo.Move1 != PokemonMove.MoveUnset)
                {
                    oldSniperInfo.Move1 = sniperInfo.Move1;
                }
            }
            if (oldSniperInfo.Move2 == PokemonMove.MoveUnset)
            {
                if (sniperInfo.Move2 != PokemonMove.MoveUnset)
                {
                    oldSniperInfo.Move2 = sniperInfo.Move2;
                }
            }
            if (oldSniperInfo.EncounterId == default(ulong))
            {
                if (sniperInfo.EncounterId != default(ulong))
                {
                    oldSniperInfo.EncounterId = sniperInfo.EncounterId;
                }
            }

            if (oldSniperInfo.SpawnPointId == default(string))
            {
                if (sniperInfo.SpawnPointId != default(string))
                {
                    oldSniperInfo.SpawnPointId = sniperInfo.SpawnPointId;
                }
            }
            if (oldSniperInfo.ExpirationTimestamp == default(DateTime))
            {
                if (sniperInfo.ExpirationTimestamp != default(DateTime))
                {
                    oldSniperInfo.VerifiedOn = sniperInfo.ExpirationTimestamp;
                }
            }
            var captures = _sniperInfoRepository.Increase(oldSniperInfo);

            Log.Pokemon($"Captured existing: {FormatPokemonLog(oldSniperInfo, captures)}");
        }