feat(inventory): add item list function

This commit is contained in:
Quin Schurman committed 2025-07-09 17:26:16 -04:00
1 parent a9a4ef619c
commit aefcf8eee2
19 files changed
+126

No files matched your search

+6
View File
@@ -42,4 +42,10 @@ Inventory.StripPNG = function(item)
return item return item
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return Framework.Shared.Items
end
return Inventory return Inventory
+6
View File
@@ -51,6 +51,12 @@ Inventory.GetItemInfo = function(item)
return Framework.GetItemInfo(item) return Framework.GetItemInfo(item)
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return Framework.Shared.Items
end
---This will return the count of the item in the players inventory, if not found will return 0. ---This will return the count of the item in the players inventory, if not found will return 0.
---if metadata is passed it will find the matching items count. ---if metadata is passed it will find the matching items count.
---example: 0 ---example: 0
@@ -21,6 +21,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return codem:GetItemList()
end
---This will get the image path for this item, if not found will return placeholder. ---This will get the image path for this item, if not found will return placeholder.
---@param item string ---@param item string
---@return string ---@return string
@@ -46,6 +46,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return codem:GetItemList()
end
---This wil return the players inventory. ---This wil return the players inventory.
---@param src number ---@param src number
---@return table ---@return table
@@ -24,6 +24,24 @@ Inventory.GetItemInfo = function(item)
return {name = dataRepack.name, label = dataRepack.label, stack = dataRepack.stack, weight = dataRepack.weight, description = dataRepack.description, image = Inventory.GetImagePath(dataRepack.name) } return {name = dataRepack.name, label = dataRepack.label, stack = dataRepack.stack, weight = dataRepack.weight, description = dataRepack.description, image = Inventory.GetImagePath(dataRepack.name) }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
local frameworkName = Framework.GetFrameworkName()
if not frameworkName then return {} end
local dataRepack = {}
if frameworkName == 'es_extended' then
local callbackData = Callback.Trigger('community_bridge:Callback:core_inventory', false)
-- really really wish this inventory allowed me to pull the item list client side....
dataRepack = callbackData
if not dataRepack then return {} end
elseif frameworkName == 'qb-core' then
dataRepack = Framework.Shared.Items
if not dataRepack then return {} end
end
return dataRepack
end
---Will return boolean if the player has the item. ---Will return boolean if the player has the item.
---@param item string ---@param item string
---@return boolean ---@return boolean
@@ -251,4 +251,10 @@ Callback.Register('community_bridge:Callback:core_inventory', function(source)
return items or {} return items or {}
end) end)
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return core:getItemsList()
end
return Inventory return Inventory
@@ -27,6 +27,12 @@ Inventory.HasItem = function(item)
return jpr:HasItem(item) return jpr:HasItem(item)
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return Framework.Shared.Items
end
---This will get the image path for this item, if not found will return placeholder. ---This will get the image path for this item, if not found will return placeholder.
---@param item string ---@param item string
---@return string ---@return string
@@ -40,6 +40,12 @@ Inventory.GetItemInfo = function(item)
return itemTable return itemTable
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return Framework.Shared.Items
end
---Returns the specified slot data as a table. ---Returns the specified slot data as a table.
---format {weight, name, metadata, slot, label, count} ---format {weight, name, metadata, slot, label, count}
---@param src number ---@param src number
@@ -19,6 +19,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return origin:Items()
end
---Will return boolean if the player has the item. ---Will return boolean if the player has the item.
---@param item string ---@param item string
---@return boolean ---@return boolean
@@ -92,6 +92,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return origin:Items()
end
---This will return the count of the item in the players inventory, if not found will return 0. ---This will return the count of the item in the players inventory, if not found will return 0.
---if metadata is passed it will find the matching items count. ---if metadata is passed it will find the matching items count.
---@param src number ---@param src number
@@ -23,6 +23,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return ox_inventory:Items()
end
---Will return boolean if the player has the item. ---Will return boolean if the player has the item.
---@param item string ---@param item string
---@return boolean ---@return boolean
@@ -74,6 +74,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return ox_inventory:Items()
end
---This will return the count of the item in the players inventory, if not found will return 0. ---This will return the count of the item in the players inventory, if not found will return 0.
--- ---
---if metadata is passed it will find the matching items count. ---if metadata is passed it will find the matching items count.
@@ -20,6 +20,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return Framework.Shared.Items
end
---Will return boolean if the player has the item. ---Will return boolean if the player has the item.
---@param item string ---@param item string
---@return boolean ---@return boolean
@@ -66,6 +66,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return Framework.Shared.Items
end
---Returns the specified slot data as a table. ---Returns the specified slot data as a table.
--- ---
---format {weight, name, metadata, slot, label, count} ---format {weight, name, metadata, slot, label, count}
@@ -20,6 +20,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return Framework.Shared.Items
end
---Will return boolean if the player has the item. ---Will return boolean if the player has the item.
---@param item string ---@param item string
---@return boolean ---@return boolean
@@ -107,6 +107,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return Framework.Shared.Items
end
---Returns the specified slot data as a table. ---Returns the specified slot data as a table.
---format {weight, name, metadata, slot, label, count} ---format {weight, name, metadata, slot, label, count}
---@param src number ---@param src number
@@ -22,6 +22,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return quasar:GetItemList()
end
---Will return boolean if the player has the item. ---Will return boolean if the player has the item.
---@param item string ---@param item string
---@return boolean ---@return boolean
@@ -84,6 +84,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return quasar:GetItemList()
end
---This will return the count of the item in the players inventory, if not found will return 0. ---This will return the count of the item in the players inventory, if not found will return 0.
--- ---
---if metadata is passed it will find the matching items count. ---if metadata is passed it will find the matching items count.
@@ -46,6 +46,12 @@ Inventory.GetItemInfo = function(item)
} }
end end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return tgiann:GetItemList()
end
---This will return the count of the item in the players inventory, if not found will return 0. ---This will return the count of the item in the players inventory, if not found will return 0.
--- ---
---if metadata is passed it will find the matching items count. ---if metadata is passed it will find the matching items count.