private void AddDuplicateDiscovery(SniperInfo oldSniperInfo, SniperInfo sniperInfo)
        {
            bool updated = false;

            if (PokemonId.Missingno.Equals(oldSniperInfo.Id) && !PokemonId.Missingno.Equals(sniperInfo.Id))
            {
                oldSniperInfo.Id = sniperInfo.Id;
                updated          = true;
            }
            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);
                updated = true;
            }
            if (updated)
            {
                var captures = _sniperInfoRepository.Update(oldSniperInfo);
                Log.Debug($"Discovered (DUP): {FormatPokemonLog(oldSniperInfo, captures)}");
            }
        }
Beispiel #2
0
 private static bool Matches(SniperInfo sniperInfo, List <PokemonId> pokemonIds, bool verifiedOnly, List <Channel> channels, LatLngBounds areaBounds)
 {
     if (!pokemonIds.Contains(sniperInfo.Id))
     {
         Log.Trace($"Skipped {sniperInfo} because not in pokemon list");
         return(false);
     }
     if (verifiedOnly && !sniperInfo.Verified)
     {
         Log.Trace($"Skipped {sniperInfo} because verifiedOnly is on, but this isn't verified");
         return(false);
     }
     if (channels != null && !MatchesChannel(channels, sniperInfo.GetAllChannelInfos()))
     {
         Log.Trace($"Skipped {sniperInfo} because the channel doesn't match the channel list");
         return(false);
     }
     if (areaBounds != null && !areaBounds.Intersects(sniperInfo.Latitude, sniperInfo.Longitude))
     {
         Log.Trace($"Skipped {sniperInfo} because the lat & long isn't the areabounds {areaBounds}");
         return(false);
     }
     return(true);
 }
        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)}");
        }