private void MakeMatchSubType(GameSubType subType) { TeamCompositionRules composition = subType.TeamComposition; List <LobbyServerConnection> availablePlayers = new List <LobbyServerConnection>(Players); LobbyTeamInfo teamInfo = new LobbyTeamInfo() { TeamPlayerInfo = new List <LobbyPlayerInfo>() }; if ( FillTeam(Team.TeamA, composition, subType.TeamAPlayers, subType.TeamABots, ref availablePlayers, ref teamInfo) && FillTeam(Team.TeamB, composition, subType.TeamBPlayers, subType.TeamBBots, ref availablePlayers, ref teamInfo) ) { for (int i = 0; i < teamInfo.TeamPlayerInfo.Count; i++) { teamInfo.TeamPlayerInfo[i].PlayerId = i + 1; teamInfo.TeamPlayerInfo[i].ControllingPlayerId = i + 1; // must be non-zero for players because 0 has a special use if (!teamInfo.TeamPlayerInfo[i].IsNPCBot) { } } LobbyGameConfig gameConfig = QueueInfo.GameConfig.Clone(); gameConfig.RoomName = GenerateRoomName(); gameConfig.Map = subType.GameMapConfigs[new Random().Next(0, subType.GameMapConfigs.Count - 1)].Map; LobbyGameInfo gameInfo = new LobbyGameInfo() { GameConfig = gameConfig, AcceptedPlayers = teamInfo.TotalPlayerCount, ActiveSpectators = 0, AcceptTimeout = TimeSpan.FromSeconds(30), CreateTimestamp = DateTime.Now.Ticks, GameResult = GameResult.NoResult, GameServerAddress = "ws://127.0.0.1:6061", GameStatus = GameStatus.Launched, GameServerHost = gameConfig.RoomName, GameServerProcessCode = null, LoadoutSelectTimeout = EvoSGameConfig.LoadoutSelectTimeout, IsActive = true, LoadoutSelectionStartTimestamp = DateTime.Now.Ticks, SelectionStartTimestamp = DateTime.Now.Ticks, SelectedBotSkillTeamA = BotDifficulty.Medium, SelectedBotSkillTeamB = BotDifficulty.Medium, SelectionSubPhase = FreelancerResolutionPhaseSubType.UNDEFINED, SelectionSubPhaseStartTimestamp = DateTime.Now.Ticks, SelectTimeout = TimeSpan.FromSeconds(20), UpdateTimestamp = DateTime.Now.Ticks }; if (GameType == GameType.Practice) { gameInfo.AcceptTimeout = TimeSpan.Zero; } Log.Print(LogType.Debug, "Removing players from queue..."); foreach (LobbyPlayerInfo player in teamInfo.TeamPlayerInfo) { if (!player.IsNPCBot) { //Log.Print(LogType.Debug, $"found player {player.Handle}"); for (int i = 0; i < Players.Count; i++) { /*if (Players[i].PlayerInfo.GetAccountId() == player.AccountId) * { * RemovePlayer(Players[i]); * break; * }*/ } } } try { LobbyQueueManager.CreateGame(gameInfo, teamInfo); } catch (Exception) { throw new EvosException("Error on LobbyQueueManager.CreateGame"); } } }
//Takes the game sub type and returns the name as a string public static string gameTypeName(GameSubType gamesubType) { switch (gamesubType) { case GameSubType.None: return("Custom Game"); case GameSubType.Normal: return("Normal"); case GameSubType.Normal3x3: return("Normal 3v3"); case GameSubType.OdinUnranked: return("Dominion"); case GameSubType.AramUnranked5x5: return("ARAM"); case GameSubType.Bot: return("Co-op vs AI"); case GameSubType.Bot3x3: return("Co-op vs AI 3v3"); case GameSubType.RankedSolo5x5: return("Ranked Solo"); case GameSubType.RankedTeam3x3: return("Ranked Teams 3v3"); case GameSubType.RankedTeam5x5: return("Ranked Teams 5v5"); case GameSubType.OneForAll5x5: return("One For All"); case GameSubType.FirstBlood1x1: return("Snowdown Showdown 1v1"); case GameSubType.FirstBlood2x2: return("Snowdown Showdown 2v2"); case GameSubType.SR_6x6: return("Summoners Rift 6v6"); case GameSubType.TeamBuilder5x5: return("Team Builder 5v5"); case GameSubType.URF: return("Ultra Rapid Fire"); case GameSubType.URFBots: return("URF vs AI"); case GameSubType.NightmareBot: return("Nightmate Mode"); case GameSubType.Ascension: return("Ascension"); case GameSubType.Hexakill: return("Hexakill"); case GameSubType.KingPoro: return("Poro King"); case GameSubType.CounterPick: return("Nemesis Draft"); case GameSubType.Bilgewater: return("Black Market Brawlers"); case GameSubType.NexusSiege: return("Nexus Siege"); } return(""); }