Skip to content

Commit

Permalink
Merge branch 'qbcore-framework:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
azutake authored Jan 14, 2024
2 parents a00be07 + e8a4964 commit 95a2e10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions html/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ function generateDescription(itemData) {
case "labkey":
return `<p>Lab: ${itemData.info.lab}</p>`;
default:
return itemData.description;
let itemDescr = itemData.description;
if (itemData.info.costs != undefined && itemData.info.costs != null) itemDescr += `<p><strong>ITEMS NEEDED:</strong> <span>${itemData.info.costs}</span></p>`;
return itemDescr;
}
}

Expand Down Expand Up @@ -648,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('<div class="item-slot-img"><img src="images/' + itemData.image + '" alt="' + itemData.name + '" /></div><div class="item-slot-amount"><p>(' + itemData.amount + ") $" + itemData.price + '</p></div><div class="item-slot-label"><p>' + itemData.label + "</p></div>");
Expand All @@ -660,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('<div class="item-slot-img"><img src="images/' + itemData.image + '" alt="' + itemData.name + '" /></div><div class="item-slot-amount"><p>(' + itemData.amount + ") $" + itemData.price + '</p></div><div class="item-slot-label"><p>' + itemData.label + "</p></div>");
Expand All @@ -672,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('<div class="item-slot-img"><img src="images/' + itemData.image + '" alt="' + itemData.name + '" /></div><div class="item-slot-amount"><p>(' + itemData.amount + ") $" + itemData.price + '</p></div><div class="item-slot-label"><p>' + itemData.label + "</p></div>");
Expand Down Expand Up @@ -715,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);
}
Expand Down
2 changes: 1 addition & 1 deletion server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2164,7 +2164,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
Expand Down

0 comments on commit 95a2e10

Please sign in to comment.