Widget:Calculator/Magic/Aurum: Difference between revisions

From HighSpell Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 13: Line 13:
     if (isNaN(itemPrice)) return;
     if (isNaN(itemPrice)) return;


     // Correct logic:
     // Correct value logic
     const minorValue = itemPrice * 0.0375;
     const minorValue = itemPrice * 0.0375;
     const majorValue = itemPrice * 0.5;
     const majorValue = itemPrice * 0.5;


     const minorProfit = minorValue - scrollPrice;
     const minorProfit = Math.round(minorValue - scrollPrice);
     const majorProfit = majorValue - (scrollPrice * 3);
     const majorProfit = Math.round(majorValue - scrollPrice);
     const totalProfit = majorProfit * quantity;
     const totalProfit = Math.round(majorProfit * quantity);


     // Update the row
     // Helper function to apply red color for negatives
     row.querySelector('.minorProfit').textContent = minorProfit.toFixed(2);
    function formatProfit(cell, value) {
     row.querySelector('.majorProfit').textContent = majorProfit.toFixed(2);
      cell.textContent = value;
     row.querySelector('.totalProfit').textContent = totalProfit.toFixed(2);
      cell.style.color = value < 0 ? '#ee4231' : '';
    }
 
     formatProfit(row.querySelector('.minorProfit'), minorProfit);
     formatProfit(row.querySelector('.majorProfit'), majorProfit);
     formatProfit(row.querySelector('.totalProfit'), totalProfit);
   });
   });
}
}

Revision as of 14:06, 26 June 2025

Scroll Price:
Quantity: