cleaned up intelisense, finsihed adding type to openstash, registration tweaks
This commit is contained in:
1 parent
fcf0bec75a
commit
baf1c3b2a9
10 files changed
+90
-97
No files matched your search
@@ -86,19 +86,16 @@ end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number||string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
_type = _type or "stash"
|
||||
local tbl = Inventory.Stashes[id]
|
||||
return false, Prints.Error("This Inventory Has Not Been Bridged For A Stash Feature.")
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
--This will register a stash
|
||||
---@param id number||string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
@@ -107,8 +104,19 @@ end
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
return false, Prints.Error("This Inventory Has Not Been Bridged For A Stash Feature.")
|
||||
if Inventory.Stashes[id] then return true, id end
|
||||
Inventory.Stashes[id] = {
|
||||
id = id,
|
||||
label = label,
|
||||
slots = slots,
|
||||
weight = weight,
|
||||
owner = owner,
|
||||
groups = groups,
|
||||
coords = coords
|
||||
}
|
||||
return true, id
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
|
||||
@@ -97,15 +97,13 @@ end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number||string
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, id)
|
||||
local stash = Inventory.Stashes[id]
|
||||
assert(stash, "Stash not found", id)
|
||||
local label = stash.label
|
||||
local slots = stash.slots
|
||||
local weight = stash.weight
|
||||
TriggerClientEvent('community_bridge:client:codem-inventory:openStash', src, id, { label = label, slots = slots, weight = weight })
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
_type = _type or "stash"
|
||||
local tbl = Inventory.Stashes[id]
|
||||
TriggerClientEvent('community_bridge:client:codem-inventory:openStash', src, id, { label = tbl.label, slots = tbl.slots, weight = tbl.weight })
|
||||
end
|
||||
|
||||
|
||||
@@ -118,8 +116,9 @@ end
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
if Inventory.Stashes[id] then return true end
|
||||
if Inventory.Stashes[id] then return true, id end
|
||||
Inventory.Stashes[id] = {
|
||||
id = id,
|
||||
label = label,
|
||||
@@ -129,7 +128,7 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
|
||||
groups = groups,
|
||||
coords = coords
|
||||
}
|
||||
return true
|
||||
return true, id
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
|
||||
@@ -143,18 +143,13 @@ end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number||string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, id)
|
||||
local stash = Inventory.Stashes[id]
|
||||
assert(stash, "Stash not found", id)
|
||||
core:openInventory(src, id, 'stash', stash.slots, stash.weight, true, nil, false)
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
_type = _type or "stash"
|
||||
local tbl = Inventory.Stashes[id]
|
||||
core:openInventory(src, id, _type, tbl.slots, tbl.weight, true, nil, false)
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
@@ -166,8 +161,9 @@ end
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
if Inventory.Stashes[id] then return true end
|
||||
if Inventory.Stashes[id] then return true, id end
|
||||
if not slots then slots = 30 end
|
||||
local mathyShit = slots / 2
|
||||
Inventory.Stashes[id] = {
|
||||
@@ -179,8 +175,8 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
|
||||
groups = groups,
|
||||
coords = coords
|
||||
}
|
||||
core:openInventory(nil, id, 'stash', mathyShit, mathyShit, false, nil, false)
|
||||
return true
|
||||
--core:openInventory(nil, id, 'stash', mathyShit, mathyShit, false, nil, false)
|
||||
return true, id
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
|
||||
@@ -63,12 +63,13 @@ end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number||string
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, id)
|
||||
local stash = Inventory.Stashes[id]
|
||||
assert(stash, "Stash not found", id)
|
||||
TriggerClientEvent('community_bridge:client:jpr-inventory:openStash', src, id, { weight = stash.weight, slots = stash.slots })
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
_type = _type or "stash"
|
||||
local tbl = Inventory.Stashes[id]
|
||||
TriggerClientEvent('community_bridge:client:jpr-inventory:openStash', src, id, { weight = tbl.weight, slots = tbl.slots })
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
@@ -80,8 +81,9 @@ end
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
if Inventory.Stashes[id] then return true end
|
||||
if Inventory.Stashes[id] then return true, id end
|
||||
Inventory.Stashes[id] = {
|
||||
id = id,
|
||||
label = label,
|
||||
@@ -91,7 +93,7 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
|
||||
groups = groups,
|
||||
coords = coords
|
||||
}
|
||||
return true
|
||||
return true, id
|
||||
end
|
||||
|
||||
---This will add items to a trunk, and return true or false based on success
|
||||
|
||||
@@ -143,18 +143,13 @@ end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number||string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, id)
|
||||
local stash = Inventory.Stashes[id]
|
||||
assert(stash, "Stash not found", id)
|
||||
return origin:OpenInventory(src, 'stash', id)
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
_type = _type or "stash"
|
||||
local tbl = Inventory.Stashes[id]
|
||||
return origin:OpenInventory(src, _type, id)
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
@@ -167,7 +162,7 @@ end
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
if Inventory.Stashes[id] then return true end
|
||||
if Inventory.Stashes[id] then return true, id end
|
||||
Inventory.Stashes[id] = {
|
||||
id = id,
|
||||
label = label,
|
||||
@@ -177,7 +172,8 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
|
||||
groups = groups,
|
||||
coords = coords
|
||||
}
|
||||
return origin:registerStash(id, label, slots, weight, owner, groups, coords)
|
||||
origin:registerStash(id, label, slots, weight, owner, groups, coords)
|
||||
return true, id
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
|
||||
@@ -112,9 +112,11 @@ end
|
||||
---This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number|string
|
||||
---@param id number||string
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
_type = _type or "stash"
|
||||
--local tbl = Inventory.Stashes[id]
|
||||
ox_inventory:forceOpenInventory(src, _type, id)
|
||||
end
|
||||
|
||||
@@ -127,8 +129,9 @@ end
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
if Inventory.Stashes[id] then return true end
|
||||
if Inventory.Stashes[id] then return true, id end
|
||||
Inventory.Stashes[id] = {
|
||||
id = id,
|
||||
label = label,
|
||||
@@ -138,7 +141,8 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
|
||||
groups = groups,
|
||||
coords = coords
|
||||
}
|
||||
return ox_inventory:RegisterStash(id, label, slots, weight, owner, groups)
|
||||
ox_inventory:RegisterStash(id, label, slots, weight, owner, groups)
|
||||
return true, id
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
|
||||
@@ -102,16 +102,13 @@ end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number||string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
|
||||
TriggerClientEvent('community_bridge:client:ps-inventory:openStash', src, id, { label = label, maxweight = weight, slots = slots, })
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
_type = _type or "stash"
|
||||
local tbl = Inventory.Stashes[id]
|
||||
TriggerClientEvent('community_bridge:client:ps-inventory:openStash', src, id, { label = tbl.label, maxweight = tbl.weight, slots = tbl.slots, })
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
@@ -123,8 +120,9 @@ end
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
if Inventory.Stashes[id] then return true end
|
||||
if Inventory.Stashes[id] then return true, id end
|
||||
Inventory.Stashes[id] = {
|
||||
id = id,
|
||||
label = label,
|
||||
@@ -133,8 +131,8 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
|
||||
owner = owner,
|
||||
groups = groups,
|
||||
coords = coords
|
||||
}
|
||||
return true
|
||||
}
|
||||
return true, id
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
|
||||
@@ -120,17 +120,18 @@ end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param id number|string
|
||||
---@param _type string
|
||||
---@param id number||string
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, id)
|
||||
local stash = Inventory.Stashes[id]
|
||||
assert(stash, "Stash not found", id)
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
_type = _type or "stash"
|
||||
local tbl = Inventory.Stashes[id]
|
||||
|
||||
if getInventoryNewVersion() then
|
||||
return qbInventory:OpenInventory(src, id)
|
||||
end
|
||||
|
||||
TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = stash.weight, slots = stash.slots})
|
||||
TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = tbl.weight, slots = tbl.slots})
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
@@ -142,8 +143,9 @@ end
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
if Inventory.Stashes[id] then return true end
|
||||
if Inventory.Stashes[id] then return true, id end
|
||||
Inventory.Stashes[id] = {
|
||||
id = id,
|
||||
label = label,
|
||||
@@ -153,7 +155,7 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
|
||||
groups = groups,
|
||||
coords = coords
|
||||
}
|
||||
return true
|
||||
return true, id
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
@@ -213,7 +215,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
-- This will open the specified shop for the src passed.
|
||||
---This will open the specified shop for the src passed.
|
||||
---@param src number
|
||||
---@param shopTitle string
|
||||
Inventory.OpenShop = function(src, shopTitle)
|
||||
@@ -227,11 +229,11 @@ Inventory.OpenShop = function(src, shopTitle)
|
||||
end
|
||||
end
|
||||
|
||||
-- This will register a shop, if it already exists it will return true.
|
||||
-- @param shopTitle string
|
||||
-- @param shopInventory table
|
||||
-- @param shopCoords table
|
||||
-- @param shopGroups table
|
||||
--This will register a shop, if it already exists it will return true.
|
||||
---@param shopTitle string
|
||||
---@param shopInventory table
|
||||
---@param shopCoords table
|
||||
---@param shopGroups table
|
||||
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
|
||||
if not shopTitle or not shopInventory then return end
|
||||
if registeredShops[shopTitle] then return true end
|
||||
|
||||
@@ -137,18 +137,13 @@ end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number||string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
_type = _type or "stash"
|
||||
local data = Inventory.Stashes[id]
|
||||
TriggerEvent("inventory:server:OpenInventory", _type, id, data and { maxweight = data.weight, slots = data.slots })
|
||||
local tbl = Inventory.Stashes[id]
|
||||
TriggerEvent("inventory:server:OpenInventory", _type, id, tbl and { maxweight = tbl.weight, slots = tbl.slots })
|
||||
TriggerClientEvent("inventory:client:SetCurrentStash",src, id)
|
||||
end
|
||||
|
||||
@@ -161,6 +156,7 @@ end
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
if Inventory.Stashes[id] then return true end
|
||||
Inventory.Stashes[id] = {
|
||||
@@ -173,7 +169,7 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
|
||||
coords = coords
|
||||
}
|
||||
--exports['qs-inventory']:RegisterStash(src, id, stashSlots, stashWeight) -- this needs to pass source to register, need to plan around this.
|
||||
return true
|
||||
return true, id
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
|
||||
@@ -105,20 +105,11 @@ end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string == "trunk" || "glovebox" || "stash"
|
||||
---@param _type string
|
||||
---@param id number||string
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
-- if id:sub(1, 5) == "trunk" then
|
||||
-- _type = "trunk"
|
||||
-- id = id:sub(5)
|
||||
-- elseif id:sub(1, 6) == "glovebox" then
|
||||
-- _type = "glovebox"
|
||||
-- id = id:sub(6)
|
||||
-- elseif id:sub(1, 5) == "stash" then
|
||||
-- _type = "stash"
|
||||
-- id = id:sub(5)
|
||||
-- end
|
||||
_type = _type or "stash"
|
||||
local tbl = Inventory.Stashes[id]
|
||||
return tgiann:ForceOpenInventory(src, _type, id, tbl and { maxWeight = tbl.weight , slots = tbl.slot, label = tbl.label})
|
||||
end
|
||||
@@ -132,6 +123,7 @@ end
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
Inventory.Stashes[id] = {
|
||||
id = id,
|
||||
@@ -142,7 +134,7 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
|
||||
groups = groups,
|
||||
coords = coords
|
||||
}
|
||||
return id
|
||||
return true, id
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
|
||||
Reference in new issue
Block a user