当前位置: 首页>>代码示例>>C#>>正文


C# Schema.IsPure方法代码示例

本文整理汇总了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());
                }
            }
        }
开发者ID:einsteinsci,项目名称:SteamBot,代码行数:71,代码来源:SimpleUserHandler.cs


注:本文中的Schema.IsPure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。