Example #1
0
            public BlackjackGump(Mobile mobile, Gambler gambler)
                : base(10, 10)
            {
                m_From = gambler;

                int    i, dealervalue = 0, temp = 0;
                string cardtemp, scoredmsg, scorepmsg;

                Closable = false;

                AddPage(0);

                AddImageTiled(30, 100, 460, 280, 2624);
                AddAlphaRegion(90, 100, 460, 230);

                AddLabel(35, 109, 1500, "Dealer:");
                AddLabel(35, 229, 600, "Player:");

                if (m_From.dwin > 0)
                {
                    AddLabel(45, 129, 70, "" + m_From.dwin);
                }

                if (m_From.pwin > 0)
                {
                    AddLabel(45, 249, 70, "" + m_From.pwin);
                }

                AddButton(40, 333, 2117, 2118, 101, GumpButtonType.Reply, 0);
                AddLabel(60, 330, 800, "Deal");

                AddButton(150, 333, 2117, 2118, 102, GumpButtonType.Reply, 0);
                AddLabel(170, 330, 800, "Hit");

                AddButton(200, 333, 2117, 2118, 103, GumpButtonType.Reply, 0);
                AddLabel(220, 330, 800, "Stand");

                AddButton(280, 333, 2117, 2118, 104, GumpButtonType.Reply, 0);
                AddLabel(300, 330, 800, "Double Down");

                AddButton(90, 333, 2117, 2118, 105, GumpButtonType.Reply, 0);
                AddButton(33, 363, 3, 4, 666, GumpButtonType.Reply, 0);

                //show dealer cards
                for (i = 0; i <= 4; ++i)
                {
                    temp = m_From.dealercards[i];
                    if (temp > 0)
                    {
                        if (!m_From.dealercardhidden || (m_From.dealercardhidden && i > 0))
                        {
                            if (NewCards)
                            {
                                AddImage(25 + ((i + 1) * 75), 110, 4095 + temp);
                            }
                            else
                            {
                                cardtemp = m_From.CardSuit(temp);                                   //129
                                AddBackground(65 + ((i + 1) * 40), 110, 35, 50, 2171);
                                AddLabel(80 + ((i + 1) * 40), 136, m_From.cardcolor(cardtemp), cardtemp);
                                AddLabel(72 + ((i + 1) * 40), 115, 1500, m_From.CardName(temp));
                            }

                            dealervalue += m_From.CardValue(temp);
                        }
                        else
                        {
                            if (NewCards)
                            {
                                AddImage(25 + ((i + 1) * 75), 110, 4154);
                            }
                            else
                            {
                                AddBackground(65 + ((i + 1) * 40), 110, 35, 50, 2171);
                            }
                        }
                    }
                }

                //show player cards
                for (i = 0; i <= 4; ++i)
                {
                    temp = m_From.playercards[i];

                    if (temp > 0)
                    {
                        if (NewCards)
                        {
                            AddImage(25 + ((i + 1) * 75), 230, 4095 + temp);
                        }
                        else
                        {
                            cardtemp = m_From.CardSuit(temp);
                            AddBackground(65 + ((i + 1) * 40), 230, 35, 50, 2171);
                            AddLabel(80 + ((i + 1) * 40), 256, m_From.cardcolor(cardtemp), cardtemp);
                            AddLabel(72 + ((i + 1) * 40), 235, 600, m_From.CardName(temp));
                        }
                    }
                }

                AddLabel(110, 330, 800, "" + m_From.playerbet);

                if (!m_From.dealercardhidden)
                {
                    dealervalue = dealercardvalue();
                }

                if (m_From.CardValue(m_From.dealercards[0]) + m_From.CardValue(m_From.dealercards[1]) == 21 && !m_From.dealercardhidden)
                {
                    scoredmsg = "BJ";
                }
                else
                {
                    scoredmsg = dealervalue.ToString();
                }

                if (m_From.CardValue(m_From.playercards[1]) + m_From.CardValue(m_From.playercards[1]) == 21)
                {
                    scorepmsg = "BJ";
                }
                else
                {
                    scorepmsg = playercardvalue().ToString();
                }

                AddLabel(63, 155, 1500, "" + scoredmsg);
                AddLabel(63, 274, 600, "" + scorepmsg);
                AddLabel(100, 350, 64, m_From.pokermsg);
            }
Example #2
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;
                }
                }
            }
Example #3
0
		public BlackjackGump( Mobile mobile, Gambler gambler ) : base( 10, 10 )
		{

			m_From = gambler;

			int i,dealervalue=0,temp=0;
			string cardtemp, scoredmsg, scorepmsg;

			Closable = false;

			AddPage( 0 );

			AddImageTiled( 30, 100, 460, 280, 2624 );
			AddAlphaRegion( 90, 100, 460, 230 );

			AddLabel( 35, 109, 1500, "Dealer:" );
			AddLabel( 35, 229, 600, "Player:" );

			if (m_From.dwin>0)
				AddLabel( 45, 129, 70, ""+m_From.dwin );

			if (m_From.pwin>0)
				AddLabel( 45, 249, 70, ""+m_From.pwin );

			AddButton(  40, 333, 2117, 2118, 101, GumpButtonType.Reply, 0 );
			AddLabel(  60, 330, 800, "Deal" );

			AddButton( 150, 333, 2117, 2118, 102, GumpButtonType.Reply, 0 );
			AddLabel( 170, 330, 800, "Hit" );

			AddButton( 200, 333, 2117, 2118, 103, GumpButtonType.Reply, 0 );
			AddLabel( 220, 330, 800, "Stand" );

			AddButton( 280, 333, 2117, 2118, 104, GumpButtonType.Reply, 0 );
			AddLabel( 300, 330, 800, "Double Down" );

			AddButton(  90, 333, 2117, 2118, 105, GumpButtonType.Reply, 0 );
			AddButton( 33, 363, 3, 4, 666, GumpButtonType.Reply, 0 );

			//show dealer cards
			for ( i = 0; i <= 4; ++i )
			{
				temp = m_From.dealercards[i];
				if (temp>0)
				{
					if (!m_From.dealercardhidden || (m_From.dealercardhidden && i>0))
					{
					    if (NewCards)
						AddImage ( 25 + ((i+1)*75), 110, 4095+temp);
					    else
					    {
						cardtemp = m_From.CardSuit( temp ); //129
						AddBackground( 65 + ((i+1)*40), 110, 35, 50, 2171 );
						AddLabel( 80 + ((i+1)*40), 136, m_From.cardcolor( cardtemp ), cardtemp );
						AddLabel( 72 + ((i+1)*40), 115, 1500, m_From.CardName( temp ) );
					    }

						dealervalue += m_From.CardValue( temp );
					}
					else
					{
					    if (NewCards)
						AddImage ( 25 + ((i+1)*75), 110, 4154);
					    else
					        AddBackground( 65 + ((i+1)*40), 110, 35, 50, 2171 );
					}
				}
			}

			//show player cards
			for ( i = 0; i <= 4; ++i )
			{
				temp = m_From.playercards[i];

				if (temp>0)
				{
				    if (NewCards)
					AddImage ( 25 + ((i+1)*75), 230, 4095+temp);
				    else
				    {
    					cardtemp = m_From.CardSuit( temp );
    					AddBackground( 65 + ((i+1)*40), 230, 35, 50, 2171 );
    					AddLabel( 80 + ((i+1)*40), 256, m_From.cardcolor( cardtemp ), cardtemp );
					AddLabel( 72 + ((i+1)*40), 235, 600, m_From.CardName( temp ) );
				    }
				}
			}

			AddLabel( 110, 330, 800, ""+m_From.playerbet );

			if (!m_From.dealercardhidden)
				dealervalue = dealercardvalue();

			if (m_From.CardValue(m_From.dealercards[0]) + m_From.CardValue(m_From.dealercards[1]) == 21 && !m_From.dealercardhidden)
				scoredmsg = "BJ";
			else
				scoredmsg = dealervalue.ToString();

			if (m_From.CardValue(m_From.playercards[1]) + m_From.CardValue(m_From.playercards[1]) == 21)
				scorepmsg = "BJ";
			else
				scorepmsg = playercardvalue().ToString();
			
			AddLabel( 63, 155, 1500, ""+scoredmsg );
			AddLabel( 63, 274, 600, ""+scorepmsg );
			AddLabel( 100, 350, 64, m_From.pokermsg );

		}