Merge pull request #21 from The-Order-Of-The-Sacred-Framework/dev
Dev sync
This commit is contained in:
14 files changed
+110
-3
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ lua54 'yes'
|
||||
use_experimental_fxv2_oal 'yes'
|
||||
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.'
|
||||
version '0.2.1'
|
||||
version '0.2.2'
|
||||
|
||||
shared_scripts {
|
||||
'@ox_lib/init.lua',
|
||||
|
||||
@@ -46,7 +46,21 @@ Framework.GetPlayerJob = function()
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
Framework.GetIsPlayerDead = function()
|
||||
|
||||
@@ -240,6 +240,7 @@ end
|
||||
-- Adds the specified item to the player's inventory.
|
||||
Framework.AddItem = function(src, item, amount, slot, metadata)
|
||||
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)
|
||||
end
|
||||
|
||||
@@ -247,6 +248,7 @@ end
|
||||
-- Removes the specified item from the player's inventory.
|
||||
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
@@ -218,6 +218,7 @@ end
|
||||
-- Adds the specified item to the player's inventory.
|
||||
Framework.AddItem = function(src, item, amount, slot, metadata)
|
||||
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)
|
||||
end
|
||||
|
||||
@@ -225,6 +226,7 @@ end
|
||||
-- Removes the specified item from the player's inventory.
|
||||
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
@@ -20,4 +20,22 @@ end
|
||||
Inventory.GetImagePath = function(item)
|
||||
local imagePath = string.format("nui://codem-inventory/html/images/%s.png", item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
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.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)
|
||||
end
|
||||
|
||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||
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)
|
||||
else
|
||||
local items = codem:GetInventory(nil, src)
|
||||
for _, itemInfo in pairs(items) do
|
||||
if itemInfo.name == item 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)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,4 +21,22 @@ Inventory.GetImagePath = function(item)
|
||||
local file = LoadResourceFile("origen_inventory", string.format("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"
|
||||
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
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
@@ -23,4 +23,8 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
Inventory.GetPlayerInventory = function()
|
||||
return exports.ox_inventory:GetPlayerItems()
|
||||
end
|
||||
|
||||
--Bridge.RegisterModule("Inventory", Inventory)
|
||||
@@ -5,10 +5,12 @@ local ox_inventory = exports.ox_inventory
|
||||
Inventory = Inventory or {}
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
@@ -25,4 +25,23 @@ Inventory.GetImagePath = function(item)
|
||||
local file = LoadResourceFile("qs-inventory", string.format("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"
|
||||
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)
|
||||
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)
|
||||
end
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
@@ -26,4 +26,22 @@ Inventory.GetImagePath = function(item)
|
||||
local webpPath = LoadResourceFile("inventory_images", string.format("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"
|
||||
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)
|
||||
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)
|
||||
end
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user