コード例 #1
0
ファイル: Map.cs プロジェクト: Bkheart/PokemonGo.RocketAPI
             DownloadSettingsResponse> > GetMapObjects()
        {
            #region Messages

            var getMapObjectsMessage = new GetMapObjectsMessage
            {
                CellId           = { S2Helper.GetNearbyCellIds(Client.CurrentLongitude, Client.CurrentLatitude) },
                SinceTimestampMs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                Latitude         = Client.CurrentLatitude,
                Longitude        = Client.CurrentLongitude
            };

            var getHatchedEggsMessage = new GetHatchedEggsMessage();

            var getInventoryMessage = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };

            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();

            var downloadSettingsMessage = new DownloadSettingsMessage
            {
                Hash = Client.SettingsHash
            };

            #endregion

            var request = GetRequestBuilder().GetRequestEnvelope(new Request[] {
                new Request
                {
                    RequestType    = RequestType.GetMapObjects,
                    RequestMessage = getMapObjectsMessage.ToByteString()
                },
                new Request
                {
                    RequestType    = RequestType.GetHatchedEggs,
                    RequestMessage = getHatchedEggsMessage.ToByteString()
                }, new Request
                {
                    RequestType    = RequestType.GetInventory,
                    RequestMessage = getInventoryMessage.ToByteString()
                }, new Request
                {
                    RequestType    = RequestType.CheckAwardedBadges,
                    RequestMessage = checkAwardedBadgesMessage.ToByteString()
                }, new Request
                {
                    RequestType    = RequestType.DownloadSettings,
                    RequestMessage = downloadSettingsMessage.ToByteString()
                }
            });

            return
                (await
                 PostProtoPayload
                 <Request, GetMapObjectsResponse, GetHatchedEggsResponse, GetInventoryResponse,
                  CheckAwardedBadgesResponse, DownloadSettingsResponse>(request));
        }
コード例 #2
0
        public async Task <Tuple <GetMapObjectsResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse> > GetMapObjects()
        {
            #region Messages

            var getMapObjectsMessage = new GetMapObjectsMessage
            {
                CellId           = { S2Helper.GetNearbyCellIds(_client.CurrentLongitude, _client.CurrentLatitude) },
                SinceTimestampMs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                Latitude         = _client.CurrentLatitude,
                Longitude        = _client.CurrentLongitude
            };
            var CheckChallengeMessage = new CheckChallengeMessage();
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage   = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage   = new DownloadSettingsMessage
            {
                Hash = "2788184af4004004d6ab0740f7632983332106f6"
            };

            #endregion

            var request = RequestBuilder.GetRequestEnvelope(
                new Request
            {
                RequestType    = RequestType.GetMapObjects,
                RequestMessage = getMapObjectsMessage.ToByteString()
            },
                new Request
            {
                RequestType    = RequestType.CheckChallenge,
                RequestMessage = CheckChallengeMessage.ToByteString()
            },
                new Request
            {
                RequestType    = RequestType.GetHatchedEggs,
                RequestMessage = getHatchedEggsMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetInventory,
                RequestMessage = getInventoryMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.CheckAwardedBadges,
                RequestMessage = checkAwardedBadgesMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.DownloadSettings,
                RequestMessage = downloadSettingsMessage.ToByteString()
            });
            return(await PostProtoPayload <Request, GetMapObjectsResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse>(request));
        }
コード例 #3
0
        private async Task SetServer()
        {
            {
                var getPlayerMessage      = new GetPlayerMessage();
                var getHatchedEggsMessage = new GetHatchedEggsMessage();
                var getInventoryMessage   = new GetInventoryMessage
                {
                    LastTimestampMs = DateTime.UtcNow.ToUnixTime()
                };
                var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
                var downloadSettingsMessage   = new DownloadSettingsMessage
                {
                    //05daf51635c82611d1aac95c0b051d3ec088a930
                    Hash = "05daf51635c82611d1aac95c0b051d3ec088a930"
                };

                var serverRequest = _apiBaseRpc.RequestBuilder.GetRequestEnvelope(
                    new Request
                {
                    RequestType    = RequestType.GetPlayer,
                    RequestMessage = getPlayerMessage.ToByteString()
                }, new Request
                {
                    RequestType    = RequestType.GetHatchedEggs,
                    RequestMessage = getHatchedEggsMessage.ToByteString()
                }, new Request
                {
                    RequestType    = RequestType.GetInventory,
                    RequestMessage = getInventoryMessage.ToByteString()
                }, new Request
                {
                    RequestType    = RequestType.CheckAwardedBadges,
                    RequestMessage = checkAwardedBadgesMessage.ToByteString()
                }, new Request
                {
                    RequestType    = RequestType.DownloadSettings,
                    RequestMessage = downloadSettingsMessage.ToByteString()
                },
                    new Request()
                {
                    RequestType = RequestType.DownloadItemTemplates
                });

                var serverResponse = await _apiBaseRpc.PostProto <Request>(Resources.RpcUrl, serverRequest);

                if (serverResponse.AuthTicket == null)
                {
                    throw new AccessTokenExpiredException();
                }

                _client.AuthTicket = serverResponse.AuthTicket;
                _client.ApiUrl     = serverResponse.ApiUrl;
            }
        }
コード例 #4
0
        private async Task SetServer()
        {
            #region Standard intial request messages in right Order

            var getPlayerMessage      = new GetPlayerMessage();
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage   = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage   = new DownloadSettingsMessage
            {
                Hash = "54b359c97e46900f87211ef6e6dd0b7f2a3ea1f5" //"05daf51635c82611d1aac95c0b051d3ec088a930"
            };

            #endregion

            var serverRequest = RequestBuilder.GetInitialRequestEnvelope(
                new Request
            {
                RequestType    = RequestType.GetPlayer,
                RequestMessage = getPlayerMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetHatchedEggs,
                RequestMessage = getHatchedEggsMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetInventory,
                RequestMessage = getInventoryMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.CheckAwardedBadges,
                RequestMessage = checkAwardedBadgesMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.DownloadSettings,
                RequestMessage = downloadSettingsMessage.ToByteString()
            });


            var serverResponse = await PostProto <Request>(Resources.RpcUrl, serverRequest);

            if (serverResponse.AuthTicket == null)
            {
                _client.AuthToken = null;
                throw new AccessTokenExpiredException();
            }

            _client.AuthTicket = serverResponse.AuthTicket;
            _client.ApiUrl     = serverResponse.ApiUrl;
        }
コード例 #5
0
ファイル: Map.cs プロジェクト: ZunlabResearch/PoGo
        public async Task <ResponseContainer <GetMapObjectsResponse> > GetMapObjects()
        {
            #region Messages

            var getMapObjectsMessage = new GetMapObjectsMessage
            {
                CellId           = { S2Helper.GetNearbyCellIds(Client.CurrentLongitude, Client.CurrentLatitude) },
                SinceTimestampMs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                Latitude         = Client.CurrentLatitude,
                Longitude        = Client.CurrentLongitude
            };
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage   = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage   = new DownloadSettingsMessage
            {
                Hash = "05daf51635c82611d1aac95c0b051d3ec088a930"
            };

            #endregion

            var request = RequestBuilder.GetRequestEnvelope(
                new Request
            {
                RequestType    = RequestType.GetMapObjects,
                RequestMessage = getMapObjectsMessage.ToByteString()
            },
                new Request
            {
                RequestType    = RequestType.GetHatchedEggs,
                RequestMessage = getHatchedEggsMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetInventory,
                RequestMessage = getInventoryMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.CheckAwardedBadges,
                RequestMessage = checkAwardedBadgesMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.DownloadSettings,
                RequestMessage = downloadSettingsMessage.ToByteString()
            });

            var response = await PostProtoPayload <Request, GetMapObjectsResponse, GetHatchedEggsResponse,
                                                   GetInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse>(request);

            return(new ResponseContainer <GetMapObjectsResponse>(response.Item1, response.Item2, response.Item3, response.Item4, response.Item5));
        }
コード例 #6
0
ファイル: Login.cs プロジェクト: cywang886/PokemonGo-Bot-1
        private async Task SetServer()
        {
            #region Standard intial request messages in right Order

            var getPlayerMessage      = new GetPlayerMessage();
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage   = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage   = new DownloadSettingsMessage
            {
                Hash = "b8fa9757195897aae92c53dbcf8a60fb3d86d745"
            };

            #endregion

            var serverRequest = RequestBuilder.GetInitialRequestEnvelope(
                new Request
            {
                RequestType    = RequestType.GetPlayer,
                RequestMessage = getPlayerMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetHatchedEggs,
                RequestMessage = getHatchedEggsMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetInventory,
                RequestMessage = getInventoryMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.CheckAwardedBadges,
                RequestMessage = checkAwardedBadgesMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.DownloadSettings,
                RequestMessage = downloadSettingsMessage.ToByteString()
            });


            var serverResponse = await PostProto <Request>(Resources.RpcUrl, serverRequest);

            if (serverResponse.AuthTicket == null)
            {
                _client.AuthToken = null;
                throw new AccessTokenExpiredException();
            }

            _client.AuthTicket = serverResponse.AuthTicket;
            _client.ApiUrl     = serverResponse.ApiUrl;
        }
コード例 #7
0
ファイル: Login.cs プロジェクト: C9Kamis/PoGo-UWP
        private async Task SetServer()
        {
            #region Standard intial request messages in right Order

            var getPlayerMessage = new GetPlayerMessage();
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage = new DownloadSettingsMessage
            {
                Hash = "05daf51635c82611d1aac95c0b051d3ec088a930"
            };

            #endregion

            var serverRequest = RequestBuilder.GetInitialRequestEnvelope(
                new Request
                {
                    RequestType = RequestType.GetPlayer,
                    RequestMessage = getPlayerMessage.ToByteString()
                }, new Request
                {
                    RequestType = RequestType.GetHatchedEggs,
                    RequestMessage = getHatchedEggsMessage.ToByteString()
                }, new Request
                {
                    RequestType = RequestType.GetInventory,
                    RequestMessage = getInventoryMessage.ToByteString()
                }, new Request
                {
                    RequestType = RequestType.CheckAwardedBadges,
                    RequestMessage = checkAwardedBadgesMessage.ToByteString()
                }, new Request
                {
                    RequestType = RequestType.DownloadSettings,
                    RequestMessage = downloadSettingsMessage.ToByteString()
                });


            var serverResponse = await PostProto<Request>(Resources.RpcUrl, serverRequest);

            if (serverResponse.AuthTicket == null)
            {
                _client.AuthToken = null;
                throw new AccessTokenExpiredException();
            }

            _client.AuthTicket = serverResponse.AuthTicket;
            _client.ApiUrl = serverResponse.ApiUrl;
        }
コード例 #8
0
        private async Task SendInitialRequests()
        {
            var getPlayerMessage      = new GetPlayerMessage();
            var getHatchedEggsMessage = new GetHatchedEggsMessage();

            var epoch         = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            var lastTimeStamp = Convert.ToInt64((DateTime.UtcNow - epoch).TotalMilliseconds);

            var getInventoryMessage = new GetInventoryMessage
            {
                LastTimestampMs = lastTimeStamp
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage   = new DownloadSettingsMessage
            {
                Hash = "05daf51635c82611d1aac95c0b051d3ec088a930"
            };

            var serverRequest = RequestGenerator.GetInitialRequestEnvelope(
                new Request
            {
                RequestType    = RequestType.GetPlayer,
                RequestMessage = getPlayerMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetHatchedEggs,
                RequestMessage = getHatchedEggsMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetInventory,
                RequestMessage = getInventoryMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.CheckAwardedBadges,
                RequestMessage = checkAwardedBadgesMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.DownloadSettings,
                RequestMessage = downloadSettingsMessage.ToByteString()
            });

            var serverResponse = await PostProto <Request>(Constants.RpcUrl, serverRequest);

            if (serverResponse.AuthTicket == null)
            {
                _session.AccessToken.Token = null;
                //throw new AccessTokenExpiredException();
            }

            _session.AuthTicket = serverResponse.AuthTicket;
            _session.ApiUrl     = serverResponse.ApiUrl;
        }
コード例 #9
0
        public async Task<GetMapObjectsResponse> GetMapObjects()
        {
            #region Messages

            var getMapObjectsMessage = new GetMapObjectsMessage
            {
                CellId = { S2Helper.GetNearbyCellIds(_client.CurrentLongitude, _client.CurrentLatitude) },
                SinceTimestampMs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                Latitude = _client.CurrentLatitude,
                Longitude = _client.CurrentLongitude
            };
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage = new DownloadSettingsMessage
            {
                Hash = "05daf51635c82611d1aac95c0b051d3ec088a930"
            };

            #endregion

            var request = RequestBuilder.GetRequestEnvelope(
                new Request
                {
                    RequestType = RequestType.GetMapObjects,
                    RequestMessage = getMapObjectsMessage.ToByteString()
                },
                new Request
                {
                    RequestType = RequestType.GetHatchedEggs,
                    RequestMessage = getHatchedEggsMessage.ToByteString()
                }, new Request
                {
                    RequestType = RequestType.GetInventory,
                    RequestMessage = getInventoryMessage.ToByteString()
                }, new Request
                {
                    RequestType = RequestType.CheckAwardedBadges,
                    RequestMessage = checkAwardedBadgesMessage.ToByteString()
                }, new Request
                {
                    RequestType = RequestType.DownloadSettings,
                    RequestMessage = downloadSettingsMessage.ToByteString()
                });

            return await PostProtoPayload<Request, GetMapObjectsResponse>(request);
        }
コード例 #10
0
ファイル: Map.cs プロジェクト: leeleonis/Cpko
        public async Task <GetMapObjectsResponse> GetMapObjects()
        {
            #region Messages

            var getMapObjectsMessage = new GetMapObjectsMessage
            {
                CellId           = { S2Helper.GetNearbyCellIds(_client.CurrentLongitude, _client.CurrentLatitude) },
                SinceTimestampMs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                Latitude         = _client.CurrentLatitude,
                Longitude        = _client.CurrentLongitude
            };
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage   = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage   = new DownloadSettingsMessage
            {
                Hash = "54b359c97e46900f87211ef6e6dd0b7f2a3ea1f5"
            };

            #endregion

            var request = RequestBuilder.GetRequestEnvelope(
                new Request
            {
                RequestType    = RequestType.GetMapObjects,
                RequestMessage = getMapObjectsMessage.ToByteString()
            },
                new Request
            {
                RequestType    = RequestType.GetHatchedEggs,
                RequestMessage = getHatchedEggsMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetInventory,
                RequestMessage = getInventoryMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.CheckAwardedBadges,
                RequestMessage = checkAwardedBadgesMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.DownloadSettings,
                RequestMessage = downloadSettingsMessage.ToByteString()
            });

            return(await PostProtoPayload <Request, GetMapObjectsResponse>(request));
        }
コード例 #11
0
ファイル: ApiMap.cs プロジェクト: yxxstyle/HaxtonBot
        public async Task<GetMapObjectsResponse> GetMapObjects()
        {
            var getMapObjectsMessage = new GetMapObjectsMessage
            {
                CellId = { S2Helper.GetNearbyCellIds(_client.CurrentLongitude, _client.CurrentLatitude) },
                SinceTimestampMs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                Latitude = _client.CurrentLatitude,
                Longitude = _client.CurrentLongitude
            };
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage = new DownloadSettingsMessage
            {
                Hash = "4a2e9bc330dae60e7b74fc85b98868ab4700802e"
            };

            var request = _baseRpc.RequestBuilder.GetRequestEnvelope(
                new Request
                {
                    RequestType = RequestType.GetMapObjects,
                    RequestMessage = getMapObjectsMessage.ToByteString()
                },
                new Request
                {
                    RequestType = RequestType.GetHatchedEggs,
                    RequestMessage = getHatchedEggsMessage.ToByteString()
                }, new Request
                {
                    RequestType = RequestType.GetInventory,
                    RequestMessage = getInventoryMessage.ToByteString()
                }, new Request
                {
                    RequestType = RequestType.CheckAwardedBadges,
                    RequestMessage = checkAwardedBadgesMessage.ToByteString()
                }, new Request
                {
                    RequestType = RequestType.DownloadSettings,
                    RequestMessage = downloadSettingsMessage.ToByteString()
                });

            return await _baseRpc.PostProtoPayload<Request, GetMapObjectsResponse>(request);
        }
コード例 #12
0
        public async Task <GetMapObjectsResponse> GetMapObjects()
        {
            var getMapObjectsMessage = new GetMapObjectsMessage
            {
                CellId           = { S2Helper.GetNearbyCellIds(_client.CurrentLongitude, _client.CurrentLatitude) },
                SinceTimestampMs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
                Latitude         = _client.CurrentLatitude,
                Longitude        = _client.CurrentLongitude
            };
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage   = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage   = new DownloadSettingsMessage
            {
                Hash = "05daf51635c82611d1aac95c0b051d3ec088a930"
            };

            var request = _baseRpc.RequestBuilder.GetRequestEnvelope(
                new Request
            {
                RequestType    = RequestType.GetMapObjects,
                RequestMessage = getMapObjectsMessage.ToByteString()
            },
                new Request
            {
                RequestType    = RequestType.GetHatchedEggs,
                RequestMessage = getHatchedEggsMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetInventory,
                RequestMessage = getInventoryMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.CheckAwardedBadges,
                RequestMessage = checkAwardedBadgesMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.DownloadSettings,
                RequestMessage = downloadSettingsMessage.ToByteString()
            });

            return(await _baseRpc.PostProtoPayload <Request, GetMapObjectsResponse>(request));
        }
コード例 #13
0
ファイル: ApiLogin.cs プロジェクト: ChainsawPolice/HaxtonBot
        private async Task SetServer()
        {
            {
                var getPlayerMessage = new GetPlayerMessage();
                var getHatchedEggsMessage = new GetHatchedEggsMessage();
                var getInventoryMessage = new GetInventoryMessage
                {
                    LastTimestampMs = DateTime.UtcNow.ToUnixTime()
                };
                var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
                var downloadSettingsMessage = new DownloadSettingsMessage
                {
                    //05daf51635c82611d1aac95c0b051d3ec088a930
                    Hash = "05daf51635c82611d1aac95c0b051d3ec088a930"
                };

                var serverRequest = _apiBaseRpc.RequestBuilder.GetRequestEnvelope(
                    new Request
                    {
                        RequestType = RequestType.GetPlayer,
                        RequestMessage = getPlayerMessage.ToByteString()
                    }, new Request
                    {
                        RequestType = RequestType.GetHatchedEggs,
                        RequestMessage = getHatchedEggsMessage.ToByteString()
                    }, new Request
                    {
                        RequestType = RequestType.GetInventory,
                        RequestMessage = getInventoryMessage.ToByteString()
                    }, new Request
                    {
                        RequestType = RequestType.CheckAwardedBadges,
                        RequestMessage = checkAwardedBadgesMessage.ToByteString()
                    }, new Request
                    {
                        RequestType = RequestType.DownloadSettings,
                        RequestMessage = downloadSettingsMessage.ToByteString()
                    },
                    new Request()
                    {
                        RequestType = RequestType.DownloadItemTemplates
                    });

                var serverResponse = await _apiBaseRpc.PostProto<Request>(Resources.RpcUrl, serverRequest);

                if (serverResponse.AuthTicket == null)
                    throw new AccessTokenExpiredException();

                _client.AuthTicket = serverResponse.AuthTicket;
                _client.ApiUrl = serverResponse.ApiUrl;
            }
        }
コード例 #14
0
ファイル: Map.cs プロジェクト: Jeampan/Pokebot
        public async Task <GetMapObjectsResponse> GetMapObjects()
        {
            #region Messages

            var getMapObjectsMessage = new GetMapObjectsMessage
            {
                CellId           = { S2Helper.GetNearbyCellIds(_client.CurrentLongitude, _client.CurrentLatitude) },
                SinceTimestampMs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                Latitude         = _client.CurrentLatitude,
                Longitude        = _client.CurrentLongitude
            };
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage   = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage   = new DownloadSettingsMessage
            {
                Hash = "05daf51635c82611d1aac95c0b051d3ec088a930"
            };

            #endregion

            var request = RequestBuilder.GetRequestEnvelope(
                new Request
            {
                RequestType    = RequestType.GetMapObjects,
                RequestMessage = getMapObjectsMessage.ToByteString()
            },
                new Request
            {
                RequestType    = RequestType.GetHatchedEggs,
                RequestMessage = getHatchedEggsMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetInventory,
                RequestMessage = getInventoryMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.CheckAwardedBadges,
                RequestMessage = checkAwardedBadgesMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.DownloadSettings,
                RequestMessage = downloadSettingsMessage.ToByteString()
            });

            var response = await PostProtoPayload <Request, GetMapObjectsResponse>(request);

            lock (Client._lock)
            {
                _client._map.Invoke(new MethodInvoker(delegate
                {
                    var mapPointOverlay = _client._map.Overlays[2];
                    mapPointOverlay.Markers.Clear();
                    var pokemonOverlay = _client._map.Overlays[3];


                    foreach (var mapPoint in response.MapCells)
                    {
                        if (_client.Settings.PurePokemonMode)
                        {
                            foreach (var spawn in mapPoint.SpawnPoints)
                            {
                                mapPointOverlay.Markers.Add(new GMarkerGoogle(new GMap.NET.PointLatLng(spawn.Latitude, spawn.Longitude),
                                                                              GMarkerGoogleType.brown_small));
                            }
                        }
                        else
                        {
                            foreach (var fort in mapPoint.Forts)
                            {
                                if (fort.Type == FortType.Checkpoint)
                                {
                                    mapPointOverlay.Markers.Add(new GMarkerGoogle(new GMap.NET.PointLatLng(fort.Latitude, fort.Longitude),
                                                                                  GMarkerGoogleType.blue_small));
                                }
                            }
                        }


                        GetPokemonFromPokeVision(pokemonOverlay);

                        //foreach (var pokemon in mapPoint.WildPokemons)
                        //{
                        //    pokemonOverlay.Markers.Add(new GMarkerGoogle(new GMap.NET.PointLatLng(pokemon.Latitude, pokemon.Longitude),
                        //Images.GetPokemonImage((int)pokemon.PokemonData.PokemonId)));
                        //}
                    }
                }));
            }

            return(response);
        }
コード例 #15
0
ファイル: Login.cs プロジェクト: jabr212/Catchem-PoGo
        private async Task SetServer(bool noRetry = false)
        {
            #region Standard intial request messages in right Order

            var getPlayerMessage      = new GetPlayerMessage();
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage   = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage   = new DownloadSettingsMessage
            {
                Hash = _downloadHash //"05daf51635c82611d1aac95c0b051d3ec088a930"
            };

            var downloadRemoteConfigMessage = new DownloadRemoteConfigVersionMessage
            {
                Platform   = Platform.Ios,
                AppVersion = 4500
            };

            #endregion

            try
            {
                var serverRequest = RequestBuilder.GetInitialRequestEnvelope(
                    new Request
                {
                    RequestType    = RequestType.GetPlayer,
                    RequestMessage = getPlayerMessage.ToByteString()
                }, new Request
                {
                    RequestType    = RequestType.GetHatchedEggs,
                    RequestMessage = getHatchedEggsMessage.ToByteString()
                }, new Request
                {
                    RequestType    = RequestType.GetInventory,
                    RequestMessage = getInventoryMessage.ToByteString()
                }, new Request
                {
                    RequestType    = RequestType.CheckAwardedBadges,
                    RequestMessage = checkAwardedBadgesMessage.ToByteString()
                },
                    new Request
                {
                    RequestType    = RequestType.DownloadSettings,
                    RequestMessage = downloadSettingsMessage.ToByteString()
                },
                    new Request
                {
                    RequestType    = RequestType.DownloadRemoteConfigVersion,
                    RequestMessage = downloadRemoteConfigMessage.ToByteString()
                });
                var serverResponse = await PostProto <Request>(Resources.RpcUrl, serverRequest);

                if (serverResponse.AuthTicket == null)
                {
                    _client.AuthToken = null;
                    throw new AccessTokenExpiredException(
                              "Check your internet connection and try to restart the profile");
                }
                _client.AuthTicket = serverResponse.AuthTicket;
                _client.ApiUrl     = serverResponse.ApiUrl;


                /*    var dlVerReq = RequestBuilder.GetRequestEnvelope(new Request
                 *  {
                 *      RequestType = RequestType.DownloadSettings,
                 *      RequestMessage = downloadSettingsMessage.ToByteString()
                 *  });
                 *
                 *  var dlVerResp = await PostProtoPayload<Request, DownloadSettingsResponse>(RequestType.DownloadSettings, dlVerReq);
                 */
            }
            catch (Exception)
            {
                if (!noRetry)
                {
                    await Task.Delay(15000);
                    await DoLogin();
                }
                else
                {
                    throw new Exception("Check your internet connection and try to restart the profile");
                }
            }
        }
コード例 #16
0
ファイル: Map.cs プロジェクト: xenderUWP/PoGo-UWP
             DownloadSettingsResponse> > GetMapObjects()
        {
            #region Messages

            var getMapObjectsMessage = new GetMapObjectsMessage
            {
                CellId           = { S2Helper.GetNearbyCellIds(Client.CurrentLongitude, Client.CurrentLatitude) },
                SinceTimestampMs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                Latitude         = Client.CurrentLatitude,
                Longitude        = Client.CurrentLongitude
            };
            var checkChallengeMessage = new CheckChallengeMessage();
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage   = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime() // Should be timestamp of last inventory response, no?
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage   = new DownloadSettingsMessage
            {
                Hash = _client.Download.DownloadSettingsHash
            };

            #endregion

            var request = RequestBuilder.GetRequestEnvelope(
                new Request
            {
                RequestType    = RequestType.GetMapObjects,
                RequestMessage = getMapObjectsMessage.ToByteString()
            },
                new Request
            {
                RequestType    = RequestType.CheckChallenge,
                RequestMessage = checkChallengeMessage.ToByteString()
            },
                new Request
            {
                RequestType    = RequestType.GetHatchedEggs,
                RequestMessage = getHatchedEggsMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetInventory,
                RequestMessage = getInventoryMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.CheckAwardedBadges,
                RequestMessage = checkAwardedBadgesMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.DownloadSettings,
                RequestMessage = downloadSettingsMessage.ToByteString()
            });

            var response = await PostProtoPayload
                           <Request, GetMapObjectsResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetInventoryResponse,
                            CheckAwardedBadgesResponse, DownloadSettingsResponse>(request);


            /* Temporary inserted here from 2.0 - there is better mechanism */
            _client.ProcessMessages <GetMapObjectsResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetInventoryResponse,
                                     CheckAwardedBadgesResponse, DownloadSettingsResponse>(response);

            _client.Download.DownloadSettingsHash = response?.Item6?.Hash ?? "";

            return(response);
        }
コード例 #17
0
        public async Task <Tuple <GetMapObjectsResponse, GetHatchedEggsResponse, GetInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse> > GetMapObjects()
        {
            while (CanGetMap == false)
            {
                await Task.Delay(150);
            }
            CanGetMap = false;
            var getMapObjectsMessage = new GetMapObjectsMessage
            {
                CellId           = { S2Helper.GetNearbyCellIds(_client.CurrentLongitude, _client.CurrentLatitude) },
                SinceTimestampMs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                Latitude         = _client.CurrentLatitude,
                Longitude        = _client.CurrentLongitude
            };
            var getHatchedEggsMessage = new GetHatchedEggsMessage();
            var getInventoryMessage   = new GetInventoryMessage
            {
                LastTimestampMs = DateTime.UtcNow.ToUnixTime()
            };
            var checkAwardedBadgesMessage = new CheckAwardedBadgesMessage();
            var downloadSettingsMessage   = new DownloadSettingsMessage
            {
                Hash = "05daf51635c82611d1aac95c0b051d3ec088a930"
            };

            var request = _baseRpc.RequestBuilder.GetRequestEnvelope(
                new Request
            {
                RequestType    = RequestType.GetMapObjects,
                RequestMessage = getMapObjectsMessage.ToByteString()
            },
                new Request
            {
                RequestType    = RequestType.GetHatchedEggs,
                RequestMessage = getHatchedEggsMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.GetInventory,
                RequestMessage = getInventoryMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.CheckAwardedBadges,
                RequestMessage = checkAwardedBadgesMessage.ToByteString()
            }, new Request
            {
                RequestType    = RequestType.DownloadSettings,
                RequestMessage = downloadSettingsMessage.ToByteString()
            });

            var response = await _baseRpc.PostProtoPayload <Request, GetMapObjectsResponse, GetHatchedEggsResponse, GetInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse>(request);

            _pokemons.AddRange(response.Item1.MapCells.SelectMany(x => x.CatchablePokemons));

            //var pokestops = response.Item1.MapCells.SelectMany(t => t.Forts).Where(x => x.Type == FortType.Checkpoint);
            //_pokestops.AddRange(pokestops);
            //var newMapObjects = response.MapCells.SelectMany(x => x.WildPokemons).Select(t => new MapPokemon()
            //{
            //    EncounterId = t.EncounterId,
            //    ExpirationTimestampMs = t.TimeTillHiddenMs,
            //    Latitude = t.Latitude,
            //    Longitude = t.Longitude,
            //    PokemonId = t.PokemonData.PokemonId,
            //    SpawnPointId = t.SpawnPointId
            //});
            //_pokemons.AddRange(newMapObjects);
            //var lurePokemon =
            //    response.MapCells.SelectMany(f => f.Forts).Where(t => t.LureInfo != null).Select(l => new MapPokemon()
            //    {
            //        EncounterId = l.LureInfo.EncounterId,
            //        ExpirationTimestampMs = l.LureInfo.LureExpiresTimestampMs,
            //        Latitude = l.Latitude,
            //        Longitude = l.Longitude,
            //        PokemonId = l.LureInfo.ActivePokemonId,
            //        SpawnPointId = l.Id
            //    });
            //_pokemons.AddRange(lurePokemon);
            _pokemons = _pokemons.Where(t => t.ExpirationTimestampMs > DateTime.UtcNow.ToUnixTime()).ToList();
            return(response);
        }