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
100 files changed
+2403
-2755
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'
|
version '0.13.0'
|
||||||
|
|
||||||
shared_scripts {
|
shared_scripts {
|
||||||
-- '@ox_lib/init.lua',
|
'@ox_lib/init.lua',
|
||||||
'settings/sharedConfig.lua',
|
'settings/sharedConfig.lua',
|
||||||
'lib/init.lua',
|
'lib/init.lua',
|
||||||
'modules/locales/*.lua',
|
'modules/locales/*.lua',
|
||||||
@@ -62,7 +62,6 @@ client_scripts {
|
|||||||
'modules/bossmenu/**/client.lua',
|
'modules/bossmenu/**/client.lua',
|
||||||
'modules/zones/**/client.lua',
|
'modules/zones/**/client.lua',
|
||||||
'init.lua',
|
'init.lua',
|
||||||
-- 'unit_tests/*.lua',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_page 'web/dist/index.html'
|
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
|
if not lib then Require('init.lua', 'ox_lib') end
|
||||||
|
|
||||||
local activePlacementProp = nil
|
local activePlacementProp = nil
|
||||||
Language = Language or Require("modules/locales/shared.lua")
|
lib.locale()
|
||||||
locale = Language.Locale
|
|
||||||
-- Object placer --
|
-- Object placer --
|
||||||
local placementText = {
|
local placementText = {
|
||||||
locale('placeable_object.place_object_place'),
|
locale('placeable_object.place_object_place'),
|
||||||
@@ -32,7 +32,7 @@ Placeable.PlaceObject = function(object, distance, snapToGround, allowedMats, of
|
|||||||
distance = tonumber(distance or 10.0 )
|
distance = tonumber(distance or 10.0 )
|
||||||
if activePlacementProp then return end
|
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 propObject = type(object) == 'string' and joaat(object) or object
|
||||||
local heading = 0.0
|
local heading = 0.0
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ local function setupButton(scaleform, button)
|
|||||||
N_0xe83a3e3557a56640(GetControlInstructionalButton(CONTROL_TYPE, keyCode, true))
|
N_0xe83a3e3557a56640(GetControlInstructionalButton(CONTROL_TYPE, keyCode, true))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(CONTROL_TYPE, button.keyIndex[1],
|
ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(CONTROL_TYPE, button.keyIndex[1], true))
|
||||||
true))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
Utility = Utility or {}
|
Utility = Utility or {}
|
||||||
local blipIDs = {}
|
local blipIDs = {}
|
||||||
local spawnedPeds = {}
|
local spawnedPeds = {}
|
||||||
|
local spawnedProps = {}
|
||||||
|
|
||||||
Locales = Locales or Require('modules/locales/shared.lua')
|
Locales = Locales or Require('modules/locales/shared.lua')
|
||||||
Point = Point or Require('lib/points/client/points.lua')
|
Point = Point or Require('lib/points/client/points.lua')
|
||||||
@@ -39,10 +40,11 @@ end
|
|||||||
---@return number|nil
|
---@return number|nil
|
||||||
function Utility.CreateProp(model, coords, heading, networked)
|
function Utility.CreateProp(model, coords, heading, networked)
|
||||||
local loaded, hash = ensureModelLoaded(model)
|
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)
|
local propEntity = CreateObject(hash, coords.x, coords.y, coords.z, networked, false, false)
|
||||||
SetEntityHeading(propEntity, heading)
|
SetEntityHeading(propEntity, heading)
|
||||||
SetModelAsNoLongerNeeded(hash)
|
SetModelAsNoLongerNeeded(hash)
|
||||||
|
spawnedProps[tostring(propEntity)] = true
|
||||||
return propEntity
|
return propEntity
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -62,7 +64,7 @@ end
|
|||||||
---@return number|nil, table
|
---@return number|nil, table
|
||||||
function Utility.CreateVehicle(model, coords, heading, networked)
|
function Utility.CreateVehicle(model, coords, heading, networked)
|
||||||
local loaded, hash = ensureModelLoaded(model)
|
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)
|
local vehicle = CreateVehicle(hash, coords.x, coords.y, coords.z, heading, networked, false)
|
||||||
SetVehicleHasBeenOwnedByPlayer(vehicle, true)
|
SetVehicleHasBeenOwnedByPlayer(vehicle, true)
|
||||||
SetVehicleNeedsToBeHotwired(vehicle, false)
|
SetVehicleNeedsToBeHotwired(vehicle, false)
|
||||||
@@ -80,7 +82,7 @@ end
|
|||||||
---@return number|nil
|
---@return number|nil
|
||||||
function Utility.CreatePed(model, coords, heading, networked, settings)
|
function Utility.CreatePed(model, coords, heading, networked, settings)
|
||||||
local loaded, hash = ensureModelLoaded(model)
|
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)
|
local spawnedEntity = CreatePed(0, hash, coords.x, coords.y, coords.z, heading, networked, false)
|
||||||
SetModelAsNoLongerNeeded(hash)
|
SetModelAsNoLongerNeeded(hash)
|
||||||
spawnedPeds[tostring(spawnedEntity)] = true
|
spawnedPeds[tostring(spawnedEntity)] = true
|
||||||
@@ -120,14 +122,12 @@ end
|
|||||||
function Utility.CreateBlip(coords, sprite, color, scale, label, shortRange, displayType)
|
function Utility.CreateBlip(coords, sprite, color, scale, label, shortRange, displayType)
|
||||||
local blip = AddBlipForCoord(coords.x, coords.y, coords.z)
|
local blip = AddBlipForCoord(coords.x, coords.y, coords.z)
|
||||||
SetBlipSprite(blip, sprite or 8)
|
SetBlipSprite(blip, sprite or 8)
|
||||||
SetTextFont(0)
|
|
||||||
SetBlipDisplay(blip, displayType or 2)
|
|
||||||
SetBlipScale(blip, scale or 0.8)
|
|
||||||
SetBlipColour(blip, color or 3)
|
SetBlipColour(blip, color or 3)
|
||||||
|
SetBlipScale(blip, scale or 0.8)
|
||||||
|
SetBlipDisplay(blip, displayType or 2)
|
||||||
SetBlipAsShortRange(blip, shortRange)
|
SetBlipAsShortRange(blip, shortRange)
|
||||||
BeginTextCommandSetBlipName("STRING")
|
BeginTextCommandSetBlipName("STRING")
|
||||||
--AddTextComponentSubstringPlayerName(label) -- switch to this if below line doesnt show da chinese
|
AddTextComponentSubstringPlayerName(label)
|
||||||
AddTextComponentString(label)
|
|
||||||
EndTextCommandSetBlipName(blip)
|
EndTextCommandSetBlipName(blip)
|
||||||
blipIDs[tostring(blip)] = blip
|
blipIDs[tostring(blip)] = blip
|
||||||
return blip
|
return blip
|
||||||
@@ -174,7 +174,7 @@ end
|
|||||||
---@param blip number
|
---@param blip number
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function Utility.RemoveBlip(blip)
|
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)])
|
RemoveBlip(blipIDs[tostring(blip)])
|
||||||
blipIDs[tostring(blip)] = nil
|
blipIDs[tostring(blip)] = nil
|
||||||
return true
|
return true
|
||||||
@@ -213,6 +213,18 @@ function Utility.RemovePed(entity)
|
|||||||
return true
|
return true
|
||||||
end
|
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
|
---Show a native input menu and return the result
|
||||||
---@param text string
|
---@param text string
|
||||||
---@param length number
|
---@param length number
|
||||||
@@ -615,6 +627,11 @@ AddEventHandler('onResourceStop', function(resource)
|
|||||||
DeleteEntity(tonumber(ped))
|
DeleteEntity(tonumber(ped))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
for _, prop in pairs(spawnedProps) do
|
||||||
|
if prop and DoesEntityExist(tonumber(prop)) then
|
||||||
|
DeleteEntity(tonumber(prop))
|
||||||
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
exports('Utility', Utility)
|
exports('Utility', Utility)
|
||||||
|
|||||||
+7
-3
@@ -4,6 +4,7 @@
|
|||||||
"Input": "Hoeveelheid Invoer",
|
"Input": "Hoeveelheid Invoer",
|
||||||
"PurchaseAmount": "Aankoop Hoeveelheid",
|
"PurchaseAmount": "Aankoop Hoeveelheid",
|
||||||
"PurchasedItem": "Jy het gekoop ",
|
"PurchasedItem": "Jy het gekoop ",
|
||||||
|
"PurchaseFailed": "Aankoop het misluk, inventaris vol",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Bevestig Aankoop",
|
"Confirm": "Bevestig Aankoop",
|
||||||
"AreYouSure": "Is jy seker jy wil 'n %s koop",
|
"AreYouSure": "Is jy seker jy wil 'n %s koop",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Winkel Naam"
|
"ShopName": "Winkel Naam"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Ek is 'n %s %s",
|
"PlaceholderTitle": "Kennisgewing"
|
||||||
"locale-unit-test": "Dit is 'n toets string"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Gekopieer na knipbord"
|
"copy": "Gekopieer na knipbord"
|
||||||
@@ -33,6 +33,10 @@
|
|||||||
"place_object_scroll_down": "[Scroll Down] Draai links \n",
|
"place_object_scroll_down": "[Scroll Down] Draai links \n",
|
||||||
"object_place": "[%s] Plaas \n",
|
"object_place": "[%s] Plaas \n",
|
||||||
"object_cancel": "[%s] Kanselleer \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_clockwise": "[%s] Draai Kloksgewys \n",
|
||||||
"rotate_counter_clockwise": "[%s] Draai Antikloksgewys \n",
|
"rotate_counter_clockwise": "[%s] Draai Antikloksgewys \n",
|
||||||
"depth_modifier": "[%s] Diepte Beheer Wysiging \n"
|
"depth_modifier": "[%s] Diepte Beheer Wysiging \n"
|
||||||
|
|||||||
+13
-4
@@ -4,6 +4,7 @@
|
|||||||
"Input": "إدخال الكمية",
|
"Input": "إدخال الكمية",
|
||||||
"PurchaseAmount": "كمية الشراء",
|
"PurchaseAmount": "كمية الشراء",
|
||||||
"PurchasedItem": "لقد قمت بشراء ",
|
"PurchasedItem": "لقد قمت بشراء ",
|
||||||
|
"PurchaseFailed": "فشل الشراء، المخزون ممتلئ",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "تأكيد الشراء",
|
"Confirm": "تأكيد الشراء",
|
||||||
"AreYouSure": "هل أنت متأكد أنك تريد شراء %s",
|
"AreYouSure": "هل أنت متأكد أنك تريد شراء %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "اسم المتجر"
|
"ShopName": "اسم المتجر"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "أنا %s %s",
|
"PlaceholderTitle": "إشعار"
|
||||||
"locale-unit-test": "هذا نص تجريبي"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "تم النسخ إلى الحافظة"
|
"copy": "تم النسخ إلى الحافظة"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] إلغاء \n",
|
"object_cancel": "[%s] إلغاء \n",
|
||||||
"object_scroll_up": "[%s] استدارة يمين \n",
|
"object_scroll_up": "[%s] استدارة يمين \n",
|
||||||
"object_scroll_down": "[%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í",
|
"Input": "Zadání množství",
|
||||||
"PurchaseAmount": "Množství nákupu",
|
"PurchaseAmount": "Množství nákupu",
|
||||||
"PurchasedItem": "Zakoupili jste ",
|
"PurchasedItem": "Zakoupili jste ",
|
||||||
|
"PurchaseFailed": "Nákup se nezdařil, inventář je plný",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Potvrdit nákup",
|
"Confirm": "Potvrdit nákup",
|
||||||
"AreYouSure": "Jste si jisti, že chcete koupit %s",
|
"AreYouSure": "Jste si jisti, že chcete koupit %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Název obchodu"
|
"ShopName": "Název obchodu"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Jsem %s %s",
|
"PlaceholderTitle": "Oznámení"
|
||||||
"locale-unit-test": "Toto je testovací řetězec"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Zkopírováno do schránky"
|
"copy": "Zkopírováno do schránky"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Zrušit \n",
|
"object_cancel": "[%s] Zrušit \n",
|
||||||
"object_scroll_up": "[%s] Otočit doprava \n",
|
"object_scroll_up": "[%s] Otočit doprava \n",
|
||||||
"object_scroll_down": "[%s] Otočit doleva \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",
|
"Input": "Mængde input",
|
||||||
"PurchaseAmount": "Købs mængde",
|
"PurchaseAmount": "Købs mængde",
|
||||||
"PurchasedItem": "Du har købt ",
|
"PurchasedItem": "Du har købt ",
|
||||||
|
"PurchaseFailed": "Køb mislykkedes, inventar fuldt",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Bekræft køb",
|
"Confirm": "Bekræft køb",
|
||||||
"AreYouSure": "Er du sikker på, at du vil købe en %s",
|
"AreYouSure": "Er du sikker på, at du vil købe en %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Butiksnavn"
|
"ShopName": "Butiksnavn"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Jeg er en %s %s",
|
"PlaceholderTitle": "Notifikation"
|
||||||
"locale-unit-test": "Dette er en test streng"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Kopieret til udklipsholder"
|
"copy": "Kopieret til udklipsholder"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Annuller \n",
|
"object_cancel": "[%s] Annuller \n",
|
||||||
"object_scroll_up": "[%s] Drej til højre \n",
|
"object_scroll_up": "[%s] Drej til højre \n",
|
||||||
"object_scroll_down": "[%s] Drej til venstre \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",
|
"Input": "Mengen-Eingabe",
|
||||||
"PurchaseAmount": "Kaufmenge",
|
"PurchaseAmount": "Kaufmenge",
|
||||||
"PurchasedItem": "Sie haben gekauft ",
|
"PurchasedItem": "Sie haben gekauft ",
|
||||||
|
"PurchaseFailed": "Kauf fehlgeschlagen, Inventar voll",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Kauf bestätigen",
|
"Confirm": "Kauf bestätigen",
|
||||||
"AreYouSure": "Sind Sie sicher, dass Sie einen %s kaufen möchten",
|
"AreYouSure": "Sind Sie sicher, dass Sie einen %s kaufen möchten",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Geschäftsname"
|
"ShopName": "Geschäftsname"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Ich bin ein %s %s",
|
"PlaceholderTitle": "Benachrichtigung"
|
||||||
"locale-unit-test": "Dies ist ein Test-String"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "In die Zwischenablage kopiert"
|
"copy": "In die Zwischenablage kopiert"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Abbrechen \n",
|
"object_cancel": "[%s] Abbrechen \n",
|
||||||
"object_scroll_up": "[%s] Nach rechts drehen \n",
|
"object_scroll_up": "[%s] Nach rechts drehen \n",
|
||||||
"object_scroll_down": "[%s] Nach links 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"
|
"depth_modifier": "[%s] Tiefenkontrolle Modifikator \n"
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"interact": "[E] Interagieren",
|
||||||
|
"title": "Optionen",
|
||||||
|
"description": "Keine Beschreibung"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-3
@@ -4,6 +4,7 @@
|
|||||||
"Input": "Εισαγωγή ποσότητας",
|
"Input": "Εισαγωγή ποσότητας",
|
||||||
"PurchaseAmount": "Ποσότητα αγοράς",
|
"PurchaseAmount": "Ποσότητα αγοράς",
|
||||||
"PurchasedItem": "Αγοράσατε ",
|
"PurchasedItem": "Αγοράσατε ",
|
||||||
|
"PurchaseFailed": "Η αγορά απέτυχε, το αποθέμα είναι γεμάτο",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Επιβεβαίωση αγοράς",
|
"Confirm": "Επιβεβαίωση αγοράς",
|
||||||
"AreYouSure": "Είστε βέβαιοι ότι θέλετε να αγοράσετε ένα %s",
|
"AreYouSure": "Είστε βέβαιοι ότι θέλετε να αγοράσετε ένα %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Όνομα καταστήματος"
|
"ShopName": "Όνομα καταστήματος"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Είμαι ένας %s %s",
|
"PlaceholderTitle": "Ειδοποίηση"
|
||||||
"locale-unit-test": "Αυτό είναι ένα δοκιμαστικό κείμενο"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Αντιγράφηκε στο clipboard"
|
"copy": "Αντιγράφηκε στο clipboard"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Ακύρωση \n",
|
"object_cancel": "[%s] Ακύρωση \n",
|
||||||
"object_scroll_up": "[%s] Περιστροφή δεξιά \n",
|
"object_scroll_up": "[%s] Περιστροφή δεξιά \n",
|
||||||
"object_scroll_down": "[%s] Περιστροφή αριστερά \n",
|
"object_scroll_down": "[%s] Περιστροφή αριστερά \n",
|
||||||
|
"rotate_left": "Περιστροφή αριστερά",
|
||||||
|
"rotate_right": "Περιστροφή δεξιά",
|
||||||
|
"rotate_clockwise": "[%s] Περιστροφή δεξιόστροφα \n",
|
||||||
|
"rotate_counter_clockwise": "[%s] Περιστροφή αριστερόστροφα \n",
|
||||||
"depth_modifier": "[%s] Τροποποιητής ελέγχου βάθους \n"
|
"depth_modifier": "[%s] Τροποποιητής ελέγχου βάθους \n"
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"interact": "[E] Αλληλεπίδραση",
|
||||||
|
"title": "Επιλογές",
|
||||||
|
"description": "Χωρίς περιγραφή"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-3
@@ -4,6 +4,7 @@
|
|||||||
"Input": "Amount o' Booty",
|
"Input": "Amount o' Booty",
|
||||||
"PurchaseAmount": "Plunder Quantity",
|
"PurchaseAmount": "Plunder Quantity",
|
||||||
"PurchasedItem": "Ye Have Plundered ",
|
"PurchasedItem": "Ye Have Plundered ",
|
||||||
|
"PurchaseFailed": "Plunder failed, yer hold be full",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Aye, Plunder!",
|
"Confirm": "Aye, Plunder!",
|
||||||
"AreYouSure": "Be ye sure ye want to plunder a %s?",
|
"AreYouSure": "Be ye sure ye want to plunder a %s?",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Pirate's Emporium"
|
"ShopName": "Pirate's Emporium"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "I be a %s %s",
|
"PlaceholderTitle": "Parley Notice"
|
||||||
"locale-unit-test": "This be a test string, arrr!"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Copied to ye clipboard, matey!"
|
"copy": "Copied to ye clipboard, matey!"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Abandon Ship! \n",
|
"object_cancel": "[%s] Abandon Ship! \n",
|
||||||
"object_scroll_up": "[%s] Turn starboard \n",
|
"object_scroll_up": "[%s] Turn starboard \n",
|
||||||
"object_scroll_down": "[%s] Turn port \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"
|
"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",
|
"Input": "Amount Input",
|
||||||
"PurchaseAmount": "Purchase Quantity",
|
"PurchaseAmount": "Purchase Quantity",
|
||||||
"PurchasedItem": "You Have Purchased ",
|
"PurchasedItem": "You Have Purchased ",
|
||||||
|
"PurchaseFailed": "Purchase failed, inventory full",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Confirm Purchase",
|
"Confirm": "Confirm Purchase",
|
||||||
"AreYouSure": "Are you sure you want to purchase a %s",
|
"AreYouSure": "Are you sure you want to purchase a %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Shop Name"
|
"ShopName": "Shop Name"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "I'm a %s %s",
|
"PlaceholderTitle": "Notification"
|
||||||
"locale-unit-test": "This is a test string"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Copied to clipboard"
|
"copy": "Copied to clipboard"
|
||||||
@@ -33,6 +33,10 @@
|
|||||||
"place_object_scroll_down": "[Scroll Down] Turn left \n",
|
"place_object_scroll_down": "[Scroll Down] Turn left \n",
|
||||||
"object_place": "[%s] Place \n",
|
"object_place": "[%s] Place \n",
|
||||||
"object_cancel": "[%s] Cancel \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_clockwise": "[%s] Rotate Clockwise \n",
|
||||||
"rotate_counter_clockwise": "[%s] Rotate Counter-Clockwise \n",
|
"rotate_counter_clockwise": "[%s] Rotate Counter-Clockwise \n",
|
||||||
"depth_modifier": "[%s] Depth Control Modifier \n"
|
"depth_modifier": "[%s] Depth Control Modifier \n"
|
||||||
|
|||||||
+12
-3
@@ -4,6 +4,7 @@
|
|||||||
"Input": "Entrada de cantidad",
|
"Input": "Entrada de cantidad",
|
||||||
"PurchaseAmount": "Cantidad de compra",
|
"PurchaseAmount": "Cantidad de compra",
|
||||||
"PurchasedItem": "Has comprado ",
|
"PurchasedItem": "Has comprado ",
|
||||||
|
"PurchaseFailed": "Compra fallida, inventario lleno",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Confirmar compra",
|
"Confirm": "Confirmar compra",
|
||||||
"AreYouSure": "¿Estás seguro de que quieres comprar un %s?",
|
"AreYouSure": "¿Estás seguro de que quieres comprar un %s?",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Nombre de la tienda"
|
"ShopName": "Nombre de la tienda"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Soy un %s %s",
|
"PlaceholderTitle": "Notificación"
|
||||||
"locale-unit-test": "Esta es una cadena de prueba"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Copiado al portapapeles"
|
"copy": "Copiado al portapapeles"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Cancelar \n",
|
"object_cancel": "[%s] Cancelar \n",
|
||||||
"object_scroll_up": "[%s] Girar a la derecha \n",
|
"object_scroll_up": "[%s] Girar a la derecha \n",
|
||||||
"object_scroll_down": "[%s] Girar a la izquierda \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"
|
"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ö",
|
"Input": "Määrän syöttö",
|
||||||
"PurchaseAmount": "Ostomäärä",
|
"PurchaseAmount": "Ostomäärä",
|
||||||
"PurchasedItem": "Olet ostanut ",
|
"PurchasedItem": "Olet ostanut ",
|
||||||
|
"PurchaseFailed": "Osto epäonnistui, varasto täynnä",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Vahvista osto",
|
"Confirm": "Vahvista osto",
|
||||||
"AreYouSure": "Oletko varma, että haluat ostaa %s",
|
"AreYouSure": "Oletko varma, että haluat ostaa %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Kaupan nimi"
|
"ShopName": "Kaupan nimi"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Olen %s %s",
|
"PlaceholderTitle": "Ilmoitus"
|
||||||
"locale-unit-test": "Tämä on testimerkki"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Kopioitu leikepöydälle"
|
"copy": "Kopioitu leikepöydälle"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Peruuta \n",
|
"object_cancel": "[%s] Peruuta \n",
|
||||||
"object_scroll_up": "[%s] Käännä oikealle \n",
|
"object_scroll_up": "[%s] Käännä oikealle \n",
|
||||||
"object_scroll_down": "[%s] Käännä vasemmalle \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"
|
"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é",
|
"Input": "Saisie de quantité",
|
||||||
"PurchaseAmount": "Quantité d'achat",
|
"PurchaseAmount": "Quantité d'achat",
|
||||||
"PurchasedItem": "Vous avez acheté ",
|
"PurchasedItem": "Vous avez acheté ",
|
||||||
|
"PurchaseFailed": "Achat échoué, inventaire plein",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Confirmer l'achat",
|
"Confirm": "Confirmer l'achat",
|
||||||
"AreYouSure": "Êtes-vous sûr de vouloir acheter un %s",
|
"AreYouSure": "Êtes-vous sûr de vouloir acheter un %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Nom du magasin"
|
"ShopName": "Nom du magasin"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Je suis un %s %s",
|
"PlaceholderTitle": "Notification"
|
||||||
"locale-unit-test": "Ceci est une chaîne de test"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Copié dans le presse-papiers"
|
"copy": "Copié dans le presse-papiers"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Annuler \n",
|
"object_cancel": "[%s] Annuler \n",
|
||||||
"object_scroll_up": "[%s] Tourner à droite \n",
|
"object_scroll_up": "[%s] Tourner à droite \n",
|
||||||
"object_scroll_down": "[%s] Tourner à gauche \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"
|
"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": "मात्रा इनपुट",
|
"Input": "मात्रा इनपुट",
|
||||||
"PurchaseAmount": "खरीदारी की मात्रा",
|
"PurchaseAmount": "खरीदारी की मात्रा",
|
||||||
"PurchasedItem": "आपने खरीदा है ",
|
"PurchasedItem": "आपने खरीदा है ",
|
||||||
|
"PurchaseFailed": "खरीदारी विफल, इन्वेंटरी भरी हुई है",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "खरीदारी की पुष्टि करें",
|
"Confirm": "खरीदारी की पुष्टि करें",
|
||||||
"AreYouSure": "क्या आप वाकई %s खरीदना चाहते हैं",
|
"AreYouSure": "क्या आप वाकई %s खरीदना चाहते हैं",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "दुकान का नाम"
|
"ShopName": "दुकान का नाम"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "मैं एक %s %s हूं",
|
"PlaceholderTitle": "सूचना"
|
||||||
"locale-unit-test": "यह एक परीक्षण स्ट्रिंग है"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "क्लिपबोर्ड पर कॉपी किया गया"
|
"copy": "क्लिपबोर्ड पर कॉपी किया गया"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] रद्द करें \n",
|
"object_cancel": "[%s] रद्द करें \n",
|
||||||
"object_scroll_up": "[%s] दाएं मुड़ें \n",
|
"object_scroll_up": "[%s] दाएं मुड़ें \n",
|
||||||
"object_scroll_down": "[%s] बाएं मुड़ें \n",
|
"object_scroll_down": "[%s] बाएं मुड़ें \n",
|
||||||
|
"rotate_left": "बाएं मुड़ें",
|
||||||
|
"rotate_right": "दाएं मुड़ें",
|
||||||
|
"rotate_clockwise": "[%s] घड़ी की दिशा में घुमाएं \n",
|
||||||
|
"rotate_counter_clockwise": "[%s] घड़ी की विपरीत दिशा में घुमाएं \n",
|
||||||
"depth_modifier": "[%s] गहराई नियंत्रण संशोधक \n"
|
"depth_modifier": "[%s] गहराई नियंत्रण संशोधक \n"
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"interact": "[E] बातचीत करें",
|
||||||
|
"title": "विकल्प",
|
||||||
|
"description": "कोई विवरण नहीं"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-3
@@ -4,6 +4,7 @@
|
|||||||
"Input": "Unos količine",
|
"Input": "Unos količine",
|
||||||
"PurchaseAmount": "Količina kupnje",
|
"PurchaseAmount": "Količina kupnje",
|
||||||
"PurchasedItem": "Kupili ste ",
|
"PurchasedItem": "Kupili ste ",
|
||||||
|
"PurchaseFailed": "Kupnja nije uspjela, inventar pun",
|
||||||
"CurrencySymbol": "%s kn",
|
"CurrencySymbol": "%s kn",
|
||||||
"Confirm": "Potvrdi kupnju",
|
"Confirm": "Potvrdi kupnju",
|
||||||
"AreYouSure": "Jeste li sigurni da želite kupiti %s",
|
"AreYouSure": "Jeste li sigurni da želite kupiti %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Naziv trgovine"
|
"ShopName": "Naziv trgovine"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Ja sam %s %s",
|
"PlaceholderTitle": "Obavijest"
|
||||||
"locale-unit-test": "Ovo je test string"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Kopirano u međuspremnik"
|
"copy": "Kopirano u međuspremnik"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Otkažи \n",
|
"object_cancel": "[%s] Otkažи \n",
|
||||||
"object_scroll_up": "[%s] Okreni desno \n",
|
"object_scroll_up": "[%s] Okreni desno \n",
|
||||||
"object_scroll_down": "[%s] Okreni lijevo \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"
|
"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",
|
"Input": "Mennyiség bevitel",
|
||||||
"PurchaseAmount": "Vásárlási mennyiség",
|
"PurchaseAmount": "Vásárlási mennyiség",
|
||||||
"PurchasedItem": "Megvásároltad ",
|
"PurchasedItem": "Megvásároltad ",
|
||||||
|
"PurchaseFailed": "Vásárlás sikertelen, leltár tele",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Vásárlás megerősítése",
|
"Confirm": "Vásárlás megerősítése",
|
||||||
"AreYouSure": "Biztosan meg akarsz vásárolni egy %s-t",
|
"AreYouSure": "Biztosan meg akarsz vásárolni egy %s-t",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Bolt neve"
|
"ShopName": "Bolt neve"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Én egy %s %s vagyok",
|
"PlaceholderTitle": "Értesítés"
|
||||||
"locale-unit-test": "Ez egy teszt string"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Vágólapra másolva"
|
"copy": "Vágólapra másolva"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Mégse \n",
|
"object_cancel": "[%s] Mégse \n",
|
||||||
"object_scroll_up": "[%s] Jobbra fordítás \n",
|
"object_scroll_up": "[%s] Jobbra fordítás \n",
|
||||||
"object_scroll_down": "[%s] Balra 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"
|
"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à",
|
"Input": "Inserimento quantità",
|
||||||
"PurchaseAmount": "Quantità di acquisto",
|
"PurchaseAmount": "Quantità di acquisto",
|
||||||
"PurchasedItem": "Hai acquistato ",
|
"PurchasedItem": "Hai acquistato ",
|
||||||
|
"PurchaseFailed": "Acquisto fallito, inventario pieno",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Conferma acquisto",
|
"Confirm": "Conferma acquisto",
|
||||||
"AreYouSure": "Sei sicuro di voler acquistare un %s",
|
"AreYouSure": "Sei sicuro di voler acquistare un %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Nome negozio"
|
"ShopName": "Nome negozio"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Sono un %s %s",
|
"PlaceholderTitle": "Notifica"
|
||||||
"locale-unit-test": "Questa è una stringa di test"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Copiato negli appunti"
|
"copy": "Copiato negli appunti"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Annulla \n",
|
"object_cancel": "[%s] Annulla \n",
|
||||||
"object_scroll_up": "[%s] Ruota a destra \n",
|
"object_scroll_up": "[%s] Ruota a destra \n",
|
||||||
"object_scroll_down": "[%s] Ruota a sinistra \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": "数量入力",
|
"Input": "数量入力",
|
||||||
"PurchaseAmount": "購入数量",
|
"PurchaseAmount": "購入数量",
|
||||||
"PurchasedItem": "購入しました ",
|
"PurchasedItem": "購入しました ",
|
||||||
|
"PurchaseFailed": "購入に失敗しました、インベントリがいっぱいです",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "購入を確認",
|
"Confirm": "購入を確認",
|
||||||
"AreYouSure": "%sを購入してもよろしいですか",
|
"AreYouSure": "%sを購入してもよろしいですか",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "店舗名"
|
"ShopName": "店舗名"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "私は%s %sです",
|
"PlaceholderTitle": "通知"
|
||||||
"locale-unit-test": "これはテスト文字列です"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "クリップボードにコピーされました"
|
"copy": "クリップボードにコピーされました"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] キャンセル \n",
|
"object_cancel": "[%s] キャンセル \n",
|
||||||
"object_scroll_up": "[%s] 右回転 \n",
|
"object_scroll_up": "[%s] 右回転 \n",
|
||||||
"object_scroll_down": "[%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": "수량 입력",
|
"Input": "수량 입력",
|
||||||
"PurchaseAmount": "구매 수량",
|
"PurchaseAmount": "구매 수량",
|
||||||
"PurchasedItem": "구매했습니다 ",
|
"PurchasedItem": "구매했습니다 ",
|
||||||
|
"PurchaseFailed": "구매 실패, 인벤토리가 가득 찼습니다",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "구매 확인",
|
"Confirm": "구매 확인",
|
||||||
"AreYouSure": "%s를 구매하시겠습니까",
|
"AreYouSure": "%s를 구매하시겠습니까",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "상점 이름"
|
"ShopName": "상점 이름"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "나는 %s %s입니다",
|
"PlaceholderTitle": "알림"
|
||||||
"locale-unit-test": "이것은 테스트 문자열입니다"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "클립보드에 복사됨"
|
"copy": "클립보드에 복사됨"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] 취소 \n",
|
"object_cancel": "[%s] 취소 \n",
|
||||||
"object_scroll_up": "[%s] 오른쪽으로 회전 \n",
|
"object_scroll_up": "[%s] 오른쪽으로 회전 \n",
|
||||||
"object_scroll_down": "[%s] 왼쪽으로 회전 \n",
|
"object_scroll_down": "[%s] 왼쪽으로 회전 \n",
|
||||||
|
"rotate_left": "왼쪽으로 회전",
|
||||||
|
"rotate_right": "오른쪽으로 회전",
|
||||||
|
"rotate_clockwise": "[%s] 시계 방향으로 회전 \n",
|
||||||
|
"rotate_counter_clockwise": "[%s] 시계 반대 방향으로 회전 \n",
|
||||||
"depth_modifier": "[%s] 깊이 제어 수정자 \n"
|
"depth_modifier": "[%s] 깊이 제어 수정자 \n"
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"interact": "[E] 상호작용",
|
||||||
|
"title": "옵션",
|
||||||
|
"description": "설명 없음"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-3
@@ -4,6 +4,7 @@
|
|||||||
"Input": "Kiekio įvestis",
|
"Input": "Kiekio įvestis",
|
||||||
"PurchaseAmount": "Pirkimo kiekis",
|
"PurchaseAmount": "Pirkimo kiekis",
|
||||||
"PurchasedItem": "Jūs nusipirkote ",
|
"PurchasedItem": "Jūs nusipirkote ",
|
||||||
|
"PurchaseFailed": "Pirkimas nepavyko, inventorius pilnas",
|
||||||
"CurrencySymbol": "%s €",
|
"CurrencySymbol": "%s €",
|
||||||
"Confirm": "Patvirtinti pirkimą",
|
"Confirm": "Patvirtinti pirkimą",
|
||||||
"AreYouSure": "Ar tikrai norite nusipirkti %s",
|
"AreYouSure": "Ar tikrai norite nusipirkti %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Parduotuvės pavadinimas"
|
"ShopName": "Parduotuvės pavadinimas"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Aš esu %s %s",
|
"PlaceholderTitle": "Pranešimas"
|
||||||
"locale-unit-test": "Tai yra testavimo eilutė"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Nukopijuota į iškarpinę"
|
"copy": "Nukopijuota į iškarpinę"
|
||||||
@@ -33,8 +33,17 @@
|
|||||||
"place_object_scroll_down": "[Slinkti žemyn] Pasukti kairėn \n",
|
"place_object_scroll_down": "[Slinkti žemyn] Pasukti kairėn \n",
|
||||||
"object_place": "[%s] Pastatyti \n",
|
"object_place": "[%s] Pastatyti \n",
|
||||||
"object_cancel": "[%s] Atšaukti \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_clockwise": "[%s] Sukti pagal laikrodžio rodyklę \n",
|
||||||
"rotate_counter_clockwise": "[%s] Sukti prieš laikrodžio rodyklę \n",
|
"rotate_counter_clockwise": "[%s] Sukti prieš laikrodžio rodyklę \n",
|
||||||
"depth_modifier": "[%s] Gylio kontrolės modifikatorius \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",
|
"Input": "Hoeveelheid invoer",
|
||||||
"PurchaseAmount": "Aankoop hoeveelheid",
|
"PurchaseAmount": "Aankoop hoeveelheid",
|
||||||
"PurchasedItem": "Je hebt gekocht ",
|
"PurchasedItem": "Je hebt gekocht ",
|
||||||
|
"PurchaseFailed": "Aankoop mislukt, inventaris vol",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Aankoop bevestigen",
|
"Confirm": "Aankoop bevestigen",
|
||||||
"AreYouSure": "Weet je zeker dat je een %s wilt kopen",
|
"AreYouSure": "Weet je zeker dat je een %s wilt kopen",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Winkelnaam"
|
"ShopName": "Winkelnaam"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Ik ben een %s %s",
|
"PlaceholderTitle": "Melding"
|
||||||
"locale-unit-test": "Dit is een test string"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Gekopieerd naar klembord"
|
"copy": "Gekopieerd naar klembord"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Annuleren \n",
|
"object_cancel": "[%s] Annuleren \n",
|
||||||
"object_scroll_up": "[%s] Rechtsom draaien \n",
|
"object_scroll_up": "[%s] Rechtsom draaien \n",
|
||||||
"object_scroll_down": "[%s] Linksom 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"
|
"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",
|
"Input": "Mengde inndata",
|
||||||
"PurchaseAmount": "Kjøpsmengde",
|
"PurchaseAmount": "Kjøpsmengde",
|
||||||
"PurchasedItem": "Du har kjøpt ",
|
"PurchasedItem": "Du har kjøpt ",
|
||||||
|
"PurchaseFailed": "Kjøp mislyktes, inventar fullt",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Bekreft kjøp",
|
"Confirm": "Bekreft kjøp",
|
||||||
"AreYouSure": "Er du sikker på at du vil kjøpe en %s",
|
"AreYouSure": "Er du sikker på at du vil kjøpe en %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Butikknavn"
|
"ShopName": "Butikknavn"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Jeg er en %s %s",
|
"PlaceholderTitle": "Varsling"
|
||||||
"locale-unit-test": "Dette er en teststreng"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Kopiert til utklippstavle"
|
"copy": "Kopiert til utklippstavle"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Avbryt \n",
|
"object_cancel": "[%s] Avbryt \n",
|
||||||
"object_scroll_up": "[%s] Snu til høyre \n",
|
"object_scroll_up": "[%s] Snu til høyre \n",
|
||||||
"object_scroll_down": "[%s] Snu til venstre \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",
|
"Input": "Wprowadzanie ilości",
|
||||||
"PurchaseAmount": "Ilość zakupu",
|
"PurchaseAmount": "Ilość zakupu",
|
||||||
"PurchasedItem": "Kupiłeś ",
|
"PurchasedItem": "Kupiłeś ",
|
||||||
|
"PurchaseFailed": "Zakup nieudany, ekwipunek pełny",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Potwierdź zakup",
|
"Confirm": "Potwierdź zakup",
|
||||||
"AreYouSure": "Czy na pewno chcesz kupić %s",
|
"AreYouSure": "Czy na pewno chcesz kupić %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Nazwa sklepu"
|
"ShopName": "Nazwa sklepu"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Jestem %s %s",
|
"PlaceholderTitle": "Powiadomienie"
|
||||||
"locale-unit-test": "To jest ciąg testowy"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Skopiowano do schowka"
|
"copy": "Skopiowano do schowka"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Anuluj \n",
|
"object_cancel": "[%s] Anuluj \n",
|
||||||
"object_scroll_up": "[%s] Obróć w prawo \n",
|
"object_scroll_up": "[%s] Obróć w prawo \n",
|
||||||
"object_scroll_down": "[%s] Obróć w lewo \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"
|
"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",
|
"Input": "Entrada de quantidade",
|
||||||
"PurchaseAmount": "Quantidade de compra",
|
"PurchaseAmount": "Quantidade de compra",
|
||||||
"PurchasedItem": "Você comprou ",
|
"PurchasedItem": "Você comprou ",
|
||||||
|
"PurchaseFailed": "Compra falhou, inventário cheio",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Confirmar compra",
|
"Confirm": "Confirmar compra",
|
||||||
"AreYouSure": "Você tem certeza que quer comprar um %s",
|
"AreYouSure": "Você tem certeza que quer comprar um %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Nome da loja"
|
"ShopName": "Nome da loja"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Eu sou um %s %s",
|
"PlaceholderTitle": "Notificação"
|
||||||
"locale-unit-test": "Esta é uma string de teste"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Copiado para a área de transferência"
|
"copy": "Copiado para a área de transferência"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Cancelar \n",
|
"object_cancel": "[%s] Cancelar \n",
|
||||||
"object_scroll_up": "[%s] Girar para a direita \n",
|
"object_scroll_up": "[%s] Girar para a direita \n",
|
||||||
"object_scroll_down": "[%s] Girar para a esquerda \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"
|
"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",
|
"Input": "Introducere cantitate",
|
||||||
"PurchaseAmount": "Cantitate de cumpărare",
|
"PurchaseAmount": "Cantitate de cumpărare",
|
||||||
"PurchasedItem": "Ai cumpărat ",
|
"PurchasedItem": "Ai cumpărat ",
|
||||||
|
"PurchaseFailed": "Achiziție eșuată, inventar plin",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Confirmă cumpărarea",
|
"Confirm": "Confirmă cumpărarea",
|
||||||
"AreYouSure": "Ești sigur că vrei să cumperi un %s",
|
"AreYouSure": "Ești sigur că vrei să cumperi un %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Numele magazinului"
|
"ShopName": "Numele magazinului"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Sunt un %s %s",
|
"PlaceholderTitle": "Notificare"
|
||||||
"locale-unit-test": "Acesta este un șir de test"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Copiat în clipboard"
|
"copy": "Copiat în clipboard"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Anulează \n",
|
"object_cancel": "[%s] Anulează \n",
|
||||||
"object_scroll_up": "[%s] Rotește la dreapta \n",
|
"object_scroll_up": "[%s] Rotește la dreapta \n",
|
||||||
"object_scroll_down": "[%s] Rotește la stânga \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": "Ввод количества",
|
"Input": "Ввод количества",
|
||||||
"PurchaseAmount": "Количество покупки",
|
"PurchaseAmount": "Количество покупки",
|
||||||
"PurchasedItem": "Вы купили ",
|
"PurchasedItem": "Вы купили ",
|
||||||
|
"PurchaseFailed": "Покупка не удалась, инвентарь полон",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Подтвердить покупку",
|
"Confirm": "Подтвердить покупку",
|
||||||
"AreYouSure": "Вы уверены, что хотите купить %s",
|
"AreYouSure": "Вы уверены, что хотите купить %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Название магазина"
|
"ShopName": "Название магазина"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Я %s %s",
|
"PlaceholderTitle": "Уведомление"
|
||||||
"locale-unit-test": "Это тестовая строка"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Скопировано в буфер обмена"
|
"copy": "Скопировано в буфер обмена"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Отменить \n",
|
"object_cancel": "[%s] Отменить \n",
|
||||||
"object_scroll_up": "[%s] Повернуть вправо \n",
|
"object_scroll_up": "[%s] Повернуть вправо \n",
|
||||||
"object_scroll_down": "[%s] Повернуть влево \n",
|
"object_scroll_down": "[%s] Повернуть влево \n",
|
||||||
|
"rotate_left": "Повернуть влево",
|
||||||
|
"rotate_right": "Повернуть вправо",
|
||||||
|
"rotate_clockwise": "[%s] Вращать по часовой стрелке \n",
|
||||||
|
"rotate_counter_clockwise": "[%s] Вращать против часовой стрелки \n",
|
||||||
"depth_modifier": "[%s] Модификатор контроля глубины \n"
|
"depth_modifier": "[%s] Модификатор контроля глубины \n"
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"interact": "[E] Взаимодействовать",
|
||||||
|
"title": "Опции",
|
||||||
|
"description": "Нет описания"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+13
-4
@@ -4,6 +4,7 @@
|
|||||||
"Input": "Mängd inmatning",
|
"Input": "Mängd inmatning",
|
||||||
"PurchaseAmount": "Inköpsmängd",
|
"PurchaseAmount": "Inköpsmängd",
|
||||||
"PurchasedItem": "Du har köpt ",
|
"PurchasedItem": "Du har köpt ",
|
||||||
|
"PurchaseFailed": "Köp misslyckades, inventarium fullt",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Bekräfta köp",
|
"Confirm": "Bekräfta köp",
|
||||||
"AreYouSure": "Är du säker på att du vill köpa en %s",
|
"AreYouSure": "Är du säker på att du vill köpa en %s",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Butiksnamn"
|
"ShopName": "Butiksnamn"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "Jag är en %s %s",
|
"PlaceholderTitle": "Avisering"
|
||||||
"locale-unit-test": "Detta är en teststräng"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "Kopierat till urklipp"
|
"copy": "Kopierat till urklipp"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] Avbryt \n",
|
"object_cancel": "[%s] Avbryt \n",
|
||||||
"object_scroll_up": "[%s] Vrid höger \n",
|
"object_scroll_up": "[%s] Vrid höger \n",
|
||||||
"object_scroll_down": "[%s] Vrid vänster \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": "ป้อนจำนวน",
|
"Input": "ป้อนจำนวน",
|
||||||
"PurchaseAmount": "จำนวนที่ซื้อ",
|
"PurchaseAmount": "จำนวนที่ซื้อ",
|
||||||
"PurchasedItem": "คุณได้ซื้อ ",
|
"PurchasedItem": "คุณได้ซื้อ ",
|
||||||
|
"PurchaseFailed": "การซื้อล้มเหลว คลังเต็ม",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "ยืนยันการซื้อ",
|
"Confirm": "ยืนยันการซื้อ",
|
||||||
"AreYouSure": "คุณแน่ใจหรือว่าต้องการซื้อ %s",
|
"AreYouSure": "คุณแน่ใจหรือว่าต้องการซื้อ %s",
|
||||||
@@ -13,12 +14,9 @@
|
|||||||
"CashIcon": "fa-solid fa-money-bill-wave",
|
"CashIcon": "fa-solid fa-money-bill-wave",
|
||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "ชื่อร้าน"
|
"ShopName": "ชื่อร้าน"
|
||||||
},
|
}, "Notifications": {
|
||||||
"UNITTEST": {
|
"PlaceholderTitle": "การแจ้งเตือน"
|
||||||
"UNITTESTA": "ฉันเป็น %s %s",
|
}, "clipboard": {
|
||||||
"locale-unit-test": "นี่คือสตริงทดสอบ"
|
|
||||||
},
|
|
||||||
"clipboard": {
|
|
||||||
"copy": "คัดลอกไปยังคลิปบอร์ด"
|
"copy": "คัดลอกไปยังคลิปบอร์ด"
|
||||||
},
|
},
|
||||||
"input": {
|
"input": {
|
||||||
@@ -35,6 +33,15 @@
|
|||||||
"object_cancel": "[%s] ยกเลิก \n",
|
"object_cancel": "[%s] ยกเลิก \n",
|
||||||
"object_scroll_up": "[%s] หมุนไปทางขวา \n",
|
"object_scroll_up": "[%s] หมุนไปทางขวา \n",
|
||||||
"object_scroll_down": "[%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",
|
"Input": "Miktar girişi",
|
||||||
"PurchaseAmount": "Satın alma miktarı",
|
"PurchaseAmount": "Satın alma miktarı",
|
||||||
"PurchasedItem": "Satın aldınız ",
|
"PurchasedItem": "Satın aldınız ",
|
||||||
|
"PurchaseFailed": "Satın alma başarısız, envanter dolu",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "Satın almayı onayla",
|
"Confirm": "Satın almayı onayla",
|
||||||
"AreYouSure": "Bir %s satın almak istediğinizden emin misiniz",
|
"AreYouSure": "Bir %s satın almak istediğinizden emin misiniz",
|
||||||
@@ -13,12 +14,9 @@
|
|||||||
"CashIcon": "fa-solid fa-money-bill-wave",
|
"CashIcon": "fa-solid fa-money-bill-wave",
|
||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "Mağaza adı"
|
"ShopName": "Mağaza adı"
|
||||||
},
|
}, "Notifications": {
|
||||||
"UNITTEST": {
|
"PlaceholderTitle": "Bildirim"
|
||||||
"UNITTESTA": "Ben bir %s %s'yim",
|
}, "clipboard": {
|
||||||
"locale-unit-test": "Bu bir test dizesidir"
|
|
||||||
},
|
|
||||||
"clipboard": {
|
|
||||||
"copy": "Panoya kopyalandı"
|
"copy": "Panoya kopyalandı"
|
||||||
},
|
},
|
||||||
"input": {
|
"input": {
|
||||||
@@ -35,6 +33,15 @@
|
|||||||
"object_cancel": "[%s] İptal \n",
|
"object_cancel": "[%s] İptal \n",
|
||||||
"object_scroll_up": "[%s] Sağa döndür \n",
|
"object_scroll_up": "[%s] Sağa döndür \n",
|
||||||
"object_scroll_down": "[%s] Sola 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": "数量输入",
|
"Input": "数量输入",
|
||||||
"PurchaseAmount": "购买数量",
|
"PurchaseAmount": "购买数量",
|
||||||
"PurchasedItem": "您已购买 ",
|
"PurchasedItem": "您已购买 ",
|
||||||
|
"PurchaseFailed": "购买失败,库存已满",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "确认购买",
|
"Confirm": "确认购买",
|
||||||
"AreYouSure": "您确定要购买 %s 吗",
|
"AreYouSure": "您确定要购买 %s 吗",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "商店名称"
|
"ShopName": "商店名称"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "我是一个 %s %s",
|
"PlaceholderTitle": "通知"
|
||||||
"locale-unit-test": "这是一个测试字符串"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "已复制到剪贴板"
|
"copy": "已复制到剪贴板"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] 取消 \n",
|
"object_cancel": "[%s] 取消 \n",
|
||||||
"object_scroll_up": "[%s] 向右转 \n",
|
"object_scroll_up": "[%s] 向右转 \n",
|
||||||
"object_scroll_down": "[%s] 向左转 \n",
|
"object_scroll_down": "[%s] 向左转 \n",
|
||||||
|
"rotate_left": "向左旋转",
|
||||||
|
"rotate_right": "向右旋转",
|
||||||
|
"rotate_clockwise": "[%s] 顺时针旋转 \n",
|
||||||
|
"rotate_counter_clockwise": "[%s] 逆时针旋转 \n",
|
||||||
"depth_modifier": "[%s] 深度控制修改器 \n"
|
"depth_modifier": "[%s] 深度控制修改器 \n"
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"interact": "[E] 互动",
|
||||||
|
"title": "选项",
|
||||||
|
"description": "无描述"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-3
@@ -4,6 +4,7 @@
|
|||||||
"Input": "數量輸入",
|
"Input": "數量輸入",
|
||||||
"PurchaseAmount": "購買數量",
|
"PurchaseAmount": "購買數量",
|
||||||
"PurchasedItem": "您已購買 ",
|
"PurchasedItem": "您已購買 ",
|
||||||
|
"PurchaseFailed": "購買失敗,庫存已滿",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "確認購買",
|
"Confirm": "確認購買",
|
||||||
"AreYouSure": "您確定要購買 %s 嗎",
|
"AreYouSure": "您確定要購買 %s 嗎",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "商店名稱"
|
"ShopName": "商店名稱"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "我是一個 %s %s",
|
"PlaceholderTitle": "通知"
|
||||||
"locale-unit-test": "這是一個測試字符串"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "已復制到剪貼板"
|
"copy": "已復制到剪貼板"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] 取消 \n",
|
"object_cancel": "[%s] 取消 \n",
|
||||||
"object_scroll_up": "[%s] 向右轉 \n",
|
"object_scroll_up": "[%s] 向右轉 \n",
|
||||||
"object_scroll_down": "[%s] 向左轉 \n",
|
"object_scroll_down": "[%s] 向左轉 \n",
|
||||||
|
"rotate_left": "向左旋轉",
|
||||||
|
"rotate_right": "向右旋轉",
|
||||||
|
"rotate_clockwise": "[%s] 順時針旋轉 \n",
|
||||||
|
"rotate_counter_clockwise": "[%s] 逆時針旋轉 \n",
|
||||||
"depth_modifier": "[%s] 深度控制修改器 \n"
|
"depth_modifier": "[%s] 深度控制修改器 \n"
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"interact": "[E] 互動",
|
||||||
|
"title": "選項",
|
||||||
|
"description": "無描述"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-3
@@ -4,6 +4,7 @@
|
|||||||
"Input": "數量輸入",
|
"Input": "數量輸入",
|
||||||
"PurchaseAmount": "購買數量",
|
"PurchaseAmount": "購買數量",
|
||||||
"PurchasedItem": "您已購買 ",
|
"PurchasedItem": "您已購買 ",
|
||||||
|
"PurchaseFailed": "購買失敗,庫存已滿",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "確認購買",
|
"Confirm": "確認購買",
|
||||||
"AreYouSure": "您確定要購買 %s 嗎",
|
"AreYouSure": "您確定要購買 %s 嗎",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "商店名稱"
|
"ShopName": "商店名稱"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "我是一個 %s %s",
|
"PlaceholderTitle": "通知"
|
||||||
"locale-unit-test": "這是一個測試字符串"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "已複製到剪貼簿"
|
"copy": "已複製到剪貼簿"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] 取消 \n",
|
"object_cancel": "[%s] 取消 \n",
|
||||||
"object_scroll_up": "[%s] 向右轉 \n",
|
"object_scroll_up": "[%s] 向右轉 \n",
|
||||||
"object_scroll_down": "[%s] 向左轉 \n",
|
"object_scroll_down": "[%s] 向左轉 \n",
|
||||||
|
"rotate_left": "向左旋轉",
|
||||||
|
"rotate_right": "向右旋轉",
|
||||||
|
"rotate_clockwise": "[%s] 順時針旋轉 \n",
|
||||||
|
"rotate_counter_clockwise": "[%s] 逆時針旋轉 \n",
|
||||||
"depth_modifier": "[%s] 深度控制修改器 \n"
|
"depth_modifier": "[%s] 深度控制修改器 \n"
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"interact": "[E] 互動",
|
||||||
|
"title": "選項",
|
||||||
|
"description": "無描述"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-3
@@ -4,6 +4,7 @@
|
|||||||
"Input": "数量输入",
|
"Input": "数量输入",
|
||||||
"PurchaseAmount": "购买数量",
|
"PurchaseAmount": "购买数量",
|
||||||
"PurchasedItem": "您已购买 ",
|
"PurchasedItem": "您已购买 ",
|
||||||
|
"PurchaseFailed": "购买失败,库存已满",
|
||||||
"CurrencySymbol": "$ %s",
|
"CurrencySymbol": "$ %s",
|
||||||
"Confirm": "确认购买",
|
"Confirm": "确认购买",
|
||||||
"AreYouSure": "您确定要购买 %s 吗",
|
"AreYouSure": "您确定要购买 %s 吗",
|
||||||
@@ -14,9 +15,8 @@
|
|||||||
"ShopIcon": "fa-solid fa-basket-shopping",
|
"ShopIcon": "fa-solid fa-basket-shopping",
|
||||||
"ShopName": "商店名称"
|
"ShopName": "商店名称"
|
||||||
},
|
},
|
||||||
"UNITTEST": {
|
"Notifications": {
|
||||||
"UNITTESTA": "我是一个 %s %s",
|
"PlaceholderTitle": "通知"
|
||||||
"locale-unit-test": "这是一个测试字符串"
|
|
||||||
},
|
},
|
||||||
"clipboard": {
|
"clipboard": {
|
||||||
"copy": "已复制到剪贴板"
|
"copy": "已复制到剪贴板"
|
||||||
@@ -35,6 +35,15 @@
|
|||||||
"object_cancel": "[%s] 取消 \n",
|
"object_cancel": "[%s] 取消 \n",
|
||||||
"object_scroll_up": "[%s] 向右转 \n",
|
"object_scroll_up": "[%s] 向右转 \n",
|
||||||
"object_scroll_down": "[%s] 向左转 \n",
|
"object_scroll_down": "[%s] 向左转 \n",
|
||||||
|
"rotate_left": "向左旋转",
|
||||||
|
"rotate_right": "向右旋转",
|
||||||
|
"rotate_clockwise": "[%s] 顺时针旋转 \n",
|
||||||
|
"rotate_counter_clockwise": "[%s] 逆时针旋转 \n",
|
||||||
"depth_modifier": "[%s] 深度控制修改器 \n"
|
"depth_modifier": "[%s] 深度控制修改器 \n"
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"interact": "[E] 互动",
|
||||||
|
"title": "选项",
|
||||||
|
"description": "无描述"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ Framework = Framework or {}
|
|||||||
|
|
||||||
local cachedItemList = nil
|
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()
|
Framework.ItemList = function()
|
||||||
if cachedItemList then return cachedItemList end
|
if cachedItemList then return cachedItemList end
|
||||||
local items = Callback.Trigger('community_bridge:Callback:GetFrameworkItems', false)
|
local items = Callback.Trigger('community_bridge:Callback:GetFrameworkItems', false)
|
||||||
@@ -16,100 +16,101 @@ Framework.ItemList = function()
|
|||||||
return cachedItemList
|
return cachedItemList
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description 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
|
---@return string
|
||||||
Framework.GetFrameworkName = function()
|
Framework.GetFrameworkName = function()
|
||||||
return 'es_extended'
|
print("This is depricated, please use Framework.GetResourceName() instead.")
|
||||||
|
return Framework.GetResourceName()
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get the name of the in use resource.
|
---@description This will get the name of the in use resource.
|
||||||
---@return string
|
---@return string
|
||||||
Framework.GetResourceName = function()
|
Framework.GetResourceName = function()
|
||||||
return 'es_extended'
|
return 'es_extended'
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will return true if the player is loaded, false otherwise.
|
---@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
|
---@return boolean
|
||||||
Framework.GetIsPlayerLoaded = function()
|
Framework.GetIsPlayerLoaded = function()
|
||||||
return ESX.IsPlayerLoaded()
|
return ESX.IsPlayerLoaded()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will return a table of the player data, this will be in the framework format
|
---@description This is an internal function, do not use this outside of bridge as there is no standard format between the frameworks.
|
||||||
--- This is mainly for internal bridge use and should be avoided.
|
|
||||||
--- @return table
|
--- @return table
|
||||||
Framework.GetPlayerData = function()
|
Framework.GetPlayerData = function()
|
||||||
return ESX.GetPlayerData()
|
return ESX.GetPlayerData()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will return a table of all the jobs in the framework.
|
---@description This will return a table of all the jobs in the framework.
|
||||||
--- @return table
|
---@return table
|
||||||
Framework.GetFrameworkJobs = function()
|
Framework.GetFrameworkJobs = function()
|
||||||
local jobs = Callback.Trigger('community_bridge:Callback:GetFrameworkJobs', false)
|
local jobs = Callback.Trigger('community_bridge:Callback:GetFrameworkJobs', false)
|
||||||
return jobs
|
return jobs
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will return the players birth date
|
---@description This will get the players birth date
|
||||||
--- @return string
|
---@return string
|
||||||
Framework.GetPlayerDob = function()
|
Framework.GetPlayerDob = function()
|
||||||
local playerData = Framework.GetPlayerData()
|
local playerData = Framework.GetPlayerData()
|
||||||
local dob = playerData.dateofbirth
|
local dob = playerData.dateofbirth
|
||||||
return dob
|
return dob
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will return the players metadata for the specified metadata key.
|
---@description This will return the players metadata for the specified metadata key.
|
||||||
--- @param metadata table | string
|
---@param metadata table | string
|
||||||
---@return table | string | number | boolean
|
---@return table | string | number | boolean
|
||||||
Framework.GetPlayerMetaData = function(metadata)
|
Framework.GetPlayerMetaData = function(metadata)
|
||||||
return Framework.GetPlayerData().metadata[metadata]
|
return Framework.GetPlayerData().metadata[metadata]
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will send a notification to the player.
|
---@description This will send a notification to the player.
|
||||||
--- @param message string
|
---@param message string
|
||||||
--- @param type string
|
---@param type string
|
||||||
--- @param time number
|
---@param time number
|
||||||
--- @return nil
|
---@return nil
|
||||||
Framework.Notify = function(message, type, time)
|
Framework.Notify = function(message, type, time)
|
||||||
return ESX.ShowNotification(message, type, time)
|
return ESX.ShowNotification(message, type, time)
|
||||||
end
|
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 message string
|
||||||
--- @param _ unknown
|
---@param _position unknown
|
||||||
--- @return nil
|
---@return nil
|
||||||
Framework.ShowHelpText = function(message, _)
|
Framework.ShowHelpText = function(message, _position)
|
||||||
return exports.esx_textui:TextUI(message, "info")
|
return exports.esx_textui:TextUI(message, "info")
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will hide the help text message on the screen
|
---@description This will hide the help text message on the screen
|
||||||
--- @return nil
|
---@return nil
|
||||||
Framework.HideHelpText = function()
|
Framework.HideHelpText = function()
|
||||||
return exports.esx_textui:HideUI()
|
return exports.esx_textui:HideUI()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will get the players identifier (citizenid) etc.
|
---@description This will get the players identifier (citizenid) etc.
|
||||||
---@return string
|
---@return string
|
||||||
Framework.GetPlayerIdentifier = function()
|
Framework.GetPlayerIdentifier = function()
|
||||||
local playerData = Framework.GetPlayerData()
|
local playerData = Framework.GetPlayerData()
|
||||||
return playerData.identifier
|
return playerData.identifier
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will get the players name (first and last).
|
---@description This will get the players name (first and last).
|
||||||
--- @return string
|
---@return string
|
||||||
--- @return string
|
---@return string
|
||||||
Framework.GetPlayerName = function()
|
Framework.GetPlayerName = function()
|
||||||
local playerData = Framework.GetPlayerData()
|
local playerData = Framework.GetPlayerData()
|
||||||
return playerData.firstName, playerData.lastName
|
return playerData.firstName, playerData.lastName
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @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 returns job name
|
---@return string
|
||||||
--- @return string returns job label
|
---@return string
|
||||||
--- @return string returns job grade label
|
---@return string
|
||||||
--- @return string returns job grade level
|
---@return string
|
||||||
Framework.GetPlayerJob = function()
|
Framework.GetPlayerJob = function()
|
||||||
local playerData = Framework.GetPlayerData()
|
print("This is depricated, please use Framework.GetPlayerJobData() instead.")
|
||||||
return playerData.job.name, playerData.job.label, playerData.job.grade_label, playerData.job.grade
|
local jobData = Framework.GetPlayerJobData()
|
||||||
|
return jobData.jobName, jobData.jobLabel, jobData.gradeName, jobData.gradeRank
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will return the players job name, job label, job grade label job grade level,
|
--- @description This will return the players job name, job label, job grade label job grade level,
|
||||||
@@ -130,7 +131,7 @@ Framework.GetPlayerJobData = function()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
--This is an internal function to get status data
|
---@description This is an internal function to get status data
|
||||||
--- @param search string
|
--- @param search string
|
||||||
Framework.GetStatusData = function(search)
|
Framework.GetStatusData = function(search)
|
||||||
local playerData = Framework.GetPlayerData()
|
local playerData = Framework.GetPlayerData()
|
||||||
@@ -144,29 +145,30 @@ Framework.GetStatusData = function(search)
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get the hunger of a player
|
---@description This will get the hunger of a player
|
||||||
---@return number
|
---@return number
|
||||||
Framework.GetHunger = function()
|
Framework.GetHunger = function()
|
||||||
local status = Framework.GetStatusData("hunger")
|
local status = Framework.GetStatusData("hunger")
|
||||||
return math.floor((status) + 0.5) or 0
|
return math.floor((status) + 0.5) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get the thirst of a player
|
---@description This will get the thirst of a player
|
||||||
---@return number
|
---@return number
|
||||||
Framework.GetThirst = function()
|
Framework.GetThirst = function()
|
||||||
local status = Framework.GetStatusData("thirst")
|
local status = Framework.GetStatusData("thirst")
|
||||||
return math.floor((status) + 0.5) or 0
|
return math.floor((status) + 0.5) or 0
|
||||||
end
|
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 item string
|
||||||
--- @return boolean
|
---@param requiredCount number (optional)
|
||||||
Framework.HasItem = function(item)
|
---@return boolean
|
||||||
|
Framework.HasItem = function(item, requiredCount)
|
||||||
local hasItem = ESX.SearchInventory(item, true)
|
local hasItem = ESX.SearchInventory(item, true)
|
||||||
return hasItem > 0 and true or false
|
return hasItem >= (requiredCount or 1)
|
||||||
end
|
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
|
--- @param item string
|
||||||
--- @return number
|
--- @return number
|
||||||
Framework.GetItemCount = function(item)
|
Framework.GetItemCount = function(item)
|
||||||
@@ -175,16 +177,38 @@ Framework.GetItemCount = function(item)
|
|||||||
return inventory[item].count or 0
|
return inventory[item].count or 0
|
||||||
end
|
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}
|
||||||
--- @return table
|
---@param item string
|
||||||
Framework.GetPlayerInventory = function()
|
---@return table
|
||||||
local playerData = Framework.GetPlayerData()
|
Framework.GetItemInfo = function(item)
|
||||||
return playerData.inventory
|
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
|
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.
|
||||||
--- @param _type string
|
--- @return table {name, label, count, slot, metadata, stack, close, weight}
|
||||||
--- @return number
|
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)
|
Framework.GetAccountBalance = function(_type)
|
||||||
local player = Framework.GetPlayerData()
|
local player = Framework.GetPlayerData()
|
||||||
if not player then return 0 end
|
if not player then return 0 end
|
||||||
@@ -192,52 +216,13 @@ Framework.GetAccountBalance = function(_type)
|
|||||||
if _type == 'cash' then _type = 'money' end
|
if _type == 'cash' then _type = 'money' end
|
||||||
for _, account in ipairs(accounts) do
|
for _, account in ipairs(accounts) do
|
||||||
if account.name == _type then
|
if account.name == _type then
|
||||||
|
if not account.money or account.money <= 0 then return 0 end
|
||||||
return account.money or 0
|
return account.money or 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
end
|
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
|
--- @description This will get a players dead status
|
||||||
--- @return boolean
|
--- @return boolean
|
||||||
Framework.GetIsPlayerDead = function()
|
Framework.GetIsPlayerDead = function()
|
||||||
@@ -245,15 +230,20 @@ Framework.GetIsPlayerDead = function()
|
|||||||
return playerData.dead
|
return playerData.dead
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@description Event handler for when player is loaded in ESX framework
|
||||||
|
---@param xPlayer table
|
||||||
RegisterNetEvent('esx:playerLoaded', function(xPlayer)
|
RegisterNetEvent('esx:playerLoaded', function(xPlayer)
|
||||||
Wait(1500)
|
Wait(1500)
|
||||||
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
|
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@description Event handler for when player logs out in ESX framework
|
||||||
RegisterNetEvent('esx:onPlayerLogout', function()
|
RegisterNetEvent('esx:onPlayerLogout', function()
|
||||||
TriggerEvent('community_bridge:Client:OnPlayerUnload')
|
TriggerEvent('community_bridge:Client:OnPlayerUnload')
|
||||||
end)
|
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)
|
RegisterNetEvent('esx:setJob', function(data)
|
||||||
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', data.name, data.label, data.grade_label, data.grade)
|
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', data.name, data.label, data.grade_label, data.grade)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -13,16 +13,17 @@ local cachedItemList = nil
|
|||||||
--- @description This will return the name of the framework in use
|
--- @description This will return the name of the framework in use
|
||||||
--- @return string
|
--- @return string
|
||||||
Framework.GetFrameworkName = function()
|
Framework.GetFrameworkName = function()
|
||||||
return 'es_extended'
|
print("This is deprecated, please use Framework.GetResourceName() instead.")
|
||||||
|
return Framework.GetResourceName()
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get the name of the in use resource.
|
---@description This will get the name of the in use resource.
|
||||||
---@return string
|
--- @return string
|
||||||
Framework.GetResourceName = function()
|
Framework.GetResourceName = function()
|
||||||
return 'es_extended'
|
return 'es_extended'
|
||||||
end
|
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()
|
Framework.ItemList = function()
|
||||||
if cachedItemList then return cachedItemList end
|
if cachedItemList then return cachedItemList end
|
||||||
local items = ESX.Items
|
local items = ESX.Items
|
||||||
@@ -46,9 +47,9 @@ Framework.ItemList = function()
|
|||||||
return cachedItemList
|
return cachedItemList
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will return if the player is an admin in the framework
|
---@description This will return if the player is an admin in the framework.
|
||||||
--- @param src any
|
---@param src number
|
||||||
--- @return boolean
|
---@return boolean
|
||||||
Framework.GetIsFrameworkAdmin = function(src)
|
Framework.GetIsFrameworkAdmin = function(src)
|
||||||
if not src then return false end
|
if not src then return false end
|
||||||
local xPlayer = Framework.GetPlayer(src)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
@@ -58,7 +59,8 @@ Framework.GetIsFrameworkAdmin = function(src)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will get the players birth date
|
---@description Returns the player date of birth.
|
||||||
|
--- @param src number
|
||||||
--- @return string|nil
|
--- @return string|nil
|
||||||
Framework.GetPlayerDob = function(src)
|
Framework.GetPlayerDob = function(src)
|
||||||
local xPlayer = Framework.GetPlayer(src)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
@@ -99,7 +101,7 @@ Framework.GetPlayerName = function(src)
|
|||||||
return xPlayer.variables.firstName, xPlayer.variables.lastName
|
return xPlayer.variables.firstName, xPlayer.variables.lastName
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will return a table of all logged in players
|
---@description This will return a table of all logged in players
|
||||||
--- @return table
|
--- @return table
|
||||||
Framework.GetPlayers = function()
|
Framework.GetPlayers = function()
|
||||||
local players = ESX.GetExtendedPlayers()
|
local players = ESX.GetExtendedPlayers()
|
||||||
@@ -110,14 +112,16 @@ Framework.GetPlayers = function()
|
|||||||
return playerList
|
return playerList
|
||||||
end
|
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 src number
|
||||||
--- @param item string
|
--- @param item string
|
||||||
--- @param _ table
|
--- @param metadata table
|
||||||
--- @return table|nil returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
|
--- @return table {name, count, metadata, slot}
|
||||||
Framework.GetItem = function(src, item, _)
|
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)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
if not xPlayer then return end
|
if not xPlayer then return {} end
|
||||||
local playerItems = xPlayer.getInventory()
|
local playerItems = xPlayer.getInventory()
|
||||||
local repackedTable = {}
|
local repackedTable = {}
|
||||||
for _, v in pairs(playerItems) do
|
for _, v in pairs(playerItems) do
|
||||||
@@ -125,40 +129,57 @@ Framework.GetItem = function(src, item, _)
|
|||||||
table.insert(repackedTable, {
|
table.insert(repackedTable, {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
count = v.count,
|
count = v.count,
|
||||||
--metadata = v.metadata,
|
metadata = {}, -- ESX does not support item metadata
|
||||||
--slot = v.slot,
|
slot = 0, -- ESX does not support item slots
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return repackedTable
|
return repackedTable
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param src number
|
---@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
|
--- @param item string
|
||||||
--- @param _ table
|
--- @return table {name, label, stack, weight, description, image}
|
||||||
--- @return number returns the count of the item in the players inventory, if not found will return 0.
|
Framework.GetItemInfo = function(item)
|
||||||
--- If metadata is passed it will find the matching items count (esx_core does not feature metadata items)
|
local items = Framework.ItemList()
|
||||||
Framework.GetItemCount = function(src, item, _)
|
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 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)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
if not xPlayer then return end
|
if not xPlayer then return 0 end
|
||||||
return xPlayer.getInventoryItem(item).count
|
return xPlayer.getInventoryItem(item).count
|
||||||
end
|
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 src number
|
||||||
--- @param item string
|
--- @param item string
|
||||||
--- @return boolean returns true if the player has the item, false otherwise.
|
--- @return boolean
|
||||||
Framework.HasItem = function(src, item)
|
Framework.HasItem = function(src, item)
|
||||||
local getCount = Framework.GetItemCount(src, item, nil)
|
local getCount = Framework.GetItemCount(src, item, nil)
|
||||||
return getCount > 0
|
return getCount > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will return the player's inventory as a table
|
---@description Returns the entire inventory of the player as a table.
|
||||||
--- @param src number
|
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
|
||||||
--- @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}
|
---@param src number
|
||||||
|
---@return table {name, count, metadata, slot}
|
||||||
Framework.GetPlayerInventory = function(src)
|
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)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
if not xPlayer then return end
|
if not xPlayer then return {} end
|
||||||
local playerItems = xPlayer.getInventory()
|
local playerItems = xPlayer.getInventory()
|
||||||
local repackedTable = {}
|
local repackedTable = {}
|
||||||
for _, v in pairs(playerItems) do
|
for _, v in pairs(playerItems) do
|
||||||
@@ -166,15 +187,25 @@ Framework.GetPlayerInventory = function(src)
|
|||||||
table.insert(repackedTable, {
|
table.insert(repackedTable, {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
count = v.count,
|
count = v.count,
|
||||||
--metadata = v.metadata,
|
metadata = {}, -- ESX does not support item metadata
|
||||||
--slot = v.slot,
|
slot = 0, -- ESX does not support item slots
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return repackedTable
|
return repackedTable
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description Adds the specified metadata key and number value to the player's data.
|
---@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 src number
|
||||||
--- @param metadata string
|
--- @param metadata string
|
||||||
--- @param value any
|
--- @param value any
|
||||||
@@ -186,8 +217,7 @@ Framework.SetPlayerMetadata = function(src, metadata, value)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Framework.GetMetadata(src, metadata)
|
---@description Gets the specified metadata key to the player's data.
|
||||||
--- @description Gets the specified metadata key to the player's data.
|
|
||||||
--- @param src number
|
--- @param src number
|
||||||
--- @param metadata string
|
--- @param metadata string
|
||||||
--- @return any|nil
|
--- @return any|nil
|
||||||
@@ -197,7 +227,7 @@ Framework.GetPlayerMetadata = function(src, metadata)
|
|||||||
return xPlayer.getMeta(metadata) or false
|
return xPlayer.getMeta(metadata) or false
|
||||||
end
|
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 src number
|
||||||
--- @param column string
|
--- @param column string
|
||||||
--- @return string|nil
|
--- @return string|nil
|
||||||
@@ -213,16 +243,16 @@ Framework.GetStatus = function(src, column)
|
|||||||
return xPlayer.get(column) or nil
|
return xPlayer.get(column) or nil
|
||||||
end
|
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
|
--- @param src number
|
||||||
--- @return boolean|nil
|
--- @return boolean
|
||||||
Framework.GetIsPlayerDead = function(src)
|
Framework.GetIsPlayerDead = function(src)
|
||||||
local xPlayer = Framework.GetPlayer(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
|
return xPlayer.get("is_dead") or false
|
||||||
end
|
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
|
--- @param src number
|
||||||
--- @return boolean
|
--- @return boolean
|
||||||
Framework.RevivePlayer = function(src)
|
Framework.RevivePlayer = function(src)
|
||||||
@@ -254,13 +284,13 @@ Framework.AddHunger = function(src, value)
|
|||||||
return levelForEsx
|
return levelForEsx
|
||||||
end
|
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
|
--- @param src number
|
||||||
--- @return number | nil
|
--- @return number
|
||||||
Framework.GetHunger = function(src)
|
Framework.GetHunger = function(src)
|
||||||
local status = Framework.GetStatus(src, "status")
|
local status = Framework.GetStatus(src, "status")
|
||||||
if not status then return end
|
if not status then return 0 end
|
||||||
if type(status) ~= "table" then return end
|
if type(status) ~= "table" then return 0 end
|
||||||
for _, entry in ipairs(status) do
|
for _, entry in ipairs(status) do
|
||||||
if entry.name == "hunger" then
|
if entry.name == "hunger" then
|
||||||
return math.floor((entry.percent) + 0.5) or 0
|
return math.floor((entry.percent) + 0.5) or 0
|
||||||
@@ -268,13 +298,13 @@ Framework.GetHunger = function(src)
|
|||||||
end
|
end
|
||||||
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
|
--- @param src any
|
||||||
--- @return number | nil
|
--- @return number
|
||||||
Framework.GetThirst = function(src)
|
Framework.GetThirst = function(src)
|
||||||
local status = Framework.GetStatus(src, "status")
|
local status = Framework.GetStatus(src, "status")
|
||||||
if not status then return nil end
|
if not status then return 0 end
|
||||||
if type(status) ~= "table" then return end
|
if type(status) ~= "table" then return 0 end
|
||||||
for _, entry in ipairs(status) do
|
for _, entry in ipairs(status) do
|
||||||
if entry.name == "thirst" then
|
if entry.name == "thirst" then
|
||||||
return math.floor((entry.percent) + 0.5) or 0
|
return math.floor((entry.percent) + 0.5) or 0
|
||||||
@@ -282,16 +312,17 @@ Framework.GetThirst = function(src)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will get the phone number of a player
|
---@description Returns the phone number of the player.
|
||||||
--- @param src number
|
--- @param src number
|
||||||
--- @return string | nil return the phone number of the player
|
--- @return string | nil
|
||||||
Framework.GetPlayerPhone = function(src)
|
Framework.GetPlayerPhone = function(src)
|
||||||
local xPlayer = Framework.GetPlayer(src)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
if not xPlayer then return end
|
if not xPlayer then return end
|
||||||
return xPlayer.get("phone_number")
|
return xPlayer.get("phone_number")
|
||||||
end
|
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
|
---@param src number
|
||||||
---@return string | nil
|
---@return string | nil
|
||||||
---@return string | nil
|
---@return string | nil
|
||||||
@@ -304,13 +335,12 @@ Framework.GetPlayerJob = function(src)
|
|||||||
return job.name, job.label, job.grade_label, job.grade
|
return job.name, job.label, job.grade_label, job.grade
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will return the players job name, job label, job grade label job grade level,
|
---@description This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
|
||||||
--- boss status, and duty status in a table
|
|
||||||
--- @param src number
|
--- @param src number
|
||||||
--- @return table | nil
|
--- @return table {jobName, jobLabel, gradeName, gradeLabel, gradeRank, boss, onDuty}
|
||||||
Framework.GetPlayerJobData = function(src)
|
Framework.GetPlayerJobData = function(src)
|
||||||
local xPlayer = Framework.GetPlayer(src)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
if not xPlayer then return end
|
if not xPlayer then return {} end
|
||||||
local job = xPlayer.getJob()
|
local job = xPlayer.getJob()
|
||||||
local isBoss = (job.grade_name == "boss")
|
local isBoss = (job.grade_name == "boss")
|
||||||
return {
|
return {
|
||||||
@@ -324,9 +354,9 @@ Framework.GetPlayerJobData = function(src)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will return the players duty status, true if on duty false otherwise
|
---@description Returns the players duty status.
|
||||||
--- @param src number
|
--- @param src number
|
||||||
--- @return boolean return the players duty status
|
--- @return boolean
|
||||||
Framework.GetPlayerDuty = function(src)
|
Framework.GetPlayerDuty = function(src)
|
||||||
local xPlayer = Framework.GetPlayer(src)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
if not xPlayer then return false end
|
if not xPlayer then return false end
|
||||||
@@ -335,7 +365,7 @@ Framework.GetPlayerDuty = function(src)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will toggle a players duty status
|
---@description This will toggle a players duty status
|
||||||
--- @param src number
|
--- @param src number
|
||||||
--- @param status boolean
|
--- @param status boolean
|
||||||
--- @return boolean
|
--- @return boolean
|
||||||
@@ -348,95 +378,131 @@ Framework.SetPlayerDuty = function(src, status)
|
|||||||
return true
|
return true
|
||||||
end
|
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
|
--- @param job string
|
||||||
--- @return table
|
--- @return table
|
||||||
Framework.GetPlayersByJob = function(job)
|
Framework.GetPlayersByJob = function(job)
|
||||||
return Framework.GetPlayerSourcesByJob(job) or {}
|
return Framework.GetPlayerSourcesByJob(job) or {}
|
||||||
end
|
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 src number
|
||||||
--- @param name string
|
--- @param name string
|
||||||
--- @param grade string
|
--- @param grade string
|
||||||
--- @return nil
|
|
||||||
Framework.SetPlayerJob = function(src, name, grade)
|
Framework.SetPlayerJob = function(src, name, grade)
|
||||||
local xPlayer = Framework.GetPlayer(src)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
if not xPlayer then return end
|
if not xPlayer then return end
|
||||||
if not ESX.DoesJobExist(name, grade) then
|
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
|
return
|
||||||
end
|
end
|
||||||
xPlayer.setJob(name, grade, true)
|
xPlayer.setJob(name, grade, true)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will add money based on the type of account (money/bank)
|
---@description This will add money based on the type of account (money/bank)
|
||||||
--- @param src number
|
--- @param src number
|
||||||
--- @param _type string
|
--- @param _type string
|
||||||
--- @param amount number
|
--- @param amount number
|
||||||
--- @return boolean | nil
|
--- @return boolean
|
||||||
Framework.AddAccountBalance = function(src, _type, amount)
|
Framework.AddAccountBalance = function(src, _type, amount)
|
||||||
local xPlayer = Framework.GetPlayer(src)
|
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 _type == 'cash' then _type = 'money' end
|
||||||
|
if amount <= 0 then return false end
|
||||||
xPlayer.addAccountMoney(_type, amount)
|
xPlayer.addAccountMoney(_type, amount)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will remove money based on the type of account (money/bank)
|
---@description This will remove money based on the type of account (money/bank)
|
||||||
--- @param src number
|
--- @param src number
|
||||||
--- @param _type string
|
--- @param _type string
|
||||||
--- @param amount number
|
--- @param amount number
|
||||||
--- @return boolean | nil
|
--- @return boolean
|
||||||
Framework.RemoveAccountBalance = function(src, _type, amount)
|
Framework.RemoveAccountBalance = function(src, _type, amount)
|
||||||
local xPlayer = Framework.GetPlayer(src)
|
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 _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)
|
xPlayer.removeAccountMoney(_type, amount)
|
||||||
return true
|
return true
|
||||||
end
|
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 src number
|
||||||
--- @param _type string
|
--- @param _type string
|
||||||
--- @return string | nil
|
--- @return number
|
||||||
Framework.GetAccountBalance = function(src, _type)
|
Framework.GetAccountBalance = function(src, _type)
|
||||||
local xPlayer = Framework.GetPlayer(src)
|
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
|
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
|
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
|
||||||
--- @param src number
|
--- 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
|
---@param src number
|
||||||
--- @param amount number
|
---@param item string
|
||||||
--- @param slot number
|
---@param count number
|
||||||
--- @param metadata table
|
---@param slot number (optional)
|
||||||
--- @return boolean | nil
|
---@param metadata table (optional)
|
||||||
Framework.AddItem = function(src, item, amount, slot, metadata)
|
---@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)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
if not xPlayer then return end
|
if not xPlayer then return false end
|
||||||
xPlayer.addInventoryItem(item, amount)
|
xPlayer.addInventoryItem(item, count)
|
||||||
|
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "add", item = item, count = count, slot = slot, metadata = metadata })
|
||||||
return true
|
return true
|
||||||
end
|
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 src number
|
||||||
--- @param item string
|
--- @param item string
|
||||||
--- @param amount number
|
--- @param amount number
|
||||||
--- @param slot number
|
--- @param slot number (optional)
|
||||||
--- @param metadata table
|
--- @param metadata table (optional)
|
||||||
---@return boolean | nil
|
--- @return boolean
|
||||||
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
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)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
if not xPlayer then return end
|
if not xPlayer then return false end
|
||||||
xPlayer.removeInventoryItem(item, amount)
|
xPlayer.removeInventoryItem(item, amount)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will get all owned vehicles for the player
|
---@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
|
--- @param src number
|
||||||
--- @return table
|
--- @return table
|
||||||
Framework.GetOwnedVehicles = function(src)
|
Framework.GetOwnedVehicles = function(src)
|
||||||
@@ -452,7 +518,7 @@ Framework.GetOwnedVehicles = function(src)
|
|||||||
return vehicles
|
return vehicles
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description Registers a usable item with a callback function
|
---@description Registers a usable item with a callback function.
|
||||||
--- @param itemName string
|
--- @param itemName string
|
||||||
--- @param cb function
|
--- @param cb function
|
||||||
Framework.RegisterUsableItem = function(itemName, cb)
|
Framework.RegisterUsableItem = function(itemName, cb)
|
||||||
@@ -465,6 +531,8 @@ Framework.RegisterUsableItem = function(itemName, cb)
|
|||||||
ESX.RegisterUsableItem(itemName, func)
|
ESX.RegisterUsableItem(itemName, func)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@description Event handler for when a player is loaded in ESX framework
|
||||||
|
---@param src number
|
||||||
RegisterNetEvent("esx:playerLoaded", function(src)
|
RegisterNetEvent("esx:playerLoaded", function(src)
|
||||||
src = src or source
|
src = src or source
|
||||||
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
|
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
|
||||||
@@ -473,32 +541,50 @@ RegisterNetEvent("esx:playerLoaded", function(src)
|
|||||||
Framework.AddJobCount(src, jobData.jobName)
|
Framework.AddJobCount(src, jobData.jobName)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@description Event handler for when a player logs out in ESX framework
|
||||||
|
---@param src number
|
||||||
RegisterNetEvent("esx:playerLogout", function(src)
|
RegisterNetEvent("esx:playerLogout", function(src)
|
||||||
src = src or source
|
src = src or source
|
||||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||||
end)
|
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)
|
RegisterNetEvent("esx:setJob", function(src, job, lastJob)
|
||||||
src = src or source
|
src = src or source
|
||||||
if not job or not lastJob then return end
|
if not job or not lastJob then return end
|
||||||
TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name)
|
TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@description Event handler for when a player disconnects from the server
|
||||||
AddEventHandler("playerDropped", function()
|
AddEventHandler("playerDropped", function()
|
||||||
local src = source
|
local src = source
|
||||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@description Callback to get framework jobs list
|
||||||
|
---@param source number
|
||||||
Callback.Register('community_bridge:Callback:GetFrameworkJobs', function(source)
|
Callback.Register('community_bridge:Callback:GetFrameworkJobs', function(source)
|
||||||
return Framework.GetFrameworkJobs() or {}
|
return Framework.GetFrameworkJobs() or {}
|
||||||
end)
|
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)
|
Callback.Register('community_bridge:Callback:GetFrameworkItems', function(source)
|
||||||
return Framework.ItemList() or {}
|
return Framework.ItemList() or {}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Framework.Commands = {}
|
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, ...)
|
Framework.Commands.Add = function(name, help, arguments, argsrequired, callback, permission, ...)
|
||||||
ESX.RegisterCommand(name, permission, function(xPlayer, args, showError)
|
ESX.RegisterCommand(name, permission, function(xPlayer, args, showError)
|
||||||
callback(xPlayer, args)
|
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).
|
---@description This will get the name of the framework being used (if a supported framework).
|
||||||
---@return string
|
---@return string
|
||||||
Framework.GetFrameworkName = function()
|
Framework.GetFrameworkName = function()
|
||||||
return 'qb-core'
|
print("This is depricated, please use Framework.GetResourceName() instead.")
|
||||||
|
return Framework.GetResourceName()
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description This will get the name of the in use resource.
|
---@description This will get the name of the in use resource.
|
||||||
@@ -149,8 +150,9 @@ end
|
|||||||
---@return string
|
---@return string
|
||||||
---@return string
|
---@return string
|
||||||
Framework.GetPlayerJob = function()
|
Framework.GetPlayerJob = function()
|
||||||
local playerData = Framework.GetPlayerData()
|
print("This is depricated, please use Framework.GetPlayerJobData() instead.")
|
||||||
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
|
local jobData = Framework.GetPlayerJobData()
|
||||||
|
return jobData.jobName, jobData.jobLabel, jobData.gradeName, jobData.gradeRank
|
||||||
end
|
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
|
||||||
@@ -169,11 +171,12 @@ Framework.GetPlayerJobData = function()
|
|||||||
}
|
}
|
||||||
end
|
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 item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Framework.HasItem = function(item)
|
Framework.HasItem = function(item, requiredCount)
|
||||||
return QBCore.Functions.HasItem(item)
|
return QBCore.Functions.HasItem(item, requiredCount or 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description This will return the item count for the specified item in the players inventory
|
---@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,
|
label = v.label,
|
||||||
count = v.amount or v.count,
|
count = v.amount or v.count,
|
||||||
slot = v.slot,
|
slot = v.slot,
|
||||||
metadata = v.info,
|
metadata = v.info or v.metadata or {},
|
||||||
stack = v.unique,
|
stack = v.unique,
|
||||||
close = v.useable,
|
close = v.useable,
|
||||||
weight = v.weight
|
weight = v.weight
|
||||||
@@ -248,28 +251,21 @@ Framework.GetIsPlayerDead = function()
|
|||||||
return playerData.metadata["isdead"] or playerData.metadata["inlaststand"]
|
return playerData.metadata["isdead"] or playerData.metadata["inlaststand"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@description Event handler for when player is loaded in QB-Core framework
|
||||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
||||||
Wait(1500)
|
Wait(1500)
|
||||||
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
|
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@description Event handler for when player is unloaded in QB-Core framework
|
||||||
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
|
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
|
||||||
TriggerEvent('community_bridge:Client:OnPlayerUnload')
|
TriggerEvent('community_bridge:Client:OnPlayerUnload')
|
||||||
end)
|
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)
|
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(data)
|
||||||
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', data.name, data.label, data.grade_label, data.grade)
|
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', data.name, data.label, data.grade_label, data.grade)
|
||||||
end)
|
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
|
return Framework
|
||||||
@@ -11,7 +11,8 @@ Framework.Shared = QBCore.Shared
|
|||||||
---@description This will return the name of the framework in use.
|
---@description This will return the name of the framework in use.
|
||||||
---@return string
|
---@return string
|
||||||
Framework.GetFrameworkName = function()
|
Framework.GetFrameworkName = function()
|
||||||
return 'qb-core'
|
print("[Community Bridge] Warning: Framework.GetFrameworkName is deprecated, use Framework.GetResourceName instead.")
|
||||||
|
return Framework.GetResourceName()
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description This will get the name of the in use resource.
|
---@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
|
return playerData.metadata[metadata] or false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
---@description Adds the specified value to the player's stress level and updates the client HUD.
|
---@description Adds the specified value to the player's stress level and updates the client HUD.
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param value number
|
---@param value number
|
||||||
@@ -268,7 +268,6 @@ Framework.AddHunger = function(src, value)
|
|||||||
local newHunger = (playerData.metadata.hunger or 0) + value
|
local newHunger = (playerData.metadata.hunger or 0) + value
|
||||||
player.Functions.SetMetaData('hunger', Math.Clamp(newHunger, 0, 100))
|
player.Functions.SetMetaData('hunger', Math.Clamp(newHunger, 0, 100))
|
||||||
TriggerClientEvent('hud:client:UpdateNeeds', src, newHunger, playerData.metadata.thirst)
|
TriggerClientEvent('hud:client:UpdateNeeds', src, newHunger, playerData.metadata.thirst)
|
||||||
--TriggerClientEvent('hud:client:UpdateStress', src, newStress)
|
|
||||||
return newHunger
|
return newHunger
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -283,7 +282,6 @@ Framework.AddThirst = function(src, value)
|
|||||||
local newThirst = (playerData.metadata.thirst or 0) + value
|
local newThirst = (playerData.metadata.thirst or 0) + value
|
||||||
player.Functions.SetMetaData('thirst', Math.Clamp(newThirst, 0, 100))
|
player.Functions.SetMetaData('thirst', Math.Clamp(newThirst, 0, 100))
|
||||||
TriggerClientEvent('hud:client:UpdateNeeds', src, playerData.metadata.hunger, newThirst)
|
TriggerClientEvent('hud:client:UpdateNeeds', src, playerData.metadata.hunger, newThirst)
|
||||||
--TriggerClientEvent('hud:client:UpdateStress', src, newStress)
|
|
||||||
return newThirst
|
return newThirst
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -303,7 +301,7 @@ end
|
|||||||
---@return boolean|nil
|
---@return boolean|nil
|
||||||
Framework.GetIsPlayerDead = function(src)
|
Framework.GetIsPlayerDead = function(src)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return false end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
return playerData.metadata.isdead or playerData.metadata.inlaststand or false
|
return playerData.metadata.isdead or playerData.metadata.inlaststand or false
|
||||||
end
|
end
|
||||||
@@ -318,13 +316,23 @@ Framework.RevivePlayer = function(src)
|
|||||||
return true
|
return true
|
||||||
end
|
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
|
---@description This will get the thirst of a player
|
||||||
---@param src any
|
---@param src any
|
||||||
---@return number | nil
|
---@return number | nil
|
||||||
Framework.GetThirst = function(src)
|
Framework.GetThirst = function(src)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return 0 end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
local newThirst = (playerData.metadata.thirst or 0)
|
local newThirst = (playerData.metadata.thirst or 0)
|
||||||
return math.floor((newThirst) + 0.5) 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
|
||||||
---@return string | string | string | number | nil
|
---@return string | string | string | number | nil
|
||||||
Framework.GetPlayerJob = function(src)
|
Framework.GetPlayerJob = function(src)
|
||||||
local player = Framework.GetPlayer(src)
|
print("[Community Bridge] Warning: Framework.GetPlayerJob is deprecated, use Framework.GetPlayerJobData instead.")
|
||||||
if not player then return end
|
local jobData = Framework.GetPlayerJobData(src)
|
||||||
local playerData = player.PlayerData
|
if not jobData then return end
|
||||||
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
|
return jobData.jobName, jobData.jobLabel, jobData.gradeName, jobData.gradeLevel
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description This will return the players job name, job label, job grade label job grade level, boss status,
|
---@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
|
---@return table | nil
|
||||||
Framework.GetPlayerJobData = function(src)
|
Framework.GetPlayerJobData = function(src)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return { } end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
local jobData = playerData.job
|
local jobData = playerData.job
|
||||||
return {
|
return {
|
||||||
@@ -395,16 +403,16 @@ end
|
|||||||
---@return boolean | nil
|
---@return boolean | nil
|
||||||
Framework.GetPlayerDuty = function(src)
|
Framework.GetPlayerDuty = function(src)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return false end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
if not playerData.job.onduty then return false end
|
if not playerData.job.onduty then return false end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description This will toggle a players duty status
|
--- @description This will toggle a players duty status
|
||||||
---@param src number
|
--- @param src number
|
||||||
---@param status boolean
|
--- @param status boolean
|
||||||
---@return boolean
|
--- @return boolean
|
||||||
Framework.SetPlayerDuty = function(src, status)
|
Framework.SetPlayerDuty = function(src, status)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return false end
|
if not player then return false end
|
||||||
@@ -420,7 +428,7 @@ end
|
|||||||
---@return nil
|
---@return nil
|
||||||
Framework.SetPlayerJob = function(src, name, grade)
|
Framework.SetPlayerJob = function(src, name, grade)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return false end
|
||||||
return player.Functions.SetJob(name, grade)
|
return player.Functions.SetJob(name, grade)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -431,8 +439,9 @@ end
|
|||||||
---@return boolean | nil
|
---@return boolean | nil
|
||||||
Framework.AddAccountBalance = function(src, _type, amount)
|
Framework.AddAccountBalance = function(src, _type, amount)
|
||||||
local player = Framework.GetPlayer(src)
|
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 _type == 'money' then _type = 'cash' end
|
||||||
|
if amount <= 0 then return false end
|
||||||
return player.Functions.AddMoney(_type, amount)
|
return player.Functions.AddMoney(_type, amount)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -443,7 +452,7 @@ end
|
|||||||
---@return boolean | nil
|
---@return boolean | nil
|
||||||
Framework.RemoveAccountBalance = function(src, _type, amount)
|
Framework.RemoveAccountBalance = function(src, _type, amount)
|
||||||
local player = Framework.GetPlayer(src)
|
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 _type == 'money' then _type = 'cash' end
|
||||||
return player.Functions.RemoveMoney(_type, amount)
|
return player.Functions.RemoveMoney(_type, amount)
|
||||||
end
|
end
|
||||||
@@ -454,42 +463,66 @@ end
|
|||||||
---@return string | nil
|
---@return string | nil
|
||||||
Framework.GetAccountBalance = function(src, _type)
|
Framework.GetAccountBalance = function(src, _type)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return 0 end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
if _type == 'money' then _type = 'cash' end
|
if _type == 'money' then _type = 'cash' end
|
||||||
return playerData.money[_type]
|
return playerData.money[_type]
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param amount number
|
---@param count number
|
||||||
---@param slot number
|
---@param slot number (optional)
|
||||||
---@param metadata table
|
---@param metadata table (optional)
|
||||||
---@return boolean | nil
|
---@return boolean
|
||||||
Framework.AddItem = function(src, item, amount, slot, metadata)
|
Framework.AddItem = function(src, item, count, slot, metadata)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return false end
|
||||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "add", item = item, count = amount, slot = slot, metadata = metadata })
|
local success = player.Functions.AddItem(item, count, slot, metadata)
|
||||||
return player.Functions.AddItem(item, amount, 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
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param amount number
|
---@param count number
|
||||||
---@param slot number
|
---@param slot number (optional)
|
||||||
---@param metadata table
|
---@param metadata table (optional)
|
||||||
---@return boolean | nil
|
---@return boolean
|
||||||
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
Framework.RemoveItem = function(src, item, count, slot, metadata)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return false end
|
||||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "remove", item = item, count = amount, slot = slot, metadata = metadata })
|
if metadata then
|
||||||
return player.Functions.RemoveItem(item, amount, slot or nil)
|
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
|
end
|
||||||
|
|
||||||
---@description Sets the metadata for the specified item in the player's inventory.
|
---@description This will set the metadata of an item in the inventory.
|
||||||
---Notes, this is kinda a jank workaround. with the framework aside from updating the entire table theres not really a better way
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param slot number
|
---@param slot number
|
||||||
@@ -497,20 +530,92 @@ end
|
|||||||
---@return boolean | nil
|
---@return boolean | nil
|
||||||
Framework.SetMetadata = function(src, item, slot, metadata)
|
Framework.SetMetadata = function(src, item, slot, metadata)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return false end
|
||||||
local slotFinder = Framework.GetPlayerInventory(src)
|
local success = Framework.RemoveItem(src, item, 1, slot, nil)
|
||||||
local freeSlot = Table.FindFirstUnoccupiedSlot(slotFinder)
|
if not success then return false end
|
||||||
local itemSlot = slot or nil
|
Framework.AddItem(src, item, 1, slot, metadata)
|
||||||
if itemSlot == nil then
|
end
|
||||||
for _, v in pairs(slotFinder) do
|
|
||||||
if v.name == item then
|
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||||
slot = v.slot
|
---@param item string
|
||||||
break
|
---@return table
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
if not player.Functions.RemoveItem(item, 1, itemSlot) then return false end
|
return count
|
||||||
return player.Functions.AddItem(item, 1, slot, metadata)
|
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
|
||||||
|
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
|
end
|
||||||
|
|
||||||
---@description This will get all owned vehicles for the player
|
---@description This will get all owned vehicles for the player
|
||||||
@@ -541,6 +646,8 @@ Framework.RegisterUsableItem = function(itemName, cb)
|
|||||||
QBCore.Functions.CreateUseableItem(itemName, func)
|
QBCore.Functions.CreateUseableItem(itemName, func)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@description Event handler for when a player is loaded in QB-Core framework
|
||||||
|
---@param src number
|
||||||
RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
|
RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
|
||||||
src = src or source
|
src = src or source
|
||||||
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
|
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
|
||||||
@@ -549,23 +656,37 @@ RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
|
|||||||
Framework.AddJobCount(src, jobData.jobName)
|
Framework.AddJobCount(src, jobData.jobName)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@description Event handler for when a player is unloaded in QB-Core framework
|
||||||
|
---@param src number
|
||||||
RegisterNetEvent("QBCore:Server:OnPlayerUnload", function(src)
|
RegisterNetEvent("QBCore:Server:OnPlayerUnload", function(src)
|
||||||
src = src or source
|
src = src or source
|
||||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||||
end)
|
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)
|
RegisterNetEvent("QBCore:Server:OnJobUpdate", function(src, job)
|
||||||
src = src or source
|
src = src or source
|
||||||
if not job then return end
|
if not job then return end
|
||||||
TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name)
|
TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@description Event handler for when a player disconnects from the server
|
||||||
AddEventHandler("playerDropped", function()
|
AddEventHandler("playerDropped", function()
|
||||||
local src = source
|
local src = source
|
||||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Framework.Commands = {}
|
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, ...)
|
Framework.Commands.Add = function(name, help, arguments, argsrequired, callback, permission, ...)
|
||||||
QBCore.Commands.Add(name, help, arguments, argsrequired, callback, permission, ...)
|
QBCore.Commands.Add(name, help, arguments, argsrequired, callback, permission, ...)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ QBox = exports.qbx_core
|
|||||||
|
|
||||||
Framework = Framework or {}
|
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
|
---@return string
|
||||||
Framework.GetFrameworkName = function()
|
Framework.GetFrameworkName = function()
|
||||||
return 'qbx_core'
|
print("This is depricated, please use Framework.GetResourceName() instead.")
|
||||||
|
return Framework.GetResourceName()
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description This will get the name of the in use resource.
|
---@description This will get the name of the in use resource.
|
||||||
@@ -17,15 +18,13 @@ Framework.GetResourceName = function()
|
|||||||
return 'qbx_core'
|
return 'qbx_core'
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description This will return true if the player is loaded, false otherwise. This could be useful in scripts
|
---@description This will return true if the player is loaded, false otherwise.
|
||||||
---that rely on player loaded events and offer a debug mode to hit this function.
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Framework.GetIsPlayerLoaded = function()
|
Framework.GetIsPlayerLoaded = function()
|
||||||
return LocalPlayer.state.isLoggedIn or false
|
return LocalPlayer.state.isLoggedIn or false
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description This will return a table of the player data, this will be in the framework format
|
---@description This is an internal function, do not use this outside of bridge as there is no standard format between the frameworks.
|
||||||
---This is mainly for internal bridge use and should be avoided.
|
|
||||||
---@return table
|
---@return table
|
||||||
Framework.GetPlayerData = function()
|
Framework.GetPlayerData = function()
|
||||||
return QBox.GetPlayerData()
|
return QBox.GetPlayerData()
|
||||||
@@ -37,14 +36,14 @@ Framework.GetFrameworkJobs = function()
|
|||||||
return QBox.GetJobs()
|
return QBox.GetJobs()
|
||||||
end
|
end
|
||||||
|
|
||||||
---@descriptionThis will get the players birth date
|
---@description This will get the players birth date
|
||||||
---@return string
|
---@return string
|
||||||
Framework.GetPlayerDob = function()
|
Framework.GetPlayerDob = function()
|
||||||
local playerData = Framework.GetPlayerData()
|
local playerData = Framework.GetPlayerData()
|
||||||
return playerData.charinfo.birthdate
|
return playerData.charinfo.birthdate
|
||||||
end
|
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 message string
|
||||||
---@param position string
|
---@param position string
|
||||||
---@return nil
|
---@return nil
|
||||||
@@ -102,18 +101,18 @@ Framework.GetPlayerName = function()
|
|||||||
return playerData.charinfo.firstname, playerData.charinfo.lastname
|
return playerData.charinfo.firstname, playerData.charinfo.lastname
|
||||||
end
|
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
|
||||||
---@return string
|
---@return string
|
||||||
---@return string
|
---@return string
|
||||||
Framework.GetPlayerJob = function()
|
Framework.GetPlayerJob = function()
|
||||||
local playerData = Framework.GetPlayerData()
|
print("This is depricated, please use Framework.GetPlayerJobData() instead.")
|
||||||
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
|
local jobData = Framework.GetPlayerJobData()
|
||||||
|
return jobData.jobName, jobData.jobLabel, jobData.gradeName, jobData.gradeRank
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description This will return the players job name, job label, job grade label job grade level, boss status,
|
---@description This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
|
||||||
---and duty status in a table
|
|
||||||
---@return table
|
---@return table
|
||||||
Framework.GetPlayerJobData = function()
|
Framework.GetPlayerJobData = function()
|
||||||
local playerData = Framework.GetPlayerData()
|
local playerData = Framework.GetPlayerData()
|
||||||
@@ -129,14 +128,14 @@ Framework.GetPlayerJobData = function()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description This will return the players inventory as a table in the ox_inventory style flormat.
|
---@description This is an internal function used as a fallback, please use the Inventory.GetPlayerInventory instead.
|
||||||
---@return table
|
---@return table {name, label, count, slot, metadata, stack, close, weight}
|
||||||
Framework.GetPlayerInventory = function()
|
Framework.GetPlayerInventory = function()
|
||||||
return Framework.GetPlayerData().items
|
return Framework.GetPlayerData().items
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description This will return the players money by type, I recommend not using this
|
---@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.
|
||||||
---as its the client and not secure or to be trusted. Use case is for a ui or a menu I guess.
|
---Use case is for a ui or a menu I guess.
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@return number
|
---@return number
|
||||||
Framework.GetAccountBalance = function(_type)
|
Framework.GetAccountBalance = function(_type)
|
||||||
@@ -144,46 +143,31 @@ Framework.GetAccountBalance = function(_type)
|
|||||||
if not player then return 0 end
|
if not player then return 0 end
|
||||||
local account = player.money
|
local account = player.money
|
||||||
if _type == 'money' then _type = 'cash' end
|
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
|
end
|
||||||
|
|
||||||
---@description This will return the vehicle properties for the specified vehicle.
|
---@description This is an internal function used as a fallback, please use the Inventory.GetItemCount instead.
|
||||||
---@param vehicle number
|
--- @param item string
|
||||||
---@return table
|
--- @return number
|
||||||
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.
|
|
||||||
---@param item string
|
|
||||||
---@return number
|
|
||||||
Framework.GetItemCount = function(item)
|
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("Qbox has not implemented GetItemCount for this framework. Please ensure the inventory you are using is supported and start order is correct.")
|
||||||
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.")
|
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
|
end
|
||||||
|
|
||||||
---@description This will get a players dead status.
|
---@description This will get a players dead status.
|
||||||
@@ -193,15 +177,19 @@ Framework.GetIsPlayerDead = function()
|
|||||||
return playerData.metadata["isdead"] or playerData.metadata["inlaststand"]
|
return playerData.metadata["isdead"] or playerData.metadata["inlaststand"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@description Event handler for when player is loaded in QBX Core framework
|
||||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
||||||
Wait(1500)
|
Wait(1500)
|
||||||
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
|
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@description Event handler for when player is unloaded in QBX Core framework
|
||||||
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
|
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
|
||||||
TriggerEvent('community_bridge:Client:OnPlayerUnload')
|
TriggerEvent('community_bridge:Client:OnPlayerUnload')
|
||||||
end)
|
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)
|
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(data)
|
||||||
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', data.name, data.label, data.grade.name, data.grade.level)
|
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', data.name, data.label, data.grade.name, data.grade.level)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Framework = Framework or {}
|
|||||||
|
|
||||||
local QBox = exports.qbx_core
|
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
|
---@return string
|
||||||
Framework.GetFrameworkName = function()
|
Framework.GetFrameworkName = function()
|
||||||
return 'qbx_core'
|
return 'qbx_core'
|
||||||
@@ -18,7 +18,7 @@ Framework.GetResourceName = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@description This will return if the player is an admin in the framework.
|
---@description This will return if the player is an admin in the framework.
|
||||||
---@param src any
|
---@param src number
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Framework.GetIsFrameworkAdmin = function(src)
|
Framework.GetIsFrameworkAdmin = function(src)
|
||||||
if not src then return false end
|
if not src then return false end
|
||||||
@@ -83,62 +83,110 @@ Framework.GetPlayerName = function(src)
|
|||||||
return playerData.charinfo.firstname, playerData.charinfo.lastname
|
return playerData.charinfo.firstname, playerData.charinfo.lastname
|
||||||
end
|
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.
|
---@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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param metadata table
|
---@param metadata table
|
||||||
---@return table|nil {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
|
---@return table|nil {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
|
||||||
Framework.GetItem = function(src, item, metadata)
|
Framework.GetItem = function(src, item, metadata)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return { } end
|
||||||
local playerInventory = player.PlayerData.items
|
|
||||||
local repackedTable = {}
|
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
|
if v.name == item and (not metadata or v.info == metadata) then
|
||||||
table.insert(repackedTable, {
|
repackedTable[#repackedTable + 1] = {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
count = v.amount,
|
count = v.amount or v.count,
|
||||||
metadata = v.info,
|
metadata = v.info or v.metadata,
|
||||||
slot = v.slot,
|
slot = v.slot,
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return repackedTable
|
return repackedTable
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description Returns the count of items matching the specified name and if passed metadata from the player's inventory.
|
---@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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param metadata table
|
---@param metadata table
|
||||||
---@return number | nil
|
---@return number | nil
|
||||||
Framework.GetItemCount = function(src, item, metadata)
|
Framework.GetItemCount = function(src, item, metadata)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return 0 end
|
||||||
local playerInventory = player.PlayerData.items
|
local playerInventory = player.PlayerData.items
|
||||||
local count = 0
|
local count = 0
|
||||||
for _, v in pairs(playerInventory) do
|
for _, v in pairs(playerInventory) do
|
||||||
if v.name == item and (not metadata or v.info == metadata) then
|
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
|
||||||
end
|
end
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description Returns boolean if the player has the specified item in their inventory.
|
---@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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Framework.HasItem = function(src, item)
|
Framework.HasItem = function(src, item)
|
||||||
local getCount = Framework.GetItemCount(src, item, nil)
|
local getCount = Framework.GetItemCount(src, item)
|
||||||
return getCount > 0
|
return getCount > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description Returns the entire inventory of the player 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
|
---@param src number
|
||||||
---@return table | nil
|
---@return table | nil
|
||||||
Framework.GetPlayerInventory = function(src)
|
Framework.GetPlayerInventory = function(src)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return { } end
|
||||||
local playerItems = player.PlayerData.items
|
local playerItems = player.PlayerData.items
|
||||||
local repackedTable = {}
|
local repackedTable = {}
|
||||||
for _, v in pairs(playerItems) do
|
for _, v in pairs(playerItems) do
|
||||||
@@ -236,7 +284,7 @@ end
|
|||||||
---@return number | nil
|
---@return number | nil
|
||||||
Framework.GetHunger = function(src)
|
Framework.GetHunger = function(src)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return 0 end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
local newHunger = (playerData.metadata.hunger or 0)
|
local newHunger = (playerData.metadata.hunger or 0)
|
||||||
return math.floor((newHunger) + 0.5) or 0
|
return math.floor((newHunger) + 0.5) or 0
|
||||||
@@ -247,7 +295,7 @@ end
|
|||||||
---@return boolean|nil
|
---@return boolean|nil
|
||||||
Framework.GetIsPlayerDead = function(src)
|
Framework.GetIsPlayerDead = function(src)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return false end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
return playerData.metadata.isdead or false
|
return playerData.metadata.isdead or false
|
||||||
end
|
end
|
||||||
@@ -267,7 +315,7 @@ end
|
|||||||
---@return number| nil
|
---@return number| nil
|
||||||
Framework.GetThirst = function(src)
|
Framework.GetThirst = function(src)
|
||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return 0 end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
local newThirst = (playerData.metadata.thirst or 0)
|
local newThirst = (playerData.metadata.thirst or 0)
|
||||||
return math.floor((newThirst) + 0.5) or 0
|
return math.floor((newThirst) + 0.5) or 0
|
||||||
@@ -298,7 +346,8 @@ Framework.GetPlayersByJob = function(job)
|
|||||||
return Framework.GetPlayerSourcesByJob(job) or {}
|
return Framework.GetPlayerSourcesByJob(job) or {}
|
||||||
end
|
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
|
---@param src number
|
||||||
---@return string | string | string | number | nil
|
---@return string | string | string | number | nil
|
||||||
---@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)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return end
|
||||||
local playerData = player.PlayerData
|
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
|
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -352,7 +402,7 @@ Framework.SetPlayerDuty = function(src, status)
|
|||||||
TriggerEvent('QBCore:Server:SetDuty', src, player.PlayerData.job.onduty)
|
TriggerEvent('QBCore:Server:SetDuty', src, player.PlayerData.job.onduty)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@descriptionReturns the players duty status.
|
---@description Returns the players duty status.
|
||||||
---@param src number
|
---@param src number
|
||||||
---@return boolean | nil
|
---@return boolean | nil
|
||||||
Framework.GetPlayerDuty = function(src)
|
Framework.GetPlayerDuty = function(src)
|
||||||
@@ -372,6 +422,7 @@ Framework.AddAccountBalance = function(src, _type, amount)
|
|||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return end
|
||||||
if _type == 'money' then _type = 'cash' end
|
if _type == 'money' then _type = 'cash' end
|
||||||
|
if amount <= 0 then return false end
|
||||||
return player.Functions.AddMoney(_type, amount)
|
return player.Functions.AddMoney(_type, amount)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -384,6 +435,7 @@ Framework.RemoveAccountBalance = function(src, _type, amount)
|
|||||||
local player = Framework.GetPlayer(src)
|
local player = Framework.GetPlayer(src)
|
||||||
if not player then return end
|
if not player then return end
|
||||||
if _type == 'money' then _type = 'cash' end
|
if _type == 'money' then _type = 'cash' end
|
||||||
|
if amount <= 0 then return false end
|
||||||
return player.Functions.RemoveMoney(_type, amount)
|
return player.Functions.RemoveMoney(_type, amount)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -396,48 +448,9 @@ Framework.GetAccountBalance = function(src, _type)
|
|||||||
if not player then return end
|
if not player then return end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
if _type == 'money' then _type = 'cash' end
|
if _type == 'money' then _type = 'cash' end
|
||||||
return playerData.money[_type]
|
local balance = playerData.money[_type] or 0
|
||||||
end
|
if balance <= 0 then return 0 end
|
||||||
|
return balance
|
||||||
---@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)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@description Returns a table of owned vehicles for the player. format is {vehicle = vehicle, plate = plate}
|
---@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)
|
return QBox:CreateUseableItem(itemName, func)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@description Event handler for when a player is loaded in QBX Core framework
|
||||||
|
---@param src number
|
||||||
RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
|
RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
|
||||||
src = src or source
|
src = src or source
|
||||||
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
|
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
|
||||||
@@ -477,17 +492,23 @@ RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
|
|||||||
Framework.AddJobCount(src, jobData.jobName)
|
Framework.AddJobCount(src, jobData.jobName)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@description Event handler for when a player is unloaded in QBX Core framework
|
||||||
|
---@param src number
|
||||||
RegisterNetEvent("QBCore:Server:OnPlayerUnload", function(src)
|
RegisterNetEvent("QBCore:Server:OnPlayerUnload", function(src)
|
||||||
src = src or source
|
src = src or source
|
||||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||||
end)
|
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)
|
RegisterNetEvent("QBCore:Server:OnJobUpdate", function(src, job)
|
||||||
src = src or source
|
src = src or source
|
||||||
if not job then return end
|
if not job then return end
|
||||||
TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name)
|
TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@description Event handler for when a player disconnects from the server
|
||||||
AddEventHandler("playerDropped", function()
|
AddEventHandler("playerDropped", function()
|
||||||
local src = source
|
local src = source
|
||||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ if (configValue == "auto" and GetResourceState(resourceName) == "missing") or (c
|
|||||||
|
|
||||||
Input = {}
|
Input = {}
|
||||||
|
|
||||||
if not lib then Require('init.lua', 'ox_lib') end
|
|
||||||
|
|
||||||
function Input.Open(title, data, isQBFormat, submitText)
|
function Input.Open(title, data, isQBFormat, submitText)
|
||||||
local inputs = data.inputs
|
local inputs = data.inputs
|
||||||
if isQBFormat then
|
if isQBFormat then
|
||||||
|
|||||||
@@ -1,40 +1,41 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
Inventory = Inventory or {}
|
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
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
return Framework.GetItemInfo(item)
|
return Framework.GetItemInfo(item)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get the name of the in use resource.
|
---@description Will return boolean if the player has the item.
|
||||||
---@return string
|
|
||||||
Inventory.GetResourceName = function()
|
|
||||||
return "default"
|
|
||||||
end
|
|
||||||
|
|
||||||
---Will return boolean if the player has the item.
|
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(item)
|
Inventory.HasItem = function(item, requiredCount)
|
||||||
return Framework.HasItem(item)
|
return Framework.HasItem(item, requiredCount)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return number
|
---@return number
|
||||||
Inventory.GetItemCount = function(item)
|
Inventory.GetItemCount = function(item)
|
||||||
return Framework.GetItemCount(item)
|
return Framework.GetItemCount(item)
|
||||||
end
|
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
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function()
|
Inventory.GetPlayerInventory = function()
|
||||||
return Framework:GetPlayerInventory()
|
return Framework:GetPlayerInventory()
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
@@ -42,8 +43,7 @@ Inventory.GetImagePath = function(item)
|
|||||||
return "https://avatars.githubusercontent.com/u/47620135"
|
return "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.StripPNG = function(item)
|
Inventory.StripPNG = function(item)
|
||||||
@@ -53,8 +53,7 @@ Inventory.StripPNG = function(item)
|
|||||||
return item
|
return item
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.StripWebp = function(item)
|
Inventory.StripWebp = function(item)
|
||||||
@@ -64,8 +63,8 @@ Inventory.StripWebp = function(item)
|
|||||||
return item
|
return item
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the entire items table from the inventory.
|
---@description This will return the entire items table from the inventory.
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.Items = function()
|
Inventory.Items = function()
|
||||||
if not Framework.Shared or not Framework.Shared.Items then
|
if not Framework.Shared or not Framework.Shared.Items then
|
||||||
local itemList = Framework.ItemList() or { Items = {} }
|
local itemList = Framework.ItemList() or { Items = {} }
|
||||||
@@ -74,6 +73,4 @@ Inventory.Items = function()
|
|||||||
return Framework.Shared.Items
|
return Framework.Shared.Items
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Inventory
|
return Inventory
|
||||||
@@ -1,7 +1,14 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
Inventory = Inventory or {}
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
@@ -9,18 +16,13 @@ Inventory = Inventory or {}
|
|||||||
---@param metadata table
|
---@param metadata table
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
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})
|
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
|
end
|
||||||
|
|
||||||
---This will get the name of the in use resource.
|
---@description This will remove an item, and return true or false based on success
|
||||||
---@return string
|
|
||||||
Inventory.GetResourceName = function()
|
|
||||||
return "default"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
---This will remove an item, and return true or false based on success
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
@@ -29,36 +31,36 @@ end
|
|||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
||||||
item = type(item) == "table" and item.name or item
|
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})
|
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
|
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 identifier string
|
||||||
---@param items table
|
---@param items table
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.AddTrunkItems = function(identifier, items)
|
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
|
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
|
---@param id string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.ClearStash = function(id, _type)
|
Inventory.ClearStash = function(id, _type)
|
||||||
if type(id) ~= "string" then return false end
|
|
||||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil 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
|
end
|
||||||
|
|
||||||
---This will return a table with the item info,
|
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||||
---example: {name = "coolitem", label = "a cool item name", stack = false, weight = 1000, description = "some item description", image = "coolitem.png"}
|
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
return Framework.GetItemInfo(item)
|
return Framework.GetItemInfo(item)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the entire items table from the inventory.
|
---@description This will return the entire items table from the inventory.
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.Items = function()
|
Inventory.Items = function()
|
||||||
if not Framework.Shared or not Framework.Shared.Items then
|
if not Framework.Shared or not Framework.Shared.Items then
|
||||||
@@ -68,35 +70,31 @@ Inventory.Items = function()
|
|||||||
return Framework.Shared.Items
|
return Framework.Shared.Items
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the count of the item in the players inventory, if not found will return 0.
|
---@description 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
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param metadata table
|
---@param metadata table (optional)
|
||||||
---@return number
|
---@return number
|
||||||
Inventory.GetItemCount = function(src, item, metadata)
|
Inventory.GetItemCount = function(src, item, metadata)
|
||||||
return Framework.GetItemCount(src, item, metadata)
|
return Framework.GetItemCount(src, item, metadata)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This wil return the players inventory.
|
---@description 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}}
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function(src)
|
Inventory.GetPlayerInventory = function(src)
|
||||||
return Framework.GetPlayerInventory(src)
|
return Framework.GetPlayerInventory(src)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the specified slot data as a table.
|
---@description 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}
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param slot number
|
---@param slot number
|
||||||
---@return table
|
---@return table {weight, name, metadata, slot, label, count}
|
||||||
Inventory.GetItemBySlot = function(src, slot)
|
Inventory.GetItemBySlot = function(src, slot)
|
||||||
return Framework.GetItemBySlot(src, slot)
|
return Framework.GetItemBySlot(src, slot)
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param slot number
|
---@param slot number
|
||||||
@@ -106,74 +104,65 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
|
|||||||
return Framework.SetMetadata(src, item, slot, metadata)
|
return Framework.SetMetadata(src, item, slot, metadata)
|
||||||
end
|
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 src number
|
||||||
---@param _type string
|
---@param _type string "stash", "trunk", "glovebox"
|
||||||
---@param id number|string
|
---@param id string
|
||||||
---@return nil
|
---@return nil
|
||||||
Inventory.OpenStash = function(src, _type, id)
|
Inventory.OpenStash = function(src, _type, id)
|
||||||
_type = _type or "stash"
|
return false, print("This Inventory Has Not Been Bridged For A Stash Feature.")
|
||||||
local tbl = Inventory.Stashes[id]
|
|
||||||
return false, Prints.Error("This Inventory Has Not Been Bridged For A Stash Feature.")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will register a stash
|
---@description This will register a stash
|
||||||
---@param id number|string
|
---@param id number|string
|
||||||
---@param label string
|
---@param label string
|
||||||
---@param slots number
|
---@param slots number
|
||||||
---@param weight number
|
---@param weight number
|
||||||
---@param owner string
|
---@param owner string (optional)
|
||||||
---@param groups table
|
---@param groups table (optional)
|
||||||
---@param coords table
|
---@param coords table (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
---@return string|number
|
---@return string|number
|
||||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||||
if Inventory.Stashes[id] then return true, id end
|
if Inventory.Stashes[id] then return true, id end
|
||||||
Inventory.Stashes[id] = {
|
Inventory.Stashes[id] = {id = id, label = label, slots = slots, weight = weight, owner = owner, groups = groups, coords = coords}
|
||||||
id = id,
|
|
||||||
label = label,
|
|
||||||
slots = slots,
|
|
||||||
weight = weight,
|
|
||||||
owner = owner,
|
|
||||||
groups = groups,
|
|
||||||
coords = coords
|
|
||||||
}
|
|
||||||
return true, id
|
return true, id
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(src, item)
|
Inventory.HasItem = function(src, item, requiredCount)
|
||||||
return Framework.HasItem(src, item)
|
return Framework.HasItem(src, item, requiredCount)
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.CanCarryItem = function(src, item, count)
|
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
|
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 oldplate string
|
||||||
---@param newplate string
|
---@param newplate string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.UpdatePlate = function(oldplate, newplate)
|
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
|
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 src number
|
||||||
---@param shopTitle string
|
---@param shopTitle string
|
||||||
Inventory.OpenShop = function(src, shopTitle)
|
Inventory.OpenShop = function(src, shopTitle)
|
||||||
return Bridge.Shops.OpenShop(src, shopTitle)
|
return Bridge.Shops.OpenShop(src, shopTitle)
|
||||||
end
|
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 shopTitle string
|
||||||
---@param shopInventory table
|
---@param shopInventory table
|
||||||
---@param shopCoords table
|
---@param shopCoords table
|
||||||
@@ -182,14 +171,14 @@ Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGrou
|
|||||||
return Bridge.Shops.CreateShop(shopTitle, shopInventory, shopCoords, shopGroups)
|
return Bridge.Shops.CreateShop(shopTitle, shopInventory, shopCoords, shopGroups)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
return "https://avatars.githubusercontent.com/u/47620135"
|
return "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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"
|
---example: "item.png" will become "item"
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
@@ -200,7 +189,7 @@ Inventory.StripPNG = function(item)
|
|||||||
return item
|
return item
|
||||||
end
|
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"
|
---example: "item.webp" will become "item"
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
@@ -211,8 +200,12 @@ Inventory.StripWebp = function(item)
|
|||||||
return item
|
return item
|
||||||
end
|
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)
|
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
|
end
|
||||||
|
|
||||||
return Inventory
|
return Inventory
|
||||||
@@ -1,22 +1,16 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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 = Inventory or {}
|
||||||
|
|
||||||
local codem = exports['codem-inventory']
|
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
|
---@return string
|
||||||
Inventory.GetResourceName = function()
|
Inventory.GetResourceName = function()
|
||||||
return "codem-inventory"
|
return "codem-inventory"
|
||||||
end
|
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}
|
||||||
---@return table
|
|
||||||
Inventory.Items = function()
|
|
||||||
return codem:GetItemList() or {}
|
|
||||||
end
|
|
||||||
|
|
||||||
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -33,28 +27,34 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
item = Inventory.StripPNG(item)
|
item = Inventory.StripPNG(item)
|
||||||
local file = LoadResourceFile("codem-inventory", string.format("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/images/%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"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function()
|
Inventory.GetPlayerInventory = function()
|
||||||
local items = {}
|
local items = {}
|
||||||
local inventory = codem:getUserInventory()
|
local inventory = codem:GetClientPlayerInventory()
|
||||||
for _, v in pairs(inventory) do
|
for _, v in pairs(inventory) do
|
||||||
table.insert(items, {
|
table.insert(items, {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
label = v.label,
|
label = v.label,
|
||||||
count = v.amount,
|
count = v.amount or v.count,
|
||||||
slot = v.slot,
|
slot = v.slot,
|
||||||
metadata = v.info,
|
metadata = v.info or v.metadata or {},
|
||||||
stack = v.unique,
|
stack = v.unique,
|
||||||
close = v.useable,
|
close = v.useable,
|
||||||
weight = v.weight
|
weight = v.weight
|
||||||
@@ -63,9 +63,4 @@ Inventory.GetPlayerInventory = function()
|
|||||||
return items
|
return items
|
||||||
end
|
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
|
return Inventory
|
||||||
@@ -1,29 +1,45 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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 = Inventory or {}
|
||||||
Inventory.Stashes = Inventory.Stashes or {}
|
Inventory.Stashes = Inventory.Stashes or {}
|
||||||
|
|
||||||
local codem = exports['codem-inventory']
|
local codem = exports['codem-inventory']
|
||||||
|
|
||||||
---This will add an item, and return true or false based on success
|
---@description This will get the name of the in use resource.
|
||||||
---@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.
|
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetResourceName = function()
|
Inventory.GetResourceName = function()
|
||||||
return "codem-inventory"
|
return "codem-inventory"
|
||||||
end
|
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
|
---This will remove an item, and return true or false based on success
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
@@ -32,17 +48,17 @@ end
|
|||||||
---@param metadata table
|
---@param metadata table
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
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})
|
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
|
end
|
||||||
|
|
||||||
---This will return the entire items table from the inventory.
|
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||||
---@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}
|
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -58,7 +74,22 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
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
|
---@param src number
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function(src)
|
Inventory.GetPlayerInventory = function(src)
|
||||||
@@ -68,19 +99,18 @@ Inventory.GetPlayerInventory = function(src)
|
|||||||
for _, v in pairs(playerItems) do
|
for _, v in pairs(playerItems) do
|
||||||
table.insert(repackedTable, {
|
table.insert(repackedTable, {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
count = v.amount,
|
count = v.amount or v.count,
|
||||||
metadata = v.info,
|
metadata = v.info or v.metadata or {},
|
||||||
slot = v.slot,
|
slot = v.slot,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
return repackedTable
|
return repackedTable
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the specified slot data as a table.
|
---@description Returns the specified slot data as a table.
|
||||||
---format {weight, name, metadata, slot, label, count}
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param slot number
|
---@param slot number
|
||||||
---@return table
|
---@return table {weight, name, metadata, slot, label, count}
|
||||||
Inventory.GetItemBySlot = function(src, slot)
|
Inventory.GetItemBySlot = function(src, slot)
|
||||||
local slotData = codem:GetItemBySlot(src, slot)
|
local slotData = codem:GetItemBySlot(src, slot)
|
||||||
if not slotData then return {} end
|
if not slotData then return {} end
|
||||||
@@ -90,13 +120,13 @@ Inventory.GetItemBySlot = function(src, slot)
|
|||||||
weight = slotData.weight,
|
weight = slotData.weight,
|
||||||
slot = slotData.slot,
|
slot = slotData.slot,
|
||||||
count = slotData.amount or slotData.count,
|
count = slotData.amount or slotData.count,
|
||||||
metadata = slotData.info or slotData.metadata,
|
metadata = slotData.info or slotData.metadata or {},
|
||||||
stack = slotData.unique,
|
stack = slotData.unique or false,
|
||||||
description = slotData.description
|
description = slotData.description
|
||||||
}
|
}
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param slot number
|
---@param slot number
|
||||||
@@ -106,103 +136,57 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
|
|||||||
return codem:SetItemMetadata(src, slot, metadata)
|
return codem:SetItemMetadata(src, slot, metadata)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will open the specified stash for the src passed.
|
---@description This will return a boolean if the player has the item.
|
||||||
---@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.
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(src, item)
|
Inventory.HasItem = function(src, item, requiredCount)
|
||||||
return codem:HasItem(src, item, 1)
|
return codem:HasItem(src, item, requiredCount or 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This is to get if there is available space in the inventory, will return boolean.
|
---@description This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||||
---@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.
|
|
||||||
---@param id string
|
---@param id string
|
||||||
|
---@param _type string unused with ox_inventory
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.ClearStash = function(id, _type)
|
Inventory.ClearStash = function(id, _type)
|
||||||
if type(id) ~= "string" then return false end
|
if type(id) ~= "string" then return false end
|
||||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil 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
|
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 add items to a stash, and return true or false based on success
|
||||||
---@param oldplate string
|
---@param id string
|
||||||
---@param newplate string
|
---@param items table {item, count, metadata}
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.UpdatePlate = function(oldplate, newplate)
|
Inventory.AddStashItems = function(id, items)
|
||||||
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.")
|
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
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
item = Inventory.StripPNG(item)
|
item = Inventory.StripPNG(item)
|
||||||
local file = LoadResourceFile("codem-inventory", string.format("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/images/%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"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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
|
return Inventory
|
||||||
@@ -1,35 +1,26 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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
|
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")
|
Callback = Callback or Require("lib/callback/shared/callback.lua")
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
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.
|
---This will get the name of the in use resource.
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetResourceName = function()
|
Inventory.GetResourceName = function()
|
||||||
return "core_inventory"
|
return "core_inventory"
|
||||||
end
|
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.
|
---This will return the entire items table from the inventory.
|
||||||
---@return table
|
---@return table
|
||||||
@@ -38,13 +29,16 @@ Inventory.Items = function()
|
|||||||
if not frameworkName then return {} end
|
if not frameworkName then return {} end
|
||||||
local dataRepack = {}
|
local dataRepack = {}
|
||||||
if frameworkName == 'es_extended' then
|
if frameworkName == 'es_extended' then
|
||||||
local callbackData = Callback.Trigger('community_bridge:Callback:core_inventory', false)
|
if not cachedItemList then cachedItemList = Callback.Trigger('community_bridge:Callback:core_inventory', false) end
|
||||||
-- really really wish this inventory allowed me to pull the item list client side....
|
dataRepack = cachedItemList or {}
|
||||||
dataRepack = callbackData
|
|
||||||
if not dataRepack then return {} end
|
|
||||||
elseif frameworkName == 'qb-core' then
|
elseif frameworkName == 'qb-core' then
|
||||||
dataRepack = Framework.Shared.Items
|
dataRepack = Framework.Shared.Items or {}
|
||||||
if not dataRepack then return {} end
|
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
|
end
|
||||||
return dataRepack
|
return dataRepack
|
||||||
end
|
end
|
||||||
@@ -56,11 +50,12 @@ Inventory.HasItem = function(item)
|
|||||||
return core:hasItem(item, 1)
|
return core:hasItem(item, 1)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return number
|
---@param requiredCount number (optional)
|
||||||
Inventory.GetItemCount = function(item)
|
---@return boolean
|
||||||
return core:getItemCount(item)
|
Inventory.HasItem = function(item, requiredCount)
|
||||||
|
return core:getItemCount(item) >= (requiredCount or 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get the image path for this item, if not found will return placeholder.
|
---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
|
for _, v in pairs(playerItems) do
|
||||||
table.insert(repackedTable, {
|
table.insert(repackedTable, {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
count = v.count,
|
count = v.count or v.amount,
|
||||||
metadata = v.metadata,
|
metadata = v.metadata or v.info,
|
||||||
slot = v.id,
|
slot = v.id or v.slot,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
return repackedTable
|
return repackedTable
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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 = Inventory or {}
|
||||||
Inventory.Stashes = Inventory.Stashes or {}
|
Inventory.Stashes = Inventory.Stashes or {}
|
||||||
Callback = Callback or Require("lib/callback/shared/callback.lua")
|
Callback = Callback or Require("lib/callback/shared/callback.lua")
|
||||||
local core = exports.core_inventory
|
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
|
---This will add an item, and return true or false based on success
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
@@ -14,18 +20,14 @@ local core = exports.core_inventory
|
|||||||
---@param metadata table
|
---@param metadata table
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
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})
|
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
|
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
|
---This will remove an item, and return true or false based on success
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
@@ -39,7 +41,7 @@ Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
|||||||
if not inv then return false end
|
if not inv then return false end
|
||||||
for _, v in pairs(inv) do
|
for _, v in pairs(inv) do
|
||||||
if v.name == item and v.metadata == metadata then
|
if v.name == item and v.metadata == metadata then
|
||||||
slot = v.slot
|
slot = v.id or v.slot
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -53,11 +55,12 @@ Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
|||||||
identifier = string.gsub(identifier, ":", "")
|
identifier = string.gsub(identifier, ":", "")
|
||||||
end
|
end
|
||||||
local weirdInventoryName = 'content-' .. identifier
|
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)
|
return core:removeItemExact(weirdInventoryName, slot, count)
|
||||||
end
|
end
|
||||||
core:removeItem(src, item, count)
|
core:removeItem(src, item, count)
|
||||||
return true
|
return true
|
||||||
-- I hate this inventory so much, I am so sorry for this.
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the count of the item in the players inventory, if not found will return 0.
|
---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 playerItems = core:getInventory(src)
|
||||||
local repackedTable = {}
|
local repackedTable = {}
|
||||||
for _, v in pairs(playerItems) do
|
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)
|
local plaseFixThisExportCuzThisIsPainful = core:getItems(src, v.name)
|
||||||
if plaseFixThisExportCuzThisIsPainful then
|
if plaseFixThisExportCuzThisIsPainful then
|
||||||
for _, item in pairs(plaseFixThisExportCuzThisIsPainful) do
|
for _, item in pairs(plaseFixThisExportCuzThisIsPainful) do
|
||||||
table.insert(repackedTable, {
|
table.insert(repackedTable, {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
count = item.count,
|
count = item.count or item.amount,
|
||||||
metadata = item.metadata,
|
metadata = item.metadata or item.info,
|
||||||
slot = item.id,
|
slot = item.id or item.slot,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
table.insert(repackedTable, {
|
table.insert(repackedTable, {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
count = v.count,
|
count = v.count or v.amount,
|
||||||
metadata = v.metadata,
|
metadata = v.metadata or v.info,
|
||||||
slot = v.id,
|
slot = v.id or v.slot,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -126,12 +129,12 @@ Inventory.GetItemBySlot = function(src, slot)
|
|||||||
local inv = Inventory.GetPlayerInventory(src)
|
local inv = Inventory.GetPlayerInventory(src)
|
||||||
if not inv then return {} end
|
if not inv then return {} end
|
||||||
for _, v in pairs(inv) do
|
for _, v in pairs(inv) do
|
||||||
if v.slot == slot then
|
if (v.slot == slot) or (v.id == slot) then
|
||||||
return {
|
return {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
count = v.count,
|
count = v.count,
|
||||||
metadata = v.metadata,
|
metadata = v.metadata,
|
||||||
slot = v.slot,
|
slot = v.id or v.slot,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -156,7 +159,7 @@ end
|
|||||||
Inventory.OpenStash = function(src, _type, id)
|
Inventory.OpenStash = function(src, _type, id)
|
||||||
_type = _type or "stash"
|
_type = _type or "stash"
|
||||||
local tbl = Inventory.Stashes[id]
|
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
|
end
|
||||||
|
|
||||||
---This will register a stash
|
---This will register a stash
|
||||||
@@ -185,12 +188,14 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
|
|||||||
return true, id
|
return true, id
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(src, item)
|
Inventory.HasItem = function(src, item, requiredCount)
|
||||||
return core:getItemCount(src, item) > 0
|
local count = Inventory.GetItemCount(src, item, nil)
|
||||||
|
return count >= (requiredCount or 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This is to get if there is available space in the inventory, will return boolean.
|
---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.")
|
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
|
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)
|
---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 oldplate string
|
||||||
---@param newplate string
|
---@param newplate string
|
||||||
@@ -267,9 +263,7 @@ end
|
|||||||
|
|
||||||
Inventory.OpenPlayerInventory = function(src, target)
|
Inventory.OpenPlayerInventory = function(src, target)
|
||||||
assert(src, "OpenPlayerInventory: src is required")
|
assert(src, "OpenPlayerInventory: src is required")
|
||||||
if not target then
|
assert(target, "OpenPlayerInventory: target is required")
|
||||||
target = src
|
|
||||||
end
|
|
||||||
local identifier = Framework.GetPlayerIdentifier(target)
|
local identifier = Framework.GetPlayerIdentifier(target)
|
||||||
if not identifier then return false end
|
if not identifier then return false end
|
||||||
exports.core_inventory:openInventory(src, 'stash-'.. identifier:gsub(':',''), 'stash', nil, nil, true, nil, false)
|
exports.core_inventory:openInventory(src, 'stash-'.. identifier:gsub(':',''), 'stash', nil, nil, true, nil, false)
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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 jpr = exports['jpr-inventory']
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
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
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -20,28 +26,7 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@description This will get the image path for this item, if not found will return placeholder.
|
||||||
---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.
|
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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 jpr = exports['jpr-inventory']
|
||||||
local registeredShops = {}
|
local registeredShops = {}
|
||||||
@@ -7,37 +7,43 @@ local registeredShops = {}
|
|||||||
Inventory = Inventory or {}
|
Inventory = Inventory or {}
|
||||||
Inventory.Stashes = Inventory.Stashes 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.
|
||||||
---@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.
|
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetResourceName = function()
|
Inventory.GetResourceName = function()
|
||||||
return "jpr-inventory"
|
return "jpr-inventory"
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
---@param slot number
|
---@param slot number (optional)
|
||||||
---@param metadata table
|
---@param metadata table (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
|
local canCarry = Inventory.CanCarryItem(src, item, count)
|
||||||
return exports['jpr-inventory']:RemoveItem(src, item, count, slot, 'community_bridge Item removed')
|
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
|
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
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -46,17 +52,10 @@ Inventory.GetItemInfo = function(item)
|
|||||||
return itemTable
|
return itemTable
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the entire items table from the inventory.
|
---@description Returns the specified slot data as a table.
|
||||||
---@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}
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param slot number
|
---@param slot number
|
||||||
---@return table
|
---@return table {weight, name, metadata, slot, label, count}
|
||||||
Inventory.GetItemBySlot = function(src, slot)
|
Inventory.GetItemBySlot = function(src, slot)
|
||||||
local slotData = jpr:GetItemBySlot(src, slot)
|
local slotData = jpr:GetItemBySlot(src, slot)
|
||||||
if not slotData then return {} end
|
if not slotData then return {} end
|
||||||
@@ -72,78 +71,27 @@ Inventory.GetItemBySlot = function(src, slot)
|
|||||||
}
|
}
|
||||||
end
|
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 src number
|
||||||
---@param _type string
|
---@param _type string "stash", "trunk", "glovebox"
|
||||||
---@param id number||string
|
---@param id string
|
||||||
---@return nil
|
---@return nil
|
||||||
Inventory.OpenStash = function(src, _type, id)
|
Inventory.OpenStash = function(src, _type, id)
|
||||||
_type = _type or "stash"
|
_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 })
|
TriggerClientEvent('community_bridge:client:jpr-inventory:openStash', src, id, { weight = tbl.weight, slots = tbl.slots })
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will register a stash
|
---@description This will return a boolean if the player has the item.
|
||||||
---@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.
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(src, item)
|
Inventory.HasItem = function(src, item, requiredCount)
|
||||||
return jpr:HasItem(src, item, 1)
|
return jpr:HasItem(src, item, requiredCount or 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This is to get if there is available space in the inventory, will return boolean.
|
---@description This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||||
---@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)
|
|
||||||
---@param oldplate string
|
---@param oldplate string
|
||||||
---@param newplate string
|
---@param newplate string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
@@ -158,7 +106,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
|||||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
@@ -168,26 +116,26 @@ Inventory.GetImagePath = function(item)
|
|||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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 src number
|
||||||
---@param shopTitle string
|
---@param shopTitle string
|
||||||
Inventory.OpenShop = function(src, shopTitle)
|
Inventory.OpenShop = function(src, shopTitle)
|
||||||
jpr:OpenShop(src, shopTitle)
|
jpr:OpenShop(src, shopTitle)
|
||||||
end
|
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 shopTitle string
|
||||||
---@param shopInventory table
|
---@param inventory table
|
||||||
---@param shopCoords table
|
---@param shopCoords table
|
||||||
---@param shopGroups table
|
---@param shopGroups table
|
||||||
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
|
Inventory.RegisterShop = function(shopTitle, inventory, shopCoords, shopGroups)
|
||||||
if not shopTitle or not shopInventory or not shopCoords then return end
|
if not shopTitle or not inventory or not shopCoords then return end
|
||||||
if registeredShops[shopTitle] then return true end
|
if registeredShops[shopTitle] then return true end
|
||||||
|
|
||||||
local repackItems = {}
|
local repackItems = {}
|
||||||
local repackedShopItems = {name = shopTitle, label = shopTitle, coords = shopCoords, items = repackItems, slots = #shopInventory, }
|
local repackedShopItems = {name = shopTitle, label = shopTitle, coords = shopCoords, items = repackItems, slots = #inventory, }
|
||||||
for k, v in pairs(shopInventory) do
|
for k, v in pairs(inventory) do
|
||||||
table.insert(repackItems, { name = v.name, price = v.price or 1000, amount = v.count or 1, slot = k })
|
table.insert(repackItems, { name = v.name, price = v.price or 1000, amount = v.count or v.amount or 1, slot = k })
|
||||||
end
|
end
|
||||||
|
|
||||||
jpr:CreateShop(repackedShopItems)
|
jpr:CreateShop(repackedShopItems)
|
||||||
@@ -195,11 +143,12 @@ Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGrou
|
|||||||
return true
|
return true
|
||||||
end
|
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)
|
Inventory.OpenPlayerInventory = function(src, target)
|
||||||
assert(src, "OpenPlayerInventory: src is required")
|
assert(src, "OpenPlayerInventory: src is required")
|
||||||
if not target then
|
assert(target, "OpenPlayerInventory: target is required")
|
||||||
target = src
|
|
||||||
end
|
|
||||||
local identifier = Framework.GetPlayerIdentifier(target)
|
local identifier = Framework.GetPlayerIdentifier(target)
|
||||||
if not identifier then return false end
|
if not identifier then return false end
|
||||||
exports['jpr-inventory']:OpenInventory(src, identifier)
|
exports['jpr-inventory']:OpenInventory(src, identifier)
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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 = Inventory or {}
|
||||||
local origin = exports.origen_inventory
|
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
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
local itemData = origin:Items(item)
|
local itemData = Inventory.Items()[item]
|
||||||
if not itemData then return {} end
|
if not itemData then return {} end
|
||||||
return {
|
return {
|
||||||
name = itemData.name or "Missing Name",
|
name = itemData.name or "Missing Name",
|
||||||
@@ -19,26 +26,16 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get the name of the in use resource.
|
---@description Will return boolean if the player has the item.
|
||||||
---@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.
|
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(item)
|
Inventory.HasItem = function(item, requiredCount)
|
||||||
return origin:HasItem(item)
|
local count = Inventory.GetItemCount(item)
|
||||||
|
return count >= (requiredCount or 1)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return number
|
---@return number
|
||||||
Inventory.GetItemCount = function(item)
|
Inventory.GetItemCount = function(item)
|
||||||
@@ -47,7 +44,7 @@ Inventory.GetItemCount = function(item)
|
|||||||
return inventory.count
|
return inventory.count
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
@@ -57,7 +54,7 @@ Inventory.GetImagePath = function(item)
|
|||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function()
|
Inventory.GetPlayerInventory = function()
|
||||||
local repack = {}
|
local repack = {}
|
||||||
@@ -67,10 +64,10 @@ Inventory.GetPlayerInventory = function()
|
|||||||
table.insert(repack, {
|
table.insert(repack, {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
label = v.label,
|
label = v.label,
|
||||||
count = v.amount,
|
count = v.amount or v.count,
|
||||||
slot = v.slot,
|
slot = v.slot,
|
||||||
metadata = v.metadata,
|
metadata = v.metadata or v.info or {},
|
||||||
stack = v.unique,
|
stack = v.unique or v.stack or false,
|
||||||
close = v.useable,
|
close = v.useable,
|
||||||
weight = v.weight
|
weight = v.weight
|
||||||
})
|
})
|
||||||
@@ -78,8 +75,4 @@ Inventory.GetPlayerInventory = function()
|
|||||||
return repack
|
return repack
|
||||||
end
|
end
|
||||||
|
|
||||||
Inventory.OpenStash = function(id)
|
|
||||||
origin:openInventory('stash', id, { label = id, weight = 400000, slots = 100, })
|
|
||||||
end
|
|
||||||
|
|
||||||
return Inventory
|
return Inventory
|
||||||
@@ -1,42 +1,49 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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 = Inventory or {}
|
||||||
Inventory.Stashes = Inventory.Stashes or {}
|
Inventory.Stashes = Inventory.Stashes or {}
|
||||||
|
|
||||||
local origin = exports.origen_inventory
|
local origin = exports.origen_inventory
|
||||||
|
|
||||||
---This will add an item, and return true or false based on success
|
---@description This will get the name of the in use resource.
|
||||||
---@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.
|
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetResourceName = function()
|
Inventory.GetResourceName = function()
|
||||||
return "origen_inventory"
|
return "origen_inventory"
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
---@param slot number
|
---@param slot number (optional)
|
||||||
---@param metadata table
|
---@param metadata table (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
|
local canCarry = Inventory.CanCarryItem(src, item, count)
|
||||||
return origin:removeItem(src, item, count, metadata, slot, true)
|
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
|
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 identifier string
|
||||||
---@param items table
|
---@param items table
|
||||||
---@return boolean
|
---@return boolean
|
||||||
@@ -48,8 +55,8 @@ Inventory.AddTrunkItems = function(identifier, items)
|
|||||||
for _, v in pairs(items) do
|
for _, v in pairs(items) do
|
||||||
table.insert(repack_items, {
|
table.insert(repack_items, {
|
||||||
name = v.item,
|
name = v.item,
|
||||||
amount = v.count,
|
amount = v.count or v.amount,
|
||||||
metadata = v.metadata or {}
|
metadata = v.metadata or v.info or {}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
if #repack_items == 0 then return false end
|
if #repack_items == 0 then return false end
|
||||||
@@ -57,13 +64,14 @@ Inventory.AddTrunkItems = function(identifier, items)
|
|||||||
return true
|
return true
|
||||||
end
|
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 identifier string
|
---@param id string
|
||||||
|
---@param _type string unused with ox_inventory
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.ClearStash = function(identifier, _type)
|
Inventory.ClearStash = function(id, _type)
|
||||||
if type(identifier) ~= "string" then return false end
|
if type(id) ~= "string" then return false end
|
||||||
if Inventory.Stashes[identifier] then Inventory.Stashes[identifier] = nil end
|
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
||||||
local id = identifier
|
local id = id
|
||||||
if _type == "trunk" then
|
if _type == "trunk" then
|
||||||
id = "trunk_"..id
|
id = "trunk_"..id
|
||||||
elseif _type == "glovebox" then
|
elseif _type == "glovebox" then
|
||||||
@@ -71,7 +79,7 @@ Inventory.ClearStash = function(identifier, _type)
|
|||||||
elseif _type == "stash" then
|
elseif _type == "stash" then
|
||||||
id = "stash_"..id
|
id = "stash_"..id
|
||||||
end
|
end
|
||||||
local inv = origin:getInventory(identifier, _type)
|
local inv = origin:getInventory(id, _type)
|
||||||
if not inv then return false end
|
if not inv then return false end
|
||||||
local indexed = inv.inventory
|
local indexed = inv.inventory
|
||||||
for _, v in pairs(indexed) do
|
for _, v in pairs(indexed) do
|
||||||
@@ -82,7 +90,7 @@ Inventory.ClearStash = function(identifier, _type)
|
|||||||
return true
|
return true
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -98,23 +106,22 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the entire items table from the inventory.
|
---@description This will return the entire items table from the inventory.
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.Items = function()
|
Inventory.Items = function()
|
||||||
return origin:Items()
|
return origin:Items()
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the count of the item in the players inventory, if not found will return 0.
|
---@description 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.
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param metadata table
|
---@param metadata table (optional)
|
||||||
---@return number
|
---@return number
|
||||||
Inventory.GetItemCount = function(src, item, metadata)
|
Inventory.GetItemCount = function(src, item, metadata)
|
||||||
return origin:getItemCount(src, item, metadata, false) or 0
|
return origin:getItemCount(src, item, metadata, false) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
---This wil return the players inventory.
|
---@description This will return the players inventory.
|
||||||
---@param src number
|
---@param src number
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function(src)
|
Inventory.GetPlayerInventory = function(src)
|
||||||
@@ -125,8 +132,8 @@ Inventory.GetPlayerInventory = function(src)
|
|||||||
if v.slot then
|
if v.slot then
|
||||||
table.insert(repack, {
|
table.insert(repack, {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
count = v.amount,
|
count = v.amount or v.count,
|
||||||
metadata = v.metadata or {},
|
metadata = v.metadata or v.info or {},
|
||||||
slot = v.slot,
|
slot = v.slot,
|
||||||
label = v.label or "Unknown"
|
label = v.label or "Unknown"
|
||||||
})
|
})
|
||||||
@@ -135,20 +142,19 @@ Inventory.GetPlayerInventory = function(src)
|
|||||||
return repack
|
return repack
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the specified slot data as a table.
|
---@description Returns the specified slot data as a table.
|
||||||
---format {weight, name, metadata, slot, label, count}
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param slot number
|
---@param slot number
|
||||||
---@return table
|
---@return table {weight, name, metadata, slot, label, count}
|
||||||
Inventory.GetItemBySlot = function(src, slot)
|
Inventory.GetItemBySlot = function(src, slot)
|
||||||
local playerInv = Inventory.GetPlayerInventory(src)
|
local playerInv = Inventory.GetPlayerInventory(src)
|
||||||
for _, v in pairs(playerInv) do
|
for _, v in pairs(playerInv) do
|
||||||
if v.slot == slot then
|
if v.slot == slot then
|
||||||
return {
|
return {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
count = v.count,
|
count = v.count or v.amount,
|
||||||
weight = v.weight or 0,
|
weight = v.weight or 0,
|
||||||
metadata = v.metadata,
|
metadata = v.metadata or v.info or {},
|
||||||
slot = v.slot,
|
slot = v.slot,
|
||||||
label = v.label
|
label = v.label
|
||||||
}
|
}
|
||||||
@@ -157,7 +163,7 @@ Inventory.GetItemBySlot = function(src, slot)
|
|||||||
return {}
|
return {}
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param slot number
|
---@param slot number
|
||||||
@@ -167,51 +173,43 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
|
|||||||
origin:setMetadata(src, slot, metadata)
|
origin:setMetadata(src, slot, metadata)
|
||||||
end
|
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 src number
|
||||||
---@param _type string
|
---@param _type string "stash", "trunk", "glovebox"
|
||||||
---@param id number|string
|
---@param id string
|
||||||
---@return nil
|
---@return nil
|
||||||
Inventory.OpenStash = function(src, _type, id)
|
Inventory.OpenStash = function(src, _type, id)
|
||||||
_type = _type or "stash"
|
_type = _type or "stash"
|
||||||
local tbl = Inventory.Stashes[id]
|
|
||||||
return origin:OpenInventory(src, _type, id)
|
return origin:OpenInventory(src, _type, id)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will register a stash
|
---@description This will register a stash
|
||||||
---@param id number|string
|
---@param id number|string
|
||||||
---@param label string
|
---@param label string
|
||||||
---@param slots number
|
---@param slots number
|
||||||
---@param weight number
|
---@param weight number
|
||||||
---@param owner string
|
---@param owner string (optional)
|
||||||
---@param groups table
|
---@param groups table (optional)
|
||||||
---@param coords table
|
---@param coords table (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
---@return string|number
|
---@return string|number
|
||||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||||
if Inventory.Stashes[id] then return true, id end
|
if Inventory.Stashes[id] then return true, id end
|
||||||
Inventory.Stashes[id] = {
|
Inventory.Stashes[id] = {id = id, label = label or id, slots = slots, weight = weight, owner = owner, groups = groups, coords = coords}
|
||||||
id = id,
|
|
||||||
label = label,
|
|
||||||
slots = slots,
|
|
||||||
weight = weight,
|
|
||||||
owner = owner,
|
|
||||||
groups = groups,
|
|
||||||
coords = coords
|
|
||||||
}
|
|
||||||
origin:registerStash(id, label, slots, weight, owner, groups, coords)
|
origin:registerStash(id, label, slots, weight, owner, groups, coords)
|
||||||
return true, id
|
return true, id
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(src, item)
|
Inventory.HasItem = function(src, item, requiredCount)
|
||||||
return origin:getItemCount(src , item) > 0
|
return origin:getItemCount(src , item) > (requiredCount or 0)
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
@@ -220,7 +218,7 @@ Inventory.CanCarryItem = function(src, item, count)
|
|||||||
return origin:canCarryItem(src, item, count)
|
return origin:canCarryItem(src, item, count)
|
||||||
end
|
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 oldplate string
|
||||||
---@param newplate string
|
---@param newplate string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
@@ -235,7 +233,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
|||||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
@@ -245,11 +243,12 @@ Inventory.GetImagePath = function(item)
|
|||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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)
|
Inventory.OpenPlayerInventory = function(src, target)
|
||||||
assert(src, "OpenPlayerInventory: src is required")
|
assert(src, "OpenPlayerInventory: src is required")
|
||||||
if not target then
|
assert(target, "OpenPlayerInventory: target is required")
|
||||||
target = src
|
|
||||||
end
|
|
||||||
exports.origen_inventory:OpenInventory(src, "otherplayer", target)
|
exports.origen_inventory:OpenInventory(src, "otherplayer", target)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,21 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
if GetResourceState('ox_inventory') ~= 'started' then return end
|
if GetResourceState('ox_inventory') == 'missing' then return end
|
||||||
if GetResourceState('qs-inventory') == 'started' then return end
|
if GetResourceState('tgiann-inventory') ~= 'missing' then return end
|
||||||
if GetResourceState('origen_inventory') == 'started' 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 ox_inventory = exports.ox_inventory
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
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
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -23,33 +31,28 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get the name of the in use resource.
|
---@description This will return the entire items table from the inventory.
|
||||||
---@return string
|
|
||||||
Inventory.GetResourceName = function()
|
|
||||||
return "ox_inventory"
|
|
||||||
end
|
|
||||||
|
|
||||||
---This will return the entire items table from the inventory.
|
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.Items = function()
|
Inventory.Items = function()
|
||||||
return ox_inventory:Items()
|
return ox_inventory:Items()
|
||||||
end
|
end
|
||||||
|
|
||||||
---Will return boolean if the player has the item.
|
---@description Will return boolean if the player has the item.
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(item)
|
Inventory.HasItem = function(item, requiredCount)
|
||||||
return ox_inventory:Search('count', item) > 0
|
return ox_inventory:Search('count', item, nil) >= (requiredCount or 1)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return number
|
---@return number
|
||||||
Inventory.GetItemCount = function(item)
|
Inventory.GetItemCount = function(item)
|
||||||
return ox_inventory:GetItemCount(item, nil, false)
|
return ox_inventory:GetItemCount(item, nil, false)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
@@ -59,7 +62,7 @@ Inventory.GetImagePath = function(item)
|
|||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function()
|
Inventory.GetPlayerInventory = function()
|
||||||
return ox_inventory:GetPlayerItems()
|
return ox_inventory:GetPlayerItems()
|
||||||
|
|||||||
@@ -1,71 +1,50 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
if GetResourceState('ox_inventory') ~= 'started' then return end
|
if GetResourceState('ox_inventory') == 'missing' then return end
|
||||||
if GetResourceState('qs-inventory') == 'started' then return end
|
if GetResourceState('tgiann-inventory') ~= 'missing' then return end
|
||||||
if GetResourceState('origen_inventory') == 'started' 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 ox_inventory = exports.ox_inventory
|
||||||
local registeredShops = {}
|
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
Inventory = Inventory or {}
|
||||||
Inventory.Stashes = Inventory.Stashes 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.
|
||||||
---@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.
|
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetResourceName = function()
|
Inventory.GetResourceName = function()
|
||||||
return "ox_inventory"
|
return "ox_inventory"
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
---@param slot number
|
---@param slot number (optional)
|
||||||
---@param metadata table
|
---@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
|
---@return boolean
|
||||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
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})
|
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
|
end
|
||||||
|
|
||||||
---This will add items to a trunk, and return true or false based on success
|
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||||
---@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}
|
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -81,41 +60,37 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the entire items table from the inventory.
|
---@description This will return the entire items table from the inventory.
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.Items = function()
|
Inventory.Items = function()
|
||||||
return ox_inventory:Items()
|
return ox_inventory:Items()
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the count of the item in the players inventory, if not found will return 0.
|
---@description 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.
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param metadata table
|
---@param metadata table (optional)
|
||||||
---@return number
|
---@return number
|
||||||
Inventory.GetItemCount = function(src, item, metadata)
|
Inventory.GetItemCount = function(src, item, metadata)
|
||||||
return ox_inventory:GetItemCount(src, item, metadata, false)
|
return ox_inventory:GetItemCount(src, item, metadata, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This wil return the players inventory.
|
---@description This wil return the players inventory.
|
||||||
---@param src number
|
---@param src number
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function(src)
|
Inventory.GetPlayerInventory = function(src)
|
||||||
return ox_inventory:GetInventoryItems(src, false)
|
return ox_inventory:GetInventoryItems(src, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the specified slot data as a table.
|
---@description Returns the specified slot data as a table.
|
||||||
---
|
|
||||||
---format {weight, name, metadata, slot, label, count}
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param slot number
|
---@param slot number
|
||||||
---@return table
|
---@return table {weight, name, metadata, slot, label, count}
|
||||||
Inventory.GetItemBySlot = function(src, slot)
|
Inventory.GetItemBySlot = function(src, slot)
|
||||||
return ox_inventory:GetSlot(src, slot)
|
return ox_inventory:GetSlot(src, slot)
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param slot number
|
---@param slot number
|
||||||
@@ -125,52 +100,70 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
|
|||||||
ox_inventory:SetMetadata(src, slot, metadata)
|
ox_inventory:SetMetadata(src, slot, metadata)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will open the specified stash for the src passed.
|
---@description This will register a stash
|
||||||
---@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
|
|
||||||
---@param id number|string
|
---@param id number|string
|
||||||
---@param label string
|
---@param label string
|
||||||
---@param slots number
|
---@param slots number
|
||||||
---@param weight number
|
---@param weight number
|
||||||
---@param owner string
|
---@param owner string (optional)
|
||||||
---@param groups table
|
---@param groups table (optional)
|
||||||
---@param coords table
|
---@param coords table (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
---@return string|number
|
---@return string|number
|
||||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
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
|
if Inventory.Stashes[id] then return true, id end
|
||||||
Inventory.Stashes[id] = {
|
Inventory.Stashes[id] = {id = id, label = label, slots = slots, weight = weight, owner = owner, groups = groups, coords = coords}
|
||||||
id = id,
|
|
||||||
label = label,
|
|
||||||
slots = slots,
|
|
||||||
weight = weight,
|
|
||||||
owner = owner,
|
|
||||||
groups = groups,
|
|
||||||
coords = coords
|
|
||||||
}
|
|
||||||
ox_inventory:RegisterStash(id, label, slots, weight, owner, groups, coords)
|
ox_inventory:RegisterStash(id, label, slots, weight, owner, groups, coords)
|
||||||
return true, id
|
return true, id
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param _type string "stash", "trunk", "glovebox"
|
||||||
---@return boolean
|
---@param id string
|
||||||
Inventory.HasItem = function(src, item)
|
---@return nil
|
||||||
return ox_inventory:GetItemCount(src, item, nil, false) > 0
|
Inventory.OpenStash = function(src, _type, id)
|
||||||
|
_type = _type or "stash"
|
||||||
|
ox_inventory:forceOpenInventory(src, _type, id)
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
@@ -179,17 +172,34 @@ Inventory.CanCarryItem = function(src, item, count)
|
|||||||
return ox_inventory:CanCarryItem(src, item, count)
|
return ox_inventory:CanCarryItem(src, item, count)
|
||||||
end
|
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 oldplate string
|
||||||
---@param newplate string
|
---@param newplate string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.UpdatePlate = function(oldplate, newplate)
|
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||||
ox_inventory:UpdateVehicle(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)
|
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
@@ -199,46 +209,31 @@ Inventory.GetImagePath = function(item)
|
|||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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))
|
---@description This will open the specified shop for the src passed.
|
||||||
-- This will open the specified shop for the src passed.
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param shopTitle string
|
---@param shopTitle string
|
||||||
Inventory.OpenShop = function(src, shopTitle)
|
Inventory.OpenShop = function(src, shopTitle)
|
||||||
TriggerClientEvent('ox_inventory:openInventory', src, 'shop', {type = shopTitle})
|
TriggerClientEvent('ox_inventory:openInventory', src, 'shop', {type = shopTitle})
|
||||||
end
|
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))
|
---@description This will register a shop, if it already exists it will return true.
|
||||||
-- This will register a shop, if it already exists it will return true.
|
|
||||||
---@param shopTitle string
|
---@param shopTitle string
|
||||||
---@param shopInventory table
|
---@param inventory table
|
||||||
---@param shopCoords table
|
---@param shopCoords table
|
||||||
---@param shopGroups table
|
---@param shopGroups table
|
||||||
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
|
Inventory.RegisterShop = function(shopTitle, inventory, shopCoords, shopGroups)
|
||||||
if registeredShops[shopTitle] then return true end
|
ox_inventory:RegisterShop(shopTitle, { name = shopTitle, inventory = inventory, groups = shopGroups, })
|
||||||
registeredShops[shopTitle] = true
|
-- ox standard doesnt return anything so probably shouldnt return so everything else has the same standard. Yeaaaa probably should change this.
|
||||||
ox_inventory:RegisterShop(shopTitle, { name = shopTitle, inventory = shopInventory, groups = shopGroups, })
|
|
||||||
--return Inventory.OpenShop(src, shopTitle)
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
---UNUSED:
|
---@description This will open a players inventory, used for admin purposes and stuff.
|
||||||
---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 }
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param target number
|
||||||
---@param metadata table
|
|
||||||
---@return table
|
|
||||||
Inventory.GetItem = function(src, item, metadata)
|
|
||||||
return ox_inventory:GetItem(src, item, metadata, false)
|
|
||||||
end
|
|
||||||
|
|
||||||
Inventory.OpenPlayerInventory = function(src, target)
|
Inventory.OpenPlayerInventory = function(src, target)
|
||||||
assert(src, "OpenPlayerInventory: src is required")
|
assert(src, "OpenPlayerInventory: src is required")
|
||||||
if not target then
|
assert(target, "OpenPlayerInventory: target is required")
|
||||||
target = src
|
ox_inventory:forceOpenInventory(src, 'player', target)
|
||||||
end
|
|
||||||
exports.ox_inventory:openInventory('player', target)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return Inventory
|
return Inventory
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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']
|
local ps = exports['ps-inventory']
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
Inventory = Inventory or {}
|
||||||
|
|||||||
@@ -1,62 +1,62 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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 sloth = exports['ps-inventory']
|
||||||
local registeredShops = {}
|
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
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.
|
||||||
---@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.
|
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetResourceName = function()
|
Inventory.GetResourceName = function()
|
||||||
return "ps-inventory"
|
return "ps-inventory"
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
---@param slot number
|
---@param slot number (optional)
|
||||||
---@param metadata table
|
---@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
|
---@return boolean
|
||||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
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('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})
|
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
|
end
|
||||||
|
|
||||||
---This will add items to a trunk, and return true or false based on success
|
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||||
---@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}
|
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -72,100 +72,45 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the entire items table from the inventory.
|
---@description Returns the specified slot data as a table.
|
||||||
---@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}
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param slot number
|
---@param slot number
|
||||||
---@return table
|
---@return table {weight, name, metadata, slot, label, count}
|
||||||
Inventory.GetItemBySlot = function(src, slot)
|
Inventory.GetItemBySlot = function(src, slot)
|
||||||
local slotData = sloth:GetItemBySlot(src, slot)
|
local item = sloth:GetItemBySlot(src, slot)
|
||||||
if not slotData then return {} end
|
if not item then return {} end
|
||||||
return {
|
return {
|
||||||
name = slotData.name,
|
name = item.name,
|
||||||
label = slotData.label or slotData.name,
|
label = item.label or item.name,
|
||||||
weight = slotData.weight,
|
weight = item.weight,
|
||||||
slot = slot,
|
slot = slot,
|
||||||
count = slotData.amount,
|
count = item.amount,
|
||||||
metadata = slotData.info,
|
metadata = item.info,
|
||||||
stack = slotData.unique,
|
stack = item.unique,
|
||||||
description = slotData.description
|
description = item.description
|
||||||
}
|
}
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param _type string "stash", "trunk", "glovebox"
|
||||||
---@param slot number
|
---@param id string
|
||||||
---@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
|
|
||||||
---@return nil
|
---@return nil
|
||||||
Inventory.OpenStash = function(src, _type, id)
|
Inventory.OpenStash = function(src, _type, id)
|
||||||
_type = _type or "stash"
|
_type = _type or "stash"
|
||||||
local tbl = Inventory.Stashes[id]
|
sloth:OpenInventory(_type, id, nil, src)
|
||||||
TriggerClientEvent('community_bridge:client:ps-inventory:openStash', src, id, { label = tbl.label, maxweight = tbl.weight, slots = tbl.slots, })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will register a stash
|
---@description This will return a boolean if the player has the item.
|
||||||
---@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.
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(src, item)
|
Inventory.HasItem = function(src, item, requiredCount)
|
||||||
return sloth:HasItem(src, item, 1)
|
return sloth:HasItem(src, item, requiredCount or 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This is to get if there is available space in the inventory, will return boolean.
|
---@description This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
|
||||||
---@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)
|
|
||||||
---@param oldplate string
|
---@param oldplate string
|
||||||
---@param newplate string
|
---@param newplate string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
@@ -176,11 +121,12 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
|||||||
}
|
}
|
||||||
local values = { newplate = newplate, oldplate = oldplate }
|
local values = { newplate = newplate, oldplate = oldplate }
|
||||||
MySQL.transaction.await(queries, values)
|
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
|
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
@@ -190,31 +136,41 @@ Inventory.GetImagePath = function(item)
|
|||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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 src number
|
||||||
---@param shopTitle string
|
---@param shopTitle string
|
||||||
Inventory.OpenShop = function(src, shopTitle)
|
Inventory.OpenShop = function(src, shopTitle)
|
||||||
return sloth:OpenShop(src, shopTitle)
|
return sloth:OpenShop(src, shopTitle)
|
||||||
end
|
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 shopTitle string
|
||||||
---@param shopInventory table
|
---@param inventory table
|
||||||
---@param shopCoords table
|
---@param shopCoords table
|
||||||
---@param shopGroups table
|
---@param shopGroups table
|
||||||
Inventory.RegisterShop = function(src, shopTitle, shopInventory, shopCoords, shopGroups)
|
Inventory.RegisterShop = function(shopTitle, inventory, shopCoords, shopGroups)
|
||||||
if not shopTitle or not shopInventory or not shopCoords then return end
|
assert(shopTitle, "RegisterShop: shopTitle is required")
|
||||||
if registeredShops[shopTitle] then return true end
|
assert(inventory, "RegisterShop: shopInventory is required")
|
||||||
|
assert(shopCoords, "RegisterShop: shopCoords is required")
|
||||||
|
assert(shopGroups, "RegisterShop: shopGroups is required")
|
||||||
|
|
||||||
local repackItems = {}
|
local repackItems = {}
|
||||||
local repackedShopItems = {name = shopTitle, label = shopTitle, coords = shopCoords, items = repackItems, slots = #shopInventory, }
|
for k, v in pairs(inventory) do
|
||||||
for k, v in pairs(shopInventory) do
|
table.insert(repackItems, { name = v.name, price = v.price or 1000, amount = v.amount or v.count or 1, slot = k })
|
||||||
table.insert(repackItems, { name = v.name, price = v.price or 1000, amount = v.count or 1, slot = k })
|
|
||||||
end
|
end
|
||||||
|
local repackedShopItems = {name = shopTitle, label = shopTitle, coords = shopCoords, items = repackItems, slots = #inventory, }
|
||||||
|
|
||||||
sloth:CreateShop(repackedShopItems)
|
sloth:CreateShop(repackedShopItems)
|
||||||
registeredShops[shopTitle] = true
|
|
||||||
return true
|
return true
|
||||||
end
|
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
|
return Inventory
|
||||||
@@ -1,12 +1,18 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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('codem-inventory') ~= 'missing' then return end
|
||||||
if GetResourceState('origen_inventory') ~= 'missing' then return end
|
if GetResourceState('origen_inventory') ~= 'missing' then return end
|
||||||
local qb = exports['qb-inventory']
|
local qb = exports['qb-inventory']
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
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
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -22,26 +28,21 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get the name of the in use resource.
|
---@description This will return the entire items table from the inventory.
|
||||||
---@return string
|
|
||||||
Inventory.GetResourceName = function()
|
|
||||||
return "qb-inventory"
|
|
||||||
end
|
|
||||||
|
|
||||||
---This will return the entire items table from the inventory.
|
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.Items = function()
|
Inventory.Items = function()
|
||||||
return Framework.Shared.Items
|
return Framework.Shared.Items
|
||||||
end
|
end
|
||||||
|
|
||||||
---Will return boolean if the player has the item.
|
---@description Will return boolean if the player has the item.
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(item)
|
Inventory.HasItem = function(item, requiredCount)
|
||||||
return qb:HasItem(item)
|
return qb:HasItem(item, requiredCount or 1)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
|
|||||||
@@ -1,106 +1,64 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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('codem-inventory') ~= 'missing' then return end
|
||||||
if GetResourceState('origen_inventory') ~= 'missing' then return end
|
if GetResourceState('origen_inventory') ~= 'missing' then return end
|
||||||
local qbInventory = exports['qb-inventory']
|
local qbInventory = exports['qb-inventory']
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
Inventory = Inventory or {}
|
||||||
Inventory.Stashes = Inventory.Stashes or {}
|
Inventory.Stashes = Inventory.Stashes or {}
|
||||||
|
Inventory.Old = {}
|
||||||
local registeredShops = {}
|
Inventory.Version = nil
|
||||||
local v1ShopData = {}
|
Inventory.ShopData = {}
|
||||||
|
|
||||||
local function getInventoryNewVersion()
|
local function getInventoryNewVersion()
|
||||||
if tonumber(string.sub(GetResourceMetadata("qb-inventory", "version", 0), 1, 1)) >= 2 then return true end
|
if tonumber(string.sub(GetResourceMetadata("qb-inventory", "version", 0), 1, 1)) >= 2 then Inventory.Version = true end
|
||||||
return false
|
Inventory.Version = false
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will add an item, and return true or false based on success
|
AddEventHandler('onResourceStart', function(resourceName)
|
||||||
---@param src number
|
if resourceName ~= "community_bridge" then return end
|
||||||
---@param item string
|
getInventoryNewVersion()
|
||||||
---@param count number
|
end)
|
||||||
---@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
|
|
||||||
|
|
||||||
---This will get the name of the in use resource.
|
---@description This will get the name of the in use resource.
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetResourceName = function()
|
Inventory.GetResourceName = function()
|
||||||
return "qb-inventory"
|
return "qb-inventory"
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
---@param slot number
|
---@param slot number (optional)
|
||||||
---@param metadata table
|
---@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
|
---@return boolean
|
||||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
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('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})
|
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
|
end
|
||||||
|
|
||||||
---This will add items to a trunk, and return true or false based on success
|
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
|
||||||
---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}
|
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -116,17 +74,16 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the entire items table from the inventory.
|
---@description This will return the entire items table from the inventory.
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.Items = function()
|
Inventory.Items = function()
|
||||||
return Framework.Shared.Items
|
return Framework.Shared.Items
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the specified slot data as a table.
|
---@description Returns the specified slot data as a table.
|
||||||
---format {weight, name, metadata, slot, label, count}
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param slot number
|
---@param slot number
|
||||||
---@return table
|
---@return table {weight, name, metadata, slot, label, count}
|
||||||
Inventory.GetItemBySlot = function(src, slot)
|
Inventory.GetItemBySlot = function(src, slot)
|
||||||
local slotData = qbInventory:GetItemBySlot(src, slot)
|
local slotData = qbInventory:GetItemBySlot(src, slot)
|
||||||
if not slotData then return {} end
|
if not slotData then return {} end
|
||||||
@@ -142,64 +99,88 @@ Inventory.GetItemBySlot = function(src, slot)
|
|||||||
}
|
}
|
||||||
end
|
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 src number
|
||||||
---@param _type string
|
---@param _type string "stash", "trunk", "glovebox"
|
||||||
---@param id number||string
|
---@param id string
|
||||||
---@return nil
|
---@return nil
|
||||||
Inventory.OpenStash = function(src, _type, id)
|
Inventory.OpenStash = function(src, _type, id)
|
||||||
_type = _type or "stash"
|
_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)
|
return qbInventory:OpenInventory(src, id)
|
||||||
end
|
|
||||||
|
|
||||||
TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = tbl.weight, slots = tbl.slots})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will register a stash
|
---@description This will add items to a stash, and return true or false based on success
|
||||||
---@param id number|string
|
---@param id string
|
||||||
---@param label string
|
---@param items table {item, count, metadata}
|
||||||
---@param slots number
|
|
||||||
---@param weight number
|
|
||||||
---@param owner string
|
|
||||||
---@param groups table
|
|
||||||
---@param coords table
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
---@return string|number
|
Inventory.AddStashItems = function(id, items)
|
||||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
if type(items) ~= "table" then return false end
|
||||||
if Inventory.Stashes[id] then return true, id end
|
if not Inventory.Version then return Inventory.Old.AddStashItems(id, items) end
|
||||||
Inventory.Stashes[id] = {
|
local success = false
|
||||||
id = id,
|
for _, item in pairs(items) do
|
||||||
label = label,
|
success = qbInventory:AddItem(id, item.item, item.count or item.amount, nil, item.metadata or item.info, "community_bridge, adding items to stash")
|
||||||
slots = slots,
|
end
|
||||||
weight = weight,
|
return success
|
||||||
owner = owner,
|
|
||||||
groups = groups,
|
|
||||||
coords = coords
|
|
||||||
}
|
|
||||||
return true, id
|
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(src, item)
|
Inventory.HasItem = function(src, item, requiredCount)
|
||||||
return qbInventory:HasItem(src, item, 1)
|
return qbInventory:HasItem(src, item, requiredCount or 1)
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.CanCarryItem = function(src, item, count)
|
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
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
@@ -209,87 +190,128 @@ Inventory.GetImagePath = function(item)
|
|||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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 oldplate string
|
||||||
---@param newplate string
|
---@param newplate string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.UpdatePlate = function(oldplate, newplate)
|
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||||
local newVersion = getInventoryNewVersion()
|
if not Inventory.Version then return Inventory.Old.UpdatePlate(oldplate, newplate) end
|
||||||
if newVersion then
|
local gloveboxInv = qbInventory:GetInventory('glovebox-'..oldplate) or {slots = 5, maxweight = 10000, items = {}}
|
||||||
local gloveboxInv = qbInventory:GetInventory('glovebox-'..oldplate) or {slots = 5, maxweight = 10000, items = {}}
|
local storedGloveBox = Bridge.Tables.DeepClone(gloveboxInv, nil, nil)
|
||||||
local storedGloveBox = Bridge.Tables.DeepClone(gloveboxInv, nil, nil)
|
local trunkInv = qbInventory:GetInventory('trunk-'..oldplate) or {slots = 5, maxweight = 10000, items = {}}
|
||||||
local trunkInv = qbInventory:GetInventory('trunk-'..oldplate) or {slots = 5, maxweight = 10000, items = {}}
|
local storedTrunk = Bridge.Tables.DeepClone(trunkInv, nil, nil)
|
||||||
local storedTrunk = Bridge.Tables.DeepClone(trunkInv, nil, nil)
|
qbInventory:ClearStash('glovebox-'..oldplate)
|
||||||
qbInventory:ClearStash('glovebox-'..oldplate)
|
qbInventory:ClearStash('trunk-'..oldplate)
|
||||||
qbInventory:ClearStash('trunk-'..oldplate)
|
qbInventory:CreateInventory('glovebox-'..newplate, {label = 'glovebox-'..newplate, slots = storedGloveBox.slots, maxweight = storedGloveBox.maxweight})
|
||||||
qbInventory:CreateInventory('glovebox-'..newplate, {label = 'glovebox-'..newplate, slots = storedGloveBox.slots, maxweight = storedGloveBox.maxweight})
|
qbInventory:SetInventory('glovebox-'..newplate, storedGloveBox.items, "Community Bridge Moving Items In GloveBox")
|
||||||
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:CreateInventory('trunk-'..newplate, {label = 'trunk-'..newplate, slots = storedTrunk.slots, maxweight = storedTrunk.maxweight})
|
qbInventory:SetInventory('trunk-'..newplate, storedTrunk.items, "Community Bridge Moving Items In Trunk")
|
||||||
qbInventory:SetInventory('trunk-'..newplate, storedTrunk.items, "Community Bridge Moving Items In Trunk")
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
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
|
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
end
|
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 src number
|
||||||
---@param shopTitle string
|
---@param shopTitle string
|
||||||
Inventory.OpenShop = function(src, shopTitle)
|
Inventory.OpenShop = function(src, shopTitle)
|
||||||
local newVersion = getInventoryNewVersion()
|
if not Inventory.Version then return Inventory.Old.OpenShop(src, shopTitle) end
|
||||||
if newVersion then
|
return qbInventory:OpenShop(src, shopTitle)
|
||||||
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
|
|
||||||
end
|
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 shopTitle string
|
||||||
---@param shopInventory table
|
---@param inventory table
|
||||||
---@param shopCoords table
|
---@param shopCoords table
|
||||||
---@param shopGroups table
|
---@param shopGroups table
|
||||||
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
|
Inventory.RegisterShop = function(shopTitle, inventory, shopCoords, shopGroups)
|
||||||
if not shopTitle or not shopInventory then return end
|
if not shopTitle or not inventory then return end
|
||||||
if registeredShops[shopTitle] then return true end
|
if Inventory.ShopData[shopTitle] then return true end
|
||||||
registeredShops[shopTitle] = true
|
if not Inventory.Version then return Inventory.Old.RegisterShop(shopTitle, inventory, shopCoords, shopGroups) end
|
||||||
local newVersion = getInventoryNewVersion()
|
local repackedShopItems = {}
|
||||||
if newVersion then
|
for _, v in pairs(inventory) do
|
||||||
local repackedShopItems = {}
|
table.insert(repackedShopItems, {name = v.name, price = v.price, amount = v.count or v.amount or 1000})
|
||||||
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, })
|
|
||||||
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
|
end
|
||||||
|
Inventory.ShopData[shopTitle] = { inventory = repackedShopItems, coords = shopCoords, groups = shopGroups }
|
||||||
|
qbInventory:CreateShop({ name = shopTitle, label = shopTitle, coords = shopCoords, items = repackedShopItems, })
|
||||||
end
|
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)
|
Inventory.OpenPlayerInventory = function(src, target)
|
||||||
assert(src, "OpenPlayerInventory: src is required")
|
assert(src, "OpenPlayerInventory: src is required")
|
||||||
if not target then
|
assert(target, "OpenPlayerInventory: target is required")
|
||||||
target = src
|
|
||||||
end
|
|
||||||
exports['qb-inventory']:OpenInventory(src, target)
|
exports['qb-inventory']:OpenInventory(src, target)
|
||||||
end
|
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)
|
||||||
|
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||||
|
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
|
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
|
||||||
|
|
||||||
|
Inventory.Old.AddTrunkItems = function(fullTrunkId, items)
|
||||||
|
TriggerEvent("inventory:server:addTrunkItems", fullTrunkId, items)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
Inventory.Old.AddStashItems = function(id, items)
|
||||||
|
return false, print("AddStashItems is not supported with qb-inventory v1")
|
||||||
|
end
|
||||||
|
|
||||||
|
Inventory.Old.ClearStash = function(id, _type)
|
||||||
|
return false, print("ClearStash is not supported with qb-inventory v1")
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
return Inventory
|
||||||
@@ -1,40 +1,40 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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"]
|
local quasar = exports["qs-inventory"]
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
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.
|
||||||
---@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.
|
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetResourceName = function()
|
Inventory.GetResourceName = function()
|
||||||
return "qs-inventory"
|
return "qs-inventory"
|
||||||
end
|
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
|
---@return table
|
||||||
Inventory.Items = function()
|
Inventory.Items = function()
|
||||||
return quasar:GetItemList()
|
return quasar:GetItemList()
|
||||||
end
|
end
|
||||||
|
|
||||||
---Will return boolean if the player has the item.
|
---@description Will return boolean if the player has the item.
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(item)
|
Inventory.HasItem = function(item)
|
||||||
@@ -42,7 +42,7 @@ Inventory.HasItem = function(item)
|
|||||||
return check and true or false
|
return check and true or false
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return number
|
---@return number
|
||||||
Inventory.GetItemCount = function(item)
|
Inventory.GetItemCount = function(item)
|
||||||
@@ -50,7 +50,7 @@ Inventory.GetItemCount = function(item)
|
|||||||
return searchItem or 0
|
return searchItem or 0
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
@@ -60,7 +60,7 @@ Inventory.GetImagePath = function(item)
|
|||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function()
|
Inventory.GetPlayerInventory = function()
|
||||||
local items = {}
|
local items = {}
|
||||||
@@ -69,10 +69,10 @@ Inventory.GetPlayerInventory = function()
|
|||||||
table.insert(items, {
|
table.insert(items, {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
label = v.label,
|
label = v.label,
|
||||||
count = v.amount,
|
count = v.amount or v.count,
|
||||||
slot = v.slot,
|
slot = v.slot,
|
||||||
metadata = v.info,
|
metadata = v.info or v.metadata or {},
|
||||||
stack = v.unique,
|
stack = v.unique or v.stack or false,
|
||||||
close = v.useable,
|
close = v.useable,
|
||||||
weight = v.weight
|
weight = v.weight
|
||||||
})
|
})
|
||||||
@@ -80,11 +80,4 @@ Inventory.GetPlayerInventory = function()
|
|||||||
return items
|
return items
|
||||||
end
|
end
|
||||||
|
|
||||||
---comment
|
|
||||||
---@param id any
|
|
||||||
---@return nil
|
|
||||||
Inventory.OpenStash = function(id)
|
|
||||||
quasar:RegisterStash(id, 50, 50000)
|
|
||||||
end
|
|
||||||
|
|
||||||
return Inventory
|
return Inventory
|
||||||
@@ -1,12 +1,18 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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']
|
local quasar = exports['qs-inventory']
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
Inventory = Inventory or {}
|
||||||
Inventory.Stashes = Inventory.Stashes 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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
@@ -15,17 +21,13 @@ Inventory.Stashes = Inventory.Stashes or {}
|
|||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.AddItem = function(src, item, count, slot, metadata)
|
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||||
if not quasar:CanCarryItem(src, item, count) then return false end
|
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})
|
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
|
end
|
||||||
|
|
||||||
---This will get the name of the in use resource.
|
---@description This will remove an item, and return true or false based on success
|
||||||
---@return string
|
|
||||||
Inventory.GetResourceName = function()
|
|
||||||
return "qs-inventory"
|
|
||||||
end
|
|
||||||
|
|
||||||
---This will remove an item, and return true or false based on success
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
@@ -33,46 +35,22 @@ end
|
|||||||
---@param metadata table
|
---@param metadata table
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
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})
|
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
|
end
|
||||||
|
|
||||||
---This will add items to a trunk, and return true or false based on success
|
---@description This will clear the specified inventory, will always return true unless a value isnt passed correctly.
|
||||||
---@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.
|
|
||||||
---@param id string
|
---@param id string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.ClearStash = function(id, _type)
|
Inventory.ClearStash = function(id, _type)
|
||||||
if type(id) ~= "string" then return false end
|
if type(id) ~= "string" then return false end
|
||||||
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
|
|
||||||
return false
|
|
||||||
--[[
|
|
||||||
quasar:ClearOtherInventory(_type, id)
|
quasar:ClearOtherInventory(_type, id)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
--]]
|
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -90,24 +68,23 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the entire items table from the inventory.
|
---@description This will return the entire items table from the inventory.
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.Items = function()
|
Inventory.Items = function()
|
||||||
return quasar:GetItemList()
|
return quasar:GetItemList()
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the count of the item in the players inventory, if not found will return 0.
|
---@description 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.
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param metadata table
|
---@param metadata table
|
||||||
---@return number
|
---@return number
|
||||||
Inventory.GetItemCount = function(src, item, metadata)
|
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
|
end
|
||||||
|
|
||||||
---This wil return the players inventory.
|
---@description This wil return the players inventory.
|
||||||
---@param src number
|
---@param src number
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function(src)
|
Inventory.GetPlayerInventory = function(src)
|
||||||
@@ -116,20 +93,18 @@ Inventory.GetPlayerInventory = function(src)
|
|||||||
for _, v in pairs(playerItems) do
|
for _, v in pairs(playerItems) do
|
||||||
table.insert(repackedTable, {
|
table.insert(repackedTable, {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
count = v.amount,
|
count = v.amount or v.count,
|
||||||
metadata = v.info,
|
metadata = v.info or v.metadata or {},
|
||||||
slot = v.slot,
|
slot = v.slot,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
return repackedTable
|
return repackedTable
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the specified slot data as a table.
|
---@description Returns the specified slot data as a table.
|
||||||
---
|
|
||||||
---format {weight, name, metadata, slot, label, count}
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param slot number
|
---@param slot number
|
||||||
---@return table
|
---@return table {weight, name, metadata, slot, label, count}
|
||||||
Inventory.GetItemBySlot = function(src, slot)
|
Inventory.GetItemBySlot = function(src, slot)
|
||||||
local playerItems = quasar:GetInventory(src)
|
local playerItems = quasar:GetInventory(src)
|
||||||
for _, item in pairs(playerItems) do
|
for _, item in pairs(playerItems) do
|
||||||
@@ -139,9 +114,9 @@ Inventory.GetItemBySlot = function(src, slot)
|
|||||||
label = item.label,
|
label = item.label,
|
||||||
weight = item.weight,
|
weight = item.weight,
|
||||||
slot = slot,
|
slot = slot,
|
||||||
count = item.amount,
|
count = item.amount or item.count,
|
||||||
metadata = item.info,
|
metadata = item.info or item.metadata or {},
|
||||||
stack = item.unique or false,
|
stack = item.unique or item.stack or false,
|
||||||
description = item.description
|
description = item.description
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -149,7 +124,7 @@ Inventory.GetItemBySlot = function(src, slot)
|
|||||||
return {}
|
return {}
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param slot number
|
---@param slot number
|
||||||
@@ -159,62 +134,40 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
|
|||||||
return quasar:SetItemMetadata(src, slot, metadata)
|
return quasar:SetItemMetadata(src, slot, metadata)
|
||||||
end
|
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 src number
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param id number||string
|
---@param id number||string
|
||||||
---@return nil
|
---@return nil
|
||||||
Inventory.OpenStash = function(src, _type, id)
|
Inventory.OpenStash = function(src, _type, id)
|
||||||
_type = _type or "stash"
|
_type = _type or "stash"
|
||||||
|
if not Inventory.Stashes[id] then return end
|
||||||
local tbl = Inventory.Stashes[id]
|
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)
|
TriggerClientEvent("inventory:client:SetCurrentStash",src, id)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will register a stash
|
---@description This will return a boolean if the player has the item.
|
||||||
---@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.
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(src, item)
|
Inventory.HasItem = function(src, item, requiredCount)
|
||||||
local count = quasar:GetItemTotalAmount(src, item)
|
local count = quasar:GetItemTotalAmount(src, item)
|
||||||
if not count then return false end
|
if not count then return false end
|
||||||
return count > 0
|
return count >= (requiredCount or 1)
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.CanCarryItem = function(src, item, count)
|
Inventory.CanCarryItem = function(src, item, count)
|
||||||
return quasar:CanCarryItem(src, item, count)
|
return quasar:CanCarryItem(src, item, count) or false
|
||||||
end
|
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 oldplate string
|
||||||
---@param newplate string
|
---@param newplate string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
@@ -229,7 +182,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
|||||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
@@ -239,12 +192,4 @@ Inventory.GetImagePath = function(item)
|
|||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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
|
return Inventory
|
||||||
@@ -1,10 +1,17 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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"]
|
local tgiann = exports["tgiann-inventory"]
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
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
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -21,20 +28,15 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get the name of the in use resource.
|
---@description Will return boolean if the player has the item.
|
||||||
---@return string
|
|
||||||
Inventory.GetResourceName = function()
|
|
||||||
return "tgiann-inventory"
|
|
||||||
end
|
|
||||||
|
|
||||||
---Will return boolean if the player has the item.
|
|
||||||
---@param item string
|
---@param item string
|
||||||
|
---@param requiredCount number (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.HasItem = function(item)
|
Inventory.HasItem = function(item, requiredCount)
|
||||||
return tgiann:HasItem(item)
|
return tgiann:HasItem(item, requiredCount)
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return number
|
---@return number
|
||||||
Inventory.GetItemCount = function(item)
|
Inventory.GetItemCount = function(item)
|
||||||
@@ -42,7 +44,7 @@ Inventory.GetItemCount = function(item)
|
|||||||
return searchItem or 0
|
return searchItem or 0
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
@@ -54,7 +56,7 @@ Inventory.GetImagePath = function(item)
|
|||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function()
|
Inventory.GetPlayerInventory = function()
|
||||||
local items = {}
|
local items = {}
|
||||||
@@ -74,10 +76,4 @@ Inventory.GetPlayerInventory = function()
|
|||||||
return items
|
return items
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param id any
|
|
||||||
---@return nil
|
|
||||||
Inventory.OpenStash = function(id)
|
|
||||||
tgiann:OpenInventory('stash', id, { maxweight = 400000, slots = 100 })
|
|
||||||
end
|
|
||||||
|
|
||||||
return Inventory
|
return Inventory
|
||||||
@@ -1,43 +1,46 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@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"]
|
local tgiann = exports["tgiann-inventory"]
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
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.
|
||||||
---@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.
|
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetResourceName = function()
|
Inventory.GetResourceName = function()
|
||||||
return "tgiann-inventory"
|
return "tgiann-inventory"
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
---@param slot number
|
---@param slot number (optional)
|
||||||
---@param metadata table
|
---@param metadata table (optional)
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.RemoveItem = function(src, item, count, slot, metadata)
|
Inventory.AddItem = function(src, item, count, slot, metadata)
|
||||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
|
if not tgiann:CanCarryItem(src, item, count) then return false end
|
||||||
return tgiann:RemoveItem(src, item, count, slot, metadata)
|
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
|
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
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemInfo = function(item)
|
Inventory.GetItemInfo = function(item)
|
||||||
@@ -53,25 +56,23 @@ Inventory.GetItemInfo = function(item)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the entire items table from the inventory.
|
---@description This will return the entire items table from the inventory.
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.Items = function()
|
Inventory.Items = function()
|
||||||
return tgiann:GetItemList()
|
return tgiann:GetItemList()
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return the count of the item in the players inventory, if not found will return 0.
|
---@description 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.
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param metadata table
|
---@param metadata table (optional)
|
||||||
---@return number
|
---@return number
|
||||||
Inventory.GetItemCount = function(src, item, metadata)
|
Inventory.GetItemCount = function(src, item, metadata)
|
||||||
local _item = tgiann:GetItemByName(src, item, metadata)
|
local _item = tgiann:GetItemByName(src, item, metadata)
|
||||||
return _item.amount or 0
|
return _item.amount or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
---This wil return the players inventory.
|
---@description This will return the players inventory.
|
||||||
---@param src number
|
---@param src number
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function(src)
|
Inventory.GetPlayerInventory = function(src)
|
||||||
@@ -85,12 +86,10 @@ Inventory.GetPlayerInventory = function(src)
|
|||||||
return items
|
return items
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the specified slot data as a table.
|
---@description Returns the specified slot data as a table.
|
||||||
---
|
|
||||||
---format {weight, name, metadata, slot, label, count}
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param slot number
|
---@param slot number
|
||||||
---@return table
|
---@return table {weight, name, metadata, slot, label, count}
|
||||||
Inventory.GetItemBySlot = function(src, slot)
|
Inventory.GetItemBySlot = function(src, slot)
|
||||||
local item = tgiann:GetItemBySlot(src, slot)
|
local item = tgiann:GetItemBySlot(src, slot)
|
||||||
if not item then return {} end
|
if not item then return {} end
|
||||||
@@ -99,14 +98,14 @@ Inventory.GetItemBySlot = function(src, slot)
|
|||||||
label = item.label,
|
label = item.label,
|
||||||
weight = item.weight,
|
weight = item.weight,
|
||||||
slot = slot,
|
slot = slot,
|
||||||
count = item.amount,
|
count = item.amount or item.count,
|
||||||
metadata = item.info,
|
metadata = item.info or item.metadata or {},
|
||||||
stack = item.unique or false,
|
stack = item.unique or item.stack or false,
|
||||||
description = item.description
|
description = item.description
|
||||||
}
|
}
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param slot number
|
---@param slot number
|
||||||
@@ -116,42 +115,18 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
|
|||||||
tgiann:UpdateItemMetadata(src, item, slot, metadata)
|
tgiann:UpdateItemMetadata(src, item, slot, metadata)
|
||||||
end
|
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 src number
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param id number||string
|
---@param id number||string
|
||||||
---@return nil
|
---@return nil
|
||||||
Inventory.OpenStash = function(src, _type, id)
|
Inventory.OpenStash = function(src, _type, id)
|
||||||
_type = _type or "stash"
|
_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})
|
return tgiann:ForceOpenInventory(src, _type, id, tbl and { maxWeight = tbl.weight , slots = tbl.slot, label = tbl.label})
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will register a stash
|
---@description This will return a boolean if the player has the item.
|
||||||
---@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.
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
@@ -159,7 +134,7 @@ Inventory.HasItem = function(src, item)
|
|||||||
return tgiann:HasItem(src, item, 1)
|
return tgiann:HasItem(src, item, 1)
|
||||||
end
|
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 src number
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param count number
|
---@param count number
|
||||||
@@ -168,7 +143,7 @@ Inventory.CanCarryItem = function(src, item, count)
|
|||||||
return tgiann:CanCarryItem(src, item, count)
|
return tgiann:CanCarryItem(src, item, count)
|
||||||
end
|
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 oldplate string
|
||||||
---@param newplate string
|
---@param newplate string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
@@ -184,7 +159,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
|||||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
end
|
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 identifier string
|
||||||
---@param items table
|
---@param items table
|
||||||
---@return boolean
|
---@return boolean
|
||||||
@@ -197,7 +172,7 @@ Inventory.AddTrunkItems = function(identifier, items)
|
|||||||
return true
|
return true
|
||||||
end
|
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 id string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.ClearStash = function(id, _type)
|
Inventory.ClearStash = function(id, _type)
|
||||||
@@ -207,7 +182,7 @@ Inventory.ClearStash = function(id, _type)
|
|||||||
return true
|
return true
|
||||||
end
|
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
|
---@param item string
|
||||||
---@return string
|
---@return string
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
@@ -219,30 +194,13 @@ Inventory.GetImagePath = function(item)
|
|||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
end
|
||||||
|
|
||||||
---UNUSED:
|
---@description This will open a players inventory, used for admin purposes and stuff.
|
||||||
---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 }
|
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param item string
|
---@param target number
|
||||||
---@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
|
|
||||||
|
|
||||||
Inventory.OpenPlayerInventory = function(src, target)
|
Inventory.OpenPlayerInventory = function(src, target)
|
||||||
assert(src, "OpenPlayerInventory: src is required")
|
assert(src, "OpenPlayerInventory: src is required")
|
||||||
if not target then
|
assert(target, "OpenPlayerInventory: target is required")
|
||||||
target = src
|
tgiann:OpenInventoryById(src, target)
|
||||||
end
|
|
||||||
exports['tgiann-inventory']:OpenInventoryById(src, target)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return Inventory
|
return Inventory
|
||||||
@@ -25,14 +25,14 @@ function Language.Locale(str, ...)
|
|||||||
|
|
||||||
-- Handle nested tables via dot notation
|
-- Handle nested tables via dot notation
|
||||||
local current = locales
|
local current = locales
|
||||||
for part in str:gmatch("[^%.]+") do
|
for part in str:gmatch("([^%.]+)") do
|
||||||
if type(current) ~= "table" then
|
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
|
return str
|
||||||
end
|
end
|
||||||
current = current[part]
|
current = current[part]
|
||||||
if not current then
|
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
|
return str
|
||||||
end
|
end
|
||||||
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"
|
return "default"
|
||||||
end
|
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 message string
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param time number
|
---@param time number
|
||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
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
|
time = time or 3000
|
||||||
return Framework.Notify(message, nil, time)
|
return Framework.Notify(message, nil, time)
|
||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent('community_bridge:Client:Notify', function(message, _type, time)
|
RegisterNetEvent('community_bridge:Client:Notify', function(title, message, _type, time, props)
|
||||||
Notify.SendNotify(message, _type, time)
|
Notify.SendNotification(title, message, _type, time, props)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
---------[[Depricated Stuff Below, please adjust to the HelpText module instead]]--------
|
---------[[Depricated Stuff Below, please adjust to the HelpText module instead]]--------
|
||||||
|
|||||||
@@ -1,17 +1,35 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
Notify = Notify or {}
|
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 src number
|
||||||
---@param message string
|
---@param message string
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@return nil
|
||||||
Notify.SendNotify = function(src, message, _type, time)
|
Notify.SendNotify = function(src, message, _type, time)
|
||||||
TriggerClientEvent('community_bridge:Client:Notify', src, message, _type, time)
|
Notify.SendNotification(src, nil, message, _type, time)
|
||||||
end
|
end
|
||||||
|
|
||||||
Notify.GetResourceName = function()
|
---This will send a notify message of the type and time passed
|
||||||
return "default"
|
---@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
|
end
|
||||||
|
|
||||||
---------[[Depricated Stuff Below, please adjust to the HelpText module instead]]--------
|
---------[[Depricated Stuff Below, please adjust to the HelpText module instead]]--------
|
||||||
|
|||||||
@@ -10,13 +10,16 @@ Notify.GetResourceName = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
---This will send a notify message of the type and time passed
|
---This will send a notify message of the type and time passed
|
||||||
|
---@param title string
|
||||||
---@param message string
|
---@param message string
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@props table optional
|
||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotification = function(title, message, _type, time, props)
|
||||||
time = time or 3000
|
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
|
end
|
||||||
|
|
||||||
return Notify
|
return Notify
|
||||||
@@ -4,18 +4,20 @@ local resourceName = "FL-Notify"
|
|||||||
local configValue = BridgeSharedConfig.Notify
|
local configValue = BridgeSharedConfig.Notify
|
||||||
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||||
|
|
||||||
|
|
||||||
Notify.GetResourceName = function()
|
Notify.GetResourceName = function()
|
||||||
return resourceName
|
return resourceName
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will send a notify message of the type and time passed
|
---This will send a notify message of the type and time passed
|
||||||
|
---@param title string
|
||||||
---@param message string
|
---@param message string
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@props table optional
|
||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotification = function(title, message, _type, time, props)
|
||||||
time = time or 3000
|
time = time or 3000
|
||||||
|
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||||
if _type == "error" or _type == "info" then
|
if _type == "error" or _type == "info" then
|
||||||
_type = tostring(1)
|
_type = tostring(1)
|
||||||
elseif _type == "success" then
|
elseif _type == "success" then
|
||||||
|
|||||||
@@ -10,13 +10,16 @@ Notify.GetResourceName = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
---This will send a notify message of the type and time passed
|
---This will send a notify message of the type and time passed
|
||||||
|
---@param title string
|
||||||
---@param message string
|
---@param message string
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@props table optional
|
||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotification = function(title, message, _type, time, props)
|
||||||
time = time or 3000
|
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
|
end
|
||||||
|
|
||||||
return Notify
|
return Notify
|
||||||
@@ -9,12 +9,15 @@ Notify.GetResourceName = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
---This will send a notify message of the type and time passed
|
---This will send a notify message of the type and time passed
|
||||||
|
---@param title string
|
||||||
---@param message string
|
---@param message string
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@props table optional
|
||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotification = function(title, message, _type, time, props)
|
||||||
time = time or 3000
|
time = time or 3000
|
||||||
|
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||||
_type = _type or "inform"
|
_type = _type or "inform"
|
||||||
return exports['mythic_notify']:SendAlert(_type, message, time)
|
return exports['mythic_notify']:SendAlert(_type, message, time)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,13 +9,16 @@ Notify.GetResourceName = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
---This will send a notify message of the type and time passed
|
---This will send a notify message of the type and time passed
|
||||||
|
---@param title string
|
||||||
---@param message string
|
---@param message string
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@props table optional
|
||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotification = function(title, message, _type, time, props)
|
||||||
time = time or 3000
|
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
|
end
|
||||||
|
|
||||||
return Notify
|
return Notify
|
||||||
@@ -4,19 +4,21 @@ local resourceName = "ox_lib"
|
|||||||
local configValue = BridgeSharedConfig.Notify
|
local configValue = BridgeSharedConfig.Notify
|
||||||
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||||
|
|
||||||
|
|
||||||
Notify.GetResourceName = function()
|
Notify.GetResourceName = function()
|
||||||
return resourceName
|
return resourceName
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will send a notify message of the type and time passed
|
---This will send a notify message of the type and time passed
|
||||||
|
---@param title string
|
||||||
---@param message string
|
---@param message string
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@props table optional
|
||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotification = function(title, message, _type, time, props)
|
||||||
time = time or 3000
|
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
|
end
|
||||||
|
|
||||||
return Notify
|
return Notify
|
||||||
@@ -9,13 +9,16 @@ Notify.GetResourceName = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
---This will send a notify message of the type and time passed
|
---This will send a notify message of the type and time passed
|
||||||
|
---@param title string
|
||||||
---@param message string
|
---@param message string
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@props table optional
|
||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotification = function(title, message, _type, time, props)
|
||||||
time = time or 3000
|
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
|
end
|
||||||
|
|
||||||
return Notify
|
return Notify
|
||||||
@@ -9,13 +9,16 @@ Notify.GetResourceName = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
---This will send a notify message of the type and time passed
|
---This will send a notify message of the type and time passed
|
||||||
|
---@param title string
|
||||||
---@param message string
|
---@param message string
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@props table optional
|
||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotification = function(title, message, _type, time, props)
|
||||||
time = time or 3000
|
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
|
end
|
||||||
|
|
||||||
return Notify
|
return Notify
|
||||||
@@ -9,14 +9,17 @@ Notify.GetResourceName = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
---This will send a notify message of the type and time passed
|
---This will send a notify message of the type and time passed
|
||||||
|
---@param title string
|
||||||
---@param message string
|
---@param message string
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@props table optional
|
||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotification = function(title, message, _type, time, props)
|
||||||
time = time or 3000
|
time = time or 3000
|
||||||
|
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||||
_type = _type or "info"
|
_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
|
end
|
||||||
|
|
||||||
return Notify
|
return Notify
|
||||||
@@ -9,12 +9,15 @@ Notify.GetResourceName = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
---This will send a notify message of the type and time passed
|
---This will send a notify message of the type and time passed
|
||||||
|
---@param title string
|
||||||
---@param message string
|
---@param message string
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param time number
|
---@param time number
|
||||||
|
---@props table optional
|
||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotification = function(title, message, _type, time, props)
|
||||||
time = time or 3000
|
time = time or 3000
|
||||||
|
if not title then title = Bridge.Language.Locale("Notifications.PlaceholderTitle") end
|
||||||
_type = _type or "info"
|
_type = _type or "info"
|
||||||
return exports.wasabi_notify:notify(_type, message, time, _type)
|
return exports.wasabi_notify:notify(_type, message, time, _type)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ end
|
|||||||
---@param message string
|
---@param message string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Phone.SendEmail = function(email, title, message)
|
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
|
end
|
||||||
|
|
||||||
return Phone
|
return Phone
|
||||||
@@ -15,7 +15,7 @@ end
|
|||||||
---@param src number
|
---@param src number
|
||||||
---@return number|boolean
|
---@return number|boolean
|
||||||
Phone.GetPlayerPhone = function(src)
|
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
|
end
|
||||||
|
|
||||||
---This will send an email to the passed source, email address, title and message.
|
---This will send an email to the passed source, email address, title and message.
|
||||||
@@ -25,7 +25,7 @@ end
|
|||||||
---@param message string
|
---@param message string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Phone.SendEmail = function(src, email, title, message)
|
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
|
end
|
||||||
|
|
||||||
return Phone
|
return Phone
|
||||||
@@ -28,21 +28,20 @@ end
|
|||||||
---@return boolean
|
---@return boolean
|
||||||
Phone.SendEmail = function(src, email, title, message)
|
Phone.SendEmail = function(src, email, title, message)
|
||||||
local numberNumber = exports["lb-phone"]:GetEquippedPhoneNumber(src)
|
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)
|
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({
|
local success, id = exports["lb-phone"]:SendMail({
|
||||||
to = playerEmail,
|
to = playerEmail,
|
||||||
sender = email,
|
sender = email,
|
||||||
subject = title,
|
subject = title,
|
||||||
message = message,
|
message = message,
|
||||||
})
|
})
|
||||||
return success
|
return success or false
|
||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent('community_bridge:Server:genericEmail', function(data)
|
RegisterNetEvent('community_bridge:Server:genericEmail', function(data)
|
||||||
local src = source
|
local src = source
|
||||||
Prints.Debug('community_bridge:Server:genericEmail Hit')
|
|
||||||
return Phone.SendEmail(src, data.email, data.title, data.message)
|
return Phone.SendEmail(src, data.email, data.title, data.message)
|
||||||
end)
|
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
|
end
|
||||||
|
|
||||||
ProgressBar.GetResourceName = function()
|
ProgressBar.GetResourceName = function()
|
||||||
return "ox_lib"
|
return resourceName
|
||||||
end
|
end
|
||||||
|
|
||||||
return ProgressBar
|
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
|
---@diagnostic disable: duplicate-set-field
|
||||||
Shops = Shops or {}
|
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 source ~= 65535 then return end
|
||||||
if not _title and not _title and not shopData then return end
|
if not shopType or not shopLabel or not shopData then return end
|
||||||
if _type ~= 'shop' then return end
|
if shopType ~= 'shop' then return end
|
||||||
Shops.OpenShop(_title, shopData.inventory)
|
Shops.OpenShop(shopLabel, shopData.inventory)
|
||||||
end)
|
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)
|
Shops.FinalizeCheckOut = function(shopName, item, itemLabel, price, amount)
|
||||||
if not shopName and not item and not itemLabel and not price then return end
|
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 generatedID = Ids.CreateUniqueId()
|
||||||
local buildMenu = {
|
local buildMenu = {
|
||||||
{
|
{
|
||||||
title = string.format(locale('Shops.PayByCash'), tostring(mathStuff)),
|
title = locale('Shops.PayByCash', tostring(mathStuff)),
|
||||||
description = string.format(locale('Shops.AreYouSure'), itemLabel),
|
description = locale('Shops.AreYouSure', itemLabel),
|
||||||
icon = locale('Shops.CashIcon'),
|
icon = locale('Shops.CashIcon'),
|
||||||
onSelect = function(_, __, ___)
|
onSelect = function(_, __, ___)
|
||||||
TriggerServerEvent('community_bridge:completeCheckout', shopName, item, amount, "money")
|
TriggerServerEvent('community_bridge:Server:completeCheckout', shopName, item, amount, "money")
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title = string.format(locale('Shops.PayByCard'), tostring(mathStuff)),
|
title = locale('Shops.PayByCard', tostring(mathStuff)),
|
||||||
description = string.format(locale('Shops.AreYouSure'), itemLabel),
|
description = locale('Shops.AreYouSure', itemLabel),
|
||||||
icon = locale('Shops.CardIcon'),
|
icon = locale('Shops.CardIcon'),
|
||||||
onSelect = function(_, __, ___)
|
onSelect = function(_, __, ___)
|
||||||
TriggerServerEvent('community_bridge:completeCheckout', shopName, item, amount, "bank")
|
TriggerServerEvent('community_bridge:Server:completeCheckout', shopName, item, amount, "bank")
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Menu.Open({ id = generatedID, title = locale("Shops.Input"), options = buildMenu }, false)
|
Menu.Open({ id = generatedID, title = locale("Shops.Input"), options = buildMenu }, false)
|
||||||
end
|
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 shopName string
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param itemLabel string
|
---@param itemLabel string
|
||||||
---@param price number
|
---@param price number
|
||||||
Shops.AmountSelect = function(shopName, item, itemLabel, price)
|
Shops.AmountSelect = function(shopName, item, itemLabel, price)
|
||||||
if not shopName and not item and not itemLabel and not price then return end
|
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 = {}
|
local numberOptions = {}
|
||||||
for i = 1, 100 do
|
for i = 1, 100 do
|
||||||
table.insert(numberOptions, {label = tostring(i), value = i})
|
table.insert(numberOptions, {label = tostring(i), value = i})
|
||||||
@@ -54,28 +65,27 @@ Shops.AmountSelect = function(shopName, item, itemLabel, price)
|
|||||||
end
|
end
|
||||||
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.
|
---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 shopName string
|
||||||
---@param shopData any
|
---@param shopData table
|
||||||
---@return nil
|
---@return nil
|
||||||
Shops.OpenShop = function(title, shopData)
|
Shops.OpenShop = function(shopName, shopData)
|
||||||
if not title and not shopData and not title then return Prints.Error("No Title Passed") end
|
if not shopName and not shopData then return print("^6 No Shop Name or Shop Data Passed ^0") end
|
||||||
local generatedID = Ids.CreateUniqueId()
|
local generatedID = Ids.CreateUniqueId()
|
||||||
local buildMenu = {}
|
local buildMenu = {}
|
||||||
for _, v in pairs(shopData) do
|
for _, v in pairs(shopData) do
|
||||||
local getItemName = Inventory.GetItemInfo(v.name).label
|
local getItemName = Inventory.GetItemInfo(v.name).label
|
||||||
table.insert(buildMenu, {
|
table.insert(buildMenu, {
|
||||||
title = getItemName,
|
title = getItemName,
|
||||||
description = string.format(locale('Shops.CurrencySymbol'), tostring(v.price)),
|
description = locale('Shops.CurrencySymbol', tostring(v.price)),
|
||||||
icon = locale('Shops.ShopIcon'),
|
icon = locale('Shops.ShopIcon'),
|
||||||
onSelect = function(selected, secondary, args)
|
onSelect = function(selected, secondary, args)
|
||||||
Shops.AmountSelect(title, v.name, getItemName, v.price)
|
Shops.AmountSelect(shopName, v.name, getItemName, v.price)
|
||||||
--Shops.FinalizeCheckOut(title, v.name, getItemName, v.price)
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
Menu.Open({ id = generatedID, title = title, options = buildMenu }, false)
|
Menu.Open({ id = generatedID, title = shopName, options = buildMenu }, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Shops
|
return Shops
|
||||||
@@ -3,41 +3,46 @@ Shops = Shops or {}
|
|||||||
|
|
||||||
local registeredShops = {}
|
local registeredShops = {}
|
||||||
|
|
||||||
|
local Language = Language or Require("modules/locales/shared.lua")
|
||||||
|
local locales = Language.Locale
|
||||||
|
|
||||||
---This can open a shop for the client
|
---This can open a shop for the client
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param shopTitle string
|
---@param shopName string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Shops.OpenShop = function(src, shopTitle)
|
Shops.OpenShop = function(src, shopName)
|
||||||
if not shopTitle and not registeredShops[shopTitle] then return false end
|
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:openShop', src, 'shop', shopTitle, registeredShops[shopTitle])
|
TriggerClientEvent('community_bridge:Client:openShop', src, 'shop', shopName, registeredShops[shopName])
|
||||||
return true
|
return true
|
||||||
end
|
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.
|
---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 shopInventory table
|
||||||
---@param shopCoords table
|
---@param shopCoords table
|
||||||
---@param shopGroups table
|
---@param shopGroups table
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Shops.CreateShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
|
Shops.CreateShop = function(shopName, shopInventory, shopCoords, shopGroups)
|
||||||
if not shopTitle and not shopInventory and not shopCoords then return false end
|
if not shopName and not shopInventory and not shopCoords then return false end
|
||||||
if registeredShops[shopTitle] then return true end
|
if registeredShops[shopName] then return true end
|
||||||
registeredShops[shopTitle] = {name = shopTitle, inventory = shopInventory, shopCoords = shopCoords, groups = shopGroups}
|
registeredShops[shopName] = {name = shopName, inventory = shopInventory, shopCoords = shopCoords, groups = shopGroups}
|
||||||
return true
|
return true
|
||||||
end
|
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 src number
|
||||||
---@param shopName string
|
---@param shopName string
|
||||||
---@param item string
|
---@param item string
|
||||||
---@param amount number
|
---@param amount number
|
||||||
---@param paymentType string
|
---@param account string
|
||||||
---@return nil
|
---@return nil
|
||||||
Shops.CompleteCheckout = function(src, shopName, item, amount, paymentType)
|
Shops.CompleteCheckout = function(src, shopName, item, amount, account)
|
||||||
if not src and not shopName and not item and not amount and not paymentType then return end
|
if not src or not shopName or not item or not amount or not account then return end
|
||||||
local ilocale = Language.Locale
|
if not amount or amount <= 0 then return end
|
||||||
|
|
||||||
local shopData = registeredShops[shopName]
|
local shopData = registeredShops[shopName]
|
||||||
if not shopData then return end
|
if not shopData then return end
|
||||||
|
|
||||||
local itemData = nil
|
local itemData = nil
|
||||||
for _, data in pairs(shopData.inventory) do
|
for _, data in pairs(shopData.inventory) do
|
||||||
if data.name == item then
|
if data.name == item then
|
||||||
@@ -45,22 +50,38 @@ Shops.CompleteCheckout = function(src, shopName, item, amount, paymentType)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
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 or not itemData.price then return print("community_bridge Player ID "..src.." attempted to purchase invalid item from shop: "..shopName) end
|
||||||
if not itemData.price then return end
|
if itemData.count and itemData.count <= 0 then return Notify.SendNotify(src, locales('Shops.NotEnoughStock'), "error", 5000) end
|
||||||
local balance = Framework.GetAccountBalance(src, paymentType)
|
local totalCost = tonumber(itemData.price) * amount
|
||||||
local mathStuff = tonumber(itemData.price) * tonumber(amount)
|
local balance = Framework.GetAccountBalance(src, account)
|
||||||
if balance < mathStuff then return Notify.SendNotify(src, ilocale('Shops.NotEnoughMoney'), "error", 5000) end
|
if not balance then return end
|
||||||
if not Framework.RemoveAccountBalance(src, paymentType, mathStuff) then return end
|
if balance <= 0 then return Notify.SendNotify(src, locales('Shops.NotEnoughMoney'), "error", 5000) end
|
||||||
Inventory.AddItem(src, itemData.name, tonumber(amount))
|
if balance < totalCost then return Notify.SendNotify(src, locales('Shops.NotEnoughMoney'), "error", 5000) end
|
||||||
local itemLabel = Inventory.GetItemInfo(itemData.name).label
|
|
||||||
Notify.SendNotify(src, ilocale('Shops.PurchasedItem')..itemLabel, "success", 5000)
|
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
|
||||||
|
|
||||||
|
local itemLabel = Inventory.GetItemInfo(itemData.name).label or itemData.name
|
||||||
|
Notify.SendNotify(src, locales('Shops.PurchasedItem', itemLabel), "success", 5000)
|
||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent("community_bridge:completeCheckout", function(shopName, item, amount, paymentType)
|
---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
|
local src = source
|
||||||
if not shopName and not item and not paymentType then return end
|
if not shopName or not item or not account or not amount then return end
|
||||||
if not paymentType == "money" or not paymentType == "bank" then return end
|
if account ~= "money" and account ~= "bank" then return end
|
||||||
Shops.CompleteCheckout(src, shopName, item, amount, paymentType)
|
amount = tonumber(amount)
|
||||||
|
if not amount or amount <= 0 then return end
|
||||||
|
Shops.CompleteCheckout(src, shopName, item, amount, account)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return Shops
|
return Shops
|
||||||
@@ -11,7 +11,7 @@ VehicleKey = VehicleKey or {}
|
|||||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||||
assert(vehicle, "vehicle is nil")
|
assert(vehicle, "vehicle is nil")
|
||||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||||
|
|
||||||
if not plate then
|
if not plate then
|
||||||
plate = GetVehicleNumberPlateText(vehicle)
|
plate = GetVehicleNumberPlateText(vehicle)
|
||||||
end
|
end
|
||||||
@@ -26,11 +26,11 @@ end
|
|||||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||||
assert(vehicle, "vehicle is nil")
|
assert(vehicle, "vehicle is nil")
|
||||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||||
|
|
||||||
if not plate then
|
if not plate then
|
||||||
plate = GetVehicleNumberPlateText(vehicle)
|
plate = GetVehicleNumberPlateText(vehicle)
|
||||||
end
|
end
|
||||||
|
|
||||||
return exports.MrNewbVehicleKeys:RemoveKeysByPlate(plate)
|
return exports.MrNewbVehicleKeys:RemoveKeysByPlate(plate)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -38,4 +38,4 @@ VehicleKey.GetResourceName = function()
|
|||||||
return resourceName
|
return resourceName
|
||||||
end
|
end
|
||||||
|
|
||||||
return VehicleKey
|
return VehicleKey
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
BridgeClientConfig = {}
|
BridgeClientConfig = {}
|
||||||
BridgeClientConfig.InputSystem = "auto" -- [ auto | ox_lib | lation_ui | qb-input ]
|
BridgeClientConfig.InputSystem = "auto" -- [ auto | ox_lib | lation_ui | qb-input ]
|
||||||
BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | lation_ui | qb-menu ]
|
BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | qb-menu ]
|
||||||
BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | lation_ui | progressbar ]
|
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.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.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
|
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