當前位置: 首頁>>代碼示例>>C#>>正文


C# PlayerVendor.GetVendorItem方法代碼示例

本文整理匯總了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);
             }
         }
     }
 }
開發者ID:JohnathonReasons,項目名稱:runuo-vendor-search,代碼行數:45,代碼來源:VendorItems.cs

示例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);//
 		}
 	}
 }
開發者ID:greeduomacro,項目名稱:dragonknights-uo,代碼行數:32,代碼來源:WebStatus.cs


注:本文中的Server.Mobiles.PlayerVendor.GetVendorItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。