protected override void OnTarget(Mobile from, object target) { if (target is PlayerVendor) { PlayerVendor vendor = (PlayerVendor)target; if (vendor.IsOwner(from)) { if (vendor.PricingModel == PricingModel.Commission) { from.SendMessage("This vendor is already working on commission."); } else { vendor.PricingModel = PricingModel.Commission; vendor.SayTo(from, String.Format("I shall now work for a minimum wage plus a {0}% comission.", ((int)(vendor.Commission * 100)).ToString())); m_Deed.Delete(); } } else { vendor.SayTo(from, "I do not work for thee! Only my master may renegotiate my contract."); } } else { from.SendMessage("Thou canst only renegotiate the contracts of thy own servants."); } }
private void SetInfo(Mobile from, int price, string desc) { bool allowed = true; if (price <= 0) { VendorItem vi = null; if (m_Cont != null) { vi = (VendorItem)m_Vendor.SellItems[m_Cont]; } if (vi == null || vi.Price == 0) { if (m_Item is Container) { if (!(m_Item is KeyRing)) { if (m_Item is LockableContainer && ((LockableContainer)m_Item).Locked) { price = 999; m_Vendor.SayTo(from, 1043298); // Locked items may not be made not-for-sale. } else if (m_Item.Items.Count > 0) { price = 999; m_Vendor.SayTo(from, 1043299); // To be not for sale, all items in a container must be for sale. } } } else if (!(m_Item is BaseBook)) { m_Vendor.SayTo(from, 1043301); // Only the following may be made not-for-sale: books, containers, keyrings, and items in for-sale containers. allowed = false; } } } if (price > 0 && m_Item is Container) { RecurseClearSales((Container)m_Item); } if (allowed) { m_VI.Price = price; m_VI.Description = desc; m_VI.Item.InvalidateProperties(); } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (!m_Vendor.CanInteractWith(from, false)) { return; } if (m_Vendor.IsOwner(from)) { m_Vendor.SayTo(from, 503212); // You own this shop, just take what you want. return; } if (info.ButtonID == 1) { m_Vendor.Say(from.Name); if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack)) { m_Vendor.SayTo(from, 503216); // You can't buy that. } else if (!Banker.WithdrawPackAndBank(from, m_Vendor.TypeOfCurrency, m_VI.Price)) { m_Vendor.SayTo(from, 503205); // You cannot afford this item. } else if (!from.PlaceInBackpack(m_VI.Item)) { m_Vendor.SayTo(from, 503204); // You do not have room in your backpack for this. BankBox box = from.FindBank(m_Vendor.Expansion) ?? from.BankBox; box.Credit += (ulong)m_VI.Price; m_Vendor.SayTo(from, "I credited your bank account. Please come back when you have room for this item."); } else { from.SendLocalizedMessage(503201); // You take the item. m_Vendor.HoldCurrency += m_VI.Price; m_Vendor.LastActivity = DateTime.UtcNow; m_Vendor.NameMod = null; m_Vendor.NameHue = -1; } } else { from.SendLocalizedMessage(503207); // Cancelled purchase. } }
public override void OnResponse(NetState state, RelayInfo info) { if (m_Vendor.Deleted) { return; } Mobile from = state.Mobile; from.CloseGump(typeof(PlayerVendorBuyGump)); if (info.ButtonID == 2) { if (m_VI.IsForSale && m_Item.RootParent == m_Vendor) { m_Vendor.Say(from.Name); Container pack = from.Backpack; if ((pack != null && pack.ConsumeTotal(typeof(Gold), m_VI.Price)) || from.BankBox.ConsumeTotal(typeof(Gold), m_VI.Price)) { int price = m_VI.Price; m_Vendor.HoldGold += price; m_Vendor.RemoveInfo(m_Item); if (pack == null || !pack.TryDropItem(from, m_Item, false)) { m_Vendor.SayTo(from, 503204); // You do not have room in your backpack for this. m_Item.MoveToWorld(from.Location, from.Map); } // charge our N% commission AFTER the customer gets their goods (in case the comission charge causes the vendor to die.) if (m_Vendor.PricingModel == PricingModel.Commission) { m_Vendor.Charge((int)(price * m_Vendor.Commission), PlayerVendor.ChargeReason.Commission); } } else { m_Vendor.SayTo(from, 503205); // You cannot afford this item. } } else { m_Vendor.SayTo(from, 503216); // You can't buy that. } } }
public override void OnResponse(NetState state, RelayInfo info) { if (m_Vendor.Deleted) { return; } Mobile from = state.Mobile; switch (info.ButtonID) { case 1: { Container pack = m_Vendor.Backpack; if (pack != null) { m_Vendor.SayTo(from, 1010642); // Take a look at your goods. pack.DisplayTo(from); } break; } case 2: { from.SendGump(new PlayerVendorCustomizeGump(m_Vendor, from)); break; } } }
protected override void OnTarget(Mobile from, object target) { if (target is PlayerVendor) { PlayerVendor vendor = (PlayerVendor)target; if (vendor.IsOwner(from)) { from.SendMessage("How dost thou wish to title thy servant?"); from.Prompt = new RenamePrompt(from, vendor, m_Deed); } else { vendor.SayTo(from, "I do not work for thee! Only my master may change my name."); } } else if (target is PlayerBarkeeper) { PlayerBarkeeper barkeep = (PlayerBarkeeper)target; if (barkeep.IsOwner(from)) { from.SendMessage("How dost thou wish to title thy servant?"); from.Prompt = new RenamePrompt(from, barkeep, m_Deed); } else { barkeep.SayTo(from, "I do not work for thee! Only my master may change my name."); } } else { from.SendMessage("Thou canst only change the names of thy servants."); } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendLocalizedMessage( 503248); // Your godly powers allow you to place this vendor whereever you wish. Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from)); v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, 503246); // Ah! it feels good to be working again. Delete(); } else { BaseHouse house = BaseHouse.FindHouseAt(from); if (house == null) { from.SendLocalizedMessage(503240); // Vendors can only be placed in houses. } else if (!house.IsFriend(from)) { from.SendLocalizedMessage( 503242); // You must ask the owner of this building to name you a friend of the household in order to place a vendor here. } else if (!house.Public) { from.SendLocalizedMessage( 503241); // You cannot place this vendor or barkeep. Make sure the house is public and has sufficient storage available. } else { bool vendor = BaseHouse.IsThereVendor(from.Location, from.Map); if (vendor) { from.SendLocalizedMessage(1062677); // You cannot place a vendor or barkeep at this location. } else { Mobile v = new PlayerVendor(from, house); v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, 503246); // Ah! it feels good to be working again. Delete(); } } } }
protected override void OnTarget(Mobile from, object targeted) { //from.SendMessage(targeted.ToString()); IPoint3D p = (IPoint3D)targeted; Point3D point = new Point3D(p.X, p.Y, p.Z); if (Region.Find(point, Map.Felucca) is MarcheHurlevent) { Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from)); v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(point, from.Map); v.SayTo(from, "Je suis a votre service."); m_Item.Delete(); //v.SayTo(from, 503246); } else { from.SendMessage("Vous pouvez seulement placer un marchand dans une zone commercial."); } }
public override void OnResponse(NetState state, RelayInfo info) { if (m_Vendor.Deleted) { return; } Mobile from = state.Mobile; from.CloseGump(typeof(PlayerVendorBuyGump)); if (info.ButtonID == 2) { if (m_VI.IsForSale && m_Item.RootParent == m_Vendor) { m_Vendor.Say(from.Name); Container pack = from.Backpack; if ((pack != null && pack.ConsumeTotal(typeof(Gold), m_VI.Price)) || from.BankBox.ConsumeTotal(typeof(Gold), m_VI.Price)) { m_Vendor.HoldGold += m_VI.Price; m_Vendor.RemoveInfo(m_Item); if (pack == null || !pack.TryDropItem(from, m_Item, false)) { m_Vendor.SayTo(from, 503204); // You do not have room in your backpack for this. m_Item.MoveToWorld(from.Location, from.Map); } } else { m_Vendor.SayTo(from, 503205); // You cannot afford this item. } } else { m_Vendor.SayTo(from, 503216); // You can't buy that. } } }
protected override void OnTarget(Mobile from, object o) { PlayerVendorTile pvt = o as PlayerVendorTile; if (o is PlayerVendorTile) { Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from)); v.Location = pvt.Location; v.Direction = from.Direction & Direction.Mask; v.Map = pvt.Map; v.SayTo(from, 503246); m_tcoe.Delete( ); pvt.Delete( ); } else { from.SendMessage(33, "That is not a Player vendor Tile"); } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (from.Region.Name == "Magincia") { //from.SendLocalizedMessage( 503248 ); // Your godly powers allow you to place this vendor whereever you wish. Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from)); v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, 503246); // Ah! it feels good to be working again. this.Delete(); } else { from.SendLocalizedMessage(1062677); // You cannot place a vendor or barkeep at this location. } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (!m_Vendor.CanInteractWith(from, false)) { return; } if (m_Vendor.IsOwner(from)) { m_Vendor.SayTo(from, 503212); // You own this shop, just take what you want. return; } if (info.ButtonID == 1) { if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack)) { m_Vendor.SayTo(from, 503216); // You can't buy that. return; } int totalGold = 0; if (from.Backpack != null) { totalGold += from.Backpack.GetAmount(typeof(Gold)); } totalGold += Banker.GetBalance(from); if (totalGold < m_VI.Price) { m_Vendor.SayTo(from, 503205); // You cannot afford this item. } else if (!from.PlaceInBackpack(m_VI.Item)) { m_Vendor.SayTo(from, 503204); // You do not have room in your backpack for this. } else { int leftPrice = m_VI.Price; if (from.Backpack != null) { leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice); } if (leftPrice > 0) { Banker.Withdraw(from, leftPrice); } m_Vendor.HoldGold += m_VI.Price; from.SendLocalizedMessage(503201); // You take the item. } } else { from.SendLocalizedMessage(503207); // Cancelled purchase. } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendLocalizedMessage(503248); // Your godly powers allow you to place this vendor whereever you wish. Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from)) { Direction = from.Direction & Direction.Mask }; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, 503246); // Ah! it feels good to be working again. EventSink.InvokePlacePlayerVendor(new PlacePlayerVendorEventArgs(from, v)); Delete(); } else { BaseHouse house = BaseHouse.FindHouseAt(from); if (house == null) { from.SendLocalizedMessage(503240); // Vendors can only be placed in houses. } else if (!BaseHouse.NewVendorSystem && !house.IsFriend(from)) { from.SendLocalizedMessage(503242); // You must ask the owner of this building to name you a friend of the household in order to place a vendor here. } else if (BaseHouse.NewVendorSystem && !house.IsOwner(from)) { from.SendLocalizedMessage(1062423); // Only the house owner can directly place vendors. Please ask the house owner to offer you a vendor contract so that you may place a vendor in this house. } else if (!house.Public || !house.CanPlaceNewVendor()) { from.SendLocalizedMessage(503241); // You cannot place this vendor or barkeep. Make sure the house is public and has sufficient storage available. } else { BaseHouse.IsThereVendor(from.Location, from.Map, out bool vendor, out bool contract); if (vendor) { from.SendLocalizedMessage(1062677); // You cannot place a vendor or barkeep at this location. } else if (contract) { from.SendLocalizedMessage(1062678); // You cannot place a vendor or barkeep on top of a rental contract! } else { Mobile v = new PlayerVendor(from, house) { Direction = from.Direction & Direction.Mask }; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, 503246); // Ah! it feels good to be working again. EventSink.InvokePlacePlayerVendor(new PlacePlayerVendorEventArgs(from, v)); Delete(); } } } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (!m_Vendor.CanInteractWith(from, false)) { return; } if (m_Vendor.IsOwner(from)) { m_Vendor.SayTo(from, 503212); // You own this shop, just take what you want. return; } if (info.ButtonID == 1) { m_Vendor.Say(from.Name); if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack)) { m_Vendor.SayTo(from, 503216); // You can't buy that. return; } int totalGold = 0; int price = m_VI.GetPrice(from, m_Vendor); Item[] items = from.Backpack.FindItemsByType(typeof(Gold), true); for (int i = 0; i < items.Length; ++i) { Item item = items[i]; if (item.LootType != LootType.Newbied && item.Movable) { totalGold += items[i].Amount; } } //if ( from.Backpack != null ) // totalGold += from.Backspack.GetAmount( typeof( Gold ) ); totalGold += Banker.GetBalance(from); if (totalGold < price) { m_Vendor.SayTo(from, 503205); // You cannot afford this item. } else if (!from.PlaceInBackpack(m_VI.Item)) { m_Vendor.SayTo(from, 503204); // You do not have room in your backpack for this. } else { int leftPrice = price; if (from.Backpack != null) { leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice); } if (leftPrice > 0) { Banker.Withdraw(from, leftPrice); } m_Vendor.HoldGold += price; from.SendLocalizedMessage(503201); // You take the item. } } else { from.SendLocalizedMessage(503207); // Cancelled purchase. } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (!m_Vendor.CanInteractWith(from, false)) { return; } if (m_Vendor.IsOwner(from)) { m_Vendor.SayTo(from, "Voce e o dono deste Shop, pegue o que quiser"); // You own this shop, just take what you want. return; } if (info.ButtonID == 1) { m_Vendor.Say(from.Name); if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack)) { m_Vendor.SayTo(from, "Voce nao pode comprar isto"); // You can't buy that. return; } int totalGold = 0; if (from.Backpack != null) { totalGold += from.Backpack.GetAmount(typeof(Gold)); } totalGold += Banker.GetBalance(from); if (totalGold < m_VI.Price) { m_Vendor.SayTo(from, "Voce nao tem dinheiro!"); // You cannot afford this item. } else if (!from.PlaceInBackpack(m_VI.Item)) { m_Vendor.SayTo(from, "Voce nao tem espaco na sua backpack"); // You do not have room in your backpack for this. } else { int leftPrice = m_VI.Price; if (from.Backpack != null) { leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice); } if (leftPrice > 0) { Banker.Withdraw(from, leftPrice); } m_Vendor.HoldGold += m_VI.Price; from.SendMessage("Voce comprou o item"); // You take the item. } } else { from.SendMessage("Voce cancelou a compra"); // Cancelled purchase. } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { if (info.ButtonID == 2) { PlayerVendor pv = m_Book.RootParent as PlayerVendor; if (m_Book.Entries.Contains(m_Object) && pv != null) { int price = 0; VendorItem vi = pv.GetVendorItem(m_Book); if (vi != null && !vi.IsForSale) { if (m_Object is PowerScrollBookEntry) { price = ((PowerScrollBookEntry)m_Object).Price; } } if (price != m_Price) { pv.SayTo(m_From, "The price has been been changed. If you like, you may offer to purchase the item again."); } else if (price == 0) { pv.SayTo(m_From, 1062382); } else { Item item = null; if (m_Object is PowerScrollBookEntry) { item = ((PowerScrollBookEntry)m_Object).Reconstruct(); } if (item == null) { m_From.SendMessage("Internal error. The power scroll could not be reconstructed."); } else { pv.Say(m_From.Name); Container pack = m_From.Backpack; if ((pack != null && pack.ConsumeTotal(typeof(Gold), price)) || Banker.Withdraw(m_From, price)) { m_Book.Entries.Remove(m_Object); m_Book.InvalidateProperties(); pv.HoldGold += price; if (m_From.AddToBackpack(item)) { m_From.SendMessage("The power scroll has been placed in your backpack."); } else { pv.SayTo(m_From, 503204); } if (m_Book.Entries.Count > 0) { m_From.SendGump(new PowerScrollBookGump(m_From, m_Book)); } else { m_From.SendLocalizedMessage(1062381); } } else { pv.SayTo(m_From, 503205); item.Delete(); } } } } else { if (pv == null) { m_From.SendLocalizedMessage(1062382); } else { pv.SayTo(m_From, 1062382); } } } else { m_From.SendLocalizedMessage(503207); } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (!m_Vendor.CanInteractWith(from, false)) { return; } if (m_Vendor.IsOwner(from)) { m_Vendor.SayTo(from, 503212); // You own this shop, just take what you want. return; } if (info.ButtonID == 1) { if (!m_VI.Valid) { m_Vendor.SayTo(from, 503216); // You can't buy that. return; } int totalGold = 0; if (from.Backpack != null) { totalGold += from.Backpack.GetAmount(typeof(Gold)); } if (from.BankBox != null) { totalGold += from.BankBox.GetAmount(typeof(Gold)); } if (totalGold < m_VI.Price) { m_Vendor.SayTo(from, 503205); // You cannot afford this item. } else if (!from.PlaceInBackpack(m_VI.Item)) { m_Vendor.SayTo(from, 503204); // You do not have room in your backpack for this. } else { int leftPrice = m_VI.Price; if (from.Backpack != null) { Container cont = from.Backpack; int silvtotal = 0; Item[] silvers = cont.FindItemsByType(typeof(Silver), true); foreach (Silver silver in silvers) { silvtotal += silver.Amount; silver.Delete(); } Gold money = new Gold(); cont.AddItem(money); money.Amount = silvtotal / 10; if (silvtotal - money.Amount > 0) { Silver change = new Silver(); cont.AddItem(change); change.Amount = silvtotal - (money.Amount * 10); } leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice); } if (leftPrice > 0 && from.BankBox != null) { from.BankBox.ConsumeUpTo(typeof(Gold), leftPrice); } m_Vendor.HoldGold += m_VI.Price; from.SendLocalizedMessage(503201); // You take the item. } } else { from.SendLocalizedMessage(503207); // Cancelled purchase. } }
public override void OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID == 2) { PlayerVendor pv = m_Book.RootParent as PlayerVendor; if (pv != null) { int price = 0; VendorItem vi = pv.GetVendorItem(m_Book); if (vi != null && !vi.IsForSale) { price = m_Recipe.Price; } if (price != m_Price) { pv.SayTo(m_From, 1150158); // The price of the selected item has been changed from the value you confirmed. You must select and confirm the purchase again at the new price in order to buy it. m_Book.Using = false; } else if (m_Recipe.Amount == 0 || price == 0) { pv.SayTo(m_From, 1158821); // The recipe selected is not available. m_Book.Using = false; } else { Item item = new RecipeScroll(m_Recipe.RecipeID); pv.Say(m_From.Name); Container pack = m_From.Backpack; if ((pack != null && pack.ConsumeTotal(typeof(Gold), price)) || Banker.Withdraw(m_From, price)) { m_Book.Recipes.ForEach(x => { if (x.RecipeID == m_Recipe.RecipeID) { x.Amount = x.Amount - 1; } }); m_Book.InvalidateProperties(); pv.HoldGold += price; if (m_From.AddToBackpack(item)) { m_From.SendLocalizedMessage(1158820); // The recipe has been placed in your backpack. } else { pv.SayTo(m_From, 503204); // You do not have room in your backpack for this. } m_From.SendGump(new RecipeBookGump(m_From, m_Book)); } else { pv.SayTo(m_From, 503205); // You cannot afford this item. item.Delete(); m_Book.Using = false; } } } else { m_Book.Using = false; if (pv == null) { m_From.SendLocalizedMessage(1158821); // The recipe selected is not available. } else { pv.SayTo(m_From, 1158821); // The recipe selected is not available. } } } else { m_Book.Using = false; m_From.SendLocalizedMessage(503207); // Cancelled purchase. } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendMessage("O item precisa estar na sua bag"); // That must be in your pack for you to use it. } else if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendMessage("Voce e GM e pode colocar o vendedor onde quiser."); // Your godly powers allow you to place this vendor whereever you wish. Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from)); v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, "Ah! Como e bom voltar ao trabalho..."); // Ah! it feels good to be working again. this.Delete(); } else { BaseHouse house = BaseHouse.FindHouseAt(from); if (house == null) { from.SendMessage("Vendedores so podem ser colocados dentro de casa"); // Vendors can only be placed in houses. } else if (!BaseHouse.NewVendorSystem && !house.IsFriend(from)) { from.SendMessage("Apenas o dono, sócios e amigos podem colocar vendedores nesta casa"); // You must ask the owner of this building to name you a friend of the household in order to place a vendor here. } else if (BaseHouse.NewVendorSystem && !house.IsOwner(from)) { from.SendMessage("Apenas o dono pode colocar vendedores diretamente."); // Only the house owner can directly place vendors. Please ask the house owner to offer you a vendor contract so that you may place a vendor in this house. } else if (!house.Public || !house.CanPlaceNewVendor()) { from.SendMessage("Voce nao pode colocar este vendedor aqui. Verifique se a casa e publica e tem espaco suficiente."); // You cannot place this vendor or barkeep. Make sure the house is public and has sufficient storage available. } else { bool vendor, contract; BaseHouse.IsThereVendor(from.Location, from.Map, out vendor, out contract); if (vendor) { from.SendMessage("Voce nao pode colocar um vendedor aqui"); // You cannot place a vendor or barkeep at this location. } else if (contract) { from.SendMessage("Voce nao pode colocar este vendedor aqui, verifique o contrato."); // You cannot place a vendor or barkeep on top of a rental contract! } else { Mobile v = new PlayerVendor(from, house); v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, "Ah! Como e bom voltar ao trabalho..."); // Ah! it feels good to be working again. this.Delete(); } } } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendLocalizedMessage(503248); //Your godly powers allow you to place this vendor whereever you wish. Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from)); v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, 503246); // Ah! it feels good to be working again. this.Delete(); } else { //find the house there at BaseHouse house = BaseHouse.FindHouseAt(from); // wea: allow placement within tents if (house == null) { if (from.Region != null) { // is there a tent belonging to the person's account here though? if (from.Region is HouseRegion) { HouseRegion hr = (HouseRegion)from.Region; if ((hr.House is Tent || hr.House is SiegeTent) && hr.House.Owner.Account == from.Account) { house = ((HouseRegion)from.Region).House; } } } } if (house == null) { from.SendLocalizedMessage(503240); //Vendors can only be placed in houses. } else if (!house.IsFriend(from)) { from.SendLocalizedMessage(503242); //You must ask the owner of this house to make you a friend in order to place this vendor here, } else if (!house.Public) { from.SendLocalizedMessage(503241); //You cannot place this vendor. Make sure the building is public and you have not reached your vendor limit. } else if (!house.CanPlaceNewVendor()) { from.SendLocalizedMessage(503241); // You cannot place this vendor or barkeep. Make sure the house is public or a shop and has sufficient storage available. } //else if (house.FindTownshipNPC() != null) else if (house.CanPlacePlayerVendorInThisTownshipHouse() == false) { from.SendMessage("You cannot place a vendor in a house with the township NPCs present."); } else { Mobile v = new PlayerVendor(from, house); v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, 503246); // Ah! it feels good to be working again. this.Delete(); } } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendLocalizedMessage(503248); // Your godly powers allow you to place this vendor whereever you wish. Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from)); v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, 503246); // Ah! it feels good to be working again. Delete(); } else { bool canplace = false; BaseHouse house = BaseHouse.FindHouseAt(from); CustomRegion cR; if ((cR = from.Region as CustomRegion) != null && !cR.Controller.CanPlaceVendors) { if (house == null) { from.SendAsciiMessage("Vendors can only be placed in houses or specified areas."); } else { from.SendAsciiMessage("You cannot place a vendor in this region"); } } else if ((cR = from.Region as CustomRegion) != null && cR.Controller.CanPlaceVendors) { canplace = true; try { foreach (Mobile mob in cR.GetMobiles()) { if (mob is PlayerVendor && (mob as PlayerVendor).Owner.Account == from.Account) { from.SendAsciiMessage("You alread have a vendor placed in this region."); canplace = false; return; } } } catch (Exception e) { Console.WriteLine(e.ToString()); } } else if (house == null) { from.SendAsciiMessage("Vendors can only be placed in houses or specified areas."); } else if (!BaseHouse.NewVendorSystem && !house.IsFriend(from)) { from.SendLocalizedMessage(503242); // You must ask the owner of this building to name you a friend of the household in order to place a vendor here. } else if (BaseHouse.NewVendorSystem && !house.IsOwner(from)) { from.SendLocalizedMessage(1062423); // Only the house owner can directly place vendors. Please ask the house owner to offer you a vendor contract so that you may place a vendor in this house. } else if (!house.Public || !house.CanPlaceNewVendor()) { from.SendLocalizedMessage(503241); // You cannot place this vendor or barkeep. Make sure the house is public and has sufficient storage available. } else { canplace = true; } if (canplace) { bool vendor, contract; BaseHouse.IsThereVendor(from.Location, from.Map, out vendor, out contract); if (vendor) { from.SendLocalizedMessage(1062677); // You cannot place a vendor or barkeep at this location. } else if (contract) { from.SendLocalizedMessage(1062678); // You cannot place a vendor or barkeep on top of a rental contract! } else { Mobile v = new PlayerVendor(from, house); v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, 503246); // Ah! it feels good to be working again. Delete(); } } } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendLocalizedMessage(503248); //Your godly powers allow you to place this vendor whereever you wish. Mobile v = new PlayerVendor(from); v.Location = from.Location; v.Direction = from.Direction & Direction.Mask; v.Map = from.Map; v.SayTo(from, 503246); // Ah! it feels good to be working again. this.Delete(); } else { BaseHouse house = BaseHouse.FindHouseAt(from); if (house == null && from.Region is HouseRegion) { //allow placement in tents house = ((HouseRegion)from.Region).House; if (house != null && !(house is Tent)) { house = null; } } if (house == null) { from.SendLocalizedMessage(503240); //Vendors can only be placed in houses. } else if (!house.IsOwner(from)) { from.SendLocalizedMessage(503242); // You must ask the owner of this house to make you a friend in order to place this vendor here, } else { IPooledEnumerable eable = from.GetMobilesInRange(0); foreach (Mobile m in eable) { if (!m.Player) { from.SendAsciiMessage("There is something blocking that location."); eable.Free(); return; } } Mobile v = new PlayerVendor(from); v.Location = from.Location; v.Direction = from.Direction & Direction.Mask; v.Map = from.Map; v.SayTo(from, 503246); // Ah! it feels good to be working again. this.Delete(); } } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (!m_Vendor.CanInteractWith(from, false)) { return; } if (m_Vendor.IsOwner(from)) { m_Vendor.SayTo(from, 503212); // You own this shop, just take what you want. return; } if (info.ButtonID == 1) { if (!m_VI.Valid) { m_Vendor.SayTo(from, 503216); // You can't buy that. return; } int totalGold = 0; if (from.Backpack != null) { totalGold += from.Backpack.GetAmount(typeof(Gold)); } if (from.BankBox != null) { totalGold += from.BankBox.GetAmount(typeof(Gold)); } if (totalGold < m_VI.Price) { m_Vendor.SayTo(from, 503205); // You cannot afford this item. } else if (!from.PlaceInBackpack(m_VI.Item)) { m_Vendor.SayTo(from, 503204); // You do not have room in your backpack for this. } else { int leftPrice = m_VI.Price; if (from.Backpack != null) { leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice); } if (leftPrice > 0 && from.BankBox != null) { from.BankBox.ConsumeUpTo(typeof(Gold), leftPrice); } if (m_Vendor is CityPlayerVendor) { CityPlayerVendor vend = (CityPlayerVendor)m_Vendor; double rate = Convert.ToDouble(vend.TaxRate) / 100.0; double tax = Convert.ToDouble(m_VI.Price) * rate; int taxx = Convert.ToInt32(tax); vend.IncomeTax += taxx; vend.HoldGold += (m_VI.Price - taxx); } else { m_Vendor.HoldGold += m_VI.Price; } from.SendLocalizedMessage(503201); // You take the item. } } else { from.SendLocalizedMessage(503207); // Cancelled purchase. } }
public override void OnResponse(Network.NetState sender, RelayInfo info) { if (info.ButtonID == 2) { PlayerVendor pv = m_Book.RootParent as PlayerVendor; if (m_Book.Entries.Contains(m_Object) && pv != null) { int price = 0; VendorItem vi = pv.GetVendorItem(m_Book); if (vi != null && !vi.IsForSale) { if (m_Object is BOBLargeEntry) { price = ((BOBLargeEntry)m_Object).Price; } else if (m_Object is BOBSmallEntry) { price = ((BOBSmallEntry)m_Object).Price; } } if (price != m_Price) { pv.SayTo(m_From, "The price has been been changed. If you like, you may offer to purchase the item again."); } else if (price == 0) { pv.SayTo(m_From, 1062382); // The deed selected is not available. } else { Item item = null; if (m_Object is BOBLargeEntry) { item = ((BOBLargeEntry)m_Object).Reconstruct(); } else if (m_Object is BOBSmallEntry) { item = ((BOBSmallEntry)m_Object).Reconstruct(); } if (item == null) { m_From.SendMessage("Internal error. The bulk order deed could not be reconstructed."); } else { pv.Say(m_From.Name); Container pack = m_From.Backpack; if ((pack == null) || ((pack != null) && (!pack.CheckHold(m_From, item, true, true, 0, item.PileWeight + item.TotalWeight)))) { pv.SayTo(m_From, 503204); // You do not have room in your backpack for this m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null)); } else { if ((pack != null && pack.ConsumeTotal(typeof(Gold), price)) || Banker.Withdraw(m_From, price)) { m_Book.Entries.Remove(m_Object); m_Book.InvalidateProperties(); pv.HoldGold += price; m_From.AddToBackpack(item); m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack. if (m_Book.Entries.Count / 5 < m_Book.ItemCount) { m_Book.ItemCount--; m_Book.InvalidateItems(); } if (m_Book.Entries.Count > 0) { m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null)); } else { m_From.SendLocalizedMessage(1062381); // The book is empty. } } else { pv.SayTo(m_From, 503205); // You cannot afford this item. item.Delete(); } } } } } else { if (pv == null) { m_From.SendLocalizedMessage(1062382); // The deed selected is not available. } else { pv.SayTo(m_From, 1062382); // The deed selected is not available. } } } else { m_From.SendLocalizedMessage(503207); // Cancelled purchase. } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendAsciiMessage("That must be in your pack for you to use it."); // That must be in your pack for you to use it. } else if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendAsciiMessage("Your godly powers allow you to place this vendor whereever you wish."); // Your godly powers allow you to place this vendor whereever you wish. Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from)); v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, true, "Ah! it feels good to be working again."); // Ah! it feels good to be working again. this.Delete(); } else { BaseHouse house = BaseHouse.FindHouseAt(from); if (house == null) { from.SendAsciiMessage("Vendors can only be placed in houses."); // Vendors can only be placed in houses. } else if (!Key.ContainsKey(from.Backpack, house.keyValue)) { from.SendAsciiMessage("You can only place this in a house that you own!"); } /*else if ( !BaseHouse.NewVendorSystem && !house.IsFriend( from ) ) * { * from.SendAsciiMessage("You can only place this in a house that you own!"); // You must ask the owner of this building to name you a friend of the household in order to place a vendor here. * } * else if ( BaseHouse.NewVendorSystem && !house.IsOwner( from ) ) * { * from.SendAsciiMessage("You can only place this in a house that you own!"); // Only the house owner can directly place vendors. Please ask the house owner to offer you a vendor contract so that you may place a vendor in this house. * } * else if ( !house.Public || !house.CanPlaceNewVendor() ) * { * from.SendAsciiMessage( "You cannot place this vendor or barkeep. Make sure the house is public and has sufficient storage available." ); // You cannot place this vendor or barkeep. Make sure the house is public and has sufficient storage available. * }*/ else { bool vendor, contract; BaseHouse.IsThereVendor(from.Location, from.Map, out vendor, out contract); if (vendor) { from.SendAsciiMessage("You cannot place a vendor at this location."); // You cannot place a vendor or barkeep at this location. } else if (contract) { from.SendLocalizedMessage(1062678); // You cannot place a vendor or barkeep on top of a rental contract! } else { Mobile v = new PlayerVendor(from, house); v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, true, "Ah! it feels good to be working again."); // Ah! it feels good to be working again. this.Delete(); } } } }