From b461d4857d49efce8bd30de8d5712543de0e76c0 Mon Sep 17 00:00:00 2001 From: Borre <103928083+Borreke0@users.noreply.github.com> Date: Sun, 12 Nov 2023 23:06:14 +0100 Subject: [PATCH 1/6] [fix] Show costs of items The costs for crafting items wasn't displayed anymore. This fixes it. --- html/js/app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/html/js/app.js b/html/js/app.js index bb7534308..b76522b6c 100644 --- a/html/js/app.js +++ b/html/js/app.js @@ -395,7 +395,9 @@ function generateDescription(itemData) { case "labkey": return `

Lab: ${itemData.info.lab}

`; default: - return itemData.description; + let itemDescr = itemData.description; + if (itemData.info.costs != undefined && itemData.info.costs != null) itemDescr += "

ITEMS NEEDED: "+itemData.info.costs+"

"; + return itemDescr; } } From 0ede403bff65ce964e9077a43e87e2a719e00fe2 Mon Sep 17 00:00:00 2001 From: Borre <103928083+Borreke0@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:45:35 +0100 Subject: [PATCH 2/6] Reformat Reformat to fit with the other code. --- html/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/js/app.js b/html/js/app.js index b76522b6c..afff09a57 100644 --- a/html/js/app.js +++ b/html/js/app.js @@ -396,7 +396,7 @@ function generateDescription(itemData) { return `

Lab: ${itemData.info.lab}

`; default: let itemDescr = itemData.description; - if (itemData.info.costs != undefined && itemData.info.costs != null) itemDescr += "

ITEMS NEEDED: "+itemData.info.costs+"

"; + if (itemData.info.costs != undefined && itemData.info.costs != null) itemDescr += `

Benodigdheden:${itemData.info.costs}

`; return itemDescr; } } From 2ed53a42bfcbf14c5dc65ffe60ea7b2e3fd46778 Mon Sep 17 00:00:00 2001 From: Borre <103928083+Borreke0@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:51:51 +0100 Subject: [PATCH 3/6] Language! --- html/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/js/app.js b/html/js/app.js index afff09a57..bfd5973a8 100644 --- a/html/js/app.js +++ b/html/js/app.js @@ -396,7 +396,7 @@ function generateDescription(itemData) { return `

Lab: ${itemData.info.lab}

`; default: let itemDescr = itemData.description; - if (itemData.info.costs != undefined && itemData.info.costs != null) itemDescr += `

Benodigdheden:${itemData.info.costs}

`; + if (itemData.info.costs != undefined && itemData.info.costs != null) itemDescr += `

ITEMS NEEDED:${itemData.info.costs}

`; return itemDescr; } } From 06dfdf5dcaf19b97f6880021a9740f6e8a792173 Mon Sep 17 00:00:00 2001 From: Borre <103928083+Borreke0@users.noreply.github.com> Date: Sun, 26 Nov 2023 09:33:03 +0100 Subject: [PATCH 4/6] Update main.lua --- server/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/main.lua b/server/main.lua index 3a5e0b025..9e0d7fcc6 100644 --- a/server/main.lua +++ b/server/main.lua @@ -2156,7 +2156,7 @@ RegisterNetEvent('inventory:server:SetInventoryData', function(fromInventory, to QBCore.Functions.Notify(src, Lang:t('notify.noitem'), 'error') end elseif fromInventory == 'attachment_crafting' then - local itemData = Config.AttachmentCrafting['items'][fromSlot] + local itemData = Config.AttachmentCrafting[fromSlot] if hasCraftItems(src, itemData.costs, fromAmount) then TriggerClientEvent('inventory:client:CraftAttachment', src, itemData.name, itemData.costs, fromAmount, toSlot, itemData.points) else From 2cd97f3b1b72d821684a408efe5198c72f9496dc Mon Sep 17 00:00:00 2001 From: Borre <103928083+Borreke0@users.noreply.github.com> Date: Sun, 26 Nov 2023 09:34:50 +0100 Subject: [PATCH 5/6] Update app.js Fixes attachments crafting --- html/js/app.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/html/js/app.js b/html/js/app.js index bfd5973a8..4d6f48230 100644 --- a/html/js/app.js +++ b/html/js/app.js @@ -396,7 +396,7 @@ function generateDescription(itemData) { return `

Lab: ${itemData.info.lab}

`; default: let itemDescr = itemData.description; - if (itemData.info.costs != undefined && itemData.info.costs != null) itemDescr += `

ITEMS NEEDED:${itemData.info.costs}

`; + if (itemData.info.costs != undefined && itemData.info.costs != null) itemDescr += `

ITEMS NEEDED: ${itemData.info.costs}

`; return itemDescr; } } @@ -637,7 +637,7 @@ function updateOtherProgressBar(totalWeightOther, otherMaxWeight) { } function updateweights($fromSlot, $toSlot, $fromInv, $toInv, $toAmount) { - var otherinventory = otherLabel.toLowerCase(); + var otherinventory = otherLabel.toLowerCase(); if (otherinventory.split("-")[0] == "dropped") { toData = $toInv.find("[data-slot=" + $toSlot + "]").data("item"); if (toData !== null && toData !== undefined) { @@ -650,7 +650,7 @@ function updateweights($fromSlot, $toSlot, $fromInv, $toInv, $toAmount) { return true; } - if (($fromInv.attr("data-inventory").split("-")[0] == "itemshop" && $toInv.attr("data-inventory").split("-")[0] == "itemshop") || ($fromInv.attr("data-inventory") == "crafting" && $toInv.attr("data-inventory") == "crafting")) { + if (($fromInv.attr("data-inventory").split("-")[0] == "itemshop" && $toInv.attr("data-inventory").split("-")[0] == "itemshop") || ($fromInv.attr("data-inventory") == "crafting" && $toInv.attr("data-inventory") == "crafting") || ($fromInv.attr("data-inventory") == "attachment_crafting" && $toInv.attr("data-inventory") == "attachment_crafting")) { itemData = $fromInv.find("[data-slot=" + $fromSlot + "]").data("item"); if ($fromInv.attr("data-inventory").split("-")[0] == "itemshop") { $fromInv.find("[data-slot=" + $fromSlot + "]").html('
' + itemData.name + '

(' + itemData.amount + ") $" + itemData.price + '

' + itemData.label + "

"); @@ -662,7 +662,7 @@ function updateweights($fromSlot, $toSlot, $fromInv, $toInv, $toAmount) { return false; } - if ($toAmount == 0 && ($fromInv.attr("data-inventory").split("-")[0] == "itemshop" || $fromInv.attr("data-inventory") == "crafting")) { + if ($toAmount == 0 && ($fromInv.attr("data-inventory").split("-")[0] == "itemshop" || $fromInv.attr("data-inventory") == "crafting" || $fromInv.attr("data-inventory") == "attachment_crafting")) { itemData = $fromInv.find("[data-slot=" + $fromSlot + "]").data("item"); if ($fromInv.attr("data-inventory").split("-")[0] == "itemshop") { $fromInv.find("[data-slot=" + $fromSlot + "]").html('
' + itemData.name + '

(' + itemData.amount + ") $" + itemData.price + '

' + itemData.label + "

"); @@ -674,7 +674,7 @@ function updateweights($fromSlot, $toSlot, $fromInv, $toInv, $toAmount) { return false; } - if ($toInv.attr("data-inventory").split("-")[0] == "itemshop" || $toInv.attr("data-inventory") == "crafting") { + if ($toInv.attr("data-inventory").split("-")[0] == "itemshop" || $toInv.attr("data-inventory") == "crafting" || $toInv.attr("data-inventory") == "attachment_crafting") { itemData = $toInv.find("[data-slot=" + $toSlot + "]").data("item"); if ($toInv.attr("data-inventory").split("-")[0] == "itemshop") { $toInv.find("[data-slot=" + $toSlot + "]").html('
' + itemData.name + '

(' + itemData.amount + ") $" + itemData.price + '

' + itemData.label + "

"); @@ -717,12 +717,12 @@ function updateweights($fromSlot, $toSlot, $fromInv, $toInv, $toAmount) { } } - if (totalWeight > playerMaxWeight || (totalWeightOther > otherMaxWeight && $fromInv.attr("data-inventory").split("-")[0] != "itemshop" && $fromInv.attr("data-inventory") != "crafting")) { + if (totalWeight > playerMaxWeight || (totalWeightOther > otherMaxWeight && $fromInv.attr("data-inventory").split("-")[0] != "itemshop" && $fromInv.attr("data-inventory") != "crafting" && $fromInv.attr("data-inventory") != "attachment_crafting")) { InventoryError($fromInv, $fromSlot); return false; } updateProgressBar(parseInt(totalWeight), playerMaxWeight); - if ($fromInv.attr("data-inventory").split("-")[0] != "itemshop" && $toInv.attr("data-inventory").split("-")[0] != "itemshop" && $fromInv.attr("data-inventory") != "crafting" && $toInv.attr("data-inventory") != "crafting") { + if ($fromInv.attr("data-inventory").split("-")[0] != "itemshop" && $toInv.attr("data-inventory").split("-")[0] != "itemshop" && $fromInv.attr("data-inventory") != "crafting" && $toInv.attr("data-inventory") != "attachment_crafting") { $("#other-inv-label").html(otherLabel); updateOtherProgressBar(parseInt(totalWeightOther), otherMaxWeight); } From 01fcba69d05fb386ac4e60ce0662c75816fd0e92 Mon Sep 17 00:00:00 2001 From: Borre <103928083+Borreke0@users.noreply.github.com> Date: Sun, 26 Nov 2023 09:37:12 +0100 Subject: [PATCH 6/6] Update app.js --- html/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/js/app.js b/html/js/app.js index 4d6f48230..b0797b699 100644 --- a/html/js/app.js +++ b/html/js/app.js @@ -637,7 +637,7 @@ function updateOtherProgressBar(totalWeightOther, otherMaxWeight) { } function updateweights($fromSlot, $toSlot, $fromInv, $toInv, $toAmount) { - var otherinventory = otherLabel.toLowerCase(); + var otherinventory = otherLabel.toLowerCase(); if (otherinventory.split("-")[0] == "dropped") { toData = $toInv.find("[data-slot=" + $toSlot + "]").data("item"); if (toData !== null && toData !== undefined) {