示例#1
0
        /*num Holoholo.Rpc.Types.FortSearchOutProto.Result {
         * NO_RESULT_SET = 0;
         * SUCCESS = 1;
         * OUT_OF_RANGE = 2;
         * IN_COOLDOWN_PERIOD = 3;
         * INVENTORY_FULL = 4;
         * }*/

        public async Task <FortSearchResponse> SearchFort(string fortId, double fortLat, double fortLng)
        {
            var customRequest = new Request.Types.FortSearchRequest()
            {
                Id               = ByteString.CopyFromUtf8(fortId),
                FortLatDegrees   = Utils.FloatAsUlong(fortLat),
                FortLngDegrees   = Utils.FloatAsUlong(fortLng),
                PlayerLatDegrees = Utils.FloatAsUlong(_currentLat),
                PlayerLngDegrees = Utils.FloatAsUlong(_currentLng)
            };

            var fortDetailRequest = RequestBuilder.GetRequest(_unknownAuth, _currentLat, _currentLng, 30,
                                                              new Request.Types.Requests()
            {
                Type    = (int)RequestType.FORT_SEARCH,
                Message = customRequest.ToByteString()
            });

            return(await _httpClient.PostProto <Request, FortSearchResponse>($"https://{_apiUrl}/rpc", fortDetailRequest));
        }
示例#2
0
        public async Task<FortSearchResponse> SearchFort(string fortId, double fortLat, double fortLng)
        {
            var customRequest = new Request.Types.FortSearchRequest
            {
                Id = ByteString.CopyFromUtf8(fortId),
                FortLatDegrees = Utils.FloatAsUlong(fortLat),
                FortLngDegrees = Utils.FloatAsUlong(fortLng),
                PlayerLatDegrees = Utils.FloatAsUlong(CurrentLat),
                PlayerLngDegrees = Utils.FloatAsUlong(CurrentLng)
            };

            var fortDetailRequest = RequestBuilder.GetRequest(_unknownAuth, CurrentLat, CurrentLng, CurrentAltitude,
                new Request.Types.Requests
                {
                    Type = (int)RequestType.FORT_SEARCH,
                    Message = customRequest.ToByteString()
                });
            return
                await
                    _httpClient.PostProtoPayload<Request, FortSearchResponse>($"https://{_apiUrl}/rpc",
                        fortDetailRequest);
        }