更新 'mcbbs/vending-machine.user.js'

This commit is contained in:
502647092 2020-12-26 15:25:22 +00:00
parent fda9769ca5
commit e0fa26231a

View File

@ -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)