本文整理汇总了C#中Server.Mobiles.PlayerVendor.GetVendorItem方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerVendor.GetVendorItem方法的具体用法?C# PlayerVendor.GetVendorItem怎么用?C# PlayerVendor.GetVendorItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Mobiles.PlayerVendor
的用法示例。
在下文中一共展示了PlayerVendor.GetVendorItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: processContainer
private static void processContainer(PlayerVendor vendor, Container container)
{
foreach (Item i in container.Items)
{
VendorItem vi = vendor.GetVendorItem(i);
if (vi != null)
{
if (vi.IsForSale)
{
MyVendorItem mvi = new MyVendorItem();
mvi.Name = vi.Item is BaseContainer ? "container" : StringUtils.GetString(vi.Item.Name, Sphere.ComputeName(vi.Item));
mvi.Description = vi.Description;
mvi.Price = vi.Price;
if (vi.Item is CommodityDeed)
{
Item commodity = (vi.Item as CommodityDeed).Commodity;
if (commodity == null) // skip empty deeds
continue;
mvi.Amount = commodity.Amount;
mvi.Name += " - " + Sphere.ComputeName(commodity);
}
else
{
mvi.Amount = vi.Item.Amount;
}
if (mvi.Amount != 0)
{
mvi.PricePer = mvi.Price / mvi.Amount;
}
else
{
mvi.PricePer = mvi.Price;
}
mvi.VendorName = vendor.Name;
mvi.OwnerName = vendor.Owner.Name;
mvi.Location = StringUtils.GetString(vendor.Region.Name, BaseRegion.GetRuneNameFor(vendor.Region)) + " " + vendor.Location.X + "," + vendor.Location.Y;
m_VendorItems.Add(mvi);
}
else if (vi.Item is Container)
{
processContainer(vendor, vi.Item as Container);
}
}
}
}
示例2: GetVendorItemsDisplay
private void GetVendorItemsDisplay(StreamWriter op, PlayerVendor pv, Item item)
{
VendorItem vi = pv.GetVendorItem(item);
if ( vi == null )
return;
if ( vi.IsForSale )
{
if (pv.Owner == null || pv.Owner.Name == "1k5g6se84f895s854f884s6a") //If name same as this it will not show items in list.
return;
string ownername = (pv.Name != pv.Owner.Name ? pv.Owner.Name : " ");
string name = item.Name;
if (string.IsNullOrEmpty(name))
{
name = item.GetType().ToString();
if (name.LastIndexOf('.') >= 0)
name = name.Substring(name.LastIndexOf('.') + 1);
}
if (name.Length > 25)
name = name.Substring(0, 25);
string des = (string.IsNullOrEmpty(vi.Description) ? " " : vi.Description);
op.WriteLine( "<tr><td bgcolor=\"green\"><font color = \"black\"><img src= http://aaaservices.homeip.net/UO/uopics/pouch.bmp align=\"absmiddle\"> {0} </td> <td bgcolor=\"green\"><font color = \"black\"><img src= http://aaaservices.homeip.net/UO/uopics/bodscroll.bmp align=\"absmiddle\"> {1,-25} </td> <td bgcolor=\"green\"><font color = \"black\"><img src= http://aaaservices.homeip.net/UO/uopics/gold.bmp align=\"absmiddle\"> {2,7} </td> <td bgcolor=\"green\"><font color = \"black\"><img src= http://aaaservices.homeip.net/UO/uopics/scroll.bmp align=\"absmiddle\"> {3} </td></tr>", item.Amount, name, vi.Price.ToString(), des );//Note want to add bag icon here
}
else if ( item is Container)
{
foreach ( Item containerItem in item.Items)
{
GetVendorItemsDisplay( op, pv, containerItem);//
}
}
}