当前位置: 首页>>代码示例>>C#>>正文


C# Client.GetMapObjects方法代码示例

本文整理汇总了C#中Client.GetMapObjects方法的典型用法代码示例。如果您正苦于以下问题:C# Client.GetMapObjects方法的具体用法?C# Client.GetMapObjects怎么用?C# Client.GetMapObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Client的用法示例。


在下文中一共展示了Client.GetMapObjects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        static async void Execute()
        {
            var client = new Client(Settings.DefaultLatitude, Settings.DefaultLongitude);

            if (Settings.UsePTC)
            {
                await client.LoginPtc(Settings.PtcUsername, Settings.PtcPassword);
            }
            else
            {
                await client.LoginGoogle(Settings.DeviceId, Settings.Email, Settings.LongDurationToken);
            }
            var serverResponse = await client.GetServer();
            var profile = await client.GetProfile();
            var settings = await client.GetSettings();
            var mapObjects = await client.GetMapObjects();
            var inventory = await client.GetInventory();
            var pokemons = inventory.Payload[0].Bag.Items.Select(i => i.Item?.Pokemon).Where(p => p != null && p?.PokemonId != InventoryResponse.Types.PokemonProto.Types.PokemonIds.PokemonUnset);

            ExecutePrintPokemonPowerQuotient(pokemons);
            //await ExecuteFarmingPokestopsAndPokemons(client);
            //await ExecuteCatchAllNearbyPokemons(client);


        }
开发者ID:CptArcanium,项目名称:Pokemon-Go-Rocket-API,代码行数:25,代码来源:Program.cs

示例2: Execute

        static async void Execute()
        {
            var client = new Client(Settings.DefaultLatitude, Settings.DefaultLongitude);

            //await client.LoginPtc("FeroxRev", "Sekret");
            //await client.LoginGoogle(Settings.DeviceId, Settings.Email, Settings.LongDurationToken);
            await client.LoginGoogle();
            var serverResponse = await client.GetServer();
            var profile = await client.GetProfile();
            var settings = await client.GetSettings();
            var mapObjects = await client.GetMapObjects();
            var inventory = await client.GetInventory();
            await ExecuteFarmingPokestops(client);
            await ExecuteCatchAllNearbyPokemons(client);
        }
开发者ID:Realatis,项目名称:Pokemon-Go-Rocket-API,代码行数:15,代码来源:Program.cs

示例3: ExecuteCatchAllNearbyPokemons

        private static async Task ExecuteCatchAllNearbyPokemons(Client client)
        {
            var mapObjects = await client.GetMapObjects();

            var pokemons = mapObjects.Payload[0].Profile.SelectMany(i => i.MapPokemon);

            foreach (var pokemon in pokemons)
            {
                var update = await client.UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
                var encounterPokemonRespone = await client.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnpointId);
                var caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude);
                await Task.Delay(15000);
            }

        }
开发者ID:Realatis,项目名称:Pokemon-Go-Rocket-API,代码行数:15,代码来源:Program.cs

示例4: ExecuteFarmingPokestops

        private static async Task ExecuteFarmingPokestops(Client client)
        {
            var mapObjects = await client.GetMapObjects();

            var pokeStops = mapObjects.Payload[0].Profile.SelectMany(i => i.Fort).Where(i => i.FortType == (int)MiscEnums.FortType.CHECKPOINT && i.CooldownCompleteMs < DateTime.UtcNow.ToUnixTime());

            foreach (var pokeStop in pokeStops)
            {
                var update = await client.UpdatePlayerLocation(pokeStop.Latitude, pokeStop.Longitude);
                var fortInfo = await client.GetFort(pokeStop.FortId, pokeStop.Latitude, pokeStop.Longitude);
                var fortSearch = await client.SearchFort(pokeStop.FortId, pokeStop.Latitude, pokeStop.Longitude);
                var bag = fortSearch.Payload[0];

                System.Console.WriteLine($"Farmed XP: {bag.XpAwarded}, Gems: { bag.GemsAwarded}, Eggs: {bag.EggPokemon} Items: {GetFriendlyItemsString(bag.Items)}");
                await Task.Delay(15000);
            }
        }
开发者ID:Realatis,项目名称:Pokemon-Go-Rocket-API,代码行数:17,代码来源:Program.cs

示例5: ExecuteFarmingPokestopsAndPokemons

        private async Task ExecuteFarmingPokestopsAndPokemons(Client client)
        {
            var mapObjects = await client.GetMapObjects();

            var pokeStops = mapObjects.MapCells.SelectMany(i => i.Forts).Where(i => i.Type == FortType.Checkpoint && i.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime());

            foreach (var pokeStop in pokeStops)
            {
                var update = await client.UpdatePlayerLocation(pokeStop.Latitude, pokeStop.Longitude);
                var fortInfo = await client.GetFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);
                var fortSearch = await client.SearchFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);

                System.Console.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss")}] Farmed XP: {fortSearch.ExperienceAwarded}, Gems: { fortSearch.GemsAwarded}, Eggs: {fortSearch.PokemonDataEgg} Items: {StringUtils.GetSummedFriendlyNameOfItemAwardList(fortSearch.ItemsAwarded)}");

                await Task.Delay(15000);
                await ExecuteCatchAllNearbyPokemons(client);
            }
        }
开发者ID:CookieNick,项目名称:Pokemon-Go-Rocket-API,代码行数:18,代码来源:Logic.cs

示例6: ExecuteFarmingPokestopsAndPokemons

        private static async Task ExecuteFarmingPokestopsAndPokemons(Client client)
        {
            await Task.Delay(defaultDelay); ColoredConsoleWrite(ConsoleColor.White, $"GetMapObjects (Pokestops)");
            var mapObjects = await client.GetMapObjects();

            var pokeStops = mapObjects.MapCells.SelectMany(i => i.Forts).Where(i => i.Type == FortType.Checkpoint && i.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime());
            ColoredConsoleWrite(ConsoleColor.Red, $"[{DateTime.Now.ToString("HH:mm:ss")}] Number of Pokestop: {pokeStops.Count()}");

            Location startLocation = new Location(client.getCurrentLat(), client.getCurrentLng());
            IList<FortData> query = pokeStops.ToList();
            
            while (query.Count > 10) //Ignore last 10 pokestop, usually far away
            {
                startLocation = new Location(client.getCurrentLat(), client.getCurrentLng());
                query = query.OrderBy(pS => Spheroid.CalculateDistanceBetweenLocations(startLocation, new Location(pS.Latitude, pS.Longitude))).ToList();
                var pokeStop = query.First();
                query.RemoveAt(0);
                Location endLocation = new Location(pokeStop.Latitude, pokeStop.Longitude);
                var distanceToPokestop = Spheroid.CalculateDistanceBetweenLocations(startLocation, endLocation);

                await Task.Delay(defaultDelay); ColoredConsoleWrite(ConsoleColor.White, $"UpdatePlayerLocation");
                var update = await client.UpdatePlayerLocation(endLocation.latitude, endLocation.longitude);
                ColoredConsoleWrite(ConsoleColor.White, $"[{DateTime.Now.ToString("HH:mm:ss")}] Moved {(int)distanceToPokestop}m, wait {25.0 * (int)distanceToPokestop}ms, Number of Pokestop in this zone: {query.Count}");

                int delay = (int)(25.0 * distanceToPokestop);
                if (delay < defaultDelay) delay = defaultDelay;
                await Task.Delay(delay);  ColoredConsoleWrite(ConsoleColor.White, $"fortInfo");


                var fortInfo = await client.GetFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);
                await Task.Delay(defaultDelay); ColoredConsoleWrite(ConsoleColor.White, $"fortSearch");
                var fortSearch = await client.SearchFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);

                StringWriter PokeStopOutput = new StringWriter();
                PokeStopOutput.Write($"[{DateTime.Now.ToString("HH:mm:ss")}] ");
                if (fortInfo.Name != string.Empty)
                    PokeStopOutput.Write(Language.GetPhrases()["pokestop"].Replace("[pokestop]", fortInfo.Name));
                if (fortSearch.ExperienceAwarded != 0)
                    PokeStopOutput.Write($", {Language.GetPhrases()["xp"].Replace("[xp]", Convert.ToString(fortSearch.ExperienceAwarded))}");
                if (fortSearch.GemsAwarded != 0)
                    PokeStopOutput.Write($", {Language.GetPhrases()["gem"].Replace("[gem]", Convert.ToString(fortSearch.GemsAwarded))}");
                if (fortSearch.PokemonDataEgg != null)
                    PokeStopOutput.Write($", {Language.GetPhrases()["egg"].Replace("[egg]", Convert.ToString(fortSearch.PokemonDataEgg))}");
                if (GetFriendlyItemsString(fortSearch.ItemsAwarded) != string.Empty)
                    PokeStopOutput.Write($", {Language.GetPhrases()["item"].Replace("[item]", GetFriendlyItemsString(fortSearch.ItemsAwarded))}");
                ColoredConsoleWrite(ConsoleColor.Cyan, PokeStopOutput.ToString());

                expDone += fortSearch.ExperienceAwarded;
                ColoredConsoleWrite(ConsoleColor.Red, $"Exp/H: {expDone/GetRuntime()}");

                if (fortSearch.ExperienceAwarded != 0)
                    TotalExperience += (fortSearch.ExperienceAwarded);

                await ExecuteCatchAllNearbyPokemons(client);
                
            }
            ColoredConsoleWrite(ConsoleColor.White, $"[{DateTime.Now.ToString("HH:mm:ss")}] Finished pokestop route, reset position and restart.");

        }
开发者ID:ReiPlayGamesPL,项目名称:QuickPokeBot,代码行数:59,代码来源:Program.cs

示例7: ExecuteCatchAllNearbyPokemons

        private static async Task ExecuteCatchAllNearbyPokemons(Client client)
        {
            await Task.Delay(defaultDelay); ColoredConsoleWrite(ConsoleColor.White, $"GetMapObjects (pokemons)");
            var mapObjects = await client.GetMapObjects();

            var pokemons = mapObjects.MapCells.SelectMany(i => i.CatchablePokemons);

            var inventory2 = await client.GetInventory();
            var pokemons2 = inventory2.InventoryDelta.InventoryItems
                .Select(i => i.InventoryItemData?.Pokemon)
                .Where(p => p != null && p?.PokemonId > 0)
                .ToArray();

            foreach (var pokemon in pokemons)
            {
                await Task.Delay(defaultDelay); ColoredConsoleWrite(ConsoleColor.White, $"EncounterPokemon");
                var encounterPokemonResponse = await client.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnpointId);
                
                var pokemonCP = encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp;
                CatchPokemonResponse caughtPokemonResponse;
                do
                {
                    await Task.Delay(defaultDelay); ColoredConsoleWrite(ConsoleColor.White, $"CatchPokemon");
                    caughtPokemonResponse =
                        await
                            client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude,
                                pokemon.Longitude, MiscEnums.Item.ITEM_POKE_BALL, pokemonCP);
                    ;
                    if (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchMissed)
                    {
                        ColoredConsoleWrite(ConsoleColor.White, $"Retry");
                    }
                } while (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchMissed);
                string pokemonName = Language.GetPokemons()[Convert.ToString(pokemon.PokemonId)];

                if (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess)
                {
                    ColoredConsoleWrite(ConsoleColor.Green, $"[{DateTime.Now.ToString("HH:mm:ss")}] {Language.GetPhrases()["caught_pokemon"].Replace("[pokemon]", pokemonName).Replace("[cp]", Convert.ToString(encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp))}");
                    TotalPokemon++;
                    expDone += 210;
                    ColoredConsoleWrite(ConsoleColor.Red, $"Exp/H: {expDone / GetRuntime()}");
                }
                else
                    ColoredConsoleWrite(ConsoleColor.Red, $"[{DateTime.Now.ToString("HH:mm:ss")}] {Language.GetPhrases()["pokemon_got_away"].Replace("[pokemon]", pokemonName).Replace("[cp]", Convert.ToString(encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp))}");

                await Task.Delay(defaultDelay); ColoredConsoleWrite(ConsoleColor.White, $"Transfer");
                await TransferDuplicatePokemon(client);

                
            }
        }
开发者ID:ReiPlayGamesPL,项目名称:QuickPokeBot,代码行数:51,代码来源:Program.cs

示例8: ExecuteCatchAllNearbyPokemons

        private static async Task ExecuteCatchAllNearbyPokemons(Client client)
        {
            var mapObjects = await client.GetMapObjects();

            var pokemons = mapObjects.Payload[0].Profile.SelectMany(i => i.MapPokemon);

            foreach (var pokemon in pokemons)
            {
                var update = await client.UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
                var encounterPokemonRespone = await client.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnpointId);

                CatchPokemonResponse caughtPokemonResponse;
                do
                {
                    caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude);
                } 
                while(caughtPokemonResponse.Payload[0].Status == 2);

                System.Console.WriteLine(caughtPokemonResponse.Payload[0].Status == 1 ? $"We caught a {GetFriendlyPokemonName(pokemon.PokedexTypeId)}" : $"{GetFriendlyPokemonName(pokemon.PokedexTypeId)} got away..");
                await Task.Delay(5000);
            }
        }
开发者ID:CptArcanium,项目名称:Pokemon-Go-Rocket-API,代码行数:22,代码来源:Program.cs

示例9: ExecuteCatchAllNearbyPokemons

        private async Task ExecuteCatchAllNearbyPokemons(Client client)
        {
            var mapObjects = await client.GetMapObjects();

            var pokemons = mapObjects.MapCells.SelectMany(i => i.CatchablePokemons);

            foreach (var pokemon in pokemons)
            {
                var update = await client.UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
                var encounterPokemonResponse = await client.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnpointId);

                CatchPokemonResponse caughtPokemonResponse;
                do
                {
                    caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude, MiscEnums.Item.ITEM_POKE_BALL); //note: reverted from settings because this should not be part of settings but part of logic
                }
                while (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchMissed);

                System.Console.WriteLine(caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess ? $"[{DateTime.Now.ToString("HH:mm:ss")}] We caught a {pokemon.PokemonId} with CP {encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp}" : $"[{DateTime.Now.ToString("HH:mm:ss")}] {pokemon.PokemonId} with CP {encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp} got away..");
                await Task.Delay(5000);
            }
        }
开发者ID:CookieNick,项目名称:Pokemon-Go-Rocket-API,代码行数:22,代码来源:Logic.cs

示例10: ExecuteFarmingPokestopsAndPokemons

        private async Task ExecuteFarmingPokestopsAndPokemons(Client client)
        {
            var mapObjects = await client.GetMapObjects();

            FortData[] rawPokeStops = mapObjects.MapCells.SelectMany(i => i.Forts).Where(i => i.Type == FortType.Checkpoint && i.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime()).ToArray();
            pokeStops = PokeStopOptimizer.Optimize(rawPokeStops, ClientSettings.DefaultLatitude, ClientSettings.DefaultLongitude, pokestopsOverlay);
            wildPokemons = mapObjects.MapCells.SelectMany(i => i.WildPokemons);
            if (!ForceUnbanning && !Stopping)
                ColoredConsoleWrite(Color.Cyan, string.Format(Properties.Strings.visiting_pokestops, pokeStops.Count()));

            UpdateMap();

            foreach (var pokeStop in pokeStops)
            {
                if (ForceUnbanning || Stopping)
                    break;

                FarmingStops = true;
                await locationManager.update(pokeStop.Latitude, pokeStop.Longitude);
                UpdatePlayerLocation(pokeStop.Latitude, pokeStop.Longitude);
                UpdateMap();

                var fortInfo = await client.GetFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);
                var fortSearch = await client.SearchFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);
                StringWriter PokeStopOutput = new StringWriter();
                PokeStopOutput.Write($"");
                if (fortInfo.Name != string.Empty)
                    PokeStopOutput.Write(Properties.Strings.pokestop + fortInfo.Name);
                if (fortSearch.ExperienceAwarded != 0)
                    PokeStopOutput.Write(string.Format(Properties.Strings.xp, fortSearch.ExperienceAwarded));
                if (fortSearch.GemsAwarded != 0)
                    PokeStopOutput.Write(string.Format(Properties.Strings.gems, fortSearch.GemsAwarded));
                if (fortSearch.PokemonDataEgg != null)
                    PokeStopOutput.Write(string.Format(Properties.Strings.eggs, fortSearch.PokemonDataEgg));
                if (GetFriendlyItemsString(fortSearch.ItemsAwarded) != string.Empty)
                    PokeStopOutput.Write(string.Format(Properties.Strings.items, GetFriendlyItemsString(fortSearch.ItemsAwarded)));
                ColoredConsoleWrite(Color.Cyan, PokeStopOutput.ToString());

                if (fortSearch.ExperienceAwarded != 0)
                    TotalExperience += (fortSearch.ExperienceAwarded);

                pokeStop.CooldownCompleteTimestampMs = DateTime.UtcNow.ToUnixTime() + 300000;

                if (ClientSettings.CatchPokemon)
                    await ExecuteCatchAllNearbyPokemons(client);
            }
            FarmingStops = false;
            if (!ForceUnbanning && !Stopping)
            {
                client.RecycleItems(client);
                await ExecuteFarmingPokestopsAndPokemons(client);
            }
        }
开发者ID:Zayceur,项目名称:Pokemon-Go-Rocket-API-MULTILANG,代码行数:53,代码来源:MainForm.cs

示例11: ExecuteCatchAllNearbyPokemons

        private static async Task ExecuteCatchAllNearbyPokemons(Client client)
        {
            var mapObjects = await client.GetMapObjects();

            var pokemons = mapObjects.MapCells.SelectMany(i => i.CatchablePokemons);

            var inventory2 = await client.GetInventory();
            var pokemons2 = inventory2.InventoryDelta.InventoryItems
                .Select(i => i.InventoryItemData?.Pokemon)
                .Where(p => p != null && p?.PokemonId > 0)
                .ToArray();

            foreach (var pokemon in pokemons)
            {
                var update = await client.UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
                var encounterPokemonResponse = await client.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnpointId);
                var pokemonCP = encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp;
                var pokemonIV = Perfect(encounterPokemonResponse?.WildPokemon?.PokemonData);
                CatchPokemonResponse caughtPokemonResponse;
                do
                {
                    if (ClientSettings.RazzBerryMode == "cp")
                        if (pokemonCP > ClientSettings.RazzBerrySetting)
                            await client.UseRazzBerry(client, pokemon.EncounterId, pokemon.SpawnpointId);
                    if (ClientSettings.RazzBerryMode == "probability")
                        if (encounterPokemonResponse.CaptureProbability.CaptureProbability_.First() < ClientSettings.RazzBerrySetting)
                            await client.UseRazzBerry(client, pokemon.EncounterId, pokemon.SpawnpointId);
                    caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude, MiscEnums.Item.ITEM_POKE_BALL, pokemonCP); ; //note: reverted from settings because this should not be part of settings but part of logic
                } while (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchMissed || caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchEscape);

                string pokemonName;
                if (ClientSettings.Language == "german")
                {
                    string name_english = Convert.ToString(pokemon.PokemonId);
                    var request = (HttpWebRequest)WebRequest.Create("http://boosting-service.de/pokemon/index.php?pokeName=" + name_english);
                    var response = (HttpWebResponse)request.GetResponse();
                    pokemonName = new StreamReader(response.GetResponseStream()).ReadToEnd();
                }
                else
                    pokemonName = Convert.ToString(pokemon.PokemonId);

                if (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess)
                {
                    ColoredConsoleWrite(ConsoleColor.Green, $"We caught a {pokemonName} with {pokemonCP} CP and {pokemonIV}% IV");
                    foreach (int xp in caughtPokemonResponse.Scores.Xp)
                        TotalExperience += xp;
                    TotalPokemon += 1;
                }
                else
                    ColoredConsoleWrite(ConsoleColor.Red, $"{pokemonName} with {pokemonCP} CP and {pokemonIV}% IV");

                if (ClientSettings.TransferType == "leaveStrongest")
                    await TransferAllButStrongestUnwantedPokemon(client);
                else if (ClientSettings.TransferType == "all")
                    await TransferAllGivenPokemons(client, pokemons2);
                else if (ClientSettings.TransferType == "duplicate")
                    await TransferDuplicatePokemon(client);
                else if (ClientSettings.TransferType == "cp")
                    await TransferAllWeakPokemon(client, ClientSettings.TransferCPThreshold);
                else if (ClientSettings.TransferType == "iv")
                    await TransferAllGivenPokemons(client, pokemons2, ClientSettings.TransferIVThreshold);

                await Task.Delay(3000);
            }
        }
开发者ID:ChiDragon,项目名称:Pokemon-Go-Rocket-API,代码行数:65,代码来源:Program.cs

示例12: ExecuteFarmingPokestopsAndPokemons

        private static async Task ExecuteFarmingPokestopsAndPokemons(Client client)
        {
            var mapObjects = await client.GetMapObjects();

            var pokeStops = mapObjects.MapCells.SelectMany(i => i.Forts).Where(i => i.Type == FortType.Checkpoint && i.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime());

            foreach (var pokeStop in pokeStops)
            {
                var update = await client.UpdatePlayerLocation(pokeStop.Latitude, pokeStop.Longitude);
                var fortInfo = await client.GetFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);
                var fortSearch = await client.SearchFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);

                StringWriter PokeStopOutput = new StringWriter();
                PokeStopOutput.Write($"[{DateTime.Now.ToString("HH:mm:ss")}] ");
                if (fortInfo.Name != Empty)
                    PokeStopOutput.Write(Language.GetPhrases()["pokestop"].Replace("[pokestop]", fortInfo.Name));
                if (fortSearch.ExperienceAwarded != 0)
                    PokeStopOutput.Write($", {Language.GetPhrases()["xp"].Replace("[xp]", Convert.ToString(fortSearch.ExperienceAwarded))}");
                if (fortSearch.GemsAwarded != 0)
                    PokeStopOutput.Write($", {Language.GetPhrases()["gem"].Replace("[gem]", Convert.ToString(fortSearch.GemsAwarded))}");
                if (fortSearch.PokemonDataEgg != null)
                    PokeStopOutput.Write($", {Language.GetPhrases()["egg"].Replace("[egg]", Convert.ToString(fortSearch.PokemonDataEgg))}");
                if (GetFriendlyItemsString(fortSearch.ItemsAwarded) != Empty)
                    PokeStopOutput.Write($", {Language.GetPhrases()["item"].Replace("[item]", GetFriendlyItemsString(fortSearch.ItemsAwarded))}");
                ColoredConsoleWrite(ConsoleColor.Cyan, PokeStopOutput.ToString());

                if (fortSearch.ExperienceAwarded != 0)
                    _totalExperience += (fortSearch.ExperienceAwarded);
                await Task.Delay(15000);
                await ExecuteCatchAllNearbyPokemons(client);
            }
        }
开发者ID:XibalbaTM,项目名称:PokeBot2,代码行数:32,代码来源:Program.cs

示例13: ExecuteCatchAllNearbyPokemons

        private async Task ExecuteCatchAllNearbyPokemons(Client client)
        {
            var mapObjects = await client.GetMapObjects();

            var pokemons = mapObjects.MapCells.SelectMany(i => i.CatchablePokemons);
            var inventory2 = await client.GetInventory();
            var pokemons2 = inventory2.InventoryDelta.InventoryItems
                .Select(i => i.InventoryItemData?.Pokemon)
                .Where(p => p != null && p?.PokemonId > 0)
                .ToArray();

            foreach (var pokemon in pokemons)
            {
                if (ForceUnbanning || Stopping)
                    break;

                FarmingPokemons = true;

                await locationManager.update(pokemon.Latitude, pokemon.Longitude);

                string pokemonName;
                if (ClientSettings.Language == "german")
                {
                    string name_english = Convert.ToString(pokemon.PokemonId);
                    var request = (HttpWebRequest)WebRequest.Create("http://boosting-service.de/pokemon/index.php?pokeName=" + name_english);
                    var response = (HttpWebResponse)request.GetResponse();
                    pokemonName = new StreamReader(response.GetResponseStream()).ReadToEnd();
                }
                else
                    pokemonName = Convert.ToString(pokemon.PokemonId);

                await client.UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
                UpdatePlayerLocation(pokemon.Latitude, pokemon.Longitude);
                UpdateMap();
                var encounterPokemonResponse = await client.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnpointId);
                var pokemonCP = encounterPokemonResponse?.WildPokemon?.PokemonData?.Cp;
                var pokemonIV = Math.Round(Perfect(encounterPokemonResponse?.WildPokemon?.PokemonData));
                CatchPokemonResponse caughtPokemonResponse;
                ColoredConsoleWrite(Color.Green, $"Encounter a {pokemonName} with {pokemonCP} CP and {pokemonIV}% IV");
                do
                {
                    if (ClientSettings.RazzBerryMode == "cp")
                        if (pokemonCP > ClientSettings.RazzBerrySetting)
                            await client.UseRazzBerry(client, pokemon.EncounterId, pokemon.SpawnpointId);
                    if (ClientSettings.RazzBerryMode == "probability")
                        if (encounterPokemonResponse.CaptureProbability.CaptureProbability_.First() < ClientSettings.RazzBerrySetting)
                            await client.UseRazzBerry(client, pokemon.EncounterId, pokemon.SpawnpointId);
                    caughtPokemonResponse = await client.CatchPokemon(pokemon.EncounterId, pokemon.SpawnpointId, pokemon.Latitude, pokemon.Longitude, MiscEnums.Item.ITEM_POKE_BALL, pokemonCP); ; //note: reverted from settings because this should not be part of settings but part of logic
                } while (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchMissed || caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchEscape);

                if (caughtPokemonResponse.Status == CatchPokemonResponse.Types.CatchStatus.CatchSuccess)
                {
                    Color c = Color.LimeGreen;
                    if (pokemonIV >= 80)
                    {
                        c = Color.Yellow;
                    }
                    ColoredConsoleWrite(c, $"We caught a {pokemonName} with {pokemonCP} CP and {pokemonIV}% IV");
                    foreach (int xp in caughtPokemonResponse.Scores.Xp)
                        TotalExperience += xp;
                    TotalPokemon += 1;
                }
                else
                    ColoredConsoleWrite(Color.Red, $"{pokemonName} with {pokemonCP} CP and {pokemonIV}% IV got away..");


                // I believe a switch is more efficient and easier to read.
                switch (ClientSettings.TransferType)
                {
                    case "Leave Strongest":
                        await TransferAllButStrongestUnwantedPokemon(client);
                        break;
                    case "All":
                        await TransferAllGivenPokemons(client, pokemons2);
                        break;
                    case "CP Duplicate":
                        await TransferDuplicatePokemon(client);
                        break;
                    case "IV Duplicate":
                        await TransferDuplicateIVPokemon(client);
                        break;
                    case "CP/IV Duplicate":
                        await TransferDuplicateCPIVPokemon(client);
                        break;
                    case "CP":
                        await TransferAllWeakPokemon(client, ClientSettings.TransferCPThreshold);
                        break;
                    case "IV":
                        await TransferAllGivenPokemons(client, pokemons2, ClientSettings.TransferIVThreshold);
                        break;
                    default:
                        ColoredConsoleWrite(Color.DarkGray, "Transfering pokemon disabled");
                        break;
                }

                FarmingPokemons = false;
                await Task.Delay(3000);
            }
            pokemons = null;
        }
开发者ID:CaptDreamer,项目名称:Pokemon-Go-Rocket-API,代码行数:100,代码来源:MainForm.cs

示例14: Execute

        private async void Execute()
        {
            client = new Client(ClientSettings);
            this.locationManager = new LocationManager(client, ClientSettings.TravelSpeed);
            try
            {
                switch (ClientSettings.AuthType)
                {
                    case AuthType.Ptc:
                        ColoredConsoleWrite(Color.Green, Properties.Strings.login_type_PTC);
                        break;
                    case AuthType.Google:
                        ColoredConsoleWrite(Color.Green, Properties.Strings.login_type_Google);
                        break;
                }

                await client.Login();
                await client.SetServer();
                var profile = await client.GetProfile();
                var settings = await client.GetSettings();
                var mapObjects = await client.GetMapObjects();
                var inventory = await client.GetInventory();
                var pokemons =
                    inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.Pokemon)
                        .Where(p => p != null && p?.PokemonId > 0);

                updateUserStatusBar(client);

                // Write the players ingame details
                ColoredConsoleWrite(Color.Yellow, "----------------------------");
                /*// dont actually want to display info but keeping here incase people want to \O_O/
                 * if (ClientSettings.AuthType == AuthType.Ptc)
                {
                    ColoredConsoleWrite(Color.Cyan, string.Format(Properties.Strings.account, ClientSettings.PtcUsername));
                    ColoredConsoleWrite(Color.Cyan, string.Format(Properties.Strings.password, ClientSettings.PtcPassword));
                }
                else
                {
                    ColoredConsoleWrite(Color.DarkGray, string.Format(Properties.Strings.name, profile.Profile.Username));
                    ColoredConsoleWrite(Color.DarkGray, string.Format(Properties.Strings.team, profile.Profile.Team));
                }*/
                string lat2 = System.Convert.ToString(ClientSettings.DefaultLatitude);
                string longit2 = System.Convert.ToString(ClientSettings.DefaultLongitude);
                ColoredConsoleWrite(Color.DarkGray, string.Format(Properties.Strings.name, profile.Profile.Username));
                ColoredConsoleWrite(Color.DarkGray, string.Format(Properties.Strings.team, profile.Profile.Team));
                if (profile.Profile.Currency.ToArray()[0].Amount > 0) // If player has any pokecoins it will show how many they have.
                    ColoredConsoleWrite(Color.DarkGray, string.Format(Properties.Strings.pokecoin, profile.Profile.Currency.ToArray()[0].Amount));
                ColoredConsoleWrite(Color.DarkGray, string.Format(Properties.Strings.stardust, profile.Profile.Currency.ToArray()[1].Amount));
                ColoredConsoleWrite(Color.DarkGray, string.Format(Properties.Strings.latitude, ClientSettings.DefaultLatitude));
                ColoredConsoleWrite(Color.DarkGray, string.Format(Properties.Strings.longitude, ClientSettings.DefaultLongitude));
                try
                {
                    ColoredConsoleWrite(Color.DarkGray, string.Format(Properties.Strings.country, CallAPI("country", lat2.Replace(',', '.'), longit2.Replace(',', '.'))));
                    ColoredConsoleWrite(Color.DarkGray, string.Format(Properties.Strings.area, CallAPI("place", lat2.Replace(',', '.'), longit2.Replace(',', '.'))));
                }
                catch (Exception)
                {
                    ColoredConsoleWrite(Color.DarkGray, Properties.Strings.error_country);
                }


                ColoredConsoleWrite(Color.Yellow, "----------------------------");

                //Choosing if else, because switch case handle only constant values
                if(ClientSettings.TransferType == Properties.Strings.TransferType_Strongest)
                    await TransferAllButStrongestUnwantedPokemon(client);
                else if(ClientSettings.TransferType == Properties.Strings.TransferType_All)
                    await TransferAllGivenPokemons(client, pokemons);
                else if(ClientSettings.TransferType == Properties.Strings.TransferType_Duplicate)
                    await TransferDuplicatePokemon(client);
                else if(ClientSettings.TransferType == Properties.Strings.TransferType_IV_Duplicate)
                    await TransferDuplicateIVPokemon(client);
                else if(ClientSettings.TransferType == Properties.Strings.TransferType_CP)
                    await TransferAllWeakPokemon(client, ClientSettings.TransferCPThreshold);
                else if(ClientSettings.TransferType == Properties.Strings.TransferType_IV)
                    await TransferAllGivenPokemons(client, pokemons, ClientSettings.TransferIVThreshold);
                else
                    ColoredConsoleWrite(Color.DarkGray, Properties.Strings.transfering_disabled);


                if (ClientSettings.EvolveAllGivenPokemons)
                    await EvolveAllGivenPokemons(client, pokemons);
                if (ClientSettings.Recycler)
                    client.RecycleItems(client);

                await Task.Delay(5000);
                PrintLevel(client);
                await ExecuteFarmingPokestopsAndPokemons(client);

                while (ForceUnbanning)
                    await Task.Delay(25);

                // await ForceUnban(client);

                if (!Stopping)
                {
                    ColoredConsoleWrite(Color.Red, Properties.Strings.no_location);
                    await Task.Delay(10000);
                    CheckVersion();
                    Execute();
//.........这里部分代码省略.........
开发者ID:Zayceur,项目名称:Pokemon-Go-Rocket-API-MULTILANG,代码行数:101,代码来源:MainForm.cs

示例15: Execute

        private static async void Execute()
        {
            ColoredConsoleWrite(ConsoleColor.Green, $"QuickPokeBOT 1.2 - Fast exp bot");
            ColoredConsoleWrite(ConsoleColor.Red, $"This bot will transfer duplicate pokemons (keeping the highest cp one).");
            ColoredConsoleWrite(ConsoleColor.White, $"Before Starting check external.config file.");
            ColoredConsoleWrite(ConsoleColor.White, $"Increase/adjust requestDelay.");
            ColoredConsoleWrite(ConsoleColor.White, $"Check Credentials settings and mode [Google/Ptc].");
            ColoredConsoleWrite(ConsoleColor.White, $"Adjust item recycle settings.");
            ColoredConsoleWrite(ConsoleColor.White, $"This bot will not evolve anything.");            
            ColoredConsoleWrite(ConsoleColor.White, $"This bot will automatically wait for softban to finish.");
            ColoredConsoleWrite(ConsoleColor.White, $"");
            ColoredConsoleWrite(ConsoleColor.Green, $"This bot will start in 5 seconds...");
            ColoredConsoleWrite(ConsoleColor.White, $"");
            await Task.Delay(5000);
            var client = new Client(ClientSettings);
            try
            {
                defaultDelay = Int32.Parse(ClientSettings.requestsDelay);
                Client.requestDelay = defaultDelay;
                await Task.Delay(defaultDelay);
                if (ClientSettings.AuthType == AuthType.Ptc)
                    await client.DoPtcLogin(ClientSettings.PtcUsername, ClientSettings.PtcPassword);
                else if (ClientSettings.AuthType == AuthType.Google)
                    await client.DoGoogleLogin(ClientSettings.GoogleEmail, ClientSettings.GooglePassword);


                await Task.Delay(defaultDelay); //ColoredConsoleWrite(ConsoleColor.White, $"SetServer");
                await client.SetServer();
                await Task.Delay(defaultDelay); //ColoredConsoleWrite(ConsoleColor.White, $"GetProfile");
                var profile = await client.GetProfile();
                userName = profile.Profile.Username;
                await Task.Delay(defaultDelay); //ColoredConsoleWrite(ConsoleColor.White, $"GetSettings");
                var settings = await client.GetSettings();
                await Task.Delay(defaultDelay); //ColoredConsoleWrite(ConsoleColor.White, $"GetMapObjects");
                var mapObjects = await client.GetMapObjects();
                await Task.Delay(defaultDelay); //ColoredConsoleWrite(ConsoleColor.White, $"GetInventory");
                var inventory = await client.GetInventory();
                var pokemons = inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.Pokemon).Where(p => p != null && p?.PokemonId > 0);
                
                await Task.Delay(defaultDelay); //ColoredConsoleWrite(ConsoleColor.White, $"Transfer PK");
                await TransferDuplicatePokemon(client);

                //ColoredConsoleWrite(ConsoleColor.Red, "Recycling Items");
                await Task.Delay(defaultDelay); //ColoredConsoleWrite(ConsoleColor.White, $"client.RecycleItems(client)");
                await client.RecycleItems(client);


                //ColoredConsoleWrite(ConsoleColor.Red, "ExecuteFarmingPokestopsAndPokemons");
                await ExecuteFarmingPokestopsAndPokemons(client);

                ColoredConsoleWrite(ConsoleColor.Red, $"Finished Farming this zone. Wait 15 seconds then restart.");
                await Task.Delay(15000);
                Execute();
            }
            catch (TaskCanceledException tce) { ColoredConsoleWrite(ConsoleColor.White, $"[{DateTime.Now.ToString("HH:mm:ss")}] {Language.GetPhrases()["task_canceled_ex"]}"); Execute(); }
            catch (UriFormatException ufe) { ColoredConsoleWrite(ConsoleColor.White, $"[{DateTime.Now.ToString("HH:mm:ss")}] {Language.GetPhrases()["sys_uri_format_ex"]}"); Execute(); }
            catch (ArgumentOutOfRangeException aore) { ColoredConsoleWrite(ConsoleColor.White, $"[{DateTime.Now.ToString("HH:mm:ss")}] {Language.GetPhrases()["arg_out_of_range_ex"]}"); Execute(); }
            catch (ArgumentNullException ane) { ColoredConsoleWrite(ConsoleColor.White, $"[{DateTime.Now.ToString("HH:mm:ss")}] {Language.GetPhrases()["arg_null_ref"]}"); Execute(); }
        }
开发者ID:Zvonja,项目名称:QuickPokeBot,代码行数:59,代码来源:Program.cs


注:本文中的Client.GetMapObjects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。