diff --git a/mcbbs/vending-machine.user.js b/mcbbs/vending-machine.user.js index 1059988..d105682 100644 --- a/mcbbs/vending-machine.user.js +++ b/mcbbs/vending-machine.user.js @@ -1,13 +1,13 @@ // ==UserScript== // @name MCBBS自动售卖机 // @namespace https://miaowoo.cc/ -// @version 0.6 +// @version 0.6.1 // @description 自动售卖道具 // @author MiaoWoo // @match https://www.mcbbs.net/home.php?mod=magic** // @grant none // ==/UserScript== - +/* global jq */ (async function () { let store = window.localStorage const lastOrderKey = 'circlebox:lastorder' @@ -74,6 +74,7 @@ } async function needReplenishment() { let timeoutTask = setTimeout(() => { refresh() }, 120000) + if (stock == 0) { return } let result = await fetch('https://reward.yumc.pw/mcbbs/needReplenishment').then(r => r.json()) if (result.code != 200) { if (++checkTimes > 5) { return refresh() } @@ -175,7 +176,7 @@ let count = 0 let result = await fetch('https://reward.yumc.pw/mcbbs/needSendOrder').then(r => r.json()) if (result.code != 200) { - if (++checkTimes > 5 || back) { + if (++checkTimes > 5 || back || stock < 30) { refresh() } clearTimeout(timeoutTask)