Adjust hasItem function for QS-Inv

Apparently qs-inv reports two variables on the item data for how you have
`count` and `amount`
while other inventories appear to only have one of those

I'm assuming for compatibility sake

Apparently the `count` is updated differently, and `hasItem()` was checking for this first

I've swapped round the checks and appears to work better
This commit is contained in:
Jim Shield
2025-05-15 19:55:14 +01:00
parent 263d5160aa
commit 9198068a19

View File

@@ -50,8 +50,9 @@ function hasItem(items, amount, src)
local count = 0
for _, itemData in pairs(grabInv) do
jsonPrint(itemData)
if itemData and itemData.name == item then
count += (itemData.count or itemData.amount or 1)
count += (itemData.amount or itemData.count or 1)
end
end
foundInv = foundInv:gsub("%-", "^7-^6"):gsub("%_", "^7_^6")