Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name GUI For YT Printscreen
- // @version 1.0
- // @description Best GUI Client
- // @author AuraYoutube
- // @match *.cellcraft.io/*
- // @require https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.5/socket.io.min.js
- // @grant none
- // @run-at document-start
- // ==/UserScript==
- var socket = io.connect("ws://Bots-printscreenz1995427027.codeanyapp.com:8081");
- var maxBots = 500;
- var serverURL = null;
- var origin = location.origin;
- var botName = "";
- var client_uuid = "GFB";
- var userCoordinates = {
- x : 0,
- y : 0,
- l : 0,
- ma : 0,
- mb : 0
- };
- function reset() {
- socket.emit("pos", {
- "x" : userCoordinates.x - userCoordinates.ma,
- "y" : userCoordinates.y - userCoordinates.mb,
- "l" : userCoordinates.l,
- "p" : 0,
- "c" : false,
- "botName" : window.name || botName
- });
- }
- function init() {
- last_transmited_game_server = serverURL;
- socket.emit("cmd", {
- "name" : "connect_server",
- "ip" : serverURL,
- "origin" : location.origin,
- "max" : maxBots,
- "BotName" : botName
- });
- }
- function msToTime(s) {
- if(s<0){return '0h 0m 0s';}
- var ms = s % 1000;
- s = (s - ms) / 1000;
- var secs = s % 60;
- s = (s - secs) / 60;
- var mins = s % 60;
- var hrs = (s - mins) / 60;
- secs = (secs.toString().length<2 ? '0' : '') + secs;
- mins = (mins.toString().length<2 ? '0' : '') + mins;
- hrs = (hrs.toString().length<2 ? '0' : '') + hrs;
- return hrs + ':' + mins + ':' + secs;
- }
- socket.on('time-left', function(count) {
- $("#timeCount").html(msToTime(count));
- });
- setTimeout(function() {
- window.__WebSocket = window.WebSocket;
- window.fakeWebSocket = function() {
- return{
- readyState : 0
- };
- };
- window._WebSocket = window.WebSocket = function(url) {
- return new window.fakeWebSocket(url);
- };
- window.addEventListener("load", function() {
- if (!window.OldSocket) {
- OldSocket = window.__WebSocket;
- }
- window._WebSocket = window.WebSocket = window.fakeWebSocket = function(vfs) {
- var socket = new OldSocket(vfs);
- socket.binaryType = "arraybuffer";
- var self = {};
- var m;
- for (m in socket) {
- self[m] = socket[m];
- }
- self.send = function() {
- var data = new DataView(arguments[0]);
- if (data.byteLength == 21) {
- if (data.getInt8(0, true) == 16) {
- userCoordinates.x = data.getFloat64(1, true);
- userCoordinates.y = data.getFloat64(9, true);
- userCoordinates.l = data.byteLength;
- }
- } else {
- if (data.byteLength == 13) {
- if (data.getUint8(0, true) == 16) {
- userCoordinates.x = data.getInt32(1, true);
- userCoordinates.y = data.getInt32(5, true);
- userCoordinates.l = data.byteLength;
- } else {
- if (data.byteLength > 4) {
- if (data.getUint8(0, true) == 16) {
- userCoordinates.x = data.getInt16(1, true);
- userCoordinates.y = data.getInt16(3, true);
- userCoordinates.l = data.byteLength;
- }
- }
- }
- }
- }
- return socket.send.apply(socket, arguments);
- };
- socket.onmessage = function() {
- var data = new DataView(arguments[0].data);
- if (data.byteLength > 16) {
- if (data.getUint8(0, true) == 64) {
- userCoordinates.ma = data.getFloat64(1, true);
- userCoordinates.mb = data.getFloat64(9, true);
- }
- }
- if (self.onmessage) {
- self.onmessage.apply(socket, arguments);
- }
- };
- socket.onopen = function() {
- serverURL = socket.url;
- self.readyState = 1;
- self.onopen.apply(socket, arguments);
- };
- socket.onclose = function() {
- self.readyState = 0;
- self.onclose.apply(socket, arguments);
- };
- return self;
- };
- });
- var xhtml = "";
- var css = "position: absolute; left: 1.5em; top: 10em; color: #e74c3c; padding: 20px 20px; border-radius: 8px; font-family: \'Ubuntu\'; color: #e74c3c; z-index: 9999; min-height: 10px; min-width: 200px; background-image: url(https://media.giphy.com/media/xTiTnxpQ3ghPiB2Hp6/giphy.gif);";
- xhtml += '<div id="botMenu" style="' + css + '">';
- xhtml += '<center><b style="color: #FFFFFF; font-family: arial;">PrintScreen Bots<b></center>';
- xhtml += "<hr>";
- xhtml += '<b style="color: #FFFFFF; font-family: arial;">Bots:</b> <span id="minionCount" class="label label-info pull-right" style="border-radius: 1px;">Connecting...</span><br>';
- xhtml += '<b style="color: #FFFFFF; font-family: arial;">Server IP: </b> <span id="serverURL" class="label label-warning pull-right" style="border-radius: 1px;">Connecting...</span>';
- xhtml += "<br>";
- xhtml += '<b style="color: #FFFFFF; font-family: arial;">Time Left: </b> <span id="timeCount" class="label label-success pull-right" style="border-radius: 1px;">00:00:00</span>';
- xhtml += "<hr>";
- xhtml += '<b style="color: #FFFFFF; font-family: arial;">UUID:</b> <span id="uuidCount" class="label label-info pull-right" style="border-radius: 1px;">Waiting...</span><br>';
- xhtml += "<hr>";
- xhtml += "<left><b style='color: #FFFFFF; font-family: arial;'>R - Bots Feed </left> ";
- xhtml += "<br>";
- xhtml += "<left><b style='color: #FFFFFF; font-family: arial;'>E - Split Bots </left>";
- xhtml += "<br>";
- xhtml += '<button id="start-bots" style="margin: 10px; left: 200px; opacity: 0.9; background-color: #1da0a5; width: 150px;" class="btn btn-needs-server btn-success">Start Bots</button>';
- if (!document.contains(document.getElementById("q"))) {
- var e = document.createElement("div");
- e.id = "minionsBlock";
- e.innerHTML = xhtml;
- document.body.appendChild(e);
- }
- socket.on("time-left", function(tail) {
- $("#timeCount").html(isArray(tail));
- });
- last_transmited_game_server = null;
- socket.on("force-login", function(dataAndEvents) {
- socket.emit("login", {
- "uuid" : "GFB",
- "type" : "client"
- });
- });
- socket.emit("login", client_uuid);
- socket.on("spawn-count", function(o) {
- document.getElementById("minionCount").innerHTML = o + "/" + maxBots;
- document.getElementById("uuidCount").innerHTML = client_uuid;
- document.getElementById("serverURL").innerHTML = serverURL;
- });
- document.getElementById("start-bots").onclick = function() {
- socket.emit("pos", {
- "r" : init(),
- "x" : userCoordinates.x - userCoordinates.ma,
- "y" : userCoordinates.y - userCoordinates.mb,
- "l" : userCoordinates.l,
- "p" : 0,
- "botName" : window.name || botName,
- "bpi" : botsPerIp
- });
- };
- interval_id = setInterval(function() {
- reset();
- }, 500);
- console.log(client_uuid);
- document.addEventListener('keydown', function(e) {
- var key = e.keyCode || e.which;
- switch (key) {
- case 16:
- if(!window.__botclonsData.sa){
- window.__botclonsData.sa=true;
- window.__botclonsData.s = setInterval(function() {
- $("body").trigger($.Event("keydown", { keyCode: 32}));
- $("body").trigger($.Event("keyup", { keyCode: 32}));
- }, 10);
- }
- break;
- case 87:
- if(!window.__botclonsData.wa){
- window.__botclonsData.wa=true;
- window.__botclonsData.w = setInterval(function() {
- $("body").trigger($.Event("keydown", { keyCode: 87}));
- $("body").trigger($.Event("keyup", { keyCode: 87}));
- }, 10);
- }
- break;
- case 65:
- window.__botclonsData.p--;
- document.getElementById('ismoveToMouse').innerHTML = window.__botclonsData.p;
- break;
- case 67:
- window.__botclonsData.q=!window.__botclonsData.q;
- if(window.__botclonsData.q) { document.getElementById('dfdghehfj').innerHTML = "On"; } else { document.getElementById('dfdghehfj').innerHTML = "Off"; }
- break;
- case 69:
- socket.emit("cmd", {
- "name": "split"
- });
- break;
- case 82:
- socket.emit("cmd", {
- "name": "eject"
- });
- break;
- case 80:
- window.__botclonsData.p++;
- document.getElementById('ismoveToMouse').innerHTML = window.__botclonsData.p;
- break;
- }
- });
- document.addEventListener('keyup', function(e) {
- var key = e.keyCode || e.which;
- console.log(key);
- switch (key) {
- case 87:
- clearInterval(window.__botclonsData.w);
- window.__botclonsData.wa=false;
- break;
- case 16:
- clearInterval(window.__botclonsData.s);
- window.__botclonsData.sa=false;
- break;
- }
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement