// Start void Start() { // Player playerCommands = new ChatCommand <LobbyPlayer>[] { // practice new ChatCommand <LobbyPlayer>( @"^practice$", (player, args) => { if (!player.inMatch) { LobbyQueue.CreatePracticeMatch(player); } else { // Notify player ... } } ), // online new ChatCommand <LobbyPlayer>( @"^online$", (player, args) => { LobbyServer.SendSystemMessage(player, "Players online: " + LobbyPlayer.list.Count); } ) }; // VIP vipCommands = new ChatCommand <LobbyPlayer>[] { // list new ChatCommand <LobbyPlayer>( @"^list$", (player, args) => { LobbyServer.SendSystemMessage(player, "Town: " + LobbyTown.running.Count); LobbyServer.SendSystemMessage(player, "World: " + LobbyWorld.running.Count); LobbyServer.SendSystemMessage(player, "Arena: " + LobbyMatch.running.Count); LobbyServer.SendSystemMessage(player, "FFA: " + LobbyFFA.running.Count); } ) }; // Community Manager communityManagerCommands = new ChatCommand <LobbyPlayer>[] { // goto new ChatCommand <LobbyPlayer>( @"^goto ([^ ]+) (.*)$", (player, args) => { var serverType = ChatServer.GetServerType(args[0]); var mapName = args[1]; player.location = new PlayerLocation(mapName, serverType); } ), // moveToPlayer new ChatCommand <LobbyPlayer>( @"^moveToPlayer (.*)$", (player, args) => { var playerName = args[1]; LobbyGameDB.GetAccountIdByPlayerName(playerName, accountId => { if (accountId == null) { return; } PositionsDB.GetPosition(accountId, position => { if (position == null) { position = new PlayerPosition(); } LocationsDB.GetLocation(accountId, location => { if (location == null) { return; } // TODO: This is not 100% correct as it might get overwritten by the server PositionsDB.SetPosition(player.accountId, position); player.location = location; }); }); }); } ), }; // Game Master gameMasterCommands = new ChatCommand <LobbyPlayer>[] { // start new ChatCommand <LobbyPlayer>( @"^start ([^ ]+) (.*)$", (player, args) => { var serverType = ChatServer.GetServerType(args[0]); var mapName = args[1]; switch (serverType) { case ServerType.FFA: new LobbyFFA(mapName).Register(); break; case ServerType.Town: new LobbyTown(mapName).Register(); break; } } ), }; // Admin adminCommands = new ChatCommand <LobbyPlayer>[] { }; // Make this class listen to lobby events Lobby.AddListener(this); }