public async Task<object> FindMore(dynamic args)
 {
     string str = (string)args.realm;
     long num = (long)args.matchId;
     RiotAccount riotAccount = JsApiService.AccountBag.Get(str);
     SpectateClient spectateClient = new SpectateClient(riotAccount.RealmId, riotAccount.Endpoints.Replay.PlatformId, ChampionNameData.NameToId, riotAccount.Endpoints.Replay.SpectateUri);
     GameDescription gameDescriptionAsync = await spectateClient.GetGameDescriptionAsync(num);
     object variable = new { Started = gameDescriptionAsync.StartTime, Featured = gameDescriptionAsync.FeaturedGame, Elo = gameDescriptionAsync.InterestScore, Ended = gameDescriptionAsync.GameEnded };
     return variable;
 }
 public async Task<object> StartChampionSelect(dynamic args)
 {
     GameDTO game = JsApiService.RiotAccount.Game;
     RiotAccount riotAccount = JsApiService.RiotAccount;
     object[] id = new object[] { game.Id, game.OptimisticLock };
     StartChampSelectDTO startChampSelectDTO = await riotAccount.InvokeAsync<StartChampSelectDTO>("gameService", "startChampionSelection", id);
     object variable = new { Success = startChampSelectDTO.InvalidPlayers.Count == 0, JoinFailures = startChampSelectDTO.InvalidPlayers.Select<FailedJoinPlayer, object>(new Func<FailedJoinPlayer, object>(RiotJsTransformer.TransformFailedJoinPlayer)).ToArray<object>() };
     return variable;
 }
 private async Task ProcessData(RiotAccount account, object obj)
 {
     bool flag;
     object[] objArray;
     long num2;
     SearchingForMatchNotification searchingForMatchNotification = obj as SearchingForMatchNotification;
     if (searchingForMatchNotification == null)
     {
         GameNotification gameNotification = obj as GameNotification;
         if (gameNotification == null)
         {
             GameDTO gameDTO = obj as GameDTO;
             if (gameDTO != null && gameDTO.StatusOfParticipants != null)
             {
                 char[] charArray = gameDTO.StatusOfParticipants.ToCharArray();
                 int[] array = (
                     from x in (IEnumerable<char>)charArray
                     select int.Parse(x.ToString(CultureInfo.InvariantCulture))).ToArray<int>();
                 if (gameDTO.GameState == "START_REQUESTED" || gameDTO.GameState == "IN_PROGRESS")
                 {
                     JsApiService.PushIfActive(account, "game:queue:done", null);
                 }
                 if (gameDTO.GameState != "JOINING_CHAMP_SELECT")
                 {
                     JsApiService.PushIfActive(account, "game:queue:dropped", null);
                 }
                 string gameState = gameDTO.GameState;
                 string str = gameState;
                 if (gameState != null)
                 {
                     if (str == "JOINING_CHAMP_SELECT")
                     {
                         JsApiService.PushIfActive(account, "game:queue:found", QueueNotificationService.GetAcceptDeclineStatus(gameDTO.StatusOfParticipants));
                     }
                     else if (str == "FAILED_TO_START" || str == "START_REQUESTED" || str == "IN_PROGRESS")
                     {
                         this.SetLeftQueue(account);
                     }
                     else if (str == "TERMINATED")
                     {
                         int num3 = 0;
                         var collection = gameDTO.TeamOne.Concat<IParticipant>(gameDTO.TeamTwo).Select((IParticipant x) => {
                             int[] cSu0024u003cu003e8_locals25 = array;
                             int num = num3;
                             int num1 = num;
                             num3 = num + 1;
                             return new { Participant = x as PlayerParticipant, Status = cSu0024u003cu003e8_locals25[num1] };
                         });
                         var array1 = (
                             from x in collection
                             where x.Participant != null
                             select x).ToArray();
                         var variable1 = array1;
                         var variable2 = "";
                         variable2 = null;
                         var variable2 = ((IEnumerable<<>f__AnonymousType14<PlayerParticipant, int>>)variable1).FirstOrDefault((x) => x.Participant.SummonerId == (double)account.SummonerId);
                         if (variable2 != null)
                         {
                             var variable3 = array1;
                             var hasValue = 
                                 from x in (IEnumerable<<>f__AnonymousType14<PlayerParticipant, int>>)variable3
                                 where x.Participant.TeamParticipantId.HasValue
                                 select x;
                             var teamParticipantId = 
                                 from x in hasValue
                                 group x by x.Participant.TeamParticipantId;
                             var list = 
                                 from x in teamParticipantId
                                 select x.ToList();
                             var lists = list;
                             var collection1 = lists.FirstOrDefault((g) => g.Any((x) => x.Participant.SummonerId == (double)account.SummonerId));
                             if (collection1 != null)
                             {
                                 var collection2 = collection1;
                                 if (!collection2.Any((x) => x.Status != 1))
                                 {
                                     goto Label2;
                                 }
                                 this.SetLeftQueue(account);
                                 var collection3 = collection1;
                                 var status = 
                                     from x in collection3
                                     where x.Status != 1
                                     select x;
                                 IEnumerable<string> summonerName = 
                                     from x in status
                                     select x.Participant.SummonerName;
                                 JsApiService.PushIfActive(account, "game:queue:acceptFail", summonerName);
                                 goto Label1;
                             }
                         Label2:
                            
                             if (variable2.Status != 1)
                             {
                                 this.SetLeftQueue(account);
                                 RiotAccount riotAccount = account;
                                 string[] strArrays = new string[] { account.SummonerName };
                                 JsApiService.PushIfActive(riotAccount, "game:queue:acceptFail", strArrays);
                             }
                         }
                         else
                         {
                             return;
                         }
                     }
                 }
             //Label1;
             }
         }
         else
         {
             string type = gameNotification.Type;
             string str1 = type;
             if (type != null && (str1 == "PLAYER_QUIT" || str1 == "TEAM_REMOVED" || str1 == "PLAYER_REMOVED"))
             {
                 string summonerNameBySummonerId = null;
                 if (long.TryParse(gameNotification.MessageArgument, out num2))
                 {
                     summonerNameBySummonerId = await JsApiService.GetSummonerNameBySummonerId(account.RealmId, num2);
                 }
                 this.SetLeftQueue(account);
                 if (!string.IsNullOrEmpty(summonerNameBySummonerId))
                 {
                     JsApiService.PushIfActive(account, "game:queue:leave", summonerNameBySummonerId);
                 }
             }
         }
     }
     else if (account == JsApiService.RiotAccount)
     {
         flag = (searchingForMatchNotification.JoinedQueues == null ? false : searchingForMatchNotification.JoinedQueues.Count > 0);
         if (flag)
         {
             QueueInfo queueInfo = searchingForMatchNotification.JoinedQueues.First<QueueInfo>();
             this.SetEnteredQueue(account, queueInfo.QueueId);
         }
         List<QueueInfo> joinedQueues = searchingForMatchNotification.JoinedQueues;
         IEnumerable<int> queueId = 
             from x in joinedQueues
             select x.QueueId;
         objArray = (searchingForMatchNotification.PlayerJoinFailures != null ? searchingForMatchNotification.PlayerJoinFailures.Select<FailedJoinPlayer, object>(new Func<FailedJoinPlayer, object>(RiotJsTransformer.TransformFailedJoinPlayer)).ToArray<object>() : new object[0]);
         var variable4 = new { JoinedQueues = queueId, JoinFailures = objArray };
         JsApiService.PushIfActive(account, "game:queue:joinStatus", variable4);
     }
     else
     {
         account.InvokeAsync<object>("matchmakerService", "purgeFromQueues");
     }
 }
 private async Task ProcessData(RiotAccount account, object obj)
 {
   SearchingForMatchNotification queue = obj as SearchingForMatchNotification;
   if (queue != null)
   {
     if (account != JsApiService.RiotAccount)
     {
       account.InvokeAsync<object>("matchmakerService", "purgeFromQueues");
     }
     else
     {
       if ((queue.JoinedQueues == null ? 0 : (queue.JoinedQueues.Count > 0 ? 1 : 0)) != 0)
         this.SetEnteredQueue(account, Enumerable.First<QueueInfo>((IEnumerable<QueueInfo>) queue.JoinedQueues).QueueId);
       var fAnonymousType13 = new
       {
         JoinedQueues = Enumerable.Select<QueueInfo, int>((IEnumerable<QueueInfo>) queue.JoinedQueues, (Func<QueueInfo, int>) (x => x.QueueId)),
         JoinFailures = queue.PlayerJoinFailures != null ? Enumerable.ToArray<object>(Enumerable.Select<FailedJoinPlayer, object>((IEnumerable<FailedJoinPlayer>) queue.PlayerJoinFailures, new Func<FailedJoinPlayer, object>(RiotJsTransformer.TransformFailedJoinPlayer))) : new object[0]
       };
       JsApiService.PushIfActive(account, "game:queue:joinStatus", (object) fAnonymousType13);
     }
   }
   else
   {
     GameNotification gameNotification = obj as GameNotification;
     if (gameNotification != null)
     {
       switch (gameNotification.Type)
       {
         case "PLAYER_QUIT":
         case "TEAM_REMOVED":
         case "PLAYER_REMOVED":
           string summonerName = (string) null;
           long summonerId;
           if (long.TryParse(gameNotification.MessageArgument, out summonerId))
             summonerName = await JsApiService.GetSummonerNameBySummonerId(account.RealmId, summonerId);
           this.SetLeftQueue(account);
           if (!string.IsNullOrEmpty(summonerName))
           {
             JsApiService.PushIfActive(account, "game:queue:leave", (object) summonerName);
             break;
           }
           else
             break;
       }
     }
     else
     {
       GameDTO game = obj as GameDTO;
       if (game != null && game.StatusOfParticipants != null)
       {
         int[] statuses = Enumerable.ToArray<int>(Enumerable.Select<char, int>((IEnumerable<char>) game.StatusOfParticipants.ToCharArray(), (Func<char, int>) (x => int.Parse(x.ToString((IFormatProvider) CultureInfo.InvariantCulture)))));
         if (game.GameState == "START_REQUESTED" || game.GameState == "IN_PROGRESS")
           JsApiService.PushIfActive(account, "game:queue:done", (object) null);
         if (game.GameState != "JOINING_CHAMP_SELECT")
           JsApiService.PushIfActive(account, "game:queue:dropped", (object) null);
         switch (game.GameState)
         {
           case "JOINING_CHAMP_SELECT":
             JsApiService.PushIfActive(account, "game:queue:found", (object) QueueNotificationService.GetAcceptDeclineStatus(game.StatusOfParticipants));
             break;
           case "FAILED_TO_START":
           case "START_REQUESTED":
           case "IN_PROGRESS":
             this.SetLeftQueue(account);
             break;
           case "TERMINATED":
             int idx = 0;
             \u003C\u003Ef__AnonymousType14<PlayerParticipant, int>[] source1 = Enumerable.ToArray(Enumerable.Where(Enumerable.Select(Enumerable.Concat<IParticipant>((IEnumerable<IParticipant>) game.TeamOne, (IEnumerable<IParticipant>) game.TeamTwo), x => new
             {
               Participant = x as PlayerParticipant,
               Status = statuses[idx++]
             }), x => x.Participant != null));
             var fAnonymousType14 = Enumerable.FirstOrDefault(source1, x => x.Participant.SummonerId == (double) account.SummonerId);
             if (fAnonymousType14 != null)
             {
               List<\u003C\u003Ef__AnonymousType14<PlayerParticipant, int>> source2 = Enumerable.FirstOrDefault<List<\u003C\u003Ef__AnonymousType14<PlayerParticipant, int>>>(Enumerable.Select<IGrouping<double?, \u003C\u003Ef__AnonymousType14<PlayerParticipant, int>>, List<\u003C\u003Ef__AnonymousType14<PlayerParticipant, int>>>(Enumerable.GroupBy(Enumerable.Where(source1, x => x.Participant.TeamParticipantId.HasValue), x => x.Participant.TeamParticipantId), x => Enumerable.ToList(x)), g => Enumerable.Any(g, x => x.Participant.SummonerId == (double) account.SummonerId));
               if (source2 != null && Enumerable.Any(source2, x => x.Status != 1))
               {
                 this.SetLeftQueue(account);
                 JsApiService.PushIfActive(account, "game:queue:acceptFail", (object) Enumerable.Select(Enumerable.Where(source2, x => x.Status != 1), x => x.Participant.SummonerName));
                 break;
               }
               else if (fAnonymousType14.Status != 1)
               {
                 this.SetLeftQueue(account);
                 JsApiService.PushIfActive(account, "game:queue:acceptFail", (object) new string[1]
                 {
                   account.SummonerName
                 });
                 break;
               }
               else
                 break;
             }
             else
               break;
         }
       }
     }
   }
 }
Esempio n. 5
0
 private async Task<object> GetPreviousRatings(string realm, long accountId)
 {
     RiotAccount riotAccount = JsApiService.AccountBag.Get(realm);
     AllPublicSummonerDataDTO allPublicSummonerDataDTO = await riotAccount.InvokeCachedAsync<AllPublicSummonerDataDTO>("summonerService", "getAllPublicSummonerDataByAccount", accountId);
     BasePublicSummonerDTO summoner = allPublicSummonerDataDTO.Summoner;
     
     var variable = new <>f__AnonymousType1a<int, string>[] { new { Season = 2, Tier = ProfileService.GetRatingTier(summoner.SeasonTwoTier) }, new { Season = 1, Tier = ProfileService.GetRatingTier(summoner.SeasonOneTier) } };
     return variable;
 }