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); }
/** * Shows new game gump */ public void ShowNewGameGump(Mobile m) { while (m.HasGump(typeof(NewDiceGameGump))) { m.CloseGump(typeof(NewDiceGameGump)); } //only allow if more than number of player if (this.playerCnt < this.maxNumberOfPlayers) { ndgg = new NewDiceGameGump(this, Banker.GetBalance(m)); try{ m.SendGump(ndgg); }catch { SendMessageAllPlayers("Player " + m.Name + " was disconnected"); RemovePlayer(m, true); } } else { m.Frozen = false; m.SendMessage("Liars Dice is currently at it maximum capacity of " + this.maxNumberOfPlayers + " players, try again later."); } }