public Gump_DrugDealer(Mobile from, Mobile vendor) : base(50, 50) { m_From = from; m_Vendor = vendor; int balance = Banker.GetBalance(from); Closable = true; Disposable = true; Dragable = true; Resizable = false; AddPage(0); AddBackground(375, 77, 254, 379, 9200); AddLabel(405, 90, 139, @"Hey I think I got what you want!!!"); AddLabel(405, 140, 0, @"WaterBong 250 gp"); AddLabel(405, 170, 0, @"Joint 50 gp"); AddLabel(405, 200, 0, @"Rolling Paper 10 gp"); AddLabel(405, 230, 0, @"Marijuana 200 gp"); AddLabel(405, 260, 0, @"Marijuana Seeds 500 gp"); AddLabel(405, 290, 0, @"Karma Bong 250 gp"); AddLabel(405, 421, 52, @"Thank you for your purchase!"); AddImage(523, 385, 10430); AddButton(390, 143, 1210, 248, 1, GumpButtonType.Reply, 0); AddButton(390, 173, 1210, 248, 2, GumpButtonType.Reply, 0); AddButton(390, 203, 1210, 248, 3, GumpButtonType.Reply, 0); AddButton(390, 233, 1210, 248, 4, GumpButtonType.Reply, 0); AddButton(390, 263, 1210, 248, 5, GumpButtonType.Reply, 0); AddButton(390, 293, 1210, 248, 6, GumpButtonType.Reply, 0); AddButton(390, 393, 4012, 248, 7, GumpButtonType.Reply, 0); AddImage(325, 40, 10400); AddImage(325, 221, 10401); AddImage(325, 399, 10402); }
public override void OnClick() { if (m_DockMaster.Map == null) { return; } Container pack = m_From.Backpack; if (pack != null && pack.GetAmount(typeof(Gold)) < DryDockAmount && Banker.GetBalance(m_From) < DryDockAmount) { m_DockMaster.PrivateOverheadMessage(MessageType.Regular, m_DockMaster.SpeechHue, 1116506, DryDockAmount.ToString(), m_From.NetState); //The price is ~1_price~ and I will accept nothing less! return; } BaseBoat boat = BaseBoat.GetBoat(m_From); if (boat != null && m_DockMaster.InRange(boat.Location, 50)) { m_DockMaster.TryRetrieveHold(m_From, boat); } else { m_DockMaster.SayTo(m_From, 502581); //I cannot find the ship! } }
public void BeginStable(Mobile from) { if (Deleted || !from.CheckAlive()) { return; } Item[] currency; BankCheck[] checks; ulong credit; if ((from.Backpack == null || from.Backpack.GetAmount(TypeOfCurrency, true) < StablePrice) && Banker.GetBalance(from, TypeOfCurrency, out currency, out checks, out credit) < (ulong)StablePrice) { SayTo(from, "Thou dost not have enough {0}, not even in thy bank account.", TypeOfCurrency.Name); } else { if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendMessage("Which animal wouldst thou like to stable here?"); } else { SayTo( from, "I charge {0} {1} per pet for up to a real week's stable time. " + "Thou mayst pay outstanding charges upon claim. Which animal wouldst thou like to stable here?", StablePrice, TypeOfCurrency.Name); } from.Target = new StableTarget(this); } }
public override void OnResponse(NetState sender, RelayInfo info) { int index = info.ButtonID - 1; if (index >= 0 && index < m_SellList.Length) { HairstylistBuyInfo buyInfo = m_SellList[index]; int balance = Banker.GetBalance(m_From); bool isFemale = (m_From.Female || m_From.Body.IsFemale); if (buyInfo.FacialHair && isFemale) { // You cannot place facial hair on a woman! m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1010639, m_From.NetState); } else if (balance >= buyInfo.Price) { try { object[] origArgs = buyInfo.GumpArgs; object[] args = new object[origArgs.Length]; for (int i = 0; i < args.Length; ++i) { if (origArgs[i] == CustomHairstylist.Price) { args[i] = m_SellList[index].Price; } else if (origArgs[i] == CustomHairstylist.From) { args[i] = m_From; } else if (origArgs[i] == CustomHairstylist.Vendor) { args[i] = m_Vendor; } else { args[i] = origArgs[i]; } } Gump g = Activator.CreateInstance(buyInfo.GumpType, args) as Gump; m_From.SendGump(g); } catch (Exception e) { Diagnostics.ExceptionLogging.LogException(e); } } else { // You cannot afford my services for that style. m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState); } } }
public override void OnClick() { if (!Core.ML || m_Vendor == null || m_Vendor.Deleted) { return; } WeaponEngravingTool tool = WeaponEngravingTool.Find(m_From); if (tool != null && tool.UsesRemaining <= 0) { if (Banker.GetBalance(m_From) >= 100000) { m_From.SendGump(new WeaponEngravingTool.ConfirmGump(tool, m_Vendor)); } else { m_Vendor.Say(1076167); // You need a 100,000 gold and a blue diamond to recharge the weapon engraver. } } else { m_Vendor.Say(1076164); // I can only help with this if you are carrying an engraving tool that needs repair. } }
public override void OnResponse(NetState sender, RelayInfo info) { var index = info.ButtonID - 1; if (index >= 0 && index < m_SellList.Length) { var buyInfo = m_SellList[index]; var balance = Banker.GetBalance(m_From); var isFemale = m_From.Female || m_From.Body.IsFemale; if (buyInfo.FacialHair && isFemale) { m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1010639, m_From.NetState); } else if (balance >= buyInfo.Price) { try { var origArgs = buyInfo.GumpArgs; var args = new object[origArgs.Length]; for (var i = 0; i < args.Length; ++i) { if (origArgs[i] == CustomHairstylist.Price) { args[i] = m_SellList[index].Price; } else if (origArgs[i] == CustomHairstylist.From) { args[i] = m_From; } else if (origArgs[i] == CustomHairstylist.Vendor) { args[i] = m_Vendor; } else { args[i] = origArgs[i]; } } var g = ActivatorUtil.CreateInstance(buyInfo.GumpType, args) as Gump; m_From.SendGump(g); } catch { // ignored } } else { m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState); } } }
public HairstylistBuyGump(Mobile from, Mobile vendor, HairstylistBuyInfo[] sellList) : base(50, 50) { m_From = from; m_Vendor = vendor; m_SellList = sellList; from.CloseGump(typeof(HairstylistBuyGump)); from.CloseGump(typeof(ChangeHairHueGump)); from.CloseGump(typeof(ChangeHairstyleGump)); bool isFemale = (from.Female || from.Body.IsFemale); int balance = Banker.GetBalance(from); int canAfford = 0; for (int i = 0; i < sellList.Length; ++i) { if (balance >= sellList[i].Price && (!sellList[i].FacialHair || !isFemale)) { ++canAfford; } } AddPage(0); AddBackground(50, 10, 450, 100 + (canAfford * 25), 2600); AddHtmlLocalized(100, 40, 350, 20, 1018356, false, false); // Choose your hairstyle change: int index = 0; for (int i = 0; i < sellList.Length; ++i) { if (balance >= sellList[i].Price && (!sellList[i].FacialHair || !isFemale)) { if (sellList[i].TitleString != null) { AddHtml(140, 75 + (index * 25), 300, 20, sellList[i].TitleString, false, false); } else { AddHtmlLocalized(140, 75 + (index * 25), 300, 20, sellList[i].Title, false, false); } AddButton(100, 75 + (index++ *25), 4005, 4007, 1 + i, GumpButtonType.Reply, 0); } } }
public HairstylistBuyGump(Mobile from, Mobile vendor, HairstylistBuyInfo[] sellList) : base(50, 50) { m_From = from; m_Vendor = vendor; m_SellList = sellList; from.CloseGump <HairstylistBuyGump>(); from.CloseGump <ChangeHairHueGump>(); from.CloseGump <ChangeHairstyleGump>(); var isFemale = from.Female || from.Body.IsFemale; var balance = Banker.GetBalance(from); var canAfford = 0; for (var i = 0; i < sellList.Length; ++i) { if (balance >= sellList[i].Price && (!sellList[i].FacialHair || !isFemale)) { ++canAfford; } } AddPage(0); AddBackground(50, 10, 450, 100 + canAfford * 25, 2600); AddHtmlLocalized(100, 40, 350, 20, 1018356); // Choose your hairstyle change: var index = 0; for (var i = 0; i < sellList.Length; ++i) { if (balance >= sellList[i].Price && (!sellList[i].FacialHair || !isFemale)) { if (sellList[i].TitleString != null) { AddHtml(140, 75 + index * 25, 300, 20, sellList[i].TitleString); } else { AddHtmlLocalized(140, 75 + index * 25, 300, 20, sellList[i].Title); } AddButton(100, 75 + index++ *25, 4005, 4007, 1 + i); } } }
public override void OnResponse(Mobile from, string text) { if (!m_Vendor.CanInteractWith(from, false) || !m_Vendor.IsLandlord(from)) { return; } text = text.Trim(); int amount; try { amount = Convert.ToInt32(text); } catch { amount = -1; } Mobile owner = m_Vendor.Owner; if (owner == null) { return; } if (amount < 0) { from.SendLocalizedMessage(1062506); // You did not enter a valid amount. Offer canceled. } else if (Banker.GetBalance(from) < amount) { from.SendLocalizedMessage(1062507); // You do not have that much money in your bank account. } else if (owner.Map != m_Vendor.Map || !owner.InRange(m_Vendor, 5)) { from.SendLocalizedMessage(1062505); // The renter must be closer to the vendor in order for you to make this offer. } else { from.SendLocalizedMessage(1062504); // Please wait while the renter considers your offer. owner.CloseGump(typeof(VendorRentalRefundGump)); owner.SendGump(new VendorRentalRefundGump(m_Vendor, from, amount)); } }
public static void GetMyCorpse(Mobile from) { if (!from.Alive) { from.SendMessage("But you are dead sire, I cannot help thee"); return; } Map map = from.Map; if (map == null) { return; } int distchk = 0; int distpck = 0; ArrayList bodies = new ArrayList(); ArrayList empty = new ArrayList(); //ArrayList mice = new ArrayList(); foreach (Item body in World.Items.Values) // change so it check sall facets... remove Inrange? { if (body is Corpse) { Corpse cadaver = (Corpse)body; int carrying = body.GetTotal(TotalType.Items); if (cadaver.Owner == from && carrying > 0) { distchk++; bodies.Add(body); //if ( GhostHelper.HowFar( from.X, from.Y, mSp.X, mSp.Y ) < TheClosest ){ TheClosest = GhostHelper.HowFar( from.X, from.Y, mSp.X, mSp.Y ); IsClosest = distchk; } } else if (cadaver.Owner == from && carrying < 1) { empty.Add(body); //mice.Add( mSp ); } } } for (int u = 0; u < empty.Count; ++u) { Item theEmpty = (Item)empty[u]; theEmpty.Delete(); } //for ( int m = 0; m < mice.Count; ++m ){ Mobile theMouse = ( Mobile )mice[ m ]; theMouse.Delete(); } if (distchk == 0) { from.SendMessage("You have no nearby corpse in this area!"); } else { int i_Bank; i_Bank = Banker.GetBalance(from); Container bank = from.FindBankNoCreate(); if ((from.Backpack != null && from.Backpack.ConsumeTotal(typeof(Gold), 30000)) || (bank != null && bank.ConsumeTotal(typeof(Gold), 30000))) { for (int h = 0; h < bodies.Count; ++h) { distpck++; //if ( distpck == IsClosest ) //{ Corpse theBody = (Corpse)bodies[h]; theBody.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); //} } } else { from.SendMessage("I only work for gold, Sire."); from.SendMessage("Make sure you have 30,000 gold (coins) in your pack or bank."); } } }
public void BeginStable(Mobile from) { if (Deleted || !from.CheckAlive()) { return; } Container bank = from.FindBankNoCreate(); if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendMessage("Which animal wouldst thou like to stable here?"); } else if ((from.Backpack == null || from.Backpack.GetAmount(typeof(Gold)) < StablePrice) && Banker.GetBalance(from) < StablePrice) { SayTo(from, 1042556); // Thou dost not have enough gold, not even in thy bank account. } else { SayTo(from, "I charge {0} gold per pet for a real week's stable time. Thou mayst pay outstanding charges upon claim. Which animal wouldst thou like to stable here?", StablePrice); //from.SendLocalizedMessage( 1042558 ); /* I charge 30 gold per pet for a real week's stable time. * I will withdraw it from thy bank account. * Which animal wouldst thou like to stable here? */ from.Target = new StableTarget(this); } }
public static bool WithdrawPackAndBank(Mobile from, int amount) { int totalGold = 0; List <Gold> packgold; //BankCheck[] packchecks; Gold[] bankgold; BankCheck[] bankchecks; if (from.Backpack != null) { packgold = from.Backpack.FindItemsByType <Gold>(); //packchecks = from.Backpack.FindItemsByType<BankCheck>( false ); //They are only blessed on the top layer. for (int i = 0; i < packgold.Count; i++) { totalGold += packgold[i].Amount; } //for ( int i = 0;i < packchecks.Length; i++ ) // totalGold += packchecks[i].Worth; } else { packgold = new List <Gold>(); //packchecks = new BankCheck[0]; } if (totalGold < amount) { totalGold += Banker.GetBalance(from, out bankgold, out bankchecks); } else { bankgold = new Gold[0]; bankchecks = new BankCheck[0]; } if (totalGold >= amount) { for (int i = 0; amount > 0 && i < packgold.Count; ++i) { int consume = Math.Min(packgold[i].Amount, amount); packgold[i].Consume(consume); amount -= consume; } /* * for ( int i = 0; amount > 0 && i < packchecks.Count; ++i ) * { * int consume = Math.Min( packchecks[i].Worth, amount ); * packchecks[i].ConsumeWorth( consume ); * amount -= consume; * } */ Banker.WithdrawUpTo(from, amount, bankgold, bankchecks); return(true); } return(false); }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; from.Frozen = false; switch (info.ButtonID) { case -1: { // You decide against paying the Veterinarian, and the ghost of your pet looks at you sadly... from.SendLocalizedMessage(1113197); break; } case 1: { for (int i = 0; i < m_Pets.Length; i++) { BaseCreature pet = m_Pets[i]; if (info.IsSwitched(i)) { int fee = Veterinarian.GetResurrectionFee(pet); if (!pet.IsDeadBondedPet) { from.SendLocalizedMessage(501041); // Target is not dead. } else if (!from.CanSee(pet) || !from.InLOS(pet)) { from.SendLocalizedMessage(503376); // Target cannot be seen. } else if (!from.InRange(pet, 12)) { from.SendLocalizedMessage(500643); // Target is too far away. } else if (pet.ControlMaster != from) { from.SendLocalizedMessage(1113200); // You must be the owner of that pet to have it resurrected. } else if (pet.Corpse != null && !pet.Corpse.Deleted) { from.SendLocalizedMessage(1113279); // That creature's spirit lacks cohesion. Try again in a few minutes. } else if (Banker.Withdraw(from, fee)) { pet.PlaySound(0x214); pet.ResurrectPet(); for (int j = 0; j < pet.Skills.Length; ++j) // Decrease all skills on pet. { pet.Skills[j].Base -= 0.2; } if (pet.Map == Map.Internal) { pet.MoveToWorld(from.Location, from.Map); } from.SendLocalizedMessage(1060398, fee.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString(), 0x16); // You have ~1_AMOUNT~ gold in cash remaining in your bank box. } else { from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing. } break; } } break; } } }
public void BeginStable(Mobile from) { if (Deleted || !from.CheckAlive()) { return; } if ((from.Backpack == null || from.Backpack.GetAmount(typeof(Gold)) < 30) && Banker.GetBalance(from) < 30) { SayTo(from, 1042556); // Thou dost not have enough gold, not even in thy bank account. return; } /* * I charge 30 gold per pet for a real week's stable time. * I will withdraw it from thy bank account. * Which animal wouldst thou like to stable here? */ from.SendLocalizedMessage(1042558); from.Target = new StableTarget(this); }
public override bool OnDragDrop(Mobile from, Item dropped) { if (dropped is PetClaimTicket) { PetClaimTicket pct = (PetClaimTicket)dropped; if (pct.Time <= DateTime.UtcNow) { if (pct.Pet == null) { from.SendMessage("Error! Contact Gamemaster"); return(false); } else if (from.Followers == 0) { Type pettype = pct.Pet.GetType(); BaseCreature bc = (BaseCreature)pct.Pet; bc.IsStabled = true; from.Stabled.Add(bc); this.SayTo(from, "I have put your pet that was mating in the stable under you name."); BaseCreature baby = null; if (pettype != null) { object o = Activator.CreateInstance(pettype); baby = o as BaseCreature; } if (baby == null) { from.SendMessage(38, "There was an internal error and breeding has failed due to lack of type, Please contact a member of the staff."); return(false); } else { if (from == pct.Owner) { if (Banker.Withdraw(from, pct.Price)) { from.SendLocalizedMessage(1060398, pct.Price.ToString()); from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); baby.Str = pct.Str; baby.Dex = pct.Dex; baby.Int = pct.Int; baby.HitsMaxSeed = pct.Hits; baby.StamMaxSeed = pct.Stam; baby.ManaMaxSeed = pct.Mana; baby.PhysicalResistanceSeed = pct.Phys; baby.FireResistSeed = pct.Fire; baby.ColdResistSeed = pct.Cold; baby.EnergyResistSeed = pct.Nrgy; baby.PoisonResistSeed = pct.Pois; baby.DamageMin = pct.Dmin; baby.DamageMax = pct.Dmax; baby.MaxLevel = pct.Mlev; baby.Generation = pct.Gen + 1; baby.Controlled = true; baby.ControlMaster = from; baby.Location = from.Location; baby.ControlTarget = from; baby.Map = from.Map; baby.Name = baby.Name + " baby"; if (pct.AI == 1) { baby.AI = AIType.AI_Mage; } else if (pct.AI == 2) { baby.AI = AIType.AI_Melee; } baby.MoveToWorld(from.Location, from.Map); baby.ControlOrder = OrderType.Follow; pct.Delete(); return(true); } else { this.SayTo(from, "Hey! you tring to cheat me! This anit for free buddy."); from.SendMessage("You lack the gold in your banking account to do this."); return(false); } } else { this.SayTo(from, "You are not the owner of this deed."); return(false); } } } else { this.SayTo(from, "Please stable or shrink all your pets before we go on."); return(false); } } else { if (pct.Pet != null) { this.SayTo(from, "Your pet {0} is not done mating yet, Please check back later.", pct.Pet.Name); return(false); } else { from.SendMessage("Error in your (Pet Claim Ticket) please contact the staff."); return(false); } } } else { return(false); } }
public static int GetBalance(Mobile m) { return(Banker.GetBalance(m)); }
public override void OnResponse(NetState sender, RelayInfo info) { int index = info.ButtonID - 1; if (index >= 0 && index < m_SellList.Length) { HairstylistBuyInfo buyInfo = m_SellList[index]; int balance = Banker.GetBalance(m_From); bool isFemale = (m_From.Female || m_From.Body.IsFemale); if (buyInfo.Layer == Layer.FacialHair && isFemale) { // You cannot place facial hair on a woman! m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1010639, m_From.NetState); } else if (m_From is TeiravonMobile && ((TeiravonMobile)m_From).IsOrc()) { m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "I don't work for any orc!", m_From.NetState); } else if (balance >= buyInfo.Price) { try { object[] origArgs = buyInfo.GumpArgs; object[] args = new object[origArgs.Length]; for (int i = 0; i < args.Length; ++i) { if (origArgs[i] == CustomHairstylist.Price) { args[i] = m_SellList[index].Price; } else if (origArgs[i] == CustomHairstylist.From) { args[i] = m_From; } else if (origArgs[i] == CustomHairstylist.Vendor) { args[i] = m_Vendor; } else { args[i] = origArgs[i]; } } Gump g = Activator.CreateInstance(buyInfo.GumpType, args) as Gump; m_From.SendGump(g); } catch { } } else { // You cannot afford my services for that style. //m_Vendor.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1042293, m_From.NetState ); m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "You dont have enough gold in your bankbox for that!", m_From.NetState); } } }
public static int GetBalance(Mobile m, out Item[] gold, out Item[] checks) { return(Banker.GetBalance(m, out gold, out checks)); }