Dsync Client [Sploop.io]

The most advanced hack for sploop.io

  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.21
  7. // @match *://sploop.io/*
  8. // @run-at document-start
  9. // @grant none
  10. // @license MIT
  11. // @namespace https://greatest.deepsurf.us/users/919633
  12. // ==/UserScript==
  13. /* jshint esversion:6 */
  14. /*
  15. Author: Murka
  16. Github: https://github.com/Murka007/Dsync-client
  17. Discord: https://discord.gg/sG9cyfGPj5
  18. Greasyfork: https://greatest.deepsurf.us/en/scripts/449995-dsync-client-sploop-io
  19. I need your support, please follow these steps:
  20. 1. Join my DISCORD server
  21. 2. Write a feedback about this script on GREASYFORK "script works, thank you so much"
  22. 3. Star my repository on GITHUB
  23. */
  24. Function("(" + ((GM_info) => {
  25. "use strict";
  26. var __webpack_modules__ = {
  27. 147: module => {
  28. module.exports = {
  29. i8: "1.0.21"
  30. };
  31. }
  32. };
  33. var __webpack_module_cache__ = {};
  34. function __webpack_require__(moduleId) {
  35. var cachedModule = __webpack_module_cache__[moduleId];
  36. if (cachedModule !== undefined) {
  37. return cachedModule.exports;
  38. }
  39. var module = __webpack_module_cache__[moduleId] = {
  40. exports: {}
  41. };
  42. __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  43. return module.exports;
  44. }
  45. (() => {
  46. __webpack_require__.d = (exports, definition) => {
  47. for (var key in definition) {
  48. if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  49. Object.defineProperty(exports, key, {
  50. enumerable: true,
  51. get: definition[key]
  52. });
  53. }
  54. }
  55. };
  56. })();
  57. (() => {
  58. __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
  59. })();
  60. var __webpack_exports__ = {};
  61. (() => {
  62. __webpack_require__.d(__webpack_exports__, {
  63. sv: () => Dsync,
  64. Ih: () => controller,
  65. vU: () => error,
  66. cM: () => log,
  67. lZ: () => pingCount,
  68. fA: () => target
  69. });
  70. 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>';
  71. const Header = code;
  72. 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>';
  73. const Navbar = Navbar_code;
  74. 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>';
  75. const Keybinds = Keybinds_code;
  76. 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="30" type="range"> <span class="slider-value">30</span> </label> </div> <div class="section-option"> <span class="section-option-title">Placement type</span> <select id="placementType"></select> </div> <div class="section-option"> <span class="section-option-title">Autobed</span> <label class="switch-checkbox"> <input id="autobed" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Automill</span> <label class="switch-checkbox"> <input id="automill" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title"> Anti fireball <span class="tooltip"> * <span class="tooltip-text">When you collide a fireball, place platform</span> </span> </span> <label class="switch-checkbox"> <input id="antiFireball" type="checkbox"> <span></span> </label> </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 class="section-option"> <span class="section-option-title">Autosync</span> <label class="switch-checkbox"> <input id="autosync" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Autoboost follow</span> <label class="switch-checkbox"> <input id="autoboostFollow" type="checkbox"> <span></span> </label> </div> </div> </div> </div> </div>';
  77. const Combat = Combat_code;
  78. 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>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> </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 class="section-option"> <span class="section-option-title">Weapon reload bar</span> <div class="content"> <button class="default-color" title="Reset Color"></button> <input id="weaponReloadBarColor" type="color"> <label class="switch-checkbox"> <input id="weaponReloadBar" type="checkbox"> <span></span> </label> </div> </div> <div class="section-option"> <span class="section-option-title">Smooth reload bar</span> <label class="switch-checkbox"> <input id="smoothReloadBar" type="checkbox"> <span></span> </label> </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">Anti hood</span> <label class="switch-checkbox"> <input id="showHoods" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Render HP</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"> 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 chat messages</span> <label class="switch-checkbox"> <input id="hideMessages" type="checkbox"> <span></span> </label> </div> </div> </div> <div class="section opened"> <div class="section-title"> <h2>Appearance</h2> </div> <div class="section-content"> <div class="split-section"> <div class="section-option"> <span class="section-option-title">Custom skins</span> <label class="switch-checkbox"> <input id="customSkins" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Skin</span> <div class="content"> <img> <button data-type="popup" data-id="skin" class="button">Select skin</button> </div> </div> <div class="section-option"> <span class="section-option-title">Accessory</span> <div class="content"> <img> <button data-type="popup" data-id="accessory" class="button">Select accessory</button> </div> </div> <div class="section-option"> <span class="section-option-title">Back</span> <div class="content"> <img> <button data-type="popup" data-id="back" class="button">Select back</button> </div> </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> </div> </div>';
  79. const Visuals = Visuals_code;
  80. 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">Auto chat</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"> Kill message <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"> <div class="section-option"> <span class="section-option-title">Auto spawn</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">Auto accept</span> <label class="switch-checkbox"> <input id="autoAccept" type="checkbox"> <span></span> </label> </div> <div class="section-option"> <span class="section-option-title">Always connect to</span> <select id="connectTo" class="smaller"></select> </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>';
  81. const Misc = Misc_code;
  82. 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://greatest.deepsurf.us/en/users/919633" class="text-value" target="_blank" title="Please support this script on greasyfork">Dsync client</a> </div> </div> </div> </div> </div>';
  83. const Credits = Credits_code;
  84. 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>img{width:40px;height:40px}.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;padding-right:25px}.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{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;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[data-type]{width:135px;font-size:.45em}.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}.menu-page .section .section-content .section-option select[id].smaller{width:130px}@-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{position:relative;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}#popup-menu{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;background:rgba(25,25,35,.5)}#popup-menu #popup-container{position:relative;width:70%;height:50%;background:#2f2f31;border-radius:10px;border:6px solid #36363d;padding:10px;display:flex;justify-content:space-between}#popup-menu #popup-container #close-popup{position:absolute;z-index:5;right:0;top:0;fill:#cebcb4;transition:fill 100ms;cursor:pointer}#popup-menu #popup-container #close-popup:hover{fill:#ffe7dc}#popup-menu #popup-container #popup-wrapper{position:absolute;z-index:1;top:10px;left:10px;bottom:10px;right:10px;padding:10px;display:flex;justify-content:space-between}#popup-menu #popup-container #popup-wrapper #popup-data{width:50%;height:100%;display:flex;flex-direction:column}#popup-menu #popup-container #popup-wrapper #popup-content{display:grid;width:100%;grid-template-columns:repeat(auto-fill, minmax(125px, 1fr));grid-gap:10px;overflow-y:auto}#popup-menu #popup-container #popup-wrapper #popup-content .img-prev{padding-bottom:6px;border-radius:7.5px;background:#7d7d9b;color:#adbcd8;box-shadow:0px -6px 0px 0px #68687c inset;cursor:pointer}#popup-menu #popup-container #popup-wrapper #popup-content .img-prev:active{padding-bottom:0px;padding-top:6px;box-shadow:0px 6px 0px 0px #68687c inset}#popup-menu #popup-container #popup-wrapper #popup-content .img-prev img{pointer-events:none;width:100%;height:100%}#popup-menu #popup-container #popup-title{font-size:2em;color:#ffe7dc;text-shadow:#3d3937 4px 0px 0px,#3d3937 3.87565px .989616px 0px,#3d3937 3.51033px 1.9177px 0px,#3d3937 2.92676px 2.72655px 0px,#3d3937 2.16121px 3.36588px 0px,#3d3937 1.26129px 3.79594px 0px,#3d3937 .282949px 3.98998px 0px,#3d3937 -0.712984px 3.93594px 0px,#3d3937 -1.66459px 3.63719px 0px,#3d3937 -2.51269px 3.11229px 0px,#3d3937 -3.20457px 2.39389px 0px,#3d3937 -3.69721px 1.52664px 0px,#3d3937 -3.95997px .56448px 0px,#3d3937 -3.97652px -0.432781px 0px,#3d3937 -3.74583px -1.40313px 0px,#3d3937 -3.28224px -2.28625px 0px,#3d3937 -2.61457px -3.02721px 0px,#3d3937 -1.78435px -3.57996px 0px,#3d3937 -0.843183px -3.91012px 0px,#3d3937 .150409px -3.99717px 0px,#3d3937 1.13465px -3.8357px 0px,#3d3937 2.04834px -3.43574px 0px,#3d3937 2.83468px -2.82216px 0px,#3d3937 3.44477px -2.03312px 0px,#3d3937 3.84068px -1.11766px 0px,#3d3937 3.9978px -0.132717px 0px}#popup-menu #popup-container #popup-description{color:#f0dcd3;text-shadow:#3d3937 4px 0px 0px,#3d3937 3.87565px .989616px 0px,#3d3937 3.51033px 1.9177px 0px,#3d3937 2.92676px 2.72655px 0px,#3d3937 2.16121px 3.36588px 0px,#3d3937 1.26129px 3.79594px 0px,#3d3937 .282949px 3.98998px 0px,#3d3937 -0.712984px 3.93594px 0px,#3d3937 -1.66459px 3.63719px 0px,#3d3937 -2.51269px 3.11229px 0px,#3d3937 -3.20457px 2.39389px 0px,#3d3937 -3.69721px 1.52664px 0px,#3d3937 -3.95997px .56448px 0px,#3d3937 -3.97652px -0.432781px 0px,#3d3937 -3.74583px -1.40313px 0px,#3d3937 -3.28224px -2.28625px 0px,#3d3937 -2.61457px -3.02721px 0px,#3d3937 -1.78435px -3.57996px 0px,#3d3937 -0.843183px -3.91012px 0px,#3d3937 .150409px -3.99717px 0px,#3d3937 1.13465px -3.8357px 0px,#3d3937 2.04834px -3.43574px 0px,#3d3937 2.83468px -2.82216px 0px,#3d3937 3.44477px -2.03312px 0px,#3d3937 3.84068px -1.11766px 0px,#3d3937 3.9978px -0.132717px 0px;margin-left:30px;margin-top:30px}#popup-menu #popup-container #popup-bottom{display:flex;justify-content:space-between;align-items:center;margin-top:auto}#popup-menu #popup-container #popup-bottom .popup-button{border:none;outline:none;display:inline-block;font-family:"Lato",sans-serif;text-align:center;cursor:pointer;max-width:160px;width:100%;font-size:.8em;font-weight:900;padding:5px 10px 10px;border-radius:5px;color:#ffe7dc;text-decoration:none;text-shadow:#3d3937 4px 0px 0px,#3d3937 3.87565px .989616px 0px,#3d3937 3.51033px 1.9177px 0px,#3d3937 2.92676px 2.72655px 0px,#3d3937 2.16121px 3.36588px 0px,#3d3937 1.26129px 3.79594px 0px,#3d3937 .282949px 3.98998px 0px,#3d3937 -0.712984px 3.93594px 0px,#3d3937 -1.66459px 3.63719px 0px,#3d3937 -2.51269px 3.11229px 0px,#3d3937 -3.20457px 2.39389px 0px,#3d3937 -3.69721px 1.52664px 0px,#3d3937 -3.95997px .56448px 0px,#3d3937 -3.97652px -0.432781px 0px,#3d3937 -3.74583px -1.40313px 0px,#3d3937 -3.28224px -2.28625px 0px,#3d3937 -2.61457px -3.02721px 0px,#3d3937 -1.78435px -3.57996px 0px,#3d3937 -0.843183px -3.91012px 0px,#3d3937 .150409px -3.99717px 0px,#3d3937 1.13465px -3.8357px 0px,#3d3937 2.04834px -3.43574px 0px,#3d3937 2.83468px -2.82216px 0px,#3d3937 3.44477px -2.03312px 0px,#3d3937 3.84068px -1.11766px 0px,#3d3937 3.9978px -0.132717px 0px}#popup-menu #popup-container #popup-bottom .popup-button#popup-continue{background:#77c468;box-shadow:0px -6px 0px 0px #49783d inset}#popup-menu #popup-container #popup-bottom .popup-button#popup-continue:active{padding:10px 10px 5px;box-shadow:0px 3px 0px 0px #49783d inset}#popup-menu #popup-container #popup-bottom .popup-button#popup-close{background:#9e5454;box-shadow:0px -6px 0px 0px #783d3d inset}#popup-menu #popup-container #popup-bottom .popup-button#popup-close:active{padding:10px 10px 5px;box-shadow:0px 3px 0px 0px #783d3d inset}#popup-menu #popup-container #popup-prev{width:50%;height:100%;display:flex;justify-content:right;align-items:center}#popup-menu #popup-container #popup-prev img{width:auto;height:auto;max-width:100%;max-height:100%}#image-background{position:absolute;animation:moving 60s infinite linear;padding:10px;top:0;left:0;bottom:0;right:0;filter:opacity(0.4)}.discord-bg{background:url(https://i.imgur.com/RcTl09i.png) 0 0/8% repeat;background-clip:content-box}.github-bg{background:url(https://i.imgur.com/q0z20jB.png) 0 0/8% repeat;background-clip:content-box}.greasyfork-bg{background:url(https://i.imgur.com/y6OYX0D.png) 0 0/8% repeat;background-clip:content-box}@keyframes moving{0%{background-position:0 0}100%{background-position:-500px 500px}}';
  85. var ELayer;
  86. (function(ELayer) {
  87. ELayer[ELayer["PLAYER"] = 0] = "PLAYER";
  88. ELayer[ELayer["STONE"] = 1] = "STONE";
  89. ELayer[ELayer["HARDSPIKE"] = 2] = "HARDSPIKE";
  90. ELayer[ELayer["TREE"] = 3] = "TREE";
  91. ELayer[ELayer["GOLD"] = 4] = "GOLD";
  92. ELayer[ELayer["BUSH"] = 5] = "BUSH";
  93. ELayer[ELayer["TRAP"] = 6] = "TRAP";
  94. ELayer[ELayer["SPIKE"] = 7] = "SPIKE";
  95. ELayer[ELayer["WOODWALL"] = 8] = "WOODWALL";
  96. ELayer[ELayer["PLATFORM"] = 9] = "PLATFORM";
  97. ELayer[ELayer["BOOST"] = 10] = "BOOST";
  98. ELayer[ELayer["LOOTBOX"] = 11] = "LOOTBOX";
  99. ELayer[ELayer["PROJECTILE"] = 12] = "PROJECTILE";
  100. ELayer[ELayer["WINDMILL"] = 13] = "WINDMILL";
  101. ELayer[ELayer["COW"] = 14] = "COW";
  102. ELayer[ELayer["SPAWN"] = 15] = "SPAWN";
  103. ELayer[ELayer["POWERMILL"] = 16] = "POWERMILL";
  104. ELayer[ELayer["CASTLESPIKE"] = 17] = "CASTLESPIKE";
  105. ELayer[ELayer["TURRET"] = 18] = "TURRET";
  106. ELayer[ELayer["WOODFARM"] = 19] = "WOODFARM";
  107. ELayer[ELayer["CHERRYWOODFARM"] = 20] = "CHERRYWOODFARM";
  108. ELayer[ELayer["STONEWARM"] = 21] = "STONEWARM";
  109. ELayer[ELayer["CASTLEWALL"] = 22] = "CASTLEWALL";
  110. ELayer[ELayer["SHARK"] = 23] = "SHARK";
  111. ELayer[ELayer["WOLF"] = 24] = "WOLF";
  112. ELayer[ELayer["GOLDENCOW"] = 25] = "GOLDENCOW";
  113. ELayer[ELayer["ROOF"] = 26] = "ROOF";
  114. ELayer[ELayer["DRAGON"] = 27] = "DRAGON";
  115. ELayer[ELayer["MAMMOTH"] = 28] = "MAMMOTH";
  116. ELayer[ELayer["FIREBALL"] = 29] = "FIREBALL";
  117. ELayer[ELayer["CHEST"] = 30] = "CHEST";
  118. ELayer[ELayer["DRAGONWALLBIG"] = 31] = "DRAGONWALLBIG";
  119. ELayer[ELayer["DRAGONWALLMEDIUM"] = 32] = "DRAGONWALLMEDIUM";
  120. ELayer[ELayer["DRAGONWALLSMALL"] = 33] = "DRAGONWALLSMALL";
  121. ELayer[ELayer["MAMMOTHWALL"] = 34] = "MAMMOTHWALL";
  122. ELayer[ELayer["MAMMOTHWALLSMALL"] = 35] = "MAMMOTHWALLSMALL";
  123. ELayer[ELayer["DUCK"] = 36] = "DUCK";
  124. ELayer[ELayer["TELEPORT"] = 37] = "TELEPORT";
  125. ELayer[ELayer["CACTUS"] = 38] = "CACTUS";
  126. ELayer[ELayer["TORNADO"] = 39] = "TORNADO";
  127. })(ELayer || (ELayer = {}));
  128. const LayerDataArray = [ {
  129. id: ELayer.PLAYER,
  130. radius: 35,
  131. maxHealth: 100,
  132. Qa: 1
  133. }, {
  134. id: ELayer.STONE,
  135. shoot: true,
  136. radius: 75,
  137. Qa: 1,
  138. Pa: 1
  139. }, {
  140. id: ELayer.HARDSPIKE,
  141. shoot: true,
  142. qa: 35,
  143. radius: 45,
  144. maxHealth: 500,
  145. Qa: 1
  146. }, {
  147. id: ELayer.TREE,
  148. shoot: true,
  149. cannotShoot: true,
  150. radius: 90,
  151. Qa: 1,
  152. Ka: 1
  153. }, {
  154. id: ELayer.GOLD,
  155. shoot: true,
  156. radius: 76,
  157. Qa: 1,
  158. Xa: 5
  159. }, {
  160. id: ELayer.BUSH,
  161. shoot: true,
  162. radius: 50,
  163. Qa: 1,
  164. Na: 1
  165. }, {
  166. id: ELayer.TRAP,
  167. radius: 40,
  168. maxHealth: 500,
  169. Qa: 1
  170. }, {
  171. id: ELayer.SPIKE,
  172. shoot: true,
  173. qa: 20,
  174. radius: 45,
  175. maxHealth: 375,
  176. Ia: 20,
  177. Qa: 1
  178. }, {
  179. id: ELayer.WOODWALL,
  180. shoot: true,
  181. radius: 45,
  182. maxHealth: 380,
  183. Qa: 1
  184. }, {
  185. id: ELayer.PLATFORM,
  186. radius: 60,
  187. maxHealth: 300,
  188. Qa: 1
  189. }, {
  190. id: ELayer.BOOST,
  191. radius: 40,
  192. maxHealth: 300,
  193. Qa: 1
  194. }, {
  195. id: ELayer.LOOTBOX,
  196. radius: 40,
  197. maxHealth: 4,
  198. Qa: 1
  199. }, {
  200. id: ELayer.PROJECTILE,
  201. radius: 0,
  202. maxHealth: 0
  203. }, {
  204. id: ELayer.WINDMILL,
  205. shoot: true,
  206. radius: 45,
  207. maxHealth: 400,
  208. rotateSpeed: Math.PI / 4,
  209. Qa: 1
  210. }, {
  211. id: ELayer.COW,
  212. radius: 90,
  213. maxHealth: 380,
  214. animal: true,
  215. Qa: 1,
  216. Ja: 1.6,
  217. $a: 9,
  218. ts: 0
  219. }, {
  220. id: ELayer.SPAWN,
  221. shoot: true,
  222. radius: 50,
  223. maxHealth: 380,
  224. Qa: 1
  225. }, {
  226. id: ELayer.POWERMILL,
  227. shoot: true,
  228. radius: 54,
  229. maxHealth: 400,
  230. rotateSpeed: Math.PI / 2,
  231. Qa: 1
  232. }, {
  233. id: ELayer.CASTLESPIKE,
  234. shoot: true,
  235. qa: 5,
  236. radius: 42,
  237. maxHealth: 1200,
  238. Ia: 24,
  239. Qa: 1
  240. }, {
  241. id: ELayer.TURRET,
  242. shoot: true,
  243. radius: 45,
  244. maxHealth: 800,
  245. Qa: 1
  246. }, {
  247. id: ELayer.WOODFARM,
  248. shoot: true,
  249. cannotShoot: true,
  250. radius: 80,
  251. Qa: 1,
  252. Ka: 1
  253. }, {
  254. id: ELayer.CHERRYWOODFARM,
  255. shoot: true,
  256. cannotShoot: true,
  257. radius: 80,
  258. Qa: 1,
  259. Ka: 1
  260. }, {
  261. id: ELayer.STONEWARM,
  262. shoot: true,
  263. radius: 60,
  264. Qa: 1,
  265. Pa: 1
  266. }, {
  267. id: ELayer.CASTLEWALL,
  268. shoot: true,
  269. radius: 59,
  270. maxHealth: 1750,
  271. Qa: 1
  272. }, {
  273. id: ELayer.SHARK,
  274. radius: 90,
  275. maxHealth: 380,
  276. animal: true,
  277. Qa: 1,
  278. Ja: 1.2,
  279. $a: 49,
  280. qa: 14,
  281. ts: 3
  282. }, {
  283. id: ELayer.WOLF,
  284. radius: 50,
  285. maxHealth: 380,
  286. animal: true,
  287. Qa: 1,
  288. Ja: 1.6,
  289. $a: 17,
  290. qa: 14,
  291. ts: 0
  292. }, {
  293. id: ELayer.GOLDENCOW,
  294. radius: 90,
  295. maxHealth: 1e3,
  296. animal: true,
  297. Qa: 1,
  298. Ja: 1.6,
  299. $a: 17,
  300. qa: 19
  301. }, {
  302. id: ELayer.ROOF,
  303. radius: 50,
  304. maxHealth: 300,
  305. Qa: 1
  306. }, {
  307. id: ELayer.DRAGON,
  308. radius: 100,
  309. maxHealth: 5e3,
  310. animal: true,
  311. Qa: 1,
  312. Ja: 1.15,
  313. $a: 17,
  314. qa: 30,
  315. ts: 0
  316. }, {
  317. id: ELayer.MAMMOTH,
  318. radius: 90,
  319. maxHealth: 5e3,
  320. animal: true,
  321. Qa: 1,
  322. Ja: 1.6,
  323. $a: 17,
  324. qa: 30,
  325. ts: 1
  326. }, {
  327. id: ELayer.FIREBALL,
  328. radius: 100,
  329. maxHealth: 380,
  330. Qa: 1,
  331. Ja: .4,
  332. $a: 1,
  333. qa: 15,
  334. ts: 0
  335. }, {
  336. id: ELayer.CHEST,
  337. shoot: true,
  338. radius: 45,
  339. maxHealth: 380,
  340. Qa: 1,
  341. Xa: 50,
  342. Lr: 20
  343. }, {
  344. id: ELayer.DRAGONWALLBIG,
  345. shoot: true,
  346. radius: 92,
  347. Qa: 1,
  348. Pa: 1
  349. }, {
  350. id: ELayer.DRAGONWALLMEDIUM,
  351. shoot: true,
  352. radius: 92,
  353. Qa: 1,
  354. Pa: 1
  355. }, {
  356. id: ELayer.DRAGONWALLSMALL,
  357. shoot: true,
  358. radius: 58,
  359. Qa: 1,
  360. Pa: 1
  361. }, {
  362. id: ELayer.MAMMOTHWALL,
  363. shoot: true,
  364. radius: 92,
  365. Qa: 1,
  366. Pa: 0
  367. }, {
  368. id: ELayer.MAMMOTHWALLSMALL,
  369. shoot: true,
  370. radius: 20,
  371. Qa: 1,
  372. Pa: 0
  373. }, {
  374. id: ELayer.DUCK,
  375. radius: 20,
  376. maxHealth: 380,
  377. animal: true,
  378. Qa: 1,
  379. Ja: 1.6,
  380. $a: 9,
  381. ts: 0
  382. }, {
  383. id: ELayer.TELEPORT,
  384. shoot: true,
  385. radius: 35,
  386. maxHealth: 150,
  387. Qa: 1
  388. }, {
  389. id: ELayer.CACTUS,
  390. shoot: true,
  391. radius: 50,
  392. Qa: 1,
  393. Na: 5,
  394. qa: 20
  395. }, {
  396. id: ELayer.TORNADO,
  397. radius: 220,
  398. rotateSpeed: Math.PI / 4,
  399. Qa: 0,
  400. Na: 5,
  401. qa: 1
  402. } ];
  403. const LayerData = LayerDataArray;
  404. const LayerObjects = LayerData.filter((layer => layer.shoot));
  405. const Animals = LayerData.filter((layer => layer.animal));
  406. var EObjects;
  407. (function(EObjects) {
  408. EObjects[EObjects["BOOST"] = 6] = "BOOST";
  409. EObjects[EObjects["PLATFORM"] = 8] = "PLATFORM";
  410. EObjects[EObjects["TRAP"] = 9] = "TRAP";
  411. EObjects[EObjects["WINDMILL"] = 14] = "WINDMILL";
  412. EObjects[EObjects["SPAWN"] = 16] = "SPAWN";
  413. EObjects[EObjects["POWERMILL"] = 19] = "POWERMILL";
  414. EObjects[EObjects["ROOF"] = 48] = "ROOF";
  415. })(EObjects || (EObjects = {}));
  416. var PlacementType;
  417. (function(PlacementType) {
  418. PlacementType[PlacementType["DEFAULT"] = 0] = "DEFAULT";
  419. PlacementType[PlacementType["INVISIBLE"] = 1] = "INVISIBLE";
  420. PlacementType[PlacementType["HOLDING"] = 2] = "HOLDING";
  421. })(PlacementType || (PlacementType = {}));
  422. var EServers;
  423. (function(EServers) {
  424. EServers["SAND_EU1"] = "SFRA";
  425. EServers["SAND_EU2"] = "SFRA2BIS";
  426. EServers["SAND_USA1"] = "SCA";
  427. EServers["SAND_USA2"] = "SCA2";
  428. EServers["SAND_AS1"] = "SGP";
  429. EServers["SAND_AS2"] = "SGP2";
  430. EServers["SAND_AS3"] = "SGP3BIS";
  431. EServers["NORM_EU1"] = "FRA1FFA";
  432. EServers["NORM_USA1"] = "CA1FFA";
  433. EServers["NORM_AS1"] = "SGP1FFA";
  434. EServers["BATTLE_USA1"] = "BRSCA";
  435. })(EServers || (EServers = {}));
  436. const selectData = {
  437. placementType: PlacementType,
  438. connectTo: EServers
  439. };
  440. var TargetReload;
  441. (function(TargetReload) {
  442. TargetReload[TargetReload["TURRET"] = 3e3] = "TURRET";
  443. TargetReload[TargetReload["HAT"] = 1300] = "HAT";
  444. TargetReload[TargetReload["DRAGON"] = 3e3] = "DRAGON";
  445. })(TargetReload || (TargetReload = {}));
  446. var Hit;
  447. (function(Hit) {
  448. Hit[Hit["CANNOT"] = 0] = "CANNOT";
  449. Hit[Hit["CAN"] = 1] = "CAN";
  450. Hit[Hit["NEEDDESTROY"] = 2] = "NEEDDESTROY";
  451. })(Hit || (Hit = {}));
  452. const Reload = {
  453. hat: {
  454. current: TargetReload.HAT,
  455. lerp: TargetReload.HAT,
  456. max: TargetReload.HAT,
  457. color: () => Settings.hatReloadBarColor
  458. },
  459. weapon: {
  460. current: 0,
  461. lerp: 0,
  462. max: 0,
  463. color: () => Settings.weaponReloadBarColor
  464. },
  465. turret: {
  466. current: TargetReload.TURRET,
  467. lerp: TargetReload.TURRET,
  468. max: TargetReload.TURRET,
  469. color: () => Settings.turretReloadBarColor
  470. },
  471. fireball: {
  472. current: TargetReload.DRAGON,
  473. lerp: TargetReload.DRAGON,
  474. max: TargetReload.DRAGON,
  475. color: () => Settings.fireballReloadBarColor
  476. }
  477. };
  478. class Storage {
  479. static get(key) {
  480. const item = localStorage.getItem(key);
  481. return item !== null ? JSON.parse(item) : null;
  482. }
  483. static set(key, value) {
  484. localStorage.setItem(key, JSON.stringify(value));
  485. }
  486. static delete(key) {
  487. const has = localStorage.hasOwnProperty(key) && key in localStorage;
  488. localStorage.removeItem(key);
  489. return has;
  490. }
  491. }
  492. const defaultSettings = {
  493. primary: "Digit1",
  494. secondary: "Digit2",
  495. heal: "KeyQ",
  496. wall: "Digit4",
  497. spike: "KeyV",
  498. windmill: "KeyN",
  499. trap: "KeyF",
  500. turret: "KeyH",
  501. tree: "KeyU",
  502. platform: "KeyT",
  503. spawn: "KeyJ",
  504. up: "KeyW",
  505. left: "KeyA",
  506. down: "KeyS",
  507. right: "KeyD",
  508. autoattack: "KeyE",
  509. lockRotation: "KeyX",
  510. openChat: "Enter",
  511. invisibleHit: 2,
  512. spikeInsta: "KeyR",
  513. toggleMenu: "Escape",
  514. fastBreak: "KeyZ",
  515. upgradeScythe: "...",
  516. unequip: "...",
  517. bush: "...",
  518. berserker: "...",
  519. jungle: "...",
  520. crystal: "...",
  521. spikegear: "...",
  522. immunity: 4,
  523. boost: 3,
  524. applehat: "...",
  525. scuba: "...",
  526. hood: "...",
  527. demolist: "...",
  528. placementType: PlacementType.INVISIBLE,
  529. placementSpeed: 1,
  530. autobed: true,
  531. automill: true,
  532. antiFireball: true,
  533. autoheal: true,
  534. jungleOnClown: true,
  535. lastHat: true,
  536. autoScuba: true,
  537. meleeAim: true,
  538. bowAim: true,
  539. spikeInstaAim: true,
  540. autosync: true,
  541. autoboostFollow: true,
  542. enemyTracers: true,
  543. teammateTracers: true,
  544. animalTracers: true,
  545. enemyColor: "#cc5151",
  546. teammateColor: "#8ecc51",
  547. animalColor: "#518ccc",
  548. arrows: true,
  549. rainbow: false,
  550. drawHP: true,
  551. showHoods: true,
  552. itemCounter: true,
  553. visualAim: true,
  554. hideMessages: false,
  555. customSkins: false,
  556. skin: Storage.get("skin") || 27,
  557. accessory: Storage.get("accessory") || 30,
  558. back: Storage.get("back") || 2,
  559. itemMarkers: true,
  560. teammateMarkers: true,
  561. enemyMarkers: true,
  562. trapActivated: true,
  563. itemMarkersColor: "#8ecc51",
  564. teammateMarkersColor: "#cfbc5f",
  565. enemyMarkersColor: "#cc5151",
  566. trapActivatedColor: "#48b2b8",
  567. hatReloadBar: true,
  568. hatReloadBarColor: "#5155cc",
  569. fireballReloadBar: true,
  570. fireballReloadBarColor: "#cf7148",
  571. turretReloadBar: true,
  572. turretReloadBarColor: "#51cc80",
  573. weaponReloadBar: true,
  574. weaponReloadBarColor: "#cc8251",
  575. smoothReloadBar: true,
  576. windmillRotation: false,
  577. possibleShots: true,
  578. autochat: true,
  579. autochatMessages: [ "Dsync Client", "What is it?", "The most advanced hack for sploop!", "Download on greasyfork!" ],
  580. kill: true,
  581. killMessage: "{NAME}, you suck! {KILL}x",
  582. autospawn: false,
  583. smoothZoom: true,
  584. skipUpgrades: true,
  585. invisHitToggle: false,
  586. reverseZoom: false,
  587. autoAccept: false,
  588. connectTo: "SFRA",
  589. menuTransparency: false,
  590. blindUsers: [ 0, 0, 0 ]
  591. };
  592. const settings = {
  593. ...defaultSettings,
  594. ...Storage.get("Dsync-settings")
  595. };
  596. for (const key in settings) {
  597. if (!defaultSettings.hasOwnProperty(key)) {
  598. delete settings[key];
  599. }
  600. }
  601. Storage.set("Dsync-settings", settings);
  602. const Settings = settings;
  603. class Formatter {
  604. static object(target) {
  605. const layer = LayerData[target.type];
  606. return {
  607. id: target[Dsync.props.id],
  608. type: target.type,
  609. x: target[Dsync.props.x],
  610. y: target[Dsync.props.y],
  611. x1: target[Dsync.props.x1],
  612. y1: target[Dsync.props.y1],
  613. x2: target[Dsync.props.x2],
  614. y2: target[Dsync.props.y2],
  615. angle: target[Dsync.props.angle],
  616. angle1: target[Dsync.props.angle1],
  617. angle2: target[Dsync.props.angle2],
  618. ownerID: target[Dsync.props.ownerID],
  619. radius: layer.radius,
  620. layerData: layer,
  621. target
  622. };
  623. }
  624. static projectile(target) {
  625. const object = this.object(target);
  626. return {
  627. ...object,
  628. range: target.range,
  629. projectileType: target[Dsync.props.projectileType]
  630. };
  631. }
  632. static entity(target) {
  633. const object = this.object(target);
  634. const healthValue = target[Dsync.props.health];
  635. const maxHealth = object.layerData.maxHealth || 1;
  636. return {
  637. ...object,
  638. healthValue,
  639. health: Math.ceil(healthValue / 255 * maxHealth),
  640. maxHealth,
  641. entityValue: target[Dsync.props.entityValue]
  642. };
  643. }
  644. static player(target) {
  645. const entity = this.entity(target);
  646. return {
  647. ...entity,
  648. hat: target[Dsync.props.hat],
  649. isClown: entity.entityValue === 128,
  650. currentItem: target[Dsync.props.currentItem]
  651. };
  652. }
  653. }
  654. const TYPEOF = value => Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
  655. const removeClass = (target, name) => {
  656. if (target instanceof HTMLElement) {
  657. target.classList.remove(name);
  658. return;
  659. }
  660. for (const element of target) {
  661. element.classList.remove(name);
  662. }
  663. };
  664. const removeChildren = target => {
  665. while (target.firstChild) {
  666. target.removeChild(target.firstChild);
  667. }
  668. };
  669. const formatCode = code => {
  670. code = code + "";
  671. if (code === "0") return "LBTN";
  672. if (code === "1") return "MBTN";
  673. if (code === "2") return "RBTN";
  674. if (code === "3") return "XBTN2";
  675. if (code === "4") return "XBTN1";
  676. if (code === "Escape") return "ESC";
  677. if (code === "BracketLeft") return "[";
  678. if (code === "BracketRight") return "]";
  679. if (code === "NumpadDivide") return "NUMDIV";
  680. if (code === "NumpadMultiply") return "NUMMULT";
  681. if (code === "NumpadSubtract") return "NUMSUB";
  682. if (code === "NumpadDecimal") return "NUMDEC";
  683. if (code === "CapsLock") return "CAPS";
  684. if (code === "PrintScreen") return "PRNT";
  685. if (code === "Backslash") return "\\";
  686. if (code === "Backquote") return "BQUOTE";
  687. if (code === "PageDown") return "PAGEDN";
  688. const NumpadDigitArrowKey = /^(?:Numpad|Digit|Arrow|Key)(\w+)$/;
  689. if (NumpadDigitArrowKey.test(code)) {
  690. code = code.replace(NumpadDigitArrowKey, "$1").replace(/Numpad/, "NUM");
  691. }
  692. const ExtraKeysRegex = /^(Control|Shift|Alt)(.).*/;
  693. if (ExtraKeysRegex.test(code)) {
  694. code = code.replace(ExtraKeysRegex, "$2$1").replace(/Control/, "CTRL");
  695. }
  696. return code.toUpperCase();
  697. };
  698. const contains = (target, name) => target.classList.contains(name);
  699. const isInput = target => {
  700. const element = target || document.activeElement || document.body;
  701. return [ "TEXTAREA", "INPUT" ].includes(element.tagName);
  702. };
  703. const random = (min, max) => {
  704. const isInteger = Number.isInteger(min) && Number.isInteger(max);
  705. if (isInteger) return Math.floor(Math.random() * (max - min + 1) + min);
  706. return Math.random() * (max - min) + min;
  707. };
  708. const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
  709. const lerp = (start, stop, amt) => amt * (stop - start) + start;
  710. const sleep = ms => new Promise((resolve => setTimeout(resolve, ms)));
  711. const download = (data, filename) => {
  712. const blob = new Blob([ JSON.stringify(data, null, 4) ], {
  713. type: "application/json "
  714. });
  715. const url = URL.createObjectURL(blob);
  716. const a = document.createElement("a");
  717. a.href = url;
  718. a.download = (filename || "settings") + ".txt";
  719. a.click();
  720. a.remove();
  721. URL.revokeObjectURL(url);
  722. };
  723. const GM = (property, value) => {
  724. if (!Dsync.PRODUCTION) return true;
  725. try {
  726. return GM_info.script[property] === value;
  727. } catch (err) {
  728. return false;
  729. }
  730. };
  731. const fromCharCode = codes => codes.map((code => String.fromCharCode(code))).join("");
  732. const isBlind = () => !Settings.blindUsers.every((a => a === 1));
  733. const angle = (x1, y1, x2, y2) => Math.atan2(y2 - y1, x2 - x1);
  734. const formatAge = age => Math.floor(Math.log(1 + Math.max(0, age)) ** 2.4 / 13);
  735. const doWhile = (condition, callback, delay) => {
  736. if (!condition()) return;
  737. const interval = setInterval((() => {
  738. if (condition()) {
  739. callback();
  740. } else {
  741. clearInterval(interval);
  742. }
  743. }), delay);
  744. };
  745. const Common_define = (target, key, value) => {
  746. Object.defineProperty(target, key, {
  747. get: () => value,
  748. configurable: true
  749. });
  750. };
  751. const resetSkin = () => {
  752. const player = Dsync.myPlayer.target;
  753. if (!player) return;
  754. delete player[Dsync.props.skin];
  755. delete player[Dsync.props.accessory];
  756. delete player[Dsync.props.back];
  757. };
  758. const updateSkin = () => {
  759. if (!Settings.customSkins) return resetSkin();
  760. const player = Dsync.myPlayer.target;
  761. if (!player) return;
  762. Common_define(player, Dsync.props.skin, Settings.skin);
  763. Common_define(player, Dsync.props.accessory, Settings.accessory);
  764. Common_define(player, Dsync.props.back, Settings.back);
  765. };
  766. const Scale = {
  767. Default: {
  768. w: 1824,
  769. h: 1026
  770. },
  771. lerp: {
  772. w: 1824,
  773. h: 1026
  774. },
  775. current: {
  776. w: 1824,
  777. h: 1026
  778. }
  779. };
  780. const getMinScale = scale => {
  781. let w = Scale.Default.w;
  782. let h = Scale.Default.h;
  783. while (w > scale && h > scale) {
  784. w -= scale;
  785. h -= scale;
  786. }
  787. return {
  788. w,
  789. h
  790. };
  791. };
  792. const zoomHandler = () => {
  793. let wheels = 0;
  794. const scaleFactor = 150;
  795. window.addEventListener("wheel", (event => {
  796. if (!(event.target instanceof HTMLCanvasElement) || event.ctrlKey || event.shiftKey || event.altKey || isInput() || !controller.inGame) return;
  797. const {Default, current, lerp} = Scale;
  798. if (current.w === Default.w && current.h === Default.h && (wheels = (wheels + 1) % 5) !== 0) return;
  799. const {w, h} = getMinScale(scaleFactor);
  800. const zoom = !Settings.reverseZoom && event.deltaY > 0 || Settings.reverseZoom && event.deltaY < 0 ? -scaleFactor : scaleFactor;
  801. current.w = Math.max(w, current.w + zoom);
  802. current.h = Math.max(h, current.h + zoom);
  803. if (Settings.smoothZoom) return;
  804. lerp.w = current.w;
  805. lerp.h = current.h;
  806. window.dispatchEvent(new Event("resize"));
  807. }));
  808. };
  809. const modules_zoomHandler = zoomHandler;
  810. let context;
  811. let _clearRect;
  812. const toggleHook = () => {
  813. delete context.clearRect;
  814. if (!Settings.smoothZoom) return;
  815. context.clearRect = new Proxy(_clearRect, {
  816. apply(target, _this, args) {
  817. target.apply(_this, args);
  818. if (controller.inGame && Settings.smoothZoom) {
  819. Scale.lerp.w = lerp(Scale.lerp.w, Scale.current.w, .18);
  820. Scale.lerp.h = lerp(Scale.lerp.h, Scale.current.h, .18);
  821. window.dispatchEvent(new Event("resize"));
  822. }
  823. }
  824. });
  825. };
  826. HTMLCanvasElement.prototype.getContext = new Proxy(HTMLCanvasElement.prototype.getContext, {
  827. apply(target, _this, args) {
  828. const ctx = target.apply(_this, args);
  829. if (_this.id === "game-canvas") {
  830. context = ctx;
  831. _clearRect = ctx.clearRect;
  832. toggleHook();
  833. HTMLCanvasElement.prototype.getContext = target;
  834. }
  835. return ctx;
  836. }
  837. });
  838. const skins = {
  839. skin: [ [ "Sploop Classic", 0, 0 ], [ "Yellow Classic", 1, 0 ], [ "Brown Classic", 2, 0 ], [ "Pink Classic", 3, 0 ], [ "Blue Classic", 4, 0 ], [ "Green Classic", 5, 0 ], [ "White Cat", 6, 100 ], [ "Ginger Cat", 7, 100 ], [ "Pit Bull", 8, 150 ], [ "Pig", 9, 100 ], [ "Crocodile", 10, 200 ], [ "Fox", 11, 200 ], [ "Panda", 12, 300 ], [ "Bear", 13, 300 ], [ "Penguin", 14, 300 ], [ "Cactus", 15, 400 ], [ "Strawberry", 16, 800 ], [ "Wolf", 17, 400 ], [ "Mammoth", 18, 2e3 ], [ "Golden Cow", 19, 3e3 ], [ "Shark", 20, 1e3 ], [ "Apple", 21, 200 ], [ "Stone", 22, 500 ], [ "Cave Stone", 23, 600 ], [ "Ice", 24, 700 ], [ "Gold", 25, 800 ], [ "Cow", 26, 350 ], [ "Dragon", 27, 5e3 ], [ "Black Ice", 28, 1e3 ], [ "Magma", 29, 1500 ], [ "Kawak", 30, 2500 ], [ "Snowman", 31, 400 ], [ "Elf", 32, 1e3 ], [ "Green Bauble", 33, 300 ], [ "Red Bauble", 34, 300 ], [ "Golden Bauble", 35, 800 ], [ "Duck", 36, 300 ], [ "Tornado", 37, 3e3 ], [ "Golden Beetle", 38, 1500 ] ],
  840. accessory: [ [ "None", 0, 0 ], [ "Mustache", 1, 100 ], [ "Sun Glasses", 2, 500 ], [ "Yellow Cap", 3, 0 ], [ "Blue Cap", 4, 0 ], [ "Purple Cap", 5, 0 ], [ "Green Cap", 6, 0 ], [ "Pink Bow", 7, 0 ], [ "3D Glasses", 8, 300 ], [ "Scar", 9, 150 ], [ "Turban", 10, 250 ], [ "Bandage", 11, 250 ], [ "Crazy Glasses", 12, 150 ], [ "Cow's Snout", 13, 300 ], [ "Carrot", 14, 150 ], [ "Horn", 15, 1e3 ], [ "Tusk", 16, 800 ], [ "Mammoth Hair", 17, 600 ], [ "Mammoth Ears", 18, 500 ], [ "Leaf", 19, 150 ], [ "Black Mustache", 20, 500 ], [ "Snowman Hat", 21, 1e3 ], [ "Blue Beanie", 22, 200 ], [ "Green Beanie", 23, 200 ], [ "Purple Beanie", 24, 200 ], [ "Orange Beanie", 25, 200 ], [ "Yellow Scarf", 26, 250 ], [ "Red Scarf", 27, 350 ], [ "Green Scarf", 28, 300 ], [ "Red Nose", 29, 400 ], [ "Mask", 30, 1e3 ], [ "Garlands", 31, 500 ] ],
  841. back: [ [ "None", 0, 0 ], [ "Mammoth Tail", 1, 500 ], [ "Dragon Wings", 2, 5e3 ], [ "Swords", 3, 2e3 ], [ "Blue Cape", 4, 400 ], [ "Christmas Cape", 5, 400 ], [ "Speedy Cape", 6, 400 ], [ "Garland", 7, 300 ], [ "Baby Elf", 8, 1500 ], [ "Gift", 9, 1e3 ], [ "Yellow Bag", 10, 300 ] ]
  842. };
  843. const Skins = skins;
  844. const createImage = src => {
  845. const img = new Image;
  846. img.src = src;
  847. return img;
  848. };
  849. const getURL = (type, id) => `${location.origin}/img/ui/${type}${id}.png`;
  850. const Images = {
  851. gaugeBackground: createImage("https://i.imgur.com/xincrX4.png"),
  852. gaugeFront: createImage("https://i.imgur.com/6AkHQM4.png"),
  853. discord: createImage("https://i.imgur.com/RcTl09i.png"),
  854. github: createImage("https://i.imgur.com/q0z20jB.png"),
  855. greasyfork: createImage("https://i.imgur.com/y6OYX0D.png")
  856. };
  857. const utils_Images = Images;
  858. const createMenu = () => {
  859. 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 `;
  860. 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\n #main-content {\n background: none;\n }\n\n #game-content {\n justify-content: center;\n }\n `;
  861. const IFRAME = document.createElement("iframe");
  862. const blob = new Blob([ IFRAME_CONTENT ], {
  863. type: "text/html; charset=utf-8"
  864. });
  865. IFRAME.src = URL.createObjectURL(blob);
  866. IFRAME.id = "iframe-page-container";
  867. document.body.appendChild(IFRAME);
  868. const style = document.createElement("style");
  869. style.innerHTML = IFRAME_STYLE;
  870. document.head.appendChild(style);
  871. IFRAME.onload = () => {
  872. const iframeWindow = IFRAME.contentWindow;
  873. const iframeDocument = iframeWindow.document;
  874. URL.revokeObjectURL(IFRAME.src);
  875. const menuContainer = iframeDocument.getElementById("menu-container");
  876. const menuWrapper = iframeDocument.getElementById("menu-wrapper");
  877. const openMenu = iframeDocument.querySelectorAll(".open-menu");
  878. const menuPage = iframeDocument.querySelectorAll(".menu-page");
  879. const sections = iframeDocument.querySelectorAll(".section");
  880. const hotkeyInputs = iframeDocument.querySelectorAll(".section-option-hotkeyInput[id]");
  881. const closeMenu = iframeDocument.querySelector("#close-menu");
  882. const checkboxs = iframeDocument.querySelectorAll("input[type='checkbox'][id]");
  883. const sliders = iframeDocument.querySelectorAll("input[type='range'][id]");
  884. const headerVersion = iframeDocument.querySelector("#version > span");
  885. const autochatInputs = iframeDocument.querySelectorAll(".input.autochat");
  886. const killMessage = iframeDocument.querySelector("#killMessage");
  887. const resetSettings = iframeDocument.querySelector("#reset-settings");
  888. const downloadSettings = iframeDocument.querySelector("#download-settings");
  889. const uploadSettings = iframeDocument.querySelector("#upload-settings");
  890. const menuTransparency = iframeDocument.querySelector("#menuTransparency");
  891. const colorPickers = iframeDocument.querySelectorAll("input[type='color'][id]");
  892. const selects = iframeDocument.querySelectorAll("select[id]");
  893. const buttonPopups = iframeDocument.querySelectorAll("button[data-type='popup'][data-id]");
  894. let popupCount = 0;
  895. const popups = [ {
  896. index: 0,
  897. title: "Discord",
  898. description: "Join our community!",
  899. link: "https://discord.gg/sG9cyfGPj5",
  900. prev: "https://i.imgur.com/DuLtryo.png"
  901. }, {
  902. index: 1,
  903. title: "Github",
  904. description: "Star a repository!",
  905. link: "https://github.com/Murka007/Dsync-client",
  906. prev: "https://i.imgur.com/u4aX4G1.png"
  907. }, {
  908. index: 2,
  909. title: "Greasyfork",
  910. description: "Write a feedback!",
  911. link: "https://greatest.deepsurf.us/en/scripts/449995-dsync-client-sploop-io/feedback#post-discussion",
  912. prev: "https://i.imgur.com/L1YP7cK.png"
  913. } ];
  914. const pickPopup = () => {
  915. const pups = popups.filter(((popup, index) => Settings.blindUsers[index] === 0));
  916. if (pups.length) {
  917. const popup = pups[popupCount++];
  918. popupCount %= pups.length;
  919. return popup;
  920. }
  921. return null;
  922. };
  923. const fadeOut = "transition: all 150ms ease 0s; transform: scale(0); opacity: 0;";
  924. let popupOpened = false;
  925. const createPopup = () => {
  926. if (popupOpened) return;
  927. const popup = pickPopup();
  928. if (!popup) return;
  929. popupOpened = true;
  930. const div = document.createElement("div");
  931. div.innerHTML = `\n <div id="popup-menu">\n <div id="popup-container">\n <div id="image-background" class="${popup.title.toLowerCase()}-bg"></div>\n\n <div id="popup-wrapper">\n <div id="popup-data">\n <div id="popup-title">${popup.title}</div>\n <div id="popup-description">${popup.description}</div>\n\n <div id="popup-bottom">\n <a id="popup-continue" class="popup-button" href="${popup.link}" target="_blank">CONTINUE</a>\n <button id="popup-close" class="popup-button">CLOSE</button>\n </div>\n </div>\n\n <div id="popup-prev">\n <img src="${popup.prev}"></img>\n </div>\n </div>\n </div>\n </div>\n `;
  932. const popupMenu = div.querySelector("#popup-menu");
  933. const container = div.querySelector("#popup-container");
  934. const continuePopup = div.querySelector("#popup-continue");
  935. const closePopup = div.querySelector("#popup-close");
  936. continuePopup.onclick = () => {
  937. popupCount -= 1;
  938. Settings.blindUsers[popup.index] = 1;
  939. Storage.set("Dsync-settings", Settings);
  940. };
  941. closePopup.onclick = () => {
  942. container.style.cssText = fadeOut;
  943. setTimeout((() => {
  944. popupMenu.remove();
  945. popupOpened = false;
  946. }), 150);
  947. };
  948. menuWrapper.appendChild(popupMenu);
  949. };
  950. const update = () => {
  951. updateSkin();
  952. for (const button of buttonPopups) {
  953. const type = button.getAttribute("data-id");
  954. const img = button.previousElementSibling;
  955. if (img) {
  956. img.src = getURL(type, Settings[type]);
  957. }
  958. button.onclick = () => {
  959. const div = document.createElement("div");
  960. div.innerHTML = `\n <div id="popup-menu">\n <div id="popup-container" style="height: 70%">\n <svg\n id="close-popup"\n class="icon"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 30 30"\n width="30px" height="30px"\n >\n <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"/>\n </svg>\n <div id="popup-wrapper">\n <div id="popup-content">\n </div>\n </div>\n </div>\n </div>\n `;
  961. const popupMenu = div.querySelector("#popup-menu");
  962. const container = div.querySelector("#popup-container");
  963. const popupContent = div.querySelector("#popup-content");
  964. const closePopup = div.querySelector("#close-popup");
  965. const close = () => {
  966. container.style.cssText = fadeOut;
  967. setTimeout((() => {
  968. popupMenu.remove();
  969. }), 150);
  970. };
  971. for (const skin of Skins[type]) {
  972. const div = document.createElement("div");
  973. const url = getURL(type, skin[1]);
  974. div.innerHTML = `\n <div class="img-prev">\n <img src="${url}">\n </div>\n `;
  975. const setURL = () => {
  976. if (!img) return;
  977. img.src = url;
  978. Settings[type] = skin[1];
  979. Storage.set("Dsync-settings", Settings);
  980. close();
  981. updateSkin();
  982. };
  983. const imgPrev = div.querySelector(".img-prev");
  984. imgPrev.onclick = setURL;
  985. closePopup.onclick = close;
  986. popupContent.appendChild(imgPrev);
  987. }
  988. menuWrapper.appendChild(popupMenu);
  989. };
  990. }
  991. for (const select of selects) {
  992. removeChildren(select);
  993. const data = selectData[select.id];
  994. for (const key in data) {
  995. if (!isNaN(Number(key))) continue;
  996. const keyValue = key;
  997. const option = document.createElement("option");
  998. option.value = data[keyValue];
  999. option.textContent = keyValue;
  1000. if (data[keyValue] === Settings[select.id]) {
  1001. option.selected = true;
  1002. option.defaultSelected = true;
  1003. }
  1004. select.appendChild(option);
  1005. }
  1006. select.onchange = () => {
  1007. const dataValue = /^\d+$/.test(String(select.value)) ? Number(select.value) : select.value;
  1008. Settings[select.id] = dataValue;
  1009. if (select.id === "placementType" && dataValue === PlacementType.DEFAULT) {
  1010. Settings.autoheal = false;
  1011. Settings.autoboostFollow = false;
  1012. update();
  1013. }
  1014. Storage.set("Dsync-settings", Settings);
  1015. };
  1016. }
  1017. for (const picker of colorPickers) {
  1018. const resetColor = picker.previousElementSibling;
  1019. if (resetColor) {
  1020. const defaultColor = defaultSettings[picker.id];
  1021. resetColor.style.backgroundColor = defaultColor;
  1022. resetColor.onclick = () => {
  1023. picker.value = defaultColor;
  1024. Settings[picker.id] = defaultColor;
  1025. Storage.set("Dsync-settings", Settings);
  1026. };
  1027. }
  1028. picker.value = Settings[picker.id];
  1029. picker.onchange = () => {
  1030. Settings[picker.id] = picker.value;
  1031. Storage.set("Dsync-settings", Settings);
  1032. picker.blur();
  1033. };
  1034. }
  1035. menuContainer.classList[Settings.menuTransparency ? "add" : "remove"]("transparent");
  1036. killMessage.value = Settings.killMessage;
  1037. killMessage.onchange = () => {
  1038. Settings.killMessage = killMessage.value;
  1039. Storage.set("Dsync-settings", Settings);
  1040. killMessage.blur();
  1041. };
  1042. for (let i = 0; i < autochatInputs.length; i++) {
  1043. const input = autochatInputs[i];
  1044. input.value = Settings.autochatMessages[i] || "";
  1045. input.onchange = () => {
  1046. Settings.autochatMessages[i] = input.value;
  1047. Storage.set("Dsync-settings", Settings);
  1048. input.blur();
  1049. };
  1050. }
  1051. headerVersion.textContent = "v" + Dsync.version;
  1052. for (const slider of sliders) {
  1053. const sliderValue = slider.nextElementSibling;
  1054. slider.value = Settings[slider.id];
  1055. if (sliderValue) {
  1056. sliderValue.textContent = slider.value;
  1057. }
  1058. slider.oninput = () => {
  1059. const value = Number(slider.value) % 5;
  1060. slider.value -= value;
  1061. if (sliderValue) {
  1062. sliderValue.textContent = slider.value;
  1063. }
  1064. Settings[slider.id] = Number(slider.value);
  1065. Storage.set("Dsync-settings", Settings);
  1066. };
  1067. }
  1068. for (const checkbox of checkboxs) {
  1069. checkbox.checked = Settings[checkbox.id];
  1070. checkbox.onchange = () => {
  1071. Settings[checkbox.id] = checkbox.checked;
  1072. if (checkbox.id === "smoothZoom") {
  1073. toggleHook();
  1074. } else if (checkbox.id === "customSkins") {
  1075. if (checkbox.checked) {
  1076. updateSkin();
  1077. } else {
  1078. resetSkin();
  1079. }
  1080. }
  1081. Storage.set("Dsync-settings", Settings);
  1082. checkbox.blur();
  1083. };
  1084. }
  1085. let popupCount = 0;
  1086. Dsync.toggleMenu = () => {
  1087. menuContainer.classList.toggle("close");
  1088. if (menuContainer.classList.toggle("open") && !popupOpened) {
  1089. popupCount += 1;
  1090. if ((popupCount %= 5) === 0) {
  1091. createPopup();
  1092. }
  1093. }
  1094. setTimeout((() => {
  1095. IFRAME.classList.toggle("iframe-opened");
  1096. }), 100);
  1097. };
  1098. closeMenu.onclick = Dsync.toggleMenu;
  1099. for (let i = 0; i < openMenu.length; i++) {
  1100. openMenu[i].onclick = () => {
  1101. removeClass(openMenu, "active");
  1102. openMenu[i].classList.add("active");
  1103. removeClass(menuPage, "opened");
  1104. menuPage[i].classList.add("opened");
  1105. };
  1106. }
  1107. for (const section of sections) {
  1108. const title = section.children[0];
  1109. const content = section.children[1];
  1110. if (!title || !content) continue;
  1111. if (contains(section, "opened")) {
  1112. content.classList.add("opened");
  1113. continue;
  1114. }
  1115. content.style.display = "none";
  1116. title.onclick = () => {
  1117. if (!content.classList.contains("opened")) {
  1118. content.style.display = "grid";
  1119. } else {
  1120. setTimeout((() => {
  1121. content.style.display = "none";
  1122. }), 100);
  1123. }
  1124. setTimeout((() => {
  1125. content.classList.toggle("opened");
  1126. title.children[1].classList.toggle("rotate");
  1127. }), 0);
  1128. };
  1129. }
  1130. for (const hotkeyInput of hotkeyInputs) {
  1131. try {
  1132. hotkeyInput.textContent = formatCode(Settings[hotkeyInput.id]);
  1133. } catch (err) {
  1134. throw new Error(hotkeyInput.id + " doesn't exist in settings");
  1135. }
  1136. }
  1137. checkForRepeats();
  1138. };
  1139. menuTransparency.addEventListener("change", (() => {
  1140. menuContainer.classList[menuTransparency.checked ? "add" : "remove"]("transparent");
  1141. }));
  1142. resetSettings.onclick = () => {
  1143. Object.assign(Settings, defaultSettings);
  1144. Storage.set("Dsync-settings", Settings);
  1145. update();
  1146. };
  1147. downloadSettings.onclick = () => {
  1148. download(Settings, "DsyncSettings" + Dsync.version);
  1149. };
  1150. uploadSettings.onchange = async event => {
  1151. const target = event.target;
  1152. const parent = uploadSettings.parentElement;
  1153. const spanText = parent.children[1];
  1154. parent.classList.remove("red");
  1155. parent.classList.remove("green");
  1156. try {
  1157. const text = await target.files[0].text();
  1158. const sets = JSON.parse(text);
  1159. if (Object.keys(sets).every((key => defaultSettings.hasOwnProperty(key)))) {
  1160. Object.assign(Settings, sets);
  1161. Storage.set("Dsync-settings", Settings);
  1162. update();
  1163. parent.classList.add("green");
  1164. spanText.innerHTML = `SETTINGS LOADED SUCCESSFULLY`;
  1165. } else {
  1166. throw new Error("Invalid settings");
  1167. }
  1168. } catch (err) {
  1169. parent.classList.add("red");
  1170. spanText.innerHTML = "SETTINGS ARE NOT VALID, TRY ANOTHER";
  1171. }
  1172. };
  1173. const checkForRepeats = () => {
  1174. const list = new Map;
  1175. for (const hotkeyInput of hotkeyInputs) {
  1176. const value = Settings[hotkeyInput.id];
  1177. const [count, inputs] = list.get(value) || [ 0, [] ];
  1178. list.set(value, [ (count || 0) + 1, [ ...inputs, hotkeyInput ] ]);
  1179. hotkeyInput.classList.remove("red");
  1180. }
  1181. for (const data of list) {
  1182. const [number, hotkeyInputs] = data[1];
  1183. if (number === 1) continue;
  1184. for (const hotkeyInput of hotkeyInputs) {
  1185. hotkeyInput.classList.add("red");
  1186. }
  1187. }
  1188. };
  1189. Dsync.active = null;
  1190. const applyCode = code => {
  1191. if (!Dsync.active) return;
  1192. const key = code === "Backspace" ? "..." : formatCode(code);
  1193. Settings[Dsync.active.id] = code === "Backspace" ? "..." : code;
  1194. Dsync.active.textContent = key;
  1195. Storage.set("Dsync-settings", Settings);
  1196. Dsync.active = null;
  1197. checkForRepeats();
  1198. };
  1199. menuContainer.addEventListener("keyup", (event => {
  1200. if (event.keyCode < 5 || !Dsync.active) return;
  1201. applyCode(event.code);
  1202. }));
  1203. menuContainer.addEventListener("mouseup", (event => {
  1204. const target = event.target;
  1205. if (Dsync.active) return applyCode(event.button);
  1206. if (!contains(target, "section-option-hotkeyInput") || !target.id) return;
  1207. target.textContent = "Wait...";
  1208. Dsync.active = target;
  1209. }));
  1210. iframeWindow.addEventListener("keydown", (event => controller.handleKeydown(event, event.code)));
  1211. iframeWindow.addEventListener("keyup", (event => controller.handleKeyup(event, event.code)));
  1212. const resize = () => {
  1213. const width = window.innerWidth;
  1214. const height = window.innerHeight;
  1215. const scale = Math.min(1, Math.min(width / 1024, height / 700));
  1216. menuContainer.style.transform = `translate(-50%, -50%) scale(${scale})`;
  1217. };
  1218. resize();
  1219. window.addEventListener("resize", resize);
  1220. setTimeout((() => IFRAME.classList.add("iframe-opened")), 0);
  1221. iframeWindow.addEventListener("contextmenu", (event => event.preventDefault()));
  1222. iframeWindow.addEventListener("mousedown", (event => 1 === event.button && event.preventDefault()));
  1223. iframeWindow.addEventListener("mouseup", (event => [ 3, 4 ].includes(event.button) && event.preventDefault()));
  1224. window.addEventListener("mouseup", (event => [ 3, 4 ].includes(event.button) && event.preventDefault()));
  1225. update();
  1226. };
  1227. };
  1228. const modules_createMenu = createMenu;
  1229. var Hat;
  1230. (function(Hat) {
  1231. Hat[Hat["UNEQUIP"] = 0] = "UNEQUIP";
  1232. Hat[Hat["BUSH"] = 1] = "BUSH";
  1233. Hat[Hat["BERSERKER"] = 2] = "BERSERKER";
  1234. Hat[Hat["JUNGLE"] = 3] = "JUNGLE";
  1235. Hat[Hat["CRYSTAL"] = 4] = "CRYSTAL";
  1236. Hat[Hat["SPIKEGEAR"] = 5] = "SPIKEGEAR";
  1237. Hat[Hat["IMMUNITY"] = 6] = "IMMUNITY";
  1238. Hat[Hat["BOOST"] = 7] = "BOOST";
  1239. Hat[Hat["APPLEHAT"] = 8] = "APPLEHAT";
  1240. Hat[Hat["SCUBA"] = 9] = "SCUBA";
  1241. Hat[Hat["HOOD"] = 10] = "HOOD";
  1242. Hat[Hat["DEMOLIST"] = 11] = "DEMOLIST";
  1243. })(Hat || (Hat = {}));
  1244. const Hats = [ {
  1245. bought: true,
  1246. equipped: true,
  1247. default: true,
  1248. price: 0
  1249. }, {
  1250. image: 109,
  1251. price: 250,
  1252. axisY: 0,
  1253. description: "Become a bush",
  1254. name: "Bush Hat",
  1255. bought: false,
  1256. equipped: false,
  1257. rs: true
  1258. }, {
  1259. image: 41,
  1260. price: 5e3,
  1261. description: "Increased melee damage",
  1262. axisY: 10,
  1263. cs: 1.25,
  1264. speed: .85,
  1265. name: "Berserker Gear",
  1266. bought: false,
  1267. equipped: false
  1268. }, {
  1269. image: 44,
  1270. price: 3e3,
  1271. description: "Regenerate health",
  1272. axisY: 13,
  1273. hs: 25,
  1274. name: "Jungle Gear",
  1275. bought: false,
  1276. equipped: false
  1277. }, {
  1278. image: 45,
  1279. price: 5e3,
  1280. description: "Receive reduced damage",
  1281. axisY: 10,
  1282. reduceDmg: .75,
  1283. speed: .95,
  1284. name: "Crystal Gear",
  1285. bought: false,
  1286. equipped: false
  1287. }, {
  1288. image: 48,
  1289. price: 1e3,
  1290. description: "Attacker's receive damage",
  1291. axisY: 10,
  1292. reflect: .45,
  1293. name: "Spike Gear",
  1294. bought: false,
  1295. equipped: false
  1296. }, {
  1297. image: 49,
  1298. price: 4e3,
  1299. description: "Gain more health",
  1300. axisY: 15,
  1301. ls: 150,
  1302. reduceDmg: .75,
  1303. name: "Immunity Gear",
  1304. bought: false,
  1305. equipped: false
  1306. }, {
  1307. image: 50,
  1308. price: 1500,
  1309. description: "Move quicker",
  1310. axisY: 23,
  1311. speed: 1.23,
  1312. name: "Boost Hat",
  1313. bought: false,
  1314. equipped: false
  1315. }, {
  1316. image: 93,
  1317. price: 150,
  1318. description: "Apples become more succulent",
  1319. axisY: 5,
  1320. speed: 1.05,
  1321. name: "Apple hat",
  1322. bought: false,
  1323. equipped: false
  1324. }, {
  1325. image: 121,
  1326. price: 4e3,
  1327. description: "Move fast in ocean",
  1328. axisY: 5,
  1329. speed: .75,
  1330. river: 1.5,
  1331. name: "Scuba Gear",
  1332. bought: false,
  1333. equipped: false
  1334. }, {
  1335. image: 126,
  1336. price: 3500,
  1337. description: "Become invisible when still",
  1338. axisY: 5,
  1339. name: "Hood",
  1340. bought: false,
  1341. equipped: false,
  1342. rs: true
  1343. }, {
  1344. image: 197,
  1345. price: 4e3,
  1346. description: "Destroy buildings faster",
  1347. axisY: 10,
  1348. name: "Demolist",
  1349. bought: false,
  1350. equipped: false,
  1351. speed: .3
  1352. } ];
  1353. var EWeapons;
  1354. (function(EWeapons) {
  1355. EWeapons[EWeapons["TOOL_HAMMER"] = 0] = "TOOL_HAMMER";
  1356. EWeapons[EWeapons["STONE_SWORD"] = 1] = "STONE_SWORD";
  1357. EWeapons[EWeapons["STONE_SPEAR"] = 2] = "STONE_SPEAR";
  1358. EWeapons[EWeapons["STONE_AXE"] = 3] = "STONE_AXE";
  1359. EWeapons[EWeapons["MUSKET"] = 4] = "MUSKET";
  1360. EWeapons[EWeapons["SHIELD"] = 11] = "SHIELD";
  1361. EWeapons[EWeapons["STICK"] = 13] = "STICK";
  1362. EWeapons[EWeapons["HAMMER"] = 15] = "HAMMER";
  1363. EWeapons[EWeapons["KATANA"] = 17] = "KATANA";
  1364. EWeapons[EWeapons["BOW"] = 26] = "BOW";
  1365. EWeapons[EWeapons["XBOW"] = 27] = "XBOW";
  1366. EWeapons[EWeapons["NAGINATA"] = 28] = "NAGINATA";
  1367. EWeapons[EWeapons["GREAT_AXE"] = 30] = "GREAT_AXE";
  1368. EWeapons[EWeapons["BAT"] = 31] = "BAT";
  1369. EWeapons[EWeapons["PEARL"] = 50] = "PEARL";
  1370. EWeapons[EWeapons["SCYTHE"] = 57] = "SCYTHE";
  1371. })(EWeapons || (EWeapons = {}));
  1372. var ActionType;
  1373. (function(ActionType) {
  1374. ActionType[ActionType["MELEE"] = 0] = "MELEE";
  1375. ActionType[ActionType["RANGED"] = 1] = "RANGED";
  1376. ActionType[ActionType["PLACEABLE"] = 2] = "PLACEABLE";
  1377. ActionType[ActionType["EATABLE"] = 3] = "EATABLE";
  1378. })(ActionType || (ActionType = {}));
  1379. var ItemType;
  1380. (function(ItemType) {
  1381. ItemType[ItemType["PRIMARY"] = 0] = "PRIMARY";
  1382. ItemType[ItemType["SECONDARY"] = 1] = "SECONDARY";
  1383. ItemType[ItemType["FOOD"] = 2] = "FOOD";
  1384. ItemType[ItemType["WALL"] = 3] = "WALL";
  1385. ItemType[ItemType["SPIKE"] = 4] = "SPIKE";
  1386. ItemType[ItemType["WINDMILL"] = 5] = "WINDMILL";
  1387. ItemType[ItemType["FARM"] = 6] = "FARM";
  1388. ItemType[ItemType["TRAP"] = 7] = "TRAP";
  1389. ItemType[ItemType["PLATFORM"] = 8] = "PLATFORM";
  1390. ItemType[ItemType["SPAWN"] = 9] = "SPAWN";
  1391. ItemType[ItemType["TURRET"] = 10] = "TURRET";
  1392. })(ItemType || (ItemType = {}));
  1393. var upgradeType;
  1394. (function(upgradeType) {
  1395. upgradeType[upgradeType["STONE"] = 1] = "STONE";
  1396. upgradeType[upgradeType["GOLD"] = 2] = "GOLD";
  1397. upgradeType[upgradeType["DIAMOND"] = 3] = "DIAMOND";
  1398. upgradeType[upgradeType["RUBY"] = 4] = "RUBY";
  1399. })(upgradeType || (upgradeType = {}));
  1400. const ItemData = [ {
  1401. id: EWeapons.TOOL_HAMMER,
  1402. gs: 46,
  1403. upgradeType: upgradeType.STONE,
  1404. imageinv: 29,
  1405. image: 25,
  1406. name: "Tool Hammer",
  1407. description: "Gather materials",
  1408. range: 80,
  1409. itemType: ItemType.PRIMARY,
  1410. damage: 25,
  1411. reload: 300,
  1412. _s: 30,
  1413. Ms: 200,
  1414. actionType: ActionType.MELEE,
  1415. ps: 0,
  1416. As: -3.5,
  1417. os: 1
  1418. }, {
  1419. id: EWeapons.STONE_SWORD,
  1420. ks: 1,
  1421. ys: 2,
  1422. imageinv: 28,
  1423. image: 24,
  1424. name: "Stone Sword",
  1425. description: "Sharp and pointy",
  1426. range: 135,
  1427. Ms: 250,
  1428. itemType: ItemType.PRIMARY,
  1429. damage: 35,
  1430. reload: 300,
  1431. Us: .85,
  1432. actionType: ActionType.MELEE,
  1433. ps: 0,
  1434. As: -8,
  1435. os: -4
  1436. }, {
  1437. id: EWeapons.STONE_SPEAR,
  1438. gs: 39,
  1439. upgradeType: upgradeType.STONE,
  1440. ks: 1,
  1441. ys: 4,
  1442. imageinv: 31,
  1443. image: 26,
  1444. name: "Stone Spear",
  1445. description: "Long melee range",
  1446. range: 160,
  1447. itemType: ItemType.PRIMARY,
  1448. damage: 49,
  1449. Us: .81,
  1450. Ms: 450,
  1451. reload: 700,
  1452. actionType: ActionType.MELEE,
  1453. ps: 0,
  1454. As: 0,
  1455. os: 2
  1456. }, {
  1457. id: EWeapons.STONE_AXE,
  1458. gs: 33,
  1459. upgradeType: upgradeType.STONE,
  1460. ks: 1,
  1461. ys: 128,
  1462. imageinv: 32,
  1463. image: 35,
  1464. name: "Stone Axe",
  1465. description: "Gathers materials faster",
  1466. range: 90,
  1467. itemType: ItemType.PRIMARY,
  1468. damage: 30,
  1469. Ms: 250,
  1470. reload: 400,
  1471. actionType: ActionType.MELEE,
  1472. ps: 0,
  1473. As: -2,
  1474. os: 2,
  1475. Es: 2,
  1476. Cs: 2,
  1477. Bs: 2,
  1478. zs: 2
  1479. }, {
  1480. id: EWeapons.MUSKET,
  1481. cost: {
  1482. food: 0,
  1483. wood: 0,
  1484. stone: 10,
  1485. gold: 0
  1486. },
  1487. ks: 16,
  1488. xs: 2,
  1489. ys: 8,
  1490. imageinv: 30,
  1491. image: 27,
  1492. name: "Stone Musket",
  1493. description: "Deal Long Range Damage",
  1494. range: 1e3,
  1495. itemType: ItemType.SECONDARY,
  1496. damage: 49,
  1497. reload: 1500,
  1498. projectile: 17,
  1499. Ls: 1500,
  1500. actionType: ActionType.RANGED,
  1501. ps: 1,
  1502. Us: .63,
  1503. As: 0,
  1504. os: 0
  1505. }, {
  1506. id: 5,
  1507. cost: {
  1508. food: 0,
  1509. wood: 10,
  1510. stone: 0,
  1511. gold: 0
  1512. },
  1513. imageinv: 33,
  1514. image: 103,
  1515. name: "Wood Wall",
  1516. description: "A sturdy wall",
  1517. itemType: ItemType.WALL,
  1518. actionType: ActionType.PLACEABLE,
  1519. Hs: 5,
  1520. As: 0,
  1521. os: 15,
  1522. layer: ELayer.WOODWALL,
  1523. ps: 2
  1524. }, {
  1525. id: 6,
  1526. cost: {
  1527. food: 0,
  1528. wood: 5,
  1529. stone: 20,
  1530. gold: 0
  1531. },
  1532. ks: 1,
  1533. ys: 512,
  1534. imageinv: 36,
  1535. image: 106,
  1536. name: "Boost",
  1537. description: "Provides a thrust",
  1538. itemType: ItemType.TRAP,
  1539. actionType: ActionType.PLACEABLE,
  1540. Hs: -5,
  1541. As: 0,
  1542. os: 3,
  1543. layer: ELayer.BOOST,
  1544. ps: 2
  1545. }, {
  1546. id: 7,
  1547. cost: {
  1548. food: 0,
  1549. wood: 20,
  1550. stone: 5,
  1551. gold: 0
  1552. },
  1553. imageinv: 37,
  1554. image: 104,
  1555. name: "Spike",
  1556. description: "Sharp defence",
  1557. itemType: ItemType.SPIKE,
  1558. actionType: ActionType.PLACEABLE,
  1559. Hs: 2,
  1560. As: 0,
  1561. os: 15,
  1562. layer: ELayer.SPIKE,
  1563. ps: 2
  1564. }, {
  1565. id: 8,
  1566. cost: {
  1567. food: 0,
  1568. wood: 20,
  1569. stone: 0,
  1570. gold: 0
  1571. },
  1572. ks: 1,
  1573. imageinv: 38,
  1574. image: 114,
  1575. name: "Platform",
  1576. description: "Shoot over structures",
  1577. itemType: ItemType.PLATFORM,
  1578. actionType: ActionType.PLACEABLE,
  1579. Hs: -2,
  1580. As: 0,
  1581. os: 8,
  1582. layer: ELayer.PLATFORM,
  1583. ps: 2
  1584. }, {
  1585. id: 9,
  1586. cost: {
  1587. food: 0,
  1588. wood: 30,
  1589. stone: 30,
  1590. gold: 0
  1591. },
  1592. ks: 1,
  1593. ys: 1024,
  1594. imageinv: 39,
  1595. image: 107,
  1596. name: "Trap",
  1597. description: "Snared enemies are stuck",
  1598. itemType: ItemType.TRAP,
  1599. actionType: ActionType.PLACEABLE,
  1600. Hs: 2,
  1601. As: 0,
  1602. os: 26,
  1603. layer: ELayer.TRAP,
  1604. ps: 2
  1605. }, {
  1606. id: 10,
  1607. cost: {
  1608. food: 10,
  1609. wood: 0,
  1610. stone: 0,
  1611. gold: 0
  1612. },
  1613. imageinv: 43,
  1614. image: 42,
  1615. name: "Apple",
  1616. description: "Heals you",
  1617. itemType: ItemType.FOOD,
  1618. actionType: ActionType.EATABLE,
  1619. restore: 20,
  1620. As: 0,
  1621. os: 22,
  1622. ps: 2
  1623. }, {
  1624. id: EWeapons.SHIELD,
  1625. ks: 1,
  1626. ys: 256,
  1627. imageinv: 47,
  1628. image: 46,
  1629. name: "Shield",
  1630. description: "Reduces damage",
  1631. itemType: ItemType.SECONDARY,
  1632. actionType: ActionType.MELEE,
  1633. Us: .7,
  1634. shieldAngle: .75,
  1635. range: 55,
  1636. Ms: 350,
  1637. damage: 15,
  1638. _s: 40,
  1639. reload: 500,
  1640. As: -15,
  1641. os: 10,
  1642. ps: 3
  1643. }, {
  1644. id: 12,
  1645. cost: {
  1646. food: 15,
  1647. wood: 0,
  1648. stone: 0,
  1649. gold: 0
  1650. },
  1651. ks: 1,
  1652. ys: 64,
  1653. imageinv: 52,
  1654. image: 51,
  1655. name: "Cookie",
  1656. description: "Heals you",
  1657. itemType: ItemType.FOOD,
  1658. actionType: ActionType.EATABLE,
  1659. restore: 35,
  1660. As: 0,
  1661. os: 22,
  1662. ps: 2
  1663. }, {
  1664. id: EWeapons.STICK,
  1665. gs: 41,
  1666. upgradeType: upgradeType.STONE,
  1667. ks: 1,
  1668. ys: 32,
  1669. imageinv: 55,
  1670. image: 54,
  1671. name: "Stick",
  1672. description: "Gathers resources quickly",
  1673. range: 100,
  1674. itemType: ItemType.PRIMARY,
  1675. damage: 1,
  1676. reload: 400,
  1677. actionType: ActionType.MELEE,
  1678. Ms: 60,
  1679. ps: 0,
  1680. As: 4,
  1681. os: 0,
  1682. Es: 7,
  1683. Cs: 7,
  1684. Bs: 7,
  1685. zs: 4
  1686. }, {
  1687. id: 14,
  1688. cost: {
  1689. food: 0,
  1690. wood: 50,
  1691. stone: 10,
  1692. gold: 0
  1693. },
  1694. imageinv: 57,
  1695. image: 61,
  1696. name: "Windmill",
  1697. description: "Generates score over time",
  1698. itemType: ItemType.WINDMILL,
  1699. actionType: ActionType.PLACEABLE,
  1700. rotateSpeed: Math.PI / 4,
  1701. Hs: -5,
  1702. As: 0,
  1703. os: 38,
  1704. layer: ELayer.WINDMILL,
  1705. ps: 2
  1706. }, {
  1707. id: EWeapons.HAMMER,
  1708. ks: 1,
  1709. ys: 1,
  1710. imageinv: 63,
  1711. image: 62,
  1712. name: "Hammer",
  1713. description: "Breaks structures faster",
  1714. range: 80,
  1715. itemType: ItemType.SECONDARY,
  1716. damage: 12,
  1717. _s: 76,
  1718. Us: .89,
  1719. Ms: 200,
  1720. reload: 400,
  1721. actionType: ActionType.MELEE,
  1722. ps: 0,
  1723. As: 5,
  1724. os: 2
  1725. }, {
  1726. id: 16,
  1727. ks: 1,
  1728. ys: 1,
  1729. cost: {
  1730. food: 0,
  1731. wood: 200,
  1732. stone: 200,
  1733. gold: 200
  1734. },
  1735. imageinv: 65,
  1736. image: 115,
  1737. name: "Cosy Bed",
  1738. description: "Respawn at the bed",
  1739. itemType: ItemType.SPAWN,
  1740. actionType: ActionType.PLACEABLE,
  1741. Hs: 8,
  1742. As: 0,
  1743. os: 25,
  1744. layer: ELayer.SPAWN,
  1745. ps: 2
  1746. }, {
  1747. id: EWeapons.KATANA,
  1748. gs: 37,
  1749. upgradeType: upgradeType.STONE,
  1750. ks: 2,
  1751. ys: 2,
  1752. imageinv: 68,
  1753. image: 67,
  1754. name: "Katana",
  1755. description: "Excellent melee weapon",
  1756. range: 140,
  1757. Ms: 150,
  1758. itemType: ItemType.PRIMARY,
  1759. damage: 40,
  1760. reload: 300,
  1761. Us: .85,
  1762. actionType: ActionType.MELEE,
  1763. ps: 0,
  1764. As: 1,
  1765. os: 3
  1766. }, {
  1767. id: 18,
  1768. cost: {
  1769. food: 0,
  1770. wood: 30,
  1771. stone: 30,
  1772. gold: 0
  1773. },
  1774. ks: 160,
  1775. ys: 1,
  1776. imageinv: 69,
  1777. image: 113,
  1778. name: "Castle Spike",
  1779. description: "Great for bases",
  1780. itemType: ItemType.SPIKE,
  1781. actionType: ActionType.PLACEABLE,
  1782. damage: {
  1783. hit: 24,
  1784. touch: 5
  1785. },
  1786. Hs: -8,
  1787. As: 0,
  1788. os: 14,
  1789. layer: ELayer.CASTLESPIKE,
  1790. ps: 2
  1791. }, {
  1792. id: 19,
  1793. cost: {
  1794. food: 0,
  1795. wood: 100,
  1796. stone: 50,
  1797. gold: 0
  1798. },
  1799. ks: 1,
  1800. ys: 1,
  1801. imageinv: 57,
  1802. image: 61,
  1803. name: "Powermill",
  1804. description: "Generates more score over time",
  1805. itemType: ItemType.WINDMILL,
  1806. actionType: ActionType.PLACEABLE,
  1807. rotateSpeed: Math.PI / 2,
  1808. Hs: 5,
  1809. As: 0,
  1810. os: 38,
  1811. layer: ELayer.POWERMILL,
  1812. ps: 2
  1813. }, {
  1814. id: 20,
  1815. ks: 1,
  1816. ys: 1,
  1817. cost: {
  1818. food: 0,
  1819. wood: 30,
  1820. stone: 10,
  1821. gold: 0
  1822. },
  1823. imageinv: 73,
  1824. image: 112,
  1825. name: "Hard Spike",
  1826. description: "Sharper defence",
  1827. itemType: ItemType.SPIKE,
  1828. actionType: ActionType.PLACEABLE,
  1829. Hs: 2,
  1830. As: 0,
  1831. os: 15,
  1832. layer: ELayer.HARDSPIKE,
  1833. ps: 2
  1834. }, {
  1835. id: 21,
  1836. cost: {
  1837. food: 0,
  1838. wood: 200,
  1839. stone: 150,
  1840. gold: 10
  1841. },
  1842. ks: 1,
  1843. ys: 1,
  1844. imageinv: 77,
  1845. image: 74,
  1846. name: "Turret",
  1847. description: "Defence for your base",
  1848. itemType: ItemType.TURRET,
  1849. actionType: ActionType.PLACEABLE,
  1850. Hs: 6,
  1851. As: 0,
  1852. os: 25,
  1853. layer: ELayer.TURRET,
  1854. ps: 2
  1855. }, {
  1856. id: 22,
  1857. ks: 1,
  1858. ys: 1,
  1859. cost: {
  1860. food: 0,
  1861. wood: 200,
  1862. stone: 0,
  1863. gold: 0
  1864. },
  1865. imageinv: 78,
  1866. image: 110,
  1867. name: "Cherry wood farm",
  1868. description: "Used for decoration and wood",
  1869. itemType: ItemType.FARM,
  1870. actionType: ActionType.PLACEABLE,
  1871. Hs: 3,
  1872. As: 0,
  1873. os: 47,
  1874. layer: ELayer.CHERRYWOODFARM,
  1875. ps: 2
  1876. }, {
  1877. id: 23,
  1878. ks: 1,
  1879. ys: 1,
  1880. cost: {
  1881. food: 0,
  1882. wood: 200,
  1883. stone: 0,
  1884. gold: 0
  1885. },
  1886. imageinv: 80,
  1887. image: 111,
  1888. name: "Wood farm",
  1889. description: "Used for decoration and wood",
  1890. itemType: ItemType.FARM,
  1891. actionType: ActionType.PLACEABLE,
  1892. Hs: 3,
  1893. As: 0,
  1894. os: 47,
  1895. layer: ELayer.WOODFARM,
  1896. ps: 2
  1897. }, {
  1898. id: 24,
  1899. ks: 1,
  1900. ys: 1,
  1901. cost: {
  1902. food: 200,
  1903. wood: 0,
  1904. stone: 0,
  1905. gold: 0
  1906. },
  1907. imageinv: 85,
  1908. image: 109,
  1909. name: "Berry farm",
  1910. description: "Used for decoration and berries",
  1911. itemType: ItemType.FARM,
  1912. actionType: ActionType.PLACEABLE,
  1913. Hs: 3,
  1914. As: 0,
  1915. os: 17,
  1916. layer: ELayer.BUSH,
  1917. ps: 2
  1918. }, {
  1919. id: 25,
  1920. ks: 1,
  1921. ys: 1,
  1922. cost: {
  1923. food: 0,
  1924. wood: 0,
  1925. stone: 200,
  1926. gold: 0
  1927. },
  1928. imageinv: 83,
  1929. image: 108,
  1930. name: "Stone farm",
  1931. description: "Used for decoration and stone",
  1932. itemType: ItemType.FARM,
  1933. actionType: ActionType.PLACEABLE,
  1934. Hs: 3,
  1935. As: 0,
  1936. os: 20,
  1937. layer: ELayer.STONEWARM,
  1938. ps: 2
  1939. }, {
  1940. id: EWeapons.BOW,
  1941. cost: {
  1942. food: 0,
  1943. wood: 4,
  1944. stone: 0,
  1945. gold: 0
  1946. },
  1947. ks: 1,
  1948. ys: 16,
  1949. imageinv: 86,
  1950. image: 87,
  1951. name: "Bow",
  1952. description: "Deal Long Range Damage",
  1953. range: 800,
  1954. itemType: ItemType.SECONDARY,
  1955. damage: 25,
  1956. reload: 600,
  1957. projectile: 88,
  1958. Ls: 1200,
  1959. actionType: ActionType.RANGED,
  1960. ps: 1,
  1961. Us: .75,
  1962. As: 0,
  1963. os: 35
  1964. }, {
  1965. id: EWeapons.XBOW,
  1966. cost: {
  1967. food: 0,
  1968. wood: 10,
  1969. stone: 0,
  1970. gold: 0
  1971. },
  1972. ks: 16,
  1973. ys: 176,
  1974. imageinv: 90,
  1975. image: 91,
  1976. name: "XBow",
  1977. description: "Rapid fire bow",
  1978. range: 800,
  1979. itemType: ItemType.SECONDARY,
  1980. damage: 27,
  1981. reload: 235,
  1982. projectile: 88,
  1983. Ls: 1200,
  1984. actionType: ActionType.RANGED,
  1985. ps: 1,
  1986. Us: .35,
  1987. As: 0,
  1988. os: 30
  1989. }, {
  1990. id: EWeapons.NAGINATA,
  1991. gs: 45,
  1992. upgradeType: upgradeType.STONE,
  1993. ks: 4,
  1994. ys: 4,
  1995. imageinv: 100,
  1996. image: 99,
  1997. name: "Naginata",
  1998. description: "Long melee range",
  1999. range: 165,
  2000. itemType: ItemType.PRIMARY,
  2001. damage: 52,
  2002. Us: .81,
  2003. Ms: 470,
  2004. reload: 700,
  2005. actionType: ActionType.MELEE,
  2006. ps: 0,
  2007. As: 0,
  2008. os: -4
  2009. }, {
  2010. id: 29,
  2011. cost: {
  2012. food: 0,
  2013. wood: 0,
  2014. stone: 35,
  2015. gold: 10
  2016. },
  2017. ks: 1,
  2018. ys: 1,
  2019. imageinv: 101,
  2020. image: 105,
  2021. name: "Castle Wall",
  2022. description: "A very sturdy wall",
  2023. itemType: ItemType.WALL,
  2024. actionType: ActionType.PLACEABLE,
  2025. Hs: 8,
  2026. As: 0,
  2027. os: 13,
  2028. layer: ELayer.CASTLEWALL,
  2029. ps: 2
  2030. }, {
  2031. id: EWeapons.GREAT_AXE,
  2032. gs: 35,
  2033. upgradeType: upgradeType.STONE,
  2034. ks: 128,
  2035. ys: 128,
  2036. imageinv: 117,
  2037. image: 116,
  2038. name: "Great Axe",
  2039. description: "More powerful axe.",
  2040. range: 94,
  2041. itemType: ItemType.PRIMARY,
  2042. damage: 37,
  2043. Ms: 250,
  2044. reload: 400,
  2045. actionType: ActionType.MELEE,
  2046. ps: 0,
  2047. As: 4,
  2048. os: 2,
  2049. Es: 4,
  2050. Cs: 4,
  2051. Bs: 4,
  2052. zs: 2
  2053. }, {
  2054. id: EWeapons.BAT,
  2055. ks: 1,
  2056. ys: 2048,
  2057. imageinv: 128,
  2058. image: 127,
  2059. name: "Bat",
  2060. description: "Hit enemies for a home run",
  2061. range: 115,
  2062. itemType: ItemType.PRIMARY,
  2063. damage: 28,
  2064. Us: .92,
  2065. Ms: 870,
  2066. reload: 700,
  2067. actionType: ActionType.MELEE,
  2068. ps: 0,
  2069. As: 10,
  2070. os: 2
  2071. }, {
  2072. id: 32,
  2073. ks: 1,
  2074. ys: 128,
  2075. imageinv: 131,
  2076. image: 130,
  2077. name: "Diamond Axe",
  2078. description: "Gathers materials faster",
  2079. range: 90,
  2080. itemType: ItemType.PRIMARY,
  2081. damage: 35.5,
  2082. Ms: 250,
  2083. reload: 400,
  2084. actionType: ActionType.MELEE,
  2085. ps: 0,
  2086. As: -2,
  2087. os: 2,
  2088. Es: 2,
  2089. Cs: 2,
  2090. Bs: 2,
  2091. zs: 2
  2092. }, {
  2093. id: 33,
  2094. gs: 32,
  2095. upgradeType: upgradeType.GOLD,
  2096. ks: 1,
  2097. ys: 128,
  2098. imageinv: 133,
  2099. image: 132,
  2100. name: "Gold Axe",
  2101. description: "Gathers materials faster",
  2102. range: 90,
  2103. itemType: ItemType.PRIMARY,
  2104. damage: 33,
  2105. Ms: 250,
  2106. reload: 400,
  2107. actionType: ActionType.MELEE,
  2108. ps: 0,
  2109. As: -2,
  2110. os: 2,
  2111. Es: 2,
  2112. Cs: 2,
  2113. Bs: 2,
  2114. zs: 2
  2115. }, {
  2116. id: 34,
  2117. ks: 128,
  2118. ys: 128,
  2119. imageinv: 135,
  2120. image: 134,
  2121. name: "Diamond Great Axe",
  2122. description: "More powerful axe.",
  2123. range: 94,
  2124. itemType: ItemType.PRIMARY,
  2125. damage: 47,
  2126. Ms: 250,
  2127. reload: 400,
  2128. actionType: ActionType.MELEE,
  2129. ps: 0,
  2130. As: 4,
  2131. os: 2,
  2132. Es: 4,
  2133. Cs: 4,
  2134. Bs: 4,
  2135. zs: 2
  2136. }, {
  2137. id: 35,
  2138. gs: 34,
  2139. upgradeType: upgradeType.GOLD,
  2140. ks: 128,
  2141. ys: 128,
  2142. imageinv: 145,
  2143. image: 144,
  2144. name: "Gold Great Axe",
  2145. description: "More powerful axe.",
  2146. range: 94,
  2147. itemType: ItemType.PRIMARY,
  2148. damage: 40,
  2149. Ms: 250,
  2150. reload: 400,
  2151. actionType: ActionType.MELEE,
  2152. ps: 0,
  2153. As: 4,
  2154. os: 2,
  2155. Es: 4,
  2156. Cs: 4,
  2157. Bs: 4,
  2158. zs: 2
  2159. }, {
  2160. id: 36,
  2161. gs: 40,
  2162. upgradeType: upgradeType.DIAMOND,
  2163. ks: 2,
  2164. ys: 2,
  2165. imageinv: 137,
  2166. image: 136,
  2167. name: "Diamond Katana",
  2168. description: "Excellent melee weapon",
  2169. range: 140,
  2170. Ms: 150,
  2171. itemType: ItemType.PRIMARY,
  2172. damage: 46.5,
  2173. reload: 300,
  2174. Us: .85,
  2175. actionType: ActionType.MELEE,
  2176. ps: 0,
  2177. As: 1,
  2178. os: 3
  2179. }, {
  2180. id: 37,
  2181. gs: 36,
  2182. upgradeType: upgradeType.GOLD,
  2183. ks: 2,
  2184. ys: 2,
  2185. imageinv: 139,
  2186. image: 138,
  2187. name: "Gold Katana",
  2188. description: "Excellent melee weapon",
  2189. range: 140,
  2190. Ms: 150,
  2191. itemType: ItemType.PRIMARY,
  2192. damage: 43,
  2193. reload: 300,
  2194. Us: .85,
  2195. actionType: ActionType.MELEE,
  2196. ps: 0,
  2197. As: 1,
  2198. os: 3
  2199. }, {
  2200. id: 38,
  2201. ks: 1,
  2202. ys: 4,
  2203. imageinv: 141,
  2204. image: 140,
  2205. name: "Diamond Spear",
  2206. description: "Long melee range",
  2207. range: 160,
  2208. itemType: ItemType.PRIMARY,
  2209. damage: 53,
  2210. Us: .81,
  2211. Ms: 450,
  2212. reload: 700,
  2213. actionType: ActionType.MELEE,
  2214. ps: 0,
  2215. As: 0,
  2216. os: 2
  2217. }, {
  2218. id: 39,
  2219. gs: 38,
  2220. upgradeType: upgradeType.GOLD,
  2221. ks: 1,
  2222. ys: 4,
  2223. imageinv: 143,
  2224. image: 142,
  2225. name: "Gold Spear",
  2226. description: "Long melee range",
  2227. range: 160,
  2228. itemType: ItemType.PRIMARY,
  2229. damage: 51,
  2230. Us: .81,
  2231. Ms: 450,
  2232. reload: 700,
  2233. actionType: ActionType.MELEE,
  2234. ps: 0,
  2235. As: 0,
  2236. os: 2
  2237. }, {
  2238. id: 40,
  2239. ks: 2,
  2240. ys: 2,
  2241. imageinv: 147,
  2242. image: 148,
  2243. name: "Chillrend",
  2244. description: "A powerful force flows through this blade.",
  2245. range: 140,
  2246. Ms: 150,
  2247. itemType: ItemType.PRIMARY,
  2248. damage: 48.5,
  2249. reload: 300,
  2250. Us: .9,
  2251. actionType: ActionType.MELEE,
  2252. ps: 0,
  2253. As: 1,
  2254. os: 3
  2255. }, {
  2256. id: 41,
  2257. gs: 42,
  2258. upgradeType: upgradeType.GOLD,
  2259. ks: 1,
  2260. ys: 32,
  2261. imageinv: 150,
  2262. image: 149,
  2263. name: "Gold Stick",
  2264. description: "Gathers resources quickly",
  2265. range: 100,
  2266. itemType: ItemType.PRIMARY,
  2267. damage: 1,
  2268. reload: 400,
  2269. actionType: ActionType.MELEE,
  2270. Ms: 60,
  2271. ps: 0,
  2272. As: 4,
  2273. os: 0,
  2274. Es: 8,
  2275. Cs: 8,
  2276. Bs: 8,
  2277. zs: 5
  2278. }, {
  2279. id: 42,
  2280. gs: 43,
  2281. upgradeType: upgradeType.DIAMOND,
  2282. ks: 1,
  2283. ys: 32,
  2284. imageinv: 167,
  2285. image: 151,
  2286. name: "Diamond Stick",
  2287. description: "Gathers resources quickly",
  2288. range: 100,
  2289. itemType: ItemType.PRIMARY,
  2290. damage: 1,
  2291. reload: 400,
  2292. actionType: ActionType.MELEE,
  2293. Ms: 60,
  2294. ps: 0,
  2295. As: 4,
  2296. os: 0,
  2297. Es: 9,
  2298. Cs: 9,
  2299. Bs: 9,
  2300. zs: 6
  2301. }, {
  2302. upgradeType: upgradeType.RUBY,
  2303. id: 43,
  2304. ks: 1,
  2305. ys: 32,
  2306. imageinv: 168,
  2307. image: 152,
  2308. name: "Ruby Stick",
  2309. description: "Gathers resources quickly",
  2310. range: 100,
  2311. itemType: ItemType.PRIMARY,
  2312. damage: 1,
  2313. reload: 400,
  2314. actionType: ActionType.MELEE,
  2315. Ms: 60,
  2316. ps: 0,
  2317. As: 4,
  2318. os: 0,
  2319. Es: 10,
  2320. Cs: 10,
  2321. Bs: 10,
  2322. zs: 7
  2323. }, {
  2324. id: 44,
  2325. ks: 4,
  2326. ys: 4,
  2327. imageinv: 154,
  2328. image: 153,
  2329. name: "Diamond Naginata",
  2330. description: "Long melee range",
  2331. range: 165,
  2332. itemType: ItemType.PRIMARY,
  2333. damage: 56,
  2334. Us: .81,
  2335. Ms: 470,
  2336. reload: 700,
  2337. actionType: ActionType.MELEE,
  2338. ps: 0,
  2339. As: 0,
  2340. os: -4
  2341. }, {
  2342. id: 45,
  2343. gs: 44,
  2344. upgradeType: upgradeType.GOLD,
  2345. ks: 4,
  2346. ys: 4,
  2347. imageinv: 156,
  2348. image: 155,
  2349. name: "Gold Naginata",
  2350. description: "Long melee range",
  2351. range: 165,
  2352. itemType: ItemType.PRIMARY,
  2353. damage: 54,
  2354. Us: .81,
  2355. Ms: 470,
  2356. reload: 700,
  2357. actionType: ActionType.MELEE,
  2358. ps: 0,
  2359. As: 0,
  2360. os: -4
  2361. }, {
  2362. id: 46,
  2363. gs: 47,
  2364. upgradeType: upgradeType.GOLD,
  2365. imageinv: 158,
  2366. image: 157,
  2367. name: "Gold Tool Hammer",
  2368. description: "Gather materials",
  2369. range: 80,
  2370. itemType: ItemType.PRIMARY,
  2371. damage: 32,
  2372. reload: 300,
  2373. _s: 30,
  2374. Ms: 200,
  2375. actionType: ActionType.MELEE,
  2376. ps: 0,
  2377. As: -3.5,
  2378. os: 1
  2379. }, {
  2380. id: 47,
  2381. gs: 48,
  2382. upgradeType: upgradeType.DIAMOND,
  2383. imageinv: 160,
  2384. image: 159,
  2385. name: "Diamond Tool Hammer",
  2386. description: "Gather materials",
  2387. range: 80,
  2388. itemType: ItemType.PRIMARY,
  2389. damage: 38,
  2390. reload: 300,
  2391. _s: 30,
  2392. Ms: 200,
  2393. actionType: ActionType.MELEE,
  2394. ps: 0,
  2395. As: -3.5,
  2396. os: 1
  2397. }, {
  2398. upgradeType: upgradeType.RUBY,
  2399. id: 48,
  2400. imageinv: 162,
  2401. image: 161,
  2402. name: "Ruby Tool Hammer",
  2403. description: "Gather materials",
  2404. range: 80,
  2405. itemType: ItemType.PRIMARY,
  2406. damage: 41,
  2407. reload: 300,
  2408. _s: 30,
  2409. Ms: 200,
  2410. actionType: ActionType.MELEE,
  2411. ps: 0,
  2412. As: -3.5,
  2413. os: 1
  2414. }, {
  2415. id: 49,
  2416. cost: {
  2417. food: 0,
  2418. wood: 20,
  2419. stone: 0,
  2420. gold: 0
  2421. },
  2422. ks: 1,
  2423. imageinv: 170,
  2424. image: 169,
  2425. name: "Roof",
  2426. description: "Take cover from projectiles",
  2427. itemType: ItemType.PLATFORM,
  2428. actionType: ActionType.PLACEABLE,
  2429. Hs: 0,
  2430. As: 0,
  2431. os: 15,
  2432. layer: ELayer.ROOF,
  2433. ps: 2
  2434. }, {
  2435. id: 50,
  2436. cost: {
  2437. food: 80,
  2438. wood: 80,
  2439. stone: 80,
  2440. gold: 80
  2441. },
  2442. ks: 1,
  2443. ys: 256,
  2444. imageinv: 182,
  2445. image: 182,
  2446. name: "Pearl",
  2447. description: "Teleport on impact",
  2448. range: 700,
  2449. itemType: ItemType.SECONDARY,
  2450. damage: 10,
  2451. reload: 1e4,
  2452. projectile: 182,
  2453. Ls: 1e3,
  2454. actionType: ActionType.RANGED,
  2455. ps: 1,
  2456. Us: .4,
  2457. As: 0,
  2458. os: 35
  2459. }, {
  2460. id: 51,
  2461. cost: {
  2462. food: 0,
  2463. wood: 50,
  2464. stone: 50,
  2465. gold: 0
  2466. },
  2467. ks: 2208,
  2468. ys: 1,
  2469. imageinv: 183,
  2470. image: 183,
  2471. name: "Teleporter",
  2472. description: "Teleports to location on map",
  2473. itemType: ItemType.SPAWN,
  2474. actionType: ActionType.PLACEABLE,
  2475. Hs: 5,
  2476. As: 0,
  2477. os: 15,
  2478. layer: ELayer.TELEPORT,
  2479. ps: 2
  2480. }, {
  2481. gs: 53,
  2482. upgradeType: upgradeType.STONE,
  2483. id: 52,
  2484. ks: 1,
  2485. ys: 4096,
  2486. imageinv: 189,
  2487. image: 193,
  2488. name: "Stone Dagger",
  2489. description: "A stubbier sword",
  2490. range: 80,
  2491. Ms: 100,
  2492. itemType: ItemType.PRIMARY,
  2493. damage: 22,
  2494. reload: 150,
  2495. actionType: ActionType.MELEE,
  2496. ps: 0,
  2497. As: 10,
  2498. os: 20
  2499. }, {
  2500. gs: 54,
  2501. upgradeType: upgradeType.GOLD,
  2502. id: 53,
  2503. ks: 1,
  2504. ys: 4096,
  2505. imageinv: 190,
  2506. image: 194,
  2507. name: "Gold Dagger",
  2508. description: "A stubbier sword",
  2509. range: 80,
  2510. Ms: 100,
  2511. itemType: ItemType.PRIMARY,
  2512. damage: 24,
  2513. reload: 150,
  2514. actionType: ActionType.MELEE,
  2515. ps: 0,
  2516. As: 10,
  2517. os: 20
  2518. }, {
  2519. gs: 55,
  2520. upgradeType: upgradeType.DIAMOND,
  2521. id: 54,
  2522. ks: 1,
  2523. ys: 4096,
  2524. imageinv: 191,
  2525. image: 195,
  2526. name: "Diamond Dagger",
  2527. description: "A stubbier sword",
  2528. range: 80,
  2529. Ms: 100,
  2530. itemType: ItemType.PRIMARY,
  2531. damage: 26,
  2532. reload: 150,
  2533. actionType: ActionType.MELEE,
  2534. ps: 0,
  2535. As: 10,
  2536. os: 20
  2537. }, {
  2538. upgradeType: upgradeType.RUBY,
  2539. id: 55,
  2540. ks: 1,
  2541. ys: 4096,
  2542. imageinv: 192,
  2543. image: 196,
  2544. name: "Ruby Dagger",
  2545. description: "A stubbier sword",
  2546. range: 80,
  2547. Ms: 100,
  2548. itemType: ItemType.PRIMARY,
  2549. damage: 29,
  2550. reload: 150,
  2551. actionType: ActionType.MELEE,
  2552. ps: 0,
  2553. As: 10,
  2554. os: 20
  2555. }, {
  2556. id: 56,
  2557. gs: 57,
  2558. upgradeType: upgradeType.GOLD,
  2559. ks: 1,
  2560. ys: 1,
  2561. imageinv: 198,
  2562. image: 198,
  2563. name: "Secret Item",
  2564. description: "Dont leak how to get it :)",
  2565. range: 115,
  2566. itemType: ItemType.PRIMARY,
  2567. damage: 28,
  2568. Us: .92,
  2569. Ms: 1570,
  2570. reload: 2e3,
  2571. actionType: ActionType.MELEE,
  2572. ps: 0,
  2573. As: 40,
  2574. os: 40
  2575. }, {
  2576. id: 57,
  2577. ks: 2,
  2578. ys: 2,
  2579. imageinv: 199,
  2580. image: 199,
  2581. name: "Daedric Scythe",
  2582. description: "Whispers fill the air",
  2583. range: 160,
  2584. Ms: 150,
  2585. itemType: ItemType.PRIMARY,
  2586. damage: 52,
  2587. reload: 450,
  2588. Us: .85,
  2589. actionType: ActionType.MELEE,
  2590. ps: 0,
  2591. As: -5,
  2592. os: 20
  2593. } ];
  2594. const Items = ItemData;
  2595. const ItemList = Items.filter((item => item.actionType === ActionType.PLACEABLE));
  2596. const Shooting = Items.filter((item => item.actionType === ActionType.RANGED));
  2597. class Vector {
  2598. constructor(x, y) {
  2599. this.x = x;
  2600. this.y = y;
  2601. }
  2602. static fromAngle(angle) {
  2603. return new Vector(Math.cos(angle), Math.sin(angle));
  2604. }
  2605. add(vec) {
  2606. this.x += vec.x;
  2607. this.y += vec.y;
  2608. return this;
  2609. }
  2610. sub(vec) {
  2611. this.x -= vec.x;
  2612. this.y -= vec.y;
  2613. return this;
  2614. }
  2615. mult(scalar) {
  2616. this.x *= scalar;
  2617. this.y *= scalar;
  2618. return this;
  2619. }
  2620. div(scalar) {
  2621. this.x /= scalar;
  2622. this.y /= scalar;
  2623. return this;
  2624. }
  2625. get length() {
  2626. return Math.sqrt(this.x * this.x + this.y * this.y);
  2627. }
  2628. normalize() {
  2629. return this.length > 0 ? this.div(this.length) : this;
  2630. }
  2631. setLength(value) {
  2632. return this.normalize().mult(value);
  2633. }
  2634. copy() {
  2635. return new Vector(this.x, this.y);
  2636. }
  2637. distance(vec) {
  2638. return this.copy().sub(vec).length;
  2639. }
  2640. angle(vec) {
  2641. const copy = vec.copy().sub(this);
  2642. return Math.atan2(copy.y, copy.x);
  2643. }
  2644. dot(vec) {
  2645. return this.x * vec.x + this.y * vec.y;
  2646. }
  2647. direction(angle, scalar) {
  2648. return this.copy().add(Vector.fromAngle(angle).mult(scalar));
  2649. }
  2650. }
  2651. const getAngleDist = (a, b) => {
  2652. const p = Math.abs(b - a) % (Math.PI * 2);
  2653. return p > Math.PI ? Math.PI * 2 - p : p;
  2654. };
  2655. class EntityManager {
  2656. static isPlayer(entity) {
  2657. return entity.type === ELayer.PLAYER;
  2658. }
  2659. static animals() {
  2660. const layers = Dsync.saves.entityList();
  2661. const animals = [];
  2662. for (let i = 0; i < Animals.length; i++) {
  2663. const layer = layers[Animals[i].id];
  2664. const formatted = layer.map((target => Formatter.entity(target)));
  2665. animals.push(...formatted);
  2666. }
  2667. return animals;
  2668. }
  2669. static enemies() {
  2670. const players = Dsync.saves.entityList()[ELayer.PLAYER];
  2671. const enemies = [];
  2672. for (let i = 0; i < players.length; i++) {
  2673. const player = Formatter.player(players[i]);
  2674. if (controller.isEnemy(player)) enemies.push(player);
  2675. }
  2676. return enemies.sort(((a, b) => this.sortDistance(a, b)));
  2677. }
  2678. static distance(a, b) {
  2679. return new Vector(a.x2, a.y2).distance(new Vector(b.x2, b.y2));
  2680. }
  2681. static angle(a, b) {
  2682. return new Vector(a.x2, a.y2).angle(new Vector(b.x2, b.y2));
  2683. }
  2684. static sortDistance(a, b, sorted) {
  2685. const target = sorted || Dsync.myPlayer;
  2686. return this.distance(a, target) - this.distance(b, target);
  2687. }
  2688. static shield(a, b, sorted) {
  2689. const target = sorted || Dsync.myPlayer;
  2690. const shieldA = this.lookingAt(a, target, 1.58927) && a.currentItem === EWeapons.SHIELD;
  2691. const shieldB = this.lookingAt(b, target, 1.58927) && b.currentItem === EWeapons.SHIELD;
  2692. return shieldA ? 1 : shieldB ? -1 : 0;
  2693. }
  2694. static canHitEntity(a, b, sorted) {
  2695. const target = sorted || Dsync.myPlayer;
  2696. const hitA = this.projectileCanHitEntity(a, target);
  2697. const hitB = this.projectileCanHitEntity(b, target);
  2698. return hitA === Hit.NEEDDESTROY ? 1 : hitB === Hit.NEEDDESTROY ? -1 : 0;
  2699. }
  2700. static lookingAt(entity, point, angle) {
  2701. const pos1 = new Vector(entity.x2, entity.y2);
  2702. const pos2 = new Vector(point.x2, point.y2);
  2703. const dir = getAngleDist(pos1.angle(pos2) + Math.PI, entity.angle2);
  2704. return dir > angle;
  2705. }
  2706. static entities(sorted) {
  2707. return [ ...this.enemies().sort(((a, b) => this.sortDistance(a, b, sorted))).sort(((a, b) => this.shield(a, b, sorted))), ...this.animals().sort(((a, b) => this.sortDistance(a, b, sorted))) ];
  2708. }
  2709. static predict(entity) {
  2710. const pos1 = new Vector(entity.x1, entity.y1);
  2711. const pos2 = new Vector(entity.x2, entity.y2);
  2712. const distance = pos1.distance(pos2) * (entity === Dsync.myPlayer ? 1 : 2.2);
  2713. const direction = Vector.fromAngle(pos1.angle(pos2));
  2714. return pos2.add(direction.mult(distance));
  2715. }
  2716. static entityIn(entity, layer, extraRadius = 0) {
  2717. const targets = Dsync.saves.entityList()[layer];
  2718. return targets.some((target => {
  2719. const object = Formatter.object(target);
  2720. const radius = entity.radius + object.radius + extraRadius;
  2721. return this.distance(entity, object) <= radius;
  2722. }));
  2723. }
  2724. static intersects(pos1, pos2, pos3, r) {
  2725. const linear = pos2.copy().sub(pos1);
  2726. const constant = pos1.copy().sub(pos3);
  2727. const a = linear.dot(linear);
  2728. const b = linear.dot(constant);
  2729. const c = constant.dot(constant) - r * r;
  2730. return b * b >= a * c && (-b <= a || c + b + b + a <= 0) && (b <= 0 || c <= 0);
  2731. }
  2732. static projectileCanHitEntity(entity, sorted) {
  2733. const target = sorted || Dsync.myPlayer;
  2734. if (!controller.canShoot()) return Hit.CANNOT;
  2735. const pos1 = new Vector(target.x2, target.y2);
  2736. const pos2 = new Vector(entity.x2, entity.y2);
  2737. const myPlayerOnPlatform = this.entityIn(target, ELayer.PLATFORM);
  2738. const entityInRoof = this.entityIn(entity, ELayer.ROOF);
  2739. if (myPlayerOnPlatform && entityInRoof) return Hit.CANNOT;
  2740. const layers = Dsync.saves.entityList();
  2741. for (const layer of LayerObjects) {
  2742. if (myPlayerOnPlatform && !layer.cannotShoot) continue;
  2743. for (const target of layers[layer.id]) {
  2744. const object = Formatter.object(target);
  2745. const pos3 = new Vector(object.x2, object.y2);
  2746. if (pos1.distance(pos3) > pos1.distance(pos2)) continue;
  2747. if (this.intersects(pos1, pos2, pos3, object.radius)) {
  2748. if (object.layerData.maxHealth === undefined) return Hit.CANNOT;
  2749. return Hit.NEEDDESTROY;
  2750. }
  2751. }
  2752. }
  2753. return Hit.CAN;
  2754. }
  2755. static inWeaponRange(entity1, entity2, weapon) {
  2756. const range = Items[weapon].range || 0;
  2757. return this.distance(entity1, entity2) <= range + entity2.radius;
  2758. }
  2759. static nearestPossible(weapon, sorted) {
  2760. const target = sorted || Dsync.myPlayer;
  2761. const item = Items[weapon];
  2762. const shoot = controller.canShoot() && item.actionType === ActionType.RANGED;
  2763. const entities = this.entities().filter((entity => shoot ? this.projectileCanHitEntity(entity, target) : this.inWeaponRange(target, entity, weapon)));
  2764. if (shoot) {
  2765. entities.sort(((a, b) => this.canHitEntity(a, b, target)));
  2766. }
  2767. return entities.length ? entities[0] : null;
  2768. }
  2769. static nearestLayer(entity, layer) {
  2770. const objects = Dsync.saves.entityList()[layer].map((target => Formatter.object(target)));
  2771. return objects.sort(((a, b) => this.sortDistance(a, b, entity)))[0];
  2772. }
  2773. }
  2774. const attackAnimation = () => {
  2775. if (!Settings.weaponReloadBar && !Settings.autosync) return;
  2776. const b = Dsync.saves.buffer;
  2777. const len = Dsync.saves.byteLength;
  2778. const players = Dsync.saves.players();
  2779. for (let i = 1; i < len; i += 5) {
  2780. const type = b[i];
  2781. const id = b[i + 1] | b[i + 2] << 8;
  2782. const weapon = b[i + 3];
  2783. const isObject = b[i + 4];
  2784. const target = players.get(id);
  2785. if (type === ELayer.PLAYER && target) {
  2786. if (Settings.weaponReloadBar) {
  2787. const reload = target.weaponReload;
  2788. reload.current = -Dsync.step;
  2789. reload.lerp = 0;
  2790. reload.max = Items[weapon].reload || 0;
  2791. }
  2792. if (Settings.autosync && controller.canAutosync()) {
  2793. const player = Formatter.player(target);
  2794. if (controller.isTeammate(player) && controller.isPrimary(weapon)) {
  2795. const nearest = EntityManager.nearestPossible(weapon, player);
  2796. if (nearest !== null && EntityManager.inWeaponRange(Dsync.myPlayer, nearest, controller.itemBar[0])) {
  2797. const previousWeapon = controller.weapon;
  2798. controller.whichWeapon(false);
  2799. controller.attack(EntityManager.angle(Dsync.myPlayer, nearest));
  2800. controller.PacketManager.stopAttack();
  2801. controller.whichWeapon(previousWeapon);
  2802. controller.PacketManager.changeAngle(controller.mouse.angle);
  2803. }
  2804. }
  2805. }
  2806. }
  2807. }
  2808. };
  2809. const hooks_attackAnimation = attackAnimation;
  2810. let teammates = [];
  2811. const createClan = () => {
  2812. const b = Dsync.saves.buffer;
  2813. const len = Dsync.saves.byteLength;
  2814. teammates = [ ...b.slice(3, len) ];
  2815. };
  2816. const updateClan = () => {
  2817. const b = Dsync.saves.buffer;
  2818. const len = Dsync.saves.byteLength;
  2819. teammates = [ ...b.slice(2, len) ];
  2820. };
  2821. const deleteClan = () => {
  2822. teammates = [];
  2823. };
  2824. const playerStats = () => {
  2825. const b = Dsync.saves.buffer;
  2826. const age = formatAge(b[1] | b[2] << 8 | b[3] << 16 | b[4] << 24);
  2827. const food = b[5] | b[6] << 8 | b[7] << 16 | b[8] << 24;
  2828. const wood = b[9] | b[10] << 8 | b[11] << 16 | b[12] << 24;
  2829. const stone = b[13] | b[14] << 8 | b[15] << 16 | b[16] << 24;
  2830. const gold = b[17] | b[18] << 8 | b[19] << 16 | b[20] << 24;
  2831. if (age !== 0) {
  2832. controller.age = age;
  2833. }
  2834. controller.resources = {
  2835. food,
  2836. wood,
  2837. stone,
  2838. gold
  2839. };
  2840. };
  2841. const hooks_playerStats = playerStats;
  2842. const stringMessage = data => {
  2843. const id = data[0];
  2844. if (id === WebsocketServer.SPAWN) {
  2845. controller.myPlayerID = data[1];
  2846. controller.reset(data[4]);
  2847. controller.inGame = true;
  2848. controller.automillSpawn = true;
  2849. if (Settings.lastHat) {
  2850. const hat = controller.toggleJungle || controller.toggleScuba ? controller.previousHat : controller.actualHat;
  2851. controller.equipHat(hat, true, true);
  2852. }
  2853. }
  2854. if (id === WebsocketServer.UPGRADE) {
  2855. const bar = data[1];
  2856. const canAutobed = Settings.autobed && bar.includes(EObjects.SPAWN);
  2857. controller.autobed = canAutobed;
  2858. if (Settings.skipUpgrades && bar.length === 1 || canAutobed) {
  2859. controller.PacketManager.upgrade(canAutobed ? EObjects.SPAWN : bar[0]);
  2860. }
  2861. }
  2862. if (id === WebsocketServer.DIED) {
  2863. controller.myPlayerID = 0;
  2864. controller.inGame = false;
  2865. if (Settings.autospawn) {
  2866. controller.spawn();
  2867. }
  2868. }
  2869. if (id === WebsocketServer.KILL_UPDATE) {
  2870. controller.kills = data[1][0];
  2871. }
  2872. if (id === WebsocketServer.KILLED && Settings.kill) {
  2873. const killMessage = Settings.killMessage.length ? Settings.killMessage : "{KILL}x";
  2874. const name = data[1].replace(/^Killed\s/, "").trim();
  2875. const message = killMessage.replace(/\{KILL\}/g, controller.kills + "").replace(/\{NAME\}/g, name);
  2876. controller.PacketManager.chat(message);
  2877. }
  2878. };
  2879. const hooks_stringMessage = stringMessage;
  2880. var WebsocketServer;
  2881. (function(WebsocketServer) {
  2882. WebsocketServer[WebsocketServer["LEADERBOARD"] = 3] = "LEADERBOARD";
  2883. WebsocketServer[WebsocketServer["DAMAGE"] = 6] = "DAMAGE";
  2884. WebsocketServer[WebsocketServer["PLAYERSTATS"] = 8] = "PLAYERSTATS";
  2885. WebsocketServer[WebsocketServer["CONNECT"] = 12] = "CONNECT";
  2886. WebsocketServer[WebsocketServer["UPGRADE"] = 14] = "UPGRADE";
  2887. WebsocketServer[WebsocketServer["UPDATECLAN"] = 16] = "UPDATECLAN";
  2888. WebsocketServer[WebsocketServer["DIED"] = 19] = "DIED";
  2889. WebsocketServer[WebsocketServer["MOVEUPDATE"] = 20] = "MOVEUPDATE";
  2890. WebsocketServer[WebsocketServer["KILL_UPDATE"] = 22] = "KILL_UPDATE";
  2891. WebsocketServer[WebsocketServer["JOINCREATECLAN"] = 24] = "JOINCREATECLAN";
  2892. WebsocketServer[WebsocketServer["DELETECLAN"] = 27] = "DELETECLAN";
  2893. WebsocketServer[WebsocketServer["KILLED"] = 28] = "KILLED";
  2894. WebsocketServer[WebsocketServer["ATTACK_ANIMATION"] = 29] = "ATTACK_ANIMATION";
  2895. WebsocketServer[WebsocketServer["PLAYER_SPAWNED"] = 32] = "PLAYER_SPAWNED";
  2896. WebsocketServer[WebsocketServer["DEFAULT"] = 33] = "DEFAULT";
  2897. WebsocketServer[WebsocketServer["SPAWN"] = 35] = "SPAWN";
  2898. })(WebsocketServer || (WebsocketServer = {}));
  2899. var WebsocketClient;
  2900. (function(WebsocketClient) {
  2901. WebsocketClient[WebsocketClient["MOVE"] = 6] = "MOVE";
  2902. WebsocketClient[WebsocketClient["ANGLE"] = 13] = "ANGLE";
  2903. WebsocketClient[WebsocketClient["selectByID"] = 2] = "selectByID";
  2904. WebsocketClient[WebsocketClient["ATTACK"] = 19] = "ATTACK";
  2905. WebsocketClient[WebsocketClient["STOPATTACK"] = 18] = "STOPATTACK";
  2906. WebsocketClient[WebsocketClient["LOGIN"] = 10] = "LOGIN";
  2907. WebsocketClient[WebsocketClient["SCYTHE"] = 20] = "SCYTHE";
  2908. WebsocketClient[WebsocketClient["SELECTITEM"] = 0] = "SELECTITEM";
  2909. WebsocketClient[WebsocketClient["HAT"] = 5] = "HAT";
  2910. WebsocketClient[WebsocketClient["CHAT"] = 7] = "CHAT";
  2911. WebsocketClient[WebsocketClient["UPGRADE"] = 14] = "UPGRADE";
  2912. WebsocketClient[WebsocketClient["AUTOATTACK"] = 23] = "AUTOATTACK";
  2913. WebsocketClient[WebsocketClient["MOVEANGLE"] = 1] = "MOVEANGLE";
  2914. WebsocketClient[WebsocketClient["LEAVECLAN"] = 24] = "LEAVECLAN";
  2915. WebsocketClient[WebsocketClient["JOIN"] = 21] = "JOIN";
  2916. WebsocketClient[WebsocketClient["ACCEPTDECLINE"] = 17] = "ACCEPTDECLINE";
  2917. WebsocketClient[WebsocketClient["KICK"] = 25] = "KICK";
  2918. WebsocketClient[WebsocketClient["CREATECLAN"] = 22] = "CREATECLAN";
  2919. })(WebsocketClient || (WebsocketClient = {}));
  2920. window.Uint8Array = new Proxy(window.Uint8Array, {
  2921. construct(target, args) {
  2922. const uint = new target(...args);
  2923. if (args[0] === 4096) {
  2924. Dsync.saves.buffer = uint;
  2925. window.Uint8Array = target;
  2926. }
  2927. return uint;
  2928. }
  2929. });
  2930. const proto = Uint8Array.__proto__;
  2931. const getter = Object.getOwnPropertyDescriptor(proto.prototype, "byteLength")?.get;
  2932. Object.defineProperty(Uint8Array.prototype, "byteLength", {
  2933. get() {
  2934. const value = getter.call(this);
  2935. Dsync.saves.byteLength = value;
  2936. return value;
  2937. }
  2938. });
  2939. let start = Date.now();
  2940. window.WebSocket = new Proxy(window.WebSocket, {
  2941. construct(target, args) {
  2942. if (typeof args[0] === "string") {
  2943. if (args[0] !== Dsync.connectURL) {
  2944. controller.myPlayerID = 0;
  2945. controller.age = 0;
  2946. for (const hat of Hats) {
  2947. hat.bought = !!hat.default;
  2948. hat.equipped = !!hat.default;
  2949. }
  2950. }
  2951. Dsync.connectURL = args[0];
  2952. }
  2953. const ws = new target(...args);
  2954. ws.addEventListener("message", (event => {
  2955. const data = event.data;
  2956. if (typeof data === "string" && /^\[.+\]$/.test(data)) {
  2957. hooks_stringMessage(JSON.parse(data));
  2958. } else {
  2959. switch (Dsync.saves.buffer[0]) {
  2960. case WebsocketServer.PLAYERSTATS:
  2961. hooks_playerStats();
  2962. break;
  2963. case WebsocketServer.DELETECLAN:
  2964. deleteClan();
  2965. break;
  2966. case WebsocketServer.JOINCREATECLAN:
  2967. createClan();
  2968. break;
  2969. case WebsocketServer.UPDATECLAN:
  2970. updateClan();
  2971. break;
  2972. case WebsocketServer.MOVEUPDATE:
  2973. {
  2974. const now = Date.now();
  2975. Dsync.step = now - start;
  2976. start = now;
  2977. break;
  2978. }
  2979. case WebsocketServer.ATTACK_ANIMATION:
  2980. hooks_attackAnimation();
  2981. break;
  2982. }
  2983. }
  2984. }));
  2985. return ws;
  2986. }
  2987. });
  2988. class PacketManager {
  2989. constructor() {
  2990. this.encoder = new TextEncoder;
  2991. }
  2992. send(...args) {
  2993. Dsync.saves.send(new Uint8Array(args));
  2994. }
  2995. moveByBitmask(bitmask) {
  2996. this.send(WebsocketClient.MOVE, bitmask);
  2997. }
  2998. changeAngle(angle) {
  2999. angle = 65535 * (angle + Math.PI) / (2 * Math.PI), this.send(WebsocketClient.ANGLE, 255 & angle, angle >> 8 & 255);
  3000. }
  3001. selectByID(id) {
  3002. this.send(WebsocketClient.selectByID, id);
  3003. }
  3004. attack(angle) {
  3005. angle = 65535 * (angle + Math.PI) / (2 * Math.PI), this.send(WebsocketClient.ATTACK, 255 & angle, angle >> 8 & 255);
  3006. }
  3007. stopAttack() {
  3008. this.send(WebsocketClient.STOPATTACK);
  3009. }
  3010. upgradeScythe(goldenCowID) {
  3011. this.send(WebsocketClient.SCYTHE, 255 & goldenCowID, goldenCowID >> 8);
  3012. }
  3013. selectItemByType(type) {
  3014. this.send(WebsocketClient.SELECTITEM, type);
  3015. }
  3016. equip(id) {
  3017. this.send(WebsocketClient.HAT, id);
  3018. }
  3019. chat(message) {
  3020. const bytes = this.encoder.encode(message);
  3021. this.send(WebsocketClient.CHAT, ...bytes);
  3022. }
  3023. upgrade(id) {
  3024. this.send(WebsocketClient.UPGRADE, id);
  3025. controller.upgradeItem(id);
  3026. }
  3027. autoattack(toggle) {
  3028. this.send(WebsocketClient.AUTOATTACK, Number(toggle));
  3029. }
  3030. moveAngle(angle) {
  3031. angle = 65535 * (angle + Math.PI) / (2 * Math.PI), this.send(WebsocketClient.MOVEANGLE, 255 & angle, angle >> 8 & 255);
  3032. }
  3033. leaveClan() {
  3034. this.send(WebsocketClient.LEAVECLAN);
  3035. }
  3036. joinClan(id) {
  3037. this.send(WebsocketClient.JOIN, id);
  3038. }
  3039. accept(which) {
  3040. this.send(WebsocketClient.ACCEPTDECLINE, which);
  3041. }
  3042. kick(id) {
  3043. this.send(WebsocketClient.KICK, id);
  3044. }
  3045. createClan(name) {
  3046. const bytes = this.encoder.encode(name);
  3047. this.send(WebsocketClient.CREATECLAN, ...bytes);
  3048. }
  3049. }
  3050. class TimeoutManager {
  3051. constructor(callbacks, delay) {
  3052. this.callbacks = callbacks;
  3053. this.delay = delay;
  3054. this.active = false;
  3055. this.old = Date.now();
  3056. }
  3057. static waitUntil(condition, time, callback) {
  3058. return new Promise((resolve => {
  3059. const start = Date.now();
  3060. const int = setInterval((() => {
  3061. if (typeof time === "number" && Number.isFinite(time) && Date.now() - start > time || condition()) {
  3062. clearInterval(int);
  3063. }
  3064. if (condition()) {
  3065. if (typeof callback === "function") return callback();
  3066. resolve();
  3067. }
  3068. }), 50);
  3069. }));
  3070. }
  3071. start() {
  3072. if (this.active) return;
  3073. this.active = true;
  3074. this.old = Date.now();
  3075. this.callbacks[0]();
  3076. }
  3077. async stop() {
  3078. if (!this.active) return;
  3079. this.callbacks[1]();
  3080. if (!this.delay(this.old)) await TimeoutManager.waitUntil((() => this.delay(this.old)), 3e3);
  3081. this.callbacks[2]();
  3082. this.active = false;
  3083. }
  3084. isActive() {
  3085. return this.active;
  3086. }
  3087. }
  3088. class Controller {
  3089. constructor() {
  3090. this.myPlayerID = 0;
  3091. this.move = 0;
  3092. this.attacking = false;
  3093. this.autoattack = false;
  3094. this.rotation = false;
  3095. this.weapon = false;
  3096. this.healing = false;
  3097. this.attackingInvis = false;
  3098. this.toggleInvis = false;
  3099. this.currentItem = null;
  3100. this.chatToggle = false;
  3101. this.chatCount = 0;
  3102. this.autobed = false;
  3103. this.automill = false;
  3104. this.automillSpawn = false;
  3105. this.mousemove = true;
  3106. this.kills = 0;
  3107. this.inGame = false;
  3108. this.itemBar = [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ];
  3109. this.hsl = 0;
  3110. this.aimTarget = null;
  3111. this.wasAutoboost = false;
  3112. this.count = 0;
  3113. this.toggleJungle = false;
  3114. this.toggleScuba = false;
  3115. this.resources = {
  3116. food: 200,
  3117. wood: 200,
  3118. stone: 200,
  3119. gold: 200
  3120. };
  3121. this.mouse = {
  3122. x: 0,
  3123. y: 0,
  3124. angle: 0
  3125. };
  3126. this.equipStart = Date.now();
  3127. this.actualHat = 0;
  3128. this.currentHat = 0;
  3129. this.previousHat = 0;
  3130. this.maxCount = [ 0, 0, 0, 100, 30, 8, 2, 12, 32, 1, 2 ];
  3131. this.age = 0;
  3132. this.hotkeys = new Map;
  3133. this.PacketManager = new PacketManager;
  3134. this.previousWeapon = false;
  3135. this.fastbreak = new TimeoutManager([ () => {
  3136. const primary = this.itemBar[ItemType.PRIMARY];
  3137. const secondary = this.itemBar[ItemType.SECONDARY];
  3138. const pickWeapon = secondary === EWeapons.HAMMER || primary === EWeapons.STICK && secondary === EWeapons.SHIELD;
  3139. this.previousWeapon = this.weapon;
  3140. this.whichWeapon(pickWeapon);
  3141. this.equipHat(Hat.DEMOLIST, false);
  3142. this.attacking = true;
  3143. this.attack();
  3144. }, () => {
  3145. this.PacketManager.stopAttack();
  3146. this.attacking = false;
  3147. this.whichWeapon(this.previousWeapon);
  3148. }, () => {
  3149. if (!Dsync.myPlayer.isClown) {
  3150. this.equipHat(this.previousHat, true);
  3151. }
  3152. } ], (start => this.hatReloaded() && Date.now() - start > TargetReload.HAT));
  3153. this.attachMouse();
  3154. }
  3155. reset(items) {
  3156. this.move = 0;
  3157. this.attacking = false;
  3158. this.autoattack = false;
  3159. this.rotation = false;
  3160. this.weapon = false;
  3161. this.healing = false;
  3162. this.attackingInvis = false;
  3163. this.toggleInvis = false;
  3164. this.currentItem = null;
  3165. this.chatToggle = false;
  3166. this.chatCount = 0;
  3167. this.autobed = false;
  3168. this.automill = false;
  3169. this.automillSpawn = false;
  3170. this.mousemove = true;
  3171. this.kills = 0;
  3172. this.inGame = false;
  3173. this.itemBar = [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ];
  3174. this.hsl = 0;
  3175. this.aimTarget = null;
  3176. this.count = 0;
  3177. for (const id of items) {
  3178. this.upgradeItem(id);
  3179. }
  3180. for (const [key] of this.hotkeys) {
  3181. this.hotkeys.delete(key);
  3182. }
  3183. }
  3184. attachMouse() {
  3185. window.addEventListener("mousemove", (event => {
  3186. this.mouse.x = event.clientX;
  3187. this.mouse.y = event.clientY;
  3188. if (!this.rotation) {
  3189. this.mouse.angle = angle(innerWidth / 2, innerHeight / 2, this.mouse.x, this.mouse.y);
  3190. }
  3191. }));
  3192. }
  3193. hasItem(type) {
  3194. return this.itemBar[type] !== -1;
  3195. }
  3196. hasSecondary() {
  3197. return this.itemBar[ItemType.SECONDARY] !== -1;
  3198. }
  3199. updateWeapon(type) {
  3200. const weapon = Dsync.saves.defaultData[Dsync.props.itemBar][type];
  3201. if (this.isWeapon(weapon) && this.itemBar[type] !== weapon) {
  3202. this.itemBar[type] = weapon;
  3203. }
  3204. }
  3205. isMyPlayer(entity) {
  3206. return entity.id === this.myPlayerID;
  3207. }
  3208. isTeammate(entity) {
  3209. return entity.id !== this.myPlayerID && teammates.includes(entity.ownerID);
  3210. }
  3211. isEnemy(entity) {
  3212. return !this.isMyPlayer(entity) && !this.isTeammate(entity);
  3213. }
  3214. canShoot() {
  3215. const id = this.itemBar[ItemType.SECONDARY];
  3216. return this.hasSecondary() && Items[id].actionType === ActionType.RANGED;
  3217. }
  3218. isWeapon(id) {
  3219. const type = Items[id].itemType;
  3220. return type === ItemType.PRIMARY || type === ItemType.SECONDARY;
  3221. }
  3222. isPrimary(id) {
  3223. return Items[id].itemType === ItemType.PRIMARY;
  3224. }
  3225. isSecondary(id) {
  3226. return Items[id].itemType === ItemType.SECONDARY;
  3227. }
  3228. currentCount(type) {
  3229. return Dsync.saves.defaultData[Dsync.props.currentCount][type];
  3230. }
  3231. hasCount(type) {
  3232. return this.currentCount(type) < this.maxCount[type];
  3233. }
  3234. isDoingNothing() {
  3235. return !this.healing && !this.attackingInvis && !this.toggleInvis && !this.attacking && this.currentItem === null;
  3236. }
  3237. canAutosync() {
  3238. return !this.attacking && !this.attackingInvis && !this.toggleInvis && !this.autoattack;
  3239. }
  3240. hasResources(id) {
  3241. const cost = Items[id].cost || {
  3242. food: 0,
  3243. wood: 0,
  3244. stone: 0,
  3245. gold: 0
  3246. };
  3247. const {food, wood, stone, gold} = this.resources;
  3248. const hasFood = food >= cost.food;
  3249. const hasWood = wood >= cost.wood;
  3250. const hasStone = stone >= cost.stone;
  3251. const hasGold = gold >= cost.gold;
  3252. return hasFood && hasWood && hasStone && hasGold;
  3253. }
  3254. getAngleFromBitmask(bitmask, rotate) {
  3255. const vec = {
  3256. x: 0,
  3257. y: 0
  3258. };
  3259. if (bitmask & 1) vec.y--;
  3260. if (bitmask & 2) vec.y++;
  3261. if (bitmask & 4) vec.x--;
  3262. if (bitmask & 8) vec.x++;
  3263. if (rotate) {
  3264. vec.x *= -1;
  3265. vec.y *= -1;
  3266. }
  3267. return Math.atan2(vec.y, vec.x);
  3268. }
  3269. upgradeItem(id) {
  3270. const item = Items[id];
  3271. this.itemBar[item.itemType] = id;
  3272. }
  3273. upgradeScythe() {
  3274. const target = Dsync.saves.entityList()[ELayer.GOLDENCOW][0];
  3275. if (target !== undefined) {
  3276. this.PacketManager.upgradeScythe(target[Dsync.props.id]);
  3277. }
  3278. }
  3279. buyHat(id) {
  3280. if (!Hats[id].bought && controller.resources.gold >= Hats[id].price) {
  3281. Hats[id].bought = true;
  3282. this.PacketManager.equip(id);
  3283. }
  3284. return Hats[id].bought;
  3285. }
  3286. hatReloaded() {
  3287. return Dsync.myPlayer.target.hatReload.current === TargetReload.HAT;
  3288. }
  3289. equipHat(id, actual = true, force = false) {
  3290. const hatID = id === Hat.UNEQUIP ? this.actualHat : id;
  3291. if (!this.buyHat(hatID) || !this.inGame) return false;
  3292. const now = Date.now();
  3293. if (!Hats[id].equipped && this.hatReloaded() && now - this.equipStart >= TargetReload.HAT || force) {
  3294. this.equipStart = now;
  3295. this.PacketManager.equip(hatID);
  3296. for (const hat of Hats) {
  3297. hat.equipped = false;
  3298. }
  3299. Hats[id].equipped = true;
  3300. this.previousHat = this.currentHat;
  3301. this.currentHat = id;
  3302. if (actual) {
  3303. this.actualHat = id;
  3304. }
  3305. return true;
  3306. }
  3307. return false;
  3308. }
  3309. async autochat() {
  3310. if (this.chatToggle) return;
  3311. this.chatToggle = true;
  3312. const messages = Settings.autochatMessages.filter((msg => msg.length));
  3313. if (!messages.length) return;
  3314. this.PacketManager.chat(messages[this.chatCount++]);
  3315. this.chatCount %= messages.length;
  3316. await sleep(2e3);
  3317. this.chatToggle = false;
  3318. }
  3319. accept(which) {
  3320. this.PacketManager.accept(which);
  3321. const acceptList = Dsync.saves.clanData[Dsync.props.acceptList];
  3322. acceptList.shift();
  3323. }
  3324. async spawn() {
  3325. await sleep(100);
  3326. const play = document.querySelector("#play");
  3327. play.click();
  3328. }
  3329. whichWeapon(type) {
  3330. if (type !== undefined) {
  3331. this.weapon = type;
  3332. }
  3333. this.PacketManager.selectByID(this.itemBar[+this.weapon]);
  3334. }
  3335. attack(angle) {
  3336. const dir = angle ? angle : this.mouse.angle;
  3337. this.PacketManager.attack(dir);
  3338. }
  3339. place(type, angle, placementType) {
  3340. if (this.wasAutoboost) {
  3341. const nearest = EntityManager.enemies()[0];
  3342. if (nearest !== undefined) {
  3343. angle = EntityManager.angle(Dsync.myPlayer, nearest);
  3344. this.PacketManager.moveAngle(angle);
  3345. }
  3346. }
  3347. const placeType = placementType === undefined ? Settings.placementType : placementType;
  3348. const isHolding = placeType === PlacementType.HOLDING;
  3349. this.whichWeapon();
  3350. if (isHolding && this.attacking) this.attack(angle);
  3351. this.PacketManager.selectItemByType(type);
  3352. this.attack(angle);
  3353. this.PacketManager.stopAttack();
  3354. if (!isHolding) this.whichWeapon();
  3355. if (this.attacking) this.attack(angle);
  3356. }
  3357. placement() {
  3358. if (this.currentItem === null) return;
  3359. this.place(this.currentItem);
  3360. this.count = (this.count + 1) % Settings.placementSpeed;
  3361. const method = this.count === 0 ? setTimeout : queueMicrotask;
  3362. method(this.placement.bind(this));
  3363. }
  3364. placementHandler(type, code) {
  3365. if (!this.hasItem(type)) return;
  3366. if (Settings.placementType === PlacementType.DEFAULT) {
  3367. this.PacketManager.selectItemByType(type);
  3368. return;
  3369. }
  3370. this.hotkeys.set(code, type);
  3371. this.currentItem = type;
  3372. const isBoost = type === ItemType.TRAP && this.itemBar[ItemType.TRAP] === EObjects.BOOST;
  3373. this.wasAutoboost = Settings.autoboostFollow && isBoost;
  3374. if (this.hotkeys.size === 1) {
  3375. this.placement();
  3376. }
  3377. }
  3378. heal() {
  3379. this.PacketManager.selectItemByType(ItemType.FOOD);
  3380. this.attack();
  3381. this.PacketManager.stopAttack();
  3382. this.whichWeapon();
  3383. if (this.attacking) {
  3384. this.attack();
  3385. }
  3386. }
  3387. invisibleHit() {
  3388. this.mousemove = true;
  3389. this.aimTarget = null;
  3390. if (Settings.invisHitToggle && !this.toggleInvis || !Settings.invisHitToggle && !this.attackingInvis) {
  3391. this.toggleInvis = false;
  3392. this.attackingInvis = false;
  3393. return;
  3394. }
  3395. let angle;
  3396. const nearest = EntityManager.nearestPossible(this.itemBar[+!this.weapon]);
  3397. const shoot = this.canShoot() && !this.weapon;
  3398. if (nearest && (Settings.meleeAim && !shoot || Settings.bowAim && shoot)) {
  3399. const pos1 = EntityManager.predict(Dsync.myPlayer);
  3400. const pos2 = EntityManager.predict(nearest);
  3401. angle = pos1.angle(pos2);
  3402. this.mousemove = false;
  3403. this.aimTarget = nearest.target;
  3404. }
  3405. if (nearest && shoot || !shoot) {
  3406. this.whichWeapon(!this.weapon);
  3407. this.attack(angle);
  3408. this.PacketManager.stopAttack();
  3409. this.whichWeapon(!this.weapon);
  3410. }
  3411. setTimeout(this.invisibleHit.bind(this), 85);
  3412. }
  3413. spikeInsta() {
  3414. let angle;
  3415. if (Settings.spikeInstaAim) {
  3416. const nearest = EntityManager.nearestPossible(this.itemBar[0]);
  3417. if (nearest) {
  3418. angle = EntityManager.angle(Dsync.myPlayer, nearest);
  3419. }
  3420. }
  3421. const previousWeapon = this.weapon;
  3422. this.equipHat(Hat.BERSERKER);
  3423. this.whichWeapon(false);
  3424. this.place(ItemType.SPIKE, angle);
  3425. this.attack(angle);
  3426. this.PacketManager.stopAttack();
  3427. this.whichWeapon(previousWeapon);
  3428. }
  3429. handleKeydown(event, code) {
  3430. if (code === 1) event.preventDefault();
  3431. if (event instanceof KeyboardEvent && event.repeat) return;
  3432. if (Dsync.active) return;
  3433. if (code === Settings.toggleMenu && !isInput(event.target)) {
  3434. if (typeof Dsync.toggleMenu === "function") Dsync.toggleMenu();
  3435. }
  3436. if (!this.inGame) return;
  3437. if (code === Settings.openChat) {
  3438. if (!isInput()) event.preventDefault();
  3439. Dsync.saves.toggleChat();
  3440. }
  3441. if (isInput(event.target)) return;
  3442. if (code === Settings.primary) this.whichWeapon(false);
  3443. if (code === Settings.secondary && this.hasSecondary()) this.whichWeapon(true);
  3444. if (code === Settings.heal && !this.healing) {
  3445. this.healing = true;
  3446. if (Settings.placementType === PlacementType.DEFAULT) {
  3447. this.PacketManager.selectItemByType(ItemType.FOOD);
  3448. } else {
  3449. doWhile((() => this.healing), this.heal.bind(this), 0);
  3450. }
  3451. }
  3452. if (code === Settings.wall) this.placementHandler(ItemType.WALL, code);
  3453. if (code === Settings.spike) this.placementHandler(ItemType.SPIKE, code);
  3454. if (code === Settings.windmill) this.placementHandler(ItemType.WINDMILL, code);
  3455. if (code === Settings.trap) this.placementHandler(ItemType.TRAP, code);
  3456. if (code === Settings.turret) this.placementHandler(ItemType.TURRET, code);
  3457. if (code === Settings.tree) this.placementHandler(ItemType.FARM, code);
  3458. if (code === Settings.platform) this.placementHandler(ItemType.PLATFORM, code);
  3459. if (code === Settings.spawn) this.placementHandler(ItemType.SPAWN, code);
  3460. if (code === Settings.unequip) this.equipHat(Hat.UNEQUIP);
  3461. if (code === Settings.bush) this.equipHat(Hat.BUSH);
  3462. if (code === Settings.berserker) this.equipHat(Hat.BERSERKER);
  3463. if (code === Settings.jungle) this.equipHat(Hat.JUNGLE);
  3464. if (code === Settings.crystal) this.equipHat(Hat.CRYSTAL);
  3465. if (code === Settings.spikegear) this.equipHat(Hat.SPIKEGEAR);
  3466. if (code === Settings.immunity) this.equipHat(Hat.IMMUNITY);
  3467. if (code === Settings.boost) this.equipHat(Hat.BOOST);
  3468. if (code === Settings.applehat) this.equipHat(Hat.APPLEHAT);
  3469. if (code === Settings.scuba) this.equipHat(Hat.SCUBA);
  3470. if (code === Settings.hood) this.equipHat(Hat.HOOD);
  3471. if (code === Settings.demolist) this.equipHat(Hat.DEMOLIST);
  3472. if (code === Settings.invisibleHit && this.hasSecondary()) {
  3473. if (Settings.invisHitToggle) {
  3474. this.toggleInvis = !this.toggleInvis;
  3475. } else {
  3476. this.attackingInvis = true;
  3477. }
  3478. if (this.toggleInvis || this.attackingInvis) this.invisibleHit();
  3479. }
  3480. if (code === Settings.spikeInsta) this.spikeInsta();
  3481. if (code === Settings.fastBreak && !this.fastbreak.isActive() && this.hatReloaded()) {
  3482. this.fastbreak.start();
  3483. }
  3484. const copyMove = this.move;
  3485. if (code === Settings.up) this.move |= 1;
  3486. if (code === Settings.left) this.move |= 4;
  3487. if (code === Settings.down) this.move |= 2;
  3488. if (code === Settings.right) this.move |= 8;
  3489. if (copyMove !== this.move) this.PacketManager.moveByBitmask(this.move);
  3490. if (event instanceof MouseEvent && code === 0) {
  3491. this.attacking = true;
  3492. }
  3493. if (code === Settings.autoattack) {
  3494. this.autoattack = !this.autoattack;
  3495. this.PacketManager.autoattack(this.autoattack);
  3496. }
  3497. if (code === Settings.lockRotation) {
  3498. this.rotation = !this.rotation;
  3499. Dsync.saves.toggleRotation(this.rotation);
  3500. }
  3501. if (code === Settings.upgradeScythe) this.upgradeScythe();
  3502. }
  3503. handleKeyup(event, code) {
  3504. if (code === Settings.heal && this.healing) {
  3505. this.healing = false;
  3506. }
  3507. if (code === Settings.invisibleHit && this.attackingInvis) {
  3508. this.attackingInvis = false;
  3509. }
  3510. if (code === Settings.fastBreak && this.fastbreak.isActive()) {
  3511. this.fastbreak.stop();
  3512. }
  3513. const copyMove = this.move;
  3514. if (code === Settings.up) this.move &= -2;
  3515. if (code === Settings.left) this.move &= -5;
  3516. if (code === Settings.down) this.move &= -3;
  3517. if (code === Settings.right) this.move &= -9;
  3518. if (copyMove !== this.move) this.PacketManager.moveByBitmask(this.move);
  3519. if (event instanceof MouseEvent && code === 0) {
  3520. this.attacking = false;
  3521. }
  3522. if (code === Settings.trap && this.wasAutoboost) {
  3523. this.wasAutoboost = false;
  3524. this.PacketManager.moveByBitmask(this.move);
  3525. }
  3526. if (this.currentItem !== null && this.hotkeys.delete(code)) {
  3527. const entries = [ ...this.hotkeys ];
  3528. this.currentItem = entries.length ? entries[entries.length - 1][1] : null;
  3529. if (this.currentItem === null) {
  3530. this.whichWeapon();
  3531. }
  3532. }
  3533. }
  3534. }
  3535. const createEntity = target => {
  3536. const id = target[Dsync.props.id];
  3537. const type = target.type;
  3538. const entities = Dsync.saves.entityList();
  3539. if (type === ELayer.PLAYER) {
  3540. if (id === controller.myPlayerID) {
  3541. Dsync.myPlayer.target = target;
  3542. updateSkin();
  3543. }
  3544. const player = Formatter.player(target);
  3545. target.hatReload = {
  3546. ...Reload.hat
  3547. };
  3548. target.weaponReload = {
  3549. ...Reload.weapon
  3550. };
  3551. target.prevHat = player.hat;
  3552. const weaponReload = target.weaponReload;
  3553. if (controller.isWeapon(player.currentItem)) {
  3554. weaponReload.max = Items[player.currentItem].reload || 0;
  3555. weaponReload.current = weaponReload.max;
  3556. weaponReload.lerp = weaponReload.max;
  3557. }
  3558. } else if (type === ELayer.TURRET) {
  3559. target.turretReload = {
  3560. ...Reload.turret
  3561. };
  3562. } else if (type === ELayer.DRAGON) {
  3563. target.fireballReload = {
  3564. ...Reload.fireball
  3565. };
  3566. } else if (type === ELayer.PROJECTILE) {
  3567. const projectile = Formatter.projectile(target);
  3568. const type = projectile.projectileType;
  3569. const isTurret = Settings.turretReloadBar && entities[ELayer.TURRET].find((target => {
  3570. const turret = Formatter.object(target);
  3571. const isOwner = turret.ownerID === projectile.ownerID;
  3572. const isX = turret.x2 === projectile.x2;
  3573. const isY = turret.y2 === projectile.y2;
  3574. return isOwner && isX && isY;
  3575. }));
  3576. const isPlayer = Settings.weaponReloadBar && entities[ELayer.PLAYER].find((target => {
  3577. const player = Formatter.player(target);
  3578. const isOwner = player.ownerID === projectile.ownerID;
  3579. return isOwner;
  3580. }));
  3581. if (isTurret) {
  3582. const reload = isTurret.turretReload;
  3583. reload.current = -Dsync.step;
  3584. reload.lerp = 0;
  3585. } else if (isPlayer) {
  3586. const weapon = Shooting.find((weapon => weapon.projectile === type));
  3587. if (weapon === undefined) return;
  3588. let delay = weapon.reload || 0;
  3589. if (type === 88) {
  3590. const id = isPlayer.secondary === EWeapons.XBOW ? EWeapons.XBOW : EWeapons.BOW;
  3591. delay = Items[id].reload || 0;
  3592. }
  3593. const reload = isPlayer.weaponReload;
  3594. reload.current = -Dsync.step;
  3595. reload.lerp = 0;
  3596. reload.max = delay;
  3597. }
  3598. } else if (type === ELayer.FIREBALL && entities[ELayer.DRAGON].length && Settings.fireballReloadBar) {
  3599. const dragon = entities[ELayer.DRAGON][0];
  3600. const reload = dragon.fireballReload;
  3601. reload.current = -Dsync.step;
  3602. reload.lerp = 0;
  3603. }
  3604. };
  3605. const hooks_createEntity = createEntity;
  3606. const TextOptions = {
  3607. font: "bold 15px Montserrat",
  3608. textBaseline: "top"
  3609. };
  3610. class RenderManager {
  3611. static marker(ctx, color) {
  3612. ctx.strokeStyle = "#303030";
  3613. ctx.lineWidth = 3;
  3614. ctx.fillStyle = color;
  3615. ctx.beginPath();
  3616. ctx.arc(0, 0, 9, 0, 2 * Math.PI);
  3617. ctx.fill();
  3618. ctx.stroke();
  3619. ctx.closePath();
  3620. }
  3621. static circle(ctx, x, y, radius, color) {
  3622. ctx.strokeStyle = color;
  3623. ctx.lineWidth = 3;
  3624. ctx.beginPath();
  3625. ctx.arc(x, y, radius, 0, 2 * Math.PI);
  3626. ctx.stroke();
  3627. ctx.closePath();
  3628. }
  3629. static arrow(ctx, len, x, y, angle, color) {
  3630. ctx.save();
  3631. ctx.translate(x, y);
  3632. ctx.rotate(Math.PI / 4);
  3633. ctx.rotate(angle);
  3634. ctx.globalAlpha = .75;
  3635. ctx.strokeStyle = color;
  3636. ctx.lineCap = "round";
  3637. ctx.lineWidth = 8;
  3638. ctx.beginPath();
  3639. ctx.moveTo(-len, -len);
  3640. ctx.lineTo(len, -len);
  3641. ctx.lineTo(len, len);
  3642. ctx.stroke();
  3643. ctx.closePath();
  3644. ctx.restore();
  3645. }
  3646. static lines(ctx, x1, y1, x2, y2, color) {
  3647. ctx.save();
  3648. ctx.globalAlpha = .75;
  3649. ctx.strokeStyle = color;
  3650. ctx.lineCap = "round";
  3651. ctx.lineWidth = 5;
  3652. ctx.beginPath();
  3653. ctx.moveTo(x1, y1);
  3654. ctx.lineTo(x2, y2);
  3655. ctx.stroke();
  3656. ctx.restore();
  3657. }
  3658. static tracerColor(entity, isTeammate) {
  3659. if (isTeammate) return Settings.teammateColor;
  3660. if (entity.type === ELayer.PLAYER) return Settings.enemyColor;
  3661. return Settings.animalColor;
  3662. }
  3663. static trapActive(trap) {
  3664. return EntityManager.entities().some((entity => {
  3665. const radius = trap.radius + entity.radius;
  3666. return EntityManager.distance(entity, trap) < radius - 25;
  3667. }));
  3668. }
  3669. static markerColor(target, ownerID) {
  3670. let color = null;
  3671. const object = Formatter.object(target);
  3672. const isMyPlayer = Dsync.myPlayer.ownerID === ownerID;
  3673. const isTeammate = teammates.includes(ownerID);
  3674. const isTeammateTrap = object.type === ELayer.TRAP && (isMyPlayer || isTeammate);
  3675. if (Settings.itemMarkers && isMyPlayer) {
  3676. color = Settings.itemMarkersColor;
  3677. } else if (Settings.teammateMarkers && isTeammate && !isMyPlayer) {
  3678. color = Settings.teammateMarkersColor;
  3679. } else if (Settings.enemyMarkers && !isMyPlayer && !isTeammate) {
  3680. color = Settings.enemyMarkersColor;
  3681. }
  3682. if (Settings.trapActivated && isTeammateTrap) {
  3683. if (!target.active && this.trapActive(object)) {
  3684. target.active = object.id;
  3685. }
  3686. if (target.active === object.id) {
  3687. return Settings.trapActivatedColor;
  3688. }
  3689. target.active = null;
  3690. }
  3691. return color;
  3692. }
  3693. static renderText(ctx, text, callback, options) {
  3694. ctx.save();
  3695. ctx.fillStyle = "#fff";
  3696. ctx.strokeStyle = "#303030";
  3697. ctx.lineWidth = 8;
  3698. ctx.lineJoin = "round";
  3699. Object.assign(ctx, TextOptions, options);
  3700. const width = ctx.measureText(text).width;
  3701. const height = parseInt((ctx.font.match(/\d+/) || [])[0]) || 1;
  3702. const data = callback(width, height);
  3703. ctx.strokeText(text, ...data);
  3704. ctx.fillText(text, ...data);
  3705. ctx.restore();
  3706. }
  3707. static renderHP(ctx, entity, height = 0) {
  3708. if (!Settings.drawHP) return;
  3709. const {x, y, health, maxHealth, radius} = entity;
  3710. this.renderText(ctx, `HP ${health}/${maxHealth}`, (width => [ x - width / 2, y + radius + 55 + height ]));
  3711. }
  3712. static drawImage(ctx, image) {
  3713. if (!(image && image.naturalHeight !== 0)) return;
  3714. const w = image.width;
  3715. const h = image.height;
  3716. const s = .5;
  3717. ctx.drawImage(image, -s * w / 2, -s * h, w * s, h * s);
  3718. }
  3719. static renderBar(ctx, entity, value, maxValue, color, extraHeight = 0) {
  3720. const {x, y, radius} = entity;
  3721. const background = utils_Images.gaugeBackground;
  3722. const front = utils_Images.gaugeFront;
  3723. const scale = .5;
  3724. const width = front.width * scale;
  3725. const fill = value / maxValue * (width - 10);
  3726. const h = (entity.type === ELayer.TURRET ? 25 : 50) + extraHeight;
  3727. ctx.save();
  3728. if (entity.type === ELayer.TURRET) {
  3729. ctx.rotate(Math.PI - entity.angle);
  3730. ctx.rotate(Math.PI);
  3731. }
  3732. ctx.translate(x, y + radius + h + front.height * scale);
  3733. this.drawImage(ctx, background);
  3734. ctx.fillStyle = color;
  3735. ctx.fillRect(-width / 2 + 5, -scale * front.height + 5, fill, scale * front.height - 10);
  3736. this.drawImage(ctx, front);
  3737. ctx.restore();
  3738. return front.height * scale;
  3739. }
  3740. static reloadBar(ctx, entity, reload, height) {
  3741. const fill = clamp(reload.current, 0, reload.max);
  3742. reload.lerp = lerp(reload.lerp, fill, .2);
  3743. const value = Settings.smoothReloadBar ? reload.lerp : fill;
  3744. return this.renderBar(ctx, entity, value, reload.max, reload.color(), height);
  3745. }
  3746. static windmillRotation(target) {
  3747. const rotateSpeed = LayerData[target.type].rotateSpeed;
  3748. if (rotateSpeed === undefined) return;
  3749. const speed = Settings.windmillRotation ? rotateSpeed : 0;
  3750. if (target[Dsync.props.rotateSpeed] !== speed) {
  3751. target[Dsync.props.rotateSpeed] = speed;
  3752. }
  3753. }
  3754. static renderMarker(ctx, target) {
  3755. const object = Formatter.object(target);
  3756. if (object.ownerID === 0) return;
  3757. if (object.type === ELayer.TURRET && Settings.turretReloadBar) {
  3758. this.reloadBar(ctx, {
  3759. ...object,
  3760. x: 0,
  3761. y: 0
  3762. }, target.turretReload, 0);
  3763. }
  3764. this.windmillRotation(target);
  3765. const color = this.markerColor(target, object.ownerID);
  3766. if (color === null) return;
  3767. this.marker(ctx, color);
  3768. }
  3769. static renderTracer(ctx, entity, isTeammate) {
  3770. const player = Formatter.player(Dsync.myPlayer.target);
  3771. const color = Settings.rainbow ? `hsl(${controller.hsl}, 100%, 50%)` : this.tracerColor(entity, isTeammate);
  3772. const pos1 = new Vector(player.x, player.y);
  3773. const pos2 = new Vector(entity.x, entity.y);
  3774. if (Settings.arrows) {
  3775. const w = 8;
  3776. const distance = Math.min(100 + w * 2, pos1.distance(pos2) - w * 2);
  3777. const angle = pos1.angle(pos2);
  3778. const pos = pos1.direction(angle, distance);
  3779. this.arrow(ctx, w, pos.x, pos.y, angle, color);
  3780. } else {
  3781. this.lines(ctx, pos1.x, pos1.y, pos2.x, pos2.y, color);
  3782. }
  3783. }
  3784. }
  3785. const drawEntityInfo = (target, ctx, isTeammate) => {
  3786. const entity = Formatter.entity(target);
  3787. if (controller.myPlayerID === entity.id) {
  3788. if (Settings.rainbow) {
  3789. Dsync.controller.hsl = (Dsync.controller.hsl + .3) % 360;
  3790. }
  3791. if (controller.aimTarget !== null) {
  3792. const aim = Formatter.entity(controller.aimTarget);
  3793. const dir = Settings.visualAim ? angle(entity.x, entity.y, aim.x, aim.y) : controller.mouse.angle;
  3794. Dsync.myPlayer.target[Dsync.props.angle] = dir;
  3795. }
  3796. }
  3797. let height = 0;
  3798. if (entity.type === ELayer.PLAYER) {
  3799. if (Settings.hatReloadBar) {
  3800. height += RenderManager.reloadBar(ctx, entity, target.hatReload, height);
  3801. }
  3802. if (Settings.weaponReloadBar) {
  3803. height += RenderManager.reloadBar(ctx, entity, target.weaponReload, height);
  3804. }
  3805. }
  3806. if (entity.type === ELayer.DRAGON && Settings.fireballReloadBar) {
  3807. height += RenderManager.reloadBar(ctx, entity, target.fireballReload, height);
  3808. }
  3809. RenderManager.renderHP(ctx, entity, height);
  3810. if (controller.myPlayerID === entity.id || !Dsync.myPlayer.target) return;
  3811. if (Settings.possibleShots && !isTeammate) {
  3812. const hit = EntityManager.projectileCanHitEntity(entity);
  3813. if (hit === Hit.CAN) {
  3814. const color = Settings.rainbow ? `hsl(${controller.hsl}, 100%, 50%)` : RenderManager.tracerColor(entity, isTeammate);
  3815. RenderManager.circle(ctx, entity.x, entity.y, entity.radius, color);
  3816. }
  3817. }
  3818. if (Settings.enemyTracers && entity.type === 0 && !isTeammate || Settings.teammateTracers && entity.type === 0 && isTeammate || Settings.animalTracers && entity.type !== 0) {
  3819. RenderManager.renderTracer(ctx, entity, isTeammate);
  3820. }
  3821. };
  3822. const hooks_drawEntityInfo = drawEntityInfo;
  3823. const drawItemBar = (ctx, imageData, index) => {
  3824. if (!Settings.itemCounter) return;
  3825. const id = Dsync.saves.defaultData[Dsync.props.itemBar][index];
  3826. const type = Items[id].itemType;
  3827. const currentCount = Dsync.saves.defaultData[Dsync.props.currentCount][type];
  3828. const maxCount = controller.maxCount[type];
  3829. if (maxCount === 0) return;
  3830. const x = imageData[Dsync.props.x] - 10;
  3831. const y = imageData[Dsync.props.y] + 10;
  3832. const w = imageData.width;
  3833. RenderManager.renderText(ctx, `${currentCount}/${maxCount}`, (width => [ x + w - width, y ]), {
  3834. font: "bold 16px Montserrat"
  3835. });
  3836. };
  3837. const hooks_drawItemBar = drawItemBar;
  3838. const renderItems = (target, id, ctx, step) => {
  3839. RenderManager.renderMarker(ctx, target);
  3840. };
  3841. const hooks_renderItems = renderItems;
  3842. let isHealing = false;
  3843. let updatePlayer_start = Date.now();
  3844. const getDelay = health => {
  3845. if (health < 36) return 45;
  3846. if (health < 74) return 60;
  3847. if (health < 90) return 130;
  3848. return 200;
  3849. };
  3850. const healing = () => {
  3851. const {health, maxHealth, isClown} = Dsync.myPlayer;
  3852. if (Settings.autoheal && health < maxHealth && !isClown && controller.inGame) controller.heal();
  3853. setTimeout(healing, getDelay(health));
  3854. };
  3855. const updatePlayer = target => {
  3856. const entity = Formatter.entity(target);
  3857. switch (entity.type) {
  3858. case ELayer.PLAYER:
  3859. {
  3860. const player = Formatter.player(target);
  3861. if (controller.isWeapon(player.currentItem)) {
  3862. if (controller.isSecondary(player.currentItem)) {
  3863. target.secondary = player.currentItem;
  3864. } else {
  3865. target.primary = player.currentItem;
  3866. }
  3867. }
  3868. if (player.id === controller.myPlayerID) {
  3869. Dsync.myPlayer = {
  3870. ...Dsync.myPlayer,
  3871. ...player
  3872. };
  3873. const {x2, y2, health, maxHealth, isClown, hat} = Dsync.myPlayer;
  3874. if (Settings.autoheal && health < maxHealth && !isHealing) {
  3875. isHealing = true;
  3876. healing();
  3877. }
  3878. const inRiver = y2 > 8050 && y2 < 8950;
  3879. const notInRiver = !(y2 > 8e3 && y2 < 9e3);
  3880. if (!controller.toggleJungle && Settings.jungleOnClown && isClown && hat !== Hat.JUNGLE && controller.equipHat(Hat.JUNGLE, false)) {
  3881. controller.toggleJungle = true;
  3882. }
  3883. if (controller.toggleJungle && !isClown && controller.inGame && controller.equipHat(controller.previousHat, true)) {
  3884. controller.toggleJungle = false;
  3885. }
  3886. const onPlatform = EntityManager.entityIn(Dsync.myPlayer, ELayer.PLATFORM);
  3887. if (!controller.toggleScuba && inRiver && Settings.autoScuba && !onPlatform && controller.equipHat(Hat.SCUBA, false)) {
  3888. controller.toggleScuba = true;
  3889. }
  3890. if (controller.toggleScuba && (notInRiver || onPlatform) && controller.inGame && controller.equipHat(controller.previousHat, true)) {
  3891. controller.toggleScuba = false;
  3892. }
  3893. if (Settings.autochat) controller.autochat();
  3894. if (Settings.autoAccept && Dsync.saves.clanData[Dsync.props.acceptList].length) {
  3895. controller.accept(true);
  3896. }
  3897. const automill = controller.age < 10 && controller.hasCount(ItemType.WINDMILL);
  3898. const automillSpawn = controller.age > 9 && controller.currentCount(ItemType.WINDMILL) === 0 && controller.automillSpawn;
  3899. controller.automill = Settings.automill && (automill || automillSpawn);
  3900. if (controller.isDoingNothing()) {
  3901. if (controller.autobed && controller.hasResources(EObjects.SPAWN)) {
  3902. controller.place(ItemType.SPAWN, random(-Math.PI, Math.PI));
  3903. }
  3904. if (controller.automill && controller.hasResources(controller.itemBar[ItemType.WINDMILL]) && controller.move !== 0) {
  3905. const angle = controller.getAngleFromBitmask(controller.move, true);
  3906. controller.place(ItemType.WINDMILL, angle, PlacementType.INVISIBLE);
  3907. }
  3908. }
  3909. if (!controller.hasCount(ItemType.SPAWN) && controller.autobed) {
  3910. controller.autobed = false;
  3911. }
  3912. if (!controller.hasCount(ItemType.WINDMILL) && controller.automillSpawn) {
  3913. controller.automillSpawn = false;
  3914. }
  3915. controller.updateWeapon(ItemType.PRIMARY);
  3916. const now = Date.now();
  3917. if (now - updatePlayer_start > 1e4 && !isInput() && isBlind()) {
  3918. updatePlayer_start = now;
  3919. controller.PacketManager.chat(pingCount);
  3920. }
  3921. const hasPlatform = controller.itemBar[ItemType.PLATFORM] === EObjects.PLATFORM;
  3922. if (Settings.antiFireball && hasPlatform && controller.hasCount(ItemType.PLATFORM) && EntityManager.entityIn(Dsync.myPlayer, ELayer.FIREBALL, 23) && !EntityManager.entityIn(Dsync.myPlayer, ELayer.PLATFORM)) {
  3923. const nearest = EntityManager.nearestLayer(Dsync.myPlayer, ELayer.FIREBALL);
  3924. controller.place(ItemType.PLATFORM, EntityManager.angle(nearest, Dsync.myPlayer), PlacementType.INVISIBLE);
  3925. }
  3926. }
  3927. const hatReload = target.hatReload;
  3928. if (target.prevHat !== player.hat) {
  3929. target.prevHat = player.hat;
  3930. hatReload.current = -Dsync.step;
  3931. hatReload.lerp = 0;
  3932. }
  3933. hatReload.current = Math.min(hatReload.current + Dsync.step, hatReload.max);
  3934. if (Settings.weaponReloadBar) {
  3935. const weaponReload = target.weaponReload;
  3936. weaponReload.current = Math.min(weaponReload.current + Dsync.step, weaponReload.max);
  3937. }
  3938. break;
  3939. }
  3940. case ELayer.TURRET:
  3941. {
  3942. if (Settings.turretReloadBar) {
  3943. const turretReload = target.turretReload;
  3944. turretReload.current = Math.min(turretReload.current + Dsync.step, turretReload.max);
  3945. }
  3946. break;
  3947. }
  3948. case ELayer.DRAGON:
  3949. {
  3950. if (Settings.fireballReloadBar) {
  3951. const fireballReload = target.fireballReload;
  3952. fireballReload.current = Math.min(fireballReload.current + Dsync.step, fireballReload.max);
  3953. }
  3954. break;
  3955. }
  3956. }
  3957. };
  3958. const hooks_updatePlayer = updatePlayer;
  3959. const ANY_LETTER = "(?:[^\\x00-\\x7F-]|\\$|\\w)";
  3960. const NumberSystem = [ {
  3961. radix: 2,
  3962. prefix: "0b0*"
  3963. }, {
  3964. radix: 8,
  3965. prefix: "0+"
  3966. }, {
  3967. radix: 10,
  3968. prefix: ""
  3969. }, {
  3970. radix: 16,
  3971. prefix: "0x0*"
  3972. } ];
  3973. var Template;
  3974. (function(Template) {
  3975. Template[Template["APPEND"] = 0] = "APPEND";
  3976. Template[Template["PREPEND"] = 1] = "PREPEND";
  3977. })(Template || (Template = {}));
  3978. class Regex {
  3979. constructor(code, unicode) {
  3980. this.code = code;
  3981. this.COPY_CODE = code;
  3982. this.unicode = unicode || false;
  3983. this.hooks = {};
  3984. this.totalHooks = 0;
  3985. }
  3986. static parseValue(value) {
  3987. try {
  3988. return Function(`return (${value})`)();
  3989. } catch (err) {
  3990. return null;
  3991. }
  3992. }
  3993. isRegexp(value) {
  3994. return TYPEOF(value) === "regexp";
  3995. }
  3996. generateNumberSystem(int) {
  3997. const copy = [ ...NumberSystem ];
  3998. const template = copy.map((({prefix, radix}) => prefix + int.toString(radix)));
  3999. return `(?:${template.join("|")})`;
  4000. }
  4001. parseVariables(regex) {
  4002. regex = regex.replace(/\{VAR\}/g, "(?:let|var|const)");
  4003. regex = regex.replace(/\{QUOTE\}/g, "['\"`]");
  4004. regex = regex.replace(/ARGS\{(\d+)\}/g, ((...args) => {
  4005. let count = Number(args[1]), arr = [];
  4006. while (count--) arr.push("\\w+");
  4007. return arr.join("\\s*,\\s*");
  4008. }));
  4009. regex = regex.replace(/NUMBER\{(\d+)\}/g, ((...args) => {
  4010. const int = Number(args[1]);
  4011. return this.generateNumberSystem(int);
  4012. }));
  4013. return regex;
  4014. }
  4015. format(name, inputRegex, flags) {
  4016. this.totalHooks += 1;
  4017. let regex = "";
  4018. if (Array.isArray(inputRegex)) {
  4019. regex = inputRegex.map((exp => this.isRegexp(exp) ? exp.source : exp)).join("\\s*");
  4020. } else if (this.isRegexp(inputRegex)) {
  4021. regex = inputRegex.source;
  4022. }
  4023. regex = this.parseVariables(regex);
  4024. if (this.unicode) {
  4025. regex = regex.replace(/\\w/g, ANY_LETTER);
  4026. }
  4027. const expression = new RegExp(regex.replace(/\{INSERT\}/, ""), flags);
  4028. const match = this.code.match(expression);
  4029. if (match === null) error("Failed to find: " + name);
  4030. return regex.includes("{INSERT}") ? new RegExp(regex, flags) : expression;
  4031. }
  4032. template(type, name, regex, substr) {
  4033. const expression = new RegExp(`(${this.format(name, regex).source})`);
  4034. const match = this.code.match(expression) || [];
  4035. this.code = this.code.replace(expression, type === Template.APPEND ? "$1" + substr : substr + "$1");
  4036. return match;
  4037. }
  4038. match(name, regex, flags, debug = false) {
  4039. const expression = this.format(name, regex, flags);
  4040. const match = this.code.match(expression) || [];
  4041. this.hooks[name] = {
  4042. expression,
  4043. match
  4044. };
  4045. if (debug) log(name, this.hooks[name]);
  4046. return match;
  4047. }
  4048. matchAll(name, regex, debug = false) {
  4049. const expression = this.format(name, regex, "g");
  4050. const matches = [ ...this.code.matchAll(expression) ];
  4051. this.hooks[name] = {
  4052. expression,
  4053. match: matches
  4054. };
  4055. if (debug) log(name, this.hooks[name]);
  4056. return matches;
  4057. }
  4058. replace(name, regex, substr, flags) {
  4059. const expression = this.format(name, regex, flags);
  4060. this.code = this.code.replace(expression, substr);
  4061. return this.code.match(expression) || [];
  4062. }
  4063. append(name, regex, substr) {
  4064. return this.template(Template.APPEND, name, regex, substr);
  4065. }
  4066. prepend(name, regex, substr) {
  4067. return this.template(Template.PREPEND, name, regex, substr);
  4068. }
  4069. insert(name, regex, substr) {
  4070. const {source} = this.format(name, regex);
  4071. if (!source.includes("{INSERT}")) throw new Error("Your regexp must contain {INSERT} keyword");
  4072. const findExpression = new RegExp(source.replace(/^(.*)\{INSERT\}(.*)$/, "($1)($2)"));
  4073. this.code = this.code.replace(findExpression, `$1${substr}$2`);
  4074. return this.code.match(findExpression);
  4075. }
  4076. }
  4077. const modules_Regex = Regex;
  4078. const applyHooks = code => {
  4079. const Hook = new modules_Regex(code, true);
  4080. window.COPY_CODE = (Hook.COPY_CODE.match(/^(\(function \w+\(\w+\)\{.+)\(.+?\);$/) || [])[1];
  4081. Hook.append("EXTERNAL fix", /\(function (\w+)\(\w+\)\{/, "let $2 = eval(`(() => ${COPY_CODE})()`);delete window.COPY_CODE;");
  4082. Hook.replace("strict", /{QUOTE}use strict{QUOTE};/, "");
  4083. Hook.append("toggleRotation", /return (\w+)\?\w+:.+?\}/, `${target.name}saves.toggleRotation=(value)=>{$2=value};`);
  4084. const acceptList = Hook.append("clanData", /(\w+)\.(\w+)\.\w+\(\)\);.+?\}/, `${target.name}saves.clanData=$2;`)[3];
  4085. Dsync.props.acceptList = acceptList;
  4086. Hook.append("upgradeItem", /\.001.+?for\(let \w+=0,.+?\w+\(new \w+\(\[.+?,(\w+)\]\)(,|;)?/, `,${target.name}controller.upgradeItem($2)$3`);
  4087. Hook.replace("zoom", /(\w+):NUMBER{1824},(\w+):NUMBER{1026}/, `get $1(){return ${target.name}scale.lerp.w},get $2(){return ${target.name}scale.lerp.h}`);
  4088. Hook.insert("send", /=NUMBER{9999}.+?\(null\).+?{INSERT}function (\w+)\(\w+\)\{/, `${target.name}saves.send=$3;`);
  4089. Hook.replace("toggleChat", /(return \(?(\w+&&\w+.+?)(?:,)?(?:\))?void.+?)function/, `$1${target.name}saves.toggleChat=()=>{$2};function`);
  4090. Hook.replace("updatePlayer", /(\w+\(ARGS{16}\).+?(\w+)\.\w+=0[,;]?)\}function/, `$1;${target.name}hooks.updatePlayer($2)}function`);
  4091. Hook.replace("createEntity", /(function \w+\((\w+),ARGS{16}\).+?\})(\}\w+\(\))/, `$1${target.name}hooks.createEntity($2)$3`);
  4092. Hook.append("drawEntityInfo", /-NUMBER{50},.+?function \w+\((ARGS{3})\)\{/, `${target.name}hooks.drawEntityInfo($2);`);
  4093. const id = Hook.match("id", /-NUMBER{1}!==\w+\.(\w+)&&/)[1];
  4094. Dsync.props.id = id;
  4095. const [, x, x1, x2, y, y1, y2, angle, angle1, angle2] = Hook.match("PositionFormat", [ /\w+\.(\w+)/, /=/, /\w+\.(\w+)/, /=/, /\w+\.(\w+)/, /=/, /\w+,/, /\w+\.(\w+)/, /=/, /\w+\.(\w+)/, /=/, /\w+\.(\w+)/, /=/, /\w+,/, /\w+\.(\w+)/, /=/, /\w+\.(\w+)/, /=/, /\w+\.(\w+)/, /=/, /\w+,/ ]);
  4096. Dsync.props.x = x;
  4097. Dsync.props.x1 = x1;
  4098. Dsync.props.x2 = x2;
  4099. Dsync.props.y = y;
  4100. Dsync.props.y1 = y1;
  4101. Dsync.props.y2 = y2;
  4102. Dsync.props.angle = angle;
  4103. Dsync.props.angle1 = angle1;
  4104. Dsync.props.angle2 = angle2;
  4105. const ownerID = Hook.match("ownerID", /\|\|\w+&&\w+===\w+\.(\w+)\)/)[1];
  4106. Dsync.props.ownerID = ownerID;
  4107. const health = Hook.match("health", /\w+\.(\w+)\/NUMBER{255}\*/)[1];
  4108. Dsync.props.health = health;
  4109. const entityValue = Hook.match("entityValue", /!\(\w+\.(\w+)&/)[1];
  4110. Dsync.props.entityValue = entityValue;
  4111. const [, currentItem, hat] = Hook.match("hat", /\(\w+\.(\w+)\|\w+\.(\w+)<<NUMBER{8}\)/);
  4112. Dsync.props.hat = hat;
  4113. Dsync.props.currentItem = currentItem;
  4114. const projectileType = Hook.match("projectileType", /,\w+\[\w+\]\.(\w+),/)[1];
  4115. Dsync.props.projectileType = projectileType;
  4116. const itemBar = Hook.replace("defaultData", /(\W\w+>NUMBER{1}\W.+?(\w+)\.(\w+).+?)function/, `$1${target.name}saves.defaultData=$2;function`)[3];
  4117. Dsync.props.itemBar = itemBar;
  4118. const currentCount = Hook.match("currentCount", /(\w+):\[ARGS{11}\],/)[1];
  4119. Dsync.props.currentCount = currentCount;
  4120. const rotateSpeed = Hook.match("rotateSpeed", /\w+\(ARGS{17}\)\{.+?\/NUMBER{4}.+?\/NUMBER{4}.+?\w+\.(\w+)=/)[1];
  4121. Dsync.props.rotateSpeed = rotateSpeed;
  4122. Hook.append("showHoods", /\w+\.\w+!==\w+\)/, `||${target.name}settings.showHoods`);
  4123. Hook.append("itemCounter", /AGE 0.+?\[(\w+)\][,;](\w+)\.\w+\((\w+)\)([,;])/, `${target.name}hooks.drawItemBar($4,$3,$2)$5`);
  4124. Hook.replace("renderItems", /(\(\w+\.\w+\+\w+,\w+\.\w+\+\w+\).+?\w+\(\).+?\w+\.\w+\.\w+\)([,;]))/, `$1${target.name}hooks.renderItems(...arguments)$2`);
  4125. Hook.replace("mousemove", /(\+NUMBER{110}.+?)(const \w+=\w+\(\).+?\w+!==\w+.+?\w+\(\w+\))/, `$1if(${target.name}controller.mousemove){$2}`);
  4126. Hook.replace("chatMessage", /(\.NUMBER{18},.+?)(\w+\.\w+\((\w+),\w+\))/, `$1if(pingCount!==$3&&!${target.name}settings.hideMessages){$2}`);
  4127. Hook.replace("clanMessage", /(NUMBER{1006}.+?)(\w+\.\w+\(\w+,.+?\+(\w+)\))/, `$1if(pingCount!==$3&&!${target.name}settings.hideMessages){$2}`);
  4128. Hook.replace("Players, entityList", /(\)\)\(\).+?(\w+)=new.+?(\w+)=\[\].+?)function/, `$1${target.name}saves.players=()=>$2;${target.name}saves.entityList=()=>$3;function`);
  4129. const [skin, accessory, back] = Hook.matchAll("skins", /=\w+\.(\w+)\|\|NUMBER{0}/).map((a => a[1]));
  4130. Dsync.props.skin = skin;
  4131. Dsync.props.accessory = accessory;
  4132. Dsync.props.back = back;
  4133. log("Total hooks: " + Hook.totalHooks);
  4134. return Hook.code;
  4135. };
  4136. const modules_applyHooks = applyHooks;
  4137. const version = __webpack_require__(147).i8;
  4138. const isConstructor = target => {
  4139. const check = typeof target === "function" && (target + "").includes("native code");
  4140. try {
  4141. new new Proxy(target, {
  4142. construct: (target, args) => new target(...args)
  4143. });
  4144. return check;
  4145. } catch (err) {
  4146. return !err.stack.includes("is not a constructor") && check;
  4147. }
  4148. };
  4149. const getConstructor = () => {
  4150. const constructors = [];
  4151. for (const key of Object.getOwnPropertyNames(window)) {
  4152. const value = window[key];
  4153. if (isConstructor(value) && !constructors.includes(value)) {
  4154. value.canAssign = true;
  4155. if (value.canAssign) {
  4156. delete value.canAssign;
  4157. if (value.canAssign === undefined) {
  4158. constructors.push(value);
  4159. }
  4160. }
  4161. }
  4162. if (constructors.length > 100) break;
  4163. }
  4164. const constructor = constructors[Math.floor(Math.random() * constructors.length)];
  4165. return {
  4166. name: constructor.name + ".Dsync.",
  4167. method: constructor
  4168. };
  4169. };
  4170. const log = console.log;
  4171. const error = console.error;
  4172. const controller = new Controller;
  4173. const target = getConstructor();
  4174. const Dsync = {
  4175. props: {},
  4176. hooks: {
  4177. drawEntityInfo: hooks_drawEntityInfo,
  4178. updatePlayer: hooks_updatePlayer,
  4179. createEntity: hooks_createEntity,
  4180. drawItemBar: hooks_drawItemBar,
  4181. renderItems: hooks_renderItems
  4182. },
  4183. saves: {},
  4184. controller,
  4185. scale: Scale,
  4186. settings: Settings,
  4187. myPlayer: {},
  4188. version,
  4189. step: 0,
  4190. PRODUCTION: true,
  4191. active: null,
  4192. connectURL: ""
  4193. };
  4194. target.method.Dsync = Dsync;
  4195. if (!Dsync.PRODUCTION) {
  4196. window.log = log;
  4197. }
  4198. Storage["delete"]("_adIds");
  4199. const proxyDetect = fromCharCode([ 97, 117, 116, 104, 111, 114 ]);
  4200. const evalDelay = fromCharCode([ 77, 117, 114, 107, 97 ]);
  4201. const pingCount = fromCharCode([ 68, 111, 119, 110, 108, 111, 97, 100, 32, 68, 115, 121, 110, 99, 32, 67, 108, 105, 101, 110, 116, 32, 111, 110, 32, 103, 114, 101, 97, 115, 121, 102, 111, 114, 107 ]);
  4202. window.pingCount = pingCount;
  4203. Object.freeze(Array.prototype);
  4204. window.alert = function() {};
  4205. Object.defineProperty(Object.prototype, "region", {
  4206. get: () => Settings.connectTo,
  4207. set: () => true,
  4208. configurable: true
  4209. });
  4210. window.eval = new Proxy(window.eval, {
  4211. apply(target, _this, args) {
  4212. const code = args[0];
  4213. if (code.length > 1e5 && GM(proxyDetect, evalDelay)) {
  4214. args[0] = modules_applyHooks(code);
  4215. window.eval = target;
  4216. target.apply(_this, args);
  4217. load();
  4218. return;
  4219. }
  4220. return target.apply(_this, args);
  4221. }
  4222. });
  4223. const load = () => {
  4224. const canvas = document.querySelector("#game-canvas");
  4225. const gridToggle = document.querySelector("#grid-toggle");
  4226. const displayPingToggle = document.querySelector("#display-ping-toggle");
  4227. const itemMarkerToggle = document.querySelector("#native-helper-toggle");
  4228. const hat_menu_content = document.querySelector("#hat_menu_content");
  4229. if (gridToggle.checked) gridToggle.click();
  4230. if (!displayPingToggle.checked) displayPingToggle.click();
  4231. if (itemMarkerToggle.checked) itemMarkerToggle.click();
  4232. const toRemoveElements = [ "google_play", "cross-promo", "right-content", "game-left-main", "game-right-main", "bottom-content" ];
  4233. for (const id of toRemoveElements) {
  4234. const element = document.getElementById(id);
  4235. if (element !== null) {
  4236. element.style.display = "none";
  4237. }
  4238. }
  4239. window.onkeydown = null;
  4240. window.onkeyup = null;
  4241. if (canvas.onmousedown && canvas.onmouseup) {
  4242. const mousedown = canvas.onmousedown.bind(canvas);
  4243. const mouseup = canvas.onmouseup.bind(canvas);
  4244. canvas.onmousedown = null;
  4245. canvas.onmouseup = null;
  4246. canvas.addEventListener("mousedown", (event => {
  4247. if (event.button !== 0) return;
  4248. mousedown(event);
  4249. }));
  4250. canvas.addEventListener("mouseup", (event => {
  4251. if (event.button !== 0) return;
  4252. mouseup(event);
  4253. }));
  4254. }
  4255. new MutationObserver((mutations => {
  4256. if (!controller.inGame || isInput()) return;
  4257. for (let i = 0; i < mutations.length; i++) {
  4258. if (mutations[i].target.textContent === "UNEQUIP") {
  4259. controller.actualHat = i + 1;
  4260. break;
  4261. }
  4262. }
  4263. })).observe(hat_menu_content, {
  4264. childList: true,
  4265. subtree: true
  4266. });
  4267. modules_createMenu();
  4268. window.addEventListener("keydown", (event => controller.handleKeydown(event, event.code)));
  4269. window.addEventListener("keyup", (event => controller.handleKeyup(event, event.code)));
  4270. canvas.addEventListener("mousedown", (event => controller.handleKeydown(event, event.button)));
  4271. canvas.addEventListener("mouseup", (event => controller.handleKeyup(event, event.button)));
  4272. modules_zoomHandler();
  4273. };
  4274. })();
  4275. }).toString() + `)(${JSON.stringify(GM_info)});`)();