Dsync Client [Sploop.io]

The most advanced hack for sploop.io

目前为 2022-10-05 提交的版本,查看 最新版本

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