Remove example scripts and update core logic
Deleted all files in the examples directory to clean up unused or test scripts. Updated fxmanifest.lua to enable ox_lib initialization. Improved error handling and entity tracking in utility functions, added prop removal, and made minor localization and code style adjustments throughout the codebase. Significant reword of inventory module, notification module, and framework module. Added support for wasabi_uikit, added support for keep-progressbars,
This commit is contained in:
1 parent
c40a260ea2
commit
343af95794
100 files changed
+2403
-2755
No files matched your search
@@ -1,22 +1,16 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('codem-inventory') ~= 'started' then return end
|
||||
if GetResourceState('codem-inventory') == 'missing' then return end
|
||||
Inventory = Inventory or {}
|
||||
|
||||
local codem = exports['codem-inventory']
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "codem-inventory"
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return codem:GetItemList() or {}
|
||||
end
|
||||
|
||||
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -33,28 +27,34 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will get the image path for this item, if not found will return placeholder.
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return codem:GetItemList() or {}
|
||||
end
|
||||
|
||||
---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@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)
|
||||
local file = LoadResourceFile("codem-inventory", string.format("html/itemimages/%s.png", item))
|
||||
local imagePath = file and string.format("nui://codem-inventory/html/itemimages/%s.png", item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@description This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function()
|
||||
local items = {}
|
||||
local inventory = codem:getUserInventory()
|
||||
local inventory = codem:GetClientPlayerInventory()
|
||||
for _, v in pairs(inventory) do
|
||||
table.insert(items, {
|
||||
name = v.name,
|
||||
label = v.label,
|
||||
count = v.amount,
|
||||
count = v.amount or v.count,
|
||||
slot = v.slot,
|
||||
metadata = v.info,
|
||||
metadata = v.info or v.metadata or {},
|
||||
stack = v.unique,
|
||||
close = v.useable,
|
||||
weight = v.weight
|
||||
@@ -63,9 +63,4 @@ Inventory.GetPlayerInventory = function()
|
||||
return items
|
||||
end
|
||||
|
||||
RegisterNetEvent('community_bridge:client:codem-inventory:openStash', function(id, data)
|
||||
if source ~= 65535 then return end
|
||||
TriggerServerEvent('codem-inventory:server:openstash', id, data.slots, data.weight, data.label)
|
||||
end)
|
||||
|
||||
return Inventory
|
||||
Reference in new issue
Block a user