Esempio n. 1
0
        public async Task <GetMapObjectsResponse> GetMapObjects()
        {
            var customRequest = new Request.Types.MapObjectsRequest()
            {
                CellIds =
                    ByteString.CopyFrom(
                        ProtoHelper.EncodeUlongList(S2Helper.GetNearbyCellIds(CurrentLng,
                                                                              CurrentLat))),
                Latitude  = Utils.FloatAsUlong(CurrentLat),
                Longitude = Utils.FloatAsUlong(CurrentLng),
                Unknown14 = ByteString.CopyFromUtf8("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0")
            };

            var mapRequest = RequestBuilder.GetRequest(_unknownAuth, CurrentLat, CurrentLng, 10,
                                                       new Request.Types.Requests()
            {
                Type    = (int)RequestType.GET_MAP_OBJECTS,
                Message = customRequest.ToByteString()
            },
                                                       new Request.Types.Requests()
            {
                Type = (int)RequestType.GET_HATCHED_OBJECTS
            },
                                                       new Request.Types.Requests()
            {
                Type    = (int)RequestType.GET_INVENTORY,
                Message = new Request.Types.Time()
                {
                    Time_ = DateTime.UtcNow.ToUnixTime()
                }.ToByteString()
            },
                                                       new Request.Types.Requests()
            {
                Type = (int)RequestType.CHECK_AWARDED_BADGES
            },
                                                       new Request.Types.Requests()
            {
                Type    = (int)RequestType.DOWNLOAD_SETTINGS,
                Message =
                    new Request.Types.SettingsGuid()
                {
                    //new guid, working on API fix
                    Guid = ByteString.CopyFromUtf8("b1f2bf509a025b7cd76e1c484e2a24411c50f061")
                }.ToByteString()
            });

            return(await _httpClient.PostProtoPayload <Request, GetMapObjectsResponse>($"https://{_apiUrl}/rpc", mapRequest));
        }
Esempio n. 2
0
        public async Task <MapObjectsResponse> GetMapObjects()
        {
            var customRequest = new Request.Types.MapObjectsRequest()
            {
                CellIds =
                    ByteString.CopyFrom(
                        ProtoHelper.EncodeUlongList(S2Helper.GetNearbyCellIds(_currentLng,
                                                                              _currentLat))),
                Latitude  = Utils.FloatAsUlong(_currentLat),
                Longitude = Utils.FloatAsUlong(_currentLng),
                Unknown14 = ByteString.CopyFromUtf8("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0")
            };

            var mapRequest = RequestBuilder.GetRequest(_unknownAuth, _currentLat, _currentLng, 10,
                                                       new Request.Types.Requests()
            {
                Type    = (int)RequestType.GET_MAP_OBJECTS,
                Message = customRequest.ToByteString()
            },
                                                       new Request.Types.Requests()
            {
                Type = (int)RequestType.GET_HATCHED_OBJECTS
            },
                                                       new Request.Types.Requests()
            {
                Type    = (int)RequestType.GET_INVENTORY,
                Message = new Request.Types.Time()
                {
                    Time_ = DateTime.UtcNow.ToUnixTime()
                }.ToByteString()
            },
                                                       new Request.Types.Requests()
            {
                Type = (int)RequestType.CHECK_AWARDED_BADGES
            },
                                                       new Request.Types.Requests()
            {
                Type    = (int)RequestType.DOWNLOAD_SETTINGS,
                Message =
                    new Request.Types.SettingsGuid()
                {
                    Guid = ByteString.CopyFromUtf8("4a2e9bc330dae60e7b74fc85b98868ab4700802e")
                }.ToByteString()
            });

            return(await _httpClient.PostProto <Request, MapObjectsResponse>($"https://{_apiUrl}/rpc", mapRequest));
        }
Esempio n. 3
0
        public async Task<GetMapObjectsResponse> GetMapObjects()
        {
            var customRequest = new Request.Types.MapObjectsRequest
            {
                CellIds =
                    ByteString.CopyFrom(
                        ProtoHelper.EncodeUlongList(S2Helper.GetNearbyCellIds(CurrentLng,
                            CurrentLat))),
                Latitude = Utils.FloatAsUlong(CurrentLat),
                Longitude = Utils.FloatAsUlong(CurrentLng),
                Unknown14 = ByteString.CopyFromUtf8("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0")
            };

            var mapRequest = RequestBuilder.GetRequest(_unknownAuth, CurrentLat, CurrentLng, CurrentAltitude,
                new Request.Types.Requests
                {
                    Type = (int)RequestType.GET_MAP_OBJECTS,
                    Message = customRequest.ToByteString()
                },
                new Request.Types.Requests { Type = (int)RequestType.GET_HATCHED_OBJECTS },
                new Request.Types.Requests
                {
                    Type = (int)RequestType.GET_INVENTORY,
                    Message = new Request.Types.Time() {Time_ = DateTime.UtcNow.ToUnixTime()}.ToByteString()
                },
                new Request.Types.Requests() { Type = (int)RequestType.CHECK_AWARDED_BADGES },
                new Request.Types.Requests()
                {
                    Type = (int)RequestType.DOWNLOAD_SETTINGS,
                    Message =
                        new Request.Types.SettingsGuid
                        {
                            Guid = ByteString.CopyFromUtf8("4a2e9bc330dae60e7b74fc85b98868ab4700802e")
                        }.ToByteString()
                });

            return await _httpClient.PostProtoPayload<Request, GetMapObjectsResponse>($"https://{_apiUrl}/rpc", mapRequest);
        }
        public async Task<GetMapObjectsResponse> GetMapObjects()
        {
            var customRequest = new Request.Types.MapObjectsRequest
            {
                CellIds =
                    ByteString.CopyFrom(
                        ProtoHelper.EncodeUlongList(S2Helper.GetNearbyCellIds(_currentLng,
                            _currentLat))),
                Latitude = Utils.FloatAsUlong(_currentLat),
                Longitude = Utils.FloatAsUlong(_currentLng),
                Unknown14 = ByteString.CopyFromUtf8("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0")
            };

            var mapRequest = RequestBuilder.GetRequest(_unknownAuth, _currentLat, _currentLng, 10,
                new Request.Types.Requests
                {
                    Type = (int)RequestType.GET_MAP_OBJECTS,
                    Message = customRequest.ToByteString()
                },
                new Request.Types.Requests { Type = (int)RequestType.GET_HATCHED_OBJECTS },
                new Request.Types.Requests
                {
                    Type = (int)RequestType.GET_INVENTORY,
                    Message = new Request.Types.Time { Time_ = DateTime.UtcNow.ToUnixTime() }.ToByteString()
                },
                new Request.Types.Requests { Type = (int)RequestType.CHECK_AWARDED_BADGES },
                new Request.Types.Requests
                {
                    Type = (int)RequestType.DOWNLOAD_SETTINGS,
                    Message =
                        new Request.Types.SettingsGuid
                        {
                            Guid = ByteString.CopyFromUtf8("4a2e9bc330dae60e7b74fc85b98868ab4700802e")
                        }.ToByteString()
                });
                
                
            for (int i = 0; i < 10; i++)
            {
                var mapobjects = await _httpClient.PostProtoPayload<Request, GetMapObjectsResponse>($"https://{_apiUrl}/rpc", mapRequest);
                if ((mapobjects.MapCells.SelectMany(a => a.CatchablePokemons).Count() + mapobjects.MapCells.SelectMany(a => a.WildPokemons).Count() + mapobjects.MapCells.SelectMany(a => a.NearbyPokemons).Count()) == 0)
                {
                    await Task.Delay(500 * i);
                    continue;
                }
                    return mapobjects;
            }
            return await _httpClient.PostProtoPayload<Request, GetMapObjectsResponse>($"https://{_apiUrl}/rpc", mapRequest);
        }