public async Task <DownloadSettingsResponse> GetSettings() { var message = new DownloadSettingsMessage { Hash = "05daf51635c82611d1aac95c0b051d3ec088a930" }; return(await _baseRpc.PostProtoPayload <Request, DownloadSettingsResponse>(RequestType.DownloadSettings, message)); }
public async Task <ClaimCodenameResponse> ClaimCodename(string codename) { return (await _baseRpc.PostProtoPayload <Request, ClaimCodenameResponse>(RequestType.ClaimCodename, new ClaimCodenameMessage() { Codename = codename })); }
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)); }
public async Task <FortDetailsResponse> GetFort(string fortId, double fortLatitude, double fortLongitude) { var message = new FortDetailsMessage { FortId = fortId, Latitude = fortLatitude, Longitude = fortLongitude }; return(await _baseRpc.PostProtoPayload <Request, FortDetailsResponse>(RequestType.FortDetails, message)); }
public async Task <EncounterResponse> EncounterPokemon(ulong encounterId, string spawnPointGuid) { var message = new EncounterMessage { EncounterId = encounterId, SpawnPointId = spawnPointGuid, PlayerLatitude = _client.CurrentLatitude, PlayerLongitude = _client.CurrentLongitude }; return(await _baseRpc.PostProtoPayload <Request, EncounterResponse>(RequestType.Encounter, message)); }
public async Task <PlayerUpdateResponse> UpdatePlayerLocation(double latitude, double longitude, double altitude) { SetCoordinates(latitude, longitude, altitude); var message = new PlayerUpdateMessage { Latitude = _client.CurrentLatitude, Longitude = _client.CurrentLongitude }; var updatePlayerLocationRequestEnvelope = _baseRpc.RequestBuilder.GetRequestEnvelope( new Request { RequestType = RequestType.PlayerUpdate, RequestMessage = message.ToByteString() }); return(await _baseRpc.PostProtoPayload <Request, PlayerUpdateResponse>(updatePlayerLocationRequestEnvelope)); }
public async Task <ReleasePokemonResponse> TransferPokemon(ulong pokemonId) { var message = new ReleasePokemonMessage { PokemonId = pokemonId }; return(await _baseRpc.PostProtoPayload <Request, ReleasePokemonResponse>(RequestType.ReleasePokemon, message)); }
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); }