public static void GoldTransfer(Mobile m, Container c, BaseCreature creature) { if (creature.IsBonded) { return; } if (m.Map != creature.Map || !m.InRange(creature, 12)) { return; } string nametitle = null; if (creature.Title != null) { nametitle = creature.Name + " " + creature.Title; } else { nametitle = creature.Name; } Item item = m.Backpack.FindItemByType(typeof(GoldLedger)); GoldLedger ledger = item as GoldLedger; if (ledger == null) { return; } if (!ledger.GoldAutoLoot || !m.Alive || !GoldLedger.GoldAutoLootAvailable) { return; } TransferGold(m, c, ledger, nametitle); }
public static void GoldSweep(Mobile m, Gold gold) { Item item = m.Backpack.FindItemByType(typeof(GoldLedger)); GoldLedger ledger = item as GoldLedger; if (ledger == null) { return; } if (!ledger.GoldSweeper || !GoldLedger.GoldSweeperAvailable) { return; } if (gold != null) { if (ledger.Gold < 999999999) { double maxWeight = (WeightOverloading.GetMaxWeight(m)); if ((Mobile.BodyWeight + m.TotalWeight) < (maxWeight)) { int golda = gold.Amount; if ((gold.Amount + ledger.Gold) > 999999999) { golda = (999999999 - ledger.Gold); } double maxgold = golda; if (ledger.d_WeightScale > 0) { maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)m.TotalWeight)) / ledger.d_WeightScale); } if (golda > maxgold) { golda = (int)maxgold; } int GoldID = 0; if (golda == 1) { GoldID = gold.ItemID; } else if (golda > 1 && golda < 6) { GoldID = gold.ItemID + 1; } else if (golda >= 6) { GoldID = gold.ItemID + 2; } if (golda < gold.Amount) { gold.Amount -= golda; } else { gold.Delete(); } ledger.Gold += golda; if (ledger.b_open && golda > 0) { m.CloseGump(typeof(GoldLedgerGump)); m.SendGump(new GoldLedgerGump(ledger)); } if (golda > 0) { m.SendMessage(2125, "You deposit {0} gold into your gold ledger.", golda.ToString("#,0")); if (!m.Mounted) { m.Animate(32, 5, 1, true, false, 0); } Effects.SendMovingEffect(gold, m, GoldID, 5, 50, true, false); m.PlaySound(0x2E6); } } } } }
public static void TransferGold(Mobile m, Container c, GoldLedger ledger, string nametitle) { Item[] items = c.FindItemsByType(typeof(Gold)); foreach (Gold ngold in items) { Gold gold = ngold as Gold; if (gold != null) { if (ledger.Gold < 999999999) { double maxWeight = (WeightOverloading.GetMaxWeight(m)); if ((Mobile.BodyWeight + m.TotalWeight) < (maxWeight)) { int golda = gold.Amount; if ((gold.Amount + ledger.Gold) > 999999999) { golda = (999999999 - ledger.Gold); } double maxgold = golda; if (ledger.d_WeightScale > 0) { maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)m.TotalWeight)) / ledger.d_WeightScale); } if (golda > maxgold) { golda = (int)maxgold; } int GoldID = 0; if (golda == 1) { GoldID = gold.ItemID; } else if (golda > 1 && golda < 6) { GoldID = gold.ItemID + 1; } else if (golda >= 6) { GoldID = gold.ItemID + 2; } if (golda < gold.Amount) { gold.Amount -= golda; } else { gold.Delete(); } ledger.Gold += golda; if (ledger.b_open && golda > 0) { m.CloseGump(typeof(GoldLedgerGump)); m.SendGump(new GoldLedgerGump(ledger)); } if (golda > 0) { m.SendMessage(2125, "You loot {0} gold from {1} and deposit it into your gold ledger.", golda.ToString("#,0"), nametitle); Effects.SendMovingEffect(c, m, GoldID, 5, 50, true, false); m.PlaySound(0x2E6); } } } } } }
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); }
public GoldLedgerGump(GoldLedger ledger) : base(225, 100) { Resizable = false; Ledger = ledger; int val = Ledger.Gold; if (val > 5000) { val = 5000; } bool bool1 = true; bool bool2 = false; if (Ledger.i_Selection == 1) { bool1 = false; bool2 = true; } AddPage(0); AddBackground(50, 50, 400, (280 + ((GoldLedger.GoldSweeperAvailable || GoldLedger.GoldAutoLootAvailable) ? 85 : 0)), 3600); AddLabel(217, 78, 2124, @"Gold Ledger"); AddImage(138, 68, 4037, 2124); AddImage(328, 70, 4037, 2124); AddImage(295, 80, 57, 2101); AddImage(175, 80, 59, 2101); AddButton(395, 66, 22153, 22155, 8, GumpButtonType.Reply, 0); AddButton(417, 68, 3, 4, 0, GumpButtonType.Reply, 0); AddBackground(65, 115, 185, 85, 9270); AddLabel(107, 130, 2124, @"Account Balance"); AddBackground(103, 157, 109, 25, 9350); AddLabel(112, 160, 0, Ledger.Gold.ToString("#,0")); AddBackground(250, 115, 185, 85, 9270); AddLabel(291, 130, 2124, @"Deposit Currency"); AddButton(289, 154, 10800, 10820, 5, GumpButtonType.Reply, 0); AddBackground(65, 200, 185, 115, 9270); AddLabel(132, 215, 2124, @"Currency"); AddItem(97, 242, 3823, 0); AddLabel(108, 242, 2101, @"Gold"); AddLabel(154, 243, 2101, @"or"); AddItem(174, 240, 5360, 52); AddLabel(188, 237, 2101, @"Bank"); AddLabel(185, 249, 2101, @"Check"); AddRadio(114, 275, 210, 211, bool1, 2); AddRadio(182, 275, 210, 211, bool2, 3); AddBackground(250, 200, 185, 115, 9270); AddLabel(284, 215, 2124, @"Withdraw Currency"); AddBackground(288, 242, 109, 30, 2620); AddTextEntry(295, 247, 95, 20, 2101, 4, val.ToString()); AddLabel(290, 277, 2101, @"Finalize"); AddButton(343, 276, 2128, 2129, 1, GumpButtonType.Reply, 0); if (GoldLedger.GoldSweeperAvailable) { AddBackground(65, 315, 185, 85, 9270); AddLabel(121, 330, 2124, @"Gold Sweeper"); AddLabel(90, 357, 2101, @"Sweeper Enabled"); AddButton(199, 354, (Ledger.GoldSweeper ? 9723 : 9720), (Ledger.GoldSweeper ? 9720 : 9723), 6, GumpButtonType.Reply, 0); } if (GoldLedger.GoldAutoLootAvailable) { AddBackground(250, 315, 185, 85, 9270); AddLabel(297, 330, 2124, @"Gold Auto-Loot"); AddLabel(275, 357, 2101, @"Gold Looting"); AddButton(357, 357, (Ledger.GoldAutoLoot ? 2113 : 2116), (Ledger.GoldAutoLoot ? 2116 : 2113), 7, GumpButtonType.Reply, 0); } AddImage(0, -7, 10400, 2124); AddImage(0, 167, 10401, 2124); AddImage(0, 345, 10402, 2124); AddImage(418, -7, 10410, 2124); AddImage(418, 167, 10411, 2124); AddImage(418, 345, 10412, 2124); }
public AddGoldTarget(GoldLedger tl) : base(18, false, TargetFlags.None) { m_TL = tl; }
public static void TransferGold(Mobile m, Container c, GoldLedger ledger, string nametitle) { Item[] items = c.FindItemsByType(typeof(Gold)); foreach (Gold ngold in items) { Gold gold = ngold as Gold; if (gold != null) { if (ledger.Gold < 999999999) { double maxWeight = (WeightOverloading.GetMaxWeight(m)); if ((Mobile.BodyWeight + m.TotalWeight) < (maxWeight)) { int golda = gold.Amount; if ((gold.Amount + ledger.Gold) > 999999999) golda = (999999999 - ledger.Gold); double maxgold = golda; if (ledger.d_WeightScale > 0) maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)m.TotalWeight)) / ledger.d_WeightScale); if (golda > maxgold) golda = (int)maxgold; int GoldID = 0; if (golda == 1) GoldID = gold.ItemID; else if (golda > 1 && golda < 6) GoldID = gold.ItemID + 1; else if (golda >= 6) GoldID = gold.ItemID + 2; if (golda < gold.Amount) gold.Amount -= golda; else gold.Delete(); ledger.Gold += golda; if (ledger.b_open && golda > 0) { m.CloseGump(typeof(GoldLedgerGump)); m.SendGump(new GoldLedgerGump(ledger)); } if (golda > 0) { m.SendMessage(2125, "You loot {0} gold from {1} and deposit it into your gold ledger.", golda.ToString("#,0"), nametitle); Effects.SendMovingEffect(c, m, GoldID, 5, 50, true, false); m.PlaySound(0x2E6); } } } } } }
public GoldLedgerGump(GoldLedger ledger) : base(225, 100) { Resizable = false; Ledger = ledger; int val = Ledger.Gold; if (val > 5000) val = 5000; bool bool1 = true; bool bool2 = false; if (Ledger.i_Selection == 1) { bool1 = false; bool2 = true; } AddPage(0); AddBackground(50, 50, 400, (280 + ((GoldLedger.GoldSweeperAvailable || GoldLedger.GoldAutoLootAvailable) ? 85 : 0)), 3600); AddLabel(217, 78, 2124, @"Gold Ledger"); AddImage(138, 68, 4037, 2124); AddImage(328, 70, 4037, 2124); AddImage(295, 80, 57, 2101); AddImage(175, 80, 59, 2101); AddButton(395, 66, 22153, 22155, 8, GumpButtonType.Reply, 0); AddButton(417, 68, 3, 4, 0, GumpButtonType.Reply, 0); AddBackground(65, 115, 185, 85, 9270); AddLabel(107, 130, 2124, @"Account Balance"); AddBackground(103, 157, 109, 25, 9350); AddLabel(112, 160, 0, Ledger.Gold.ToString("#,0")); AddBackground(250, 115, 185, 85, 9270); AddLabel(291, 130, 2124, @"Deposit Currency"); AddButton(289, 154, 10800, 10820, 5, GumpButtonType.Reply, 0); AddBackground(65, 200, 185, 115, 9270); AddLabel(132, 215, 2124, @"Currency"); AddItem(97, 242, 3823, 0); AddLabel(108, 242, 2101, @"Gold"); AddLabel(154, 243, 2101, @"or"); AddItem(174, 240, 5360, 52); AddLabel(188, 237, 2101, @"Bank"); AddLabel(185, 249, 2101, @"Check"); AddRadio(114, 275, 210, 211, bool1, 2); AddRadio(182, 275, 210, 211, bool2, 3); AddBackground(250, 200, 185, 115, 9270); AddLabel(284, 215, 2124, @"Withdraw Currency"); AddBackground(288, 242, 109, 30, 2620); AddTextEntry(295, 247, 95, 20, 2101, 4, val.ToString()); AddLabel(290, 277, 2101, @"Finalize"); AddButton(343, 276, 2128, 2129, 1, GumpButtonType.Reply, 0); if (GoldLedger.GoldSweeperAvailable) { AddBackground(65, 315, 185, 85, 9270); AddLabel(121, 330, 2124, @"Gold Sweeper"); AddLabel(90, 357, 2101, @"Sweeper Enabled"); AddButton(199, 354, (Ledger.GoldSweeper ? 9723 : 9720), (Ledger.GoldSweeper ? 9720 : 9723), 6, GumpButtonType.Reply, 0); } if (GoldLedger.GoldAutoLootAvailable) { AddBackground(250, 315, 185, 85, 9270); AddLabel(297, 330, 2124, @"Gold Auto-Loot"); AddLabel(275, 357, 2101, @"Gold Looting"); AddButton(357, 357, (Ledger.GoldAutoLoot ? 2113 : 2116), (Ledger.GoldAutoLoot ? 2116 : 2113), 7, GumpButtonType.Reply, 0); } AddImage(0, -7, 10400, 2124); AddImage(0, 167, 10401, 2124); AddImage(0, 345, 10402, 2124); AddImage(418, -7, 10410, 2124); AddImage(418, 167, 10411, 2124); AddImage(418, 345, 10412, 2124); }
public SetOwnerTarget(GoldLedger tl) : base(18, false, TargetFlags.None) { m_TL = tl; }