Skip to content

写了一个解放双手的脚本 #1

@zhangkuibao

Description

@zhangkuibao

非常感谢老铁的游戏,给我的摸鱼时光增加了很多乐趣,在度过前期的探索后,后期只是一味的进行重构,操作过于机械。

写了一个油猴脚本,实现真·自动重构,解放双手^-^

享受纯粹的数值增长的快乐~

// ==UserScript==
// @name         code-deity
// @namespace    http://tampermonkey.net/
// @version      2025-10-13
// @description  try to take over the world!
// @author       You
// @match        https://code-deity.stormlee.asia/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=stormlee.asia
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let lastRPDate = new Date();

    function calcMinRp(v) {
        const cost = 10 * Math.pow(v + 1, 2);

        return cost * (v + 6);
    }

    function autoRP() {
        try {
            // 关闭返回弹窗
            if(document.querySelectorAll('button')[26]) {
                document.querySelectorAll('button')[26].click()
            }
            // 跳转到重构
            document.querySelectorAll('h2')[3].nextElementSibling.nextElementSibling.click()

            setTimeout(() => {

                // 版本
                const version = Number(document.querySelector('.grid').children[2].children[1].textContent)

                // 当前RP
                const RP = Number((document.querySelector('.grid').children[1].children[1].textContent).replace(/\D/, ''))

                // 点数大于等于30时重构
                // if(Number(document.querySelector('h1').textContent) >= 20) {
                if(true) {
                    document.querySelector('main').querySelectorAll('button')[14].click()

                    setTimeout(() => {
                        // 确认重构
                        document.querySelectorAll('button')[19].click()

                        console.log(`${lastRPDate.toLocaleString()},耗时:${((new Date()).getTime() - lastRPDate.getTime()) / 1000}s,当前版本:${version},当前RP:${RP},下版本所需RP:${calcMinRp(version)}`)

                        lastRPDate = new Date();

                    }, 500)
                }

            }, 500)

        } catch(e) {}


        setTimeout(autoRP, 5000)
    }
    setTimeout(autoRP, 5000)
    // Your code here...
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions