public override void Initialize(IServer server)
 {
     singleton = this;
     server.SetHandler((short)CustomMasterServerMSG.tournamentRoundPreStarted, handlePreGameStarted);
     server.SetHandler((short)CustomMasterServerMSG.tournamentRoundStarted, handleRoundStarted);
     server.SetHandler((short)CustomMasterServerMSG.tournamentRoundForceWinner, handleForeceRoundWinner);
     server.SetHandler((short)CustomMasterServerMSG.tournamentRoundReconnectPlayer, handleReconnectPlayer);
 }
 public void handleCloseTournament(IPeer peer, string key)
 {
     if (currentPreTournaments.ContainsKey(key) == false)
     {
         AlbotRunningTournamentModule.handleCloseTournament(key);
         return;
     }
     closeTournament(currentPreTournaments[key], key);
 }
        public void handleStartTournament(IIncommingMessage rawMsg)
        {
            string roomID = rawMsg.AsString();

            if (currentPreTournaments.ContainsKey(roomID) == false)
            {
                rawMsg.Respond("Tried to start tournament " + roomID + ", but no such tournament exist", ResponseStatus.Error);
                return;
            }

            PreTournamentGame     preGame     = currentPreTournaments[roomID];
            RunningTournamentGame runningGame = null;

            if (preGame.startTournament(ref runningGame, rawMsg) == false)
            {
                return;
            }

            currentPreTournaments.Remove(roomID);
            AlbotRunningTournamentModule.addNewRunningGame(roomID, runningGame);
        }
 private string generateGameKey()
 {
     return(Msf.Helper.CreateRandomStringMatch(MasterServerConstants.KEY_LENGTH, (key) => { return currentPreTournaments.ContainsKey(key) || AlbotRunningTournamentModule.containsKey(key); }));
 }