diff --git a/mcbbs/vending-machine.user.js b/mcbbs/vending-machine.user.js index 1b2b267..698f7b4 100644 --- a/mcbbs/vending-machine.user.js +++ b/mcbbs/vending-machine.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name MCBBS自动售卖机 // @namespace https://miaowoo.cc/ -// @version 0.6.3 +// @version 0.7.0 // @description 自动售卖道具 // @author MiaoWoo // @match https://www.mcbbs.net/home.php?mod=magic** @@ -101,7 +101,12 @@ sendItem(() => window.showWindow('magics', 'home.php?mod=magic&action=mybox&operation=give&magicid=32', 'get', 0), masterInfo.username, masterInfo.amount || stock) } async function refresh() { - location.href = '/home.php?mod=magic&action=mybox&nodeType=' + params.nodeType + try { + await fetch('/api/mobile/index.php?version=4&module=credit') + location.href = '/home.php?mod=magic&action=mybox&nodeType=' + params.nodeType + } catch (error) { + setTimeout(refresh, 5000) + } } async function shopAction() { await sendOrderAction(() => window.showWindow('magics', 'home.php?mod=magic&action=shop&operation=give&mid=mcbbs_mcserver_plus:serverBump'), true)