ScaledBot

OWOP ScaledBot.

  1. // ==UserScript==
  2. // @name ScaledBot
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @license MIT
  6. // @description OWOP ScaledBot.
  7. // @author scar17off
  8. // @match *://augustberchelmann.com/owop/*
  9. // @match *://ourworldofpixels.com/*
  10. // @match *://yourworldofpixels.glitch.me/*
  11. // @icon https://www.google.com/s2/favicons?domain=ourworldofpixels.com
  12. // @grant none
  13. // @namespace none
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. function install() {
  20. window.history.pushState("object or string", "Title", "/?#main");
  21. var OJS = null;
  22. if (!localStorage.scaled_height) {
  23. localStorage.scaled_height = "315px";
  24. };
  25. if (!localStorage.scaled_width) {
  26. localStorage.scaled_width = "680px";
  27. };
  28. let height = localStorage.scaled_height,
  29. width = localStorage.scaled_width;
  30. if(!OWOP.tool) OWOP.tool = OWOP.tools;
  31. if(!OWOP.tools) OWOP.tools = OWOP.tool;
  32. let f1 = 0;
  33. let radius121 = 0;
  34. let stop = false;
  35. let OldPaste = false;
  36. let wolfmove = false;
  37. let useplayer = false;
  38. let Pixelization = false;
  39. if(!OWOP.cursors.stamp) OWOP.cursors.paste = OWOP.cursors.stamp;
  40. if(!OWOP.cursors.shield) OWOP.cursors.shield = OWOP.cursors.protection;
  41. if (!localStorage.scaled_botnick) {
  42. localStorage.scaled_botnick = "SCALED_BOT";
  43. };
  44. let AutoLogin = false;
  45. let paintfollow = false;
  46. let AutoNickname = false;
  47. let AutoPassword = false;
  48. let folint;
  49. let FollowInterval;
  50. if (!localStorage.scaled_followinterval) {
  51. localStorage.scaled_followinterval = 79;
  52. FollowInterval = localStorage.scaled_followinterval;
  53. } else {
  54. FollowInterval = localStorage.scaled_followinterval;
  55. };
  56. let autoreconnecten = false;
  57. let animation = 0;
  58. let animations = {
  59. circle: 0,
  60. disk: 1,
  61. atom: 2,
  62. random: 3,
  63. wave: 4,
  64. line: 5,
  65. hyperbola: 6,
  66. ez: 7,
  67. botline: 8,
  68. x: 9,
  69. spiral: 10,
  70. cool: 11,
  71. disktwo: 12,
  72. topbottom: 13,
  73. laggy: 14,
  74. smallcircle: 15,
  75. eight: 16,
  76. cool2: 17,
  77. tworings: 18,
  78. threed: 19,
  79. flower: 20,
  80. square: 21,
  81. infinity: 22,
  82. infinity2: 23,
  83. default2: 24,
  84. trialge: 25,
  85. disk3: 26,
  86. saturn: 27,
  87. storm: 28,
  88. disk4: 29
  89. };
  90. let pattern = 0;
  91. let patterns = {
  92. lr: 0,
  93. tb: 1,
  94. rand: 2
  95. };
  96. let imgpattern = 0;
  97. let imgpatterns = {
  98. default: 0,
  99. random: 1,
  100. leftup: 2,
  101. grid: 3,
  102. square: 4
  103. };
  104. let eraserpattern = 0;
  105. let eraserpatterns = {
  106. tb: 0,
  107. lr: 1,
  108. perfect: 2
  109. };
  110. const SITEKEY = "6LcgvScUAAAAAARUXtwrM8MP0A0N70z4DHNJh-KI";
  111. let following = false;
  112. let cont;
  113. let BOTS = [];
  114. let over, newX, newY, pixel, color
  115. let rendercaptchaen = false;
  116. function componentToHex(c) {
  117. var hex = c.toString(16);
  118. return hex.length == 1 ? "0" + hex : hex;
  119. };
  120. function rgbtohex(r, g, b) {
  121. return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
  122. };
  123. append("https://raw.githack.com/Olical/EventEmitter/master/EventEmitter.min.js", () => {
  124. function Bucket(rate, time) {
  125. this.lastCheck = Date.now();
  126. this.allowance = rate;
  127. this.rate = rate;
  128. this.time = time;
  129. this.infinite = false;
  130. }
  131. Bucket.prototype.canSpend = function(count) {
  132. if (this.infinite) {
  133. return true;
  134. }
  135. this.allowance += (Date.now() - this.lastCheck) / 1000 * (this.rate / this.time);
  136. this.lastCheck = Date.now();
  137. if (this.allowance > this.rate) {
  138. this.allowance = this.rate;
  139. }
  140. if (this.allowance < count) {
  141. return false;
  142. }
  143. this.allowance -= count;
  144. return true;
  145. };
  146. OJS = class extends EventEmitter {
  147. // Options: "no_log", "ws", "origin", "agent", "index"
  148. constructor(options) {
  149. super();
  150. let init = {};
  151. let that = this;
  152. if (!options.origin) options.origin = location.href.replaceAll("?", "");
  153. if (!options.ws) options.ws = OWOP.options.serverAddress[0].url;
  154. if (!options.proxy) {options.device = "🖥️"} else {options.device = "📡"};
  155. if (options.origin) init.origin = options.origin;
  156. if (options.agent) init.agent = options.agent;
  157. let OJS = this;
  158. this.ws = new WebSocket(options.ws, null, init);
  159. this.ws.binaryType = 'arraybuffer';
  160. this.RANKS = {
  161. ADMIN: 3,
  162. MOD: 2,
  163. USER: 1,
  164. NONE: 0
  165. };
  166. this.options = {
  167. device: "🖥️",
  168. isJoined: false,
  169. id: options.ind,
  170. ind: options.ind,
  171. index: options.ind,
  172. busy: false,
  173. canSay: true,
  174. tickAmount: 30,
  175. special: 0,
  176. class: null,
  177. chunkSize: 16,
  178. netUpdateSpeed: 20,
  179. clusterChunkAmount: 64,
  180. maxWorldNameLength: 24,
  181. worldBorder: 0xFFFFF,
  182. chatBucket: [4, 6],
  183. captchaState: {
  184. CA_WAITING: 0,
  185. CA_VERIFYING: 1,
  186. CA_VERIFIED: 2,
  187. CA_OK: 3,
  188. CA_INVALID: 4
  189. },
  190. captchaNames: {
  191. 0: "WAITING",
  192. 1: "VERIFYING",
  193. 2: "VERIFIED",
  194. 3: "OK",
  195. 4: "INVALID"
  196. },
  197. tools: {
  198. id: {
  199. 'cursor': 0,
  200. 'move': 1,
  201. 'pipette': 2,
  202. 'eraser': 3,
  203. 'zoom': 4,
  204. 'fill': 5,
  205. 'paste': 6,
  206. 'export': 7,
  207. 'line': 8,
  208. 'protect': 9,
  209. 'copy': 10
  210. },
  211. 0: 'cursor',
  212. 1: 'move',
  213. 2: 'pipette',
  214. 3: 'eraser',
  215. 4: 'zoom',
  216. 5: 'fill',
  217. 6: 'paste',
  218. 7: 'export',
  219. 8: 'line',
  220. 9: 'protect',
  221. 10: 'copy'
  222. },
  223. misc: {
  224. worldVerification: OWOP.options.serverAddress[0].proto.misc.worldVerification,
  225. chatVerification: OWOP.options.serverAddress[0].proto.misc.chatVerification,
  226. tokenVerification: OWOP.options.serverAddress[0].proto.misc.tokenVerification
  227. },
  228. opCode: {
  229. setId: 0,
  230. worldUpdate: 1,
  231. chunkLoad: 2,
  232. teleport: 3,
  233. setRank: 4,
  234. captcha: 5,
  235. setPQuota: 6,
  236. chunkProtected: 7
  237. }
  238. };
  239. this.chat = {
  240. recvModifier: msg => msg,
  241. sendModifier: msg => msg,
  242. send: msg => OJS.ws.send(OJS.chat.sendModifier(msg) + OJS.options.misc.chatVerification),
  243. sendWS: msg => {
  244. OJS.ws.send(msg)
  245. },
  246. firstdata: () => OJS.chat.history[0],
  247. lastdata: () => OJS.chat.history[OJS.chat.history.length - 1],
  248. history: []
  249. };
  250. this.world = {
  251. join: (world = "main") => {
  252. if (OJS.ws.readyState !== 1) OJS.ws = new WebSocket(options.ws, null, init);
  253. let ints = [];
  254. world = world.toLowerCase();
  255. for (let i = 0; i < world.length && i < 24; i++) {
  256. let charCode = world.charCodeAt(i);
  257. if ((charCode < 123 && charCode > 96) || (charCode < 58 && charCode > 47) || charCode === 95 || charCode === 46) {
  258. ints.push(charCode);
  259. }
  260. }
  261. let array = new ArrayBuffer(ints.length + 2);
  262. let dv = new DataView(array);
  263. for (let i = ints.length; i--;) {
  264. dv.setUint8(i, ints[i]);
  265. }
  266. dv.setUint16(ints.length, OJS.options.misc.worldVerification, true);
  267. OJS.ws.send(array);
  268. OJS.utils.log("Joining world: " + world);
  269. OJS.emit(OJS.events.CONNECT);
  270. OJS.world.name = world;
  271.  
  272. let color = rgbtohex(OJS.player.color[0], OJS.player.color[1], OJS.player.color[2]);
  273. var bottable = document.createElement("tr");
  274. bottable.innerHTML = `<td id="scaled-bots-menu-list-bot-${options.ind}">`+options.ind+`</td><td id="scaled-bots-menu-list-bot-${options.ind}-x">`+OJS.player.x+`</td><td id="scaled-bots-menu-list-bot-${options.ind}-y">`+OJS.player.y+`</td><td id="scaled-bots-menu-list-bot-${options.ind}-pq">`+OJS.utils.bucket.allowance+`</td><td id="scaled-bots-menu-list-bot-${options.ind}-color">`+color+`</td><td id="scaled-bots-menu-list-bot-${options.ind}-device">`+options.device+'</td>'+`<button id="scaled-bots-menu-list-bot-${options.ind}-leave">Disconnect</button>`+'&nbsp&nbsp';
  275. bottable.id = `scaled-bots-menu-list-bot-${options.ind}`;
  276. document.getElementById("scaled-bots-menu-list").appendChild(bottable);
  277. document.getElementById(`scaled-bots-menu-list-bot-${options.ind}-leave`).addEventListener("click", () => {
  278. that.world.leave();
  279. document.getElementById(`scaled-bots-menu-list-bot-${options.ind}`).style.display = "none";;
  280. });
  281. if (options.proxy) document.getElementById(`scaled-proxy-proxyconns-${options.proxy}`).innerText = parseInt(document.getElementById(`scaled-proxy-proxyconns-${options.proxy}`).innerText) + 1;
  282. OJS.options.isJoined = true;
  283. return true;
  284. },
  285. leave: () => {
  286. OJS.ws.close()
  287. },
  288. move: (x, y) => {
  289. if (this.ws.readyState !== 1) return;
  290. let array = new ArrayBuffer(12);
  291. let dv = new DataView(array);
  292. dv.setInt32(0, 16 * x, true);
  293. dv.setInt32(4, 16 * y, true);
  294. dv.setUint8(8, OWOP.player.selectedColor[0]);
  295. dv.setUint8(9, OWOP.player.selectedColor[1]);
  296. dv.setUint8(10, OWOP.player.selectedColor[2]);
  297. dv.setUint8(11, OJS.options.tools.id[OWOP.player.tool.id]);
  298. OJS.ws.send(array);
  299. OJS.player.color[0] = OWOP.player.selectedColor[0];
  300. OJS.player.color[1] = OWOP.player.selectedColor[1];
  301. OJS.player.color[2] = OWOP.player.selectedColor[2];
  302. OJS.player.x = Math.round(16 * x);
  303. OJS.player.y = Math.round(16 * y);
  304. if (document.getElementById(`scaled-bots-menu-list-bot-${options.ind}`)) {
  305. document.getElementById(`scaled-bots-menu-list-bot-${options.ind}-x`).innerText = Math.round(x);
  306. document.getElementById(`scaled-bots-menu-list-bot-${options.ind}-y`).innerText = Math.round(y);
  307. document.getElementById(`scaled-bots-menu-list-bot-${options.ind}-color`).innerText = rgbtohex(OJS.player.color[0], OJS.player.color[1], OJS.player.color[2]);
  308. };
  309. },
  310. setPixel: async function(x = OJS.player.x, y = OJS.player.y, color = OJS.player.color) {
  311. let oldPlayerX = OJS.player.x;
  312. let oldPlayerY = OJS.player.y;
  313. let c = OWOP.world.getPixel(x, y);
  314. //if(isProtected(x, y)) return;
  315. if (c)
  316. if (c[0] === color[0] && c[1] === color[1] && c[2] === color[2]) return;
  317. OJS.world.move(x, y);
  318. if (!OJS.utils.bucket.canSpend(1)) return false;
  319. let array = new ArrayBuffer(11);
  320. let dv = new DataView(array);
  321. dv.setInt32(0, x, true);
  322. dv.setInt32(4, y, true);
  323. dv.setUint8(8, color[0]);
  324. dv.setUint8(9, color[1]);
  325. dv.setUint8(10, color[2]);
  326. OJS.player.color = [color[0], color[1], color[2]];
  327. document.getElementById(`scaled-bots-menu-list-bot-${options.ind}-color`).innerText = rgbtohex(OJS.player.color[0], OJS.player.color[1], OJS.player.color[2]);
  328.  
  329. if(useplayer) OWOP.world.setPixel(x, y, color);
  330. OJS.ws.send(array);
  331. if(wolfmove) OJS.world.move(oldPlayerX, oldPlayerY);
  332. return true;
  333. },
  334. clearChunk: (x = OJS.player.x, y = OJS.player.y) => {
  335. if (OJS.player.rank >= OJS.RANKS.MOD) {
  336. let array = new ArrayBuffer(9);
  337. let dv = new DataView(array);
  338. dv.setInt32(0, x, true);
  339. dv.setInt32(4, y, true);
  340. OJS.ws.send(array);
  341. return true;
  342. } else {
  343. console.error("[ERROR]: You are not admin!");
  344. return false
  345. }
  346. },
  347. setColor: function(rgb) {
  348. if (typeof rgb !== "object") return OJS.utils.log(`Please use array.`);
  349. let array = new ArrayBuffer(12);
  350. let dv = new DataView(array);
  351. dv.setInt32(0, OJS.player.x, true);
  352. dv.setInt32(4, OJS.player.y, true);
  353. dv.setUint8(8, rgb[0]);
  354. dv.setUint8(9, rgb[1]);
  355. dv.setUint8(10, rgb[2]);
  356. dv.setUint8(11, OJS.player.tool);
  357. OJS.ws.send(array);
  358. OJS.player.color = [rgb[0], rgb[1], rgb[2]];
  359. document.getElementById(`scaled-bots-menu-list-bot-${options.ind}-color`).innerText = rgbtohex(OJS.player.color[0], OJS.player.color[1], OJS.player.color[2]);
  360. },
  361. setTool: function(toolId) {
  362. let array = new ArrayBuffer(12);
  363. let dv = new DataView(array);
  364. dv.setInt32(0, OJS.player.x, true);
  365. dv.setInt32(4, OJS.player.y, true);
  366. dv.setUint8(8, OJS.player.color[0]);
  367. dv.setUint8(9, OJS.player.color[1]);
  368. dv.setUint8(10, OJS.player.color[2]);
  369. dv.setUint8(11, toolId);
  370. OJS.ws.send(array);
  371. OJS.player.tool = toolId;
  372. },
  373. protectChunk: function(x, y, newState) {
  374. if (OJS.player.rank >= OJS.RANKS.MOD) {
  375. let array = new ArrayBuffer(10);
  376. let dv = new DataView(array);
  377. dv.setInt32(0, x, true);
  378. dv.setInt32(4, y, true);
  379. dv.setUint8(8, newState);
  380. OJS.ws.send(array);
  381. } else {
  382. console.error("[ERROR]: No permission.")
  383. }
  384. },
  385. getPixel: OWOP.world.getPixel,
  386. name: null
  387. };
  388. this.player = {
  389. id: 0,
  390. rank: 1,
  391. x: 0,
  392. y: 0,
  393. color: [0, 0, 0],
  394. tool: 1
  395. };
  396. this.players = {};
  397. this.utils = {
  398. bucket: new Bucket(32, 4),
  399. log: msg => {
  400. if (!options.no_log && msg[0] !== "[" && isNaN(parseInt(msg[0]))) console.log(`${options.index ? `(${options.index}) ` : ""}` + `[OWOP.js]: ${msg}`)
  401. },
  402. setNickname: name => {
  403. this.chat.send("/nick " + name);
  404. },
  405. dataHandler: async data => {
  406. if (typeof data !== "object") return;
  407. let op = OJS.options.opCode;
  408. data = new DataView(data);
  409. switch (data.getUint8(0)) {
  410. case op.setId:
  411. OJS.player.id = data.getUint32(1);
  412. OJS.utils.log(`Joined world ${OJS.world.name}, your ID is: ${data.getUint32(1)}.`);
  413. OJS.emit(OJS.events.ID, OJS.player.id);
  414. break;
  415. case op.worldUpdate:
  416. let updated = false;
  417. let updates = {};
  418. for (let i = data.getUint8(1); i--;) {
  419. updated = true;
  420. let pid = data.getUint32(2 + i * 16);
  421. let pmx = data.getUint32(2 + i * 16 + 4);
  422. let pmy = data.getUint32(2 + i * 16 + 8);
  423. let pr = data.getUint8(2 + i * 16 + 12);
  424. let pg = data.getUint8(2 + i * 16 + 13);
  425. let pb = data.getUint8(2 + i * 16 + 14);
  426. let ptool = data.getUint8(2 + i * 16 + 15);
  427. updates[pid] = {
  428. x: pmx,
  429. y: pmy,
  430. rgb: [pr, pg, pb],
  431. tool: OJS.options.tools[ptool]
  432. };
  433. OJS.players[pid] = {
  434. x: updates[pid].x >> 4,
  435. y: updates[pid].y >> 4,
  436. rgb: updates[pid].rgb,
  437. tool: updates[pid].tool
  438. };
  439. }
  440. if (updated) OJS.emit(OJS.events.UPDATE, updates);
  441. break;
  442. case op.setRank:
  443. OJS.utils.log(`Got rank ${data.getUint8(1)}`);
  444. OJS.player.rank = data.getUint8(1);
  445. OJS.emit(OJS.events.RANK, OJS.player.rank);
  446. break;
  447. case op.captcha:
  448. console.log(OJS.options.captchaNames[data.getUint8(1)]);
  449. switch (data.getUint8(1)) {
  450. case OJS.options.captchaState.CA_WAITING:
  451. this.options.captcha = true;
  452. if (!localStorage.owopcaptcha) OJS.ws.send(OWOP.options.serverAddress[0].proto.misc.tokenVerification + await renderCaptcha())
  453. else OJS.ws.send(`CaptchALETMEINPLZ${localStorage.owopcaptcha}`);
  454. break;
  455. case OJS.options.captchaState.CA_OK:
  456. OJS.world.join(OWOP.world.name);
  457. };
  458. OJS.emit(OJS.events.CAPTCHA);
  459. break;
  460. case op.teleport:
  461. let x = data.getInt32(1, !0),
  462. y = data.getInt32(5, !0);
  463. OJS.emit(OJS.events.TELEPORT, x, y);
  464. break;
  465. case op.setPQuota:
  466. let rate = data.getUint16(1, !0),
  467. time = data.getUint16(3, !0);
  468. OJS.utils.bucket = new Bucket(rate, time);
  469. OJS.emit(OJS.events.PQUOTA, rate, time);
  470. OJS.utils.log(`Got new PQuota: ${rate}x${time}.`);
  471. break;
  472. }
  473. }
  474. };
  475. this.events = {
  476. CONNECT: 0,
  477. data: 1,
  478. ID: 2,
  479. RANK: 3,
  480. DISCONNECT: 4,
  481. UPDATE: 5,
  482. TELEPORT: 6,
  483. CAPTCHA: 7,
  484. PQUOTA: 8,
  485. CHUNK: 9
  486. };
  487. let pqi = setInterval(() => {
  488. if (!document.getElementById(`scaled-bots-menu-list-bot-${options.ind}-pq`)) return;
  489. for (let i = 0; i < BOTS.length - 1; i++) BOTS[i].utils.bucket.canSpend(0);
  490. document.getElementById(`scaled-bots-menu-list-bot-${options.ind}-pq`).innerText = Math.round(OJS.utils.bucket.allowance);
  491. }, 20);
  492. this.ws.onopen = () => {
  493. this.emit("open")
  494. };
  495. this.ws.onmessage = msg => {
  496. OJS.utils.dataHandler(msg.data);
  497. if (typeof msg.data !== "string") return;
  498. if (msg.data.startsWith('<')) return;
  499. OJS.utils.log(OJS.chat.recvModifier(msg.data));
  500. this.emit("data", OJS.chat.recvModifier(msg.data));
  501. };
  502. this.ws.onclose = () => {
  503. document.getElementById(`scaled-bots-menu-list-bot-${options.ind}`).parentElement.style.display = "none";
  504. if (!autoreconnecten) //OWOP.chat.local(`[${options.ind}]: Closed connection.`)
  505. BOTS = BOTS.filter(i => i.options.ind !== options.ind);
  506. console.log(`[OWOP.js]: Disconnected.`);
  507. if (autoreconnecten) BOTS.push(new struct(options));
  508. this.emit("close")
  509. };
  510. };
  511. }});
  512. let ProxyPasswords = localStorage.scaled_proxies;
  513. if (!ProxyPasswords) ProxyPasswords = [];
  514. if (localStorage.scaled_proxies) ProxyPasswords = ProxyPasswords.split(",");
  515. const updateServers = () => {
  516. const servers = document.getElementById("scaled-proxies-menu-list");
  517. for (let i in ProxyPasswords) {
  518. const Proxy = ProxyPasswords[i];
  519. let proxytable = document.createElement("tr");
  520. proxytable.id = `scaled-proxy-${Proxy}`;
  521. proxytable.innerHTML = `<td id="scaled-proxy-${Proxy}">${Proxy}</td><td id="scaled-proxy-proxystatus-${Proxy}" style="color: yellow;">=</td><td id="scaled-proxy-proxyconns-${Proxy}">?</td><td><button id="scaled-proxy-proxyjoin-${Proxy}">Connect</button></td><td><button id="scaled-proxy-proxydisconnect-${Proxy}">Disconnect</button></td><td><button id="scaled-proxy-proxydelete-${Proxy}">Delete</button></td>`+'&nbsp&nbsp';
  522. servers.appendChild(proxytable);
  523. document.getElementById(`scaled-proxy-proxydelete-${Proxy}`).onclick = () => {
  524. delete localStorage.scaled_proxies[Proxy];
  525. delete ProxyPasswords[Proxy];
  526. localStorage.scaled_proxies = localStorage.scaled_proxies(e => e !== Proxy);
  527. ProxyPasswords = localStorage.scaled_proxies(e => e !== Proxy);
  528. };
  529. const WSCheck = new WebSocket(`wss://ws-proxy${Proxy}.glitch.me/?ws=WS-STATUS`);
  530. WSCheck.onopen = () => {
  531. onlineproxy += 1;
  532. if(checkingproxy !== 0) checkingproxy -= 1;
  533. document.getElementById(`scaled-proxy-proxystatus-${Proxy}`).innerText = "+";
  534. document.getElementById(`scaled-proxy-proxystatus-${Proxy}`).style.color = "lightgreen";
  535. document.getElementById(`scaled-proxy-proxyjoin-${Proxy}`).onclick = () => {
  536. proxyJoin(Proxy);
  537. };
  538. document.getElementById(`scaled-proxy-proxydisconnect-${Proxy}`).onclick = () => {
  539. for(let i in BOTS){
  540. if(BOTS[i].options.proxy == document.getElementById(`scaled-proxy-${Proxy}`).innerText){
  541. BOTS[i].ws.close();
  542. BOTS[i].slice();
  543. };
  544. };
  545. };
  546. WSCheck.send("WS-STATUS");
  547. };
  548. WSCheck.onmessage = msg => {
  549. document.getElementById(`scaled-proxy-proxyconns-${Proxy}`).innerText = parseInt(msg.data.split(",")[1]) - 1;
  550. WSCheck.close();
  551. };
  552. WSCheck.onerror = () => {
  553. if(onlineproxy !== 0) onlineproxy -= 1;
  554. checkingproxy -= 1;
  555. offlineproxy += 1;
  556. document.getElementById(`scaled-proxy-proxystatus-${Proxy}`).innerText = "-";
  557. document.getElementById(`scaled-proxy-proxystatus-${Proxy}`).style.color = "red";
  558. };
  559. };
  560. };
  561. let allproxy = ProxyPasswords.length;
  562. let checkingproxy = allproxy;
  563. let offlineproxy = 0;
  564. let onlineproxy = 0;
  565. const renderCaptcha = () => new Promise(resolve => {
  566. if (rendercaptchaen = true) {
  567. OWOP.windowSys.addWindow(new OWOP.windowSys.class.window(`Captcha`, {
  568. closeable: true
  569. }, function(win) {
  570. grecaptcha.render(win.addObj(OWOP.util.mkHTML("div", {})), {
  571. theme: "dark",
  572. sitekey: SITEKEY,
  573. callback: function callback(token) {
  574. win.close();
  575. resolve(token);
  576. }
  577. });
  578. }));
  579. };
  580. });
  581. const getFree = () => {
  582. let b = BOTS.filter(i => i.ws.readyState === 1);
  583. if (b.length === 0) return -1;
  584. if (last >= b.length) last = 0;
  585. return last++;
  586. };
  587. let botslen = 7;
  588. async function writeChar(matrix, x, y) {
  589. for (var xx = 0; xx < matrix.length; xx++)
  590. for (var yy = 0; yy < 8; yy += slen)
  591. for (var bb = 0; bb < slen; bb++)
  592. if ((matrix[xx] >> (7 - yy - bb)) & 1 && yy + bb < 8) {
  593. const abc = getFree();
  594. BOTS[abc].world.setPixel(x + xx, y + yy + bb, OWOP.player.selectedColor, false);
  595. };
  596. };
  597. async function writeText(str, x, y) {
  598. if (isNaN(x) || isNaN(y)) return OWOP.chat.local('Invalid Coordinates')
  599. str = str.toUpperCase();
  600. var len = str.length,
  601. ccode, matrix;
  602. for (var i = 0; i < len; i++) {
  603. ccode = str.charCodeAt(i);
  604. if (ccode >= 0x41 && ccode <= 0x5a)
  605. matrix = chars[ccode - 65];
  606. else if (ccode == 0x20) {
  607. x += 2;
  608. continue;
  609. } else if (ccode >= 0x30 && ccode <= 0x39)
  610. matrix = NUMS[ccode - 0x30];
  611. else if (symbols[ccode])
  612. matrix = symbols[ccode];
  613. else {
  614. continue;
  615. }
  616. writeChar(matrix, x, y);
  617. x += matrix.length + 1;
  618. }
  619. };
  620. const proxyJoin = server => {
  621. let ws = "wss://ws-proxy" + server + ".glitch.me";
  622. let BotCount = parseFloat(document.getElementById("scaled-main-menu-botcount").value);
  623. for (let i = 0; i < BotCount; i++) {
  624. const ofo = BOTS.length;
  625. BOTS[ofo] = new OJS({
  626. ws: ws + `?ws=${OWOP.options.serverAddress[0].url}`,
  627. origin: location.href,
  628. ind: ofo,
  629. proxy: server
  630. });
  631. BOTS[ofo].ws.onmessage = msg => {
  632. if (msg.data.toString().startsWith('You are banned.')) {
  633. document.getElementById(`scaled-proxy-proxystatus-${server}-proxystatus-${server}`).innerText = "|";
  634. document.getElementById(`scaled-proxy-proxystatus-${server}-proxystatus-${server}`).style.color = "yellow";
  635. //document.getElementById(`proxy-${server}`).style.cssText = "display:none";
  636. };
  637. };
  638. //BOTS[ofo].ws.onopen = () => {
  639. // if(AutoLogin = true){
  640. // if(localStorage.adminlogin) {
  641. // BOTS[ofo].chat.send(`/adminlogin ${localStorage.adminlogin}`);
  642. // };
  643. // };
  644. // if(AutoPassword = true) {
  645. // if(AutoPassword && JSON.parse(localStorage.worldPasswords)[OWOP.world.name]) BOTS[ofo].chat.send(`/pass ${JSON.parse(localStorage.worldPasswords)[OWOP.world.name]}`);
  646. // };
  647. // if(AutoNickname = true) {
  648. // BOTS[ofo].chat.send(`/nickname ${localStorage.scaled_botnick}`);
  649. // };
  650. //};
  651. };
  652. };
  653.  
  654. function drawRectbrush(x, y, w, h, color) {
  655. if (isNaN(x) || isNaN(y) || isNaN(w) || isNaN(h)) {
  656. return;
  657. }
  658. color = color || OWOP.player.selectedColor;
  659. let Y, X, i;
  660. for (Y = 0; Y < h; Y++) {
  661. for (X = 0; X < w; X += BOTS.length) {
  662. for (i = 0; i < BOTS.length; i++) {
  663. if (X + i < w) {
  664. over = 0;
  665. newX = X + i;
  666. newY = Y;
  667. pixel = OWOP.world.getPixel(x + newX, y + newY);
  668. if (pixel[0] !== color[0] || pixel[1] !== color[1] || pixel[2] !== color[2]) {
  669. let abc = getFree();
  670. BOTS[abc].world.setPixel(x + newX, y + newY, color);
  671. } else continue;
  672. }
  673. }
  674. }
  675. }
  676. };
  677. const upload = (accept = "*") => new Promise(resolve => {
  678. let file = document.createElement('input');
  679. file.type = "file";
  680. file.accept = accept;
  681. file.onchange = () => {
  682. let reader = new FileReader();
  683. reader.onloadend = () => {
  684. resolve(reader.result);
  685. };
  686. reader.readAsDataURL(file.files[0]);
  687. };
  688. file.click();
  689. });
  690. const refreshAssets = () => {
  691. let assets = localStorage.scaled_assets;
  692. if (!assets) assets = [];
  693. else assets = JSON.parse(assets);
  694. const assetsDiv = document.getElementById("scaled-assets-menu-assetlist");
  695. assetsDiv.innerHTML = "";
  696.  
  697. for (let i in assets) {
  698. const image = new Image();
  699. image.onload = () => {
  700. image.style.width = "48px";
  701. image.style.height = "48px";
  702. image.style.border = "solid 1px";
  703. image.onclick = e => {
  704. for (let j in document.getElementById("scaled-assets-menu-assetlist").children) {
  705. if (typeof(document.getElementById("scaled-assets-menu-assetlist").children[j]) !== "object") break;
  706. document.getElementById("scaled-assets-menu-assetlist").children[j].style.border = "solid 1px";
  707. }
  708. selectedAsset = assets[i];
  709. image.style.border = "solid 1px red";
  710. };
  711. image.oncontextmenu = e => {
  712. e.preventDefault();
  713. assets.splice(i, 1);
  714. localStorage.scaled_assets = JSON.stringify(assets);
  715. refreshAssets();
  716. }
  717. assetsDiv.append(image);
  718. };
  719. image.src = assets[i];
  720. }
  721. };
  722. const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
  723. let selectedAsset = null;
  724. let last = 0;
  725. OWOP.windowSys.addWindow(new OWOP.windowSys.class.window(" ", {
  726. closeable: true
  727. }, function(win) {
  728. let menu = document.createElement("div");
  729. let styles = document.createElement("style");
  730. styles.type = "text/css";
  731. styles.innerHTML = `
  732. th[id^="scaled-"], td[id^="scaled-"] {
  733. font-family: Verdana,sans-serif;
  734. font-size: 12px;
  735. padding: 2px 6px;
  736. width: 500px;
  737. text-align: center;
  738. }
  739. tr[id^="scaled-"]:first-child {
  740. font-family: Verdana,sans-serif;
  741. font-size: 12px;
  742. text-align: center;
  743. background-color: rgba(0, 0, 0, 0.5);
  744. }
  745. tr[id^="scaled-"]:nth-child(odd) {
  746. font-family: Verdana,sans-serif;
  747. font-size: 12px;
  748. background-color: rgba(0, 0, 0, 0.1);
  749. }
  750. table[id^="scaled-"] {
  751. border-collapse: collapse;
  752. border: 0px solid #000;
  753. color: #fff;
  754. text-shadow: -1px 0 #000, 0 1px #000, 1px 0 #000, 0 -1px #000;
  755. padding: 2px;
  756. }
  757. .circle:before{
  758. text-align: center;
  759. height: 90px;
  760. width: 90px;
  761. content: '';
  762. position: absolute;
  763. top:30px;
  764. left:0px;
  765. right:0px;
  766. bottom: 0px;
  767. border: 20px solid #fff;
  768. border-radius:50%;
  769. animation: animate 5s linear infinite;
  770. }
  771. @keyframes animate{
  772. 0%{
  773. box-shadow: 0 0 50px #0f0,0 0 50px #0f0 inset;
  774. filter: hue-rotate(0deg);
  775. }
  776. 20%{
  777. box-shadow: 0 0 60px #0f0,0 0 60px #0f0 inset;
  778. }
  779. 40%{
  780. box-shadow: 0 0 40px #0f0,0 0 40px #0f0 inset;
  781. }
  782. 60%{
  783. box-shadow: 0 0 80px #0f0,0 0 80px #0f0 inset;
  784. }
  785. 80%{
  786. box-shadow: 0 0 100px #0f0,0 0 100px #0f0 inset;
  787. }
  788. 100%{
  789. box-shadow: 0 0 50px #0f0,0 0 50px #0f0 inset;
  790. filter: hue-rotate(360deg);
  791. }
  792. }
  793. svg{
  794. width:0;
  795. height:0;
  796. }
  797. #scaled-menu-container {
  798. user-select: none;
  799. font-size: 14px;
  800. overflow: hidden;
  801. color: #fff;
  802. font-family: Verdana,sans-serif;
  803. box-sizing: border-box;
  804. position: fixed;
  805. top: 50%;
  806. left: 50%;
  807. height: 366px;
  808. width: 500px;
  809. margin-top: -183px;
  810. margin-left: -250px;
  811. z-index: 2147000000;
  812. }
  813. #scaled-main-menu {
  814. font-size: 12px;
  815. user-select: none;
  816. background-color: rgba(100, 100, 100, 0.4);
  817. color: #fff;
  818. font-family: Verdana,sans-serif;
  819. box-sizing: border-box;
  820. position: relative;
  821. height: 100%;
  822. padding: .5em 1em;
  823. border-top: none;
  824. margin-left: 130px;
  825. }
  826. #scaled-proxies-menu {
  827. font-size: 12px;
  828. user-select: none;
  829. color: #fff;
  830. font-family: Verdana,sans-serif;
  831. background-color: rgba(100, 100, 100, 0.4);
  832. box-sizing: border-box;
  833. position: relative;
  834. height: 100%;
  835. padding: .5em 1em;
  836. border-top: none;
  837. margin-left: 130px;
  838. }
  839. #scaled-assets-menu {
  840. font-size: 12px;
  841. user-select: none;
  842. color: #fff;
  843. font-family: Verdana,sans-serif;
  844. background-color: rgba(100, 100, 100, 0.4);
  845. box-sizing: border-box;
  846. position: relative;
  847. height: 100%;
  848. padding: .5em 1em;
  849. border-top: none;
  850. margin-left: 130px;
  851. }
  852. #scaled-config-menu {
  853. font-size: 12px;
  854. user-select: none;
  855. color: #fff;
  856. font-family: Verdana,sans-serif;
  857. background-color: rgba(100, 100, 100, 0.4);
  858. box-sizing: border-box;
  859. position: relative;
  860. height: 100%;
  861. padding: .5em 1em;
  862. border-top: none;
  863. margin-left: 130px;
  864. }
  865. #scaled-bots-menu {
  866. font-size: 12px;
  867. user-select: none;
  868. color: #fff;
  869. font-family: Verdana,sans-serif;
  870. background-color: rgba(100, 100, 100, 0.4);
  871. box-sizing: border-box;
  872. position: relative;
  873. height: 100%;
  874. padding: .5em 1em;
  875. border-top: none;
  876. margin-left: 130px;
  877. }
  878. #scaled-addons-menu {
  879. font-size: 12px;
  880. user-select: none;
  881. color: #fff;
  882. font-family: Verdana,sans-serif;
  883. background-color: rgba(100, 100, 100, 0.4);
  884. box-sizing: border-box;
  885. position: relative;
  886. height: 100%;
  887. padding: .5em 1em;
  888. border-top: none;
  889. margin-left: 130px;
  890. }
  891. .i-tab-content {
  892. font-size: 12px;
  893. user-select: none;
  894. color: #fff;
  895. font-family: Verdana,sans-serif;
  896. box-sizing: border-box;
  897. width: 100%;
  898. height: 100%;
  899. background-color: rgba(100, 100, 100, 0.4)
  900. }
  901. .i-tab-menu, .sidebar {
  902. font-size: 12px;
  903. user-select: none;
  904. color: #fff;
  905. font-family: Verdana,sans-serif;
  906. box-sizing: border-box;
  907. position: relative;
  908. background-color: rgba(120, 120, 120, 0.4);
  909. display: block;
  910. overflow: auto;
  911. float: left;
  912. width: 130px;
  913. height: 100%;
  914. box-shadow: 0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);
  915. }
  916. .i-tab-menu-item {
  917. font-size: 12px;
  918. user-select: none;
  919. text-decoration: none;
  920. font-family: Verdana,sans-serif;
  921. box-sizing: border-box;
  922. color: #d15151;
  923. }
  924. .i-tab-menu-item:hover {
  925. background-color: rgb(77, 73, 73, 0.5)
  926. !important;
  927. }
  928. #scaled-main-menu-item {
  929. user-select: none;
  930. color: #fff;
  931. font-family: Verdana,sans-serif;
  932. box-sizing: border-box;
  933. float: left;
  934. background-color: inherit;
  935. padding: 8px 8px;
  936. margin: 0;
  937. border: none;
  938. font-size: 14px;
  939. text-align: center;
  940. outline: 0;
  941. transition: .3s;
  942. width: 100%;
  943. }
  944. #scaled-proxies-menu-item {
  945. user-select: none;
  946. color: #fff;
  947. font-family: Verdana,sans-serif;
  948. box-sizing: border-box;
  949. float: left;
  950. background-color: inherit;
  951. padding: 8px 8px;
  952. margin: 0;
  953. border: none;
  954. font-size: 14px;
  955. text-align: center;
  956. outline: 0;
  957. transition: .3s;
  958. width: 100%;
  959. }
  960. #scaled-assets-menu-item {
  961. user-select: none;
  962. color: #fff;
  963. font-family: Verdana,sans-serif;
  964. box-sizing: border-box;
  965. float: left;
  966. background-color: inherit;
  967. padding: 8px 8px;
  968. margin: 0;
  969. border: none;
  970. font-size: 14px;
  971. text-align: center;
  972. outline: 0;
  973. transition: .3s;
  974. width: 100%;
  975. }
  976. #scaled-addons-menu-item {
  977. user-select: none;
  978. color: #fff;
  979. font-family: Verdana,sans-serif;
  980. box-sizing: border-box;
  981. float: left;
  982. background-color: inherit;
  983. padding: 8px 8px;
  984. margin: 0;
  985. border: none;
  986. font-size: 14px;
  987. text-align: center;
  988. outline: 0;
  989. transition: .3s;
  990. width: 100%;
  991. }
  992. #scaled-config-menu-item {
  993. user-select: none;
  994. color: #fff;
  995. font-family: Verdana,sans-serif;
  996. box-sizing: border-box;
  997. float: left;
  998. background-color: inherit;
  999. padding: 8px 8px;
  1000. margin: 0;
  1001. border: none;
  1002. font-size: 14px;
  1003. text-align: center;
  1004. outline: 0;
  1005. transition: .3s;
  1006. width: 100%;
  1007. }
  1008. #scaled-bots-menu-item {
  1009. user-select: none;
  1010. color: #fff;
  1011. font-family: Verdana,sans-serif;
  1012. box-sizing: border-box;
  1013. float: left;
  1014. background-color: inherit;
  1015. padding: 8px 8px;
  1016. margin: 0;
  1017. border: none;
  1018. font-size: 14px;
  1019. text-align: center;
  1020. outline: 0;
  1021. transition: .3s;
  1022. width: 100%;
  1023. }
  1024. .i-tab-menu-item {
  1025. user-select: none;
  1026. color: #fff;
  1027. font-family: Verdana,sans-serif;
  1028. box-sizing: border-box;
  1029. float: left;
  1030. background-color: inherit;
  1031. padding: 8px 8px;
  1032. margin: 0;
  1033. border: none;
  1034. font-size: 14px;
  1035. text-align: center;
  1036. outline: 0;
  1037. transition: .3s;
  1038. width: 100%;
  1039. }
  1040. .is-active {
  1041. background-color: rgb(140, 0, 255, 0.5) !important;
  1042. }
  1043. label {
  1044. cursor: default;
  1045. }
  1046. .wincontainer {
  1047. background-color: rgba(53, 53, 53, 1);
  1048. }
  1049. #windows > div, .winframe {
  1050. position: absolute;
  1051. pointer-events: auto;
  1052. background-color: rgb(22, 21, 21);
  1053. border: 11px solid rgb(22, 21, 21);
  1054. border-width: 11px;
  1055. -o-border-image: url(https://raw.githubusercontent.com/scar17off/OSM-2-packages/main/packages/assets/window_out.png) 11 repeat;
  1056. border-image: url(https://raw.githubusercontent.com/scar17off/OSM-2-packages/main/packages/assets/window_out.png) 11 repeat;
  1057. border-image-outset: 1px;
  1058. }
  1059. button[id^="tool-"]:not(.selected) > div {
  1060. background-image: url("https://github.com/scar17off/OSM-2-packages/blob/main/packages/assets/scaledbottoolset.png?raw=true") !important;
  1061. background-color: rgba(69, 69, 69, 1);
  1062. }
  1063. *[id^="scaled-"] {
  1064. font-family: 'Hammersmith One';
  1065. font-size: 13px;
  1066. -webkit-touch-callout: none;
  1067. -webkit-user-select: none;
  1068. -khtml-user-select: none;
  1069. -moz-user-select: none;
  1070. -ms-user-select: none;
  1071. user-select: none;
  1072. }
  1073. fieldset {
  1074. display: block;
  1075. margin-inline-start: 2px;
  1076. margin-inline-end: 2px;
  1077. padding-block-start: 0.35em;
  1078. padding-inline-start: 0.75em;
  1079. padding-inline-end: 0.75em;
  1080. padding-block-end: 0.625em;
  1081. min-inline-size: min-content;
  1082. border-width: 2px;
  1083. border-style: groove;
  1084. border-image: initial;
  1085. border-color: rgba(115, 115, 115, 1);
  1086. }
  1087. button[id^="scaled"] {
  1088. border-width: 1px;
  1089. border-style: groove;
  1090. border-image: initial;
  1091. border-color: rgba(115, 115, 115, 1);
  1092. border: solid 1px;
  1093. background-color: #292929;
  1094. color: #919191;
  1095. }`;
  1096. menu.innerHTML = `
  1097. <div id="scaled-content">
  1098. <div class="circle">
  1099. <svg>
  1100. <filter id = "wavy">
  1101. <feTurbulence x="0" y="0" baseFrequency="0.5" numOctaves="5" seed="7"/>
  1102. <feDisplacementMap in="SourceGraphic" scale="30"/>
  1103. </filter>
  1104. </svg>
  1105. </div>
  1106. <div class="i-tab-menu sidebar">
  1107. <a><h2 class="i-tab-menu-item">Scaled Bot</h2></a>
  1108. <button id="scaled-main-menu-item" class="i-tab-menu-item">Main</button>
  1109. <button id="scaled-proxies-menu-item" class="i-tab-menu-item">Proxies</button>
  1110. <button id="scaled-assets-menu-item" class="i-tab-menu-item">Assets</button>
  1111. <button id="scaled-bots-menu-item" class="i-tab-menu-item">Bots</button>
  1112. <button id="scaled-addons-menu-item" class="i-tab-menu-item">Addons</button>
  1113. <button id="scaled-config-menu-item" class="i-tab-menu-item">Config</button>
  1114. <a><h1 id="scaled-made-by-item" class="i-tab-menu-item" title="made with love">Made by <a href="https://discord.gg/PRhsxYvWHq">scar17off</a>.</h2></a>
  1115. <a><h1 class="i-tab-menu-item"><span id="scaled-info-menu">0 bots, 0.00 chunks </span></h2></a>
  1116. </div>
  1117. <div id="scaled-main-menu">
  1118. <form>
  1119. <fieldset>
  1120. <legend>Connection Options</legend>
  1121. <div><input type="number" id="scaled-main-menu-botcount" style="width: 240; border: solid 1px;background-color: #292929; color: #919191; user-select: none;" placeholder="Count" value="5" id="scaled-main-menu-botcount" title="Number of bots to connect."></input></div>
  1122. <div><input type="checkbox" id="scaled-main-menu-captcharender" name="usecaptcharenderer"></input><label>Captcha Renderer</label></div>
  1123. <div><input type="checkbox" id="scaled-main-menu-autoreconnect" name="useautoreconnect"></input><label>Auto Reconnect</label></div>
  1124. <div><input type="checkbox" id="scaled-main-menu-autopassword" name="autopasswordenabler"></input><label>Auto Password</label></div>
  1125. <div><input type="checkbox" id="scaled-main-menu-autologin" name="autologinenabler"></input><label title="Automatically log ins as Admin or Moderator.">Auto Login</label></div>
  1126. <div><input type="checkbox" id="scaled-main-menu-autonickname" name="autonicknameenabler"></input><label title="Automatically sets bot nickname.">Auto Nickname</label></div>
  1127. </fieldset>
  1128. </form>
  1129. <hr>
  1130. <form>
  1131. <fieldset>
  1132. <legend>Bot Connection</legend>
  1133. <div><button id="scaled-main-menu-connect">Connect</button>
  1134. <button id="scaled-main-menu-disconnect">Disconnect</button></div>
  1135. </fieldset>
  1136. </form>
  1137. <hr>
  1138. <form>
  1139. <fieldset>
  1140. <legend>Follow Options</legend>
  1141. <div>
  1142. <select style="width: 240; font-size: 13px; border: solid 1px; background-color: #292929; color: #919191;" title="Follow select" id="scaled-main-menu-followselect">
  1143. <option>Circle</option>
  1144. <option>Disk</option>
  1145. <option>Atom</option>
  1146. <option>Random</option>
  1147. <option>Wave</option>
  1148. <option>Right-Left</option>
  1149. <option>Hyperbola</option>
  1150. <option>BotLine</option>
  1151. <option>X</option>
  1152. <option>Spiral</option>
  1153. <option>Cool</option>
  1154. <option>Disk 2</option>
  1155. <option>Top-Bottom</option>
  1156. <option>Laggy</option>
  1157. <option>Small Circle</option>
  1158. <option>8</option>
  1159. <option>Cool 2</option>
  1160. <option>3D</option>
  1161. <option>Flower</option>
  1162. <option>Infinity</option>
  1163. <option>Infinity 2</option>
  1164. <option>Square</option>
  1165. <option>Default 2</option>
  1166. <option>Disk 3</option>
  1167. <option>Saturn</option>
  1168. <option>Triagle</option>
  1169. <option>Storm</option>
  1170. <option>Disk 4</option>
  1171. </select>
  1172. <div><input type="checkbox" id="scaled-main-menu-follow" name="followenable">Follow</input></div>
  1173. <div><input type="checkbox" id="scaled-main-menu-paintfollow" name="paintfollowenable">Paint Follow</input></div>
  1174. </div>
  1175. </fieldset>
  1176. </form>
  1177. <hr>
  1178. <form>
  1179. <fieldset>
  1180. <legend>Chat</legend>
  1181. <div><input id="scaled-main-menu-send" placeholder="Message to send" title="Send" style="width: 240; border: solid 1px;background-color: #292929; color: #919191; user-select: none;"></input>
  1182. <button id="scaled-main-menu-botsend">Send</button></div>
  1183. </fieldset>
  1184. </form>
  1185. <hr>
  1186. <form>
  1187. <fieldset>
  1188. <legend>Paste Options</legend>
  1189. <div><label>Asset Paster Pattern</label>
  1190. <select style="width: 240px; font-size: 13px; border: solid 1px; background-color: #292929; color: #919191;" id="scaled-main-menu-assetpasterpattern">
  1191. <option>Default</option>
  1192. <option>Random</option>
  1193. <option>Left - Up</option>
  1194. <option>Grid</option>
  1195. <option>Square</option>
  1196. </select>
  1197. </div>
  1198. <div><label>Bot Area Pattern</label>
  1199. <select style="width: 240px; font-size: 13px; border: solid 1px; background-color: #292929; color: #919191;" id="scaled-main-menu-areapattern">
  1200. <option>Default</option>
  1201. <option>Top - Bottom</option>
  1202. <option>Random</option>
  1203. </select>
  1204. </div>
  1205. <div><label>Chunker Pattern</label>
  1206. <select style="width: 240px; font-size: 13px; border: solid 1px; background-color: #292929; color: #919191;" id="scaled-main-menu-eraserpattern">
  1207. <option>Top - Bottom</option>
  1208. <option>Left - Right</option>
  1209. <option>Perfect</option>
  1210. </select>
  1211. </div>
  1212. <div><input type="checkbox" id="scaled-main-menu-oldpaste" name="oldpasteenabler"></input><label title="Old Paste">Old Paste</label></div>
  1213. <div><input type="checkbox" id="scaled-main-menu-wolfmove" name="wolfmoveenabler"></input><label title="WolfMove">Wolf Move</label></div>
  1214. <div><input type="checkbox" id="scaled-main-menu-useplayer" name="useplayerenabler"></input><label title="UsePlayer">Use player</label></div>
  1215. </fieldset>
  1216. </form>
  1217. </div>
  1218. <div id="scaled-proxies-menu">
  1219. <form>
  1220. <fieldset>
  1221. <div><input id="scaled-proxies-menu-addproxy" placeholder="xxxx-yyyy" title="Enter your proxy here." style="width: 150px; height: 14px; border: solid 1px;background-color: #292929; color: #919191; user-select: none;"></input>
  1222. <button id="scaled-proxies-menu-add">Add</button>
  1223. <button id="scaled-proxies-menu-refresh">Refresh</button>
  1224. <button id="scaled-proxies-menu-delall">Delete all</button>
  1225. <button id="scaled-proxies-menu-conall">Connect all</button>
  1226. <br>
  1227. <label>Count: ${allproxy}</label>
  1228. <label id="scaled-proxies-menu-onlineproxy">Online proxies: ${onlineproxy}</label>
  1229. <label id="scaled-proxies-menu-offlineproxy">Offline proxies: ${offlineproxy}</label>
  1230. <label id="scaled-proxies-menu-checkingproxy">Checking proxy: ${checkingproxy}</label>
  1231. </div>
  1232. </fieldset>
  1233. </form>
  1234. <hr>
  1235. <table id="scaled-proxies-menu-list">
  1236. <tr id="scaled-proxies-menu-tr"><th id="scaled-proxies-menu-proxy">Proxy</th><th id="scaled-proxies-menu-status">Status</th><th id="scaled-proxies-menu-connections">Connections</th><th id="scaled-proxies-menu-actions">Actions</th>
  1237. </tr>
  1238. </table>
  1239. </div>
  1240. <div id="scaled-assets-menu">
  1241. <form>
  1242. <fieldset>
  1243. <div><button id="scaled-assets-menu-addasset" class="scaled-assets-menu">Add asset</button>
  1244. <button id="scaled-assets-menu-clear" class="scaled-assets-menu">Clear</button></div>
  1245. </fieldset>
  1246. </form>
  1247. <form>
  1248. <fieldset>
  1249. <div id="scaled-assets-menu-assetlist"></div>
  1250. </fieldset>
  1251. </form>
  1252. </div>
  1253. <div id="scaled-config-menu">
  1254. <div><input id="scaled-config-menu-config-proxies" style="border: 1px solid; background-color: #292929; color: #919191; margin: 0px; width: 510px; height: 16px;" placeholder="Proxy Passwords" value=${localStorage.scaled_proxies}></input></div>
  1255. <div><input type="number" id="scaled-config-menu-config-followint" style="border: 1px solid; background-color: #292929; color: #919191; margin: 0px; width: 510px; height: 16px;" placeholder="Follow Interval (ms)" value=${localStorage.scaled_followinterval}></input></div>
  1256. <div><input id="scaled-config-menu-config-botnick" style="border: 1px solid; background-color: #292929; color: #919191; margin: 0px; width: 510px; height: 16px;" placeholder="Bot nickname." value=${localStorage.scaled_botnick}></input></div>
  1257. </div>
  1258. <div id="scaled-bots-menu">
  1259. <form>
  1260. <fieldset>
  1261. <table id="scaled-bots-menu-list">
  1262. <tr id="scaled-bots-menu-tr">
  1263. <th id="scaled-bots-menu-id">Id</th><th id="scaled-bots-menu-x">X</th><th id="scaled-bots-menu-y">Y</th><th id="scaled-bots-menu-pq">PQuota</th><th id="scaled-bots-menu-color">Color</th><th id="scaled-bots-menu-ws">WS</th><th id="scaled-bots-menu-actions">Actions</th>
  1264. </tr>
  1265. </table>
  1266. </fieldset>
  1267. </form>
  1268. </div>
  1269. <div id="scaled-addons-menu">
  1270. <form>
  1271. <fieldset>
  1272. <div>
  1273. <select style="width: 240px; font-size: 13px; border: solid 1px; background-color: #292929; color: #919191;" id="scaled-addons-menu-list">
  1274. <option>Chunker with queue</option>
  1275. <option>Chess chunker</option>
  1276. </select>
  1277. <button id="scaled-addons-menu-load">Load</button>
  1278. </div>
  1279. <div>
  1280. <input id="scaled-addons-menu-url" style="border: 1px solid; background-color: #292929; color: #919191; margin: 0px; width: 430px; height: 16px;" placeholder="Link to raw addon."></input>
  1281. <button id="scaled-addons-menu-exec">Execute</button>
  1282. </div>
  1283. </fieldset>
  1284. </form>
  1285. </div>
  1286. </div>
  1287. `;
  1288. win.addObj(menu);
  1289. win.addObj(styles);
  1290. cont = win.container;
  1291. cont.style.height = height;
  1292. cont.style.maxHeight = height;
  1293. cont.style.width = width;
  1294. }).move(75, 75));
  1295.  
  1296. setInterval(() => {
  1297. document.getElementById("scaled-proxies-menu-onlineproxy").innerText = `Online proxies: ${onlineproxy}`;
  1298. document.getElementById("scaled-proxies-menu-offlineproxy").innerText = `Offline proxies: ${offlineproxy}`;
  1299. document.getElementById("scaled-proxies-menu-checkingproxy").innerText = `Checking proxies: ${checkingproxy}`;
  1300. }, 25);
  1301.  
  1302. document.getElementById("scaled-addons-menu-load").onclick = async () => {
  1303. let val = document.getElementById("scaled-addons-menu-list").value;
  1304. if (val === "Chunker with queue") loadAddon("chunkerwithqueue");
  1305. if (val === "Chess chunker") loadAddon("chesschunker");
  1306. };
  1307.  
  1308. function loadAddon(url) {
  1309. let xhttpt = new XMLHttpRequest();
  1310. xhttpt.open("GET", `https://raw.githubusercontent.com/scar17off/OSM-2-packages/main/packages/scaled-addons/${url}.js`);
  1311. xhttpt.responseType = "text";
  1312. xhttpt.addEventListener("load", function() {
  1313. eval(xhttpt.response);
  1314. });
  1315. xhttpt.send();
  1316. };
  1317.  
  1318. document.getElementById("scaled-main-menu-disconnect").onclick = async () => {
  1319. for (let i in BOTS) BOTS[i].ws.close();
  1320. BOTS = [];
  1321. };
  1322.  
  1323. document.getElementById("scaled-main-menu-eraserpattern").onchange = () => {
  1324. let val = document.getElementById("scaled-main-menu-eraserpattern").value;
  1325. if (val === "Left - Right") eraserpattern = eraserpatterns.lr;
  1326. if (val === "Top - Bottom") eraserpattern = eraserpatterns.tb;
  1327. if (val === "Perfect") eraserpattern = eraserpatterns.perfect;
  1328. };
  1329.  
  1330. document.getElementById("scaled-proxies-menu-conall").onclick = () => {
  1331. for (let i in ProxyPasswords) {
  1332. let Proxy = ProxyPasswords[i];
  1333. document.getElementById(`scaled-proxy-proxyjoin-${Proxy}`).click();
  1334. };
  1335. };
  1336.  
  1337. document.getElementById("scaled-main-menu-areapattern").onchange = () => {
  1338. let val = document.getElementById("scaled-main-menu-areapattern").value;
  1339. if (val === "Default") pattern = patterns.lr;
  1340. if (val === "Top - Bottom") pattern = patterns.tb;
  1341. if (val === "Random") pattern = patterns.rand;
  1342. };
  1343. document.getElementById("scaled-main-menu-assetpasterpattern").onchange = () => {
  1344. let val = document.getElementById("scaled-main-menu-assetpasterpattern").value;
  1345. if (val == "Default") imgpattern = imgpatterns.default;
  1346. if (val == "Left - Up") imgpattern = imgpatterns.leftup;
  1347. if (val == "Grid") imgpattern = imgpatterns.grid;
  1348. if (val == "Square") imgpattern = imgpatterns.square;
  1349. if (val == "Random") imgpattern = imgpatterns.random;
  1350. };
  1351.  
  1352. document.getElementById("scaled-main-menu-oldpaste").onchange = async () => {
  1353. if (!OldPaste) {
  1354. OldPaste = true;
  1355. } else {
  1356. OldPaste = false;
  1357. };
  1358. };
  1359.  
  1360. document.getElementById("scaled-main-menu-wolfmove").onchange = async () => {
  1361. if (!wolfmove) {
  1362. wolfmove = true;
  1363. } else {
  1364. wolfmove = false;
  1365. };
  1366. };
  1367.  
  1368. document.getElementById("scaled-main-menu-useplayer").onchange = async () => {
  1369. if (!useplayer) {
  1370. useplayer = true;
  1371. } else {
  1372. useplayer = false;
  1373. };
  1374. };
  1375.  
  1376. document.getElementById("scaled-main-menu-captcharender").onchange = async () => {
  1377. if (!rendercaptchaen) {
  1378. rendercaptchaen = true;
  1379. } else {
  1380. rendercaptchaen = false;
  1381. };
  1382. };
  1383.  
  1384. document.getElementById("scaled-assets-menu-clear").onclick = async () => {
  1385. localStorage.scaled_assets = [];
  1386. refreshAssets();
  1387. };
  1388.  
  1389. document.getElementById("scaled-main-menu-paintfollow").onchange = async () => {
  1390. if (!paintfollow) {
  1391. paintfollow = true;
  1392. } else {
  1393. paintfollow = false;
  1394. };
  1395. };
  1396.  
  1397. let botcount = 0;
  1398.  
  1399. setInterval(() => {
  1400. let o = 0;
  1401. for (let i in BOTS) {
  1402. o += BOTS[i].utils.bucket.allowance;
  1403. botcount = BOTS.filter(BOT => BOT.ws.readyState === 1).length;
  1404. };
  1405. let botchunks = (o / 256).toFixed(2);
  1406. document.getElementById("scaled-info-menu").innerText = botcount + ` bots, ` + botchunks + ` chunks`;
  1407. }, 25);
  1408.  
  1409. document.getElementById("scaled-main-menu-autopassword").onclick = async () => {
  1410. if (!AutoPassword) {
  1411. AutoPassword = true;
  1412. } else {
  1413. AutoPassword = false;
  1414. };
  1415. };
  1416.  
  1417. document.getElementById("scaled-main-menu-autonickname").onclick = async () => {
  1418. if (!AutoNickname) {
  1419. AutoNickname = true;
  1420. } else {
  1421. AutoNickname = false;
  1422. };
  1423. };
  1424.  
  1425. document.getElementById("scaled-proxies-menu-add").onclick = async () => {
  1426. let prox = document.getElementById("scaled-proxies-menu-addproxy").value;
  1427. if (prox == "") return;
  1428. ProxyPasswords.push(prox);
  1429. localStorage.scaled_proxies += ","+prox;
  1430. updateServers();
  1431. };
  1432.  
  1433. document.getElementById("scaled-main-menu-autologin").onchange = async () => {
  1434. if (!AutoLogin) {
  1435. AutoLogin = true;
  1436. } else {
  1437. AutoLogin = false;
  1438. };
  1439. };
  1440.  
  1441. document.getElementById("scaled-main-menu-botsend").onclick = async () => {
  1442. for (let i = 0; i < BOTS.length; i++) BOTS[i].chat.send(document.getElementById("scaled-main-menu-send").value);
  1443. };
  1444.  
  1445. document.getElementById("scaled-proxies-menu-delall").onclick = async () => {
  1446. localStorage.scaled_proxies = "";
  1447. ProxyPasswords = [];
  1448. updateServers();
  1449. };
  1450.  
  1451. document.getElementById("scaled-proxies-menu-refresh").onclick = async () => {
  1452. updateServers();
  1453. allproxy = ProxyPasswords.length;
  1454. offlineproxy = 0;
  1455. onlineproxy = 0;
  1456. checkingproxy = allproxy
  1457. };
  1458.  
  1459. document.getElementById("scaled-main-menu-connect").onclick = async () => {
  1460. let BotCount = parseFloat(document.getElementById("scaled-main-menu-botcount").value);
  1461. for (let i = 0; i < BotCount; i++) {
  1462. const ofo = BOTS.length + 0;
  1463. BOTS[ofo] = new OJS({
  1464. ind: ofo,
  1465. controller: true
  1466. });
  1467. //BOTS[ofo].ws.onopen = () => {
  1468. // if(AutoLogin = true){
  1469. // if(localStorage.adminlogin) {
  1470. // BOTS[ofo].chat.send(`/adminlogin ${localStorage.adminlogin}`);
  1471. // };
  1472. // };
  1473. // if(AutoPassword = true) {
  1474. // if(AutoPassword && JSON.parse(localStorage.worldPasswords)[OWOP.world.name]) BOTS[ofo].chat.send(`/pass ${JSON.parse(localStorage.worldPasswords)[OWOP.world.name]}`); };
  1475. // if(AutoNickname = true) {
  1476. // BOTS[ofo].chat.send(`/nickname ${localStorage.scaled_botnick}`);
  1477. // };
  1478. //};
  1479. }
  1480. };
  1481.  
  1482. let PI2 = 3 * Math.PI,
  1483. FOLLOWADD = PI2 / 45,
  1484. f = 0,
  1485. x, y,
  1486. offset = 0,
  1487. state = 1, a = 0
  1488. let spiral = {
  1489. step: 0,
  1490. PI2: 2 * Math.PI,
  1491. speed: ()=>((2 * Math.PI) / 30 / BOTS.length),
  1492. radius: (i) => i * 3
  1493. };
  1494. document.getElementById("scaled-main-menu-follow").onchange = () => {
  1495. if (!following) {
  1496. following = true;
  1497. folint = setInterval(() => {
  1498. let pos = {
  1499. x: OWOP.mouse.tileX,
  1500. y: OWOP.mouse.tileY
  1501. },
  1502. i = BOTS.length;
  1503. while (i--) {
  1504. if (animation === animations.hyperbola) {
  1505. if (!BOTS[i]) return;
  1506. if (!BOTS[i].options.isJoined) continue;
  1507. x = pos.x + Math.tan(2 * Math.PI * 2 / BOTS.length * i + f * BOTS.length);
  1508. y = pos.y + 1 / Math.tan(2 * Math.PI * 2 / BOTS.length * i + f * BOTS.length);
  1509. BOTS[i].world.move(x, y);
  1510. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1511. } else if (animation === animations.line) {
  1512. if (!BOTS[i]) return;
  1513. if (!BOTS[i].options.isJoined) continue;
  1514. x = pos.x + (Math.cos(2 * Math.PI * 2 ** BOTS.length * i + f) * BOTS.length);
  1515. y = pos.y + (Math.sin(2 * Math.PI * 2 / BOTS.length * i + f) * BOTS.length);
  1516. BOTS[i].world.move(x, y);
  1517. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1518. } else if (animation === animations.wave) {
  1519. if (!BOTS[i]) return;
  1520. if (!BOTS[i].options.isJoined) continue;
  1521. x = pos.x + (Math.cos(2 * Math.PI / BOTS.length * i + f) * BOTS.length);
  1522. y = pos.y + (Math.sin(2 * Math.PI * 2 / BOTS.length * i + f) * BOTS.length);
  1523. BOTS[i].world.move(x, y);
  1524. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1525. } else if (animation === animations.random) {
  1526. if (!BOTS[i]) return;
  1527. if (!BOTS[i].options.isJoined) continue;
  1528. x = pos.x + (Math.cos(2 * Math.PI * 2 / BOTS.length - i + f) * BOTS.length);
  1529. y = pos.y + (Math.sin(2 * Math.PI * 2 / BOTS.length * i + f) * BOTS.length);
  1530. BOTS[i].world.move(x, y);
  1531. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1532. } else if (animation === animations.atom) {
  1533. if (i >= BOTS.length / 2) {
  1534. x = pos.x + (Math.cos(2 * Math.PI * 2 / BOTS.length * i + f) * BOTS.length / 2),
  1535. y = pos.y + (Math.sin(2 * Math.PI * 2 / BOTS.length * i + f + 2) * BOTS.length / 2);
  1536. if (!BOTS[i].options.isJoined) continue;
  1537. BOTS[i].world.move(x, y);
  1538. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1539. } else {
  1540. if (!BOTS[i]) return;
  1541. if (!BOTS[i].options.isJoined) continue;
  1542. x = pos.x + (Math.cos(2 * Math.PI * 2 / BOTS.length * i + f + 2) * BOTS.length / 2);
  1543. y = pos.y + (Math.sin(2 * Math.PI * 2 / BOTS.length * i + f) * BOTS.length / 2);
  1544. BOTS[i].world.move(x, y);
  1545. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1546. }
  1547. } else if (animation === animations.circle) {
  1548. if (!BOTS[i]) return;
  1549. if (!BOTS[i].options.isJoined) continue;
  1550. x = pos.x + (Math.cos(2 * Math.PI * 2 / BOTS.length * i + f) * BOTS.length);
  1551. y = pos.y + (Math.sin(2 * Math.PI * 2 / BOTS.length * i + f) * BOTS.length);
  1552. BOTS[i].world.move(x, y);
  1553. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1554. } else if (animation === animations.disk) {
  1555. if (!BOTS[i]) return;
  1556. if (!BOTS[i].options.isJoined) continue;
  1557. x = pos.x + (Math.cos(2 * Math.PI * 2 / BOTS.length * i + f * 2) * BOTS.length);
  1558. y = pos.y + (Math.sin(2 * Math.PI * 2 / BOTS.length * i + f) * BOTS.length);
  1559. BOTS[i].world.move(x, y);
  1560. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1561. } else if (animation === animations.botline) {
  1562. if (!BOTS[i]) return;
  1563. if (!BOTS[i].options.isJoined) continue;
  1564. x = pos.x + i * 2;
  1565. y = pos.y;
  1566. BOTS[i].world.move(x, y);
  1567. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1568. } else if (animation === animations.x) {
  1569. if (!BOTS[i]) return;
  1570. if (!BOTS[i].options.isJoined) continue;
  1571. let r = 2 * Math.PI * 2 / BOTS.length * i + f;
  1572. if (i % 2 == 0) {
  1573. let s = Math.sin(r);
  1574. y = pos.y + (Math.cos(r) * 3 + 15 * s);
  1575. x = pos.x + (s * 15 + 3 * s);
  1576. } else {
  1577. let c = Math.cos(r)
  1578. x = pos.x + (c * 8 + 9 * c);
  1579. y = pos.y + (Math.sin(r) * 3 + -15 * c);
  1580. }
  1581. BOTS[i].world.move(x, y);
  1582. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1583. } else if (animation === animations.spiral) {
  1584. let speed = spiral.speed();
  1585. let radius = spiral.radius(i);
  1586.  
  1587. x = Math.cos(Math.PI / BOTS.length * i + spiral.step) * radius;
  1588. y = Math.sin(Math.PI / BOTS.length * i + spiral.step) * radius;
  1589. x += pos.x
  1590. y += pos.y
  1591.  
  1592. BOTS[i].world.move(x, y);
  1593. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1594.  
  1595. spiral.step += speed;
  1596. spiral.step %= spiral.PI2;
  1597. } else if (animation === animations.cool) {
  1598. x = pos.x + Math.cos(((Math.PI * 2 / BOTS.length) * i) + offset) * (radius * 16);
  1599. y = pos.y + Math.sin(((Math.PI * 2 / BOTS.length) * i) + offset) * (radius * 16);
  1600.  
  1601. offset += ((Math.PI * 2) / 100) / BOTS.length;
  1602.  
  1603. if (state === 1) {
  1604. radius -= 0.01;
  1605. if (radius <= 0.1) state = 2;
  1606. } else {
  1607. radius += 0.01;
  1608. if (radius >= BOTS.length * 0.1) state = 1
  1609. }
  1610. if (offset > Math.PI * 2) offset = 0;
  1611.  
  1612. BOTS[i].world.move(x, y);
  1613. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1614. } else if (animation === animations.disktwo) {
  1615. if (!BOTS[i]) return;
  1616. if (!BOTS[i].options.isJoined) continue;
  1617. x = pos.x + (Math.cos(2 * Math.PI * 2 / 4.09 * i + f * 2) * 4.09);
  1618. y = pos.y + (Math.sin(2 * Math.PI * 2 / 4.09 * i + f) * 4.09);
  1619. BOTS[i].world.move(x, y);
  1620. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1621. } else if (animation === animations.topbottom) {
  1622. if (!BOTS[i]) return;
  1623. if (!BOTS[i].options.isJoined) continue;
  1624. x = pos.x + (Math.sin(2 * Math.PI * 2 / BOTS.length * i + f) * BOTS.length);
  1625. y = pos.y + (Math.cos(2 * Math.PI * 2 ** BOTS.length * i + f) * BOTS.length);
  1626. BOTS[i].world.move(x, y);
  1627. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1628. } else if (animation === animations.laggy) {
  1629. if (i >= BOTS.length / 2) {
  1630. x = pos.x + (Math.cos(2 * Math.PI * 2 / 3.5 * i + f) * 3.5 / 2),
  1631. y = pos.y + (Math.sin(2 * Math.PI * 2 / 3.5 * i + f + 2) * 3.5 / 2);
  1632. if (!BOTS[i].options.isJoined) continue;
  1633. BOTS[i].world.move(x, y);
  1634. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1635. } else {
  1636. if (!BOTS[i]) return;
  1637. if (!BOTS[i].options.isJoined) continue;
  1638. x = pos.x + (Math.cos(2 * Math.PI * 2 / 4.05 * i + f + 2) * 4.0909 / 2);
  1639. y = pos.y + (Math.sin(2 * Math.PI * 2 / 4.05 * i + f) * 4.09 / 2);
  1640. BOTS[i].world.move(x, y);
  1641. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1642. }
  1643. } else if (animation === animations.smallcircle) {
  1644. if (!BOTS[i]) return;
  1645. if (!BOTS[i].options.isJoined) continue;
  1646. x = pos.x + (Math.cos(2 * Math.PI * 2 / 4.35 * i + f) * 4.35);
  1647. y = pos.y + (Math.sin(2 * Math.PI * 2 / 4.35 * i + f) * 4.35);
  1648. BOTS[i].world.move(x, y);
  1649. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1650. } else if (animation === animations.eight) {
  1651. if (!BOTS[i]) return;
  1652. if (!BOTS[i].options.isJoined) continue;
  1653. x = pos.x + (Math.sin(10 * Math.PI / BOTS.length * i * f) * BOTS.length / 1.768);
  1654. y = pos.y + (Math.cos(5 * Math.PI / BOTS.length * i * f) * BOTS.length / 1.768);
  1655. BOTS[i].world.move(x, y);
  1656. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1657. } else if (animation === animations.cool2) {
  1658. if (i >= BOTS.length / 2) {
  1659. x = pos.x + (Math.cos(8 * Math.PI * 2 / BOTS.length + 5 * i + f) * BOTS.length / 4),
  1660. y = pos.y + (Math.sin(8 * Math.PI * 2 / BOTS.length + 5 * i + f + 10) * BOTS.length / 4);
  1661. if (!BOTS[i].options.isJoined) continue;
  1662. BOTS[i].world.move(x, y);
  1663. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1664. } else {
  1665. if (!BOTS[i]) return;
  1666. if (!BOTS[i].options.isJoined) continue;
  1667. x = pos.x + (Math.cos(1.1 * Math.PI * 2 / BOTS.length + 5 * i + f + 10) * BOTS.length / 4);
  1668. y = pos.y + (Math.sin(1.1 * Math.PI * 2 / BOTS.length + 5 * i + f) * BOTS.length / 4);
  1669. BOTS[i].world.move(x, y);
  1670. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1671. }
  1672. } else if (animation === animations.threed) {
  1673. if (i >= BOTS.length / 2) {
  1674. y = pos.y + Math.cos(2 * Math.PI / BOTS * i + f) * 40;
  1675. x = pos.x + Math.sin(2 * Math.PI * 2 / BOTS * i + f) * 40;
  1676. if (!BOTS[i].options.isJoined) continue;
  1677. BOTS[i].world.move(x, y);
  1678. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1679. } else {
  1680. if (!BOTS[i]) return;
  1681. if (!BOTS[i].options.isJoined) continue;
  1682. x = pos.x + (Math.cos(2 * Math.PI * 4 / 4.09 * i + f * 2.5) * 9); // 4.09, 4.09
  1683. y = pos.y + (Math.sin(2 * Math.PI * 2 / 4.09 * i + f) * 9); // 4.09, 4.09
  1684. BOTS[i].world.move(x, y);
  1685. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1686. }
  1687. } else if (animation === animations.flower) {
  1688. if (!BOTS[i]) return;
  1689. if (!BOTS[i].options.isJoined) continue;
  1690. if (state === 1) {
  1691. radius121 -= 0.1;
  1692. localStorage.buxxed_followint - 1;
  1693. if (radius121 <= 1) {
  1694. state = 2
  1695. }
  1696. } else {
  1697. radius121 += 0.2;
  1698. localStorage.buxxed_followint + 2;
  1699. if (radius121 >= 10) {
  1700. state = 1
  1701. }
  1702. }
  1703. if (state == 2) {
  1704. x = pos.x + (Math.cos(2 * Math.PI * 2 / BOTS.length * i + f) * radius121);
  1705. y = pos.y + (Math.sin(2 * Math.PI * 2 / BOTS.length * i + f) * radius121);
  1706. } else {
  1707. x = pos.x + (Math.cos(2 * Math.PI * 2 / BOTS.length * i - f) * radius121);
  1708. y = pos.y + (Math.sin(2 * Math.PI * 2 / BOTS.length * i - f) * radius121);
  1709. }
  1710. BOTS[i].world.move(x, y);
  1711. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1712. } else if (animation === animations.square) {
  1713. if (!BOTS[i]) return;
  1714. if (!BOTS[i].options.isJoined) continue;
  1715. a = spiral.PI2 / BOTS[i].length * i + f;
  1716. x = pos.x + squareX(f / 40 * i + f) * BOTS.length / 1.285;
  1717. y = pos.y + squareY(f / 40 * i + f) * BOTS.length / 1.285;
  1718.  
  1719. BOTS[i].world.move(x, y);
  1720. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1721. } else if (animation === animations.infinity) {
  1722. if (!BOTS[i]) return;
  1723. if (!BOTS[i].options.isJoined) continue;
  1724. a = spiral.PI2 / BOTS[i].length * i + f;
  1725. x = pos.x + infinityX(f / 20 * i + f) * 40;
  1726. y = pos.y + infinityY(f / 20 * i + f) * 40;
  1727.  
  1728. BOTS[i].world.move(x, y);
  1729. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1730. } else if (animation === animations.infinity2) {
  1731. if (!BOTS[i]) return;
  1732. if (!BOTS[i].options.isJoined) continue;
  1733. a = spiral.PI2 / BOTS[i].length * i + f;
  1734. x = pos.x + infinityX(f / 20 * i + f) * 40;
  1735. y = pos.y + infinityY(f / 20 * i + f) * 40;
  1736. BOTS[i].world.move(x, y);
  1737. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1738. } else if (animation === animations.default2) {
  1739. if (!BOTS[i]) return;
  1740. if (!BOTS[i].options.isJoined) continue;
  1741. let x1;
  1742. let y1;
  1743. let x;
  1744. let y;
  1745. if (i >= BOTS.length / 2) {
  1746. x1 = pos.x + (Math.cos(2 * Math.PI * 2 / (BOTS.length / 2) * i) * (BOTS.length / 2));
  1747. y1 = pos.y + (Math.sin(2 * Math.PI * 2 / (BOTS.length / 2) * i) * (BOTS.length / 2));
  1748. x = x1 + (Math.cos(2 * Math.PI * 2 / 4 * i + f) * 4);
  1749. y = y1 + (Math.sin(2 * Math.PI * 2 / 4 * i + f) * 4);
  1750. BOTS[i].world.move(x, y);
  1751. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1752. } else {
  1753. x = pos.x + (Math.cos(2 * Math.PI * 2 / (BOTS.length / 2) * i) * (BOTS.length / 2));
  1754. y = pos.y + (Math.sin(2 * Math.PI * 2 / (BOTS.length / 2) * i) * (BOTS.length / 2));
  1755. BOTS[i].world.move(x, y);
  1756. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1757. }
  1758. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1759. } else if (animation === animations.saturn) {
  1760. let t = 2 * Math.PI * 2 / BOTS.length * i + f1;
  1761. if (i <= BOTS.length / 2) {
  1762. let x = pos.x + (Math.cos(t + 2) * BOTS.length / (BOTS.length / 10))
  1763. let y = pos.y + (Math.sin(t) * BOTS.length / (BOTS.length / 10));
  1764. BOTS[i].world.move(x, y);
  1765. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1766. } else {
  1767. let x = pos.x + (Math.cos(t) * BOTS.length / (BOTS.length / 10))
  1768. let y = pos.y + (Math.sin(t) * BOTS.length / (BOTS.length / 10));
  1769. BOTS[i].world.move(x, y);
  1770. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1771. }
  1772. } else if (animation === animations.disk3) {
  1773. let t = Math.PI * 2 / BOTS.length * i + f;
  1774. let t1 = Math.PI / BOTS.length * i + f;
  1775. x = pos.x + (2 * Math.sin(t) + Math.sin(2 * t1)) * BOTS.length / 2;
  1776. y = pos.y + (2 * Math.cos(t) - Math.cos(2 * t1)) * BOTS.length / 2;
  1777. BOTS[i].world.move(x, y);
  1778. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1779. } else if (animation === animations.triagle) {
  1780. if (!BOTS[i]) return;
  1781. if (!BOTS[i].options.isJoined) continue;
  1782. let t = Math.PI * 2 / BOTS.length * i + f;
  1783. x = pos.x + (2 * Math.sin(t) + Math.sin(2 * (t))) * BOTS.length / 2;
  1784. y = pos.y + (2 * Math.cos(t) - Math.cos(2 * (t))) * BOTS.length / 2;
  1785. BOTS[i].world.move(x, y);
  1786. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1787. } else if (animation === animations.storm) {
  1788. let t = Math.PI * 2 / BOTS.length * i - f;
  1789. let t1 = Math.PI * 3 / BOTS.length * i + f;
  1790. x1 = pos.x + (Math.cos(2 * t) * BOTS.length);
  1791. y1 = pos.y + (Math.sin(2 * t) * BOTS.length);
  1792. x = x1 + (Math.cos(3 * t) * BOTS.length);
  1793. y = y1 + (Math.sin(3 * t) * BOTS.length);
  1794. BOTS[i].world.move(x, y);
  1795. if (paintfollow) BOTS[i].world.setPixel(x, y, OWOP.player.selectedColor)
  1796. } else if (animation === animations.disk4) {
  1797. y = pos.y + 40 * Math.cos(angle + f);
  1798. x = pos.x + 40 * Math.sin(angle);
  1799. BOTS[i].world.move(x, y);
  1800. if (paintfollow) BOTS[i].wold.setP(x, y, OWOP.player.selectedColor);
  1801. }
  1802. };
  1803. if(animation === animations.infinity) {
  1804. FOLLOWADD = PI2 / 100;
  1805. f = (f + FOLLOWADD);
  1806. } else if(animation === animations.infinity2) {
  1807. FOLLOWADD = PI2 / 95;
  1808. f = (f + FOLLOWADD);
  1809. } else if(animation === animations.eight) {
  1810. FOLLOWADD = PI2 / 500;
  1811. f = (f + FOLLOWADD) % PI2;
  1812. } else {
  1813. FOLLOWADD = PI2 / 45;
  1814. f = (f + FOLLOWADD) % PI2;
  1815. }
  1816. }, parseInt(localStorage.scaled_followinterval));
  1817. } else {
  1818. following = false;
  1819. clearInterval(folint);
  1820. };
  1821. };
  1822.  
  1823. document.getElementById("scaled-main-menu-followselect").onchange = () => {
  1824. let val = document.getElementById("scaled-main-menu-followselect").value;
  1825. if (val === "Circle") animation = animations.circle;
  1826. if (val === "Disk") animation = animations.disk;
  1827. if (val === "Atom") animation = animations.atom;
  1828. if (val === "Random") animation = animations.random;
  1829. if (val === "Wave") animation = animations.wave;
  1830. if (val === "Right-Left") animation = animations.line;
  1831. if (val === "Hyperbola") animation = animations.hyperbola;
  1832. if (val === "BotLine") animation = animations.botline;
  1833. if (val === "X") animation = animations.x;
  1834. if (val === "Spiral") animation = animations.spiral;
  1835. if (val === "Cool") animation = animations.cool;
  1836. if (val === "Disk 2") animation = animations.disktwo;
  1837. if (val === "Top-Bottom") animation = animations.topbottom;
  1838. if (val === "Laggy") animation = animations.laggy;
  1839. if (val === "Small Circle") animation = animations.smallcircle;
  1840. if (val === "8") animation = animations.eight;
  1841. if (val === "Cool 2") animation = animations.cool2;
  1842. if (val === "3D") animation = animations.threed;
  1843. if (val === "Flower") animation = animations.flower;
  1844. if (val === "Infinity") animation = animations.infinity;
  1845. if (val === "Infinity 2") animation = animations.infinity2;
  1846. if (val === "Square") animation = animations.square;
  1847. if (val === "Default 2") animation = animations.default2;
  1848. if (val === "Disk 3") animation = animations.disk3;
  1849. if (val === "Triagle") animation = animations.triagle;
  1850. if (val === "Saturn") animation = animations.saturn;
  1851. if (val === "Storm") animation = animations.storm;
  1852. if (val === "Disk 4") animation = animations.disk4;
  1853. };
  1854.  
  1855. document.getElementById("scaled-config-menu-config-proxies").onchange = () => {
  1856. let val = document.getElementById("scaled-config-menu-config-proxies").value;
  1857. localStorage.scaled_proxies = val;
  1858. };
  1859.  
  1860. document.getElementById("scaled-main-menu-autoreconnect").onchange = () => {
  1861. autoreconnecten = document.getElementById("scaled-config-menu-config-proxies").value;
  1862. };
  1863.  
  1864. document.getElementById("scaled-config-menu-config-botnick").onchange = () => {
  1865. let val = document.getElementById("scaled-config-menu-config-botnick").value;
  1866. localStorage.scaled_botnick = val;
  1867. };
  1868.  
  1869. document.getElementById("scaled-config-menu-config-followint").onchange = () => {
  1870. let val = document.getElementById("scaled-config-menu-config-followint").value;
  1871. localStorage.scaled_followinterval = val;
  1872. };
  1873.  
  1874. document.getElementById("scaled-assets-menu-addasset").onclick = async () => {
  1875. let assets = localStorage.scaled_assets;
  1876. if (!assets) assets = [];
  1877. else assets = JSON.parse(assets);
  1878. assets.push(await upload("image/*"));
  1879. localStorage.scaled_assets = JSON.stringify(assets);
  1880. refreshAssets();
  1881. };
  1882. updateServers();
  1883.  
  1884. // hidden
  1885. document.getElementById("scaled-main-menu").hidden = false;
  1886. document.getElementById("scaled-main-menu-item").classList.add("is-active");
  1887. document.getElementById("scaled-proxies-menu").hidden = true;
  1888. document.getElementById("scaled-proxies-menu-item").classList.remove("is-active");
  1889. document.getElementById("scaled-assets-menu").hidden = true;
  1890. document.getElementById("scaled-assets-menu-item").classList.remove("is-active");
  1891. document.getElementById("scaled-config-menu").hidden = true;
  1892. document.getElementById("scaled-config-menu-item").classList.remove("is-active");
  1893. document.getElementById("scaled-bots-menu").hidden = true;
  1894. document.getElementById("scaled-bots-menu-item").classList.remove("is-active");
  1895. document.getElementById("scaled-addons-menu").hidden = true;
  1896. document.getElementById("scaled-addons-menu-item").classList.remove("is-active");
  1897. // onclick
  1898. document.getElementById("scaled-main-menu-item").addEventListener("click", () => {
  1899. document.getElementById("scaled-main-menu").hidden = false;
  1900. document.getElementById("scaled-main-menu-item").classList.add("is-active");
  1901. document.getElementById("scaled-proxies-menu").hidden = true;
  1902. document.getElementById("scaled-proxies-menu-item").classList.remove("is-active");
  1903. document.getElementById("scaled-assets-menu").hidden = true;
  1904. document.getElementById("scaled-assets-menu-item").classList.remove("is-active");
  1905. document.getElementById("scaled-config-menu").hidden = true;
  1906. document.getElementById("scaled-config-menu-item").classList.remove("is-active");
  1907. document.getElementById("scaled-bots-menu").hidden = true;
  1908. document.getElementById("scaled-bots-menu-item").classList.remove("is-active");
  1909. document.getElementById("scaled-addons-menu").hidden = true;
  1910. document.getElementById("scaled-addons-menu-item").classList.remove("is-active");
  1911. });
  1912. document.getElementById("scaled-proxies-menu-item").addEventListener("click", () => {
  1913. document.getElementById("scaled-main-menu").hidden = true;
  1914. document.getElementById("scaled-main-menu-item").classList.remove("is-active");
  1915. document.getElementById("scaled-proxies-menu").hidden = false;
  1916. document.getElementById("scaled-proxies-menu-item").classList.add("is-active");
  1917. document.getElementById("scaled-assets-menu").hidden = true;
  1918. document.getElementById("scaled-assets-menu-item").classList.remove("is-active");
  1919. document.getElementById("scaled-config-menu").hidden = true;
  1920. document.getElementById("scaled-config-menu-item").classList.remove("is-active");
  1921. document.getElementById("scaled-bots-menu").hidden = true;
  1922. document.getElementById("scaled-bots-menu-item").classList.remove("is-active");
  1923. document.getElementById("scaled-addons-menu").hidden = true;
  1924. document.getElementById("scaled-addons-menu-item").classList.remove("is-active");
  1925. });
  1926. document.getElementById("scaled-assets-menu-item").addEventListener("click", () => {
  1927. refreshAssets();
  1928. document.getElementById("scaled-main-menu").hidden = true;
  1929. document.getElementById("scaled-main-menu-item").classList.remove("is-active");
  1930. document.getElementById("scaled-proxies-menu").hidden = true;
  1931. document.getElementById("scaled-proxies-menu-item").classList.remove("is-active");
  1932. document.getElementById("scaled-assets-menu").hidden = false;
  1933. document.getElementById("scaled-assets-menu-item").classList.add("is-active");
  1934. document.getElementById("scaled-config-menu").hidden = true;
  1935. document.getElementById("scaled-config-menu-item").classList.remove("is-active");
  1936. document.getElementById("scaled-bots-menu").hidden = true;
  1937. document.getElementById("scaled-bots-menu-item").classList.remove("is-active");
  1938. document.getElementById("scaled-addons-menu").hidden = true;
  1939. document.getElementById("scaled-addons-menu-item").classList.remove("is-active");
  1940. });
  1941. document.getElementById("scaled-config-menu-item").addEventListener("click", () => {
  1942. document.getElementById("scaled-main-menu").hidden = true;
  1943. document.getElementById("scaled-main-menu-item").classList.remove("is-active");
  1944. document.getElementById("scaled-proxies-menu").hidden = true;
  1945. document.getElementById("scaled-proxies-menu-item").classList.remove("is-active");
  1946. document.getElementById("scaled-assets-menu").hidden = true;
  1947. document.getElementById("scaled-assets-menu-item").classList.remove("is-active");
  1948. document.getElementById("scaled-config-menu").hidden = false;
  1949. document.getElementById("scaled-config-menu-item").classList.add("is-active");
  1950. document.getElementById("scaled-bots-menu").hidden = true;
  1951. document.getElementById("scaled-bots-menu-item").classList.remove("is-active");
  1952. document.getElementById("scaled-addons-menu").hidden = true;
  1953. document.getElementById("scaled-addons-menu-item").classList.remove("is-active");
  1954. });
  1955. document.getElementById("scaled-bots-menu-item").addEventListener("click", () => {
  1956. document.getElementById("scaled-main-menu").hidden = true;
  1957. document.getElementById("scaled-main-menu-item").classList.remove("is-active");
  1958. document.getElementById("scaled-proxies-menu").hidden = true;
  1959. document.getElementById("scaled-proxies-menu-item").classList.remove("is-active");
  1960. document.getElementById("scaled-assets-menu").hidden = true;
  1961. document.getElementById("scaled-assets-menu-item").classList.remove("is-active");
  1962. document.getElementById("scaled-config-menu").hidden = true;
  1963. document.getElementById("scaled-config-menu-item").classList.remove("is-active");
  1964. document.getElementById("scaled-bots-menu").hidden = false;
  1965. document.getElementById("scaled-bots-menu-item").classList.add("is-active");
  1966. document.getElementById("scaled-addons-menu").hidden = true;
  1967. document.getElementById("scaled-addons-menu-item").classList.remove("is-active");
  1968. });
  1969. document.getElementById("scaled-addons-menu-item").addEventListener("click", () => {
  1970. document.getElementById("scaled-main-menu").hidden = true;
  1971. document.getElementById("scaled-main-menu-item").classList.remove("is-active");
  1972. document.getElementById("scaled-proxies-menu").hidden = true;
  1973. document.getElementById("scaled-proxies-menu-item").classList.remove("is-active");
  1974. document.getElementById("scaled-assets-menu").hidden = true;
  1975. document.getElementById("scaled-assets-menu-item").classList.remove("is-active");
  1976. document.getElementById("scaled-config-menu").hidden = true;
  1977. document.getElementById("scaled-config-menu-item").classList.remove("is-active");
  1978. document.getElementById("scaled-bots-menu").hidden = true;
  1979. document.getElementById("scaled-bots-menu-item").classList.remove("is-active");
  1980. document.getElementById("scaled-addons-menu").hidden = false;
  1981. document.getElementById("scaled-addons-menu-item").classList.add("is-active");
  1982. });
  1983. OWOP.tools.addToolObject(new OWOP.tools.class("Bot Brush", OWOP.cursors.brush, OWOP.fx.player.RECT_SELECT_ALIGNED(1), OWOP.RANK.USER, tool => {
  1984. tool.setEvent("mousemove mousedown", async e => {
  1985. if (e.buttons !== 0)
  1986. for (let i = -1; i < 2; i++)
  1987. for (let j = -1; j < 2; j++)
  1988. if (!OWOP.world.setPixel(OWOP.mouse.tileX + i, OWOP.mouse.tileY + j, e.buttons === 1 ? OWOP.player.selectedColor : [255, 255, 255])) {
  1989. let abc = getFree();
  1990. if (Math.floor(BOTS[abc].utils.bucket.allowance) === 1) await sleep(42);
  1991. BOTS[abc].world.setPixel(OWOP.mouse.tileX + i, OWOP.mouse.tileY + j, e.buttons === 1 ? OWOP.player.selectedColor : [255, 255, 255]);
  1992. };
  1993. });
  1994. }));
  1995. let LastChunk = Date.now();
  1996. OWOP.tools.addToolObject(new OWOP.tools.class('Bot Chunker', OWOP.cursors.erase, OWOP.fx.player.RECT_SELECT_ALIGNED(16), false, function(tool) {
  1997. let queue = [];
  1998. let pix = 16;
  1999. const set = (x, y, color) => {
  2000. OWOP.mouse.lastX = x * 16;
  2001. OWOP.mouse.lastY = y * 16;
  2002. OWOP.world.setPixel(x, y, color);
  2003. };
  2004. const eq = (a, b) => a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
  2005. const eq2 = function eq(a, b) {
  2006. return a && b && a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
  2007. };
  2008.  
  2009. function clearChunk(chunkX, chunkY) {
  2010. for (let y = 0; y < 16; ++y) {
  2011. for (let x = 0; x < 16; ++x) {
  2012. let pos = [chunkX * 16 + x, chunkY * 16 + y];
  2013. if ((!eq(OWOP.world.getPixel(...pos), [255, 255, 255])) && (queue.filter(i => eq(i, pos)).length < 1)) {
  2014. queue.unshift(pos);
  2015. }
  2016. }
  2017. }
  2018. }
  2019. tool.setEvent('mousedown mousemove', function(mouse, event) {
  2020. if (mouse.buttons === 1) {
  2021. if (eraserpattern === eraserpatterns.tb) {
  2022. let brushercolor = OWOP.player.selectedColor;
  2023. let antx = Math.floor(OWOP.mouse.tileX / 16)
  2024. let anty = Math.floor(OWOP.mouse.tileY / 16)
  2025. let verx = antx * 16
  2026. let very = anty * 16
  2027. drawRectbrush(verx, very, 16, 16, brushercolor)
  2028. } else if (eraserpattern === eraserpatterns.lr) {
  2029. if (Date.now() - LastChunk < 100) return;
  2030. LastChunk = Date.now();
  2031. for (let i = 0; i < BOTS.length; i++) BOTS[i].options.busy = true;
  2032. let color = mouse.buttons === 1 ? OWOP.player.selectedColor : [255, 255, 255];
  2033. let chunkx = Math.floor(OWOP.mouse.tileX / pix) * pix;
  2034. let chunky = Math.floor(OWOP.mouse.tileY / pix) * pix;
  2035. let armor = pix * pix;
  2036. //console.log(armor)
  2037. for (let x = 0; x < pix; x++) {
  2038. for (let y = 0; y < pix; y++) {
  2039. const abc = getFree();
  2040. //if(BOTS[abc].utils.bucket.allowance === 0) await sleep(42);
  2041. BOTS[abc].world.setPixel(chunkx + x, chunky + y, color);
  2042. };
  2043. }
  2044. for (let i = 0; i < BOTS.length; i++) BOTS[i].options.busy = false;
  2045. } else if(eraserpattern === eraserpatterns.perfect) {
  2046. if (Date.now() - LastChunk < 100) return;
  2047. LastChunk = Date.now();
  2048. for (let i = 0; i < BOTS.length; i++) BOTS[i].options.busy = true;
  2049. let color = mouse.buttons === 1 ? OWOP.player.selectedColor : [255, 255, 255];
  2050. let chunkx = Math.floor(OWOP.mouse.tileX / pix) * pix;
  2051. let chunky = Math.floor(OWOP.mouse.tileY / pix) * pix;
  2052. let armor = pix * pix;
  2053. for (let y = 0; y < pix; ++y) {
  2054. for (let x = 0; x < pix; ++x) {
  2055. let abc = getFree();
  2056. BOTS[abc].utils.bucket.canSpend(0)
  2057. if(BOTS[abc].utils.bucket.allowance >= 1){
  2058. if((!eq2(OWOP.world.getPixel(chunkx + x, chunky + y), color))) {
  2059. BOTS[abc].world.setPixel(chunkx + x, chunky + y, color);
  2060. };
  2061. } else {
  2062. x--
  2063. };
  2064. };
  2065. };
  2066. for (let i = 0; i < BOTS.length; i++) BOTS[i].options.busy = false;
  2067. }
  2068. };
  2069. });
  2070. }));
  2071. OWOP.tools.addToolObject(new OWOP.tools.class('Bot Text', OWOP.cursors.write, OWOP.fx.player.RECT_SELECT_ALIGNED(1), false, function(tool) {
  2072. tool.setEvent('mousedown', function(mouse, event) {
  2073. if (mouse.buttons == 1 || mouse.buttons == 2) {
  2074. var text = prompt('Text to draw:');
  2075. writeText(text, mouse.tileX, mouse.tileY);
  2076. };
  2077. });
  2078. }));
  2079. OWOP.tools.addToolObject(new OWOP.tools.class("Bot Fill", OWOP.cursors.fill, OWOP.fx.player.NONE, OWOP.RANK.USER, e => {
  2080. e.extra.tickAmount = 30;
  2081. let t = [],
  2082. n = null,
  2083. o = OWOP.fx.player.RECT_SELECT_ALIGNED(1);
  2084. async function r() {
  2085. var o = function(e, t) {
  2086. return e && t && e[0] === t[0] && e[1] === t[1] && e[2] === t[2]
  2087. },
  2088. r = function(e, r) {
  2089. return !!o(OWOP.world.getPixel(e, r), n) && (t.unshift([e, r]),
  2090. !0)
  2091. };
  2092. if (t.length && n) {
  2093. var i = OWOP.player.selectedColor,
  2094. a = 0,
  2095. s = e.extra.tickAmount;
  2096. s *= 3;
  2097. for (a = 0; a < s && t.length; a++) {
  2098. var l = t.pop(),
  2099. u = l[0],
  2100. d = l[1],
  2101. f = OWOP.world.getPixel(u, d);
  2102. if (o(f, n) && !o(f, i)) {
  2103. if (!OWOP.world.setPixel(u, d, i)) {
  2104. let abc = getFree();
  2105. if (BOTS[abc].utils.bucket.allowance === 0) sleep(42).then(i => {
  2106. if (!BOTS[abc].world.setPixel(u, d, i)) t.push(l);
  2107. });
  2108. if (BOTS[abc].utils.bucket.allowance !== 0)
  2109. if (!BOTS[abc].world.setPixel(u, d, i)) t.push(l);
  2110. break
  2111. }
  2112. var p = r(u, d - 1),
  2113. m = r(u, d + 1),
  2114. v = r(u - 1, d),
  2115. g = r(u + 1, d);
  2116. p && v && r(u - 1, d - 1),
  2117. p && g && r(u + 1, d - 1),
  2118. m && v && r(u - 1, d + 1),
  2119. m && g && r(u + 1, d + 1)
  2120. }
  2121. }
  2122. }
  2123. }
  2124. e.setFxRenderer(function(e, r, i) {
  2125. r.globalAlpha = .8,
  2126. r.strokeStyle = e.extra.player.htmlRgb;
  2127. var a = OWOP.camera.zoom;
  2128. if (n && e.extra.isLocalPlayer) {
  2129. r.beginPath();
  2130. for (var s = 0; s < t.length; s++)
  2131. r.rect((t[s][0] - OWOP.camera.x) * a, (t[s][1] - OWOP.camera.y) * a, a, a);
  2132. r.stroke()
  2133. } else
  2134. o(e, r, i)
  2135. }),
  2136. e.setEvent("mousedown", function(o) {
  2137. 4 & o.buttons || (n = OWOP.world.getPixel(o.tileX, o.tileY)) && (t.push([o.tileX, o.tileY]),
  2138. e.setEvent("tick", r))
  2139. }),
  2140. e.setEvent("mouseup deselect", function(o) {
  2141. o && 1 & o.buttons || (n = null,
  2142. t = [],
  2143. e.setEvent("tick", null))
  2144. });
  2145.  
  2146. }));
  2147. let aboab;
  2148. OWOP.tools.addToolObject(new OWOP.tools.class('Bot Area', OWOP.cursors.select, OWOP.fx.player.NONE, false, function(tool) {
  2149. tool.setFxRenderer(function(fx, ctx, time) {
  2150. if (!fx.extra.isLocalPlayer) return 1;
  2151. let x = fx.extra.player.x;
  2152. let y = fx.extra.player.y;
  2153. let fxx = (Math.floor(x / 16) - OWOP.camera.x) * OWOP.camera.zoom;
  2154. let fxy = (Math.floor(y / 16) - OWOP.camera.y) * OWOP.camera.zoom;
  2155. let oldlinew = ctx.lineWidth;
  2156. ctx.lineWidth = 1;
  2157. if (tool.extra.end) {
  2158. let s = tool.extra.start;
  2159. let e = tool.extra.end;
  2160. let x = (s[0] - OWOP.camera.x) * OWOP.camera.zoom + 0.5;
  2161. let y = (s[1] - OWOP.camera.y) * OWOP.camera.zoom + 0.5;
  2162. let w = e[0] - s[0];
  2163. let h = e[1] - s[1];
  2164. ctx.beginPath();
  2165. ctx.rect(x, y, w * OWOP.camera.zoom, h * OWOP.camera.zoom);
  2166. ctx.globalAlpha = 0.25;
  2167. ctx.strokeStyle = "#FFFFFF";
  2168. ctx.stroke();
  2169. ctx.setLineDash([3, 4]);
  2170. ctx.strokeStyle = "#000000";
  2171. ctx.stroke();
  2172. //ctx.globalAlpha = 0.25 + Math.sin(time / 500) / 4;
  2173. ctx.fillStyle = OWOP.renderer.patterns.unloaded;
  2174. ctx.fill();
  2175. ctx.setLineDash([]);
  2176. let oldfont = ctx.font;
  2177. ctx.font = "16px sans-serif";
  2178. let perc = 2;
  2179. if (perc > 100) perc = 100;
  2180. let txt = tool.extra.clicking ? 'Right click to start pixeling.' : '';
  2181. let txtx = window.innerWidth >> 1;
  2182. let txty = window.innerHeight >> 1;
  2183. txtx = Math.max(x, Math.min(txtx, x + w * OWOP.camera.zoom));
  2184. txty = Math.max(y, Math.min(txty, y + h * OWOP.camera.zoom));
  2185. OWOP.drawText = (ctx, str, x, y, centered) => {
  2186. ctx.strokeStyle = "#000000", ctx.fillStyle = "#FFFFFF", ctx.lineWidth = 2.5, ctx.globalAlpha = 1;
  2187. if (centered) {
  2188. x -= ctx.measureText(str).width >> 1;
  2189. }
  2190. ctx.strokeText(str, x, y);
  2191. ctx.globalAlpha = 1;
  2192. ctx.fillText(str, x, y);
  2193. };
  2194. OWOP.drawText(ctx, txt, txtx, txty, true);
  2195. ctx.font = oldfont;
  2196. ctx.lineWidth = oldlinew;
  2197. return 0;
  2198. } else {
  2199. ctx.beginPath();
  2200. ctx.moveTo(0, fxy + 0.5);
  2201. ctx.lineTo(window.innerWidth, fxy + 0.5);
  2202. ctx.moveTo(fxx + 0.5, 0);
  2203. ctx.lineTo(fxx + 0.5, window.innerHeight);
  2204.  
  2205. //ctx.lineWidth = 1;
  2206. ctx.globalAlpha = 0.8;
  2207. ctx.strokeStyle = "#FFFFFF";
  2208. ctx.stroke();
  2209. ctx.setLineDash([3]);
  2210. ctx.strokeStyle = "#000000";
  2211. ctx.stroke();
  2212.  
  2213. ctx.setLineDash([]);
  2214. ctx.lineWidth = oldlinew;
  2215. return 1;
  2216. }
  2217. });
  2218.  
  2219. tool.extra.start = null;
  2220. tool.extra.end = null;
  2221. tool.extra.clicking = false;
  2222.  
  2223. tool.setEvent('mousedown', async (mouse, event) => {
  2224.  
  2225. let s = tool.extra.start;
  2226. let e = tool.extra.end;
  2227. let isInside = function isInside() {
  2228. return mouse.tileX >= s[0] && mouse.tileX < e[0] && mouse.tileY >= s[1] && mouse.tileY < e[1];
  2229. };
  2230. if (mouse.buttons === 1 && !tool.extra.end) {
  2231. tool.extra.start = [Math.floor(mouse.tileX / 16) * 16, Math.floor(mouse.tileY / 16) * 16];
  2232. tool.extra.clicking = true;
  2233. tool.setEvent('mousemove', function(mouse, event) {
  2234. if (tool.extra.start && mouse.buttons === 1) {
  2235. tool.extra.end = [Math.floor(mouse.tileX / 16) * 16, Math.floor(mouse.tileY / 16) * 16];
  2236. return 1;
  2237. }
  2238. });
  2239. let finish = function finish() {
  2240. tool.setEvent('mousemove mouseup deselect', null);
  2241. tool.extra.clicking = false;
  2242. let s = tool.extra.start;
  2243. let e = tool.extra.end;
  2244. if (e) {
  2245. if (s[0] === e[0] || s[1] === e[1]) {
  2246. tool.extra.start = null;
  2247. tool.extra.end = null;
  2248. }
  2249. if (s[0] > e[0]) {
  2250. let tmp = e[0];
  2251. e[0] = s[0];
  2252. s[0] = tmp;
  2253. }
  2254. if (s[1] > e[1]) {
  2255. let tmp = e[1];
  2256. e[1] = s[1];
  2257. s[1] = tmp;
  2258. }
  2259. }
  2260. OWOP.renderer.render(OWOP.renderer.rendertype.FX);
  2261. };
  2262. tool.setEvent('deselect', finish);
  2263. tool.setEvent('mouseup', function(mouse, event) {
  2264. if (!(mouse.buttons & 1)) {
  2265. finish();
  2266. }
  2267. });
  2268. } else if (mouse.buttons === 1 && tool.extra.end) {
  2269. if (isInside()) {
  2270. let offx = mouse.tileX;
  2271. let offy = mouse.tileY;
  2272. tool.setEvent('mousemove', function(mouse, event) {
  2273. let dx = mouse.tileX - offx;
  2274. let dy = mouse.tileY - offy;
  2275. tool.extra.start = [s[0] + dx, s[1] + dy];
  2276. tool.extra.end = [e[0] + dx, e[1] + dy];
  2277. });
  2278. let end = function end() {
  2279. tool.setEvent('mouseup deselect mousemove', null);
  2280. };
  2281. tool.setEvent('deselect', end);
  2282. tool.setEvent('mouseup', function(mouse, event) {
  2283. if (!(mouse.buttons & 1)) {
  2284. end();
  2285. };
  2286. });
  2287. }
  2288. } else if (mouse.buttons === 2 && tool.extra.end && isInside()) {
  2289. if (BOTS.length === 0) {
  2290. let w = tool.extra.end[0] - tool.extra.start[0];
  2291. let h = tool.extra.end[1] - tool.extra.start[1];
  2292. for (let x = 0; x < w; x++) {
  2293. let chunkx = tool.extra.start[0];
  2294. let chunky = tool.extra.start[1];
  2295. let color = OWOP.player.selectedColor;
  2296. for (let y = 0; y < h; y++) {
  2297. OWOP.world.setPixel(chunkx + x, chunky + y, color);
  2298. }
  2299. }
  2300. }
  2301. for (let i = 0; i < BOTS.length; i++) BOTS[i].options.busy = true;
  2302. let w = tool.extra.end[0] - tool.extra.start[0];
  2303. let h = tool.extra.end[1] - tool.extra.start[1];
  2304. let color = OWOP.player.selectedColor;
  2305.  
  2306. let chunkx = tool.extra.start[0];
  2307. let chunky = tool.extra.start[1];
  2308.  
  2309. async function drawPattern(pattern) {
  2310. if (pattern == patterns.lr) {
  2311. for (let x = 0; x < w; x++) {
  2312. for (let y = 0; y < h; y++) {
  2313. let abc = getFree();
  2314. if (!OldPaste) {
  2315. BOTS[abc].utils.bucket.canSpend(0);
  2316. if (BOTS[abc].utils.bucket.allowance <= 1) await sleep(0);
  2317. }
  2318. BOTS[abc].world.setPixel(chunkx + x, chunky + y, color);
  2319. }
  2320. }
  2321. } else if (pattern == patterns.tb) {
  2322. for (let y = 0; y < h; y++) {
  2323. for (let x = 0; x < w; x++) {
  2324. let abc = getFree();
  2325. if (!OldPaste) {
  2326. BOTS[abc].utils.bucket.canSpend(0);
  2327. if (BOTS[abc].utils.bucket.allowance <= 1) await sleep(0);
  2328. }
  2329. BOTS[abc].world.setPixel(chunkx + x, chunky + y, color);
  2330. }
  2331. }
  2332. } else if (pattern == patterns.rand) {
  2333. for (let x = 0; x < w * 3; x++) {
  2334. for (let y = 0; y < h * 3; y++) {
  2335. let abc = getFree();
  2336. if (!OldPaste) {
  2337. BOTS[abc].utils.bucket.canSpend(0);
  2338. if (BOTS[abc].utils.bucket.allowance <= 1) await sleep(0);
  2339. }
  2340. BOTS[abc].world.setPixel(chunkx + Math.floor(Math.random() * w), chunky + Math.floor(Math.random() * h), color);
  2341. }
  2342. }
  2343. };
  2344. };
  2345.  
  2346. drawPattern(pattern);
  2347. for (let i = 0; i < BOTS.length; i++) BOTS[i].options.busy = false;
  2348. } else {
  2349. tool.extra.start = null;
  2350. tool.extra.end = null;
  2351. }
  2352. });
  2353. }));
  2354.  
  2355. OWOP.tools.addToolObject(new OWOP.tools.class('Bot Paster', OWOP.cursors.paste, OWOP.fx.player.RECT_SELECT_ALIGNED(1), false, function(tool) {
  2356. tool.setEvent('mousedown', function(mouse, event) {
  2357. let sX = !Pixelization ? OWOP.mouse.tileX : Math.floor(OWOP.mouse.tileX / 16) * 16,
  2358. sY = !Pixelization ? OWOP.mouse.tileY : Math.floor(OWOP.mouse.tileY / 16) * 16;
  2359. if (mouse.buttons != 0) {
  2360. let input = document.createElement('input');
  2361. input.type = "file";
  2362. input.accept = 'image/*';
  2363.  
  2364. input.click();
  2365. input.onchange = () => {
  2366. if (BOTS.length === 0) return OWOP.chat.local("No bots connected!");
  2367. sleep(15);
  2368. let imgURL = URL.createObjectURL(input.files[0]);
  2369. let img = new Image();
  2370. img.onload = async () => {
  2371. let cnv = document.createElement('canvas');
  2372. let ctx = cnv.getContext('2d');
  2373. let imgWidth = img.naturalWidth;
  2374. let imgHeight = img.naturalHeight;
  2375.  
  2376. cnv.width = 3000;
  2377. cnv.height = 3000;
  2378. if (imgWidth > 3000) return OJS.chat.local('The width of image is too big!');
  2379. if (imgHeight > 3000) return OJS.chat.local('The height of image is too big!');
  2380. ctx.drawImage(img, 0, 0);
  2381. let imgData = ctx.getImageData(0, 0, imgWidth, imgHeight);
  2382. let orgPixels = Array.from(imgData.data);
  2383. let i = 0;
  2384. let I = 0;
  2385. let pixels = [];
  2386. while (i <= orgPixels.length) {
  2387. pixels.push([orgPixels[i], orgPixels[i + 1], orgPixels[i + 2], orgPixels[i + 3]]);
  2388. i += 4;
  2389. };
  2390.  
  2391. for (let i = 0; i < BOTS.length; i++) BOTS[i].options.busy = true;
  2392. for (i = 0; i < imgHeight; i++)
  2393. for (let j = 0; j < imgWidth; j++) {
  2394. let abc = getFree();
  2395. BOTS[abc].world.setPixel(sX + j, sY + i, pixels[I]);
  2396. I++;
  2397. }
  2398. for (let i = 0; i < BOTS.length; i++) BOTS[i].options.busy = false;
  2399. };
  2400. img.src = imgURL;
  2401. };
  2402. };
  2403. });
  2404. }));
  2405. OWOP.world.protection = {
  2406. intervals: {},
  2407. pixels: {}
  2408. };
  2409.  
  2410. OWOP.tools.addToolObject(new OWOP.tools.class("Bot Protection 16", OWOP.cursors.shield, OWOP.fx.player.RECT_SELECT_ALIGNED(16), OWOP.RANK.USER, tool => {
  2411. tool.setFxRenderer((fx, ctx) => {
  2412. const X = fx.extra.player.x,
  2413. Y = fx.extra.player.y,
  2414. cX = (16 * Math.floor(X / 256) - OWOP.camera.x) * OWOP.camera.zoom,
  2415. cY = (16 * Math.floor(Y / 256) - OWOP.camera.y) * OWOP.camera.zoom,
  2416. tX = fx.extra.player.tileX,
  2417. tY = fx.extra.player.tileY,
  2418. chunk = OWOP.world.protection.pixels[`${tX},${tY}`];
  2419. ctx.globalAlpha = .5;
  2420. ctx.fillStyle = chunk ? "#00FF00" : "#FF0000";
  2421. ctx.fillRect(cX, cY, 16 * OWOP.camera.zoom, 16 * OWOP.camera.zoom);
  2422. return true;
  2423. });
  2424.  
  2425. tool.setEvent("mousedown mousemove", fx => {
  2426. const X = Math.floor(OWOP.mouse.tileX / OWOP.options.serverAddress[0].proto.chunkSize) * 16,
  2427. Y = Math.floor(OWOP.mouse.tileY / OWOP.options.serverAddress[0].proto.chunkSize) * 16,
  2428. chunk = OWOP.world.protection.pixels[`${X},${Y}`];
  2429. switch (fx.buttons) {
  2430. case 1:
  2431. if (chunk) return false;
  2432. for (let y = 0; y < 16; y++)
  2433. for (let x = 0; x < 16; x++) {
  2434. OWOP.world.protection.pixels[`${X + x},${Y + y}`] = OWOP.world.getPixel(X + x, Y + y);
  2435. OWOP.world.protection.intervals[`${X + x},${Y + y}`] = setInterval(() => {
  2436. if (!OWOP.world.setPixel(X + x, Y + y, OWOP.world.protection.pixels[`${X + x},${Y + y}`])) {
  2437. let abc = getFree();
  2438. if (BOTS[abc].utils.bucket.allowance >= 1) BOTS[abc].world.setPixel(X + x, Y + y, OWOP.world.protection.pixels[`${X + x},${Y + y}`]);
  2439. }
  2440. }, 1);
  2441. }
  2442. return true;
  2443. break;
  2444. case 2:
  2445. if (!chunk) return false;
  2446. for (let y = 0; y < 16; y++)
  2447. for (let x = 0; x < 16; x++) {
  2448. clearInterval(OWOP.world.protection.intervals[`${X + x},${Y + y}`]);
  2449. delete OWOP.world.protection.intervals[`${X + x},${Y + y}`];
  2450. delete OWOP.world.protection.pixels[`${X + x},${Y + y}`];
  2451. }
  2452. break;
  2453. }
  2454. });
  2455. }));
  2456. OWOP.tools.addToolObject(new OWOP.tools.class("Bot Area Protect", OWOP.cursors.selectprotect, OWOP.fx.player.NONE, OWOP.RANK.USER, tool => {
  2457. const X = Math.floor(OWOP.mouse.tileX / OWOP.options.serverAddress[0].proto.chunkSize) * 16,
  2458. Y = Math.floor(OWOP.mouse.tileY / OWOP.options.serverAddress[0].proto.chunkSize) * 16,
  2459. chunk = OWOP.world.protection.pixels[`${X},${Y}`];
  2460. function drawText(ctx, str, x, y, centered) {
  2461. ctx.strokeStyle = "#000000", ctx.fillStyle = "#FFFFFF", ctx.lineWidth = 2.5, ctx.globalAlpha = 0.5;
  2462. if (centered) {
  2463. x -= ctx.measureText(str).width >> 1;
  2464. }
  2465. ctx.strokeText(str, x, y);
  2466. ctx.globalAlpha = 1;
  2467. ctx.fillText(str, x, y);
  2468. }
  2469. tool.setFxRenderer(function (fx, ctx, time) {
  2470. if (!fx.extra.isLocalPlayer) return 1;
  2471. var x = fx.extra.player.x;
  2472. var y = fx.extra.player.y;
  2473. var fxx = (Math.round(x / 256) * 16 - OWOP.camera.x) * OWOP.camera.zoom;
  2474. var fxy = (Math.round(y / 256) * 16 - OWOP.camera.y) * OWOP.camera.zoom;
  2475. var oldlinew = ctx.lineWidth;
  2476. ctx.lineWidth = 1;
  2477. if (tool.extra.end) {
  2478. var s = tool.extra.start;
  2479. var e = tool.extra.end;
  2480. var x = (s[0] * 16 - OWOP.camera.x) * OWOP.camera.zoom + 0.5;
  2481. var y = (s[1] * 16 - OWOP.camera.y) * OWOP.camera.zoom + 0.5;
  2482. var rw = e[0] - s[0];
  2483. var rh = e[1] - s[1];
  2484. var w = rw * OWOP.camera.zoom * 16;
  2485. var h = rh * OWOP.camera.zoom * 16;
  2486. ctx.beginPath();
  2487. ctx.rect(x, y, w, h);
  2488. ctx.globalAlpha = 1;
  2489. ctx.strokeStyle = "#FFFFFF";
  2490. ctx.stroke();
  2491. ctx.setLineDash([3, 4]);
  2492. ctx.strokeStyle = "#000000";
  2493. ctx.stroke();
  2494. if (tool.extra.isSure) {
  2495. ctx.globalAlpha = 0.6;
  2496. ctx.fillStyle = "#00EE00";
  2497. ctx.fill();
  2498. }
  2499. ctx.globalAlpha = 0.25 + Math.sin(time / 500) / 4;
  2500. ctx.fillStyle = OWOP.renderer.patterns.unloaded;
  2501. ctx.fill();
  2502. ctx.setLineDash([]);
  2503. var oldfont = ctx.font;
  2504. ctx.font = "16px sans-serif";
  2505. var txt = (tool.extra.isSure ? "Click again to confirm. " : !tool.extra.clicking ? "Click to erase. " : "") + '(' + Math.abs(rw) + 'x' + Math.abs(rh) + ')';
  2506. var txtx = window.innerWidth >> 1;
  2507. var txty = window.innerHeight >> 1;
  2508. txtx = Math.max(x, Math.min(txtx, x + w));
  2509. txty = Math.max(y, Math.min(txty, y + h));
  2510. drawText(ctx, txt, txtx, txty, true);
  2511. ctx.font = oldfont;
  2512. ctx.lineWidth = oldlinew;
  2513. return 0;
  2514. } else {
  2515. ctx.beginPath();
  2516. ctx.moveTo(0, fxy + 0.5);
  2517. ctx.lineTo(window.innerWidth, fxy + 0.5);
  2518. ctx.moveTo(fxx + 0.5, 0);
  2519. ctx.lineTo(fxx + 0.5, window.innerHeight);
  2520. //ctx.lineWidth = 1;
  2521. ctx.globalAlpha = 1;
  2522. ctx.strokeStyle = "#FFFFFF";
  2523. ctx.stroke();
  2524. ctx.setLineDash([3]);
  2525. ctx.strokeStyle = "#000000";
  2526. ctx.stroke();
  2527. ctx.setLineDash([]);
  2528. ctx.lineWidth = oldlinew;
  2529. return 1;
  2530. }
  2531. });
  2532. tool.extra.start = null;
  2533. tool.extra.end = null;
  2534. tool.extra.clicking = false;
  2535. tool.extra.isSure = false;
  2536. var timeout = null;
  2537. var sure = function sure() {
  2538. if (tool.extra.isSure) {
  2539. clearTimeout(timeout);
  2540. timeout = null;
  2541. tool.extra.isSure = false;
  2542. return true;
  2543. }
  2544. tool.extra.isSure = true;
  2545. setTimeout(function () {
  2546. tool.extra.isSure = false;
  2547. timeout = null;
  2548. }, 1000);
  2549. return false;
  2550. };
  2551. tool.setEvent('mousedown', function (mouse, event) {
  2552. var get = {
  2553. rx: function rx() {
  2554. return mouse.tileX / 16;
  2555. },
  2556. ry: function ry() {
  2557. return mouse.tileY / 16;
  2558. },
  2559. x: function x() {
  2560. return Math.round(mouse.tileX / 16);
  2561. },
  2562. y: function y() {
  2563. return Math.round(mouse.tileY / 16);
  2564. }
  2565. };
  2566. var s = tool.extra.start;
  2567. var e = tool.extra.end;
  2568. var isInside = function isInside() {
  2569. return get.rx() >= s[0] && get.rx() < e[0] && get.ry() >= s[1] && get.ry() < e[1];
  2570. };
  2571. if (mouse.buttons === 1 && !tool.extra.end) {
  2572. tool.extra.start = [get.x(), get.y()];
  2573. tool.extra.clicking = true;
  2574. tool.setEvent('mousemove', function (mouse, event) {
  2575. if (tool.extra.start && mouse.buttons === 1) {
  2576. tool.extra.end = [get.x(), get.y()];
  2577. return 1;
  2578. }
  2579. });
  2580. var finish = function finish() {
  2581. tool.setEvent('mousemove mouseup deselect', null);
  2582. tool.extra.clicking = false;
  2583. var s = tool.extra.start;
  2584. var e = tool.extra.end;
  2585. if (e) {
  2586. if (s[0] === e[0] || s[1] === e[1]) {
  2587. tool.extra.start = null;
  2588. tool.extra.end = null;
  2589. }
  2590. if (s[0] > e[0]) {
  2591. var tmp = e[0];
  2592. e[0] = s[0];
  2593. s[0] = tmp;
  2594. }
  2595. if (s[1] > e[1]) {
  2596. var tmp = e[1];
  2597. e[1] = s[1];
  2598. s[1] = tmp;
  2599. }
  2600. }
  2601. OWOP.renderer.render(OWOP.renderer.rendertype.FX);
  2602. };
  2603. tool.setEvent('deselect', finish);
  2604. tool.setEvent('mouseup', function (mouse, event) {
  2605. if (!(mouse.buttons & 1)) {
  2606. finish();
  2607. }
  2608. });
  2609. } else if (mouse.buttons === 1 && tool.extra.end) {
  2610. if (isInside() && sure()) {
  2611. tool.extra.start = null;
  2612. tool.extra.end = null;
  2613. var _ref = [s[0], s[1], e[0] - s[0], e[1] - s[1]],
  2614. x = _ref[0],
  2615. y = _ref[1],
  2616. w = _ref[2],
  2617. h = _ref[3];
  2618. for (var i = x; i < x + w; i++) {
  2619. for (var j = y; j < y + h; j++) {
  2620. clearInterval(OWOP.world.protection.intervals[`${X + i},${Y + j}`]);
  2621. delete OWOP.world.protection.intervals[`${X + i},${Y + j}`];
  2622. delete OWOP.world.protection.pixels[`${X + i},${Y + j}`];
  2623. }
  2624. }
  2625. } else if (!isInside()) {
  2626. tool.extra.start = null;
  2627. tool.extra.end = null;
  2628. }
  2629. } else if (mouse.buttons === 0 && tool.extra.end) {
  2630. if (isInside() && sure()) {
  2631. tool.extra.start = null;
  2632. tool.extra.end = null;
  2633. var _ref = [s[0], s[1], e[0] - s[0], e[1] - s[1]],
  2634. x = _ref[0],
  2635. y = _ref[1],
  2636. w = _ref[2],
  2637. h = _ref[3];
  2638. for (var i = x; i < x + w; i++) {
  2639. for (var j = y; j < y + h; j++) {
  2640. OWOP.world.protection.pixels[`${X + i},${Y + j}`] = OWOP.world.getPixel(X + i, Y + j);
  2641. OWOP.world.protection.intervals[`${X + i},${Y + j}`] = setInterval(() => {
  2642. if (!OWOP.world.setPixel(X + i, Y + j, OWOP.world.protection.pixels[`${X + i},${Y + j}`])) {
  2643. let abc = getFree();
  2644. if (BOTS[abc].utils.bucket.allowance >= 1) BOTS[abc].world.setPixel(X + i, Y + j, OWOP.world.protection.pixels[`${X + x},${Y + y}`]);
  2645. }
  2646. }, 3000);
  2647. }
  2648. }
  2649. } else if (!isInside()) {
  2650. tool.extra.start = null;
  2651. tool.extra.end = null;
  2652. }
  2653. }
  2654. });
  2655. }));
  2656. OWOP.tools.addToolObject(new OWOP.tools.class("Bot Protection 32", OWOP.cursors.shield, OWOP.fx.player.RECT_SELECT_ALIGNED(32), OWOP.RANK.USER, tool => {
  2657. tool.setFxRenderer((fx, ctx) => {
  2658. const X = fx.extra.player.x,
  2659. Y = fx.extra.player.y,
  2660. cX = (32 * Math.floor(X / 512) - OWOP.camera.x) * OWOP.camera.zoom,
  2661. cY = (32 * Math.floor(Y / 512) - OWOP.camera.y) * OWOP.camera.zoom,
  2662. tX = fx.extra.player.tileX,
  2663. tY = fx.extra.player.tileY,
  2664. chunk = OWOP.world.protection.pixels[`${tX},${tY}`];
  2665. ctx.globalAlpha = .5;
  2666. ctx.fillStyle = chunk ? "#00FF00" : "#FF0000";
  2667. ctx.fillRect(cX, cY, 32 * OWOP.camera.zoom, 32 * OWOP.camera.zoom);
  2668. return true;
  2669. });
  2670.  
  2671. tool.setEvent("mousedown mousemove", fx => {
  2672. const X = Math.floor(OWOP.mouse.tileX / OWOP.options.serverAddress[0].proto.chunkSize) * 32,
  2673. Y = Math.floor(OWOP.mouse.tileY / OWOP.options.serverAddress[0].proto.chunkSize) * 32,
  2674. chunk = OWOP.world.protection.pixels[`${X},${Y}`];
  2675. switch (fx.buttons) {
  2676. case 1:
  2677. if (chunk) return false;
  2678. for (let y = 0; y < 32; y++)
  2679. for (let x = 0; x < 32; x++) {
  2680. OWOP.world.protection.pixels[`${X + x},${Y + y}`] = OWOP.world.getPixel(X + x, Y + y);
  2681. OWOP.world.protection.intervals[`${X + x},${Y + y}`] = setInterval(() => {
  2682. if (!OWOP.world.setPixel(X + x, Y + y, OWOP.world.protection.pixels[`${X + x},${Y + y}`])) {
  2683. let abc = getFree();
  2684. if (BOTS[abc].utils.bucket.allowance >= 1) BOTS[abc].world.setPixel(X + x, Y + y, OWOP.world.protection.pixels[`${X + x},${Y + y}`]);
  2685. }
  2686. }, 1);
  2687. }
  2688. return true;
  2689. break;
  2690. case 2:
  2691. if (!chunk) return false;
  2692. for (let y = 0; y < 32; y++)
  2693. for (let x = 0; x < 32; x++) {
  2694. clearInterval(OWOP.world.protection.intervals[`${X + x},${Y + y}`]);
  2695. delete OWOP.world.protection.intervals[`${X + x},${Y + y}`];
  2696. delete OWOP.world.protection.pixels[`${X + x},${Y + y}`];
  2697. }
  2698. break;
  2699. }
  2700. });
  2701. }));
  2702. OWOP.tools.addToolObject(new OWOP.tools.class("Bot Protection 64", OWOP.cursors.shield, OWOP.fx.player.RECT_SELECT_ALIGNED(64), OWOP.RANK.USER, tool => {
  2703. tool.setFxRenderer((fx, ctx) => {
  2704. const X = fx.extra.player.x,
  2705. Y = fx.extra.player.y,
  2706. cX = (64 * Math.floor(X / 1024) - OWOP.camera.x) * OWOP.camera.zoom,
  2707. cY = (64 * Math.floor(Y / 1024) - OWOP.camera.y) * OWOP.camera.zoom,
  2708. tX = fx.extra.player.tileX,
  2709. tY = fx.extra.player.tileY,
  2710. chunk = OWOP.world.protection.pixels[`${tX},${tY}`];
  2711. ctx.globalAlpha = .5;
  2712. ctx.fillStyle = chunk ? "#00FF00" : "#FF0000";
  2713. ctx.fillRect(cX, cY, 64 * OWOP.camera.zoom, 64 * OWOP.camera.zoom);
  2714. return true;
  2715. });
  2716.  
  2717. tool.setEvent("mousedown mousemove", fx => {
  2718. const X = Math.floor(OWOP.mouse.tileX / OWOP.options.serverAddress[0].proto.chunkSize) * 64,
  2719. Y = Math.floor(OWOP.mouse.tileY / OWOP.options.serverAddress[0].proto.chunkSize) * 64,
  2720. chunk = OWOP.world.protection.pixels[`${X},${Y}`];
  2721. switch (fx.buttons) {
  2722. case 1:
  2723. if (chunk) return false;
  2724. for (let y = 0; y < 64; y++)
  2725. for (let x = 0; x < 64; x++) {
  2726. OWOP.world.protection.pixels[`${X + x},${Y + y}`] = OWOP.world.getPixel(X + x, Y + y);
  2727. OWOP.world.protection.intervals[`${X + x},${Y + y}`] = setInterval(() => {
  2728. if (!OWOP.world.setPixel(X + x, Y + y, OWOP.world.protection.pixels[`${X + x},${Y + y}`])) {
  2729. let abc = getFree();
  2730. if (BOTS[abc].utils.bucket.allowance >= 1) BOTS[abc].world.setPixel(X + x, Y + y, OWOP.world.protection.pixels[`${X + x},${Y + y}`]);
  2731. }
  2732. }, 1);
  2733. }
  2734. return true;
  2735. break;
  2736. case 2:
  2737. if (!chunk) return false;
  2738. for (let y = 0; y < 64; y++)
  2739. for (let x = 0; x < 64; x++) {
  2740. clearInterval(OWOP.world.protection.intervals[`${X + x},${Y + y}`]);
  2741. delete OWOP.world.protection.intervals[`${X + x},${Y + y}`];
  2742. delete OWOP.world.protection.pixels[`${X + x},${Y + y}`];
  2743. }
  2744. break;
  2745. }
  2746. });
  2747. }));
  2748. OWOP.tools.addToolObject(new OWOP.tools.class("Bot Paste Asset", OWOP.cursors.paste, OWOP.fx.player.RECT_SELECT_ALIGNED(1), false, tool => {
  2749. tool.setEvent("mousedown mousemove", async e => {
  2750. if (e.buttons === 1) {
  2751. if (!selectedAsset) OWOP.chat.local("No asset selected!");
  2752. if (typeof selectedAsset === "string") {
  2753. // convert
  2754. let cnv = document.createElement("canvas");
  2755. let ctx = cnv.getContext('2d');
  2756. aboab = ctx;
  2757. let img = new Image();
  2758. img.onload = () => {
  2759. cnv.width = 2500;
  2760. cnv.height = 2500;
  2761. ctx.drawImage(img, 0, 0);
  2762. selectedAsset = ctx.getImageData(0, 0, img.naturalWidth, img.naturalHeight);
  2763. }
  2764. img.src = selectedAsset;
  2765. return OWOP.chat.local("Image is ready.");
  2766. };
  2767. let cC0 = 0;
  2768. let cC1 = 0;
  2769. let cC2 = 0;
  2770. let xX = 0;
  2771. let yY = 0;
  2772. let x_ = 0;
  2773. let y_ = 0;
  2774. let I = 0;
  2775. let x = !Pixelization ? OWOP.mouse.tileX : Math.floor(OWOP.mouse.tileX / 16) * 16,
  2776. y = !Pixelization ? OWOP.mouse.tileY : Math.floor(OWOP.mouse.tileY / 16) * 16;
  2777. if (imgpattern === imgpatterns.default) {
  2778. async function pastePick() {
  2779. let I = 0;
  2780. let x = !Pixelization ? OWOP.mouse.tileX : Math.floor(OWOP.mouse.tileX / 16) * 16,
  2781. y = !Pixelization ? OWOP.mouse.tileY : Math.floor(OWOP.mouse.tileY / 16) * 16;
  2782. for (let Y = 0; Y < selectedAsset.height; Y++) {
  2783. for (let X = 0; X < selectedAsset.width; X++) {
  2784. let abc = getFree();
  2785. if (!OldPaste) {
  2786. BOTS[abc].utils.bucket.canSpend(0);
  2787. if (BOTS[abc].utils.bucket.allowance <= 1) await sleep(0);
  2788. }
  2789. BOTS[abc].world.setPixel(x + X, y + Y, [selectedAsset.data[I++], selectedAsset.data[I++], selectedAsset.data[I++]]);
  2790. I++;
  2791. }
  2792. }
  2793. }
  2794. pastePick();
  2795. } else if (imgpattern === imgpatterns.grid) {
  2796. async function pastePick() {
  2797. if (!stop) {
  2798. for (let Y = 0; Y < selectedAsset.height; Y += 2) {
  2799. for (let X = 0; X < selectedAsset.width; X++) {
  2800.  
  2801. // for(let Y = 0; Y > selectedAsset.height; Y++){
  2802. //for(let X = 0; X > selectedAsset.width; X++) {
  2803. let abc = getFree();
  2804. if (!OldPaste) {
  2805. BOTS[abc].utils.bucket.canSpend(0);
  2806. if (BOTS[abc].utils.bucket.allowance <= 49) await sleep(0);
  2807. }
  2808. x_ = X;
  2809. //xX = x_;
  2810. y_ = Y;
  2811. //yY = y_;
  2812. BOTS[abc].world.setPixel(x + x_, y + y_, pixColor(aboab, x_, y_));
  2813. }
  2814. }
  2815. for (let Y = 0; Y < selectedAsset.height; Y++) {
  2816. for (let X = 0; X < selectedAsset.width; X += 2) {
  2817.  
  2818. // for(let Y = 0; Y > selectedAsset.height; Y++){
  2819. //for(let X = 0; X > selectedAsset.width; X++) {
  2820. let abc = getFree();
  2821. if (!OldPaste) {
  2822. BOTS[abc].utils.bucket.canSpend(0);
  2823. if (BOTS[abc].utils.bucket.allowance <= 49) await sleep(0);
  2824. }
  2825. x_ = X;
  2826. //xX = x_;
  2827. y_ = Y;
  2828. //yY = y_;
  2829. BOTS[abc].world.setPixel(x + x_, y + y_, pixColor(aboab, x_, y_));
  2830. }
  2831. }
  2832. for (let Y = 0; Y < selectedAsset.height; Y++) {
  2833. for (let X = 0; X < selectedAsset.width; X++) {
  2834.  
  2835. // for(let Y = 0; Y > selectedAsset.height; Y++){
  2836. //for(let X = 0; X > selectedAsset.width; X++) {
  2837. let abc = getFree();
  2838. if (!OldPaste) {
  2839. BOTS[abc].utils.bucket.canSpend(0);
  2840. if (BOTS[abc].utils.bucket.allowance <= 49) await sleep(0);
  2841. }
  2842. x_ = X;
  2843. //xX = x_;
  2844. y_ = Y;
  2845. //yY = y_;
  2846. BOTS[abc].world.setPixel(x + x_, y + y_, pixColor(aboab, x_, y_));
  2847. }
  2848. }
  2849. }
  2850. }
  2851. for (let Y = 0; Y < selectedAsset.height; Y++) {
  2852. for (let X = 0; X < selectedAsset.width; X++) {
  2853. if ([OWOP.world.getPixel(x + X, y + Y)[0], OWOP.world.getPixel(x + X, y + Y)[1], OWOP.world.getPixel(x + X, y + Y)[2]] != pixColor(aboab, X, Y)) {
  2854. await pastePick();
  2855. await sleep(1000);
  2856. X = 0;
  2857. Y = 0;
  2858. if (stop) {
  2859. Y = selectedAsset.height;
  2860. X = selectedAsset.width;
  2861. }
  2862. }
  2863. }
  2864. } //
  2865. } else if (imgpattern === imgpatterns.leftup) {
  2866. async function pastePick() {
  2867. for (let X = 0; X < selectedAsset.width; X++) {
  2868. for (let Y = 0; Y < selectedAsset.height; Y++) {
  2869. if (stop) {
  2870. Y = selectedAsset.height;
  2871. X = selectedAsset.width;
  2872. }
  2873. // for(let Y = 0; Y > selectedAsset.height; Y++){
  2874. //for(let X = 0; X > selectedAsset.width; X++) {
  2875. let x_ = (selectedAsset.width - X) - 1;
  2876. let y_ = (selectedAsset.height - Y) - 1;
  2877. let i = getFree();
  2878. if (!OldPaste) {
  2879. BOTS[i].utils.bucket.canSpend(0);
  2880. if (BOTS[i].utils.bucket.allowance <= 1) {
  2881. await sleep(0);
  2882. Y--
  2883. } else {
  2884. BOTS[i].world.setPixel(x + x_, y + y_, pixColor(aboab, x_, y_));
  2885. }
  2886. }
  2887. }
  2888. }
  2889. // }
  2890. //}
  2891. }
  2892. pastePick();
  2893. } else if (imgpattern == imgpatterns.square) {
  2894. async function pastePick() {
  2895. let x_2 = 1;
  2896. let y_2 = selectedAsset.height - 1;
  2897. let y_1;
  2898. let x_1 = selectedAsset.width - 1;
  2899. for (y_ = 0; y_ < selectedAsset.height; y_++) {
  2900. for (x_ = 0; x_ < selectedAsset.width; x_++) {
  2901. if (stop) {
  2902. x_ = selectedAsset.height;
  2903. y_ = selectedAsset.width;
  2904. y_1 = selectedAsset.height;
  2905. }
  2906. let abc = getFree();
  2907. if (!OldPaste) {
  2908. BOTS[abc].utils.bucket.canSpend(0);
  2909. if (BOTS[abc].utils.bucket.allowance <= 1) {
  2910. await sleep(0);
  2911. x_--
  2912. } else {
  2913. BOTS[abc].world.setPixel(x + x_, y + y_, pixColor(aboab, x_, y_));
  2914. }
  2915. }
  2916. }
  2917. y_1 = y_;
  2918. if (x_1 > 0) {
  2919. for (y_ = 0; y_ < selectedAsset.height; y_++) {
  2920. let abc = getFree();
  2921. if (!OldPaste) {
  2922. BOTS[abc].utils.bucket.canSpend(0);
  2923. if (BOTS[abc].utils.bucket.allowance <= 1) {
  2924. await sleep(0);
  2925. y_--
  2926. } else {
  2927. BOTS[abc].world.setPixel(x + x_1, y + y_, pixColor(aboab, x_1, y_));
  2928. }
  2929. }
  2930. }
  2931. x_1--
  2932. }
  2933. y_ = y_1;
  2934. if (y_2 != 0) {
  2935. for (let x_ = selectedAsset.width - 1; x_ > -1; x_--) {
  2936. if (!stop) {
  2937. let abc = getFree();
  2938. if (!OldPaste) {
  2939. BOTS[abc].utils.bucket.canSpend(0);
  2940. if (BOTS[abc].utils.bucket.allowance <= 1) {
  2941. await sleep(0);
  2942. x_++
  2943. } else {
  2944. BOTS[abc].world.setPixel(x + x_, y + y_2, pixColor(aboab, x_, y_2));
  2945. }
  2946. }
  2947. }
  2948. }
  2949. }
  2950. y_2--
  2951. y_1 = y_;
  2952. if (x_2 < selectedAsset.width) {
  2953. for (y_ = selectedAsset.height - 1; y_ > -1; y_--) {
  2954. let abc = getFree();
  2955. if (!OldPaste) {
  2956. BOTS[abc].utils.bucket.canSpend(0);
  2957. if (BOTS[abc].utils.bucket.allowance <= 1) {
  2958. await sleep(0);
  2959. y_++
  2960. } else {
  2961. BOTS[abc].world.setPixel(x + x_2, y + y_, pixColor(aboab, x_2, y_));
  2962. }
  2963. }
  2964. }
  2965. x_2++
  2966. }
  2967. y_ = y_1;
  2968. }
  2969. };
  2970. pastePick();
  2971. };
  2972. };
  2973. });
  2974. }));
  2975. };
  2976. var chars = [
  2977. [0b1111111, 0b1000001, 0b1010111, 0b1010100, 0b1010111, 0b1000001, 0b1111111] /*A*/ ,
  2978. [0b1111111, 0b1000001, 0b1010101, 0b1010101, 0b1010101, 0b1001001, 0b1111111] /*B*/ ,
  2979. [0b1111111, 0b1000001, 0b1011101, 0b1010101, 0b1010101, 0b1010101, 0b1110111] /*C*/ ,
  2980. [0b1111111, 0b1000001, 0b1011101, 0b1010101, 0b1011101, 0b1100011, 0b0111110] /*D*/ ,
  2981. [0b1111111, 0b1000001, 0b1010101, 0b1010101, 0b1010101, 0b1011101, 0b1110111] /*E*/ ,
  2982. [0b1111111, 0b1000001, 0b1010111, 0b1010100, 0b1010100, 0b1011100, 0b1110000] /*F*/ ,
  2983. [0b1111111, 0b1000001, 0b1011101, 0b1010101, 0b1010101, 0b1010001, 0b1111111] /*G*/ ,
  2984. [0b1111111, 0b1000001, 0b1110111, 0b0010100, 0b1110111, 0b1000001, 0b1111111] /*H*/ ,
  2985. [0b1111111, 0b1000001, 0b1111111] /*I*/ ,
  2986. [0b1111111, 0b1010001, 0b1011101, 0b1010101, 0b1011101, 0b1000001, 0b1111111] /*J*/ ,
  2987. [0b1111111, 0b1000001, 0b1110111, 0b0110110, 0b1101011, 0b1011101, 0b1110111] /*K*/ ,
  2988. [0b1111111, 0b1000001, 0b1111101, 0b0000101, 0b0000101, 0b0000101, 0b0000111] /*L*/ ,
  2989. [0b1111111, 0b1000001, 0b1011111, 0b1000001, 0b1011111, 0b1000001, 0b1111111] /*M*/ ,
  2990. [0b1111111, 0b1000001, 0b1011111, 0b1000001, 0b1111101, 0b1000001, 0b1111111] /*N*/ ,
  2991. [0b1111111, 0b1000001, 0b1011101, 0b1010101, 0b1011101, 0b1000001, 0b1111111] /*O*/ ,
  2992. [0b1111111, 0b1000001, 0b1010111, 0b1010100, 0b1010100, 0b1000100, 0b1111100] /*P*/ ,
  2993. [0b1111111, 0b1000001, 0b1011101, 0b1010101, 0b1011101, 0b1000011, 0b1111111] /*Q*/ ,
  2994. [0b1111111, 0b1000001, 0b1010111, 0b1010100, 0b1010111, 0b1001001, 0b1111111] /*R*/ ,
  2995. [0b1111111, 0b1000101, 0b1010101, 0b1010101, 0b1010101, 0b1010001, 0b1111111] /*S*/ ,
  2996. [0b1110000, 0b1010000, 0b1011111, 0b1000001, 0b1011111, 0b1010000, 0b1110000] /*T*/ ,
  2997. [0b1111111, 0b1000001, 0b1111101, 0b0000101, 0b1111101, 0b1000001, 0b1111111] /*U*/ ,
  2998. [0b1111100, 0b1000110, 0b1111011, 0b0001101, 0b1111011, 0b1000110, 0b1111100] /*V*/ ,
  2999. [0b1111110, 0b1000011, 0b1111101, 0b0100011, 0b1111101, 0b1000011, 0b1111110] /*W*/ ,
  3000. [0b1110111, 0b1011101, 0b1101011, 0b0110110, 0b1101011, 0b1011101, 0b1110111] /*X*/ ,
  3001. [0b1111000, 0b1001100, 0b1110111, 0b0011001, 0b1110111, 0b1001100, 0b1111000] /*Y*/ ,
  3002. [0b1111111, 0b1010001, 0b1010101, 0b1010101, 0b1010101, 0b1000101, 0b1111111] /*Z*/ ,
  3003. ];
  3004. var NUMS = [
  3005. [0b11111, 0b10001, 0b11111] /*0*/ ,
  3006. [0b01000, 0b11111] /*1*/ ,
  3007. [0b10111, 0b10101, 0b11101] /*2*/ ,
  3008. [0b10101, 0b10101, 0b11111] /*3*/ ,
  3009. [0b11100, 0b00100, 0b11111] /*4*/ ,
  3010. [0b11101, 0b10101, 0b10111] /*5*/ ,
  3011. [0b11111, 0b10101, 0b10111] /*6*/ ,
  3012. [0b10000, 0b10000, 0b11111] /*7*/ ,
  3013. [0b11111, 0b10101, 0b11111] /*8*/ ,
  3014. [0b11101, 0b10101, 0b11111] /*9*/
  3015. ];
  3016. var symbols = {
  3017. "33": [0b11101] /*!*/ ,
  3018. "34": [0b11000, 0b00000, 0b11000] /*"*/ ,
  3019. "35": [0b01010, 0b11111, 0b01010, 0b11111, 0b01010] /*#*/ ,
  3020. "39": [0b11000] /*'*/ ,
  3021. "40": [0b01110, 0b10001] /*(*/ ,
  3022. "41": [0b10001, 0b01110] /*)*/ ,
  3023. "43": [0b00100, 0b01110, 0b00100] /*+*/ ,
  3024. "45": [0b00100, 0b00100, 0b00100] /*-*/ ,
  3025. "46": [0b00001] /*.*/ ,
  3026. "47": [0b00001, 0b00110, 0b11000] /*/*/ ,
  3027. "58": [0b01010] /*:*/ ,
  3028. "61": [0b01010, 0b01010, 0b01010] /*=*/ ,
  3029. "63": [0b10101, 0b01000] /*?*/ ,
  3030. "91": [0b11111, 0b10001] /*[*/ ,
  3031. "93": [0b10001, 0b11111] /*]*/
  3032. };
  3033.  
  3034. function infinityX(t) {
  3035. let x = (Math.cos(t*2)-1)/2;
  3036. if (Math.abs(t*2) % (4*Math.PI) > 2*Math.PI) return -x;
  3037. else return x;
  3038. };
  3039. function infinityY(t) {
  3040. return Math.sin(t*2) / 2;
  3041. };
  3042. function squareX(angle) {
  3043. let x = Math.sin(angle), y = Math.cos(angle);
  3044. return x / Math.max(Math.abs(x), Math.abs(y));
  3045. };
  3046. function squareY(angle) {
  3047. let x = Math.sin(angle), y = Math.cos(angle);
  3048. return y / Math.max(Math.abs(x), Math.abs(y));
  3049. };
  3050. function pixColor(img, X, Y, RGB) {
  3051. var abab = img.getImageData(X, Y, 1, 1).data
  3052. return [abab[0], abab[1], abab[2]]
  3053. };
  3054. function getRandomInt2(max) {
  3055. return Math.floor(Math.random() * max);
  3056. };
  3057. function dist(x, y) {
  3058. return Math.sqrt(x * x + y * y);
  3059. };
  3060.  
  3061. function append(src, onload) {
  3062. var s = document.createElement('script');
  3063. s.src = src;
  3064. s.onload = onload;
  3065. document.body.appendChild(s);
  3066. };
  3067.  
  3068. setTimeout(install, 2001);
  3069. })();