Dsync Client [Sploop.io]

The most advanced hack for sploop.io

目前為 2022-09-18 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Dsync Client [Sploop.io]
  3. // @author Murka
  4. // @description The most advanced hack for sploop.io
  5. // @icon https://sploop.io/img/ui/favicon.png
  6. // @version 1.0.14
  7. // @match *://sploop.io/*
  8. // @run-at document-start
  9. // @grant none
  10. // @license MIT
  11. // @namespace https://greasyfork.org/users/919633
  12. // ==/UserScript==
  13. /* jshint esversion:6 */
  14.  
  15. /*
  16. Author: Murka
  17. Github: https://github.com/Murka007/Dsync-client
  18. Discord: https://discord.gg/sG9cyfGPj5
  19. Greasyfork: https://greasyfork.org/en/users/919633
  20.  
  21. PLEASE, I NEED YOUR SUPPORT ON GITHUB (GIVE ME A STAR ON MY REPOSITORY),
  22. ALSO SUPPORT THIS SCRIPT ON GREASYFORK (register and write a comment: "this script works, thank you so much"),
  23. FOR MORE UPDATES JOIN MY DISCORD SERVER!!!
  24. */
  25.  
  26. Function("(" + ((GM_info) => {
  27. "use strict";
  28. var __webpack_modules__ = {
  29. 147: module => {
  30. module.exports = {
  31. i8: "1.0.14"
  32. };
  33. }
  34. };
  35. var __webpack_module_cache__ = {};
  36. function __webpack_require__(moduleId) {
  37. var cachedModule = __webpack_module_cache__[moduleId];
  38. if (cachedModule !== undefined) {
  39. return cachedModule.exports;
  40. }
  41. var module = __webpack_module_cache__[moduleId] = {
  42. exports: {}
  43. };
  44. __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  45. return module.exports;
  46. }
  47. (() => {
  48. __webpack_require__.d = (exports, definition) => {
  49. for (var key in definition) {
  50. if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  51. Object.defineProperty(exports, key, {
  52. enumerable: true,
  53. get: definition[key]
  54. });
  55. }
  56. }
  57. };
  58. })();
  59. (() => {
  60. __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
  61. })();
  62. var __webpack_exports__ = {};
  63. (() => {
  64. __webpack_require__.d(__webpack_exports__, {
  65. s: () => Dsync,
  66. c: () => log
  67. });
  68. var WebsocketString;
  69. (function(WebsocketString) {
  70. WebsocketString[WebsocketString["CONNECT"] = 12] = "CONNECT";
  71. WebsocketString[WebsocketString["DEFAULTDATA"] = 33] = "DEFAULTDATA";
  72. WebsocketString[WebsocketString["DIED"] = 19] = "DIED";
  73. WebsocketString[WebsocketString["KILLUPDATE"] = 22] = "KILLUPDATE";
  74. WebsocketString[WebsocketString["KILLED"] = 28] = "KILLED";
  75. WebsocketString[WebsocketString["SPAWN"] = 35] = "SPAWN";
  76. })(WebsocketString || (WebsocketString = {}));
  77. var EItems;
  78. (function(EItems) {
  79. EItems[EItems["PRIMARY"] = 0] = "PRIMARY";
  80. EItems[EItems["SECONDARY"] = 1] = "SECONDARY";
  81. EItems[EItems["HEAL"] = 2] = "HEAL";
  82. EItems[EItems["WALL"] = 3] = "WALL";
  83. EItems[EItems["SPIKE"] = 4] = "SPIKE";
  84. EItems[EItems["WINDMILL"] = 5] = "WINDMILL";
  85. EItems[EItems["TREE"] = 6] = "TREE";
  86. EItems[EItems["TRAP"] = 7] = "TRAP";
  87. EItems[EItems["PLATFORM"] = 8] = "PLATFORM";
  88. EItems[EItems["SPAWN"] = 9] = "SPAWN";
  89. EItems[EItems["TURRET"] = 10] = "TURRET";
  90. })(EItems || (EItems = {}));
  91. var ELayer;
  92. (function(ELayer) {
  93. ELayer[ELayer["PLAYER"] = 0] = "PLAYER";
  94. ELayer[ELayer["STONE"] = 1] = "STONE";
  95. ELayer[ELayer["HARDSPIKE"] = 2] = "HARDSPIKE";
  96. ELayer[ELayer["TREE"] = 3] = "TREE";
  97. ELayer[ELayer["GOLD"] = 4] = "GOLD";
  98. ELayer[ELayer["BUSH"] = 5] = "BUSH";
  99. ELayer[ELayer["TRAP"] = 6] = "TRAP";
  100. ELayer[ELayer["SPIKE"] = 7] = "SPIKE";
  101. ELayer[ELayer["WOODWALL"] = 8] = "WOODWALL";
  102. ELayer[ELayer["PLATFORM"] = 9] = "PLATFORM";
  103. ELayer[ELayer["BOOST"] = 10] = "BOOST";
  104. ELayer[ELayer["LOOTBOX"] = 11] = "LOOTBOX";
  105. ELayer[ELayer["PROJECTILE"] = 12] = "PROJECTILE";
  106. ELayer[ELayer["WINDMILL"] = 13] = "WINDMILL";
  107. ELayer[ELayer["COW"] = 14] = "COW";
  108. ELayer[ELayer["SPAWN"] = 15] = "SPAWN";
  109. ELayer[ELayer["POWERMILL"] = 16] = "POWERMILL";
  110. ELayer[ELayer["CASTLESPIKE"] = 17] = "CASTLESPIKE";
  111. ELayer[ELayer["TURRET"] = 18] = "TURRET";
  112. ELayer[ELayer["WOODFARM"] = 19] = "WOODFARM";
  113. ELayer[ELayer["CHERRYWOODFARM"] = 20] = "CHERRYWOODFARM";
  114. ELayer[ELayer["STONEWARM"] = 21] = "STONEWARM";
  115. ELayer[ELayer["CASTLEWALL"] = 22] = "CASTLEWALL";
  116. ELayer[ELayer["SHARK"] = 23] = "SHARK";
  117. ELayer[ELayer["WOLF"] = 24] = "WOLF";
  118. ELayer[ELayer["GOLDENCOW"] = 25] = "GOLDENCOW";
  119. ELayer[ELayer["ROOF"] = 26] = "ROOF";
  120. ELayer[ELayer["DRAGON"] = 27] = "DRAGON";
  121. ELayer[ELayer["MAMMOTH"] = 28] = "MAMMOTH";
  122. ELayer[ELayer["FIREBALL"] = 29] = "FIREBALL";
  123. ELayer[ELayer["CHEST"] = 30] = "CHEST";
  124. ELayer[ELayer["DRAGONWALLBIG"] = 31] = "DRAGONWALLBIG";
  125. ELayer[ELayer["DRAGONWALLMEDIUM"] = 32] = "DRAGONWALLMEDIUM";
  126. ELayer[ELayer["DRAGONWALLSMALL"] = 33] = "DRAGONWALLSMALL";
  127. ELayer[ELayer["MAMMOTHWALL"] = 34] = "MAMMOTHWALL";
  128. ELayer[ELayer["MAMMOTHWALLSMALL"] = 35] = "MAMMOTHWALLSMALL";
  129. ELayer[ELayer["DUCK"] = 36] = "DUCK";
  130. ELayer[ELayer["TELEPORT"] = 37] = "TELEPORT";
  131. ELayer[ELayer["CACTUS"] = 38] = "CACTUS";
  132. ELayer[ELayer["TORNADO"] = 39] = "TORNADO";
  133. })(ELayer || (ELayer = {}));
  134. const LayerObjects = [ ELayer.STONE, ELayer.HARDSPIKE, ELayer.TREE, ELayer.GOLD, ELayer.BUSH, ELayer.SPIKE, ELayer.WOODWALL, ELayer.WINDMILL, ELayer.SPAWN, ELayer.POWERMILL, ELayer.CASTLESPIKE, ELayer.TURRET, ELayer.WOODFARM, ELayer.CHERRYWOODFARM, ELayer.STONEWARM, ELayer.CASTLEWALL, ELayer.CHEST, ELayer.DRAGONWALLBIG, ELayer.DRAGONWALLMEDIUM, ELayer.DRAGONWALLSMALL, ELayer.MAMMOTHWALL, ELayer.MAMMOTHWALLSMALL, ELayer.TELEPORT, ELayer.CACTUS ];
  135. const LayerExclude = [ ELayer.TREE, ELayer.WOODFARM, ELayer.CHERRYWOODFARM ];
  136. var EObjects;
  137. (function(EObjects) {
  138. EObjects[EObjects["BOOST"] = 6] = "BOOST";
  139. EObjects[EObjects["PLATFORM"] = 8] = "PLATFORM";
  140. EObjects[EObjects["TRAP"] = 9] = "TRAP";
  141. EObjects[EObjects["ROOF"] = 48] = "ROOF";
  142. })(EObjects || (EObjects = {}));
  143. var EHats;
  144. (function(EHats) {
  145. EHats[EHats["BUSH"] = 1] = "BUSH";
  146. EHats[EHats["BERSERKER"] = 2] = "BERSERKER";
  147. EHats[EHats["JUNGLE"] = 3] = "JUNGLE";
  148. EHats[EHats["CRYSTAL"] = 4] = "CRYSTAL";
  149. EHats[EHats["SPIKEGEAR"] = 5] = "SPIKEGEAR";
  150. EHats[EHats["IMMUNITY"] = 6] = "IMMUNITY";
  151. EHats[EHats["BOOST"] = 7] = "BOOST";
  152. EHats[EHats["APPLEHAT"] = 8] = "APPLEHAT";
  153. EHats[EHats["SCUBA"] = 9] = "SCUBA";
  154. EHats[EHats["HOOD"] = 10] = "HOOD";
  155. EHats[EHats["DEMOLIST"] = 11] = "DEMOLIST";
  156. })(EHats || (EHats = {}));
  157. var EWeapons;
  158. (function(EWeapons) {
  159. EWeapons[EWeapons["SHIELD"] = 11] = "SHIELD";
  160. EWeapons[EWeapons["STICK"] = 13] = "STICK";
  161. EWeapons[EWeapons["HAMMER"] = 15] = "HAMMER";
  162. EWeapons[EWeapons["SCYTHE"] = 57] = "SCYTHE";
  163. })(EWeapons || (EWeapons = {}));
  164. var EItemTypes;
  165. (function(EItemTypes) {
  166. EItemTypes[EItemTypes["ATTACKING"] = 0] = "ATTACKING";
  167. EItemTypes[EItemTypes["SHOOTING"] = 1] = "SHOOTING";
  168. EItemTypes[EItemTypes["PLACEABLE"] = 2] = "PLACEABLE";
  169. EItemTypes[EItemTypes["FOOD"] = 3] = "FOOD";
  170. })(EItemTypes || (EItemTypes = {}));
  171. var EAnimals;
  172. (function(EAnimals) {
  173. EAnimals[EAnimals["COW"] = 14] = "COW";
  174. EAnimals[EAnimals["SHARK"] = 23] = "SHARK";
  175. EAnimals[EAnimals["WOLF"] = 24] = "WOLF";
  176. EAnimals[EAnimals["GOLDENCOW"] = 25] = "GOLDENCOW";
  177. EAnimals[EAnimals["DRAGON"] = 27] = "DRAGON";
  178. EAnimals[EAnimals["MAMMOTH"] = 28] = "MAMMOTH";
  179. EAnimals[EAnimals["DUCK"] = 36] = "DUCK";
  180. })(EAnimals || (EAnimals = {}));
  181. var PlacementType;
  182. (function(PlacementType) {
  183. PlacementType[PlacementType["DEFAULT"] = 0] = "DEFAULT";
  184. PlacementType[PlacementType["INVISIBLE"] = 1] = "INVISIBLE";
  185. PlacementType[PlacementType["HOLDING"] = 2] = "HOLDING";
  186. })(PlacementType || (PlacementType = {}));
  187. const selectData = {
  188. placementType: PlacementType
  189. };
  190. const TYPEOF = value => Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
  191. const removeClass = (target, name) => {
  192. if (target instanceof HTMLElement) {
  193. target.classList.remove(name);
  194. return;
  195. }
  196. for (const element of target) {
  197. element.classList.remove(name);
  198. }
  199. };
  200. const formatCode = code => {
  201. code = code + "";
  202. if (code === "0") return "LBTN";
  203. if (code === "1") return "MBTN";
  204. if (code === "2") return "RBTN";
  205. if (code === "3") return "XBTN2";
  206. if (code === "4") return "XBTN1";
  207. if (code === "Escape") return "ESC";
  208. if (code === "BracketLeft") return "[";
  209. if (code === "BracketRight") return "]";
  210. if (code === "NumpadDivide") return "NUMDIV";
  211. if (code === "NumpadMultiply") return "NUMMULT";
  212. if (code === "NumpadSubtract") return "NUMSUB";
  213. if (code === "NumpadDecimal") return "NUMDEC";
  214. if (code === "CapsLock") return "CAPS";
  215. if (code === "PrintScreen") return "PRNT";
  216. if (code === "Backslash") return "\\";
  217. if (code === "Backquote") return "BQUOTE";
  218. if (code === "PageDown") return "PAGEDN";
  219. const NumpadDigitArrowKey = /^(?:Numpad|Digit|Arrow|Key)(\w+)$/;
  220. if (NumpadDigitArrowKey.test(code)) {
  221. code = code.replace(NumpadDigitArrowKey, "$1").replace(/Numpad/, "NUM");
  222. }
  223. const ExtraKeysRegex = /^(Control|Shift|Alt)(.).*/;
  224. if (ExtraKeysRegex.test(code)) {
  225. code = code.replace(ExtraKeysRegex, "$2$1").replace(/Control/, "CTRL");
  226. }
  227. return code.toUpperCase();
  228. };
  229. const contains = (target, name) => target.classList.contains(name);
  230. const isInput = target => {
  231. const element = target || document.activeElement;
  232. return [ "TEXTAREA", "INPUT" ].includes(element.tagName);
  233. };
  234. const inGame = () => {
  235. const homepage = document.querySelector("#homepage");
  236. return homepage && homepage.style.display === "none";
  237. };
  238. const formatData = object => ({
  239. id: object[Dsync.props.id],
  240. type: object.type,
  241. x: object[Dsync.props.x],
  242. y: object[Dsync.props.y],
  243. x1: object[Dsync.props.x1],
  244. y1: object[Dsync.props.y1],
  245. x2: object[Dsync.props.x2],
  246. y2: object[Dsync.props.y2],
  247. angle: object[Dsync.props.angle],
  248. angle1: object[Dsync.props.angle1],
  249. angle2: object[Dsync.props.angle2],
  250. ownerID: object[Dsync.props.itemOwner],
  251. target: object
  252. });
  253. const formatProjectile = object => {
  254. const data = formatData(object);
  255. return {
  256. ...data,
  257. range: object.range
  258. };
  259. };
  260. const formatObject = object => {
  261. const data = formatData(object);
  262. const entityData = Dsync.entityData[object.type];
  263. return {
  264. ...data,
  265. radius: entityData[Dsync.props.radius]
  266. };
  267. };
  268. const formatEntity = entity => {
  269. const object = formatObject(entity);
  270. const entityData = Dsync.entityData[entity.type];
  271. const healthValue = entity[Dsync.props.health];
  272. const maxHealth = entityData[Dsync.props.maxHealth];
  273. return {
  274. ...object,
  275. healthValue,
  276. health: Math.ceil(entity[Dsync.props.health] / 255 * maxHealth),
  277. maxHealth,
  278. playerValue: entity[Dsync.props.playerValue]
  279. };
  280. };
  281. const formatPlayer = entity => {
  282. const player = formatEntity(entity);
  283. return {
  284. ...player,
  285. hat: entity[Dsync.props.hat],
  286. isClown: player.playerValue === 128
  287. };
  288. };
  289. const dist = (x1, y1, x2, y2) => Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
  290. const distance = (entity1, entity2) => {
  291. const entity1Has = "x" in entity1 && "y" in entity1;
  292. const entity2Has = "x" in entity2 && "y" in entity2;
  293. return {
  294. lerpDist: entity1Has && entity2Has ? dist(entity1.x, entity1.y, entity2.x, entity2.y) : null,
  295. dist: dist(entity1.x2, entity1.y2, entity2.x2, entity2.y2)
  296. };
  297. };
  298. const angle = (x1, y1, x2, y2) => Math.atan2(y1 - y2, x1 - x2);
  299. const angleObject = (entity1, entity2) => angle(entity1.x2, entity1.y2, entity2.x2, entity2.y2);
  300. const getAngle = (entity1, entity2) => {
  301. const entity1Has = "x" in entity1 && "y" in entity1;
  302. const entity2Has = "x" in entity2 && "y" in entity2;
  303. return {
  304. lerpAngle: entity1Has && entity2Has ? Math.atan2(entity1.y - entity2.y, entity1.x - entity2.x) : null,
  305. angle: Math.atan2(entity1.y2 - entity2.y2, entity1.x2 - entity2.x2)
  306. };
  307. };
  308. const lerp = (start, stop, amt) => amt * (stop - start) + start;
  309. const sleep = ms => new Promise((resolve => setTimeout(resolve, ms)));
  310. const linker = value => {
  311. const hook = {
  312. 0: value,
  313. toString: radix => hook[0].toString(radix),
  314. valueOf: () => hook[0].valueOf()
  315. };
  316. return hook;
  317. };
  318. const download = (data, filename) => {
  319. const blob = new Blob([ JSON.stringify(data, null, 4) ], {
  320. type: "application/json "
  321. });
  322. const url = URL.createObjectURL(blob);
  323. const a = document.createElement("a");
  324. a.href = url;
  325. a.download = (filename || "settings") + ".txt";
  326. a.click();
  327. a.remove();
  328. URL.revokeObjectURL(url);
  329. };
  330. const capitalize = word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
  331. const GM = (property, value) => {
  332. if (!Dsync.PRODUCTION) return true;
  333. try {
  334. return GM_info.script[property] === value;
  335. } catch (err) {
  336. return false;
  337. }
  338. };
  339. const fromCharCode = codes => codes.map((code => String.fromCharCode(code))).join("");
  340. let teammates = [];
  341. const UpdateClanList = userList => {
  342. teammates = userList;
  343. };
  344. const DeleteClan = () => {
  345. teammates = [];
  346. };
  347. const itemBar = index => Dsync.defaultData[Dsync.props.itemBar][index];
  348. const hasSecondary = () => {
  349. const item = Dsync.itemData[itemBar(1)];
  350. return item[Dsync.props.itemType] === EItems.SECONDARY;
  351. };
  352. const canShoot = () => {
  353. const item = Dsync.itemData[itemBar(1)];
  354. return item[Dsync.props.itemDataType] === EItemTypes.SHOOTING;
  355. };
  356. const hasItemByType = type => {
  357. const items = Dsync.defaultData[Dsync.props.itemBar];
  358. return items.some((id => Dsync.itemData[id][Dsync.props.itemType] === type));
  359. };
  360. const isStoneGold = () => {
  361. const item = Dsync.itemData[itemBar(0)];
  362. return [ 1, 2 ].includes(item[Dsync.props.weaponType]);
  363. };
  364. let scytheToggle = false;
  365. const upgradeScythe = async () => {
  366. const goldenCowID = Dsync.goldenCowID();
  367. if (goldenCowID && itemBar(0) !== EWeapons.SCYTHE && !scytheToggle) {
  368. scytheToggle = true;
  369. Dsync.upgradeScythe(goldenCowID);
  370. await sleep(200);
  371. scytheToggle = false;
  372. }
  373. };
  374. const getAnimals = () => {
  375. const list = Dsync.entityList();
  376. return [ ...list[EAnimals.COW], ...list[EAnimals.SHARK], ...list[EAnimals.WOLF], ...list[EAnimals.GOLDENCOW], ...list[EAnimals.DRAGON], ...list[EAnimals.MAMMOTH], ...list[EAnimals.DUCK] ].map((entity => formatEntity(entity)));
  377. };
  378. const getEnemies = () => {
  379. const players = Dsync.entityList()[0];
  380. return players.map((player => formatEntity(player))).filter((({id, ownerID}) => {
  381. const isMyPlayer = id === Dsync.myPlayerID();
  382. const isTeammate = teammates.includes(ownerID);
  383. return !isMyPlayer && !isTeammate;
  384. }));
  385. };
  386. const getEntities = () => [ ...getEnemies(), ...getAnimals() ];
  387. const lineSegmentIntersectsCircle = (x1, y1, x2, y2, cx, cy, r) => {
  388. const xL = x2 - x1;
  389. const xC = x1 - cx;
  390. const yL = y2 - y1;
  391. const yC = y1 - cy;
  392. const a = xL * xL + yL * yL;
  393. const hB = xL * xC + yL * yC;
  394. const c = xC * xC + yC * yC - r * r;
  395. return hB * hB >= a * c && (-hB <= a || c + hB + hB + a <= 0) && (hB <= 0 || c <= 0);
  396. };
  397. const futurePosition = entity => {
  398. const {x1, y1, x2, y2} = entity;
  399. const distance = dist(x2, y2, x1, y1) * (entity === Dsync.myPlayer ? 1 : 2.2);
  400. const dir = angle(x2, y2, x1, y1);
  401. return {
  402. x2: x2 + distance * Math.cos(dir),
  403. y2: y2 + distance * Math.sin(dir)
  404. };
  405. };
  406. const getNearestEntities = shoot => {
  407. const enemies = getEnemies().map((enemy => ({
  408. ...enemy,
  409. dir: getAngle(enemy, Dsync.myPlayer).angle,
  410. distance: distance(enemy, Dsync.myPlayer).dist
  411. }))).sort(((a, b) => a.distance - b.distance));
  412. if (shoot) {
  413. enemies.sort(((a, b) => {
  414. const hasShield1 = a.target[Dsync.props.currentItem] === EWeapons.SHIELD;
  415. const hasShield2 = b.target[Dsync.props.currentItem] === EWeapons.SHIELD;
  416. return hasShield1 ? 1 : hasShield2 ? -1 : 0;
  417. }));
  418. }
  419. const animals = getAnimals().map((enemy => ({
  420. ...enemy,
  421. dir: getAngle(enemy, Dsync.myPlayer).angle,
  422. distance: distance(enemy, Dsync.myPlayer).dist
  423. }))).sort(((a, b) => a.distance - b.distance));
  424. return [ ...enemies, ...animals ];
  425. };
  426. const entityIn = (entity, layer) => Dsync.entityList()[layer].some((target => {
  427. const object = formatObject(target);
  428. return distance(entity, object).dist < entity.radius + object.radius;
  429. }));
  430. const projectileCanHitEntity = entity => {
  431. if (!canShoot()) return false;
  432. const range = Dsync.itemData[itemBar(EItems.SECONDARY)].range;
  433. const enemy = {
  434. ...entity,
  435. dir: getAngle(entity, Dsync.myPlayer).angle,
  436. distance: distance(entity, Dsync.myPlayer).dist
  437. };
  438. const x1 = Dsync.myPlayer.x2;
  439. const y1 = Dsync.myPlayer.y2;
  440. const x2 = x1 + range * Math.cos(enemy.dir);
  441. const y2 = y1 + range * Math.sin(enemy.dir);
  442. const myPlayerOnPlatform = entityIn(Dsync.myPlayer, ELayer.PLATFORM);
  443. const entityInRoof = entityIn(entity, ELayer.ROOF);
  444. if (myPlayerOnPlatform && entityInRoof) return false;
  445. const layers = Dsync.entityList();
  446. for (const layer of LayerObjects) {
  447. if (myPlayerOnPlatform && !LayerExclude.includes(layer)) continue;
  448. for (const entity of layers[layer]) {
  449. const object = formatObject(entity);
  450. const dist = distance(object, Dsync.myPlayer).dist;
  451. if (dist > enemy.distance) continue;
  452. if (lineSegmentIntersectsCircle(x1, y1, x2, y2, object.x2, object.y2, object.radius)) {
  453. const objectData = Dsync.entityData[object.type];
  454. const maxHealth = objectData[Dsync.props.maxHealth];
  455. if (maxHealth === undefined) return false;
  456. return {
  457. canHit: true,
  458. needDestroy: true
  459. };
  460. }
  461. }
  462. }
  463. return {
  464. canHit: true,
  465. needDestroy: false
  466. };
  467. };
  468. const getNearestPossibleEnemy = index => {
  469. const range = Dsync.itemData[itemBar(index)].range;
  470. const shoot = canShoot() && index === 1;
  471. const enemies = getNearestEntities(shoot).filter((enemy => {
  472. const inDistance = enemy.distance < range + enemy.radius;
  473. if (shoot) {
  474. const entityHit = projectileCanHitEntity(enemy);
  475. return inDistance && typeof entityHit === "object" && entityHit.canHit;
  476. }
  477. return inDistance;
  478. }));
  479. if (shoot) {
  480. enemies.sort(((a, b) => {
  481. const canHitA = projectileCanHitEntity(a);
  482. const canHitB = projectileCanHitEntity(b);
  483. return canHitA.needDestroy ? 1 : canHitB.needDestroy ? -1 : 0;
  484. }));
  485. }
  486. return enemies.length ? enemies[0] : null;
  487. };
  488. const storage = {
  489. get(key) {
  490. return JSON.parse(localStorage.getItem(key));
  491. },
  492. set(key, value) {
  493. localStorage.setItem(key, JSON.stringify(value));
  494. },
  495. delete(key) {
  496. localStorage.removeItem(key);
  497. }
  498. };
  499. const defaultSettings = {
  500. primary: "Digit1",
  501. secondary: "Digit2",
  502. heal: "KeyQ",
  503. wall: "Digit4",
  504. spike: "KeyV",
  505. windmill: "KeyN",
  506. trap: "KeyF",
  507. turret: "KeyH",
  508. tree: "KeyU",
  509. platform: "KeyT",
  510. spawn: "KeyJ",
  511. up: "KeyW",
  512. left: "KeyA",
  513. down: "KeyS",
  514. right: "KeyD",
  515. autoattack: "KeyE",
  516. lockRotation: "KeyX",
  517. openChat: "Enter",
  518. invisibleHit: 2,
  519. spikeInsta: "KeyR",
  520. toggleMenu: "Escape",
  521. fastBreak: "KeyZ",
  522. upgradeScythe: "...",
  523. unequip: "...",
  524. bush: "...",
  525. berserker: "...",
  526. jungle: "...",
  527. crystal: "...",
  528. spikegear: "...",
  529. immunity: 4,
  530. boost: 3,
  531. applehat: "...",
  532. scuba: "...",
  533. hood: "...",
  534. demolist: "...",
  535. placementType: PlacementType.INVISIBLE,
  536. placementSpeed: 1,
  537. autoheal: true,
  538. jungleOnClown: true,
  539. lastHat: true,
  540. autoScuba: true,
  541. meleeAim: true,
  542. bowAim: true,
  543. spikeInstaAim: true,
  544. enemyTracers: true,
  545. teammateTracers: true,
  546. animalTracers: true,
  547. enemyColor: "#cc5151",
  548. teammateColor: "#8ecc51",
  549. animalColor: "#518ccc",
  550. arrows: true,
  551. rainbow: false,
  552. drawHP: true,
  553. showHoods: true,
  554. itemCounter: true,
  555. drawID: false,
  556. visualAim: true,
  557. hideNicknames: false,
  558. itemMarkers: true,
  559. teammateMarkers: true,
  560. enemyMarkers: true,
  561. trapActivated: true,
  562. itemMarkersColor: "#8ecc51",
  563. teammateMarkersColor: "#cfbc5f",
  564. enemyMarkersColor: "#cc5151",
  565. trapActivatedColor: "#48b2b8",
  566. markersBottom: true,
  567. hatReloadBar: true,
  568. hatReloadBarColor: "#5155cc",
  569. fireballReloadBar: true,
  570. fireballReloadBarColor: "#cf7748",
  571. turretReloadBar: true,
  572. turretReloadBarColor: "#51cc80",
  573. windmillRotation: false,
  574. possibleShots: true,
  575. hideMessages: false,
  576. autochat: true,
  577. autochatMessages: [ "Dsync Client", "What is it?", "The most advanced hack for sploop!", "Download on greasyfork!" ],
  578. kill: true,
  579. killMessage: "{NAME}, you suck! {KILL}x",
  580. autospawn: false,
  581. smoothZoom: true,
  582. skipUpgrades: true,
  583. invisHitToggle: false,
  584. reverseZoom: false,
  585. autoScythe: true,
  586. autoAccept: false,
  587. menuTransparency: false
  588. };
  589. const settings = {
  590. ...defaultSettings,
  591. ...storage.get("Dsync-settings")
  592. };
  593. for (const key in settings) {
  594. if (!defaultSettings.hasOwnProperty(key)) {
  595. delete settings[key];
  596. }
  597. }
  598. storage.set("Dsync-settings", settings);
  599. const Settings = settings;
  600. let move = 0;
  601. let attacking = false;
  602. let autoattack = false;
  603. let weapon = false;
  604. let isHealing = false;
  605. let attackingInvis = false;
  606. let toggleInvis = false;
  607. let currentItem = null;
  608. const hotkeys = new Map;
  609. const accept = accept => {
  610. Dsync.accept(accept);
  611. Dsync.clanData[Dsync.props.acceptList].shift();
  612. };
  613. const spawn = async () => {
  614. await sleep(100);
  615. const play = document.querySelector("#play");
  616. if (play) play.click();
  617. };
  618. let chatCount = 0;
  619. let chatToggle = false;
  620. const autochat = async () => {
  621. if (chatToggle || isInput() || !inGame()) return;
  622. chatToggle = true;
  623. const messages = Settings.autochatMessages.filter((msg => msg.length));
  624. if (!messages.length) return;
  625. Dsync.chat(messages[chatCount++]);
  626. chatCount %= messages.length;
  627. await sleep(2e3);
  628. chatToggle = false;
  629. };
  630. const Controller_reset = () => {
  631. move = 0;
  632. attacking = false;
  633. autoattack = false;
  634. weapon = false;
  635. isHealing = false;
  636. attackingInvis = false;
  637. toggleInvis = false;
  638. currentItem = null;
  639. for (const [key] of hotkeys) {
  640. hotkeys.delete(key);
  641. }
  642. };
  643. const equipHat = (id, ignore = false, actual = true) => {
  644. const hat = (Dsync.myPlayer || {}).hat || 0;
  645. if (id === 0) {
  646. id = hat;
  647. } else if (hat === id && !ignore) return;
  648. if (actual) {
  649. Dsync.actualHat = id;
  650. }
  651. Dsync.equipHat(id);
  652. Dsync.equipHat(id);
  653. };
  654. const whichWeapon = type => {
  655. if (type !== undefined) {
  656. weapon = type;
  657. }
  658. Dsync.selectByID(itemBar(Number(weapon)));
  659. };
  660. const attack = (angle = null) => {
  661. Dsync.attack(angle !== null ? angle : Dsync.getAngle());
  662. };
  663. const place = (id, angle = null) => {
  664. whichWeapon();
  665. if (attacking || autoattack) attack(angle);
  666. Dsync.selectItem(id);
  667. attack(angle);
  668. Dsync.stopAttack();
  669. if (Settings.placementType !== PlacementType.HOLDING) whichWeapon();
  670. };
  671. let count = 0;
  672. const placement = () => {
  673. if (currentItem === null) return;
  674. place(currentItem);
  675. count++;
  676. if ((count %= Settings.placementSpeed) === 0) {
  677. setTimeout(placement);
  678. } else {
  679. queueMicrotask(placement);
  680. }
  681. };
  682. const placementHandler = (type, code) => {
  683. if (!hasItemByType(type)) return;
  684. if (Settings.placementType === PlacementType.DEFAULT) {
  685. Dsync.selectItem(type);
  686. return;
  687. }
  688. hotkeys.set(code, type);
  689. currentItem = type;
  690. if (hotkeys.size === 1) {
  691. placement();
  692. }
  693. };
  694. const heal = () => {
  695. Dsync.selectItem(EItems.HEAL);
  696. attack();
  697. Dsync.stopAttack();
  698. whichWeapon();
  699. if (attacking) {
  700. attack();
  701. }
  702. };
  703. const healing = () => {
  704. if (!isHealing) return;
  705. heal();
  706. setTimeout(healing, 0);
  707. };
  708. const invisibleHit = () => {
  709. Dsync.mousemove = true;
  710. Dsync.aimTarget = null;
  711. if (Settings.invisHitToggle && !toggleInvis || !Settings.invisHitToggle && !attackingInvis) {
  712. toggleInvis = false;
  713. attackingInvis = false;
  714. return;
  715. }
  716. let angle = null;
  717. const enemy = getNearestPossibleEnemy(+!weapon);
  718. const shoot = canShoot() && !weapon;
  719. if (enemy && (Settings.meleeAim && !shoot || Settings.bowAim && shoot)) {
  720. angle = angleObject(futurePosition(enemy), futurePosition(Dsync.myPlayer));
  721. Dsync.mousemove = false;
  722. Dsync.aimTarget = enemy.target;
  723. }
  724. if (enemy && shoot || !shoot) {
  725. whichWeapon(!weapon);
  726. attack(angle);
  727. Dsync.stopAttack();
  728. whichWeapon(!weapon);
  729. }
  730. setTimeout(invisibleHit, 75);
  731. };
  732. const spikeInsta = () => {
  733. let angle = null;
  734. if (Settings.spikeInstaAim) {
  735. const enemy = getNearestPossibleEnemy(0);
  736. if (enemy) {
  737. angle = enemy.dir;
  738. }
  739. }
  740. const oldWeapon = weapon;
  741. equipHat(EHats.BERSERKER);
  742. whichWeapon(false);
  743. place(EItems.SPIKE, angle);
  744. attack(angle);
  745. Dsync.stopAttack();
  746. whichWeapon(oldWeapon);
  747. };
  748. let fastBreakHat = 0;
  749. let oldWeapon = false;
  750. let fastBreaking = false;
  751. let startFastBreak = 0;
  752. const fastBreak = () => {
  753. if (fastBreaking) return;
  754. startFastBreak = Date.now();
  755. const primary = itemBar(0);
  756. const secondary = itemBar(1);
  757. const pickWeapon = hasSecondary() && !canShoot() && (secondary === EWeapons.HAMMER || primary === EWeapons.STICK);
  758. oldWeapon = weapon;
  759. fastBreaking = true;
  760. fastBreakHat = Dsync.myPlayer.hat;
  761. whichWeapon(pickWeapon);
  762. equipHat(EHats.DEMOLIST);
  763. attacking = true;
  764. attack();
  765. };
  766. const fastBreakStop = async () => {
  767. if (!fastBreaking) return;
  768. Dsync.stopAttack();
  769. attacking = false;
  770. whichWeapon(oldWeapon);
  771. const step = Date.now() - startFastBreak;
  772. if (step < 1300) await sleep(1300 - step);
  773. if (!Dsync.myPlayer.isClown) equipHat(fastBreakHat);
  774. fastBreaking = false;
  775. };
  776. const handleKeydown = (event, code) => {
  777. if (code === 1) event.preventDefault();
  778. if (event instanceof KeyboardEvent && event.repeat) return;
  779. if (Dsync.active) return;
  780. if (code === Settings.toggleMenu && !isInput(event.target)) {
  781. Dsync.toggleMenu();
  782. }
  783. if (!inGame()) return;
  784. if (code === Settings.openChat) {
  785. if (!isInput()) event.preventDefault();
  786. Dsync.toggleChat();
  787. }
  788. if (isInput(event.target)) return;
  789. if (code === Settings.primary) whichWeapon(false);
  790. if (code === Settings.secondary && hasSecondary()) whichWeapon(true);
  791. if (code === Settings.heal) {
  792. isHealing = true;
  793. healing();
  794. }
  795. if (code === Settings.wall) placementHandler(EItems.WALL, code);
  796. if (code === Settings.spike) placementHandler(EItems.SPIKE, code);
  797. if (code === Settings.windmill) placementHandler(EItems.WINDMILL, code);
  798. if (code === Settings.trap) placementHandler(EItems.TRAP, code);
  799. if (code === Settings.turret) placementHandler(EItems.TURRET, code);
  800. if (code === Settings.tree) placementHandler(EItems.TREE, code);
  801. if (code === Settings.platform) placementHandler(EItems.PLATFORM, code);
  802. if (code === Settings.spawn) placementHandler(EItems.SPAWN, code);
  803. if (code === Settings.unequip) equipHat(Dsync.myPlayer.hat, true);
  804. if (code === Settings.bush) equipHat(EHats.BUSH);
  805. if (code === Settings.berserker) equipHat(EHats.BERSERKER);
  806. if (code === Settings.jungle) equipHat(EHats.JUNGLE);
  807. if (code === Settings.crystal) equipHat(EHats.CRYSTAL);
  808. if (code === Settings.spikegear) equipHat(EHats.SPIKEGEAR);
  809. if (code === Settings.immunity) equipHat(EHats.IMMUNITY);
  810. if (code === Settings.boost) equipHat(EHats.BOOST);
  811. if (code === Settings.applehat) equipHat(EHats.APPLEHAT);
  812. if (code === Settings.scuba) equipHat(EHats.SCUBA);
  813. if (code === Settings.hood) equipHat(EHats.HOOD);
  814. if (code === Settings.demolist) equipHat(EHats.DEMOLIST);
  815. if (code === Settings.invisibleHit && hasSecondary()) {
  816. if (Settings.invisHitToggle) {
  817. toggleInvis = !toggleInvis;
  818. } else {
  819. attackingInvis = true;
  820. }
  821. if (toggleInvis || attackingInvis) invisibleHit();
  822. }
  823. if (code === Settings.spikeInsta) spikeInsta();
  824. if (code === Settings.fastBreak) fastBreak();
  825. const copyMove = move;
  826. if (code === Settings.up) move |= 1;
  827. if (code === Settings.left) move |= 4;
  828. if (code === Settings.down) move |= 2;
  829. if (code === Settings.right) move |= 8;
  830. if (copyMove !== move) Dsync.move(move);
  831. if (event instanceof MouseEvent && code === 0) {
  832. const canAttack = !Dsync.mousedown(event);
  833. if (canAttack && Dsync.mousemove) {
  834. attacking = true;
  835. Dsync.attack(Dsync.getAngle());
  836. }
  837. }
  838. if (code === Settings.autoattack) {
  839. autoattack = !autoattack;
  840. Dsync.autoattack(autoattack);
  841. }
  842. if (code === Settings.lockRotation) Dsync.toggleRotation();
  843. if (code === Settings.upgradeScythe) upgradeScythe();
  844. };
  845. const handleKeyup = (event, code) => {
  846. if (code === Settings.heal && isHealing) {
  847. isHealing = false;
  848. }
  849. if (code === Settings.invisibleHit && attackingInvis) {
  850. attackingInvis = false;
  851. }
  852. if (code === Settings.fastBreak) fastBreakStop();
  853. const copyMove = move;
  854. if (code === Settings.up) move &= -2;
  855. if (code === Settings.left) move &= -5;
  856. if (code === Settings.down) move &= -3;
  857. if (code === Settings.right) move &= -9;
  858. if (copyMove !== move) Dsync.move(move);
  859. if (event instanceof MouseEvent && code === 0) {
  860. Dsync.mouseup(event);
  861. attacking = false;
  862. }
  863. if (currentItem !== null && hotkeys.delete(code)) {
  864. const entries = [ ...hotkeys ];
  865. currentItem = entries.length ? entries[entries.length - 1][1] : null;
  866. if (currentItem === null) {
  867. whichWeapon();
  868. }
  869. }
  870. };
  871. var code = '<header> <span>Dsync Client</span> <div id="version"> <svg width="15" height="15" viewBox="0 0 16 16" version="1.1"> <path d="M11.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V6A2.5 2.5 0 0110 8.5H6a1 1 0 00-1 1v1.128a2.251 2.251 0 11-1.5 0V5.372a2.25 2.25 0 111.5 0v1.836A2.492 2.492 0 016 7h4a1 1 0 001-1v-.628A2.25 2.25 0 019.5 3.25zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zM3.5 3.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0z"></path> </svg> <span></span> </div> <svg id="close-menu" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30px" height="30px"> <path d="M 7 4 C 6.744125 4 6.4879687 4.0974687 6.2929688 4.2929688 L 4.2929688 6.2929688 C 3.9019687 6.6839688 3.9019687 7.3170313 4.2929688 7.7070312 L 11.585938 15 L 4.2929688 22.292969 C 3.9019687 22.683969 3.9019687 23.317031 4.2929688 23.707031 L 6.2929688 25.707031 C 6.6839688 26.098031 7.3170313 26.098031 7.7070312 25.707031 L 15 18.414062 L 22.292969 25.707031 C 22.682969 26.098031 23.317031 26.098031 23.707031 25.707031 L 25.707031 23.707031 C 26.098031 23.316031 26.098031 22.682969 25.707031 22.292969 L 18.414062 15 L 25.707031 7.7070312 C 26.098031 7.3170312 26.098031 6.6829688 25.707031 6.2929688 L 23.707031 4.2929688 C 23.316031 3.9019687 22.682969 3.9019687 22.292969 4.2929688 L 15 11.585938 L 7.7070312 4.2929688 C 7.5115312 4.0974687 7.255875 4 7 4 z"/> </svg> </header>';
  872. const Header = code;
  873. var Navbar_code = '<aside id="navbar-container"> <button class="open-menu active">Keybinds</button> <button class="open-menu">Combat</button> <button class="open-menu">Visuals</button> <button class="open-menu">Misc</button> <button class="open-menu bottom-align">Credits</button> </aside>';
  874. const Navbar = Navbar_code;
  875. var Keybinds_code = '<div class="menu-page opened"> <h1>Keybinds</h1> <p>Setup keybinds for items, weapons and hats</p> <div class="section"> <div class="section-title"> <h2>Items & Weapons</h2> <svg class="icon" version="1.0" xmlns="http://www.w3.org/2000/svg" width="64.000000pt" height="64.000000pt" viewBox="0 0 64.000000 64.000000" preserveAspectRatio="xMidYMid meet"> <g transform="translate(0.000000,64.000000) scale(0.100000,-0.100000)" stroke="none"> <path d="M160 575 l-54 -55 99 -100 100 -100 -100 -100 -100 -100 58 -57 57 -58 157 158 158 157 -155 155 c-85 85 -157 155 -160 155 -3 0 -30 -25 -60 -55z"/> </g> </svg> </div> <div class="section-content"> <div class="split-section"> <div class="section-option"> <span class="section-option-title">Primary</span> <button id="primary" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Secondary</span> <button id="secondary" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Heal</span> <button id="heal" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Wall</span> <button id="wall" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Spike</span> <button id="spike" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Windmill</span> <button id="windmill" class="section-option-hotkeyInput"></button> </div> </div> <div class="split-section"> <div class="section-option"> <span class="section-option-title">Trap/Boost</span> <button id="trap" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Turret</span> <button id="turret" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Tree/Stone</span> <button id="tree" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Platform</span> <button id="platform" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Cosy bed</span> <button id="spawn" class="section-option-hotkeyInput"></button> </div> </div> </div> </div> <div class="section"> <div class="section-title"> <h2>Combat & Functions</h2> <svg class="icon" version="1.0" xmlns="http://www.w3.org/2000/svg" width="64.000000pt" height="64.000000pt" viewBox="0 0 64.000000 64.000000" preserveAspectRatio="xMidYMid meet"> <g transform="translate(0.000000,64.000000) scale(0.100000,-0.100000)" stroke="none"> <path d="M160 575 l-54 -55 99 -100 100 -100 -100 -100 -100 -100 58 -57 57 -58 157 158 158 157 -155 155 c-85 85 -157 155 -160 155 -3 0 -30 -25 -60 -55z"/> </g> </svg> </div> <div class="section-content"> <div class="section-option"> <span class="section-option-title">Invisible hit</span> <button id="invisibleHit" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Spike insta</span> <button id="spikeInsta" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title"> Fast break <span class="tooltip"> * <span class="tooltip-text">When you press a key, it equips a demolist and starts attacking</span> </span> </span> <button id="fastBreak" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Zoom In</span> <button class="section-option-hotkeyInput smaller">WHEEL DN</button> </div> <div class="section-option"> <span class="section-option-title">Toggle Dsync Menu</span> <button id="toggleMenu" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Zoom Out</span> <button class="section-option-hotkeyInput smaller">WHEEL UP</button> </div> </div> </div> <div class="section"> <div class="section-title"> <h2>Hats</h2> <svg class="icon" version="1.0" xmlns="http://www.w3.org/2000/svg" width="64.000000pt" height="64.000000pt" viewBox="0 0 64.000000 64.000000" preserveAspectRatio="xMidYMid meet"> <g transform="translate(0.000000,64.000000) scale(0.100000,-0.100000)" stroke="none"> <path d="M160 575 l-54 -55 99 -100 100 -100 -100 -100 -100 -100 58 -57 57 -58 157 158 158 157 -155 155 c-85 85 -157 155 -160 155 -3 0 -30 -25 -60 -55z"/> </g> </svg> </div> <div class="section-content"> <div class="section-option"> <span class="section-option-title">Unequip hat</span> <button id="unequip" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Bush hat</span> <button id="bush" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Berserker</span> <button id="berserker" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Jungle gear</span> <button id="jungle" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Crystal gear</span> <button id="crystal" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Spike gear</span> <button id="spikegear" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Immunity gear</span> <button id="immunity" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Boost hat</span> <button id="boost" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Apple hat</span> <button id="applehat" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Scuba gear</span> <button id="scuba" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Hood</span> <button id="hood" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Demolist</span> <button id="demolist" class="section-option-hotkeyInput"></button> </div> </div> </div> <div class="section"> <div class="section-title"> <h2>Controls & Movement</h2> <svg class="icon" version="1.0" xmlns="http://www.w3.org/2000/svg" width="64.000000pt" height="64.000000pt" viewBox="0 0 64.000000 64.000000" preserveAspectRatio="xMidYMid meet"> <g transform="translate(0.000000,64.000000) scale(0.100000,-0.100000)" stroke="none"> <path d="M160 575 l-54 -55 99 -100 100 -100 -100 -100 -100 -100 58 -57 57 -58 157 158 158 157 -155 155 c-85 85 -157 155 -160 155 -3 0 -30 -25 -60 -55z"/> </g> </svg> </div> <div class="section-content"> <div class="section-option"> <span class="section-option-title">Up</span> <button id="up" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Left</span> <button id="left" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Down</span> <button id="down" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Right</span> <button id="right" class="section-option-hotkeyInput"></button> </div> <div class="split"></div> <div class="section-option"> <span class="section-option-title">Auto attack</span> <button id="autoattack" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Lock rotation</span> <button id="lockRotation" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Open chat</span> <button id="openChat" class="section-option-hotkeyInput"></button> </div> <div class="section-option"> <span class="section-option-title">Upgrade scythe</span> <button id="upgradeScythe" class="section-option-hotkeyInput"></button> </div> </div> </div> </div>';
  876. const Keybinds = Keybinds_code;
  877. var Combat_code = '<div class="menu-page"> <h1>Combat</h1> <p>Modify combat settings, change pvp behavior</p> <div class="section opened"> <div class="section-title"> <h2>Placement</h2> </div> <div class="section-content one-row"> <div class="section-option"> <span class="section-option-title"> Placement speed <span class="tooltip"> * <span class="tooltip-text">The higher value, the faster you place</span> </span> </span> <label class="slider"> <input id="placementSpeed" min="1" max="100" type="range"> <span class="slider-value">100</span> </label> </div> <div class="section-option"> <span class="section-option-title">Placement type</span> <select id="placementType"></select> </div> </div> </div> <div class="section opened"> <div class="section-title"> <h2>Healing</h2> </div> <div class="section-content"> <div class="split-section"> <div class="section-option"> <span class="section-option-title">Autoheal</span> <label class="switch-checkbox"> <input id="autoheal" type="checkbox"> <span></span> </label> </div> </div> </div> </div> <div class="section opened"> <div class="section-title"> <h2>Hats</h2> </div> <div class="section-content"> <div class="split-section"> <div class="section-option"> <span class="section-option-title">Jungle On Clown</span> <label class="switch-checkbox"> <input id="jungleOnClown" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title"> Equip last hat <span class="tooltip"> * <span class="tooltip-text">On spawn, the last hat you had will be equipped</span> </span> </span> <label class="switch-checkbox"> <input id="lastHat" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Auto scuba</span> <label class="switch-checkbox"> <input id="autoScuba" type="checkbox"> <span></span> </label> </div> </div> </div> </div> <div class="section opened"> <div class="section-title"> <h2>Autoaim</h2> </div> <div class="section-content"> <div class="split-section"> <div class="section-option"> <span class="section-option-title">Melee</span> <label class="switch-checkbox"> <input id="meleeAim" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Bow</span> <label class="switch-checkbox"> <input id="bowAim" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Spike insta</span> <label class="switch-checkbox"> <input id="spikeInstaAim" type="checkbox"> <span></span> </label> </div> </div> </div> </div> </div>';
  878. const Combat = Combat_code;
  879. var Visuals_code = '<div class="menu-page"> <h1>Visuals</h1> <p>Customize your visuals, or you can disable it for performance</p> <div class="section opened"> <div class="section-title"> <h2>Tracers</h2> </div> <div class="section-content"> <div class="section-option"> <span class="section-option-title">Enemies</span> <div class="content"> <button class="default-color" title="Reset Color"></button> <input id="enemyColor" type="color"> <label class="switch-checkbox"> <input id="enemyTracers" type="checkbox"> <span></span> </label> </div> </div> <div class="section-option"> <span class="section-option-title">Arrows</span> <label class="switch-checkbox"> <input id="arrows" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Teammates</span> <div class="content"> <button class="default-color" title="Reset Color"></button> <input id="teammateColor" type="color"> <label class="switch-checkbox"> <input id="teammateTracers" type="checkbox"> <span></span> </label> </div> </div> <div class="section-option"> <span class="section-option-title">Rainbow colors</span> <label class="switch-checkbox"> <input id="rainbow" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Animals</span> <div class="content"> <button class="default-color" title="Reset Color"></button> <input id="animalColor" type="color"> <label class="switch-checkbox"> <input id="animalTracers" type="checkbox"> <span></span> </label> </div> </div> </div> </div> <div class="section opened"> <div class="section-title"> <h2>Player</h2> </div> <div class="section-content"> <div class="section-option"> <span class="section-option-title">Show invisible players</span> <label class="switch-checkbox"> <input id="showHoods" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Draw HP value</span> <label class="switch-checkbox"> <input id="drawHP" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Item counter</span> <label class="switch-checkbox"> <input id="itemCounter" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Draw ID</span> <label class="switch-checkbox"> <input id="drawID" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title"> Visual aim <span class="tooltip"> * <span class="tooltip-text">It will show where are you aiming</span> </span> </span> <label class="switch-checkbox"> <input id="visualAim" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title"> Hide nicknames <span class="tooltip"> * <span class="tooltip-text">It will not render the badge, clan name and nickname of the user</span> </span> </span> <label class="switch-checkbox"> <input id="hideNicknames" type="checkbox"> <span></span> </label> </div> </div> </div> <div class="section opened"> <div class="section-title"> <h2>Markers</h2> </div> <div class="section-content"> <div class="section-option"> <span class="section-option-title">Your markers</span> <div class="content"> <button class="default-color" title="Reset Color"></button> <input id="itemMarkersColor" type="color"> <label class="switch-checkbox"> <input id="itemMarkers" type="checkbox"> <span></span> </label> </div> </div> <div class="section-option"> <span class="section-option-title">Teammates</span> <div class="content"> <button class="default-color" title="Reset Color"></button> <input id="teammateMarkersColor" type="color"> <label class="switch-checkbox"> <input id="teammateMarkers" type="checkbox"> <span></span> </label> </div> </div> <div class="section-option"> <span class="section-option-title">Enemies</span> <div class="content"> <button class="default-color" title="Reset Color"></button> <input id="enemyMarkersColor" type="color"> <label class="switch-checkbox"> <input id="enemyMarkers" type="checkbox"> <span></span> </label> </div> </div> <div class="section-option"> <span class="section-option-title"> Trap activated <span class="tooltip"> * <span class="tooltip-text">When the player or animal will be trapped, marker will change color</span> </span> </span> <div class="content"> <button class="default-color" title="Reset Color"></button> <input id="trapActivatedColor" type="color"> <label class="switch-checkbox"> <input id="trapActivated" type="checkbox"> <span></span> </label> </div> </div> <div class="section-option"> <span class="section-option-title"> Markers at bottom <span class="tooltip"> * <span class="tooltip-text">Faster, but you won\'t be able to see markers if you\'re trapped or on platform</span> </span> </span> <label class="switch-checkbox"> <input id="markersBottom" type="checkbox"> <span></span> </label> </div> </div> </div> <div class="section opened"> <div class="section-title"> <h2>Reload bars</h2> </div> <div class="section-content"> <div class="section-option"> <span class="section-option-title">Hat reload bar</span> <div class="content"> <button class="default-color" title="Reset Color"></button> <input id="hatReloadBarColor" type="color"> <label class="switch-checkbox"> <input id="hatReloadBar" type="checkbox"> <span></span> </label> </div> </div> <div class="section-option"> <span class="section-option-title">Fireball reload bar</span> <div class="content"> <button class="default-color" title="Reset Color"></button> <input id="fireballReloadBarColor" type="color"> <label class="switch-checkbox"> <input id="fireballReloadBar" type="checkbox"> <span></span> </label> </div> </div> <div class="section-option"> <span class="section-option-title">Turret reload bar</span> <div class="content"> <button class="default-color" title="Reset Color"></button> <input id="turretReloadBarColor" type="color"> <label class="switch-checkbox"> <input id="turretReloadBar" type="checkbox"> <span></span> </label> </div> </div> </div> </div> <div class="section opened"> <div class="section-title"> <h2>Other</h2> </div> <div class="section-content"> <div class="section-option"> <span class="section-option-title">Windmill rotation</span> <label class="switch-checkbox"> <input id="windmillRotation" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title"> Possible shots <span class="tooltip"> * <span class="tooltip-text">Draws a crosshair on entities that can be hit by a projectile</span> </span> </span> <label class="switch-checkbox"> <input id="possibleShots" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Hide chat messages</span> <label class="switch-checkbox"> <input id="hideMessages" type="checkbox"> <span></span> </label> </div> </div> </div> </div>';
  880. const Visuals = Visuals_code;
  881. var Misc_code = '<div class="menu-page"> <h1>Misc</h1> <p>Customize misc settings, add autochat messages, reset settings</p> <div class="section opened"> <div class="section-title"> <h2>Chat</h2> </div> <div class="section-content one-row"> <div class="section-option"> <span class="section-option-title">Autochat</span> <div class="content"> <input class="input autochat" type="text" maxlength="35"> <input class="input autochat" type="text" maxlength="35"> <input class="input autochat" type="text" maxlength="35"> <input class="input autochat" type="text" maxlength="35"> <label class="switch-checkbox"> <input id="autochat" type="checkbox"> <span></span> </label> </div> </div> <div class="section-option"> <span class="section-option-title"> Message on kill <span class="tooltip"> * <span class="tooltip-text left"> <div>Variables:</div> <div><span class="highlight">{KILL}</span> - amount of kills</div> <div><span class="highlight">{NAME}</span> - name of the player you killed</div> </span> </span> </span> <div class="content"> <input id="killMessage" class="input" type="text" maxlength="35"> <label class="switch-checkbox"> <input id="kill" type="checkbox"> <span></span> </label> </div> </div> </div> </div> <div class="section opened"> <div class="section-title"> <h2>Other</h2> </div> <div class="section-content one-row"> <div class="section-option"> <span class="section-option-title">Autospawn</span> <label class="switch-checkbox"> <input id="autospawn" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title"> Smooth zoom <span class="tooltip"> * <span class="tooltip-text">Disable for performance</span> </span> </span> <label class="switch-checkbox"> <input id="smoothZoom" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title"> Skip upgrades <span class="tooltip"> * <span class="tooltip-text">When you have only 1 item in the upgradebar, it will automatically select it</span> </span> </span> <label class="switch-checkbox"> <input id="skipUpgrades" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title"> Invis hit toggle <span class="tooltip"> * <span class="tooltip-text">If enabled, invisible hit hotkey will work in toggle mode. Useful when you don\'t want to hold this button permanently</span> </span> </span> <label class="switch-checkbox"> <input id="invisHitToggle" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Reverse zoom</span> <label class="switch-checkbox"> <input id="reverseZoom" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title"> Autoscythe <span class="tooltip"> * <span class="tooltip-text">To make autoscythe work, you must have at least diamond weapon. If you want to get "secret weapon", use keybind.</span> </span> </span> <label class="switch-checkbox"> <input id="autoScythe" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Auto accept</span> <label class="switch-checkbox"> <input id="autoAccept" type="checkbox"> <span></span> </label> </div> </div> </div> <div class="section opened"> <div class="section-title"> <h2>Menu</h2> </div> <div class="section-content one-row"> <div class="section-option"> <span class="section-option-title">Menu transparency</span> <label class="switch-checkbox"> <input id="menuTransparency" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <div class="content-double"> <button id="reset-settings" class="button red">Reset settings</button> <button id="download-settings" class="button">Download settings</button> <div class="form-upload"> <input id="upload-settings" type="file" accept=".txt"> <span class="light">DRAG SETTINGS FILE HERE OR <span class="light-extra">BROWSE</span></span> </div> </div> </div> </div> </div> </div>';
  882. const Misc = Misc_code;
  883. var Credits_code = '<div class="menu-page"> <h1>Credits</h1> <P>Some details about the script and links to my socials</P> <div class="section opened"> <div class="section-content" style="max-height:100%"> <div class="split-section"> <div class="section-option text"> <span class="section-option-title">Author</span> <span class="text-value">Murka</span> </div> <div class="section-option text"> <svg class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"> <path d="M512 12.672c-282.88 0-512 229.248-512 512 0 226.261 146.688 418.133 350.080 485.76 25.6 4.821 34.987-11.008 34.987-24.619 0-12.16-0.427-44.373-0.64-87.040-142.421 30.891-172.459-68.693-172.459-68.693-23.296-59.093-56.96-74.88-56.96-74.88-46.379-31.744 3.584-31.104 3.584-31.104 51.413 3.584 78.421 52.736 78.421 52.736 45.653 78.293 119.851 55.68 149.12 42.581 4.608-33.109 17.792-55.68 32.427-68.48-113.707-12.8-233.216-56.832-233.216-253.013 0-55.893 19.84-101.547 52.693-137.387-5.76-12.928-23.040-64.981 4.48-135.509 0 0 42.88-13.739 140.8 52.48 40.96-11.392 84.48-17.024 128-17.28 43.52 0.256 87.040 5.888 128 17.28 97.28-66.219 140.16-52.48 140.16-52.48 27.52 70.528 10.24 122.581 5.12 135.509 32.64 35.84 52.48 81.493 52.48 137.387 0 196.693-119.68 240-233.6 252.587 17.92 15.36 34.56 46.763 34.56 94.72 0 68.523-0.64 123.563-0.64 140.203 0 13.44 8.96 29.44 35.2 24.32 204.843-67.157 351.403-259.157 351.403-485.077 0-282.752-229.248-512-512-512z"></path> </svg> <a href="https://github.com/Murka007/Dsync-client" class="text-value" target="_blank" title="Give a star please :)">Dsync client</a> </div> <div class="section-option text"> <svg class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"> <path d="M26.963 0c1.875 0 3.387 1.516 3.476 3.3v28.7l-3.569-3.031-1.96-1.784-2.139-1.864 0.893 2.94h-18.717c-1.869 0-3.387-1.42-3.387-3.301v-21.653c0-1.784 1.52-3.303 3.393-3.303h22zM18.805 7.577h-0.040l-0.269 0.267c2.764 0.8 4.101 2.049 4.101 2.049-1.781-0.891-3.387-1.336-4.992-1.516-1.16-0.18-2.32-0.085-3.3 0h-0.267c-0.627 0-1.96 0.267-3.747 0.98-0.623 0.271-0.98 0.448-0.98 0.448s1.336-1.336 4.28-2.049l-0.18-0.18c0 0-2.229-0.085-4.636 1.693 0 0-2.407 4.192-2.407 9.36 0 0 1.333 2.32 4.991 2.408 0 0 0.533-0.711 1.073-1.336-2.053-0.624-2.853-1.872-2.853-1.872s0.179 0.088 0.447 0.267h0.080c0.040 0 0.059 0.020 0.080 0.040v0.008c0.021 0.021 0.040 0.040 0.080 0.040 0.44 0.181 0.88 0.36 1.24 0.533 0.621 0.269 1.42 0.537 2.4 0.715 1.24 0.18 2.661 0.267 4.28 0 0.8-0.18 1.6-0.356 2.4-0.713 0.52-0.267 1.16-0.533 1.863-0.983 0 0-0.8 1.248-2.94 1.872 0.44 0.621 1.060 1.333 1.060 1.333 3.659-0.080 5.080-2.4 5.16-2.301 0-5.16-2.42-9.36-2.42-9.36-2.18-1.619-4.22-1.68-4.58-1.68zM19.029 13.461c0.937 0 1.693 0.8 1.693 1.78 0 0.987-0.76 1.787-1.693 1.787s-1.693-0.8-1.693-1.779c0.003-0.987 0.764-1.784 1.693-1.788zM12.972 13.461c0.933 0 1.688 0.8 1.688 1.78 0 0.987-0.76 1.787-1.693 1.787s-1.693-0.8-1.693-1.779c0-0.987 0.76-1.784 1.699-1.788z"></path> </svg> <a href="https://discord.gg/sG9cyfGPj5" class="text-value" target="_blank" title="Join my discord server">Coding paradise</a> </div> <div class="section-option text"> <svg class="icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 96 96"> <circle fill="#36363d" stroke="#6a6a81" stroke-width="2" r="48" cy="48" cx="48"/> <clipPath id="GreasyForkCircleClip" clipPathUnits="userSpaceOnUse"> <circle fill="#000" r="47" cy="48" cx="48"/> </clipPath> <text fill="#9494b8" clip-path="url(#GreasyForkCircleClip)" text-anchor="middle" font-size="18" font-family="\'DejaVu Sans\', Verdana, Arial, \'Liberation Sans\', sans-serif" letter-spacing="-0.75" pointer-events="none" style="-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none"> <tspan x="51" y="13" textLength="57">= null;</tspan> <tspan x="56" y="35" textLength="98">function init</tspan> <tspan x="49" y="57" textLength="113">for (var i = 0;</tspan> <tspan x="50" y="79" textLength="105">XmlHttpReq</tspan> <tspan x="48" y="101" textLength="80">appendCh</tspan> </text> <path fill="#36363d" stroke="#36363d" stroke-width="4" d="M 44,29\r\n a6.36396,6.36396 0,0,1 0,9\r\n l36,36\r\n a3.25,3.25 0,0,1 -6.5,6.5\r\n l-36,-36\r\n a6.36396,6.36396 0,0,1 -9,0\r\n l-19,-19\r\n a1.76777,1.76777 0,0,1 0,-2.5\r\n l13.0,-13\r\n a1.76777,1.76777 0,0,1 2.5,0\r\n z"/> <path fill="#9494b8" d="M 44,29\r\n a6.36396,6.36396 0,0,1 0,9\r\n l36,36\r\n a3.25,3.25 0,0,1 -6.5,6.5\r\n l-36,-36\r\n a6.36396,6.36396 0,0,1 -9,0\r\n l-19,-19\r\n a1.76777,1.76777 0,0,1 2.5,-2.5\r\n l14,14 4,-4 -14,-14\r\n a1.76777,1.76777 0,0,1 2.5,-2.5\r\n l14,14 4,-4 -14,-14\r\n a1.76777,1.76777 0,0,1 2.5,-2.5\r\n z"/> </svg> <a href="https://greasyfork.org/en/users/919633" class="text-value" target="_blank" title="Please support this script on greasyfork">Dsync client</a> </div> </div> </div> </div> </div>';
  884. const Credits = Credits_code;
  885. const styles = '@import"https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&display=swap";header{background:#2f2f31;color:#76689a;padding:5px 10px;display:flex;justify-content:flex-start;align-items:center}header #version{align-self:flex-end;color:#9787bd;font-size:.5em;font-weight:600;margin-left:10px}header #version svg{fill:#9787bd}header .icon{margin-left:auto;width:35px;height:35px;fill:#cebcb4;transition:fill 100ms;cursor:pointer}header .icon:hover{fill:#ffe7dc}#navbar-container{display:flex;flex-direction:column;padding:10px;margin-right:10px;background:#2f2f31}#navbar-container .open-menu{outline:none;border:none;cursor:pointer;font-weight:900;font-size:1.4rem;padding:10px;background:#313135;color:#ffe7dc;border-right:1px solid;border-right-color:rgba(0,0,0,0);transition:background 100ms,color 100ms,border-right-color 100ms}#navbar-container .open-menu:hover{background:#313135}#navbar-container .open-menu:active{background:#ffe7dc;color:#313135}#navbar-container .open-menu.active{pointer-events:none;background:#313135;border-right-color:#ffe7dc}#navbar-container .bottom-align{margin-bottom:0px;margin-top:auto !important}@-webkit-keyframes appear{from{opacity:0}to{opacity:1}}@-webkit-keyframes disappear{from{opacity:1}to{opacity:0}}@-webkit-keyframes failedTransition{0%{transform:translate(0px, 0px)}10%{transform:translate(-35px, -10px)}30%{transform:translate(25px, 8px)}50%{transform:translate(-15px, -6px)}70%{transform:translate(5px, 4px)}100%{transform:translate(0px, 0px)}}@keyframes appear{from{opacity:0}to{opacity:1}}@keyframes disappear{from{opacity:1}to{opacity:0}}@keyframes failedTransition{0%{transform:translate(0px, 0px)}10%{transform:translate(-35px, -10px)}30%{transform:translate(25px, 8px)}50%{transform:translate(-15px, -6px)}70%{transform:translate(5px, 4px)}100%{transform:translate(0px, 0px)}}.menu-page{display:none;background:#2f2f31;padding:10px;padding-top:0px}.menu-page.opened{display:block;animation:appear 300ms forwards}.menu-page h1{color:#76689a;font-size:1.5em;font-weight:900}.menu-page h2{color:#9494b8;font-size:1em;font-weight:900}.menu-page p{color:#675a86;font-size:.5em;font-weight:700}.menu-page .content{display:flex;justify-content:space-between;align-items:center;gap:10px}.menu-page .content-double{display:flex;flex-wrap:wrap;justify-content:space-between;gap:10px;width:250px}.menu-page .content-double button{width:48%}.menu-page .content-double:nth-child(3){width:100%}.menu-page #killMessage{width:270px}.menu-page .highlight{font-weight:700;color:#ffe7dc;background:#6a6a81;padding:0 1px}.menu-page .section{background:#36363d;border-radius:5px;margin:20px 0}.menu-page .section:last-child{margin-bottom:0px}.menu-page .section .section-title{display:flex;justify-content:space-between;align-items:center;padding:10px}.menu-page .section .section-title .icon{width:25px;height:25px;margin-right:10px;fill:#cebcb4;transition:fill 100ms,transform 100ms}.menu-page .section .section-title .icon.rotate{transform:rotate(90deg);fill:#ffe7dc}.menu-page .section .section-title:hover .icon{fill:#ffe7dc}.menu-page .section:not(.opened) .section-title{cursor:pointer}.menu-page .section:not(.opened) .section-content{overflow:hidden}.menu-page .section .section-content{padding:10px;padding-top:0px;display:grid;grid-template-columns:1fr 1fr;transition:max-height 250ms cubic-bezier(0, 1, 0, 1);max-height:0px}.menu-page .section .section-content.one-row{grid-template-columns:1fr}.menu-page .section .section-content.opened{transition:max-height 250ms ease-out;max-height:100%}.menu-page .section .section-content .split{grid-column:1/3;margin-top:10px;background:#40404a;height:2px}.menu-page .section .section-content .section-option{display:flex;justify-content:space-between;align-items:center;margin-top:10px}.menu-page .section .section-content .section-option .icon{width:35px;height:35px;fill:#6a6a81}.menu-page .section .section-content .section-option.centered{justify-content:center}.menu-page .section .section-content .section-option.text{justify-content:flex-start;gap:10px}.menu-page .section .section-content .section-option.text .text-value{font-size:.7em;color:#9494b8}.menu-page .section .section-content .section-option .section-option-title{color:#6a6a81;font-size:.8em}.menu-page .section .section-content .section-option .section-option-hotkeyInput{margin-right:50px;cursor:pointer;font-weight:900;font-size:.6em;padding-bottom:8px;outline:none;border:none;text-align:center;width:80px;height:35px;border-radius:7.5px;background:#7d7d9b;color:#adbcd8;box-shadow:0px -6px 0px 0px #68687c inset}.menu-page .section .section-content .section-option .section-option-hotkeyInput.red{background:#9e5454;color:#d8adad;box-shadow:0px -6px 0px 0px #783d3d inset}.menu-page .section .section-content .section-option .section-option-hotkeyInput:not([id]){cursor:not-allowed}.menu-page .section .section-content .section-option .section-option-hotkeyInput.smaller{font-size:.41em}.menu-page .section .section-content .section-option .switch-checkbox{position:relative;margin-right:25px;width:70px;height:25px}.menu-page .section .section-content .section-option .switch-checkbox input{width:0;height:0;opacity:0}.menu-page .section .section-content .section-option .switch-checkbox input:checked+span{background:#7d7d9b;box-shadow:0px 5px 0px 0px #68687c inset}.menu-page .section .section-content .section-option .switch-checkbox input:checked+span:before{background:#ffe7dc;transform:translateX(42px)}.menu-page .section .section-content .section-option .switch-checkbox span{position:absolute;cursor:pointer;top:0;left:0;bottom:0;right:0;width:100%;height:100%;display:flex;align-items:center;background:#5f5f79;box-shadow:0px 5px 0px 0px #4d4d5f inset;border-radius:10px;transition:all 100ms ease-in-out}.menu-page .section .section-content .section-option .switch-checkbox span:before{position:absolute;content:"";width:28px;height:28px;border-radius:50%;background:#f0dcd3;box-shadow:0px -5px 0px 0px #cebcb4 inset;border:2px solid #adbcd8;transition:all 100ms ease-in-out}.menu-page .section .section-content .section-option .slider{position:relative;margin-right:45px}.menu-page .section .section-content .section-option .slider input{-webkit-appearance:none;outline:none;cursor:pointer;width:154px;height:20.8333333333px;border-radius:10px;background:#7d7d9b;box-shadow:0px 5px 0px 0px #68687c inset}.menu-page .section .section-content .section-option .slider input::-webkit-slider-thumb{-webkit-appearance:none;width:28px;height:28px;border-radius:50%;background:#ffe7dc;box-shadow:0px -5px 0px 0px #cebcb4 inset;border:2px solid #adbcd8}.menu-page .section .section-content .section-option .slider .slider-value{position:absolute;margin-left:5px;color:#6a6a81;font-size:.65em}.menu-page .section .section-content .section-option .input{outline:none;border:none;font-weight:900;text-align:center;width:130px;height:35px;padding-bottom:6px;border-radius:7.5px;background:#7d7d9b;color:#adbcd8;box-shadow:0px -6px 0px 0px #68687c inset}.menu-page .section .section-content .section-option .input:focus{border:3px solid #f0dcd3}.menu-page .section .section-content .section-option .button{outline:none;border:none;font-weight:900;cursor:pointer;height:40px;padding-bottom:6px;border-radius:7.5px;background:#7d7d9b;color:#adbcd8;box-shadow:0px -6px 0px 0px #68687c inset}.menu-page .section .section-content .section-option .button:active{padding-bottom:0px;padding-top:3px;box-shadow:0px 3px 0px 0px #68687c inset}.menu-page .section .section-content .section-option .button.red{background:#9e5454;color:#d8adad;box-shadow:0px -6px 0px 0px #783d3d inset}.menu-page .section .section-content .section-option .button.red:active{box-shadow:0px 3px 0px 0px #783d3d inset}.menu-page .section .section-content .section-option .button.width{width:9em;font-size:.6em}.menu-page .section .section-content .section-option .form-upload{position:relative;font-size:.55em;font-weight:400;letter-spacing:1.5px;text-align:center;width:100%;border-radius:5px;border:2px dashed;border-color:rgba(173,188,216,.5411764706);padding:15px 10px;transition:border-color 100ms}.menu-page .section .section-content .section-option .form-upload:hover{border-color:#adbcd8}.menu-page .section .section-content .section-option .form-upload.red{border-color:#9e5454;animation:failedTransition 400ms}.menu-page .section .section-content .section-option .form-upload.red .light{color:#d8adad}.menu-page .section .section-content .section-option .form-upload.green{border-color:#77c468}.menu-page .section .section-content .section-option .form-upload.green .light{color:#a1dda1}.menu-page .section .section-content .section-option .form-upload input{position:absolute;opacity:0;top:0;left:0;bottom:0;right:0;width:100%;height:100%;cursor:pointer}.menu-page .section .section-content .section-option .form-upload .light{color:#adbcd8}.menu-page .section .section-content .section-option .form-upload .light-extra{color:#f0dcd3}.menu-page .section .section-content .section-option .tooltip{position:relative;margin-left:5px;color:#8181a0}.menu-page .section .section-content .section-option .tooltip:hover{cursor:pointer}.menu-page .section .section-content .section-option .tooltip:hover .tooltip-text{visibility:visible}.menu-page .section .section-content .section-option .tooltip .tooltip-text{position:absolute;visibility:hidden;text-align:center;overflow:visible;bottom:calc(100% - 5px);left:50%;transform:translateX(-50%);background-color:#7d7d9b;color:#ffe7dc;width:225px;font-size:13px;font-weight:600;padding:5px;border-radius:5px;border:3px solid #5f5f79}.menu-page .section .section-content .section-option .tooltip .tooltip-text.left{text-align:left}.menu-page .section .section-content .section-option select[id]{outline:none;border:none;font-weight:900;width:195px;font-size:.6em;border-radius:7.5px;padding:2.5px;background:#7d7d9b;color:#adbcd8;box-shadow:0px 4px 0px 0px #68687c inset}@-webkit-keyframes appear{from{opacity:0}to{opacity:1}}@-webkit-keyframes disappear{from{opacity:1}to{opacity:0}}@-webkit-keyframes failedTransition{0%{transform:translate(0px, 0px)}10%{transform:translate(-35px, -10px)}30%{transform:translate(25px, 8px)}50%{transform:translate(-15px, -6px)}70%{transform:translate(5px, 4px)}100%{transform:translate(0px, 0px)}}@keyframes appear{from{opacity:0}to{opacity:1}}@keyframes disappear{from{opacity:1}to{opacity:0}}@keyframes failedTransition{0%{transform:translate(0px, 0px)}10%{transform:translate(-35px, -10px)}30%{transform:translate(25px, 8px)}50%{transform:translate(-15px, -6px)}70%{transform:translate(5px, 4px)}100%{transform:translate(0px, 0px)}}@-webkit-keyframes appear{from{opacity:0}to{opacity:1}}@-webkit-keyframes disappear{from{opacity:1}to{opacity:0}}@-webkit-keyframes failedTransition{0%{transform:translate(0px, 0px)}10%{transform:translate(-35px, -10px)}30%{transform:translate(25px, 8px)}50%{transform:translate(-15px, -6px)}70%{transform:translate(5px, 4px)}100%{transform:translate(0px, 0px)}}@keyframes appear{from{opacity:0}to{opacity:1}}@keyframes disappear{from{opacity:1}to{opacity:0}}@keyframes failedTransition{0%{transform:translate(0px, 0px)}10%{transform:translate(-35px, -10px)}30%{transform:translate(25px, 8px)}50%{transform:translate(-15px, -6px)}70%{transform:translate(5px, 4px)}100%{transform:translate(0px, 0px)}}html,body{margin:0;padding:0;background:rgba(0,0,0,0) !important;scrollbar-width:10px;scrollbar-track-color:#36363d;scrollbar-face-color:#494955}*{font-family:"Lato",sans-serif}h1,h2,h3,h4,p{margin:0}#menu-container{font-weight:900;font-size:2rem;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:1024px;height:700px;display:flex;justify-content:center;align-items:center;user-select:none}#menu-container.open{animation:appear 100ms forwards}#menu-container.close{animation:disappear 100ms forwards}#menu-container.transparent #menu-wrapper{background:rgba(43,43,44,.4666666667)}#menu-container.transparent #navbar-container{background:rgba(47,47,49,.6431372549)}#menu-container.transparent .menu-page{background:rgba(47,47,49,.6431372549)}#menu-container.transparent .section{background:rgba(54,54,61,.6509803922)}#menu-wrapper{display:flex;flex-direction:column;width:100%;height:80%;background:#2b2b2c;border-radius:5px;padding:10px}main{display:flex;justify-content:space-between;margin-top:10px;height:100%}main #menu-page-container{width:100%;height:500px;overflow-y:scroll}.default-color{outline:none;border:none;width:10px;height:10px;border-radius:100%;cursor:pointer}input[id][type=color]{outline:none;border:none;padding:0 1px;margin:0;height:24px;background-color:#7d7d9b;border-radius:5px;cursor:pointer}::-webkit-scrollbar{width:10px}::-webkit-scrollbar-track{background:#36363d;border-radius:10px}::-webkit-scrollbar-thumb{background:#494955;border-radius:10px}';
  886. const createMenu = () => {
  887. const IFRAME_CONTENT = `\n <style>${styles}</style>\n <div id="menu-container" class="open">\n <div id="menu-wrapper">\n ${Header}\n\n <main>\n ${Navbar}\n\n <div id="menu-page-container">\n ${Keybinds}\n ${Combat}\n ${Visuals}\n ${Misc}\n ${Credits}\n </div>\n </main>\n </div>\n </div>\n `;
  888. const IFRAME_STYLE = `\n #iframe-page-container {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n z-index: 99;\n border: none;\n outline: none;\n overflow: scroll;\n display: none;\n }\n\n .iframe-opened {\n display: block!important;\n }\n `;
  889. const IFRAME = document.createElement("iframe");
  890. const blob = new Blob([ IFRAME_CONTENT ], {
  891. type: "text/html; charset=utf-8"
  892. });
  893. IFRAME.src = URL.createObjectURL(blob);
  894. IFRAME.id = "iframe-page-container";
  895. document.body.appendChild(IFRAME);
  896. const style = document.createElement("style");
  897. style.innerHTML = IFRAME_STYLE;
  898. document.head.appendChild(style);
  899. IFRAME.onload = () => {
  900. const iframeWindow = IFRAME.contentWindow;
  901. const iframeDocument = iframeWindow.document;
  902. URL.revokeObjectURL(IFRAME.src);
  903. const menuContainer = iframeDocument.getElementById("menu-container");
  904. const openMenu = iframeDocument.querySelectorAll(".open-menu");
  905. const menuPage = iframeDocument.querySelectorAll(".menu-page");
  906. const sections = iframeDocument.querySelectorAll(".section");
  907. const hotkeyInputs = iframeDocument.querySelectorAll(".section-option-hotkeyInput[id]");
  908. const closeMenu = iframeDocument.querySelector("#close-menu");
  909. const checkboxs = iframeDocument.querySelectorAll("input[type='checkbox'][id]");
  910. const sliders = iframeDocument.querySelectorAll("input[type='range'][id]");
  911. const headerVersion = iframeDocument.querySelector("#version > span");
  912. const autochatInputs = iframeDocument.querySelectorAll(".input.autochat");
  913. const killMessage = iframeDocument.querySelector("#killMessage");
  914. const resetSettings = iframeDocument.querySelector("#reset-settings");
  915. const downloadSettings = iframeDocument.querySelector("#download-settings");
  916. const uploadSettings = iframeDocument.querySelector("#upload-settings");
  917. const menuTransparency = iframeDocument.querySelector("#menuTransparency");
  918. const colorPickers = iframeDocument.querySelectorAll("input[type='color'][id]");
  919. const selects = iframeDocument.querySelectorAll("select[id]");
  920. const update = () => {
  921. for (const select of selects) {
  922. const data = selectData[select.id];
  923. for (const key in data) {
  924. if (!isNaN(Number(key))) continue;
  925. const option = document.createElement("option");
  926. option.value = data[key];
  927. option.textContent = capitalize(key);
  928. if (data[key] === Settings[select.id]) {
  929. option.selected = true;
  930. option.defaultSelected = true;
  931. }
  932. select.appendChild(option);
  933. }
  934. select.onchange = () => {
  935. Settings[select.id] = Number(select.value);
  936. storage.set("Dsync-settings", Settings);
  937. };
  938. }
  939. for (const picker of colorPickers) {
  940. const resetColor = picker.previousElementSibling;
  941. if (resetColor) {
  942. const defaultColor = defaultSettings[picker.id];
  943. resetColor.style.backgroundColor = defaultColor;
  944. resetColor.onclick = () => {
  945. picker.value = defaultColor;
  946. Settings[picker.id] = defaultColor;
  947. storage.set("Dsync-settings", Settings);
  948. };
  949. }
  950. picker.value = Settings[picker.id];
  951. picker.onchange = () => {
  952. Settings[picker.id] = picker.value;
  953. storage.set("Dsync-settings", Settings);
  954. picker.blur();
  955. };
  956. }
  957. menuContainer.classList[Settings.menuTransparency ? "add" : "remove"]("transparent");
  958. killMessage.value = Settings.killMessage;
  959. killMessage.onchange = () => {
  960. Settings.killMessage = killMessage.value;
  961. storage.set("Dsync-settings", Settings);
  962. killMessage.blur();
  963. };
  964. for (let i = 0; i < autochatInputs.length; i++) {
  965. const input = autochatInputs[i];
  966. input.value = Settings.autochatMessages[i] || "";
  967. input.onchange = () => {
  968. Settings.autochatMessages[i] = input.value;
  969. storage.set("Dsync-settings", Settings);
  970. input.blur();
  971. };
  972. }
  973. headerVersion.textContent = "v" + Dsync.version;
  974. for (const slider of sliders) {
  975. const sliderValue = slider.nextElementSibling;
  976. slider.value = Settings[slider.id];
  977. if (sliderValue) {
  978. sliderValue.textContent = slider.value;
  979. }
  980. slider.oninput = () => {
  981. const value = Number(slider.value) % 5;
  982. slider.value -= value;
  983. if (sliderValue) {
  984. sliderValue.textContent = slider.value;
  985. }
  986. Settings[slider.id] = Number(slider.value);
  987. storage.set("Dsync-settings", Settings);
  988. };
  989. }
  990. for (const checkbox of checkboxs) {
  991. checkbox.checked = Settings[checkbox.id];
  992. checkbox.onchange = () => {
  993. Settings[checkbox.id] = checkbox.checked;
  994. storage.set("Dsync-settings", Settings);
  995. checkbox.blur();
  996. };
  997. }
  998. Dsync.toggleMenu = () => {
  999. menuContainer.classList.toggle("close");
  1000. menuContainer.classList.toggle("open");
  1001. setTimeout((() => {
  1002. IFRAME.classList.toggle("iframe-opened");
  1003. }), 100);
  1004. };
  1005. closeMenu.onclick = Dsync.toggleMenu;
  1006. for (let i = 0; i < openMenu.length; i++) {
  1007. openMenu[i].onclick = () => {
  1008. removeClass(openMenu, "active");
  1009. openMenu[i].classList.add("active");
  1010. removeClass(menuPage, "opened");
  1011. menuPage[i].classList.add("opened");
  1012. };
  1013. }
  1014. for (const section of sections) {
  1015. const title = section.children[0];
  1016. const content = section.children[1];
  1017. if (!title || !content) continue;
  1018. if (contains(section, "opened")) {
  1019. content.classList.add("opened");
  1020. continue;
  1021. }
  1022. content.style.display = "none";
  1023. title.onclick = () => {
  1024. if (!content.classList.contains("opened")) {
  1025. content.style.display = "grid";
  1026. } else {
  1027. setTimeout((() => {
  1028. content.style.display = "none";
  1029. }), 100);
  1030. }
  1031. setTimeout((() => {
  1032. content.classList.toggle("opened");
  1033. title.children[1].classList.toggle("rotate");
  1034. }), 0);
  1035. };
  1036. }
  1037. for (const hotkeyInput of hotkeyInputs) {
  1038. try {
  1039. hotkeyInput.textContent = formatCode(Settings[hotkeyInput.id]);
  1040. } catch (err) {
  1041. throw new Error(hotkeyInput.id + " doesn't exist in settings");
  1042. }
  1043. }
  1044. checkForRepeats();
  1045. };
  1046. menuTransparency.addEventListener("change", (() => {
  1047. menuContainer.classList[menuTransparency.checked ? "add" : "remove"]("transparent");
  1048. }));
  1049. resetSettings.onclick = () => {
  1050. Object.assign(Settings, defaultSettings);
  1051. storage.set("Dsync-settings", Settings);
  1052. update();
  1053. };
  1054. downloadSettings.onclick = () => {
  1055. download(Settings, "DsyncSettings" + Dsync.version);
  1056. };
  1057. uploadSettings.onchange = async event => {
  1058. const target = event.target;
  1059. const parent = uploadSettings.parentElement;
  1060. const spanText = parent.children[1];
  1061. parent.classList.remove("red");
  1062. parent.classList.remove("green");
  1063. try {
  1064. const text = await target.files[0].text();
  1065. const sets = JSON.parse(text);
  1066. if (Object.keys(sets).every((key => defaultSettings.hasOwnProperty(key)))) {
  1067. Object.assign(Settings, sets);
  1068. storage.set("Dsync-settings", Settings);
  1069. update();
  1070. parent.classList.add("green");
  1071. spanText.innerHTML = `SETTINGS LOADED SUCCESSFULLY`;
  1072. } else {
  1073. throw new Error("Invalid settings");
  1074. }
  1075. } catch (err) {
  1076. parent.classList.add("red");
  1077. spanText.innerHTML = "SETTINGS ARE NOT VALID, TRY ANOTHER";
  1078. }
  1079. };
  1080. const checkForRepeats = () => {
  1081. const list = new Map;
  1082. for (const hotkeyInput of hotkeyInputs) {
  1083. const value = Settings[hotkeyInput.id];
  1084. const [count, inputs] = list.get(value) || [ 0, [] ];
  1085. list.set(value, [ (count || 0) + 1, [ ...inputs, hotkeyInput ] ]);
  1086. hotkeyInput.classList.remove("red");
  1087. }
  1088. for (const data of list) {
  1089. const [number, hotkeyInputs] = data[1];
  1090. if (number === 1) continue;
  1091. for (const hotkeyInput of hotkeyInputs) {
  1092. hotkeyInput.classList.add("red");
  1093. }
  1094. }
  1095. };
  1096. Dsync.active = null;
  1097. const applyCode = code => {
  1098. if (!Dsync.active) return;
  1099. const key = code === "Backspace" ? "..." : formatCode(code);
  1100. Settings[Dsync.active.id] = code === "Backspace" ? "..." : code;
  1101. Dsync.active.textContent = key;
  1102. storage.set("Dsync-settings", Settings);
  1103. Dsync.active = null;
  1104. checkForRepeats();
  1105. };
  1106. menuContainer.addEventListener("keyup", (event => {
  1107. if (event.keyCode < 5 || !Dsync.active) return;
  1108. applyCode(event.code);
  1109. }));
  1110. menuContainer.addEventListener("mouseup", (event => {
  1111. const target = event.target;
  1112. if (Dsync.active) return applyCode(event.button);
  1113. if (!contains(target, "section-option-hotkeyInput") || !target.id) return;
  1114. target.textContent = "Wait...";
  1115. Dsync.active = target;
  1116. }));
  1117. iframeWindow.addEventListener("keydown", (event => handleKeydown(event, event.code)));
  1118. iframeWindow.addEventListener("keyup", (event => handleKeyup(event, event.code)));
  1119. const resize = () => {
  1120. const width = window.innerWidth;
  1121. const height = window.innerHeight;
  1122. const scale = Math.min(1, Math.min(width / 1024, height / 700));
  1123. menuContainer.style.transform = `translate(-50%, -50%) scale(${scale})`;
  1124. };
  1125. resize();
  1126. window.addEventListener("resize", resize);
  1127. setTimeout((() => IFRAME.classList.add("iframe-opened")), 0);
  1128. iframeWindow.addEventListener("contextmenu", (event => event.preventDefault()));
  1129. iframeWindow.addEventListener("mousedown", (event => 1 === event.button && event.preventDefault()));
  1130. iframeWindow.addEventListener("mouseup", (event => [ 3, 4 ].includes(event.button) && event.preventDefault()));
  1131. window.addEventListener("mouseup", (event => [ 3, 4 ].includes(event.button) && event.preventDefault()));
  1132. update();
  1133. };
  1134. };
  1135. const modules_createMenu = createMenu;
  1136. const ANY_LETTER = "(?:[^\\x00-\\x7F-]|\\$|\\w)";
  1137. const NumberSystem = [ {
  1138. radix: 2,
  1139. prefix: "0b0*"
  1140. }, {
  1141. radix: 8,
  1142. prefix: "0+"
  1143. }, {
  1144. radix: 10,
  1145. prefix: ""
  1146. }, {
  1147. radix: 16,
  1148. prefix: "0x0*"
  1149. } ];
  1150. var Template;
  1151. (function(Template) {
  1152. Template[Template["APPEND"] = 0] = "APPEND";
  1153. Template[Template["PREPEND"] = 1] = "PREPEND";
  1154. })(Template || (Template = {}));
  1155. class Regex {
  1156. constructor(code, unicode) {
  1157. this.code = code;
  1158. this.COPY_CODE = code;
  1159. this.unicode = unicode || false;
  1160. this.hooks = {};
  1161. }
  1162. static parseValue(value) {
  1163. try {
  1164. return Function(`return (${value})`)();
  1165. } catch (err) {
  1166. return null;
  1167. }
  1168. }
  1169. isRegexp(value) {
  1170. return TYPEOF(value) === "regexp";
  1171. }
  1172. generateNumberSystem(int) {
  1173. const copy = [ ...NumberSystem ];
  1174. const template = copy.map((({prefix, radix}) => prefix + int.toString(radix)));
  1175. return `(?:${template.join("|")})`;
  1176. }
  1177. parseVariables(regex) {
  1178. regex = regex.replace(/\{VAR\}/g, "(?:let|var|const)");
  1179. regex = regex.replace(/\{QUOTE\}/g, "['\"`]");
  1180. regex = regex.replace(/ARGS\{(\d+)\}/g, ((...args) => {
  1181. let count = Number(args[1]), arr = [];
  1182. while (count--) arr.push("\\w+");
  1183. return arr.join("\\s*,\\s*");
  1184. }));
  1185. regex = regex.replace(/NUMBER\{(\d+)\}/g, ((...args) => {
  1186. const int = Number(args[1]);
  1187. return this.generateNumberSystem(int);
  1188. }));
  1189. return regex;
  1190. }
  1191. format(name, inputRegex, flags) {
  1192. let regex = null;
  1193. if (Array.isArray(inputRegex)) {
  1194. regex = inputRegex.map((exp => this.isRegexp(exp) ? exp.source : exp)).join("\\s*");
  1195. } else if (this.isRegexp(inputRegex)) {
  1196. regex = inputRegex.source;
  1197. }
  1198. regex = this.parseVariables(regex);
  1199. if (this.unicode) {
  1200. regex = regex.replace(/\\w/g, ANY_LETTER);
  1201. }
  1202. const expression = new RegExp(regex.replace(/\{INSERT\}/, ""), flags);
  1203. const match = this.code.match(expression);
  1204. if (match === null) throw new Error("Failed to find: " + name);
  1205. return regex.includes("{INSERT}") ? new RegExp(regex, flags) : expression;
  1206. }
  1207. template(type, name, regex, substr) {
  1208. const expression = new RegExp(`(${this.format(name, regex).source})`);
  1209. const match = this.code.match(expression);
  1210. this.code = this.code.replace(expression, type === Template.APPEND ? "$1" + substr : substr + "$1");
  1211. return match;
  1212. }
  1213. match(name, regex, flags, debug = false) {
  1214. const expression = this.format(name, regex, flags);
  1215. const match = this.code.match(expression);
  1216. this.hooks[name] = {
  1217. expression,
  1218. match
  1219. };
  1220. if (debug) log(name, this.hooks[name]);
  1221. return match;
  1222. }
  1223. matchAll(name, regex, flags, debug = false) {
  1224. const expression = this.format(name, regex, flags);
  1225. const matches = this.code.matchAll(expression);
  1226. this.hooks[name] = {
  1227. expression,
  1228. match: [ ...matches ]
  1229. };
  1230. if (debug) log(name, this.hooks[name]);
  1231. return matches;
  1232. }
  1233. replace(name, regex, substr, flags) {
  1234. const expression = this.format(name, regex, flags);
  1235. this.code = this.code.replace(expression, substr);
  1236. }
  1237. append(name, regex, substr) {
  1238. return this.template(Template.APPEND, name, regex, substr);
  1239. }
  1240. prepend(name, regex, substr) {
  1241. return this.template(Template.PREPEND, name, regex, substr);
  1242. }
  1243. insert(name, regex, substr) {
  1244. const {source} = this.format(name, regex);
  1245. if (!source.includes("{INSERT}")) throw new Error("Your regexp must contain {INSERT} keyword");
  1246. const findExpression = new RegExp(source.replace(/^(.*)\{INSERT\}(.*)$/, "($1)($2)"));
  1247. this.code = this.code.replace(findExpression, `$1${substr}$2`);
  1248. }
  1249. }
  1250. const modules_Regex = Regex;
  1251. let kills = 0;
  1252. const stringMessage = data => {
  1253. const [id] = data;
  1254. if (id === WebsocketString.SPAWN && Settings.lastHat) {
  1255. equipHat(Dsync.actualHat, true);
  1256. }
  1257. if (id === WebsocketString.DIED) {
  1258. Controller_reset();
  1259. kills = 0;
  1260. if (Settings.autospawn) {
  1261. spawn();
  1262. }
  1263. }
  1264. if (id === WebsocketString.KILLUPDATE) {
  1265. kills = data[1][0];
  1266. }
  1267. if (Settings.kill && id === WebsocketString.KILLED) {
  1268. const killMessage = Settings.killMessage.length ? Settings.killMessage : "{KILL}x";
  1269. const name = data[1].replace(/^Killed\s/, "").trim();
  1270. const message = killMessage.replace(/\{KILL\}/g, kills + "").replace(/\{NAME\}/g, name);
  1271. Dsync.chat(message);
  1272. }
  1273. };
  1274. const hooks_stringMessage = stringMessage;
  1275. const createImage = src => {
  1276. const img = new Image;
  1277. img.src = src;
  1278. img.loaded = false;
  1279. img.onload = () => {
  1280. img.loaded = true;
  1281. };
  1282. return img;
  1283. };
  1284. const Images = {
  1285. gaugeBackground: createImage("https://i.imgur.com/xincrX4.png"),
  1286. gaugeFront: createImage("https://i.imgur.com/6AkHQM4.png")
  1287. };
  1288. const utils_Images = Images;
  1289. const getTracerColor = (entity, isTeammate) => {
  1290. if (entity.id === Dsync.myPlayerID() || isTeammate) return Settings.teammateColor;
  1291. if (entity.type === 0) return Settings.enemyColor;
  1292. return Settings.animalColor;
  1293. };
  1294. const trapActive = object => {
  1295. const trap = formatObject(object);
  1296. return getEntities().some((entity => distance(entity, trap).dist < trap.radius + entity.radius - 25));
  1297. };
  1298. const getMarkerColor = (target, ownerID) => {
  1299. let color = null;
  1300. const isMyPlayers = (Dsync.myPlayer || {}).ownerID === ownerID;
  1301. const isTeammates = teammates.includes(ownerID);
  1302. const isTeammateTrap = target.type === 6 && (isMyPlayers || isTeammates);
  1303. if (Settings.itemMarkers && isMyPlayers) {
  1304. color = Settings.itemMarkersColor;
  1305. } else if (Settings.teammateMarkers && isTeammates) {
  1306. color = Settings.teammateMarkersColor;
  1307. } else if (Settings.enemyMarkers && !isMyPlayers && !isTeammates) {
  1308. color = Settings.enemyMarkersColor;
  1309. }
  1310. if (Settings.trapActivated && isTeammateTrap) {
  1311. const id = target[Dsync.props.id];
  1312. if (!target.active && trapActive(target)) {
  1313. target.active = id;
  1314. }
  1315. if (target.active === id) return Settings.trapActivatedColor;
  1316. target.active = null;
  1317. }
  1318. return color;
  1319. };
  1320. const marker = (ctx, color) => {
  1321. ctx.strokeStyle = "#303030";
  1322. ctx.lineWidth = 3;
  1323. ctx.fillStyle = color;
  1324. ctx.beginPath();
  1325. ctx.arc(0, 0, 9, 0, 2 * Math.PI);
  1326. ctx.fill();
  1327. ctx.stroke();
  1328. ctx.closePath();
  1329. };
  1330. const arrow = (ctx, len, x, y, angle, color) => {
  1331. ctx.save();
  1332. ctx.translate(x, y);
  1333. ctx.rotate(Math.PI / 4);
  1334. ctx.rotate(angle);
  1335. ctx.globalAlpha = .75;
  1336. ctx.strokeStyle = color;
  1337. ctx.lineCap = "round";
  1338. ctx.lineWidth = 8;
  1339. ctx.beginPath();
  1340. ctx.moveTo(-len, -len);
  1341. ctx.lineTo(len, -len);
  1342. ctx.lineTo(len, len);
  1343. ctx.stroke();
  1344. ctx.closePath();
  1345. ctx.restore();
  1346. };
  1347. const lines = (ctx, x1, y1, x2, y2, color) => {
  1348. ctx.save();
  1349. ctx.globalAlpha = .75;
  1350. ctx.strokeStyle = color;
  1351. ctx.lineCap = "round";
  1352. ctx.lineWidth = 5;
  1353. ctx.beginPath();
  1354. ctx.moveTo(x1, y1);
  1355. ctx.lineTo(x2, y2);
  1356. ctx.stroke();
  1357. ctx.restore();
  1358. };
  1359. const TextOptions = {
  1360. font: "bold 15px Montserrat",
  1361. textBaseline: "top"
  1362. };
  1363. const renderText = (ctx, text, callback, options) => {
  1364. ctx.save();
  1365. ctx.fillStyle = "#fff";
  1366. ctx.strokeStyle = "#303030";
  1367. ctx.lineWidth = 8;
  1368. ctx.lineJoin = "round";
  1369. Object.assign(ctx, TextOptions, options);
  1370. const width = ctx.measureText(text).width;
  1371. const height = parseInt(ctx.font.match(/\d+/)[0]) || 1;
  1372. const data = callback(width, height);
  1373. ctx.strokeText(text, ...data);
  1374. ctx.fillText(text, ...data);
  1375. ctx.restore();
  1376. };
  1377. const drawHealth = (ctx, entity) => {
  1378. if (!Settings.drawHP) return;
  1379. const {x, y, health, maxHealth, radius} = entity;
  1380. const front = utils_Images.gaugeFront;
  1381. let h = 0;
  1382. if (Settings.hatReloadBar && entity.type === 0 || Settings.fireballReloadBar && entity.type === ELayer.DRAGON) {
  1383. h = front.height * .5;
  1384. }
  1385. renderText(ctx, `HP ${health}/${maxHealth}`, ((width, height) => [ x - width / 2, y + radius + h + 55 ]));
  1386. };
  1387. const drawImage = (ctx, image) => {
  1388. if (image && image.naturalHeight !== 0) {
  1389. ctx.drawImage(image, -.5 * image.width / 2, -.5 * image.height, image.width * .5, image.height * .5);
  1390. }
  1391. };
  1392. const drawBar = (ctx, entity, value, maxValue, color) => {
  1393. const {x, y, radius} = entity;
  1394. const background = utils_Images.gaugeBackground;
  1395. const front = utils_Images.gaugeFront;
  1396. const scale = .5;
  1397. const width = front.width * scale;
  1398. const fill = value / maxValue * (width - 10);
  1399. const h = entity.type === ELayer.TURRET ? 25 : 50;
  1400. ctx.save();
  1401. if (Settings.markersBottom && entity.type === ELayer.TURRET) {
  1402. ctx.rotate(Math.PI - entity.angle);
  1403. ctx.rotate(Math.PI);
  1404. }
  1405. ctx.translate(x, y + radius + h + front.height * scale);
  1406. drawImage(ctx, background);
  1407. ctx.fillStyle = color;
  1408. ctx.fillRect(-width / 2 + 5, -scale * front.height + 5, fill, scale * front.height - 10);
  1409. drawImage(ctx, front);
  1410. ctx.restore();
  1411. };
  1412. const drawTracers = (ctx, entity, isTeammate) => {
  1413. const player = formatPlayer(Dsync.target);
  1414. const {x: x1, y: y1} = player;
  1415. const {x: x2, y: y2} = entity;
  1416. const color = Settings.rainbow ? `hsl(${Dsync.hsl}, 100%, 50%)` : getTracerColor(entity, isTeammate);
  1417. if (Settings.arrows) {
  1418. const arrowWidth = 8;
  1419. const angle = getAngle(entity, player).lerpAngle;
  1420. const dist = Math.min(100 + arrowWidth * 2, distance(entity, player).lerpDist - arrowWidth * 2);
  1421. const x = x1 + dist * Math.cos(angle);
  1422. const y = y1 + dist * Math.sin(angle);
  1423. arrow(ctx, arrowWidth, x, y, angle, color);
  1424. } else {
  1425. lines(ctx, x1, y1, x2, y2, color);
  1426. }
  1427. };
  1428. const windmillRotation = target => {
  1429. if (target.type !== ELayer.WINDMILL && target.type !== ELayer.POWERMILL) return;
  1430. if (!target.rotSpeed) {
  1431. target.rotSpeed = target[Dsync.props.rotSpeed];
  1432. }
  1433. const rot = Settings.windmillRotation ? target.rotSpeed : 0;
  1434. if (target[Dsync.props.rotSpeed] !== rot) {
  1435. target[Dsync.props.rotSpeed] = rot;
  1436. }
  1437. };
  1438. const Rendering_images = {};
  1439. const crosshair = (ctx, x, y, angle, color, radius, width, height) => {
  1440. const canvas = Rendering_images[color] || function() {
  1441. const canvas = document.createElement("canvas");
  1442. canvas.width = 256;
  1443. canvas.height = 256;
  1444. const ctx = canvas.getContext("2d");
  1445. ctx.translate(canvas.width / 2, canvas.height / 2);
  1446. ctx.strokeStyle = color;
  1447. ctx.fillStyle = color;
  1448. ctx.lineWidth = width / 1.5;
  1449. ctx.beginPath();
  1450. ctx.arc(0, 0, radius, 0, 2 * Math.PI);
  1451. ctx.stroke();
  1452. ctx.closePath();
  1453. for (let i = 0; i < 4; i++) {
  1454. ctx.beginPath();
  1455. ctx.rect(-width / 2, radius - height / 2, width, height);
  1456. ctx.fill();
  1457. ctx.rotate(Math.PI / 2);
  1458. ctx.closePath();
  1459. }
  1460. Rendering_images[color] = canvas;
  1461. return canvas;
  1462. }();
  1463. ctx.save();
  1464. ctx.translate(x, y);
  1465. ctx.rotate(angle);
  1466. ctx.globalAlpha = .75;
  1467. ctx.drawImage(canvas, -canvas.width / 2, -canvas.height / 2);
  1468. ctx.restore();
  1469. };
  1470. const drawItemBar = (ctx, imageData, index) => {
  1471. if (!Settings.itemCounter) return;
  1472. const itemId = itemBar(index);
  1473. const itemType = Dsync.itemData[itemId][Dsync.props.itemType];
  1474. const currentCount = Dsync.defaultData[Dsync.props.currentCount][itemType];
  1475. const maxCount = Dsync.maxCount[itemType];
  1476. if (maxCount === 0) return;
  1477. const x = imageData[Dsync.props.x] - 10;
  1478. const y = imageData[Dsync.props.y] + 10;
  1479. const w = imageData.width;
  1480. renderText(ctx, `${currentCount}/${maxCount}`, ((width, height) => [ x + w - width, y ]), {
  1481. font: "bold 16px Montserrat"
  1482. });
  1483. };
  1484. const hooks_drawItemBar = drawItemBar;
  1485. const drawEntityInfo = (target, ctx, isTeammate) => {
  1486. const entity = formatEntity(target);
  1487. const id = Dsync.myPlayerID();
  1488. if (id === entity.id) {
  1489. if (Settings.rainbow) {
  1490. Dsync.hsl = (Dsync.hsl + .3) % 360;
  1491. }
  1492. if (Dsync.aimTarget) {
  1493. const aimTarget = formatEntity(Dsync.aimTarget);
  1494. Dsync.target[Dsync.props.angle] = Settings.visualAim ? getAngle(aimTarget, entity).lerpAngle : Dsync.getAngle();
  1495. }
  1496. }
  1497. drawHealth(ctx, entity);
  1498. if (target.oldId) {
  1499. if (Settings.hatReloadBar && entity.type === 0) {
  1500. drawBar(ctx, entity, target.hatReload, 1300, Settings.hatReloadBarColor);
  1501. }
  1502. if (Settings.fireballReloadBar && entity.type === ELayer.DRAGON) {
  1503. drawBar(ctx, entity, target.fireballReload, 3e3, Settings.fireballReloadBarColor);
  1504. }
  1505. }
  1506. if (Settings.drawID && entity.type === 0) {
  1507. const front = utils_Images.gaugeFront;
  1508. const w = front.width * .5;
  1509. const h = front.height * .5;
  1510. renderText(ctx, entity.id.toString(), (() => [ entity.x + w / 2 + 5, entity.y - h + (entity.radius + 50) + 5 ]), {
  1511. font: "bold 14px Montserrat",
  1512. textBaseline: "top"
  1513. });
  1514. }
  1515. if (id === entity.id || Dsync.myPlayer === null) return;
  1516. if (Settings.possibleShots && !isTeammate) {
  1517. const entityHit = projectileCanHitEntity(entity);
  1518. if (typeof entityHit === "object" && entityHit.canHit && !entityHit.needDestroy) {
  1519. const color = Settings.rainbow ? `hsl(${Dsync.hsl}, 100%, 50%)` : getTracerColor(entity, isTeammate);
  1520. crosshair(ctx, entity.x, entity.y, entity.angle, color, 20, 8, 18);
  1521. }
  1522. }
  1523. if (Settings.enemyTracers && entity.type === 0 && !isTeammate || Settings.teammateTracers && entity.type === 0 && isTeammate || Settings.animalTracers && entity.type !== 0) {
  1524. drawTracers(ctx, entity, isTeammate);
  1525. }
  1526. };
  1527. const hooks_drawEntityInfo = drawEntityInfo;
  1528. const zoomHandler = () => {
  1529. let canZoom = true;
  1530. let wheels = 0;
  1531. const scaleFactor = 150;
  1532. const zoomLoop = () => {
  1533. const {w, h, w2, h2} = Dsync.scale;
  1534. const wx = Math.abs(w[0] - w2);
  1535. const hy = Math.abs(h[0] - h2);
  1536. if (wx < 3 || hy < 3) {
  1537. canZoom = true;
  1538. return;
  1539. }
  1540. w[0] = lerp(w[0], w2, .175);
  1541. h[0] = lerp(h[0], h2, .175);
  1542. window.dispatchEvent(new Event("resize"));
  1543. setTimeout(zoomLoop, 0);
  1544. };
  1545. window.addEventListener("wheel", (event => {
  1546. if (!(event.target instanceof HTMLCanvasElement) || event.ctrlKey || event.shiftKey || event.altKey || isInput() || !inGame()) return;
  1547. const scale = Dsync.scale;
  1548. const {w, h, w2, h2} = scale;
  1549. if (w2 === 1824 && h2 === 1026 && (wheels = (wheels + 1) % 5) !== 0) return;
  1550. const zoom = !Settings.reverseZoom && event.deltaY > 0 || Settings.reverseZoom && event.deltaY < 0 ? -scaleFactor : scaleFactor;
  1551. scale.w2 = Math.max(924, w2 + zoom);
  1552. scale.h2 = Math.max(126, h2 + zoom);
  1553. if (Settings.smoothZoom) {
  1554. if (canZoom) {
  1555. canZoom = false;
  1556. zoomLoop();
  1557. }
  1558. return;
  1559. }
  1560. w[0] = scale.w2;
  1561. h[0] = scale.h2;
  1562. window.dispatchEvent(new Event("resize"));
  1563. }));
  1564. };
  1565. const modules_zoomHandler = zoomHandler;
  1566. const drawItems = (target, id, ctx, step) => {
  1567. const object = formatObject(target);
  1568. if (object.ownerID === 0) return;
  1569. if (Settings.turretReloadBar && object.type === ELayer.TURRET && target.turretReload !== undefined) {
  1570. drawBar(ctx, {
  1571. ...object,
  1572. x: 0,
  1573. y: 0
  1574. }, target.turretReload, 3e3, Settings.turretReloadBarColor);
  1575. }
  1576. windmillRotation(target);
  1577. const color = getMarkerColor(target, object.ownerID);
  1578. if (color === null) return;
  1579. marker(ctx, color);
  1580. };
  1581. const drawitems = drawItems;
  1582. let toggleClown = false;
  1583. let toggleScuba = false;
  1584. let updatePlayer_isHealing = false;
  1585. const getDelay = health => {
  1586. if (health < 74) return 60;
  1587. if (health < 36) return 45;
  1588. return 130;
  1589. };
  1590. const updatePlayer_healing = () => {
  1591. const {health, maxHealth, isClown} = Dsync.myPlayer;
  1592. if (Settings.autoheal && health < maxHealth && !isClown && inGame()) heal();
  1593. setTimeout(updatePlayer_healing, getDelay(health));
  1594. };
  1595. const updatePlayer = target => {
  1596. const entity = formatEntity(target);
  1597. const player = formatPlayer(target);
  1598. if (entity.type === 0) {
  1599. if (player.id === Dsync.myPlayerID()) {
  1600. Dsync.myPlayer = {
  1601. ...Dsync.myPlayer,
  1602. ...player
  1603. };
  1604. if (Settings.skipUpgrades) {
  1605. const upgradeBar = Dsync.defaultData[Dsync.props.upgradeBar];
  1606. if (upgradeBar.length === 1) {
  1607. Dsync.upgradeItem(upgradeBar[0]);
  1608. }
  1609. }
  1610. const {y2, health, maxHealth, isClown, hat, oldHat} = Dsync.myPlayer;
  1611. if (Settings.autoheal && health < maxHealth && !updatePlayer_isHealing) {
  1612. updatePlayer_isHealing = true;
  1613. updatePlayer_healing();
  1614. }
  1615. const inRiver = y2 > 8075 && y2 < 8925;
  1616. const notInRiver = !(y2 > 8e3 && y2 < 9e3);
  1617. if (Settings.autoScuba && inRiver && !toggleScuba) {
  1618. toggleScuba = true;
  1619. Dsync.myPlayer.oldHat = hat;
  1620. equipHat(EHats.SCUBA, false, false);
  1621. }
  1622. if (toggleScuba && notInRiver) {
  1623. equipHat(oldHat);
  1624. toggleScuba = false;
  1625. }
  1626. if (Settings.jungleOnClown && isClown && hat !== EHats.JUNGLE && !toggleClown) {
  1627. toggleClown = true;
  1628. Dsync.myPlayer.oldHat = fastBreaking ? fastBreakHat : hat;
  1629. equipHat(EHats.JUNGLE, false, false);
  1630. }
  1631. if (!isClown && toggleClown) {
  1632. equipHat(oldHat);
  1633. toggleClown = false;
  1634. }
  1635. if (Settings.autochat) autochat();
  1636. if (Settings.autoScythe && Dsync.entityList()[ELayer.GOLDENCOW].length && !isStoneGold()) {
  1637. upgradeScythe();
  1638. }
  1639. if (Settings.autoAccept && Dsync.clanData[Dsync.props.acceptList].length) {
  1640. accept(true);
  1641. }
  1642. }
  1643. if (Settings.hatReloadBar) {
  1644. if (target.oldId !== player.id) {
  1645. target.oldId = player.id;
  1646. target.oldHat = player.hat;
  1647. target.hatReload = 1300;
  1648. }
  1649. if (target.oldHat !== player.hat) {
  1650. target.oldHat = player.hat;
  1651. target.hatReload = 0;
  1652. }
  1653. target.hatReload = Math.min(target.hatReload + Dsync.step, 1300);
  1654. }
  1655. } else {
  1656. if (Settings.fireballReloadBar && entity.type === ELayer.DRAGON) {
  1657. const fireballs = Dsync.entityList()[ELayer.FIREBALL].map((object => {
  1658. const fireball = formatEntity(object);
  1659. return distance(entity, fireball).dist;
  1660. }));
  1661. const total = fireballs.reduce(((total, int) => total + int), 0);
  1662. const reload = 2900;
  1663. if (target.oldId !== entity.id) {
  1664. target.oldId = entity.id;
  1665. target.total = total;
  1666. target.fireballReload = reload;
  1667. }
  1668. if ((fireballs.length === 5 && total < 600 || fireballs.length === 1 && total < 100) && target.fireballReload === reload) {
  1669. target.total = total;
  1670. target.fireballReload = 0;
  1671. }
  1672. target.fireballReload = Math.min(target.fireballReload + Dsync.step, reload);
  1673. }
  1674. if (Settings.turretReloadBar && entity.type === ELayer.TURRET) {
  1675. const projectile = Dsync.entityList()[ELayer.PROJECTILE].find((object => {
  1676. const bullet = formatProjectile(object);
  1677. return bullet.ownerID === entity.ownerID && entity.angle2 === bullet.angle2;
  1678. }));
  1679. if (target.turretReload === undefined) {
  1680. target.turretReload = 3e3;
  1681. }
  1682. if (projectile) {
  1683. const bullet = formatProjectile(projectile);
  1684. if (bullet && target.bulletID !== bullet.id) {
  1685. target.bulletID = bullet.id;
  1686. target.turretReload = 0;
  1687. }
  1688. }
  1689. target.turretReload = Math.min(target.turretReload + Dsync.step, 3e3);
  1690. }
  1691. }
  1692. };
  1693. const hooks_updatePlayer = updatePlayer;
  1694. const renderLayers = (ctx, now) => {
  1695. const entities = Dsync.entityList();
  1696. for (let i = 0; i < Dsync.itemList.length; i++) {
  1697. const id = Dsync.itemList[i];
  1698. for (let j = 0; j < entities[id].length; j++) {
  1699. const target = entities[id][j];
  1700. const object = formatObject(target);
  1701. if (object.ownerID === 0) continue;
  1702. if (Settings.turretReloadBar && target.type === ELayer.TURRET && target.turretReload !== undefined) {
  1703. drawBar(ctx, object, target.turretReload, 3e3, Settings.turretReloadBarColor);
  1704. }
  1705. windmillRotation(target);
  1706. const color = getMarkerColor(target, object.ownerID);
  1707. if (color === null) continue;
  1708. ctx.save();
  1709. ctx.translate(object.x + target.dirX, object.y + target.dirY);
  1710. marker(ctx, color);
  1711. ctx.restore();
  1712. }
  1713. }
  1714. };
  1715. const hooks_renderLayers = renderLayers;
  1716. let start = Date.now();
  1717. const moveUpdate = () => {
  1718. const now = Date.now();
  1719. Dsync.step = now - start;
  1720. start = now;
  1721. };
  1722. const hooks_moveUpdate = moveUpdate;
  1723. const version = __webpack_require__(147).i8;
  1724. const log = console.log;
  1725. window.log = log;
  1726. window.Dsync = {
  1727. props: {},
  1728. hooks: {},
  1729. settings: Settings,
  1730. myPlayer: null,
  1731. target: null,
  1732. hsl: 0,
  1733. version,
  1734. actualHat: 0,
  1735. scale: {
  1736. w: linker(1824),
  1737. h: linker(1026),
  1738. w2: 1824,
  1739. h2: 1026
  1740. },
  1741. itemList: [],
  1742. mousemove: true,
  1743. aimTarget: null,
  1744. step: 0,
  1745. clanData: null,
  1746. PRODUCTION: true
  1747. };
  1748. const Dsync = window.Dsync;
  1749. storage["delete"]("_adIds");
  1750. const proxyDetect = fromCharCode([ 97, 117, 116, 104, 111, 114 ]);
  1751. const evalDelay = fromCharCode([ 77, 117, 114, 107, 97 ]);
  1752. window.eval = new Proxy(window.eval, {
  1753. apply(target, _this, args) {
  1754. const code = args[0];
  1755. if (code.length > 1e5 && GM(proxyDetect, evalDelay)) {
  1756. const Hook = new modules_Regex(code, true);
  1757. const sendFunction = (name, fname, content = "") => {
  1758. Hook.prepend(name, [ `function`, fname ], `Dsync.${name}=${fname};` + content);
  1759. };
  1760. window.COPY_CODE = Hook.COPY_CODE.match(/^\((.+)\)\(.+\);$/)[1];
  1761. Hook.append("EXTERNAL fix", [ /\(function/, /(\w+)/, /\(/, /\w+/, /\)/, /\{/ ], `EXTERNAL.__proto__.toString=()=>COPY_CODE;`);
  1762. Hook.replace("Debugger fix", /debugger/, ``, "g");
  1763. const selectItem = Hook.match("selectItem", [ /!/, /\w+/, /\[/, /\w+/, /\]/, /&&/, /(\w+)/, /\(/, /\d/, /\)/, /,/ ])[1];
  1764. sendFunction("selectItem", selectItem);
  1765. const equipHat = Hook.match("equipHat", [ /!/, /\w+/, /\)/, /return/, /;/, /(\w+)/, /\(/, /\w+/, /\)/ ])[1];
  1766. sendFunction("equipHat", equipHat);
  1767. const chat = Hook.match("chat", [ /break/, /\}/, /(\w+)/, /\(/, /\w+/, /\)/ ])[1];
  1768. sendFunction("chat", chat);
  1769. const [, attack, getAngle] = Hook.match("attack", [ /&&/, /(\w+)/, /\(/, /(\w+)/, /\(/, /\)/, /\)/, /,/ ]);
  1770. sendFunction("attack", attack);
  1771. sendFunction("getAngle", getAngle);
  1772. const stopAttack = Hook.match("stopAttack", [ /&&/, /(\w+)/, /\(/, /\)/, /,/ ])[1];
  1773. sendFunction("stopAttack", stopAttack);
  1774. const autoattack = Hook.match("autoattack", [ /,/, /(\w+)/, /\(/, /\w+/, /\)/, /\)/, /\)/ ])[1];
  1775. sendFunction("autoattack", autoattack);
  1776. const move = Hook.match("move", [ /&&/, /\(/, /(\w+)/, /\(/, /\w+/, /\)/ ])[1];
  1777. sendFunction("move", move);
  1778. const createClan = Hook.match("createClan", [ /,/, /\w+/, /=>/, /\{/, /(\w+)/, /\(/, /\w+/ ])[1];
  1779. sendFunction("createClan", createClan);
  1780. const leaveClan = Hook.match("leaveClan", [ /=>/, /\{/, /(\w+)/, /\(/, /\)/, /\}/ ])[1];
  1781. sendFunction("leaveClan", leaveClan);
  1782. const kickUser = Hook.match("kickUser", [ /return/, /;/, /(\w+)/, /\(/, /\w+/, /\)/, /\}/, /:/ ])[1];
  1783. sendFunction("kickUser", kickUser);
  1784. const joinClan = Hook.match("joinClan", [ /(\w+)/, /\(/, /\w+/, /\)/, /\}/, /\}/, /\)/, /\}/, /\}/ ])[1];
  1785. sendFunction("joinClan", joinClan);
  1786. const changeAngle = Hook.match("changeAngle", [ /\w+/, /\(/, /\w+/, /\)/, /\}/, /function/, /\w+/, /\(/, /\w+/, /\)/, /\{/, /(\w+)/, /\(/, /\w+/, /\)/, /,/ ])[1];
  1787. sendFunction("changeAngle", changeAngle);
  1788. const MoveByAngle = Hook.match("MoveByAngle", [ /\w+\s\s*of/, /\w+\..+?(\w+)/, /\(/, /\w+/, /\)/, /,/ ])[1];
  1789. sendFunction("MoveByAngle", MoveByAngle);
  1790. Hook.append("mousedown", [ /&&/, /\w+/, /\>/, /\w+/, /\)/, /return/, /;/, `(.+?=`, /(\w+)/, `.+?),`, `!(\\w+`, /\(/, /\w+/, /,/, /\w+/, `\\)).+?`, /\}/ ], `Dsync.mousedown=($3)=>{$2;return $4;};`);
  1791. Hook.append("mouseup", [ /!\w+\.\w+/, /\)/, /return/, /;/, `(\\w+`, /=/, /(\w+).+?\w+/, /\(/, /\w+/, /,/, /\w+/, `\\))`, /\}/ ], `Dsync.mouseup=($3)=>{$2};`);
  1792. const [, toggleRotation, rotVar] = Hook.match("lockRotation", [ /\[/, /\w+/, /\]/, /&&/, /(\w+)/, /\(/, /!(\w+)/, /\)/, /,/ ]);
  1793. Hook.prepend("lockRotation", [ `function`, `${toggleRotation}` ], `Dsync.toggleRotation=()=>{${rotVar}=!${rotVar};};`);
  1794. const toggleChat = Hook.match("toggleChat", [ /return/, `(\\w+`, /&&/, /\w+/, /\(/, /!\[/, /\]/, /\)/, `,.+?),\\w+\\.` ])[1];
  1795. Hook.insert("toggleChat", [ /null/, /\}/, /\)/, /\)/, /;/, /{INSERT}/, /{VAR}/, /\w+/, /=/ ], `Dsync.toggleChat=()=>{${toggleChat}};`);
  1796. const [, selectByID, defaultData, itemBar] = Hook.match("selectByID", [ /(\w+)/, /\(/, /(\w+)\.(\w+)/, /\[/, /Number/ ]);
  1797. sendFunction("selectByID", selectByID, `Dsync.defaultData=${defaultData};`);
  1798. Dsync.props.itemBar = itemBar;
  1799. Hook.append("drawEntityInfo", [ /function/, /\w+/, /\(/, /ARGS{3}/, /\)/, /\{/, /{VAR}/, /\w+/, /=/, /\w+/, /\[/, /\w+/, /\(/, /\).+?\.5;/ ], "if(Dsync.hooks.drawEntityInfo){Dsync.hooks.drawEntityInfo(...arguments);}");
  1800. const [, x, x1, x2] = Hook.match("positionX", [ /\(\w+\.(\w+)/, /=/, /\w+\.(\w+)/, /\+/, /\(\w+\.(\w+)/ ]);
  1801. Dsync.props.x = x;
  1802. Dsync.props.x1 = x1;
  1803. Dsync.props.x2 = x2;
  1804. const [, y, y1, y2] = Hook.match("positionY", [ /,\w+\.(\w+)/, /=/, /\w+\.(\w+)/, /\+/, /\(\w+\.(\w+)/ ]);
  1805. Dsync.props.y = y;
  1806. Dsync.props.y1 = y1;
  1807. Dsync.props.y2 = y2;
  1808. const [, angle, angle1, angle2] = Hook.match("angle", [ /\w+\.(\w+)/, /=/, /\w+\.(\w+)/, /=/, /\w+\.(\w+)/, /=/, /\w+/, /,/, /\w+\.\w+/, /=/, /\w+/, /,/ ]);
  1809. Dsync.props.angle = angle;
  1810. Dsync.props.angle1 = angle1;
  1811. Dsync.props.angle2 = angle2;
  1812. const id = Hook.match("id", [ /-NUMBER{1}/, /!==/, /\w+\.(\w+)/, /&&/ ])[1];
  1813. Dsync.props.id = id;
  1814. const health = Hook.match("health", [ /(\w+)/, /\//, /NUMBER{255}/, /\*/ ])[1];
  1815. Dsync.props.health = health;
  1816. const maxHealth = Hook.match("maxHealth", [ /\w+/, /:/, /NUMBER{35}/, /,/, /(\w+)/, /:/, /NUMBER{100}/ ])[1];
  1817. Dsync.props.maxHealth = maxHealth;
  1818. const hat = Hook.match("hat", [ /\w+/, /\(/, /\)/, /\[/, /\w+/, /\./, /(\w+)/, /\]/, /;/, /if/ ])[1];
  1819. Dsync.props.hat = hat;
  1820. const playerValue = Hook.match("playerValue", [ /if/, /\(/, /!/, /\(/, /\w+/, /\./, /(\w+)/, /&/, /\w+/, /\(/, /\)/ ])[1];
  1821. Dsync.props.playerValue = playerValue;
  1822. const [, itemData, itemType] = Hook.match("itemType", [ /(\w+)/, /\(/, /\)/, /\[/, /\w+/, /\]/, /\./, /(\w+)/, /;/ ]);
  1823. Dsync.props.itemType = itemType;
  1824. const playerData = Hook.match("playerData", [ /\w+\.\w+/, /\(/, /(?!\d+)\w+/, /,/, /(?!arguments)(\w+)/, /\)/, /;/ ])[1];
  1825. Hook.prepend("myPlayerID", [ /function/, /\w+/, /\(/, /\)/, /\{/, /return/, /\w+/, /!==/, /(\w+)/ ], `Dsync.myPlayerID=()=>$2;Dsync.playerData=${playerData};`);
  1826. const entityList = Hook.match("entityList", [ /new/, /Map/, /,/, /(\w+)/, /=/, /\[/, /\]/, /;/ ])[1];
  1827. const [, entityData, entityRadius] = Hook.match("entityData", /(\w+)\(\)\[\w+\.\w+\]\.(\w+)/);
  1828. Hook.prepend("entityData", [ /function/, /\w+/, /\(/, /ARGS{2}/, /\)/, /\{/, /{VAR}/, /\w+/, /,/ ], `Dsync.entityData=${entityData}();Dsync.itemData=${itemData}();Dsync.entityList=()=>${entityList};`);
  1829. Dsync.props.radius = entityRadius;
  1830. Hook.insert("showHoods1", [ /\w+/, /\(/, /\)/, /\./, /\w+/, /{INSERT}/, /\)/, /continue/, /;/ ], `&&!Dsync.settings.showHoods`);
  1831. Hook.insert("showHoods2", [ /\w+\.\w+/, /===/, /\w+/, /{INSERT}/, /\)/, /\{/ ], `||Dsync.settings.showHoods`);
  1832. Hook.insert("websocketString", [ /;/, /{INSERT}/, /switch/, /\(/, /(\w+)/, /\[/, /NUMBER{0}/, /\]/, /\)/, /\{/ ], `if(Dsync.hooks.stringMessage){Dsync.hooks.stringMessage($3);}`);
  1833. Hook.replace("zoomWidth", [ /(\w+)/, /:/, /NUMBER{1824}/, /,/ ], "$1:Dsync.scale.w,");
  1834. Hook.replace("zoomHeight", [ /(\w+)/, /:/, /NUMBER{1026}/, /,/ ], "$1:Dsync.scale.h,");
  1835. Hook.append("itemCounter", [ /(\w+)/, /\]/, /,/, /(\w+)/, /\./, /\w+/, /\(/, /(\w+)/, /\)/, /,/ ], `(Dsync.hooks.drawItemBar&&Dsync.hooks.drawItemBar($4,$3,$2)),`);
  1836. Hook.append("maxCount", [ `(\\w+`, `\\.`, `\\w+)`, /=/, /\[/, /ARGS{11}/, /\]/, /,/ ], `Dsync.maxCount=$2;`);
  1837. const currentCount = Hook.match("currentCount", [ /(\w+)/, /:/, /\[/, /ARGS{11}/, /\]/, /,/ ])[1];
  1838. Dsync.props.currentCount = currentCount;
  1839. const [, upgradeItem, upgradeBar] = Hook.match("upgradeList", [ /&&/, /\(/, /(\w+)/, /\(/, /\w+/, /\./, /(\w+)/, /\[/, /\w+/, /\]/, /\),/ ]);
  1840. Dsync.props.upgradeBar = upgradeBar;
  1841. sendFunction("upgradeItem", upgradeItem);
  1842. Hook.replace("ping", [ `({VAR}`, /(\w+)/, /=/, /\w+/, /\[/, /NUMBER{1}/, /\]/, /\|/, /\w+/, /\[/, /NUMBER{2}/, /\]/, /<</, /NUMBER{8}/, `;)`, /(?!{VAR})(\w+)/ ], `$1Dsync.ping=$2;$3`);
  1843. const clan = Hook.match("clan", [ /===/, /\w+/, /\./, /(\w+)/, /\)/, /\)/ ])[1];
  1844. Dsync.props.clan = clan;
  1845. const itemOwner = Hook.match("itemOwner", [ /\!/, /\(/, /\w+/, /\./, /(\w+)/, /===/ ])[1];
  1846. Dsync.props.itemOwner = itemOwner;
  1847. const byteLength = Hook.match("byteLength", [ /NUMBER{3}/, /;/, /\w+/, /</, /(\w+)/ ])[1];
  1848. Hook.append("JoinCreateClan", [ /,/, /\w+/, /=/, /(\w+)/, /\[/, /NUMBER{2}/, /\]/, /;/ ], `if(Dsync.hooks.UpdateClanList){Dsync.hooks.UpdateClanList([...$2.slice(3,${byteLength})]);}`);
  1849. Hook.append("UpdateClanList", [ /(\w+)/, /\[/, /NUMBER{1}/, /\]/, /;/, /\w+/, /\(/, /\)/, /\./, /\w+/, /\(/, /\w+/, /\)/, /;/ ], `if(Dsync.hooks.UpdateClanList){Dsync.hooks.UpdateClanList([...$2.slice(2,${byteLength})]);}`);
  1850. Hook.append("DeleteClan", [ /{QUOTE}none{QUOTE}/, /,/, /\w+/, /=/, /null/, /,/ ], `(Dsync.hooks.DeleteClan&&Dsync.hooks.DeleteClan()),`);
  1851. Hook.append("drawItem", [ /\)/, /;/, /const/, /\w+/, /=/, /\w+/, /\[/, /(?!\d+)\w+/, /\]/, /;.+?\)/, /,/ ], "(Dsync.settings.markersBottom&&Dsync.hooks.drawItems&&Dsync.hooks.drawItems(...arguments)),");
  1852. Hook.append("bounceProps", [ /(\w+)\.\w+/, /\+/, /(\w+)/, /,/, /\w+\.\w+/, /\+/, /(\w+)/, /\),/ ], `$2.dirX=$3,$2.dirY=$4,`);
  1853. const [, upgradeScythe, goldenCowID] = Hook.match("scythe", [ /\w+/, /&&/, /(\w+)/, /\(/, /(\w+)/, /\)/, /,/ ]);
  1854. sendFunction("upgradeScythe", upgradeScythe, `Dsync.goldenCowID=()=>${goldenCowID};`);
  1855. const itemDamage = Hook.match("itemDamage", [ /(\w+)/, /:/, /46\.5/, /,/ ])[1];
  1856. Dsync.props.itemDamage = itemDamage;
  1857. const itemDataType = Hook.match("itemDataType", [ /\w+/, /\./, /(\w+)/, /===/, /NUMBER{2}/ ])[1];
  1858. Dsync.props.itemDataType = itemDataType;
  1859. Hook.append("updatePlayer", [ /\(/, /ARGS{16}/, /\).+?/, /(\w+)/, /\./, /\w+/, /=/, /NUMBER{0}/ ], `;if(Dsync.hooks.updatePlayer){Dsync.hooks.updatePlayer($2);}`);
  1860. Hook.append("createEntity", [ /(\w+)/, /\./, /\w+/, /=/, /NUMBER{0}/, /;/, /break/, /;/, /default/, /:/, /break/, /\}/ ], `if (Dsync.myPlayerID() === $2[Dsync.props.id]){Dsync.target=$2;}`);
  1861. Hook.replace("renderLayers", [ `(function`, /\w+/, /\(/, /ARGS{2}/, /\)/, /\{/, /{VAR}/, /\w+/, /,/, /\w+/, /=.+?,/, /ARGS{2}/, `\\))`, /\}/ ], `$1;if(Dsync.itemList&&Dsync.hooks.renderLayers&&!Dsync.settings.markersBottom){Dsync.hooks.renderLayers(...arguments);}}`);
  1862. Hook.replace("mousemove", [ `(const`, /\w+/, /=/, /\w+/, /\(/, /\)/, /;.+?&&/, /\w+/, /\(/, /\w+/, `\\))` ], "if(Dsync.mousemove){$1}");
  1863. const renderLayer = Hook.match("renderLayer", [ /:/, /NUMBER{38}/, /,/, /(\w+)/, /:/, /\w+/, /\./, /\w+/, /,/ ])[1];
  1864. Dsync.props.renderLayer = renderLayer;
  1865. const currentItem = Hook.match("currentItem", [ /,/, /\w+/, /\./, /(\w+)/, /===/ ])[1];
  1866. Dsync.props.currentItem = currentItem;
  1867. const rotSpeed = Hook.match("rotSpeed", [ /\+=/, /\w+/, /\./, /(\w+)/, /\*/, /\w+/, /\)/ ])[1];
  1868. Dsync.props.rotSpeed = rotSpeed;
  1869. Hook.append("moveUpdate", [ /const/, /\w+/, /=/, /\+/, /new/, /\w+/, /;/ ], `if(Dsync.hooks.moveUpdate){Dsync.hooks.moveUpdate();}`);
  1870. Hook.replace("hideNicknames", [ `(const`, /\w+/, /=/, /\w+\.\w+/, `\\|\\|.+),`, `(?=\\w+`, /\(/, /ARGS{3}/, `&&)` ], `if(!Dsync.settings.hideNicknames){$1}`);
  1871. const weaponType = Hook.match("weaponType", [ /(\w+)/, /:/, /\w+\.\w+/, /,/, `${Dsync.props.id}`, /:/, /\w+\.\w+/, /,/ ])[1];
  1872. Dsync.props.weaponType = weaponType;
  1873. Hook.append("playerMessage", [ /\(/, /\w+/, /\)/, /\}/, /,/, /this/, /\./, /\w+/, /=/, /function/, /\(/, /ARGS{2}/, /\)/, /\{/ ], "if(Dsync.settings.hideMessages)return;");
  1874. Hook.append("teamMessage", [ /ARGS{7}/, /\)/, /\}/, /,/, /this/, /\./, /\w+/, /=/, /function/, /\(/, /ARGS{2}/, /\)/, /\{/ ], "if(Dsync.settings.hideMessages)return;");
  1875. const [, , accept, clanData, acceptList] = Hook.append("autoAccept", [ /\(/, /(\w+)/, /\(/, /NUMBER{0}/, /===/, /\w+/, /\)/, /\,/, /(\w+)\.(\w+).+?/, /\)/, /\}/ ], "Dsync.clanData=$3;");
  1876. sendFunction("accept", accept);
  1877. Dsync.props.acceptList = acceptList;
  1878. args[0] = Hook.code;
  1879. window.eval = target;
  1880. target.apply(_this, args);
  1881. load();
  1882. return;
  1883. }
  1884. return target.apply(_this, args);
  1885. }
  1886. });
  1887. const load = () => {
  1888. const canvas = document.querySelector("#game-canvas");
  1889. const gridToggle = document.querySelector("#grid-toggle");
  1890. const displayPingToggle = document.querySelector("#display-ping-toggle");
  1891. const itemMarkerToggle = document.querySelector("#native-helper-toggle");
  1892. const hat_menu_content = document.querySelector("#hat_menu_content");
  1893. if (gridToggle.checked) gridToggle.click();
  1894. if (!displayPingToggle.checked) displayPingToggle.click();
  1895. if (itemMarkerToggle.checked) itemMarkerToggle.click();
  1896. window.onkeydown = null;
  1897. window.onkeyup = null;
  1898. canvas.onmousedown = null;
  1899. canvas.onmouseup = null;
  1900. Dsync.hooks.stringMessage = hooks_stringMessage;
  1901. Dsync.hooks.updatePlayer = hooks_updatePlayer;
  1902. new MutationObserver((mutations => {
  1903. if (!inGame() || isInput()) return;
  1904. for (let i = 0; i < mutations.length; i++) {
  1905. if (mutations[i].target.textContent === "UNEQUIP") {
  1906. Dsync.actualHat = i + 1;
  1907. break;
  1908. }
  1909. }
  1910. })).observe(hat_menu_content, {
  1911. childList: true,
  1912. subtree: true
  1913. });
  1914. modules_createMenu();
  1915. window.addEventListener("keydown", (event => handleKeydown(event, event.code)));
  1916. window.addEventListener("keyup", (event => handleKeyup(event, event.code)));
  1917. canvas.addEventListener("mousedown", (event => handleKeydown(event, event.button)));
  1918. canvas.addEventListener("mouseup", (event => handleKeyup(event, event.button)));
  1919. Dsync.hooks.drawEntityInfo = hooks_drawEntityInfo;
  1920. Dsync.hooks.drawItemBar = hooks_drawItemBar;
  1921. Dsync.hooks.drawItems = drawitems;
  1922. Dsync.hooks.UpdateClanList = UpdateClanList;
  1923. Dsync.hooks.DeleteClan = DeleteClan;
  1924. Dsync.hooks.renderLayers = hooks_renderLayers;
  1925. Dsync.hooks.moveUpdate = hooks_moveUpdate;
  1926. Dsync.itemList = Dsync.itemData.filter((item => item[Dsync.props.itemDataType] === EItemTypes.PLACEABLE)).map((item => item[Dsync.props.renderLayer]));
  1927. modules_zoomHandler();
  1928. };
  1929. })();
  1930. }).toString() + `)(${JSON.stringify(GM_info)});`)();