/// <summary> /// Convert Legendary items to SettingsItem objects only once to a static collection. /// </summary> public static void CacheReferenceItems() { if (_cachedItems == null) { _cachedItems = Legendary.ToList().Where(i => !i.IsCrafted && i.Id != 0).Select(i => new LItem(i)).ToList(); } }
internal static void DumpReferenceItems(TrinityLogLevel level = TrinityLogLevel.Debug) { var path = Path.Combine(FileManager.DemonBuddyPath, "Resources\\JS Class Generator\\ItemReference.js"); if (File.Exists(path)) { File.Delete(path); } using (StreamWriter w = File.AppendText(path)) { w.WriteLine("var itemLookup = {"); foreach (var item in Legendary.ToList()) { if (item.Id != 0) { w.WriteLine(string.Format(" \"{0}\": [\"{1}\", {2}, \"{3}\"],", item.Slug, item.Name, item.Id, item.InternalName)); } } w.WriteLine("}"); } Logger.Log("Dumped Reference Items to: {0}", path); }
internal static void DumpReferenceItems(TrinityLogLevel level = TrinityLogLevel.Debug) { var path = Path.Combine(FileManager.DemonBuddyPath, "Plugins\\Trinity\\Resources\\JS Class Generator\\ItemReference.js"); if (File.Exists(path)) { File.Delete(path); } using (StreamWriter w = File.AppendText(path)) { w.WriteLine("var itemLookup = {"); foreach (var item in Legendary.ToList()) { var key = !string.IsNullOrEmpty(item.Slug) ? item.Slug : RemoveApostophes(item.Name).ToLower(); if (item.Id != 0) { w.WriteLine($" \"{key}\": [\"{item.Name}\", {item.Id}, \"{item.InternalName}\"],"); } } w.WriteLine("}"); } Core.Logger.Log("Dumped Reference Items to: {0}", path); }
internal static void LogInvalidItems(TrinityLogLevel level = TrinityLogLevel.Debug) { var dropItems = Legendary.ToList().Where(i => !i.IsCrafted && i.Id == 0).OrderBy(i => i.TrinityItemType).ToList(); var craftedItems = Legendary.ToList().Where(i => i.IsCrafted && i.Id == 0).OrderBy(i => i.TrinityItemType).ToList(); Core.Logger.Log("Dropped Items: {0}", dropItems.Count); foreach (var item in dropItems) { Core.Logger.Log("{0} - {1} = 0", item.TrinityItemType, item.Name); } Core.Logger.Log(" "); Core.Logger.Log("Crafted Items: {0}", craftedItems.Count); foreach (var item in craftedItems) { Core.Logger.Log("{0} - {1} = 0", item.TrinityItemType, item.Name); } }