Remove example scripts and update core logic
Deleted all files in the examples directory to clean up unused or test scripts. Updated fxmanifest.lua to enable ox_lib initialization. Improved error handling and entity tracking in utility functions, added prop removal, and made minor localization and code style adjustments throughout the codebase. Significant reword of inventory module, notification module, and framework module. Added support for wasabi_uikit, added support for keep-progressbars,
This commit is contained in:
1 parent
c40a260ea2
commit
343af95794
99 files changed
+2337
-2689
No files matched your search
@@ -1,20 +0,0 @@
|
||||
-- -- Make sure to include filename in the init (prefix of the .lua)Utility = Utility or Require("lib/utility/client/utility.lua")
|
||||
-- local ParticlesBehaviors = {
|
||||
-- tag = "isTemplate",
|
||||
-- default = {
|
||||
-- }
|
||||
|
||||
-- }
|
||||
|
||||
-- function ParticlesBehaviors.OnSpawn(entityData)
|
||||
-- end
|
||||
|
||||
|
||||
-- function ParticlesBehaviors.OnRemove(entityData)
|
||||
-- end
|
||||
|
||||
-- function ParticlesBehaviors.OnUpdate(entityData)
|
||||
|
||||
-- end
|
||||
|
||||
-- return ParticlesBehaviors
|
||||
@@ -1,19 +0,0 @@
|
||||
AddEventHandler('onResourceStart', function(resource)
|
||||
if resource == GetCurrentResourceName() then
|
||||
Bridge.Cache.OnChange("Ped", function(newValue, oldValue)
|
||||
print("Ped changed from " .. tostring(oldValue) .. " to " .. tostring(newValue))
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterCommand("testcache", function(source, args, rawCommand)
|
||||
-- local cache = Bridge.Cache.Get("Ped")
|
||||
Bridge.Cache.Create("TestCache", function()
|
||||
return math.random(1, 100)
|
||||
end, 1000)
|
||||
|
||||
Bridge.Cache.OnChange("TestCache", function(newValue, oldValue)
|
||||
print("TestCache changed from " .. tostring(oldValue) .. " to " .. tostring(newValue))
|
||||
end)
|
||||
end)
|
||||
@@ -1,40 +0,0 @@
|
||||
-- ▄▀▀ ▄▀▄ █ █ ██▄ ▄▀▄ ▄▀▀ █▄▀ ▄▀▀ ▄▀▀ █▄█ ▄▀▄ █▀▄ ██▀ █▀▄ █ █ █▄ █ █ ▀█▀ ▀█▀ ██▀ ▄▀▀ ▀█▀
|
||||
-- ▀▄▄ █▀█ █▄▄ █▄▄ █▄█ █▀█ ▀▄▄ █ █ ▄█▀ ▄█▀ █ █ █▀█ █▀▄ █▄▄ █▄▀ ▀▄█ █ ▀█ █ █ █ █▄▄ ▄█▀ █
|
||||
|
||||
-- -- -- -- -- -- -- -- -- --
|
||||
-- ▄▀▀ ██▀ █▀▄ █ █ ██▀ █▀▄
|
||||
-- ▄█▀ █▄▄ █▀▄ ▀▄▀ █▄▄ █▀▄
|
||||
-- -- -- -- -- -- -- -- -- --
|
||||
if not IsDuplicityVersion() then goto client end
|
||||
|
||||
Bridge.Callbacks.Register('callback_test1_name_here', function(src, var1)
|
||||
if var1 == "herpaderpa" then
|
||||
print("this is a test")
|
||||
end
|
||||
return 'some random string', "some other string"
|
||||
end)
|
||||
|
||||
RegisterCommand('callback_test2', function(source)
|
||||
local someData, other = Bridge.Callbacks.Trigger('callback_test2_name_here', source, "herpaderpa")
|
||||
print("Data From Client: ", someData, other)
|
||||
end)
|
||||
|
||||
-- -- -- -- -- -- -- -- -- --
|
||||
-- ▄▀▀ █ █ ██▀ █▄ █ ▀█▀
|
||||
-- ▀▄▄ █▄▄ █ █▄▄ █ ▀█ █
|
||||
-- -- -- -- -- -- -- -- -- --
|
||||
if IsDuplicityVersion() then return end
|
||||
::client::
|
||||
|
||||
RegisterCommand('callback_test1', function()
|
||||
local somerandomstring, someotherrandomstring = Bridge.Callbacks.Trigger('callback_test1_name_here', "herpaderpa")
|
||||
print("Data From Server: ", somerandomstring, someotherrandomstring)
|
||||
end)
|
||||
|
||||
-- exports.community_bridge:RegisterRebound('callback_test1', function(src, cb, ftpcsftug)
|
||||
-- print("this is a rebound to all players")
|
||||
-- end)
|
||||
|
||||
Bridge.Callbacks.Register('callback_test2_name_here', function(ftpcsftug)
|
||||
return ftpcsftug, 'TestyMcTesterton'
|
||||
end)
|
||||
@@ -1,367 +0,0 @@
|
||||
Bridge = Bridge or exports['community_bridge']:Bridge()
|
||||
-- RegisterCommand("ClientEntityParticles", function()
|
||||
-- local position = GetEntityCoords(PlayerPedId())
|
||||
-- local data = Bridge.ClientEntity.Create({
|
||||
-- id = "particle_" .. math.random(1, 10000),
|
||||
-- model = "mp_m_freemode_01",
|
||||
-- coords = position,
|
||||
-- entityType = "ped",
|
||||
-- freeze = false,
|
||||
-- follow = {
|
||||
-- target = 1,
|
||||
-- },
|
||||
-- weapon = {
|
||||
-- name = "WEAPON_PISTOL",
|
||||
-- ammo = 100
|
||||
-- },
|
||||
-- stash = {
|
||||
-- -- id = "generate from server",
|
||||
-- label = "Test Stash",
|
||||
-- target = {
|
||||
-- label = "Open Stash",
|
||||
-- description = "Access the stash to store or retrieve items.",
|
||||
-- icon = "fas fa-boxes"
|
||||
-- }
|
||||
-- },
|
||||
-- attach = {
|
||||
-- target = 1,
|
||||
-- bone = 57005, -- right hand
|
||||
-- },
|
||||
-- scenarios = {
|
||||
-- name = "WORLD_HUMAN_CLIPBOARD",
|
||||
-- introClip = true,
|
||||
-- duration = 20000
|
||||
-- },
|
||||
-- anim = {
|
||||
-- dict = "anim@mp_player_intcelebrationmale@wave",
|
||||
-- name = "wave",
|
||||
-- flags = 49,
|
||||
-- duration = -1,
|
||||
-- onComplete = function(entityData)
|
||||
-- Bridge.ClientEntity.Set(entityData.id, "anim", {
|
||||
-- dict = "rcmnigel1c",
|
||||
-- name = "hailing_whistle_waive_a",
|
||||
-- flags = entityData.anim.flags,
|
||||
-- duration = 10000,
|
||||
-- onComplete = function(entityData)
|
||||
-- Bridge.ClientEntity.Set(entityData.id, "anim", {
|
||||
-- dict = "timetable@denice@ig_1",
|
||||
-- name = "idle_b",
|
||||
-- flags = entityData.anim.flags,
|
||||
-- duration = 10000,
|
||||
-- onComplete = function(entityData)
|
||||
-- print("hello")
|
||||
-- end
|
||||
-- })
|
||||
-- end
|
||||
-- })
|
||||
-- end
|
||||
-- },
|
||||
-- clothing = {
|
||||
-- components = {
|
||||
-- { drawable = 0, texture = 0, component_id = 0 },
|
||||
-- { drawable = 0, texture = 0, component_id = 1 },
|
||||
-- { drawable = 19, texture = 0, component_id = 2 },
|
||||
-- { drawable = 6, texture = 0, component_id = 3 },
|
||||
-- { drawable = 0, texture = 0, component_id = 4 },
|
||||
-- { drawable = 0, texture = 0, component_id = 5 },
|
||||
-- { drawable = 0, texture = 0, component_id = 6 },
|
||||
-- { drawable = 0, texture = 0, component_id = 7 },
|
||||
-- { drawable = 23, texture = 0, component_id = 8 },
|
||||
-- { drawable = 0, texture = 0, component_id = 9 },
|
||||
-- { drawable = 0, texture = 0, component_id = 10 },
|
||||
-- { drawable = 4, texture = 2, component_id = 11 }
|
||||
-- },
|
||||
-- props = {
|
||||
-- { drawable = 27, prop_id = 0, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 1, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 2, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 3, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 4, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 5, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 6, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 7, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 8, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 9, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 10, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 11, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 12, texture = 0 },
|
||||
-- { drawable = 0, prop_id = 13, texture = 0 }
|
||||
-- }
|
||||
-- },
|
||||
-- particles = {
|
||||
-- {
|
||||
-- dict = "core",
|
||||
-- ptfx = "ent_dst_electrical",
|
||||
-- offset = vector3(0.0, 1.0, 0.0),
|
||||
-- looped = true
|
||||
-- },
|
||||
-- {
|
||||
-- dict = "core",
|
||||
-- ptfx = "ent_dst_electrical",
|
||||
-- offset = vector3(0.0, -1.0, 0.0),
|
||||
-- rotation = vector3(0.0, 0.0, 180.0),
|
||||
-- looped = true,
|
||||
-- loopLength = 1000
|
||||
-- }
|
||||
-- },
|
||||
-- targets = {
|
||||
-- {
|
||||
-- label = "Follow Test",
|
||||
-- distance = 2,
|
||||
-- description = "A test particle for demonstration purposes.",
|
||||
-- onSelect = function (entityData, entity)
|
||||
-- FreezeEntityPosition(entity, false)
|
||||
-- Bridge.ClientEntity.Set(entityData.id, "follow", {
|
||||
-- target = PlayerPedId()
|
||||
-- })
|
||||
-- end
|
||||
-- }
|
||||
-- },
|
||||
-- -- OnUpdate = function(entityData)
|
||||
|
||||
-- -- end,
|
||||
-- })
|
||||
-- -- Wait(5000)
|
||||
-- Bridge.ClientEntity.Set(data.id, "targets", {
|
||||
-- label = "This should be the new label",
|
||||
-- distance = 2,
|
||||
-- description = "Herpa derpa gihad",
|
||||
-- onSelect = function (entityData, entity)
|
||||
-- print("round 2 baby", entityData.id)
|
||||
-- end
|
||||
-- })
|
||||
-- end, false)
|
||||
|
||||
|
||||
-- Bridge.ClientEntity.Behaviors.Create("plate", {
|
||||
-- tag = "something",
|
||||
-- OnCreate = function(entityData)
|
||||
|
||||
-- end,
|
||||
-- OnSpawn = function(entityData)
|
||||
|
||||
-- end,
|
||||
-- OnUpdate = function(entityData)
|
||||
-- -- Update logic here
|
||||
-- end,
|
||||
-- OnRemove = function(entityData)
|
||||
|
||||
-- end,
|
||||
-- OnDestroy = function(entityData)
|
||||
|
||||
-- end
|
||||
-- })
|
||||
|
||||
RegisterCommand("ClientEntityFreeze", function()
|
||||
local position = GetEntityCoords(PlayerPedId())
|
||||
local data = Bridge.ClientEntity.Create({
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
freeze = true
|
||||
})
|
||||
Wait(10000)
|
||||
Bridge.ClientEntity.Set(data.id, "freeze", false)
|
||||
end, false)
|
||||
|
||||
RegisterCommand("ClientEntityFollow", function()
|
||||
local position = GetEntityCoords(PlayerPedId())
|
||||
local serverId = GetPlayerServerId(PlayerId())
|
||||
local data = Bridge.ClientEntity.Create({
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
freeze = false,
|
||||
follow = {
|
||||
speed = 3.0,
|
||||
target = serverId,
|
||||
distance = 5.0
|
||||
}
|
||||
})
|
||||
print(data.id)
|
||||
end, false)
|
||||
|
||||
RegisterCommand("ClientEntityWeapon", function()
|
||||
local position = GetEntityCoords(PlayerPedId())
|
||||
local data = Bridge.ClientEntity.Create({
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
weapon = {
|
||||
name = "WEAPON_PISTOL",
|
||||
ammo = 100
|
||||
}
|
||||
})
|
||||
end, false)
|
||||
|
||||
|
||||
RegisterCommand("ClientEntityAttach", function()
|
||||
local position = GetEntityCoords(PlayerPedId())
|
||||
local serverId = GetPlayerServerId(PlayerId())
|
||||
Bridge.ClientEntity.Create({
|
||||
id = "attach_" .. math.random(1, 10000),
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
attach = {
|
||||
target = serverId,
|
||||
bone = 57005
|
||||
}
|
||||
})
|
||||
end, false)
|
||||
|
||||
RegisterCommand("ClientEntityScenarios", function()
|
||||
local position = GetEntityCoords(PlayerPedId())
|
||||
Bridge.ClientEntity.Create({
|
||||
id = "scenarios_" .. math.random(1, 10000),
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
scenarios = {
|
||||
name = "WORLD_HUMAN_CLIPBOARD",
|
||||
introClip = true,
|
||||
duration = 20000
|
||||
}
|
||||
})
|
||||
end, false)
|
||||
|
||||
RegisterCommand("ClientEntityAnim", function()
|
||||
local position = GetEntityCoords(PlayerPedId())
|
||||
Bridge.ClientEntity.Create({
|
||||
id = "anim_" .. math.random(1, 10000),
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
anim = {
|
||||
dict = "anim@mp_player_intcelebrationmale@wave",
|
||||
name = "wave",
|
||||
flags = 49,
|
||||
duration = -1,
|
||||
onComplete = function(entityData)
|
||||
Bridge.ClientEntity.Set(entityData.id, "anim", {
|
||||
dict = "rcmnigel1c",
|
||||
name = "hailing_whistle_waive_a",
|
||||
flags = entityData.anim.flags,
|
||||
duration = 10000,
|
||||
onComplete = function(entityData)
|
||||
Bridge.ClientEntity.Set(entityData.id, "anim", {
|
||||
dict = "timetable@denice@ig_1",
|
||||
name = "idle_b",
|
||||
flags = entityData.anim.flags,
|
||||
duration = 10000,
|
||||
onComplete = function(entityData)
|
||||
print("hello")
|
||||
end
|
||||
})
|
||||
end
|
||||
})
|
||||
end
|
||||
}
|
||||
})
|
||||
end, false)
|
||||
|
||||
RegisterCommand("ClientEntityClothing", function()
|
||||
local position = GetEntityCoords(PlayerPedId())
|
||||
Bridge.ClientEntity.Create({
|
||||
id = "clothing_" .. math.random(1, 10000),
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
clothing = {
|
||||
components = {
|
||||
{ drawable = 0, texture = 0, component_id = 0 },
|
||||
{ drawable = 0, texture = 0, component_id = 1 },
|
||||
{ drawable = 19, texture = 0, component_id = 2 },
|
||||
{ drawable = 6, texture = 0, component_id = 3 },
|
||||
{ drawable = 0, texture = 0, component_id = 4 },
|
||||
{ drawable = 0, texture = 0, component_id = 5 },
|
||||
{ drawable = 0, texture = 0, component_id = 6 },
|
||||
{ drawable = 0, texture = 0, component_id = 7 },
|
||||
{ drawable = 23, texture = 0, component_id = 8 },
|
||||
{ drawable = 0, texture = 0, component_id = 9 },
|
||||
{ drawable = 0, texture = 0, component_id = 10 },
|
||||
{ drawable = 4, texture = 2, component_id = 11 }
|
||||
},
|
||||
props = {
|
||||
{ drawable = 27, prop_id = 0, texture = 0 },
|
||||
{ drawable = 0, prop_id = 1, texture = 0 },
|
||||
{ drawable = 0, prop_id = 2, texture = 0 },
|
||||
{ drawable = 0, prop_id = 3, texture = 0 },
|
||||
{ drawable = 0, prop_id = 4, texture = 0 },
|
||||
{ drawable = 0, prop_id = 5, texture = 0 },
|
||||
{ drawable = 0, prop_id = 6, texture = 0 },
|
||||
{ drawable = 0, prop_id = 7, texture = 0 },
|
||||
{ drawable = 0, prop_id = 8, texture = 0 },
|
||||
{ drawable = 0, prop_id = 9, texture = 0 },
|
||||
{ drawable = 0, prop_id = 10, texture = 0 },
|
||||
{ drawable = 0, prop_id = 11, texture = 0 },
|
||||
{ drawable = 0, prop_id = 12, texture = 0 },
|
||||
{ drawable = 0, prop_id = 13, texture = 0 }
|
||||
}
|
||||
}
|
||||
})
|
||||
end, false)
|
||||
|
||||
RegisterCommand("ClientEntityParticles", function()
|
||||
local position = GetEntityCoords(PlayerPedId())
|
||||
Bridge.ClientEntity.Create({
|
||||
id = "particles_" .. math.random(1, 10000),
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
particles = {
|
||||
{
|
||||
dict = "core",
|
||||
ptfx = "ent_dst_electrical",
|
||||
offset = vector3(0.0, 1.0, 0.0),
|
||||
looped = true
|
||||
},
|
||||
{
|
||||
dict = "core",
|
||||
ptfx = "ent_dst_electrical",
|
||||
offset = vector3(0.0, -1.0, 0.0),
|
||||
rotation = vector3(0.0, 0.0, 180.0),
|
||||
looped = true,
|
||||
loopLength = 1000
|
||||
}
|
||||
}
|
||||
})
|
||||
end, false)
|
||||
|
||||
RegisterCommand("ClientEntityTargets", function()
|
||||
local position = GetEntityCoords(PlayerPedId())
|
||||
local derp = Bridge.ClientEntity.Create({
|
||||
id = "targets_" .. math.random(1, 10000),
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
targets = {
|
||||
{
|
||||
label = "Initial test",
|
||||
distance = 2,
|
||||
description = "A test particle for demonstration purposes.",
|
||||
onSelect = function (entityData, entity)
|
||||
print("Selected entity:", entityData.id)
|
||||
end
|
||||
}
|
||||
}
|
||||
})
|
||||
Wait(10000)
|
||||
Bridge.ClientEntity.Set(derp.id, "targets",
|
||||
{
|
||||
{
|
||||
label = "Follow Test",
|
||||
distance = 2,
|
||||
description = "A test particle for demonstration purposes.",
|
||||
onSelect = function (entityData, entity)
|
||||
Bridge.ClientEntity.Set(entityData.id, "freeze", false)
|
||||
Bridge.ClientEntity.Set(entityData.id, "follow", {
|
||||
target = PlayerPedId()
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
)
|
||||
end, false)
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
Bridge = Bridge or exports['community_bridge']:Bridge()
|
||||
RegisterCommand("dialogue", function()
|
||||
local pos = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0, 2.0, 0)
|
||||
local timeout = 500
|
||||
local model = `a_f_y_hipster_01`
|
||||
RequestModel(model)
|
||||
while not HasModelLoaded(model) do
|
||||
Wait(0)
|
||||
timeout = timeout - 1
|
||||
if timeout == 0 then
|
||||
print("Failed to load model")
|
||||
return
|
||||
end
|
||||
end
|
||||
local ped = CreatePed(0, model, pos.x, pos.y, pos.z, 0.0, false, false)
|
||||
SetEntityHeading(ped, 50.0)
|
||||
local characterData = {
|
||||
entity = ped,
|
||||
offset = vector3(0, 0, 0),
|
||||
rotationOffset = vector3(0, 0, 0)
|
||||
}
|
||||
Bridge.Dialogue.Open("Akmed", "Hello how are you doing my friend?", ped, {
|
||||
{
|
||||
label = "Trade with me",
|
||||
id = 'something',
|
||||
},
|
||||
{
|
||||
label = "Goodbye",
|
||||
id = 'someotherthing',
|
||||
},
|
||||
},
|
||||
function(selectedId)
|
||||
if selectedId == 'something' then
|
||||
Dialogue.Open( "Akmed" , "Thank you for wanting to purchase me lucky charms", characterData, {
|
||||
{
|
||||
label = "Fuck off",
|
||||
id = 'something',
|
||||
},
|
||||
{
|
||||
label = "Goodbye",
|
||||
id = 'someotherthing',
|
||||
},
|
||||
},
|
||||
function(selectedId)
|
||||
DeleteEntity(ped)
|
||||
if selectedId == "something" then
|
||||
print("You hate lucky charms")
|
||||
else
|
||||
print("Thanks for keeping it civil")
|
||||
end
|
||||
end)
|
||||
else
|
||||
DeleteEntity(ped)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,234 +0,0 @@
|
||||
-- Test QB Format Input
|
||||
RegisterCommand('input_test_qb', function()
|
||||
local qbFormatData = {
|
||||
inputs = {
|
||||
{
|
||||
text = "Player Name",
|
||||
name = "playername",
|
||||
type = "text",
|
||||
isRequired = true,
|
||||
default = "John Doe"
|
||||
},
|
||||
{
|
||||
text = "Player ID",
|
||||
name = "playerid",
|
||||
type = "number",
|
||||
isRequired = true
|
||||
},
|
||||
{
|
||||
text = "Password",
|
||||
name = "password",
|
||||
type = "password",
|
||||
isRequired = false
|
||||
},
|
||||
{
|
||||
text = "Vehicle Type",
|
||||
name = "vehicle",
|
||||
type = "select",
|
||||
isRequired = true,
|
||||
options = {
|
||||
{value = "car", text = "Car"},
|
||||
{value = "bike", text = "Motorcycle"},
|
||||
{value = "truck", text = "Truck"}
|
||||
}
|
||||
},
|
||||
{
|
||||
text = "Enable Notifications",
|
||||
name = "notifications",
|
||||
type = "checkbox",
|
||||
isRequired = false,
|
||||
options = {
|
||||
{value = "email", text = "Email", checked = true},
|
||||
{value = "sms", text = "SMS", checked = false}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local result = Input.Open("QB Format Test", qbFormatData, true, "Submit")
|
||||
if result then
|
||||
print("QB Format Result:")
|
||||
for k, v in pairs(result) do
|
||||
print(k .. ": " .. tostring(v))
|
||||
end
|
||||
else
|
||||
print("QB Format: User cancelled or no input")
|
||||
end
|
||||
end, false)
|
||||
|
||||
-- Test Ox Format Input
|
||||
RegisterCommand('input_test_ox', function()
|
||||
local oxFormatData = {
|
||||
{
|
||||
type = "input",
|
||||
label = "Character Name",
|
||||
name = "charname",
|
||||
required = true,
|
||||
default = "Jane Smith"
|
||||
},
|
||||
{
|
||||
type = "number",
|
||||
label = "Age",
|
||||
name = "age",
|
||||
required = true,
|
||||
min = 18,
|
||||
max = 100
|
||||
},
|
||||
{
|
||||
type = "select",
|
||||
label = "Job Category",
|
||||
name = "jobcat",
|
||||
required = true,
|
||||
options = {
|
||||
{value = "civ", label = "Civilian"},
|
||||
{value = "leo", label = "Law Enforcement"},
|
||||
{value = "ems", label = "Emergency Medical"}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "checkbox",
|
||||
label = "Has License",
|
||||
name = "license",
|
||||
required = false
|
||||
},
|
||||
{
|
||||
type = "color",
|
||||
label = "Favorite Color",
|
||||
name = "color",
|
||||
default = "#ff0000"
|
||||
},
|
||||
{
|
||||
type = "date",
|
||||
label = "Birth Date",
|
||||
name = "birthdate",
|
||||
format = "DD/MM/YYYY"
|
||||
}
|
||||
}
|
||||
|
||||
local result = Input.Open("Ox Format Test", oxFormatData, false)
|
||||
if result then
|
||||
print("Ox Format Result:")
|
||||
for k, v in pairs(result) do
|
||||
print(k .. ": " .. tostring(v))
|
||||
end
|
||||
else
|
||||
print("Ox Format: User cancelled or no input")
|
||||
end
|
||||
end, false)
|
||||
|
||||
-- Test Simple Text Input
|
||||
RegisterCommand('input_test_simple', function()
|
||||
local simpleData = {
|
||||
inputs = {
|
||||
{
|
||||
text = "Enter your message",
|
||||
name = "message",
|
||||
type = "text",
|
||||
isRequired = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local result = Input.Open("Simple Input", simpleData, true, "Send")
|
||||
if result then
|
||||
print("Simple Input Result: " .. (result.message or "No message"))
|
||||
else
|
||||
print("Simple Input: Cancelled")
|
||||
end
|
||||
end, false)
|
||||
|
||||
-- Test All Input Types (QB Format)
|
||||
RegisterCommand('input_test_all_types', function()
|
||||
local allTypesData = {
|
||||
inputs = {
|
||||
{
|
||||
text = "Text Input",
|
||||
name = "text_field",
|
||||
type = "text",
|
||||
isRequired = false,
|
||||
default = "Sample text"
|
||||
},
|
||||
{
|
||||
text = "Number Input",
|
||||
name = "number_field",
|
||||
type = "number",
|
||||
isRequired = false,
|
||||
default = 42
|
||||
},
|
||||
{
|
||||
text = "Password Input",
|
||||
name = "password_field",
|
||||
type = "password",
|
||||
isRequired = false
|
||||
},
|
||||
{
|
||||
text = "Radio Selection",
|
||||
name = "radio_field",
|
||||
type = "radio",
|
||||
isRequired = false,
|
||||
options = {
|
||||
{value = "option1", text = "Option 1"},
|
||||
{value = "option2", text = "Option 2"},
|
||||
{value = "option3", text = "Option 3"}
|
||||
}
|
||||
},
|
||||
{
|
||||
text = "Checkbox Options",
|
||||
name = "checkbox_field",
|
||||
type = "checkbox",
|
||||
isRequired = false,
|
||||
options = {
|
||||
{value = "check1", text = "Check 1", checked = true},
|
||||
{value = "check2", text = "Check 2", checked = false},
|
||||
{value = "check3", text = "Check 3", checked = false}
|
||||
}
|
||||
},
|
||||
{
|
||||
text = "Select Dropdown",
|
||||
name = "select_field",
|
||||
type = "select",
|
||||
isRequired = false,
|
||||
options = {
|
||||
{value = "val1", text = "Value 1"},
|
||||
{value = "val2", text = "Value 2"},
|
||||
{value = "val3", text = "Value 3"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local result = Input.Open("All Input Types Test", allTypesData, true, "Test Submit")
|
||||
if result then
|
||||
print("All Types Result:", json.encode(result))
|
||||
|
||||
else
|
||||
print("All Types: User cancelled")
|
||||
end
|
||||
end, false)
|
||||
|
||||
-- Test Error Handling
|
||||
RegisterCommand('input_test_error', function()
|
||||
-- Test with invalid data
|
||||
local result = Input.Open("Error Test", nil, true)
|
||||
if result then
|
||||
print("Error test unexpectedly succeeded")
|
||||
else
|
||||
print("Error test correctly handled nil data")
|
||||
end
|
||||
|
||||
-- Test with empty inputs
|
||||
local emptyData = {inputs = {}}
|
||||
local result2 = Input.Open("Empty Test", emptyData, true)
|
||||
if result2 then
|
||||
print("Empty test result: " .. json.encode(result2))
|
||||
else
|
||||
print("Empty test: No result")
|
||||
end
|
||||
end, false)
|
||||
|
||||
-- print("Input unit tests loaded. Available commands:")
|
||||
-- print(" /input_test_qb - Test QB format input")
|
||||
-- print(" /input_test_ox - Test Ox format input")
|
||||
-- print(" /input_test_simple - Test simple text input")
|
||||
-- print(" /input_test_all_types - Test all input types")
|
||||
-- print(" /input_test_error - Test error handling")
|
||||
@@ -1,16 +0,0 @@
|
||||
-- if outside this resource, use local whatever = Require("modules/locales/shared.lua")
|
||||
-- whatever.Locales("some-index-in-language-.json-file")
|
||||
-- Files must be stored in "locales" folder, within the resource.
|
||||
-- Instead of using Require you can also import it via the manifest.
|
||||
-- The Lang variable is available globally, which tells you what the server is using.
|
||||
-- print("Language: ", Lang)
|
||||
-- print("Locale: ", Language.Locale("UNITTEST.locale-unit-test"))
|
||||
|
||||
-- Example outside community bridge resource:
|
||||
|
||||
-- local Language = Require('modules/locales/shared.lua')
|
||||
-- print("Language: ", Lang)
|
||||
-- print("Locale: ", Language.Locale("UNITTEST.locale-unit-test"))
|
||||
RegisterCommand("lang", function(source, args, raw)
|
||||
print( "Oh also this works", Language.Locale("placeable_object.place_object_scroll_down"))
|
||||
end, false)
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
RegisterCommand("test_particle", function(source, args, rawCommand)
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 1.0, 0.0)
|
||||
local heading = GetEntityHeading(playerPed)
|
||||
Particle.Create("core", "ent_dst_concrete_large", coords, vector3(0.0, 0.0, heading), 1.0, vector3(1.0, 1.0, 1.0), false)
|
||||
end)
|
||||
@@ -1,38 +0,0 @@
|
||||
local isPlacing = false
|
||||
RegisterCommand('startplacer', function(source, args, rawCommand)
|
||||
if Bridge.PlaceableObject.IsPlacing() then
|
||||
print("Already placing an object.")
|
||||
return
|
||||
end
|
||||
|
||||
local model = args[1] or 'prop_barrel_01a' -- Default model if none provided
|
||||
local position = GetEntityCoords(PlayerPedId())
|
||||
local result = Bridge.PlaceableObject.Create(model, {
|
||||
allowMovement = true, -- Enable movement mode
|
||||
allowNormal = true, -- Enable normal mode
|
||||
allowVertical = false, -- Allow vertical movement in normal mode
|
||||
startMode = 'normal', -- Start in normal mode
|
||||
depthMin = 2.0,
|
||||
depthMax = 15.0,
|
||||
heightStep = 0.2, -- Height adjustment step
|
||||
boundary = {min = vector3(position.x - 5, position.y - 5, position.z - 1.5), max = vector3(position.x + 5, position.y + 5, position.z + 10)},
|
||||
showInstructionalButtons = true, -- Show instructional buttons
|
||||
})
|
||||
|
||||
if result then
|
||||
print("Object placed!")
|
||||
print("Position:", result.position)
|
||||
print("Heading:", result.heading)
|
||||
else
|
||||
print("Placement cancelled")
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterCommand("startplacerold", function(source, args, rawCommand)
|
||||
local model = args[1] or 'prop_barrel_01a' -- Default model if none provided
|
||||
local distance = tonumber(args[2]) or 5.0 -- Default distance if not provided
|
||||
local snapToGround = true
|
||||
local offset = vector3(0.0, 0.0, 0.0) -- No offset
|
||||
local obj = Bridge.Placeable.PlaceObject(model, distance, snapToGround, {}, offset)
|
||||
end)
|
||||
@@ -1,115 +0,0 @@
|
||||
Bridge = Bridge or exports['community_bridge']:Bridge()
|
||||
|
||||
RegisterCommand("ServerEntityStash", function(src)
|
||||
local position = GetEntityCoords(GetPlayerPed(src)) - vector3(0,0,1)
|
||||
Bridge.ServerEntity.Create({
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
stash = {
|
||||
label = "Test Stash",
|
||||
slots = 20,
|
||||
maxWeight = 10000,
|
||||
target = {
|
||||
label = "Open Stash",
|
||||
description = "Access the stash to store or retrieve items.",
|
||||
icon = "fas fa-boxes"
|
||||
}
|
||||
}
|
||||
})
|
||||
end, false)
|
||||
|
||||
RegisterCommand("ServerEntityScenarios", function(src)
|
||||
local position = GetEntityCoords(GetPlayerPed(src)) - vector3(0,0,1)
|
||||
Bridge.ServerEntity.Create({
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
scenarios = {
|
||||
name = "WORLD_HUMAN_CLIPBOARD",
|
||||
introClip = true,
|
||||
duration = 20000
|
||||
}
|
||||
})
|
||||
end, false)
|
||||
|
||||
RegisterCommand("ServerEntityAnim", function(src)
|
||||
local position = GetEntityCoords(GetPlayerPed(src)) - vector3(0,0,1)
|
||||
Bridge.ServerEntity.Create({
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
anim = {
|
||||
dict = "anim@mp_player_intcelebrationmale@wave",
|
||||
name = "wave",
|
||||
flags = 49,
|
||||
duration = -1,
|
||||
}
|
||||
})
|
||||
end, false)
|
||||
|
||||
RegisterCommand("ServerEntityParticles", function(src)
|
||||
local position = GetEntityCoords(GetPlayerPed(src)) - vector3(0,0,1)
|
||||
Bridge.ServerEntity.Create({
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
particles = {
|
||||
{
|
||||
dict = "core",
|
||||
ptfx = "ent_dst_electrical",
|
||||
offset = vector3(0.0, 1.0, 0.0),
|
||||
looped = true
|
||||
},
|
||||
{
|
||||
dict = "core",
|
||||
ptfx = "ent_dst_electrical",
|
||||
offset = vector3(0.0, -1.0, 0.0),
|
||||
rotation = vector3(0.0, 0.0, 180.0),
|
||||
looped = true,
|
||||
loopLength = 1000
|
||||
}
|
||||
}
|
||||
})
|
||||
end, false)
|
||||
|
||||
RegisterCommand("ServerEntityClothing", function(src)
|
||||
local position = GetEntityCoords(GetPlayerPed(src)) - vector3(0,0,1)
|
||||
Bridge.ServerEntity.Create({
|
||||
model = "mp_m_freemode_01",
|
||||
coords = position,
|
||||
entityType = "ped",
|
||||
clothing = {
|
||||
components = {
|
||||
{ drawable = 0, texture = 0, component_id = 0 },
|
||||
{ drawable = 0, texture = 0, component_id = 1 },
|
||||
{ drawable = 19, texture = 0, component_id = 2 },
|
||||
{ drawable = 6, texture = 0, component_id = 3 },
|
||||
{ drawable = 0, texture = 0, component_id = 4 },
|
||||
{ drawable = 0, texture = 0, component_id = 5 },
|
||||
{ drawable = 0, texture = 0, component_id = 6 },
|
||||
{ drawable = 0, texture = 0, component_id = 7 },
|
||||
{ drawable = 23, texture = 0, component_id = 8 },
|
||||
{ drawable = 0, texture = 0, component_id = 9 },
|
||||
{ drawable = 0, texture = 0, component_id = 10 },
|
||||
{ drawable = 4, texture = 2, component_id = 11 }
|
||||
},
|
||||
props = {
|
||||
{ drawable = 27, prop_id = 0, texture = 0 },
|
||||
{ drawable = 0, prop_id = 1, texture = 0 },
|
||||
{ drawable = 0, prop_id = 2, texture = 0 },
|
||||
{ drawable = 0, prop_id = 3, texture = 0 },
|
||||
{ drawable = 0, prop_id = 4, texture = 0 },
|
||||
{ drawable = 0, prop_id = 5, texture = 0 },
|
||||
{ drawable = 0, prop_id = 6, texture = 0 },
|
||||
{ drawable = 0, prop_id = 7, texture = 0 },
|
||||
{ drawable = 0, prop_id = 8, texture = 0 },
|
||||
{ drawable = 0, prop_id = 9, texture = 0 },
|
||||
{ drawable = 0, prop_id = 10, texture = 0 },
|
||||
{ drawable = 0, prop_id = 11, texture = 0 },
|
||||
{ drawable = 0, prop_id = 12, texture = 0 },
|
||||
{ drawable = 0, prop_id = 13, texture = 0 }
|
||||
}
|
||||
}
|
||||
})
|
||||
end, false)
|
||||
@@ -1,53 +0,0 @@
|
||||
Bridge = Bridge or exports['community_bridge']:Bridge()
|
||||
|
||||
RegisterCommand('testboxzone', function(source, args, rawCommand)
|
||||
local playerPos = GetEntityCoords(PlayerPedId())
|
||||
Bridge.Zones.Create("box", {
|
||||
coords = vector3(playerPos.x, playerPos.y, playerPos.z),
|
||||
size = vector3(2, 2, 6),
|
||||
heading = 90,
|
||||
debug = true,
|
||||
onEnter = function(data)
|
||||
print("Entered Zone: " .. data.id)
|
||||
end,
|
||||
onExit = function(data)
|
||||
print("Exited Zone:")
|
||||
end
|
||||
})
|
||||
end, false)
|
||||
|
||||
RegisterCommand('testpolyzone', function(source, args, rawCommand)
|
||||
local playerPos = GetEntityCoords(PlayerPedId())
|
||||
Bridge.Zones.Create("poly", {
|
||||
points = {
|
||||
vector3(playerPos.x - 1, playerPos.y - 1, playerPos.z),
|
||||
vector3(playerPos.x + 1, playerPos.y - 1, playerPos.z),
|
||||
vector3(playerPos.x + 1, playerPos.y + 1, playerPos.z),
|
||||
vector3(playerPos.x - 1, playerPos.y + 1, playerPos.z)
|
||||
},
|
||||
size = vector3(1, 1, 1),
|
||||
heading = 90,
|
||||
debug = true,
|
||||
onEnter = function(data)
|
||||
print("Entered Zone: " .. data.id)
|
||||
end,
|
||||
onExit = function(data)
|
||||
print("Exited Zone:")
|
||||
end
|
||||
})
|
||||
end, false)
|
||||
|
||||
RegisterCommand('testspherezone', function(source, args, rawCommand)
|
||||
local playerPos = GetEntityCoords(PlayerPedId())
|
||||
Bridge.Zones.Create("sphere", {
|
||||
coords = vector3(playerPos.x, playerPos.y, playerPos.z),
|
||||
radius = 2.0,
|
||||
debug = true,
|
||||
onEnter = function(data)
|
||||
print("Entered Zone: " .. data.id)
|
||||
end,
|
||||
onExit = function(data)
|
||||
print("Exited Zone:")
|
||||
end
|
||||
})
|
||||
end, false)
|
||||
+1
-2
@@ -8,7 +8,7 @@ description 'A Universal Bridge for Our Community, created by a group of contrib
|
||||
version '0.13.0'
|
||||
|
||||
shared_scripts {
|
||||
-- '@ox_lib/init.lua',
|
||||
'@ox_lib/init.lua',
|
||||
'settings/sharedConfig.lua',
|
||||
'lib/init.lua',
|
||||
'modules/locales/*.lua',
|
||||
@@ -62,7 +62,6 @@ client_scripts {
|
||||
'modules/bossmenu/**/client.lua',
|
||||
'modules/zones/**/client.lua',
|
||||
'init.lua',
|
||||
-- 'unit_tests/*.lua',
|
||||
}
|
||||
|
||||
ui_page 'web/dist/index.html'
|
||||
|
||||
@@ -3,8 +3,8 @@ Utility = Utility or Require("lib/utility/client/utility.lua")
|
||||
if not lib then Require('init.lua', 'ox_lib') end
|
||||
|
||||
local activePlacementProp = nil
|
||||
Language = Language or Require("modules/locales/shared.lua")
|
||||
locale = Language.Locale
|
||||
lib.locale()
|
||||
|
||||
-- Object placer --
|
||||
local placementText = {
|
||||
locale('placeable_object.place_object_place'),
|
||||
@@ -32,7 +32,7 @@ Placeable.PlaceObject = function(object, distance, snapToGround, allowedMats, of
|
||||
distance = tonumber(distance or 10.0 )
|
||||
if activePlacementProp then return end
|
||||
|
||||
if not object then Prints.Error('placeable_object.no_prop_defined') end
|
||||
if not object then print('^6 placeable_object.no_prop_defined ^0') end
|
||||
|
||||
local propObject = type(object) == 'string' and joaat(object) or object
|
||||
local heading = 0.0
|
||||
|
||||
@@ -22,8 +22,7 @@ local function setupButton(scaleform, button)
|
||||
N_0xe83a3e3557a56640(GetControlInstructionalButton(CONTROL_TYPE, keyCode, true))
|
||||
end
|
||||
else
|
||||
ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(CONTROL_TYPE, button.keyIndex[1],
|
||||
true))
|
||||
ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(CONTROL_TYPE, button.keyIndex[1], true))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
Utility = Utility or {}
|
||||
local blipIDs = {}
|
||||
local spawnedPeds = {}
|
||||
local spawnedProps = {}
|
||||
|
||||
Locales = Locales or Require('modules/locales/shared.lua')
|
||||
Point = Point or Require('lib/points/client/points.lua')
|
||||
@@ -39,10 +40,11 @@ end
|
||||
---@return number|nil
|
||||
function Utility.CreateProp(model, coords, heading, networked)
|
||||
local loaded, hash = ensureModelLoaded(model)
|
||||
if not loaded then return nil, Prints and Prints.Error and Prints.Error("Model Has Not Loaded") end
|
||||
if not loaded then return nil, print("^6 Model was unable to load "..tostring(model).." ^0") end
|
||||
local propEntity = CreateObject(hash, coords.x, coords.y, coords.z, networked, false, false)
|
||||
SetEntityHeading(propEntity, heading)
|
||||
SetModelAsNoLongerNeeded(hash)
|
||||
spawnedProps[tostring(propEntity)] = true
|
||||
return propEntity
|
||||
end
|
||||
|
||||
@@ -62,7 +64,7 @@ end
|
||||
---@return number|nil, table
|
||||
function Utility.CreateVehicle(model, coords, heading, networked)
|
||||
local loaded, hash = ensureModelLoaded(model)
|
||||
if not loaded then return nil, {}, Prints and Prints.Error and Prints.Error("Model Has Not Loaded") end
|
||||
if not loaded then return nil, {}, print("^6 Model was unable to load "..tostring(model).." ^0") end
|
||||
local vehicle = CreateVehicle(hash, coords.x, coords.y, coords.z, heading, networked, false)
|
||||
SetVehicleHasBeenOwnedByPlayer(vehicle, true)
|
||||
SetVehicleNeedsToBeHotwired(vehicle, false)
|
||||
@@ -80,7 +82,7 @@ end
|
||||
---@return number|nil
|
||||
function Utility.CreatePed(model, coords, heading, networked, settings)
|
||||
local loaded, hash = ensureModelLoaded(model)
|
||||
if not loaded then return nil, Prints and Prints.Error and Prints.Error("Model Has Not Loaded") end
|
||||
if not loaded then return nil, print("^6 Model was unable to load "..tostring(model).." ^0") end
|
||||
local spawnedEntity = CreatePed(0, hash, coords.x, coords.y, coords.z, heading, networked, false)
|
||||
SetModelAsNoLongerNeeded(hash)
|
||||
spawnedPeds[tostring(spawnedEntity)] = true
|
||||
@@ -120,14 +122,12 @@ end
|
||||
function Utility.CreateBlip(coords, sprite, color, scale, label, shortRange, displayType)
|
||||
local blip = AddBlipForCoord(coords.x, coords.y, coords.z)
|
||||
SetBlipSprite(blip, sprite or 8)
|
||||
SetTextFont(0)
|
||||
SetBlipDisplay(blip, displayType or 2)
|
||||
SetBlipScale(blip, scale or 0.8)
|
||||
SetBlipColour(blip, color or 3)
|
||||
SetBlipScale(blip, scale or 0.8)
|
||||
SetBlipDisplay(blip, displayType or 2)
|
||||
SetBlipAsShortRange(blip, shortRange)
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
--AddTextComponentSubstringPlayerName(label) -- switch to this if below line doesnt show da chinese
|
||||
AddTextComponentString(label)
|
||||
AddTextComponentSubstringPlayerName(label)
|
||||
EndTextCommandSetBlipName(blip)
|
||||
blipIDs[tostring(blip)] = blip
|
||||
return blip
|
||||
@@ -174,7 +174,7 @@ end
|
||||
---@param blip number
|
||||
---@return boolean
|
||||
function Utility.RemoveBlip(blip)
|
||||
if not blipIDs[tostring(blip)] then return false, print("NO BLIP BY ID") end
|
||||
if not blipIDs[tostring(blip)] then return false, print("^6 No blip to remove with matching ID ^0") end
|
||||
RemoveBlip(blipIDs[tostring(blip)])
|
||||
blipIDs[tostring(blip)] = nil
|
||||
return true
|
||||
@@ -213,6 +213,18 @@ function Utility.RemovePed(entity)
|
||||
return true
|
||||
end
|
||||
|
||||
---Remove a ped if it exists
|
||||
---@param entity number
|
||||
---@return boolean
|
||||
function Utility.RemoveProp(entity)
|
||||
if not spawnedProps[tostring(entity)] then return false end
|
||||
spawnedProps[tostring(entity)] = nil
|
||||
if not DoesEntityExist(entity) then return false end
|
||||
SetEntityAsMissionEntity(entity, true, true)
|
||||
DeleteEntity(entity)
|
||||
return true
|
||||
end
|
||||
|
||||
---Show a native input menu and return the result
|
||||
---@param text string
|
||||
---@param length number
|
||||
@@ -615,6 +627,11 @@ AddEventHandler('onResourceStop', function(resource)
|
||||
DeleteEntity(tonumber(ped))
|
||||
end
|
||||
end
|
||||
for _, prop in pairs(spawnedProps) do
|
||||
if prop and DoesEntityExist(tonumber(prop)) then
|
||||
DeleteEntity(tonumber(prop))
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
exports('Utility', Utility)
|
||||
|
||||
+7
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Hoeveelheid Invoer",
|
||||
"PurchaseAmount": "Aankoop Hoeveelheid",
|
||||
"PurchasedItem": "Jy het gekoop ",
|
||||
"PurchaseFailed": "Aankoop het misluk, inventaris vol",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Bevestig Aankoop",
|
||||
"AreYouSure": "Is jy seker jy wil 'n %s koop",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Winkel Naam"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Ek is 'n %s %s",
|
||||
"locale-unit-test": "Dit is 'n toets string"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Kennisgewing"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Gekopieer na knipbord"
|
||||
@@ -33,6 +33,10 @@
|
||||
"place_object_scroll_down": "[Scroll Down] Draai links \n",
|
||||
"object_place": "[%s] Plaas \n",
|
||||
"object_cancel": "[%s] Kanselleer \n",
|
||||
"object_scroll_up": "[%s] Draai regs \n",
|
||||
"object_scroll_down": "[%s] Draai links \n",
|
||||
"rotate_left": "Draai links",
|
||||
"rotate_right": "Draai regs",
|
||||
"rotate_clockwise": "[%s] Draai Kloksgewys \n",
|
||||
"rotate_counter_clockwise": "[%s] Draai Antikloksgewys \n",
|
||||
"depth_modifier": "[%s] Diepte Beheer Wysiging \n"
|
||||
|
||||
+13
-4
@@ -4,6 +4,7 @@
|
||||
"Input": "إدخال الكمية",
|
||||
"PurchaseAmount": "كمية الشراء",
|
||||
"PurchasedItem": "لقد قمت بشراء ",
|
||||
"PurchaseFailed": "فشل الشراء، المخزون ممتلئ",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "تأكيد الشراء",
|
||||
"AreYouSure": "هل أنت متأكد أنك تريد شراء %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "اسم المتجر"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "أنا %s %s",
|
||||
"locale-unit-test": "هذا نص تجريبي"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "إشعار"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "تم النسخ إلى الحافظة"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] إلغاء \n",
|
||||
"object_scroll_up": "[%s] استدارة يمين \n",
|
||||
"object_scroll_down": "[%s] استدارة يسار \n",
|
||||
"depth_modifier": "[%s] تعديل التحكم بالعمق \n"
|
||||
"rotate_left": "استدارة يسار",
|
||||
"rotate_right": "استدارة يمين",
|
||||
"rotate_clockwise": "[%s] استدارة مع عقارب الساعة \n",
|
||||
"rotate_counter_clockwise": "[%s] استدارة عكس عقارب الساعة \n",
|
||||
"depth_modifier": "[%s] معدل التحكم في العمق \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] تفاعل",
|
||||
"title": "خيارات",
|
||||
"description": "لا يوجد وصف"
|
||||
}
|
||||
}
|
||||
+13
-4
@@ -4,6 +4,7 @@
|
||||
"Input": "Zadání množství",
|
||||
"PurchaseAmount": "Množství nákupu",
|
||||
"PurchasedItem": "Zakoupili jste ",
|
||||
"PurchaseFailed": "Nákup se nezdařil, inventář je plný",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Potvrdit nákup",
|
||||
"AreYouSure": "Jste si jisti, že chcete koupit %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Název obchodu"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Jsem %s %s",
|
||||
"locale-unit-test": "Toto je testovací řetězec"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Oznámení"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Zkopírováno do schránky"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Zrušit \n",
|
||||
"object_scroll_up": "[%s] Otočit doprava \n",
|
||||
"object_scroll_down": "[%s] Otočit doleva \n",
|
||||
"depth_modifier": "[%s] Modifikátor kontroly hloubky \n"
|
||||
"rotate_left": "Otočit doleva",
|
||||
"rotate_right": "Otočit doprava",
|
||||
"rotate_clockwise": "[%s] Otočit ve směru hodinových ručiček \n",
|
||||
"rotate_counter_clockwise": "[%s] Otočit proti směru hodinových ručiček \n",
|
||||
"depth_modifier": "[%s] Modifikátor řízení hloubky \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interakce",
|
||||
"title": "Možnosti",
|
||||
"description": "Bez popisu"
|
||||
}
|
||||
}
|
||||
+13
-4
@@ -4,6 +4,7 @@
|
||||
"Input": "Mængde input",
|
||||
"PurchaseAmount": "Købs mængde",
|
||||
"PurchasedItem": "Du har købt ",
|
||||
"PurchaseFailed": "Køb mislykkedes, inventar fuldt",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Bekræft køb",
|
||||
"AreYouSure": "Er du sikker på, at du vil købe en %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Butiksnavn"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Jeg er en %s %s",
|
||||
"locale-unit-test": "Dette er en test streng"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Notifikation"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Kopieret til udklipsholder"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Annuller \n",
|
||||
"object_scroll_up": "[%s] Drej til højre \n",
|
||||
"object_scroll_down": "[%s] Drej til venstre \n",
|
||||
"depth_modifier": "[%s] Dybde kontrol modifier \n"
|
||||
"rotate_left": "Drej til venstre",
|
||||
"rotate_right": "Drej til højre",
|
||||
"rotate_clockwise": "[%s] Rotér med uret \n",
|
||||
"rotate_counter_clockwise": "[%s] Rotér mod uret \n",
|
||||
"depth_modifier": "[%s] Dybdekontrol Modifier \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interager",
|
||||
"title": "Muligheder",
|
||||
"description": "Ingen beskrivelse"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Mengen-Eingabe",
|
||||
"PurchaseAmount": "Kaufmenge",
|
||||
"PurchasedItem": "Sie haben gekauft ",
|
||||
"PurchaseFailed": "Kauf fehlgeschlagen, Inventar voll",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Kauf bestätigen",
|
||||
"AreYouSure": "Sind Sie sicher, dass Sie einen %s kaufen möchten",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Geschäftsname"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Ich bin ein %s %s",
|
||||
"locale-unit-test": "Dies ist ein Test-String"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Benachrichtigung"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "In die Zwischenablage kopiert"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Abbrechen \n",
|
||||
"object_scroll_up": "[%s] Nach rechts drehen \n",
|
||||
"object_scroll_down": "[%s] Nach links drehen \n",
|
||||
"rotate_left": "Nach links drehen",
|
||||
"rotate_right": "Nach rechts drehen",
|
||||
"rotate_clockwise": "[%s] Im Uhrzeigersinn drehen \n",
|
||||
"rotate_counter_clockwise": "[%s] Gegen den Uhrzeigersinn drehen \n",
|
||||
"depth_modifier": "[%s] Tiefenkontrolle Modifikator \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interagieren",
|
||||
"title": "Optionen",
|
||||
"description": "Keine Beschreibung"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Εισαγωγή ποσότητας",
|
||||
"PurchaseAmount": "Ποσότητα αγοράς",
|
||||
"PurchasedItem": "Αγοράσατε ",
|
||||
"PurchaseFailed": "Η αγορά απέτυχε, το αποθέμα είναι γεμάτο",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Επιβεβαίωση αγοράς",
|
||||
"AreYouSure": "Είστε βέβαιοι ότι θέλετε να αγοράσετε ένα %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Όνομα καταστήματος"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Είμαι ένας %s %s",
|
||||
"locale-unit-test": "Αυτό είναι ένα δοκιμαστικό κείμενο"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Ειδοποίηση"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Αντιγράφηκε στο clipboard"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Ακύρωση \n",
|
||||
"object_scroll_up": "[%s] Περιστροφή δεξιά \n",
|
||||
"object_scroll_down": "[%s] Περιστροφή αριστερά \n",
|
||||
"rotate_left": "Περιστροφή αριστερά",
|
||||
"rotate_right": "Περιστροφή δεξιά",
|
||||
"rotate_clockwise": "[%s] Περιστροφή δεξιόστροφα \n",
|
||||
"rotate_counter_clockwise": "[%s] Περιστροφή αριστερόστροφα \n",
|
||||
"depth_modifier": "[%s] Τροποποιητής ελέγχου βάθους \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Αλληλεπίδραση",
|
||||
"title": "Επιλογές",
|
||||
"description": "Χωρίς περιγραφή"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Amount o' Booty",
|
||||
"PurchaseAmount": "Plunder Quantity",
|
||||
"PurchasedItem": "Ye Have Plundered ",
|
||||
"PurchaseFailed": "Plunder failed, yer hold be full",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Aye, Plunder!",
|
||||
"AreYouSure": "Be ye sure ye want to plunder a %s?",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Pirate's Emporium"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "I be a %s %s",
|
||||
"locale-unit-test": "This be a test string, arrr!"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Parley Notice"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Copied to ye clipboard, matey!"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Abandon Ship! \n",
|
||||
"object_scroll_up": "[%s] Turn starboard \n",
|
||||
"object_scroll_down": "[%s] Turn port \n",
|
||||
"rotate_left": "Turn Port",
|
||||
"rotate_right": "Turn Starboard",
|
||||
"rotate_clockwise": "[%s] Spin Clockwise, arrr! \n",
|
||||
"rotate_counter_clockwise": "[%s] Spin Counter-Clockwise, matey! \n",
|
||||
"depth_modifier": "[%s] Depth Control, savvy? \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Parley",
|
||||
"title": "Choices, matey",
|
||||
"description": "No tale to tell"
|
||||
}
|
||||
}
|
||||
+7
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Amount Input",
|
||||
"PurchaseAmount": "Purchase Quantity",
|
||||
"PurchasedItem": "You Have Purchased ",
|
||||
"PurchaseFailed": "Purchase failed, inventory full",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Confirm Purchase",
|
||||
"AreYouSure": "Are you sure you want to purchase a %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Shop Name"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "I'm a %s %s",
|
||||
"locale-unit-test": "This is a test string"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Notification"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Copied to clipboard"
|
||||
@@ -33,6 +33,10 @@
|
||||
"place_object_scroll_down": "[Scroll Down] Turn left \n",
|
||||
"object_place": "[%s] Place \n",
|
||||
"object_cancel": "[%s] Cancel \n",
|
||||
"object_scroll_up": "[%s] Turn right \n",
|
||||
"object_scroll_down": "[%s] Turn left \n",
|
||||
"rotate_left": "Rotate Left",
|
||||
"rotate_right": "Rotate Right",
|
||||
"rotate_clockwise": "[%s] Rotate Clockwise \n",
|
||||
"rotate_counter_clockwise": "[%s] Rotate Counter-Clockwise \n",
|
||||
"depth_modifier": "[%s] Depth Control Modifier \n"
|
||||
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Entrada de cantidad",
|
||||
"PurchaseAmount": "Cantidad de compra",
|
||||
"PurchasedItem": "Has comprado ",
|
||||
"PurchaseFailed": "Compra fallida, inventario lleno",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Confirmar compra",
|
||||
"AreYouSure": "¿Estás seguro de que quieres comprar un %s?",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Nombre de la tienda"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Soy un %s %s",
|
||||
"locale-unit-test": "Esta es una cadena de prueba"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Notificación"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Copiado al portapapeles"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Cancelar \n",
|
||||
"object_scroll_up": "[%s] Girar a la derecha \n",
|
||||
"object_scroll_down": "[%s] Girar a la izquierda \n",
|
||||
"rotate_left": "Girar a la izquierda",
|
||||
"rotate_right": "Girar a la derecha",
|
||||
"rotate_clockwise": "[%s] Rotar en sentido horario \n",
|
||||
"rotate_counter_clockwise": "[%s] Rotar en sentido antihorario \n",
|
||||
"depth_modifier": "[%s] Modificador de control de profundidad \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interactuar",
|
||||
"title": "Opciones",
|
||||
"description": "Sin descripción"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Määrän syöttö",
|
||||
"PurchaseAmount": "Ostomäärä",
|
||||
"PurchasedItem": "Olet ostanut ",
|
||||
"PurchaseFailed": "Osto epäonnistui, varasto täynnä",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Vahvista osto",
|
||||
"AreYouSure": "Oletko varma, että haluat ostaa %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Kaupan nimi"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Olen %s %s",
|
||||
"locale-unit-test": "Tämä on testimerkki"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Ilmoitus"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Kopioitu leikepöydälle"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Peruuta \n",
|
||||
"object_scroll_up": "[%s] Käännä oikealle \n",
|
||||
"object_scroll_down": "[%s] Käännä vasemmalle \n",
|
||||
"rotate_left": "Kierrä vasemmalle",
|
||||
"rotate_right": "Kierrä oikealle",
|
||||
"rotate_clockwise": "[%s] Kierrä myötäpäivään \n",
|
||||
"rotate_counter_clockwise": "[%s] Kierrä vastapäivään \n",
|
||||
"depth_modifier": "[%s] Syvyyshallinnan muokkaaja \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Vuorovaikutus",
|
||||
"title": "Vaihtoehdot",
|
||||
"description": "Ei kuvausta"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Saisie de quantité",
|
||||
"PurchaseAmount": "Quantité d'achat",
|
||||
"PurchasedItem": "Vous avez acheté ",
|
||||
"PurchaseFailed": "Achat échoué, inventaire plein",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Confirmer l'achat",
|
||||
"AreYouSure": "Êtes-vous sûr de vouloir acheter un %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Nom du magasin"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Je suis un %s %s",
|
||||
"locale-unit-test": "Ceci est une chaîne de test"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Notification"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Copié dans le presse-papiers"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Annuler \n",
|
||||
"object_scroll_up": "[%s] Tourner à droite \n",
|
||||
"object_scroll_down": "[%s] Tourner à gauche \n",
|
||||
"rotate_left": "Pivoter à gauche",
|
||||
"rotate_right": "Pivoter à droite",
|
||||
"rotate_clockwise": "[%s] Rotation horaire \n",
|
||||
"rotate_counter_clockwise": "[%s] Rotation antihoraire \n",
|
||||
"depth_modifier": "[%s] Modificateur de contrôle de profondeur \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interagir",
|
||||
"title": "Options",
|
||||
"description": "Aucune description"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "मात्रा इनपुट",
|
||||
"PurchaseAmount": "खरीदारी की मात्रा",
|
||||
"PurchasedItem": "आपने खरीदा है ",
|
||||
"PurchaseFailed": "खरीदारी विफल, इन्वेंटरी भरी हुई है",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "खरीदारी की पुष्टि करें",
|
||||
"AreYouSure": "क्या आप वाकई %s खरीदना चाहते हैं",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "दुकान का नाम"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "मैं एक %s %s हूं",
|
||||
"locale-unit-test": "यह एक परीक्षण स्ट्रिंग है"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "सूचना"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "क्लिपबोर्ड पर कॉपी किया गया"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] रद्द करें \n",
|
||||
"object_scroll_up": "[%s] दाएं मुड़ें \n",
|
||||
"object_scroll_down": "[%s] बाएं मुड़ें \n",
|
||||
"rotate_left": "बाएं मुड़ें",
|
||||
"rotate_right": "दाएं मुड़ें",
|
||||
"rotate_clockwise": "[%s] घड़ी की दिशा में घुमाएं \n",
|
||||
"rotate_counter_clockwise": "[%s] घड़ी की विपरीत दिशा में घुमाएं \n",
|
||||
"depth_modifier": "[%s] गहराई नियंत्रण संशोधक \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] बातचीत करें",
|
||||
"title": "विकल्प",
|
||||
"description": "कोई विवरण नहीं"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Unos količine",
|
||||
"PurchaseAmount": "Količina kupnje",
|
||||
"PurchasedItem": "Kupili ste ",
|
||||
"PurchaseFailed": "Kupnja nije uspjela, inventar pun",
|
||||
"CurrencySymbol": "%s kn",
|
||||
"Confirm": "Potvrdi kupnju",
|
||||
"AreYouSure": "Jeste li sigurni da želite kupiti %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Naziv trgovine"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Ja sam %s %s",
|
||||
"locale-unit-test": "Ovo je test string"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Obavijest"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Kopirano u međuspremnik"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Otkažи \n",
|
||||
"object_scroll_up": "[%s] Okreni desno \n",
|
||||
"object_scroll_down": "[%s] Okreni lijevo \n",
|
||||
"rotate_left": "Okreni lijevo",
|
||||
"rotate_right": "Okreni desno",
|
||||
"rotate_clockwise": "[%s] Rotiraj u smjeru kazaljke na satu \n",
|
||||
"rotate_counter_clockwise": "[%s] Rotiraj suprotno od kazaljke na satu \n",
|
||||
"depth_modifier": "[%s] Modifikator kontrole dubine \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interakcija",
|
||||
"title": "Opcije",
|
||||
"description": "Nema opisa"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Mennyiség bevitel",
|
||||
"PurchaseAmount": "Vásárlási mennyiség",
|
||||
"PurchasedItem": "Megvásároltad ",
|
||||
"PurchaseFailed": "Vásárlás sikertelen, leltár tele",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Vásárlás megerősítése",
|
||||
"AreYouSure": "Biztosan meg akarsz vásárolni egy %s-t",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Bolt neve"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Én egy %s %s vagyok",
|
||||
"locale-unit-test": "Ez egy teszt string"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Értesítés"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Vágólapra másolva"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Mégse \n",
|
||||
"object_scroll_up": "[%s] Jobbra fordítás \n",
|
||||
"object_scroll_down": "[%s] Balra fordítás \n",
|
||||
"rotate_left": "Balra fordítás",
|
||||
"rotate_right": "Jobbra fordítás",
|
||||
"rotate_clockwise": "[%s] Forgatás óramutató járásával megegyezően \n",
|
||||
"rotate_counter_clockwise": "[%s] Forgatás óramutató járásával ellentétesen \n",
|
||||
"depth_modifier": "[%s] Mélység vezérlő módosító \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interakció",
|
||||
"title": "Lehetőségek",
|
||||
"description": "Nincs leírás"
|
||||
}
|
||||
}
|
||||
+13
-4
@@ -4,6 +4,7 @@
|
||||
"Input": "Inserimento quantità",
|
||||
"PurchaseAmount": "Quantità di acquisto",
|
||||
"PurchasedItem": "Hai acquistato ",
|
||||
"PurchaseFailed": "Acquisto fallito, inventario pieno",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Conferma acquisto",
|
||||
"AreYouSure": "Sei sicuro di voler acquistare un %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Nome negozio"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Sono un %s %s",
|
||||
"locale-unit-test": "Questa è una stringa di test"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Notifica"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Copiato negli appunti"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Annulla \n",
|
||||
"object_scroll_up": "[%s] Ruota a destra \n",
|
||||
"object_scroll_down": "[%s] Ruota a sinistra \n",
|
||||
"depth_modifier": "[%s] Modificatore controllo profondità \n"
|
||||
"rotate_left": "Ruota a sinistra",
|
||||
"rotate_right": "Ruota a destra",
|
||||
"rotate_clockwise": "[%s] Ruota in senso orario \n",
|
||||
"rotate_counter_clockwise": "[%s] Ruota in senso antiorario \n",
|
||||
"depth_modifier": "[%s] Modificatore di controllo della profondità \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interagisci",
|
||||
"title": "Opzioni",
|
||||
"description": "Nessuna descrizione"
|
||||
}
|
||||
}
|
||||
+13
-4
@@ -4,6 +4,7 @@
|
||||
"Input": "数量入力",
|
||||
"PurchaseAmount": "購入数量",
|
||||
"PurchasedItem": "購入しました ",
|
||||
"PurchaseFailed": "購入に失敗しました、インベントリがいっぱいです",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "購入を確認",
|
||||
"AreYouSure": "%sを購入してもよろしいですか",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "店舗名"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "私は%s %sです",
|
||||
"locale-unit-test": "これはテスト文字列です"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "通知"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "クリップボードにコピーされました"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] キャンセル \n",
|
||||
"object_scroll_up": "[%s] 右回転 \n",
|
||||
"object_scroll_down": "[%s] 左回転 \n",
|
||||
"depth_modifier": "[%s] 深度制御修飾子 \n"
|
||||
"rotate_left": "左回転",
|
||||
"rotate_right": "右回転",
|
||||
"rotate_clockwise": "[%s] 時計回りに回転 \n",
|
||||
"rotate_counter_clockwise": "[%s] 反時計回りに回転 \n",
|
||||
"depth_modifier": "[%s] 深さコントロール修飾子 \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] 対話",
|
||||
"title": "オプション",
|
||||
"description": "説明なし"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "수량 입력",
|
||||
"PurchaseAmount": "구매 수량",
|
||||
"PurchasedItem": "구매했습니다 ",
|
||||
"PurchaseFailed": "구매 실패, 인벤토리가 가득 찼습니다",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "구매 확인",
|
||||
"AreYouSure": "%s를 구매하시겠습니까",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "상점 이름"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "나는 %s %s입니다",
|
||||
"locale-unit-test": "이것은 테스트 문자열입니다"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "알림"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "클립보드에 복사됨"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] 취소 \n",
|
||||
"object_scroll_up": "[%s] 오른쪽으로 회전 \n",
|
||||
"object_scroll_down": "[%s] 왼쪽으로 회전 \n",
|
||||
"rotate_left": "왼쪽으로 회전",
|
||||
"rotate_right": "오른쪽으로 회전",
|
||||
"rotate_clockwise": "[%s] 시계 방향으로 회전 \n",
|
||||
"rotate_counter_clockwise": "[%s] 시계 반대 방향으로 회전 \n",
|
||||
"depth_modifier": "[%s] 깊이 제어 수정자 \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] 상호작용",
|
||||
"title": "옵션",
|
||||
"description": "설명 없음"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Kiekio įvestis",
|
||||
"PurchaseAmount": "Pirkimo kiekis",
|
||||
"PurchasedItem": "Jūs nusipirkote ",
|
||||
"PurchaseFailed": "Pirkimas nepavyko, inventorius pilnas",
|
||||
"CurrencySymbol": "%s €",
|
||||
"Confirm": "Patvirtinti pirkimą",
|
||||
"AreYouSure": "Ar tikrai norite nusipirkti %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Parduotuvės pavadinimas"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Aš esu %s %s",
|
||||
"locale-unit-test": "Tai yra testavimo eilutė"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Pranešimas"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Nukopijuota į iškarpinę"
|
||||
@@ -33,8 +33,17 @@
|
||||
"place_object_scroll_down": "[Slinkti žemyn] Pasukti kairėn \n",
|
||||
"object_place": "[%s] Pastatyti \n",
|
||||
"object_cancel": "[%s] Atšaukti \n",
|
||||
"object_scroll_up": "[%s] Pasukti dešinėn \n",
|
||||
"object_scroll_down": "[%s] Pasukti kairėn \n",
|
||||
"rotate_left": "Pasukti kairėn",
|
||||
"rotate_right": "Pasukti dešinėn",
|
||||
"rotate_clockwise": "[%s] Sukti pagal laikrodžio rodyklę \n",
|
||||
"rotate_counter_clockwise": "[%s] Sukti prieš laikrodžio rodyklę \n",
|
||||
"depth_modifier": "[%s] Gylio kontrolės modifikatorius \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Sąveika",
|
||||
"title": "Parinktys",
|
||||
"description": "Nėra aprašymo"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Hoeveelheid invoer",
|
||||
"PurchaseAmount": "Aankoop hoeveelheid",
|
||||
"PurchasedItem": "Je hebt gekocht ",
|
||||
"PurchaseFailed": "Aankoop mislukt, inventaris vol",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Aankoop bevestigen",
|
||||
"AreYouSure": "Weet je zeker dat je een %s wilt kopen",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Winkelnaam"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Ik ben een %s %s",
|
||||
"locale-unit-test": "Dit is een test string"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Melding"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Gekopieerd naar klembord"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Annuleren \n",
|
||||
"object_scroll_up": "[%s] Rechtsom draaien \n",
|
||||
"object_scroll_down": "[%s] Linksom draaien \n",
|
||||
"rotate_left": "Linksom draaien",
|
||||
"rotate_right": "Rechtsom draaien",
|
||||
"rotate_clockwise": "[%s] Draai met de klok mee \n",
|
||||
"rotate_counter_clockwise": "[%s] Draai tegen de klok in \n",
|
||||
"depth_modifier": "[%s] Diepte controle modifier \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interactie",
|
||||
"title": "Opties",
|
||||
"description": "Geen beschrijving"
|
||||
}
|
||||
}
|
||||
+13
-4
@@ -4,6 +4,7 @@
|
||||
"Input": "Mengde inndata",
|
||||
"PurchaseAmount": "Kjøpsmengde",
|
||||
"PurchasedItem": "Du har kjøpt ",
|
||||
"PurchaseFailed": "Kjøp mislyktes, inventar fullt",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Bekreft kjøp",
|
||||
"AreYouSure": "Er du sikker på at du vil kjøpe en %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Butikknavn"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Jeg er en %s %s",
|
||||
"locale-unit-test": "Dette er en teststreng"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Varsling"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Kopiert til utklippstavle"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Avbryt \n",
|
||||
"object_scroll_up": "[%s] Snu til høyre \n",
|
||||
"object_scroll_down": "[%s] Snu til venstre \n",
|
||||
"depth_modifier": "[%s] Dybdekontroll modifikator \n"
|
||||
"rotate_left": "Roter til venstre",
|
||||
"rotate_right": "Roter til høyre",
|
||||
"rotate_clockwise": "[%s] Roter med klokken \n",
|
||||
"rotate_counter_clockwise": "[%s] Roter mot klokken \n",
|
||||
"depth_modifier": "[%s] Dybdekontroll Modifikator \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Samhandle",
|
||||
"title": "Alternativer",
|
||||
"description": "Ingen beskrivelse"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Wprowadzanie ilości",
|
||||
"PurchaseAmount": "Ilość zakupu",
|
||||
"PurchasedItem": "Kupiłeś ",
|
||||
"PurchaseFailed": "Zakup nieudany, ekwipunek pełny",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Potwierdź zakup",
|
||||
"AreYouSure": "Czy na pewno chcesz kupić %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Nazwa sklepu"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Jestem %s %s",
|
||||
"locale-unit-test": "To jest ciąg testowy"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Powiadomienie"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Skopiowano do schowka"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Anuluj \n",
|
||||
"object_scroll_up": "[%s] Obróć w prawo \n",
|
||||
"object_scroll_down": "[%s] Obróć w lewo \n",
|
||||
"rotate_left": "Obróć w lewo",
|
||||
"rotate_right": "Obróć w prawo",
|
||||
"rotate_clockwise": "[%s] Obróć zgodnie z ruchem wskazówek zegara \n",
|
||||
"rotate_counter_clockwise": "[%s] Obróć przeciwnie do ruchu wskazówek zegara \n",
|
||||
"depth_modifier": "[%s] Modyfikator kontroli głębokości \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interakcja",
|
||||
"title": "Opcje",
|
||||
"description": "Brak opisu"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Entrada de quantidade",
|
||||
"PurchaseAmount": "Quantidade de compra",
|
||||
"PurchasedItem": "Você comprou ",
|
||||
"PurchaseFailed": "Compra falhou, inventário cheio",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Confirmar compra",
|
||||
"AreYouSure": "Você tem certeza que quer comprar um %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Nome da loja"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Eu sou um %s %s",
|
||||
"locale-unit-test": "Esta é uma string de teste"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Notificação"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Copiado para a área de transferência"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Cancelar \n",
|
||||
"object_scroll_up": "[%s] Girar para a direita \n",
|
||||
"object_scroll_down": "[%s] Girar para a esquerda \n",
|
||||
"rotate_left": "Girar para a esquerda",
|
||||
"rotate_right": "Girar para a direita",
|
||||
"rotate_clockwise": "[%s] Girar no sentido horário \n",
|
||||
"rotate_counter_clockwise": "[%s] Girar no sentido anti-horário \n",
|
||||
"depth_modifier": "[%s] Modificador de controle de profundidade \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interagir",
|
||||
"title": "Opções",
|
||||
"description": "Sem descrição"
|
||||
}
|
||||
}
|
||||
+13
-4
@@ -4,6 +4,7 @@
|
||||
"Input": "Introducere cantitate",
|
||||
"PurchaseAmount": "Cantitate de cumpărare",
|
||||
"PurchasedItem": "Ai cumpărat ",
|
||||
"PurchaseFailed": "Achiziție eșuată, inventar plin",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Confirmă cumpărarea",
|
||||
"AreYouSure": "Ești sigur că vrei să cumperi un %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Numele magazinului"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Sunt un %s %s",
|
||||
"locale-unit-test": "Acesta este un șir de test"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Notificare"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Copiat în clipboard"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Anulează \n",
|
||||
"object_scroll_up": "[%s] Rotește la dreapta \n",
|
||||
"object_scroll_down": "[%s] Rotește la stânga \n",
|
||||
"depth_modifier": "[%s] Modificator control adâncime \n"
|
||||
"rotate_left": "Rotește la stânga",
|
||||
"rotate_right": "Rotește la dreapta",
|
||||
"rotate_clockwise": "[%s] Rotește în sensul acelor de ceasornic \n",
|
||||
"rotate_counter_clockwise": "[%s] Rotește în sens invers acelor de ceasornic \n",
|
||||
"depth_modifier": "[%s] Modificator de control al adâncimii \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interacționează",
|
||||
"title": "Opțiuni",
|
||||
"description": "Fără descriere"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "Ввод количества",
|
||||
"PurchaseAmount": "Количество покупки",
|
||||
"PurchasedItem": "Вы купили ",
|
||||
"PurchaseFailed": "Покупка не удалась, инвентарь полон",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Подтвердить покупку",
|
||||
"AreYouSure": "Вы уверены, что хотите купить %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Название магазина"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Я %s %s",
|
||||
"locale-unit-test": "Это тестовая строка"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Уведомление"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Скопировано в буфер обмена"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Отменить \n",
|
||||
"object_scroll_up": "[%s] Повернуть вправо \n",
|
||||
"object_scroll_down": "[%s] Повернуть влево \n",
|
||||
"rotate_left": "Повернуть влево",
|
||||
"rotate_right": "Повернуть вправо",
|
||||
"rotate_clockwise": "[%s] Вращать по часовой стрелке \n",
|
||||
"rotate_counter_clockwise": "[%s] Вращать против часовой стрелки \n",
|
||||
"depth_modifier": "[%s] Модификатор контроля глубины \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Взаимодействовать",
|
||||
"title": "Опции",
|
||||
"description": "Нет описания"
|
||||
}
|
||||
}
|
||||
+13
-4
@@ -4,6 +4,7 @@
|
||||
"Input": "Mängd inmatning",
|
||||
"PurchaseAmount": "Inköpsmängd",
|
||||
"PurchasedItem": "Du har köpt ",
|
||||
"PurchaseFailed": "Köp misslyckades, inventarium fullt",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Bekräfta köp",
|
||||
"AreYouSure": "Är du säker på att du vill köpa en %s",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Butiksnamn"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Jag är en %s %s",
|
||||
"locale-unit-test": "Detta är en teststräng"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "Avisering"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "Kopierat till urklipp"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] Avbryt \n",
|
||||
"object_scroll_up": "[%s] Vrid höger \n",
|
||||
"object_scroll_down": "[%s] Vrid vänster \n",
|
||||
"depth_modifier": "[%s] Djupkontroll modifierare \n"
|
||||
"rotate_left": "Rotera vänster",
|
||||
"rotate_right": "Rotera höger",
|
||||
"rotate_clockwise": "[%s] Rotera medurs \n",
|
||||
"rotate_counter_clockwise": "[%s] Rotera moturs \n",
|
||||
"depth_modifier": "[%s] Djupkontroll Modifierare \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Interagera",
|
||||
"title": "Alternativ",
|
||||
"description": "Ingen beskrivning"
|
||||
}
|
||||
}
|
||||
+14
-7
@@ -4,6 +4,7 @@
|
||||
"Input": "ป้อนจำนวน",
|
||||
"PurchaseAmount": "จำนวนที่ซื้อ",
|
||||
"PurchasedItem": "คุณได้ซื้อ ",
|
||||
"PurchaseFailed": "การซื้อล้มเหลว คลังเต็ม",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "ยืนยันการซื้อ",
|
||||
"AreYouSure": "คุณแน่ใจหรือว่าต้องการซื้อ %s",
|
||||
@@ -13,12 +14,9 @@
|
||||
"CashIcon": "fa-solid fa-money-bill-wave",
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "ชื่อร้าน"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "ฉันเป็น %s %s",
|
||||
"locale-unit-test": "นี่คือสตริงทดสอบ"
|
||||
},
|
||||
"clipboard": {
|
||||
}, "Notifications": {
|
||||
"PlaceholderTitle": "การแจ้งเตือน"
|
||||
}, "clipboard": {
|
||||
"copy": "คัดลอกไปยังคลิปบอร์ด"
|
||||
},
|
||||
"input": {
|
||||
@@ -35,6 +33,15 @@
|
||||
"object_cancel": "[%s] ยกเลิก \n",
|
||||
"object_scroll_up": "[%s] หมุนไปทางขวา \n",
|
||||
"object_scroll_down": "[%s] หมุนไปทางซ้าย \n",
|
||||
"depth_modifier": "[%s] ตัวปรับเปลี่ยนการควบคุมความลึก \n"
|
||||
"rotate_left": "หมุนไปทางซ้าย",
|
||||
"rotate_right": "หมุนไปทางขวา",
|
||||
"rotate_clockwise": "[%s] หมุนตามเข็มนาฬิกา \n",
|
||||
"rotate_counter_clockwise": "[%s] หมุนทวนเข็มนาฬิกา \n",
|
||||
"depth_modifier": "[%s] ตัวปรับควบคุมความลึก \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] โต้ตอบ",
|
||||
"title": "ตัวเลือก",
|
||||
"description": "ไม่มีคำอธิบาย"
|
||||
}
|
||||
}
|
||||
+14
-7
@@ -4,6 +4,7 @@
|
||||
"Input": "Miktar girişi",
|
||||
"PurchaseAmount": "Satın alma miktarı",
|
||||
"PurchasedItem": "Satın aldınız ",
|
||||
"PurchaseFailed": "Satın alma başarısız, envanter dolu",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "Satın almayı onayla",
|
||||
"AreYouSure": "Bir %s satın almak istediğinizden emin misiniz",
|
||||
@@ -13,12 +14,9 @@
|
||||
"CashIcon": "fa-solid fa-money-bill-wave",
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "Mağaza adı"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "Ben bir %s %s'yim",
|
||||
"locale-unit-test": "Bu bir test dizesidir"
|
||||
},
|
||||
"clipboard": {
|
||||
}, "Notifications": {
|
||||
"PlaceholderTitle": "Bildirim"
|
||||
}, "clipboard": {
|
||||
"copy": "Panoya kopyalandı"
|
||||
},
|
||||
"input": {
|
||||
@@ -35,6 +33,15 @@
|
||||
"object_cancel": "[%s] İptal \n",
|
||||
"object_scroll_up": "[%s] Sağa döndür \n",
|
||||
"object_scroll_down": "[%s] Sola döndür \n",
|
||||
"depth_modifier": "[%s] Derinlik kontrol düzenleyicisi \n"
|
||||
"rotate_left": "Sola döndür",
|
||||
"rotate_right": "Sağa döndür",
|
||||
"rotate_clockwise": "[%s] Saat yönünde döndür \n",
|
||||
"rotate_counter_clockwise": "[%s] Saat yönünün tersine döndür \n",
|
||||
"depth_modifier": "[%s] Derinlik Kontrol Değiştirici \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] Etkileşim",
|
||||
"title": "Seçenekler",
|
||||
"description": "Açıklama yok"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "数量输入",
|
||||
"PurchaseAmount": "购买数量",
|
||||
"PurchasedItem": "您已购买 ",
|
||||
"PurchaseFailed": "购买失败,库存已满",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "确认购买",
|
||||
"AreYouSure": "您确定要购买 %s 吗",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "商店名称"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "我是一个 %s %s",
|
||||
"locale-unit-test": "这是一个测试字符串"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "通知"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "已复制到剪贴板"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] 取消 \n",
|
||||
"object_scroll_up": "[%s] 向右转 \n",
|
||||
"object_scroll_down": "[%s] 向左转 \n",
|
||||
"rotate_left": "向左旋转",
|
||||
"rotate_right": "向右旋转",
|
||||
"rotate_clockwise": "[%s] 顺时针旋转 \n",
|
||||
"rotate_counter_clockwise": "[%s] 逆时针旋转 \n",
|
||||
"depth_modifier": "[%s] 深度控制修改器 \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] 互动",
|
||||
"title": "选项",
|
||||
"description": "无描述"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "數量輸入",
|
||||
"PurchaseAmount": "購買數量",
|
||||
"PurchasedItem": "您已購買 ",
|
||||
"PurchaseFailed": "購買失敗,庫存已滿",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "確認購買",
|
||||
"AreYouSure": "您確定要購買 %s 嗎",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "商店名稱"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "我是一個 %s %s",
|
||||
"locale-unit-test": "這是一個測試字符串"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "通知"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "已復制到剪貼板"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] 取消 \n",
|
||||
"object_scroll_up": "[%s] 向右轉 \n",
|
||||
"object_scroll_down": "[%s] 向左轉 \n",
|
||||
"rotate_left": "向左旋轉",
|
||||
"rotate_right": "向右旋轉",
|
||||
"rotate_clockwise": "[%s] 順時針旋轉 \n",
|
||||
"rotate_counter_clockwise": "[%s] 逆時針旋轉 \n",
|
||||
"depth_modifier": "[%s] 深度控制修改器 \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] 互動",
|
||||
"title": "選項",
|
||||
"description": "無描述"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "數量輸入",
|
||||
"PurchaseAmount": "購買數量",
|
||||
"PurchasedItem": "您已購買 ",
|
||||
"PurchaseFailed": "購買失敗,庫存已滿",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "確認購買",
|
||||
"AreYouSure": "您確定要購買 %s 嗎",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "商店名稱"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "我是一個 %s %s",
|
||||
"locale-unit-test": "這是一個測試字符串"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "通知"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "已複製到剪貼簿"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] 取消 \n",
|
||||
"object_scroll_up": "[%s] 向右轉 \n",
|
||||
"object_scroll_down": "[%s] 向左轉 \n",
|
||||
"rotate_left": "向左旋轉",
|
||||
"rotate_right": "向右旋轉",
|
||||
"rotate_clockwise": "[%s] 順時針旋轉 \n",
|
||||
"rotate_counter_clockwise": "[%s] 逆時針旋轉 \n",
|
||||
"depth_modifier": "[%s] 深度控制修改器 \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] 互動",
|
||||
"title": "選項",
|
||||
"description": "無描述"
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -4,6 +4,7 @@
|
||||
"Input": "数量输入",
|
||||
"PurchaseAmount": "购买数量",
|
||||
"PurchasedItem": "您已购买 ",
|
||||
"PurchaseFailed": "购买失败,库存已满",
|
||||
"CurrencySymbol": "$ %s",
|
||||
"Confirm": "确认购买",
|
||||
"AreYouSure": "您确定要购买 %s 吗",
|
||||
@@ -14,9 +15,8 @@
|
||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||
"ShopName": "商店名称"
|
||||
},
|
||||
"UNITTEST": {
|
||||
"UNITTESTA": "我是一个 %s %s",
|
||||
"locale-unit-test": "这是一个测试字符串"
|
||||
"Notifications": {
|
||||
"PlaceholderTitle": "通知"
|
||||
},
|
||||
"clipboard": {
|
||||
"copy": "已复制到剪贴板"
|
||||
@@ -35,6 +35,15 @@
|
||||
"object_cancel": "[%s] 取消 \n",
|
||||
"object_scroll_up": "[%s] 向右转 \n",
|
||||
"object_scroll_down": "[%s] 向左转 \n",
|
||||
"rotate_left": "向左旋转",
|
||||
"rotate_right": "向右旋转",
|
||||
"rotate_clockwise": "[%s] 顺时针旋转 \n",
|
||||
"rotate_counter_clockwise": "[%s] 逆时针旋转 \n",
|
||||
"depth_modifier": "[%s] 深度控制修改器 \n"
|
||||
},
|
||||
"target": {
|
||||
"interact": "[E] 互动",
|
||||
"title": "选项",
|
||||
"description": "无描述"
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ Framework = Framework or {}
|
||||
|
||||
local cachedItemList = nil
|
||||
|
||||
--- @description This is an internal function, its here to attempt to emulate qbs shared items mainly
|
||||
---@description This is an internal function, its here to attempt to emulate qbs shared items mainly. This should not be used outside of bridge.
|
||||
Framework.ItemList = function()
|
||||
if cachedItemList then return cachedItemList end
|
||||
local items = Callback.Trigger('community_bridge:Callback:GetFrameworkItems', false)
|
||||
@@ -19,24 +19,24 @@ end
|
||||
---@description This will get the name of the framework being used (if a supported framework).
|
||||
---@return string
|
||||
Framework.GetFrameworkName = function()
|
||||
return 'es_extended'
|
||||
print("This is depricated, please use Framework.GetResourceName() instead.")
|
||||
return Framework.GetResourceName()
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Framework.GetResourceName = function()
|
||||
return 'es_extended'
|
||||
end
|
||||
|
||||
---@description This will return true if the player is loaded, false otherwise.
|
||||
--- This could be useful in scripts that rely on player loaded events and offer a debug mode to hit this function
|
||||
---This could be useful in scripts that rely on player loaded events and offer a debug mode to hit this function.
|
||||
---@return boolean
|
||||
Framework.GetIsPlayerLoaded = function()
|
||||
return ESX.IsPlayerLoaded()
|
||||
end
|
||||
|
||||
--- @description This will return a table of the player data, this will be in the framework format
|
||||
--- This is mainly for internal bridge use and should be avoided.
|
||||
---@description This is an internal function, do not use this outside of bridge as there is no standard format between the frameworks.
|
||||
--- @return table
|
||||
Framework.GetPlayerData = function()
|
||||
return ESX.GetPlayerData()
|
||||
@@ -49,7 +49,7 @@ Framework.GetFrameworkJobs = function()
|
||||
return jobs
|
||||
end
|
||||
|
||||
--- @description This will return the players birth date
|
||||
---@description This will get the players birth date
|
||||
---@return string
|
||||
Framework.GetPlayerDob = function()
|
||||
local playerData = Framework.GetPlayerData()
|
||||
@@ -73,11 +73,11 @@ Framework.Notify = function(message, type, time)
|
||||
return ESX.ShowNotification(message, type, time)
|
||||
end
|
||||
|
||||
--- @description This will display the help text message on the screen
|
||||
---@description Will Display the help text message on the screen
|
||||
---@param message string
|
||||
--- @param _ unknown
|
||||
---@param _position unknown
|
||||
---@return nil
|
||||
Framework.ShowHelpText = function(message, _)
|
||||
Framework.ShowHelpText = function(message, _position)
|
||||
return exports.esx_textui:TextUI(message, "info")
|
||||
end
|
||||
|
||||
@@ -102,14 +102,15 @@ Framework.GetPlayerName = function()
|
||||
return playerData.firstName, playerData.lastName
|
||||
end
|
||||
|
||||
--- @deprecated This will return the players job name, job label, job grade label and job grade level
|
||||
--- @return string returns job name
|
||||
--- @return string returns job label
|
||||
--- @return string returns job grade label
|
||||
--- @return string returns job grade level
|
||||
---@description Depricated : This will return the players job name, job label, job grade label and job grade level
|
||||
---@return string
|
||||
---@return string
|
||||
---@return string
|
||||
---@return string
|
||||
Framework.GetPlayerJob = function()
|
||||
local playerData = Framework.GetPlayerData()
|
||||
return playerData.job.name, playerData.job.label, playerData.job.grade_label, playerData.job.grade
|
||||
print("This is depricated, please use Framework.GetPlayerJobData() instead.")
|
||||
local jobData = Framework.GetPlayerJobData()
|
||||
return jobData.jobName, jobData.jobLabel, jobData.gradeName, jobData.gradeRank
|
||||
end
|
||||
|
||||
--- @description This will return the players job name, job label, job grade label job grade level,
|
||||
@@ -130,7 +131,7 @@ Framework.GetPlayerJobData = function()
|
||||
}
|
||||
end
|
||||
|
||||
--This is an internal function to get status data
|
||||
---@description This is an internal function to get status data
|
||||
--- @param search string
|
||||
Framework.GetStatusData = function(search)
|
||||
local playerData = Framework.GetPlayerData()
|
||||
@@ -144,29 +145,30 @@ Framework.GetStatusData = function(search)
|
||||
return 0
|
||||
end
|
||||
|
||||
---This will get the hunger of a player
|
||||
---@description This will get the hunger of a player
|
||||
---@return number
|
||||
Framework.GetHunger = function()
|
||||
local status = Framework.GetStatusData("hunger")
|
||||
return math.floor((status) + 0.5) or 0
|
||||
end
|
||||
|
||||
---This will get the thirst of a player
|
||||
---@description This will get the thirst of a player
|
||||
---@return number
|
||||
Framework.GetThirst = function()
|
||||
local status = Framework.GetStatusData("thirst")
|
||||
return math.floor((status) + 0.5) or 0
|
||||
end
|
||||
|
||||
--- @description This will return if the player has the specified item in their inventory
|
||||
---@description Will return boolean if the player has the item.
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Framework.HasItem = function(item)
|
||||
Framework.HasItem = function(item, requiredCount)
|
||||
local hasItem = ESX.SearchInventory(item, true)
|
||||
return hasItem > 0 and true or false
|
||||
return hasItem >= (requiredCount or 1)
|
||||
end
|
||||
|
||||
--- @description This will return the item count for the specified item in the players inventory
|
||||
---@description This is an internal function used as a fallback, please use the Inventory.GetItemCount instead.
|
||||
--- @param item string
|
||||
--- @return number
|
||||
Framework.GetItemCount = function(item)
|
||||
@@ -175,14 +177,36 @@ Framework.GetItemCount = function(item)
|
||||
return inventory[item].count or 0
|
||||
end
|
||||
|
||||
--- @description This will return a table of the players inventory
|
||||
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Framework.GetPlayerInventory = function()
|
||||
local playerData = Framework.GetPlayerData()
|
||||
return playerData.inventory
|
||||
Framework.GetItemInfo = function(item)
|
||||
return {}, print("ESX has not implemented GetItemInfo for this framework. Please ensure the inventory you are using is supported and start order is correct.")
|
||||
end
|
||||
|
||||
--- @description This will return the players money by type, I recommend not using this as its the client and not secure or to be trusted
|
||||
---@description This is an internal function used as a fallback, please use the Inventory.GetPlayerInventory instead.
|
||||
--- @return table {name, label, count, slot, metadata, stack, close, weight}
|
||||
Framework.GetPlayerInventory = function()
|
||||
local playerData = Framework.GetPlayerData()
|
||||
if not playerData then return {} end
|
||||
local repack = {}
|
||||
for k, v in pairs(playerData.inventory) do
|
||||
repack[k] = {
|
||||
name = v.name,
|
||||
label = v.label,
|
||||
count = v.count,
|
||||
slot = 0,
|
||||
metadata = {},
|
||||
stack = false,
|
||||
close = v.usable or false,
|
||||
weight = v.weight or 0,
|
||||
}
|
||||
end
|
||||
return repack
|
||||
end
|
||||
|
||||
---@description This will return the players money by type, I recommend not useing this as its the client and not secure or to be trusted.
|
||||
---Use case is for a ui or a menu I guess.
|
||||
---@param _type string
|
||||
---@return number
|
||||
Framework.GetAccountBalance = function(_type)
|
||||
@@ -192,52 +216,13 @@ Framework.GetAccountBalance = function(_type)
|
||||
if _type == 'cash' then _type = 'money' end
|
||||
for _, account in ipairs(accounts) do
|
||||
if account.name == _type then
|
||||
if not account.money or account.money <= 0 then return 0 end
|
||||
return account.money or 0
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
--- @description This will return the vehicle properties for the specified vehicle
|
||||
--- @param vehicle number
|
||||
--- @return table
|
||||
Framework.GetVehicleProperties = function(vehicle)
|
||||
if not vehicle or not DoesEntityExist(vehicle) then return {} end
|
||||
local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
|
||||
return vehicleProps or {}
|
||||
end
|
||||
|
||||
--- @description This will set the vehicle properties for the specified vehicle
|
||||
--- @param vehicle number
|
||||
--- @param properties table
|
||||
--- @return boolean
|
||||
Framework.SetVehicleProperties = function(vehicle, properties)
|
||||
if not vehicle or not DoesEntityExist(vehicle) then return false end
|
||||
if not properties then return false end
|
||||
if NetworkGetEntityIsNetworked(vehicle) then
|
||||
local vehNetID = NetworkGetNetworkIdFromEntity(vehicle)
|
||||
local entOwner = GetPlayerServerId(NetworkGetEntityOwner(vehNetID))
|
||||
if entOwner ~= GetPlayerServerId(PlayerId()) then
|
||||
NetworkRequestControlOfEntity(vehicle)
|
||||
local count = 0
|
||||
while not NetworkHasControlOfEntity(vehicle) and count < 3000 do
|
||||
Wait(1)
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Every framework version does this just a diffrent key I guess?
|
||||
if properties.color1 and type(properties.color1) == 'table' then
|
||||
properties.customPrimaryColor = {properties.color1[1], properties.color1[2], properties.color1[3]}
|
||||
properties.color1 = nil
|
||||
end
|
||||
if properties.color2 and type(properties.color2) == 'table' then
|
||||
properties.customSecondaryColor = {properties.color2[1], properties.color2[2], properties.color2[3]}
|
||||
properties.color2 = nil
|
||||
end
|
||||
return true, ESX.Game.SetVehicleProperties(vehicle, properties)
|
||||
end
|
||||
|
||||
--- @description This will get a players dead status
|
||||
--- @return boolean
|
||||
Framework.GetIsPlayerDead = function()
|
||||
@@ -245,15 +230,20 @@ Framework.GetIsPlayerDead = function()
|
||||
return playerData.dead
|
||||
end
|
||||
|
||||
---@description Event handler for when player is loaded in ESX framework
|
||||
---@param xPlayer table
|
||||
RegisterNetEvent('esx:playerLoaded', function(xPlayer)
|
||||
Wait(1500)
|
||||
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
|
||||
end)
|
||||
|
||||
---@description Event handler for when player logs out in ESX framework
|
||||
RegisterNetEvent('esx:onPlayerLogout', function()
|
||||
TriggerEvent('community_bridge:Client:OnPlayerUnload')
|
||||
end)
|
||||
|
||||
---@description Event handler for when player job is updated in ESX framework
|
||||
---@param data table Job data containing name, label, grade_label, and grade
|
||||
RegisterNetEvent('esx:setJob', function(data)
|
||||
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', data.name, data.label, data.grade_label, data.grade)
|
||||
end)
|
||||
|
||||
@@ -13,16 +13,17 @@ local cachedItemList = nil
|
||||
--- @description This will return the name of the framework in use
|
||||
--- @return string
|
||||
Framework.GetFrameworkName = function()
|
||||
return 'es_extended'
|
||||
print("This is deprecated, please use Framework.GetResourceName() instead.")
|
||||
return Framework.GetResourceName()
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@description This will get the name of the in use resource.
|
||||
--- @return string
|
||||
Framework.GetResourceName = function()
|
||||
return 'es_extended'
|
||||
end
|
||||
|
||||
--- @description This is an internal function, its here to attempt to emulate qbs shared items mainly
|
||||
---@description This is an internal function, its here to attempt to emulate qbs shared items mainly, do not use this outside of bridge.
|
||||
Framework.ItemList = function()
|
||||
if cachedItemList then return cachedItemList end
|
||||
local items = ESX.Items
|
||||
@@ -46,8 +47,8 @@ Framework.ItemList = function()
|
||||
return cachedItemList
|
||||
end
|
||||
|
||||
--- @description This will return if the player is an admin in the framework
|
||||
--- @param src any
|
||||
---@description This will return if the player is an admin in the framework.
|
||||
---@param src number
|
||||
---@return boolean
|
||||
Framework.GetIsFrameworkAdmin = function(src)
|
||||
if not src then return false end
|
||||
@@ -58,7 +59,8 @@ Framework.GetIsFrameworkAdmin = function(src)
|
||||
return false
|
||||
end
|
||||
|
||||
--- @description This will get the players birth date
|
||||
---@description Returns the player date of birth.
|
||||
--- @param src number
|
||||
--- @return string|nil
|
||||
Framework.GetPlayerDob = function(src)
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
@@ -110,14 +112,16 @@ Framework.GetPlayers = function()
|
||||
return playerList
|
||||
end
|
||||
|
||||
--- @description This will return a table of items matching the specified name and if passed metadata from the player's inventory
|
||||
---@description Returns a table of items matching the specified name and if passed metadata from the player's inventory.
|
||||
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
--- @param src number
|
||||
--- @param item string
|
||||
--- @param _ table
|
||||
--- @return table|nil returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
|
||||
Framework.GetItem = function(src, item, _)
|
||||
--- @param metadata table
|
||||
--- @return table {name, count, metadata, slot}
|
||||
Framework.GetItem = function(src, item, metadata)
|
||||
print("ESX does not support item metadata searches, please ensure you are using a supported inventory system or that you have the correct start order.")
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return end
|
||||
if not xPlayer then return {} end
|
||||
local playerItems = xPlayer.getInventory()
|
||||
local repackedTable = {}
|
||||
for _, v in pairs(playerItems) do
|
||||
@@ -125,40 +129,57 @@ Framework.GetItem = function(src, item, _)
|
||||
table.insert(repackedTable, {
|
||||
name = v.name,
|
||||
count = v.count,
|
||||
--metadata = v.metadata,
|
||||
--slot = v.slot,
|
||||
metadata = {}, -- ESX does not support item metadata
|
||||
slot = 0, -- ESX does not support item slots
|
||||
})
|
||||
end
|
||||
end
|
||||
return repackedTable
|
||||
end
|
||||
|
||||
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
--- @param item string
|
||||
--- @return table {name, label, stack, weight, description, image}
|
||||
Framework.GetItemInfo = function(item)
|
||||
local items = Framework.ItemList()
|
||||
if not items[item] then return {} end
|
||||
return {name = item, label = items[item].label, stack = false, weight = items[item].weight, description = items[item].description, image = items[item].image}
|
||||
end
|
||||
|
||||
---@description This will return the count of the item in the players inventory, if not found will return 0.
|
||||
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
---@param src number
|
||||
---@param item string
|
||||
--- @param _ table
|
||||
--- @return number returns the count of the item in the players inventory, if not found will return 0.
|
||||
--- If metadata is passed it will find the matching items count (esx_core does not feature metadata items)
|
||||
Framework.GetItemCount = function(src, item, _)
|
||||
---@param metadata table (optional)
|
||||
---@return number
|
||||
Framework.GetItemCount = function(src, item, metadata)
|
||||
if metadata then
|
||||
print("ESX does not support item metadata searches, please ensure you are using a supported inventory system or that you have the correct start order.")
|
||||
end
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return end
|
||||
if not xPlayer then return 0 end
|
||||
return xPlayer.getInventoryItem(item).count
|
||||
end
|
||||
|
||||
--- @description This will return true if the player has the item, false otherwise
|
||||
---@description This will return a boolean if the player has the item.
|
||||
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
--- @param src number
|
||||
--- @param item string
|
||||
--- @return boolean returns true if the player has the item, false otherwise.
|
||||
--- @return boolean
|
||||
Framework.HasItem = function(src, item)
|
||||
local getCount = Framework.GetItemCount(src, item, nil)
|
||||
return getCount > 0
|
||||
end
|
||||
|
||||
--- @description This will return the player's inventory as a table
|
||||
---@description Returns the entire inventory of the player as a table.
|
||||
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
---@param src number
|
||||
--- @return table | nil returns the player's inventory as a table in format: {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
|
||||
---@return table {name, count, metadata, slot}
|
||||
Framework.GetPlayerInventory = function(src)
|
||||
print("ESX does not support item metadata or slots, please ensure you are using a supported inventory system or that you have the correct start order.")
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return end
|
||||
if not xPlayer then return {} end
|
||||
local playerItems = xPlayer.getInventory()
|
||||
local repackedTable = {}
|
||||
for _, v in pairs(playerItems) do
|
||||
@@ -166,14 +187,24 @@ Framework.GetPlayerInventory = function(src)
|
||||
table.insert(repackedTable, {
|
||||
name = v.name,
|
||||
count = v.count,
|
||||
--metadata = v.metadata,
|
||||
--slot = v.slot,
|
||||
metadata = {}, -- ESX does not support item metadata
|
||||
slot = 0, -- ESX does not support item slots
|
||||
})
|
||||
end
|
||||
end
|
||||
return repackedTable
|
||||
end
|
||||
|
||||
---@description This will return the item data for the specified slot.
|
||||
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
--- @param src number
|
||||
--- @param slot number
|
||||
--- @return table {name, label, weight, count, metadata, slot, stack, description}
|
||||
Framework.GetItemBySlot = function(src, slot)
|
||||
print("ESX does not support item slots, please ensure you are using a supported inventory system or that you have the correct start order.")
|
||||
return {} -- ESX does not support item slots
|
||||
end
|
||||
|
||||
---@description Adds the specified metadata key and number value to the player's data.
|
||||
--- @param src number
|
||||
--- @param metadata string
|
||||
@@ -186,7 +217,6 @@ Framework.SetPlayerMetadata = function(src, metadata, value)
|
||||
return true
|
||||
end
|
||||
|
||||
-- Framework.GetMetadata(src, metadata)
|
||||
---@description Gets the specified metadata key to the player's data.
|
||||
--- @param src number
|
||||
--- @param metadata string
|
||||
@@ -197,7 +227,7 @@ Framework.GetPlayerMetadata = function(src, metadata)
|
||||
return xPlayer.getMeta(metadata) or false
|
||||
end
|
||||
|
||||
--- @description This will return the specified status column of the player.
|
||||
---@description This is an internal function and should not be used outside of bridge, this is only present in the esx portion.
|
||||
--- @param src number
|
||||
--- @param column string
|
||||
--- @return string|nil
|
||||
@@ -213,16 +243,16 @@ Framework.GetStatus = function(src, column)
|
||||
return xPlayer.get(column) or nil
|
||||
end
|
||||
|
||||
--- @description This will return a boolean if the player is dead or in last stand
|
||||
---@description This will return a boolean if the player is dead or in last stand.
|
||||
--- @param src number
|
||||
--- @return boolean|nil
|
||||
--- @return boolean
|
||||
Framework.GetIsPlayerDead = function(src)
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return end
|
||||
if not xPlayer then return false end
|
||||
return xPlayer.get("is_dead") or false
|
||||
end
|
||||
|
||||
--- @description This will revive a player, if the player is dead or in last stand
|
||||
---@description This will revive a player, if the player is dead or in last stand.
|
||||
--- @param src number
|
||||
--- @return boolean
|
||||
Framework.RevivePlayer = function(src)
|
||||
@@ -254,13 +284,13 @@ Framework.AddHunger = function(src, value)
|
||||
return levelForEsx
|
||||
end
|
||||
|
||||
--- @description This will get the hunger of a player (ESX we get the percent of the status)
|
||||
---@description This will get the hunger of a player
|
||||
--- @param src number
|
||||
--- @return number | nil
|
||||
--- @return number
|
||||
Framework.GetHunger = function(src)
|
||||
local status = Framework.GetStatus(src, "status")
|
||||
if not status then return end
|
||||
if type(status) ~= "table" then return end
|
||||
if not status then return 0 end
|
||||
if type(status) ~= "table" then return 0 end
|
||||
for _, entry in ipairs(status) do
|
||||
if entry.name == "hunger" then
|
||||
return math.floor((entry.percent) + 0.5) or 0
|
||||
@@ -268,13 +298,13 @@ Framework.GetHunger = function(src)
|
||||
end
|
||||
end
|
||||
|
||||
--- @description This will get the thirst of a player (ESX we get the percent of the status)
|
||||
---@description This will get the thirst of a player
|
||||
--- @param src any
|
||||
--- @return number | nil
|
||||
--- @return number
|
||||
Framework.GetThirst = function(src)
|
||||
local status = Framework.GetStatus(src, "status")
|
||||
if not status then return nil end
|
||||
if type(status) ~= "table" then return end
|
||||
if not status then return 0 end
|
||||
if type(status) ~= "table" then return 0 end
|
||||
for _, entry in ipairs(status) do
|
||||
if entry.name == "thirst" then
|
||||
return math.floor((entry.percent) + 0.5) or 0
|
||||
@@ -282,16 +312,17 @@ Framework.GetThirst = function(src)
|
||||
end
|
||||
end
|
||||
|
||||
--- @description This will get the phone number of a player
|
||||
---@description Returns the phone number of the player.
|
||||
--- @param src number
|
||||
--- @return string | nil return the phone number of the player
|
||||
--- @return string | nil
|
||||
Framework.GetPlayerPhone = function(src)
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return end
|
||||
return xPlayer.get("phone_number")
|
||||
end
|
||||
|
||||
---@deprecated This will return the job name, label, grade name, and grade level of the player.
|
||||
---@description This will return the job name, label, grade name, and grade level of the player.
|
||||
---@deprecated
|
||||
---@param src number
|
||||
---@return string | nil
|
||||
---@return string | nil
|
||||
@@ -304,13 +335,12 @@ Framework.GetPlayerJob = function(src)
|
||||
return job.name, job.label, job.grade_label, job.grade
|
||||
end
|
||||
|
||||
--- @description This will return the players job name, job label, job grade label job grade level,
|
||||
--- boss status, and duty status in a table
|
||||
---@description This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
|
||||
--- @param src number
|
||||
--- @return table | nil
|
||||
--- @return table {jobName, jobLabel, gradeName, gradeLabel, gradeRank, boss, onDuty}
|
||||
Framework.GetPlayerJobData = function(src)
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return end
|
||||
if not xPlayer then return {} end
|
||||
local job = xPlayer.getJob()
|
||||
local isBoss = (job.grade_name == "boss")
|
||||
return {
|
||||
@@ -324,9 +354,9 @@ Framework.GetPlayerJobData = function(src)
|
||||
}
|
||||
end
|
||||
|
||||
--- @description This will return the players duty status, true if on duty false otherwise
|
||||
---@description Returns the players duty status.
|
||||
--- @param src number
|
||||
--- @return boolean return the players duty status
|
||||
--- @return boolean
|
||||
Framework.GetPlayerDuty = function(src)
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return false end
|
||||
@@ -348,23 +378,30 @@ Framework.SetPlayerDuty = function(src, status)
|
||||
return true
|
||||
end
|
||||
|
||||
--- @description This will get a table of player sources that have the specified job name
|
||||
---@description Returns the gang name of the player.
|
||||
---@param src number
|
||||
---@return string | nil
|
||||
Framework.GetPlayerGang = function(src)
|
||||
print("ESX does not support gangs, please ensure you are using a supported gang system or that you have the correct start order.")
|
||||
return
|
||||
end
|
||||
|
||||
---@description This will get a table of player sources that have the specified job name.
|
||||
--- @param job string
|
||||
--- @return table
|
||||
Framework.GetPlayersByJob = function(job)
|
||||
return Framework.GetPlayerSourcesByJob(job) or {}
|
||||
end
|
||||
|
||||
--- @description This will set the player's job to the specified name and grade
|
||||
---@description Sets the player's job to the specified name and grade.
|
||||
--- @param src number
|
||||
--- @param name string
|
||||
--- @param grade string
|
||||
--- @return nil
|
||||
Framework.SetPlayerJob = function(src, name, grade)
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return end
|
||||
if not ESX.DoesJobExist(name, grade) then
|
||||
Prints.Error("Job Does Not Exsist In Framework :NAME " .. name .. " Grade:" .. grade)
|
||||
print("^6 Job Does Not Exsist In Framework :NAME " .. name .. " Grade:" .. grade .. " ^0 ")
|
||||
return
|
||||
end
|
||||
xPlayer.setJob(name, grade, true)
|
||||
@@ -375,11 +412,12 @@ end
|
||||
--- @param src number
|
||||
--- @param _type string
|
||||
--- @param amount number
|
||||
--- @return boolean | nil
|
||||
--- @return boolean
|
||||
Framework.AddAccountBalance = function(src, _type, amount)
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return end
|
||||
if not xPlayer then return false end
|
||||
if _type == 'cash' then _type = 'money' end
|
||||
if amount <= 0 then return false end
|
||||
xPlayer.addAccountMoney(_type, amount)
|
||||
return true
|
||||
end
|
||||
@@ -388,54 +426,82 @@ end
|
||||
--- @param src number
|
||||
--- @param _type string
|
||||
--- @param amount number
|
||||
--- @return boolean | nil
|
||||
--- @return boolean
|
||||
Framework.RemoveAccountBalance = function(src, _type, amount)
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return end
|
||||
if not xPlayer then return false end
|
||||
if _type == 'cash' then _type = 'money' end
|
||||
if amount <= 0 then return false end
|
||||
local accountVal = Framework.GetAccountBalance(src, _type)
|
||||
if accountVal < amount then return false end
|
||||
xPlayer.removeAccountMoney(_type, amount)
|
||||
return true
|
||||
end
|
||||
|
||||
--- @description This will get the account balance based on the type of account (money/bank)
|
||||
---@description This will get money based on the type of account (money/bank)
|
||||
--- @param src number
|
||||
--- @param _type string
|
||||
--- @return string | nil
|
||||
--- @return number
|
||||
Framework.GetAccountBalance = function(src, _type)
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return end
|
||||
if not xPlayer then return 0 end
|
||||
if _type == 'cash' then _type = 'money' end
|
||||
return xPlayer.getAccount(_type).money
|
||||
local balance = xPlayer.getAccount(_type).money or 0
|
||||
if balance <= 0 then return 0 end
|
||||
return balance
|
||||
end
|
||||
|
||||
--- @description Adds the specified item to the player's inventory
|
||||
---@description This will add an item, and return true or false based on success
|
||||
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
---@param src number
|
||||
---@param item string
|
||||
--- @param amount number
|
||||
--- @param slot number
|
||||
--- @param metadata table
|
||||
--- @return boolean | nil
|
||||
Framework.AddItem = function(src, item, amount, slot, metadata)
|
||||
---@param count number
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Framework.AddItem = function(src, item, count, slot, metadata)
|
||||
if slot then print("ESX does not support item slots, please ensure you are using a supported inventory system or that you have the correct start order.") end
|
||||
if metadata then print("ESX does not support item metadata, please ensure you are using a supported inventory system or that you have the correct start order.") end
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return end
|
||||
xPlayer.addInventoryItem(item, amount)
|
||||
if not xPlayer then return false end
|
||||
xPlayer.addInventoryItem(item, count)
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "add", item = item, count = count, slot = slot, metadata = metadata })
|
||||
return true
|
||||
end
|
||||
|
||||
--- @description Removes the specified item from the player's inventory
|
||||
---@description Removes the specified item from the player's inventory.
|
||||
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
--- @param src number
|
||||
--- @param item string
|
||||
--- @param amount number
|
||||
--- @param slot number
|
||||
--- @param metadata table
|
||||
---@return boolean | nil
|
||||
--- @param slot number (optional)
|
||||
--- @param metadata table (optional)
|
||||
--- @return boolean
|
||||
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
||||
if slot then
|
||||
print("ESX does not support item slots, please ensure you are using a supported inventory system or that you have the correct start order.")
|
||||
end
|
||||
if metadata then
|
||||
print("ESX does not support item metadata, please ensure you are using a supported inventory system or that you have the correct start order.")
|
||||
end
|
||||
local xPlayer = Framework.GetPlayer(src)
|
||||
if not xPlayer then return end
|
||||
if not xPlayer then return false end
|
||||
xPlayer.removeInventoryItem(item, amount)
|
||||
return true
|
||||
end
|
||||
|
||||
---@description Sets the metadata for the specified item in the player's inventory.
|
||||
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
--- @param src number
|
||||
--- @param item string
|
||||
--- @param slot number
|
||||
--- @param metadata table
|
||||
--- @return boolean
|
||||
Framework.SetMetadata = function(src, item, slot, metadata)
|
||||
print("ESX does not support item metadata, please ensure you are using a supported inventory system or that you have the correct start order.")
|
||||
return false
|
||||
end
|
||||
|
||||
---@description This will get all owned vehicles for the player
|
||||
--- @param src number
|
||||
--- @return table
|
||||
@@ -452,7 +518,7 @@ Framework.GetOwnedVehicles = function(src)
|
||||
return vehicles
|
||||
end
|
||||
|
||||
--- @description Registers a usable item with a callback function
|
||||
---@description Registers a usable item with a callback function.
|
||||
--- @param itemName string
|
||||
--- @param cb function
|
||||
Framework.RegisterUsableItem = function(itemName, cb)
|
||||
@@ -465,6 +531,8 @@ Framework.RegisterUsableItem = function(itemName, cb)
|
||||
ESX.RegisterUsableItem(itemName, func)
|
||||
end
|
||||
|
||||
---@description Event handler for when a player is loaded in ESX framework
|
||||
---@param src number
|
||||
RegisterNetEvent("esx:playerLoaded", function(src)
|
||||
src = src or source
|
||||
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
|
||||
@@ -473,32 +541,50 @@ RegisterNetEvent("esx:playerLoaded", function(src)
|
||||
Framework.AddJobCount(src, jobData.jobName)
|
||||
end)
|
||||
|
||||
---@description Event handler for when a player logs out in ESX framework
|
||||
---@param src number
|
||||
RegisterNetEvent("esx:playerLogout", function(src)
|
||||
src = src or source
|
||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||
end)
|
||||
|
||||
---@description Event handler for when a player's job is updated in ESX framework
|
||||
---@param src number
|
||||
---@param job table
|
||||
---@param lastJob table
|
||||
RegisterNetEvent("esx:setJob", function(src, job, lastJob)
|
||||
src = src or source
|
||||
if not job or not lastJob then return end
|
||||
TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name)
|
||||
end)
|
||||
|
||||
---@description Event handler for when a player disconnects from the server
|
||||
AddEventHandler("playerDropped", function()
|
||||
local src = source
|
||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||
end)
|
||||
|
||||
---@description Callback to get framework jobs list
|
||||
---@param source number
|
||||
Callback.Register('community_bridge:Callback:GetFrameworkJobs', function(source)
|
||||
return Framework.GetFrameworkJobs() or {}
|
||||
end)
|
||||
|
||||
-- This is linked to an internal function, its an attempt to standardize the item list across frameworks.
|
||||
---@description This is linked to an internal function, its an attempt to standardize the item list across frameworks.
|
||||
---@param source number
|
||||
Callback.Register('community_bridge:Callback:GetFrameworkItems', function(source)
|
||||
return Framework.ItemList() or {}
|
||||
end)
|
||||
|
||||
Framework.Commands = {}
|
||||
---@description Adds a command to the ESX framework
|
||||
---@param name string
|
||||
---@param help string
|
||||
---@param arguments table
|
||||
---@param argsrequired boolean
|
||||
---@param callback function
|
||||
---@param permission string
|
||||
---@param ... any
|
||||
Framework.Commands.Add = function(name, help, arguments, argsrequired, callback, permission, ...)
|
||||
ESX.RegisterCommand(name, permission, function(xPlayer, args, showError)
|
||||
callback(xPlayer, args)
|
||||
|
||||
@@ -11,7 +11,8 @@ Framework.Shared = QBCore.Shared
|
||||
---@description This will get the name of the framework being used (if a supported framework).
|
||||
---@return string
|
||||
Framework.GetFrameworkName = function()
|
||||
return 'qb-core'
|
||||
print("This is depricated, please use Framework.GetResourceName() instead.")
|
||||
return Framework.GetResourceName()
|
||||
end
|
||||
|
||||
---@description This will get the name of the in use resource.
|
||||
@@ -149,8 +150,9 @@ end
|
||||
---@return string
|
||||
---@return string
|
||||
Framework.GetPlayerJob = function()
|
||||
local playerData = Framework.GetPlayerData()
|
||||
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
|
||||
print("This is depricated, please use Framework.GetPlayerJobData() instead.")
|
||||
local jobData = Framework.GetPlayerJobData()
|
||||
return jobData.jobName, jobData.jobLabel, jobData.gradeName, jobData.gradeRank
|
||||
end
|
||||
|
||||
---@description This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
|
||||
@@ -169,11 +171,12 @@ Framework.GetPlayerJobData = function()
|
||||
}
|
||||
end
|
||||
|
||||
---@description This will return if the player has the specified item in their inventory
|
||||
---@description Will return boolean if the player has the item.
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Framework.HasItem = function(item)
|
||||
return QBCore.Functions.HasItem(item)
|
||||
Framework.HasItem = function(item, requiredCount)
|
||||
return QBCore.Functions.HasItem(item, requiredCount or 1)
|
||||
end
|
||||
|
||||
---@description This will return the item count for the specified item in the players inventory
|
||||
@@ -201,7 +204,7 @@ Framework.GetPlayerInventory = function()
|
||||
label = v.label,
|
||||
count = v.amount or v.count,
|
||||
slot = v.slot,
|
||||
metadata = v.info,
|
||||
metadata = v.info or v.metadata or {},
|
||||
stack = v.unique,
|
||||
close = v.useable,
|
||||
weight = v.weight
|
||||
@@ -248,28 +251,21 @@ Framework.GetIsPlayerDead = function()
|
||||
return playerData.metadata["isdead"] or playerData.metadata["inlaststand"]
|
||||
end
|
||||
|
||||
---@description Event handler for when player is loaded in QB-Core framework
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
||||
Wait(1500)
|
||||
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
|
||||
end)
|
||||
|
||||
---@description Event handler for when player is unloaded in QB-Core framework
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
|
||||
TriggerEvent('community_bridge:Client:OnPlayerUnload')
|
||||
end)
|
||||
|
||||
---@description Event handler for when player job is updated in QB-Core framework
|
||||
---@param data table Job data containing name, label, grade_label, and grade
|
||||
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(data)
|
||||
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', data.name, data.label, data.grade_label, data.grade)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnGangUpdate', function(data)
|
||||
-- Unsure what data is passed in this, but considering the gang data isnt updating I doubt this was tested.
|
||||
--[[
|
||||
PlayerJobName = data.name
|
||||
PlayerJobLabel = data.label
|
||||
PlayerJobGradeName = data.grade.name
|
||||
PlayerJobGradeLevel = data.grade.level
|
||||
TriggerEvent('community_bridge:Client:OnPlayerGangUpdate', PlayerGangName, PlayerGangLabel, PlayerGangGradeName, PlayerGangGradeLevel)
|
||||
--]]
|
||||
end)
|
||||
|
||||
return Framework
|
||||
@@ -11,7 +11,8 @@ Framework.Shared = QBCore.Shared
|
||||
---@description This will return the name of the framework in use.
|
||||
---@return string
|
||||
Framework.GetFrameworkName = function()
|
||||
return 'qb-core'
|
||||
print("[Community Bridge] Warning: Framework.GetFrameworkName is deprecated, use Framework.GetResourceName instead.")
|
||||
return Framework.GetResourceName()
|
||||
end
|
||||
|
||||
---@description This will get the name of the in use resource.
|
||||
@@ -228,7 +229,6 @@ Framework.GetPlayerMetadata = function(src, metadata)
|
||||
return playerData.metadata[metadata] or false
|
||||
end
|
||||
|
||||
|
||||
---@description Adds the specified value to the player's stress level and updates the client HUD.
|
||||
---@param src number
|
||||
---@param value number
|
||||
@@ -268,7 +268,6 @@ Framework.AddHunger = function(src, value)
|
||||
local newHunger = (playerData.metadata.hunger or 0) + value
|
||||
player.Functions.SetMetaData('hunger', Math.Clamp(newHunger, 0, 100))
|
||||
TriggerClientEvent('hud:client:UpdateNeeds', src, newHunger, playerData.metadata.thirst)
|
||||
--TriggerClientEvent('hud:client:UpdateStress', src, newStress)
|
||||
return newHunger
|
||||
end
|
||||
|
||||
@@ -283,7 +282,6 @@ Framework.AddThirst = function(src, value)
|
||||
local newThirst = (playerData.metadata.thirst or 0) + value
|
||||
player.Functions.SetMetaData('thirst', Math.Clamp(newThirst, 0, 100))
|
||||
TriggerClientEvent('hud:client:UpdateNeeds', src, playerData.metadata.hunger, newThirst)
|
||||
--TriggerClientEvent('hud:client:UpdateStress', src, newStress)
|
||||
return newThirst
|
||||
end
|
||||
|
||||
@@ -303,7 +301,7 @@ end
|
||||
---@return boolean|nil
|
||||
Framework.GetIsPlayerDead = function(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return false end
|
||||
local playerData = player.PlayerData
|
||||
return playerData.metadata.isdead or playerData.metadata.inlaststand or false
|
||||
end
|
||||
@@ -318,13 +316,23 @@ Framework.RevivePlayer = function(src)
|
||||
return true
|
||||
end
|
||||
|
||||
--- @description This will get the hunger of a player
|
||||
--- @param src number
|
||||
--- @return number
|
||||
Framework.GetHunger = function(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return 0 end
|
||||
local playerData = player.PlayerData
|
||||
local newHunger = (playerData.metadata.hunger or 0)
|
||||
return math.floor((newHunger) + 0.5) or 0
|
||||
end
|
||||
|
||||
---@description This will get the thirst of a player
|
||||
---@param src any
|
||||
---@return number | nil
|
||||
Framework.GetThirst = function(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return 0 end
|
||||
local playerData = player.PlayerData
|
||||
local newThirst = (playerData.metadata.thirst or 0)
|
||||
return math.floor((newThirst) + 0.5) or 0
|
||||
@@ -364,10 +372,10 @@ end
|
||||
---@return string | string | string | number | nil
|
||||
---@return string | string | string | number | nil
|
||||
Framework.GetPlayerJob = function(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
|
||||
print("[Community Bridge] Warning: Framework.GetPlayerJob is deprecated, use Framework.GetPlayerJobData instead.")
|
||||
local jobData = Framework.GetPlayerJobData(src)
|
||||
if not jobData then return end
|
||||
return jobData.jobName, jobData.jobLabel, jobData.gradeName, jobData.gradeLevel
|
||||
end
|
||||
|
||||
---@description This will return the players job name, job label, job grade label job grade level, boss status,
|
||||
@@ -376,7 +384,7 @@ end
|
||||
---@return table | nil
|
||||
Framework.GetPlayerJobData = function(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return { } end
|
||||
local playerData = player.PlayerData
|
||||
local jobData = playerData.job
|
||||
return {
|
||||
@@ -395,7 +403,7 @@ end
|
||||
---@return boolean | nil
|
||||
Framework.GetPlayerDuty = function(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return false end
|
||||
local playerData = player.PlayerData
|
||||
if not playerData.job.onduty then return false end
|
||||
return true
|
||||
@@ -420,7 +428,7 @@ end
|
||||
---@return nil
|
||||
Framework.SetPlayerJob = function(src, name, grade)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return false end
|
||||
return player.Functions.SetJob(name, grade)
|
||||
end
|
||||
|
||||
@@ -431,8 +439,9 @@ end
|
||||
---@return boolean | nil
|
||||
Framework.AddAccountBalance = function(src, _type, amount)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return false end
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
if amount <= 0 then return false end
|
||||
return player.Functions.AddMoney(_type, amount)
|
||||
end
|
||||
|
||||
@@ -443,7 +452,7 @@ end
|
||||
---@return boolean | nil
|
||||
Framework.RemoveAccountBalance = function(src, _type, amount)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return false end
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
return player.Functions.RemoveMoney(_type, amount)
|
||||
end
|
||||
@@ -454,42 +463,66 @@ end
|
||||
---@return string | nil
|
||||
Framework.GetAccountBalance = function(src, _type)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return 0 end
|
||||
local playerData = player.PlayerData
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
return playerData.money[_type]
|
||||
end
|
||||
|
||||
---@description Adds the specified item to the player's inventory.
|
||||
---@description This will add an item, and return true or false based on success
|
||||
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param amount number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean | nil
|
||||
Framework.AddItem = function(src, item, amount, slot, metadata)
|
||||
---@param count number
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Framework.AddItem = function(src, item, count, slot, metadata)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
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)
|
||||
if not player then return false end
|
||||
local success = player.Functions.AddItem(item, count, slot, metadata)
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "add", item = item, count = count, slot = slot, metadata = metadata })
|
||||
return success
|
||||
end
|
||||
|
||||
---@description Removes the specified item from the player's inventory.
|
||||
---@description Internal function to search for items with specific metadata in player inventory
|
||||
---@param src number
|
||||
---@param metadata table
|
||||
---@return boolean, number|nil
|
||||
local function runMetadataSearch(src, metadata)
|
||||
local inv = Framework.GetPlayerInventory(src) or {}
|
||||
for k, v in pairs(inv) do
|
||||
if v.metadata and v.metadata == metadata then
|
||||
return true, v.slot
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
---@description This will remove an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param amount number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean | nil
|
||||
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
||||
---@param count number
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Framework.RemoveItem = function(src, item, count, slot, metadata)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
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)
|
||||
if not player then return false end
|
||||
if metadata then
|
||||
local found, itemSlot = runMetadataSearch(src, metadata)
|
||||
if found then
|
||||
slot = itemSlot
|
||||
end
|
||||
end
|
||||
local success = player.Functions.RemoveItem(item, count, slot)
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "remove", item = item, count = count, slot = slot, metadata = metadata })
|
||||
return success
|
||||
end
|
||||
|
||||
---@description Sets the metadata for the specified item in the player's inventory.
|
||||
---Notes, this is kinda a jank workaround. with the framework aside from updating the entire table theres not really a better way
|
||||
---@description This will set the metadata of an item in the inventory.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param slot number
|
||||
@@ -497,20 +530,92 @@ end
|
||||
---@return boolean | nil
|
||||
Framework.SetMetadata = function(src, item, slot, metadata)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local slotFinder = Framework.GetPlayerInventory(src)
|
||||
local freeSlot = Table.FindFirstUnoccupiedSlot(slotFinder)
|
||||
local itemSlot = slot or nil
|
||||
if itemSlot == nil then
|
||||
for _, v in pairs(slotFinder) do
|
||||
if v.name == item then
|
||||
slot = v.slot
|
||||
break
|
||||
if not player then return false end
|
||||
local success = Framework.RemoveItem(src, item, 1, slot, nil)
|
||||
if not success then return false end
|
||||
Framework.AddItem(src, item, 1, slot, metadata)
|
||||
end
|
||||
|
||||
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Framework.GetItemInfo = function(item)
|
||||
local itemData = QBCore.Shared.Items[item]
|
||||
if not itemData then return {} end
|
||||
return {
|
||||
name = itemData.name,
|
||||
label = itemData.label or itemData.name,
|
||||
stack = itemData.unique,
|
||||
weight = itemData.weight,
|
||||
description = itemData.description,
|
||||
image = itemData.image
|
||||
}
|
||||
end
|
||||
|
||||
---@description This will return the count of the item in the players inventory, if not found will return 0.
|
||||
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param metadata table (optional)
|
||||
---@return number
|
||||
Framework.GetItemCount = function(src, item, metadata)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return 0 end
|
||||
local playerData = player.PlayerData
|
||||
local playerInventory = playerData.items
|
||||
local count = 0
|
||||
for _, v in pairs(playerInventory) do
|
||||
if v.name == item and (not metadata or v.info == metadata) then
|
||||
count = count + (v.amount or v.count)
|
||||
end
|
||||
end
|
||||
return count
|
||||
end
|
||||
if not player.Functions.RemoveItem(item, 1, itemSlot) then return false end
|
||||
return player.Functions.AddItem(item, 1, slot, metadata)
|
||||
|
||||
---@description This will return a boolean if the player has the item.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Framework.HasItem = function(src, item, requiredCount)
|
||||
local getCount = Framework.GetItemCount(src, item, nil)
|
||||
return getCount >= (requiredCount or 1)
|
||||
end
|
||||
|
||||
---@description This wil return the players inventory.
|
||||
---@param src number
|
||||
---@return table
|
||||
Framework.GetPlayerInventory = function(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return {} end
|
||||
local playerData = player.PlayerData
|
||||
local playerInventory = playerData.items
|
||||
local repackedTable = {}
|
||||
for _, v in pairs(playerInventory) do
|
||||
table.insert(repackedTable, {
|
||||
name = v.name,
|
||||
count = v.amount or v.count,
|
||||
metadata = v.info,
|
||||
slot = v.slot,
|
||||
})
|
||||
end
|
||||
return repackedTable
|
||||
end
|
||||
|
||||
---@description Returns the specified slot data as a table.
|
||||
---@param src number
|
||||
---@param slot number
|
||||
---@return table {name, label, weight, count, metadata, slot, stack, description, image}
|
||||
Framework.GetItemBySlot = function(src, slot)
|
||||
local inventory = Framework.GetPlayerInventory(src)
|
||||
if not inventory or #inventory == 0 then return {} end
|
||||
for _, v in pairs(inventory) do
|
||||
if v.slot == slot then
|
||||
local itemInfo = Framework.GetItemInfo(v.name)
|
||||
return {v.name, itemInfo.label or v.name, itemInfo.weight or 0, v.count or 0, v.metadata or {}, v.slot, itemInfo.stack or false, itemInfo.description or "No description available", itemInfo.image or nil}
|
||||
end
|
||||
end
|
||||
return {}
|
||||
end
|
||||
|
||||
---@description This will get all owned vehicles for the player
|
||||
@@ -541,6 +646,8 @@ Framework.RegisterUsableItem = function(itemName, cb)
|
||||
QBCore.Functions.CreateUseableItem(itemName, func)
|
||||
end
|
||||
|
||||
---@description Event handler for when a player is loaded in QB-Core framework
|
||||
---@param src number
|
||||
RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
|
||||
src = src or source
|
||||
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
|
||||
@@ -549,23 +656,37 @@ RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
|
||||
Framework.AddJobCount(src, jobData.jobName)
|
||||
end)
|
||||
|
||||
---@description Event handler for when a player is unloaded in QB-Core framework
|
||||
---@param src number
|
||||
RegisterNetEvent("QBCore:Server:OnPlayerUnload", function(src)
|
||||
src = src or source
|
||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||
end)
|
||||
|
||||
---@description Event handler for when a player's job is updated in QB-Core framework
|
||||
---@param src number
|
||||
---@param job table
|
||||
RegisterNetEvent("QBCore:Server:OnJobUpdate", function(src, job)
|
||||
src = src or source
|
||||
if not job then return end
|
||||
TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name)
|
||||
end)
|
||||
|
||||
---@description Event handler for when a player disconnects from the server
|
||||
AddEventHandler("playerDropped", function()
|
||||
local src = source
|
||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||
end)
|
||||
|
||||
Framework.Commands = {}
|
||||
---@description Adds a command to the QB-Core framework
|
||||
---@param name string
|
||||
---@param help string
|
||||
---@param arguments table
|
||||
---@param argsrequired boolean
|
||||
---@param callback function
|
||||
---@param permission string
|
||||
---@param ... any
|
||||
Framework.Commands.Add = function(name, help, arguments, argsrequired, callback, permission, ...)
|
||||
QBCore.Commands.Add(name, help, arguments, argsrequired, callback, permission, ...)
|
||||
end
|
||||
|
||||
@@ -5,10 +5,11 @@ QBox = exports.qbx_core
|
||||
|
||||
Framework = Framework or {}
|
||||
|
||||
---This will get the name of the framework being used (if a supported framework).
|
||||
---@description This will get the name of the framework being used (if a supported framework).
|
||||
---@return string
|
||||
Framework.GetFrameworkName = function()
|
||||
return 'qbx_core'
|
||||
print("This is depricated, please use Framework.GetResourceName() instead.")
|
||||
return Framework.GetResourceName()
|
||||
end
|
||||
|
||||
---@description This will get the name of the in use resource.
|
||||
@@ -17,15 +18,13 @@ Framework.GetResourceName = function()
|
||||
return 'qbx_core'
|
||||
end
|
||||
|
||||
---@description This will return true if the player is loaded, false otherwise. This could be useful in scripts
|
||||
---that rely on player loaded events and offer a debug mode to hit this function.
|
||||
---@description This will return true if the player is loaded, false otherwise.
|
||||
---@return boolean
|
||||
Framework.GetIsPlayerLoaded = function()
|
||||
return LocalPlayer.state.isLoggedIn or false
|
||||
end
|
||||
|
||||
---@description This will return a table of the player data, this will be in the framework format
|
||||
---This is mainly for internal bridge use and should be avoided.
|
||||
---@description This is an internal function, do not use this outside of bridge as there is no standard format between the frameworks.
|
||||
---@return table
|
||||
Framework.GetPlayerData = function()
|
||||
return QBox.GetPlayerData()
|
||||
@@ -44,7 +43,7 @@ Framework.GetPlayerDob = function()
|
||||
return playerData.charinfo.birthdate
|
||||
end
|
||||
|
||||
---@description This will display the help text message on the screen
|
||||
---@description Will Display the help text message on the screen
|
||||
---@param message string
|
||||
---@param position string
|
||||
---@return nil
|
||||
@@ -102,18 +101,18 @@ Framework.GetPlayerName = function()
|
||||
return playerData.charinfo.firstname, playerData.charinfo.lastname
|
||||
end
|
||||
|
||||
---@deprecated Deprecated: This will return the players job name, job label, job grade label and job grade level
|
||||
---@description Depricated : This will return the players job name, job label, job grade label and job grade level
|
||||
---@return string
|
||||
---@return string
|
||||
---@return string
|
||||
---@return string
|
||||
Framework.GetPlayerJob = function()
|
||||
local playerData = Framework.GetPlayerData()
|
||||
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
|
||||
print("This is depricated, please use Framework.GetPlayerJobData() instead.")
|
||||
local jobData = Framework.GetPlayerJobData()
|
||||
return jobData.jobName, jobData.jobLabel, jobData.gradeName, jobData.gradeRank
|
||||
end
|
||||
|
||||
---@description This will return the players job name, job label, job grade label job grade level, boss status,
|
||||
---and duty status in a table
|
||||
---@description This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
|
||||
---@return table
|
||||
Framework.GetPlayerJobData = function()
|
||||
local playerData = Framework.GetPlayerData()
|
||||
@@ -129,14 +128,14 @@ Framework.GetPlayerJobData = function()
|
||||
}
|
||||
end
|
||||
|
||||
---@description This will return the players inventory as a table in the ox_inventory style flormat.
|
||||
---@return table
|
||||
---@description This is an internal function used as a fallback, please use the Inventory.GetPlayerInventory instead.
|
||||
---@return table {name, label, count, slot, metadata, stack, close, weight}
|
||||
Framework.GetPlayerInventory = function()
|
||||
return Framework.GetPlayerData().items
|
||||
end
|
||||
|
||||
---@description This will return the players money by type, I recommend not using this
|
||||
---as its the client and not secure or to be trusted. Use case is for a ui or a menu I guess.
|
||||
---@description This will return the players money by type, I recommend not useing this as its the client and not secure or to be trusted.
|
||||
---Use case is for a ui or a menu I guess.
|
||||
---@param _type string
|
||||
---@return number
|
||||
Framework.GetAccountBalance = function(_type)
|
||||
@@ -144,46 +143,31 @@ Framework.GetAccountBalance = function(_type)
|
||||
if not player then return 0 end
|
||||
local account = player.money
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
return account[_type] or 0
|
||||
local balance = account[_type] or 0
|
||||
if balance <= 0 then return 0 end
|
||||
return balance
|
||||
end
|
||||
|
||||
---@description This will return the vehicle properties for the specified vehicle.
|
||||
---@param vehicle number
|
||||
---@return table
|
||||
Framework.GetVehicleProperties = function(vehicle)
|
||||
if not vehicle or not DoesEntityExist(vehicle) then return {} end
|
||||
local vehicleProps = lib.getVehicleProperties(vehicle)
|
||||
return vehicleProps or {}
|
||||
end
|
||||
|
||||
---@description This will set the vehicle properties for the specified vehicle.
|
||||
---@param vehicle number
|
||||
---@param properties table
|
||||
---@return boolean
|
||||
Framework.SetVehicleProperties = function(vehicle, properties)
|
||||
if not vehicle or not DoesEntityExist(vehicle) then return false end
|
||||
if not properties then return false end
|
||||
if NetworkGetEntityIsNetworked(vehicle) then
|
||||
local vehNetID = NetworkGetNetworkIdFromEntity(vehicle)
|
||||
local entOwner = GetPlayerServerId(NetworkGetEntityOwner(vehNetID))
|
||||
if entOwner ~= GetPlayerServerId(PlayerId()) then
|
||||
NetworkRequestControlOfEntity(vehicle)
|
||||
local count = 0
|
||||
while not NetworkHasControlOfEntity(vehicle) and count < 3000 do
|
||||
Wait(1)
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return true, lib.setVehicleProperties(vehicle, properties)
|
||||
end
|
||||
|
||||
---@description This will return the item count for the specified item in the players inventory.
|
||||
---@description This is an internal function used as a fallback, please use the Inventory.GetItemCount instead.
|
||||
--- @param item string
|
||||
--- @return number
|
||||
Framework.GetItemCount = function(item)
|
||||
-- This seems to be exclusively for ox_inventory, if other inventories are used, they need to be bridged in the inventory module. Until then we will return 0 and a print.
|
||||
return 0, print("Community_bridge:WARN: GetItemCount is not implemented for this framework, please use the inventory module to get the item count. If you are using a diffrent inventory please let us know so we can bridge it and have less nonsense.")
|
||||
return 0, print("Qbox has not implemented GetItemCount for this framework. Please ensure the inventory you are using is supported and start order is correct.")
|
||||
end
|
||||
|
||||
---@description This will return the item data for the specified item.
|
||||
--- @param item string
|
||||
--- @return table {name, label, stack, weight, description, image}
|
||||
Framework.GetItemInfo = function(item)
|
||||
return {}, print("Qbox has not implemented GetItemInfo for this framework. Please ensure the inventory you are using is supported and start order is correct.")
|
||||
end
|
||||
|
||||
---@description Will return boolean if the player has the item.
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Framework.HasItem = function(item, requiredCount)
|
||||
return false, print("Qbox has not implemented HasItem for this framework, Please ensure the inventory you are using is supported and start order is correct.")
|
||||
end
|
||||
|
||||
---@description This will get a players dead status.
|
||||
@@ -193,15 +177,19 @@ Framework.GetIsPlayerDead = function()
|
||||
return playerData.metadata["isdead"] or playerData.metadata["inlaststand"]
|
||||
end
|
||||
|
||||
---@description Event handler for when player is loaded in QBX Core framework
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
||||
Wait(1500)
|
||||
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
|
||||
end)
|
||||
|
||||
---@description Event handler for when player is unloaded in QBX Core framework
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
|
||||
TriggerEvent('community_bridge:Client:OnPlayerUnload')
|
||||
end)
|
||||
|
||||
---@description Event handler for when player job is updated in QBX Core framework
|
||||
---@param data table Job data containing name, label, and grade information
|
||||
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(data)
|
||||
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', data.name, data.label, data.grade.name, data.grade.level)
|
||||
end)
|
||||
|
||||
@@ -5,7 +5,7 @@ Framework = Framework or {}
|
||||
|
||||
local QBox = exports.qbx_core
|
||||
|
||||
---Returns the name of the framework being used (if a supported framework).
|
||||
---@description Returns the name of the framework being used (if a supported framework).
|
||||
---@return string
|
||||
Framework.GetFrameworkName = function()
|
||||
return 'qbx_core'
|
||||
@@ -18,7 +18,7 @@ Framework.GetResourceName = function()
|
||||
end
|
||||
|
||||
---@description This will return if the player is an admin in the framework.
|
||||
---@param src any
|
||||
---@param src number
|
||||
---@return boolean
|
||||
Framework.GetIsFrameworkAdmin = function(src)
|
||||
if not src then return false end
|
||||
@@ -83,62 +83,110 @@ Framework.GetPlayerName = function(src)
|
||||
return playerData.charinfo.firstname, playerData.charinfo.lastname
|
||||
end
|
||||
|
||||
---@description Adds the specified item to the player's inventory.
|
||||
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param amount number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean | nil
|
||||
Framework.AddItem = function(src, item, amount, slot, metadata)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return false end
|
||||
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
|
||||
|
||||
---@description Removes the specified item from the player's inventory.
|
||||
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param amount number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean | nil
|
||||
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return false end
|
||||
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
|
||||
|
||||
---@description Sets the metadata for the specified item in the player's inventory.
|
||||
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean | nil
|
||||
Framework.SetMetadata = function(src, item, slot, metadata)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return false end
|
||||
player.Functions.RemoveItem(item, 1, slot)
|
||||
return player.Functions.AddItem(item, 1, slot, metadata)
|
||||
end
|
||||
|
||||
---@description Returns a table of items matching the specified name and if passed metadata from the player's inventory.
|
||||
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
---returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param metadata table
|
||||
---@return table|nil {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
|
||||
Framework.GetItem = function(src, item, metadata)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerInventory = player.PlayerData.items
|
||||
if not player then return { } end
|
||||
local repackedTable = {}
|
||||
for _, v in pairs(playerInventory) do
|
||||
for _, v in pairs(player.PlayerData.items) do
|
||||
if v.name == item and (not metadata or v.info == metadata) then
|
||||
table.insert(repackedTable, {
|
||||
repackedTable[#repackedTable + 1] = {
|
||||
name = v.name,
|
||||
count = v.amount,
|
||||
metadata = v.info,
|
||||
count = v.amount or v.count,
|
||||
metadata = v.info or v.metadata,
|
||||
slot = v.slot,
|
||||
})
|
||||
}
|
||||
end
|
||||
end
|
||||
return repackedTable
|
||||
end
|
||||
|
||||
---@description Returns the count of items matching the specified name and if passed metadata from the player's inventory.
|
||||
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param metadata table
|
||||
---@return number | nil
|
||||
Framework.GetItemCount = function(src, item, metadata)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return 0 end
|
||||
local playerInventory = player.PlayerData.items
|
||||
local count = 0
|
||||
for _, v in pairs(playerInventory) do
|
||||
if v.name == item and (not metadata or v.info == metadata) then
|
||||
count = count + v.amount
|
||||
count = count + (v.amount or v.count)
|
||||
end
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
---@description Returns boolean if the player has the specified item in their inventory.
|
||||
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@return boolean
|
||||
Framework.HasItem = function(src, item)
|
||||
local getCount = Framework.GetItemCount(src, item, nil)
|
||||
local getCount = Framework.GetItemCount(src, item)
|
||||
return getCount > 0
|
||||
end
|
||||
|
||||
---@description Returns the entire inventory of the player as a table.
|
||||
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||
---@param src number
|
||||
---@return table | nil
|
||||
Framework.GetPlayerInventory = function(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return { } end
|
||||
local playerItems = player.PlayerData.items
|
||||
local repackedTable = {}
|
||||
for _, v in pairs(playerItems) do
|
||||
@@ -236,7 +284,7 @@ end
|
||||
---@return number | nil
|
||||
Framework.GetHunger = function(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return 0 end
|
||||
local playerData = player.PlayerData
|
||||
local newHunger = (playerData.metadata.hunger or 0)
|
||||
return math.floor((newHunger) + 0.5) or 0
|
||||
@@ -247,7 +295,7 @@ end
|
||||
---@return boolean|nil
|
||||
Framework.GetIsPlayerDead = function(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return false end
|
||||
local playerData = player.PlayerData
|
||||
return playerData.metadata.isdead or false
|
||||
end
|
||||
@@ -267,7 +315,7 @@ end
|
||||
---@return number| nil
|
||||
Framework.GetThirst = function(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if not player then return 0 end
|
||||
local playerData = player.PlayerData
|
||||
local newThirst = (playerData.metadata.thirst or 0)
|
||||
return math.floor((newThirst) + 0.5) or 0
|
||||
@@ -298,7 +346,8 @@ Framework.GetPlayersByJob = function(job)
|
||||
return Framework.GetPlayerSourcesByJob(job) or {}
|
||||
end
|
||||
|
||||
---@Deprecated Deprecated: Returns the job name, label, grade name, and grade level of the player.
|
||||
---@description Depricated: Returns the job name, label, grade name, and grade level of the player.
|
||||
---Please use GetPlayerJobData instead.
|
||||
---@param src number
|
||||
---@return string | string | string | number | nil
|
||||
---@return string | string | string | number | nil
|
||||
@@ -308,6 +357,7 @@ Framework.GetPlayerJob = function(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
print("This function is depricated, please use GetPlayerJobData instead.")
|
||||
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
|
||||
end
|
||||
|
||||
@@ -372,6 +422,7 @@ Framework.AddAccountBalance = function(src, _type, amount)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
if amount <= 0 then return false end
|
||||
return player.Functions.AddMoney(_type, amount)
|
||||
end
|
||||
|
||||
@@ -384,6 +435,7 @@ Framework.RemoveAccountBalance = function(src, _type, amount)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
if amount <= 0 then return false end
|
||||
return player.Functions.RemoveMoney(_type, amount)
|
||||
end
|
||||
|
||||
@@ -396,48 +448,9 @@ Framework.GetAccountBalance = function(src, _type)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
return playerData.money[_type]
|
||||
end
|
||||
|
||||
---@description Adds the specified item to the player's inventory.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param amount number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean | nil
|
||||
Framework.AddItem = function(src, item, amount, slot, metadata)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
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
|
||||
|
||||
---@description Removes the specified item from the player's inventory.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param amount number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean | nil
|
||||
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
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
|
||||
|
||||
---@description Sets the metadata for the specified item in the player's inventory.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean | nil
|
||||
Framework.SetMetadata = function(src, item, slot, metadata)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
player.Functions.RemoveItem(item, 1, slot)
|
||||
return player.Functions.AddItem(item, 1, slot, metadata)
|
||||
local balance = playerData.money[_type] or 0
|
||||
if balance <= 0 then return 0 end
|
||||
return balance
|
||||
end
|
||||
|
||||
---@description Returns a table of owned vehicles for the player. format is {vehicle = vehicle, plate = plate}
|
||||
@@ -469,6 +482,8 @@ Framework.RegisterUsableItem = function(itemName, cb)
|
||||
return QBox:CreateUseableItem(itemName, func)
|
||||
end
|
||||
|
||||
---@description Event handler for when a player is loaded in QBX Core framework
|
||||
---@param src number
|
||||
RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
|
||||
src = src or source
|
||||
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
|
||||
@@ -477,17 +492,23 @@ RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
|
||||
Framework.AddJobCount(src, jobData.jobName)
|
||||
end)
|
||||
|
||||
---@description Event handler for when a player is unloaded in QBX Core framework
|
||||
---@param src number
|
||||
RegisterNetEvent("QBCore:Server:OnPlayerUnload", function(src)
|
||||
src = src or source
|
||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||
end)
|
||||
|
||||
---@description Event handler for when a player's job is updated in QBX Core framework
|
||||
---@param src number
|
||||
---@param job table
|
||||
RegisterNetEvent("QBCore:Server:OnJobUpdate", function(src, job)
|
||||
src = src or source
|
||||
if not job then return end
|
||||
TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name)
|
||||
end)
|
||||
|
||||
---@description Event handler for when a player disconnects from the server
|
||||
AddEventHandler("playerDropped", function()
|
||||
local src = source
|
||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||
|
||||
@@ -5,8 +5,6 @@ if (configValue == "auto" and GetResourceState(resourceName) == "missing") or (c
|
||||
|
||||
Input = {}
|
||||
|
||||
if not lib then Require('init.lua', 'ox_lib') end
|
||||
|
||||
function Input.Open(title, data, isQBFormat, submitText)
|
||||
local inputs = data.inputs
|
||||
if isQBFormat then
|
||||
|
||||
@@ -1,40 +1,41 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
Inventory = Inventory or {}
|
||||
|
||||
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "default"
|
||||
end
|
||||
|
||||
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
return Framework.GetItemInfo(item)
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "default"
|
||||
end
|
||||
|
||||
---Will return boolean if the player has the item.
|
||||
---@description Will return boolean if the player has the item.
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(item)
|
||||
return Framework.HasItem(item)
|
||||
Inventory.HasItem = function(item, requiredCount)
|
||||
return Framework.HasItem(item, requiredCount)
|
||||
end
|
||||
|
||||
---This will return th count of the item in the players inventory, if not found will return 0.
|
||||
---@description This will return their count of the item in the players inventory, if not found will return 0.
|
||||
---@param item string
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(item)
|
||||
return Framework.GetItemCount(item)
|
||||
end
|
||||
|
||||
---This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@description This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function()
|
||||
return Framework:GetPlayerInventory()
|
||||
end
|
||||
|
||||
---This will get the image path for this item, if not found will return placeholder.
|
||||
---@description This will get the image path for this item, if not found will return placeholder.
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -42,8 +43,7 @@ Inventory.GetImagePath = function(item)
|
||||
return "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---This will remove the file extension from the item name if present.
|
||||
---example: "item.png" will become "item"
|
||||
---@description This will remove the file extension from the item name if present.
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.StripPNG = function(item)
|
||||
@@ -53,8 +53,7 @@ Inventory.StripPNG = function(item)
|
||||
return item
|
||||
end
|
||||
|
||||
---This will remove the file extension from the item name if present.
|
||||
---example: "item.webp" will become "item"
|
||||
---@description This will remove the file extension from the item name if present.
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.StripWebp = function(item)
|
||||
@@ -64,7 +63,7 @@ Inventory.StripWebp = function(item)
|
||||
return item
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
if not Framework.Shared or not Framework.Shared.Items then
|
||||
@@ -74,6 +73,4 @@ Inventory.Items = function()
|
||||
return Framework.Shared.Items
|
||||
end
|
||||
|
||||
|
||||
|
||||
return Inventory
|
||||
@@ -1,7 +1,14 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
Inventory = Inventory or {}
|
||||
Inventory.Stashes = Inventory.Stashes or {}
|
||||
|
||||
---This will add an item, and return true or false based on success
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "default"
|
||||
end
|
||||
|
||||
---@description This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
@@ -9,18 +16,13 @@ Inventory = Inventory or {}
|
||||
---@param metadata table
|
||||
---@return boolean
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
local success = Framework.AddItem(src, item, count, slot, metadata)
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return Framework.AddItem(src, item, count, slot, metadata)
|
||||
return success
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "default"
|
||||
end
|
||||
|
||||
|
||||
---This will remove an item, and return true or false based on success
|
||||
---@description This will remove an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
@@ -29,36 +31,36 @@ end
|
||||
---@return boolean
|
||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||
item = type(item) == "table" and item.name or item
|
||||
local success = Framework.RemoveItem(src, item, count, slot, metadata)
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return Framework.RemoveItem(src, item, count, slot, metadata)
|
||||
return success
|
||||
end
|
||||
|
||||
---This will add items to a trunk, and return true or false based on success
|
||||
---@description This will add items to a trunk, and return true or false based on success
|
||||
---@param identifier string
|
||||
---@param items table
|
||||
---@return boolean
|
||||
Inventory.AddTrunkItems = function(identifier, items)
|
||||
return false, Prints.Error("This Inventory Has Not Been Bridged For A Trunk Feature.")
|
||||
return false, print("This Inventory Has Not Been Bridged For A Trunk Feature.")
|
||||
end
|
||||
|
||||
---This will clear the specified inventory, will return success or failure.
|
||||
---@description This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param id string
|
||||
---@return boolean
|
||||
Inventory.ClearStash = function(id, _type)
|
||||
if type(id) ~= "string" then return false end
|
||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
||||
return false, Prints.Error("This Inventory Has Not Been Bridged For A ClearStash Feature.")
|
||||
return false, print("This Inventory Has Not Been Bridged For A ClearStash Feature.")
|
||||
end
|
||||
|
||||
---This will return a table with the item info,
|
||||
---example: {name = "coolitem", label = "a cool item name", stack = false, weight = 1000, description = "some item description", image = "coolitem.png"}
|
||||
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
return Framework.GetItemInfo(item)
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
if not Framework.Shared or not Framework.Shared.Items then
|
||||
@@ -68,35 +70,31 @@ Inventory.Items = function()
|
||||
return Framework.Shared.Items
|
||||
end
|
||||
|
||||
---This will return the count of the item in the players inventory, if not found will return 0.
|
||||
---if metadata is passed it will find the matching items count.
|
||||
---example: 0
|
||||
---@description This will return the count of the item in the players inventory, if not found will return 0.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param metadata table
|
||||
---@param metadata table (optional)
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(src, item, metadata)
|
||||
return Framework.GetItemCount(src, item, metadata)
|
||||
end
|
||||
|
||||
---This wil return the players inventory.
|
||||
---example: {{weight = 10, name = "farts", metadata = {description = "this is a description"}, slot = 1, label = "stinky", count = 1}, {weight = 10, name = "farts", metadata = {description = "this is a description"}, slot = 2, label = "stinky", count = 1}}
|
||||
---@description This wil return the players inventory.
|
||||
---@param src number
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function(src)
|
||||
return Framework.GetPlayerInventory(src)
|
||||
end
|
||||
|
||||
---Returns the specified slot data as a table.
|
||||
---example {weight = 10, name = "farts", metadata = {description = "this is a description"}, slot = 1, label = "stinky", count = 1}
|
||||
---@description Returns the specified slot data as a table.
|
||||
---@param src number
|
||||
---@param slot number
|
||||
---@return table
|
||||
---@return table {weight, name, metadata, slot, label, count}
|
||||
Inventory.GetItemBySlot = function(src, slot)
|
||||
return Framework.GetItemBySlot(src, slot)
|
||||
end
|
||||
|
||||
---This will set the metadata of an item in the inventory.
|
||||
---@description This will set the metadata of an item in the inventory.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param slot number
|
||||
@@ -106,74 +104,65 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
|
||||
return Framework.SetMetadata(src, item, slot, metadata)
|
||||
end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@description This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number|string
|
||||
---@param _type string "stash", "trunk", "glovebox"
|
||||
---@param id string
|
||||
---@return nil
|
||||
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.")
|
||||
return false, print("This Inventory Has Not Been Bridged For A Stash Feature.")
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
---@description This will register a stash
|
||||
---@param id number|string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@param owner string (optional)
|
||||
---@param groups table (optional)
|
||||
---@param coords table (optional)
|
||||
---@return boolean
|
||||
---@return string|number
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
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
|
||||
}
|
||||
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.
|
||||
---@description This will return a boolean if the player has the item.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(src, item)
|
||||
return Framework.HasItem(src, item)
|
||||
Inventory.HasItem = function(src, item, requiredCount)
|
||||
return Framework.HasItem(src, item, requiredCount)
|
||||
end
|
||||
|
||||
---This is to get if there is available space in the inventory, will return boolean.
|
||||
---@description This is to get if there is available space in the inventory, will return boolean.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@return boolean
|
||||
Inventory.CanCarryItem = function(src, item, count)
|
||||
return false, Prints.Error("This Inventory Has Not Been Bridged For A CanCarryItem Feature.")
|
||||
return true, print("This Inventory Has Not Been Bridged For A CanCarryItem Feature.")
|
||||
end
|
||||
|
||||
---This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@description This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@param oldplate string
|
||||
---@param newplate string
|
||||
---@return boolean
|
||||
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
return false, Prints.Error("This Inventory Has Not Been Bridged For A UpdatePlate Feature.")
|
||||
return false, print("This Inventory Has Not Been Bridged For A UpdatePlate Feature.")
|
||||
end
|
||||
|
||||
-- This will open the specified shop for the src passed.
|
||||
---@description This will open the specified shop for the src passed.
|
||||
---@param src number
|
||||
---@param shopTitle string
|
||||
Inventory.OpenShop = function(src, shopTitle)
|
||||
return Bridge.Shops.OpenShop(src, shopTitle)
|
||||
end
|
||||
|
||||
-- This will register a shop, if it already exists it will return true.
|
||||
---@description This will register a shop, if it already exists it will return true.
|
||||
---@param shopTitle string
|
||||
---@param shopInventory table
|
||||
---@param shopCoords table
|
||||
@@ -182,14 +171,14 @@ Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGrou
|
||||
return Bridge.Shops.CreateShop(shopTitle, shopInventory, shopCoords, shopGroups)
|
||||
end
|
||||
|
||||
---This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
return "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---This will remove the file extension from the item name if present.
|
||||
---@description This will remove the file extension from the item name if present.
|
||||
---example: "item.png" will become "item"
|
||||
---@param item string
|
||||
---@return string
|
||||
@@ -200,7 +189,7 @@ Inventory.StripPNG = function(item)
|
||||
return item
|
||||
end
|
||||
|
||||
---This will remove the file extension from the item name if present.
|
||||
---@description This will remove the file extension from the item name if present.
|
||||
---example: "item.webp" will become "item"
|
||||
---@param item string
|
||||
---@return string
|
||||
@@ -211,8 +200,12 @@ Inventory.StripWebp = function(item)
|
||||
return item
|
||||
end
|
||||
|
||||
---@description Opens another player's inventory for inspection/interaction
|
||||
---@param src number The source player who is opening the inventory
|
||||
---@param targetSrc number The target player whose inventory is being opened
|
||||
---@return boolean
|
||||
Inventory.OpenPlayerInventory = function(src, targetSrc)
|
||||
return false, Prints.Error("OpenPlayerInventory is not implemented in this inventory, because of this we dont have a way to open a players inventory.")
|
||||
return false, print("OpenPlayerInventory is not implemented in this inventory, because of this we dont have a way to open a players inventory.")
|
||||
end
|
||||
|
||||
return Inventory
|
||||
@@ -1,22 +1,16 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('codem-inventory') ~= 'started' then return end
|
||||
if GetResourceState('codem-inventory') == 'missing' then return end
|
||||
Inventory = Inventory or {}
|
||||
|
||||
local codem = exports['codem-inventory']
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "codem-inventory"
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return codem:GetItemList() or {}
|
||||
end
|
||||
|
||||
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -33,28 +27,34 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will get the image path for this item, if not found will return placeholder.
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return codem:GetItemList() or {}
|
||||
end
|
||||
|
||||
---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
item = Inventory.StripPNG(item)
|
||||
local file = LoadResourceFile("codem-inventory", string.format("html/images/%s.png", item))
|
||||
local imagePath = file and string.format("nui://codem-inventory/html/images/%s.png", item)
|
||||
local file = LoadResourceFile("codem-inventory", string.format("html/itemimages/%s.png", item))
|
||||
local imagePath = file and string.format("nui://codem-inventory/html/itemimages/%s.png", item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@description This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function()
|
||||
local items = {}
|
||||
local inventory = codem:getUserInventory()
|
||||
local inventory = codem:GetClientPlayerInventory()
|
||||
for _, v in pairs(inventory) do
|
||||
table.insert(items, {
|
||||
name = v.name,
|
||||
label = v.label,
|
||||
count = v.amount,
|
||||
count = v.amount or v.count,
|
||||
slot = v.slot,
|
||||
metadata = v.info,
|
||||
metadata = v.info or v.metadata or {},
|
||||
stack = v.unique,
|
||||
close = v.useable,
|
||||
weight = v.weight
|
||||
@@ -63,9 +63,4 @@ Inventory.GetPlayerInventory = function()
|
||||
return items
|
||||
end
|
||||
|
||||
RegisterNetEvent('community_bridge:client:codem-inventory:openStash', function(id, data)
|
||||
if source ~= 65535 then return end
|
||||
TriggerServerEvent('codem-inventory:server:openstash', id, data.slots, data.weight, data.label)
|
||||
end)
|
||||
|
||||
return Inventory
|
||||
@@ -1,29 +1,45 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('codem-inventory') ~= 'started' then return end
|
||||
if GetResourceState('codem-inventory') == 'missing' then return end
|
||||
|
||||
Inventory = Inventory or {}
|
||||
Inventory.Stashes = Inventory.Stashes or {}
|
||||
|
||||
local codem = exports['codem-inventory']
|
||||
|
||||
---This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean
|
||||
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
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "codem-inventory"
|
||||
end
|
||||
|
||||
---@description This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
local success = codem:AddItem(src, item, count, slot, metadata)
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return success
|
||||
end
|
||||
|
||||
---@description Internal function to search for items with specific metadata in player inventory
|
||||
---@param src number
|
||||
---@param metadata table
|
||||
---@return boolean, number|nil
|
||||
local function runMetadataSearch(src, metadata)
|
||||
local inv = Framework.GetPlayerInventory(src) or {}
|
||||
for _, v in pairs(inv) do
|
||||
if v.metadata and v.metadata == metadata then
|
||||
return true, v.slot
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
---This will remove an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
@@ -32,17 +48,17 @@ end
|
||||
---@param metadata table
|
||||
---@return boolean
|
||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||
if metadata then
|
||||
local found, foundSlot = runMetadataSearch(src, metadata)
|
||||
if found then slot = foundSlot end
|
||||
end
|
||||
local success = codem:RemoveItem(src, item, count, slot)
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return codem:RemoveItem(src, item, count, slot)
|
||||
return success
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return codem:GetItemList() or {}
|
||||
end
|
||||
|
||||
---This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -58,7 +74,22 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This wil return the players inventory.
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return codem:GetItemList() or {}
|
||||
end
|
||||
|
||||
---@description This will return the count of the item in the players inventory, if not found will return 0.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param metadata table (optional)
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(src, item, metadata)
|
||||
return codem:GetItemsTotalAmount(src, item) or 0
|
||||
end
|
||||
|
||||
---@description This wil return the players inventory.
|
||||
---@param src number
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function(src)
|
||||
@@ -68,19 +99,18 @@ Inventory.GetPlayerInventory = function(src)
|
||||
for _, v in pairs(playerItems) do
|
||||
table.insert(repackedTable, {
|
||||
name = v.name,
|
||||
count = v.amount,
|
||||
metadata = v.info,
|
||||
count = v.amount or v.count,
|
||||
metadata = v.info or v.metadata or {},
|
||||
slot = v.slot,
|
||||
})
|
||||
end
|
||||
return repackedTable
|
||||
end
|
||||
|
||||
---Returns the specified slot data as a table.
|
||||
---format {weight, name, metadata, slot, label, count}
|
||||
---@description Returns the specified slot data as a table.
|
||||
---@param src number
|
||||
---@param slot number
|
||||
---@return table
|
||||
---@return table {weight, name, metadata, slot, label, count}
|
||||
Inventory.GetItemBySlot = function(src, slot)
|
||||
local slotData = codem:GetItemBySlot(src, slot)
|
||||
if not slotData then return {} end
|
||||
@@ -90,13 +120,13 @@ Inventory.GetItemBySlot = function(src, slot)
|
||||
weight = slotData.weight,
|
||||
slot = slotData.slot,
|
||||
count = slotData.amount or slotData.count,
|
||||
metadata = slotData.info or slotData.metadata,
|
||||
stack = slotData.unique,
|
||||
metadata = slotData.info or slotData.metadata or {},
|
||||
stack = slotData.unique or false,
|
||||
description = slotData.description
|
||||
}
|
||||
end
|
||||
|
||||
---This will set the metadata of an item in the inventory.
|
||||
---@description This will set the metadata of an item in the inventory.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param slot number
|
||||
@@ -106,103 +136,57 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
|
||||
return codem:SetItemMetadata(src, slot, metadata)
|
||||
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, _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
|
||||
|
||||
|
||||
---This will register a stash
|
||||
---@param id number|string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string|number
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
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.
|
||||
---@description This will return a boolean if the player has the item.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(src, item)
|
||||
return codem:HasItem(src, item, 1)
|
||||
Inventory.HasItem = function(src, item, requiredCount)
|
||||
return codem:HasItem(src, item, requiredCount or 1)
|
||||
end
|
||||
|
||||
---This is to get if there is available space in the inventory, will return boolean.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@return boolean
|
||||
Inventory.CanCarryItem = function(src, item, count)
|
||||
return true
|
||||
end
|
||||
|
||||
---This will add items to a trunk, and return true or false based on success
|
||||
---If a trunk with the identifier does not exist, it will create one with default values.
|
||||
---@param identifier string
|
||||
---@param items table
|
||||
---@return boolean
|
||||
Inventory.AddTrunkItems = function(identifier, items)
|
||||
if type(items) ~= "table" then return false end
|
||||
return false, print("AddItemsToTrunk is not implemented in codem-inventory, because of this we dont have a way to add items to a trunk.")
|
||||
end
|
||||
|
||||
---This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@description This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param id string
|
||||
---@param _type string unused with ox_inventory
|
||||
---@return boolean
|
||||
Inventory.ClearStash = function(id, _type)
|
||||
if type(id) ~= "string" then return false end
|
||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
||||
return false, print("ClearInventory is not implemented in codem-inventory, because of this we dont have a way to clear a stash.")
|
||||
codem:UpdateStash(id, {})
|
||||
return true
|
||||
end
|
||||
|
||||
---This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@param oldplate string
|
||||
---@param newplate string
|
||||
---@description This will add items to a stash, and return true or false based on success
|
||||
---@param id string
|
||||
---@param items table {item, count, metadata}
|
||||
---@return boolean
|
||||
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
return false, print("Unable to update plate for codem-inventory, I do not have access to a copy of this inventory to bridge the feature.")
|
||||
Inventory.AddStashItems = function(id, items)
|
||||
if type(items) ~= "table" then return false end
|
||||
local repack = {}
|
||||
for _, v in pairs(items) do
|
||||
table.insert(repack, {
|
||||
item = v.item,
|
||||
amount = v.count or v.amount,
|
||||
info = v.metadata or v.info or {},
|
||||
unique = v.unique or v.stack or false,
|
||||
description = v.description or "none",
|
||||
weight = Inventory.GetItemInfo(v.item).weight or 0,
|
||||
type = 'item',
|
||||
slot = #repack + 1,
|
||||
})
|
||||
end
|
||||
codem:UpdateStash(id, repack)
|
||||
return true
|
||||
end
|
||||
|
||||
---This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
item = Inventory.StripPNG(item)
|
||||
local file = LoadResourceFile("codem-inventory", string.format("html/images/%s.png", item))
|
||||
local imagePath = file and string.format("nui://codem-inventory/html/images/%s.png", item)
|
||||
local file = LoadResourceFile("codem-inventory", string.format("html/itemimages/%s.png", item))
|
||||
local imagePath = file and string.format("nui://codem-inventory/html/itemimages/%s.png", item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
Inventory.OpenPlayerInventory = function(src, target)
|
||||
assert(src, "OpenPlayerInventory: src is required")
|
||||
if not target then
|
||||
target = src
|
||||
end
|
||||
exports['codem-inventory']:OpenInventory(src, target)
|
||||
end
|
||||
|
||||
|
||||
return Inventory
|
||||
@@ -1,35 +1,26 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('core_inventory') ~= 'started' then return end
|
||||
if GetResourceState('core_inventory') == 'missing' then return end
|
||||
local core = exports.core_inventory
|
||||
-- Core inventory docs available at https://docs.c8re.store/core-inventory/api/server#getitemslist
|
||||
Callback = Callback or Require("lib/callback/shared/callback.lua")
|
||||
|
||||
Inventory = Inventory or {}
|
||||
|
||||
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
local frameworkName = Framework.GetFrameworkName()
|
||||
if not frameworkName then return {} end
|
||||
local dataRepack = {}
|
||||
if frameworkName == 'es_extended' then
|
||||
local callbackData = Callback.Trigger('community_bridge:Callback:core_inventory', false)
|
||||
-- really really wish this inventory allowed me to pull the item list client side....
|
||||
dataRepack = callbackData[item]
|
||||
if not dataRepack then return {} end
|
||||
elseif frameworkName == 'qb-core' then
|
||||
dataRepack = Framework.Shared.Items[item]
|
||||
if not dataRepack then return {} end
|
||||
end
|
||||
return {name = dataRepack.name, label = dataRepack.label, stack = dataRepack.stack, weight = dataRepack.weight, description = dataRepack.description, image = Inventory.GetImagePath(dataRepack.name) }
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "core_inventory"
|
||||
end
|
||||
|
||||
local cachedItemList = nil
|
||||
--- Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
--- https://docs.c8re.store/core-inventory/api/server#getitemslist
|
||||
--- @param item string
|
||||
--- @return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
local itemList = Inventory.Items()
|
||||
return itemList[item] or {}
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
@@ -38,13 +29,16 @@ Inventory.Items = function()
|
||||
if not frameworkName then return {} end
|
||||
local dataRepack = {}
|
||||
if frameworkName == 'es_extended' then
|
||||
local callbackData = Callback.Trigger('community_bridge:Callback:core_inventory', false)
|
||||
-- really really wish this inventory allowed me to pull the item list client side....
|
||||
dataRepack = callbackData
|
||||
if not dataRepack then return {} end
|
||||
if not cachedItemList then cachedItemList = Callback.Trigger('community_bridge:Callback:core_inventory', false) end
|
||||
dataRepack = cachedItemList or {}
|
||||
elseif frameworkName == 'qb-core' then
|
||||
dataRepack = Framework.Shared.Items
|
||||
if not dataRepack then return {} end
|
||||
dataRepack = Framework.Shared.Items or {}
|
||||
end
|
||||
for itemName, itemData in pairs(dataRepack) do
|
||||
if itemData and itemData.name then
|
||||
dataRepack[itemName].image = Inventory.GetImagePath(itemData.name)
|
||||
dataRepack[itemName].stack = dataRepack[itemName].unique or false
|
||||
end
|
||||
end
|
||||
return dataRepack
|
||||
end
|
||||
@@ -56,11 +50,12 @@ Inventory.HasItem = function(item)
|
||||
return core:hasItem(item, 1)
|
||||
end
|
||||
|
||||
---This will return th count of the item in the players inventory, if not found will return 0.
|
||||
---@description Will return boolean if the player has the item.
|
||||
---@param item string
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(item)
|
||||
return core:getItemCount(item)
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(item, requiredCount)
|
||||
return core:getItemCount(item) >= (requiredCount or 1)
|
||||
end
|
||||
|
||||
---This will get the image path for this item, if not found will return placeholder.
|
||||
@@ -81,9 +76,9 @@ Inventory.GetPlayerInventory = function()
|
||||
for _, v in pairs(playerItems) do
|
||||
table.insert(repackedTable, {
|
||||
name = v.name,
|
||||
count = v.count,
|
||||
metadata = v.metadata,
|
||||
slot = v.id,
|
||||
count = v.count or v.amount,
|
||||
metadata = v.metadata or v.info,
|
||||
slot = v.id or v.slot,
|
||||
})
|
||||
end
|
||||
return repackedTable
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('core_inventory') ~= 'started' then return end
|
||||
if GetResourceState('core_inventory') == 'missing' then return end
|
||||
|
||||
Inventory = Inventory or {}
|
||||
Inventory.Stashes = Inventory.Stashes or {}
|
||||
Callback = Callback or Require("lib/callback/shared/callback.lua")
|
||||
local core = exports.core_inventory
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "core_inventory"
|
||||
end
|
||||
|
||||
---This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
@@ -14,18 +20,14 @@ local core = exports.core_inventory
|
||||
---@param metadata table
|
||||
---@return boolean
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
-- docs specify a table returned on success, on failure it returns false.
|
||||
-- https://docs.c8re.store/core-inventory/api/server#additem
|
||||
local success = core:addItem(src, item, count, metadata)
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return core:addItem(src, item, count, metadata)
|
||||
return success or false
|
||||
end
|
||||
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "core_inventory"
|
||||
end
|
||||
|
||||
|
||||
---This will remove an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
@@ -39,7 +41,7 @@ Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||
if not inv then return false end
|
||||
for _, v in pairs(inv) do
|
||||
if v.name == item and v.metadata == metadata then
|
||||
slot = v.slot
|
||||
slot = v.id or v.slot
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -53,11 +55,12 @@ Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||
identifier = string.gsub(identifier, ":", "")
|
||||
end
|
||||
local weirdInventoryName = 'content-' .. identifier
|
||||
-- No return value specified in docs, so we assume none.
|
||||
-- https://docs.c8re.store/core-inventory/api/server#removeitemexact
|
||||
return core:removeItemExact(weirdInventoryName, slot, count)
|
||||
end
|
||||
core:removeItem(src, item, count)
|
||||
return true
|
||||
-- I hate this inventory so much, I am so sorry for this.
|
||||
end
|
||||
|
||||
---This will return the count of the item in the players inventory, if not found will return 0.
|
||||
@@ -93,24 +96,24 @@ Inventory.GetPlayerInventory = function(src)
|
||||
local playerItems = core:getInventory(src)
|
||||
local repackedTable = {}
|
||||
for _, v in pairs(playerItems) do
|
||||
if v.metadata and v.count > 1 then
|
||||
if (v.metadata or v.info) and (v.count or v.amount) > 1 then
|
||||
local plaseFixThisExportCuzThisIsPainful = core:getItems(src, v.name)
|
||||
if plaseFixThisExportCuzThisIsPainful then
|
||||
for _, item in pairs(plaseFixThisExportCuzThisIsPainful) do
|
||||
table.insert(repackedTable, {
|
||||
name = v.name,
|
||||
count = item.count,
|
||||
metadata = item.metadata,
|
||||
slot = item.id,
|
||||
count = item.count or item.amount,
|
||||
metadata = item.metadata or item.info,
|
||||
slot = item.id or item.slot,
|
||||
})
|
||||
end
|
||||
end
|
||||
else
|
||||
table.insert(repackedTable, {
|
||||
name = v.name,
|
||||
count = v.count,
|
||||
metadata = v.metadata,
|
||||
slot = v.id,
|
||||
count = v.count or v.amount,
|
||||
metadata = v.metadata or v.info,
|
||||
slot = v.id or v.slot,
|
||||
})
|
||||
end
|
||||
end
|
||||
@@ -126,12 +129,12 @@ Inventory.GetItemBySlot = function(src, slot)
|
||||
local inv = Inventory.GetPlayerInventory(src)
|
||||
if not inv then return {} end
|
||||
for _, v in pairs(inv) do
|
||||
if v.slot == slot then
|
||||
if (v.slot == slot) or (v.id == slot) then
|
||||
return {
|
||||
name = v.name,
|
||||
count = v.count,
|
||||
metadata = v.metadata,
|
||||
slot = v.slot,
|
||||
slot = v.id or v.slot,
|
||||
}
|
||||
end
|
||||
end
|
||||
@@ -156,7 +159,7 @@ end
|
||||
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)
|
||||
core:openInventory(src, id, _type, tbl.slots or 30, tbl.weight or 50000, true, nil, false)
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
@@ -185,12 +188,14 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
|
||||
return true, id
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
---@description This will return a boolean if the player has the item.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(src, item)
|
||||
return core:getItemCount(src, item) > 0
|
||||
Inventory.HasItem = function(src, item, requiredCount)
|
||||
local count = Inventory.GetItemCount(src, item, nil)
|
||||
return count >= (requiredCount or 1)
|
||||
end
|
||||
|
||||
---This is to get if there is available space in the inventory, will return boolean.
|
||||
@@ -212,15 +217,6 @@ Inventory.AddTrunkItems = function(identifier, items)
|
||||
return false, print("AddItemsToTrunk is not implemented in core_inventory, because of this we dont have a way to add items to a trunk.")
|
||||
end
|
||||
|
||||
---This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param id string
|
||||
---@return boolean
|
||||
Inventory.ClearStash = function(id, _type)
|
||||
if type(id) ~= "string" then return false end
|
||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
||||
return false, print("ClearInventory is not implemented in core_inventory, because of this we dont have a way to clear a stash.")
|
||||
end
|
||||
|
||||
---This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@param oldplate string
|
||||
---@param newplate string
|
||||
@@ -267,9 +263,7 @@ end
|
||||
|
||||
Inventory.OpenPlayerInventory = function(src, target)
|
||||
assert(src, "OpenPlayerInventory: src is required")
|
||||
if not target then
|
||||
target = src
|
||||
end
|
||||
assert(target, "OpenPlayerInventory: target is required")
|
||||
local identifier = Framework.GetPlayerIdentifier(target)
|
||||
if not identifier then return false end
|
||||
exports.core_inventory:openInventory(src, 'stash-'.. identifier:gsub(':',''), 'stash', nil, nil, true, nil, false)
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('jpr-inventory') ~= 'started' then return end
|
||||
if GetResourceState('jpr-inventory') == 'missing' then return end
|
||||
local jpr = exports['jpr-inventory']
|
||||
|
||||
Inventory = Inventory or {}
|
||||
|
||||
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "jpr-inventory"
|
||||
end
|
||||
|
||||
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -20,28 +26,7 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "jpr-inventory"
|
||||
end
|
||||
|
||||
|
||||
---Will return boolean if the player has the item.
|
||||
---@param item string
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(item)
|
||||
return jpr:HasItem(item)
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return Framework.Shared.Items
|
||||
end
|
||||
|
||||
---This will get the image path for this item, if not found will return placeholder.
|
||||
---@description This will get the image path for this item, if not found will return placeholder.
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('jpr-inventory') ~= 'started' then return end
|
||||
if GetResourceState('jpr-inventory') == 'missing' then return end
|
||||
|
||||
local jpr = exports['jpr-inventory']
|
||||
local registeredShops = {}
|
||||
@@ -7,37 +7,43 @@ local registeredShops = {}
|
||||
Inventory = Inventory or {}
|
||||
Inventory.Stashes = Inventory.Stashes or {}
|
||||
|
||||
---This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean
|
||||
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 exports['jpr-inventory']:AddItem(src, item, count, slot, metadata, 'community_bridge Item added')
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "jpr-inventory"
|
||||
end
|
||||
|
||||
---This will remove an item, and return true or false based on success
|
||||
---@description This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
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 exports['jpr-inventory']:RemoveItem(src, item, count, slot, 'community_bridge Item removed')
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
local canCarry = Inventory.CanCarryItem(src, item, count)
|
||||
if not canCarry then return false end
|
||||
local success = exports['jpr-inventory']:AddItem(src, item, count, slot, metadata, 'community_bridge Item added')
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return success or false
|
||||
end
|
||||
|
||||
---This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@description This will remove an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||
local success = exports['jpr-inventory']:RemoveItem(src, item, count, slot, 'community_bridge Item removed')
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return success or false
|
||||
end
|
||||
|
||||
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -46,17 +52,10 @@ Inventory.GetItemInfo = function(item)
|
||||
return itemTable
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return Framework.Shared.Items
|
||||
end
|
||||
|
||||
---Returns the specified slot data as a table.
|
||||
---format {weight, name, metadata, slot, label, count}
|
||||
---@description Returns the specified slot data as a table.
|
||||
---@param src number
|
||||
---@param slot number
|
||||
---@return table
|
||||
---@return table {weight, name, metadata, slot, label, count}
|
||||
Inventory.GetItemBySlot = function(src, slot)
|
||||
local slotData = jpr:GetItemBySlot(src, slot)
|
||||
if not slotData then return {} end
|
||||
@@ -72,78 +71,27 @@ Inventory.GetItemBySlot = function(src, slot)
|
||||
}
|
||||
end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@description This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number||string
|
||||
---@param _type string "stash", "trunk", "glovebox"
|
||||
---@param id string
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
_type = _type or "stash"
|
||||
local tbl = Inventory.Stashes[id]
|
||||
local tbl = Inventory.Stashes[id] or {weight = 1000000, slots = 50}
|
||||
TriggerClientEvent('community_bridge:client:jpr-inventory:openStash', src, id, { weight = tbl.weight, slots = tbl.slots })
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
---@param id number|string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string|number
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
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 add items to a trunk, and return true or false based on success
|
||||
---If a trunk with the identifier does not exist, it will create one with default values.
|
||||
---@param identifier string
|
||||
---@param items table
|
||||
---@return boolean
|
||||
Inventory.AddTrunkItems = function(identifier, items)
|
||||
if type(items) ~= "table" then return false end
|
||||
return false, print("AddItemsToTrunk is not implemented in jpr-inventory, because of this we dont have a way to add items to a trunk.")
|
||||
end
|
||||
|
||||
---This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param id string
|
||||
---@return boolean
|
||||
Inventory.ClearStash = function(id, _type)
|
||||
if type(id) ~= "string" then return false end
|
||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
||||
return false, print("ClearInventory is not implemented in jpr-inventory, because of this we dont have a way to clear a stash.")
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
---@description This will return a boolean if the player has the item.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(src, item)
|
||||
return jpr:HasItem(src, item, 1)
|
||||
Inventory.HasItem = function(src, item, requiredCount)
|
||||
return jpr:HasItem(src, item, requiredCount or 1)
|
||||
end
|
||||
|
||||
---This is to get if there is available space in the inventory, will return boolean.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@return boolean
|
||||
Inventory.CanCarryItem = function(src, item, count)
|
||||
return true
|
||||
end
|
||||
|
||||
---This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@description This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@param oldplate string
|
||||
---@param newplate string
|
||||
---@return boolean
|
||||
@@ -158,7 +106,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
---This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -168,26 +116,26 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---This will open the specified shop for the src passed.
|
||||
---@description This will open the specified shop for the src passed.
|
||||
---@param src number
|
||||
---@param shopTitle string
|
||||
Inventory.OpenShop = function(src, shopTitle)
|
||||
jpr:OpenShop(src, shopTitle)
|
||||
end
|
||||
|
||||
---This will register a shop, if it already exists it will return true.
|
||||
---@description This will register a shop, if it already exists it will return true.
|
||||
---@param shopTitle string
|
||||
---@param shopInventory table
|
||||
---@param inventory table
|
||||
---@param shopCoords table
|
||||
---@param shopGroups table
|
||||
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
|
||||
if not shopTitle or not shopInventory or not shopCoords then return end
|
||||
Inventory.RegisterShop = function(shopTitle, inventory, shopCoords, shopGroups)
|
||||
if not shopTitle or not inventory or not shopCoords then return end
|
||||
if registeredShops[shopTitle] then return true end
|
||||
|
||||
local repackItems = {}
|
||||
local repackedShopItems = {name = shopTitle, label = shopTitle, coords = shopCoords, items = repackItems, slots = #shopInventory, }
|
||||
for k, v in pairs(shopInventory) do
|
||||
table.insert(repackItems, { name = v.name, price = v.price or 1000, amount = v.count or 1, slot = k })
|
||||
local repackedShopItems = {name = shopTitle, label = shopTitle, coords = shopCoords, items = repackItems, slots = #inventory, }
|
||||
for k, v in pairs(inventory) do
|
||||
table.insert(repackItems, { name = v.name, price = v.price or 1000, amount = v.count or v.amount or 1, slot = k })
|
||||
end
|
||||
|
||||
jpr:CreateShop(repackedShopItems)
|
||||
@@ -195,11 +143,12 @@ Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGrou
|
||||
return true
|
||||
end
|
||||
|
||||
---@description This will open a players inventory, used for admin purposes and stuff.
|
||||
---@param src number
|
||||
---@param target number
|
||||
Inventory.OpenPlayerInventory = function(src, target)
|
||||
assert(src, "OpenPlayerInventory: src is required")
|
||||
if not target then
|
||||
target = src
|
||||
end
|
||||
assert(target, "OpenPlayerInventory: target is required")
|
||||
local identifier = Framework.GetPlayerIdentifier(target)
|
||||
if not identifier then return false end
|
||||
exports['jpr-inventory']:OpenInventory(src, identifier)
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('origen_inventory') ~= 'started' then return end
|
||||
if GetResourceState('origen_inventory') == 'missing' then return end
|
||||
if GetResourceState('ox_inventory') ~= 'missing' then return end
|
||||
Inventory = Inventory or {}
|
||||
local origin = exports.origen_inventory
|
||||
|
||||
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "origen_inventory"
|
||||
end
|
||||
|
||||
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
local itemData = origin:Items(item)
|
||||
local itemData = Inventory.Items()[item]
|
||||
if not itemData then return {} end
|
||||
return {
|
||||
name = itemData.name or "Missing Name",
|
||||
@@ -19,26 +26,16 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "origen_inventory"
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return origin:Items()
|
||||
end
|
||||
|
||||
---Will return boolean if the player has the item.
|
||||
---@description Will return boolean if the player has the item.
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(item)
|
||||
return origin:HasItem(item)
|
||||
Inventory.HasItem = function(item, requiredCount)
|
||||
local count = Inventory.GetItemCount(item)
|
||||
return count >= (requiredCount or 1)
|
||||
end
|
||||
|
||||
---This will return th count of the item in the players inventory, if not found will return 0.
|
||||
---@description This will return their count of the item in the players inventory, if not found will return 0.
|
||||
---@param item string
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(item)
|
||||
@@ -47,7 +44,7 @@ Inventory.GetItemCount = function(item)
|
||||
return inventory.count
|
||||
end
|
||||
|
||||
---This will get the image path for this item, if not found will return placeholder.
|
||||
---@description This will get the image path for this item, if not found will return placeholder.
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -57,7 +54,7 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@description This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function()
|
||||
local repack = {}
|
||||
@@ -67,10 +64,10 @@ Inventory.GetPlayerInventory = function()
|
||||
table.insert(repack, {
|
||||
name = v.name,
|
||||
label = v.label,
|
||||
count = v.amount,
|
||||
count = v.amount or v.count,
|
||||
slot = v.slot,
|
||||
metadata = v.metadata,
|
||||
stack = v.unique,
|
||||
metadata = v.metadata or v.info or {},
|
||||
stack = v.unique or v.stack or false,
|
||||
close = v.useable,
|
||||
weight = v.weight
|
||||
})
|
||||
@@ -78,8 +75,4 @@ Inventory.GetPlayerInventory = function()
|
||||
return repack
|
||||
end
|
||||
|
||||
Inventory.OpenStash = function(id)
|
||||
origin:openInventory('stash', id, { label = id, weight = 400000, slots = 100, })
|
||||
end
|
||||
|
||||
return Inventory
|
||||
@@ -1,42 +1,49 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('origen_inventory') ~= 'started' then return end
|
||||
if GetResourceState('origen_inventory') == 'missing' then return end
|
||||
if GetResourceState('ox_inventory') ~= 'missing' then return end
|
||||
|
||||
Inventory = Inventory or {}
|
||||
Inventory.Stashes = Inventory.Stashes or {}
|
||||
|
||||
local origin = exports.origen_inventory
|
||||
|
||||
---This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean
|
||||
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 origin:AddItem(src, item, count, metadata, slot, true)
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "origen_inventory"
|
||||
end
|
||||
|
||||
---This will remove an item, and return true or false based on success
|
||||
---@description This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
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 origin:removeItem(src, item, count, metadata, slot, true)
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
local canCarry = Inventory.CanCarryItem(src, item, count)
|
||||
if not canCarry then return false end
|
||||
local success = origin:addItem(src, item, count, metadata, slot, false)
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return success or false
|
||||
end
|
||||
|
||||
---This will add items to a trunk, and return true or false based on success
|
||||
---@description This will remove an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||
local success = origin:removeItem(src, item, count, metadata, slot, false)
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return success or false
|
||||
end
|
||||
|
||||
---@description This will add items to a trunk, and return true or false based on success
|
||||
---@param identifier string
|
||||
---@param items table
|
||||
---@return boolean
|
||||
@@ -48,8 +55,8 @@ Inventory.AddTrunkItems = function(identifier, items)
|
||||
for _, v in pairs(items) do
|
||||
table.insert(repack_items, {
|
||||
name = v.item,
|
||||
amount = v.count,
|
||||
metadata = v.metadata or {}
|
||||
amount = v.count or v.amount,
|
||||
metadata = v.metadata or v.info or {}
|
||||
})
|
||||
end
|
||||
if #repack_items == 0 then return false end
|
||||
@@ -57,13 +64,14 @@ Inventory.AddTrunkItems = function(identifier, items)
|
||||
return true
|
||||
end
|
||||
|
||||
---This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param identifier string
|
||||
---@description This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param id string
|
||||
---@param _type string unused with ox_inventory
|
||||
---@return boolean
|
||||
Inventory.ClearStash = function(identifier, _type)
|
||||
if type(identifier) ~= "string" then return false end
|
||||
if Inventory.Stashes[identifier] then Inventory.Stashes[identifier] = nil end
|
||||
local id = identifier
|
||||
Inventory.ClearStash = function(id, _type)
|
||||
if type(id) ~= "string" then return false end
|
||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
||||
local id = id
|
||||
if _type == "trunk" then
|
||||
id = "trunk_"..id
|
||||
elseif _type == "glovebox" then
|
||||
@@ -71,7 +79,7 @@ Inventory.ClearStash = function(identifier, _type)
|
||||
elseif _type == "stash" then
|
||||
id = "stash_"..id
|
||||
end
|
||||
local inv = origin:getInventory(identifier, _type)
|
||||
local inv = origin:getInventory(id, _type)
|
||||
if not inv then return false end
|
||||
local indexed = inv.inventory
|
||||
for _, v in pairs(indexed) do
|
||||
@@ -82,7 +90,7 @@ Inventory.ClearStash = function(identifier, _type)
|
||||
return true
|
||||
end
|
||||
|
||||
---This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -98,23 +106,22 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return origin:Items()
|
||||
end
|
||||
|
||||
---This will return the count of the item in the players inventory, if not found will return 0.
|
||||
---if metadata is passed it will find the matching items count.
|
||||
---@description This will return the count of the item in the players inventory, if not found will return 0.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param metadata table
|
||||
---@param metadata table (optional)
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(src, item, metadata)
|
||||
return origin:getItemCount(src, item, metadata, false) or 0
|
||||
end
|
||||
|
||||
---This wil return the players inventory.
|
||||
---@description This will return the players inventory.
|
||||
---@param src number
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function(src)
|
||||
@@ -125,8 +132,8 @@ Inventory.GetPlayerInventory = function(src)
|
||||
if v.slot then
|
||||
table.insert(repack, {
|
||||
name = v.name,
|
||||
count = v.amount,
|
||||
metadata = v.metadata or {},
|
||||
count = v.amount or v.count,
|
||||
metadata = v.metadata or v.info or {},
|
||||
slot = v.slot,
|
||||
label = v.label or "Unknown"
|
||||
})
|
||||
@@ -135,20 +142,19 @@ Inventory.GetPlayerInventory = function(src)
|
||||
return repack
|
||||
end
|
||||
|
||||
---Returns the specified slot data as a table.
|
||||
---format {weight, name, metadata, slot, label, count}
|
||||
---@description Returns the specified slot data as a table.
|
||||
---@param src number
|
||||
---@param slot number
|
||||
---@return table
|
||||
---@return table {weight, name, metadata, slot, label, count}
|
||||
Inventory.GetItemBySlot = function(src, slot)
|
||||
local playerInv = Inventory.GetPlayerInventory(src)
|
||||
for _, v in pairs(playerInv) do
|
||||
if v.slot == slot then
|
||||
return {
|
||||
name = v.name,
|
||||
count = v.count,
|
||||
count = v.count or v.amount,
|
||||
weight = v.weight or 0,
|
||||
metadata = v.metadata,
|
||||
metadata = v.metadata or v.info or {},
|
||||
slot = v.slot,
|
||||
label = v.label
|
||||
}
|
||||
@@ -157,7 +163,7 @@ Inventory.GetItemBySlot = function(src, slot)
|
||||
return {}
|
||||
end
|
||||
|
||||
---This will set the metadata of an item in the inventory.
|
||||
---@description This will set the metadata of an item in the inventory.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param slot number
|
||||
@@ -167,51 +173,43 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
|
||||
origin:setMetadata(src, slot, metadata)
|
||||
end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@description This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number|string
|
||||
---@param _type string "stash", "trunk", "glovebox"
|
||||
---@param id string
|
||||
---@return nil
|
||||
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
|
||||
---@description This will register a stash
|
||||
---@param id number|string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@param owner string (optional)
|
||||
---@param groups table (optional)
|
||||
---@param coords table (optional)
|
||||
---@return boolean
|
||||
---@return string|number
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
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
|
||||
}
|
||||
Inventory.Stashes[id] = {id = id, label = label or id, slots = slots, weight = weight, owner = owner, groups = groups, coords = 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.
|
||||
---@description This will return a boolean if the player has the item.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(src, item)
|
||||
return origin:getItemCount(src , item) > 0
|
||||
Inventory.HasItem = function(src, item, requiredCount)
|
||||
return origin:getItemCount(src , item) > (requiredCount or 0)
|
||||
end
|
||||
|
||||
---This is to get if there is available space in the inventory, will return boolean.
|
||||
---@description This is to get if there is available space in the inventory, will return boolean.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
@@ -220,7 +218,7 @@ Inventory.CanCarryItem = function(src, item, count)
|
||||
return origin:canCarryItem(src, item, count)
|
||||
end
|
||||
|
||||
---This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@description This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@param oldplate string
|
||||
---@param newplate string
|
||||
---@return boolean
|
||||
@@ -235,7 +233,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
---This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -245,11 +243,12 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---@description This will open a players inventory, used for admin purposes and stuff.
|
||||
---@param src number
|
||||
---@param target number
|
||||
Inventory.OpenPlayerInventory = function(src, target)
|
||||
assert(src, "OpenPlayerInventory: src is required")
|
||||
if not target then
|
||||
target = src
|
||||
end
|
||||
assert(target, "OpenPlayerInventory: target is required")
|
||||
exports.origen_inventory:OpenInventory(src, "otherplayer", target)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('ox_inventory') ~= 'started' then return end
|
||||
if GetResourceState('qs-inventory') == 'started' then return end
|
||||
if GetResourceState('origen_inventory') == 'started' then return end
|
||||
if GetResourceState('ox_inventory') == 'missing' then return end
|
||||
if GetResourceState('tgiann-inventory') ~= 'missing' then return end
|
||||
if GetResourceState('qs-inventory') ~= 'missing' then return end
|
||||
if GetResourceState('origen_inventory') ~= 'missing' then return end
|
||||
--check for providers =/
|
||||
|
||||
local ox_inventory = exports.ox_inventory
|
||||
|
||||
Inventory = Inventory or {}
|
||||
|
||||
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "ox_inventory"
|
||||
end
|
||||
|
||||
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -23,33 +31,28 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "ox_inventory"
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return ox_inventory:Items()
|
||||
end
|
||||
|
||||
---Will return boolean if the player has the item.
|
||||
---@description Will return boolean if the player has the item.
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(item)
|
||||
return ox_inventory:Search('count', item) > 0
|
||||
Inventory.HasItem = function(item, requiredCount)
|
||||
return ox_inventory:Search('count', item, nil) >= (requiredCount or 1)
|
||||
end
|
||||
|
||||
---This will return th count of the item in the players inventory, if not found will return 0.
|
||||
---@description This will return their count of the item in the players inventory, if not found will return 0.
|
||||
---@param item string
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(item)
|
||||
return ox_inventory:GetItemCount(item, nil, false)
|
||||
end
|
||||
|
||||
---This will get the image path for this item, if not found will return placeholder.
|
||||
---@description This will get the image path for this item, if not found will return placeholder.
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -59,7 +62,7 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@description This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function()
|
||||
return ox_inventory:GetPlayerItems()
|
||||
|
||||
@@ -1,71 +1,50 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('ox_inventory') ~= 'started' then return end
|
||||
if GetResourceState('qs-inventory') == 'started' then return end
|
||||
if GetResourceState('origen_inventory') == 'started' then return end
|
||||
if GetResourceState('ox_inventory') == 'missing' then return end
|
||||
if GetResourceState('tgiann-inventory') ~= 'missing' then return end
|
||||
if GetResourceState('qs-inventory') ~= 'missing' then return end
|
||||
if GetResourceState('origen_inventory') ~= 'missing' then return end
|
||||
--check for providers =/
|
||||
|
||||
local ox_inventory = exports.ox_inventory
|
||||
local registeredShops = {}
|
||||
|
||||
Inventory = Inventory or {}
|
||||
Inventory.Stashes = Inventory.Stashes or {}
|
||||
|
||||
---This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
if not ox_inventory:CanCarryItem(src, item, count, metadata) then return false end
|
||||
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
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "ox_inventory"
|
||||
end
|
||||
|
||||
---This will remove an item, and return true or false based on success
|
||||
---@description This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
if not ox_inventory:CanCarryItem(src, item, count, metadata) then return false end
|
||||
local success = ox_inventory:AddItem(src, item, count, metadata)
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return success
|
||||
end
|
||||
|
||||
---@description This will remove an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||
local success = ox_inventory:RemoveItem(src, item, count, metadata, slot)
|
||||
if not success then return false end
|
||||
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)
|
||||
return success
|
||||
end
|
||||
|
||||
---This will add items to a trunk, and return true or false based on success
|
||||
---@param identifier string
|
||||
---@param items table
|
||||
---@return boolean
|
||||
Inventory.AddTrunkItems = function(identifier, items)
|
||||
local id = "trunk"..identifier
|
||||
if type(items) ~= "table" then return false end
|
||||
Inventory.RegisterStash(id, identifier, 20, 10000, nil, nil, nil)
|
||||
Wait(100) -- Wait for the stash to be registered just in case
|
||||
for _, v in pairs(items) do
|
||||
ox_inventory:AddItem(id, v.item, v.count, v.metadata)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param id string
|
||||
---@return boolean
|
||||
Inventory.ClearStash = function(id, _type)
|
||||
if type(id) ~= "string" then return false end
|
||||
ox_inventory:ClearInventory(_type..id, nil)
|
||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
||||
return true
|
||||
end
|
||||
|
||||
---This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -81,41 +60,37 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return ox_inventory:Items()
|
||||
end
|
||||
|
||||
---This will return the count of the item in the players inventory, if not found will return 0.
|
||||
---
|
||||
---if metadata is passed it will find the matching items count.
|
||||
---@description This will return the count of the item in the players inventory, if not found will return 0.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param metadata table
|
||||
---@param metadata table (optional)
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(src, item, metadata)
|
||||
return ox_inventory:GetItemCount(src, item, metadata, false)
|
||||
end
|
||||
|
||||
---This wil return the players inventory.
|
||||
---@description This wil return the players inventory.
|
||||
---@param src number
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function(src)
|
||||
return ox_inventory:GetInventoryItems(src, false)
|
||||
end
|
||||
|
||||
---Returns the specified slot data as a table.
|
||||
---
|
||||
---format {weight, name, metadata, slot, label, count}
|
||||
---@description Returns the specified slot data as a table.
|
||||
---@param src number
|
||||
---@param slot number
|
||||
---@return table
|
||||
---@return table {weight, name, metadata, slot, label, count}
|
||||
Inventory.GetItemBySlot = function(src, slot)
|
||||
return ox_inventory:GetSlot(src, slot)
|
||||
end
|
||||
|
||||
---This will set the metadata of an item in the inventory.
|
||||
---@description This will set the metadata of an item in the inventory.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param slot number
|
||||
@@ -125,52 +100,70 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
|
||||
ox_inventory:SetMetadata(src, slot, metadata)
|
||||
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, _type, id)
|
||||
_type = _type or "stash"
|
||||
--local tbl = Inventory.Stashes[id]
|
||||
ox_inventory:forceOpenInventory(src, _type, id)
|
||||
end
|
||||
|
||||
-- restores stashes to before commit #e06e04a (no depreication path followed, breaking change and not present on all inventories so undoing it. (also breaking multiple resources))
|
||||
---This will register a stash
|
||||
---@description This will register a stash
|
||||
---@param id number|string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@param owner string (optional)
|
||||
---@param groups table (optional)
|
||||
---@param coords table (optional)
|
||||
---@return boolean
|
||||
---@return string|number
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
id = tostring(id)
|
||||
-- ox standard doesnt return anything so probably shouldnt return so everything else has the same standard. Id is pointless if its a param already. Yeaaaa probably should change this.
|
||||
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
|
||||
}
|
||||
Inventory.Stashes[id] = {id = id, label = label, slots = slots, weight = weight, owner = owner, groups = groups, coords = coords}
|
||||
ox_inventory:RegisterStash(id, label, slots, weight, owner, groups, coords)
|
||||
return true, id
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
---@description This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(src, item)
|
||||
return ox_inventory:GetItemCount(src, item, nil, false) > 0
|
||||
---@param _type string "stash", "trunk", "glovebox"
|
||||
---@param id string
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
_type = _type or "stash"
|
||||
ox_inventory:forceOpenInventory(src, _type, id)
|
||||
end
|
||||
|
||||
---This is to get if there is available space in the inventory, will return boolean.
|
||||
---@description This will add items to a stash, and return true or false based on success
|
||||
---@param id string
|
||||
---@param items table {item, count, metadata}
|
||||
---@return boolean
|
||||
Inventory.AddStashItems = function(id, items)
|
||||
if type(items) ~= "table" then return false end
|
||||
local success = false
|
||||
for _, v in pairs(items) do
|
||||
success = ox_inventory:AddItem(id, v.item, v.count or v.amount, v.metadata or v.info or {})
|
||||
end
|
||||
return success
|
||||
end
|
||||
|
||||
---@description This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param id string
|
||||
---@param _type string unused with ox_inventory
|
||||
---@return boolean
|
||||
Inventory.ClearStash = function(id, _type)
|
||||
id = tostring(id)
|
||||
ox_inventory:ClearInventory(id)
|
||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
||||
-- ox standard doesnt return anything so probably shouldnt return so everything else has the same standard. Yeaaaa probably should change this.
|
||||
return true
|
||||
end
|
||||
|
||||
---@description This will return a boolean if the player has the item.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(src, item, requiredCount)
|
||||
return ox_inventory:GetItemCount(src, item, nil, false) >= (requiredCount or 1)
|
||||
end
|
||||
|
||||
---@description This is to get if there is available space in the inventory, will return boolean.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
@@ -179,17 +172,34 @@ Inventory.CanCarryItem = function(src, item, count)
|
||||
return ox_inventory:CanCarryItem(src, item, count)
|
||||
end
|
||||
|
||||
---This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@description This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@param oldplate string
|
||||
---@param newplate string
|
||||
---@return boolean
|
||||
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
ox_inventory:UpdateVehicle(oldplate, newplate)
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
-- ox standard doesnt return anything so probably shouldnt return so everything else has the same standard. Yeaaaa probably should change this.
|
||||
if GetResourceState('jg-mechanic') ~= 'missing' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
---This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@description This will add items to a trunk, and return true or false based on success
|
||||
---@param identifier string
|
||||
---@param items table
|
||||
---@return boolean
|
||||
Inventory.AddTrunkItems = function(identifier, items)
|
||||
local id = "trunk"..identifier
|
||||
if type(items) ~= "table" then return false end
|
||||
Inventory.RegisterStash(id, identifier, 20, 10000, nil, nil, nil)
|
||||
Wait(100)
|
||||
local success = false
|
||||
for _, v in pairs(items) do
|
||||
success = ox_inventory:AddItem(id, v.item, v.count or v.amount, v.metadata or v.info or {})
|
||||
end
|
||||
return success
|
||||
end
|
||||
|
||||
---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -199,46 +209,31 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
-- restores shops to before commit #e06e04a (no depreication path followed, breaking change and not present on all inventories so undoing it. (also breaking multiple resources))
|
||||
-- This will open the specified shop for the src passed.
|
||||
---@description This will open the specified shop for the src passed.
|
||||
---@param src number
|
||||
---@param shopTitle string
|
||||
Inventory.OpenShop = function(src, shopTitle)
|
||||
TriggerClientEvent('ox_inventory:openInventory', src, 'shop', {type = shopTitle})
|
||||
end
|
||||
|
||||
-- restores shops to before commit #e06e04a (no depreication path followed, breaking change and not present on all inventories so undoing it. (also breaking multiple resources))
|
||||
-- This will register a shop, if it already exists it will return true.
|
||||
---@description This will register a shop, if it already exists it will return true.
|
||||
---@param shopTitle string
|
||||
---@param shopInventory table
|
||||
---@param inventory table
|
||||
---@param shopCoords table
|
||||
---@param shopGroups table
|
||||
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
|
||||
if registeredShops[shopTitle] then return true end
|
||||
registeredShops[shopTitle] = true
|
||||
ox_inventory:RegisterShop(shopTitle, { name = shopTitle, inventory = shopInventory, groups = shopGroups, })
|
||||
--return Inventory.OpenShop(src, shopTitle)
|
||||
Inventory.RegisterShop = function(shopTitle, inventory, shopCoords, shopGroups)
|
||||
ox_inventory:RegisterShop(shopTitle, { name = shopTitle, inventory = inventory, groups = shopGroups, })
|
||||
-- ox standard doesnt return anything so probably shouldnt return so everything else has the same standard. Yeaaaa probably should change this.
|
||||
return true
|
||||
end
|
||||
|
||||
---UNUSED:
|
||||
---This will return generic item data from the specified inventory, with the items total count.
|
||||
---format without metadata { count, stack, name, weight, label }
|
||||
---fortmat with metadata { count, stack, name, weight, label, metadata }
|
||||
---@description This will open a players inventory, used for admin purposes and stuff.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param metadata table
|
||||
---@return table
|
||||
Inventory.GetItem = function(src, item, metadata)
|
||||
return ox_inventory:GetItem(src, item, metadata, false)
|
||||
end
|
||||
|
||||
---@param target number
|
||||
Inventory.OpenPlayerInventory = function(src, target)
|
||||
assert(src, "OpenPlayerInventory: src is required")
|
||||
if not target then
|
||||
target = src
|
||||
end
|
||||
exports.ox_inventory:openInventory('player', target)
|
||||
assert(target, "OpenPlayerInventory: target is required")
|
||||
ox_inventory:forceOpenInventory(src, 'player', target)
|
||||
end
|
||||
|
||||
return Inventory
|
||||
@@ -1,5 +1,5 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('ps-inventory') ~= 'started' then return end
|
||||
if GetResourceState('ps-inventory') == 'missing' then return end
|
||||
local ps = exports['ps-inventory']
|
||||
|
||||
Inventory = Inventory or {}
|
||||
|
||||
@@ -1,62 +1,62 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('ps-inventory') ~= 'started' then return end
|
||||
if GetResourceState('ps-inventory') == 'missing' then return end
|
||||
local sloth = exports['ps-inventory']
|
||||
local registeredShops = {}
|
||||
|
||||
Inventory = Inventory or {}
|
||||
Inventory.Stashes = Inventory.Stashes or {}
|
||||
|
||||
---This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add', count)
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return sloth:AddItem(src, item, count, slot, metadata, 'community_bridge')
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "ps-inventory"
|
||||
end
|
||||
|
||||
---This will remove an item, and return true or false based on success
|
||||
---@description This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
local success = sloth:AddItem(src, item, count, slot, metadata, 'community_bridge')
|
||||
if not success then return false end
|
||||
TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add', count)
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return success or false
|
||||
end
|
||||
|
||||
local function runMetadataSearch(src, metadata)
|
||||
local inv = Framework.GetPlayerInventory(src) or {}
|
||||
for k, v in pairs(inv) do
|
||||
if v.metadata and v.metadata == metadata then
|
||||
return true, v.slot
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
---@description This will remove an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||
if metadata then
|
||||
local found, itemSlot = runMetadataSearch(src, metadata)
|
||||
if found then
|
||||
slot = itemSlot
|
||||
end
|
||||
end
|
||||
local success = sloth:RemoveItem(src, item, count, slot, 'community_bridge')
|
||||
if not success then return false end
|
||||
TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'remove', count)
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return sloth:RemoveItem(src, item, count, slot, 'community_bridge')
|
||||
return success or false
|
||||
end
|
||||
|
||||
---This will add items to a trunk, and return true or false based on success
|
||||
---@param identifier string
|
||||
---@param items table
|
||||
---@return boolean
|
||||
Inventory.AddItemsToTrunk = function(identifier, items)
|
||||
if type(items) ~= "table" then return false end
|
||||
return false, print("AddItemsToTrunk is not implemented in ps-inventory, because of this we dont have a way to add items to a trunk.")
|
||||
end
|
||||
|
||||
---This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param id string
|
||||
---@return boolean
|
||||
Inventory.ClearStash = function(id, _type)
|
||||
if type(id) ~= "string" then return false end
|
||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
||||
return false, print("ClearInventory is not implemented in ps-inventory, because of this we dont have a way to clear a stash.")
|
||||
end
|
||||
|
||||
---This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -72,100 +72,45 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return Framework.Shared.Items
|
||||
end
|
||||
|
||||
---Returns the specified slot data as a table.
|
||||
---
|
||||
---format {weight, name, metadata, slot, label, count}
|
||||
---@description Returns the specified slot data as a table.
|
||||
---@param src number
|
||||
---@param slot number
|
||||
---@return table
|
||||
---@return table {weight, name, metadata, slot, label, count}
|
||||
Inventory.GetItemBySlot = function(src, slot)
|
||||
local slotData = sloth:GetItemBySlot(src, slot)
|
||||
if not slotData then return {} end
|
||||
local item = sloth:GetItemBySlot(src, slot)
|
||||
if not item then return {} end
|
||||
return {
|
||||
name = slotData.name,
|
||||
label = slotData.label or slotData.name,
|
||||
weight = slotData.weight,
|
||||
name = item.name,
|
||||
label = item.label or item.name,
|
||||
weight = item.weight,
|
||||
slot = slot,
|
||||
count = slotData.amount,
|
||||
metadata = slotData.info,
|
||||
stack = slotData.unique,
|
||||
description = slotData.description
|
||||
count = item.amount,
|
||||
metadata = item.info,
|
||||
stack = item.unique,
|
||||
description = item.description
|
||||
}
|
||||
end
|
||||
|
||||
---This will set the metadata of an item in the inventory.
|
||||
---@description This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return nil
|
||||
Inventory.SetMetadata = function(src, item, slot, metadata)
|
||||
local itemData = Inventory.GetItemBySlot(src, slot)
|
||||
if not itemData then return end
|
||||
if itemData.count > 1 then return print("Items with more than 1 count cannot be set with metadata plase adjust item to unique in the qb shared item name : "..item) end
|
||||
Inventory.RemoveItem(src, item, 1, slot)
|
||||
return Inventory.AddItem(src, item, 1, slot, metadata)
|
||||
end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number||string
|
||||
---@param _type string "stash", "trunk", "glovebox"
|
||||
---@param id string
|
||||
---@return nil
|
||||
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, })
|
||||
sloth:OpenInventory(_type, id, nil, src)
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
---@param id number|string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string|number
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
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.
|
||||
---@description This will return a boolean if the player has the item.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(src, item)
|
||||
return sloth:HasItem(src, item, 1)
|
||||
Inventory.HasItem = function(src, item, requiredCount)
|
||||
return sloth:HasItem(src, item, requiredCount or 1)
|
||||
end
|
||||
|
||||
---This is to get if there is available space in the inventory, will return boolean.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@return boolean
|
||||
Inventory.CanCarryItem = function(src, item, count)
|
||||
return true
|
||||
end
|
||||
|
||||
---This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@description This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@param oldplate string
|
||||
---@param newplate string
|
||||
---@return boolean
|
||||
@@ -176,11 +121,12 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
}
|
||||
local values = { newplate = newplate, oldplate = oldplate }
|
||||
MySQL.transaction.await(queries, values)
|
||||
-- ox standard doesnt return anything so probably shouldnt return so everything else has the same standard. Yeaaaa probably should change this.
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
---This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -190,31 +136,41 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
-- This will open the specified shop for the src passed.
|
||||
---@description This will open the specified shop for the src passed.
|
||||
---@param src number
|
||||
---@param shopTitle string
|
||||
Inventory.OpenShop = function(src, shopTitle)
|
||||
return sloth:OpenShop(src, shopTitle)
|
||||
end
|
||||
|
||||
-- This will register a shop, if it already exists it will return true.
|
||||
---@description This will register a shop, if it already exists it will return true.
|
||||
---@param shopTitle string
|
||||
---@param shopInventory table
|
||||
---@param inventory table
|
||||
---@param shopCoords table
|
||||
---@param shopGroups table
|
||||
Inventory.RegisterShop = function(src, shopTitle, shopInventory, shopCoords, shopGroups)
|
||||
if not shopTitle or not shopInventory or not shopCoords then return end
|
||||
if registeredShops[shopTitle] then return true end
|
||||
Inventory.RegisterShop = function(shopTitle, inventory, shopCoords, shopGroups)
|
||||
assert(shopTitle, "RegisterShop: shopTitle is required")
|
||||
assert(inventory, "RegisterShop: shopInventory is required")
|
||||
assert(shopCoords, "RegisterShop: shopCoords is required")
|
||||
assert(shopGroups, "RegisterShop: shopGroups is required")
|
||||
|
||||
local repackItems = {}
|
||||
local repackedShopItems = {name = shopTitle, label = shopTitle, coords = shopCoords, items = repackItems, slots = #shopInventory, }
|
||||
for k, v in pairs(shopInventory) do
|
||||
table.insert(repackItems, { name = v.name, price = v.price or 1000, amount = v.count or 1, slot = k })
|
||||
for k, v in pairs(inventory) do
|
||||
table.insert(repackItems, { name = v.name, price = v.price or 1000, amount = v.amount or v.count or 1, slot = k })
|
||||
end
|
||||
local repackedShopItems = {name = shopTitle, label = shopTitle, coords = shopCoords, items = repackItems, slots = #inventory, }
|
||||
|
||||
sloth:CreateShop(repackedShopItems)
|
||||
registeredShops[shopTitle] = true
|
||||
return true
|
||||
end
|
||||
|
||||
---@description This will open a players inventory, used for admin purposes and stuff.
|
||||
---@param src number
|
||||
---@param target number
|
||||
Inventory.OpenPlayerInventory = function(src, target)
|
||||
assert(src, "OpenPlayerInventory: src is required")
|
||||
assert(target, "OpenPlayerInventory: target is required")
|
||||
sloth:OpenInventoryById(src, target)
|
||||
end
|
||||
|
||||
return Inventory
|
||||
@@ -1,12 +1,18 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('qb-inventory') ~= 'started' then return end
|
||||
if GetResourceState('qb-inventory') == 'missing' then return end
|
||||
if GetResourceState('codem-inventory') ~= 'missing' then return end
|
||||
if GetResourceState('origen_inventory') ~= 'missing' then return end
|
||||
local qb = exports['qb-inventory']
|
||||
|
||||
Inventory = Inventory or {}
|
||||
|
||||
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "qb-inventory"
|
||||
end
|
||||
|
||||
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -22,26 +28,21 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "qb-inventory"
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return Framework.Shared.Items
|
||||
end
|
||||
|
||||
---Will return boolean if the player has the item.
|
||||
---@description Will return boolean if the player has the item.
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(item)
|
||||
return qb:HasItem(item)
|
||||
Inventory.HasItem = function(item, requiredCount)
|
||||
return qb:HasItem(item, requiredCount or 1)
|
||||
end
|
||||
|
||||
---This will get the image path for this item, if not found will return placeholder.
|
||||
---@description This will get the image path for this item, if not found will return placeholder.
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
|
||||
@@ -1,106 +1,64 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('qb-inventory') ~= 'started' then return end
|
||||
if GetResourceState('qb-inventory') == 'missing' then return end
|
||||
if GetResourceState('ox_inventory') ~= 'missing' then return end
|
||||
if GetResourceState('codem-inventory') ~= 'missing' then return end
|
||||
if GetResourceState('origen_inventory') ~= 'missing' then return end
|
||||
local qbInventory = exports['qb-inventory']
|
||||
|
||||
Inventory = Inventory or {}
|
||||
Inventory.Stashes = Inventory.Stashes or {}
|
||||
|
||||
local registeredShops = {}
|
||||
local v1ShopData = {}
|
||||
Inventory.Old = {}
|
||||
Inventory.Version = nil
|
||||
Inventory.ShopData = {}
|
||||
|
||||
local function getInventoryNewVersion()
|
||||
if tonumber(string.sub(GetResourceMetadata("qb-inventory", "version", 0), 1, 1)) >= 2 then return true end
|
||||
return false
|
||||
if tonumber(string.sub(GetResourceMetadata("qb-inventory", "version", 0), 1, 1)) >= 2 then Inventory.Version = true end
|
||||
Inventory.Version = false
|
||||
end
|
||||
|
||||
---This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
if getInventoryNewVersion() then if not qbInventory:CanAddItem(src, item, count) then return false end end
|
||||
TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add', count)
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return qbInventory:AddItem(src, item, count, slot, metadata, 'community_bridge')
|
||||
end
|
||||
AddEventHandler('onResourceStart', function(resourceName)
|
||||
if resourceName ~= "community_bridge" then return end
|
||||
getInventoryNewVersion()
|
||||
end)
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "qb-inventory"
|
||||
end
|
||||
|
||||
---This will remove an item, and return true or false based on success
|
||||
---@description This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
if Inventory.Version then if not qbInventory:CanAddItem(src, item, count) then return false end end
|
||||
local success = qbInventory:AddItem(src, item, count, slot, metadata, 'community_bridge')
|
||||
if not success then return false end
|
||||
TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add', count)
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return success or false
|
||||
end
|
||||
|
||||
---@description This will remove an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||
local success = qbInventory:RemoveItem(src, item, count, slot, 'community_bridge')
|
||||
if not success then return false end
|
||||
TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'remove', count)
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return qbInventory:RemoveItem(src, item, count, slot, 'community_bridge')
|
||||
return success or false
|
||||
end
|
||||
|
||||
---This will add items to a trunk, and return true or false based on success
|
||||
---If a trunk with the identifier does not exist, it will create one with default values.
|
||||
---@param identifier string
|
||||
---@param items table
|
||||
---@return boolean
|
||||
Inventory.AddTrunkItems = function(identifier, items)
|
||||
if type(items) ~= "table" then return false end
|
||||
local fullTrunkId = "trunk-"..identifier
|
||||
local repacked_items = {}
|
||||
local slot = 0
|
||||
for _, item in pairs(items) do
|
||||
slot = slot + 1
|
||||
repacked_items[slot] = {
|
||||
name = item.item,
|
||||
amount = item.count,
|
||||
info = item.metadata,
|
||||
type = item.type or "item",
|
||||
slot = slot,
|
||||
}
|
||||
end
|
||||
local newVersion = getInventoryNewVersion()
|
||||
if newVersion then
|
||||
qbInventory:CreateInventory(fullTrunkId, { label = fullTrunkId })
|
||||
Wait(1000)
|
||||
for i = 1, #repacked_items do
|
||||
local v = repacked_items[i]
|
||||
qbInventory:AddItem(fullTrunkId, v.name, v.amount, v.slot, v.info, "community_bridge, adding items to trunk")
|
||||
end
|
||||
else
|
||||
-- I dont have a copy of this version to test it, if you run into issues please let me know.
|
||||
TriggerEvent("inventory:server:addTrunkItems", fullTrunkId, repacked_items)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param id string
|
||||
---@return boolean
|
||||
Inventory.ClearStash = function(id, _type)
|
||||
if type(id) ~= "string" then return false end
|
||||
if _type == "trunk" then
|
||||
id = "trunk-"..id
|
||||
elseif _type == "glovebox" then
|
||||
id = "glovebox-"..id
|
||||
end
|
||||
if qbInventory:GetInventory(id) then
|
||||
qbInventory:ClearStash(id)
|
||||
end
|
||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
||||
return true
|
||||
end
|
||||
|
||||
---This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -116,17 +74,16 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return Framework.Shared.Items
|
||||
end
|
||||
|
||||
---Returns the specified slot data as a table.
|
||||
---format {weight, name, metadata, slot, label, count}
|
||||
---@description Returns the specified slot data as a table.
|
||||
---@param src number
|
||||
---@param slot number
|
||||
---@return table
|
||||
---@return table {weight, name, metadata, slot, label, count}
|
||||
Inventory.GetItemBySlot = function(src, slot)
|
||||
local slotData = qbInventory:GetItemBySlot(src, slot)
|
||||
if not slotData then return {} end
|
||||
@@ -142,64 +99,88 @@ Inventory.GetItemBySlot = function(src, slot)
|
||||
}
|
||||
end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@description This will open the specified stash for the src passed.
|
||||
---@param src number
|
||||
---@param _type string
|
||||
---@param id number||string
|
||||
---@param _type string "stash", "trunk", "glovebox"
|
||||
---@param id string
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(src, _type, id)
|
||||
_type = _type or "stash"
|
||||
local tbl = Inventory.Stashes[id]
|
||||
|
||||
if getInventoryNewVersion() then
|
||||
if not Inventory.Version then return Inventory.Old.OpenStash(src, _type, id) end
|
||||
return qbInventory:OpenInventory(src, id)
|
||||
end
|
||||
|
||||
TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = tbl.weight, slots = tbl.slots})
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
---@param id number|string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@description This will add items to a stash, and return true or false based on success
|
||||
---@param id string
|
||||
---@param items table {item, count, metadata}
|
||||
---@return boolean
|
||||
---@return string|number
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
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
|
||||
Inventory.AddStashItems = function(id, items)
|
||||
if type(items) ~= "table" then return false end
|
||||
if not Inventory.Version then return Inventory.Old.AddStashItems(id, items) end
|
||||
local success = false
|
||||
for _, item in pairs(items) do
|
||||
success = qbInventory:AddItem(id, item.item, item.count or item.amount, nil, item.metadata or item.info, "community_bridge, adding items to stash")
|
||||
end
|
||||
return success
|
||||
end
|
||||
|
||||
---This will return a boolean if the player has the item.
|
||||
---@description This will add items to a trunk, and return true or false based on success
|
||||
---@param identifier string
|
||||
---@param items table
|
||||
---@return boolean
|
||||
Inventory.AddTrunkItems = function(identifier, items)
|
||||
if type(items) ~= "table" then return false end
|
||||
local fullTrunkId = "trunk-"..identifier
|
||||
if not Inventory.Version then return Inventory.Old.AddTrunkItems(fullTrunkId, items) end
|
||||
if not qbInventory:GetInventory(fullTrunkId) then
|
||||
qbInventory:CreateInventory(fullTrunkId, {label = fullTrunkId, slots = 15, maxweight = 10000})
|
||||
end
|
||||
Wait(1000)
|
||||
for i = 1, #items do
|
||||
qbInventory:AddItem(fullTrunkId, items[i].name, items[i].amount or items[i].count, items[i].slot or nil, items[i].info or items[i].metadata or {}, "community_bridge, adding items to trunk")
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---@description This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param id string
|
||||
---@return boolean
|
||||
Inventory.ClearStash = function(id, _type)
|
||||
if type(id) ~= "string" then return false end
|
||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
||||
if not Inventory.Version then return Inventory.Old.ClearStash(id, _type) end
|
||||
if _type == "trunk" then
|
||||
id = "trunk-"..id
|
||||
elseif _type == "glovebox" then
|
||||
id = "glovebox-"..id
|
||||
end
|
||||
local inv = qbInventory:GetInventory(id)
|
||||
if not inv then return true end
|
||||
qbInventory:ClearStash(id)
|
||||
return true
|
||||
end
|
||||
|
||||
---@description This will return a boolean if the player has the item.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(src, item)
|
||||
return qbInventory:HasItem(src, item, 1)
|
||||
Inventory.HasItem = function(src, item, requiredCount)
|
||||
return qbInventory:HasItem(src, item, requiredCount or 1)
|
||||
end
|
||||
|
||||
---This is to get if there is available space in the inventory, will return boolean.
|
||||
---@description This is to get if there is available space in the inventory, will return boolean.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@return boolean
|
||||
Inventory.CanCarryItem = function(src, item, count)
|
||||
return true
|
||||
if not Inventory.Version then return Inventory.Old.CanCarryItem(src, item, count) end
|
||||
return qbInventory:CanAddItem(src, item, count)
|
||||
end
|
||||
|
||||
---This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -209,13 +190,12 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@description This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@param oldplate string
|
||||
---@param newplate string
|
||||
---@return boolean
|
||||
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
local newVersion = getInventoryNewVersion()
|
||||
if newVersion then
|
||||
if not Inventory.Version then return Inventory.Old.UpdatePlate(oldplate, newplate) end
|
||||
local gloveboxInv = qbInventory:GetInventory('glovebox-'..oldplate) or {slots = 5, maxweight = 10000, items = {}}
|
||||
local storedGloveBox = Bridge.Tables.DeepClone(gloveboxInv, nil, nil)
|
||||
local trunkInv = qbInventory:GetInventory('trunk-'..oldplate) or {slots = 5, maxweight = 10000, items = {}}
|
||||
@@ -226,70 +206,112 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
qbInventory:SetInventory('glovebox-'..newplate, storedGloveBox.items, "Community Bridge Moving Items In GloveBox")
|
||||
qbInventory:CreateInventory('trunk-'..newplate, {label = 'trunk-'..newplate, slots = storedTrunk.slots, maxweight = storedTrunk.maxweight})
|
||||
qbInventory:SetInventory('trunk-'..newplate, storedTrunk.items, "Community Bridge Moving Items In Trunk")
|
||||
return true
|
||||
else
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
---@description This will open the specified shop for the src passed.
|
||||
---@param src number
|
||||
---@param shopTitle string
|
||||
Inventory.OpenShop = function(src, shopTitle)
|
||||
if not Inventory.Version then return Inventory.Old.OpenShop(src, shopTitle) end
|
||||
return qbInventory:OpenShop(src, shopTitle)
|
||||
end
|
||||
|
||||
---@description This will register a shop, if it already exists it will return true.
|
||||
---@param shopTitle string
|
||||
---@param inventory table
|
||||
---@param shopCoords table
|
||||
---@param shopGroups table
|
||||
Inventory.RegisterShop = function(shopTitle, inventory, shopCoords, shopGroups)
|
||||
if not shopTitle or not inventory then return end
|
||||
if Inventory.ShopData[shopTitle] then return true end
|
||||
if not Inventory.Version then return Inventory.Old.RegisterShop(shopTitle, inventory, shopCoords, shopGroups) end
|
||||
local repackedShopItems = {}
|
||||
for _, v in pairs(inventory) do
|
||||
table.insert(repackedShopItems, {name = v.name, price = v.price, amount = v.count or v.amount or 1000})
|
||||
end
|
||||
Inventory.ShopData[shopTitle] = { inventory = repackedShopItems, coords = shopCoords, groups = shopGroups }
|
||||
qbInventory:CreateShop({ name = shopTitle, label = shopTitle, coords = shopCoords, items = repackedShopItems, })
|
||||
end
|
||||
|
||||
---@description This will open a players inventory, used for admin purposes and stuff.
|
||||
---@param src number
|
||||
---@param target number
|
||||
Inventory.OpenPlayerInventory = function(src, target)
|
||||
assert(src, "OpenPlayerInventory: src is required")
|
||||
assert(target, "OpenPlayerInventory: target is required")
|
||||
exports['qb-inventory']:OpenInventory(src, target)
|
||||
end
|
||||
|
||||
Inventory.Old.OpenShop = function(src, shopTitle)
|
||||
local shopData = Inventory.ShopData[shopTitle]
|
||||
if not shopData then return false end
|
||||
TriggerClientEvent("inventory:client:OpenInventory", src, "shop", shopTitle, shopData)
|
||||
end
|
||||
|
||||
Inventory.Old.RegisterShop = function(shopTitle, inventory, shopCoords, shopGroups)
|
||||
local shopData = { label = shopTitle, items = {}, slots = 0 }
|
||||
|
||||
for _, v in pairs(inventory) do
|
||||
table.insert(shopData.items, { name = v.name, price = v.price, amount = v.count or v.amount or 1000, info = v.metadata or v.info or {}, type = 'item' })
|
||||
end
|
||||
|
||||
shopData.slots = #shopData.items
|
||||
Inventory.ShopData[shopTitle] = shopData
|
||||
print("QB-INVENTORY: You are using an outdated version of qb-inventory, please update to the latest version. Stuff will still work but you are using litterally the most exploitable inventory in fivem.")
|
||||
end
|
||||
|
||||
Inventory.Old.UpdatePlate = function(oldplate, newplate)
|
||||
local queries = {
|
||||
'UPDATE inventory_glovebox SET plate = @newplate WHERE plate = @oldplate',
|
||||
'UPDATE inventory_trunk SET plate = @newplate WHERE plate = @oldplate',
|
||||
}
|
||||
local values = { newplate = newplate, oldplate = oldplate }
|
||||
MySQL.transaction.await(queries, values)
|
||||
end
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
---This will open the specified shop for the src passed.
|
||||
---@param src number
|
||||
---@param shopTitle string
|
||||
Inventory.OpenShop = function(src, shopTitle)
|
||||
local newVersion = getInventoryNewVersion()
|
||||
if newVersion then
|
||||
return qbInventory:OpenShop(src, shopTitle)
|
||||
else
|
||||
local shopData = v1ShopData[shopTitle]
|
||||
if not shopData then return false end
|
||||
TriggerClientEvent("inventory:client:OpenInventory", src, "shop", shopTitle, shopData)
|
||||
end
|
||||
Inventory.Old.OpenStash = function(src, _type, id)
|
||||
local tbl = Inventory.Stashes[id]
|
||||
TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = tbl.weight or 5000, slots = tbl.slots or 20})
|
||||
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
|
||||
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
|
||||
if not shopTitle or not shopInventory then return end
|
||||
if registeredShops[shopTitle] then return true end
|
||||
registeredShops[shopTitle] = true
|
||||
local newVersion = getInventoryNewVersion()
|
||||
if newVersion then
|
||||
local repackedShopItems = {}
|
||||
for _, v in pairs(shopInventory) do
|
||||
table.insert(repackedShopItems, {name = v.name, price = v.price, amount = v.count or 1000})
|
||||
end
|
||||
qbInventory:CreateShop({ name = shopTitle, label = shopTitle, coords = shopCoords, items = repackedShopItems, })
|
||||
Inventory.Old.AddTrunkItems = function(fullTrunkId, items)
|
||||
TriggerEvent("inventory:server:addTrunkItems", fullTrunkId, items)
|
||||
return true
|
||||
else
|
||||
local shopData = { label = shopTitle, items = {}, slots = 0 }
|
||||
|
||||
for _, v in pairs(shopInventory) do
|
||||
table.insert(shopData.items, { name = v.name, price = v.price, amount = v.count or 1000, info = {}, type = 'item' })
|
||||
end
|
||||
|
||||
shopData.slots = #shopData.items
|
||||
-- TriggerClientEvent("inventory:client:OpenInventory", src, "shop", shopTitle, shopData)
|
||||
v1ShopData[shopTitle] = shopData
|
||||
print("QB-INVENTORY: You are using an outdated version of qb-inventory, please update to the latest version. Stuff will still work but you are using litterally the most exploitable inventory in fivem.")
|
||||
end
|
||||
Inventory.Old.AddStashItems = function(id, items)
|
||||
return false, print("AddStashItems is not supported with qb-inventory v1")
|
||||
end
|
||||
|
||||
Inventory.OpenPlayerInventory = function(src, target)
|
||||
assert(src, "OpenPlayerInventory: src is required")
|
||||
if not target then
|
||||
target = src
|
||||
Inventory.Old.ClearStash = function(id, _type)
|
||||
return false, print("ClearStash is not supported with qb-inventory v1")
|
||||
end
|
||||
exports['qb-inventory']:OpenInventory(src, target)
|
||||
|
||||
Inventory.Old.CanCarryItem = function(src, item, count)
|
||||
local oldQbInventoryConfig = Require('config.lua', 'qb-inventory')
|
||||
local maxInvWeight = oldQbInventoryConfig.MaxWeight or 100000
|
||||
local maxInvSlots = oldQbInventoryConfig.MaxSlots or 30
|
||||
local packedWeight = 0
|
||||
local addedSlots = 1
|
||||
local stackCheck = Inventory.GetItemInfo(item).stack
|
||||
local playerInv = Framework.GetPlayerInventory(src)
|
||||
if not playerInv then return false end
|
||||
for k, v in pairs(playerInv) do
|
||||
if v.name then
|
||||
local weight = Inventory.GetItemInfo(v.name).weight or 0
|
||||
count = count + v.count
|
||||
packedWeight = packedWeight + (weight * v.count)
|
||||
end
|
||||
end
|
||||
local slotsUsed = #playerInv
|
||||
if not stackCheck then addedSlots = count end
|
||||
if slotsUsed + addedSlots > maxInvSlots then return false end
|
||||
if packedWeight + (Inventory.GetItemInfo(item).weight or 0) * count > maxInvWeight then return false end
|
||||
return true
|
||||
end
|
||||
|
||||
return Inventory
|
||||
@@ -1,40 +1,40 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('qs-inventory') ~= 'started' then return end
|
||||
if GetResourceState('qs-inventory') == 'missing' then return end
|
||||
local quasar = exports["qs-inventory"]
|
||||
|
||||
Inventory = Inventory or {}
|
||||
|
||||
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
local itemsData = quasar:GetItemList()
|
||||
if not itemsData then return {} end
|
||||
local itemData = itemsData[item]
|
||||
if not itemData then return {} end
|
||||
return {
|
||||
name = itemData.name or "Missing Name",
|
||||
label = itemData.label or "Missing Label",
|
||||
stack = itemData.unique or "false",
|
||||
weight = itemData.weight or "0",
|
||||
description = itemData.description or "none",
|
||||
image = Inventory.GetImagePath(item),
|
||||
}
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "qs-inventory"
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
local itemsData = quasar:GetItemList()
|
||||
if not itemsData then return {} end
|
||||
itemsData = itemsData[item]
|
||||
if not itemsData then return {} end
|
||||
return {
|
||||
name = itemsData.name or "Missing Name",
|
||||
label = itemsData.label or "Missing Label",
|
||||
stack = itemsData.unique or "false",
|
||||
weight = itemsData.weight or "0",
|
||||
description = itemsData.description or "none",
|
||||
image = Inventory.GetImagePath(item),
|
||||
}
|
||||
end
|
||||
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return quasar:GetItemList()
|
||||
end
|
||||
|
||||
---Will return boolean if the player has the item.
|
||||
---@description Will return boolean if the player has the item.
|
||||
---@param item string
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(item)
|
||||
@@ -42,7 +42,7 @@ Inventory.HasItem = function(item)
|
||||
return check and true or false
|
||||
end
|
||||
|
||||
---This will return th count of the item in the players inventory, if not found will return 0.
|
||||
---@description This will return th count of the item in the players inventory, if not found will return 0.
|
||||
---@param item string
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(item)
|
||||
@@ -50,7 +50,7 @@ Inventory.GetItemCount = function(item)
|
||||
return searchItem or 0
|
||||
end
|
||||
|
||||
---This will get the image path for this item, if not found will return placeholder.
|
||||
---@description This will get the image path for this item, if not found will return placeholder.
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -60,7 +60,7 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@description This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function()
|
||||
local items = {}
|
||||
@@ -69,10 +69,10 @@ Inventory.GetPlayerInventory = function()
|
||||
table.insert(items, {
|
||||
name = v.name,
|
||||
label = v.label,
|
||||
count = v.amount,
|
||||
count = v.amount or v.count,
|
||||
slot = v.slot,
|
||||
metadata = v.info,
|
||||
stack = v.unique,
|
||||
metadata = v.info or v.metadata or {},
|
||||
stack = v.unique or v.stack or false,
|
||||
close = v.useable,
|
||||
weight = v.weight
|
||||
})
|
||||
@@ -80,11 +80,4 @@ Inventory.GetPlayerInventory = function()
|
||||
return items
|
||||
end
|
||||
|
||||
---comment
|
||||
---@param id any
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(id)
|
||||
quasar:RegisterStash(id, 50, 50000)
|
||||
end
|
||||
|
||||
return Inventory
|
||||
@@ -1,12 +1,18 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('qs-inventory') ~= 'started' then return end
|
||||
if GetResourceState('qs-inventory') == 'missing' then return end
|
||||
|
||||
local quasar = exports['qs-inventory']
|
||||
|
||||
Inventory = Inventory or {}
|
||||
Inventory.Stashes = Inventory.Stashes or {}
|
||||
|
||||
---This will add an item, and return true or false based on success
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "qs-inventory"
|
||||
end
|
||||
|
||||
---@description This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
@@ -15,17 +21,13 @@ Inventory.Stashes = Inventory.Stashes or {}
|
||||
---@return boolean
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
if not quasar:CanCarryItem(src, item, count) then return false end
|
||||
local success = quasar:AddItem(src, item, count, slot, metadata)
|
||||
if not success 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)
|
||||
return success
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "qs-inventory"
|
||||
end
|
||||
|
||||
---This will remove an item, and return true or false based on success
|
||||
---@description This will remove an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
@@ -33,46 +35,22 @@ end
|
||||
---@param metadata table
|
||||
---@return boolean
|
||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||
local success = quasar:RemoveItem(src, item, count, slot, metadata)
|
||||
if not success then return false end
|
||||
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)
|
||||
return success
|
||||
end
|
||||
|
||||
---This will add items to a trunk, and return true or false based on success
|
||||
---@param identifier string
|
||||
---@param items table
|
||||
---@return boolean
|
||||
Inventory.AddTrunkItems = function(identifier, items)
|
||||
if type(items) ~= "table" then return false end
|
||||
return false
|
||||
--[[
|
||||
for k, v in pairs(items) do
|
||||
--
|
||||
In testing this inventory allowed it on owned vehicle but not unowned vehicles,
|
||||
also attempted registering it as a stash with no luck.
|
||||
was thinking about just forcing it in sql but there is data attached that I assume is a timestamp
|
||||
kinda not sure on this one atm...
|
||||
Also there is no GetInventory(identifier) only by player source
|
||||
--quasar:AddToTrunk(identifier, v.count, v.metadata, v.item, v.metadata)
|
||||
end
|
||||
return true
|
||||
--]]
|
||||
end
|
||||
|
||||
---This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@description This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param id string
|
||||
---@return boolean
|
||||
Inventory.ClearStash = function(id, _type)
|
||||
if type(id) ~= "string" then return false end
|
||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
||||
return false
|
||||
--[[
|
||||
quasar:ClearOtherInventory(_type, id)
|
||||
|
||||
return true
|
||||
--]]
|
||||
end
|
||||
|
||||
---This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -90,24 +68,23 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return quasar:GetItemList()
|
||||
end
|
||||
|
||||
---This will return the count of the item in the players inventory, if not found will return 0.
|
||||
---
|
||||
---if metadata is passed it will find the matching items count.
|
||||
---@description This will return the count of the item in the players inventory, if not found will return 0.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param metadata table
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(src, item, metadata)
|
||||
return quasar:GetItemTotalAmount(src, item)
|
||||
if metadata then print("qs-inventory does not support metadata searching for item counts, you will need to get the inventory and parse it manually.") end
|
||||
return quasar:GetItemTotalAmount(src, item) or 0
|
||||
end
|
||||
|
||||
---This wil return the players inventory.
|
||||
---@description This wil return the players inventory.
|
||||
---@param src number
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function(src)
|
||||
@@ -116,20 +93,18 @@ Inventory.GetPlayerInventory = function(src)
|
||||
for _, v in pairs(playerItems) do
|
||||
table.insert(repackedTable, {
|
||||
name = v.name,
|
||||
count = v.amount,
|
||||
metadata = v.info,
|
||||
count = v.amount or v.count,
|
||||
metadata = v.info or v.metadata or {},
|
||||
slot = v.slot,
|
||||
})
|
||||
end
|
||||
return repackedTable
|
||||
end
|
||||
|
||||
---Returns the specified slot data as a table.
|
||||
---
|
||||
---format {weight, name, metadata, slot, label, count}
|
||||
---@description Returns the specified slot data as a table.
|
||||
---@param src number
|
||||
---@param slot number
|
||||
---@return table
|
||||
---@return table {weight, name, metadata, slot, label, count}
|
||||
Inventory.GetItemBySlot = function(src, slot)
|
||||
local playerItems = quasar:GetInventory(src)
|
||||
for _, item in pairs(playerItems) do
|
||||
@@ -139,9 +114,9 @@ Inventory.GetItemBySlot = function(src, slot)
|
||||
label = item.label,
|
||||
weight = item.weight,
|
||||
slot = slot,
|
||||
count = item.amount,
|
||||
metadata = item.info,
|
||||
stack = item.unique or false,
|
||||
count = item.amount or item.count,
|
||||
metadata = item.info or item.metadata or {},
|
||||
stack = item.unique or item.stack or false,
|
||||
description = item.description
|
||||
}
|
||||
end
|
||||
@@ -149,7 +124,7 @@ Inventory.GetItemBySlot = function(src, slot)
|
||||
return {}
|
||||
end
|
||||
|
||||
---This will set the metadata of an item in the inventory.
|
||||
---@description This will set the metadata of an item in the inventory.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param slot number
|
||||
@@ -159,62 +134,40 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
|
||||
return quasar:SetItemMetadata(src, slot, metadata)
|
||||
end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@description 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, _type, id)
|
||||
_type = _type or "stash"
|
||||
if not Inventory.Stashes[id] then return end
|
||||
local tbl = Inventory.Stashes[id]
|
||||
TriggerEvent("inventory:server:OpenInventory", _type, id, tbl and { maxweight = tbl.weight, slots = tbl.slots })
|
||||
TriggerEvent("inventory:server:OpenInventory", _type, id, tbl and { maxweight = tbl.weight or 5000, slots = tbl.slots or 20 })
|
||||
TriggerClientEvent("inventory:client:SetCurrentStash",src, id)
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
---@param id number|string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string|number
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
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.
|
||||
---@description This will return a boolean if the player has the item.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(src, item)
|
||||
Inventory.HasItem = function(src, item, requiredCount)
|
||||
local count = quasar:GetItemTotalAmount(src, item)
|
||||
if not count then return false end
|
||||
return count > 0
|
||||
return count >= (requiredCount or 1)
|
||||
end
|
||||
|
||||
---This is to get if there is available space in the inventory, will return boolean.
|
||||
---@description This is to get if there is available space in the inventory, will return boolean.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@return boolean
|
||||
Inventory.CanCarryItem = function(src, item, count)
|
||||
return quasar:CanCarryItem(src, item, count)
|
||||
return quasar:CanCarryItem(src, item, count) or false
|
||||
end
|
||||
|
||||
---This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@description This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@param oldplate string
|
||||
---@param newplate string
|
||||
---@return boolean
|
||||
@@ -229,7 +182,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
---This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -239,12 +192,4 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
Inventory.OpenPlayerInventory = function(src, target)
|
||||
assert(src, "OpenPlayerInventory: src is required")
|
||||
if not target then
|
||||
target = src
|
||||
end
|
||||
exports['qs-inventory']:OpenInventory(src, target)
|
||||
end
|
||||
|
||||
return Inventory
|
||||
@@ -1,10 +1,17 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('tgiann-inventory') ~= 'started' then return end
|
||||
if GetResourceState('tgiann-inventory') == 'missing' then return end
|
||||
|
||||
local tgiann = exports["tgiann-inventory"]
|
||||
|
||||
Inventory = Inventory or {}
|
||||
|
||||
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "tgiann-inventory"
|
||||
end
|
||||
|
||||
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -21,20 +28,15 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "tgiann-inventory"
|
||||
end
|
||||
|
||||
---Will return boolean if the player has the item.
|
||||
---@description Will return boolean if the player has the item.
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(item)
|
||||
return tgiann:HasItem(item)
|
||||
Inventory.HasItem = function(item, requiredCount)
|
||||
return tgiann:HasItem(item, requiredCount)
|
||||
end
|
||||
|
||||
---This will return th count of the item in the players inventory, if not found will return 0.
|
||||
---@description This will return their count of the item in the players inventory, if not found will return 0.
|
||||
---@param item string
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(item)
|
||||
@@ -42,7 +44,7 @@ Inventory.GetItemCount = function(item)
|
||||
return searchItem or 0
|
||||
end
|
||||
|
||||
---This will get the image path for this item, if not found will return placeholder.
|
||||
---@description This will get the image path for this item, if not found will return placeholder.
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -54,7 +56,7 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@description This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function()
|
||||
local items = {}
|
||||
@@ -74,10 +76,4 @@ Inventory.GetPlayerInventory = function()
|
||||
return items
|
||||
end
|
||||
|
||||
---@param id any
|
||||
---@return nil
|
||||
Inventory.OpenStash = function(id)
|
||||
tgiann:OpenInventory('stash', id, { maxweight = 400000, slots = 100 })
|
||||
end
|
||||
|
||||
return Inventory
|
||||
@@ -1,43 +1,46 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('tgiann-inventory') ~= 'started' then return end
|
||||
if GetResourceState('tgiann-inventory') == 'missing' then return end
|
||||
|
||||
local tgiann = exports["tgiann-inventory"]
|
||||
|
||||
Inventory = Inventory or {}
|
||||
Inventory.Stashes = Inventory.Stashes or {}
|
||||
|
||||
---This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@return boolean
|
||||
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
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "tgiann-inventory"
|
||||
end
|
||||
|
||||
---This will remove an item, and return true or false based on success
|
||||
---@description This will add an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number
|
||||
---@param metadata table
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
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)
|
||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||
if not tgiann:CanCarryItem(src, item, count) then return false end
|
||||
local success = tgiann:AddItem(src, item, count, slot, metadata, false)
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return success or false
|
||||
end
|
||||
|
||||
---This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@description This will remove an item, and return true or false based on success
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
---@param slot number (optional)
|
||||
---@param metadata table (optional)
|
||||
---@return boolean
|
||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||
local success = tgiann:RemoveItem(src, item, count, slot, metadata)
|
||||
if not success then return false end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
|
||||
return success or false
|
||||
end
|
||||
|
||||
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
@@ -53,25 +56,23 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@description This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return tgiann:GetItemList()
|
||||
end
|
||||
|
||||
---This will return the count of the item in the players inventory, if not found will return 0.
|
||||
---
|
||||
---if metadata is passed it will find the matching items count.
|
||||
---@description This will return the count of the item in the players inventory, if not found will return 0.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param metadata table
|
||||
---@param metadata table (optional)
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(src, item, metadata)
|
||||
local _item = tgiann:GetItemByName(src, item, metadata)
|
||||
return _item.amount or 0
|
||||
end
|
||||
|
||||
---This wil return the players inventory.
|
||||
---@description This will return the players inventory.
|
||||
---@param src number
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function(src)
|
||||
@@ -85,12 +86,10 @@ Inventory.GetPlayerInventory = function(src)
|
||||
return items
|
||||
end
|
||||
|
||||
---Returns the specified slot data as a table.
|
||||
---
|
||||
---format {weight, name, metadata, slot, label, count}
|
||||
---@description Returns the specified slot data as a table.
|
||||
---@param src number
|
||||
---@param slot number
|
||||
---@return table
|
||||
---@return table {weight, name, metadata, slot, label, count}
|
||||
Inventory.GetItemBySlot = function(src, slot)
|
||||
local item = tgiann:GetItemBySlot(src, slot)
|
||||
if not item then return {} end
|
||||
@@ -99,14 +98,14 @@ Inventory.GetItemBySlot = function(src, slot)
|
||||
label = item.label,
|
||||
weight = item.weight,
|
||||
slot = slot,
|
||||
count = item.amount,
|
||||
metadata = item.info,
|
||||
stack = item.unique or false,
|
||||
count = item.amount or item.count,
|
||||
metadata = item.info or item.metadata or {},
|
||||
stack = item.unique or item.stack or false,
|
||||
description = item.description
|
||||
}
|
||||
end
|
||||
|
||||
---This will set the metadata of an item in the inventory.
|
||||
---@description This will set the metadata of an item in the inventory.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param slot number
|
||||
@@ -116,42 +115,18 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
|
||||
tgiann:UpdateItemMetadata(src, item, slot, metadata)
|
||||
end
|
||||
|
||||
---This will open the specified stash for the src passed.
|
||||
---@description 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, _type, id)
|
||||
_type = _type or "stash"
|
||||
local tbl = Inventory.Stashes[id]
|
||||
local tbl = Inventory.Stashes[id] or {weight = 1000000, slot = 50, label = "Stash"}
|
||||
return tgiann:ForceOpenInventory(src, _type, id, tbl and { maxWeight = tbl.weight , slots = tbl.slot, label = tbl.label})
|
||||
end
|
||||
|
||||
---This will register a stash
|
||||
---@param id number|string
|
||||
---@param label string
|
||||
---@param slots number
|
||||
---@param weight number
|
||||
---@param owner string
|
||||
---@param groups table
|
||||
---@param coords table
|
||||
---@return boolean
|
||||
---@return string|number
|
||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||
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.
|
||||
---@description This will return a boolean if the player has the item.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@return boolean
|
||||
@@ -159,7 +134,7 @@ Inventory.HasItem = function(src, item)
|
||||
return tgiann:HasItem(src, item, 1)
|
||||
end
|
||||
|
||||
---This is to get if there is available space in the inventory, will return boolean.
|
||||
---@description This is to get if there is available space in the inventory, will return boolean.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param count number
|
||||
@@ -168,7 +143,7 @@ Inventory.CanCarryItem = function(src, item, count)
|
||||
return tgiann:CanCarryItem(src, item, count)
|
||||
end
|
||||
|
||||
---This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@description This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||
---@param oldplate string
|
||||
---@param newplate string
|
||||
---@return boolean
|
||||
@@ -184,7 +159,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
---This will add items to a trunk, and return true or false based on success
|
||||
---@description This will add items to a trunk, and return true or false based on success
|
||||
---@param identifier string
|
||||
---@param items table
|
||||
---@return boolean
|
||||
@@ -197,7 +172,7 @@ Inventory.AddTrunkItems = function(identifier, items)
|
||||
return true
|
||||
end
|
||||
|
||||
---This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@description This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||
---@param id string
|
||||
---@return boolean
|
||||
Inventory.ClearStash = function(id, _type)
|
||||
@@ -207,7 +182,7 @@ Inventory.ClearStash = function(id, _type)
|
||||
return true
|
||||
end
|
||||
|
||||
---This will get the image path for this item, if not found will return placeholder.
|
||||
---@description This will get the image path for this item, if not found will return placeholder.
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -219,30 +194,13 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---UNUSED:
|
||||
---This will return generic item data from the specified inventory, with the items total count.
|
||||
---
|
||||
---format without metadata { count, stack, name, weight, label }
|
||||
---
|
||||
---fortmat with metadata { count, stack, name, weight, label, metadata }
|
||||
---@description This will open a players inventory, used for admin purposes and stuff.
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@param metadata table
|
||||
---@return table
|
||||
Inventory.GetItem = function(src, item, metadata)
|
||||
local item = tgiann:GetItemByName(src, item, metadata)
|
||||
item.count = item.amount
|
||||
item.metadata = item.info
|
||||
return item
|
||||
end
|
||||
|
||||
---@param target number
|
||||
Inventory.OpenPlayerInventory = function(src, target)
|
||||
assert(src, "OpenPlayerInventory: src is required")
|
||||
if not target then
|
||||
target = src
|
||||
assert(target, "OpenPlayerInventory: target is required")
|
||||
tgiann:OpenInventoryById(src, target)
|
||||
end
|
||||
exports['tgiann-inventory']:OpenInventoryById(src, target)
|
||||
end
|
||||
|
||||
|
||||
return Inventory
|
||||
@@ -25,14 +25,14 @@ function Language.Locale(str, ...)
|
||||
|
||||
-- Handle nested tables via dot notation
|
||||
local current = locales
|
||||
for part in str:gmatch("[^%.]+") do
|
||||
for part in str:gmatch("([^%.]+)") do
|
||||
if type(current) ~= "table" then
|
||||
warn(("Invalid nested locale path: %s"):format(str))
|
||||
warn(("Invalid nested locale path: %s for resource: %s"):format(str, resource))
|
||||
return str
|
||||
end
|
||||
current = current[part]
|
||||
if not current then
|
||||
warn(("Locale not found for key: %s in language: %s"):format(str, Lang))
|
||||
warn(("Locale not found for key: %s in language: %s for resource: %s"):format(str, Lang, resource))
|
||||
return str
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
local resourceName = "wasabi_uikit"
|
||||
local configValue = BridgeClientConfig.MenuSystem
|
||||
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||
Menus = Menus or {}
|
||||
|
||||
---Converts a QB menu to an Wasabi menu.
|
||||
---@param id string The menu ID.
|
||||
---@param menu table The QB menu data.
|
||||
---@return table The Wasabi menu data.
|
||||
local function QBToWasabiMenu(id, menu)
|
||||
local wasabiMenu = {
|
||||
id = id,
|
||||
title = "",
|
||||
canClose = true,
|
||||
options = {},
|
||||
}
|
||||
for i, v in pairs(menu) do
|
||||
if v.isMenuHeader then
|
||||
if wasabiMenu.title == "" then
|
||||
wasabiMenu.title = v.header
|
||||
end
|
||||
else
|
||||
local option = {
|
||||
title = v.header,
|
||||
description = v.txt,
|
||||
icon = v.icon,
|
||||
args = v.params.args,
|
||||
onSelect = v.action or function(selected, secondary, args)
|
||||
local params = menu[id]?.options?[selected]?.params
|
||||
if not params then return end
|
||||
local event = params.event
|
||||
local isServer = params.isServer
|
||||
if not event then return end
|
||||
if isServer then
|
||||
return TriggerServerEvent(event, args)
|
||||
end
|
||||
return TriggerEvent(event, args)
|
||||
end
|
||||
|
||||
}
|
||||
table.insert(wasabiMenu.options, option)
|
||||
end
|
||||
end
|
||||
return wasabiMenu
|
||||
end
|
||||
|
||||
function OpenMenu(id, data, useQBinput)
|
||||
if useQBinput then
|
||||
data = QBToWasabiMenu(id, data)
|
||||
end
|
||||
exports.wasabi_uikit:RegisterContextMenu(data)
|
||||
exports.wasabi_uikit:OpenContextMenu(id)
|
||||
return data
|
||||
end
|
||||
|
||||
GetMenuResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
@@ -5,18 +5,30 @@ Notify.GetResourceName = function()
|
||||
return "default"
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---DEPRICATED: PLEASE SWITCH TO Notify.SendNotification
|
||||
---12/13/25
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@return nil
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
return Notify.SendNotification(nil, message, _type, time)
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
return Framework.Notify(message, nil, time)
|
||||
end
|
||||
|
||||
RegisterNetEvent('community_bridge:Client:Notify', function(message, _type, time)
|
||||
Notify.SendNotify(message, _type, time)
|
||||
RegisterNetEvent('community_bridge:Client:Notify', function(title, message, _type, time, props)
|
||||
Notify.SendNotification(title, message, _type, time, props)
|
||||
end)
|
||||
|
||||
---------[[Depricated Stuff Below, please adjust to the HelpText module instead]]--------
|
||||
|
||||
@@ -1,17 +1,35 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
Notify = Notify or {}
|
||||
|
||||
---This will send a notification to the specified player of the passed message and type
|
||||
Notify.GetResourceName = function()
|
||||
return "default"
|
||||
end
|
||||
|
||||
---DEPRICATED: PLEASE SWITCH TO Notify.SendNotification
|
||||
---12/13/25
|
||||
---@param src number
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@return nil
|
||||
Notify.SendNotify = function(src, message, _type, time)
|
||||
TriggerClientEvent('community_bridge:Client:Notify', src, message, _type, time)
|
||||
Notify.SendNotification(src, nil, message, _type, time)
|
||||
end
|
||||
|
||||
Notify.GetResourceName = function()
|
||||
return "default"
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param src number
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotification = function(src, title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
if not title then
|
||||
title = Bridge.Language.Locale("Notifications.PlaceholderTitle")
|
||||
end
|
||||
TriggerClientEvent('community_bridge:Client:Notify', src, title, message, _type, time, props)
|
||||
end
|
||||
|
||||
---------[[Depricated Stuff Below, please adjust to the HelpText module instead]]--------
|
||||
|
||||
@@ -10,13 +10,16 @@ Notify.GetResourceName = function()
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
return exports['brutal_notify']:SendAlert('Notification', message, time, _type or "success", false)
|
||||
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||
return exports['brutal_notify']:SendAlert(title, message, time, _type or "success", false)
|
||||
end
|
||||
|
||||
return Notify
|
||||
@@ -4,18 +4,20 @@ local resourceName = "FL-Notify"
|
||||
local configValue = BridgeSharedConfig.Notify
|
||||
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||
|
||||
|
||||
Notify.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||
if _type == "error" or _type == "info" then
|
||||
_type = tostring(1)
|
||||
elseif _type == "success" then
|
||||
|
||||
@@ -10,13 +10,16 @@ Notify.GetResourceName = function()
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
return exports.lation_ui:notify({ message = message, type = _type or "success", duration = time, position = 'top-right' })
|
||||
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||
return exports.lation_ui:notify({ title = title, message = message, type = _type or "success", duration = time, position = 'top-right' })
|
||||
end
|
||||
|
||||
return Notify
|
||||
@@ -9,12 +9,15 @@ Notify.GetResourceName = function()
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||
_type = _type or "inform"
|
||||
return exports['mythic_notify']:SendAlert(_type, message, time)
|
||||
end
|
||||
|
||||
@@ -9,13 +9,16 @@ Notify.GetResourceName = function()
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
return exports['okokNotify']:Alert('Notification', message, time, _type or "Success", false)
|
||||
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||
return exports['okokNotify']:Alert(title, message, time, _type or "Success", false)
|
||||
end
|
||||
|
||||
return Notify
|
||||
@@ -4,19 +4,21 @@ local resourceName = "ox_lib"
|
||||
local configValue = BridgeSharedConfig.Notify
|
||||
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||
|
||||
|
||||
Notify.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
return exports.ox_lib:notify({ description = message, type = _type, duration = time, position = 'top-right' })
|
||||
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||
return exports.ox_lib:notify({ title = title, description = message, type = _type or "success", duration = time, position = 'top-right' })
|
||||
end
|
||||
|
||||
return Notify
|
||||
@@ -9,13 +9,16 @@ Notify.GetResourceName = function()
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
return exports['pNotify']:SendNotification({ text = message, type = _type, timeout = time, layout = 'centerRight' })
|
||||
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||
return exports['pNotify']:SendNotification({ title = title, text = message, type = _type or "success", timeout = time, layout = 'centerRight' })
|
||||
end
|
||||
|
||||
return Notify
|
||||
@@ -9,13 +9,16 @@ Notify.GetResourceName = function()
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
return exports.r_notify:notify({title = 'Notification', content = message, type = _type, icon = "fas fa-check", duration = time, position = 'top-right', sound = false})
|
||||
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||
return exports.r_notify:notify({title = title, content = message, type = _type or "success", icon = "fas fa-check", duration = time, position = 'top-right', sound = false})
|
||||
end
|
||||
|
||||
return Notify
|
||||
@@ -9,14 +9,17 @@ Notify.GetResourceName = function()
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||
_type = _type or "info"
|
||||
return exports['t-notify']:Alert({ style = _type, message = message, duration = time, })
|
||||
return exports['t-notify']:Alert({ title = title, style = _type, message = message, duration = time, })
|
||||
end
|
||||
|
||||
return Notify
|
||||
@@ -9,12 +9,15 @@ Notify.GetResourceName = function()
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||
_type = _type or "info"
|
||||
return exports.wasabi_notify:notify(_type, message, time, _type)
|
||||
end
|
||||
|
||||
@@ -17,7 +17,7 @@ end
|
||||
---@param message string
|
||||
---@return boolean
|
||||
Phone.SendEmail = function(email, title, message)
|
||||
return false, Print.Error('There Is No Phone Bridged.')
|
||||
return false, print('^6 There is no phone bridged in community_bridge. ^0')
|
||||
end
|
||||
|
||||
return Phone
|
||||
@@ -15,7 +15,7 @@ end
|
||||
---@param src number
|
||||
---@return number|boolean
|
||||
Phone.GetPlayerPhone = function(src)
|
||||
return false, Print.Error('There Is No Phone Bridged.')
|
||||
return false, print('^6 There is no phone bridged in community_bridge. ^0')
|
||||
end
|
||||
|
||||
---This will send an email to the passed source, email address, title and message.
|
||||
@@ -25,7 +25,7 @@ end
|
||||
---@param message string
|
||||
---@return boolean
|
||||
Phone.SendEmail = function(src, email, title, message)
|
||||
return false, Print.Error('There Is No Phone Bridged.')
|
||||
return false, print('^6 There is no phone bridged in community_bridge. ^0')
|
||||
end
|
||||
|
||||
return Phone
|
||||
@@ -28,21 +28,20 @@ end
|
||||
---@return boolean
|
||||
Phone.SendEmail = function(src, email, title, message)
|
||||
local numberNumber = exports["lb-phone"]:GetEquippedPhoneNumber(src)
|
||||
if not numberNumber then return false, Prints.Error("Could not Find Phone number") end
|
||||
if not numberNumber then return false, print(" ^6 Could not Find Phone number ^0") end
|
||||
local playerEmail = exports["lb-phone"]:GetEmailAddress(numberNumber)
|
||||
if not playerEmail then return false, Prints.Error("Could not Find email") end
|
||||
if not playerEmail then return false, print(" ^6 Could not Find email ^0") end
|
||||
local success, id = exports["lb-phone"]:SendMail({
|
||||
to = playerEmail,
|
||||
sender = email,
|
||||
subject = title,
|
||||
message = message,
|
||||
})
|
||||
return success
|
||||
return success or false
|
||||
end
|
||||
|
||||
RegisterNetEvent('community_bridge:Server:genericEmail', function(data)
|
||||
local src = source
|
||||
Prints.Debug('community_bridge:Server:genericEmail Hit')
|
||||
return Phone.SendEmail(src, data.email, data.title, data.message)
|
||||
end)
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "qb-phone"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
if GetResourceState("lb-phone") ~= 'missing' then return end
|
||||
if GetResourceState("gksphone") ~= 'missing' then return end
|
||||
if GetResourceState("okokPhone") ~= 'missing' then return end
|
||||
if GetResourceState("qs-smartphone") ~= 'missing' then return end
|
||||
if GetResourceState("yseries") ~= 'missing' then return end
|
||||
Phone = Phone or {}
|
||||
|
||||
---This will get the name of the Phone system being being used.
|
||||
---@return string
|
||||
Phone.GetPhoneName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
Phone.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will send an email to the passed email address with the title and message.
|
||||
---@param email string
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@return boolean
|
||||
Phone.SendEmail = function(email, title, message)
|
||||
TriggerServerEvent('community_bridge:Server:genericEmail', {email = email, title = title, message = message})
|
||||
end
|
||||
|
||||
return Phone
|
||||
@@ -0,0 +1,48 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "qb-phone"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
if GetResourceState("lb-phone") ~= 'missing' then return end
|
||||
if GetResourceState("gksphone") ~= 'missing' then return end
|
||||
if GetResourceState("okokPhone") ~= 'missing' then return end
|
||||
if GetResourceState("qs-smartphone") ~= 'missing' then return end
|
||||
if GetResourceState("yseries") ~= 'missing' then return end
|
||||
Phone = Phone or {}
|
||||
|
||||
---This will get the name of the Phone system being being used.
|
||||
---@return string
|
||||
Phone.GetPhoneName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
Phone.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the phone number of the passed source.
|
||||
---@param src number
|
||||
---@return number|boolean
|
||||
Phone.GetPlayerPhone = function(src)
|
||||
return Bridge.Framework.GetPlayerPhone(src) or false
|
||||
end
|
||||
|
||||
---This will send an email to the passed source, email address, title and message.
|
||||
---@param src number
|
||||
---@param email string
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@return boolean
|
||||
Phone.SendEmail = function(src, email, title, message)
|
||||
local identifier = Bridge.Framework.GetPlayerIdentifier(src)
|
||||
if not identifier then return false, print(" ^6 Could not Find Player Identifier ^0") end
|
||||
|
||||
local mailData = { sender = email, subject = title, message = message }
|
||||
exports["qb-phone"]:sendNewMailToOffline(identifier, mailData)
|
||||
return true
|
||||
end
|
||||
|
||||
RegisterNetEvent('community_bridge:Server:genericEmail', function(data)
|
||||
local src = source
|
||||
return Phone.SendEmail(src, data.email, data.title, data.message)
|
||||
end)
|
||||
|
||||
return Phone
|
||||
@@ -0,0 +1,18 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "default"
|
||||
ProgressBar = ProgressBar or {}
|
||||
|
||||
---This function opens a progress bar.
|
||||
---@param options table
|
||||
---@param cb any
|
||||
---@param isQBInput boolean||optional
|
||||
---@return boolean
|
||||
function ProgressBar.Open(options, cb, isQBInput)
|
||||
return true, print("No supported progress bar system found.")
|
||||
end
|
||||
|
||||
ProgressBar.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
return ProgressBar
|
||||
@@ -0,0 +1,71 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "keep-progressbar"
|
||||
local configValue = BridgeClientConfig.ProgressBarSystem
|
||||
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||
|
||||
ProgressBar = ProgressBar or {}
|
||||
|
||||
---This function converts a QB progress bar options table to an Ox progress bar options table.
|
||||
---@param options table
|
||||
---@return table
|
||||
local function convertFromQB(options)
|
||||
if not options then return options end
|
||||
local prop1 = options.prop or {}
|
||||
local prop2 = options.propTwo or {}
|
||||
local props = {
|
||||
{
|
||||
model = prop1.model,
|
||||
bone = prop1.bone,
|
||||
pos = prop1.coords,
|
||||
rot = prop1.rotation,
|
||||
},
|
||||
{
|
||||
model = prop2.model,
|
||||
bone = prop2.bone,
|
||||
pos = prop2.coords,
|
||||
rot = prop2.rotation,
|
||||
}
|
||||
}
|
||||
return {
|
||||
duration = options.duration,
|
||||
label = options.label,
|
||||
position = 'bottom',
|
||||
useWhileDead = options.useWhileDead,
|
||||
canCancel = options.canCancel,
|
||||
disable = {
|
||||
move = options.controlDisables?.disableMovement,
|
||||
car = options.controlDisables?.disableCarMovement,
|
||||
combat = options.controlDisables?.disableCombat,
|
||||
mouse = options.controlDisables?.disableMouse
|
||||
},
|
||||
anim = {
|
||||
dict = options.animation?.animDict,
|
||||
clip = options.animation?.anim,
|
||||
flag = options.animation?.flags or 49,
|
||||
},
|
||||
prop = props,
|
||||
}
|
||||
end
|
||||
|
||||
---This function opens a progress bar.
|
||||
---@param options table
|
||||
---@param cb any
|
||||
---@param isQBInput boolean||optional
|
||||
---@return boolean
|
||||
function ProgressBar.Open(options, cb, isQBInput)
|
||||
if isQBInput then
|
||||
options = convertFromQB(options)
|
||||
end
|
||||
|
||||
local style = options.style or 'bar'
|
||||
local success = style == 'circle' and exports['keep-progressbar']:ox_lib_progressBar(options) or exports['keep-progressbar']:ox_lib_progressBar(options)
|
||||
|
||||
if cb then cb(success) end
|
||||
return success
|
||||
end
|
||||
|
||||
ProgressBar.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
return ProgressBar
|
||||
@@ -65,7 +65,7 @@ function ProgressBar.Open(options, cb, isQBInput)
|
||||
end
|
||||
|
||||
ProgressBar.GetResourceName = function()
|
||||
return "ox_lib"
|
||||
return resourceName
|
||||
end
|
||||
|
||||
return ProgressBar
|
||||
@@ -0,0 +1,71 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "wasabi_uikit"
|
||||
local configValue = BridgeClientConfig.ProgressBarSystem
|
||||
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||
|
||||
ProgressBar = ProgressBar or {}
|
||||
|
||||
---This function converts a QB progress bar options table to an Ox progress bar options table.
|
||||
---@param options table
|
||||
---@return table
|
||||
local function convertFromQB(options)
|
||||
if not options then return options end
|
||||
local prop1 = options.prop or {}
|
||||
local prop2 = options.propTwo or {}
|
||||
local props = {
|
||||
{
|
||||
model = prop1.model,
|
||||
bone = prop1.bone,
|
||||
pos = prop1.coords,
|
||||
rot = prop1.rotation,
|
||||
},
|
||||
{
|
||||
model = prop2.model,
|
||||
bone = prop2.bone,
|
||||
pos = prop2.coords,
|
||||
rot = prop2.rotation,
|
||||
}
|
||||
}
|
||||
return {
|
||||
duration = options.duration,
|
||||
label = options.label,
|
||||
position = 'bottom',
|
||||
useWhileDead = options.useWhileDead,
|
||||
canCancel = options.canCancel,
|
||||
disable = {
|
||||
move = options.controlDisables?.disableMovement,
|
||||
car = options.controlDisables?.disableCarMovement,
|
||||
combat = options.controlDisables?.disableCombat,
|
||||
mouse = options.controlDisables?.disableMouse
|
||||
},
|
||||
anim = {
|
||||
dict = options.animation?.animDict,
|
||||
clip = options.animation?.anim,
|
||||
flag = options.animation?.flags or 49,
|
||||
},
|
||||
prop = props,
|
||||
}
|
||||
end
|
||||
|
||||
---This function opens a progress bar.
|
||||
---@param options table
|
||||
---@param cb any
|
||||
---@param isQBInput boolean||optional
|
||||
---@return boolean
|
||||
function ProgressBar.Open(options, cb, isQBInput)
|
||||
if isQBInput then
|
||||
options = convertFromQB(options)
|
||||
end
|
||||
|
||||
local style = options.style or 'bar'
|
||||
local success = style == 'circle' and exports.wasabi_uikit:ProgressBar(options, 'circle') or exports.wasabi_uikit:ProgressBar(options, 'bar')
|
||||
|
||||
if cb then cb(success) end
|
||||
return success
|
||||
end
|
||||
|
||||
ProgressBar.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
return ProgressBar
|
||||
@@ -1,46 +1,57 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
Shops = Shops or {}
|
||||
|
||||
RegisterNetEvent('community_bridge:openShop', function(_type, _title, shopData)
|
||||
---This is an internal event used to be hit from server for the shop context menus. Please do not use this event directly.
|
||||
---@param shopType string
|
||||
---@param shopLabel string
|
||||
---@param shopData table
|
||||
RegisterNetEvent('community_bridge:Client:openShop', function(shopType, shopLabel, shopData)
|
||||
if source ~= 65535 then return end
|
||||
if not _title and not _title and not shopData then return end
|
||||
if _type ~= 'shop' then return end
|
||||
Shops.OpenShop(_title, shopData.inventory)
|
||||
if not shopType or not shopLabel or not shopData then return end
|
||||
if shopType ~= 'shop' then return end
|
||||
Shops.OpenShop(shopLabel, shopData.inventory)
|
||||
end)
|
||||
|
||||
---This is an internal event that is used to complete a transaction and offer cash/card pay
|
||||
---This is an internal function that is used to complete a transaction and offer cash/card pay. Please do not use this function directly.
|
||||
---@param shopName string
|
||||
---@param item string
|
||||
---@param itemLabel string
|
||||
---@param price number
|
||||
---@param amount number
|
||||
Shops.FinalizeCheckOut = function(shopName, item, itemLabel, price, amount)
|
||||
if not shopName and not item and not itemLabel and not price then return end
|
||||
local mathStuff = tonumber(price) * tonumber(amount)
|
||||
local mathStuff = (tonumber(price) * tonumber(amount))
|
||||
local generatedID = Ids.CreateUniqueId()
|
||||
local buildMenu = {
|
||||
{
|
||||
title = string.format(locale('Shops.PayByCash'), tostring(mathStuff)),
|
||||
description = string.format(locale('Shops.AreYouSure'), itemLabel),
|
||||
title = locale('Shops.PayByCash', tostring(mathStuff)),
|
||||
description = locale('Shops.AreYouSure', itemLabel),
|
||||
icon = locale('Shops.CashIcon'),
|
||||
onSelect = function(_, __, ___)
|
||||
TriggerServerEvent('community_bridge:completeCheckout', shopName, item, amount, "money")
|
||||
TriggerServerEvent('community_bridge:Server:completeCheckout', shopName, item, amount, "money")
|
||||
end
|
||||
},
|
||||
{
|
||||
title = string.format(locale('Shops.PayByCard'), tostring(mathStuff)),
|
||||
description = string.format(locale('Shops.AreYouSure'), itemLabel),
|
||||
title = locale('Shops.PayByCard', tostring(mathStuff)),
|
||||
description = locale('Shops.AreYouSure', itemLabel),
|
||||
icon = locale('Shops.CardIcon'),
|
||||
onSelect = function(_, __, ___)
|
||||
TriggerServerEvent('community_bridge:completeCheckout', shopName, item, amount, "bank")
|
||||
TriggerServerEvent('community_bridge:Server:completeCheckout', shopName, item, amount, "bank")
|
||||
end
|
||||
}
|
||||
}
|
||||
Menu.Open({ id = generatedID, title = locale("Shops.Input"), options = buildMenu }, false)
|
||||
end
|
||||
|
||||
---This is an internal event that is used to open the amount select menu
|
||||
---This is an internal functions that is used to open the amount select menu. Please do not use this function directly.
|
||||
---@param shopName string
|
||||
---@param item string
|
||||
---@param itemLabel string
|
||||
---@param price number
|
||||
Shops.AmountSelect = function(shopName, item, itemLabel, price)
|
||||
if not shopName and not item and not itemLabel and not price then return end
|
||||
if not tonumber(price) then return end
|
||||
if price <= 0 then return end
|
||||
local numberOptions = {}
|
||||
for i = 1, 100 do
|
||||
table.insert(numberOptions, {label = tostring(i), value = i})
|
||||
@@ -54,28 +65,27 @@ Shops.AmountSelect = function(shopName, item, itemLabel, price)
|
||||
end
|
||||
end
|
||||
|
||||
---This will open a shop with the passed title and data. It will create a menu with the items in the shopData table. The items will be clickable and will open a checkout menu.
|
||||
---This will open a shop with the passed shopName and data. It will create a menu with the items in the shopData table. The items will be clickable and will open a checkout menu.
|
||||
---This also verifies the shop exsists and was made first server side. This will not work when only used client side and the server side verifies the item exsists in the table as well as the shop id.
|
||||
---@param title any
|
||||
---@param shopData any
|
||||
---@param shopName string
|
||||
---@param shopData table
|
||||
---@return nil
|
||||
Shops.OpenShop = function(title, shopData)
|
||||
if not title and not shopData and not title then return Prints.Error("No Title Passed") end
|
||||
Shops.OpenShop = function(shopName, shopData)
|
||||
if not shopName and not shopData then return print("^6 No Shop Name or Shop Data Passed ^0") end
|
||||
local generatedID = Ids.CreateUniqueId()
|
||||
local buildMenu = {}
|
||||
for _, v in pairs(shopData) do
|
||||
local getItemName = Inventory.GetItemInfo(v.name).label
|
||||
table.insert(buildMenu, {
|
||||
title = getItemName,
|
||||
description = string.format(locale('Shops.CurrencySymbol'), tostring(v.price)),
|
||||
description = locale('Shops.CurrencySymbol', tostring(v.price)),
|
||||
icon = locale('Shops.ShopIcon'),
|
||||
onSelect = function(selected, secondary, args)
|
||||
Shops.AmountSelect(title, v.name, getItemName, v.price)
|
||||
--Shops.FinalizeCheckOut(title, v.name, getItemName, v.price)
|
||||
Shops.AmountSelect(shopName, v.name, getItemName, v.price)
|
||||
end
|
||||
})
|
||||
end
|
||||
Menu.Open({ id = generatedID, title = title, options = buildMenu }, false)
|
||||
Menu.Open({ id = generatedID, title = shopName, options = buildMenu }, false)
|
||||
end
|
||||
|
||||
return Shops
|
||||
@@ -3,41 +3,46 @@ Shops = Shops or {}
|
||||
|
||||
local registeredShops = {}
|
||||
|
||||
local Language = Language or Require("modules/locales/shared.lua")
|
||||
local locales = Language.Locale
|
||||
|
||||
---This can open a shop for the client
|
||||
---@param src number
|
||||
---@param shopTitle string
|
||||
---@param shopName string
|
||||
---@return boolean
|
||||
Shops.OpenShop = function(src, shopTitle)
|
||||
if not shopTitle and not registeredShops[shopTitle] then return false end
|
||||
TriggerClientEvent('community_bridge:openShop', src, 'shop', shopTitle, registeredShops[shopTitle])
|
||||
Shops.OpenShop = function(src, shopName)
|
||||
if not shopName and not registeredShops[shopName] then return false, print("community_bridge PLAYERID "..src.." attempted to open invalid shop: "..shopName) end
|
||||
TriggerClientEvent('community_bridge:Client:openShop', src, 'shop', shopName, registeredShops[shopName])
|
||||
return true
|
||||
end
|
||||
|
||||
---This will create a shop to use on the client side, shops must be registered server side and exsist in the shop inventory table to allow any purchases passed.
|
||||
---@param shopTitle string
|
||||
---@param shopName string
|
||||
---@param shopInventory table
|
||||
---@param shopCoords table
|
||||
---@param shopGroups table
|
||||
---@return boolean
|
||||
Shops.CreateShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
|
||||
if not shopTitle and not shopInventory and not shopCoords then return false end
|
||||
if registeredShops[shopTitle] then return true end
|
||||
registeredShops[shopTitle] = {name = shopTitle, inventory = shopInventory, shopCoords = shopCoords, groups = shopGroups}
|
||||
Shops.CreateShop = function(shopName, shopInventory, shopCoords, shopGroups)
|
||||
if not shopName and not shopInventory and not shopCoords then return false end
|
||||
if registeredShops[shopName] then return true end
|
||||
registeredShops[shopName] = {name = shopName, inventory = shopInventory, shopCoords = shopCoords, groups = shopGroups}
|
||||
return true
|
||||
end
|
||||
|
||||
---This is an internal event to complete a shop transaction, it will verify pass items and amounts are registered to the created shop.
|
||||
---This is an internal event to complete a shop transaction, it will verify pass items and amounts are registered to the created shop. Please do not use this function directly.
|
||||
---@param src number
|
||||
---@param shopName string
|
||||
---@param item string
|
||||
---@param amount number
|
||||
---@param paymentType string
|
||||
---@param account string
|
||||
---@return nil
|
||||
Shops.CompleteCheckout = function(src, shopName, item, amount, paymentType)
|
||||
if not src and not shopName and not item and not amount and not paymentType then return end
|
||||
local ilocale = Language.Locale
|
||||
Shops.CompleteCheckout = function(src, shopName, item, amount, account)
|
||||
if not src or not shopName or not item or not amount or not account then return end
|
||||
if not amount or amount <= 0 then return end
|
||||
|
||||
local shopData = registeredShops[shopName]
|
||||
if not shopData then return end
|
||||
|
||||
local itemData = nil
|
||||
for _, data in pairs(shopData.inventory) do
|
||||
if data.name == item then
|
||||
@@ -45,22 +50,38 @@ Shops.CompleteCheckout = function(src, shopName, item, amount, paymentType)
|
||||
break
|
||||
end
|
||||
end
|
||||
if not itemData then return Prints.Error("Player ID "..src.." Is Possibly A Cheater And Has Attempted To Purchase A "..item) end
|
||||
if not itemData.price then return end
|
||||
local balance = Framework.GetAccountBalance(src, paymentType)
|
||||
local mathStuff = tonumber(itemData.price) * tonumber(amount)
|
||||
if balance < mathStuff then return Notify.SendNotify(src, ilocale('Shops.NotEnoughMoney'), "error", 5000) end
|
||||
if not Framework.RemoveAccountBalance(src, paymentType, mathStuff) then return end
|
||||
Inventory.AddItem(src, itemData.name, tonumber(amount))
|
||||
local itemLabel = Inventory.GetItemInfo(itemData.name).label
|
||||
Notify.SendNotify(src, ilocale('Shops.PurchasedItem')..itemLabel, "success", 5000)
|
||||
if not itemData or not itemData.price then return print("community_bridge Player ID "..src.." attempted to purchase invalid item from shop: "..shopName) end
|
||||
if itemData.count and itemData.count <= 0 then return Notify.SendNotify(src, locales('Shops.NotEnoughStock'), "error", 5000) end
|
||||
local totalCost = tonumber(itemData.price) * amount
|
||||
local balance = Framework.GetAccountBalance(src, account)
|
||||
if not balance then return end
|
||||
if balance <= 0 then return Notify.SendNotify(src, locales('Shops.NotEnoughMoney'), "error", 5000) end
|
||||
if balance < totalCost then return Notify.SendNotify(src, locales('Shops.NotEnoughMoney'), "error", 5000) end
|
||||
|
||||
if not Framework.RemoveAccountBalance(src, account, totalCost) then return end
|
||||
|
||||
local success = Inventory.AddItem(src, itemData.name, amount)
|
||||
if not success then
|
||||
Framework.AddAccountBalance(src, account, totalCost)
|
||||
return Notify.SendNotify(src, locales('Shops.PurchaseFailed'), "error", 5000)
|
||||
end
|
||||
|
||||
RegisterNetEvent("community_bridge:completeCheckout", function(shopName, item, amount, paymentType)
|
||||
local itemLabel = Inventory.GetItemInfo(itemData.name).label or itemData.name
|
||||
Notify.SendNotify(src, locales('Shops.PurchasedItem', itemLabel), "success", 5000)
|
||||
end
|
||||
|
||||
---This is an internal event to complete a checkout, complete with multiple validations. Please do not use this event directly.
|
||||
---@param shopName string
|
||||
---@param item string
|
||||
---@param amount number
|
||||
---@param account string
|
||||
RegisterNetEvent("community_bridge:Server:completeCheckout", function(shopName, item, amount, account)
|
||||
local src = source
|
||||
if not shopName and not item and not paymentType then return end
|
||||
if not paymentType == "money" or not paymentType == "bank" then return end
|
||||
Shops.CompleteCheckout(src, shopName, item, amount, paymentType)
|
||||
if not shopName or not item or not account or not amount then return end
|
||||
if account ~= "money" and account ~= "bank" then return end
|
||||
amount = tonumber(amount)
|
||||
if not amount or amount <= 0 then return end
|
||||
Shops.CompleteCheckout(src, shopName, item, amount, account)
|
||||
end)
|
||||
|
||||
return Shops
|
||||
@@ -1,7 +1,7 @@
|
||||
BridgeClientConfig = {}
|
||||
BridgeClientConfig.InputSystem = "auto" -- [ auto | ox_lib | lation_ui | qb-input ]
|
||||
BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | lation_ui | qb-menu ]
|
||||
BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | lation_ui | progressbar ]
|
||||
BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | qb-menu ]
|
||||
BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | keep-progressbar | progressbar ]
|
||||
BridgeClientConfig.VehicleKey = "auto" -- [ auto | qb-vehiclekeys | MrNewbVehicleKeys | jaksams_VehiclesKeys | wasabi_carlock | mk_vehiclekeys | qbx_vehiclekeys | qs-vehiclekeys | t1ger_keys | Renewed-Vehiclekeys | mono_carkeys| cd_garage | okokGarage | F_RealCarKeysSystem
|
||||
BridgeClientConfig.Fuel = "auto" -- [ auto | LegacyFuel | ox_fuel | ps-fuel | qs-fuelstations | Renewed-Fuel | ti_fuel | lc_fuel | x-fuel | cdn-fuel | esx-sna-fuel | BigDaddy-Fuel | okokGasStation ]
|
||||
BridgeClientConfig.TargetSystem = "auto" -- [ auto | ox_target | qb-target | sleepless_interact ] -- sleepless is only partially supported and would need another system in place
|
||||
|
||||
Reference in new issue
Block a user