private string Search_(Search query, bool duplicatesOnly, bool includeBuddyItems, bool orderByLevel)
        {
            string message;
            long   personalCount = 0;

            // If we've changed the mod, we'll need to update any recipes. (data source changes)
            if (_previousCallback != query?.Mod)
            {
                _previousMod = query?.Mod;
                StashManagerOnStashUpdated(null, null);
            }

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

            List <PlayerHeldItem> 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();
            }


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

            if (includeBuddyItems && !query.SocketedOnly)
            {
                AddBuddyItems(items, query, out message);
            }
            else
            {
                if (personalCount == 0)
                {
                    message = "No matching items found";
                }
                else
                {
                    message = string.Empty;
                }
            }

            if ((bool)Properties.Settings.Default.ShowRecipesAsItems && !query.SocketedOnly)
            {
                AddRecipeItems(items, query);
            }

            _itemPaginatorService.Update(items, orderByLevel);


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

            // If we've changed the mod, we'll need to update any recipes. (data source changes)
            if (_previousCallback != query?.Mod)
            {
                _previousMod = query?.Mod;
                StashManagerOnStashUpdated(null, null);
            }

            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();
            }

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

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

            if (Properties.Settings.Default.ShowRecipesAsItems && !query.SocketedOnly)
            {
                AddRecipeItems(items, query);
            }

            if (Properties.Settings.Default.ShowAugmentsAsItems && !query.SocketedOnly)
            {
                AddAugmentItems(items, query);
            }

            _itemPaginatorService.Update(items, orderByLevel);
            JsBind.ItemSourceExhausted = items.Count == 0;

            return(message);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        private string Search_(ItemSearchRequest query, bool duplicatesOnly, bool includeBuddyItems, bool orderByLevel)
        {
            OnSearch?.Invoke(this, null);
            string message;
            long   personalCount = 0;


            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();
            }

            personalCount = items.Sum(i => 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);
            }

            _itemPaginatorService.Update(items, orderByLevel);
            JsBind.ItemSourceExhausted = items.Count == 0;

            return(message);
        }
Beispiel #5
0
 public List <PlayerItem> SearchForItems(Search query)
 {
     return(ThreadExecuter.Execute(
                () => repo.SearchForItems(query)
                ));
 }
Beispiel #6
0
 public List <PlayerItem> SearchForItems(ItemSearchRequest query)
 {
     return(ThreadExecuter.Execute(
                () => _repo.SearchForItems(query)
                ));
 }
Beispiel #7
0
 private List <PlayerItem> DoSearch(Search query)
 {
     return(dao.SearchForItems(query));
 }
Beispiel #8
0
 private List <PlayerItem> DoSearch(ItemSearchRequest query)
 {
     return(dao.SearchForItems(query));
 }