public virtual void VendorSell(Mobile from) { if (!IsActiveBuyer) { return; } if (!from.CheckAlive()) { return; } if (!CheckVendorAccess(from)) { //Say( 501522 ); // I shall not treat with scum like thee! Say("Je ne peux rien vous vendre."); return; } Container pack = from.Backpack; if (pack != null) { IShopSellInfo[] info = GetSellInfo(); Dictionary <Item, SellItemState> table = new Dictionary <Item, SellItemState>(); foreach (IShopSellInfo ssi in info) { Item[] items = pack.FindItemsByType(ssi.Types); foreach (Item item in items) { if (item is Container && ((Container)item).Items.Count != 0) { continue; } if (item.IsStandardLoot() && item.Movable && ssi.IsSellable(item)) { table[item] = new SellItemState(item, ssi.GetSellPriceFor(item), ssi.GetNameFor(item)); } } } if (table.Count > 0) { SendPacksTo(from); from.Send(new VendorSellList(this, table.Values)); } else { Say(true, "Vous n'avez rien qui m'interesses."); } } }
public virtual void VendorSell(Mobile from) { if (!IsActiveBuyer) { return; } if (!from.CheckAlive()) { return; } if (!CheckVendorAccess(from)) { Say(501522); // I shall not treat with scum like thee! return; } Container pack = from.Backpack; if (pack != null) { IShopSellInfo[] info = GetSellInfo(); Hashtable table = new Hashtable(); foreach (IShopSellInfo ssi in info) { Item[] items = pack.FindItemsByType(ssi.Types); foreach (Item item in items) { if (item is Container && ((Container)item).Items.Count != 0) { continue; } if (item.IsStandardLoot() && item.Movable && ssi.IsSellable(item)) { table[item] = new SellItemState(item, ssi.GetSellPriceFor(item), ssi.GetNameFor(item)); } } } if (table.Count > 0) { SendPacksTo(from); from.Send(new VendorSellList(this, table)); } else { Say(true, "You have nothing I would be interested in."); } } }
public virtual void VendorSell( Mobile from ) { if ( !IsActiveBuyer ) return; if ( !from.CheckAlive() ) return; if ( !CheckVendorAccess( from ) ) { Say( 501522 ); // I shall not treat with scum like thee! return; } Container pack = from.Backpack; if ( pack != null ) { IShopSellInfo[] info = GetSellInfo(); Dictionary<Item, SellItemState> table = new Dictionary<Item, SellItemState>(); foreach ( IShopSellInfo ssi in info ) { Item[] items = pack.FindItemsByType( ssi.Types ); foreach ( Item item in items ) { if ( item is Container && ( (Container)item ).Items.Count != 0 ) continue; if ( item.IsStandardLoot() && item.Movable && ssi.IsSellable( item ) ) table[item] = new SellItemState( item, ssi.GetSellPriceFor( item ), ssi.GetNameFor( item ) ); } } if ( table.Count > 0 ) { SendPacksTo( from ); from.Send( new VendorSellList( this, table.Values ) ); } else { Say( true, "You have nothing I would be interested in." ); } } }
public virtual void VendorSell(Mobile from) { if (!IsActiveBuyer) return; if (!from.CheckAlive()) return; if (!CheckVendorAccess(from)) { Say(501522); // I shall not treat with scum like thee! return; } Container cont = this.BuyPack; ArrayList playerItems = cont.Items; ArrayList deleteItems = new ArrayList(); for (int i = playerItems.Count - 1; i >= 0; --i) { Item item = (Item)playerItems[i]; if ((item.LastMoved + InventoryDecayTime) <= DateTime.Now) deleteItems.Add( playerItems[i] ); } for (int i = deleteItems.Count - 1; i >= 0; --i) { Item item = (Item)deleteItems[i]; item.Delete(); } if (DateTime.Now - m_LastRestock > RestockDelay) Restock(); if ( playerItems.Count > InventoryBuyPackLimit ) { Say( true, "I cannot purchase more at this time." ); return; } Container pack = from.Backpack; if (pack != null) { IShopSellInfo[] info = GetSellInfo(); Hashtable table = new Hashtable(); foreach (IShopSellInfo ssi in info) { Item[] items = pack.FindItemsByType(ssi.Types); foreach (Item item in items) { if (item is Container && ((Container)item).Items.Count != 0) continue; if (item.IsStandardLoot() && item.Movable && ssi.IsSellable(item)) table[item] = new SellItemState(item, ssi.GetSellPriceFor(item), ssi.GetNameFor(item)); } } if (table.Count > 0) { SendPacksTo(from); from.Send(new VendorSellList(this, table)); } else { Say(true, "You have nothing I would be interested in."); } } }
public override void VendorSell( Mobile from ) { if ( !IsActiveBuyer ) return; if ( !from.CheckAlive() ) return; if ( !CheckVendorAccess( from ) ) { Say( 501522 ); //I shall not treat with scum like thee! return; } Container pack = from.Backpack; if ( pack != null ) { VendorEntry[] info = (VendorEntry[])m_CustomSellList.ToArray( typeof( VendorEntry ) ); Hashtable table = new Hashtable(); foreach ( VendorEntry entry in info ) { Item[] items = pack.FindItemsByType( entry.Type ); foreach ( Item item in items ) { if ( item is Container && ((Container)item).Items.Count != 0 ) continue; if ( item.IsStandardLoot() && item.Movable ) table[item] = new SellItemState( item, entry.Price, item.Name ); } } if ( table.Count > 0 ) { SendPacksTo( from ); from.Send( new VendorSellList( this, table ) ); } else { Say( true, "You have nothing I would be interested in." ); } } }
public virtual void VendorSell( Mobile from ) { if ( !IsActiveBuyer ) return; if ( !from.CheckAlive() ) return; if ( !CheckVendorAccess( from ) ) { Say( 501522 ); // I shall not treat with scum like thee! return; } if( DateTime.Now - m_LastRestock > RestockDelay ) Restock(); if(heldGold <= 0) { Say("Sorry, I am currently broke."); return; } Container pack = from.Backpack; if ( pack != null ) { IShopSellInfo[] info = GetSellInfo(); Hashtable table = new Hashtable(); foreach ( IShopSellInfo ssi in info ) { Item[] items = pack.FindItemsByType( ssi.Types ); foreach ( Item item in items ) { if ( item is Container && ( (Container)item ).Items.Count != 0 ) continue; if ( item.IsStandardLoot() && item.Movable && ssi.IsSellable( item ) ) table[item] = new SellItemState( item, ssi.GetSellPriceFor( item ), ssi.GetNameFor( item ) ); } } if ( table.Count > 0 ) { SendPacksTo( from ); from.Send( new VendorSellList( this, table ) ); } else { Say( true, "You have nothing I would be interested in." ); } } }
public virtual void VendorSell(Mobile from) { if (!IsActiveBuyer) { return; } if (!from.CheckAlive()) { return; } if (this.Home != Point3D.Zero && !this.InRange(this.Home, this.RangeHome + 5)) { this.Say("Please allow me to return to my shop so that I might assist thee."); this.Location = this.Home; return; } double discount = GetSellDiscountFor(from); if (DateTime.Now - m_LastRestock > RestockDelay) { Restock(); // restocks the bank account too so must do it on sell also } Container pack = from.Backpack; bool noMoney = false; if (pack != null) { IShopSellInfo[] info = GetSellInfo(); Hashtable table = new Hashtable(); foreach (IShopSellInfo ssi in info) { Item[] items = pack.FindItemsByType(ssi.Types); foreach (Item item in items) { if (item is Container && ((Container)item).Items.Count != 0) { continue; } if (item.IsStandardLoot() && item.Movable && ssi.IsSellable(item)) { int price = (int)Math.Round(ssi.GetSellPriceFor(item) * discount); if (price < 1) { price = 1; } if (price <= m_BankAccount) { table[item] = new SellItemState(item, price, ssi.GetNameFor(item)); } else { noMoney = true; } } } } if (table.Count > 0) { SendPacksTo(from); from.Send(new VendorSellList(this, table)); foreach (SellItemState sis in table.Values) { int loc; try { loc = Utility.ToInt32(sis.Name); } catch { loc = 0; } if (loc > 500000) { from.Send(new FakeOPL(sis.Item.Serial, loc)); } else { from.Send(new FakeOPL(sis.Item.Serial, sis.Name)); } } } else { if (noMoney) { Say(true, "I don't have enough money to buy anything right now."); } else { Say(true, "You have nothing I would be interested in."); } } } }
public virtual void VendorSell(Mobile from) { if (!IsActiveBuyer) return; if (!from.CheckAlive()) return; Container pack = from.Backpack; if (pack != null) { IShopSellInfo[] info = GetSellInfo(); Hashtable table = new Hashtable(); foreach (IShopSellInfo ssi in info) { Item[] items = pack.FindItemsByType(ssi.Types); foreach (Item item in items) { if (item is Container && ((Container)item).Items.Count != 0) continue; if (item is CommodityDeed) { CommodityDeed cd = (CommodityDeed)item; if (cd.Commodity == null) continue; if (ResourcePool.IsPooledResource(cd.Commodity.GetType()) && ssi.IsSellable(cd.Commodity)) table[item] = new SellItemState(item, (int)ResourcePool.GetWholesalePrice(cd.Commodity.GetType()), "Commodity Deed"); } else if (item.IsStandardLoot() && item.Movable && ssi.IsSellable(item)) { if (ResourcePool.IsPooledResource(item.GetType())) table[item] = new SellItemState(item, (int)ResourcePool.GetWholesalePrice(item.GetType()), ResourcePool.GetName(item.GetType())); else table[item] = new SellItemState(item, ssi.GetSellPriceFor(item), ssi.GetNameFor(item)); } } } if (table.Count > 0) { SendPacksTo(from); from.Send(new VendorSellList(this, table)); } else { Say(true, "You have nothing I would be interested in."); } } }
public virtual void VendorSell(Mobile from) { if (!IsActiveBuyer) { return; } if (!from.CheckAlive()) { return; } if (!CheckVendorAccess(from)) { Say(501522); // I shall not treat with scum like thee! return; } //TEST: Figure Out Budgets Concept if (m_Budgets.ContainsKey(from.Serial)) { /* * if ( from.AccessLevel >= AccessLevel.GameMaster ) * { * SayTo( from, true, "Your current budget is {0}, which resets at {1}", * m_Budgets[from.Serial].CurrentBudget, m_Budgets[from.Serial].ResetBudgetAt ); * } */ if (DateTime.UtcNow < m_Budgets[from.Serial].ResetBudgetAt) { } else { m_Budgets[from.Serial].CurrentBudget = 0; m_Budgets[from.Serial].ResetBudgetAt = DateTime.UtcNow + Budget.TimeFrame; } } else { m_Budgets.Add(from.Serial, new Budget(0, DateTime.UtcNow + Budget.TimeFrame)); } Container pack = from.Backpack; if (pack != null) { IShopSellInfo[] info = GetSellInfo(); IBuyItemInfo[] buyinfo = GetBuyInfo(); Hashtable table = new Hashtable(); int numItemsNotCraftedBySeller = 0; foreach (IShopSellInfo ssi in info) { Item[] items = pack.FindItemsByType(ssi.Types); foreach (Item item in items) { if (item is Container && ((Container)item).Items.Count != 0) { continue; } if (item.IsStandardLoot() && item.Movable && ssi.IsSellable(item)) { int price = ssi.GetSellPriceFor(item); for (int idx = 0; idx < buyinfo.Length; idx++) { IBuyItemInfo buyItem = (IBuyItemInfo)buyinfo[idx]; GenericBuyInfo gbi = (GenericBuyInfo)buyItem; if (item.GetType().IsAssignableFrom(gbi.Type) && !(item is BaseWeapon) && !(item is BaseArmor)) { if (price >= buyItem.Price) { price = buyItem.Price - 1; } } } table[item] = new SellItemState(item, price, ssi.GetNameFor(item)); } } } if (table.Count > 0) { SendPacksTo(from); from.Send(new VendorSellList(this, table)); } else { Say(true, "You have nothing I would be interested in."); } } }
public virtual void VendorSell(Mobile from) { if (!IsActiveBuyer) { return; } if (!from.CheckAlive()) { return; } if (Home != Point3D.Zero) { if (Math.Abs(Location.X - Home.X) > 30 || Math.Abs(Location.Y - Home.Y) > 30) { Location = Home; return; } } // fact = Faction.Find( from ); if (!CheckVendorAccess(from)) { Say(501522); // I shall not treat with scum like thee! return; } /*else if ( FactionAllegiance != null && fact != null && FactionAllegiance != fact ) { Say( "I will not do business with the enemy!" ); return; }*/ Container cont = BuyPack; List<Item> playerItems = cont.Items; for (int i = playerItems.Count - 1; i >= 0; --i) { if (i >= playerItems.Count) { continue; } Item item = playerItems[i]; if ((item.LastMoved + InventoryDecayTime) <= DateTime.UtcNow) { item.Delete(); } } if (playerItems.Count > InventoryBuyPackLimit) { Say(true, "I cannot purchase more at this time."); } else { Container pack = from.Backpack; if (pack != null) { IShopSellInfo[] info = GetSellInfo(); var table = new Dictionary<Item, SellItemState>(); foreach (IShopSellInfo ssi in info) { Item[] items = pack.FindItemsByType(ssi.Types); foreach (Item item in items.Where(item => !(item is Container) || item.Items.Count == 0) .Where(item => item.IsStandardLoot() && item.Movable && ssi.IsSellable(item))) { table[item] = new SellItemState(item, ssi.GetSellPriceFor(item), ssi.GetNameFor(item)); } } if (table.Count > 0) { SendPacksTo(from); from.Send(new VendorSellList(this, table)); } else { Say(true, "You have nothing I would be interested in."); } } } }
public virtual void VendorSell( Mobile from ) { if ( !IsActiveBuyer ) return; if ( !from.CheckAlive() ) return; if ( this.Home != Point3D.Zero && !this.InRange( this.Home, this.RangeHome+5 ) ) { this.Say( "Please allow me to return to my shop so that I might assist thee." ); this.Location = this.Home; return; } double discount = GetSellDiscountFor( from ); if ( DateTime.Now - m_LastRestock > RestockDelay ) Restock();// restocks the bank account too so must do it on sell also Container pack = from.Backpack; bool noMoney = false; if ( pack != null ) { IShopSellInfo[] info = GetSellInfo(); Hashtable table = new Hashtable(); foreach ( IShopSellInfo ssi in info ) { Item[] items = pack.FindItemsByType( ssi.Types ); foreach ( Item item in items ) { if ( item is Container && ((Container)item).Items.Count != 0 ) continue; if ( item.IsStandardLoot() && item.Movable && ssi.IsSellable( item ) ) { int price = (int)Math.Round( ssi.GetSellPriceFor( item ) * discount ); if ( price < 1 ) price = 1; if ( price <= m_BankAccount ) table[item] = new SellItemState( item, price, ssi.GetNameFor( item ) ); else noMoney = true; } } } if ( table.Count > 0 ) { SendPacksTo( from ); from.Send(new VendorSellList(this, table)); foreach ( SellItemState sis in table.Values ) { int loc; try { loc = Utility.ToInt32( sis.Name ); } catch { loc = 0; } if ( loc > 500000 ) from.Send( new FakeOPL( sis.Item.Serial, loc ) ); else from.Send( new FakeOPL( sis.Item.Serial, sis.Name ) ); } } else { if ( noMoney ) Say( true, "I don't have enough money to buy anything right now." ); else Say( true, "You have nothing I would be interested in." ); } } }