Exemplo n.º 1
0
        public void BuyCheapest(int categoryIndex, int subCategoryIndex, int echantmentLevelIndex, int qualityIndex, int tierIndex, string uniqueName)
        {
            var item = ResourceRepository.ItemConfigByUniqueName(uniqueName);

            Market.DemandRequests(
                IndexToSearchString(categoryIndex),
                IndexToSearchString(subCategoryIndex),
                IndexToSearchString(echantmentLevelIndex),
                FilterType.One,
                IndexToSearchString(qualityIndex),
                FilterType.One,
                IndexToSearchString(tierIndex),
                new short[] { (short)item.UniqueId },
                false,
                (auctions) =>
            {
                IAuctionListing cheapest = null;
                foreach (var auction in auctions)
                {
                    if (cheapest == null || auction.UnitPriceSilver <= cheapest.UnitPriceSilver)
                    {
                        cheapest = auction;
                    }
                }
                Market.BuyOffer(cheapest.Id, cheapest.Amount);
            });
        }