Skip to content

Commit

Permalink
Update app.js
Browse files Browse the repository at this point in the history
Fixes attachments crafting
  • Loading branch information
Borreke0 authored Nov 26, 2023
1 parent 06dfdf5 commit 2cd97f3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions html/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ function generateDescription(itemData) {
return `<p>Lab: ${itemData.info.lab}</p>`;
default:
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>`;
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 @@ -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) {
Expand All @@ -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('<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 @@ -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('<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 @@ -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('<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 @@ -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);
}
Expand Down

0 comments on commit 2cd97f3

Please sign in to comment.