Пример #1
0
		public static ulong GetBalance(Mobile from, Type currencyType, out Item[] currency, out BankCheck[] checks, out ulong credit)
		{
			ulong balance = 0;

			BankBox bank = from.FindBankNoCreate();

			if (bank != null)
			{
				Type cType = bank.Expansion == Expansion.T2A ? typeof(Silver) : typeof(Gold);

				credit = cType == currencyType ? bank.Credit : 0;

				balance += credit;

				currency = bank.FindItemsByType(currencyType, true).ToArray();
				checks = bank.FindItemsByType<BankCheck>(true).Where(c => c.TypeOfCurrency == currencyType).ToArray();

				balance = currency.Aggregate(balance, (current, t) => current + (ulong)t.Amount);
				balance = checks.Aggregate(balance, (current, t) => current + (ulong)t.Worth);
			}
			else
			{
				currency = new Item[0];
				checks = new BankCheck[0];
				credit = 0;
			}

			return balance;
		}