using Dalamud.Interface.Internal; using Dalamud.Interface.Textures; using Dalamud.Interface.Textures.TextureWraps; using Lumina.Excel; using static Dalamud.Plugin.Services.ITextureProvider; namespace HSUI.Helpers { public class TexturesHelper { public static IDalamudTextureWrap? GetTexture(uint rowId, uint stackCount = 0, bool hdIcon = true) where T : struct, IExcelRow { ExcelSheet sheet = Plugin.DataManager.GetExcelSheet(); return sheet == null ? null : GetTexture(sheet.GetRow(rowId), stackCount, hdIcon); } public static IDalamudTextureWrap? GetTexture(dynamic row, uint stackCount = 0, bool hdIcon = true) where T : struct, IExcelRow { dynamic iconId = row.Icon; return GetTextureFromIconId(iconId, stackCount, hdIcon); } public static IDalamudTextureWrap? GetTextureFromIconId(uint iconId, uint stackCount = 0, bool hdIcon = true) { GameIconLookup lookup = new GameIconLookup(iconId + stackCount, false, hdIcon); return Plugin.TextureProvider.GetFromGameIcon(lookup).GetWrapOrDefault(); } public static IDalamudTextureWrap? GetTextureFromPath(string path) { return Plugin.TextureProvider.GetFromGame(path).GetWrapOrDefault(); } } }