Melvor Farming Notifier

Plays a ding noise when a crop is ready

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Melvor Farming Notifier
// @version      0.8
// @description  Plays a ding noise when a crop is ready
// @author       Asthereon
// @match        https://*.melvoridle.com/*
// @grant        none
// @namespace http://tampermonkey.net/
// ==/UserScript==

let lastDing = -1;

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
	});
}

function checkForNewGrowth() {
	for (let i = 0; i < newFarmingAreas.length; i++) {
		for (let j = 0; j < newFarmingAreas[i].patches.length; j++) {
			if (newFarmingAreas[i].patches[j].hasGrown) {
				if ((Date.now() - lastDing) >= 60000) {
					lastDing = Date.now();
					notify("Some of your crops are grown");
					ding();
				}
			}
		}
	}
}

function checkForGemGloves() {
	if (glovesTracker[4].remainingActions < 500) {
		notify("Gem glove charges are getting low");
		ding();
	}
}

setInterval(function() {
	checkForNewGrowth();
	checkForGemGloves();
},10000);