/// <summary> /// Returns the localized name of an item that is cached /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetItemCacheName(uint id) { WoWCache.InfoBlock cache = StyxWoW.Cache[CacheDb.Item].GetInfoBlockById(id); if (cache != null) { return(ObjectManager.Wow.Read <string>(cache.ItemSparse.Name)); } return(null); }
public void UpdateHeader() { if (!string.IsNullOrEmpty(_header)) { return; } WoWDb.DbTable dbTable; WoWDb.Row dbRow; if (CraftedItemID == 0) { dbTable = StyxWoW.Db[ClientDb.SkillLine]; dbRow = dbTable.GetRow((uint)Skill); _header = ObjectManager.Wow.Read <string>(dbRow.GetField <uint>(5)); } else { // we need to iterate through ClientDb.ItemSubClass till we find matching WoWCache.InfoBlock cache = StyxWoW.Cache[CacheDb.ItemClass].GetInfoBlockById(CraftedItemID); if (cache != null) { dbTable = StyxWoW.Db[ClientDb.ItemSubClass]; for (int i = dbTable.MinIndex; i <= dbTable.MaxIndex; i++) { dbRow = dbTable.GetRow((uint)i); var iSubClass1 = dbRow.GetField <int>(1); var iSubClass2 = dbRow.GetField <int>(2); if (iSubClass1 == cache.Item.ClassId && iSubClass2 == cache.Item.SubClassId) { var stringPtr = dbRow.GetField <uint>(12); // if pointer in field (12) is 0 or it points to null string then use field (11) if (stringPtr == 0 || string.IsNullOrEmpty(_header = ObjectManager.Wow.Read <string>(stringPtr))) { stringPtr = dbRow.GetField <uint>(11); if (stringPtr != 0) { _header = ObjectManager.Wow.Read <string>(stringPtr); } } break; } } } } }