rendered paste body// ==UserScript==// @name HentaiVerse Legendary Upgrade Calculator// @namespace http://tampermonkey.net/// @version 1.5// @description Calculate Legendary equipment upgrade cost using HVUT material prices.// @author Gemini, Codex// @match *://hentaiverse.org/isekai/*// @match *://hentaiverse.org/*// @grant none// ==/UserScript==(function() { 'use strict'; const urlParams = new URLSearchParams(window.location.search); if (urlParams.get('s') !== 'Bazaar' || urlParams.get('ss') !== 'am') { return; } const upgradeData = [ { level: 1, mid: 100, high: 5, rare: 1, core: 1, creds: 25000 }, { level: 2, mid: 100, high: 10, rare: 1, core: 1, creds: 25000 }, { level: 3, mid: 100, high: 15, rare: 1, core: 1, creds: 25000 }, { level: 4, mid: 100, high: 20, rare: 1, core: 1, creds: 25000 }, { level: 5, mid: 100, high: 25, rare: 1, core: 1, creds: 25000 }, { level: 6, mid: 100, high: 30, rare: 2, core: 2, creds: 25000 }, { level: 7, mid: 100, high: 35, rare: 2, core: 2, creds: 25000 }, { level: 8, mid: 100, high: 40, rare: 2, core: 2, creds: 25000 }, { level: 9, mid: 100, high: 45, rare: 2, core: 2, creds: 25000 }, { level: 10, mid: 100, high: 50, rare: 2, core: 2, creds: 25000 }, { level: 11, mid: 100, high: 50, rare: 3, core: 3, creds: 50000 }, { level: 12, mid: 100, high: 50, rare: 3, core: 3, creds: 50000 }, { level: 13, mid: 100, high: 50, rare: 3, core: 3, creds: 50000 }, { level: 14, mid: 100, high: 50, rare: 3, core: 3, creds: 50000 }, { level: 15, mid: 100, high: 50, rare: 3, core: 3, creds: 50000 }, { level: 16, mid: 100, high: 50, rare: 4, core: 4, creds: 50000 }, { level: 17, mid: 100, high: 50, rare: 4, core: 4, creds: 50000 }, { level: 18, mid: 100, high: 50, rare: 4, core: 4, creds: 50000 }, { level: 19, mid: 100, high: 50, rare: 4, core: 4, creds: 50000 }, { level: 20, mid: 100, high: 50, rare: 4, core: 4, creds: 50000 }, { level: 21, mid: 100, high: 50, rare: 5, core: 5, creds: 100000 }, { level: 22, mid: 100, high: 50, rare: 5, core: 5, creds: 100000 }, { level: 23, mid: 100, high: 50, rare: 5, core: 5, creds: 100000 }, { level: 24, mid: 100, high: 50, rare: 5, core: 5, creds: 100000 }, { level: 25, mid: 100, high: 50, rare: 5, core: 5, creds: 100000 } ]; const materialTypes = [ { value: 'Cloth', label: 'Cloth' }, { value: 'Leather', label: 'Leather' }, { value: 'Metals', label: 'Metals' }, { value: 'Wood', label: 'Wood' } ]; const rareMaterials = [ { value: '', label: 'None' }, { value: 'Crystallized Phazon', label: 'Crystallized Phazon' }, { value: 'Shade Fragment', label: 'Shade Fragment' }, { value: 'Repurposed Actuator', label: 'Repurposed Actuator' }, { value: 'Defense Matrix Modulator', label: 'Defense Matrix Modulator' } ]; const coreTypes = [ { value: 'Legendary Weapon Core', label: 'Legendary Weapon Core' }, { value: 'Legendary Staff Core', label: 'Legendary Staff Core' }, { value: 'Legendary Armor Core', label: 'Legendary Armor Core' } ]; function readHvutPrices() { const key = location.pathname.startsWith('/isekai/') ? 'hvuti_prices' : 'hvut_prices'; const fallbackKey = key === 'hvut_prices' ? 'hvuti_prices' : 'hvut_prices'; for (const storageKey of [key, fallbackKey]) { try { const value = localStorage.getItem(storageKey); if (value) { return { prices: JSON.parse(value), key: storageKey }; } } catch (error) { console.warn('Failed to read HVUT prices:', storageKey, error); } } return { prices: {}, key: '' }; } function priceOf(prices, itemName) { if (!itemName) { return 0; } const price = Number(prices[itemName]); return Number.isFinite(price) ? price : 0; } function formatCredits(value) { return Math.ceil(value).toLocaleString(); } function buildOptions(items) { return items.map((item) => `<option value="${item.value}">${item.label}</option>`).join(''); } const style = document.createElement('style'); style.textContent = ` #hv-upgrade-calc { position: fixed; bottom: 20px; right: 20px; width: 340px; background: #fdfdfd; border: 2px solid #333; border-radius: 8px; padding: 15px; box-shadow: 0 4px 6px rgba(0,0,0,0.3); font-family: Arial, sans-serif; font-size: 14px; z-index: 999999; color: #333; } #hv-upgrade-calc h3 { margin: 0 0 10px 0; font-size: 16px; text-align: center; border-bottom: 1px solid #ccc; padding-bottom: 5px; } .hv-calc-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; align-items: center; } .hv-calc-row label { flex: 1; } .hv-calc-row input, .hv-calc-row select { width: 155px; box-sizing: border-box; padding: 2px 5px; border: 1px solid #aaa; border-radius: 4px; background: #fff; color: #333; } .hv-calc-row input[readonly] { background: #eee; } #hv-calc-btn { width: 100%; padding: 8px; margin-top: 10px; background: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; } #hv-calc-summary { margin-top: 10px; font-size: 12px; color: #555; background: #f0f0f0; padding: 5px; border-radius: 4px; text-align: center; display: none; line-height: 1.45; } #hv-calc-result { margin-top: 10px; font-weight: bold; text-align: center; color: #d32f2f; font-size: 16px; } #hv-calc-price-source { margin-top: 6px; font-size: 11px; text-align: center; color: #666; } `; document.head.appendChild(style); const panel = document.createElement('div'); panel.id = 'hv-upgrade-calc'; panel.innerHTML = ` <h3>Legendary 升级计算器</h3> <div class="hv-calc-row"><label>当前等级 (0-24):</label><input type="number" id="hv-curr-lvl" value="0" min="0" max="24"></div> <div class="hv-calc-row"><label>目标等级 (1-25):</label><input type="number" id="hv-target-lvl" value="25" min="1" max="25"></div> <div class="hv-calc-row"><label>材料类型:</label><select id="hv-material-type">${buildOptions(materialTypes)}</select></div> <div class="hv-calc-row"><label>Mid Grade 单价:</label><input type="number" id="hv-price-mid" value="0" readonly></div> <div class="hv-calc-row"><label>High Grade 单价:</label><input type="number" id="hv-price-high" value="0" readonly></div> <div class="hv-calc-row"><label>Rare 材料:</label><select id="hv-rare-material">${buildOptions(rareMaterials)}</select></div> <div class="hv-calc-row"><label>Rare 单价:</label><input type="number" id="hv-price-rare" value="0" readonly></div> <div class="hv-calc-row"><label>Legendary Core:</label><select id="hv-core-type">${buildOptions(coreTypes)}</select></div> <div class="hv-calc-row"><label>Core 单价:</label><input type="number" id="hv-price-core" value="0" readonly></div> <button id="hv-calc-btn">计算总消耗</button> <div id="hv-calc-summary"></div> <div id="hv-calc-result">等待计算...</div> <div id="hv-calc-price-source"></div> `; document.body.appendChild(panel); let hvutPriceState = readHvutPrices(); function refreshPrices() { hvutPriceState = readHvutPrices(); const prices = hvutPriceState.prices; const materialType = document.getElementById('hv-material-type').value; const rareMaterial = document.getElementById('hv-rare-material').value; const coreType = document.getElementById('hv-core-type').value; document.getElementById('hv-price-mid').value = priceOf(prices, `Mid-Grade ${materialType}`); document.getElementById('hv-price-high').value = priceOf(prices, `High-Grade ${materialType}`); document.getElementById('hv-price-rare').value = priceOf(prices, rareMaterial); document.getElementById('hv-price-core').value = priceOf(prices, coreType); document.getElementById('hv-calc-price-source').textContent = hvutPriceState.key ? `价格来源: HVUT ${hvutPriceState.key}` : '未找到 HVUT 价格,单价按 0 计算'; } function calculate() { refreshPrices(); const currLvl = parseInt(document.getElementById('hv-curr-lvl').value, 10) || 0; const targetLvl = parseInt(document.getElementById('hv-target-lvl').value, 10) || 0; const materialType = document.getElementById('hv-material-type').value; const rareMaterial = document.getElementById('hv-rare-material').value; const coreType = document.getElementById('hv-core-type').value; const priceMid = parseFloat(document.getElementById('hv-price-mid').value) || 0; const priceHigh = parseFloat(document.getElementById('hv-price-high').value) || 0; const priceRare = parseFloat(document.getElementById('hv-price-rare').value) || 0; const priceCore = parseFloat(document.getElementById('hv-price-core').value) || 0; if (currLvl >= targetLvl || targetLvl > 25 || currLvl < 0) { document.getElementById('hv-calc-result').textContent = '等级范围错误'; return; } let totalMid = 0; let totalHigh = 0; let totalRare = 0; let totalCore = 0; let baseCredits = 0; for (let i = currLvl; i < targetLvl; i++) { const data = upgradeData[i]; totalMid += data.mid; totalHigh += data.high; totalRare += data.rare; totalCore += data.core; baseCredits += data.creds; } const materialCredits = (totalMid * priceMid) + (totalHigh * priceHigh) + (totalRare * priceRare) + (totalCore * priceCore); const totalCredits = baseCredits + materialCredits; const summary = document.getElementById('hv-calc-summary'); summary.style.display = 'block'; summary.innerHTML = [ '<strong>材料需求</strong>', `${totalMid} Mid-Grade ${materialType} @ ${formatCredits(priceMid)}c`, `${totalHigh} High-Grade ${materialType} @ ${formatCredits(priceHigh)}c`, `${totalRare} ${rareMaterial} @ ${formatCredits(priceRare)}c`, `${totalCore} ${coreType} @ ${formatCredits(priceCore)}c`, `基础 Credits: ${formatCredits(baseCredits)}` ].join('<br>'); document.getElementById('hv-calc-result').textContent = `总需 Credits: ${formatCredits(totalCredits)}`; } document.getElementById('hv-material-type').addEventListener('change', calculate); document.getElementById('hv-rare-material').addEventListener('change', calculate); document.getElementById('hv-core-type').addEventListener('change', calculate); document.getElementById('hv-calc-btn').addEventListener('click', calculate); refreshPrices();})();