Exemple #1
0
        private string Search_(ItemSearchRequest query, bool duplicatesOnly, bool includeBuddyItems, bool orderByLevel)
        {
            OnSearch?.Invoke(this, null);
            string message;


            Logger.Info("Searching for items..");

            var items = new List <PlayerHeldItem>();

            items.AddRange(_playerItemDao.SearchForItems(query));

            var personalCount = items.Sum(i => (long)i.Count);

            if (includeBuddyItems && !query.SocketedOnly)
            {
                AddBuddyItems(items, query, out message);
            }
            else
            {
                message = personalCount == 0
                    ? RuntimeSettings.Language.GetTag("iatag_no_matching_items_found")
                    : string.Empty;
            }

            if (!duplicatesOnly && _settings.GetPersistent().ShowRecipesAsItems&& !query.SocketedOnly)
            {
                AddRecipeItems(items, query);
            }

            if (!duplicatesOnly && _settings.GetPersistent().ShowAugmentsAsItems&& !query.SocketedOnly)
            {
                AddAugmentItems(items, query);
            }

            if (_itemPaginationService.Update(items, orderByLevel))
            {
                if (!ApplyItems(false))
                {
                    Browser.SetItems(new List <List <JsonItem> >(0), 0);
                }
                UpdateCollectionItems(query);
            }
            else
            {
                Browser.ShowLoadingAnimation(false);
            }

            return(message);
        }
Exemple #2
0
        private string Search_(ItemSearchRequest query, bool duplicatesOnly, bool includeBuddyItems, bool orderByLevel)
        {
            OnSearch?.Invoke(this, null);
            string message;


            Logger.Info("Searching for items..");

            var items = new List <PlayerHeldItem>();

            items.AddRange(_playerItemDao.SearchForItems(query));

            // This specific filter was easiest to add after the actual search
            // Obs: the "duplicates only" search only works when merging duplicates
            if (duplicatesOnly)
            {
                items = items.Where(m => m.Count > 1).ToList();
            }

            var personalCount = items.Sum(i => (long)i.Count);

            if (includeBuddyItems && !query.SocketedOnly)
            {
                AddBuddyItems(items, query, out message);
            }
            else
            {
                message = personalCount == 0
                    ? RuntimeSettings.Language.GetTag("iatag_no_matching_items_found")
                    : string.Empty;
            }

            if (_settings.GetPersistent().ShowRecipesAsItems&& !query.SocketedOnly)
            {
                AddRecipeItems(items, query);
            }

            if (_settings.GetPersistent().ShowAugmentsAsItems&& !query.SocketedOnly)
            {
                AddAugmentItems(items, query);
            }

            _itemPaginationService.Update(items, orderByLevel);

            return(message);
        }