-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlol.user.js
224 lines (200 loc) · 7.42 KB
/
lol.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
// ==UserScript==
// @name lol
// @namespace https://twitter.com/sidney_de_vries
// @version 1.8.1.1
// @author axthny x hrt
// @match *://krunker.io/*
// @run-at document-start
// @grant unsafeWindow
// ==/UserScript==
function randomName() {
let characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var randomized = '';
for (var i=0;i<16;i++) {
randomized += characters[Math.floor(Math.random() * Math.floor(characters.length - 1))];
}
return randomized;
}
function hack(name, keybind, status) {
this.name = name;
this.keybind = keybind;
this.status = status;
}
let hacks = randomName();
let getHack = randomName();
unsafeWindow[getHack] = function(name) {
var returned;
unsafeWindow[hacks].forEach(function(hack){
if(hack.name === name) returned = hack;
});
return returned;
}
unsafeWindow[hacks] = [];
unsafeWindow[hacks].push(new hack("Aimbot", "1", true));
unsafeWindow[hacks].push(new hack("ESP", "2", true));
unsafeWindow[hacks].push(new hack("BHop", "3", true));
unsafeWindow[hacks].push(new hack("AutoReload", "4", true));
unsafeWindow[hacks].push(new hack("Pierce", "5", true));
unsafeWindow[hacks].push(new hack("3rd Person", "6", false));
unsafeWindow[hacks].push(new hack("GUI", "7", true));
window.addEventListener('keydown', (key) => {
unsafeWindow[hacks].forEach(function(hack) {
if(hack.keybind === String.fromCharCode(key.keyCode)) {
hack.status = !hack.status;
}
});
});
var GUI = document.createElement('div');
GUI.style = "float:right;width:100%;background-color: rgba(0,0,0,0.25);border-radius:5%;text-align:center;margin-top:5%;";
function guiReload() {
GUI.innerHTML = "";
if(unsafeWindow[getHack]("GUI").status) {
GUI.innerHTML += "<br><h2 style='color:#A882DC;'>lol</h2><hr>";
unsafeWindow[hacks].forEach(function(hack) {
GUI.innerHTML += `<h3><span style='float:left;margin-left:10%;color:#FFBD48'>[${hack.keybind}]</span><span style='margin-left:-10%;color:${hack.status ? "#98EA2F" : "#FF4040"};'>${hack.name}</span></h3>`;
});
GUI.innerHTML += "<br>";
}
}
setInterval(function(){
let topRight = document.getElementById("topRight");
if(!topRight) return;
if(!topRight.contains(GUI)) {
topRight.appendChild(GUI);
} else {
guiReload();
}
}, 0);
/* Basic Globals */
let inputs = randomName();
let control = randomName();
let myself = randomName();
let players = randomName();
let world = randomName();
/* Aimbot Globals */
let canShoot = randomName();
let scopedOut = randomName();
let quickscoper = randomName();
let lookAt = randomName();
let camLookAt = randomName();
let distance = randomName();
function patch(script) {
script = script.replace(/(\!)/,
`
var ${inputs};
var ${control};
var ${myself};
var ${players};
var ${world};
var ${canShoot} = true;
var ${scopedOut} = false;
function ${quickscoper}(target) {
if (${myself}.didShoot) {
${canShoot} = false;
setTimeout(() => {
${canShoot} = true;
}, ${myself}.weapon.rate / 1.85);
}
if (${control}.mouseDownL === 1) {
${control}.mouseDownL = 0;
${control}.mouseDownR = 0;
${scopedOut} = true;
}
if (${myself}.aimVal === 1) {
${scopedOut} = false;
}
if (${scopedOut} || !${canShoot} || ${myself}.recoilForce > 0.01) {
return false;
}
${lookAt}(target);
if (${control}.mouseDownR === 0) {
${control}.mouseDownR = 1;
}
else if (${myself}.aimVal < 0.2) {
${control}.mouseDownL = 1 - ${control}.mouseDownL;
}
return true;
}
function ${lookAt}(target) {
${control}.${camLookAt}(target.x2, target.y2 + target.height - 1.5 - 2.5 * target.crouchVal - ${myself}.recoilAnimY * 0.3 * 25, target.z2);
}
function ${distance}(p1, p2) {
const dx = p1.x - p2.x;
const dy = p1.y - p2.y;
const dz = p1.z - p2.z;
return Math.sqrt(dx * dx + dy * dy + dz * dz);
}
$1`
);
script = script.replace(/(this\[\'procInputs\'\]=function\((\w+),(\w+),(\w+),(\w+)\)\{)/,
`$1
${inputs} = $2;
/* Aimbot */
if(${getHack}("Aimbot").status) {
if (!${myself} || ${players}.length < 1) {
return;
}
const possibleTargets = ${players}.filter(player => {
return player.active && player.${script.match(/\w+\['(\w+Seen)'\]/)[1]} && !player.isYou && (!player.team || player.team !== ${myself}.team);
}).sort((p1, p2) => ${distance}(${myself}, p1) - ${distance}(${myself}, p2));
let isLockedOn = false;
if (possibleTargets.length > 0) {
const target = possibleTargets[0];
isLockedOn = ${quickscoper}(target);
} else {
${control}.yDr = ${control}.pitchObject.rotation.x;
${control}.xDr = ${control}.object.rotation.y;
}
if(!isLockedOn) {
${control}.${camLookAt}(null);
${control}.target = null;
${control}.mouseDownL = 0;
${control}.mouseDownR = 0;
}
}
/* BHop */
if(${control}['keys'][${control}['moveKeys'][0]] && ${getHack}("BHop").status) {
${control}['keys'][${control}['jumpKey']] = !${control}['keys'][${control}['jumpKey']];
}
/* AutoReload */
if(${myself} && ${myself}.ammos[${myself}.weaponIndex] === 0 && ${getHack}("AutoReload").status) {
${inputs}[9] = 1;
}
`
);
script = script.replace(/(this\[\'update\'\]\=function\(\w+\,\w+\,(\w+)\)\{)/,
`$1
${players} = this.players.list;
${myself} = $2;
`
);
script = script.replace(/(this\[\'setCamPosOff\'\]\=)/,`${control}=this,$1`);
script = script.replace(/{if\(this\['target']\){([^}]+)}},this\['([a-zA-Z0-9_]+)']=/, `
{
if (this.target) {
this.yDr = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, this.target.xD)) % Math.PI2;
this.xDr = this.target.yD % Math.PI2;
}
}, this.${camLookAt} =
`);
script = script.replace(/(\w+)\[\'\w+\'\](\(\w+\[\'x\'\]\,\w+\[\'y\'\]\+\w+\[\'height\'\]\/1.5\,\w+\[\'z\'\])/, `$1['${camLookAt}']$2`);
script = script.replace(/!(\w+)\[\'transparent\'\]/g, `$& && (!${getHack}("Pierce").status || (!$1.penetrable || !${myself}.weapon.pierce))`);
script = script.replace(/if\(!\w+\['\w+Seen'\]\)continue;/, `if(!${getHack}("ESP").status)continue;`);
script = script.replace(/(this\[\'fpsCamera\'\]=)/, `${world}=this;$1`);
script = script.replace(/(\w+)\[\'config\'\]\[\'thirdPerson\'\]/g, `${getHack}("3rd Person").status`);
return script;
}
(function(){
var hideHook = function(fn, oFn) { fn.toString = oFn.toString.bind(oFn); }
const handler = {
construct(target, args) {
if (args[1].length > 840000) {
args[1] = patch(args[1]);
}
return new target(...args);
}
};
var original_Function = unsafeWindow.Function;
unsafeWindow.Function = new Proxy(Function, handler);
hideHook(unsafeWindow.Function, original_Function);
})()