本文整理汇总了C#中Schema.IsPure方法的典型用法代码示例。如果您正苦于以下问题:C# Schema.IsPure方法的具体用法?C# Schema.IsPure怎么用?C# Schema.IsPure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schema
的用法示例。
在下文中一共展示了Schema.IsPure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTradeAddItem
public override void OnTradeAddItem(Schema.Item schemaItem, Inventory.Item inventoryItem)
{
Log.Info("Added item {0}{1} (defindex #{2}).", Order.GetQualityString(inventoryItem.Quality),
schemaItem.ItemName, schemaItem.Defindex);
if (!schemaItem.IsPure())
{
Bot.GetInventory();
bool found = false;
foreach (Order o in Bot.Orders.BuyOrders)
{
if (o.MatchesItem(inventoryItem))
{
found = true;
if (Bot.MyInventory.TotalPure() < o.Price)
{
Log.Warn("Out of metal for buy orders! Not enough metal to buy {0}.", schemaItem.ItemName);
SendTradeMessage("Unfortunately I am out of metal and cannot buy anything at the moment.");
SendTradeMessage("Enter 'buy' to get a list of the items I am selling.");
}
else if (Bot.MyInventory.GetItemsByDefindex(o.Defindex, o.Quality).Count >= o.MaxStock)
{
Log.Warn("Full stock for item {0}.", schemaItem.ItemName);
SendTradeMessage("Unfortunately I have full stock and cannot buy your {0}.", schemaItem.ItemName);
SendTradeMessage("Enter 'buy' to get a list of the items I am selling.");
}
else
{
ActiveOrder = o;
SendTradeMessage(o.ToString(Trade.CurrentSchema));
AddPure(ActiveOrder.Price);
}
}
}
if (!found)
{
SendTradeMessage("I am currently not buying that item at the moment.");
SendTradeMessage("Enter 'buy' to get a list of the items I am selling.");
}
}
else
{
if (schemaItem.Defindex == TF2Value.SCRAP_DEFINDEX)
AmountAdded += TF2Value.Scrap;
else if (schemaItem.Defindex == TF2Value.RECLAIMED_DEFINDEX)
AmountAdded += TF2Value.Reclaimed;
else if (schemaItem.Defindex == TF2Value.REFINED_DEFINDEX)
AmountAdded += TF2Value.Refined;
else if (schemaItem.Defindex == TF2Value.KEY_DEFINDEX)
AmountAdded += TF2Value.Key;
else if (ActiveOrder != null)
{
SendTradeMessage("Sorry, but I cannot accept any {0} as valid payment.",
schemaItem.ItemName);
}
if (AmountAdded == ActiveOrder.Price)
{
SendTradeMessage("You have paid the correct amount.");
}
else if (AmountAdded > ActiveOrder.Price)
{
SendTradeMessage("You are paying too much! The price for the {0} is {1}.",
ActiveOrder.GetSearchString(Trade.CurrentSchema), ActiveOrder.Price.ToRefString());
}
}
}