image pathing fixed on tgiann

this -- "nui://inventory_images/html/images/%s.png"
Is not the path, it its instead
nui://inventory_images/images/%s.png"

Also strip webp function added. And indexing itemdata was required.
This commit is contained in:
MrNewb committed 2025-08-03 16:23:19 -04:00
1 parent fa9ea6e6eb
commit 5abebe13c6
4 files changed
+30 -10

No files matched your search

@@ -10,13 +10,14 @@ Inventory = Inventory or {}
Inventory.GetItemInfo = function(item)
local itemData = tgiann:GetItemList()
if not itemData[item] then return {} end
itemData = itemData[item]
return {
name = itemData.name or "Missing Name",
label = itemData.label or "Missing Label",
stack = itemData.unique or "false",
weight = itemData.weight or "0",
description = itemData.description or "none",
image = itemData.image or Inventory.GetImagePath(item),
image = Inventory.GetImagePath(item),
}
end
@@ -41,9 +42,9 @@ end
Inventory.GetImagePath = function(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)
local pngPath = LoadResourceFile("inventory_images", string.format("/images/%s.png", pngItem))
local webpPath = LoadResourceFile("inventory_images", string.format("/images/%s.webp", webpItem))
local imagePath = pngPath and string.format("nui://inventory_images/images/%s.png", pngItem) or webpPath and string.format("nui://inventory_images/images/%s.webp", webpItem)
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end