From c18932443aa8a312a695e6b190f17080964af8c7 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 25 Jan 2024 17:32:40 +0000 Subject: [PATCH] Testing fixing stashes --- crafting.lua | 8 ++++++-- fxmanifest.lua | 2 +- version.txt | 2 +- wrapper.lua | 8 ++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/crafting.lua b/crafting.lua index 6073624..b259046 100644 --- a/crafting.lua +++ b/crafting.lua @@ -303,12 +303,14 @@ function getStash(stashName) local stashResource = "" local result = MySQL.scalar.await('SELECT items FROM stashitems WHERE stash = ?', { stashName }) if result then stashItems = json.decode(result) end end + if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..stashResource) end if stashItems then for _, item in pairs(stashItems) do local itemInfo = Items[item.name:lower()] if itemInfo then - items[#items+1] = { + local indexNum = #items+1 + items[(item.slot and item.slot) or #indexNum)] = { name = itemInfo.name or nil, amount = tonumber(item.amount) or tonumber(item.count), info = item.info or "", @@ -319,8 +321,9 @@ function getStash(stashName) local stashResource = "" unique = itemInfo.unique or nil, useable = itemInfo.useable or nil, image = itemInfo.image or nil, - slot = itemInfo.slot or nil, + slot = (item.slot and item.slot) or indexNum, } + print("TEST:", item.slot and ("slot info found: "..item.slot) or "reverting to indexnum "..indexNum) end end if Config.System.Debug then print("^6Bridge^7: ^3GetStashItems^7: ^2Stash information for ^7'^6"..stashName.."^7' ^2retrieved^7") end @@ -334,6 +337,7 @@ function stashRemoveItem(stashItems, stashName, items) local amount = amount and exports[OXInv]:RemoveItem(stashName, k, v) if Config.System.Debug then print("^6Bridge^7: ^2Removing item from ^3Stash^2 with ^7"..OXInv, k, v) end end + elseif GetResourceState(QSInv):find("start") then for k, v in pairs(items) do for l in pairs(stashItems) do diff --git a/fxmanifest.lua b/fxmanifest.lua index 177aaaa..0eeb09f 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,6 +1,6 @@ name "Jim_Bridge" author "Jimathy" -version "1.0.8" +version "1.0.9" description "Framework Bridge By Jimathy" fx_version "cerulean" game "gta5" diff --git a/version.txt b/version.txt index c7981f4..ab7e7da 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.8 +1.0.9 diff --git a/wrapper.lua b/wrapper.lua index f252810..a340bad 100644 --- a/wrapper.lua +++ b/wrapper.lua @@ -1248,13 +1248,13 @@ function invImg(item) if item ~= "" and Items[item] then if GetResourceState(OXInv):find("start") then imgLink = "nui://"..OXInv.."/web/images/"..(Items[item].image or "") - elseif GetResourceState(QSInv and QSInv or ""):find("start") then + elseif GetResourceState(QSInv):find("start") then imgLink = "nui://"..QSInv.."/html/images/"..(Items[item].image or "") - elseif GetResourceState(CoreInv and CoreInv or ""):find("start") then + elseif GetResourceState(CoreInv):find("start") then imgLink = "nui://"..CoreInv.."/html/img/"..(Items[item].image or "") - elseif GetResourceState(OrigenInv and OrigenInv or ""):find("start") then + elseif GetResourceState(OrigenInv):find("start") then imgLink = "nui://"..OrigenInv.."/html/img/"..(Items[item].image or "") - elseif GetResourceState(QBInv and QBInv or ""):find("start") then + elseif GetResourceState(QBInv):find("start") then imgLink = "nui://"..QBInv.."/html/images/"..(Items[item].image or "") else print("^4ERROR^7: ^2No Inventory detected for invImg ^7- ^2Check ^3exports^1.^2lua^7")