public void EndAddGold(Mobile from, object obj) { from.CloseGump(typeof(GoldLedgerGump)); if (obj is Item) { Item item = obj as Item; double maxWeight = (WeightOverloading.GetMaxWeight(from)); int golda = 0; if (!this.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. return; } if (!item.IsAccessibleTo(from)) { from.SendGump(new GoldLedgerGump(this)); from.SendLocalizedMessage(3000270); // That is not accessible. return; } if (obj is Gold) { Gold gold = obj as Gold; golda = gold.Amount; if ((gold.Amount + this.Gold) > 999999999) { golda = (999999999 - this.Gold); } double maxgold = golda; if (this.d_WeightScale > 0 && gold.RootParent != from) { maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)from.TotalWeight)) / this.d_WeightScale); } if (golda > maxgold) { golda = (int)maxgold; } if (golda < gold.Amount) { gold.Amount -= golda; } else { gold.Delete(); } this.Gold += golda; from.SendGump(new GoldLedgerGump(this)); from.SendMessage(2125, String.Format("You deposit {0} gold into your gold ledger.", golda.ToString("#,0"))); from.PlaySound(0x249); } else if (obj is BankCheck) { BankCheck check = obj as BankCheck; golda = check.Worth; if ((check.Worth + this.Gold) > 999999999) { golda = (999999999 - this.Gold); } double maxgold = golda; if (this.d_WeightScale > 0) { maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)from.TotalWeight)) / this.d_WeightScale); } if (golda > maxgold) { golda = (int)maxgold; } if (golda < check.Worth) { check.Worth -= golda; } else { check.Delete(); } this.Gold += golda; from.SendGump(new GoldLedgerGump(this)); from.SendMessage(2125, String.Format("You deposit a bank check worth {0} gold into your gold ledger.", golda.ToString("#,0"))); from.PlaySound(0x249); } else if (obj is GoldLedger && obj != this) { GoldLedger gledger = obj as GoldLedger; golda = gledger.Gold; if ((gledger.Gold + this.Gold) > 999999999) { golda = (999999999 - this.Gold); } double maxgold = golda; if (this.d_WeightScale > 0) { maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)from.TotalWeight)) / this.d_WeightScale); } if (golda > maxgold) { golda = (int)maxgold; } gledger.Gold -= golda; this.Gold += golda; from.SendGump(new GoldLedgerGump(this)); from.SendMessage(2125, String.Format("You transfer {0} gold into your gold ledger.", golda.ToString("#,0"))); from.PlaySound(0x249); } else { from.SendGump(new GoldLedgerGump(this)); from.SendMessage(2125, "You can only deposit gold or bank checks into your gold ledger."); } } else { from.SendGump(new GoldLedgerGump(this)); from.SendMessage(2125, "You can only deposit gold or bank checks into your gold ledger."); } from.SendMessage(2125, "Do you want to deposit anything else? (ESC to cancel)"); from.Target = new AddGoldTarget(this); }