// ==UserScript==
// @name diep.io key functions
// @namespace http://tampermonkey.net/
// @version 33.0
// @description Bounds keys do stuff
// @author delta-1
// @match *://*.diep.io/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
document.body.onkeyup=function(e){
//Build keys
//Go to http://keycode.info/ if you want to reassign keys and then change the number after "e.keyCode==="
//01277727 = "z key"
if(e.keyCode===90){
input.execute("game_stats_build 565656565656564848484848484877332");
}
//57700077 = "x key"
if(e.keyCode===88){
input.execute("game_stats_build 232323888238238238238117777777111");
}
//07776600 =
if(e.keyCode===70){
input.execute("game_stats_build 565656565656444444432323232323232");
}
//reset build = "0 key"
if(e.keyCode===48){
input.execute("game_stats_build 0");
}
//00067677 = "G key"
if(e.keyCode===71){
input.execute("game_stats_build 565656565656547474747474778888888");
}
//Themes bellow.
//La Faucheuse theme = "v key"
if(e.keyCode===86){
input.set_convar("ren_minimap_viewport", true);
input.set_convar("ren_background_color", 0xC8C661);
input.set_convar("ren_pattern_grid", false);
input.set_convar("ren_grid_base_alpha", 0.3);
input.set_convar("ren_stroke_soft_color_intensity", 1);
input.execute("net_replace_color 1 0xBCDED2");
input.execute("net_replace_color 2 0x0E99EE");
input.execute("net_replace_color 10 0x0BC9E1");
input.execute("net_replace_color 9 0xF6181B");
input.execute("net_replace_color 8 0xE3C816");
input.execute("net_replace_color 11 0xA881C2");
input.execute("net_replace_color 15 0xF71022");
input.execute("net_replace_color 16 0xEBE776");
input.execute("net_replace_color 14 0xBCB28F");
input.execute("net_replace_color 3 0x0E99EE");
input.execute("net_replace_color 4 0xF71022");
input.execute("net_replace_color 5 0xC03998");
input.execute("net_replace_color 6 0x9FFA03");
input.execute("net_replace_color 101 0x999999");
input.set_convar(`ren_raw_health_values`, true);
input.execute("ren_fps true");
setInterval(function(){input.keyDown(76);},150);
}
//b key
if(e.keyCode===66){
input.execute("net_replace_color 0 0x777777");
input.execute("net_replace_color 1 0x898989");
input.execute("net_replace_color 2 0x008db1");
input.execute("net_replace_color 3 0x008db1");
input.execute("net_replace_color 4 0xc23f43");
input.execute("net_replace_color 5 0x9865c4");
input.execute("net_replace_color 6 0x00aa4b");
input.execute("net_replace_color 8 0xB8860B");
input.execute("net_replace_color 9 0xa53c2c");
input.execute("net_replace_color 10 0x105773");
input.execute("net_replace_color 11 0xcc5fb0");
input.execute("net_replace_color 12 0xccb954");
input.execute("net_replace_color 13 0x2fb270");
input.execute("net_replace_color 14 0x212121");
input.execute("net_replace_color 15 0xc23f43");
input.execute("net_replace_color 16 0xb48c56");
input.set_convar("ren_background_color", 0x999999);
input.execute("ren_solid_background true");
input.execute("ren_minimap_viewport true");
input.execute("ren_border_color_alpha 1");
input.execute("ren_health_fill_color 0x20FFEF");
input.execute("ren_health_background_color 0x000000");
input.set_convar(`ren_raw_health_values`, true);
input.execute("ren_fps true");
}
};
})();
//predator stack
document.addEventListener("keydown", function(zEvent) {
if ( zEvent.code === "KeyN") {
function fire(t, w) {
setTimeout(function() {
input.keyDown(32);
}, t * 1000);
setTimeout(function() {
input.keyUp(32);
}, t * 1000 + w);
}
fire(0, 100);
fire(0.75, 200);
fire(1.5, 750);
setTimeout(function() {
input.keyDown(69);
}, 2000);
}
});
//???????? stack
document.addEventListener("keydown", function(zEvent) {
if ( zEvent.code === "KeyP") {
function fire(t, w) {
setTimeout(function() {
input.keyDown(32);
}, t * 1000);
setTimeout(function() {
input.keyUp(32);
}, t * 1000 + w);
}
fire(0, 100);
setTimeout(function() {
input.keyDown(69);
}, 200);
}
});
'use strict';
const HTML = `
<table style="width:100%">
<tr>
<td><b>So uh.......</b></td>
<td><b>If you frogot the commands here they are: <br>
click z for overlord build <br>
x for ram build <br>
f anti ram build <br>
0 to reset your build <br>
g for glass build <br>
v for cool theme <br>
b for other cool theme <br>
n predator stack (7 reload) <br>
p stack for (twin,booster,gunner,octo,and more!) 7 reload! <br>
and... esc for menu <br>
<button type="button" onclick="afk()">Afk</button>
<tr>
<td>Ssp build for booster/fighter</td>
<td><button onclick='input.execute("game_stats_build 565656565656567878787878787833322")'>Apply</button></td>
</tr>
</b></td>
</tr>
<tr>
<img src="https://pics.me.me/thumb_made-some-crappy-art-cuz-im-bored-fallen-booster-47063508.png" alt="diep cool pic" style="width:350px;height:100px;"> <br>
cool image of fallen booster i wanted to include for no reason
</tr>
</table>
`
const styles = `
div#dt-menu > table, th, td {
border: 1px solid green;
padding-left:10px;
padding-right:10px;
border-collapse: collapse;
overflow-y:auto;
word-wrap:break-all;
}
div#dt-menu > button {
font-family: inherit;
font-size: 1em;
}
`
const menuStyles = {
position: "absolute",
top: "25%",
width:"50vw",
height:"60vh",
left: "25%",
display: "none",
"background-color": "rgba(0, 80, 89, 1)",
"font-family":'"Montserrat","Verdana"'
}
// <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat">
const menu = document.createElement("div")
for (var prop in menuStyles) {
menu.style[prop] = menuStyles[prop]
}
menu.innerHTML = HTML
menu.id = "dt-menu"
const styleElement = document.createElement("style")
const font = document.createElement("link")
font.rel = "stylesheet"
font.href = "https://fonts.googleapis.com/css?family=Montserrat"
styleElement.innerHTML = styles
document.head.appendChild(styleElement)
document.head.appendChild(font)
document.body.appendChild(menu)
const myEvent = function(event) {
switch (event.key) {
case "Escape":
if (menu.style.display == "none") {
menu.style.display = "block"
console.log("Menu Enabled!")
}
else {
menu.style.display = "none"
console.log("Menu Disabled!")
}
break
}
}
window.addEventListener("keydown",myEvent)
console.log("Key functions loaded!")
//diff colored names
CanvasRenderingContext2D.prototype.fillText = new Proxy(CanvasRenderingContext2D.prototype.fillText, {
apply(reference, _this, args) {
if (_this.fillStyle == "#ffff90") {
_this.fillStyle = "#03fcfc";
}
return reference.apply(_this, args);
}
});
//afk by cazka
//not by me
class Player {
constructor() {
this._minimap = new Minimap();
this._mouse = { x: NaN, y: NaN };
}
get x() {
return this._minimap.x;
}
get y() {
return this._minimap.y;
}
goto(x, y) {
const dX = x - this.x;
const dY = y - this.y;
const len = Math.sqrt(dX ** 2 + dY ** 2);
if (dX > 0) {
unsafeWindow.input.keyDown('68');
unsafeWindow.input.keyUp('65');
} else {
unsafeWindow.input.keyDown('65');
unsafeWindow.input.keyUp('68');
}
if (dY > 0) {
unsafeWindow.input.keyDown('83');
unsafeWindow.input.keyUp('87');
} else {
unsafeWindow.input.keyDown('87');
unsafeWindow.input.keyUp('83');
}
}
}
class Minimap {
constructor() {
this._minimapWidth;
this._minimapHeight;
this._x00;
this._y00;
this._pointX;
this._pointY;
this._viewportWidth;
this._viewportHeight;
this._minimapHook();
this._arrowHook();
}
get x() {
return (this._pointX - this._x00) / this._minimapWidth;
}
get y() {
return (this._pointY - this._y00) / this._minimapHeight;
}
_minimapHook() {
let setTransformArgs;
const onsetTransform = (args) => {
if (args[0] === args[3]) setTransformArgs = args;
};
const onstrokeRect = () => {
if (setTransformArgs) {
this._minimapWidth = setTransformArgs[0];
this._minimapHeight = setTransformArgs[3];
this._x00 = setTransformArgs[4];
this._y00 = setTransformArgs[5];
setTransformArgs = undefined;
}
};
this._ctxHook('setTransform', onsetTransform);
this._ctxHook('strokeRect', onstrokeRect);
}
_arrowHook() {
let index = 0;
const stack = Array(4);
let pointA;
let pointB;
let pointC;
const calculatePos = () => {
const side1 = ((pointA[0] - pointB[0]) ** 2 + (pointA[1] - pointB[1]) ** 2) ** 0.5;
const side2 = ((pointA[0] - pointC[0]) ** 2 + (pointA[1] - pointC[1]) ** 2) ** 0.5;
const side3 = ((pointB[0] - pointC[0]) ** 2 + (pointB[1] - pointC[1]) ** 2) ** 0.5;
if (~~side1 == ~~side2 && ~~side2 == ~~side3) return;
this._pointX = (pointA[0] + pointB[0] + pointC[0]) / 3;
this._pointY = (pointA[1] + pointB[1] + pointC[1]) / 3;
};
const onbeginPath = () => {
index = 0;
stack[index++] = 0;
};
const onmoveTo = (args) => {
if (index == 1 && stack[index - 1] == 0) {
stack[index++] = 1;
pointA = args;
return;
}
index = 0;
};
const onlineTo = (args) => {
if (index == 2 && stack[index - 1] == 1) {
stack[index++] = 2;
pointB = args;
return;
}
if (index == 3 && stack[index - 1] == 2) {
stack[index++] = 2;
pointC = args;
return;
}
index = 0;
};
const onfill = () => {
if (index == 4 && stack[index - 1] == 2) {
calculatePos();
return;
}
index = 0;
};
this._ctxHook('beginPath', onbeginPath);
this._ctxHook('moveTo', onmoveTo);
this._ctxHook('lineTo', onlineTo);
this._ctxHook('fill', onfill);
}
_ctxHook(method, callback) {
const target = window.CanvasRenderingContext2D.prototype;
target[method] = new Proxy(target[method], {
apply(target, thisArg, args) {
callback(args);
return target.apply(thisArg, args);
},
});
}
}
function Afk() {
this.active = !this.active;
if (this.active) {
this.x = player.x;
this.y = player.y;
this.innerHTML = 'AFK: ON';
} else {
unsafeWindow.input.keyUp('65');
unsafeWindow.input.keyUp('68');
unsafeWindow.input.keyUp('87');
unsafeWindow.input.keyUp('83');
this.innerHTML = 'AFK: OFF';
}
}