您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows time remaining for completing a task with your current resources. Takes into account Mastery Levels and other bonuses.
当前为
// ==UserScript== // @name Melvor TimeRemaining // @namespace http://tampermonkey.net/ // @version 0.1.1 // @description Shows time remaining for completing a task with your current resources. Takes into account Mastery Levels and other bonuses. // @author Breindahl#2660 // @match https://*.melvoridle.com/* // @grant none // ==/UserScript== function ding() { new Audio("https://www.myinstants.com/media/sounds/ding-sound-effect.mp3").play(); } function notify(msg) { One.helpers('notify', { type: 'dark', from: 'bottom', align: 'center', message: msg }); } document.getElementById("smith-item-have").outerHTML += "<br><small id =\"timeLeft\">"+""+"<small>"; console.log('Loading Breindahl TimeRemaining'); function timeRemaining(){ // Define Selected Item item = smithingItems[selectedSmith].itemID; //Funtion to get unformatted number for SmithQty function getSmithQtyUnformat(itemID) { let qty = 0; for (let i = 0; i < bank.length; i++) { if (bank[i].id === itemID) { qty += bank[i].qty; } } return qty; } // Reset variable var itemCraft = [] var recordCraft = Infinity; var smithingMasteryLevel = smithingMastery[smithingItems[selectedSmith].smithingID].mastery; var chanceToKeep = 0; if (smithingMasteryLevel >= 80) { chanceToKeep = 40; } else if (smithingMasteryLevel >= 60) { chanceToKeep = 30; } else if (smithingMasteryLevel >= 40) { chanceToKeep = 20; } else if (smithingMasteryLevel >= 20) { chanceToKeep = 10; } //console.log('Chance to preserve resource: '+chanceToKeep); // Get Item Requirements and Current Requirements for (let i = 0; i < items[item].smithReq.length; i++) { if (equippedItems[CONSTANTS.equipmentSlot.Cape] === CONSTANTS.item.Smithing_Skillcape && items[item].smithReq[i].id == 48) { itemReq = Math.floor(items[item].smithReq[i].qty / 2) } else { itemReq = items[item].smithReq[i].qty; } //console.log('ItemReq: '+itemReq); itemQty = getSmithQtyUnformat(items[item].smithReq[i].id); //console.log('ItemQty['+items[item].smithReq[i].id+']: '+itemQty); // Calculate max items you can craft for each itemReq itemCraft[i] = Math.floor(itemQty/itemReq); //console.log('ItemCraft: '+itemCraft[i]); //console.log('Old Record: '+recordCraft) // Calculate limiting factor and set new record if(itemCraft[i] < recordCraft) { recordCraft = itemCraft[i]; //console.log('New Record: '+recordCraft) }; }; window.timeLeftLast = window.timeLeftGlobal; //Calculate time var timeLeft = Math.floor(recordCraft * smithInterval / 1000 /(1-chanceToKeep/100)); window.timeLeftGlobal = timeLeft; //Convert seconds to hours/minutes/seconds function secondsToHms(d) { d = Number(d); var h = Math.floor(d / 3600); var m = Math.floor(d % 3600 / 60); var s = Math.floor(d % 3600 % 60); var sDisplay = s > 0 ? s + (s == 1 ? " second" : " seconds") : ""; var mDisplay = m > 0 ? m + (m == 1 ? " minute" : " minutes") + (s == "" ? "" : ", ") : ""; var hDisplay = h > 0 ? h + (h == 1 ? " hour" : " hours") + ((s == "" && m == "") ? "" : ", ") : ""; return hDisplay + mDisplay + sDisplay; }; //Inject HTML elementToChange = document.getElementById("timeLeft"); if (timeLeft !== 0) { if(elementToChange !== null) { elementToChange.innerHTML = secondsToHms(timeLeft) + " remaining"; }; } else { if(elementToChange !== null) { elementToChange.innerHTML = secondsToHms(timeLeft) + ""; }; }; }; var tempFunc = startSmithing; window.startSmithing = function() { tempFunc(true); timeRemaining(); if (window.timeLeftLast > 1 && window.timeLeftGlobal == 0) { notify("Task Done"); console.log('task done'); ding(); }; console.log('timeLeftLast'+window.timeLeftLast); console.log('timeLeftGlobal'+window.timeLeftGlobal); }; var tempFunc2 = selectSmith; window.selectSmith = function(smithingID) { tempFunc2(smithingID); timeRemaining(); };
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址