Server.Mobiles.Banker.GetBalance C# (CSharp) Méthode

GetBalance() public static méthode

public static GetBalance ( Mobile m ) : int
m Mobile
Résultat int
        public static int GetBalance(Mobile m)
        {
            double balance = 0;

            if (AccountGold.Enabled && m.Account != null)
            {
                int goldStub;
                m.Account.GetGoldBalance(out goldStub, out balance);

                if (balance > Int32.MaxValue)
                {
                    return Int32.MaxValue;
                }
            }

            Container bank = m.FindBankNoCreate();

            if (bank != null)
            {
                var gold = bank.FindItemsByType<Gold>();
                var checks = bank.FindItemsByType<BankCheck>();

                balance += gold.Aggregate(0.0, (c, t) => c + t.Amount);
                balance += checks.Aggregate(0.0, (c, t) => c + t.Worth);
            }

            return (int)Math.Max(0, Math.Min(Int32.MaxValue, balance));
        }

Same methods

Banker::GetBalance ( Mobile m, Item &gold, Item &checks ) : int

Usage Example

Exemple #1
0
        public Gump_DrugDealer(Mobile from, Mobile vendor) : base(50, 50)
        {
            m_From   = from;
            m_Vendor = vendor;

            int balance = Banker.GetBalance(from);

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;
            AddPage(0);
            AddBackground(375, 77, 254, 379, 9200);
            AddLabel(405, 90, 139, @"Hey I think I got what you want!!!");
            AddLabel(405, 140, 0, @"WaterBong 250 gp");
            AddLabel(405, 170, 0, @"Joint 50 gp");
            AddLabel(405, 200, 0, @"Rolling Paper 10 gp");
            AddLabel(405, 230, 0, @"Marijuana 200 gp");
            AddLabel(405, 260, 0, @"Marijuana Seeds 500 gp");
            AddLabel(405, 290, 0, @"Karma Bong 250 gp");
            AddLabel(405, 421, 52, @"Thank you for your purchase!");
            AddImage(523, 385, 10430);
            AddButton(390, 143, 1210, 248, 1, GumpButtonType.Reply, 0);
            AddButton(390, 173, 1210, 248, 2, GumpButtonType.Reply, 0);
            AddButton(390, 203, 1210, 248, 3, GumpButtonType.Reply, 0);
            AddButton(390, 233, 1210, 248, 4, GumpButtonType.Reply, 0);
            AddButton(390, 263, 1210, 248, 5, GumpButtonType.Reply, 0);
            AddButton(390, 293, 1210, 248, 6, GumpButtonType.Reply, 0);
            AddButton(390, 393, 4012, 248, 7, GumpButtonType.Reply, 0);
            AddImage(325, 40, 10400);
            AddImage(325, 221, 10401);
            AddImage(325, 399, 10402);
        }
All Usage Examples Of Server.Mobiles.Banker::GetBalance