· 4 years ago · May 20, 2021, 10:40 AM
1// ==UserScript==
2// @name MAD MOD
3// @namespace -
4// @version 12
5// @description by MaximumTears#4440
6// @author MaximumTears
7// @match *://sandbox.moomoo.io/*
8// @match *://moomoo.io/*
9// @grant none
10// @require https://greasyfork.org/scripts/368273-msgpack/code/msgpack.js?version=598723
11// @require http://code.jquery.com/jquery-3.3.1.min.js
12// @require https://code.jquery.com/ui/1.12.0/jquery-ui.min.js
13// @require https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.js
14// @require https://cdn.jsdelivr.net/gh/emn178/js-sha3/build/sha3.min.js
15
16// ==/UserScript==
17
18let hue = 0;
19
20let replaceInterval = setInterval(() => {
21if (CanvasRenderingContext2D.prototype.roundRect) {
22 CanvasRenderingContext2D.prototype.roundRect = ((oldFunc) => function() { if (this.fillStyle == "#8ecc51") this.fillStyle = `hsl(${hue}, 100%, 50%)`; return oldFunc.call(this, ...arguments); })(CanvasRenderingContext2D.prototype.roundRect);
23 clearInterval(replaceInterval);
24}}, 10);
25
26function changeHue() {
27 hue += Math.random() * 3;
28}
29
30setInterval(changeHue, 10);
31
32let mouseX;
33let mouseY;
34
35let width;
36let height;
37
38setInterval(() => {
39 if(clanToggle == 1) {
40 doNewSend(["9", [null]]);
41 doNewSend(["8", [animate(false, 5)]])
42 }
43 doNewSend(["testing", [6]]);
44}, 200);
45
46setInterval(() => {
47 if(messageToggle == 1) {
48 doNewSend(["ch", [animate(true, 5)]])
49 }
50}, 200);
51
52setInterval(() => {
53 if(autoaim == true) {
54 doNewSend(["2", [nearestEnemyAngle]]);
55 }
56}, 0);
57
58setInterval(() => {
59 if(autoprimary == true) {
60 doNewSend(["5", [primary, true]]);
61 }
62}, 0);
63
64setInterval(() => {
65 if(autosecondary == true) {
66 doNewSend(["5", [secondary, true]]);
67 }
68}, 0);
69
70setInterval(() => {
71 if(hatToggle == 1) {
72 if(oldHat != normalHat) {
73 hat(normalHat);
74 console.log("Tried. - Hat")
75 }
76 if(oldAcc != normalAcc) {
77 acc(normalAcc);
78 console.log("Tried. - Acc")
79 }
80 oldHat = normalHat;
81 oldAcc = normalAcc
82 }
83}, 25);
84
85function normal() {
86 hat(normalHat);
87 acc(normalAcc);
88}
89
90function aim(x, y){
91 var cvs = document.getElementById("gameCanvas");
92 cvs.dispatchEvent(new MouseEvent("mousemove", {
93 clientX: x,
94 clientY: y
95
96 }));
97}
98
99let coreURL = new URL(window.location.href);
100window.sessionStorage.force = coreURL.searchParams.get("fc");
101
102var nearestEnemy;
103var nearestEnemyAngle;
104var isEnemyNear;
105var primary;
106var secondary;
107var foodType;
108var wallType;
109var spikeType;
110var millType;
111var mineType;
112var boostType;
113var turretType;
114var spawnpadType;
115var autoaim = false;
116var autoprimary = false;
117var autosecondary = false;
118var tick = 1;
119var oldHat;
120var oldAcc;
121var enemiesNear;
122var normalHat;
123var normalAcc;
124var ws;
125var msgpack5 = msgpack;
126var boostDir;
127let myPlayer = {
128 id: null,
129 x: null,
130 y: null,
131 dir: null,
132 object: null,
133 weapon: null,
134 clan: null,
135 isLeader: null,
136 hat: null,
137 accessory: null,
138 isSkull: null
139};
140
141let healSpeed = 60;
142var messageToggle = 0;
143var clanToggle = 0;
144let healToggle = 1;
145let hatToggle = 1;
146let clickInsta = 1;
147
148
149
150document.msgpack = msgpack;
151function n(){
152 this.buffer = new Uint8Array([0]);
153 this.buffer.__proto__ = new Uint8Array;
154 this.type = 0;
155}
156
157const CanvasAPI = document.getElementById("gameCanvas")
158CanvasAPI.addEventListener("mousedown", buttonPressD, false);
159
160function buttonPressD(e) {
161 if (e.button == 2) {
162 doNewSend(["13c", [1, 40, 0]]);
163 doNewSend(["13c", [0, 40, 0]]);
164 doNewSend(["13c", [0, 0, 1]]);
165 doNewSend(["13c", [1, 21, 1]]);
166 doNewSend(["13c", [0, 21, 1]]);
167 doNewSend(["7", [1]]);
168 setTimeout( () => {
169 doNewSend(["13c", [0, 0, 0]]);
170 doNewSend(["13c", [0, 11, 1]]);
171 if (myPlayer.y < 2400){
172 doNewSend(["13c", [0, 15, 0]]);
173 } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
174 doNewSend(["13c", [0, 31, 0]]);
175 } else {
176 doNewSend(["13c", [0, 12, 0]]);
177 }
178 }, 120);
179 setTimeout( () => {
180 doNewSend(["7", [1]]);
181 }, 200);
182 }
183 if (e.button == 0 && clickInsta == 1) {
184 autoprimary = true;
185 autosecondary = false;
186 autoaim = true;
187 autoprimary = true;
188 autosecondary = false;
189 doNewSend(["13c", [0, 0, 1]]);
190 doNewSend(["ch", ["*;::;*"]]);
191 doNewSend(["5", [primary, true]]);
192 doNewSend(["7", [1]]);
193 doNewSend(["13c", [1, 7, 0]]);
194 doNewSend(["13c", [0, 7, 0]]);
195 doNewSend(["13c", [1, 21, 1]]);
196 doNewSend(["13c", [0, 21, 1]]);
197 setTimeout( () => {
198 autoprimary = false;
199 autosecondary = true;
200 doNewSend(["13c", [0, 0, 0]]);
201 doNewSend(["13c", [1, 53, 0]]);
202 doNewSend(["13c", [0, 53, 0]]);
203 doNewSend(["5", [secondary, true]]);
204 }, 110);
205 setTimeout( () => {
206 doNewSend(["13c", [0, 0, 0]]);
207 doNewSend(["7", [1]]);
208 doNewSend(["5", [primary, true]]);
209 doNewSend(["13c", [0, 11, 1]]);
210 if (myPlayer.y < 2400){
211 doNewSend(["13c", [0, 15, 0]]);
212 } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
213 doNewSend(["13c", [0, 31, 0]]);
214 } else {
215 doNewSend(["13c", [0, 12, 0]]);
216 }
217 autosecondary = false;
218 autoaim = false;
219 }, 220)
220 }
221}
222
223WebSocket.prototype.oldSend = WebSocket.prototype.send;
224WebSocket.prototype.send = function(m){
225 if (!ws){
226 document.ws = this;
227
228 ws = this;
229 socketFound(this);
230 }
231 this.oldSend(m);
232};
233
234
235function socketFound(socket){
236 socket.addEventListener('message', function(message){
237 handleMessage(message);
238 });
239}
240
241function handleMessage(m){
242 let temp = msgpack5.decode(new Uint8Array(m.data));
243 let data;
244 if(temp.length > 1) {
245 data = [temp[0], ...temp[1]];
246 if (data[1] instanceof Array){
247 data = data;
248 }
249 } else {
250 data = temp;
251 }
252 let item = data[0];
253 if(!data) {return};
254
255 if(item === "io-init") {
256 let cvs = document.getElementById("gameCanvas");
257 width = cvs.clientWidth;
258 height = cvs.clientHeight;
259 $(window).resize(function() {
260 width = cvs.clientWidth;
261 height = cvs.clientHeight;
262 });
263 cvs.addEventListener("mousemove", e => {
264 mouseX = e.clientX;
265 mouseY = e.clientY;
266 });
267 }
268
269 if (item == "1" && myPlayer.id == null){
270 myPlayer.id = data[1];
271 }
272
273 if (item == "33") {
274 enemiesNear = [];
275 for(let i = 0; i < data[1].length / 13; i++) {
276 let playerInfo = data[1].slice(13*i, 13*i+13);
277 if(playerInfo[0] == myPlayer.id) {
278 myPlayer.x = playerInfo[1];
279 myPlayer.y = playerInfo[2];
280 myPlayer.dir = playerInfo[3];
281 myPlayer.object = playerInfo[4];
282 myPlayer.weapon = playerInfo[5];
283 myPlayer.clan = playerInfo[7];
284 myPlayer.isLeader = playerInfo[8];
285 myPlayer.hat = playerInfo[9];
286 myPlayer.accessory = playerInfo[10];
287 myPlayer.isSkull = playerInfo[11];
288 } else if(playerInfo[7] != myPlayer.clan || playerInfo[7] === null) {
289 enemiesNear.push(playerInfo);
290 }
291 }
292 }
293
294 isEnemyNear = false;
295 if(enemiesNear) {
296 nearestEnemy = enemiesNear.sort((a,b) => dist(a, myPlayer) - dist(b, myPlayer))[0];
297 }
298
299 if(nearestEnemy) {
300 nearestEnemyAngle = Math.atan2(nearestEnemy[2]-myPlayer.y, nearestEnemy[1]-myPlayer.x);
301 if(Math.sqrt(Math.pow((myPlayer.y-nearestEnemy[2]), 2) + Math.pow((myPlayer.x-nearestEnemy[1]), 2)) < 0) {
302 isEnemyNear = true;
303 if(autoaim == false && myPlayer.hat != 7 && myPlayer.hat != 53) {
304 normalHat = 6;
305 if(primary != 8) {
306 normalAcc = 19
307 }
308 };
309 }
310 }
311 if(isEnemyNear == false && autoaim == false) {
312 normalAcc = 11;
313 if (myPlayer.y < 2400){
314 normalHat = 15;
315 } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
316 normalHat = 31;
317 } else {
318 normalHat = 12;
319 }
320 }
321 if (!nearestEnemy) {
322 nearestEnemyAngle = myPlayer.dir;
323 }
324
325 if(item == "h" && data[1] == myPlayer.id) {
326 if(data[2] < 100 && data[2] > 0 && healToggle == 1) {
327 setTimeout( () => {
328 place(foodType, null);
329 place(foodType, null);
330 place(foodType, null);
331 place(foodType, null);
332 }, healSpeed);
333
334 }
335 }
336 update();
337}
338
339
340function doNewSend(sender){
341 ws.send(new Uint8Array(Array.from(msgpack5.encode(sender))));
342}
343
344function acc(id) {
345 doNewSend(["13c", [0, 0, 1]]);
346 doNewSend(["13c", [0, id, 1]]);
347}
348
349function hat(id) {
350 doNewSend(["13c", [0, id, 0]]);
351}
352
353
354function place(id, angle = Math.atan2(mouseY - height / 2, mouseX - width / 2)) {
355 doNewSend(["5", [id, null]]);
356 doNewSend(["c", [1, angle]]);
357 doNewSend(["c", [0, angle]]);
358 doNewSend(["5", [myPlayer.weapon, true]]);
359}
360
361function placeQ(id, angle = Math.atan2(mouseY - height / 2, mouseX - width / 2)) {
362 doNewSend(["5", [id, null]]);
363 doNewSend(["c", [1, boostDir]]);
364 doNewSend(["c", [0, boostDir]]);
365 doNewSend(["5", [myPlayer.weapon, true]]);
366 doNewSend(["2", [nearestEnemyAngle]]);
367}
368
369function boostSpike() {
370 if(boostDir == null) {
371 boostDir = nearestEnemyAngle;
372 }
373 place(spikeType, boostDir + toRad(90));
374 place(spikeType, boostDir - toRad(90));
375 place(boostType, boostDir);
376 doNewSend(["33", [boostDir]]);
377}
378
379var repeater = function(key, action, interval) {
380 let _isKeyDown = false;
381 let _intervalId = undefined;
382
383 return {
384 start(keycode) {
385 if(keycode == key && document.activeElement.id.toLowerCase() !== 'chatbox') {
386 _isKeyDown = true;
387 if(_intervalId === undefined) {
388 _intervalId = setInterval(() => {
389 action();
390 if(!_isKeyDown){
391 clearInterval(_intervalId);
392 _intervalId = undefined;
393 console.log("claered");
394 }
395 }, interval);
396 }
397 }
398 },
399
400 stop(keycode) {
401 if(keycode == key && document.activeElement.id.toLowerCase() !== 'chatbox') {
402 _isKeyDown = false;
403 }
404 }
405 };
406
407
408}
409
410
411const healer1 = repeater(51, () => {placeQ(foodType, boostDir);
412 placeQ(foodType, boostDir);
413 placeQ(foodType, boostDir)}, 50);
414const healer2 = repeater(81, () => {placeQ(foodType, boostDir);
415 placeQ(foodType, boostDir);
416 placeQ(foodType, boostDir)}, 50);
417const boostPlacer = repeater(70, () => {place(boostType)}, 0);
418const fourSpawnpader = repeater(75, fourSpawnpad, 0);
419const spikePlacer = repeater(86, () => {place(spikeType)}, 0);
420const millPlacer = repeater(78, () => {place(millType)}, 0);
421const turretPlacer = repeater(72, () => {place(turretType)}, 0);
422
423document.addEventListener('keydown', (e)=>{
424 spikePlacer.start(e.keyCode);
425 fourSpawnpader.start(e.keyCode);
426 healer1.start(e.keyCode);
427 healer2.start(e.keyCode);
428 boostPlacer.start(e.keyCode);
429 millPlacer.start(e.keyCode);
430 turretPlacer.start(e.keyCode);
431
432 if (e.keyCode == 67 && document.activeElement.id.toLowerCase() !== 'chatbox') {
433 doNewSend(["13c", [1, 6, 0]]);
434 doNewSend(["13c", [0, 6, 0]]);
435 doNewSend(["13c", [0, 0, 1]]);
436 doNewSend(["13c", [1, 19, 1]]);
437 doNewSend(["13c", [0, 19, 1]]);
438 }
439
440 if (e.keyCode == 49 && document.activeElement.id.toLowerCase() !== 'chatbox') {
441 autosecondary = false;
442 autoprimary = true;
443 setTimeout( () => {
444 autoprimary = false;
445 }, 330);
446 }
447
448 if (e.keyCode == 50 && document.activeElement.id.toLowerCase() !== 'chatbox') {
449 autoprimary = false;
450 autosecondary = true;
451 setTimeout( () => {
452 autosecondary = false;
453 }, 330);
454 }
455
456 if (e.keyCode == 82 && document.activeElement.id.toLowerCase() !== 'chatbox') {
457 doNewSend(["ch", ["*;::;*"]]);
458 }
459
460 if (e.keyCode == 71 && document.activeElement.id.toLowerCase() !== 'chatbox') {
461 doNewSend(["13c", [1, 7, 0]]);
462 doNewSend(["13c", [0, 7, 0]]);
463 doNewSend(["13c", [0, 0, 1]]);
464 doNewSend(["13c", [0, 19, 1]]);
465 }
466
467 if (e.keyCode == 75 && document.activeElement.id.toLowerCase() !== 'chatbox') {
468 place(spawnpadType, myPlayer.dir + toRad(45));
469 place(spawnpadType, myPlayer.dir - toRad(45));
470 }
471 if (e.keyCode == 90 && document.activeElement.id.toLowerCase() !== 'chatbox') {
472 doNewSend(["13c", [1, 40, 0]]);
473 doNewSend(["13c", [0, 40, 0]]);
474 doNewSend(["13c", [0, 0, 1]]);
475 doNewSend(["13c", [0, 19, 1]]);
476 }
477
478 if (e.keyCode == 84 && document.activeElement.id.toLowerCase() !== 'chatbox') {
479 doNewSend(["13c", [1, 22, 0]]);
480 doNewSend(["13c", [0, 22, 0]]);
481 doNewSend(["13c", [0, 0, 1]]);
482 doNewSend(["13c", [0, 19, 1]]);
483 }
484
485 if (e.keyCode == 9 && document.activeElement.id.toLowerCase() !== 'chatbox') {
486 doNewSend(["13c", [1, 11, 1]]);
487 doNewSend(["13c", [0, 11, 1]]);
488 doNewSend(["13c", [1, 12, 0]]);
489 doNewSend(["13c", [0, 12, 0]]);
490 doNewSend(["13c", [1, 31, 0]]);
491 doNewSend(["13c", [1, 15, 0]]);
492 }
493
494 if(e.keyCode == 106 && document.activeElement.id.toLowerCase() !== 'chatbox') {
495 healToggle = (healToggle + 1) % 2;
496 }
497
498 if(e.keyCode == 113 && document.activeElement.id.toLowerCase() !== 'chatbox') {
499 clickInsta = (clickInsta + 1) % 2;
500 }
501
502 if(e.keyCode == 40 && document.activeElement.id.toLowerCase() !== 'chatbox') {
503 doNewSend(["6", [5]]);
504 doNewSend(["6", [17]]);
505 doNewSend(["6", [31]]);
506 doNewSend(["6", [23]]);
507 doNewSend(["6", [9]]);
508 doNewSend(["6", [38]]);
509 doNewSend(["6", [28]]);
510 doNewSend(["6", [15]]);
511 }
512
513 if(e.keyCode == 35 && document.activeElement.id.toLowerCase() !== 'chatbox') {
514 doNewSend(["6", [7]]);
515 doNewSend(["6", [17]]);
516 doNewSend(["6", [31]]);
517 doNewSend(["6", [27]]);
518 doNewSend(["6", [10]]);
519 doNewSend(["6", [38]]);
520 doNewSend(["6", [4]]);
521 doNewSend(["6", [15]]);
522 }
523
524 if (e.keyCode == 9 && document.activeElement.id.toLowerCase() !== 'chatbox') {
525 if (myPlayer.y < 2400){
526 doNewSend(["13c", [0, 15, 0]]);
527 } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
528 doNewSend(["13c", [0, 31, 0]]);
529 } else {
530 doNewSend(["13c", [0, 12, 0]]);
531 }
532 doNewSend(["13c", [0, 11, 1]]);
533 }
534
535 if(e.keyCode == 82 && document.activeElement.id.toLowerCase() !== 'chatbox') {
536 autoprimary = true;
537 autosecondary = false;
538 autoaim = true;
539 autoprimary = true;
540 autosecondary = false;
541 doNewSend(["13c", [0, 0, 1]]);
542 doNewSend(["5", [primary, true]]);
543 doNewSend(["7", [1]]);
544 doNewSend(["13c", [1, 7, 0]]);
545 doNewSend(["13c", [0, 7, 0]]);
546 doNewSend(["13c", [1, 21, 1]]);
547 doNewSend(["13c", [0, 21, 1]]);
548 setTimeout( () => {
549 autoprimary = false;
550 autosecondary = true;
551 doNewSend(["13c", [0, 0, 0]]);
552 doNewSend(["13c", [1, 53, 0]]);
553 doNewSend(["13c", [0, 53, 0]]);
554 doNewSend(["5", [secondary, true]]);
555 }, 115);
556 setTimeout( () => {
557 doNewSend(["13c", [0, 0, 0]]);
558 doNewSend(["7", [1]]);
559 doNewSend(["5", [primary, true]]);
560 doNewSend(["13c", [0, 11, 1]]);
561 if (myPlayer.y < 2400){
562 doNewSend(["13c", [0, 15, 0]]);
563 } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
564 doNewSend(["13c", [0, 31, 0]]);
565 } else {
566 doNewSend(["13c", [0, 12, 0]]);
567 }
568 autosecondary = false;
569 autoaim = false;
570 }, 230);
571 }
572})
573
574document.addEventListener('keyup', (e)=>{
575 spikePlacer.stop(e.keyCode);
576 fourSpawnpader.stop(e.keyCode);
577 boostPlacer.stop(e.keyCode);
578 millPlacer.stop(e.keyCode);
579 turretPlacer.stop(e.keyCode);
580 healer1.stop(e.keyCode);
581 healer2.stop(e.keyCode);
582})
583
584
585function isElementVisible(e) {
586 return (e.offsetParent !== null);
587}
588
589function fourSpawnpad() {
590 place(spawnpadType, myPlayer.dir + toRad(135));
591 place(spawnpadType, myPlayer.dir + toRad(150));
592 place(spawnpadType, myPlayer.dir + toRad(165));
593 place(spawnpadType, myPlayer.dir + toRad(180));
594 place(spawnpadType, myPlayer.dir + toRad(270));
595 place(spawnpadType, myPlayer.dir + toRad(360));
596}
597
598function toRad(angle) {
599 return angle * 0.01745329251;
600}
601
602function dist(a, b){
603 return Math.sqrt( Math.pow((b.y-a[2]), 2) + Math.pow((b.x-a[1]), 2) );
604}
605
606function update() {
607 for (let i=0;i<9;i++){
608 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
609 primary = i;
610 }
611 }
612
613 for (let i=9;i<16;i++){
614 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
615 secondary = i;
616 }
617 }
618
619 for (let i=16;i<19;i++){
620 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
621 foodType = i - 16;
622 }
623 }
624
625 for (let i=19;i<22;i++){
626 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
627 wallType = i - 16;
628 }
629 }
630
631 for (let i=22;i<26;i++){
632 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
633 spikeType = i - 16;
634 }
635 }
636
637 for (let i=26;i<29;i++){
638 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
639 millType = i - 16;
640 }
641 }
642
643 for (let i=29;i<31;i++){
644 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
645 mineType = i - 16;
646 }
647 }
648
649 for (let i=31;i<33;i++){
650 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
651 boostType = i - 16;
652 }
653 }
654
655 for (let i=33;i<36;i++){
656 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
657 turretType = i - 16;
658 }
659 }
660
661 for (let i=36;i<37;i++){
662 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
663 spawnpadType = i - 16;
664 }
665 }
666
667 for (let i=37;i<39;i++){
668 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
669 turretType = i - 16;
670 }
671 }
672}
673RAW Paste Data
674// ==UserScript==
675// @name MAD MOD
676// @namespace -
677// @version 12
678// @description by MaximumTears#4440
679// @author MaximumTears
680// @match *://sandbox.moomoo.io/*
681// @match *://moomoo.io/*
682// @grant none
683// @require https://greasyfork.org/scripts/368273-msgpack/code/msgpack.js?version=598723
684// @require http://code.jquery.com/jquery-3.3.1.min.js
685// @require https://code.jquery.com/ui/1.12.0/jquery-ui.min.js
686// @require https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.js
687// @require https://cdn.jsdelivr.net/gh/emn178/js-sha3/build/sha3.min.js
688
689// ==/UserScript==
690
691let hue = 0;
692
693let replaceInterval = setInterval(() => {
694if (CanvasRenderingContext2D.prototype.roundRect) {
695 CanvasRenderingContext2D.prototype.roundRect = ((oldFunc) => function() { if (this.fillStyle == "#8ecc51") this.fillStyle = `hsl(${hue}, 100%, 50%)`; return oldFunc.call(this, ...arguments); })(CanvasRenderingContext2D.prototype.roundRect);
696 clearInterval(replaceInterval);
697}}, 10);
698
699function changeHue() {
700 hue += Math.random() * 3;
701}
702
703setInterval(changeHue, 10);
704
705let mouseX;
706let mouseY;
707
708let width;
709let height;
710
711setInterval(() => {
712 if(clanToggle == 1) {
713 doNewSend(["9", [null]]);
714 doNewSend(["8", [animate(false, 5)]])
715 }
716 doNewSend(["testing", [6]]);
717}, 200);
718
719setInterval(() => {
720 if(messageToggle == 1) {
721 doNewSend(["ch", [animate(true, 5)]])
722 }
723}, 200);
724
725setInterval(() => {
726 if(autoaim == true) {
727 doNewSend(["2", [nearestEnemyAngle]]);
728 }
729}, 0);
730
731setInterval(() => {
732 if(autoprimary == true) {
733 doNewSend(["5", [primary, true]]);
734 }
735}, 0);
736
737setInterval(() => {
738 if(autosecondary == true) {
739 doNewSend(["5", [secondary, true]]);
740 }
741}, 0);
742
743setInterval(() => {
744 if(hatToggle == 1) {
745 if(oldHat != normalHat) {
746 hat(normalHat);
747 console.log("Tried. - Hat")
748 }
749 if(oldAcc != normalAcc) {
750 acc(normalAcc);
751 console.log("Tried. - Acc")
752 }
753 oldHat = normalHat;
754 oldAcc = normalAcc
755 }
756}, 25);
757
758function normal() {
759 hat(normalHat);
760 acc(normalAcc);
761}
762
763function aim(x, y){
764 var cvs = document.getElementById("gameCanvas");
765 cvs.dispatchEvent(new MouseEvent("mousemove", {
766 clientX: x,
767 clientY: y
768
769 }));
770}
771
772let coreURL = new URL(window.location.href);
773window.sessionStorage.force = coreURL.searchParams.get("fc");
774
775var nearestEnemy;
776var nearestEnemyAngle;
777var isEnemyNear;
778var primary;
779var secondary;
780var foodType;
781var wallType;
782var spikeType;
783var millType;
784var mineType;
785var boostType;
786var turretType;
787var spawnpadType;
788var autoaim = false;
789var autoprimary = false;
790var autosecondary = false;
791var tick = 1;
792var oldHat;
793var oldAcc;
794var enemiesNear;
795var normalHat;
796var normalAcc;
797var ws;
798var msgpack5 = msgpack;
799var boostDir;
800let myPlayer = {
801 id: null,
802 x: null,
803 y: null,
804 dir: null,
805 object: null,
806 weapon: null,
807 clan: null,
808 isLeader: null,
809 hat: null,
810 accessory: null,
811 isSkull: null
812};
813
814let healSpeed = 60;
815var messageToggle = 0;
816var clanToggle = 0;
817let healToggle = 1;
818let hatToggle = 1;
819let clickInsta = 1;
820
821
822
823document.msgpack = msgpack;
824function n(){
825 this.buffer = new Uint8Array([0]);
826 this.buffer.__proto__ = new Uint8Array;
827 this.type = 0;
828}
829
830const CanvasAPI = document.getElementById("gameCanvas")
831CanvasAPI.addEventListener("mousedown", buttonPressD, false);
832
833function buttonPressD(e) {
834 if (e.button == 2) {
835 doNewSend(["13c", [1, 40, 0]]);
836 doNewSend(["13c", [0, 40, 0]]);
837 doNewSend(["13c", [0, 0, 1]]);
838 doNewSend(["13c", [1, 21, 1]]);
839 doNewSend(["13c", [0, 21, 1]]);
840 doNewSend(["7", [1]]);
841 setTimeout( () => {
842 doNewSend(["13c", [0, 0, 0]]);
843 doNewSend(["13c", [0, 11, 1]]);
844 if (myPlayer.y < 2400){
845 doNewSend(["13c", [0, 15, 0]]);
846 } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
847 doNewSend(["13c", [0, 31, 0]]);
848 } else {
849 doNewSend(["13c", [0, 12, 0]]);
850 }
851 }, 120);
852 setTimeout( () => {
853 doNewSend(["7", [1]]);
854 }, 200);
855 }
856 if (e.button == 0 && clickInsta == 1) {
857 autoprimary = true;
858 autosecondary = false;
859 autoaim = true;
860 autoprimary = true;
861 autosecondary = false;
862 doNewSend(["13c", [0, 0, 1]]);
863 doNewSend(["ch", ["*;::;*"]]);
864 doNewSend(["5", [primary, true]]);
865 doNewSend(["7", [1]]);
866 doNewSend(["13c", [1, 7, 0]]);
867 doNewSend(["13c", [0, 7, 0]]);
868 doNewSend(["13c", [1, 21, 1]]);
869 doNewSend(["13c", [0, 21, 1]]);
870 setTimeout( () => {
871 autoprimary = false;
872 autosecondary = true;
873 doNewSend(["13c", [0, 0, 0]]);
874 doNewSend(["13c", [1, 53, 0]]);
875 doNewSend(["13c", [0, 53, 0]]);
876 doNewSend(["5", [secondary, true]]);
877 }, 110);
878 setTimeout( () => {
879 doNewSend(["13c", [0, 0, 0]]);
880 doNewSend(["7", [1]]);
881 doNewSend(["5", [primary, true]]);
882 doNewSend(["13c", [0, 11, 1]]);
883 if (myPlayer.y < 2400){
884 doNewSend(["13c", [0, 15, 0]]);
885 } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
886 doNewSend(["13c", [0, 31, 0]]);
887 } else {
888 doNewSend(["13c", [0, 12, 0]]);
889 }
890 autosecondary = false;
891 autoaim = false;
892 }, 220)
893 }
894}
895
896WebSocket.prototype.oldSend = WebSocket.prototype.send;
897WebSocket.prototype.send = function(m){
898 if (!ws){
899 document.ws = this;
900
901 ws = this;
902 socketFound(this);
903 }
904 this.oldSend(m);
905};
906
907
908function socketFound(socket){
909 socket.addEventListener('message', function(message){
910 handleMessage(message);
911 });
912}
913
914function handleMessage(m){
915 let temp = msgpack5.decode(new Uint8Array(m.data));
916 let data;
917 if(temp.length > 1) {
918 data = [temp[0], ...temp[1]];
919 if (data[1] instanceof Array){
920 data = data;
921 }
922 } else {
923 data = temp;
924 }
925 let item = data[0];
926 if(!data) {return};
927
928 if(item === "io-init") {
929 let cvs = document.getElementById("gameCanvas");
930 width = cvs.clientWidth;
931 height = cvs.clientHeight;
932 $(window).resize(function() {
933 width = cvs.clientWidth;
934 height = cvs.clientHeight;
935 });
936 cvs.addEventListener("mousemove", e => {
937 mouseX = e.clientX;
938 mouseY = e.clientY;
939 });
940 }
941
942 if (item == "1" && myPlayer.id == null){
943 myPlayer.id = data[1];
944 }
945
946 if (item == "33") {
947 enemiesNear = [];
948 for(let i = 0; i < data[1].length / 13; i++) {
949 let playerInfo = data[1].slice(13*i, 13*i+13);
950 if(playerInfo[0] == myPlayer.id) {
951 myPlayer.x = playerInfo[1];
952 myPlayer.y = playerInfo[2];
953 myPlayer.dir = playerInfo[3];
954 myPlayer.object = playerInfo[4];
955 myPlayer.weapon = playerInfo[5];
956 myPlayer.clan = playerInfo[7];
957 myPlayer.isLeader = playerInfo[8];
958 myPlayer.hat = playerInfo[9];
959 myPlayer.accessory = playerInfo[10];
960 myPlayer.isSkull = playerInfo[11];
961 } else if(playerInfo[7] != myPlayer.clan || playerInfo[7] === null) {
962 enemiesNear.push(playerInfo);
963 }
964 }
965 }
966
967 isEnemyNear = false;
968 if(enemiesNear) {
969 nearestEnemy = enemiesNear.sort((a,b) => dist(a, myPlayer) - dist(b, myPlayer))[0];
970 }
971
972 if(nearestEnemy) {
973 nearestEnemyAngle = Math.atan2(nearestEnemy[2]-myPlayer.y, nearestEnemy[1]-myPlayer.x);
974 if(Math.sqrt(Math.pow((myPlayer.y-nearestEnemy[2]), 2) + Math.pow((myPlayer.x-nearestEnemy[1]), 2)) < 0) {
975 isEnemyNear = true;
976 if(autoaim == false && myPlayer.hat != 7 && myPlayer.hat != 53) {
977 normalHat = 6;
978 if(primary != 8) {
979 normalAcc = 19
980 }
981 };
982 }
983 }
984 if(isEnemyNear == false && autoaim == false) {
985 normalAcc = 11;
986 if (myPlayer.y < 2400){
987 normalHat = 15;
988 } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
989 normalHat = 31;
990 } else {
991 normalHat = 12;
992 }
993 }
994 if (!nearestEnemy) {
995 nearestEnemyAngle = myPlayer.dir;
996 }
997
998 if(item == "h" && data[1] == myPlayer.id) {
999 if(data[2] < 100 && data[2] > 0 && healToggle == 1) {
1000 setTimeout( () => {
1001 place(foodType, null);
1002 place(foodType, null);
1003 place(foodType, null);
1004 place(foodType, null);
1005 }, healSpeed);
1006
1007 }
1008 }
1009 update();
1010}
1011
1012
1013function doNewSend(sender){
1014 ws.send(new Uint8Array(Array.from(msgpack5.encode(sender))));
1015}
1016
1017function acc(id) {
1018 doNewSend(["13c", [0, 0, 1]]);
1019 doNewSend(["13c", [0, id, 1]]);
1020}
1021
1022function hat(id) {
1023 doNewSend(["13c", [0, id, 0]]);
1024}
1025
1026
1027function place(id, angle = Math.atan2(mouseY - height / 2, mouseX - width / 2)) {
1028 doNewSend(["5", [id, null]]);
1029 doNewSend(["c", [1, angle]]);
1030 doNewSend(["c", [0, angle]]);
1031 doNewSend(["5", [myPlayer.weapon, true]]);
1032}
1033
1034function placeQ(id, angle = Math.atan2(mouseY - height / 2, mouseX - width / 2)) {
1035 doNewSend(["5", [id, null]]);
1036 doNewSend(["c", [1, boostDir]]);
1037 doNewSend(["c", [0, boostDir]]);
1038 doNewSend(["5", [myPlayer.weapon, true]]);
1039 doNewSend(["2", [nearestEnemyAngle]]);
1040}
1041
1042function boostSpike() {
1043 if(boostDir == null) {
1044 boostDir = nearestEnemyAngle;
1045 }
1046 place(spikeType, boostDir + toRad(90));
1047 place(spikeType, boostDir - toRad(90));
1048 place(boostType, boostDir);
1049 doNewSend(["33", [boostDir]]);
1050}
1051
1052var repeater = function(key, action, interval) {
1053 let _isKeyDown = false;
1054 let _intervalId = undefined;
1055
1056 return {
1057 start(keycode) {
1058 if(keycode == key && document.activeElement.id.toLowerCase() !== 'chatbox') {
1059 _isKeyDown = true;
1060 if(_intervalId === undefined) {
1061 _intervalId = setInterval(() => {
1062 action();
1063 if(!_isKeyDown){
1064 clearInterval(_intervalId);
1065 _intervalId = undefined;
1066 console.log("claered");
1067 }
1068 }, interval);
1069 }
1070 }
1071 },
1072
1073 stop(keycode) {
1074 if(keycode == key && document.activeElement.id.toLowerCase() !== 'chatbox') {
1075 _isKeyDown = false;
1076 }
1077 }
1078 };
1079
1080
1081}
1082
1083
1084const healer1 = repeater(51, () => {placeQ(foodType, boostDir);
1085 placeQ(foodType, boostDir);
1086 placeQ(foodType, boostDir)}, 50);
1087const healer2 = repeater(81, () => {placeQ(foodType, boostDir);
1088 placeQ(foodType, boostDir);
1089 placeQ(foodType, boostDir)}, 50);
1090const boostPlacer = repeater(70, () => {place(boostType)}, 0);
1091const fourSpawnpader = repeater(75, fourSpawnpad, 0);
1092const spikePlacer = repeater(86, () => {place(spikeType)}, 0);
1093const millPlacer = repeater(78, () => {place(millType)}, 0);
1094const turretPlacer = repeater(72, () => {place(turretType)}, 0);
1095
1096document.addEventListener('keydown', (e)=>{
1097 spikePlacer.start(e.keyCode);
1098 fourSpawnpader.start(e.keyCode);
1099 healer1.start(e.keyCode);
1100 healer2.start(e.keyCode);
1101 boostPlacer.start(e.keyCode);
1102 millPlacer.start(e.keyCode);
1103 turretPlacer.start(e.keyCode);
1104
1105 if (e.keyCode == 67 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1106 doNewSend(["13c", [1, 6, 0]]);
1107 doNewSend(["13c", [0, 6, 0]]);
1108 doNewSend(["13c", [0, 0, 1]]);
1109 doNewSend(["13c", [1, 19, 1]]);
1110 doNewSend(["13c", [0, 19, 1]]);
1111 }
1112
1113 if (e.keyCode == 49 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1114 autosecondary = false;
1115 autoprimary = true;
1116 setTimeout( () => {
1117 autoprimary = false;
1118 }, 330);
1119 }
1120
1121 if (e.keyCode == 50 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1122 autoprimary = false;
1123 autosecondary = true;
1124 setTimeout( () => {
1125 autosecondary = false;
1126 }, 330);
1127 }
1128
1129 if (e.keyCode == 82 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1130 doNewSend(["ch", ["*;::;*"]]);
1131 }
1132
1133 if (e.keyCode == 71 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1134 doNewSend(["13c", [1, 7, 0]]);
1135 doNewSend(["13c", [0, 7, 0]]);
1136 doNewSend(["13c", [0, 0, 1]]);
1137 doNewSend(["13c", [0, 19, 1]]);
1138 }
1139
1140 if (e.keyCode == 75 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1141 place(spawnpadType, myPlayer.dir + toRad(45));
1142 place(spawnpadType, myPlayer.dir - toRad(45));
1143 }
1144 if (e.keyCode == 90 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1145 doNewSend(["13c", [1, 40, 0]]);
1146 doNewSend(["13c", [0, 40, 0]]);
1147 doNewSend(["13c", [0, 0, 1]]);
1148 doNewSend(["13c", [0, 19, 1]]);
1149 }
1150
1151 if (e.keyCode == 84 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1152 doNewSend(["13c", [1, 22, 0]]);
1153 doNewSend(["13c", [0, 22, 0]]);
1154 doNewSend(["13c", [0, 0, 1]]);
1155 doNewSend(["13c", [0, 19, 1]]);
1156 }
1157
1158 if (e.keyCode == 9 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1159 doNewSend(["13c", [1, 11, 1]]);
1160 doNewSend(["13c", [0, 11, 1]]);
1161 doNewSend(["13c", [1, 12, 0]]);
1162 doNewSend(["13c", [0, 12, 0]]);
1163 doNewSend(["13c", [1, 31, 0]]);
1164 doNewSend(["13c", [1, 15, 0]]);
1165 }
1166
1167 if(e.keyCode == 106 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1168 healToggle = (healToggle + 1) % 2;
1169 }
1170
1171 if(e.keyCode == 113 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1172 clickInsta = (clickInsta + 1) % 2;
1173 }
1174
1175 if(e.keyCode == 40 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1176 doNewSend(["6", [5]]);
1177 doNewSend(["6", [17]]);
1178 doNewSend(["6", [31]]);
1179 doNewSend(["6", [23]]);
1180 doNewSend(["6", [9]]);
1181 doNewSend(["6", [38]]);
1182 doNewSend(["6", [28]]);
1183 doNewSend(["6", [15]]);
1184 }
1185
1186 if(e.keyCode == 35 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1187 doNewSend(["6", [7]]);
1188 doNewSend(["6", [17]]);
1189 doNewSend(["6", [31]]);
1190 doNewSend(["6", [27]]);
1191 doNewSend(["6", [10]]);
1192 doNewSend(["6", [38]]);
1193 doNewSend(["6", [4]]);
1194 doNewSend(["6", [15]]);
1195 }
1196
1197 if (e.keyCode == 9 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1198 if (myPlayer.y < 2400){
1199 doNewSend(["13c", [0, 15, 0]]);
1200 } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
1201 doNewSend(["13c", [0, 31, 0]]);
1202 } else {
1203 doNewSend(["13c", [0, 12, 0]]);
1204 }
1205 doNewSend(["13c", [0, 11, 1]]);
1206 }
1207
1208 if(e.keyCode == 82 && document.activeElement.id.toLowerCase() !== 'chatbox') {
1209 autoprimary = true;
1210 autosecondary = false;
1211 autoaim = true;
1212 autoprimary = true;
1213 autosecondary = false;
1214 doNewSend(["13c", [0, 0, 1]]);
1215 doNewSend(["5", [primary, true]]);
1216 doNewSend(["7", [1]]);
1217 doNewSend(["13c", [1, 7, 0]]);
1218 doNewSend(["13c", [0, 7, 0]]);
1219 doNewSend(["13c", [1, 21, 1]]);
1220 doNewSend(["13c", [0, 21, 1]]);
1221 setTimeout( () => {
1222 autoprimary = false;
1223 autosecondary = true;
1224 doNewSend(["13c", [0, 0, 0]]);
1225 doNewSend(["13c", [1, 53, 0]]);
1226 doNewSend(["13c", [0, 53, 0]]);
1227 doNewSend(["5", [secondary, true]]);
1228 }, 115);
1229 setTimeout( () => {
1230 doNewSend(["13c", [0, 0, 0]]);
1231 doNewSend(["7", [1]]);
1232 doNewSend(["5", [primary, true]]);
1233 doNewSend(["13c", [0, 11, 1]]);
1234 if (myPlayer.y < 2400){
1235 doNewSend(["13c", [0, 15, 0]]);
1236 } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
1237 doNewSend(["13c", [0, 31, 0]]);
1238 } else {
1239 doNewSend(["13c", [0, 12, 0]]);
1240 }
1241 autosecondary = false;
1242 autoaim = false;
1243 }, 230);
1244 }
1245})
1246
1247document.addEventListener('keyup', (e)=>{
1248 spikePlacer.stop(e.keyCode);
1249 fourSpawnpader.stop(e.keyCode);
1250 boostPlacer.stop(e.keyCode);
1251 millPlacer.stop(e.keyCode);
1252 turretPlacer.stop(e.keyCode);
1253 healer1.stop(e.keyCode);
1254 healer2.stop(e.keyCode);
1255})
1256
1257
1258function isElementVisible(e) {
1259 return (e.offsetParent !== null);
1260}
1261
1262function fourSpawnpad() {
1263 place(spawnpadType, myPlayer.dir + toRad(135));
1264 place(spawnpadType, myPlayer.dir + toRad(150));
1265 place(spawnpadType, myPlayer.dir + toRad(165));
1266 place(spawnpadType, myPlayer.dir + toRad(180));
1267 place(spawnpadType, myPlayer.dir + toRad(270));
1268 place(spawnpadType, myPlayer.dir + toRad(360));
1269}
1270
1271function toRad(angle) {
1272 return angle * 0.01745329251;
1273}
1274
1275function dist(a, b){
1276 return Math.sqrt( Math.pow((b.y-a[2]), 2) + Math.pow((b.x-a[1]), 2) );
1277}
1278
1279function update() {
1280 for (let i=0;i<9;i++){
1281 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
1282 primary = i;
1283 }
1284 }
1285
1286 for (let i=9;i<16;i++){
1287 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
1288 secondary = i;
1289 }
1290 }
1291
1292 for (let i=16;i<19;i++){
1293 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
1294 foodType = i - 16;
1295 }
1296 }
1297
1298 for (let i=19;i<22;i++){
1299 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
1300 wallType = i - 16;
1301 }
1302 }
1303
1304 for (let i=22;i<26;i++){
1305 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
1306 spikeType = i - 16;
1307 }
1308 }
1309
1310 for (let i=26;i<29;i++){
1311 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
1312 millType = i - 16;
1313 }
1314 }
1315
1316 for (let i=29;i<31;i++){
1317 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
1318 mineType = i - 16;
1319 }
1320 }
1321
1322 for (let i=31;i<33;i++){
1323 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
1324 boostType = i - 16;
1325 }
1326 }
1327
1328 for (let i=33;i<36;i++){
1329 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
1330 turretType = i - 16;
1331 }
1332 }
1333
1334 for (let i=36;i<37;i++){
1335 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
1336 spawnpadType = i - 16;
1337 }
1338 }
1339
1340 for (let i=37;i<39;i++){
1341 if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
1342 turretType = i - 16;
1343 }
1344 }
1345}
1346Public Pastes
1347My Log File
1348HTML 5 | 14 min ago
1349[ HABBO ] Packet P...
1350Python | 20 min ago
1351Untitled
1352PHP | 22 min ago
1353Pozitii elem pare/...
1354C++ | 32 min ago
1355Prelucrare sir
1356C++ | 58 min ago
1357SLA BreachMarker
1358C | 1 hour ago
1359Paste Ping
1360C | 1 hour ago
1361YinYangYoComicDrea...
1362Python | 1 hour ago
1363create new paste / syntax languages / archive / faq / tools / night mode / api / scraping api / news / pro
1364privacy statement / cookies policy / terms of serviceupdated / security disclosure / dmca / report abuse / contact
1365
1366By using Pastebin.com you agree to our cookies policy to enhance your experience.
1367Site design & logo © 2021 Pastebin