吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1258|回复: 10
收起左侧

[其他原创] 色差检验趣味小游戏作弊脚本

  [复制链接]
YWQ8 发表于 2023-11-23 17:00
本帖最后由 YWQ8 于 2023-11-25 01:17 编辑

游戏网页:https://www.webhek.com/post/color-test/
朋友在玩这个小游戏,看到颜色块是单独的标签,所以很容易可以作弊让分数超过他,写了这个js脚本。
用油猴安装,安装后网页上出现三个按钮,对应三种作弊模式。
原理比较简单,遍历所有标签,找到rgb值不同的块即可。
[JavaScript] 纯文本查看 复制代码
// ==UserScript==
// @name         染色
// @namespace    *://www.webhek.com/post/color-test/
// @version      0.1
// @description  try to take over the world!
// @AuThor       YWQ
// @match        *://www.webhek.com/post/color-test/
// @Icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
function yyy()
{
    setTimeout(yyy,100);
    var ans;
    for(var i=1;i<=3;i++){
        var a=document.querySelector("#box > span:nth-child("+i+")").style.backgroundColor;
        var b=document.querySelector("#box > span:nth-child("+(i+1)+")").style.backgroundColor
        if(a==b)
        {
            ans=a;
            break;
        }
    }
    var res=1;
    while(document.querySelector("#box > span:nth-child("+res+")").style.backgroundColor==ans)res++;
    document.querySelector("#box > span:nth-child("+res+")").click();
}
function yao()
{
    setTimeout(yao,100);
    ywq();
}
function ywq(){
    //setTimeout(ywq,100);
    var ans;
    for(var i=1;i<=3;i++){
        var a=document.querySelector("#box > span:nth-child("+i+")").style.backgroundColor;
        var b=document.querySelector("#box > span:nth-child("+(i+1)+")").style.backgroundColor
        if(a==b)
        {
            ans=a;
            break;
        }
    }
    var res=1;
    while(document.querySelector("#box > span:nth-child("+res+")").style.backgroundColor==ans)res++;
    document.querySelector("#box > span:nth-child("+res+")").style.backgroundColor='rgb(255,255,255)';
}
  // 添加按钮
document.querySelector("#overlay99").remove();//去广告
  var btn = document.createElement('button');

  btn.innerHTML = '单次提示';
    btn.style.position = 'fixed';
    btn.style.top = '50';
    btn.style.left = '570';
    btn.style.zIndex = '9999';

  btn.addEventListener('click', function() {
  // 在这里编写按钮点击后的操作
  ywq();
});
  document.body.appendChild(btn);

    var btn1 = document.createElement('button');
    btn1.innerHTML = '连续模式';
    btn1.style.position = 'fixed';
    btn1.style.top = '50';
    btn1.style.left = '500';
    btn1.style.zIndex = '9999';
  btn1.addEventListener('click', function() {
  // 在这里编写按钮点击后的操作
  yao();
});
  document.body.appendChild(btn1);

    let wx=document.createElement('span');
    wx.innerHTML='妖_';
    wx.style.position = 'fixed';
    wx.style.top = '50';
    wx.style.left = '450';
    wx.style.zIndex = '9999';
    document.body.appendChild(wx);


    var btn2 = document.createElement('button');
    btn2.innerHTML = '疯狂模式';
    btn2.style.position = 'fixed';
    btn2.style.top = '75';
    btn2.style.left = '500';
    btn2.style.zIndex = '9999';
  btn2.addEventListener('click', function() {
  // 在这里编写按钮点击后的操作
  yyy();
});
  document.body.appendChild(btn2);
})();

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

Hmily 发表于 2023-11-23 17:08
这不是JS吗?你选java原创分类?
闷骚小贱男 发表于 2023-11-23 19:12
pjy612 发表于 2023-11-23 17:50
mcby 发表于 2023-11-23 18:41
手机,电脑都可以么?
hygzs 发表于 2023-11-23 20:41
挺好玩的写了一个
[JavaScript] 纯文本查看 复制代码
setInterval(function () {
    let boxa = document.getElementById("box");
    let spanList = boxa.querySelectorAll("span");
    let newColor = "";
    if (
        spanList[0].style.backgroundColor !=
            spanList[1].style.backgroundColor &&
        spanList[1].style.backgroundColor == spanList[2].style.backgroundColor
    ) {
        spanList[0].click();
    } else {
        spanList.forEach((e, v) => {
            if (newColor == "") {
                newColor = e.style.backgroundColor;
            } else {
                e.click();
            }
        });
    }
}, 1);
头像被屏蔽
moruye 发表于 2023-11-23 20:47
提示: 作者被禁止或删除 内容自动屏蔽
zbking1314 发表于 2023-11-24 08:03
人才呀,这都可以
cn005897 发表于 2023-11-24 08:25
本帖最后由 cn005897 于 2023-11-24 08:26 编辑

[JavaScript] 纯文本查看 复制代码
function checkAndClickUniqueColor() {
    const box = document.getElementById('box');
    const spans = box.getElementsByTagName('span');
    const colorCounts = {};

    for (let span of spans) {
        const color = span.style.backgroundColor;
        colorCounts[color] = (colorCounts[color] || 0) + 1;
    }

    const uniqueColor = Object.keys(colorCounts).find(color => colorCounts[color] === 1);

    if (uniqueColor) {
        for (let span of spans) {
            if (span.style.backgroundColor === uniqueColor) {
                span.click(); // 执行点击操作
                break;
            }
        }
    }
}

setInterval(checkAndClickUniqueColor, 1); 

陌小全 发表于 2023-11-24 15:26
色弱人士表示只过了24关
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-2 04:33

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表