bool Tick() { var items = _playerItemDao.ListWithMissingStatCache(); if (items.Count <= 0) { return(true); } Logger.Debug($"Updated cache for {items.Count} items"); _itemStatService.ApplyStats(items); foreach (var item in items) { var rendered = ItemHtmlWriter.GetJsonItem(item); List <string> searchableText = new List <string>(); searchableText.AddRange(rendered.HeaderStats.Select(ToString)); searchableText.AddRange(rendered.BodyStats.Select(ToString)); searchableText.AddRange(rendered.PetStats.Select(ToString)); if (rendered.Skill != null) { searchableText.AddRange(rendered.Skill.HeaderStats.Select(ToString).ToList()); searchableText.AddRange(rendered.Skill.BodyStats.Select(ToString).ToList()); searchableText.AddRange(rendered.Skill.PetStats.Select(ToString).ToList()); searchableText.Add(rendered.Skill.Name); searchableText.Add(rendered.Skill.Description); searchableText.Add(rendered.Skill.Trigger); } searchableText.Add(rendered.Extras); item.SearchableText = string.Join("\n", searchableText); if (string.IsNullOrEmpty(item.SearchableText)) { if (string.IsNullOrEmpty(item.Name)) { continue; } else { // Typically potions and writs, they wont have any stats listed, so set a dummy value to prevent an infinite loop here. item.SearchableText = "-"; } } } _playerItemDao.UpdateCachedStats(items); return(true); }
public IList <PlayerItem> ListWithMissingStatCache() { return(ThreadExecuter.Execute( () => _repo.ListWithMissingStatCache() )); }