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