Diep.io Custom Points Upgrader. Beta

NEW! custom upgrade builds update! Your upgrade builds will save now! This is still in beta!

2025-02-16 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

  1. // ==UserScript==
  2. // @name Diep.io Custom Points Upgrader. Beta
  3. // @namespace http://tampermonkey.net/
  4. // @version 10.01
  5. // @homepage https://greatest.deepsurf.us/scripts/416440
  6. // @description NEW! custom upgrade builds update! Your upgrade builds will save now! This is still in beta!
  7. // @author -{Abyss⌬}-ora
  8. // @match https://diep.io/*
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. "use strict";
  15.  
  16. const hoverMenu = document.createElement("div");
  17. hoverMenu.id = "myhover";
  18. hoverMenu.className = "hover";
  19.  
  20. const modMenu = document.createElement("a");
  21. modMenu.id = "modtab";
  22.  
  23. const menuHeader = document.createElement("h1");
  24. menuHeader.textContent = "-{Abyss⌬}-ora's Mod Menu beta";
  25. modMenu.appendChild(menuHeader);
  26.  
  27. const topRightButton = document.createElement("button");
  28. topRightButton.id = "topRightButton";
  29. topRightButton.textContent = "↻";
  30.  
  31. const style = document.createElement("style");
  32. style.type = "text/css";
  33. style.textContent = `
  34. #myhover a {
  35. z-index: 999;
  36. position: absolute;
  37. top: 300px;
  38. right: -260px;
  39. transition: 0.3s;
  40. width: 250px;
  41. padding: 15px;
  42. background-image: url("https://media.tenor.com/images/f3f5354b7c304bc61882dbb1183885e7/tenor.gif");
  43. background-color: #555;
  44. text-decoration: none;
  45. font-size: 10px;
  46. font-family: 'Monoton', cursive;
  47. text-shadow: 1px 1px #000, 2px 2px #555;
  48. color: white;
  49. border: double thick white;
  50. border-radius: 20px;
  51. }
  52. #myhover a:hover {
  53. right: 0;
  54. }
  55. .button {
  56. display: block;
  57. margin: 5px auto;
  58. width: 90%;
  59. text-align: center;
  60. font-size: 18px;
  61. font-family: 'Jersey 10', sans-serif;
  62. color: black;
  63. background-color: white;
  64. border-radius: 5px;
  65. transition: 0.4s;
  66. cursor: pointer;
  67. }
  68. .button:hover {
  69. transform: translateX(-10px);
  70. }
  71. #userInput {
  72. margin: 5px auto;
  73. width: 90%;
  74. padding: 8px;
  75. font-family: 'Monoton', cursive;
  76. text-align: center;
  77. }
  78. #specialButton {
  79. display: block;
  80. margin: 5px auto;
  81. width: 90%;
  82. text-align: center;
  83. font-size: 18px;
  84. font-family: 'Jersey 10', sans-serif;
  85. color: white;
  86. background-color: black;
  87. border-radius: 5px;
  88. border-color: white;
  89. transition: 0.4s;
  90. cursor: pointer;
  91. opacity: 0.8;
  92. }
  93. #specialButton:hover {
  94. color: black;
  95. background-color: darkgray;
  96. transform: translateX(-10px);
  97. }
  98. .popup {
  99. position: fixed;
  100. top: 50%;
  101. left: 50%;
  102. transform: translate(-50%, -50%);
  103. width: 300px;
  104. background-image: url("https://media.tenor.com/images/f3f5354b7c304bc61882dbb1183885e7/tenor.gif");
  105. background-color: white;
  106. border: double thick white;
  107. border-radius: 10px;
  108. padding: 20px;
  109. z-index: 1000;
  110. text-shadow: 1px 1px #000, 2px 2px #555;
  111. }
  112. .attribute {
  113. display: flex;
  114. align-items: center;
  115. margin-bottom: 10px;
  116. }
  117. .attribute div {
  118. width: 30px;
  119. height: 30px;
  120. border: 1px solid #000;
  121. margin: 0;
  122. }
  123. .attribute button {
  124. background-color: gray;
  125. border: none;
  126. color: black;
  127. font-size: 20px;
  128. cursor: pointer;
  129. width: 30px;
  130. height: 30px;
  131. margin: 0;
  132. }
  133. #pointsCounter {
  134. text-align: center;
  135. font-size: 16px;
  136. margin-bottom: 10px;
  137. }
  138. #createBuildButton {
  139. display: block;
  140. margin: 20px auto 0 auto;
  141. width: 80%;
  142. text-align: center;
  143. font-size: 18px;
  144. font-family: 'Jersey 10', sans-serif;
  145. color: black;
  146. background-color: white;
  147. border-radius: 5px;
  148. border: 2px solid black;
  149. cursor: pointer;
  150. padding: 10px;
  151. }
  152. #createBuildButton:hover {
  153. background-color: gray;
  154. color: white;
  155. }
  156. #codeString {
  157. text-align: center;
  158. font-size: 18px;
  159. margin: 10px 0;
  160. }
  161. .remove-button {
  162. background-color: gray;
  163. border: none;
  164. color: white;
  165. font-size: 18px;
  166. cursor: pointer;
  167. width: 30px;
  168. height: 30px;
  169. margin-right: 5px;
  170. transition: background-color 0.3s;
  171. }
  172. .remove-button:hover {
  173. background-color: red;
  174. }
  175. .close-btn {
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. position: absolute;
  180. top: 1px;
  181. z-index: 10;
  182. right: 0px;
  183. width: 40px;
  184. height: 35px;
  185. color: white;
  186. cursor: pointer;
  187. font-size: 18px;
  188. line-height: 30px;
  189. text-align: center;
  190. transition: background-color 0.3s;
  191. text-shadow: 1px 1px #000, 2px 2px #555;
  192. border-radius: 10px;
  193. background-color: rgba(0, 0, 0, 0.8);
  194. }
  195. .close-btn:hover {
  196. background-color: red;
  197. }
  198. #topRightButton {
  199. position: absolute;
  200. top: 10px;
  201. right: 10px;
  202. width: 30px;
  203. height: 30px;
  204. background-color: black;
  205. color: white;
  206. border: none;
  207. border-radius: 10%;
  208. cursor: pointer;
  209. font-size: 18px;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. transition: background-color 0.3s;
  214. z-index: 1001;
  215. opacity: 0.8;
  216. }
  217. #topRightButton:hover {
  218. color: red;
  219. }
  220. #buildButtonsContainer {
  221. max-height: 400px;
  222. overflow-y: scroll;
  223. margin-left: 5px;
  224. }
  225. #buildButtonsContainer {
  226. -ms-overflow-style: none;
  227. scrollbar-width: none;
  228. }
  229. ::-webkit-scrollbar {
  230. width: 10px;
  231. }
  232. ::-webkit-scrollbar-track {
  233. background: #f1f1f1;
  234. border-radius: 10px;
  235. }
  236. ::-webkit-scrollbar-thumb {
  237. background: #888;
  238. border-radius: 10px;
  239. }
  240. ::-webkit-scrollbar-thumb:hover {
  241. background: #555;
  242. }
  243. .popup {
  244. position: fixed;
  245. z-index: 9;
  246. background-color: #f1f1f1;
  247. border: 1px solid #d3d3d3;
  248. text-align: center;
  249. padding-top: 40px;
  250. }
  251. .popup-header {
  252. display: flex;
  253. justify-content: center;
  254. align-items: center;
  255. position: absolute;
  256. top: 1px;
  257. left: 0px;
  258. right: 35px;
  259. height: 30px;
  260. cursor: grabbing;
  261. z-index: 10;
  262. background-color: rgba(5, 5,5, 0.8);
  263. color: #fff;
  264. font-size: 10px;
  265. font-family: 'Monoton', cursive;
  266. text-shadow: 1px 1px #000, 2px 2px #555;
  267. border-color: white;
  268. border-radius: 10px;
  269. }
  270. `;
  271. document.head.appendChild(style);
  272.  
  273. const userInput = document.createElement("input");
  274. userInput.id = "userInput";
  275. userInput.type = "text";
  276. userInput.placeholder = "Enter Username For Quick Spawn";
  277. userInput.value = localStorage.getItem("quickSpawnUsername") || "";
  278. modMenu.appendChild(userInput);
  279.  
  280. userInput.addEventListener("input", (event) => {
  281. localStorage.setItem("quickSpawnUsername", event.target.value);
  282. });
  283.  
  284. const buttons = [];
  285.  
  286. buttons.forEach((buttonData) => {
  287. const buttonContainer = document.createElement("div");
  288. buttonContainer.style.display = "flex";
  289. buttonContainer.style.alignItems = "center";
  290. buttonContainer.style.justifyContent = "center";
  291.  
  292. const removeButton = document.createElement("button");
  293. removeButton.className = "remove-button";
  294. removeButton.textContent = "🖉";
  295. removeButton.onclick = () => {
  296. createRemovePopup(buttonContainer, buttonData);
  297. };
  298.  
  299. buttonContainer.appendChild(removeButton);
  300.  
  301. const button = document.createElement("button");
  302. button.className = "button";
  303. button.textContent = buttonData.name;
  304. button.style.backgroundColor = buttonData.color;
  305. button.onclick = () => {
  306. const spawnName = userInput.value.trim();
  307. window.input.execute(`game_spawn ${spawnName}`);
  308. window.input.execute(`game_stats_build ${buttonData.cmd}`);
  309. const hoverMenu = document.getElementById("myhover");
  310. if (hoverMenu) {
  311. hoverMenu.style.display = hoverMenu.style.display === "none" ? "block" : "none";
  312. }
  313. };
  314. buttonContainer.appendChild(button);
  315.  
  316. modMenu.appendChild(buttonContainer);
  317. });
  318.  
  319. const specialButton = document.createElement("button");
  320. specialButton.id = "specialButton";
  321. specialButton.textContent = "[+]";
  322.  
  323. specialButton.onclick = () => {
  324. const popup = document.createElement("div");
  325. popup.className = "popup";
  326. popup.id = "resetPopup";
  327. popup.innerHTML = `<div class="popup-header" id="resetPopupHeader">Drag me</div> `;
  328. document.body.appendChild(popup);
  329.  
  330. const closeButton = document.createElement("button");
  331. closeButton.className = "close-btn";
  332. closeButton.textContent = "X";
  333. closeButton.onclick = () => {
  334. document.body.removeChild(popup);
  335. };
  336. popup.appendChild(closeButton);
  337.  
  338. const buildNameInput = document.createElement("input");
  339. buildNameInput.type = "text";
  340. buildNameInput.placeholder = "Build Name";
  341. buildNameInput.style.display = "block";
  342. buildNameInput.style.width = "80%";
  343. buildNameInput.style.margin = "0 auto 10px auto";
  344. popup.appendChild(buildNameInput);
  345.  
  346. const pointsCounter = document.createElement("div");
  347. pointsCounter.id = "pointsCounter";
  348. pointsCounter.textContent = "Points: 33";
  349. popup.appendChild(pointsCounter);
  350.  
  351. const codeString = document.createElement("div");
  352. codeString.id = "codeString";
  353. codeString.textContent = "Code: 0";
  354. popup.appendChild(codeString);
  355.  
  356. let totalPoints = 33;
  357. let code = "";
  358.  
  359. const attributes = [
  360. { name: "Health Regen", color: "rgb(232, 188, 157)" },
  361. { name: "Max Health", color: "rgb(230, 128, 234)" },
  362. { name: "Body Damage", color: "rgb(165, 128, 234)" },
  363. { name: "Bullet Speed", color: "rgb(128, 162, 234)" },
  364. { name: "Bullet Penetration", color: "rgb(234, 215, 128)" },
  365. { name: "Bullet Damage", color: "rgb(234, 128, 128)" },
  366. { name: "Reload", color: "rgb(164, 234, 128)" },
  367. { name: "Movement Speed", color: "rgb(128, 234, 230)" },
  368. ];
  369.  
  370. attributes.forEach((attribute, index) => {
  371. const attributeRow = document.createElement("div");
  372. attributeRow.className = "attribute";
  373. attributeRow.style.position = "relative";
  374.  
  375. const minusButton = document.createElement("button");
  376. minusButton.style.padding = "0 5px";
  377. minusButton.style.border = "1px solid black";
  378. minusButton.style.borderTopLeftRadius = "50px";
  379. minusButton.style.borderBottomLeftRadius = "50px";
  380. minusButton.style.borderTopRightRadius = "0";
  381. minusButton.style.borderBottomRightRadius = "0";
  382. minusButton.style.width = "32px";
  383. minusButton.style.height = "32px";
  384. minusButton.textContent = "-";
  385. minusButton.onclick = () => {
  386. const coloredSquares = Array.from(attributeRow.children).filter(child => child !== plusButton && child.style.backgroundColor === attribute.color);
  387. if (coloredSquares.length > 0 && totalPoints < 33) {
  388. const square = coloredSquares[coloredSquares.length - 1];
  389. square.style.backgroundColor = "gray";
  390. square.style.border = "0";
  391. totalPoints++;
  392. pointsCounter.textContent = `Points: ${totalPoints}`;
  393. code = code.slice(0, -1);
  394. codeString.textContent = `Code: ${code}`;
  395. }
  396. };
  397. attributeRow.appendChild(minusButton);
  398.  
  399. for (let i = 0; i < 7; i++) {
  400. const colorDiv = document.createElement("div");
  401. colorDiv.style.border = "0";
  402. colorDiv.style.backgroundColor = "gray";
  403. colorDiv.style.width = "30px";
  404. colorDiv.style.height = "30px";
  405. colorDiv.style.display = "inline-block";
  406. colorDiv.style.position = "relative";
  407. colorDiv.style.padding = "0 5px";
  408.  
  409. if (i === 3) {
  410. const textSpan = document.createElement("span");
  411. textSpan.textContent = attribute.name;
  412. textSpan.style.position = "absolute";
  413. textSpan.style.top = "50%";
  414. textSpan.style.left = "50%";
  415. textSpan.style.transform = "translate(-50%, -50%)";
  416. textSpan.style.color = "white";
  417. textSpan.style.pointerEvents = "none";
  418. textSpan.style.whiteSpace = "nowrap";
  419. textSpan.style.zIndex = "1";
  420. textSpan.style.display = "inline-block";
  421. textSpan.style.textShadow =
  422. "1px 1px 1px black, -1px -1px 1px black, -1px 1px 1px black, 1px -1px 1px black";
  423.  
  424. colorDiv.appendChild(textSpan);
  425. }
  426.  
  427. attributeRow.appendChild(colorDiv);
  428. }
  429.  
  430. const plusButton = document.createElement("button");
  431. plusButton.style.padding = "0 5px";
  432. plusButton.style.border = "1px solid black";
  433. plusButton.style.borderTopLeftRadius = "0";
  434. plusButton.style.borderBottomLeftRadius = "0";
  435. plusButton.style.borderTopRightRadius = "50px";
  436. plusButton.style.borderBottomRightRadius = "50px";
  437. plusButton.style.width = "32px";
  438. plusButton.style.height = "32px";
  439. plusButton.style.color = "Black";
  440. plusButton.style.fontWeight = "bold";
  441. plusButton.textContent = "+";
  442. plusButton.style.backgroundColor = attribute.color;
  443.  
  444. plusButton.onclick = () => {
  445. const graySquares = Array.from(attributeRow.children).filter(child => child.style.backgroundColor === "gray" && child !== plusButton);
  446. if (graySquares.length > 0 && totalPoints > 0) {
  447. const square = graySquares[0];
  448. square.style.backgroundColor = attribute.color;
  449. square.style.border = "1px solid black";
  450. totalPoints--;
  451. pointsCounter.textContent = `Points: ${totalPoints}`;
  452. code += (index + 1).toString();
  453. codeString.textContent = `Code: ${code}`;
  454. }
  455. };
  456. attributeRow.appendChild(plusButton);
  457.  
  458. popup.appendChild(attributeRow);
  459. });
  460.  
  461. const createBuildButton = document.createElement("button");
  462. createBuildButton.id = "createBuildButton";
  463. createBuildButton.textContent = "Create Build";
  464. createBuildButton.onclick = () => {
  465. const buildName = buildNameInput.value.trim();
  466. if (buildName === "") {
  467. alert("Please enter a build name.");
  468. return;
  469. }
  470.  
  471. let savedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  472. savedButtons.push({ name: buildName, color: "#C0C0C0", cmd: code });
  473. localStorage.setItem("savedButtons", JSON.stringify(savedButtons));
  474.  
  475. const buttonContainer = document.createElement("div");
  476. buttonContainer.style.display = "flex";
  477. buttonContainer.style.alignItems = "center";
  478. buttonContainer.style.justifyContent = "center";
  479.  
  480. const removeButton = document.createElement("button");
  481. removeButton.className = "remove-button";
  482. removeButton.textContent = "🖉";
  483. removeButton.onclick = () => {
  484. buttonContainer.remove();
  485. const updatedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  486. let newSavedButtons = updatedButtons.filter(b => b.name !== buildName);
  487. localStorage.setItem("savedButtons", JSON.stringify(newSavedButtons));
  488.  
  489. let updatedRemovedDefaults = JSON.parse(localStorage.getItem("removedDefaults")) || [];
  490. updatedRemovedDefaults = updatedRemovedDefaults.filter(b => b !== buildName);
  491. localStorage.setItem("removedDefaults", JSON.stringify(updatedRemovedDefaults));
  492. };
  493. buttonContainer.appendChild(removeButton);
  494.  
  495. const newButton = document.createElement("button");
  496. newButton.className = "button";
  497. newButton.textContent = buildName;
  498. newButton.style.backgroundColor = "#C0C0C0";
  499. newButton.onclick = () => {
  500. const spawnName = userInput.value.trim();
  501. window.input.execute(`game_spawn ${spawnName}`);
  502. window.input.execute(`game_stats_build ${code}`);
  503. const hoverMenu = document.getElementById("myhover");
  504. if (hoverMenu) {
  505. hoverMenu.style.display = hoverMenu.style.display === "none" ? "block" : "none";
  506. }
  507. };
  508. buttonContainer.appendChild(newButton);
  509.  
  510. buildButtonsContainer.appendChild(buttonContainer);
  511.  
  512. document.body.removeChild(popup);
  513. };
  514. popup.appendChild(createBuildButton);
  515.  
  516. document.body.appendChild(popup);
  517. dragElement(document.getElementById("resetPopup"));
  518. };
  519.  
  520. modMenu.appendChild(specialButton);
  521. modMenu.appendChild(topRightButton);
  522. hoverMenu.appendChild(modMenu);
  523. document.body.appendChild(hoverMenu);
  524.  
  525. document.addEventListener("keydown", (event) => {
  526. if (event.key === "r" || event.key === "R") {
  527. const hoverMenu = document.getElementById("myhover");
  528. if (hoverMenu) {
  529. hoverMenu.style.display = hoverMenu.style.display === "none" ? "block" : "none";
  530. }
  531. }
  532. });
  533.  
  534. window.onload = () => {
  535. const userInput = document.getElementById("userInput");
  536. const specialButton = document.getElementById("specialButton");
  537. const modMenu = document.getElementById("modtab");
  538. const topRightButton = document.getElementById("topRightButton");
  539.  
  540. const savedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  541. const removedDefaults = JSON.parse(localStorage.getItem("removedDefaults")) || [];
  542.  
  543. const defaultButtons = [
  544. { "name": "L3mon឵", "color": "#FFFFFF", "cmd": "656565656565654848748487484874877" },
  545. { "name": "Factory឵", "color": "#FFFFFF", "cmd": "567456745678567456745678567488888" },
  546. { "name": "OverLord2.0឵", "color": "#FFFFFF", "cmd": "456745674567456745674567456788888" },
  547. { "name": "OverLord឵", "color": "#FFFFFF", "cmd": "555666555566664444444888888822111" },
  548. { "name": "Juggernaut឵", "color": "#FFFFFF", "cmd": "213121312138238238883288327777777" },
  549. { "name": "SmasherPacifist឵", "color": "#FFFFFF", "cmd": "7654765476547654765476547654128128128312812812812831281281283" },
  550. { "name": "SmasherAttacker឵", "color": "#FFFFFF", "cmd": "7654765476547654765476547654111823823823823823823823823823823" },
  551. { "name": "SturdyDestroyer឵", "color": "#FFFFFF", "cmd": "456456456456456456456123123123123" },
  552. { "name": "Aggressor឵", "color": "#FFFFFF", "cmd": "456745674567456745674567456722111" },
  553. { "name": "SturdyAggressor឵", "color": "#FFFFFF", "cmd": "567856785678567856785678567822111" },
  554. { "name": "SturdyTriangle឵", "color": "#FFFFFF", "cmd": "567567567567567567567123123123123" },
  555. { "name": "Sniper឵", "color": "#FFFFFF", "cmd": "564456445644564815681568156818188" },
  556. { "name": "Trapper឵", "color": "#FFFFFF", "cmd": "567567485675674856756748567484848" },
  557. { "name": "Semi/Ram/Booster឵", "color": "#FFFFFF", "cmd": "567823567823148148567823567882314" },
  558. { "name": "anti-ram", "color឵": "#FFFFFF", "cmd": "234234562345623456234562345623456" },
  559. { "name": "pentrat/anti-ram឵", "color": "#FFFFFF", "cmd": "345345263452634526345263452634526" },
  560. { "name": "Anni/hybrid឵", "color": "#FFFFFF", "cmd": "456845684568456845678456782345678" },
  561. { "name": "OL/overseer឵", "color": "#FFFFFF", "cmd": "456845684568456845683456782345678" }
  562. ];
  563.  
  564. const allButtons = [...defaultButtons, ...savedButtons.filter(saved => !defaultButtons.some(defaultButton => defaultButton.name === saved.name))];
  565. const finalButtons = allButtons.filter(buttonData => !removedDefaults.includes(buttonData.name));
  566.  
  567. const buildButtonsContainer = document.createElement("div");
  568. buildButtonsContainer.id = "buildButtonsContainer";
  569. buildButtonsContainer.style.maxHeight = "400px";
  570. buildButtonsContainer.style.overflowY = "scroll";
  571. buildButtonsContainer.style.color = "black";
  572. modMenu.insertBefore(buildButtonsContainer, specialButton);
  573.  
  574. function createButton(buttonData) {
  575. const buttonContainer = document.createElement("div");
  576. buttonContainer.style.display = "flex";
  577. buttonContainer.style.alignItems = "center";
  578. buttonContainer.style.justifyContent = "center";
  579.  
  580. const removeButton = document.createElement("button");
  581. removeButton.className = "remove-button";
  582. removeButton.textContent = "🖉";
  583. removeButton.onclick = () => {
  584. createRemovePopup(buttonContainer, buttonData);
  585. };
  586. buttonContainer.appendChild(removeButton);
  587.  
  588. const button = document.createElement("button");
  589. button.className = "button";
  590. button.textContent = buttonData.name;
  591. button.style.backgroundColor = buttonData.color;
  592. button.onclick = () => {
  593. const spawnName = userInput.value.trim();
  594. window.input.execute(`game_spawn ${spawnName}`);
  595. window.input.execute(`game_stats_build ${buttonData.cmd}`);
  596. const hoverMenu = document.getElementById("myhover");
  597. if (hoverMenu) {
  598. hoverMenu.style.display = hoverMenu.style.display === "none" ? "block" : "none";
  599. }
  600. };
  601. buttonContainer.appendChild(button);
  602.  
  603. buildButtonsContainer.appendChild(buttonContainer);
  604. }
  605.  
  606. finalButtons.forEach(buttonData => createButton(buttonData));
  607.  
  608. const createBuildButton = document.getElementById("createBuildButton");
  609. createBuildButton.onclick = () => {
  610. const buildNameInput = document.getElementById("buildNameInput");
  611. const buildName = buildNameInput.value.trim();
  612. if (buildName === "") {
  613. alert("Please enter a build name.");
  614. return;
  615. }
  616.  
  617. const code = "some_code_here";
  618.  
  619. let savedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  620. savedButtons.push({ name: buildName, color: "#C0C0C0", cmd: code });
  621. localStorage.setItem("savedButtons", JSON.stringify(savedButtons));
  622.  
  623. createButton({ name: buildName, color: "#C0C0C0", cmd: code });
  624.  
  625. const popup = document.getElementById("popup");
  626. document.body.removeChild(popup);
  627. };
  628. };
  629.  
  630. document.getElementById("userInput").addEventListener("input", (event) => {
  631. localStorage.setItem("quickSpawnUsername", event.target.value);
  632. });
  633.  
  634. topRightButton.addEventListener("click", () => {
  635. const resetPopup = document.createElement("div");
  636. resetPopup.className = "popup";
  637.  
  638. const closeButton = document.createElement("button");
  639. closeButton.className = "close-btn";
  640. closeButton.textContent = "X";
  641. closeButton.onclick = () => {
  642. document.body.removeChild(resetPopup);
  643. };
  644. resetPopup.appendChild(closeButton);
  645.  
  646. const confirmationMessage = document.createElement("div");
  647. confirmationMessage.textContent = "Do you really want to reset to default builds?";
  648. confirmationMessage.style.textAlign = "center";
  649. confirmationMessage.style.marginBottom = "20px";
  650. resetPopup.appendChild(confirmationMessage);
  651.  
  652. const buttonsContainer = document.createElement("div");
  653. buttonsContainer.style.display = "flex";
  654. buttonsContainer.style.justifyContent = "space-between";
  655.  
  656. const noButton = document.createElement("button");
  657. noButton.className = "button";
  658. noButton.textContent = "NO";
  659. noButton.onclick = () => {
  660. document.body.removeChild(resetPopup);
  661. };
  662. buttonsContainer.appendChild(noButton);
  663.  
  664. const yesButton = document.createElement("button");
  665. yesButton.className = "button";
  666. yesButton.textContent = "YES";
  667. yesButton.onclick = () => {
  668. localStorage.removeItem("savedButtons");
  669. localStorage.removeItem("removedDefaults");
  670. location.reload();
  671. };
  672. buttonsContainer.appendChild(yesButton);
  673.  
  674. resetPopup.appendChild(buttonsContainer);
  675. document.body.appendChild(resetPopup);
  676. dragElement(document.getElementById("resetPopup"));
  677. dragElementVertical(document.getElementById("mainMenu")); // Add this line to apply vertical drag to main menu
  678. });
  679.  
  680. function dragElement(elmnt) {
  681. var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
  682. if (document.getElementById(elmnt.id + "Header")) {
  683. document.getElementById(elmnt.id + "Header").onmousedown = dragMouseDown;
  684. } else {
  685. elmnt.onmousedown = dragMouseDown;
  686. }
  687.  
  688. function dragMouseDown(e) {
  689. e = e || window.event;
  690. e.preventDefault();
  691. pos3 = e.clientX;
  692. pos4 = e.clientY;
  693. document.onmouseup = closeDragElement;
  694. document.onmousemove = elementDrag;
  695. }
  696.  
  697. function elementDrag(e) {
  698. e = e || window.event;
  699. e.preventDefault();
  700. pos1 = pos3 - e.clientX;
  701. pos2 = pos4 - e.clientY;
  702. pos3 = e.clientX;
  703. pos4 = e.clientY;
  704. elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
  705. elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
  706. }
  707.  
  708. function closeDragElement() {
  709. document.onmouseup = null;
  710. document.onmousemove = null;
  711. }
  712. }
  713.  
  714. function dragElementVertical(elmnt) {
  715. var pos2 = 0, pos4 = 0;
  716. if (document.getElementById(elmnt.id + "Header")) {
  717. document.getElementById(elmnt.id + "Header").onmousedown = dragMouseDown;
  718. } else {
  719. elmnt.onmousedown = dragMouseDown;
  720. }
  721.  
  722. function dragMouseDown(e) {
  723. e = e || window.event;
  724. e.preventDefault();
  725. pos4 = e.clientY;
  726. document.onmouseup = closeDragElement;
  727. document.onmousemove = elementDrag;
  728. }
  729.  
  730. function elementDrag(e) {
  731. e = e || window.event;
  732. e.preventDefault();
  733. pos2 = pos4 - e.clientY;
  734. pos4 = e.clientY;
  735. elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
  736. }
  737.  
  738. function closeDragElement() {
  739. document.onmouseup = null;
  740. document.onmousemove = null;
  741. }
  742. }
  743.  
  744. function createRemovePopup(buttonContainer, buttonData) {
  745. const popup = document.createElement("div");
  746. popup.className = "popup";
  747. popup.id = "removePopup";
  748. popup.innerHTML = `<div class="popup-header" id="removePopupHeader">Drag me</div> `;
  749. document.body.appendChild(popup);
  750.  
  751. const closeButton = document.createElement("button");
  752. closeButton.className = "close-btn";
  753. closeButton.textContent = "X";
  754. closeButton.onclick = () => {
  755. document.body.removeChild(popup);
  756. };
  757. popup.appendChild(closeButton);
  758.  
  759. const buildNameInput = document.createElement("input");
  760. buildNameInput.type = "text";
  761. buildNameInput.placeholder = "Build Name";
  762. buildNameInput.style.display = "block";
  763. buildNameInput.style.width = "80%";
  764. buildNameInput.style.margin = "0 auto 10px auto";
  765. buildNameInput.value = buttonData.name;
  766. popup.appendChild(buildNameInput);
  767.  
  768. const pointsCounter = document.createElement("div");
  769. pointsCounter.id = "pointsCounter";
  770. pointsCounter.textContent = "Points: 33";
  771. popup.appendChild(pointsCounter);
  772.  
  773. const codeString = document.createElement("input");
  774. codeString.id = "codeString";
  775. codeString.type = "text";
  776. codeString.value = buttonData.cmd;
  777. codeString.style.display = "block";
  778. codeString.style.width = "80%";
  779. codeString.style.margin = "0 auto 10px auto";
  780. popup.appendChild(codeString);
  781.  
  782. let totalPoints = 33;
  783. let code = buttonData.cmd;
  784.  
  785. const attributes = [
  786. { name: "Health Regen", color: "rgb(232, 188, 157)" },
  787. { name: "Max Health", color: "rgb(230, 128, 234)" },
  788. { name: "Body Damage", color: "rgb(165, 128, 234)" },
  789. { name: "Bullet Speed", color: "rgb(128, 162, 234)" },
  790. { name: "Bullet Penetration", color: "rgb(234, 215, 128)" },
  791. { name: "Bullet Damage", color: "rgb(234, 128, 128)" },
  792. { name: "Reload", color: "rgb(164, 234, 128)" },
  793. { name: "Movement Speed", color: "rgb(128, 234, 230)" },
  794. ];
  795.  
  796. function updateAttributes() {
  797. totalPoints = 33;
  798. attributes.forEach((attribute, index) => {
  799. const attributeRow = document.getElementById(`attributeRow-${index}`);
  800. const attributeCount = Math.min((code.match(new RegExp(index + 1, "g")) || []).length, 7);
  801. for (let i = 0; i < 7; i++) {
  802. const graySquare = attributeRow.children[i + 1];
  803. if (i < attributeCount) {
  804. graySquare.style.backgroundColor = attribute.color;
  805. graySquare.style.border = "1px solid black";
  806. totalPoints--;
  807. } else {
  808. graySquare.style.backgroundColor = "gray";
  809. graySquare.style.border = "0";
  810. }
  811. }
  812. });
  813. pointsCounter.textContent = `Points: ${totalPoints}`;
  814. }
  815.  
  816. attributes.forEach((attribute, index) => {
  817. const attributeRow = document.createElement("div");
  818. attributeRow.className = "attribute";
  819. attributeRow.id = `attributeRow-${index}`;
  820. attributeRow.style.position = "relative";
  821.  
  822. const minusButton = document.createElement("button");
  823. minusButton.style.padding = "0 5px";
  824. minusButton.style.border = "1px solid black";
  825. minusButton.style.borderTopLeftRadius = "50px";
  826. minusButton.style.borderBottomLeftRadius = "50px";
  827. minusButton.style.borderTopRightRadius = "0";
  828. minusButton.style.borderBottomRightRadius = "0";
  829. minusButton.style.width = "32px";
  830. minusButton.style.height = "32px";
  831. minusButton.textContent = "-";
  832. minusButton.onclick = () => {
  833. const coloredSquares = Array.from(attributeRow.children).filter(child => child !== plusButton && child.style.backgroundColor === attribute.color);
  834. if (coloredSquares.length > 0 && totalPoints < 33) {
  835. const square = coloredSquares[coloredSquares.length - 1];
  836. square.style.backgroundColor = "gray";
  837. square.style.border = "0";
  838. totalPoints++;
  839. pointsCounter.textContent = `Points: ${totalPoints}`;
  840. code = code.slice(0, -1);
  841. codeString.value = code;
  842. updateAttributes();
  843. }
  844. };
  845. attributeRow.appendChild(minusButton);
  846.  
  847. for (let i = 0; i < 7; i++) {
  848. const colorDiv = document.createElement("div");
  849. colorDiv.style.border = "0";
  850. colorDiv.style.backgroundColor = "gray";
  851. colorDiv.style.width = "30px";
  852. colorDiv.style.height = "30px";
  853. colorDiv.style.display = "inline-block";
  854. colorDiv.style.position = "relative";
  855. colorDiv.style.padding = "0 5px";
  856.  
  857. if (i === 3) {
  858. const textSpan = document.createElement("span");
  859. textSpan.textContent = attribute.name;
  860. textSpan.style.position = "absolute";
  861. textSpan.style.top = "50%";
  862. textSpan.style.left = "50%";
  863. textSpan.style.transform = "translate(-50%, -50%)";
  864. textSpan.style.color = "white";
  865. textSpan.style.pointerEvents = "none";
  866. textSpan.style.whiteSpace = "nowrap";
  867. textSpan.style.zIndex = "1";
  868. textSpan.style.display = "inline-block";
  869. textSpan.style.textShadow =
  870. "1px 1px 1px black, -1px -1px 1px black, -1px 1px 1px black, 1px -1px 1px black";
  871. textSpan.className = "attribute-text";
  872.  
  873. colorDiv.appendChild(textSpan);
  874. }
  875.  
  876. attributeRow.appendChild(colorDiv);
  877. }
  878.  
  879. const plusButton = document.createElement("button");
  880. plusButton.style.padding = "0 5px";
  881. plusButton.style.border = "1px solid black";
  882. plusButton.style.borderTopLeftRadius = "0";
  883. plusButton.style.borderBottomLeftRadius = "0";
  884. plusButton.style.borderTopRightRadius = "50px";
  885. plusButton.style.borderBottomRightRadius = "50px";
  886. plusButton.style.width = "32px";
  887. plusButton.style.height = "32px";
  888. plusButton.style.color = "Black";
  889. plusButton.style.fontWeight = "bold";
  890. plusButton.textContent = "+";
  891. plusButton.style.backgroundColor = attribute.color;
  892.  
  893. plusButton.onclick = () => {
  894. const graySquares = Array.from(attributeRow.children).filter(child => child.style.backgroundColor === "gray" && child !== plusButton);
  895. if (graySquares.length > 0 && totalPoints > 0) {
  896. const square = graySquares[0];
  897. square.style.backgroundColor = attribute.color;
  898. square.style.border = "1px solid black";
  899. totalPoints--;
  900. pointsCounter.textContent = `Points: ${totalPoints}`;
  901. code += (index + 1).toString();
  902. codeString.value = code;
  903. updateAttributes();
  904. }
  905. };
  906. attributeRow.appendChild(plusButton);
  907.  
  908. popup.appendChild(attributeRow);
  909. });
  910.  
  911. codeString.addEventListener("input", (event) => {
  912. code = event.target.value;
  913. updateAttributes();
  914. adjustFontSize(codeString);
  915. });
  916.  
  917. updateAttributes();
  918. adjustFontSize(codeString);
  919.  
  920. const deleteButton = document.createElement("button");
  921. deleteButton.id = "deleteButton";
  922. deleteButton.textContent = "Delete Build";
  923. deleteButton.style.display = "block";
  924. deleteButton.style.margin = "10px auto";
  925. deleteButton.style.width = "80%";
  926. deleteButton.style.textAlign = "center";
  927. deleteButton.style.fontSize = "14px";
  928. deleteButton.style.color = "black";
  929. deleteButton.style.backgroundColor = "white";
  930. deleteButton.style.border = "2px solid black";
  931. deleteButton.style.borderRadius = "5px";
  932. deleteButton.style.cursor = "pointer";
  933. deleteButton.onclick = () => {
  934. const confirmationPopup = document.createElement("div");
  935. confirmationPopup.className = "popup";
  936. confirmationPopup.id = "confirmationPopup";
  937. confirmationPopup.innerHTML = `<div class="popup-header" id="confirmationPopupHeader">Drag Me</div> `;
  938. document.body.appendChild(confirmationPopup);
  939.  
  940. const confirmationMessage = document.createElement("div");
  941. confirmationMessage.textContent = "Are you sure you want to delete this build?";
  942. confirmationMessage.style.textAlign = "center";
  943. confirmationMessage.style.marginBottom = "20px";
  944. confirmationPopup.appendChild(confirmationMessage);
  945.  
  946. const buttonsContainer = document.createElement("div");
  947. buttonsContainer.style.display = "flex";
  948. buttonsContainer.style.justifyContent = "space-between";
  949.  
  950. const noButton = document.createElement("button");
  951. noButton.className = "button";
  952. noButton.textContent = "NO";
  953. noButton.onclick = () => {
  954. document.body.removeChild(confirmationPopup);
  955. };
  956. buttonsContainer.appendChild(noButton);
  957.  
  958. const yesButton = document.createElement("button");
  959. yesButton.className = "button";
  960. yesButton.textContent = "YES";
  961. yesButton.onclick = () => {
  962. buttonContainer.remove();
  963. const updatedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  964. const newSavedButtons = updatedButtons.filter(b => b.name !== buttonData.name);
  965. localStorage.setItem("savedButtons", JSON.stringify(newSavedButtons));
  966. document.body.removeChild(confirmationPopup);
  967. document.body.removeChild(popup);
  968. };
  969. buttonsContainer.appendChild(yesButton);
  970.  
  971. confirmationPopup.appendChild(buttonsContainer);
  972. document.body.appendChild(confirmationPopup);
  973. dragElement(document.getElementById("confirmationPopup"));
  974. };
  975. popup.appendChild(deleteButton);
  976.  
  977. const createBuildButton = document.createElement("button");
  978. createBuildButton.id = "createBuildButton";
  979. createBuildButton.textContent = "Save Changes";
  980. createBuildButton.style.display = "block";
  981. createBuildButton.style.margin = "10px auto";
  982. createBuildButton.style.width = "80%";
  983. createBuildButton.style.textAlign = "center";
  984. createBuildButton.style.fontSize = "14px";
  985. createBuildButton.style.color = "black";
  986. createBuildButton.style.backgroundColor = "white";
  987. createBuildButton.style.border = "2px solid black";
  988. createBuildButton.style.borderRadius = "5px";
  989. createBuildButton.style.cursor = "pointer";
  990. createBuildButton.onclick = () => {
  991. const buildName = buildNameInput.value.trim();
  992. if (buildName === "") {
  993. alert("Please enter a build name.");
  994. return;
  995. }
  996.  
  997. buttonData.name = buildName;
  998. buttonData.cmd = codeString.value;
  999. buttonContainer.querySelector(".button").textContent = buildName;
  1000.  
  1001. document.body.removeChild(popup);
  1002. };
  1003. popup.appendChild(createBuildButton);
  1004.  
  1005. document.body.appendChild(popup);
  1006. dragElement(document.getElementById("removePopup"));
  1007. }
  1008.  
  1009. // Function to adjust font size
  1010. function adjustFontSize(element) {
  1011. let fontSize = 16; // Initial font size
  1012. element.style.fontSize = fontSize + "px";
  1013. while (element.scrollWidth > element.clientWidth && fontSize > 6) {
  1014. fontSize--;
  1015. element.style.fontSize = fontSize + "px";
  1016. }
  1017. }
  1018. })();