コード例 #1
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                Mobile from = sender.Mobile;

                int i = 0, temp = 0;

                switch (info.ButtonID)
                {
                case 101:
                {                                 // deal
                    m_From.pokermsg = "";

                    if (!from.InRange(m_From.Location, 4))
                    {
                        m_From.roundend = true;
                        m_From.busy     = false;
                    }
                    else
                    {
                        if (m_From.roundend)
                        {
                            if (m_From.playerbet > 1000)
                            {
                                m_From.playerbet = 1000;
                            }

                            if (m_From.paydealer(from, m_From.playerbet))
                            {
                                m_From.dwin             = 0;
                                m_From.pwin             = 0;
                                m_From.roundend         = false;
                                m_From.dealercardhidden = true;
                                // clear dealer and player cards
                                for (i = 2; i <= 4; ++i)
                                {
                                    m_From.dealercards[i] = 0;
                                    m_From.playercards[i] = 0;
                                }
                                //pick card
                                m_From.dealercards[0] = m_From.pickcard(from);
                                m_From.playercards[0] = m_From.pickcard(from);
                                m_From.dealercards[1] = m_From.pickcard(from);
                                m_From.playercards[1] = m_From.pickcard(from);

                                if (m_From.CardValue(m_From.dealercards[0]) + m_From.CardValue(m_From.dealercards[1]) == 21)
                                {
                                    m_From.dbj = true;
                                }
                                else if (m_From.CardValue(m_From.playercards[1]) + m_From.CardValue(m_From.playercards[1]) == 21)
                                {
                                    m_From.pbj = true;
                                }
                                if (m_From.pbj)
                                {
                                    finishgame(from);
                                }
                            }
                            else
                            {
                                m_From.pokermsg = "You need more money!";
                            }
                        }
                        from.SendGump(new BlackjackGump(from, m_From));
                    }
                    break;
                }

                case 102:
                {                                 // hit
                    if (!m_From.roundend)
                    {
                        temp = 0;
                        for (i = 2; i <= 4; ++i)
                        {
                            if (m_From.playercards[i] == 0 && temp == 0)
                            {
                                m_From.playercards[i] = m_From.pickcard(from);
                                temp = i;
                                i    = 6;
                            }
                        }

                        if ((temp > 0 && playercardvalue() <= 21) && i != 5)
                        {
                            from.SendGump(new BlackjackGump(from, m_From));
                        }
                        else
                        {
                            finishgame(from);
                        }
                    }
                    else
                    {
                        from.SendGump(new BlackjackGump(from, m_From));
                    }
                    break;
                }

                case 103:
                {                                 //stand
                    if (!m_From.roundend)
                    {
                        finishgame(from);
                    }
                    else
                    {
                        from.SendGump(new BlackjackGump(from, m_From));
                    }
                    break;
                }

                case 104:
                {                                 //double down
                    if (!m_From.roundend)
                    {
                        temp = 0;
                        for (i = 0; i <= 4; ++i)
                        {
                            if (m_From.playercards[i] > 0)
                            {
                                temp++;
                            }
                        }

                        if (temp == 2 && m_From.paydealer(from, m_From.playerbet))
                        {
                            m_From.playerbet *= 2;
                        }

                        m_From.playercards[2] = m_From.pickcard(from);
                        finishgame(from);
                    }
                    else
                    {
                        from.SendGump(new BlackjackGump(from, m_From));
                    }
                    break;
                }

                case 105:
                {                                 // bet
                    if (m_From.roundend)
                    {
                        m_From.playerbet += 100;
                        if (m_From.playerbet > 1000)
                        {
                            m_From.playerbet = 100;
                        }
                    }
                    from.SendGump(new BlackjackGump(from, m_From));
                    break;
                }

                case 666:
                {                                 // quit
                    m_From.roundend = true;
                    m_From.busy     = false;
                    Effects.PlaySound(from.Location, from.Map, 0x1e9);
                    break;
                }
                }
            }
コード例 #2
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                Mobile from = sender.Mobile;
                int    i;

                switch (info.ButtonID)
                {
                case 101:
                {                                  //deal
                    m_From.pokermsg = "";

                    if (!from.InRange(m_From.Location, 4))
                    {
                        m_From.roundend = true;
                        m_From.busy     = false;
                    }
                    else
                    {
                        if (m_From.dwin == 0)
                        {
                            if (m_From.paydealer(from, m_From.playerbet))
                            {
                                if ((m_From.m_current_card + 10) > 52)
                                {
                                    Effects.PlaySound(from.Location, from.Map, 0x3D);
                                    m_From.ShuffleCards();
                                }

                                for (i = 0; i <= 4; ++i)
                                {
                                    m_From.playercards[i] = 0;
                                }
                                m_From.dwin     = 1;
                                m_From.roundend = false;
                                m_From.pokermsg = "Click on the cards you want re-dealt.";
                            }
                            else
                            {
                                m_From.pokermsg = "You need more money!";
                            }
                        }
                        else if (m_From.dwin == 2)
                        {
                            m_From.dwin = 3;

                            ArrayList Selections = new ArrayList(info.Switches);

                            for (i = 0; i <= 4; ++i)
                            {
                                if (Selections.Contains(i + 1) != false)
                                {
                                    m_From.playercards[i] = m_From.pickcard(from);
                                }
                            }
                            finishpokergame(from);
                        }
                    }
                    from.SendGump(new PokerGump(from, m_From));
                    break;
                }

                case 105:
                {                                 // bet
                    if (m_From.roundend)
                    {
                        m_From.playerbet += 100;
                        if (m_From.playerbet > 500)
                        {
                            m_From.playerbet = 100;
                        }
                    }
                    from.SendGump(new PokerGump(from, m_From));
                    break;
                }

                case 666:
                {                                 // quit
                    m_From.roundend = true;
                    m_From.busy     = false;
                    Effects.PlaySound(from.Location, from.Map, 0x1e9);
                    break;
                }
                }
            }