2025-05-09 02:00:02 -04:00
|
|
|
---@diagnostic disable: duplicate-set-field
|
2025-01-13 14:28:09 -05:00
|
|
|
Inventory = Inventory or {}
|
|
|
|
|
|
2025-05-09 03:16:27 -04:00
|
|
|
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
2025-03-03 01:09:24 -05:00
|
|
|
---@param item string
|
|
|
|
|
---@return table
|
2025-01-13 14:28:09 -05:00
|
|
|
Inventory.GetItemInfo = function(item)
|
|
|
|
|
return Framework.GetItemInfo(item)
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-09 03:16:27 -04:00
|
|
|
---Will return boolean if the player has the item.
|
2025-03-03 01:09:24 -05:00
|
|
|
---@param item string
|
|
|
|
|
---@return boolean
|
2025-02-17 12:34:10 -05:00
|
|
|
Inventory.HasItem = function(item)
|
|
|
|
|
return Framework.HasItem(item)
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-09 03:16:27 -04:00
|
|
|
---This will return th count of the item in the players inventory, if not found will return 0.
|
2025-04-12 02:31:47 -04:00
|
|
|
---@param item string
|
|
|
|
|
---@return number
|
2025-04-07 14:37:22 -04:00
|
|
|
Inventory.GetItemCount = function(item)
|
|
|
|
|
return Framework.GetItemCount(item)
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-09 03:16:27 -04:00
|
|
|
---This will return the players inventory in the format of {name, label, count, slot, metadata}
|
|
|
|
|
---@return table
|
|
|
|
|
Inventory.GetPlayerInventory = function()
|
|
|
|
|
return Framework:GetPlayerInventory()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---This will get the image path for this item, if not found will return placeholder.
|
2025-03-03 01:09:24 -05:00
|
|
|
---@param item string
|
|
|
|
|
---@return string
|
2025-01-13 14:28:09 -05:00
|
|
|
Inventory.GetImagePath = function(item)
|
2025-08-03 15:22:33 -04:00
|
|
|
print("No get image path for this inventory, using default.")
|
2025-01-13 14:28:09 -05:00
|
|
|
return "https://avatars.githubusercontent.com/u/47620135"
|
2025-04-16 05:24:03 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Inventory.StripPNG = function(item)
|
|
|
|
|
if string.find(item, ".png") then
|
|
|
|
|
item = string.gsub(item, ".png", "")
|
|
|
|
|
end
|
|
|
|
|
return item
|
2025-05-10 00:01:56 -04:00
|
|
|
end
|
|
|
|
|
|
2025-08-03 15:22:33 -04:00
|
|
|
Inventory.StripWebp = function(item)
|
|
|
|
|
if string.find(item, ".webp") then
|
|
|
|
|
item = string.gsub(item, ".webp", "")
|
|
|
|
|
end
|
|
|
|
|
return item
|
|
|
|
|
end
|
|
|
|
|
|
2025-07-09 17:26:16 -04:00
|
|
|
---This will return the entire items table from the inventory.
|
|
|
|
|
---@return table
|
|
|
|
|
Inventory.Items = function()
|
2025-07-09 22:08:44 -04:00
|
|
|
if not Framework.Shared or not Framework.Shared.Items then
|
|
|
|
|
local itemList = Framework.ItemList() or { Items = {} }
|
|
|
|
|
return itemList.Items
|
|
|
|
|
end
|
2025-07-09 17:26:16 -04:00
|
|
|
return Framework.Shared.Items
|
|
|
|
|
end
|
|
|
|
|
|
2025-07-28 00:10:51 -05:00
|
|
|
|
|
|
|
|
|
2025-05-10 00:01:56 -04:00
|
|
|
return Inventory
|