public void SetActive(RiotAccount account)
 {
   if (account != null && !this.accounts.Contains(account))
     throw new AccountNotFoundException("The specified account is not registered.");
   this.Active = account;
   this.FireActiveChanged(account);
 }
예제 #2
0
 public void FireActiveChanged(RiotAccount account)
 {
     if (this.ActiveChanged != null)
     {
         this.ActiveChanged(this, account);
     }
 }
 private static object TransformAccount(RiotAccount account)
 {
     if (account == null)
     {
         return null;
     }
     return new { Username = account.Username, Name = account.SummonerName, AccountId = account.AccountId, SummonerId = account.SummonerId, RealmId = account.RealmId, RealmName = account.RealmName, RealmFullName = account.RealmFullName, Handle = account.Handle, Active = account == JsApiService.AccountBag.Active, State = account.State, QueuePosition = account.QueuePosition, WaitingUntil = account.WaitingUntil, ErrorReason = account.ErrorReason };
 }
예제 #4
0
 public static async Task<GameService.JsGameMap[]> GetMaps(RiotAccount account)
 {
   GameMap[] maps = await account.InvokeCachedAsync<GameMap[]>("gameMapService", "getGameMapList", TimeSpan.FromDays(1.0));
   return Enumerable.ToArray<GameService.JsGameMap>((IEnumerable<GameService.JsGameMap>) Enumerable.OrderBy<GameService.JsGameMap, string>(Enumerable.Select<GameMap, GameService.JsGameMap>(Enumerable.Where<GameMap>((IEnumerable<GameMap>) maps, (Func<GameMap, bool>) (x => x.MapId != 4)), (Func<GameMap, GameService.JsGameMap>) (x => new GameService.JsGameMap()
   {
     Id = x.MapId,
     Name = GameService.TransformMapDisplayName(x.DisplayName),
     Players = x.TotalPlayers
   })), (Func<GameService.JsGameMap, string>) (x => x.Name)));
 }
 private async void OnData(RiotAccount account, object obj)
 {
     try
     {
         await this.ProcessData(account, obj);
     }
     catch
     {
     }
 }
 private async Task OnDataInternal(RiotAccount account, object message)
 {
   PlayerCredentialsDto gameConnectionCredentials = message as PlayerCredentialsDto;
   if (gameConnectionCredentials != null)
   {
     JsApiService.PushIfActive(account, "game:launch", (object) null);
     bool result = await GameMaestroService.TryStartGame(account.RealmId, gameConnectionCredentials);
     if (!result)
       JsApiService.Push("game:launch:fail", (object) null);
   }
 }
예제 #7
0
 public static UberChatClient Create(AccountConfig config, RiotAccount account)
 {
   Uri uri = new Uri(config.Endpoints.Chat.Uri);
   UberChatClient uberChatClient1 = new UberChatClient(account);
   uberChatClient1.Host = uri.Host;
   uberChatClient1.Port = uri.Port;
   uberChatClient1.Server = "pvp.net";
   uberChatClient1.Username = config.Username;
   uberChatClient1.Password = "******" + config.Password;
   UberChatClient uberChatClient2 = uberChatClient1;
   uberChatClient2.ConferenceServers.AddRange((IEnumerable<string>) config.Endpoints.Chat.Conference);
   return uberChatClient2;
 }
예제 #8
0
 public static UberChatClient Create(AccountConfig config, RiotAccount account)
 {
     Uri uri = new Uri(config.Endpoints.Chat.Uri);
     UberChatClient uberChatClient = new UberChatClient(account)
     {
         Host = uri.Host,
         Port = uri.Port,
         Server = "pvp.net",
         Username = config.Username,
         Password = string.Concat("AIR_", config.Password)
     };
     UberChatClient uberChatClient1 = uberChatClient;
     uberChatClient1.ConferenceServers.AddRange(config.Endpoints.Chat.Conference);
     return uberChatClient1;
 }
 private void CompleteJsGame(RiotAccount account, GameDTO game, RiotJsTransformer.JavascriptyGame jsGame)
 {
     if (game == null)
     {
         return;
     }
     GameTypeConfigDTO gameTypeConfigDTO = account.GameTypeConfigs.FirstOrDefault<GameTypeConfigDTO>((GameTypeConfigDTO x) => x.Id == (double)game.GameTypeConfigId);
     if (gameTypeConfigDTO == null)
     {
         return;
     }
     if (this.lastGameState != game.GameState || this.lastPickTurn != game.PickTurn)
     {
         this.lastGameState = game.GameState;
         this.lastPickTurn = game.PickTurn;
         string heroSelectState = jsGame.HeroSelectState;
         string str = heroSelectState;
         if (heroSelectState != null)
         {
             if (str == "pre")
             {
                 this.lastTurnDuration = (int)gameTypeConfigDTO.BanTimerDuration;
                 goto Label0;
             }
             else if (str == "pick")
             {
                 this.lastTurnDuration = (int)gameTypeConfigDTO.MainPickTimerDuration;
                 goto Label0;
             }
             else
             {
                 if (str != "post")
                 {
                     goto Label2;
                 }
                 this.lastTurnDuration = (int)gameTypeConfigDTO.PostPickTimerDuration;
                 goto Label0;
             }
         }
     Label2:
         this.lastTurnDuration = 0;
     Label0:
         this.lastTurnEnds = DateTime.UtcNow + TimeSpan.FromSeconds((double)this.lastTurnDuration);
     }
     jsGame.TurnDuration = this.lastTurnDuration;
     jsGame.TurnEnds = this.lastTurnEnds;
 }
 private async Task ImportMasteries(RiotAccount account)
 {
     string str;
     Func<MasteryBookPageDTO, string> func = (MasteryBookPageDTO page) => page.PageId.ToString(CultureInfo.InvariantCulture);
     MasteryBookDTO masteryBookDTO = await account.InvokeAsync<MasteryBookDTO>("masteryBookService", "getMasteryBook", account.SummonerId);
     MasteryBookDTO masteryBookDTO1 = masteryBookDTO;
     List<MasteryBookPageDTO> bookPages = masteryBookDTO1.BookPages;
     IOrderedEnumerable<MasteryBookPageDTO> pageId =
         from page in bookPages
         orderby page.PageId
         select page;
     IEnumerable<MasterySetup> talentEntries =
         from page in pageId
         let masteries =
             from x in page.TalentEntries
             select new Mastery()
             {
                 Id = x.TalentId,
                 Rank = x.Rank
             }
         select new MasterySetup()
         {
             Id = func(page),
             Name = page.Name,
             Masteries = masteries.ToArray<Mastery>()
         };
     List<MasteryBookPageDTO> masteryBookPageDTOs = masteryBookDTO1.BookPages;
     MasteryBookPageDTO masteryBookPageDTO = masteryBookPageDTOs.FirstOrDefault<MasteryBookPageDTO>((MasteryBookPageDTO x) => x.Current);
     if (masteryBookPageDTO != null)
     {
         str = func(masteryBookPageDTO);
     }
     else
     {
         str = null;
     }
     string str1 = str;
     LittleClient client = JsApiService.Client;
     object[] objArray = new object[] { "masteries", null };
     MasteryBook masteryBook = new MasteryBook()
     {
         ActiveId = str1,
         Setups = talentEntries.ToArray<MasterySetup>()
     };
     objArray[1] = masteryBook;
     await client.Invoke("storage.set", objArray);
 }
예제 #11
0
 public void Detach(RiotAccount account)
 {
   if (!this.accounts.Contains(account))
     return;
   if (account == this.Active)
     this.SetActive(Enumerable.FirstOrDefault<RiotAccount>((IEnumerable<RiotAccount>) this.accounts, (Func<RiotAccount, bool>) (x =>
     {
       if (x != account)
         return x.RealmId == account.RealmId;
       else
         return false;
     })) ?? Enumerable.FirstOrDefault<RiotAccount>((IEnumerable<RiotAccount>) this.accounts));
   account.CanConnect = false;
   this.accounts.Remove(account);
   account.Close();
   this.OnAccountRemoved(account);
 }
예제 #12
0
 public RiotAccount Attach(AccountConfig config)
 {
   RiotAccount riotAccount = Enumerable.FirstOrDefault<RiotAccount>((IEnumerable<RiotAccount>) this.accounts, (Func<RiotAccount, bool>) (x =>
   {
     if (x.Username == config.Username)
       return x.RealmId == config.RealmId;
     else
       return false;
   }));
   if (riotAccount != null)
     return riotAccount;
   RiotAccount account = new RiotAccount(config)
   {
     CanConnect = true
   };
   account.ConnectAsync();
   this.accounts.Add(account);
   this.OnAccountAdded(account);
   return account;
 }
예제 #13
0
 public void Detach(RiotAccount account)
 {
     if (!this.accounts.Contains(account))
     {
         return;
     }
     if (account == this.Active)
     {
         this.SetActive(this.accounts.FirstOrDefault<RiotAccount>((RiotAccount x) =>
         {
             if (x == account)
             {
                 return false;
             }
             return x.RealmId == account.RealmId;
         }) ?? this.accounts.FirstOrDefault<RiotAccount>());
     }
     account.CanConnect = false;
     this.accounts.Remove(account);
     account.Close();
     this.OnAccountRemoved(account);
 }
예제 #14
0
 public static async Task<GameService.JsGameMap[]> GetMaps(RiotAccount account)
 {
     GameMap[] gameMapArray = await account.InvokeCachedAsync<GameMap[]>("gameMapService", "getGameMapList", TimeSpan.FromDays(1));
     GameMap[] gameMapArray1 = gameMapArray;
     IEnumerable<GameMap> mapId =
         from x in (IEnumerable<GameMap>)gameMapArray1
         where x.MapId != 4
         select x;
     IEnumerable<GameService.JsGameMap> jsGameMap =
         from x in mapId
         select new GameService.JsGameMap()
         {
             Id = x.MapId,
             Name = GameService.TransformMapDisplayName(x.DisplayName),
             Players = x.TotalPlayers
         };
     GameService.JsGameMap[] array = (
         from x in jsGameMap
         orderby x.Name
         select x).ToArray<GameService.JsGameMap>();
     return array;
 }
예제 #15
0
 public RiotAccount Attach(AccountConfig config)
 {
     RiotAccount riotAccount = this.accounts.FirstOrDefault<RiotAccount>((RiotAccount x) =>
     {
         if (x.Username != config.Username)
         {
             return false;
         }
         return x.RealmId == config.RealmId;
     });
     if (riotAccount != null)
     {
         return riotAccount;
     }
     RiotAccount riotAccount1 = new RiotAccount(config)
     {
         CanConnect = true
     };
     riotAccount1.ConnectAsync();
     this.accounts.Add(riotAccount1);
     this.OnAccountAdded(riotAccount1);
     return riotAccount1;
 }
 private void SetLeftQueue(RiotAccount account)
 {
     account.Storage["queueId"] = -1;
     JsApiService.PushIfActive(account, "game:queue", -1);
     JsApiService.PushIfActive(account, "game:queue:done", null);
 }
 private string GetTimestamp(RiotAccount account, string type)
 {
   if (account != this.__account || type != this.__type)
     this.__timestamp = DateTime.UtcNow;
   this.__account = account;
   this.__type = type;
   return ((long) (this.__timestamp - UnixDateTime.Epoch).TotalMilliseconds).ToString((IFormatProvider) CultureInfo.InvariantCulture);
 }
 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 void SetEnteredQueue(RiotAccount account, int queueId)
 {
     account.Storage["queueId"] = queueId;
     JsApiService.PushIfActive(account, "game:queue", queueId);
 }
예제 #20
0
 private static void ClearRuneCache(RiotAccount account)
 {
     InventoryHelper.ClearRuneCache(account, account.SummonerId);
 }
예제 #21
0
 private static void ClearRuneCache(RiotAccount account, long summonerId)
 {
     account.RemoveCached<SpellBookDTO>("spellBookService", "getSpellBook", summonerId);
 }
예제 #22
0
 public static RiotJsTransformer.JavascriptyGame TransformGame(GameDTO game, RiotAccount account, long accountId)
 {
     RiotJsTransformer.JavascriptyPlayer championId;
     if (game == null)
     {
         return new RiotJsTransformer.JavascriptyGame()
         {
             State = "none"
         };
     }
     GameTypeConfigDTO gameTypeConfigDTO = account.GameTypeConfigs.FirstOrDefault<GameTypeConfigDTO>((GameTypeConfigDTO x) => x.Id == (double)game.GameTypeConfigId) ?? new GameTypeConfigDTO();
     List<BannedChampion> bannedChampions = game.BannedChampions ?? new List<BannedChampion>(0);
     var variable = new
     {
         TeamOne =
             from x in bannedChampions
             where x.TeamId == 100
             select x,
         TeamTwo =
             from x in bannedChampions
             where x.TeamId == 200
             select x
     };
     RiotJsTransformer.JavascriptyGame javascriptyGame = new RiotJsTransformer.JavascriptyGame()
     {
         RealmId = account.RealmId,
         MatchId = (long)game.Id,
         Name = game.Name.Trim(),
         State = GameJsApiService.GetGameState(game.GameState),
         HeroSelectState = GameJsApiService.GetGameHeroSelectState(game.GameState),
         TeamOne = RiotJsTransformer.ToTeam(accountId, variable.TeamOne, 1, game.TeamOne),
         TeamTwo = RiotJsTransformer.ToTeam(accountId, variable.TeamTwo, 2, game.TeamTwo),
         IsOwner = (game.OwnerSummary == null ? false : (long)game.OwnerSummary.AccountId == accountId),
         ConferenceJid = string.Concat(game.RoomName, ".pvp.net"),
         ConferencePassword = game.RoomPassword,
         TurnHash = RiotJsTransformer.GetTurnHash(game),
         GameTypeConfigName = gameTypeConfigDTO.Name,
         QueueName = game.QueueTypeName,
         Created = game.CreationTime,
         ExpiryTime = DateTime.UtcNow + TimeSpan.FromMilliseconds(game.ExpiryTime),
         MapId = game.MapId
     };
     RiotJsTransformer.JavascriptyGame javascriptyGame1 = javascriptyGame;
     Dictionary<string, RiotJsTransformer.JavascriptyPlayer> dictionary = (
         from x in javascriptyGame1.TeamOne.Members.Concat<RiotJsTransformer.JavascriptyPlayer>(javascriptyGame1.TeamTwo.Members)
         where x.InternalName != null
         select x).ToDictionary<RiotJsTransformer.JavascriptyPlayer, string, RiotJsTransformer.JavascriptyPlayer>((RiotJsTransformer.JavascriptyPlayer x) => x.InternalName, (RiotJsTransformer.JavascriptyPlayer x) => x);
     foreach (PlayerChampionSelectionDTO playerChampionSelection in game.PlayerChampionSelections)
     {
         if (!dictionary.TryGetValue(playerChampionSelection.SummonerInternalName, out championId))
         {
             continue;
         }
         int[] spell1Id = new int[] { (int)playerChampionSelection.Spell1Id, (int)playerChampionSelection.Spell2Id };
         championId.SpellIds = spell1Id;
         championId.ChampionId = playerChampionSelection.ChampionId;
         championId.SkinId = championId.ChampionId * 1000 + playerChampionSelection.SelectedSkinIndex;
     }
     foreach (RiotJsTransformer.JavascriptyPlayer realmId in
         from x in dictionary
         select x.Value)
     {
         realmId.RealmId = account.RealmId;
         if (!(javascriptyGame1.HeroSelectState == "post") && (!(realmId.PickState == "pending") || realmId.ChampionId <= 0))
         {
             continue;
         }
         realmId.PickState = "completed";
     }
     return javascriptyGame1;
 }
예제 #23
0
 private static void ClearMasteryCache(RiotAccount account, long summonerId)
 {
     account.RemoveCached<MasteryBookDTO>("masteryBookService", "getMasteryBook", summonerId);
     JsApiService.Client.Purge<MasteryBook>("storage.get", new object[] { "masteries" });
 }
예제 #24
0
 private string GetTimestamp(RiotAccount account, string type)
 {
     if (account != this.__account || type != this.__type)
     {
         this.__timestamp = DateTime.UtcNow;
     }
     this.__account = account;
     this.__type = type;
     TimeSpan _Timestamp = this.__timestamp - UnixDateTime.Epoch;
     return ((long)_Timestamp.TotalMilliseconds).ToString(CultureInfo.InvariantCulture);
 }
예제 #25
0
 public static RiotJsTransformer.JavascriptyGame TransformGame(GameDTO game, RiotAccount account)
 {
     return RiotJsTransformer.TransformGame(game, account, account.AccountId);
 }
 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;
         }
       }
     }
   }
 }
예제 #27
0
 public UberChatClient(RiotAccount account)
 {
     this.Account = account;
 }
 private string GetXmlStatus(RiotAccount account, string timestamp, string type)
 {
   GameDTO gameDto = account.Game ?? new GameDTO();
   PlayerChampionSelectionDTO championSelectionDto = Enumerable.FirstOrDefault<PlayerChampionSelectionDTO>((IEnumerable<PlayerChampionSelectionDTO>) (gameDto.PlayerChampionSelections ?? new List<PlayerChampionSelectionDTO>()), (Func<PlayerChampionSelectionDTO, bool>) (x => x.SummonerInternalName == account.SummonerInternalName)) ?? new PlayerChampionSelectionDTO();
   return string.Format("<body>  <profileIcon>532</profileIcon>  <level>30</level>  <wins>1</wins>  <leaves>0</leaves>  <odinWins>0</odinWins>  <odinLeaves>0</odinLeaves>  <queueType />  <rankedLosses>0</rankedLosses>  <rankedRating>0</rankedRating>  <tier>DIAMOND</tier>  <statusMsg></statusMsg>  <timeStamp>{0}</timeStamp>  <rankedLeagueName>Wintermint Dreamyland</rankedLeagueName>  <rankedLeagueDivision>I</rankedLeagueDivision>  <rankedLeagueTier>DIAMOND</rankedLeagueTier>  <rankedLeagueQueue>RANKED_SOLO_5x5</rankedLeagueQueue>  <isObservable>ALL</isObservable>  <gameQueueType>{1}</gameQueueType>  <skinname>{2}</skinname>  <gameStatus>{3}</gameStatus></body>", (object) timestamp, string.IsNullOrEmpty(gameDto.QueueTypeName) ? (object) "NONE" : (object) gameDto.QueueTypeName, (object) ChampionNameData.GetLegacyChampionClientNameOrSoraka(championSelectionDto.ChampionId), (object) StringExtensions.Camelize(type));
 }
예제 #29
0
 private string GetXmlStatus(RiotAccount account, string timestamp, string type)
 {
     GameDTO game = account.Game ?? new GameDTO();
     List<PlayerChampionSelectionDTO> playerChampionSelections = game.PlayerChampionSelections ?? new List<PlayerChampionSelectionDTO>();
     PlayerChampionSelectionDTO playerChampionSelectionDTO = playerChampionSelections.FirstOrDefault<PlayerChampionSelectionDTO>((PlayerChampionSelectionDTO x) => x.SummonerInternalName == account.SummonerInternalName) ?? new PlayerChampionSelectionDTO();
     object[] legacyChampionClientNameOrSoraka = new object[] { timestamp, null, null, null };
     legacyChampionClientNameOrSoraka[1] = (string.IsNullOrEmpty(game.QueueTypeName) ? "NONE" : game.QueueTypeName);
     legacyChampionClientNameOrSoraka[2] = ChampionNameData.GetLegacyChampionClientNameOrSoraka(playerChampionSelectionDTO.ChampionId);
     legacyChampionClientNameOrSoraka[3] = type.Camelize();
     return string.Format("<body>  <profileIcon>532</profileIcon>  <level>30</level>  <wins>1</wins>  <leaves>0</leaves>  <odinWins>0</odinWins>  <odinLeaves>0</odinLeaves>  <queueType />  <rankedLosses>0</rankedLosses>  <rankedRating>0</rankedRating>  <tier>DIAMOND</tier>  <statusMsg></statusMsg>  <timeStamp>{0}</timeStamp>  <rankedLeagueName>Wintermint Dreamyland</rankedLeagueName>  <rankedLeagueDivision>I</rankedLeagueDivision>  <rankedLeagueTier>DIAMOND</rankedLeagueTier>  <rankedLeagueQueue>RANKED_SOLO_5x5</rankedLeagueQueue>  <isObservable>ALL</isObservable>  <gameQueueType>{1}</gameQueueType>  <skinname>{2}</skinname>  <gameStatus>{3}</gameStatus></body>", legacyChampionClientNameOrSoraka);
 }
예제 #30
0
 public void OnAccountRemoved(RiotAccount account)
 {
     if (this.AccountRemoved != null)
     {
         account.StateChanged -= new EventHandler<StateChangedEventArgs>(this.AccountOnStateChanged);
         this.AccountRemoved(this, account);
     }
 }