Exemplo n.º 1
0
 /// 26.)
 public void GetTeamEndOfGameStats(TeamId arg0, Double arg1, EndOfGameStats.Callback callback)
 {
     EndOfGameStats cb = new EndOfGameStats(callback);
     InvokeWithCallback("playerStatsService", "getTeamEndOfGameStats", new object[] { arg0.GetBaseTypedObject(), arg1 }, cb);
 }
Exemplo n.º 2
0
 public async Task<EndOfGameStats> GetTeamEndOfGameStats(TeamId arg0, Double arg1)
 {
     int Id = Invoke("playerStatsService", "getTeamEndOfGameStats", new object[] { arg0.GetBaseTypedObject(), arg1 });
     while (!results.ContainsKey(Id))
         await Task.Delay(10);
     TypedObject messageBody = results[Id].GetTO("data").GetTO("body");
     EndOfGameStats result = new EndOfGameStats(messageBody);
     results.Remove(Id);
     return result;
 }
Exemplo n.º 3
0
 public async void connection_OnMessageReceived(object sender, object message)
 {
     if (message is GameDTO)
     {
         GameDTO game = message as GameDTO;
         switch (game.GameState)
         {
             case "CHAMP_SELECT":
                 firstTimeInCustom = true;
                 firstTimeInQueuePop = true;
                 if (firstTimeInLobby)
                 {
                     firstTimeInLobby = false;
                     updateStatus("In Champion Select", Accountname);
                     await connection.SetClientReceivedGameMessage(game.Id, "CHAMP_SELECT_CLIENT");
                     if (queueType != QueueTypes.ARAM)
                     {
                         if (Core.championId != "")
                         {
                             await connection.SelectChampion(Enums.championToId(Core.championId));
                             await connection.ChampionSelectCompleted();
                         }
                         else
                         {
                             await connection.SelectChampion(availableChampsArray.First(champ => champ.Owned || champ.FreeToPlay).ChampionId);
                             await connection.ChampionSelectCompleted();
                         }
                     }
                     break;
                 }
                 else
                     break;
             case "POST_CHAMP_SELECT":
                 firstTimeInLobby = false;
                 updateStatus("(Post Champ Select)", Accountname);
                 break;
             case "PRE_CHAMP_SELECT":
                 updateStatus("(Pre Champ Select)", Accountname);
                 break;
             case "GAME_START_CLIENT":
                 updateStatus("Game client ran", Accountname);
                 break;
             case "GameClientConnectedToServer":
                 updateStatus("Client connected to the server", Accountname);
                 break;
             case "IN_QUEUE":
                 updateStatus("In Queue", Accountname);
                 break;
             case "TERMINATED":
                 updateStatus("Re-entering queue", Accountname);
                 firstTimeInQueuePop = true;
                 break;
             case "JOINING_CHAMP_SELECT":
                 if (firstTimeInQueuePop)
                 {
                     updateStatus("Queue popped", Accountname);
                     if (game.StatusOfParticipants.Contains("1"))
                     {
                         updateStatus("Accepted Queue", Accountname);
                         firstTimeInQueuePop = false;
                         firstTimeInLobby = true;
                         await connection.AcceptPoppedGame(true);
                     }
                 }
                 break;
         }
     }
     else if (message is PlayerCredentialsDto)
     {
         PlayerCredentialsDto dto = message as PlayerCredentialsDto;
         if (!HasLaunchedGame)
         {
             HasLaunchedGame = true;
             new Thread((ThreadStart)(() =>
             {
                 LaunchGame(dto);
                 Thread.Sleep(3000);
             })).Start();
         }
     }
     else if (!(message is GameNotification) && !(message is SearchingForMatchNotification))
     {
         if (message is EndOfGameStats)
         {
             MatchMakerParams matchParams = new MatchMakerParams();
             //Set BotParams
             if (queueType == QueueTypes.INTRO_BOT)
             {
                 matchParams.BotDifficulty = "INTRO";
             }
             else if (queueType == QueueTypes.BEGINNER_BOT)
             {
                 matchParams.BotDifficulty = "EASY";
             }
             else if (queueType == QueueTypes.MEDIUM_BOT)
             {
                 matchParams.BotDifficulty = "MEDIUM";
             }
             //Check if is available to join queue.
             if (sumLevel == 3 && actualQueueType == QueueTypes.NORMAL_5x5)
             {
                 queueType = actualQueueType;
             }
             else if (sumLevel == 6 && actualQueueType == QueueTypes.ARAM)
             {
                 queueType = actualQueueType;
             }
             else if (sumLevel == 7 && actualQueueType == QueueTypes.NORMAL_3x3)
             {
                 queueType = actualQueueType;
             }
             matchParams.QueueIds = new Int32[1] { (int)queueType };
             SearchingForMatchNotification m = await connection.AttachToQueue(matchParams);
             if (m.PlayerJoinFailures == null)
             {
                 updateStatus("In Queue: " + queueType.ToString(), Accountname);
             }
             else
             {
                 updateStatus("Couldn't enter Queue! >.<", Accountname);
             }
         }
         else
         {
             if (message.ToString().Contains("EndOfGameStats"))
             {
                 EndOfGameStats eog = new EndOfGameStats();
                 connection_OnMessageReceived(sender, eog);
                 exeProcess.Kill();
                 loginPacket = await this.connection.GetLoginDataPacketForUser();
                 archiveSumLevel = sumLevel;
                 sumLevel = loginPacket.AllSummonerData.SummonerLevel.Level;
                 if (sumLevel != archiveSumLevel)
                 {
                     levelUp();
                 }
             }
         }
     }
 }