Beispiel #1
0
 public TransferFilter GetPokemonTransferFilter(PokemonId pokemon)
 {
     if (_logicClient.Settings.PokemonsTransferFilter != null)
     {
         if (_logicClient.Settings.PokemonsTransferFilter.ContainsKey(pokemon))
             return _logicClient.Settings.PokemonsTransferFilter[pokemon];
     }
     return new TransferFilter(_logicClient.Settings.KeepMinCp, _logicClient.Settings.KeepMinIvPercentage, _logicClient.Settings.KeepMinDuplicatePokemon);
 }
        public async Task<EncounterTutorialCompleteResponse> EncounterTutorialComplete(PokemonId pokemonId)
        {
            var message = new EncounterTutorialCompleteMessage()
            {
                PokemonId = pokemonId
            };

            return await PostProtoPayload<Request, EncounterTutorialCompleteResponse>(RequestType.EncounterTutorialComplete, message);
        }
 private void verifyParsing(String text, double latitude, double longitude, PokemonId pokemonId, double iv, DateTime expiration)
 {
     List<SniperInfo> sniperInfo = messageParser.parseMessage(text);
     Assert.IsNotNull(sniperInfo);
     Assert.AreEqual(pokemonId, sniperInfo[0].id);
     Assert.AreEqual(latitude, sniperInfo[0].latitude);
     Assert.AreEqual(longitude, sniperInfo[0].longitude);
     Assert.AreEqual(iv, sniperInfo[0].iv);
     Assert.AreEqual(Truncate(expiration, TimeSpan.FromSeconds(1)), Truncate(sniperInfo[0].timeStamp, TimeSpan.FromSeconds(1)));
 }
 private void verifyParsing(string text, double latitude, double longitude, PokemonId pokemonId, double iv,
     DateTime expiration)
 {
     var sniperInfo = messageParser.parseMessage(text);
     Assert.IsNotNull(sniperInfo);
     Assert.AreEqual(pokemonId, sniperInfo[0].Id);
     Assert.AreEqual(latitude, sniperInfo[0].Latitude);
     Assert.AreEqual(longitude, sniperInfo[0].Longitude);
     Assert.AreEqual(iv, sniperInfo[0].IV);
     Assert.AreEqual(Truncate(expiration, TimeSpan.FromSeconds(1)),
         Truncate(sniperInfo[0].ExpirationTimestamp, TimeSpan.FromSeconds(1)));
 }
Beispiel #5
0
 public async Task CatchPokemon(ulong encounterId, string id, DiskEncounterResponse encounter, PokemonId pokemonId)
 {
     CatchPokemonResponse caughtPokemonResponse;
     var attempts = 0;
     do
     {
         var probability = encounter?.CaptureProbability?.CaptureProbability_?.FirstOrDefault();
         var pokeball = GetPokeball(encounter);
         caughtPokemonResponse =
             await _apiEncounter.CatchPokemon(encounterId, id, pokeball);
         logger.Info($"[{caughtPokemonResponse.Status} - {attempts}] {pokemonId} encountered. {PokemonInfo.CalculatePokemonPerfection(encounter?.PokemonData)}% perfect. {encounter?.PokemonData?.Cp} CP. Probabilty: {probability}");
         attempts++;
     } while (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchMissed ||
              caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchEscape);
 }
 public AppearItem(ScenarioAppearPokemon model, PokemonId id, string pokemonName)
 {
     _model  = model;
     _id     = id;
     Pokemon = pokemonName;
 }
Beispiel #7
0
        public static PokemonGrades GetPokemonGrade(PokemonId id)
        {
            var first = pokemonByGrades.FirstOrDefault(p => p.Value.Contains(id));

            return(first.Key);
        }
Beispiel #8
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (PokemonId != 0)
            {
                hash ^= PokemonId.GetHashCode();
            }
            if (ModelScale != 0F)
            {
                hash ^= ModelScale.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (Type2 != 0)
            {
                hash ^= Type2.GetHashCode();
            }
            if (camera_ != null)
            {
                hash ^= Camera.GetHashCode();
            }
            if (encounter_ != null)
            {
                hash ^= Encounter.GetHashCode();
            }
            if (stats_ != null)
            {
                hash ^= Stats.GetHashCode();
            }
            hash ^= quickMoves_.GetHashCode();
            hash ^= cinematicMoves_.GetHashCode();
            hash ^= animationTime_.GetHashCode();
            hash ^= evolutionIds_.GetHashCode();
            if (EvolutionPips != 0)
            {
                hash ^= EvolutionPips.GetHashCode();
            }
            if (Rarity != 0)
            {
                hash ^= Rarity.GetHashCode();
            }
            if (PokedexHeightM != 0F)
            {
                hash ^= PokedexHeightM.GetHashCode();
            }
            if (PokedexWeightKg != 0F)
            {
                hash ^= PokedexWeightKg.GetHashCode();
            }
            if (ParentPokemonId != 0)
            {
                hash ^= ParentPokemonId.GetHashCode();
            }
            if (HeightStdDev != 0F)
            {
                hash ^= HeightStdDev.GetHashCode();
            }
            if (WeightStdDev != 0F)
            {
                hash ^= WeightStdDev.GetHashCode();
            }
            if (KmDistanceToHatch != 0F)
            {
                hash ^= KmDistanceToHatch.GetHashCode();
            }
            if (FamilyId != 0)
            {
                hash ^= FamilyId.GetHashCode();
            }
            if (CandyToEvolve != 0)
            {
                hash ^= CandyToEvolve.GetHashCode();
            }
            if (KmBuddyDistance != 0F)
            {
                hash ^= KmBuddyDistance.GetHashCode();
            }
            if (BuddySize != 0)
            {
                hash ^= BuddySize.GetHashCode();
            }
            return(hash);
        }
 internal PokemonAlternativeNames(PokemonId pokemonId, ISet <string> exactMatches, ISet <string> partialMatches)
 {
     this.PokemonId      = pokemonId;
     this.ExactMatches   = exactMatches;
     this.PartialMatches = partialMatches;
 }
Beispiel #10
0
        public void Execute(PokemonId pokeid, GeoCoordinate remoteCoords)
        {
            var returnCoords = new GeoCoordinate();

            returnCoords.Latitude  = _client.CurrentLatitude;
            returnCoords.Longitude = _client.CurrentLongitude;
            returnCoords.Altitude  = _client.CurrentAltitude;
            LocationUtils.updatePlayerLocation(_client, returnCoords.Latitude, returnCoords.Longitude, returnCoords.Altitude);

            if (_botSettings == null && _client == null)
            {
                SendToLog($" client or settings are not set");
                return;
            }

            try {
                remoteCoords.Altitude = LocationUtils.GetAltitude(remoteCoords.Latitude, remoteCoords.Longitude);

                SendToLog($"Trying to capture {pokeid}  at { remoteCoords.Latitude } / {remoteCoords.Longitude}");
                SendToLog(LocationUtils.FindAddress(remoteCoords.Latitude, remoteCoords.Longitude));
                LocationUtils.updatePlayerLocation(_client, remoteCoords.Latitude, remoteCoords.Longitude, remoteCoords.Altitude, false);
                var gmp = _client.Map.GetMapObjects(true).Result;

                SendToLog($"We are at sniping location...");
                SendToLog($"Waiting {GlobalVars.SnipeOpts.WaitSecond} seconds for Pokemon to appear...");
                RandomHelper.RandomSleep(GlobalVars.SnipeOpts.WaitSecond * 1000);

                var catchedID = 0UL;
                if (pokeid == PokemonId.Missingno)
                {
                    catchedID = TrySnipeGym(remoteCoords, returnCoords);
                }
                else
                {
                    RandomHelper.RandomSleep(1000);
                    catchedID = TrySnipePokemons(pokeid, remoteCoords, returnCoords);
                }

                LocationUtils.updatePlayerLocation(_client, returnCoords.Latitude, returnCoords.Longitude, returnCoords.Altitude);
                gmp = _client.Map.GetMapObjects(true).Result;

                SendToLog($"Location after Snipe : {_client.CurrentLatitude} / {_client.CurrentLongitude} / {_client.CurrentAltitude}");
                SendToLog(LocationUtils.FindAddress(_client.CurrentLatitude, _client.CurrentLongitude));

                if ((catchedID > 0) && GlobalVars.SnipeOpts.TransferIt && pokeid != PokemonId.Missingno)
                {
                    var trResult = Logic.objClient.Inventory.TransferPokemon(catchedID);
                    if (trResult.Result == ReleasePokemonResponse.Types.Result.Success)
                    {
                        SendToLog("Pokemon was transfered.");
                        SendToLog("Candies awarded: " + trResult.CandyAwarded);
                    }
                }

                RandomHelper.RandomSleep(20000, 22000);  // Avoid cache after snipe
            } catch (Exception ex) {
                Logger.ExceptionInfo(ex.ToString());
                SendToLog($"Go to {returnCoords.Latitude} / {returnCoords.Longitude} / {returnCoords.Altitude}.");
                LocationUtils.updatePlayerLocation(_client, returnCoords.Latitude, returnCoords.Longitude, returnCoords.Altitude);
                var gmp = _client.Map.GetMapObjects(true).Result;
            }

            GlobalVars.SnipeOpts.Enabled    = false;
            GlobalVars.SnipeOpts.ID         = PokemonId.Missingno;
            GlobalVars.SnipeOpts.Location   = null;
            GlobalVars.SnipeOpts.WaitSecond = 6;
            GlobalVars.SnipeOpts.NumTries   = 3;
        }
 internal PokemonAlternativeNames(PokemonId pokemonId, ISet<String> exactMatches, ISet<String> partialMatches)
 {
     this.pokemonId = pokemonId;
     this.exactMatches = exactMatches;
     this.partialMatches = partialMatches;
 }
Beispiel #12
0
 public PokemonData GetBestPokemonByCp(PokemonId pokemonId)
 {
     return Pokemon.OrderByDescending(x => x.Cp).FirstOrDefault(t => t.PokemonId == pokemonId);
 }
Beispiel #13
0
 public int GetMaxLink(PokemonId pokemon)
 {
     return(GetByte((int)pokemon));
 }
Beispiel #14
0
        public async Task <bool> CanEvolvePokemon(PokemonData pokemon, EvolveFilter appliedFilter = null, bool checkEvolveFilterRequirements = false)
        {
            // Can't evolve pokemon null.
            if (pokemon == null || pokemon.PokemonId == PokemonId.Missingno || pokemon.IsBad)
            {
                return(false);
            }

            // Can't evolve pokemon in gyms.
            if (!string.IsNullOrEmpty(pokemon.DeployedFortId))
            {
                return(false);
            }

            IEnumerable <PokemonSettings> pokemonSettings = await GetPokemonSettings().ConfigureAwait(false);

            var settings = pokemonSettings.FirstOrDefault(x => x.PokemonId == pokemon.PokemonId);

            // Can't evolve pokemon that are not evolvable.
            if (settings == null || settings.EvolutionIds.Count == 0 && settings.EvolutionBranch.Count == 0)
            {
                return(false);
            }

            int familyCandy = await GetCandyCount(pokemon.PokemonId).ConfigureAwait(false);

            if (checkEvolveFilterRequirements &&
                !IsEvolveByGlobalIvFilter(pokemon) &&
                !IsEvolveBySpecificFilter(pokemon, settings, familyCandy, appliedFilter))
            {
                return(false);
            }

            PokemonId evolveTo = PokemonId.Missingno;

            if (appliedFilter != null && !string.IsNullOrEmpty(appliedFilter.EvolveTo) && Enum.TryParse <PokemonId>(appliedFilter.EvolveTo, true, out evolveTo))
            {
                var branch = settings.EvolutionBranch.FirstOrDefault(x => x.Evolution == evolveTo);
                if (branch == null)
                {
                    return(false); //wrong setting, do not evolve this pokemon
                }
                if (branch.EvolutionItemRequirement != ItemId.ItemUnknown)
                {
                    var itemCount = (await GetItems().ConfigureAwait(false)).Count(x => x.ItemId == branch.EvolutionItemRequirement);

                    if (itemCount == 0)
                    {
                        return(false);
                    }
                }

                if (familyCandy < branch.CandyCost)
                {
                    return(false);
                }
            }
            else
            {
                bool canEvolve = false;
                // Check requirements for all branches, if we meet the requirements for any of them then we return true.
                foreach (var branch in settings.EvolutionBranch)
                {
                    var itemCount      = (await GetItems().ConfigureAwait(false)).Count(x => x.ItemId == branch.EvolutionItemRequirement);
                    var Candies2Evolve = branch.CandyCost; // GetCandyToEvolve(settings);
                    var Evolutions     = familyCandy / Candies2Evolve;

                    if (branch.EvolutionItemRequirement != ItemId.ItemUnknown)
                    {
                        if (itemCount == 0)
                        {
                            continue;  // Cannot evolve so check next branch
                        }
                    }

                    if (familyCandy < branch.CandyCost)
                    {
                        continue;  // Cannot evolve so check next branch
                    }
                    // If we got here, then we can evolve so break out of loop.
                    canEvolve = true;
                }
                return(canEvolve);
            }
            return(true);
        }
Beispiel #15
0
 public async Task <Pokemon> Execute(PokemonId pokemonId)
 {
     GuardPokemonNotFound(pokemonId);
     return(await _pokemonRepository.Find(pokemonId));
 }
 public static Bitmap GetPokemonVeryLargeImage(PokemonId pokemon)
 {
     return(GetPokemonImagefromResource(pokemon, "200"));
 }
 public static Bitmap GetPokemonMediumImage(PokemonId pokemon)
 {
     return(GetPokemonImagefromResource(pokemon, "35"));
 }
 public static Bitmap GetPokemonSmallImage(PokemonId pokemon)
 {
     return(GetPokemonImagefromResource(pokemon, "20"));
 }
Beispiel #19
0
        public async Task <EncounterTutorialCompleteResponse> EncounterTutorialComplete(PokemonId pokemonId)
        {
            var message = new EncounterTutorialCompleteMessage()
            {
                PokemonId = pokemonId
            };

            return(await PostProtoPayload <Request, EncounterTutorialCompleteResponse>(RequestType.EncounterTutorialComplete, message));
        }
Beispiel #20
0
        public static string getPokemonNameGer(PokemonId b)
        {
            string GerName = string.Empty;
            switch (b)
            {
                case PokemonId.Missingno:
                    GerName = "Missingno";
                    break;
                case PokemonId.Bulbasaur:
                    GerName = "Bisasam";
                    break;
                case PokemonId.Ivysaur:
                    GerName = "Bisaknosp";
                    break;
                case PokemonId.Venusaur:
                    GerName = "Bisaflor";
                    break;
                case PokemonId.Charmander:
                    GerName = "Glumanda";
                    break;
                case PokemonId.Charmeleon:
                    GerName = "Glutexo";
                    break;
                case PokemonId.Charizard:
                    GerName = "Glurak";
                    break;
                case PokemonId.Squirtle:
                    GerName = "Schiggy";
                    break;
                case PokemonId.Wartortle:
                    GerName = "Schillok";
                    break;
                case PokemonId.Blastoise:
                    GerName = "Turtok";
                    break;
                case PokemonId.Caterpie:
                    GerName = "Raupy";
                    break;
                case PokemonId.Metapod:
                    GerName = "Safcon";
                    break;
                case PokemonId.Butterfree:
                    GerName = "Smettbo";
                    break;
                case PokemonId.Weedle:
                    GerName = "Hornliu";
                    break;
                case PokemonId.Kakuna:
                    GerName = "Kokuna";
                    break;
                case PokemonId.Beedrill:
                    GerName = "Bibor";
                    break;
                case PokemonId.Pidgey:
                    GerName = "Taubsi";
                    break;
                case PokemonId.Pidgeotto:
                    GerName = "Tauboga";
                    break;
                case PokemonId.Pidgeot:
                    GerName = "Tauboss";
                    break;
                case PokemonId.Rattata:
                    GerName = "Rattfratz";
                    break;
                case PokemonId.Raticate:
                    GerName = "Rattikarl";
                    break;
                case PokemonId.Spearow:
                    GerName = "Habitak";
                    break;
                case PokemonId.Fearow:
                    GerName = "Ibitak";
                    break;
                case PokemonId.Ekans:
                    GerName = "Rettan";
                    break;
                case PokemonId.Arbok:
                    GerName = "Arbok";
                    break;
                case PokemonId.Pikachu:
                    GerName = "Pikachu";
                    break;
                case PokemonId.Raichu:
                    GerName = "Raichu";
                    break;
                case PokemonId.Sandshrew:
                    GerName = "Sandan";
                    break;
                case PokemonId.Sandslash:
                    GerName = "Sandamer";
                    break;
                case PokemonId.NidoranFemale:
                    GerName = "Weibliches Nidoran";
                    break;
                case PokemonId.Nidorina:
                    GerName = "Nidorina";
                    break;
                case PokemonId.Nidoqueen:
                    GerName = "Nidoqueen";
                    break;
                case PokemonId.NidoranMale:
                    GerName = "Maennliches Nidoran";
                    break;
                case PokemonId.Nidorino:
                    GerName = "Nidorino";
                    break;
                case PokemonId.Nidoking:
                    GerName = "Nidoking";
                    break;
                case PokemonId.Clefairy:
                    GerName = "Piepi";
                    break;
                case PokemonId.Clefable:
                    GerName = "Pixi";
                    break;
                case PokemonId.Vulpix:
                    GerName = "Vulpix";
                    break;
                case PokemonId.Ninetales:
                    GerName = "Vulnona";
                    break;
                case PokemonId.Jigglypuff:
                    GerName = "Pummeluff";
                    break;
                case PokemonId.Wigglytuff:
                    GerName = "Knuddeluff";
                    break;
                case PokemonId.Zubat:
                    GerName = "Zubat";
                    break;
                case PokemonId.Golbat:
                    GerName = "Golbat";
                    break;
                case PokemonId.Oddish:
                    GerName = "Myrapla";
                    break;
                case PokemonId.Gloom:
                    GerName = "Duflor";
                    break;
                case PokemonId.Vileplume:
                    GerName = "Giflor";
                    break;
                case PokemonId.Paras:
                    GerName = "Paras";
                    break;
                case PokemonId.Parasect:
                    GerName = "Parasek";
                    break;
                case PokemonId.Venonat:
                    GerName = "Bluzuk";
                    break;
                case PokemonId.Venomoth:
                    GerName = "Omot";
                    break;
                case PokemonId.Diglett:
                    GerName = "Digda";
                    break;
                case PokemonId.Dugtrio:
                    GerName = "Digdri";
                    break;
                case PokemonId.Meowth:
                    GerName = "Mauzi";
                    break;
                case PokemonId.Persian:
                    GerName = "Snobilikat";
                    break;
                case PokemonId.Psyduck:
                    GerName = "Enton";
                    break;
                case PokemonId.Golduck:
                    GerName = "Entoron";
                    break;
                case PokemonId.Mankey:
                    GerName = "Menki";
                    break;
                case PokemonId.Primeape:
                    GerName = "Rasaff";
                    break;
                case PokemonId.Growlithe:
                    GerName = "Fukano";
                    break;
                case PokemonId.Arcanine:
                    GerName = "Arkani";
                    break;
                case PokemonId.Poliwag:
                    GerName = "Quapsel";
                    break;
                case PokemonId.Poliwhirl:
                    GerName = "Quaputzi";
                    break;
                case PokemonId.Poliwrath:
                    GerName = "Quappo";
                    break;
                case PokemonId.Abra:
                    GerName = "Abra";
                    break;
                case PokemonId.Kadabra:
                    GerName = "Kadabra";
                    break;
                case PokemonId.Alakazam:
                    GerName = "Simsala";
                    break;
                case PokemonId.Machop:
                    GerName = "Machollo";
                    break;
                case PokemonId.Machoke:
                    GerName = "Maschock";
                    break;
                case PokemonId.Machamp:
                    GerName = "Machomei";
                    break;
                case PokemonId.Bellsprout:
                    GerName = "Knofensa";
                    break;
                case PokemonId.Weepinbell:
                    GerName = "Ultrigaria";
                    break;
                case PokemonId.Victreebel:
                    GerName = "Sarzenia";
                    break;
                case PokemonId.Tentacool:
                    GerName = "Tentacha";
                    break;
                case PokemonId.Tentacruel:
                    GerName = "Tentoxa";
                    break;
                case PokemonId.Geodude:
                    GerName = "Kleinstein";
                    break;
                case PokemonId.Graveler:
                    GerName = "Georok";
                    break;
                case PokemonId.Golem:
                    GerName = "Geowaz";
                    break;
                case PokemonId.Ponyta:
                    GerName = "Ponita";
                    break;
                case PokemonId.Rapidash:
                    GerName = "Gallopa";
                    break;
                case PokemonId.Slowpoke:
                    GerName = "Flegmon";
                    break;
                case PokemonId.Slowbro:
                    GerName = "Lahmus";
                    break;
                case PokemonId.Magnemite:
                    GerName = "Magnetilo";
                    break;
                case PokemonId.Magneton:
                    GerName = "Magneton";
                    break;
                case PokemonId.Farfetchd:
                    GerName = "Porenta";
                    break;
                case PokemonId.Doduo:
                    GerName = "Dodu";
                    break;
                case PokemonId.Dodrio:
                    GerName = "Dodri";
                    break;
                case PokemonId.Seel:
                    GerName = "Jurob";
                    break;
                case PokemonId.Dewgong:
                    GerName = "Jugong";
                    break;
                case PokemonId.Grimer:
                    GerName = "Sleima";
                    break;
                case PokemonId.Muk:
                    GerName = "Sleimok";
                    break;
                case PokemonId.Shellder:
                    GerName = "Muschas";
                    break;
                case PokemonId.Cloyster:
                    GerName = "Austos";
                    break;
                case PokemonId.Gastly:
                    GerName = "Nebulak";
                    break;
                case PokemonId.Haunter:
                    GerName = "Alpollo";
                    break;
                case PokemonId.Gengar:
                    GerName = "Gengar";
                    break;
                case PokemonId.Onix:
                    GerName = "Onix";
                    break;
                case PokemonId.Drowzee:
                    GerName = "Traumato";
                    break;
                case PokemonId.Hypno:
                    GerName = "Hypno";
                    break;
                case PokemonId.Krabby:
                    GerName = "Krabby";
                    break;
                case PokemonId.Kingler:
                    GerName = "Kingler";
                    break;
                case PokemonId.Voltorb:
                    GerName = "Voltobal";
                    break;
                case PokemonId.Electrode:
                    GerName = "Lektrobal";
                    break;
                case PokemonId.Exeggcute:
                    GerName = "Owei";
                    break;
                case PokemonId.Exeggutor:
                    GerName = "Kokowei";
                    break;
                case PokemonId.Cubone:
                    GerName = "Tragosso";
                    break;
                case PokemonId.Marowak:
                    GerName = "Knogga";
                    break;
                case PokemonId.Hitmonlee:
                    GerName = "Kicklee";
                    break;
                case PokemonId.Hitmonchan:
                    GerName = "Nockchan";
                    break;
                case PokemonId.Lickitung:
                    GerName = "Schlurp";
                    break;
                case PokemonId.Koffing:
                    GerName = "Smogon";
                    break;
                case PokemonId.Weezing:
                    GerName = "Smogmog";
                    break;
                case PokemonId.Rhyhorn:
                    GerName = "Rihorn";
                    break;
                case PokemonId.Rhydon:
                    GerName = "Rizeros";
                    break;
                case PokemonId.Chansey:
                    GerName = "Chaneira";
                    break;
                case PokemonId.Tangela:
                    GerName = "Tangela";
                    break;
                case PokemonId.Kangaskhan:
                    GerName = "Kangama";
                    break;
                case PokemonId.Horsea:
                    GerName = "Seeper";
                    break;
                case PokemonId.Seadra:
                    GerName = "Seemon";
                    break;
                case PokemonId.Goldeen:
                    GerName = "Goldini";
                    break;
                case PokemonId.Seaking:
                    GerName = "Golking";
                    break;
                case PokemonId.Staryu:
                    GerName = "Sterndu";
                    break;
                case PokemonId.Starmie:
                    GerName = "Starmie";
                    break;
                case PokemonId.MrMime:
                    GerName = "Pantimos";
                    break;
                case PokemonId.Scyther:
                    GerName = "Sichlor";
                    break;
                case PokemonId.Jynx:
                    GerName = "Rossana";
                    break;
                case PokemonId.Electabuzz:
                    GerName = "Elektek";
                    break;
                case PokemonId.Magmar:
                    GerName = "Magmar";
                    break;
                case PokemonId.Pinsir:
                    GerName = "Pinsir";
                    break;
                case PokemonId.Tauros:
                    GerName = "Tauros";
                    break;
                case PokemonId.Magikarp:
                    GerName = "Karpador";
                    break;
                case PokemonId.Gyarados:
                    GerName = "Garados";
                    break;
                case PokemonId.Lapras:
                    GerName = "Lapras";
                    break;
                case PokemonId.Ditto:
                    GerName = "Ditto";
                    break;
                case PokemonId.Eevee:
                    GerName = "Evoli";
                    break;
                case PokemonId.Vaporeon:
                    GerName = "Aquana";
                    break;
                case PokemonId.Jolteon:
                    GerName = "Blitza";
                    break;
                case PokemonId.Flareon:
                    GerName = "Flamara";
                    break;
                case PokemonId.Porygon:
                    GerName = "Porygon";
                    break;
                case PokemonId.Omanyte:
                    GerName = "Amonitas";
                    break;
                case PokemonId.Omastar:
                    GerName = "Amoroso";
                    break;
                case PokemonId.Kabuto:
                    GerName = "Kabuto";
                    break;
                case PokemonId.Kabutops:
                    GerName = "Kabutops";
                    break;
                case PokemonId.Aerodactyl:
                    GerName = "Aerodactyl";
                    break;
                case PokemonId.Snorlax:
                    GerName = "Relaxo";
                    break;
                case PokemonId.Articuno:
                    GerName = "Arktos";
                    break;
                case PokemonId.Zapdos:
                    GerName = "Zapdos";
                    break;
                case PokemonId.Moltres:
                    GerName = "Lavados";
                    break;
                case PokemonId.Dratini:
                    GerName = "Dratini";
                    break;
                case PokemonId.Dragonair:
                    GerName = "Dragonir";
                    break;
                case PokemonId.Dragonite:
                    GerName = "Dragoran";
                    break;
                case PokemonId.Mewtwo:
                    GerName = "Mewtu";
                    break;
                case PokemonId.Mew:
                    GerName = "Mew";
                    break;
                default:
                    GerName = "Unknown Pokemon";
                    break;

            }
            return GerName;
        }
 public PokemonToggle(PokemonId id, bool isChecked)
 {
     Name = id.ToString();
     Id = id;
     Numeric = (int)id;
     IsChecked = isChecked;
 }
Beispiel #22
0
 public void SetMaxLink(PokemonId pokemon, int value)
 {
     SetByte((int)pokemon, (byte)value);
 }
Beispiel #23
0
        public static async Task Execute(ISession session, CancellationToken cancellationToken,
                                         PokemonId priority = PokemonId.Missingno, bool sessionAllowTransfer = true)
        {
            var manager = TinyIoCContainer.Current.Resolve <MultiAccountManager>();

            manager.ThrowIfSwitchAccountRequested();
            cancellationToken.ThrowIfCancellationRequested();

            if (!session.LogicSettings.CatchPokemon)
            {
                return;
            }

            var totalBalls = (await session.Inventory.GetItems().ConfigureAwait(false)).Where(x => x.ItemId == ItemId.ItemPokeBall || x.ItemId == ItemId.ItemGreatBall || x.ItemId == ItemId.ItemUltraBall).Sum(x => x.Count);

            if (session.SaveBallForByPassCatchFlee && totalBalls < 130)
            {
                return;
            }

            if (session.Stats.CatchThresholdExceeds(session))
            {
                if (manager.AllowMultipleBot() &&
                    session.LogicSettings.MultipleBotConfig.SwitchOnCatchLimit &&
                    manager.AllowSwitch()
                    )
                {
                    throw new ActiveSwitchByRuleException()
                          {
                              MatchedRule  = SwitchRules.CatchLimitReached,
                              ReachedValue = session.LogicSettings.CatchPokemonLimit
                          };
                }

                return;
            }

            Logger.Write(session.Translation.GetTranslation(TranslationString.LookingForPokemon), LogLevel.Debug);

            var nearbyPokemons = await GetNearbyPokemons(session).ConfigureAwait(false);

            if (nearbyPokemons == null)
            {
                return;
            }
            var priorityPokemon = nearbyPokemons.Where(p => p.PokemonId == priority).FirstOrDefault();
            var pokemons        = nearbyPokemons.Where(p => p.PokemonId != priority).ToList();

            //add pokemons to map
            OnPokemonEncounterEvent(pokemons.ToList());

            EncounterResponse encounter = null;

            //if that is snipe pokemon and inventories if full, execute transfer to get more room for pokemon
            if (priorityPokemon != null)
            {
                pokemons.Insert(0, priorityPokemon);
                await LocationUtils.UpdatePlayerLocationWithAltitude(session,
                                                                     new GeoCoordinate(priorityPokemon.Latitude, priorityPokemon.Longitude, session.Client.CurrentAltitude), 0).ConfigureAwait(false); // Set speed to 0 for random speed.

                encounter = await session.Client.Encounter
                            .EncounterPokemon(priorityPokemon.EncounterId, priorityPokemon.SpawnPointId).ConfigureAwait(false);

                if (encounter.Status == EncounterResponse.Types.Status.PokemonInventoryFull)
                {
                    if (session.LogicSettings.TransferDuplicatePokemon)
                    {
                        await TransferDuplicatePokemonTask.Execute(session, cancellationToken).ConfigureAwait(false);
                    }

                    if (session.LogicSettings.TransferWeakPokemon)
                    {
                        await TransferWeakPokemonTask.Execute(session, cancellationToken).ConfigureAwait(false);
                    }

                    if (session.LogicSettings.EvolveAllPokemonAboveIv ||
                        session.LogicSettings.EvolveAllPokemonWithEnoughCandy ||
                        session.LogicSettings.UseLuckyEggsWhileEvolving ||
                        session.LogicSettings.KeepPokemonsThatCanEvolve)
                    {
                        await EvolvePokemonTask.Execute(session, cancellationToken).ConfigureAwait(false);
                    }
                }
            }

            foreach (var pokemon in pokemons)
            {
                await MSniperServiceTask.Execute(session, cancellationToken).ConfigureAwait(false);

                if (LocationUtils.CalculateDistanceInMeters(pokemon.Latitude, pokemon.Longitude, session.Client.CurrentLatitude, session.Client.CurrentLongitude) > session.Client.GlobalSettings.MapSettings.EncounterRangeMeters)
                {
                    Logger.Debug($"THIS POKEMON IS TOO FAR, {pokemon.Latitude}, {pokemon.Longitude}");
                    continue;
                }
                cancellationToken.ThrowIfCancellationRequested();
                TinyIoC.TinyIoCContainer.Current.Resolve <MultiAccountManager>().ThrowIfSwitchAccountRequested();
                string pokemonUniqueKey = $"{pokemon.EncounterId}";

                if (session.Cache.GetCacheItem(pokemonUniqueKey) != null)
                {
                    continue; //this pokemon has been skipped because not meet with catch criteria before.
                }

                var allitems = await session.Inventory.GetItems().ConfigureAwait(false);

                var pokeBallsCount   = allitems.FirstOrDefault(i => i.ItemId == ItemId.ItemPokeBall)?.Count;
                var greatBallsCount  = allitems.FirstOrDefault(i => i.ItemId == ItemId.ItemGreatBall)?.Count;
                var ultraBallsCount  = allitems.FirstOrDefault(i => i.ItemId == ItemId.ItemUltraBall)?.Count;
                var masterBallsCount = allitems.FirstOrDefault(i => i.ItemId == ItemId.ItemMasterBall)?.Count;
                masterBallsCount =
                    masterBallsCount == null
                        ? 0
                        : masterBallsCount; //return null ATM. need this code to logic check work

                if (pokeBallsCount + greatBallsCount + ultraBallsCount + masterBallsCount <
                    session.LogicSettings.PokeballsToKeepForSnipe && session.CatchBlockTime < DateTime.Now)
                {
                    session.CatchBlockTime = DateTime.Now.AddMinutes(session.LogicSettings.OutOfBallCatchBlockTime);
                    Logger.Write(session.Translation.GetTranslation(TranslationString.CatchPokemonDisable,
                                                                    session.LogicSettings.OutOfBallCatchBlockTime, session.LogicSettings.PokeballsToKeepForSnipe));
                    return;
                }

                if (session.CatchBlockTime > DateTime.Now)
                {
                    return;
                }

                if ((session.LogicSettings.UsePokemonToCatchLocallyListOnly &&
                     !session.LogicSettings.PokemonToCatchLocally.Pokemon.Contains(pokemon.PokemonId)) ||
                    (session.LogicSettings.UsePokemonToNotCatchFilter &&
                     session.LogicSettings.PokemonsNotToCatch.Contains(pokemon.PokemonId)))
                {
                    Logger.Write(session.Translation.GetTranslation(TranslationString.PokemonSkipped,
                                                                    session.Translation.GetPokemonTranslation(pokemon.PokemonId)));
                    continue;
                }

                var distance = LocationUtils.CalculateDistanceInMeters(session.Client.CurrentLatitude,
                                                                       session.Client.CurrentLongitude, pokemon.Latitude, pokemon.Longitude);
                await Task.Delay(distance > 100? 500 : 100, cancellationToken).ConfigureAwait(false);

                //to avoid duplicated encounter when snipe priority pokemon

                if (encounter == null || encounter.Status != EncounterResponse.Types.Status.EncounterSuccess)
                {
                    await LocationUtils.UpdatePlayerLocationWithAltitude(session,
                                                                         new GeoCoordinate(pokemon.Latitude, pokemon.Longitude, session.Client.CurrentAltitude), 0).ConfigureAwait(false); // Set speed to 0 for random speed.

                    encounter =
                        await session.Client.Encounter.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnPointId).ConfigureAwait(false);
                }

                if (encounter.Status == EncounterResponse.Types.Status.EncounterSuccess &&
                    session.LogicSettings.CatchPokemon)
                {
                    // Catch the Pokemon
                    await CatchPokemonTask.Execute(session, cancellationToken, encounter, pokemon,
                                                   currentFortData : null, sessionAllowTransfer : sessionAllowTransfer).ConfigureAwait(false);
                }
                else if (encounter.Status == EncounterResponse.Types.Status.PokemonInventoryFull)
                {
                    if (session.LogicSettings.TransferDuplicatePokemon || session.LogicSettings.TransferWeakPokemon)
                    {
                        session.EventDispatcher.Send(new WarnEvent
                        {
                            Message = session.Translation.GetTranslation(TranslationString.InvFullTransferring)
                        });
                        if (session.LogicSettings.TransferDuplicatePokemon)
                        {
                            await TransferDuplicatePokemonTask.Execute(session, cancellationToken).ConfigureAwait(false);
                        }
                        if (session.LogicSettings.TransferWeakPokemon)
                        {
                            await TransferWeakPokemonTask.Execute(session, cancellationToken).ConfigureAwait(false);
                        }
                        if (session.LogicSettings.EvolveAllPokemonAboveIv ||
                            session.LogicSettings.EvolveAllPokemonWithEnoughCandy ||
                            session.LogicSettings.UseLuckyEggsWhileEvolving ||
                            session.LogicSettings.KeepPokemonsThatCanEvolve)
                        {
                            await EvolvePokemonTask.Execute(session, cancellationToken).ConfigureAwait(false);
                        }
                    }
                    else
                    {
                        session.EventDispatcher.Send(new WarnEvent
                        {
                            Message = session.Translation.GetTranslation(TranslationString.InvFullTransferManually)
                        });
                    }
                }
                else
                {
                    session.EventDispatcher.Send(new WarnEvent
                    {
                        Message =
                            session.Translation.GetTranslation(TranslationString.EncounterProblem, encounter.Status)
                    });
                }
                encounter = null;
                // If pokemon is not last pokemon in list, create delay between catches, else keep moving.
                if (!Equals(pokemons.ElementAtOrDefault(pokemons.Count() - 1), pokemon))
                {
                    await Task.Delay(session.LogicSettings.DelayBetweenPokemonCatch, cancellationToken).ConfigureAwait(false);
                }
            }
        }
 public async Task <bool> Exists(PokemonId pokemonId)
 {
     return((await Find(pokemonId)) != null);
 }
Beispiel #25
0
 public static BaseStats GetBaseStats(PokemonId id)
 {
     switch ((int) id)
     {
         case 1:
             return new BaseStats(90, 126, 126);
         case 2:
             return new BaseStats(120, 156, 158);
         case 3:
             return new BaseStats(160, 198, 200);
         case 4:
             return new BaseStats(78, 128, 108);
         case 5:
             return new BaseStats(116, 160, 140);
         case 6:
             return new BaseStats(156, 212, 182);
         case 7:
             return new BaseStats(88, 112, 142);
         case 8:
             return new BaseStats(118, 144, 176);
         case 9:
             return new BaseStats(158, 186, 222);
         case 10:
             return new BaseStats(90, 62, 66);
         case 11:
             return new BaseStats(100, 56, 86);
         case 12:
             return new BaseStats(120, 144, 144);
         case 13:
             return new BaseStats(80, 68, 64);
         case 14:
             return new BaseStats(90, 62, 82);
         case 15:
             return new BaseStats(130, 144, 130);
         case 16:
             return new BaseStats(80, 94, 90);
         case 17:
             return new BaseStats(126, 126, 122);
         case 18:
             return new BaseStats(166, 170, 166);
         case 19:
             return new BaseStats(60, 92, 86);
         case 20:
             return new BaseStats(110, 146, 150);
         case 21:
             return new BaseStats(80, 102, 78);
         case 22:
             return new BaseStats(130, 168, 146);
         case 23:
             return new BaseStats(70, 112, 112);
         case 24:
             return new BaseStats(120, 166, 166);
         case 25:
             return new BaseStats(70, 124, 108);
         case 26:
             return new BaseStats(120, 200, 154);
         case 27:
             return new BaseStats(100, 90, 114);
         case 28:
             return new BaseStats(150, 150, 172);
         case 29:
             return new BaseStats(110, 100, 104);
         case 30:
             return new BaseStats(140, 132, 136);
         case 31:
             return new BaseStats(180, 184, 190);
         case 32:
             return new BaseStats(92, 110, 94);
         case 33:
             return new BaseStats(122, 142, 128);
         case 34:
             return new BaseStats(162, 204, 170);
         case 35:
             return new BaseStats(140, 116, 124);
         case 36:
             return new BaseStats(190, 178, 178);
         case 37:
             return new BaseStats(76, 106, 118);
         case 38:
             return new BaseStats(146, 176, 194);
         case 39:
             return new BaseStats(230, 98, 54);
         case 40:
             return new BaseStats(280, 168, 108);
         case 41:
             return new BaseStats(80, 88, 90);
         case 42:
             return new BaseStats(150, 164, 164);
         case 43:
             return new BaseStats(90, 134, 130);
         case 44:
             return new BaseStats(120, 162, 158);
         case 45:
             return new BaseStats(150, 202, 190);
         case 46:
             return new BaseStats(70, 122, 120);
         case 47:
             return new BaseStats(120, 162, 170);
         case 48:
             return new BaseStats(120, 108, 118);
         case 49:
             return new BaseStats(140, 172, 154);
         case 50:
             return new BaseStats(20, 108, 86);
         case 51:
             return new BaseStats(70, 148, 140);
         case 52:
             return new BaseStats(80, 104, 94);
         case 53:
             return new BaseStats(130, 156, 146);
         case 54:
             return new BaseStats(100, 132, 112);
         case 55:
             return new BaseStats(160, 194, 176);
         case 56:
             return new BaseStats(80, 122, 96);
         case 57:
             return new BaseStats(130, 178, 150);
         case 58:
             return new BaseStats(110, 156, 110);
         case 59:
             return new BaseStats(180, 230, 180);
         case 60:
             return new BaseStats(80, 108, 98);
         case 61:
             return new BaseStats(130, 132, 132);
         case 62:
             return new BaseStats(180, 180, 202);
         case 63:
             return new BaseStats(50, 110, 76);
         case 64:
             return new BaseStats(80, 150, 112);
         case 65:
             return new BaseStats(110, 186, 152);
         case 66:
             return new BaseStats(140, 118, 96);
         case 67:
             return new BaseStats(160, 154, 144);
         case 68:
             return new BaseStats(180, 198, 180);
         case 69:
             return new BaseStats(100, 158, 78);
         case 70:
             return new BaseStats(130, 190, 110);
         case 71:
             return new BaseStats(160, 222, 152);
         case 72:
             return new BaseStats(80, 106, 136);
         case 73:
             return new BaseStats(160, 170, 196);
         case 74:
             return new BaseStats(80, 106, 118);
         case 75:
             return new BaseStats(110, 142, 156);
         case 76:
             return new BaseStats(160, 176, 198);
         case 77:
             return new BaseStats(100, 168, 138);
         case 78:
             return new BaseStats(130, 200, 170);
         case 79:
             return new BaseStats(180, 110, 110);
         case 80:
             return new BaseStats(190, 184, 198);
         case 81:
             return new BaseStats(50, 128, 138);
         case 82:
             return new BaseStats(100, 186, 180);
         case 83:
             return new BaseStats(104, 138, 132);
         case 84:
             return new BaseStats(70, 126, 96);
         case 85:
             return new BaseStats(120, 182, 150);
         case 86:
             return new BaseStats(130, 104, 138);
         case 87:
             return new BaseStats(180, 156, 192);
         case 88:
             return new BaseStats(160, 124, 110);
         case 89:
             return new BaseStats(210, 180, 188);
         case 90:
             return new BaseStats(60, 120, 112);
         case 91:
             return new BaseStats(100, 196, 196);
         case 92:
             return new BaseStats(60, 136, 82);
         case 93:
             return new BaseStats(90, 172, 118);
         case 94:
             return new BaseStats(120, 204, 156);
         case 95:
             return new BaseStats(70, 90, 186);
         case 96:
             return new BaseStats(120, 104, 140);
         case 97:
             return new BaseStats(170, 162, 196);
         case 98:
             return new BaseStats(60, 116, 110);
         case 99:
             return new BaseStats(110, 178, 168);
         case 100:
             return new BaseStats(80, 102, 124);
         case 101:
             return new BaseStats(120, 150, 174);
         case 102:
             return new BaseStats(120, 110, 132);
         case 103:
             return new BaseStats(190, 232, 164);
         case 104:
             return new BaseStats(100, 102, 150);
         case 105:
             return new BaseStats(120, 140, 202);
         case 106:
             return new BaseStats(100, 148, 172);
         case 107:
             return new BaseStats(100, 138, 204);
         case 108:
             return new BaseStats(180, 126, 160);
         case 109:
             return new BaseStats(80, 136, 142);
         case 110:
             return new BaseStats(130, 190, 198);
         case 111:
             return new BaseStats(160, 110, 116);
         case 112:
             return new BaseStats(210, 166, 160);
         case 113:
             return new BaseStats(500, 40, 60);
         case 114:
             return new BaseStats(130, 164, 152);
         case 115:
             return new BaseStats(210, 142, 178);
         case 116:
             return new BaseStats(60, 122, 100);
         case 117:
             return new BaseStats(110, 176, 150);
         case 118:
             return new BaseStats(90, 112, 126);
         case 119:
             return new BaseStats(160, 172, 160);
         case 120:
             return new BaseStats(60, 130, 128);
         case 121:
             return new BaseStats(120, 194, 192);
         case 122:
             return new BaseStats(80, 154, 196);
         case 123:
             return new BaseStats(140, 176, 180);
         case 124:
             return new BaseStats(130, 172, 134);
         case 125:
             return new BaseStats(130, 198, 160);
         case 126:
             return new BaseStats(130, 214, 158);
         case 127:
             return new BaseStats(130, 184, 186);
         case 128:
             return new BaseStats(150, 148, 184);
         case 129:
             return new BaseStats(40, 42, 84);
         case 130:
             return new BaseStats(190, 192, 196);
         case 131:
             return new BaseStats(260, 186, 190);
         case 132:
             return new BaseStats(96, 110, 110);
         case 133:
             return new BaseStats(110, 114, 128);
         case 134:
             return new BaseStats(260, 186, 168);
         case 135:
             return new BaseStats(130, 192, 174);
         case 136:
             return new BaseStats(130, 238, 178);
         case 137:
             return new BaseStats(130, 156, 158);
         case 138:
             return new BaseStats(70, 132, 160);
         case 139:
             return new BaseStats(140, 180, 202);
         case 140:
             return new BaseStats(60, 148, 142);
         case 141:
             return new BaseStats(120, 190, 190);
         case 142:
             return new BaseStats(160, 182, 162);
         case 143:
             return new BaseStats(320, 180, 180);
         case 144:
             return new BaseStats(180, 198, 242);
         case 145:
             return new BaseStats(180, 232, 194);
         case 146:
             return new BaseStats(180, 242, 194);
         case 147:
             return new BaseStats(82, 128, 110);
         case 148:
             return new BaseStats(122, 170, 152);
         case 149:
             return new BaseStats(182, 250, 212);
         case 150:
             return new BaseStats(212, 284, 202);
         case 151:
             return new BaseStats(200, 220, 220);
         default:
             return new BaseStats();
     }
 }
Beispiel #26
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0UL)
            {
                hash ^= Id.GetHashCode();
            }
            if (PokemonId != global::POGOProtos.Enums.PokemonId.Missingno)
            {
                hash ^= PokemonId.GetHashCode();
            }
            if (Cp != 0)
            {
                hash ^= Cp.GetHashCode();
            }
            if (Stamina != 0)
            {
                hash ^= Stamina.GetHashCode();
            }
            if (StaminaMax != 0)
            {
                hash ^= StaminaMax.GetHashCode();
            }
            if (Move1 != global::POGOProtos.Enums.PokemonMove.MoveUnset)
            {
                hash ^= Move1.GetHashCode();
            }
            if (Move2 != global::POGOProtos.Enums.PokemonMove.MoveUnset)
            {
                hash ^= Move2.GetHashCode();
            }
            if (DeployedFortId.Length != 0)
            {
                hash ^= DeployedFortId.GetHashCode();
            }
            if (OwnerName.Length != 0)
            {
                hash ^= OwnerName.GetHashCode();
            }
            if (IsEgg != false)
            {
                hash ^= IsEgg.GetHashCode();
            }
            if (EggKmWalkedTarget != 0D)
            {
                hash ^= EggKmWalkedTarget.GetHashCode();
            }
            if (EggKmWalkedStart != 0D)
            {
                hash ^= EggKmWalkedStart.GetHashCode();
            }
            if (Origin != 0)
            {
                hash ^= Origin.GetHashCode();
            }
            if (HeightM != 0F)
            {
                hash ^= HeightM.GetHashCode();
            }
            if (WeightKg != 0F)
            {
                hash ^= WeightKg.GetHashCode();
            }
            if (IndividualAttack != 0)
            {
                hash ^= IndividualAttack.GetHashCode();
            }
            if (IndividualDefense != 0)
            {
                hash ^= IndividualDefense.GetHashCode();
            }
            if (IndividualStamina != 0)
            {
                hash ^= IndividualStamina.GetHashCode();
            }
            if (CpMultiplier != 0F)
            {
                hash ^= CpMultiplier.GetHashCode();
            }
            if (Pokeball != global::POGOProtos.Inventory.Item.ItemId.ItemUnknown)
            {
                hash ^= Pokeball.GetHashCode();
            }
            if (CapturedCellId != 0UL)
            {
                hash ^= CapturedCellId.GetHashCode();
            }
            if (BattlesAttacked != 0)
            {
                hash ^= BattlesAttacked.GetHashCode();
            }
            if (BattlesDefended != 0)
            {
                hash ^= BattlesDefended.GetHashCode();
            }
            if (EggIncubatorId.Length != 0)
            {
                hash ^= EggIncubatorId.GetHashCode();
            }
            if (CreationTimeMs != 0UL)
            {
                hash ^= CreationTimeMs.GetHashCode();
            }
            if (NumUpgrades != 0)
            {
                hash ^= NumUpgrades.GetHashCode();
            }
            if (AdditionalCpMultiplier != 0F)
            {
                hash ^= AdditionalCpMultiplier.GetHashCode();
            }
            if (Favorite != 0)
            {
                hash ^= Favorite.GetHashCode();
            }
            if (Nickname.Length != 0)
            {
                hash ^= Nickname.GetHashCode();
            }
            if (FromFort != 0)
            {
                hash ^= FromFort.GetHashCode();
            }
            if (BuddyCandyAwarded != 0)
            {
                hash ^= BuddyCandyAwarded.GetHashCode();
            }
            return(hash);
        }
 internal static PokemonAlternativeNames CreateExactMatches(PokemonId pokemonId, ISet <string> exactMatches)
 {
     return(new PokemonAlternativeNames(pokemonId, exactMatches, null));
 }
Beispiel #28
0
 internal async Task <PokemonSettings> GetPokemonSetting(PokemonId pokemonId)
 {
     return((await GetPokemonSettings().ConfigureAwait(false)).FirstOrDefault(p => p.PokemonId == pokemonId));
 }
 internal static PokemonAlternativeNames CreateAllMatches(PokemonId pokemonId, ISet <string> exactMatches,
                                                          ISet <string> partialMatches)
 {
     return(new PokemonAlternativeNames(pokemonId, exactMatches, partialMatches));
 }
Beispiel #30
0
        public async Task <bool> CanEvolvePokemon(PokemonData pokemon, EvolveFilter appliedFilter = null, bool checkEvolveFilterRequirements = false)
        {
            // Can't evolve pokemon in gyms.
            if (!string.IsNullOrEmpty(pokemon.DeployedFortId))
            {
                return(false);
            }

            IEnumerable <PokemonSettings> pokemonSettings = await GetPokemonSettings().ConfigureAwait(false);

            var settings = pokemonSettings.SingleOrDefault(x => x.PokemonId == pokemon.PokemonId);

            // Can't evolve pokemon that are not evolvable.
            if (settings.EvolutionIds.Count == 0 && settings.EvolutionBranch.Count == 0)
            {
                return(false);
            }

            int familyCandy = await GetCandyCount(pokemon.PokemonId).ConfigureAwait(false);

            if (checkEvolveFilterRequirements)
            {
                if (!appliedFilter.Operator.BoolFunc(
                        appliedFilter.MinIV <= pokemon.Perfection(),
                        appliedFilter.MinLV <= pokemon.Level(),
                        appliedFilter.MinCP <= pokemon.CP(),
                        (appliedFilter.Moves == null ||
                         appliedFilter.Moves.Count == 0 ||
                         appliedFilter.Moves.Any(x => x[0] == pokemon.Move1 && x[1] == pokemon.Move2)
                        )
                        ))
                {
                    return(false);
                }

                if (appliedFilter.MinCandiesBeforeEvolve > 0 && familyCandy < appliedFilter.MinCandiesBeforeEvolve)
                {
                    return(false);
                }
            }

            PokemonId evolveTo = PokemonId.Missingno;

            if (appliedFilter != null && !string.IsNullOrEmpty(appliedFilter.EvolveTo) && Enum.TryParse <PokemonId>(appliedFilter.EvolveTo, true, out evolveTo))
            {
                var branch = settings.EvolutionBranch.FirstOrDefault(x => x.Evolution == evolveTo);
                if (branch == null)
                {
                    return(false); //wrong setting, do not evolve this pokemon
                }
                if (branch.EvolutionItemRequirement != ItemId.ItemUnknown)
                {
                    var itemCount = (await GetItems().ConfigureAwait(false)).Count(x => x.ItemId == branch.EvolutionItemRequirement);

                    if (itemCount == 0)
                    {
                        return(false);
                    }
                }

                if (familyCandy < branch.CandyCost)
                {
                    return(false);
                }
            }
            else
            {
                bool canEvolve = false;
                // Check requirements for all branches, if we meet the requirements for any of them then we return true.
                foreach (var branch in settings.EvolutionBranch)
                {
                    if (branch.EvolutionItemRequirement != ItemId.ItemUnknown)
                    {
                        var itemCount = (await GetItems().ConfigureAwait(false)).Count(x => x.ItemId == branch.EvolutionItemRequirement);

                        if (itemCount == 0)
                        {
                            continue;  // Cannot evolve so check next branch
                        }
                    }

                    if (familyCandy < branch.CandyCost)
                    {
                        continue;  // Cannot evolve so check next branch
                    }
                    // If we got here, then we can evolve so break out of loop.
                    canEvolve = true;
                }
                return(canEvolve);
            }

            return(true);
        }
Beispiel #31
0
        public static string GetGradeColor(PokemonId pokemonId)
        {
            var g = GetPokemonGrade(pokemonId);

            return(RarityColors[g]);
        }
Beispiel #32
0
        private async Task <MethodResult> CaptureSnipePokemon(double latitude, double longitude, PokemonId pokemon)
        {
            var currentLocation = new GeoCoordinate(_client.ClientSession.Player.Latitude, _client.ClientSession.Player.Longitude);
            var fortLocation    = new GeoCoordinate(latitude, longitude);

            double distance = CalculateDistanceInMeters(currentLocation, fortLocation);

            LogCaller(new LoggerEventArgs(String.Format("Going to sniping {0} at location {1}, {2}. Distance {3:0.00}m", pokemon, latitude, longitude, distance), LoggerTypes.Snipe));

            // Not nedded this runs on local pos.../
            //GeoCoordinate originalLocation = new GeoCoordinate(_client.ClientSession.Player.Latitude, _client.ClientSession.Player.Longitude, _client.ClientSession.Player.Altitude);

            //Update location
            //MethodResult result = await UpdateLocation(new GeoCoordinate(latitude, longitude));

            //Update location
            MethodResult result = await GoToLocation(new GeoCoordinate(latitude, longitude));

            if (!result.Success)
            {
                return(result);
            }

            if (UserSettings.UsePOGOLibHeartbeat)
            {
                await Task.Delay(10000); //wait for pogolib refreshmapobjects
            }
            //Get catchable pokemon

            MethodResult <List <MapPokemon> > pokemonResult = await GetCatchablePokemonAsync();

            if (!pokemonResult.Success)
            {
                return(new MethodResult
                {
                    Message = pokemonResult.Message
                });
            }

            if (pokemonResult.Data == null || pokemonResult.Data.Count == 0)
            {
                return(new MethodResult());
            }

            MapPokemon pokemonToSnipe = pokemonResult.Data.FirstOrDefault(x => x.PokemonId == pokemon);

            //Encounter
            MethodResult <EncounterResponse> eResponseResult = await EncounterPokemon(pokemonToSnipe);

            if (!eResponseResult.Success)
            {
                //LogCaller(new LoggerEventArgs(String.Format("Snipe failed to encounter pokemon {0}. Going back to original location, or already catched", pokemon), LoggerTypes.Info));
                LogCaller(new LoggerEventArgs(String.Format("Snipe failed to encounter pokemon {0}, or already catched", pokemon), LoggerTypes.Info));

                //Failed, update location back
                //await UpdateLocation(originalLocation);

                // Not nedded this runs on local pos.../
                //await GoToLocation(originalLocation);

                return(new MethodResult
                {
                    Message = eResponseResult.Message
                });
            }

            if (eResponseResult.Data == null || eResponseResult.Data.WildPokemon.PokemonData.PokemonId == PokemonId.Missingno)
            {
                return(new MethodResult());
            }

            //Update location back
            //MethodResult locationResult = await RepeatAction(() => UpdateLocation(originalLocation), 2);

            // Not nedded this runs on local pos.../

            /*MethodResult locationResult = await RepeatAction(() => GoToLocation(originalLocation), 2);
             *
             * if (!locationResult.Success)
             * {
             *  return locationResult;
             * }
             */

            _lastPokeSniperId = pokemonToSnipe.EncounterId;

            //Catch pokemon
            MethodResult catchResult = await CatchPokemon(eResponseResult.Data, pokemonToSnipe, true); //Handles logging

            if (catchResult.Success)
            {
                AlreadySnipped = true;
            }

            return(catchResult);
        }
        public static async Task Execute(ISession session, CancellationToken cancellationToken, PokemonId priority = PokemonId.Missingno, bool sessionAllowTransfer = true)
        {
            cancellationToken.ThrowIfCancellationRequested();
            if (!session.LogicSettings.CatchPokemon)
            {
                return;
            }

            Logger.Write(session.Translation.GetTranslation(TranslationString.LookingForPokemon), LogLevel.Debug);

            var nearbyPokemons = await GetNearbyPokemons(session);

            var priorityPokemon         = nearbyPokemons.Where(p => p.PokemonId == priority).FirstOrDefault();
            var pokemons                = nearbyPokemons.Where(p => p.PokemonId != priority).ToList();
            EncounterResponse encounter = null;

            //if that is snipe pokemon and inventories if full, execute transfer to get more room for pokemon
            if (priorityPokemon != null)
            {
                pokemons.Insert(0, priorityPokemon);
                encounter = await session.Client.Encounter.EncounterPokemon(priorityPokemon.EncounterId, priorityPokemon.SpawnPointId);

                if (encounter.Status == EncounterResponse.Types.Status.PokemonInventoryFull)
                {
                    await TransferWeakPokemonTask.Execute(session, cancellationToken);

                    await TransferDuplicatePokemonTask.Execute(session, cancellationToken);
                }
            }

            foreach (var pokemon in pokemons)
            {
                cancellationToken.ThrowIfCancellationRequested();
                string pokemonUniqueKey = $"{pokemon.EncounterId}";

                if (session.Cache.GetCacheItem(pokemonUniqueKey) != null)
                {
                    continue; //this pokemon has been skipped because not meet with catch criteria before.
                }

                var allitems = await session.Inventory.GetItems();

                var pokeBallsCount   = allitems.FirstOrDefault(i => i.ItemId == ItemId.ItemPokeBall)?.Count;
                var greatBallsCount  = allitems.FirstOrDefault(i => i.ItemId == ItemId.ItemGreatBall)?.Count;
                var ultraBallsCount  = allitems.FirstOrDefault(i => i.ItemId == ItemId.ItemUltraBall)?.Count;
                var masterBallsCount = allitems.FirstOrDefault(i => i.ItemId == ItemId.ItemMasterBall)?.Count;

                if (pokeBallsCount + greatBallsCount + ultraBallsCount + masterBallsCount == 0)
                {
                    Logger.Write(session.Translation.GetTranslation(TranslationString.ZeroPokeballInv));
                    return;
                }

                if ((session.LogicSettings.UsePokemonSniperFilterOnly && !session.LogicSettings.PokemonToSnipe.Pokemon.Contains(pokemon.PokemonId)) ||
                    (session.LogicSettings.UsePokemonToNotCatchFilter && session.LogicSettings.PokemonsNotToCatch.Contains(pokemon.PokemonId)))
                {
                    Logger.Write(session.Translation.GetTranslation(TranslationString.PokemonSkipped, session.Translation.GetPokemonTranslation(pokemon.PokemonId)));
                    continue;
                }

                var distance = LocationUtils.CalculateDistanceInMeters(session.Client.CurrentLatitude,
                                                                       session.Client.CurrentLongitude, pokemon.Latitude, pokemon.Longitude);
                await Task.Delay(distance > 100? 500 : 100, cancellationToken);

                //to avoid duplicated encounter when snipe priority pokemon

                if (encounter == null || encounter.Status != EncounterResponse.Types.Status.EncounterSuccess)
                {
                    encounter = await session.Client.Encounter.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnPointId);
                }

                if (encounter.Status == EncounterResponse.Types.Status.EncounterSuccess && session.LogicSettings.CatchPokemon)
                {
                    // Catch the Pokemon
                    await CatchPokemonTask.Execute(session, cancellationToken, encounter, pokemon,
                                                   currentFortData : null, sessionAllowTransfer : sessionAllowTransfer);
                }
                else if (encounter.Status == EncounterResponse.Types.Status.PokemonInventoryFull)
                {
                    if (session.LogicSettings.TransferDuplicatePokemon || session.LogicSettings.TransferWeakPokemon)
                    {
                        session.EventDispatcher.Send(new WarnEvent
                        {
                            Message = session.Translation.GetTranslation(TranslationString.InvFullTransferring)
                        });
                        if (session.LogicSettings.TransferDuplicatePokemon)
                        {
                            await TransferDuplicatePokemonTask.Execute(session, cancellationToken);
                        }
                        if (session.LogicSettings.TransferWeakPokemon)
                        {
                            await TransferWeakPokemonTask.Execute(session, cancellationToken);
                        }
                    }
                    else
                    {
                        session.EventDispatcher.Send(new WarnEvent
                        {
                            Message = session.Translation.GetTranslation(TranslationString.InvFullTransferManually)
                        });
                    }
                }
                else
                {
                    session.EventDispatcher.Send(new WarnEvent
                    {
                        Message =
                            session.Translation.GetTranslation(TranslationString.EncounterProblem, encounter.Status)
                    });
                }
                encounter = null;
                // If pokemon is not last pokemon in list, create delay between catches, else keep moving.
                if (!Equals(pokemons.ElementAtOrDefault(pokemons.Count() - 1), pokemon))
                {
                    await Task.Delay(session.LogicSettings.DelayBetweenPokemonCatch, cancellationToken);
                }
            }
        }
Beispiel #34
0
 public BotSwitcherState(PokemonId pokemon)
 {
     this.pokemonToCatch = pokemon;
 }
Beispiel #35
0
        public static string getPokemonNameByLanguage(ISettings clientSettings, PokemonId b)
        {
            if (clientSettings.Language)
            {
                return getPokemonNameGer(b);

            }
            else
            {
                return b.ToString();
            }
        }
Beispiel #36
0
 //Generate user friendly and hashtag friendly pokemon names
 private static string SpellCheckPokemon(PokemonId pokemon, bool isHashtag = false)
 {
     string display;
     switch (pokemon)
     {
         case PokemonId.Farfetchd:
             display = isHashtag ? "Farfetchd" : "Farfetch'd";
             break;
         case PokemonId.MrMime:
             display = isHashtag ? "MrMime" : "Mr. Mime";
             break;
         case PokemonId.NidoranFemale:
             display = isHashtag ? "Nidoran" : "Nidoran♀";
             break;
         case PokemonId.NidoranMale:
             display = isHashtag ? "Nidoran" : "Nidoran♂";
             break;
         default:
             display = pokemon.ToString();
             break;
     }
     if (s_config.PokemonOverrides.Any(po => po.Kind == pokemon))
     {
         display = s_config.PokemonOverrides.First(po => po.Kind == pokemon).Display;
     }
     Regex regex = new Regex("[^a-zA-Z0-9]");
     return isHashtag ? regex.Replace(display, "") : display;
 }
 private void testPokemonParsing(String text, PokemonId expectedPokemonId)
 {
     Assert.AreEqual(expectedPokemonId, PokemonParser.parsePokemon(text));
 }
 public spottedPoke(int id, double lat, double lng, int expTime, int visionid)
 {
     _pokeId = (PokemonId)id;
     _lat = lat;
     _lng = lng;
     _expTime = expTime;
     _visionId = visionid;
 }
Beispiel #39
0
 public static PokemonMovesCombo GetPokemonMoves(PokemonId id)
 {
     switch ((int) id)
     {
         case 3:
             return new PokemonMovesCombo(214, 90); //Venusaur
         case 6:
             return new PokemonMovesCombo(210, 83); //Charizard
         case 9:
             return new PokemonMovesCombo(230, 135); //Blastoise
         case 12:
             return new PokemonMovesCombo(201, 108); //Butterfree
         case 15:
             return new PokemonMovesCombo(224, 90); //Beedrill
         case 18:
             return new PokemonMovesCombo(210, 122); //Pidgeot
         case 20:
             return new PokemonMovesCombo(202, 129); //Raticate
         case 22:
             return new PokemonMovesCombo(239, 46); //Fearow
         case 24:
             return new PokemonMovesCombo(202, 92); //Arbok
         case 26:
             return new PokemonMovesCombo(206, 123); //Raichu
         case 28:
             return new PokemonMovesCombo(216, 31); //Sandslash
         case 31:
             return new PokemonMovesCombo(44, 32); //Nidoqueen
         case 34:
             return new PokemonMovesCombo(44, 91); //Nidoking
         case 36:
             return new PokemonMovesCombo(222, 87); //Clefable
         case 38:
             return new PokemonMovesCombo(209, 24); //Ninetales
         case 40:
             return new PokemonMovesCombo(222, 88); //Wigglypuff
         case 42:
             return new PokemonMovesCombo(210, 121); //Golbat
         case 45:
             return new PokemonMovesCombo(215, 47); //Vileplume
         case 47:
             return new PokemonMovesCombo(98, 100); //Parasect
         case 49:
             return new PokemonMovesCombo(98, 108); //Venomoth
         case 51:
             return new PokemonMovesCombo(216, 32); //Dugtrio
         case 53:
             return new PokemonMovesCombo(220, 88); //Persian
         case 55:
             return new PokemonMovesCombo(230, 107); //Golduck
         case 57:
             return new PokemonMovesCombo(207, 28); //Primeape
         case 59:
             return new PokemonMovesCombo(202, 24); //Arcanine
         case 62:
             return new PokemonMovesCombo(92, 107); //Poliwrath
         case 65:
             return new PokemonMovesCombo(226, 108); //Alakazam
         case 68:
             return new PokemonMovesCombo(208, 28); //Machamp
         case 71:
             return new PokemonMovesCombo(215, 90); //Victreebel
         case 73:
             return new PokemonMovesCombo(224, 91); //Tentacruel
         case 76:
             return new PokemonMovesCombo(93, 32); //Golem
         case 78:
             return new PokemonMovesCombo(209, 42); //Rapidash
         case 80:
             return new PokemonMovesCombo(230, 108); //Slowbro
         case 82:
             return new PokemonMovesCombo(206, 35); //Magneton
         case 83:
             return new PokemonMovesCombo(124, 117); //Farfetch'd
         case 85:
             return new PokemonMovesCombo(238, 38); //Dodrio
         case 87:
             return new PokemonMovesCombo(112, 40); //Dewgong
         case 89:
             return new PokemonMovesCombo(44, 92); //Muk
         case 91:
             return new PokemonMovesCombo(112, 107); //Cloyster
         case 94:
             return new PokemonMovesCombo(213, 91); //Gengar
         case 95:
             return new PokemonMovesCombo(227, 32); //Onix
         case 97:
             return new PokemonMovesCombo(234, 108); //Hypno
         case 99:
             return new PokemonMovesCombo(216, 105); //Kingler
         case 101:
             return new PokemonMovesCombo(206, 79); //Electrode
         case 103:
             return new PokemonMovesCombo(234, 108); //Exeggutor
         case 105:
             return new PokemonMovesCombo(233, 31); //Marowak
         case 107:
             return new PokemonMovesCombo(71, 123); //Hitmonchan
         case 108:
             return new PokemonMovesCombo(212, 118); //Lickitung
         case 110:
             return new PokemonMovesCombo(120, 90); //Weezing
         case 112:
             return new PokemonMovesCombo(233, 32); //Rhydon
         case 113:
             return new PokemonMovesCombo(222, 108); //Chancey
         case 114:
             return new PokemonMovesCombo(214, 118); //Tangela
         case 115:
             return new PokemonMovesCombo(207, 123); //Kangaskhan
         case 117:
             return new PokemonMovesCombo(230, 107); //Seadra
         case 119:
             return new PokemonMovesCombo(224, 22); //Seaking
         case 121:
             return new PokemonMovesCombo(230, 107); //Starmie
         case 122:
             return new PokemonMovesCombo(234, 108); //MrMime
         case 123:
             return new PokemonMovesCombo(239, 100); //Scyther
         case 124:
             return new PokemonMovesCombo(112, 60); //Jynx
         case 125:
             return new PokemonMovesCombo(205, 79); //Electrabuzz
         case 126:
             return new PokemonMovesCombo(209, 24); //Magmar
         case 127:
             return new PokemonMovesCombo(97, 100); //Pinsir
         case 128:
             return new PokemonMovesCombo(234, 74); //Tauros
         case 130:
             return new PokemonMovesCombo(null, 107); //Gyarados
         case 131:
             return new PokemonMovesCombo(112, 40); //Lapras
         case 132:
             return new PokemonMovesCombo(222, 133); //Ditto
         case 134:
             return new PokemonMovesCombo(230, 58); //Vaporeon
         case 135:
             return new PokemonMovesCombo(205, 79); //Jolteon
         case 136:
             return new PokemonMovesCombo(209, 24); //Flareon
         case 137:
             return new PokemonMovesCombo(221, 35); //Porygon
         case 139:
             return new PokemonMovesCombo(230, 107); //Omastar
         case 141:
             return new PokemonMovesCombo(216, 32); //Kabutops
         case 142:
             return new PokemonMovesCombo(202, 74); //Aerodactyl
         case 143:
             return new PokemonMovesCombo(212, 131); //Snorlax
         case 144:
             return new PokemonMovesCombo(218, 40); //Articuno
         case 145:
             return new PokemonMovesCombo(205, 79); //Zapdos
         case 146:
             return new PokemonMovesCombo(209, 24); //Moltres
         case 149:
             return new PokemonMovesCombo(81, 83); //Dragonite
         case 150:
             return new PokemonMovesCombo(226, 108); //Mewtwo
         case 151:
             return new PokemonMovesCombo(222, 108); //Mew
         default:
             return new PokemonMovesCombo();
     }
 }
 internal static PokemonAlternativeNames createExactMatches(PokemonId pokemonId, ISet<String> exactMatches)
 {
     return new PokemonAlternativeNames(pokemonId, exactMatches, null);
 }
Beispiel #41
0
 public PokemonData GetBestPokemonByIv(PokemonId pokemonId)
 {
     return Pokemon.OrderByDescending(PokemonInfo.CalculatePokemonPerfection).FirstOrDefault();
 }
Beispiel #42
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            PokemonId pokemonId = (PokemonId)Enum.Parse(typeof(PokemonId), value.ToString());

            return($"https://cdn.jsdelivr.net/gh/NecroBot-Private/PokemonGO-Assets@master/pokemon/{(int)pokemonId}.png");
        }
Beispiel #43
0
 public LoginState(PokemonId pokemonToCatch = PokemonId.Missingno, EncounteredEvent encounterData = null)
 {
     this.encounterData  = encounterData;
     this.pokemonToCatch = pokemonToCatch;
 }
Beispiel #44
0
        public static async Task <ItemId> GetRequireEvolveItem(ISession session, PokemonId from, PokemonId to)
        {
            var settings = (await session.Inventory.GetPokemonSettings().ConfigureAwait(false)).FirstOrDefault(x => x.PokemonId == from);

            if (settings == null)
            {
                return(ItemId.ItemUnknown);
            }

            var branch = settings.EvolutionBranch.FirstOrDefault(x => x.Evolution == to);

            if (branch == null)
            {
                return(ItemId.ItemUnknown);
            }
            return(branch.EvolutionItemRequirement);
        }
 internal static PokemonAlternativeNames createAllMatches(PokemonId pokemonId, ISet<String> exactMatches, ISet<String> partialMatches)
 {
     return new PokemonAlternativeNames(pokemonId, exactMatches, partialMatches);
 }
Beispiel #46
0
        private IReadOnlyDictionary <string, string> GetProperties(DiscordGuild guild, WhConfig whConfig, string city, string raidImageUrl)
        {
            var pkmnInfo        = MasterFile.GetPokemon(PokemonId, Form);
            var name            = IsEgg ? "Egg" /*TODO: Localize*/ : Translator.Instance.GetPokemonName(PokemonId);
            var form            = Translator.Instance.GetFormName(Form);
            var costume         = Translator.Instance.GetCostumeName(Costume);
            var evo             = Translator.Instance.GetEvolutionName(Evolution);
            var gender          = Gender.GetPokemonGenderIcon();
            var level           = Level;
            var move1           = Translator.Instance.GetMoveName(FastMove);
            var move2           = Translator.Instance.GetMoveName(ChargeMove);
            var types           = pkmnInfo?.Types;
            var type1           = types?[0];
            var type2           = types?.Count > 1 ? types?[1] : PokemonType.None;
            var type1Emoji      = types?[0].GetTypeEmojiIcons();
            var type2Emoji      = pkmnInfo?.Types?.Count > 1 ? types?[1].GetTypeEmojiIcons() : string.Empty;
            var typeEmojis      = $"{type1Emoji} {type2Emoji}";
            var weaknesses      = Weaknesses == null ? string.Empty : string.Join(", ", Weaknesses);
            var weaknessesEmoji = types?.GetWeaknessEmojiIcons();
            var perfectRange    = PokemonId.MaxCpAtLevel(20);
            var boostedRange    = PokemonId.MaxCpAtLevel(25);
            var worstRange      = PokemonId.MinCpAtLevel(20);
            var worstBoosted    = PokemonId.MinCpAtLevel(25);
            var exEmojiId       = MasterFile.Instance.Emojis["ex"];
            var exEmoji         = exEmojiId > 0 ? $"<:ex:{exEmojiId}>" : "EX";
            var teamEmojiId     = MasterFile.Instance.Emojis[Team.ToString().ToLower()];
            var teamEmoji       = teamEmojiId > 0 ? $"<:{Team.ToString().ToLower()}:{teamEmojiId}>" : Team.ToString();

            var gmapsLink               = string.Format(Strings.GoogleMaps, Latitude, Longitude);
            var appleMapsLink           = string.Format(Strings.AppleMaps, Latitude, Longitude);
            var wazeMapsLink            = string.Format(Strings.WazeMaps, Latitude, Longitude);
            var scannerMapsLink         = string.Format(whConfig.Urls.ScannerMap, Latitude, Longitude);
            var staticMapLink           = StaticMap.GetUrl(whConfig.Urls.StaticMap, whConfig.StaticMaps["raids"], Latitude, Longitude, raidImageUrl, Team);
            var gmapsLocationLink       = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, gmapsLink);
            var appleMapsLocationLink   = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, appleMapsLink);
            var wazeMapsLocationLink    = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, wazeMapsLink);
            var scannerMapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, scannerMapsLink);
            var address = new Location(null, city, Latitude, Longitude).GetAddress(whConfig);
            //var staticMapLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? staticMapLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, staticMapLink);

            var now           = DateTime.UtcNow.ConvertTimeFromCoordinates(Latitude, Longitude);
            var startTimeLeft = now.GetTimeRemaining(StartTime).ToReadableStringNoSeconds();
            var endTimeLeft   = now.GetTimeRemaining(EndTime).ToReadableStringNoSeconds();

            const string defaultMissingValue = "?";
            var          dict = new Dictionary <string, string>
            {
                //Raid boss properties
                { "pkmn_id", PokemonId.ToString() },
                { "pkmn_id_3", PokemonId.ToString("D3") },
                { "pkmn_name", name },
                { "pkmn_img_url", raidImageUrl },
                { "evolution", evo },
                { "evolution_id", Convert.ToInt32(Evolution).ToString() },
                { "evolution_id_3", Evolution.ToString("D3") },
                { "form", form },
                { "form_id", Form.ToString() },
                { "form_id_3", Form.ToString("D3") },
                { "costume", costume },
                { "costume_id", Costume.ToString() },
                { "costume_id_3", Costume.ToString("D3") },
                { "is_egg", Convert.ToString(IsEgg) },
                { "is_ex", Convert.ToString(IsExEligible) },
                { "ex_emoji", exEmoji },
                { "team", Team.ToString() },
                { "team_id", Convert.ToInt32(Team).ToString() },
                { "team_emoji", teamEmoji },
                { "cp", CP ?? defaultMissingValue },
                { "lvl", level ?? defaultMissingValue },
                { "gender", gender ?? defaultMissingValue },
                { "move_1", move1 ?? defaultMissingValue },
                { "move_2", move2 ?? defaultMissingValue },
                { "moveset", $"{move1}/{move2}" },
                { "type_1", type1?.ToString() ?? defaultMissingValue },
                { "type_2", type2?.ToString() ?? defaultMissingValue },
                { "type_1_emoji", type1Emoji },
                { "type_2_emoji", type2Emoji },
                { "types", $"{type1}/{type2}" },
                { "types_emoji", typeEmojis },
                { "weaknesses", weaknesses },
                { "weaknesses_emoji", weaknessesEmoji },
                { "perfect_cp", perfectRange.ToString() },
                { "perfect_cp_boosted", boostedRange.ToString() },
                { "worst_cp", worstRange.ToString() },
                { "worst_cp_boosted", worstBoosted.ToString() },

                //Time properties
                { "start_time", StartTime.ToLongTimeString() },
                { "start_time_24h", StartTime.ToString("HH:mm:ss") },
                { "start_time_left", startTimeLeft },
                { "end_time", EndTime.ToLongTimeString() },
                { "end_time_24h", EndTime.ToString("HH:mm:ss") },
                { "end_time_left", endTimeLeft },

                //Location properties
                { "geofence", city ?? defaultMissingValue },
                { "lat", Latitude.ToString() },
                { "lng", Longitude.ToString() },
                { "lat_5", Latitude.ToString("0.00000") },
                { "lng_5", Longitude.ToString("0.00000") },

                //Location links
                { "tilemaps_url", staticMapLink },
                { "gmaps_url", gmapsLocationLink },
                { "applemaps_url", appleMapsLocationLink },
                { "wazemaps_url", wazeMapsLocationLink },
                { "scanmaps_url", scannerMapsLocationLink },

                { "address", address?.Address },

                //Gym properties
                { "gym_id", GymId },
                { "gym_name", GymName },
                { "gym_url", GymUrl },

                // Discord Guild properties
                { "guild_name", guild?.Name },
                { "guild_img_url", guild?.IconUrl },

                { "date_time", DateTime.Now.ToString() },

                //Misc properties
                { "br", "\r\n" }
            };

            return(dict);
        }
 internal static PokemonAlternativeNames createPartialMatches(PokemonId pokemonId, ISet<String> partialMatches)
 {
     return new PokemonAlternativeNames(pokemonId, null, partialMatches);
 }
Beispiel #48
0
        public static BaseStats GetBaseStats(PokemonId id)
        {
            switch ((int)id)
            {
            case 1:
                return(new BaseStats(90, 126, 126));

            case 2:
                return(new BaseStats(120, 156, 158));

            case 3:
                return(new BaseStats(160, 198, 200));

            case 4:
                return(new BaseStats(78, 128, 108));

            case 5:
                return(new BaseStats(116, 160, 140));

            case 6:
                return(new BaseStats(156, 212, 182));

            case 7:
                return(new BaseStats(88, 112, 142));

            case 8:
                return(new BaseStats(118, 144, 176));

            case 9:
                return(new BaseStats(158, 186, 222));

            case 10:
                return(new BaseStats(90, 62, 66));

            case 11:
                return(new BaseStats(100, 56, 86));

            case 12:
                return(new BaseStats(120, 144, 144));

            case 13:
                return(new BaseStats(80, 68, 64));

            case 14:
                return(new BaseStats(90, 62, 82));

            case 15:
                return(new BaseStats(130, 144, 130));

            case 16:
                return(new BaseStats(80, 94, 90));

            case 17:
                return(new BaseStats(126, 126, 122));

            case 18:
                return(new BaseStats(166, 170, 166));

            case 19:
                return(new BaseStats(60, 92, 86));

            case 20:
                return(new BaseStats(110, 146, 150));

            case 21:
                return(new BaseStats(80, 102, 78));

            case 22:
                return(new BaseStats(130, 168, 146));

            case 23:
                return(new BaseStats(70, 112, 112));

            case 24:
                return(new BaseStats(120, 166, 166));

            case 25:
                return(new BaseStats(70, 124, 108));

            case 26:
                return(new BaseStats(120, 200, 154));

            case 27:
                return(new BaseStats(100, 90, 114));

            case 28:
                return(new BaseStats(150, 150, 172));

            case 29:
                return(new BaseStats(110, 100, 104));

            case 30:
                return(new BaseStats(140, 132, 136));

            case 31:
                return(new BaseStats(180, 184, 190));

            case 32:
                return(new BaseStats(92, 110, 94));

            case 33:
                return(new BaseStats(122, 142, 128));

            case 34:
                return(new BaseStats(162, 204, 170));

            case 35:
                return(new BaseStats(140, 116, 124));

            case 36:
                return(new BaseStats(190, 178, 178));

            case 37:
                return(new BaseStats(76, 106, 118));

            case 38:
                return(new BaseStats(146, 176, 194));

            case 39:
                return(new BaseStats(230, 98, 54));

            case 40:
                return(new BaseStats(280, 168, 108));

            case 41:
                return(new BaseStats(80, 88, 90));

            case 42:
                return(new BaseStats(150, 164, 164));

            case 43:
                return(new BaseStats(90, 134, 130));

            case 44:
                return(new BaseStats(120, 162, 158));

            case 45:
                return(new BaseStats(150, 202, 190));

            case 46:
                return(new BaseStats(70, 122, 120));

            case 47:
                return(new BaseStats(120, 162, 170));

            case 48:
                return(new BaseStats(120, 108, 118));

            case 49:
                return(new BaseStats(140, 172, 154));

            case 50:
                return(new BaseStats(20, 108, 86));

            case 51:
                return(new BaseStats(70, 148, 140));

            case 52:
                return(new BaseStats(80, 104, 94));

            case 53:
                return(new BaseStats(130, 156, 146));

            case 54:
                return(new BaseStats(100, 132, 112));

            case 55:
                return(new BaseStats(160, 194, 176));

            case 56:
                return(new BaseStats(80, 122, 96));

            case 57:
                return(new BaseStats(130, 178, 150));

            case 58:
                return(new BaseStats(110, 156, 110));

            case 59:
                return(new BaseStats(180, 230, 180));

            case 60:
                return(new BaseStats(80, 108, 98));

            case 61:
                return(new BaseStats(130, 132, 132));

            case 62:
                return(new BaseStats(180, 180, 202));

            case 63:
                return(new BaseStats(50, 110, 76));

            case 64:
                return(new BaseStats(80, 150, 112));

            case 65:
                return(new BaseStats(110, 186, 152));

            case 66:
                return(new BaseStats(140, 118, 96));

            case 67:
                return(new BaseStats(160, 154, 144));

            case 68:
                return(new BaseStats(180, 198, 180));

            case 69:
                return(new BaseStats(100, 158, 78));

            case 70:
                return(new BaseStats(130, 190, 110));

            case 71:
                return(new BaseStats(160, 222, 152));

            case 72:
                return(new BaseStats(80, 106, 136));

            case 73:
                return(new BaseStats(160, 170, 196));

            case 74:
                return(new BaseStats(80, 106, 118));

            case 75:
                return(new BaseStats(110, 142, 156));

            case 76:
                return(new BaseStats(160, 176, 198));

            case 77:
                return(new BaseStats(100, 168, 138));

            case 78:
                return(new BaseStats(130, 200, 170));

            case 79:
                return(new BaseStats(180, 110, 110));

            case 80:
                return(new BaseStats(190, 184, 198));

            case 81:
                return(new BaseStats(50, 128, 138));

            case 82:
                return(new BaseStats(100, 186, 180));

            case 83:
                return(new BaseStats(104, 138, 132));

            case 84:
                return(new BaseStats(70, 126, 96));

            case 85:
                return(new BaseStats(120, 182, 150));

            case 86:
                return(new BaseStats(130, 104, 138));

            case 87:
                return(new BaseStats(180, 156, 192));

            case 88:
                return(new BaseStats(160, 124, 110));

            case 89:
                return(new BaseStats(210, 180, 188));

            case 90:
                return(new BaseStats(60, 120, 112));

            case 91:
                return(new BaseStats(100, 196, 196));

            case 92:
                return(new BaseStats(60, 136, 82));

            case 93:
                return(new BaseStats(90, 172, 118));

            case 94:
                return(new BaseStats(120, 204, 156));

            case 95:
                return(new BaseStats(70, 90, 186));

            case 96:
                return(new BaseStats(120, 104, 140));

            case 97:
                return(new BaseStats(170, 162, 196));

            case 98:
                return(new BaseStats(60, 116, 110));

            case 99:
                return(new BaseStats(110, 178, 168));

            case 100:
                return(new BaseStats(80, 102, 124));

            case 101:
                return(new BaseStats(120, 150, 174));

            case 102:
                return(new BaseStats(120, 110, 132));

            case 103:
                return(new BaseStats(190, 232, 164));

            case 104:
                return(new BaseStats(100, 102, 150));

            case 105:
                return(new BaseStats(120, 140, 202));

            case 106:
                return(new BaseStats(100, 148, 172));

            case 107:
                return(new BaseStats(100, 138, 204));

            case 108:
                return(new BaseStats(180, 126, 160));

            case 109:
                return(new BaseStats(80, 136, 142));

            case 110:
                return(new BaseStats(130, 190, 198));

            case 111:
                return(new BaseStats(160, 110, 116));

            case 112:
                return(new BaseStats(210, 166, 160));

            case 113:
                return(new BaseStats(500, 40, 60));

            case 114:
                return(new BaseStats(130, 164, 152));

            case 115:
                return(new BaseStats(210, 142, 178));

            case 116:
                return(new BaseStats(60, 122, 100));

            case 117:
                return(new BaseStats(110, 176, 150));

            case 118:
                return(new BaseStats(90, 112, 126));

            case 119:
                return(new BaseStats(160, 172, 160));

            case 120:
                return(new BaseStats(60, 130, 128));

            case 121:
                return(new BaseStats(120, 194, 192));

            case 122:
                return(new BaseStats(80, 154, 196));

            case 123:
                return(new BaseStats(140, 176, 180));

            case 124:
                return(new BaseStats(130, 172, 134));

            case 125:
                return(new BaseStats(130, 198, 160));

            case 126:
                return(new BaseStats(130, 214, 158));

            case 127:
                return(new BaseStats(130, 184, 186));

            case 128:
                return(new BaseStats(150, 148, 184));

            case 129:
                return(new BaseStats(40, 42, 84));

            case 130:
                return(new BaseStats(190, 192, 196));

            case 131:
                return(new BaseStats(260, 186, 190));

            case 132:
                return(new BaseStats(96, 110, 110));

            case 133:
                return(new BaseStats(110, 114, 128));

            case 134:
                return(new BaseStats(260, 186, 168));

            case 135:
                return(new BaseStats(130, 192, 174));

            case 136:
                return(new BaseStats(130, 238, 178));

            case 137:
                return(new BaseStats(130, 156, 158));

            case 138:
                return(new BaseStats(70, 132, 160));

            case 139:
                return(new BaseStats(140, 180, 202));

            case 140:
                return(new BaseStats(60, 148, 142));

            case 141:
                return(new BaseStats(120, 190, 190));

            case 142:
                return(new BaseStats(160, 182, 162));

            case 143:
                return(new BaseStats(320, 180, 180));

            case 144:
                return(new BaseStats(180, 198, 242));

            case 145:
                return(new BaseStats(180, 232, 194));

            case 146:
                return(new BaseStats(180, 242, 194));

            case 147:
                return(new BaseStats(82, 128, 110));

            case 148:
                return(new BaseStats(122, 170, 152));

            case 149:
                return(new BaseStats(182, 250, 212));

            case 150:
                return(new BaseStats(212, 284, 202));

            case 151:
                return(new BaseStats(200, 220, 220));

            default:
                return(new BaseStats());
            }
        }
Beispiel #49
0
 public TransferFilter GetPokemonTransferFilter(PokemonId pokemon)
 {
     if (_logicSettings.PokemonsTransferFilter != null &&
         _logicSettings.PokemonsTransferFilter.ContainsKey(pokemon))
     {
         return _logicSettings.PokemonsTransferFilter[pokemon];
     }
     return new TransferFilter(_logicSettings.KeepMinCp, _logicSettings.KeepMinLvl, _logicSettings.UseKeepMinLvl, _logicSettings.KeepMinIvPercentage,
         _logicSettings.KeepMinOperator, _logicSettings.KeepMinDuplicatePokemon);
 }
 internal static PokemonAlternativeNames CreatePartialMatches(PokemonId pokemonId,
                                                              ISet <string> partialMatches)
 {
     return(new PokemonAlternativeNames(pokemonId, null, partialMatches));
 }
Beispiel #51
0
 public static double CalculateMaxCpMultiplier(PokemonId pokemonId)
 {
     var baseStats = GetBaseStats(pokemonId);
     return (baseStats.BaseAttack + 15)*Math.Sqrt(baseStats.BaseDefense + 15)*
            Math.Sqrt(baseStats.BaseStamina + 15);
 }
 public PokemonFilterModel(PokemonId id, BitmapImage img)
 {
     Image = img;
     Id = id;
 }