您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Calculates real NoRNG profit and exp gain for MWI battle emulator.
当前为
// ==UserScript== // @name Real Profit Calculator // @namespace http://tampermonkey.net/ // @version 1.3 // @description Calculates real NoRNG profit and exp gain for MWI battle emulator. // @author guch8017 // @match https://shykai.github.io/MWICombatSimulatorTest/dist/ // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_getValue // @license MIT // ==/UserScript== (function () { 'use strict'; let realExpGainDiv = null; GM_registerMenuCommand("设置社区掉落增益", async function () { const currentRate = await GM_getValue('buffRate', 1.295); const input = prompt("Enter new Buff Rate:", currentRate); if (input !== null) { const parsed = parseFloat(input); if (!isNaN(parsed) && parsed > 0) { await GM_setValue('buffRate', parsed); alert(`Buff rate set to ${parsed}. Reload the page to see changes.`); } else { alert("Invalid input. Please enter a positive number."); } } }); GM_registerMenuCommand("设置社区经验增益", async function () { const currentRate = await GM_getValue('expBuffRate', 0.295); const input = prompt("Enter new Exp Buff Rate:", currentRate); if (input !== null) { const parsed = parseFloat(input); if (!isNaN(parsed) && parsed > 0) { await GM_setValue('expBuffRate', parsed); alert(`Exp rate set to ${parsed}. Reload the page to see changes.`); } else { alert("Invalid input. Please enter a positive number."); } } }); const eliteMapExpBonus = { "/actions/combat/smelly_planet_elite": 0.1, "/actions/combat/swamp_planet_elite": 0.1, "/actions/combat/aqua_planet_elite": 0.1, "/actions/combat/jungle_planet_elite": 0.1, "/actions/combat/gobo_planet_elite": 0.15, "/actions/combat/planet_of_the_eyes_elite": 0.15, "/actions/combat/sorcerers_tower_elite": 0.15, "/actions/combat/bear_with_it_elite": 0.15, "/actions/combat/golem_cave_elite": 0.2, "/actions/combat/twilight_zone_elite": 0.2, "/actions/combat/infernal_abyss_elite": 0.2, } const enhancementLevelTotalMultiplierTable = [0, 1, 2.1, 3.3, 4.6, 6, 7.5, 9.1, 10.8, 12.600000000000001, 14.500000000000002, 16.5, 18.6, 20.8, 23.1, 25.5, 28, 30.6, 33.300000000000004, 36.1, 39]; // function waitForElement(selector, callback) { // const observer = new MutationObserver(() => { // const el = document.querySelector(selector); // if (el) { // observer.disconnect(); // callback(el); // } // }); // observer.observe(document.body, { childList: true, subtree: true }); // } function parseNumber(text) { const numericText = text.replace(/[^\d.,\-]/g, '').replace(/,/g, ''); return parseFloat(numericText); } function getDrinkConcentration(level) { return 0.1 + 0.002 * (enhancementLevelTotalMultiplierTable[level] || 0); } function getWisdomNeckBonus(level) { return 0.03 + 0.003 * (enhancementLevelTotalMultiplierTable[level] || 0); } async function calculateProfit() { const expenseText = document.getElementById('script_expense')?.textContent || ''; const noRngProfitText = document.getElementById('noRngProfitPreview')?.textContent || ''; const expense = parseNumber(expenseText); const noRngProfit = parseNumber(noRngProfitText); const buffRate = await GM_getValue('buffRate', 1.295); if (!isNaN(expense) && !isNaN(noRngProfit)) { const realProfit = ((noRngProfit + expense) * 1.295) - expense; const formattedProfit = realProfit.toLocaleString(undefined, { maximumFractionDigits: 3 }); const existingDiv = document.getElementById('realProfitDisplay'); if (existingDiv) { existingDiv.textContent = `实际期望利润: ${formattedProfit}`; return; } const displayDiv = document.createElement('div'); displayDiv.id = 'realProfitDisplay'; displayDiv.style.backgroundColor = '#FFD700'; displayDiv.style.color = 'black'; displayDiv.style.fontWeight = 'bold'; displayDiv.style.padding = '4px'; displayDiv.textContent = `实际期望利润: ${formattedProfit}`; const targetDiv = document.getElementById('noRngProfitPreview').parentElement.parentElement; targetDiv.parentNode.insertBefore(displayDiv, targetDiv.nextSibling); } } function addRealExpBlock() { // "<div class="row"><b data-i18n="common:simulationResults.xpPerHour">每小时经验值</b></div>" let realExpTitle = document.createElement('div'); realExpTitle.className = "row"; realExpTitle.innerHTML = "<b>实际每小时经验值</b>"; // <div id="simulationResultExperienceGain" class="mb-2" style="background-color: rgb(205, 255, 221); color: black;"><div class="row"><div class="col-md-6" data-i18n="common:total">合计</div><div class="col-md-6 text-end">2299</div></div><div class="row"><div class="col-md-6" data-i18n="leaderboardCategoryNames.stamina">耐力</div><div class="col-md-6 text-end">448</div></div><div class="row"><div class="col-md-6" data-i18n="leaderboardCategoryNames.attack">攻击</div><div class="col-md-6 text-end">655</div></div><div class="row"><div class="col-md-6" data-i18n="leaderboardCategoryNames.power">力量</div><div class="col-md-6 text-end">655</div></div><div class="row"><div class="col-md-6" data-i18n="leaderboardCategoryNames.defense">防御</div><div class="col-md-6 text-end">541</div></div></div> let realExpDiv = document.createElement('div'); realExpDiv.id = "simulationResultExperienceGainReal"; realExpDiv.className = "mb-2"; realExpDiv.style.backgroundColor = "rgb(205, 255, 221)"; realExpDiv.style.color = "black"; realExpGainDiv = realExpDiv; const targetDiv = document.getElementById('simulationResultExperienceGain'); targetDiv.parentNode.insertBefore(realExpDiv, targetDiv.nextSibling); targetDiv.parentNode.insertBefore(realExpTitle, targetDiv.nextSibling); } function clearRealExp() { const simulationResultExperienceGain = document.getElementById('simulationResultExperienceGainReal'); if (simulationResultExperienceGain) { simulationResultExperienceGain.innerHTML = ""; } } function addRealExp(key, value) { const simulationResultExperienceGain = document.getElementById('simulationResultExperienceGainReal'); if (simulationResultExperienceGain) { const row = document.createElement('div'); row.className = "row"; const col1 = document.createElement('div'); col1.className = "col-md-6"; col1.textContent = key; const col2 = document.createElement('div'); col2.className = "col-md-6 text-end"; col2.textContent = value; row.appendChild(col1); row.appendChild(col2); simulationResultExperienceGain.appendChild(row); } } async function calculateExp() { let expBonus = 0; // 判断精英地图加成 const mapSelected = document.querySelector("#selectZone").value; const isEliteMap = mapSelected.includes("elite"); if (isEliteMap) { let mapBonus = eliteMapExpBonus[mapSelected]; if (mapBonus === undefined) { console.error(`No bonus found for elite map: ${mapSelected}`); } else { expBonus = mapBonus; } } // 判断咖啡加成,同时计算暴饮带来的额外增益 let coffeeBonus = 0; for (let drinkId = 0; drinkId < 3; drinkId++) { const drink = document.querySelector(`#selectDrink_${drinkId}`); if (drink && drink.value === "/items/wisdom_coffee") { coffeeBonus += 0.12; } } const pouchSel = document.querySelector("#selectEquipment_pouch"); if (pouchSel && pouchSel.value === "/items/guzzling_pouch") { const pouchEnhanceLv = Number.parseInt(document.querySelector("#inputEquipmentEnhancementLevel_pouch").value) || 0; const pouchConcentration = getDrinkConcentration(pouchEnhanceLv); coffeeBonus *= pouchConcentration; } expBonus += coffeeBonus; // 判断经验项链加成 if (document.querySelector("#selectEquipment_neck").value === "/items/necklace_of_wisdom") { const neckEnhanceLv = Number.parseInt(document.querySelector("#inputEquipmentEnhancementLevel_neck").value) || 0; expBonus += getWisdomNeckBonus(neckEnhanceLv); } // 判断房屋加成 let houseTotalLv = 0; for (const houseLv of document.querySelectorAll('input[data-house-hrid]')) { houseTotalLv += Number.parseInt(houseLv.value) || 0; } expBonus += houseTotalLv * 0.0005; // 读取经验值 const expRateBonus = await GM_getValue('expBuffRate', 0.295); clearRealExp(); for (let node of document.querySelector("#simulationResultExperienceGain").childNodes) { let node0 = node.childNodes[1]; let expCurrent = Number.parseInt(node0.innerText); let expNew = Math.floor(expCurrent / (1 + expBonus) * (1 + expBonus + expRateBonus)); addRealExp(node.childNodes[0].innerText, expNew); } } const obConfig = {characterData: true, subtree: true, childList: true}; const ProfitNode = document.getElementById('noRngProfitPreview'); const ExpNode = document.getElementById('simulationResultExperienceGain'); addRealExpBlock(); new MutationObserver(() => {calculateProfit();}).observe(ProfitNode, obConfig); const expObserver = new MutationObserver(() => { calculateExp(); }); expObserver.observe(ExpNode, obConfig) })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址