Shenkuu Lunar Temple Solver

Auto solver

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Shenkuu Lunar Temple Solver
// @namespace    neopets
// @version      1.3
// @description  Auto solver
// @author       EatWoolooAsMutton
// @match        *://www.neopets.com/shenkuu/lunar/?show=puzzle
// @grant        none
// ==/UserScript==

const d = document;
const html = $("html").html();

if (!html.includes("Please try again tomorrow")) {

    const angle = html.match(/angleKreludor=(\d+)/)[1];
    const angleList = [0, 12, 34, 57, 79, 102, 124, 147, 169, 192, 214, 237, 259, 282, 304, 327, 349, 361];

    let answer = null;

    for (var i = 0; i < angleList.length; i++) {
        if (i <= 7) {
            if (angle >= angleList[i] && angle < angleList[i + 1]) {
                console.log(`2nd row, #${i + 1} from left`);
                answer = i + 8;
                break;
            }
        }
        else if (i <= 15) {
            if (angle >= angleList[i] && angle < angleList[i + 1]) {
                console.log(`1st row, #${i - 7} from left`);
                answer = i - 8;
                break;
            }
        }
        else if (i <= 17) {
            console.log("2nd row, #1 from left");
            answer = 8;
            break;
        }
    }

    let $answer = $("input[onclick='this.form.submit();']").eq(answer);
    $answer.parent().css({
        "background-color": "#00ffbf",
        "border-style": "solid",
        "border-color": "#00ff00"
    });

    // selectAnswer(answer);
    //
    // function selectAnswer(num) {
    //     let ans = d.querySelectorAll("input[onclick='this.form.submit();']")[num];
    //     setTimeout(function () {
    //         ans.click();
    //     }, Math.floor(Math.random() * 1000) + 1000);
    // }
}