nonogamer9

my swiss knife for bonziworld servers

Mar 28th, 2025 (edited)
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 10.29 KB | Software | 0 0
  1. function sendMsg(msg) {
  2.     if (msg.startsWith('/img ')) {
  3.         setTimeout(() => {
  4.             socket.emit("command", { list: ["img", msg.substring(5)] });
  5.         });
  6.     } else if (msg.startsWith('/name ')) {
  7.         socket.emit("command", { list: ["name", msg.substring(6)] });
  8.     } else {
  9.         socket.emit("talk", { text: msg });
  10.     }
  11. }
  12.  
  13. var menu = document.createElement("div");
  14. menu.setAttribute("draggable", "true");
  15. document.getElementById("content").appendChild(menu);
  16.  
  17. setTimeout(() => {
  18.     alert("Tool has loaded!");
  19.     menu.style.backgroundColor = "white";
  20.     menu.style.position = "absolute";
  21.     menu.style.left = "80%";
  22.     menu.style.top = "20%";
  23.     menu.style.color = "black";
  24.     menu.style.padding = "10px";
  25.     menu.style.cursor = "move";
  26.     menu.style.border = "1px solid black";
  27.     menu.style.width = "300px";
  28.     menu.style.height = "600px";
  29.     menu.style.overflow = "auto";
  30.     menu.innerHTML = `
  31.         <h2>nono's Bonziworld Swiss Knife</h2>
  32.        <ol>
  33.          <li>Enter messages, image commands, or name changes in the text area below. Separate each item with a comma.</li>
  34.          <li>Text messages: Just type the message.</li>
  35.          <li>Image command: <code>/img [image URL]</code></li>
  36.          <li>Name change: <code>/name [new name]</code></li>
  37.          <li>Set spam rate in seconds (can be decimal).</li>
  38.          <li>Click "Run" to start spamming.</li>
  39.          <li>Click "Run Donut" to display an animated donut in chat.</li>
  40.          <li>Use the web browser to load pages and send their content to chat.</li>
  41.        </ol>
  42.        <img src="https://files.catbox.moe/f3rzuw.png" alt="Uploaded by catbox.moe" width="200"><br><br>
  43.        <textarea id='in' placeholder='Enter commands here, separated by commas...' rows='4' cols='30'></textarea><br>
  44.        <button id='run'>Run</button>
  45.        <button id='stop'>Stop</button>
  46.        <button id='donut'>Run Donut</button><br><br>
  47.        <input type='number' id='rate' min='0.01' max='10' step='0.01' value='1'></input><br>
  48.        <h4>Rate of spam (in seconds)</h4><br>
  49.        Bot Name: <input type="text" id="botName" value="bot"><br>
  50.        Bot Message: <textarea id="botMessage" rows="2" cols="30">bot message</textarea><br>
  51.        <h4>Set Bot Join Interval (in seconds)</h4>
  52.        <input type='number' id='joinRate' min='0.001' step='0.001' value='3'><br>
  53.        <h4>Set Bot Message Interval (in seconds)</h4>
  54.        <input type='number' id='messageRate' min='0.001' step='0.001' value='3'><br>
  55.        <button id="startBots">Start Bots</button>
  56.        <button id="stopBots">Stop Bots</button><br><br>
  57.        <button id='webBrowser'>Toggle Web Browser</button>
  58.        <div id='browserContainer' style='display:none;'>
  59.          <input type='text' id='urlInput' placeholder='Enter URL'>
  60.          <button id='loadUrl'>Go</button>
  61.          <button id='sendToChat'>Send to Chat</button>
  62.          <iframe id='browserFrame' style='width:100%;height:300px;'></iframe>
  63.        </div>
  64.        <div id="resizeHandle" style="position:absolute;bottom:0;right:0;width:10px;height:10px;background:gray;cursor:se-resize;"></div>
  65.      `;
  66.  
  67.    let offsetX = 0, offsetY = 0, isDragging = false;
  68.    let isResizing = false;
  69.    let startX, startY, startWidth, startHeight;
  70.  
  71.    let botsJoinInterval;
  72.    let botsMessageInterval;
  73.  
  74.    function startBots() {
  75.        const roomIdElement = document.querySelector('.room_id');
  76.        const roomId = roomIdElement ? roomIdElement.textContent : null;
  77.  
  78.        if (roomId) {
  79.            const botName = document.getElementById("botName").value;
  80.            const botMessage = document.getElementById("botMessage").value;
  81.            const joinRate = parseFloat(document.getElementById("joinRate").value) * 1000;
  82.            const messageRate = parseFloat(document.getElementById("messageRate").value) * 1000;
  83.  
  84.            botsJoinInterval = setInterval(() => {
  85.                const bot = io(window.location.origin);
  86.                bot.emit("client", "MAIN");
  87.                bot.emit("login", { passcode: "", name: botName, room: roomId });
  88.  
  89.                botsMessageInterval = setInterval(() => {
  90.                    if (botMessage.startsWith('/img ')) {
  91.                        bot.emit("command", { list: ["img", botMessage.substring(5)] });
  92.                    } else {
  93.                        bot.emit("talk", { text: botMessage });
  94.                    }
  95.                }, messageRate);
  96.  
  97.                bot.on('disconnect', () => {
  98.                    console.error("Bot disconnected. Attempting to reconnect...");
  99.                    startBots();
  100.                });
  101.            }, joinRate);
  102.  
  103.            console.log("Bots started!");
  104.        } else {
  105.            console.error("Room ID not found!");
  106.        }
  107.    }
  108.  
  109.    function stopBots() {
  110.        clearInterval(botsJoinInterval);
  111.        clearInterval(botsMessageInterval);
  112.        console.log("Bots stopped!");
  113.    }
  114.  
  115.    document.getElementById("startBots").onclick = startBots;
  116.    document.getElementById("stopBots").onclick = stopBots;
  117.  
  118.    menu.addEventListener("mousedown", (e) => {
  119.        if (e.target.id === "resizeHandle") {
  120.            isResizing = true;
  121.            startX = e.clientX;
  122.            startY = e.clientY;
  123.            startWidth = parseInt(document.defaultView.getComputedStyle(menu).width, 10);
  124.            startHeight = parseInt(document.defaultView.getComputedStyle(menu).height, 10);
  125.        } else {
  126.            isDragging = true;
  127.            offsetX = e.clientX - menu.offsetLeft;
  128.            offsetY = e.clientY - menu.offsetTop;
  129.        }
  130.        document.addEventListener("mousemove", moveElement);
  131.        document.addEventListener("mouseup", stopMoving);
  132.    });
  133.  
  134.    function moveElement(e) {
  135.        if (isDragging) {
  136.            menu.style.left = (e.clientX - offsetX) + "px";
  137.            menu.style.top = (e.clientY - offsetY) + "px";
  138.        } else if (isResizing) {
  139.            const width = startWidth + (e.clientX - startX);
  140.            const height = startHeight + (e.clientY - startY);
  141.            menu.style.width = width + "px";
  142.            menu.style.height = height + "px";
  143.        }
  144.    }
  145.  
  146.    function stopMoving() {
  147.        isDragging = false;
  148.        isResizing = false;
  149.        document.removeEventListener("mousemove", moveElement);
  150.        document.removeEventListener("mouseup", stopMoving);
  151.    }
  152.  
  153.    let spamInterval;
  154.  
  155.    document.getElementById("run").onclick = () => {
  156.        let inputText = document.getElementById("in").value;
  157.        let commands = inputText.split(',').map(cmd => cmd.trim());
  158.        let rate = parseFloat(document.getElementById("rate").value);
  159.        let interval = Math.max(rate * 1000, 10);
  160.        let index = 0;
  161.  
  162.        function spamMessage() {
  163.            if (commands.length === 0) return;
  164.            let command = commands[index];
  165.            sendMsg(command);
  166.            index = (index + 1) % commands.length;
  167.        }
  168.  
  169.        clearInterval(spamInterval);
  170.        spamInterval = setInterval(spamMessage, interval);
  171.    };
  172.  
  173.    document.getElementById("stop").onclick = () => {
  174.        clearInterval(spamInterval);
  175.    };
  176.  
  177.    document.getElementById("donut").onclick = () => {
  178.        let A = 0, B = 0;
  179.        const R1 = 1, R2 = 2, K2 = 5;
  180.        const SCREEN_WIDTH = 80, SCREEN_HEIGHT = 22;
  181.        const K1 = SCREEN_WIDTH * K2 * 3 / (8 * (R1 + R2));
  182.  
  183.        function renderFrame() {
  184.            const output = [];
  185.            const zbuffer = new Array(SCREEN_WIDTH * SCREEN_HEIGHT).fill(0);
  186.            const buffer = new Array(SCREEN_WIDTH * SCREEN_HEIGHT).fill(' ');
  187.  
  188.            for (let j = 0; j < Math.PI * 2; j += Math.PI / SCREEN_WIDTH) {
  189.                for (let i = 0; i < Math.PI * 2; i += Math.PI / SCREEN_HEIGHT) {
  190.                    const c = Math.sin(i), d = Math.cos(j), e = Math.sin(A), f = Math.sin(j), g = Math.cos(A), h = d + 2;
  191.                    const D = 1 / (c * h * e + f * g + 5);
  192.                    const l = Math.cos(i), m = Math.cos(B), n = Math.sin(B);
  193.                    const t = c * h * g - f * e;
  194.                    const x = Math.floor(40 + 30 * D * (l * h * m - t * n));
  195.                    const y = Math.floor(12 + 15 * D * (l * h * n + t * m));
  196.                    const o = Math.floor(x + SCREEN_WIDTH * y);
  197.                    const N = Math.floor(8 * ((f * e - c * d * g) * m - c * d * e - f * g - l * d * n));
  198.                    if (y < SCREEN_HEIGHT && y >= 0 && x >= 0 && x < SCREEN_WIDTH && D > zbuffer[o]) {
  199.                        zbuffer[o] = D;
  200.                        buffer[o] = ".,-~:;=!*#$@"[N > 0 ? N : 0];
  201.                    }
  202.                }
  203.            }
  204.  
  205.            for (let k = 0; k < SCREEN_WIDTH * SCREEN_HEIGHT; k++) {
  206.                output.push(k % SCREEN_WIDTH ? buffer[k] : '\n');
  207.            }
  208.  
  209.            sendMsg(output.join(''));
  210.            A += 0.08;
  211.            B += 0.06;
  212.        }
  213.  
  214.        clearInterval(spamInterval);
  215.        spamInterval = setInterval(renderFrame, 100);
  216.    };
  217.  
  218.    document.getElementById("webBrowser").onclick = () => {
  219.        const container = document.getElementById("browserContainer");
  220.        container.style.display = container.style.display === "none" ? "block" : "none";
  221.    };
  222.  
  223.    document.getElementById("loadUrl").onclick = () => {
  224.        const url = document.getElementById("urlInput").value;
  225.        document.getElementById("browserFrame").src = url;
  226.    };
  227.  
  228.    document.getElementById("sendToChat").onclick = () => {
  229.        const url = document.getElementById("urlInput").value;
  230.        const proxyUrl = `https://api.allorigins.win/raw?url=${encodeURIComponent(url)}`;
  231.  
  232.        fetch(proxyUrl)
  233.            .then(response => response.text())
  234.            .then(html => {
  235.                const parser = new DOMParser();
  236.                const doc = parser.parseFromString(html, 'text/html');
  237.                const content = doc.body.innerText;
  238.                const chunks = content.match(/.{1,200}/g) || [];
  239.                chunks.forEach((chunk, index) => {
  240.                    setTimeout(() => sendMsg(chunk), index * 1000);
  241.                });
  242.            })
  243.            .catch(error => {
  244.                console.error('Error:', error);
  245.                sendMsg("Failed to fetch webpage content.");
  246.            });
  247.    };
  248. }, 600);
  249.  
Add Comment
Please, Sign In to add comment