Widget:Calculator/Magic/Aurum: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 14: | Line 14: | ||
const coinIcon = ' <span class="noviewer" typeof="mw:File"><span><img src="/w/images/thumb/9/9a/Coins_icon.png/16px-Coins_icon.png" decoding="async" width="16" height="16" class="mw-file-element" srcset="/w/images/thumb/9/9a/Coins_icon.png/24px-Coins_icon.png 1.5x, /w/images/9/9a/Coins_icon.png 2x"></span></span>'; | const coinIcon = ' <span class="noviewer" typeof="mw:File"><span><img src="/w/images/thumb/9/9a/Coins_icon.png/16px-Coins_icon.png" decoding="async" width="16" height="16" class="mw-file-element" srcset="/w/images/thumb/9/9a/Coins_icon.png/24px-Coins_icon.png 1.5x, /w/images/9/9a/Coins_icon.png 2x"></span></span>'; | ||
// Get & sanitize scroll price | |||
let scrollPrice = parseFloat(document.getElementById('scrollPrice').value); | |||
if (isNaN(scrollPrice) || scrollPrice < 0) scrollPrice = 1; | |||
// Get & sanitize quantity | |||
let quantity = parseInt(document.getElementById('quantity').value); | |||
if (isNaN(quantity) || quantity < 1) quantity = 1; | |||
document.querySelectorAll('#aurum-table tbody tr').forEach(row => { | document.querySelectorAll('#aurum-table tbody tr').forEach(row => { | ||
const | const aurumMinorValue = parseInt(row.dataset.aurumMinor); | ||
const | const aurumMajorValue = parseInt(row.dataset.aurumMajor); | ||
const aurumMinor = isNaN(aurumMinorValue) ? 0 : aurumMinorValue - scrollPrice; | |||
const aurumMajor = isNaN(aurumMajorValue) ? 0 : aurumMajorValue - scrollPrice * 3; | |||
const minorTotal = aurumMinor * quantity; | const minorTotal = aurumMinor * quantity; | ||
const majorTotal = aurumMajor * quantity; | const majorTotal = aurumMajor * quantity; |
Revision as of 15:52, 26 June 2025