本文整理汇总了C#中DOL.Database.InventoryItem.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# InventoryItem.GetName方法的具体用法?C# InventoryItem.GetName怎么用?C# InventoryItem.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.Database.InventoryItem
的用法示例。
在下文中一共展示了InventoryItem.GetName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPlayerAppraise
/// <summary>
/// Called to appraise the value of an item
/// </summary>
/// <param name="player">The player whose item needs appraising</param>
/// <param name="item">The item to be appraised</param>
/// <param name="silent"></param>
/// <returns>The price this merchant will pay for the offered items</returns>
public virtual long OnPlayerAppraise(GamePlayer player, InventoryItem item, bool silent)
{
if (item == null)
return 0;
int itemCount = Math.Max(1, item.Count);
int packSize = Math.Max(1, item.PackSize);
long val = item.Price * itemCount / packSize * ServerProperties.Properties.ITEM_SELL_RATIO / 100;
if (!item.IsDropable)
{
val = 0;
}
if (!silent)
{
string message;
if (val == 0)
{
message = LanguageMgr.GetTranslation(player.Client, "GameMerchant.OnPlayerSell.IsntInterested", GetName(0, true), item.GetName(0, false));
}
else
{
message = LanguageMgr.GetTranslation(player.Client, "GameMerchant.OnPlayerAppraise.Offers", GetName(0, true), Money.GetString(val), item.GetName(0, false));
}
player.Out.SendMessage(message, eChatType.CT_Merchant, eChatLoc.CL_SystemWindow);
}
return val;
}
示例2: OnPlayerSell
/// <summary>
/// Called when a player sells something
/// </summary>
/// <param name="player">Player making the sale</param>
/// <param name="item">The InventoryItem to be sold</param>
/// <returns>true if selling is allowed, false if it should be prevented</returns>
public virtual void OnPlayerSell(GamePlayer player, InventoryItem item)
{
if(item==null || player==null) return;
if (!item.IsDropable)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "GameMerchant.OnPlayerSell.CantBeSold"), eChatType.CT_Merchant, eChatLoc.CL_SystemWindow);
return;
}
if (!this.IsWithinRadius(player, GS.ServerProperties.Properties.WORLD_PICKUP_DISTANCE)) // tested
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "GameMerchant.OnPlayerSell.TooFarAway", GetName(0, true)), eChatType.CT_Merchant, eChatLoc.CL_SystemWindow);
return;
}
long itemValue = OnPlayerAppraise(player, item, true);
if (itemValue == 0)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "GameMerchant.OnPlayerSell.IsntInterested", GetName(0, true), item.GetName(0, false)), eChatType.CT_Merchant, eChatLoc.CL_SystemWindow);
return;
}
if (player.Inventory.RemoveItem(item))
{
string message = LanguageMgr.GetTranslation(player.Client, "GameMerchant.OnPlayerSell.GivesYou", GetName(0, true), Money.GetString(itemValue), item.GetName(0, false));
player.AddMoney(itemValue, message, eChatType.CT_Merchant, eChatLoc.CL_SystemWindow);
InventoryLogging.LogInventoryAction(player, this, eInventoryActionType.Merchant, item.Template, item.Count);
InventoryLogging.LogInventoryAction(this, player, eInventoryActionType.Merchant, itemValue);
return;
}
else
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "GameMerchant.OnPlayerSell.CantBeSold"), eChatType.CT_Merchant, eChatLoc.CL_SystemWindow);
}