public static void TryToBuy(Item item, Mobile from) { PlayerVendor vendor = item.RootParent as PlayerVendor; if (vendor == null || !vendor.CanInteractWith(from, false)) { return; } if (vendor.IsOwner(from)) { vendor.SayTo(from, 503212); // You own this shop, just take what you want. return; } VendorItem vi = vendor.GetVendorItem(item); if (vi == null) { vendor.SayTo(from, 503216); // You can't buy that. } else if (!vi.IsForSale) { vendor.SayTo(from, 503202); // This item is not for sale. } else if (vi.Created + TimeSpan.FromMinutes(1.0) > DateTime.Now) { from.SendMessage("You cannot buy this item right now. Please wait one minute and try again."); } else { from.CloseGump(typeof(PlayerVendorBuyGump)); from.SendGump(new PlayerVendorBuyGump(vendor, vi)); } }
public static void TryToBuy(Item item, Mobile from) { PlayerVendor vendor = item.RootParent as PlayerVendor; if (vendor == null || !vendor.CanInteractWith(from, false)) { return; } if (vendor.IsOwner(from)) { vendor.SayTo(from, 503212); // You own this shop, just take what you want. return; } VendorItem vi = vendor.GetVendorItem(item); if (vi == null) { vendor.SayTo(from, 503216); // You can't buy that. } else if (!vi.IsForSale) { vendor.SayTo(from, 503202); // This item is not for sale. } else { from.CloseGump(typeof(PlayerVendorBuyGump)); from.SendGump(new PlayerVendorBuyGump(vendor, vi)); } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Item) { Item item = (Item)targeted; PlayerVendor vendor = item.RootParent as PlayerVendor; if (vendor == null) { return; } VendorItem vi = (VendorItem)vendor.SellItems[item]; if (vi != null) { if (vi.IsForSale) { from.SendGump(new PlayerVendorBuyGump(item, vendor, vi)); } else { vendor.SayTo(from, 503202); // This item is not for sale. } return; } vendor.SayTo(from, 503216); // You can't buy that. } }
private void SetInfo(Mobile from, int price, string description) { Item item = m_VI.Item; bool setPrice = false; if (price < 0) // Not for sale { price = -1; if (item is Container) { if (item is LockableContainer && ((LockableContainer)item).Locked) { m_Vendor.SayTo(from, 1043298); // Locked items may not be made not-for-sale. } else if (item.Items.Count > 0) { m_Vendor.SayTo(from, 1043299); // To be not for sale, all items in a container must be for sale. } else { setPrice = true; } } else if (item is BaseBook) { setPrice = true; } else { m_Vendor.SayTo(from, 1043301); // Only the following may be made not-for-sale: books, containers, keyrings, and items in for-sale containers. } } else { if (price > 100000000) { price = 100000000; from.SendMessage( "You cannot price items above 100,000,000 gold. The price has been adjusted."); } setPrice = true; } if (setPrice) { m_Vendor.SetVendorItem(item, price, description); } else { m_VI.Description = description; } }
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 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 { 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, out vendor ); 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. this.Delete(); } } } }
private void GiveGold(Mobile to, int amount) { if (amount <= 0) { m_Vendor.SayTo(to, "Very well. I will hold on to the money for now then."); } else { m_Vendor.GiveGold(to, amount); } }
public override void OnResponse(Mobile from, string text) { if (!m_Vendor.CanInteractWith(from, true)) { return; } string name = text.Trim(); if (!NameVerification.Validate(name, 1, 20, true, true, true, 0, NameVerification.Empty)) { m_Vendor.SayTo(from, "That name is unacceptable."); return; } m_Vendor.ShopName = Utility.FixHtml(name); from.SendGump(new NewPlayerVendorOwnerGump(m_Vendor)); }
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.SendAsciiMessage( "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." ); 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 { BaseHouse house = BaseHouse.FindHouseAt( from ); if ( house == null ) { from.SendAsciiMessage( "Vendors can only be placed in houses." ); } else if ( !BaseHouse.NewVendorSystem && !house.IsFriend( from ) ) { from.SendAsciiMessage( "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( "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." ); } else { bool vendor, contract; BaseHouse.IsThereVendor( from.Location, from.Map, out vendor, out contract ); if ( vendor ) { from.SendAsciiMessage( "You cannot place a vendor or barkeep at this location." ); } else if ( contract ) { from.SendAsciiMessage( "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. 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 ); if( from is PlayerMobile && ((PlayerMobile)from).Nation != Nation.None ) { Nation nation = ((PlayerMobile)from).Nation; v.Hue = BaseKhaerosMobile.AssignRacialHue( nation ); v.HairItemID = BaseKhaerosMobile.AssignRacialHair( nation, v.Female ); int hairhue = BaseKhaerosMobile.AssignRacialHairHue( nation ); v.HairHue = hairhue; v.Name = BaseKhaerosMobile.RandomName( nation, v.Female ); if( !v.Female ) { v.FacialHairItemID = BaseKhaerosMobile.AssignRacialFacialHair( nation ); v.FacialHairHue = hairhue; } BaseCreature.RemoveEquipFrom( v ); BaseKhaerosMobile.RandomCrafterClothes( v, nation ); } v.SayTo( from, 503246 ); // Ah! it feels good to be working again. this.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 ) && !house.IsCoOwner( 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 { 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. 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, 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 { BaseHouse house = BaseHouse.FindHouseAt( from ); #region VendorTile Sector sector = from.Map.GetSector(from.Location); foreach (Item i in sector.Items) { if (i is VendorTile && i.Location.X == from.Location.X && i.Location.Y == from.Location.Y) { 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(); return; } } #endregion 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 { 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. this.Delete(); } } } }
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, HousingHelper.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 { var house = HousingHelper.FindHouseAt( from ); if ( house == null ) { from.SendLocalizedMessage( 503240 ); // Vendors can only be placed in houses. } else if ( !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 { bool vendor, contract; HousingHelper.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. this.Delete(); } } } }