Exemple #1
0
        private void AlterFunds(Mobile m, int amt, bool addAmt)
        {
            BankBox bank   = m.BankBox;
            int     totAmt = 0;

            if (addAmt)
            {
                bank.AddItem(new BankCheck(amt));
            }
            else
            {
                while (totAmt != amt)
                {
                    Item gp = bank.FindItemByType(typeof(Gold));
                    if (gp.Amount > (amt - totAmt))
                    {
                        gp.Amount -= (amt - totAmt);
                        totAmt     = amt;
                    }
                    else
                    {
                        totAmt = gp.Amount;
                        gp.Delete();
                    }
                }
            }
        }
        public static SavingsAccount GetAccountForMobile(Mobile mobile)
        {
            BankBox bank = mobile.BankBox;

            if (null == bank)
            {
                return(null);
            }
            else
            {
                return((SavingsAccount)bank.FindItemByType(typeof(SavingsAccount)));
            }
        }
        public SavingsGump(Mobile from) : base(400, 300)
        {
            from.CloseGump(typeof(SavingsGump));

            m_Bank    = from.BankBox;
            m_Pack    = from.Backpack;
            m_Account = (SavingsAccount)m_Bank.FindItemByType(typeof(SavingsAccount));

            String gold   = m_Account.Gold.ToString("#,0") + " Gold";
            String tokens = m_Account.Tokens.ToString("#,0") + " Tokens";

            m_MaximumCheckValue = AuctionConfig.MaximumCheckValue.ToString("#,0");

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;
            AddPage(0);
            AddBackground(0, 0, 240, 268, 9200);
            AddAlphaRegion(10, 9, 220, 100);
            AddAlphaRegion(10, 115, 220, 145);

            AddLabel(50, 15, 4, @"Savings Account Ledger");
            AddLabel(50, 35, 4, @"-----------------------");
            AddLabel(25, 55, 53, gold);
            if (Arya.Savings.SavingsAccount.EnableTokens)
            {
                AddLabel(25, 80, 18, tokens);
            }

            AddLabel(40, 130, 4, @"Withdraw 1 to " + m_MaximumCheckValue);
            AddBackground(75, 155, 95, 25, 0x2486);
            AddTextEntry(85, 155, 90, 20, 0, m_AmountID, "");

            AddButton(25, 180, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddLabel(65, 180, 53, @"Make this gold check.");

            if (Arya.Savings.SavingsAccount.EnableTokens)
            {
                AddButton(25, 205, 4005, 4007, 2, GumpButtonType.Reply, 0);
                AddLabel(65, 205, 18, @"Make this token check.");
            }
            AddButton(25, 230, 4017, 4019, 0, GumpButtonType.Reply, 0);
            AddLabel(65, 230, 4, @"Done.");
        }