diff --git a/modules/inventory/core_inventory/client.lua b/modules/inventory/core_inventory/client.lua index 27eb884..21d4fac 100644 --- a/modules/inventory/core_inventory/client.lua +++ b/modules/inventory/core_inventory/client.lua @@ -13,4 +13,20 @@ Inventory.GetImagePath = function(item) local file = LoadResourceFile("core_inventory", string.format("html/img/%s.png", item)) local imagePath = file and string.format("nui://core_inventory/html/img/%s.png", item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end + +Inventory.GetItemInfo = function(item) + local frameworkName = Framework.GetFrameworkName() + if not frameworkName then return {} end + local dataRepack = {} + if frameworkName == 'es_extended' then + local callbackData = lib.callback.await('community_bridge:Callback:core_inventory', false) + -- really really wish this inventory allowed me to pull the item list client side.... + dataRepack = callbackData[item] + if not dataRepack then return {} end + elseif frameworkName == 'qb-core' then + dataRepack = Framework.Shared.Items[item] + if not dataRepack then return {} end + end + return {name = dataRepack.name, label = dataRepack.label, stack = dataRepack.stack, weight = dataRepack.weight, description = dataRepack.description, image = Inventory.GetImagePath(dataRepack.name) } end \ No newline at end of file diff --git a/modules/inventory/core_inventory/server.lua b/modules/inventory/core_inventory/server.lua index 7acfbe8..1fbfaca 100644 --- a/modules/inventory/core_inventory/server.lua +++ b/modules/inventory/core_inventory/server.lua @@ -34,4 +34,9 @@ Inventory.UpdatePlate = function(oldplate, newplate) if GetResourceState('jg-mechanic') ~= 'started' then return true end exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate) return true -end \ No newline at end of file +end + +lib.callback.register('community_bridge:Callback:core_inventory', function(source) + local items = core:getItemsList() + return items or {} +end) \ No newline at end of file