public ScratcherGump(BaseLottoTicket ticket, Mobile from)
            : base(50, 50)
        {
            m_Ticket = ticket;
            m_From   = from;
            int bg = GetBackGround();

            AddBackground(50, 0, 400, 200, bg);

            AddImage(125, 12, 0xFC4);
            AddImage(325, 12, 0xFC4);

            AddHtml(50, 20, 400, 30, String.Format("<Center><BASEFONT SIZE=9>{0}</Center>", ScratcherLotto.GetGameType(m_Ticket.Type)), false, false);

            if (m_Ticket.Checked && m_Ticket.Payout > 0)
            {
                AddHtml(75, 150, 200, 20, String.Format("<Basefont Color=#FFFF00>Winnings: {0}</Basefont>", m_Ticket.Payout), false, false);
            }

            switch (m_Ticket.Type)
            {
            case TicketType.GoldenTicket: GoldTicket(); break;

            case TicketType.CrazedCrafting: CrazedCrafting(); break;

            case TicketType.SkiesTheLimit: SkiesTheLimit(); break;
            }

            AddHtml(75, 170, 350, 20, String.Format("<Basefont Size=2>Lotto Association of {0}, All Rights Reserved</Basefont>", ServerList.ServerName), false, false);
        }
示例#2
0
        private void GiveFreeTicket(Mobile from, BaseLottoTicket ticket)
        {
            if (from == null)
            {
                return;
            }

            Item   item = null;
            string name = "";

            switch (ticket.Type)
            {
            default:
            case TicketType.GoldenTicket: item = new GoldenTicket(from, false); name = "Golden Ticket"; break;

            case TicketType.CrazedCrafting: item = new CrazedCrafting(from, false); name = "Crazed Crafting"; break;

            case TicketType.SkiesTheLimit: item = new SkiesTheLimit(from, false); name = "Skies the Limit"; break;
            }

            if (item != null)
            {
                from.SendMessage("You have recived your free {0} ticket.", name);
                if (from.Backpack != null)
                {
                    from.Backpack.DropItem(item);
                }
                else
                {
                    from.BankBox.DropItem(item);
                }
            }
            ticket.FreeTicket = false;
        }
示例#3
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is BaseLottoTicket)
            {
                BaseLottoTicket ticket = (BaseLottoTicket)dropped;
                int             payOut = ticket.Payout;
                Container       pack   = from.Backpack;

                if (!ticket.Checked)
                {
                    Say("You haven't played this ticket yet!");
                    return(false);
                }

                if (!ticket.CashedOut && ticket.FreeTicket)
                {
                    GiveFreeTicket(from, ticket);
                }

                if (ticket.CashedOut)
                {
                    Say("This ticket has already been cashed out!");
                }

                else if (payOut == 0)
                {
                    Say("I'm sorry, but this ticket is not a winning ticket.");
                }

                else
                {
                    if (payOut <= 1000000 && pack != null)
                    {
                        pack.DropItem(new BankCheck(payOut));
                        from.SendMessage("Your winnings of {0} has been placed into your backpack. Please play again.", payOut);
                    }
                    else
                    {
                        Banker.Deposit(from, payOut);
                        from.SendMessage("Your winnings of {0} has been deposited into your bankbox. Please play again.", payOut);
                    }

                    from.PlaySound(52);
                    from.PlaySound(53);
                    from.PlaySound(54);
                    from.PlaySound(55);
                    ticket.CashedOut = true;
                }

                dropped.Delete();
            }

            return(false);
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_From == null)
            {
                return;
            }

            Container pack         = m_From.Backpack;
            bool      quickScratch = info.IsSwitched(0);

            switch (info.ButtonID)
            {
            default:
            case 0: break;

            case 1:     //Golden Ticket
            {
                int cost = GoldenTicket.TicketCost;

                if (ScratcherLotto.Stone != null && ScratcherLotto.Stone.IsActive)
                {
                    BaseLottoTicket free = FindFreeTicket(pack, typeof(GoldenTicket));

                    if (free != null && free is GoldenTicket)
                    {
                        free.Delete();
                        m_From.SendMessage("You purchase a lottery ticket with your free ticket.", cost);

                        DropItem(new GoldenTicket(m_From, quickScratch));
                    }
                    else if (pack != null && pack.GetAmount(typeof(Gold)) >= cost)
                    {
                        pack.ConsumeTotal(typeof(Gold), cost);
                        m_From.SendMessage("You purchase a lottery ticket with {0} gold from your backpack.", cost);

                        DropItem(new GoldenTicket(m_From, quickScratch));

                        if (m_Stone != null)
                        {
                            m_Stone.GoldSink += cost;
                        }
                    }
                    else if (Banker.Withdraw(m_From, cost, true))
                    {
                        m_From.SendMessage("You purchase a lottery ticket with {0} gold from your bankbox.", cost);

                        DropItem(new GoldenTicket(m_From, quickScratch));

                        if (m_Stone != null)
                        {
                            m_Stone.GoldSink += cost;
                        }
                    }
                    else
                    {
                        m_From.SendLocalizedMessage(500191);         //Begging thy pardon, but thy bank account lacks these funds.
                    }
                }
                m_From.SendGump(new ScratcherStoneGump(m_Stone, m_From, quickScratch));
                break;
            }

            case 2:     //Crazed Crafting
            {
                int cost = CrazedCrafting.TicketCost;

                if (ScratcherLotto.Stone != null && ScratcherLotto.Stone.IsActive)
                {
                    BaseLottoTicket free = FindFreeTicket(pack, typeof(CrazedCrafting));
                    if (free != null && free is CrazedCrafting)
                    {
                        free.Delete();
                        m_From.SendMessage("You purchase a lottery ticket with your free ticket.", cost);

                        DropItem(new CrazedCrafting(m_From, quickScratch));
                    }
                    else if (pack != null && pack.GetAmount(typeof(Gold)) >= cost)
                    {
                        pack.ConsumeTotal(typeof(Gold), cost);
                        m_From.SendMessage("You purchase a lottery ticket with {0} gold from your backpack.", cost);

                        DropItem(new CrazedCrafting(m_From, quickScratch));

                        if (m_Stone != null)
                        {
                            m_Stone.GoldSink += cost;
                        }
                    }
                    else if (Banker.Withdraw(m_From, cost, true))
                    {
                        m_From.SendMessage("You purchase a lottery ticket with {0} gold from your bankbox.", cost);

                        DropItem(new CrazedCrafting(m_From, quickScratch));

                        if (m_Stone != null)
                        {
                            m_Stone.GoldSink += cost;
                        }
                    }
                    else
                    {
                        m_From.SendLocalizedMessage(500191);         //Begging thy pardon, but thy bank account lacks these funds.
                    }
                }
                m_From.SendGump(new ScratcherStoneGump(m_Stone, m_From, quickScratch));
                break;
            }

            case 3:     //Skies the Limit
            {
                int cost = SkiesTheLimit.TicketCost;

                if (ScratcherLotto.Stone != null && ScratcherLotto.Stone.IsActive)
                {
                    BaseLottoTicket free = FindFreeTicket(pack, typeof(SkiesTheLimit));
                    if (free != null && free is SkiesTheLimit)
                    {
                        free.Delete();
                        m_From.SendMessage("You purchase a lottery ticket with your free ticket.", cost);

                        DropItem(new SkiesTheLimit(m_From, quickScratch));
                    }
                    else if (pack != null && pack.GetAmount(typeof(Gold)) >= cost)
                    {
                        pack.ConsumeTotal(typeof(Gold), cost);
                        m_From.SendMessage("You purchase a lottery ticket with {0} gold from your backpack.", cost);

                        DropItem(new SkiesTheLimit(m_From, quickScratch));

                        if (m_Stone != null)
                        {
                            m_Stone.GoldSink += cost;
                        }

                        m_Stone.SkiesProgressive += cost / 10;
                    }
                    else if (Banker.Withdraw(m_From, cost, true))
                    {
                        m_From.SendMessage("You purchase a lottery ticket with {0} gold from your bankbox.", cost);

                        DropItem(new SkiesTheLimit(m_From, quickScratch));

                        if (m_Stone != null)
                        {
                            m_Stone.GoldSink += cost;
                        }

                        m_Stone.SkiesProgressive += cost / 10;
                    }
                    else
                    {
                        m_From.SendLocalizedMessage(500191);         //Begging thy pardon, but thy bank account lacks these funds.
                    }
                }
                m_From.SendGump(new ScratcherStoneGump(m_Stone, m_From, quickScratch));
                break;
            }

            case 4:     //PowerBall Ticket
            {
                if (PowerBall.Instance != null && PowerBall.Game != null && !PowerBall.Game.Deleted && PowerBall.Instance.CanBuyTickets)
                {
                    int cost = PowerBall.Game.TicketCost;

                    if (pack != null && pack.GetAmount(typeof(Gold)) >= cost)
                    {
                        pack.ConsumeTotal(typeof(Gold), cost);
                        m_From.SendMessage("You purchase a Powerball ticket with {0} gold from your backpack.", cost);

                        DropItem(new PowerBallTicket(m_From, PowerBall.Game));

                        if (PowerBall.Instance != null)
                        {
                            PowerBall.Instance.Profit += cost;
                        }
                    }
                    else if (Banker.Withdraw(m_From, cost, true))
                    {
                        m_From.SendMessage("You purchase a Powerball ticket with {0} gold from your bankbox.", cost);

                        DropItem(new PowerBallTicket(m_From, PowerBall.Game));

                        if (PowerBall.Instance != null)
                        {
                            PowerBall.Instance.Profit += cost;
                        }
                    }
                    else
                    {
                        m_From.SendLocalizedMessage(500191);         //Begging thy pardon, but thy bank account lacks these funds.
                    }
                }

                m_From.SendGump(new ScratcherStoneGump(m_Stone, m_From, quickScratch));
                break;
            }

            case 5:
            {
                if (PowerBall.Game != null)
                {
                    m_From.SendGump(new PowerBallStatsGump(PowerBall.Game, m_From));
                }

                break;
            }

            case 6:
            {
                if (m_From.AccessLevel == AccessLevel.Player)
                {
                    break;
                }

                if (m_Stone != null)
                {
                    if (m_Stone.IsActive)
                    {
                        m_From.SendMessage("set to inactive.");
                        m_Stone.IsActive = false;
                    }
                    else
                    {
                        m_From.SendMessage("set to active.");
                        m_Stone.IsActive = true;
                    }
                }

                m_From.SendGump(new ScratcherStoneGump(m_Stone, m_From, quickScratch));
                break;
            }
            }
        }