Exemplo n.º 1
0
        async void CreatePracticeGame()
        {
            LoLLauncher.RiotObjects.Platform.Game.PracticeGameConfig cfg = new LoLLauncher.RiotObjects.Platform.Game.PracticeGameConfig();
            cfg.GameName = "thelawkings" + new Random().Next().ToString();
            LoLLauncher.RiotObjects.Platform.Game.Map.GameMap map = new LoLLauncher.RiotObjects.Platform.Game.Map.GameMap();
            map.Description      = "DUBLEBERTAN";
            map.DisplayName      = "DUBLEBERTAN";
            map.TotalPlayers     = 2;
            map.Name             = "dummy";
            map.MapId            = (int)GameMode.TwistedTreeline;
            map.MinCustomPlayers = 1;
            cfg.GameMap          = map;
            cfg.MaxNumPlayers    = 6;
            cfg.GamePassword     = "******";
            cfg.GameTypeConfig   = 1;
            cfg.AllowSpectators  = "NONE";
            cfg.GameMode         = StringEnum.GetStringValue(GameMode.TwistedTreeline);
            Thread.Sleep(TimeSpan.FromMilliseconds((double)1000 * 20));
            if (!m_disposed)
            {
                GameDTO game = await connection.CreatePracticeGame(cfg);

                if (game.Id == 0)
                {
                    Logger.Push("Game failed to create", "warning", username);
                }
                else
                {
                    Logger.Push("Game (" + game.Id + ") created.", "info", username);
                }
            }
        }
Exemplo n.º 2
0
        async void CreatePracticeGame()
        {
            this.updateStatus("Looking for HFL games", Accountname);
            PracticeGameSearchResult[] gameList = await connection.ListAllPracticeGames();

            dynamic gameFound = gameList.FirstOrDefault(_ => (_.Name.Contains("thelawkings") && (_.Team1Count < 3 || _.Team2Count < 3)));

            if (gameFound != null)
            {
                this.updateStatus("Joining to custom game", Accountname);
                await connection.JoinGame(gameFound.Id, "hflthelawtheking");
            }
            else
            {
                this.updateStatus("Creating custom game", Accountname);
                LoLLauncher.RiotObjects.Platform.Game.PracticeGameConfig cfg = new LoLLauncher.RiotObjects.Platform.Game.PracticeGameConfig();
                cfg.GameName = "thelawkings" + new Random().Next().ToString();
                LoLLauncher.RiotObjects.Platform.Game.Map.GameMap map = new LoLLauncher.RiotObjects.Platform.Game.Map.GameMap();
                map.Description      = "desc";
                map.DisplayName      = "dummy";
                map.TotalPlayers     = 2;
                map.Name             = "dummy";
                map.MapId            = (int)GameMode.TwistedTreeline;
                map.MinCustomPlayers = 1;
                cfg.GameMap          = map;
                cfg.MaxNumPlayers    = 6;
                cfg.GamePassword     = "******";
                cfg.GameTypeConfig   = 1;
                cfg.AllowSpectators  = "NONE";
                cfg.GameMode         = StringEnum.GetStringValue(GameMode.TwistedTreeline);
                GameDTO game = await connection.CreatePracticeGame(cfg);

                if (game.Id == 0)
                {
                    CreatePracticeGame();
                }
                else
                {
                    this.updateStatus("Game (" + game.Id + ") created.", Accountname);
                }
            }
        }
Exemplo n.º 3
0
 public async Task<GameDTO> CreatePracticeGame(PracticeGameConfig practiceGameConfig)
 {
     int Id = Invoke("gameService", "createPracticeGame", new object[] { practiceGameConfig.GetBaseTypedObject() });
     while (!results.ContainsKey(Id))
         await Task.Delay(10);
     TypedObject messageBody = results[Id].GetTO("data").GetTO("body");
     GameDTO result = new GameDTO(messageBody);
     results.Remove(Id);
     return result;
 }
Exemplo n.º 4
0
 /// 46.)
 public void CreatePracticeGame(PracticeGameConfig practiceGameConfig, GameDTO.Callback callback)
 {
     GameDTO cb = new GameDTO(callback);
     InvokeWithCallback("gameService", "createPracticeGame", new object[] { practiceGameConfig.GetBaseTypedObject() }, cb);
 }