Merge pull request #21 from The-Order-Of-The-Sacred-Framework/dev

Dev sync
This commit is contained in:
MrNewb authored and GitHub committed 2025-02-05 02:17:02 -05:00
commit f3a947ced3
14 files changed
+109 -2

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ lua54 'yes'
use_experimental_fxv2_oal 'yes' use_experimental_fxv2_oal 'yes'
author 'The Order of the Sacred Framework' author 'The Order of the Sacred Framework'
description 'A bridge made for the community to use as a base for their own projects. This bridge will allow a single format to work with nearly all commonly used systems while still offering expandability.' description 'A bridge made for the community to use as a base for their own projects. This bridge will allow a single format to work with nearly all commonly used systems while still offering expandability.'
version '0.2.1' version '0.2.2'
shared_scripts { shared_scripts {
'@ox_lib/init.lua', '@ox_lib/init.lua',
+15 -1
View File
@@ -46,7 +46,21 @@ Framework.GetPlayerJob = function()
end end
Framework.GetPlayerInventory = function() Framework.GetPlayerInventory = function()
return QBCore.Functions.GetPlayerData().items local items = {}
local frameworkInv = QBCore.Functions.GetPlayerData().items
for _, v in pairs(frameworkInv) do
table.insert(items, {
name = v.name,
label = v.label,
count = v.amount,
slot = v.slot,
metadata = v.info,
stack = v.unique,
close = v.useable,
weight = v.weight
})
end
return items
end end
Framework.GetIsPlayerDead = function() Framework.GetIsPlayerDead = function()
+2
View File
@@ -240,6 +240,7 @@ end
-- Adds the specified item to the player's inventory. -- Adds the specified item to the player's inventory.
Framework.AddItem = function(src, item, amount, slot, metadata) Framework.AddItem = function(src, item, amount, slot, metadata)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata})
return player.Functions.AddItem(item, amount, slot, metadata) return player.Functions.AddItem(item, amount, slot, metadata)
end end
@@ -247,6 +248,7 @@ end
-- Removes the specified item from the player's inventory. -- Removes the specified item from the player's inventory.
Framework.RemoveItem = function(src, item, amount, slot, metadata) Framework.RemoveItem = function(src, item, amount, slot, metadata)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
return player.Functions.RemoveItem(item, amount, slot or nil) return player.Functions.RemoveItem(item, amount, slot or nil)
end end
+2
View File
@@ -218,6 +218,7 @@ end
-- Adds the specified item to the player's inventory. -- Adds the specified item to the player's inventory.
Framework.AddItem = function(src, item, amount, slot, metadata) Framework.AddItem = function(src, item, amount, slot, metadata)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata})
return player.Functions.AddItem(item, amount, slot, metadata) return player.Functions.AddItem(item, amount, slot, metadata)
end end
@@ -225,6 +226,7 @@ end
-- Removes the specified item from the player's inventory. -- Removes the specified item from the player's inventory.
Framework.RemoveItem = function(src, item, amount, slot, metadata) Framework.RemoveItem = function(src, item, amount, slot, metadata)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
return player.Functions.RemoveItem(item, amount, slot) return player.Functions.RemoveItem(item, amount, slot)
end end
@@ -21,3 +21,21 @@ Inventory.GetImagePath = function(item)
local imagePath = string.format("nui://codem-inventory/html/images/%s.png", item) local imagePath = string.format("nui://codem-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
Inventory.GetPlayerInventory = function()
local items = {}
local inventory = codem:getUserInventory()
for _, v in pairs(inventory) do
table.insert(items, {
name = v.name,
label = v.label,
count = v.amount,
slot = v.slot,
metadata = v.info,
stack = v.unique,
close = v.useable,
weight = v.weight
})
end
return items
end
@@ -5,17 +5,21 @@ local codem = exports['codem-inventory']
Inventory = Inventory or {} Inventory = Inventory or {}
Inventory.AddItem = function(src, item, count, slot, metadata) Inventory.AddItem = function(src, item, count, slot, metadata)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
return codem:AddItem(src, item, count, slot, metadata) return codem:AddItem(src, item, count, slot, metadata)
end end
Inventory.RemoveItem = function(src, item, count, slot, metadata) Inventory.RemoveItem = function(src, item, count, slot, metadata)
if metadata == nil then if metadata == nil then
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
return codem:RemoveItem(src, item, count, slot) return codem:RemoveItem(src, item, count, slot)
else else
local items = codem:GetInventory(nil, src) local items = codem:GetInventory(nil, src)
for _, itemInfo in pairs(items) do for _, itemInfo in pairs(items) do
if itemInfo.name == item then if itemInfo.name == item then
if itemInfo.info == metadata then if itemInfo.info == metadata then
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = itemInfo.slot, metadata = metadata})
return codem:RemoveItem(src, item, count, itemInfo.slot) return codem:RemoveItem(src, item, count, itemInfo.slot)
end end
end end
@@ -22,3 +22,21 @@ Inventory.GetImagePath = function(item)
local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
Inventory.GetPlayerInventory = function()
local items = {}
local inventory = origin:GetInventory()
for _, v in pairs(inventory) do
table.insert(items, {
name = v.name,
label = v.label,
count = v.count,
slot = v.slot,
metadata = v.metadata,
stack = v.unique,
close = v.useable,
weight = v.weight
})
end
return items
end
@@ -5,10 +5,12 @@ Inventory = Inventory or {}
local origen_inventory = exports.origen_inventory local origen_inventory = exports.origen_inventory
Inventory.AddItem = function(src, item, count, slot, metadata) Inventory.AddItem = function(src, item, count, slot, metadata)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
return origen_inventory:AddItem(src, item, count, metadata, slot, true) return origen_inventory:AddItem(src, item, count, metadata, slot, true)
end end
Inventory.RemoveItem = function(src, item, count, slot, metadata) Inventory.RemoveItem = function(src, item, count, slot, metadata)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
return origen_inventory:removeItem(src, item, count, metadata, slot, true) return origen_inventory:removeItem(src, item, count, metadata, slot, true)
end end
@@ -23,4 +23,8 @@ Inventory.GetImagePath = function(item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
Inventory.GetPlayerInventory = function()
return exports.ox_inventory:GetPlayerItems()
end
--Bridge.RegisterModule("Inventory", Inventory) --Bridge.RegisterModule("Inventory", Inventory)
@@ -5,10 +5,12 @@ local ox_inventory = exports.ox_inventory
Inventory = Inventory or {} Inventory = Inventory or {}
Inventory.AddItem = function(src, item, count, slot, metadata) Inventory.AddItem = function(src, item, count, slot, metadata)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
return ox_inventory:AddItem(src, item, count, metadata) return ox_inventory:AddItem(src, item, count, metadata)
end end
Inventory.RemoveItem = function(src, item, count, slot, metadata) Inventory.RemoveItem = function(src, item, count, slot, metadata)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
return ox_inventory:RemoveItem(src, item, count, metadata, slot) return ox_inventory:RemoveItem(src, item, count, metadata, slot)
end end
+19
View File
@@ -26,3 +26,22 @@ Inventory.GetImagePath = function(item)
local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
Inventory.GetPlayerInventory = function()
local items = {}
local inventory = quasar:getUserInventory()
for _, v in pairs(inventory) do
table.insert(items, {
name = v.name,
label = v.label,
count = v.amount,
slot = v.slot,
metadata = v.info,
stack = v.unique,
close = v.useable,
weight = v.weight
})
end
return items
end
@@ -6,10 +6,12 @@ Inventory = Inventory or {}
Inventory.AddItem = function(src, item, count, slot, metadata) Inventory.AddItem = function(src, item, count, slot, metadata)
if not quasar:CanCarryItem(src, item, count) then return false end if not quasar:CanCarryItem(src, item, count) then return false end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
return quasar:AddItem(src, item, count, slot, metadata) return quasar:AddItem(src, item, count, slot, metadata)
end end
Inventory.RemoveItem = function(src, item, count, slot, metadata) Inventory.RemoveItem = function(src, item, count, slot, metadata)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
return quasar:RemoveItem(src, item, count, slot, metadata) return quasar:RemoveItem(src, item, count, slot, metadata)
end end
@@ -27,3 +27,21 @@ Inventory.GetImagePath = function(item)
local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item) local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
Inventory.GetPlayerInventory = function()
local items = {}
local inventory = tgiann:GetPlayerItems()
for _, v in pairs(inventory) do
table.insert(items, {
name = v.name,
label = v.label,
count = v.amount,
slot = v.slot,
metadata = v.info,
stack = v.unique,
close = v.useable,
weight = v.weight
})
end
return items
end
@@ -6,10 +6,12 @@ Inventory = Inventory or {}
Inventory.AddItem = function(src, item, count, slot, metadata) Inventory.AddItem = function(src, item, count, slot, metadata)
if not tgiann:CanCarryItem(src, item, count) then return false end if not tgiann:CanCarryItem(src, item, count) then return false end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
return tgiann:AddItem(src, item, count, slot, metadata, false) return tgiann:AddItem(src, item, count, slot, metadata, false)
end end
Inventory.RemoveItem = function(src, item, count, slot, metadata) Inventory.RemoveItem = function(src, item, count, slot, metadata)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
return tgiann:RemoveItem(src, item, count, slot, metadata) return tgiann:RemoveItem(src, item, count, slot, metadata)
end end