Ejemplo n.º 1
0
        public async Task <GetIncensePokemonResponse> GetIncensePokemons()
        {
            var getIncensePokemonsRequest = new Request
            {
                RequestType    = RequestType.GetIncensePokemon,
                RequestMessage = ((IMessage) new GetIncensePokemonMessage
                {
                    PlayerLatitude = Client.CurrentLatitude,
                    PlayerLongitude = Client.CurrentLongitude
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(getIncensePokemonsRequest, Client)).ConfigureAwait(false);

            Tuple <GetIncensePokemonResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, GetIncensePokemonResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 2
0
        public async Task <CheckChallengeResponse> CheckChallenge()
        {
            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.GetCommonRequests(Client)).ConfigureAwait(false);

            Tuple <CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            // This is commented out because the assumption is that you are calling CheckChallenge() directly
            // to get a new challenge url. So don't throw the exception below.
            // CheckChallengeResponse checkChallengeResponse = response.Item1;
            // CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item3;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item5;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 3
0
        public async Task <SetLobbyVisibilityResponse> SetLobbyVisibility(string gymId, long raidSeed)
        {
            var SetLobbyVisibilityRequest = new Request
            {
                RequestType    = RequestType.SetLobbyVisibility,
                RequestMessage = ((IMessage) new SetLobbyVisibilityMessage
                {
                    GymId = gymId,
                    RaidSeed = raidSeed
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(SetLobbyVisibilityRequest, Client)).ConfigureAwait(false);

            Tuple <SetLobbyVisibilityResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, SetLobbyVisibilityResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 4
0
        public async Task <SetPlayerTeamResponse> SetPlayerTeam(TeamColor teamColor)
        {
            var setPlayerTeamRequest = new Request
            {
                RequestType    = RequestType.SetPlayerTeam,
                RequestMessage = new SetPlayerTeamMessage
                {
                    Team = teamColor
                }.ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(setPlayerTeamRequest, Client)).ConfigureAwait(false);

            Tuple <SetPlayerTeamResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, SetPlayerTeamResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 5
0
        public static void Parse(Client client, RequestType requestType, ByteString data)
        {
            try
            {
                switch (requestType)
                {
                case RequestType.GetHoloInventory:
                    var getHoloInventoryResponse = new GetHoloInventoryResponse();
                    getHoloInventoryResponse.MergeFrom(data);
                    ProcessGetHoloInventoryResponse(client, getHoloInventoryResponse);
                    break;

                case RequestType.DownloadSettings:
                    //TODO Update settings
                    //api.getSettings().updateSettings(DownloadSettingsResponse.parseFrom(data));
                    // Update settings hash
                    var downloadSettingsResponse = new DownloadSettingsResponse();
                    downloadSettingsResponse.MergeFrom(data);
                    client.SettingsHash = downloadSettingsResponse.Hash;
                    break;
                }
            }
            catch (InvalidProtocolBufferException e)
            {
                throw e;
            }
        }
Ejemplo n.º 6
0
        public async Task <EquipBadgeResponse> EquipBadge(BadgeType type)
        {
            var equipBadgeRequest = new Request
            {
                RequestType    = RequestType.EquipBadge,
                RequestMessage = new EquipBadgeMessage
                {
                    BadgeType = type
                }.ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(equipBadgeRequest, Client)).ConfigureAwait(false);

            Tuple <EquipBadgeResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, EquipBadgeResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 7
0
        public async Task <LevelUpRewardsResponse> GetLevelUpRewards(int level)
        {
            var levelUpRewardsRequest = new Request
            {
                RequestType    = RequestType.LevelUpRewards,
                RequestMessage = new LevelUpRewardsMessage
                {
                    Level = level
                }.ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(levelUpRewardsRequest, Client)).ConfigureAwait(false);

            Tuple <LevelUpRewardsResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, LevelUpRewardsResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 8
0
        public async Task <GetPlayerProfileResponse> GetPlayerProfile()
        {
            var getPlayerProfileRequest = new Request
            {
                RequestType    = RequestType.GetPlayerProfile,
                RequestMessage = new GetPlayerProfileMessage
                {
                    PlayerName = PlayerData.Username
                }.ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(getPlayerProfileRequest, Client)).ConfigureAwait(false);

            Tuple <GetPlayerProfileResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, GetPlayerProfileResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 9
0
        //TODO: revise https://github.com/AeonLucid/POGOProtos/blob/master/src/POGOProtos/Networking/Requests/RequestType.proto#L46
        public async Task <CollectDailyDefenderBonusResponse> CollectDailyDefenderBonus()
        {
            var collectDailyDefenderBonusRequest = new Request
            {
                RequestType    = RequestType.CollectDailyDefenderBonus,
                RequestMessage = new CollectDailyDefenderBonusMessage().ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(collectDailyDefenderBonusRequest, Client)).ConfigureAwait(false);

            Tuple <CollectDailyDefenderBonusResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, CollectDailyDefenderBonusResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 10
0
        public async Task <ClaimCodenameResponse> ClaimCodename(string codename)
        {
            var claimCodenameRequest = new Request
            {
                RequestType    = RequestType.ClaimCodename,
                RequestMessage = ((IMessage) new ClaimCodenameMessage
                {
                    Codename = codename
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(claimCodenameRequest, Client)).ConfigureAwait(false);

            Tuple <ClaimCodenameResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, ClaimCodenameResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 11
0
        public async Task <GetDownloadUrlsResponse> GetDownloadUrls(IEnumerable <string> assetIds)
        {
            var getDownloadUrlsRequest = new Request
            {
                RequestType    = RequestType.GetDownloadUrls,
                RequestMessage = new GetDownloadUrlsMessage
                {
                    AssetId = { assetIds }
                }.ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(getDownloadUrlsRequest, Client)).ConfigureAwait(false);

            Tuple <GetDownloadUrlsResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, GetDownloadUrlsResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 12
0
        public async Task <RegisterPushNotificationResponse> UnregisterPushNotification(ApnToken apnToken, GcmToken gcmToken)
        {
            var UnregisterPushNotificationRequest = new Request
            {
                RequestType    = RequestType.UnregisterPushNotification,
                RequestMessage = ((IMessage) new RegisterPushNotificationMessage
                {
                    ApnToken = apnToken,
                    GcmToken = gcmToken,
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(UnregisterPushNotificationRequest, Client)).ConfigureAwait(false);

            Tuple <RegisterPushNotificationResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, RegisterPushNotificationResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 13
0
        public async Task <UpdateNotificationResponse> UpdateNotification(RepeatedField <string> Notification_Ids, RepeatedField <Int64> TimeStampsMS, NotificationState state)
        {
            var UpdateNotificationRequest = new Request
            {
                RequestType    = RequestType.UpdateNotificationStatus,
                RequestMessage = ((IMessage) new UpdateNotificationMessage
                {
                    NotificationIds = { Notification_Ids },
                    CreateTimestampMs = { TimeStampsMS },
                    State = state
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(UpdateNotificationRequest, Client)).ConfigureAwait(false);

            Tuple <UpdateNotificationResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, UpdateNotificationResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 14
0
        public async Task <GetInboxResponse> GetInbox(bool isHistory, bool isReverse, long notBeforeMs)
        {
            var GetInboxRequest = new Request
            {
                RequestType    = RequestType.GetInbox,
                RequestMessage = ((IMessage) new GetInboxMessage
                {
                    IsHistory = isHistory,
                    IsReverse = isReverse,
                    NotBeforeMs = notBeforeMs
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(GetInboxRequest, Client)).ConfigureAwait(false);

            Tuple <GetInboxResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, GetInboxResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 15
0
        public async Task <SfidaActionLogResponse> SfidaUpdate()
        {
            var SfidaUpdateRequest = new Request
            {
                RequestType    = RequestType.SfidaUpdate,
                RequestMessage = ((IMessage) new SfidaActionLogMessage
                {
                    //
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(SfidaUpdateRequest, Client)).ConfigureAwait(false);

            Tuple <SfidaActionLogResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, SfidaActionLogResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 16
0
        public async Task <VerifyChallengeResponse> VerifyChallenge(string token)
        {
            var verifyChallengeRequest = new Request
            {
                RequestType    = RequestType.VerifyChallenge,
                RequestMessage = new VerifyChallengeMessage
                {
                    Token = token
                }.ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(verifyChallengeRequest, Client)).ConfigureAwait(false);

            Tuple <VerifyChallengeResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, VerifyChallengeResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            // This is commented out because the assumption is that you are trying to verify the captcha,
            // so don't throw any exceptions.
            // CheckChallengeResponse checkChallengeResponse = response.Item2;
            // CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 17
0
 public static void ProcessGetHoloInventoryResponse(Client client, GetHoloInventoryResponse getHoloInventoryResponse)
 {
     if (getHoloInventoryResponse == null)
     {
         return;
     }
     if (!getHoloInventoryResponse.Success)
     {
         return;
     }
     // If there is not inventory delta
     if (getHoloInventoryResponse.InventoryDelta == null)
     {
         return;
     }
     if (client.Inventory.GetHoloInventory() == null)
     {
         client.Inventory.SetHoloInventory(getHoloInventoryResponse);
         return;
     }
     // If was updated yet.
     if (getHoloInventoryResponse.InventoryDelta.NewTimestampMs <= client.Inventory.GetHoloInventory().InventoryDelta.NewTimestampMs)
     {
         return;
     }
     client.Inventory.GetHoloInventory().InventoryDelta.NewTimestampMs = getHoloInventoryResponse.InventoryDelta.NewTimestampMs;
     client.Inventory.UpdateInventoryItems(getHoloInventoryResponse.InventoryDelta);
 }
Ejemplo n.º 18
0
        public async Task <UseItemMoveRerollResponse> UseItemMoveReroll(ItemId itemId, ulong pokemonId)
        {
            var UseItemMoveRerollRequest = new Request
            {
                RequestType    = RequestType.UseItemMoveReroll,
                RequestMessage = ((IMessage) new UseItemMoveRerollMessage
                {
                    ItemId = itemId,
                    PokemonId = pokemonId
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(UseItemMoveRerollRequest, Client)).ConfigureAwait(false);

            Tuple <UseItemMoveRerollResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, UseItemMoveRerollResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 19
0
        //https://github.com/AeonLucid/POGOProtos/blob/master/src/POGOProtos/Networking/Requests/RequestType.proto#L87
        public async Task <GetGymBadgeDetailsResponse> GetGymBadgeDetails(string fortId, double latitude, double longitude)
        {
            var GetGymBadgeDetailsRequest = new Request
            {
                RequestType    = RequestType.GetGymBadgeDetails,
                RequestMessage = ((IMessage) new GetGymBadgeDetailsMessage
                {
                    FortId = fortId,
                    Latitude = latitude,
                    Longitude = longitude
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(GetGymBadgeDetailsRequest, Client)).ConfigureAwait(false);

            Tuple <GetGymBadgeDetailsResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, GetGymBadgeDetailsResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 20
0
        public async Task <RecycleInventoryItemResponse> RecycleItem(ItemId itemId, int amount)
        {
            var recycleItemRequest = new Request
            {
                RequestType    = RequestType.RecycleInventoryItem,
                RequestMessage = ((IMessage) new RecycleInventoryItemMessage
                {
                    ItemId = itemId,
                    Count = amount
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(recycleItemRequest, Client)).ConfigureAwait(false);

            Tuple <RecycleInventoryItemResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, RecycleInventoryItemResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 21
0
        public async Task <SetFavoritePokemonResponse> SetFavoritePokemon(ulong pokemonId, bool isFavorite)
        {
            var setFavoritePokemonRequest = new Request
            {
                RequestType    = RequestType.SetFavoritePokemon,
                RequestMessage = ((IMessage) new SetFavoritePokemonMessage
                {
                    PokemonId = (long)pokemonId,
                    IsFavorite = isFavorite
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(setFavoritePokemonRequest, Client)).ConfigureAwait(false);

            Tuple <SetFavoritePokemonResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, SetFavoritePokemonResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 22
0
        public async Task <UseItemEncounterResponse> UseItemEncounter(ulong encounterId, ItemId itemId, string spawnPointId)
        {
            var useCaptureItemRequest = new Request
            {
                RequestType    = RequestType.UseItemEncounter,
                RequestMessage = ((IMessage) new UseItemEncounterMessage
                {
                    EncounterId = encounterId,
                    Item = itemId,
                    SpawnPointGuid = spawnPointId
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(useCaptureItemRequest, Client)).ConfigureAwait(false);

            Tuple <UseItemEncounterResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, UseItemEncounterResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 23
0
        public async Task <EncounterTutorialCompleteResponse> EncounterTutorialComplete(PokemonId pokemonId)
        {
            var encounterTutorialCompleteRequest = new Request
            {
                RequestType    = RequestType.EncounterTutorialComplete,
                RequestMessage = ((IMessage) new EncounterTutorialCompleteMessage
                {
                    PokemonId = pokemonId
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(encounterTutorialCompleteRequest, Client)).ConfigureAwait(false);

            Tuple <EncounterTutorialCompleteResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, EncounterTutorialCompleteResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 24
0
        public async Task <IncenseEncounterResponse> EncounterIncensePokemon(ulong encounterId, string encounterLocation)
        {
            var encounterIncensePokemonRequest = new Request
            {
                RequestType    = RequestType.IncenseEncounter,
                RequestMessage = ((IMessage) new IncenseEncounterMessage
                {
                    EncounterId = encounterId,
                    EncounterLocation = encounterLocation
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(encounterIncensePokemonRequest, Client)).ConfigureAwait(false);

            Tuple <IncenseEncounterResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, IncenseEncounterResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Send a parameter TRUE if you want to force real time invetory check
 /// </summary>
 /// <param name="forceRequest"></param>
 /// <returns></returns>
 public GetHoloInventoryResponse GetHoloInventory(bool forceRequest = false)
 {
     // forceRequest should be used never ()
     if (forceRequest)
     {
         CachedInventory = PostProtoPayload <Request, GetHoloInventoryResponse>(RequestType.GetHoloInventory, new GetHoloInventoryMessage());
     }
     return(CachedInventory);
 }
        public async Task <CatchPokemonResponse> CatchPokemon(ulong encounterId, string spawnPointGuid,
                                                              ItemId pokeballItemId, double normalizedRecticleSize = 1.950, double spinModifier = 1,
                                                              bool hitPokemon = true, double normalizedHitPos = 1)
        {
            var arPlusValues = new ARPlusEncounterValues();

            APIConfiguration.Logger.LogInfo("Using AR Bonus Values");
            arPlusValues.Awareness         = (float)0.000;
            arPlusValues.Proximity         = (float)0.000;
            arPlusValues.PokemonFrightened = false;

            var catchPokemonRequest = new Request
            {
                RequestType    = RequestType.CatchPokemon,
                RequestMessage = ((IMessage) new CatchPokemonMessage
                {
                    ArPlusValues = arPlusValues,
                    EncounterId = encounterId,
                    Pokeball = pokeballItemId,
                    SpawnPointId = spawnPointGuid,
                    HitPokemon = hitPokemon,
                    NormalizedReticleSize = normalizedRecticleSize,
                    SpinModifier = spinModifier,
                    NormalizedHitPosition = normalizedHitPos
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(catchPokemonRequest, Client)).ConfigureAwait(false);

            Tuple <CatchPokemonResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, CatchPokemonResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            return(response.Item1);
        }
Ejemplo n.º 27
0
        public async Task <ReleasePokemonResponse> TransferPokemon(ulong pokemonId)
        {
            if (GetPokemon(pokemonId) == null)
            {
                return new ReleasePokemonResponse()
                       {
                           Result = ReleasePokemonResponse.Types.Result.Success
                       }
            }
            ;

            var transferPokemonRequest = new Request
            {
                RequestType    = RequestType.ReleasePokemon,
                RequestMessage = ((IMessage) new ReleasePokemonMessage
                {
                    PokemonId = pokemonId
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(transferPokemonRequest, Client)).ConfigureAwait(false);

            Tuple <ReleasePokemonResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, ReleasePokemonResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            ReleasePokemonResponse releaseResponse = response.Item1;

            if (releaseResponse.Result == ReleasePokemonResponse.Types.Result.Success)
            {
                RemoveInventoryItem(GetPokemonHashKey(pokemonId));
            }

            return(releaseResponse);
        }
Ejemplo n.º 28
0
        public void MergeWith(GetHoloInventoryResponse update)
        {
            var delta = update.InventoryDelta;

            if (delta?.InventoryItems == null)
            {
                return;
            }

            foreach (var item in delta.InventoryItems)
            {
                AddRemoveOrUpdateItem(item);
            }

            OnInventoryUpdated?.Invoke();
        }
Ejemplo n.º 29
0
        public async Task <FortSearchResponse> SearchFort(string fortId, double fortLat, double fortLng)
        {
            var searchFortRequest = new Request
            {
                RequestType    = RequestType.FortSearch,
                RequestMessage = ((IMessage) new FortSearchMessage
                {
                    FortId = fortId,
                    FortLatitude = fortLat,
                    FortLongitude = fortLng,
                    PlayerLatitude = Client.CurrentLatitude,
                    PlayerLongitude = Client.CurrentLongitude
                }).ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(searchFortRequest, Client)).ConfigureAwait(false);

            Tuple <FortSearchResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, FortSearchResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            // Update LastMapObject to mark fort as being used
            foreach (MapCell mapCell in Client.Map.LastGetMapObjectResponse.MapCells)
            {
                var mapFort = mapCell.Forts.Where(x => x.Id == fortId).FirstOrDefault();
                if (mapFort != null && mapFort.Type == POGOProtos.Map.Fort.FortType.Checkpoint)
                {
                    mapFort.CooldownCompleteTimestampMs = DateTime.UtcNow.ToUnixTime() + 5 * 60 * 1000; // Cooldown is 5 minutes.
                    break;
                }
            }
            return(response.Item1);
        }
Ejemplo n.º 30
0
        public async Task <ReleasePokemonResponse> TransferPokemons(List <ulong> pokemonIds)
        {
            // Filter out all pokemons that don't exist and duplicates.
            pokemonIds = GetPokemons().Where(p => pokemonIds.Contains(p.Id)).Select(p => p.Id).Distinct().ToList();

            var message = new ReleasePokemonMessage();

            message.PokemonIds.AddRange(pokemonIds);

            var transferPokemonRequest = new Request
            {
                RequestType    = RequestType.ReleasePokemon,
                RequestMessage = message.ToByteString()
            };

            var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(transferPokemonRequest, Client)).ConfigureAwait(false);

            Tuple <ReleasePokemonResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, ReleasePokemonResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse,
                 CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false);

            CheckChallengeResponse checkChallengeResponse = response.Item2;

            CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse);

            GetHoloInventoryResponse getHoloInventoryResponse = response.Item4;

            CommonRequest.ProcessGetHoloInventoryResponse(Client, getHoloInventoryResponse);

            DownloadSettingsResponse downloadSettingsResponse = response.Item6;

            CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse);

            ReleasePokemonResponse releaseResponse = response.Item1;

            if (releaseResponse.Result == ReleasePokemonResponse.Types.Result.Success)
            {
                foreach (var pokemonId in pokemonIds)
                {
                    RemoveInventoryItem(GetPokemonHashKey(pokemonId));
                }
            }

            return(releaseResponse);
        }