Inventory Update
Added serverside iteminfo and consolidated image path. Now returns full nui path in .image
This commit is contained in:
1 parent
5d3a9d1950
commit
bd0074a156
22 files changed
+83
-9
No files matched your search
@@ -8,13 +8,14 @@ local codem = exports['codem-inventory']
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
local itemData = codem:GetItemList(item)
|
||||
local image = itemData.image and Inventory.GetImagePath(itemData.image) or Inventory.GetImagePath(item)
|
||||
local repackedTable = {
|
||||
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 = image,
|
||||
}
|
||||
return repackedTable or {}
|
||||
end
|
||||
@@ -43,6 +44,7 @@ end
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
item = Inventory.StripPNG(item)
|
||||
local file = LoadResourceFile("codem-inventory", string.format("html/images/%s.png", item))
|
||||
local imagePath = file and string.format("nui://codem-inventory/html/images/%s.png", item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
|
||||
Reference in new issue
Block a user