Exemplo n.º 1
0
 public DiceState(int _goldPerGame, int _gameBalanceMin, int _gameBalanceMax, int _playerToActSeconds, int _maxNumberOfPlayers)
 {
     this.goldPerGame        = _goldPerGame;
     this.gameBalanceMin     = _gameBalanceMin;
     this.gameBalanceMax     = _gameBalanceMax;
     this.playerToActSeconds = _playerToActSeconds;
     this.maxNumberOfPlayers = _maxNumberOfPlayers;
     gdg  = new GameDiceGump(this);
     sdg  = new StatusDiceGump(this);
     cbg  = new CallBluffGump(this);
     edg  = new ExitDiceGump(this);
     ndgg = new NewDiceGameGump(this, 0);
     //setup timer to kick player if applicable, really only applies to frozen character when you log off.
     statusGumpTimer = Timer.DelayCall(TimeSpan.FromSeconds(15), new TimerCallback(StatusTimerCheck));
     // Register event disconnect handler
     EventSink.Disconnected += new DisconnectedEventHandler(EventSink_Disconnected);
     //register crashed handler. -- Not sure this will actually do anything, unless a save takes place before full crash
     EventSink.Crashed += new CrashedEventHandler(EventSink_ServerCrashed);
 }
Exemplo n.º 2
0
        /********************************** START OF PRIVATE FUNCTIONS *****************************/

        /**
         *      Sends a plyer waiting gump, create gumps with 3 status arrays
         */
        public void PlayerWaiting(MobileDiceStstatus mds, int currentPlayerIdx)
        {
            if (mds.getMobile().HasGump(typeof(StatusDiceGump)))
            {
                mds.getMobile().CloseGump(typeof(StatusDiceGump));
            }
            string[] playerNames     = this.GetPlayerNames();
            int[]    playerBalances  = this.GetPlayerBalances();
            int[]    playPrevRollIdx = this.GetPlayerPrevRollOrBluff();
            sdg = new StatusDiceGump(this, playerNames, playerBalances, playPrevRollIdx, currentPlayerIdx);
            try{
                bool success = mds.getMobile().SendGump(sdg);
                //check to make sure the status gump was actually sent, and use THIS as our dissconnect protection
                if (success == false)
                {
                    SendMessageAllPlayers("Player " + mds.getMobile().Name + " was disconnected");
                    RemovePlayer(mds.getMobile(), true);
                }
            }catch {
                SendMessageAllPlayers("Player " + mds.getMobile().Name + " was disconnected");
                RemovePlayer(mds.getMobile(), true);
            }
        }