您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Calculates how lucky you are with your drops.
当前为
// ==UserScript== // @name IdlePixel Lucky // @namespace com.missnobody.idlepixel.lucky // @version 1.0.23 // @description Calculates how lucky you are with your drops. // @author MissNobody // @license MIT // @match *://idle-pixel.com/login/play* // @grant none // @require https://gf.qytechs.cn/scripts/441206-idlepixel/code/IdlePixel+.js // ==/UserScript== (function() { 'use strict'; let loaded = false; let hooked = false; class LuckyPlugin extends IdlePixelPlusPlugin { constructor() { super("Lucky", { about: { name: GM_info.script.name, version: GM_info.script.version, author: GM_info.script.author, description: GM_info.script.description } }); } solveForB(N) { let b = -0.01; let precision = 0.0001; let maxIterations = 100; let delta; let iteration = 0; do { let f = 2 * Math.exp(b * N) - 1; let df = 2 * N * Math.exp(b * N); if (Math.abs(df) < 1e-6) return -2.0; delta = -f / df; b += delta; if (++iteration > maxIterations) return b; } while (Math.abs(delta) > precision); return b; } luckFactor(n, N) { let b = this.solveForB(N); return 2 * Math.exp(b * n) - 1; } updateCombat() { try { let table = $('.combat-log-table'); let header = table.find('th:contains("Luck")'); let rows = table.find("tr"); let column; console.log('Table: ' + table + ', Header: ' + header + ', Rows: ' + rows); if (header.length <= 0) { console.log('Header missing'); column = rows.first().children().length; console.log('Column: ' + column); rows.first().append('<th style="background-color:#DEDEED;padding:10px;text-align:center;">Luck</th>'); console.log('Appended header'); } else { console.log('Header found'); column = header.parent().children().index(header); header.text("0.0"); } console.log('Processing rows: ' + rows.length); $.each(rows, function(index, row) { if (index > 0) { console.log('Row #' + index); let columns = row.children(); let amount = columns[2].text(); let chance = columns[3].text(); let probability = chance === "Always" ? 1 : chance; let factor = this.luckFactor(amount, probability); console.log(' - columns: ' + columns.length + ', amount: ' + amount + ', chance: ' + chance + ', probability: ' + probability); if (column >= columns.length) { row.append('<td>' + factor + '</td>'); } else { columns[column].text(factor); } } else { console.log('Row #' + index + ' skipped'); } }); } catch (error) { console.error(error); } } hookCombat(update) { let buttons = $('.combat-log-table-new tr td:nth-child(6) button'); console.log('Hooking combat log events: ' + buttons.length); buttons.on('click', update); hooked = true; } onLogin() { loaded = true; } onVariableSet(key, before, after) { if (!loaded) return; if (before != after) { // this.updateCombat(); } } onCombatEnd() { this.updateCombat(); } onPanelChanged(before, after) { if (before != after) { if (!hooked && after === 'combat-log') { hooked = true; this.hookCombat(this.updateCombat); } } } } const plugin = new LuckyPlugin(); IdlePixelPlus.registerPlugin(plugin); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址