Dsync Client [Sploop.io]

The most advanced hack for sploop.io

当前为 2022-10-27 提交的版本,查看 最新版本

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