Fix stashCrafting not finding items

This commit is contained in:
Jim Shield
2024-01-23 22:03:27 +00:00
committed by GitHub
parent ab61e40567
commit cc96bcde34
3 changed files with 20 additions and 25 deletions

View File

@@ -321,49 +321,44 @@ function openStash(data)
lookEnt(data.coords) lookEnt(data.coords)
end end
function getStash(stashName) function getStash(stashName) local stashResource = ""
local stashItems, items = {}, {} local stashItems, items = {}, {}
if GetResourceState(OXInv):find("start") then if GetResourceState(OXInv):find("start") then stashResource = OXInv
if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..OXInv) end
stashItems = exports[OXInv]:Inventory(stashName).items stashItems = exports[OXInv]:Inventory(stashName).items
elseif GetResourceState(QSInv):find("start") then elseif GetResourceState(QSInv):find("start") then stashResource = QSInv
if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..QSInv) end
stashItems = exports[QSInv]:GetStashItems(stashName) stashItems = exports[QSInv]:GetStashItems(stashName)
elseif GetResourceState(CoreInv):find("start") then elseif GetResourceState(CoreInv):find("start") then stashResource = CoreInv
if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..CoreInv) end
stashItems = exports[CoreInv]:getInventory(stashName) stashItems = exports[CoreInv]:getInventory(stashName)
elseif GetResourceState(CodeMInv):find("start") then elseif GetResourceState(CodeMInv):find("start") then stashResource = CodeMInv
if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..CodeMInv) end
stashItems = exports[CodeMInv]:GetInventoryItems('Stash', stashName) stashItems = exports[CodeMInv]:GetInventoryItems('Stash', stashName)
elseif GetResourceState(OrigenInv):find("start") then elseif GetResourceState(OrigenInv):find("start") then stashResource = OrigenInv
if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..OrigenInv) end
stashItems = exports[OrigenInv]:GetStash(stashName) stashItems = exports[OrigenInv]:GetStash(stashName)
elseif GetResourceState(QBInv):find("start") then elseif GetResourceState(QBInv):find("start") then stashResource = QBInv
if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..QBInv) end
local result = MySQL.scalar.await('SELECT items FROM stashitems WHERE stash = ?', { stashName }) local result = MySQL.scalar.await('SELECT items FROM stashitems WHERE stash = ?', { stashName })
if result then stashItems = json.decode(result) end if result then stashItems = json.decode(result) end
end end
if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..stashResource) end
if stashItems then if stashItems then
for _, item in pairs(stashItems) do for _, item in pairs(stashItems) do
local itemInfo = Items[item.name:lower()] local itemInfo = Items[item.name:lower()]
if itemInfo then if itemInfo then
items[#items+1] = { items[#items+1] = {
name = itemInfo["name"] ~= nil and itemInfo["slot"] or nil, name = itemInfo.name or nil,
amount = tonumber(item.amount) or tonumber(item.count), amount = tonumber(item.amount) or tonumber(item.count),
info = item.info ~= nil and item.info or "", info = item.info or "",
label = itemInfo["label"] ~= nil and itemInfo["slot"] or nil, label = itemInfo.label or nil,
description = itemInfo["description"] ~= nil and itemInfo["description"] or "", description = itemInfo.description or "",
weight = itemInfo["weight"] ~= nil and itemInfo["slot"] or nil, weight = itemInfo.weight or nil,
type = itemInfo["type"] ~= nil and itemInfo["slot"] or nil, type = itemInfo.type or nil,
unique = itemInfo["unique"] ~= nil and itemInfo["slot"] or nil, unique = itemInfo.unique or nil,
useable = itemInfo["useable"] ~= nil and itemInfo["slot"] or nil, useable = itemInfo.useable or nil,
image = itemInfo["image"] ~= nil and itemInfo["slot"] or nil, image = itemInfo.image or nil,
slot = itemInfo["slot"] ~= nil and itemInfo["slot"] or nil, slot = itemInfo.slot or nil,
} }
end end
end end

View File

@@ -1,6 +1,6 @@
name "Jim_Bridge" name "Jim_Bridge"
author "Jimathy" author "Jimathy"
version "1.0.7" version "1.0.8"
description "Framework Bridge By Jimathy" description "Framework Bridge By Jimathy"
fx_version "cerulean" fx_version "cerulean"
game "gta5" game "gta5"

View File

@@ -1 +1 @@
1.0.7 1.0.8