Ejemplo n.º 1
0
 /// <summary>
 /// Stuffs the finded.
 /// </summary>
 /// <param name="tradeType">Type of the trade.</param>
 /// <param name="condition">The condition.</param>
 /// <param name="controller">The controller.</param>
 /// <returns></returns>
 private bool StuffFinded(TradeType tradeType, StuffSearchCondition condition, TradeItemController controller)
 {
     Log.Warn(string.Format("Найден {0} по цене {1}.", condition.ItemName, controller.GetPrice(tradeType)),
              condition.ToString(),
              condition.Clone());
     if (AppCore.AccountantSettings.SearchStrategy.SoundNotification)
     {
         PlaySound();
     }
     return(true);
 }
Ejemplo n.º 2
0
        private void Search(TradeType tradeType, StuffSearchCondition itemMatcher, MatchDelegate matchDelegate)
        {
            AppCore.LogAccountant.DebugFormat("Ищем {0} {1}.",
                                              itemMatcher.ItemName, tradeType == TradeType.Auction ? "на аукционе" : "в продаже");

            var matchers = itemMatcher.GetConditions(tradeType).GetActive();

            var hasGold     = matchers.Any(e => e.Price.Resource == Resource.Gold);
            var hasCristall = matchers.Any(e => e.Price.Resource == Resource.Crystals);
            var minLevel    = matchers.Min(e => e.MinResalesCount);

            controller.DoSearchOnMarket(tradeType, itemMatcher.ItemName, GetResealesFilter(minLevel), hasCristall, hasGold);

            foreach (var itemController in EnumerateTradeItems())
            {
                foreach (var matcher in matchers.ToArray())
                {
                    var matchResult = matcher.Match(Player, itemController, tradeType);
                    switch (matchResult)
                    {
                    case MatchResult.Ok:
                        if (!matchDelegate(tradeType, itemMatcher, itemController))
                        {
                            return;
                        }
                        break;

                    case MatchResult.BadPriceAmmount:
                        matchers.Remove(matcher);
                        break;

                    default:
                        break;
                    }
                }
                if (matchers.Count == 0)
                {
                    return;
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Finds the handler.
 /// </summary>
 /// <param name="tradeType">Type of the trade.</param>
 /// <param name="condition">The condition.</param>
 /// <param name="controller">The controller.</param>
 /// <returns></returns>
 private bool FindHandler(TradeType tradeType, StuffSearchCondition condition, TradeItemController controller)
 {
     OnItemMatched(new ItemMatchedEventArgs(condition, controller.GetPrice(tradeType)));
     return(true);
 }
Ejemplo n.º 4
0
 public ItemMatchedEventArgs(StuffSearchCondition condition, Price price)
 {
     this.condition = condition;
     this.price     = price;
 }