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

            if (info.ButtonID == 1)
            {
                int balance = Banker.GetBalance(from);
                if (balance >= m_Game.Dealer.MinBuyIn)
                {
                    try
                    {
                        buyInAmount = Convert.ToInt32((info.TextEntries[0]).Text);
                    }
                    catch
                    {
                        from.SendMessage(0x22, "Use numbers without commas to input your buy-in amount (ie 25000)");
                        return;
                    }

                    if (buyInAmount <= balance && buyInAmount >= m_Game.Dealer.MinBuyIn && buyInAmount <= m_Game.Dealer.MaxBuyIn)
                    {
                        PokerPlayer player = new PokerPlayer(from);
                        player.Gold = buyInAmount;
                        m_Game.AddPlayer(player);
                    }
                    else
                    {
                        from.SendMessage(0x22, "You may not join with that amount of gold. Minimum buy-in: " + Convert.ToString(m_Game.Dealer.MinBuyIn) +
                                         ", Maximum buy-in: " + Convert.ToString(m_Game.Dealer.MaxBuyIn));
                    }
                }
                else
                {
                    from.SendMessage(0x22, "You may not join with that amount of gold. Minimum buy-in: " + Convert.ToString(m_Game.Dealer.MinBuyIn) +
                                     ", Maximum buy-in: " + Convert.ToString(m_Game.Dealer.MaxBuyIn));
                }
            }
            else if (info.ButtonID == 2)
            {
                return;
            }
        }
Пример #2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from        = state.Mobile;
            int    buyInAmount = 0;

            // check for casting / combat

            if (from.Spell != null)
            {
                from.SendLocalizedMessage(1049616); // You are too busy to do that at the moment.
                return;
            }
            else if (from.Criminal)
            {
                from.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
                return;
            }
            else if (SpellHelper.CheckCombat(from, true))
            {
                from.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
                return;
            }
            else if (!SpellHelper.CheckTravel(from, TravelCheckType.RecallFrom))
            {
                from.SendLocalizedMessage(1019004); // You are not allowed to travel there.
                return;
            }

            if (info.ButtonID == 1)
            {
                int balance = Banker.GetBalance(from);
                if (balance >= m_Game.Dealer.MinBuyIn)
                {
                    try
                    {
                        buyInAmount = Convert.ToInt32((info.TextEntries[0]).Text);
                    }
                    catch
                    {
                        from.SendMessage(0x22, "Use numbers without commas to input your buy-in amount (ie 25000)");
                        return;
                    }

                    if (buyInAmount <= balance && buyInAmount >= m_Game.Dealer.MinBuyIn && buyInAmount <= m_Game.Dealer.MaxBuyIn)
                    {
                        PokerPlayer player = new PokerPlayer(from);
                        player.Gold = buyInAmount;
                        m_Game.AddPlayer(player);
                    }
                    else
                    {
                        from.SendMessage(0x22, "You may not join with that amount of gold. Minimum buy-in: " + Convert.ToString(m_Game.Dealer.MinBuyIn) +
                                         ", Maximum buy-in: " + Convert.ToString(m_Game.Dealer.MaxBuyIn));
                    }
                }
                else
                {
                    from.SendMessage(0x22, "You may not join with that amount of gold. Minimum buy-in: " + Convert.ToString(m_Game.Dealer.MinBuyIn) +
                                     ", Maximum buy-in: " + Convert.ToString(m_Game.Dealer.MaxBuyIn));
                }
            }
            else if (info.ButtonID == 2)
            {
                return;
            }
        }
Пример #3
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            try
            {
                if (state == null || info == null || m_Game == null || state.Mobile == null)
                {
                    return;
                }
                Mobile from = state.Mobile;

                if (from == null)
                {
                    return;
                }

                int buyInAmount;

                if (info.ButtonID != 1)
                {
                    return;
                }

                int balance = Banker.GetBalance(from, m_Game.TypeOfCurrency);

                if (balance < m_Game.Dealer.MinBuyIn)
                {
                    from.SendMessage(
                        0x22,
                        "You may not join with that amount of {0}. Minimum buy-in: {1:#,0}, Maximum buy-in: {2:#,0}",
                        (m_Game.Dealer.IsDonation ? "donation coins" : "gold"),
                        m_Game.Dealer.MinBuyIn,
                        m_Game.Dealer.MaxBuyIn);

                    return;
                }

                var t = info.GetTextEntry(3);

                if (t == null)
                {
                    return;
                }

                if (!Int32.TryParse(t.Text, out buyInAmount))
                {
                    from.SendMessage(0x22, "Use numbers without commas to input your buy-in amount (ie 25000)");
                    return;
                }

                if (m_Game.Dealer == null)
                {
                    return;
                }

                if (buyInAmount > balance || buyInAmount < m_Game.Dealer.MinBuyIn || buyInAmount > m_Game.Dealer.MaxBuyIn)
                {
                    from.SendMessage(
                        0x22,
                        "You may not join with that amount of {0}. Minimum buy-in: {1:#,0}, Maximum buy-in: {2:#,0}",
                        (m_Game.Dealer.IsDonation ? "donation coins" : "gold"),
                        m_Game.Dealer.MinBuyIn,
                        m_Game.Dealer.MaxBuyIn);

                    return;
                }

                if (m_Game != null)
                {
                    m_Game.AddPlayer(
                        new PokerPlayer(from)
                    {
                        Currency = buyInAmount
                    });
                }
            }
            catch { }
        }