Exemplo n.º 1
0
        public async Task Incubate(float kmWalked, List <EggIncubator> incubators, List <PokemonData> unusedEggs)
        {
            for (int i = 0; i < incubators.Count; i++)
            {
                if (i >= unusedEggs.Count)
                {
                    break;
                }

                var incubator = incubators[i];

                var customRequest = new POGOProtos.Networking.Requests.Messages.UseItemEggIncubatorMessage()
                {
                    ItemId    = incubator.ItemId,
                    PokemonId = (ulong)incubator.PokemonId
                };

                var useItemRequest = RequestBuilder.GetRequest(_unknownAuth, CurrentLat, CurrentLng, CurrentAltitude,
                                                               new Request.Types.Requests
                {
                    Type    = (int)RequestType.USE_ITEM_EGG_INCUBATOR,
                    Message = customRequest.ToByteString()
                });


                await _httpClient.PostProtoPayload <Request, UseItemRequest>($"https://{_apiUrl}/rpc", useItemRequest);
            }
        }
Exemplo n.º 2
0
        public async Task Incubate(float kmWalked, List <EggIncubator> incubators, List <PokemonData> unusedEggs, List <PokemonData> pokemons)
        {
            foreach (var incubator in incubators)
            {
                if (incubator.PokemonId == 0)
                {
                    // Unlimited incubators prefer short eggs, limited incubators prefer long eggs
                    var egg = incubator.IncubatorType == EggIncubatorType.IncubatorUnset
                        ? unusedEggs.FirstOrDefault()
                        : unusedEggs.LastOrDefault();

                    if (egg == null)
                    {
                        continue;
                    }

                    var customRequest = new POGOProtos.Networking.Requests.Messages.UseItemEggIncubatorMessage
                    {
                        ItemId    = incubator.ItemId,
                        PokemonId = egg.Id
                    };

                    var useItemRequest = RequestBuilder.GetRequest(_unknownAuth, CurrentLat, CurrentLng, CurrentAltitude,
                                                                   new Request.Types.Requests
                    {
                        Type    = (int)RequestType.USE_ITEM_EGG_INCUBATOR,
                        Message = customRequest.ToByteString()
                    });

                    await _httpClient.PostProtoPayload <Request, UseItemRequest>($"https://{_apiUrl}/rpc", useItemRequest);

                    unusedEggs.Remove(egg);
                }
                else
                {
                    // Wird gerade gebrütet
                    var kmToWalk    = incubator.TargetKmWalked - incubator.StartKmWalked;
                    var kmRemaining = incubator.TargetKmWalked - kmWalked;
                    Logger.ColoredConsoleWrite(ConsoleColor.DarkGray, $"Incubator needs {kmRemaining.ToString("N2")}km/{kmToWalk.ToString("N2")}km to hatch.");
                }
            }
        }
Exemplo n.º 3
0
        public async Task Incubate(float kmWalked, List<EggIncubator> incubators, List<PokemonData> unusedEggs, List<PokemonData> pokemons)
        {
            foreach (var incubator in incubators)
            {
                if (incubator.PokemonId == 0)
                {
                    // Unlimited incubators prefer short eggs, limited incubators prefer long eggs
                    var egg = incubator.IncubatorType == EggIncubatorType.IncubatorUnset
                        ? unusedEggs.FirstOrDefault()
                        : unusedEggs.LastOrDefault();

                    if (egg == null)
                    {
                        continue;
                    }

                    var customRequest = new POGOProtos.Networking.Requests.Messages.UseItemEggIncubatorMessage
                    {
                        ItemId = incubator.ItemId,
                        PokemonId = egg.Id
                    };

                    var useItemRequest = RequestBuilder.GetRequest(_unknownAuth, CurrentLat, CurrentLng, CurrentAltitude,
                        new Request.Types.Requests
                        {
                            Type = (int)RequestType.USE_ITEM_EGG_INCUBATOR,
                            Message = customRequest.ToByteString()
                        });

                    await _httpClient.PostProtoPayload<Request, UseItemRequest>($"https://{_apiUrl}/rpc", useItemRequest);
                    unusedEggs.Remove(egg);
                }
                else
                {
                    // Wird gerade gebrütet
                    var kmToWalk = incubator.TargetKmWalked - incubator.StartKmWalked;
                    var kmRemaining = incubator.TargetKmWalked - kmWalked;
                    Logger.ColoredConsoleWrite(ConsoleColor.DarkGray, $"Incubator needs {kmRemaining.ToString("N2")}km/{kmToWalk.ToString("N2")}km to hatch.");
                }
            }
        }