Ejemplo n.º 1
0
        public GymBattleAttackResponse GymBattleAttack(string fortId, string battleId, List <BattleAction> battleActions,
                                                       BattleAction lastRetrievedAction, long timestampMs)
        {
            var message = new GymBattleAttackMessage
            {
                BattleId            = battleId,
                GymId               = fortId,
                LastRetrievedAction = lastRetrievedAction,
                PlayerLatDegrees    = Client.CurrentLatitude,
                PlayerLngDegrees    = Client.CurrentLongitude,
                AttackActions       = { battleActions },
                TimestampMs         = timestampMs //(long)(Utils.GetTime(true))
            };

            return(PostProtoPayloadCommonR <Request, GymBattleAttackResponse>(RequestType.GymBattleAttack, message).Result);
        }
Ejemplo n.º 2
0
        public async Task <GymBattleAttackResponse> GymBattleAttak(string fortId, string battleId, IEnumerable <BattleAction> battleActions,
                                                                   BattleAction lastRetrievedAction, long timestampMs)
        {
            var message = new GymBattleAttackMessage
            {
                BattleId            = battleId,
                GymId               = fortId,
                LastRetrievedAction = lastRetrievedAction,
                PlayerLatDegrees    = Client.CurrentLatitude,
                PlayerLngDegrees    = Client.CurrentLongitude,
                TimestampMs         = timestampMs,
                AttackActions       = { } // { battleActions }
            };

            message.AttackActions.AddRange(battleActions);

            var gymBattleAttackGymRequest = new Request
            {
                RequestType    = RequestType.GymBattleAttack,
                RequestMessage = message.ToByteString()
            };

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

            Tuple <GymBattleAttackResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetHoloInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response =
                await
                PostProtoPayload
                <Request, GymBattleAttackResponse, 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);
        }