Пример #1
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            int    btd = info.ButtonID;
            Mobile m   = state.Mobile;

            if (info.ButtonID == 1)
            {
                TextRelay entry = info.GetTextEntry(0);
                //parse out the text entry
                try{
                    int balance    = Banker.GetBalance(m);
                    int num        = int.Parse(entry.Text);
                    int maxGameBal = ds.getGameBalanceMax();
                    //take out the full amount of bank if applicable
                    if (num > balance)
                    {
                        num = balance;
                    }
                    //if its over the max size, set num to it

                    if (num > maxGameBal)
                    {
                        num = maxGameBal;
                        m.SendMessage("You entered more than the max of " + maxGameBal + " gp. on this table, you are buying in with the max instead.");
                    }
                    //check if they have minimum game balance
                    if (num >= ds.getGameBalanceMin())
                    {
                        //withdrawl
                        Banker.Withdraw(m, num);
                        ds.AddPlayer(m, num);
                    }
                    else
                    {
                        ds.ShowNewGameGump(m);
                        m.SendMessage("You did not enter a sufficient minimum amount to play,try again.");
                    }
                }catch {
                    m.Frozen = false;
                    m.SendMessage("You did not enter a amount of gold to play with, try again.");
                }
            }
            else if (info.ButtonID == 2)
            {
                m.Frozen = false;
                m.SendMessage("You decided not to play Liars Dice.");
            }
            else
            {
                state.Mobile.SendMessage("Illegal option selected");
            }
        }
Пример #2
0
        private static void DiceCommand_OnCommand(CommandEventArgs e)
        {
            Mobile m   = e.Mobile;
            int    val = Banker.GetBalance(e.Mobile);

            //make sure user has enough gold in bank
            if (val >= GAME_BALANCE_MIN)
            {
                ds.ShowNewGameGump(m);
            }
            else
            {
                e.Mobile.SendMessage("Sorry, but you must have at least " + GAME_BALANCE_MIN + " gold in your bank to play!");
            }
        }
Пример #3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(this.GetWorldLocation(), 2))
            {
                return;
            }
            int val = Banker.GetBalance(from);

            //make sure user has enough gold in bank
            if (val >= GAME_BALANCE_MIN)
            {
                from.Frozen = true;
                ds.ShowNewGameGump(from);
            }
            else
            {
                from.SendMessage("Sorry, but you must have at least " + GAME_BALANCE_MIN + " gold in your bank to play!");
            }
        }