protected override void OnTarget(Mobile from, object targeted) { if (targeted is Mobile) { Mobile m = (Mobile)targeted; BankBox box = (m.Player ? m.BankBox : m.FindBankNoCreate()); if (box != null) { CommandLogging.WriteLine(from, "{0} {1} opening bank box of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targeted)); if (from == targeted) { box.Open(); } else { box.DisplayTo(from); } } else { from.SendMessage("They have no bank box."); } } }
public override void OnClick() { if (!Owner.From.CheckAlive()) { return; } if (Owner.From.Criminal) { m_Banker.Say(500378); // Thou art a criminal and cannot access thy bank box. } else { PlayerMobile pm = Owner.From as PlayerMobile; if (pm != null && DateTime.Now - pm.LastStoleAt < TimeSpan.FromMinutes(2)) { m_Banker.Say(500378); // Thou art a criminal and cannot access thy bank box. } else if (pm != null && AggressorInFight(pm)) { m_Banker.Say("You seem to be busy to bank, come back when you're not fighting."); } else { BankBox box = this.Owner.From.BankBox; if (box != null) { box.Open(); } } } }
public override void OnClick() { if (!Owner.From.CheckAlive()) { return; } if (Owner.From.Criminal) { m_Banker.Say(500378); // Thou art a criminal and cannot access thy bank box. } else { BankBox box = this.Owner.From.BankBox; if (box != null) { box.Open(); } } }
public override void OnSpeech(SpeechEventArgs e) { if (!e.Handled && e.Mobile.InRange(this.Location, 8)) { for (int i = 0; i < e.Keywords.Length; ++i) { int keyword = e.Keywords[i]; switch (keyword) { case 0x0000: // *withdraw* { e.Handled = true; if (e.Mobile.Criminal) { this.Say(500389); // I will not do business with a criminal! break; } string[] split = e.Speech.Split(' '); if (split.Length >= 2) { int amount; try { amount = Convert.ToInt32(split[1]); } catch { break; } if (amount > 5000) { this.Say(500381); // Thou canst not withdraw so much at one time! } else if (amount > 0) { BankBox box = e.Mobile.BankBox; if (box == null || !box.ConsumeTotal(typeof(Gold), amount)) { this.Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold! } else { e.Mobile.AddToBackpack(new Gold(amount)); this.Say(1010005); // Thou hast withdrawn gold from thy account. } } } break; } case 0x0001: // *balance* { e.Handled = true; if (e.Mobile.Criminal) { this.Say(500389); // I will not do business with a criminal! break; } BankBox box = e.Mobile.BankBox; if (box != null) { this.Say(1042759, box.TotalGold.ToString()); // Thy current bank balance is ~1_AMOUNT~ gold. } break; } case 0x0002: // *bank* { e.Handled = true; if (e.Mobile.Criminal) { this.Say(500378); // Thou art a criminal and cannot access thy bank box. break; } BankBox box = e.Mobile.BankBox; if (box != null) { box.Open(); } break; } case 0x0003: // *check* { e.Handled = true; if (e.Mobile.Criminal) { this.Say(500389); // I will not do business with a criminal! break; } string[] split = e.Speech.Split(' '); if (split.Length >= 2) { int amount; try { amount = Convert.ToInt32(split[1]); } catch { break; } if (amount < 5000) { this.Say(1010006); // We cannot create checks for such a paltry amount of gold! } else if (amount > 1000000) { this.Say(1010007); // Our policies prevent us from creating checks worth that much! } else { BankCheck check = new BankCheck(amount); BankBox box = e.Mobile.BankBox; if (box == null || !box.TryDropItem(e.Mobile, check, false)) { this.Say(500386); // There's not enough room in your bankbox for the check! check.Delete(); } else if (!box.ConsumeTotal(typeof(Gold), amount)) { this.Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold! check.Delete(); } else { this.Say(1042673, AffixType.Append, amount.ToString(), ""); // Into your bank box I have placed a check in the amount of: } } } break; } } } } base.OnSpeech(e); }
public override void OnSpeech(SpeechEventArgs e) { if (!e.Handled && e.Mobile.InRange(this.Location, 12)) { for (int i = 0; i < e.Keywords.Length; ++i) { int keyword = e.Keywords[i]; switch (keyword) { case 0x0000: // *withdraw* { e.Handled = true; string[] split = e.Speech.Split(' '); if (split.Length >= 2) { int amount; Container pack = e.Mobile.Backpack; if (!int.TryParse(split[1], out amount)) { break; } if ((!Core.ML && amount > 5000) || (Core.ML && amount > 60000)) { this.Say(500381); // Thou canst not withdraw so much at one time! } else if (pack == null || pack.Deleted || !(pack.TotalWeight < pack.MaxWeight) || !(pack.TotalItems < pack.MaxItems)) { this.Say(1048147); // Your backpack can't hold anything else. } else if (amount > 0) { BankBox box = e.Mobile.FindBankNoCreate(); if (box == null || !box.ConsumeTotal(typeof(Gold), amount)) { this.Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold! } else { pack.DropItem(new Gold(amount)); Server.Gumps.WealthBar.RefreshWealthBar(e.Mobile); this.Say(1010005); // Thou hast withdrawn gold from thy account. } } } break; } case 0x0001: // *balance* { e.Handled = true; BankBox box = e.Mobile.FindBankNoCreate(); if (box != null) { this.Say(1042759, box.TotalGold.ToString()); // Thy current bank balance is ~1_AMOUNT~ gold. } else { this.Say(1042759, "0"); // Thy current bank balance is ~1_AMOUNT~ gold. } break; } case 0x0002: // *bank* { e.Handled = true; BankBox box = e.Mobile.BankBox; if (box != null) { box.GumpID = BaseContainer.BankGump(e.Mobile, box); box.Open(); } break; } case 0x0003: // *check* { e.Handled = true; string[] split = e.Speech.Split(' '); if (split.Length >= 2) { int amount; if (!int.TryParse(split[1], out amount)) { break; } if (amount < 5000) { this.Say(1010006); // We cannot create checks for such a paltry amount of gold! } else if (amount > 1000000) { this.Say(1010007); // Our policies prevent us from creating checks worth that much! } else { BankCheck check = new BankCheck(amount); BankBox box = e.Mobile.BankBox; if (!box.TryDropItem(e.Mobile, check, false)) { this.Say(500386); // There's not enough room in your bankbox for the check! check.Delete(); } else if (!box.ConsumeTotal(typeof(Gold), amount)) { this.Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold! check.Delete(); } else { this.Say(1042673, AffixType.Append, amount.ToString(), ""); // Into your bank box I have placed a check in the amount of: } Server.Gumps.WealthBar.RefreshWealthBar(e.Mobile); } } break; } } } } base.OnSpeech(e); }
public override void OnSpeech(SpeechEventArgs e) { if (!e.Handled && e.Mobile.InRange(this.Location, 12)) { for (int i = 0; i < e.Keywords.Length; ++i) { int keyword = e.Keywords[i]; switch (keyword) { case 0x0000: // *withdraw* { e.Handled = true; if (e.Mobile.Criminal) { this.Say(500389); // I will not do business with a criminal! break; } string[] split = e.Speech.Split(' '); if (split.Length >= 2) { int amount; try { amount = Convert.ToInt32(split[1]); } catch { break; } if (amount > 5000) { this.Say(500381); // Thou canst not withdraw so much at one time! } else if (amount > 0) { BankBox box = e.Mobile.BankBox; if (box == null || !box.ConsumeTotal(typeof(Gold), amount)) { this.Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold! } else { e.Mobile.AddToBackpack(new Gold(amount)); this.Say(1010005); // Thou hast withdrawn gold from thy account. } } } break; } case 0x0001: // *balance* { e.Handled = true; if (e.Mobile.Criminal) { this.Say(500389); // I will not do business with a criminal! break; } BankBox box = e.Mobile.BankBox; if (box != null) { this.Say(1042759, box.TotalGold.ToString()); // Thy current bank balance is ~1_AMOUNT~ gold. } break; } case 0x0002: // *bank* { e.Handled = true; if (e.Mobile.Criminal) { this.Say(500378); // Thou art a criminal and cannot access thy bank box. break; } if (e.Mobile.Player == true) { if (e.Mobile is PlayerMobile) { PlayerMobile pm = e.Mobile as PlayerMobile; if (DateTime.Now - pm.LastStoleAt < TimeSpan.FromMinutes(2)) { this.Say(500378); // Thou art a criminal and cannot access thy bank box. break; } //check that we're not actively involved in a fight: bool bBreak = false; for (int a = 0; a < pm.Aggressed.Count; a++) { AggressorInfo info = (AggressorInfo)pm.Aggressed[a]; if (!info.Expired) { if (info.Attacker == pm && info.Defender is PlayerMobile) { this.Say("You seem to be busy to bank, come back when you're not fighting."); bBreak = true; break; } } } if (bBreak) { break; } } } BankBox box = e.Mobile.BankBox; if (box != null) { box.Open(); } break; } case 0x0003: // *check* { e.Handled = true; if (e.Mobile.Criminal) { this.Say(500389); // I will not do business with a criminal! break; } string[] split = e.Speech.Split(' '); if (split.Length >= 2) { int amount; try { amount = Convert.ToInt32(split[1]); } catch { break; } if (amount < 5000) { this.Say(1010006); // We cannot create checks for such a paltry amount of gold! } else if (amount > 1000000) { this.Say(1010007); // Our policies prevent us from creating checks worth that much! } else { BankCheck check = new BankCheck(amount); BankBox box = e.Mobile.BankBox; if (box == null || !box.TryDropItem(e.Mobile, check, false)) { this.Say(500386); // There's not enough room in your bankbox for the check! check.Delete(); } else if (!box.ConsumeTotal(typeof(Gold), amount)) { this.Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold! check.Delete(); } else { this.Say(1042673, AffixType.Append, amount.ToString(), ""); // Into your bank box I have placed a check in the amount of: } } } break; } } } } base.OnSpeech(e); }