private static void LookupRef(ResolvedLootItemList list, LootItemEntry entry) { ResolvedLootItemList entries = LootMgr.GetEntries(LootEntryType.Reference, entry.ReferencedEntryId); if (entries == null) { return; } if (entries.ResolveStatus < (byte)1) { entries.ResolveStatus = (byte)1; foreach (LootEntity ent in (List <LootEntity>)entries) { if (ent is LootItemEntry) { LootItemEntry entry1 = (LootItemEntry)ent; if (entry1.ReferencedEntryId > 0U) { LootMgr.LookupRef(list, entry1); continue; } } LootMgr.AddRef(list, ent); } entries.ResolveStatus = (byte)2; } else if (list.ResolveStatus == (byte)1) { LogManager.GetCurrentClassLogger() .Warn("Infinite loop in Loot references detected in: " + (object)entry); } else { foreach (LootEntity ent in (List <LootEntity>)entries) { LootMgr.AddRef(list, ent); } } }
public static void LoadAll() { if (LootMgr.Loaded) { return; } ContentMgr.Load <NPCLootItemEntry>(); ContentMgr.Load <ItemLootItemEntry>(); ContentMgr.Load <GOLootItemEntry>(); ContentMgr.Load <FishingLootItemEntry>(); ContentMgr.Load <MillingLootItemEntry>(); ContentMgr.Load <PickPocketLootItemEntry>(); ContentMgr.Load <ProspectingLootItemEntry>(); ContentMgr.Load <DisenchantingLootItemEntry>(); ContentMgr.Load <ReferenceLootItemEntry>(); for (int index = LootMgr.ReferenceEntries.Count - 1; index >= 0; --index) { KeyValuePair <ResolvedLootItemList, LootItemEntry> referenceEntry = LootMgr.ReferenceEntries[index]; referenceEntry.Key.Remove((LootEntity)referenceEntry.Value); LootMgr.LookupRef(referenceEntry.Key, referenceEntry.Value); } LootMgr.Loaded = true; }