Widget:Calculator/Magic/Aurum: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
Quantity: <input type="number" id="quantity" value="1"><br> | Quantity: <input type="number" id="quantity" value="1"><br> | ||
</form> | </form> | ||
<script> | <script> | ||
function calculateProfits() { | function calculateProfits() { | ||
Line 11: | Line 10: | ||
document.querySelectorAll('#aurum-table tbody tr').forEach(row => { | document.querySelectorAll('#aurum-table tbody tr').forEach(row => { | ||
const | const itemPrice = parseFloat(row.dataset.price); | ||
if (isNaN(itemPrice)) return; | |||
const minorProfit = | |||
const majorProfit = | // Correct logic: | ||
const totalProfit = | const minorValue = itemPrice * 0.5; | ||
const majorValue = itemPrice * 1.0; | |||
const minorProfit = minorValue - scrollPrice; | |||
const majorProfit = majorValue - (scrollPrice * 3); | |||
const totalProfit = majorProfit * quantity; | |||
// Update the row | |||
row.querySelector('.minorProfit').textContent = minorProfit.toFixed(2); | row.querySelector('.minorProfit').textContent = minorProfit.toFixed(2); | ||
row.querySelector('.majorProfit').textContent = majorProfit.toFixed(2); | row.querySelector('.majorProfit').textContent = majorProfit.toFixed(2); |
Revision as of 14:01, 26 June 2025