PP Bot Example

Bot Exampe

目前為 2023-08-16 提交的版本,檢視 最新版本

// ==UserScript==
// @name         PP Bot Example
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Bot Exampe
// @author       Bambi1
// @match        https://pixelplace.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=pixelplace.io
// @run-at       document-start
// @grant        none
// @license MIT
// ==/UserScript==

function fix(a, b) {
    Object.defineProperty(window.console, a, {configurable:false,enumerable:true,writable:false,value:b});
}

fix('log', console.log);
fix('warn', console.warn);
fix('error', console.error);
fix('info', console.info);
const originalWebSocket = window.WebSocket;
var socket;

class WebSocketHook extends originalWebSocket {
    constructor(a, b) {
        super(a, b);
        socket = this;
    }
}

window.WebSocket = WebSocketHook;


function placePix(x, y, col) {
    socket.send(`42["p",[${x},${y},${col},1]]`);
}


function startingPos(x, y){
var three = 3;
var four = 4;
placePix(x , y)
placePix(x+1, y+1)
placePix(x+2, y+2)
placePix(x+four,y+three)
}


document.addEventListener('keydown', function(event) {
    // Check if the pressed key is 'j'
    if (event.key === 'j') {
        // Get the element with the id "coordinates"
        var coordinatesElement = document.getElementById('coordinates');
        var coordinatesValue = coordinatesElement.textContent;
        // Split the coordinates value into x and y parts
        var [x, y] = coordinatesValue.split(',');
        //send the coordinates as integers
        startingPos(parseInt(x), parseInt(y));
    }
});

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址