From 9dc050cb2458e4e1b780b945851d056c08745ae2 Mon Sep 17 00:00:00 2001 From: Nordi98 Date: Sun, 27 Jul 2025 06:15:46 +0200 Subject: [PATCH] ed --- .../[inventory]/tgiann-weapons-on-back/.fxap | Bin 0 -> 178 bytes .../tgiann-weapons-on-back/checkInv.lua | 28 +++ .../client/bridge/codem_inv.lua | 89 ++++++++ .../client/bridge/core_inv.lua | 116 ++++++++++ .../client/bridge/esx_inv.lua | 88 ++++++++ .../client/bridge/main.lua | 99 +++++++++ .../client/bridge/mf_inv.lua | 77 +++++++ .../client/bridge/origen_inv.lua | 79 +++++++ .../client/bridge/ox_inv.lua | 64 ++++++ .../client/bridge/qb_inv.lua | 64 ++++++ .../client/bridge/qs_inv.lua | 89 ++++++++ .../client/bridge/tgiann_inv.lua | 62 ++++++ .../tgiann-weapons-on-back/client/client.lua | Bin 0 -> 6569 bytes .../client/editable.lua | 12 + .../tgiann-weapons-on-back/configs/config.lua | 206 ++++++++++++++++++ .../configs/core_inv_config.lua | 5 + .../tgiann-weapons-on-back/fxmanifest.lua | 34 +++ .../server/bridge/core_inv.lua | 13 ++ .../server/bridge/esx_inv.lua | 10 + .../tgiann-weapons-on-back/server/server.lua | Bin 0 -> 1954 bytes 20 files changed, 1135 insertions(+) create mode 100644 resources/[inventory]/tgiann-weapons-on-back/.fxap create mode 100644 resources/[inventory]/tgiann-weapons-on-back/checkInv.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/client/bridge/codem_inv.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/client/bridge/core_inv.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/client/bridge/esx_inv.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/client/bridge/main.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/client/bridge/mf_inv.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/client/bridge/origen_inv.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/client/bridge/ox_inv.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/client/bridge/qb_inv.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/client/bridge/qs_inv.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/client/bridge/tgiann_inv.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/client/client.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/client/editable.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/configs/config.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/configs/core_inv_config.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/fxmanifest.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/server/bridge/core_inv.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/server/bridge/esx_inv.lua create mode 100644 resources/[inventory]/tgiann-weapons-on-back/server/server.lua diff --git a/resources/[inventory]/tgiann-weapons-on-back/.fxap b/resources/[inventory]/tgiann-weapons-on-back/.fxap new file mode 100644 index 0000000000000000000000000000000000000000..f01780bd685b90fca0525a253e377028642c2db6 GIT binary patch literal 178 zcmV;j08Rf!SV2$$000000LKl5+$8u-e)qbG5^XV$dN^^Dvf32#H=*~aP2xFc#sJQ) z%iHa7K`xZQL(KW#rN=$LC*Nhs(hvC~yzg;71;Di`Z@2nIg!(8j%UGL0oW?(k3>15x zAQWH0C!ERw_MKjQ{`u literal 0 HcmV?d00001 diff --git a/resources/[inventory]/tgiann-weapons-on-back/checkInv.lua b/resources/[inventory]/tgiann-weapons-on-back/checkInv.lua new file mode 100644 index 000000000..c7a602bab --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/checkInv.lua @@ -0,0 +1,28 @@ +config.useDefaultInventory = true + +local function log(msg) + print(string.format('\x1b[32m[tgiann-weapons-on-back]\x1b[0m %s', msg)) +end + +-- Chezza Studios inventory works fine with normal esx(don't add to the list) +local inventorys = { + "tgiann-inventory", + "mf-inventory", + "ox_inventory", + "core_inventory", + "qs-inventory", + "codem-inventory", + "origen_inventory" +} + +for i = 1, #inventorys do + local inventory = inventorys[i] + local isStarted = GetResourceState(inventory) == "started" + if isStarted then + config[inventory] = true + config.useDefaultInventory = false + log(string.format("Started with %s inventory", inventory)) + end +end + +if config.useDefaultInventory then log(string.format("Started with %s default inventory", config.framework == "qb" and "QB" or "ESX")) end diff --git a/resources/[inventory]/tgiann-weapons-on-back/client/bridge/codem_inv.lua b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/codem_inv.lua new file mode 100644 index 000000000..490b46e57 --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/codem_inv.lua @@ -0,0 +1,89 @@ +if not config["codem-inventory"] then return end + +local playerJob = "" +local lastItems = {} + +RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function() + self.Functions.RemoveAllWeapons() +end) + +RegisterNetEvent('tgiCore:Client:OnPlayerLoaded') +AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData) + playerJob = PlayerData.job.name + SetTimeout(2000, function() -- some waiting time because the character's inventory data is loaded later + lastItems = exports['codem-inventory']:GetClientPlayerInventory() + weaponCheck() + end) +end) + +RegisterNetEvent('tgiCore:Client:OnJobUpdate') +AddEventHandler('tgiCore:Client:OnJobUpdate', function(job) + self.Functions.RemoveAllWeapons() + playerJob = job.name + weaponCheck() +end) + +RegisterNetEvent('codem-inventory:client:additem') +AddEventHandler('codem-inventory:client:additem', function(slot, data) + lastItems[tostring(slot)] = data + weaponCheck() +end) + +RegisterNetEvent('codem-inventory:client:removeitemtoclientInventory') +AddEventHandler('codem-inventory:client:removeitemtoclientInventory', function(slot, amount) + slot = tostring(slot) + if lastItems[slot] then + local itemAmount = lastItems[slot].count or lastItems[slot].amount + if itemAmount == amount then + lastItems[slot] = nil + end + end + weaponCheck() +end) + +RegisterNetEvent('codem-inventory:client:clearinventory') +AddEventHandler('codem-inventory:client:clearinventory', function() + lastItems = {} + weaponCheck() +end) + +RegisterNetEvent('codem-inventory:client:setitembyslot') +AddEventHandler('codem-inventory:client:setitembyslot', function(slot, itemData) + lastItems[tostring(slot)] = itemData + weaponCheck() +end) + +self.Functions.CheckWeaponIsRemoved = function() + if not next(self.weapons) then return end + for key, _ in pairs(self.weapons) do + local success = false + for _, item in pairs(lastItems) do + if key == item.info?.serie or item.name then + success = true + break + end + end + if not success then + self.Functions.RemoveWeapon(key) + end + end +end + +function weaponCheck() + if not lastItems then return end + Wait(100) + self.Functions.CheckWeaponIsRemoved() + local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01` + for _, item in pairs(lastItems) do + if item and item.type == "weapon" then + self.Functions.AddWeapon({ + weapon = item.name, + key = item?.info?.serie or item.name, + attachments = config.tgiann_attachments and + getTgiannAttachments(item.info.tgiattachments, joaat(item.name)) or item.info.attachments, + playerJob = playerJob, + isMale = isMale + }) + end + end +end diff --git a/resources/[inventory]/tgiann-weapons-on-back/client/bridge/core_inv.lua b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/core_inv.lua new file mode 100644 index 000000000..4c3a8ae84 --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/core_inv.lua @@ -0,0 +1,116 @@ +-- https://docs.c8re.store/core-inventory/api +if not config.core_inventory then return end + +local function splitStr(str, delimiter) + local result = {} + local from = 1 + local delim_from, delim_to = string.find(str, delimiter, from) + while delim_from do + result[#result + 1] = string.sub(str, from, delim_from - 1) + from = delim_to + 1 + delim_from, delim_to = string.find(str, delimiter, from) + end + result[#result + 1] = string.sub(str, from) + return result +end + +local playerJob = "" +local invItems = {} +local playerItems = {} + +local function getInventoryItems() + tgiCore.cbFunction('tgiann-weapons-on-back:core_inventory:server:getInventory', function(newPlayerItems) + playerItems = newPlayerItems + weaponCheck(true) + end) +end + +RegisterNetEvent('core_inventory:client:sync', function(inventory, data) + local split = splitStr(inventory, '-')[1] + if config.enableInv[split] then + playerItems[split] = data.content + end +end) + +RegisterNetEvent('tgiCore:Client:OnPlayerLoaded') +AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData) + if not PlayerData then return end + playerJob = PlayerData.job.name + getInventoryItems(PlayerData.identifier) +end) + +RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function() + self.Functions.RemoveAllWeapons() +end) + +RegisterNetEvent('tgiCore:Client:OnJobUpdate') +AddEventHandler('tgiCore:Client:OnJobUpdate', function(job) + self.Functions.RemoveAllWeapons() + playerJob = job.name + weaponCheck(false) +end) + +if config.framework == "qb" then + RegisterNetEvent('QBCore:Player:SetPlayerData', function(PlayerData) + playerJob = PlayerData.job.name + if not config.enableInv["content"] then return end + playerItems["content"] = PlayerData?.items + weaponCheck(true) + end) +else + RegisterNetEvent('esx:addInventoryItem') + AddEventHandler('esx:addInventoryItem', function(job) + local PlayerData = exports["tgiann-core"]:getPlayerData() + if not PlayerData then return end + getInventoryItems(PlayerData.identifier) + end) + + RegisterNetEvent('esx:removeInventoryItem') + AddEventHandler('esx:removeInventoryItem', function(job) + local PlayerData = exports["tgiann-core"]:getPlayerData() + if not PlayerData then return end + getInventoryItems(PlayerData.identifier) + end) +end + +self.Functions.CheckWeaponIsRemoved = function() + if not next(self.weapons) then return end + for key, _ in pairs(self.weapons) do + local success = false + for _, item in pairs(invItems) do + if item and key == (item.metadata?.serial or item.name) then + success = true + break + end + end + if not success then + self.Functions.RemoveWeapon(key) + end + end +end + +function weaponCheck(updateData) + if updateData then + invItems = {} + for _, inv in pairs(playerItems) do + for _, item in pairs(inv) do + invItems[#invItems + 1] = item + end + end + end + Wait(100) + self.Functions.CheckWeaponIsRemoved() + local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01` + for _, item in pairs(invItems) do + if item and string.find(string.lower(item.name), "weapon") then + self.Functions.AddWeapon({ + weapon = item.name, + key = item.metadata?.serial or item.name, + attachments = config.tgiann_attachments and + getTgiannAttachments(item.metadata.tgiattachments, joaat(item.name)) or item.metadata.attachments, + playerJob = playerJob, + isMale = isMale + }) + end + end +end diff --git a/resources/[inventory]/tgiann-weapons-on-back/client/bridge/esx_inv.lua b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/esx_inv.lua new file mode 100644 index 000000000..ff1881be5 --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/esx_inv.lua @@ -0,0 +1,88 @@ +if config.framework ~= "esx" then return end +if not config.useDefaultInventory then return end + +local playerJob = "" +local lastItems = {} + +local function getInventoryItems() + tgiCore.cbFunction('tgiann-weapons-on-back:esx_inv:server:getInventory', function(playerItems, loadout) + local itemList = {} + -- ESX is suck + if loadout and #loadout > 0 then + for i = 1, #loadout do + itemList[#itemList + 1] = loadout[i] + end + end + + if playerItems and #playerItems > 0 then + for i = 1, #playerItems do + if playerItems[i].count > 0 then + itemList[#itemList + 1] = playerItems[i] + end + end + end + lastItems = itemList + weaponCheck() + end) +end + +RegisterNetEvent('tgiCore:Client:OnPlayerLoaded') +AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData) + playerJob = PlayerData.job.name + getInventoryItems() +end) + +RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function() + self.Functions.RemoveAllWeapons() +end) + +RegisterNetEvent('esx:addInventoryItem') +AddEventHandler('esx:addInventoryItem', function(job) + getInventoryItems() +end) + +RegisterNetEvent('esx:removeInventoryItem') +AddEventHandler('esx:removeInventoryItem', function(job) + getInventoryItems() +end) + +RegisterNetEvent('tgiCore:Client:OnJobUpdate') +AddEventHandler('tgiCore:Client:OnJobUpdate', function(job) + self.Functions.RemoveAllWeapons() + playerJob = job.name + weaponCheck() +end) + +self.Functions.CheckWeaponIsRemoved = function() + if not next(self.weapons) then return end + for key, _ in pairs(self.weapons) do + local success = false + for _, item in pairs(lastItems) do + if item and key == item.name then + success = true + break + end + end + if not success then + self.Functions.RemoveWeapon(key) + end + end +end + +function weaponCheck() + self.Functions.CheckWeaponIsRemoved() + Wait(100) + local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01` + for _, item in pairs(lastItems) do + if item and string.find(string.lower(item.name), "weapon") then + self.Functions.AddWeapon({ + weapon = item.name, + key = item.name, + attachments = config.tgiann_attachments and + getTgiannAttachments(item?.info?.tgiattachments, joaat(item.name)) or item.components, + playerJob = playerJob, + isMale = isMale + }) + end + end +end diff --git a/resources/[inventory]/tgiann-weapons-on-back/client/bridge/main.lua b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/main.lua new file mode 100644 index 000000000..786946d5f --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/main.lua @@ -0,0 +1,99 @@ +tgiCore = nil +CreateThread(function() + while not tgiCore do + tgiCore = tgiCoreExports:getCore() + Wait(200) + end +end) + +local function LoadModel(model) + if HasModelLoaded(model) then return end + RequestModel(model) + while not HasModelLoaded(model) do Wait(0) end +end + +self.Functions.AddAttachments = function(entity, weaponName, weaponHash, attachments) + if not attachments then return end + if config.tgiann_attachments then + for _, data in pairs(attachments) do + local model = GetWeaponComponentTypeModel(data.component) + if model ~= 0 then + LoadModel(model) + GiveWeaponComponentToWeaponObject(entity, data.component) + SetModelAsNoLongerNeeded(data.component) + else + SetWeaponObjectTintIndex(entity, data.component) + end + end + elseif config.core_inventory then + for _, data in pairs(attachments) do + local model = GetWeaponComponentTypeModel(data.componentHash) + if model ~= 0 then + LoadModel(model) + GiveWeaponComponentToWeaponObject(entity, data.componentHash) + SetModelAsNoLongerNeeded(data.componentHash) + else + SetWeaponObjectTintIndex(entity, data.componentHash) + end + end + elseif config.ox_inventory then + if not oxItems then oxItems = exports.ox_inventory:Items() end + for i = 1, #attachments do + local components = oxItems[attachments[i]].client.component + for v = 1, #components do + local component = components[v] + if DoesWeaponTakeWeaponComponent(weaponHash, component) then + local model = GetWeaponComponentTypeModel(component) + if model ~= 0 then + LoadModel(model) + GiveWeaponComponentToWeaponObject(entity, component) + SetModelAsNoLongerNeeded(component) + end + end + end + end + elseif config.framework == "qb" then + for _, data in pairs(attachments) do + local model = GetWeaponComponentTypeModel(data.component) + if model ~= 0 then + LoadModel(model) + GiveWeaponComponentToWeaponObject(entity, data.component) + SetModelAsNoLongerNeeded(data.component) + else + SetWeaponObjectTintIndex(entity, data.component) + end + end + else + --ESX is suck + for i = 1, #attachments do + local componentData = tgiCore.core.GetWeaponComponent(weaponName, attachments[i]) + if componentData then + local hash = componentData.hash + local model = GetWeaponComponentTypeModel(hash) + if model ~= 0 then + LoadModel(model) + GiveWeaponComponentToWeaponObject(entity, hash) + SetModelAsNoLongerNeeded(hash) + else + SetWeaponObjectTintIndex(entity, hash) + end + end + end + end +end + +function getTgiannAttachments(tgiattachments, weapon) + local invSettings = exports["tgiann-attachment"]:inventoryConfig() + if invSettings then + return tgiattachments + else + local returnVal = nil + local waitCb = true + tgiCore.cbFunction("tgiann-attachment:getAttachment", function(data) + returnVal = data + waitCb = false + end, weapon) + while waitCb do Wait(10) end + return returnVal + end +end diff --git a/resources/[inventory]/tgiann-weapons-on-back/client/bridge/mf_inv.lua b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/mf_inv.lua new file mode 100644 index 000000000..c8bcde8df --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/mf_inv.lua @@ -0,0 +1,77 @@ +if not config["mf-inventory"] then return end + +local playerJob = "" +local lastItems = {} + +local function getInventoryItems(identifier) + exports["mf-inventory"]:getInventoryItems(identifier, function(items) + lastItems = items + weaponCheck() + end) +end + +RegisterNetEvent('esx:playerLoaded') +AddEventHandler('esx:playerLoaded', function(PlayerData) + playerJob = PlayerData.job.name + getInventoryItems(PlayerData.identifier) +end) + +RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function() + self.Functions.RemoveAllWeapons() +end) + +RegisterNetEvent('esx:addInventoryItem') +AddEventHandler('esx:addInventoryItem', function(job) + local PlayerData = exports["tgiann-core"]:getPlayerData() + if not PlayerData then return end + getInventoryItems(PlayerData.identifier) +end) + +RegisterNetEvent('esx:removeInventoryItem') +AddEventHandler('esx:removeInventoryItem', function(job) + local PlayerData = exports["tgiann-core"]:getPlayerData() + if not PlayerData then return end + getInventoryItems(PlayerData.identifier) +end) + +RegisterNetEvent('tgiCore:Client:OnJobUpdate') +AddEventHandler('tgiCore:Client:OnJobUpdate', function(job) + self.Functions.RemoveAllWeapons() + playerJob = job.name + weaponCheck() +end) + +self.Functions.CheckWeaponIsRemoved = function() + if not next(self.weapons) then return end + for key, _ in pairs(self.weapons) do + local success = false + for _, item in pairs(lastItems) do + if item and key == item.name then + success = true + break + end + end + if not success then + self.Functions.RemoveWeapon(key) + end + end +end + +function weaponCheck() + if not lastItems then return end + Wait(100) + self.Functions.CheckWeaponIsRemoved(lastItems) + local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01` + for _, item in pairs(lastItems) do + if item and string.find(string.lower(item.name), "weapon") then + self.Functions.AddWeapon({ + weapon = item.name, + key = item.name, + attachments = config.tgiann_attachments and + getTgiannAttachments(item.metadata.tgiattachments, joaat(item.name)), + playerJob = playerJob, + isMale = isMale + }) + end + end +end diff --git a/resources/[inventory]/tgiann-weapons-on-back/client/bridge/origen_inv.lua b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/origen_inv.lua new file mode 100644 index 000000000..aee6b831a --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/origen_inv.lua @@ -0,0 +1,79 @@ +if not config.origen_inventory then return end + +local origen_inventory = exports.origen_inventory +local playerJob = "" +local lastItems = {} + +local function getInventoryItems() + lastItems = origen_inventory:GetInventory() + weaponCheck() +end + +RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function() + self.Functions.RemoveAllWeapons() +end) + +RegisterNetEvent('tgiCore:Client:OnPlayerLoaded') +AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData) + playerJob = PlayerData.job.name + getInventoryItems() +end) + +RegisterNetEvent('tgiCore:Client:OnJobUpdate') +AddEventHandler('tgiCore:Client:OnJobUpdate', function(job) + self.Functions.RemoveAllWeapons() + playerJob = job.name + weaponCheck() +end) + +--QB +RegisterNetEvent('QBCore:Player:SetPlayerData', function(PlayerData) + playerJob = PlayerData.job.name + getInventoryItems() +end) + +--ESX +RegisterNetEvent('esx:addInventoryItem') +AddEventHandler('esx:addInventoryItem', function() + getInventoryItems() +end) + +RegisterNetEvent('esx:removeInventoryItem') +AddEventHandler('esx:removeInventoryItem', function() + getInventoryItems() +end) + +self.Functions.CheckWeaponIsRemoved = function() + if not next(self.weapons) then return end + for key, _ in pairs(self.weapons) do + local success = false + for _, item in pairs(lastItems) do + if key == item.info.serie then + success = true + break + end + end + if not success then + self.Functions.RemoveWeapon(key) + end + end +end + +function weaponCheck() + if not lastItems then return end + Wait(100) + self.Functions.CheckWeaponIsRemoved() + local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01` + for _, item in pairs(lastItems) do + if item and item.type == "weapon" then + self.Functions.AddWeapon({ + weapon = item.name, + key = item.info.serie, + attachments = config.tgiann_attachments and + getTgiannAttachments(item.info.tgiattachments, joaat(item.name)) or item.info.attachments, + playerJob = playerJob, + isMale = isMale + }) + end + end +end diff --git a/resources/[inventory]/tgiann-weapons-on-back/client/bridge/ox_inv.lua b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/ox_inv.lua new file mode 100644 index 000000000..84715b1e3 --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/ox_inv.lua @@ -0,0 +1,64 @@ +if not config.ox_inventory then return end + +local playerJob = "" +local lastItems = {} + +RegisterNetEvent('tgiCore:Client:OnPlayerLoaded') +AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData) + playerJob = PlayerData.job.name + lastItems = exports.ox_inventory:GetPlayerItems() or {} + weaponCheck() +end) + +RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function() + self.Functions.RemoveAllWeapons() +end) + +AddEventHandler('ox_inventory:updateInventory', function(changes) + for i, value in pairs(changes) do + lastItems[i] = value or nil + end + weaponCheck() +end) + +RegisterNetEvent('tgiCore:Client:OnJobUpdate') +AddEventHandler('tgiCore:Client:OnJobUpdate', function(job) + self.Functions.RemoveAllWeapons() + playerJob = job.name + weaponCheck() +end) + +self.Functions.CheckWeaponIsRemoved = function() + if not next(self.weapons) then return end + for key, _ in pairs(self.weapons) do + local success = false + for _, item in pairs(lastItems) do + if item and key == (item.metadata.serial or item.name) then + success = true + break + end + end + if not success then + self.Functions.RemoveWeapon(key) + end + end +end + +function weaponCheck() + if not lastItems then return end + Wait(100) + self.Functions.CheckWeaponIsRemoved() + local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01` + for _, item in pairs(lastItems) do + if item and string.find(string.lower(item.name), "weapon") then + self.Functions.AddWeapon({ + weapon = item.name, + key = item.metadata.serial or item.name, + attachments = config.tgiann_attachments and + getTgiannAttachments(item.metadata.tgiattachments, joaat(item.name)) or item.metadata.components, + playerJob = playerJob, + isMale = isMale + }) + end + end +end diff --git a/resources/[inventory]/tgiann-weapons-on-back/client/bridge/qb_inv.lua b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/qb_inv.lua new file mode 100644 index 000000000..7ee834347 --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/qb_inv.lua @@ -0,0 +1,64 @@ +if config.framework ~= "qb" then return end +if not config.useDefaultInventory then return end + +local playerJob = "" +local lastItems = {} + +RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function() + self.Functions.RemoveAllWeapons() +end) + +RegisterNetEvent('tgiCore:Client:OnPlayerLoaded') +AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData) + playerJob = PlayerData.job.name + lastItems = PlayerData?.items + weaponCheck() +end) + +RegisterNetEvent('QBCore:Player:SetPlayerData', function(PlayerData) + playerJob = PlayerData.job.name + lastItems = PlayerData?.items + weaponCheck() +end) + +RegisterNetEvent('tgiCore:Client:OnJobUpdate') +AddEventHandler('tgiCore:Client:OnJobUpdate', function(job) + self.Functions.RemoveAllWeapons() + playerJob = job.name + weaponCheck() +end) + +self.Functions.CheckWeaponIsRemoved = function() + if not next(self.weapons) then return end + for key, _ in pairs(self.weapons) do + local success = false + for _, item in pairs(lastItems) do + if key == item.info.serie then + success = true + break + end + end + if not success then + self.Functions.RemoveWeapon(key) + end + end +end + +function weaponCheck() + if not lastItems then return end + Wait(100) + self.Functions.CheckWeaponIsRemoved() + local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01` + for _, item in pairs(lastItems) do + if item and item.type == "weapon" then + self.Functions.AddWeapon({ + weapon = item.name, + key = item.info.serie, + attachments = config.tgiann_attachments and + getTgiannAttachments(item.info.tgiattachments, joaat(item.name)) or item.info.attachments, + playerJob = playerJob, + isMale = isMale + }) + end + end +end diff --git a/resources/[inventory]/tgiann-weapons-on-back/client/bridge/qs_inv.lua b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/qs_inv.lua new file mode 100644 index 000000000..387313a79 --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/qs_inv.lua @@ -0,0 +1,89 @@ +if not config["qs-inventory"] then return end + +local playerJob = "" +local lastItems = {} +local isBussy = false + +local function getInventoryItems() + if isBussy then return end + isBussy = true + while exports['qs-inventory']:inInventory() do Wait(10) end -- getUserInventory not updating when inventory is open + Wait(1000) -- getUserInventory is updating late + lastItems = exports['qs-inventory']:getUserInventory() + weaponCheck(playerJob, true) + isBussy = false +end + +RegisterNetEvent('tgiCore:Client:OnPlayerLoaded') +AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData) + playerJob = PlayerData.job.name + getInventoryItems() +end) + +RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function() + self.Functions.RemoveAllWeapons() +end) + +--ESX +RegisterNetEvent('esx:addInventoryItem') +AddEventHandler('esx:addInventoryItem', function() + getInventoryItems() +end) + +RegisterNetEvent('esx:removeInventoryItem') +AddEventHandler('esx:removeInventoryItem', function() + getInventoryItems() +end) + +--QB +RegisterNetEvent('QBCore:Player:SetPlayerData', function(PlayerData) + playerJob = PlayerData.job.name + lastItems = PlayerData?.items + weaponCheck() +end) + +RegisterNetEvent('tgiCore:Client:OnJobUpdate') +AddEventHandler('tgiCore:Client:OnJobUpdate', function(job) + self.Functions.RemoveAllWeapons() + playerJob = job.name + weaponCheck(playerJob) +end) + +self.Functions.CheckWeaponIsRemoved = function() + if not next(self.weapons) then return end + for key, _ in pairs(self.weapons) do + local success = false + for _, item in pairs(lastItems) do + if item and key == (item.info?.serie or item.name) then + success = true + break + end + end + if not success then + self.Functions.RemoveWeapon(key) + end + end +end + +function weaponCheck() + Wait(100) + self.Functions.CheckWeaponIsRemoved() + local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01` + for _, item in pairs(lastItems) do + if item then + local isWeapon = string.find(string.lower(item.name), "weapon") + debug(item.name .. " Check For Add Weapon", "isWeapon: " .. tostring(isWeapon)) + if isWeapon then + debug(item.name .. " Added") + self.Functions.AddWeapon({ + weapon = item.name, + key = item.info?.serie or item.name, + attachments = config.tgiann_attachments and + getTgiannAttachments(item.info.tgiattachments, joaat(item.name)) or item.info?.attachments, + playerJob = playerJob, + isMale = isMale + }) + end + end + end +end diff --git a/resources/[inventory]/tgiann-weapons-on-back/client/bridge/tgiann_inv.lua b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/tgiann_inv.lua new file mode 100644 index 000000000..71e036f7f --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/client/bridge/tgiann_inv.lua @@ -0,0 +1,62 @@ +if not config["tgiann-inventory"] then return end + +local playerJob = "" +local lastItems = {} + +RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function() + self.Functions.RemoveAllWeapons() +end) + +RegisterNetEvent('tgiCore:Client:OnPlayerLoaded') +AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData) + playerJob = PlayerData.job.name + lastItems = exports["tgiann-inventory"]:GetPlayerItems() + weaponCheck() +end) + +RegisterNetEvent('tgiann-inventory:inventoryUpdated') +AddEventHandler('tgiann-inventory:inventoryUpdated', function(items) + lastItems = items + weaponCheck() +end) + +RegisterNetEvent('tgiCore:Client:OnJobUpdate') +AddEventHandler('tgiCore:Client:OnJobUpdate', function(job) + self.Functions.RemoveAllWeapons() + playerJob = job.name + weaponCheck() +end) + +self.Functions.CheckWeaponIsRemoved = function() + if not next(self.weapons) then return end + for key, _ in pairs(self.weapons) do + local success = false + for _, item in pairs(lastItems) do + if key == item?.info?.serie then + success = true + break + end + end + if not success then + self.Functions.RemoveWeapon(key) + end + end +end + +function weaponCheck() + if not lastItems then return end + Wait(100) + self.Functions.CheckWeaponIsRemoved() + local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01` + for _, item in pairs(lastItems) do + if item and item.type == "weapon" then + self.Functions.AddWeapon({ + weapon = string.gsub(item.name, "_police", ""), + key = item?.info?.serie or item.name, + attachments = item?.info?.tgiattachments or {}, + playerJob = playerJob, + isMale = isMale + }) + end + end +end diff --git a/resources/[inventory]/tgiann-weapons-on-back/client/client.lua b/resources/[inventory]/tgiann-weapons-on-back/client/client.lua new file mode 100644 index 0000000000000000000000000000000000000000..b45246355dd59bea1537a1850de4ed4b69adec11 GIT binary patch literal 6569 zcmV;a8CK>-SV2$$00000058W|j|@&|w}t$d%TjWoj>NCDz2e~Hme;-3A3UU0CKDQY zUZW>Z7~vGbtiMDU;u5C1+btSGq0JCx=!q#k1Ky9M8vkP`1Fm}rGpfKEj;O5Lfyr`i zcGLiu&vhxz&8#>PQlIGs^4}2$C%GH{_k7REl6k2n!@ALdtHfL6lGe1LdeZZe0F+QV z&ozPkH25s&M*r35K{D>v0mS|4JRVCqBU$|`Z4`J5gyre#8+Y{^=A>{-&=IYvD5Tkc zx7aM8A$Jd=b|2YWw=+H!9!aK%7B>z7XrGJ%p?8Ri<+p~=uWl}VMJXpsF`)Jnuz4~3 zWsOa#57Vwh14*TpN01P~;GgV;^kK!LBkNVj{{Uumzg_q;E)aALm(b2Bzn<;yS>V#b ze{vdqdDOWlaM%(Sos6lX%34-yhP3nci9cfI=6oV4+%7qEFaUjv{)WiK4%DYlt!GOyS6Z(S1r8hfWNDx9AhZU< zzv8!qkuHTjkd0u4puW!W(4BL_s!Q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>$K?ei_tG5%=PlzE$Q3tU|0rFeVvyXczLx6Ch8d8VXfa+eKj8jx*rLOd_*L> zsLXHAm;TuaGy{Pb3m8!Wqkp6U+xX^IxTB# zWimeh5q_nPlM!l#Yp1Hx{Vw(`W^Nk-%X`!#^U|2s`|3PNZ;?}Sk79I2bIYF0X8j@)(sV+ z`Iwjv0TU5_HyWCi`wq!q2Y~5BX3|{Fbqih5Z424ELb|blvg4746lqnIBF-b2a6vHg z%tnq#3+0j&kim~;&8T&@l(ccLHOgKZH|wL6^7d!oc%bVm0e z9_>^$fC%pjCU@C>S~gLT-MZXFOXa_4+tU0nT&O{tePQ>P<-L?IiCbH&42ti@gBrBQ z%g2fn-JVVug^V+`Yb=KKC?`VT4`nh_LpI<1Ti|wEP#>@I_^s7%aR-z}0nY8crkKuS_S?|o5PJIGud5$Rs`92_a`#@K^s=S+J6rlZUo}H9q=}~$g?n;}{7-{0b6C+c(CMl_2#y}KY`8$AN bqk#c^1^A++u_L_%ykAe-CU_tzlr@crGiJtU literal 0 HcmV?d00001 diff --git a/resources/[inventory]/tgiann-weapons-on-back/client/editable.lua b/resources/[inventory]/tgiann-weapons-on-back/client/editable.lua new file mode 100644 index 000000000..a5f9866b3 --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/client/editable.lua @@ -0,0 +1,12 @@ +function canShow(targetPed) + local isEntityVisible = IsEntityVisible(targetPed) + local getEntityAlpha = GetEntityAlpha(targetPed) + local pedIsVisible = isEntityVisible and getEntityAlpha == 255 + debug("pedIsVisible: " .. tostring(pedIsVisible), "ped:" .. targetPed, "isEntityVisible: " .. tostring(isEntityVisible), "getEntityAlpha: " .. getEntityAlpha) + return pedIsVisible +end + +function debug(...) + if not config.debug then return end + print(...) +end diff --git a/resources/[inventory]/tgiann-weapons-on-back/configs/config.lua b/resources/[inventory]/tgiann-weapons-on-back/configs/config.lua new file mode 100644 index 000000000..db92c0b04 --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/configs/config.lua @@ -0,0 +1,206 @@ +--[[ + - this script needs tgiann-core script to work, you can download the script from your keymaster account + Start tgiann-core script after es_extented/qb-core script and before tgiann-* scripts + Adjust the tgiann-core config file according to the framework you are using + + https://tgiann.gitbook.io/tgiann/scripts/tgiann-weapons-on-back + + Note: If you want the weapons to be invisible while in Noclip, the character must be completely invisible. If your character is invisible to other players, other players cannot see these weapons. + If you want to edit this, take a look at client/editable.lua +]] + +tgiCoreExports = exports["tgiann-core"] +config = tgiCoreExports:getConfig() +config.debug = false + +config.tgiann_attachments = GetResourceState("tgiann-attachment") ~= "missing" -- https://tgiann.tebex.io/package/5399235 + +-- Weapon positions for male and female characters. You can add additional positions here if you like. +config.positions = { + male = { + back = { -- We have set 3 positions for the back. You can add or remove extra positions if you like. This setting also applies to other positions. + { -- position 1 + bone = 24816, + offset = vector3(0.285, -0.17, 0.13), + rot = vector3(0.0, 170.0, 0.0), + }, + { -- position 2 + bone = 24816, + offset = vector3(0.285, -0.17, 0.0), + rot = vector3(0.0, 170.0, 0.0), + }, + { -- position 3 + bone = 24816, + offset = vector3(0.285, -0.17, -0.13), + rot = vector3(0.0, 170.0, 0.0), + } + }, + front = { + { + bone = 24818, + offset = vector3(-0.03, 0.19, 0.0), + rot = vector3(-10.0, 40.0, 5.0), + } + }, + right = { + { + bone = 11816, + offset = vector3(-0.01, 0.02, 0.215), + rot = vector3(-100.0, 60.0, 45.0), + } + }, + rLegBack = { + { + bone = 11816, + offset = vector3(-0.15, -0.11, 0.22), + rot = vector3(0.0, 95.0, 180.0), + } + }, + waist = { + { + bone = 11816, + offset = vector3(-0.07, -0.13, 0.05), + rot = vector3(180.0, -30.0, 10.0), + } + }, + -- You can add extra positions here if you like. + -- The positions you add can be used in the `config.weaponPositions`, `config.weaponGroupPositions` and `config.weaponGroupJobPositions` settings. + --[[ exampleCustomName = { + { + bone = 11816, + offset = vector3(-0.07, -0.13, 0.05), + rot = vector3(180.0, -30.0, 10.0), + } + }, ]] + }, + female = { + back = { + { + bone = 24816, + offset = vector3(0.285, -0.15, 0.13), + rot = vector3(0.0, 170.0, 0.0), + }, + { + bone = 24816, + offset = vector3(0.285, -0.15, 0.0), + rot = vector3(0.0, 170.0, 0.0), + }, + { + bone = 24816, + offset = vector3(0.285, -0.15, -0.13), + rot = vector3(0.0, 170.0, 0.0), + } + }, + front = { + { + bone = 24818, + offset = vector3(-0.03, 0.21, 0.0), + rot = vector3(-10.0, 40.0, 5.0), + } + }, + right = { + { + bone = 11816, + offset = vector3(-0.09, 0.03, 0.18), + rot = vector3(-105.0, 75.0, 45.0), + } + }, + rLegBack = { + { + bone = 11816, + offset = vector3(-0.15, -0.11, 0.22), + rot = vector3(0.0, 95.0, 180.0), + } + }, + waist = { + { + bone = 11816, + offset = vector3(-0.07, -0.09, 0.05), + rot = vector3(180.0, -30.0, 10.0), + } + } + } + +} + +-- Weapons in the list do not appear on the character +config.disabledWeapons = { + weapon_flashlight = true, + weapon_knuckle = true, + weapon_bottle = true, + weapon_snowball = true, +} + +-- adjusts the location of the weapon regardless of its group +config.weaponPositions = { + --weapon_pistol = "right", +} + +-- adjusts the position of the weapon regardless of its group +config.weaponCustomPositions = { + male = { + weapon_bat = { + bone = 24816, + offset = vector3(0.0, -0.15, 0.03), + rot = vector3(0.0, 80.0, 0.0), + } + }, + female = { + weapon_bat = { + bone = 24816, + offset = vector3(0.0, -0.15, 0.03), + rot = vector3(0.0, 80.0, 0.0), + } + } +} + +--"waist" - "back" - "front" - "rigt" - "rLegBack" - "none" +config.weaponGroupPostions = { + [3539449195] = "back", --GROUP_DIGISCANNER + [-37788308] = "rLegBack", --GROUP_FIREEXTINGUISHER + [1175761940] = "none", --GROUP_HACKINGDEVICE + [2725924767] = "back", --GROUP_HEAVY + [-728555052] = "back", --GROUP_MELEE + [3759491383] = "none", --GROUP_METALDETECTOR + [1159398588] = "back", --GROUP_MG + [3493187224] = "none", --GROUP_NIGHTVISION + [431593103] = "none", --GROUP_PARACHUTE + [1595662460] = "none", --GROUP_PETROLCAN + [416676503] = "waist", --GROUP_PISTOL + [970310034] = "back", --GROUP_RIFLE + [860033945] = "back", --GROUP_SHOTGUN + [-957766203] = "front", --GROUP_SMG + [-1212426201] = "back", --GROUP_SNIPER + [690389602] = "none", --GROUP_STUNGUN + [1548507267] = "none", --GROUP_THROWN + [75159441] = "back", --GROUP_TRANQILIZER + [2685387236] = "none", --GROUP_UNARMED +} + +-- weapon locations for jobs +config.weaponGroupJobPostions = { + { + jobs = { "police" }, -- u can add multible job name + postions = { + [3539449195] = "back", --GROUP_DIGISCANNER + [-37788308] = "rLegBack", --GROUP_FIREEXTINGUISHER + [1175761940] = "none", --GROUP_HACKINGDEVICE + [2725924767] = "back", --GROUP_HEAVY + [-728555052] = "back", --GROUP_MELEE + [3759491383] = "none", --GROUP_METALDETECTOR + [1159398588] = "back", --GROUP_MG + [3493187224] = "none", --GROUP_NIGHTVISION + [431593103] = "none", --GROUP_PARACHUTE + [1595662460] = "none", --GROUP_PETROLCAN + [416676503] = "right", --GROUP_PISTOL + [970310034] = "back", --GROUP_RIFLE + [860033945] = "back", --GROUP_SHOTGUN + [-957766203] = "front", --GROUP_SMG + [-1212426201] = "back", --GROUP_SNIPER + [690389602] = "none", --GROUP_STUNGUN + [1548507267] = "none", --GROUP_THROWN + [75159441] = "back", --GROUP_TRANQILIZER + [2685387236] = "none", --GROUP_UNARMED + } + } +} diff --git a/resources/[inventory]/tgiann-weapons-on-back/configs/core_inv_config.lua b/resources/[inventory]/tgiann-weapons-on-back/configs/core_inv_config.lua new file mode 100644 index 000000000..be3ce7e4f --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/configs/core_inv_config.lua @@ -0,0 +1,5 @@ +config.enableInv = { + ["content"] = true, + ["primary"] = true, + ["secondry"] = true, +} \ No newline at end of file diff --git a/resources/[inventory]/tgiann-weapons-on-back/fxmanifest.lua b/resources/[inventory]/tgiann-weapons-on-back/fxmanifest.lua new file mode 100644 index 000000000..c59b2fef0 --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/fxmanifest.lua @@ -0,0 +1,34 @@ +fx_version 'cerulean' +game 'gta5' +version '1.0.1' + +lua54 'yes' + +dependencies { + 'tgiann-core', +} + +escrow_ignore { + 'configs/*.lua', + 'checkInv.lua', + 'client/bridge/*.lua', + 'client/editable.lua', + 'server/bridge/*.lua' +} + +shared_script { + 'configs/*.lua', + 'checkInv.lua', +} + +client_scripts { + 'client/*.lua', + 'client/bridge/*.lua' +} + +server_scripts { + "server/server.lua", + 'server/bridge/*.lua', +} + +dependency '/assetpacks' \ No newline at end of file diff --git a/resources/[inventory]/tgiann-weapons-on-back/server/bridge/core_inv.lua b/resources/[inventory]/tgiann-weapons-on-back/server/bridge/core_inv.lua new file mode 100644 index 000000000..b330e546d --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/server/bridge/core_inv.lua @@ -0,0 +1,13 @@ +if not config.core_inventory then return end + +tgiCore.cbFunction('tgiann-weapons-on-back:core_inventory:server:getInventory', function(source, cb) + local src = source + local xPlayer = tgiCore.getPlayer(src) + if not xPlayer then return end + local citizenid = tgiCore.getCid(xPlayer) + local playerItems = {} + for inv, canAdd in pairs(config.enableInv) do + if canAdd then playerItems[inv] = exports['core_inventory']:getInventory(string.format("%s-%s", inv, citizenid)) end + end + cb(playerItems) +end) diff --git a/resources/[inventory]/tgiann-weapons-on-back/server/bridge/esx_inv.lua b/resources/[inventory]/tgiann-weapons-on-back/server/bridge/esx_inv.lua new file mode 100644 index 000000000..a59396790 --- /dev/null +++ b/resources/[inventory]/tgiann-weapons-on-back/server/bridge/esx_inv.lua @@ -0,0 +1,10 @@ +if config.framework ~= "esx" then return end +if not config.useDefaultInventory then return end + +-- esx is very bad, I can't access current inventory data from client +tgiCore.cbFunction('tgiann-weapons-on-back:esx_inv:server:getInventory', function(source, cb) + local src = source + local xPlayer = tgiCore.getPlayer(src) + if not xPlayer then return end + cb(xPlayer.getInventory(), xPlayer.getLoadout()) +end) \ No newline at end of file diff --git a/resources/[inventory]/tgiann-weapons-on-back/server/server.lua b/resources/[inventory]/tgiann-weapons-on-back/server/server.lua new file mode 100644 index 0000000000000000000000000000000000000000..794191b64bc92968410b62866720d8454831d3d1 GIT binary patch literal 1954 zcmV;T2VM9^SV2$$000000NBIjGT#ig0>Cpfk|w_=6SOuW_c7GZM1b+b+%|xXcP4rk z04pvgD`Q=2avJx>lK+@^mYWWb&@%B}c=)j?}%LwdDz;FL6mqBiO>A7UxT?jT;(~< z2xwA}b9(K8o$-iRTv=S_eGHAD?njTKNUnbezh)EGVzG5yvPcBUAi z>@2fVu!%w8Puqp+<)ltj5#*J8k^QTdranGY zU&hm^^81?(eBPaHf3NW3WJM z9Q=aVT=x)veB)&9WzJL}`;%U{afgM9AsX2k6+cW}Xt{dsq9y9d%*D9VyZ5yNbCFpI6gwRj#g`^$2%0wa;L$CHQ2tx1jJ=0 zj1w9x-L)Ff1H;Eg4&8~toPcXTuZ77DPtn2TQLyNWw$#emU+M;#Kllwf zv1f}+9eUpvlg3?Jz~_TZ1z#tre0_Y}?x^%_6*2%*-9&B`vR!;9uz@OP;zhWndSDAW zGtcgHllIUb}U*C45>cew`f-5(Q6WIYfL+z2X`$nF3i+gk0j*2*ZE_^PL22ZPT; z(jFE>l=rR0GyLFCRz&T6B|@{#x8?C(RbFk(r!Joj#%4iv`9!6-Y*Q75c82~tja_;h z4Tw=`wDNDuD#V?a0`s>CeHo) zL**giR82Vil}L@uqMZ!q5S`$~DJnGiK58Fj;9WO>VT#Abqm;Py#B!lzv}ihSym}UY z@=j%rLv=P;3BVZb2^dasW4o|Zw_SfEC(v97N`agy+5^h-bo0vudY{5)+ zl?;LjyW8^ZjFi2Qu{@5LM1`!{@1uMm!li?ivql5nwZ!H!#;U;U<;#<$kK*~mLSRwe z>0jgHu`VgM#?jfzxIjy~fDW7+({$liQvPhYLr#EZOk-ta>^9&l3*~@K_D>Nr8x>pI zkUeZ>kfx1;r1e^2owhQbpZ!GSLVei5?)MBXh-Xr&=E6BYZ6FN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