// ==UserScript== // @name StarrFantasyEnhanced // @name:zh-CN StarrFantasyEnhanced // @namespace rusyue@live.com // @author rusyue // @icon https://rusyue.com/images/avatar.png // @description Let all skill slots automated... // @description:zh-cn 让所有技能都能自动使用 // @include *://www.starrfantasy.com/* // @version 1.0.0 // @grant none // @run-at document-end // @downloadURL none // ==/UserScript== (async function() { 'use strict'; try { let message = await gameLoading(); let hotbarItems = document.querySelectorAll('.hotbarItemOuter'); console.log(message); hotbarItems.forEach((el, idx) => { /[2-9]/.test(idx) && el.classList.add('autobattleSlot'); }); } catch (err) { console.log(err); } }()); function gameLoading() { return new Promise((resolve, reject) => { let loading = document.querySelector('#loadingOverlay'); let times = 1; let timer = setInterval(() => { if (loading !== null) { loading = document.querySelector('#loadingOverlay'); console.log(`StarrFantasyEnhanced: Game loading... | Retrying: ${times} | Time: ${new Date().toLocaleTimeString()}`); if (times++ > 19) { clearInterval(timer); return reject('StarrFantasyEnhanced: Game failed to load, please try again later.'); } } else { clearInterval(timer); return resolve('StarrFantasyEnhanced: Game loading completed!'); } }, 6000); }); }