public virtual bool ValidateUse(Mobile m, bool message) { BaseHouse house = BaseHouse.FindHouseAt(this); if (house == null || !IsLockedDown) { if (message) { m.SendMessage("This must be locked down in a house to use!"); } return(false); } if (!house.HasSecureAccess(m, m_Level)) { if (message) { m.SendLocalizedMessage(503301, "", 0x22); // You don't have permission to do that. } return(false); } if (Engines.VvV.VvVSigil.ExistsOn(m)) { if (message) { m.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } return(false); } if (WeightOverloading.IsOverloaded(m)) { if (message) { m.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. } return(false); } if (m.Criminal) { if (message) { m.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. } return(false); } if (SpellHelper.CheckCombat(m)) { if (message) { m.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? } return(false); } if (m.Spell != null) { if (message) { m.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. } return(false); } if (Engines.CityLoyalty.CityTradeSystem.HasTrade(m)) { if (message) { m.SendLocalizedMessage(1151733); // You cannot do that while carrying a Trade Order. } return(false); } return(true); }
public void Target(IPoint3D p) { IPoint3D orig = p; Map map = Caster.Map; SpellHelper.GetSurfaceTop(ref p); Point3D from = Caster.Location; Point3D to = new Point3D(p); if (Sigil.ExistsOn(Caster)) { Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (WeightOverloading.IsOverloaded(Caster)) { Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. } else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.TeleportFrom)) { } else if (!SpellHelper.CheckTravel(Caster, map, to, TravelCheckType.TeleportTo)) { } else if (map?.CanSpawnMobile(p.X, p.Y, p.Z) != true) { Caster.SendLocalizedMessage(501942); // That location is blocked. } else if (SpellHelper.CheckMulti(to, map)) { Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot. } else if (Region.Find(to, map).IsPartOf <HouseRegion>()) { Caster.SendLocalizedMessage(502829); // Cannot teleport to that spot. } else if (CheckSequence()) { SpellHelper.Turn(Caster, orig); Mobile m = Caster; m.Location = to; m.ProcessDelta(); if (m.Player) { Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); } else { m.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist); } m.PlaySound(0x1FE); IPooledEnumerable <Item> eable = m.GetItemsInRange(0); foreach (Item item in eable) { if (item is ParalyzeFieldSpell.InternalItem || item is PoisonFieldSpell.InternalItem || item is FireFieldSpell.FireFieldItem) { item.OnMoveOver(m); } } eable.Free(); } FinishSequence(); }
public static bool Split(Mobile from, Item item) { if (!(item is Gold) || from.Party == null || item.Amount < ((Party)from.Party).Members.Count) { return(false); } var party = Party.Get(from); // Only split with players who also split. var playerSplit = party.Members.Count(m => ((PlayerMobile)m.Mobile).SplitGoldWithParty); int share = item.Amount / playerSplit; foreach (var info in party.Members) { var partyMember = info.Mobile as PlayerMobile; if (partyMember == null || partyMember.Backpack == null) { continue; } if (!partyMember.SplitGoldWithParty) { continue; } var receiverGold = partyMember.Backpack.FindItemByType <Gold>(); if (receiverGold != null) { receiverGold.Amount += share; } else { partyMember.Backpack.DropItem(new Gold(share)); } partyMember.PlaySound(item.GetDropSound()); // Your share if (partyMember == from) { from.SendMessage("You take some gold from the corpse and share with {1} party members: {0} for each.", share, playerSplit); int rest = item.Amount % party.Members.Count; if (rest > 0) { var sharerGold = from.Backpack.FindItemByType <Gold>(); if (sharerGold != null) { sharerGold.Amount += rest; } else { from.Backpack.DropItem(new Gold(rest)); } from.SendMessage("You keep the {0} gold left over.", rest); } } else // Their share { partyMember.SendMessage("{0} takes some gold from the corpse and shares with the party: {1} for each.", from.Name, share); if (WeightOverloading.IsOverloaded(partyMember)) { receiverGold.Amount -= share; var sharerGold = from.Backpack.FindItemByType <Gold>(); if (sharerGold != null) { sharerGold.Amount += share; } else { from.Backpack.DropItem(new Gold(share)); } partyMember.SendMessage("But {0} keeps your share, because you are overloaded.", (from.Female ? "she" : "he")); from.SendMessage("You keep {0}'s share, who is overloaded.", partyMember.Name); } } } item.Delete(); return(true); }
public virtual bool ValidateUse(Mobile m, bool message) { if (Movable) { if (message) { m.SendMessage("This must be locked down in a house to use!"); } return(false); } if (Sigil.ExistsOn(m)) { if (message) { m.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } return(false); } if (WeightOverloading.IsOverloaded(m)) { if (message) { m.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. } return(false); } if (m.Criminal) { if (message) { m.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. } return(false); } if (SpellHelper.CheckCombat(m)) { if (message) { m.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? } return(false); } if (m.Spell != null) { if (message) { m.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. } return(false); } return(true); }
public override void OnSpeech(SpeechEventArgs e) { if (!e.Handled && e.Mobile.InRange(Location, 2) && CheckAccess(e.Mobile)) { if (Movable) { e.Mobile.SendMessage("This must be locked down in a house to use!"); } else if (Sigil.ExistsOn(e.Mobile)) { e.Mobile.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (WeightOverloading.IsOverloaded(e.Mobile)) { e.Mobile.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. } else if (e.Mobile.Criminal) { e.Mobile.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. } else if (SpellHelper.CheckCombat(e.Mobile)) { e.Mobile.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? } else if (e.Mobile.Spell != null) { e.Mobile.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. } /* Begin Speech Entries */ // fel banks // else if (e.Speech.ToLower() == "britain bank") { var loc = new Point3D(1434, 1699, 2); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "bucs bank") { var loc = new Point3D(2724, 2192, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "cove bank") { var loc = new Point3D(2238, 1195, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "ocllo bank") { var loc = new Point3D(3687, 2523, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "jhelom bank") { var loc = new Point3D(1417, 3821, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "magincia bank") { var loc = new Point3D(3728, 2164, 20); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "minoc bank") { var loc = new Point3D(2498, 561, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "moonglow bank") { var loc = new Point3D(4471, 1177, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "nujelm bank") { var loc = new Point3D(3770, 1308, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "serpent bank") { var loc = new Point3D(2895, 3479, 15); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "skara bank") { var loc = new Point3D(596, 2138, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "trinsic bank") { var loc = new Point3D(1823, 2821, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "vesper bank") { var loc = new Point3D(2899, 676, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "wind bank") { var loc = new Point3D(1361, 895, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } ///// fel moongates //////// else if (e.Speech.ToLower() == "britain moongate") { var loc = new Point3D(1336, 1997, 5); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "bucs moongate") { var loc = new Point3D(2711, 2234, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "jhelom moongate") { var loc = new Point3D(1330, 3780, 0); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "magincia moongate") { var loc = new Point3D(3563, 2139, 34); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "minoc moongate") { var loc = new Point3D(2701, 692, 5); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "moonglow moongate") { var loc = new Point3D(4467, 1283, 5); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "skara moongate") { var loc = new Point3D(643, 2067, 5); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "trinsic moongate") { var loc = new Point3D(1828, 2948, -20); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "yew moongate") { var loc = new Point3D(771, 752, 5); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } else if (e.Speech.ToLower() == "vesper moongate") { var loc = new Point3D(2701, 692, 5); Map map = Map.Felucca; DoTeleport(e.Mobile, loc, map); } } }
static void OnCommand(CommandEventArgs e) { var m = e.Mobile; if (!Config.AllowUsageIfIsOverloaded && WeightOverloading.IsOverloaded(m)) { m.SendMessage("You can't recall because you are carrying too much weight!"); return; } if (!Config.AllowUsageIfIsInCombat && IsInCombat(m)) { m.SendMessage("You can't recall during the heat of battle!"); return; } SendSpecialEffects(m); m.MoveToWorld(Config.TargetLocation, Config.TargetMap); SendSpecialEffects(m); if (Config.DecreaseFameIfUsedInCombat && SpellHelper.CheckCombat(m)) { Titles.AwardFame(m, -(m.Fame / 20), true); } if (Config.BringFollowers) { var master = m as PlayerMobile; var followers = master.AllFollowers; if (followers.Count == 0) { return; } foreach (var follower in followers) { var mount = follower as IMount; if (mount != null) { if (mount.Rider == master) { continue; } mount.Rider = null; } if (Config.AffectOnlyControlledFollowers) { var baseCreature = follower as BaseCreature; if (baseCreature != null && !baseCreature.Controlled) { continue; } } follower.MoveToWorld(master.Location, master.Map); } } }
private static void EventSink_Speed(SpeechEventArgs e) { if (e.Mobile.Alive) { return; } if (!Insensitive.StartsWith(e.Speech, "homehomehome")) { return; } var m = e.Mobile; if (m.AccessLevel == AccessLevel.Player) { if (!Config.AllowUsageIfIsOverloaded && WeightOverloading.IsOverloaded(m)) { m.SendMessage("You can't teleport because you are carrying too much weight!"); return; } if (!Config.AllowUsageIfIsInCombat && IsInCombat(m)) { m.SendMessage("You can't teleport during the heat of battle!"); return; } if (m.Alive) { m.SendMessage("You must be dead"); return; } } SendSpecialEffects(m); m.MoveToWorld(Config.TargetLocation, Config.TargetMap); //ress them? if (!m.Alive) { m.Resurrect(); } SendSpecialEffects(m); if (Config.BringFollowers) { var master = m as PlayerMobile; var followers = master.AllFollowers; if (followers.Count == 0) { return; } foreach (var follower in followers) { var mount = follower as IMount; if (mount != null) { if (mount.Rider == master) { continue; } mount.Rider = null; } if (Config.AffectOnlyControlledFollowers) { var baseCreature = follower as BaseCreature; if (baseCreature != null && !baseCreature.Controlled) { continue; } } follower.MoveToWorld(master.Location, master.Map); } } }
public void Effect(Point3D loc, Map map, bool checkMulti) { if (map == null || Caster.Map != map) { Caster.SendLocalizedMessage(1005569); // You can not recall to another facet. } else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.RecallFrom)) { } else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.RecallTo)) { } else if (map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young) { Caster.SendLocalizedMessage( 1049543); // You decide against traveling to Felucca while you are still young. } else if (Caster.Kills >= 5 && map != Map.Felucca) { Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there. } else if (Caster.Criminal) { Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. } else if (SpellHelper.CheckCombat(Caster)) { Caster.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? } else if (WeightOverloading.IsOverloaded(Caster)) { Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. } else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z)) { Caster.SendLocalizedMessage(501942); // That location is blocked. } else if (checkMulti && SpellHelper.CheckMulti(loc, map)) { Caster.SendLocalizedMessage(501942); // That location is blocked. } else if (m_Book != null && m_Book.CurCharges <= 0) { Caster.SendLocalizedMessage(502412); // There are no charges left on that item. } else if (CheckSequence()) { BaseCreature.TeleportPets(Caster, loc, map, true); if (m_Book != null) { --m_Book.CurCharges; } Caster.PlaySound(0x1FC); Caster.MoveToWorld(loc, map); Caster.PlaySound(0x1FC); } FinishSequence(); }
static void Recall_OnCommand(CommandEventArgs e) { Mobile m = e.Mobile; if (!Config.AllowUsageIfIsOverloaded && WeightOverloading.IsOverloaded(m)) { m.SendMessage("You can't recall because you are carrying too much weight!"); return; } if (!Config.AllowUsageIfIsInCombat) { m.SendMessage("You can't recall during the heat of battle!"); return; } m.MoveToWorld(Config.TargetLocation, Config.TargetMap); if (Config.BringFollowers) { PlayerMobile master = (PlayerMobile)m; List <Mobile> followers = master.AllFollowers; if (followers.Count > 0) { foreach (var follower in followers) { var mount = follower as IMount; if (mount != null) { if (mount.Rider == master) { continue; } mount.Rider = null; } if (Config.AffectOnlyControlledFollowers) { var baseCreature = follower as BaseCreature; if (baseCreature != null) { if (!baseCreature.Controlled) { continue; } } } follower.MoveToWorld(master.Location, master.Map); } } } if (Config.SpecialEffects) { Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y, m.Z + 4), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y, m.Z), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y, m.Z - 4), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X, m.Y + 1, m.Z + 4), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X, m.Y + 1, m.Z), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X, m.Y + 1, m.Z - 4), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y + 1, m.Z + 11), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y + 1, m.Z + 7), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y + 1, m.Z + 3), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y + 1, m.Z - 1), m.Map, 0x3728, 13); m.PlaySound(0x228); m.Emote("*appears in a puff of smoke*"); } if (Config.DecreaseFameIfUsedInCombat && SpellHelper.CheckCombat(m)) { Titles.AwardFame(m, -(m.Fame / 20), true); } }
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 || !gold.Movable) { 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 > 4999) { 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 > 4999) { 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 override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (!Ledger.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. return; } switch (info.ButtonID) { case 0: //Close { int[] switches = info.Switches; for (int i = 0; i < switches.Length; i++) { if (switches[i] == 2) { Ledger.i_Selection = 0; } if (switches[i] == 3) { Ledger.i_Selection = 1; } } Ledger.b_open = false; from.SendMessage(2125, "You close your gold ledger."); break; } case 1: //Withdraw Currency { string WithdrawString = info.GetTextEntry(4).Text.Replace(",", ""); if (WithdrawString != null) { int WithdrawAmount = 0; try { WithdrawAmount = Convert.ToInt32(WithdrawString, 10); } catch { //from.SendGump(new GoldLedgerGump(Ledger)); // Commented out to keep from getting multiple gumps. from.SendMessage(2125, "You can't withdraw letters, silly! Only numbers!"); } int[] switches = info.Switches; for (int i = 0; i < switches.Length; i++) { if (switches[i] == 2) { Ledger.i_Selection = 0; } if (switches[i] == 3) { Ledger.i_Selection = 1; } } if (WithdrawAmount < 0) { from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "You can't withdraw negative gold, silly!"); return; } if (WithdrawAmount == 0) { from.SendGump(new GoldLedgerGump(Ledger)); return; } if (WithdrawAmount > Ledger.Gold) { WithdrawAmount = Ledger.Gold; } if (Ledger.i_Selection == 0) { double maxWeight = (WeightOverloading.GetMaxWeight(from)); double newledgerweight = ((Ledger.Gold - WithdrawAmount) * Ledger.d_WeightScale); double curWeight = ((Mobile.BodyWeight + from.TotalWeight) - (Ledger.Weight - newledgerweight)); double maxGold = ((maxWeight - (Mobile.BodyWeight + from.TotalWeight)) / (((GoldLedger.GoldWeight > Ledger.d_WeightScale) ? GoldLedger.GoldWeight : Ledger.d_WeightScale) - ((GoldLedger.GoldWeight > Ledger.d_WeightScale) ? Ledger.d_WeightScale : GoldLedger.GoldWeight))); if ((int)maxGold < 1) { from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "You can't carry that many stones."); } else { if (WithdrawAmount > (int)maxGold) { WithdrawAmount = (int)maxGold; from.SendMessage(2125, "You can only withdraw {0} stones' worth of gold.", (int)Math.Ceiling((int)maxGold * GoldLedger.GoldWeight)); } Ledger.Gold -= WithdrawAmount; from.SendGump(new GoldLedgerGump(Ledger)); Ledger.AppendWeight(); int toAdd = WithdrawAmount; Gold gold; int sixtyk = 60000; while (toAdd > sixtyk) { gold = new Gold(sixtyk); toAdd -= sixtyk; from.Backpack.AddItem(gold); from.SendMessage(2125, "You withdraw {0} gold from your gold ledger.", sixtyk.ToString("#,0")); } if (toAdd > 0) { gold = new Gold(toAdd); from.Backpack.AddItem(gold); from.SendMessage(2125, "You withdraw {0} gold from your gold ledger.", toAdd.ToString("#,0")); } from.PlaySound(0x2E6); } } else if (Ledger.i_Selection == 1) { BankCheck check = new BankCheck(WithdrawAmount); Ledger.Gold -= WithdrawAmount; Ledger.AppendWeight(); from.Backpack.AddItem(check); from.SendGump(new GoldLedgerGump(Ledger)); from.PlaySound(0x42); from.SendMessage(2125, "You withdraw a bank check worth {0} gold from your gold ledger.", WithdrawAmount.ToString("#,0")); } } break; } case 5: //Deposit Currency { int[] switches = info.Switches; for (int i = 0; i < switches.Length; i++) { if (switches[i] == 2) { Ledger.i_Selection = 0; } if (switches[i] == 3) { Ledger.i_Selection = 1; } } from.SendGump(new GoldLedgerGump(Ledger)); Ledger.BeginAddGold(from); break; } case 6: //Gold Sweeper { int[] switches = info.Switches; for (int i = 0; i < switches.Length; i++) { if (switches[i] == 2) { Ledger.i_Selection = 0; } if (switches[i] == 3) { Ledger.i_Selection = 1; } } if (Ledger.GoldSweeper) { Ledger.GoldSweeper = false; from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "Gold Sweeper: Disabled"); } else { Ledger.GoldSweeper = true; from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "Gold Sweeper: Enabled"); } break; } case 7: //Auto-Loot { int[] switches = info.Switches; for (int i = 0; i < switches.Length; i++) { if (switches[i] == 2) { Ledger.i_Selection = 0; } if (switches[i] == 3) { Ledger.i_Selection = 1; } } if (Ledger.GoldAutoLoot) { Ledger.GoldAutoLoot = false; from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "Gold Looting: Manual"); } else { Ledger.GoldAutoLoot = true; from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "Gold Looting: Automatic"); } break; } case 8: //Help { from.SendGump(new GoldLedgerGump(Ledger)); from.CloseGump(typeof(GoldLedgerHelp)); from.SendGump(new GoldLedgerHelp()); break; } } }
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); }