diff --git a/modules/inventory/_default/client.lua b/modules/inventory/_default/client.lua index 68aba63..f7f152e 100644 --- a/modules/inventory/_default/client.lua +++ b/modules/inventory/_default/client.lua @@ -32,6 +32,7 @@ end ---@param item string ---@return string Inventory.GetImagePath = function(item) + print("No get image path for this inventory, using default.") return "https://avatars.githubusercontent.com/u/47620135" end @@ -42,6 +43,13 @@ Inventory.StripPNG = function(item) return item end +Inventory.StripWebp = function(item) + if string.find(item, ".webp") then + item = string.gsub(item, ".webp", "") + end + return item +end + ---This will return the entire items table from the inventory. ---@return table Inventory.Items = function() diff --git a/modules/inventory/tgiann-inventory/client.lua b/modules/inventory/tgiann-inventory/client.lua index cc230c3..5102a87 100644 --- a/modules/inventory/tgiann-inventory/client.lua +++ b/modules/inventory/tgiann-inventory/client.lua @@ -39,10 +39,11 @@ end ---@param item string ---@return string Inventory.GetImagePath = function(item) - item = Inventory.StripPNG(item) - local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item)) - local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item)) - local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item) + local pngItem = Inventory.StripPNG(item) + local webpItem = Inventory.StripWebp(item) + local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", pngItem)) + local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", webpItem)) + local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", pngItem) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", webpItem) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end