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


C# Client.RecycleItems方法代码示例

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


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

示例1: ExecuteFarmingPokestopsAndPokemons

        private async Task ExecuteFarmingPokestopsAndPokemons(Client client, IEnumerable<FortData> pokeStops = null)
        {
            var mapObjects = await client.GetMapObjects();
            if (pokeStops == null)
            {
                pokeStops = mapObjects.MapCells.SelectMany(i => i.Forts).Where(i => i.Type == FortType.Checkpoint && i.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime());
            }
            HashSet<FortData> pokeStopSet = new HashSet<FortData>(pokeStops);
            IEnumerable<FortData> nextPokeStopList = null;
            ColoredConsoleWrite(Color.Cyan, $"Visiting {pokeStops.Count()} PokeStops");
            foreach (var pokeStop in pokeStops)
            {
                double pokeStopDistance = locationManager.getDistance(pokeStop.Latitude, pokeStop.Longitude);
                await locationManager.update(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($"");
                if (fortInfo.Name != string.Empty)
                    PokeStopOutput.Write("PokeStop: " + fortInfo.Name);
                if (fortSearch.ExperienceAwarded != 0)
                    PokeStopOutput.Write($", XP: {fortSearch.ExperienceAwarded}");
                if (fortSearch.GemsAwarded != 0)
                    PokeStopOutput.Write($", Gems: {fortSearch.GemsAwarded}");
                if (fortSearch.PokemonDataEgg != null)
                    PokeStopOutput.Write($", Eggs: {fortSearch.PokemonDataEgg}");
                if (GetFriendlyItemsString(fortSearch.ItemsAwarded) != string.Empty)
                    PokeStopOutput.Write($", Items: {GetFriendlyItemsString(fortSearch.ItemsAwarded)} ");
                ColoredConsoleWrite(Color.Cyan, PokeStopOutput.ToString());

                if (fortSearch.ExperienceAwarded != 0)
                    TotalExperience += (fortSearch.ExperienceAwarded);
                var pokeStopMapObjects = await client.GetMapObjects();

                /* Gets all pokeStops near this pokeStop which are not in the set of pokeStops being currently
                 * traversed and which are ready to be farmed again.  */
                var pokeStopsNearPokeStop = pokeStopMapObjects.MapCells.SelectMany(i => i.Forts).Where(i =>
                    i.Type == FortType.Checkpoint
                    && i.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime()
                    && !pokeStopSet.Contains(i)
                    );

                /* We choose the longest list of farmable PokeStops to traverse next, though we could use a different
                 * criterion, such as the number of PokeStops with lures in the list.*/
                if (pokeStopsNearPokeStop.Count() > (nextPokeStopList == null ? 0 : nextPokeStopList.Count()))
                {
                    nextPokeStopList = pokeStopsNearPokeStop;
                }
                await ExecuteCatchAllNearbyPokemons(client);
            }
            if (nextPokeStopList != null)
            {
                client.RecycleItems(client);
                await ExecuteFarmingPokestopsAndPokemons(client, nextPokeStopList);
            }
        }
开发者ID:ChiDragon,项目名称:Pokemon-Go-Rocket-API,代码行数:57,代码来源:MainForm.cs

示例2: Execute

        private static async void Execute()
        {
            var client = new Client(ClientSettings);
            try
            {
                switch (ClientSettings.AuthType)
                {
                    case AuthType.Ptc:
                        await client.DoPtcLogin(ClientSettings.PtcUsername, ClientSettings.PtcPassword);
                        break;
                    case AuthType.Google:
                        await client.DoGoogleLogin();
                        break;
                }

                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);

                ConsoleLevelTitle(profile.Profile.Username, client);

                // Write the players ingame details
                ColoredConsoleWrite(ConsoleColor.Yellow, "----------------------------");
                if (ClientSettings.AuthType == AuthType.Ptc)
                {
                    ColoredConsoleWrite(ConsoleColor.Cyan, "Account: " + ClientSettings.PtcUsername);
                    ColoredConsoleWrite(ConsoleColor.Cyan, "Password: " + ClientSettings.PtcPassword + "\n");
                }
                ColoredConsoleWrite(ConsoleColor.DarkGray, "Name: " + profile.Profile.Username);
                ColoredConsoleWrite(ConsoleColor.DarkGray, "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(ConsoleColor.DarkGray, "Pokecoins: " + profile.Profile.Currency.ToArray()[0].Amount);
                ColoredConsoleWrite(ConsoleColor.DarkGray, "Stardust: " + profile.Profile.Currency.ToArray()[1].Amount + "\n");
                ColoredConsoleWrite(ConsoleColor.DarkGray, "Latitude: " + ClientSettings.DefaultLatitude);
                ColoredConsoleWrite(ConsoleColor.DarkGray, "Longitude: " + ClientSettings.DefaultLongitude);
                try
                {
                    ColoredConsoleWrite(ConsoleColor.DarkGray, "Area: " + CallAPI("place", ClientSettings.DefaultLatitude, ClientSettings.DefaultLongitude));
                    ColoredConsoleWrite(ConsoleColor.DarkGray, "Country: " + CallAPI("country", ClientSettings.DefaultLatitude, ClientSettings.DefaultLongitude));
                }
                catch (Exception)
                {
                    ColoredConsoleWrite(ConsoleColor.DarkGray,  "Unable to get Country/Place");
                }

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

                // I believe a switch is more efficient and easier to read.
                switch (ClientSettings.TransferType)
                {
                    case "leaveStrongest":
                        await TransferAllButStrongestUnwantedPokemon(client);
                        break;
                    case "all":
                        await TransferAllGivenPokemons(client, pokemons);
                        break;
                    case "duplicate":
                        await TransferDuplicatePokemon(client);
                        break;
                    case "cp":
                        await TransferAllWeakPokemon(client, ClientSettings.TransferCPThreshold);
                        break;
                    case "iv":
                        await TransferAllGivenPokemons(client, pokemons, ClientSettings.TransferIVThreshold);
                        break;
                    default:
                        ColoredConsoleWrite(ConsoleColor.DarkGray, "Transfering pokemon disabled");
                        break;
                }

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

                await Task.Delay(5000);
                PrintLevel(client);
                await ExecuteFarmingPokestopsAndPokemons(client);
                ColoredConsoleWrite(ConsoleColor.Red, $"No nearby useful locations found. Please wait 10 seconds.");
                await Task.Delay(10000);
                CheckVersion();
                Execute();
            }
            catch (TaskCanceledException) { ColoredConsoleWrite(ConsoleColor.Red, "Task Canceled Exception - Restarting"); Execute(); }
            catch (UriFormatException) { ColoredConsoleWrite(ConsoleColor.Red, "System URI Format Exception - Restarting"); Execute(); }
            catch (ArgumentOutOfRangeException) { ColoredConsoleWrite(ConsoleColor.Red, "ArgumentOutOfRangeException - Restarting"); Execute(); }
            catch (ArgumentNullException) { ColoredConsoleWrite(ConsoleColor.Red, "Argument Null Refference - Restarting"); Execute(); }
            catch (NullReferenceException) { ColoredConsoleWrite(ConsoleColor.Red, "Null Refference - Restarting"); Execute(); }
            catch (Exception ex) { ColoredConsoleWrite(ConsoleColor.Red, ex.ToString()); Execute(); }
        }
开发者ID:ChiDragon,项目名称:Pokemon-Go-Rocket-API,代码行数:95,代码来源:Program.cs

示例3: 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, "Login Type: Pokemon Trainers Club");
                        break;
                    case AuthType.Google:
                        ColoredConsoleWrite(Color.Green, "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, "Account: " + ClientSettings.PtcUsername);
                    ColoredConsoleWrite(Color.Cyan, "Password: " + ClientSettings.PtcPassword + "\n");
                }
                else
                {
                    ColoredConsoleWrite(Color.Cyan, "Email: " + ClientSettings.Email);
                    ColoredConsoleWrite(Color.Cyan, "Password: " + ClientSettings.Password + "\n");
                }*/
                string lat2 = System.Convert.ToString(ClientSettings.DefaultLatitude);
                string longit2 = System.Convert.ToString(ClientSettings.DefaultLongitude);
                ColoredConsoleWrite(Color.DarkGray, "Name: " + profile.Profile.Username);
                ColoredConsoleWrite(Color.DarkGray, "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, "Pokecoins: " + profile.Profile.Currency.ToArray()[0].Amount);
                ColoredConsoleWrite(Color.DarkGray, "Stardust: " + profile.Profile.Currency.ToArray()[1].Amount + "\n");
                ColoredConsoleWrite(Color.DarkGray, "Latitude: " + ClientSettings.DefaultLatitude);
                ColoredConsoleWrite(Color.DarkGray, "Longitude: " + ClientSettings.DefaultLongitude);
                try
                {
                    ColoredConsoleWrite(Color.DarkGray, "Country: " + CallAPI("country", lat2.Replace(',', '.'), longit2.Replace(',', '.')));
                    ColoredConsoleWrite(Color.DarkGray, "Area: " + CallAPI("place", lat2.Replace(',', '.'), longit2.Replace(',', '.')));
                }
                catch (Exception)
                {
                    ColoredConsoleWrite(Color.DarkGray, "Unable to get Country/Place");
                }


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

                // 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, pokemons);
                        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, pokemons, ClientSettings.TransferIVThreshold);
                        break;
                    default:
                        ColoredConsoleWrite(Color.DarkGray, "Transfering pokemon disabled");
                        break;
                }


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

                await Task.Delay(5000);
                PrintLevel(client);
//.........这里部分代码省略.........
开发者ID:CaptDreamer,项目名称:Pokemon-Go-Rocket-API,代码行数:101,代码来源:MainForm.cs

示例4: 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();
            if (rawPokeStops == null || rawPokeStops.Count() <= 0)
            {
                ColoredConsoleWrite(Color.Red, $"No PokeStops to visit here, please stop the bot and change your location.");
                return;
            }
            pokeStops = rawPokeStops;
            UpdateMap();
            ColoredConsoleWrite(Color.Cyan, $"Finding fastest route through all PokeStops..");
            LatLong startingLatLong = new LatLong(ClientSettings.DefaultLatitude, ClientSettings.DefaultLongitude);
            pokeStops = RouteOptimizer.Optimize(rawPokeStops, startingLatLong, pokestopsOverlay);
            wildPokemons = mapObjects.MapCells.SelectMany(i => i.WildPokemons);
            if (!ForceUnbanning && !Stopping)
                ColoredConsoleWrite(Color.Cyan, $"Visiting {pokeStops.Count()} PokeStops");

            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("PokeStop: " + fortInfo.Name);
                if (fortSearch.ExperienceAwarded != 0)
                    PokeStopOutput.Write($", XP: {fortSearch.ExperienceAwarded}");
                if (fortSearch.GemsAwarded != 0)
                    PokeStopOutput.Write($", Gems: {fortSearch.GemsAwarded}");
                if (fortSearch.PokemonDataEgg != null)
                    PokeStopOutput.Write($", Eggs: {fortSearch.PokemonDataEgg}");
                if (GetFriendlyItemsString(fortSearch.ItemsAwarded) != string.Empty)
                    PokeStopOutput.Write($", 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:CaptDreamer,项目名称:Pokemon-Go-Rocket-API,代码行数:61,代码来源:MainForm.cs

示例5: Execute

        private static async void Execute()
        {
            var client = new Client(ClientSettings);
            try
            {
                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();
                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, $"[{DateTime.Now.ToString("HH:mm:ss")}] {Language.GetPhrases()["no_nearby_loc_found"]}");
                await Task.Delay(2000);
                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:ReiPlayGamesPL,项目名称:QuickPokeBot,代码行数:43,代码来源:Program.cs

示例6: Execute

        private static async void Execute()
        {
            //Boostrap - Replace with IoC Container
            var client = new Client(ClientSettings);
            IPokemonTransferer transferer = new PokemonTransferer(client);
            IEvolutionStrategy evolutionStrategy = new BasicEvolutionStrategy(client);
            ITransferStrategy transferStrategy = SelectTransferStrategy(client, transferer, ClientSettings);
            
            //Hook Up Events...
            evolutionStrategy.OnEvolve += EvolutionStrategy_OnEvolve;
            evolutionStrategy.OnEvolveFail += EvolutionStrategy_OnEvolveFail;

            transferStrategy.TransferSuccess += TransferStrategy_TransferSuccess;
            transferStrategy.TransferFailed += TransferStrategy_TransferFailed;
            transferStrategy.TransferIgnored += TransferStrategy_TransferIgnored;

            try
            {
                if (ClientSettings.AuthType == AuthType.Ptc)
                    await client.DoPtcLogin(ClientSettings.PtcUsername, ClientSettings.PtcPassword);
                else if (ClientSettings.AuthType == AuthType.Google)
                    await client.DoGoogleLogin();

                await client.SetServer();


                //TODO: Clean this up
                await PrintBoostrap(client);
                await PrintBoostrap(client);


                //Step 1: Transfer any pokemon according to the users selected strategy
                await transferStrategy.Transfer();

                //Step 2: If we want to evolve, then apply to evolve strategy
                if (ClientSettings.EvolveAllGivenPokemons) await evolutionStrategy.Evolve();



                client.RecycleItems(client);

                await Task.Delay(5000);
                PrintLevel(client);
                await ExecuteFarmingPokestopsAndPokemons(client);
                ColoredConsoleWrite(ConsoleColor.Red, $"[{DateTime.Now.ToString("HH:mm:ss")}] {Language.GetPhrases()["no_nearby_loc_found"]}");
                await Task.Delay(10000);
                Execute();
            }
            catch (TaskCanceledException tce) { ColoredConsoleWriteTimestamped(ConsoleColor.White, $"{Language.GetPhrases()["task_canceled_ex"]}"); Execute(); }
            catch (UriFormatException ufe) { ColoredConsoleWriteTimestamped(ConsoleColor.White, $"{Language.GetPhrases()["sys_uri_format_ex"]}"); Execute(); }
            catch (ArgumentOutOfRangeException aore) { ColoredConsoleWriteTimestamped(ConsoleColor.White, $"{Language.GetPhrases()["arg_out_of_range_ex"]}"); Execute(); }
            catch (ArgumentNullException ane) { ColoredConsoleWriteTimestamped(ConsoleColor.White, $"{Language.GetPhrases()["arg_null_ref"]}"); Execute(); }
            catch (NullReferenceException nre) { ColoredConsoleWriteTimestamped(ConsoleColor.White, $"{Language.GetPhrases()["null_ref"]}"); Execute(); }
            //await ExecuteCatchAllNearbyPokemons(client);
        }
开发者ID:XibalbaTM,项目名称:PokeBot2,代码行数:55,代码来源:Program.cs

示例7: 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, "Login Type: Pokemon Trainers Club");
                        await client.DoPtcLogin(ClientSettings.PtcUsername, ClientSettings.PtcPassword);
                        break;
                    case AuthType.Google:
                        ColoredConsoleWrite(Color.Green, "Login Type: Google");
                        await client.DoGoogleLogin(ClientSettings.Email, ClientSettings.Password);

                        break;
                }
                
                await client.SetServer();
                var profile = await client.GetProfile();
                var settings = await client.GetSettings();
                connected = true;


                ConsoleLevelTitle(profile.Profile.Username, client);

                // Write the players ingame details
                WriteConnectLogs(profile);

                // I believe a switch is more efficient and easier to read.

                client.stopRecycle = false;
                stopPrintLevel = false;

                if (ClientSettings.Recycler)
                    recycle = client.RecycleItems(client);
                printLevel = PrintLevel(client);
                await EvolveAndTransfert(client);
                await ExecuteFarmingPokestopsAndPokemons(client);
                await UnbannedCheck();
            }
            catch (TaskCanceledException) { ColoredConsoleWrite(Color.Red, "Task Canceled Exception - Restarting"); if (!Stopping) await Restart(client); }
            catch (UriFormatException) { ColoredConsoleWrite(Color.Red, "System URI Format Exception - Restarting"); if (!Stopping) await Restart(client); }
            catch (ArgumentOutOfRangeException) { ColoredConsoleWrite(Color.Red, "ArgumentOutOfRangeException - Restarting"); if (!Stopping) await Restart(client); }
            catch (ArgumentNullException) { ColoredConsoleWrite(Color.Red, "Argument Null Refference - Restarting"); if (!Stopping) await Restart(client); }
            catch (NullReferenceException) { ColoredConsoleWrite(Color.Red, "Null Refference - Restarting"); if (!Stopping) await Restart(client); }
            catch (Exception ex) { ColoredConsoleWrite(Color.Red, ex.ToString()); if (!Stopping) await Restart(client); }
        }
开发者ID:Zayceur,项目名称:Pokemon-Go-Bot,代码行数:50,代码来源:MainForm.cs

示例8: 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

示例9: 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

示例10: 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


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