Inventory Update

Added serverside iteminfo and consolidated image path. Now returns full nui path in .image
This commit is contained in:
gononono64 committed 2025-04-16 05:24:03 -05:00
1 parent 5d3a9d1950
commit bd0074a156
22 files changed
+83 -9

No files matched your search

+16
View File
@@ -40,10 +40,26 @@ Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coo
end
Inventory.GetItemInfo = function(item)
local itemData = Framework.Shared.Items[item]
if not itemData then return {} end
local repackedTable = {
name = itemData.name,
label = itemData.label,
stack = itemData.unique,
weight = itemData.weight,
description = itemData.description,
image = Inventory.GetImagePath(itemData.image or itemData.name)
}
return repackedTable
end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item)
-- check if contains.png and remove it if it does
item = Inventory.StripPNG(item)
local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135"