Greasy Fork 还支持 简体中文。

Diep.io Custom Points Upgrader. Beta

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

目前為 2025-03-09 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Diep.io Custom Points Upgrader. Beta
  3. // @namespace http://tampermonkey.net/
  4. // @version 10.02
  5. // @homepage https://greasyfork.org/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. .edit-button {
  176. background-color: gray;
  177. border: none;
  178. color: white;
  179. font-size: 18px;
  180. cursor: pointer;
  181. width: 30px;
  182. height: 30px;
  183. margin-right: 5px;
  184. transition: background-color 0.3s;
  185. }
  186. .edit-button:hover {
  187. background-color: lightgray;
  188. }
  189. .close-btn {
  190. display: flex;
  191. justify-content: center;
  192. align-items: center;
  193. position: absolute;
  194. top: 1px;
  195. z-index: 10;
  196. right: 0px;
  197. width: 40px;
  198. height: 35px;
  199. color: white;
  200. cursor: pointer;
  201. font-size: 18px;
  202. line-height: 30px;
  203. text-align: center;
  204. transition: background-color 0.3s;
  205. text-shadow: 1px 1px #000, 2px 2px #555;
  206. border-radius: 10px;
  207. background-color: rgba(0, 0, 0, 0.8);
  208. }
  209. .close-btn:hover {
  210. background-color: red;
  211. }
  212. #topRightButton {
  213. position: absolute;
  214. top: 10px;
  215. right: 10px;
  216. width: 30px;
  217. height: 30px;
  218. background-color: black;
  219. color: white;
  220. border: none;
  221. border-radius: 10%;
  222. cursor: pointer;
  223. font-size: 18px;
  224. display: flex;
  225. justify-content: center;
  226. align-items: center;
  227. transition: background-color 0.3s;
  228. z-index: 1001;
  229. opacity: 0.8;
  230. }
  231. #topRightButton:hover {
  232. color: red;
  233. }
  234. #buildButtonsContainer {
  235. max-height: 400px;
  236. overflow-y: scroll;
  237. margin-left: 5px;
  238. }
  239. #buildButtonsContainer {
  240. -ms-overflow-style: none;
  241. scrollbar-width: none;
  242. }
  243. ::-webkit-scrollbar {
  244. width: 10px;
  245. }
  246. ::-webkit-scrollbar-track {
  247. background: #f1f1f1;
  248. border-radius: 10px;
  249. }
  250. ::-webkit-scrollbar-thumb {
  251. background: #888;
  252. border-radius: 10px;
  253. }
  254. ::-webkit-scrollbar-thumb:hover {
  255. background: #555;
  256. }
  257. .popup {
  258. position: fixed;
  259. z-index: 9;
  260. background-color: #f1f1f1;
  261. border: 1px solid #d3d3d3;
  262. text-align: center;
  263. padding-top: 40px;
  264. }
  265. .popup-header {
  266. display: flex;
  267. justify-content: center;
  268. align-items: center;
  269. position: absolute;
  270. top: 1px;
  271. left: 0px;
  272. right: 35px;
  273. height: 30px;
  274. cursor: grabbing;
  275. z-index: 10;
  276. background-color: rgba(5, 5,5, 0.8);
  277. color: #fff;
  278. font-size: 10px;
  279. font-family: 'Monoton', cursive;
  280. text-shadow: 1px 1px #000, 2px 2px #555;
  281. border-color: white;
  282. border-radius: 10px;
  283. }
  284. `;
  285. document.head.appendChild(style);
  286.  
  287. const inputContainer = document.createElement("div");
  288. inputContainer.style.position = "relative";
  289. inputContainer.style.width = "90%";
  290. inputContainer.style.margin = "5px auto";
  291.  
  292. const heartIcon = document.createElement("span");
  293. heartIcon.textContent = "♥";
  294. heartIcon.style.position = "absolute";
  295. heartIcon.style.left = "10px";
  296. heartIcon.style.top = "50%";
  297. heartIcon.style.transform = "translateY(-50%)";
  298. heartIcon.style.cursor = "pointer";
  299. heartIcon.style.fontSize = "18px";
  300. heartIcon.style.color = "black";
  301.  
  302. const userInput = document.createElement("input");
  303. userInput.id = "userInput";
  304. userInput.type = "text";
  305. userInput.placeholder = "Enter Username";
  306. userInput.value = localStorage.getItem("quickSpawnUsername") || "";
  307. userInput.style.width = "100%";
  308. userInput.style.padding = "8px 30px 8px 30px"; // Adjusted padding to accommodate both icons
  309. userInput.style.border = "2px solid black";
  310. userInput.style.borderRadius = "5px";
  311. userInput.style.boxSizing = "border-box";
  312. userInput.style.fontFamily = "'Monoton', cursive";
  313. userInput.style.textAlign = "center";
  314.  
  315. const dropdownArrow = document.createElement("span");
  316. dropdownArrow.textContent = "▼";
  317. dropdownArrow.style.position = "absolute";
  318. dropdownArrow.style.right = "10px";
  319. dropdownArrow.style.top = "50%";
  320. dropdownArrow.style.transform = "translateY(-50%)";
  321. dropdownArrow.style.cursor = "pointer";
  322. dropdownArrow.style.fontSize = "14px";
  323. dropdownArrow.style.color = "black";
  324.  
  325. const dropdown = document.createElement("div");
  326. dropdown.id = "dropdownMenu";
  327. dropdown.style.position = "absolute";
  328. dropdown.style.width = "100%";
  329. dropdown.style.top = "100%";
  330. dropdown.style.left = "0";
  331. dropdown.style.backgroundImage = "url('https://media.tenor.com/images/f3f5354b7c304bc61882dbb1183885e7/tenor.gif')";
  332. dropdown.style.border = "2px solid black";
  333. dropdown.style.borderTop = "none";
  334. dropdown.style.display = "none";
  335. dropdown.style.zIndex = "100";
  336. dropdown.style.maxHeight = "150px";
  337. dropdown.style.overflowY = "auto";
  338.  
  339. dropdownArrow.addEventListener("click", () => {
  340. dropdown.style.display = dropdown.style.display === "block" ? "none" : "block";
  341. });
  342.  
  343. document.addEventListener("click", (event) => {
  344. if (!inputContainer.contains(event.target)) {
  345. dropdown.style.display = "none";
  346. }
  347. });
  348.  
  349. userInput.addEventListener("input", (event) => {
  350. localStorage.setItem("quickSpawnUsername", event.target.value);
  351. updateHeartIcon();
  352. });
  353.  
  354. heartIcon.addEventListener("click", () => {
  355. const name = userInput.value.trim();
  356. if (name) {
  357. const savedNames = JSON.parse(localStorage.getItem("savedNames")) || [];
  358. const nameIndex = savedNames.indexOf(name);
  359.  
  360. if (nameIndex === -1) {
  361. // Add name to saved names
  362. savedNames.push(name);
  363. heartIcon.style.color = "red";
  364. } else {
  365. // Remove name from saved names
  366. savedNames.splice(nameIndex, 1);
  367. heartIcon.style.color = "black";
  368. }
  369.  
  370. localStorage.setItem("savedNames", JSON.stringify(savedNames));
  371. updateDropdown(savedNames);
  372. }
  373. });
  374.  
  375. function updateDropdown(names) {
  376. dropdown.innerHTML = "";
  377. names.forEach(name => {
  378. const optionContainer = document.createElement("div");
  379. optionContainer.style.display = "flex";
  380. optionContainer.style.alignItems = "center";
  381. optionContainer.style.justifyContent = "space-between";
  382. optionContainer.style.padding = "8px";
  383. optionContainer.style.cursor = "pointer";
  384. optionContainer.style.fontFamily = "'Monoton', cursive";
  385. optionContainer.style.textAlign = "center";
  386. optionContainer.style.fontSize = "18px";
  387. optionContainer.style.backgroundImage = "url('https://media.tenor.com/images/f3f5354b7c304bc61882dbb1183885e7/tenor.gif')";
  388. optionContainer.style.transition = "background 0.3s";
  389.  
  390. const option = document.createElement("div");
  391. option.textContent = name;
  392. option.style.flexGrow = "1";
  393. option.style.textAlign = "left";
  394.  
  395. option.addEventListener("mouseover", () => {
  396. optionContainer.style.backgroundColor = "rgba(169, 169, 169, 0.8)";
  397. });
  398.  
  399. option.addEventListener("mouseout", () => {
  400. optionContainer.style.backgroundColor = "transparent";
  401. });
  402.  
  403. option.addEventListener("click", () => {
  404. userInput.value = name;
  405. dropdown.style.display = "none";
  406. localStorage.setItem("quickSpawnUsername", name);
  407. updateHeartIcon();
  408. });
  409.  
  410. optionContainer.appendChild(option);
  411. dropdown.appendChild(optionContainer);
  412. });
  413. }
  414.  
  415. function updateHeartIcon() {
  416. const name = userInput.value.trim();
  417. const savedNames = JSON.parse(localStorage.getItem("savedNames")) || [];
  418. if (savedNames.includes(name)) {
  419. heartIcon.style.color = "red";
  420. } else {
  421. heartIcon.style.color = "black";
  422. }
  423. }
  424.  
  425. const savedNames = JSON.parse(localStorage.getItem("savedNames")) || [];
  426. updateDropdown(savedNames);
  427. updateHeartIcon();
  428.  
  429. inputContainer.appendChild(heartIcon);
  430. inputContainer.appendChild(userInput);
  431. inputContainer.appendChild(dropdownArrow);
  432. inputContainer.appendChild(dropdown);
  433. modMenu.appendChild(inputContainer);
  434.  
  435. const buttons = [];
  436.  
  437. buttons.forEach((buttonData) => {
  438. const buttonContainer = document.createElement("div");
  439. buttonContainer.style.display = "flex";
  440. buttonContainer.style.alignItems = "center";
  441. buttonContainer.style.justifyContent = "center";
  442.  
  443. const removeButton = document.createElement("button");
  444. removeButton.className = "remove-button";
  445. removeButton.textContent = "🖉";
  446. removeButton.onclick = () => {
  447. createRemovePopup(buttonContainer, buttonData);
  448. };
  449.  
  450. buttonContainer.appendChild(removeButton);
  451.  
  452. const button = document.createElement("button");
  453. button.className = "button";
  454. button.textContent = buttonData.name;
  455. button.style.backgroundColor = buttonData.color;
  456. button.onclick = () => {
  457. const spawnName = userInput.value.trim();
  458. window.input.execute(`game_spawn ${spawnName}`);
  459. window.input.execute(`game_stats_build ${buttonData.cmd}`);
  460. const hoverMenu = document.getElementById("myhover");
  461. if (hoverMenu) {
  462. hoverMenu.style.display = hoverMenu.style.display === "none" ? "block" : "none";
  463. }
  464. };
  465. buttonContainer.appendChild(button);
  466.  
  467. modMenu.appendChild(buttonContainer);
  468. });
  469.  
  470. const specialButton = document.createElement("button");
  471. specialButton.id = "specialButton";
  472. specialButton.textContent = "[+]";
  473.  
  474. specialButton.onclick = () => {
  475. const popup = document.createElement("div");
  476. popup.className = "popup";
  477. popup.id = "resetPopup";
  478. popup.innerHTML = `<div class="popup-header" id="resetPopupHeader">Drag me</div> `;
  479. document.body.appendChild(popup);
  480.  
  481. const closeButton = document.createElement("button");
  482. closeButton.className = "close-btn";
  483. closeButton.textContent = "X";
  484. closeButton.onclick = () => {
  485. document.body.removeChild(popup);
  486. };
  487. popup.appendChild(closeButton);
  488.  
  489. const buildNameInput = document.createElement("input");
  490. buildNameInput.type = "text";
  491. buildNameInput.placeholder = "Build Name";
  492. buildNameInput.style.display = "block";
  493. buildNameInput.style.width = "80%";
  494. buildNameInput.style.margin = "0 auto 10px auto";
  495. popup.appendChild(buildNameInput);
  496.  
  497. const pointsCounter = document.createElement("div");
  498. pointsCounter.id = "pointsCounter";
  499. pointsCounter.textContent = "Points: 33";
  500. popup.appendChild(pointsCounter);
  501.  
  502. const codeString = document.createElement("div");
  503. codeString.id = "codeString";
  504. codeString.textContent = "Code: 0";
  505. popup.appendChild(codeString);
  506.  
  507. let totalPoints = 33;
  508. let code = "";
  509.  
  510. const attributes = [
  511. { name: "Health Regen", color: "rgb(232, 188, 157)" },
  512. { name: "Max Health", color: "rgb(230, 128, 234)" },
  513. { name: "Body Damage", color: "rgb(165, 128, 234)" },
  514. { name: "Bullet Speed", color: "rgb(128, 162, 234)" },
  515. { name: "Bullet Penetration", color: "rgb(234, 215, 128)" },
  516. { name: "Bullet Damage", color: "rgb(234, 128, 128)" },
  517. { name: "Reload", color: "rgb(164, 234, 128)" },
  518. { name: "Movement Speed", color: "rgb(128, 234, 230)" },
  519. ];
  520.  
  521. attributes.forEach((attribute, index) => {
  522. const attributeRow = document.createElement("div");
  523. attributeRow.className = "attribute";
  524. attributeRow.style.position = "relative";
  525.  
  526. const minusButton = document.createElement("button");
  527. minusButton.style.padding = "0 5px";
  528. minusButton.style.border = "1px solid black";
  529. minusButton.style.borderTopLeftRadius = "50px";
  530. minusButton.style.borderBottomLeftRadius = "50px";
  531. minusButton.style.borderTopRightRadius = "0";
  532. minusButton.style.borderBottomRightRadius = "0";
  533. minusButton.style.width = "32px";
  534. minusButton.style.height = "32px";
  535. minusButton.textContent = "-";
  536. minusButton.onclick = () => {
  537. const coloredSquares = Array.from(attributeRow.children).filter(child => child !== plusButton && child.style.backgroundColor === attribute.color);
  538. if (coloredSquares.length > 0 && totalPoints < 33) {
  539. const square = coloredSquares[coloredSquares.length - 1];
  540. square.style.backgroundColor = "gray";
  541. square.style.border = "0";
  542. totalPoints++;
  543. pointsCounter.textContent = `Points: ${totalPoints}`;
  544. code = code.slice(0, -1);
  545. codeString.textContent = `Code: ${code}`;
  546. }
  547. };
  548. attributeRow.appendChild(minusButton);
  549.  
  550. for (let i = 0; i < 7; i++) {
  551. const colorDiv = document.createElement("div");
  552. colorDiv.style.border = "0";
  553. colorDiv.style.backgroundColor = "gray";
  554. colorDiv.style.width = "30px";
  555. colorDiv.style.height = "30px";
  556. colorDiv.style.display = "inline-block";
  557. colorDiv.style.position = "relative";
  558. colorDiv.style.padding = "0 5px";
  559.  
  560. if (i === 3) {
  561. const textSpan = document.createElement("span");
  562. textSpan.textContent = attribute.name;
  563. textSpan.style.position = "absolute";
  564. textSpan.style.top = "50%";
  565. textSpan.style.left = "50%";
  566. textSpan.style.transform = "translate(-50%, -50%)";
  567. textSpan.style.color = "white";
  568. textSpan.style.pointerEvents = "none";
  569. textSpan.style.whiteSpace = "nowrap";
  570. textSpan.style.zIndex = "1";
  571. textSpan.style.display = "inline-block";
  572. textSpan.style.textShadow =
  573. "1px 1px 1px black, -1px -1px 1px black, -1px 1px 1px black, 1px -1px 1px black";
  574.  
  575. colorDiv.appendChild(textSpan);
  576. }
  577.  
  578. attributeRow.appendChild(colorDiv);
  579. }
  580.  
  581. const plusButton = document.createElement("button");
  582. plusButton.style.padding = "0 5px";
  583. plusButton.style.border = "1px solid black";
  584. plusButton.style.borderTopLeftRadius = "0";
  585. plusButton.style.borderBottomLeftRadius = "0";
  586. plusButton.style.borderTopRightRadius = "50px";
  587. plusButton.style.borderBottomRightRadius = "50px";
  588. plusButton.style.width = "32px";
  589. plusButton.style.height = "32px";
  590. plusButton.style.color = "Black";
  591. plusButton.style.fontWeight = "bold";
  592. plusButton.textContent = "+";
  593. plusButton.style.backgroundColor = attribute.color;
  594.  
  595. plusButton.onclick = () => {
  596. const graySquares = Array.from(attributeRow.children).filter(child => child.style.backgroundColor === "gray" && child !== plusButton);
  597. if (graySquares.length > 0 && totalPoints > 0) {
  598. const square = graySquares[0];
  599. square.style.backgroundColor = attribute.color;
  600. square.style.border = "1px solid black";
  601. totalPoints--;
  602. pointsCounter.textContent = `Points: ${totalPoints}`;
  603. code += (index + 1).toString();
  604. codeString.textContent = `Code: ${code}`;
  605. }
  606. };
  607. attributeRow.appendChild(plusButton);
  608.  
  609. popup.appendChild(attributeRow);
  610. });
  611.  
  612. const createBuildButton = document.createElement("button");
  613. createBuildButton.id = "createBuildButton";
  614. createBuildButton.textContent = "Create Build";
  615. createBuildButton.onclick = () => {
  616. const buildName = buildNameInput.value.trim();
  617. if (buildName === "") {
  618. alert("Please enter a build name.");
  619. return;
  620. }
  621.  
  622. let savedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  623. savedButtons.push({ name: buildName, color: "#C0C0C0", cmd: code });
  624. localStorage.setItem("savedButtons", JSON.stringify(savedButtons));
  625.  
  626. const buttonContainer = document.createElement("div");
  627. buttonContainer.style.display = "flex";
  628. buttonContainer.style.alignItems = "center";
  629. buttonContainer.style.justifyContent = "center";
  630.  
  631. const removeButton = document.createElement("button");
  632. removeButton.className = "remove-button";
  633. removeButton.textContent = "🖉";
  634. removeButton.onclick = () => {
  635. buttonContainer.remove();
  636. const updatedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  637. let newSavedButtons = updatedButtons.filter(b => b.name !== buildName);
  638. localStorage.setItem("savedButtons", JSON.stringify(newSavedButtons));
  639.  
  640. let updatedRemovedDefaults = JSON.parse(localStorage.getItem("removedDefaults")) || [];
  641. updatedRemovedDefaults = updatedRemovedDefaults.filter(b => b !== buildName);
  642. localStorage.setItem("removedDefaults", JSON.stringify(updatedRemovedDefaults));
  643. };
  644. buttonContainer.appendChild(removeButton);
  645.  
  646. const newButton = document.createElement("button");
  647. newButton.className = "button";
  648. newButton.textContent = buildName;
  649. newButton.style.backgroundColor = "#C0C0C0";
  650. newButton.onclick = () => {
  651. const spawnName = userInput.value.trim();
  652. window.input.execute(`game_spawn ${spawnName}`);
  653. window.input.execute(`game_stats_build ${code}`);
  654. const hoverMenu = document.getElementById("myhover");
  655. if (hoverMenu) {
  656. hoverMenu.style.display = hoverMenu.style.display === "none" ? "block" : "none";
  657. }
  658. };
  659. buttonContainer.appendChild(newButton);
  660.  
  661. buildButtonsContainer.appendChild(buttonContainer);
  662.  
  663. document.body.removeChild(popup);
  664. };
  665. popup.appendChild(createBuildButton);
  666.  
  667. document.body.appendChild(popup);
  668. dragElement(document.getElementById("resetPopup"));
  669. };
  670.  
  671. modMenu.appendChild(specialButton);
  672. modMenu.appendChild(topRightButton);
  673. hoverMenu.appendChild(modMenu);
  674. document.body.appendChild(hoverMenu);
  675.  
  676. document.addEventListener("keydown", (event) => {
  677. if ((event.key === "r" || event.key === "R") && !["INPUT", "TEXTAREA"].includes(event.target.tagName)) {
  678. const hoverMenu = document.getElementById("myhover");
  679. if (hoverMenu) {
  680. hoverMenu.style.display = hoverMenu.style.display === "none" ? "block" : "none";
  681. }
  682. }
  683. });
  684.  
  685. window.onload = () => {
  686. const userInput = document.getElementById("userInput");
  687. const specialButton = document.getElementById("specialButton");
  688. const modMenu = document.getElementById("modtab");
  689. const topRightButton = document.getElementById("topRightButton");
  690.  
  691. const savedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  692. const removedDefaults = JSON.parse(localStorage.getItem("removedDefaults")) || [];
  693.  
  694. const defaultButtons = [
  695. { "name": "L3mon឵", "color": "#FFFFFF", "cmd": "656565656565654848748487484874877" },
  696. { "name": "Factory឵", "color": "#FFFFFF", "cmd": "567456745678567456745678567488888" },
  697. { "name": "OverLord2.0឵", "color": "#FFFFFF", "cmd": "456745674567456745674567456788888" },
  698. { "name": "OverLord឵", "color": "#FFFFFF", "cmd": "555666555566664444444888888822111" },
  699. { "name": "Juggernaut឵", "color": "#FFFFFF", "cmd": "213121312138238238883288327777777" },
  700. { "name": "SmasherPacifist឵", "color": "#FFFFFF", "cmd": "7654765476547654765476547654128128128312812812812831281281283" },
  701. { "name": "SmasherAttacker឵", "color": "#FFFFFF", "cmd": "7654765476547654765476547654111823823823823823823823823823823" },
  702. { "name": "SturdyDestroyer឵", "color": "#FFFFFF", "cmd": "456456456456456456456123123123123" },
  703. { "name": "Aggressor឵", "color": "#FFFFFF", "cmd": "456745674567456745674567456722111" },
  704. { "name": "SturdyAggressor឵", "color": "#FFFFFF", "cmd": "567856785678567856785678567822111" },
  705. { "name": "SturdyTriangle឵", "color": "#FFFFFF", "cmd": "567567567567567567567123123123123" },
  706. { "name": "Sniper឵", "color": "#FFFFFF", "cmd": "564456445644564815681568156818188" },
  707. { "name": "Trapper឵", "color": "#FFFFFF", "cmd": "567567485675674856756748567484848" },
  708. { "name": "Semi/Ram/Booster឵", "color": "#FFFFFF", "cmd": "567823567823148148567823567882314" },
  709. { "name": "anti-ram", "color឵": "#FFFFFF", "cmd": "234234562345623456234562345623456" },
  710. { "name": "pentrat/anti-ram឵", "color": "#FFFFFF", "cmd": "345345263452634526345263452634526" },
  711. { "name": "Anni/hybrid឵", "color": "#FFFFFF", "cmd": "456845684568456845678456782345678" },
  712. { "name": "OL/overseer឵", "color": "#FFFFFF", "cmd": "456845684568456845683456782345678" }
  713. ];
  714.  
  715. const allButtons = [...defaultButtons, ...savedButtons.filter(saved => !defaultButtons.some(defaultButton => defaultButton.name === saved.name))];
  716. const finalButtons = allButtons.filter(buttonData => !removedDefaults.includes(buttonData.name));
  717.  
  718. const buildButtonsContainer = document.createElement("div");
  719. buildButtonsContainer.id = "buildButtonsContainer";
  720. buildButtonsContainer.style.maxHeight = "400px";
  721. buildButtonsContainer.style.overflowY = "scroll";
  722. buildButtonsContainer.style.color = "black";
  723. modMenu.insertBefore(buildButtonsContainer, specialButton);
  724.  
  725. function createButton(buttonData) {
  726. const buttonContainer = document.createElement("div");
  727. buttonContainer.style.display = "flex";
  728. buttonContainer.style.alignItems = "center";
  729. buttonContainer.style.justifyContent = "center";
  730.  
  731. const removeButton = document.createElement("button");
  732. removeButton.className = "remove-button";
  733. removeButton.textContent = "🖉";
  734. removeButton.onclick = () => {
  735. createRemovePopup(buttonContainer, buttonData);
  736. };
  737. buttonContainer.appendChild(removeButton);
  738.  
  739. const button = document.createElement("button");
  740. button.className = "button";
  741. button.textContent = buttonData.name;
  742. button.style.backgroundColor = buttonData.color;
  743. button.onclick = () => {
  744. const spawnName = userInput.value.trim();
  745. window.input.execute(`game_spawn ${spawnName}`);
  746. window.input.execute(`game_stats_build ${buttonData.cmd}`);
  747. const hoverMenu = document.getElementById("myhover");
  748. if (hoverMenu) {
  749. hoverMenu.style.display = hoverMenu.style.display === "none" ? "block" : "none";
  750. }
  751. };
  752. buttonContainer.appendChild(button);
  753.  
  754. buildButtonsContainer.appendChild(buttonContainer);
  755. }
  756.  
  757. finalButtons.forEach(buttonData => createButton(buttonData));
  758.  
  759. const createBuildButton = document.getElementById("createBuildButton");
  760. createBuildButton.onclick = () => {
  761. const buildNameInput = document.getElementById("buildNameInput");
  762. const buildName = buildNameInput.value.trim();
  763. if (buildName === "") {
  764. alert("Please enter a build name.");
  765. return;
  766. }
  767.  
  768. const code = "some_code_here";
  769.  
  770. let savedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  771. savedButtons.push({ name: buildName, color: "#C0C0C0", cmd: code });
  772. localStorage.setItem("savedButtons", JSON.stringify(savedButtons));
  773.  
  774. createButton({ name: buildName, color: "#C0C0C0", cmd: code });
  775.  
  776. const popup = document.getElementById("popup");
  777. document.body.removeChild(popup);
  778. };
  779. };
  780.  
  781. document.getElementById("userInput").addEventListener("input", (event) => {
  782. localStorage.setItem("quickSpawnUsername", event.target.value);
  783. });
  784.  
  785. topRightButton.addEventListener("click", () => {
  786. const resetPopup = document.createElement("div");
  787. resetPopup.className = "popup";
  788.  
  789. const closeButton = document.createElement("button");
  790. closeButton.className = "close-btn";
  791. closeButton.textContent = "X";
  792. closeButton.onclick = () => {
  793. document.body.removeChild(resetPopup);
  794. };
  795. resetPopup.appendChild(closeButton);
  796.  
  797. const confirmationMessage = document.createElement("div");
  798. confirmationMessage.textContent = "Do you really want to reset to default builds?";
  799. confirmationMessage.style.textAlign = "center";
  800. confirmationMessage.style.marginBottom = "20px";
  801. resetPopup.appendChild(confirmationMessage);
  802.  
  803. const buttonsContainer = document.createElement("div");
  804. buttonsContainer.style.display = "flex";
  805. buttonsContainer.style.justifyContent = "space-between";
  806.  
  807. const noButton = document.createElement("button");
  808. noButton.className = "button";
  809. noButton.textContent = "NO";
  810. noButton.onclick = () => {
  811. document.body.removeChild(resetPopup);
  812. };
  813. buttonsContainer.appendChild(noButton);
  814.  
  815. const yesButton = document.createElement("button");
  816. yesButton.className = "button";
  817. yesButton.textContent = "YES";
  818. yesButton.onclick = () => {
  819. localStorage.removeItem("savedButtons");
  820. localStorage.removeItem("removedDefaults");
  821. location.reload();
  822. };
  823. buttonsContainer.appendChild(yesButton);
  824.  
  825. resetPopup.appendChild(buttonsContainer);
  826. document.body.appendChild(resetPopup);
  827. dragElement(document.getElementById("resetPopup"));
  828. dragElementVertical(document.getElementById("mainMenu")); // Add this line to apply vertical drag to main menu
  829. });
  830.  
  831. function dragElement(elmnt) {
  832. var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
  833. if (document.getElementById(elmnt.id + "Header")) {
  834. document.getElementById(elmnt.id + "Header").onmousedown = dragMouseDown;
  835. } else {
  836. elmnt.onmousedown = dragMouseDown;
  837. }
  838.  
  839. function dragMouseDown(e) {
  840. e = e || window.event;
  841. e.preventDefault();
  842. pos3 = e.clientX;
  843. pos4 = e.clientY;
  844. document.onmouseup = closeDragElement;
  845. document.onmousemove = elementDrag;
  846. }
  847.  
  848. function elementDrag(e) {
  849. e = e || window.event;
  850. e.preventDefault();
  851. pos1 = pos3 - e.clientX;
  852. pos2 = pos4 - e.clientY;
  853. pos3 = e.clientX;
  854. pos4 = e.clientY;
  855. elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
  856. elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
  857. }
  858.  
  859. function closeDragElement() {
  860. document.onmouseup = null;
  861. document.onmousemove = null;
  862. }
  863. }
  864.  
  865. function dragElementVertical(elmnt) {
  866. var pos2 = 0, pos4 = 0;
  867. if (document.getElementById(elmnt.id + "Header")) {
  868. document.getElementById(elmnt.id + "Header").onmousedown = dragMouseDown;
  869. } else {
  870. elmnt.onmousedown = dragMouseDown;
  871. }
  872.  
  873. function dragMouseDown(e) {
  874. e = e || window.event;
  875. e.preventDefault();
  876. pos4 = e.clientY;
  877. document.onmouseup = closeDragElement;
  878. document.onmousemove = elementDrag;
  879. }
  880.  
  881. function elementDrag(e) {
  882. e = e || window.event;
  883. e.preventDefault();
  884. pos2 = pos4 - e.clientY;
  885. pos4 = e.clientY;
  886. elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
  887. }
  888.  
  889. function closeDragElement() {
  890. document.onmouseup = null;
  891. document.onmousemove = null;
  892. }
  893. }
  894.  
  895. function createRemovePopup(buttonContainer, buttonData) {
  896. const popup = document.createElement("div");
  897. popup.className = "popup";
  898. popup.id = "removePopup";
  899. popup.innerHTML = `<div class="popup-header" id="removePopupHeader">Drag me</div> `;
  900. document.body.appendChild(popup);
  901.  
  902. const closeButton = document.createElement("button");
  903. closeButton.className = "close-btn";
  904. closeButton.textContent = "X";
  905. closeButton.onclick = () => {
  906. document.body.removeChild(popup);
  907. };
  908. popup.appendChild(closeButton);
  909.  
  910. const buildNameInput = document.createElement("input");
  911. buildNameInput.type = "text";
  912. buildNameInput.placeholder = "Build Name";
  913. buildNameInput.style.display = "block";
  914. buildNameInput.style.width = "80%";
  915. buildNameInput.style.margin = "0 auto 10px auto";
  916. buildNameInput.value = buttonData.name;
  917. popup.appendChild(buildNameInput);
  918.  
  919. const pointsCounter = document.createElement("div");
  920. pointsCounter.id = "pointsCounter";
  921. pointsCounter.textContent = "Points: 33";
  922. popup.appendChild(pointsCounter);
  923.  
  924. const codeString = document.createElement("input");
  925. codeString.id = "codeString";
  926. codeString.type = "text";
  927. codeString.value = buttonData.cmd;
  928. codeString.style.display = "block";
  929. codeString.style.width = "80%";
  930. codeString.style.margin = "0 auto 10px auto";
  931. popup.appendChild(codeString);
  932.  
  933. let totalPoints = 33;
  934. let code = buttonData.cmd;
  935.  
  936. const attributes = [
  937. { name: "Health Regen", color: "rgb(232, 188, 157)" },
  938. { name: "Max Health", color: "rgb(230, 128, 234)" },
  939. { name: "Body Damage", color: "rgb(165, 128, 234)" },
  940. { name: "Bullet Speed", color: "rgb(128, 162, 234)" },
  941. { name: "Bullet Penetration", color: "rgb(234, 215, 128)" },
  942. { name: "Bullet Damage", color: "rgb(234, 128, 128)" },
  943. { name: "Reload", color: "rgb(164, 234, 128)" },
  944. { name: "Movement Speed", color: "rgb(128, 234, 230)" },
  945. ];
  946.  
  947. function updateAttributes() {
  948. totalPoints = 33;
  949. attributes.forEach((attribute, index) => {
  950. const attributeRow = document.getElementById(`attributeRow-${index}`);
  951. const attributeCount = Math.min((code.match(new RegExp(index + 1, "g")) || []).length, 7);
  952. for (let i = 0; i < 7; i++) {
  953. const graySquare = attributeRow.children[i + 1];
  954. if (i < attributeCount) {
  955. graySquare.style.backgroundColor = attribute.color;
  956. graySquare.style.border = "1px solid black";
  957. totalPoints--;
  958. } else {
  959. graySquare.style.backgroundColor = "gray";
  960. graySquare.style.border = "0";
  961. }
  962. }
  963. });
  964. pointsCounter.textContent = `Points: ${totalPoints}`;
  965. }
  966.  
  967. attributes.forEach((attribute, index) => {
  968. const attributeRow = document.createElement("div");
  969. attributeRow.className = "attribute";
  970. attributeRow.id = `attributeRow-${index}`;
  971. attributeRow.style.position = "relative";
  972.  
  973. const minusButton = document.createElement("button");
  974. minusButton.style.padding = "0 5px";
  975. minusButton.style.border = "1px solid black";
  976. minusButton.style.borderTopLeftRadius = "50px";
  977. minusButton.style.borderBottomLeftRadius = "50px";
  978. minusButton.style.borderTopRightRadius = "0";
  979. minusButton.style.borderBottomRightRadius = "0";
  980. minusButton.style.width = "32px";
  981. minusButton.style.height = "32px";
  982. minusButton.textContent = "-";
  983. minusButton.onclick = () => {
  984. const coloredSquares = Array.from(attributeRow.children).filter(child => child !== plusButton && child.style.backgroundColor === attribute.color);
  985. if (coloredSquares.length > 0 && totalPoints < 33) {
  986. const square = coloredSquares[coloredSquares.length - 1];
  987. square.style.backgroundColor = "gray";
  988. square.style.border = "0";
  989. totalPoints++;
  990. pointsCounter.textContent = `Points: ${totalPoints}`;
  991. code = code.slice(0, -1);
  992. codeString.value = code;
  993. updateAttributes();
  994. }
  995. };
  996. attributeRow.appendChild(minusButton);
  997.  
  998. for (let i = 0; i < 7; i++) {
  999. const colorDiv = document.createElement("div");
  1000. colorDiv.style.border = "0";
  1001. colorDiv.style.backgroundColor = "gray";
  1002. colorDiv.style.width = "30px";
  1003. colorDiv.style.height = "30px";
  1004. colorDiv.style.display = "inline-block";
  1005. colorDiv.style.position = "relative";
  1006. colorDiv.style.padding = "0 5px";
  1007.  
  1008. if (i === 3) {
  1009. const textSpan = document.createElement("span");
  1010. textSpan.textContent = attribute.name;
  1011. textSpan.style.position = "absolute";
  1012. textSpan.style.top = "50%";
  1013. textSpan.style.left = "50%";
  1014. textSpan.style.transform = "translate(-50%, -50%)";
  1015. textSpan.style.color = "white";
  1016. textSpan.style.pointerEvents = "none";
  1017. textSpan.style.whiteSpace = "nowrap";
  1018. textSpan.style.zIndex = "1";
  1019. textSpan.style.display = "inline-block";
  1020. textSpan.style.textShadow =
  1021. "1px 1px 1px black, -1px -1px 1px black, -1px 1px 1px black, 1px -1px 1px black";
  1022. textSpan.className = "attribute-text";
  1023.  
  1024. colorDiv.appendChild(textSpan);
  1025. }
  1026.  
  1027. attributeRow.appendChild(colorDiv);
  1028. }
  1029.  
  1030. const plusButton = document.createElement("button");
  1031. plusButton.style.padding = "0 5px";
  1032. plusButton.style.border = "1px solid black";
  1033. plusButton.style.borderTopLeftRadius = "0";
  1034. plusButton.style.borderBottomLeftRadius = "0";
  1035. plusButton.style.borderTopRightRadius = "50px";
  1036. plusButton.style.borderBottomRightRadius = "50px";
  1037. plusButton.style.width = "32px";
  1038. plusButton.style.height = "32px";
  1039. plusButton.style.color = "Black";
  1040. plusButton.style.fontWeight = "bold";
  1041. plusButton.textContent = "+";
  1042. plusButton.style.backgroundColor = attribute.color;
  1043.  
  1044. plusButton.onclick = () => {
  1045. const graySquares = Array.from(attributeRow.children).filter(child => child.style.backgroundColor === "gray" && child !== plusButton);
  1046. if (graySquares.length > 0 && totalPoints > 0) {
  1047. const square = graySquares[0];
  1048. square.style.backgroundColor = attribute.color;
  1049. square.style.border = "1px solid black";
  1050. totalPoints--;
  1051. pointsCounter.textContent = `Points: ${totalPoints}`;
  1052. code += (index + 1).toString();
  1053. codeString.value = code;
  1054. updateAttributes();
  1055. }
  1056. };
  1057. attributeRow.appendChild(plusButton);
  1058.  
  1059. popup.appendChild(attributeRow);
  1060. });
  1061.  
  1062. codeString.addEventListener("input", (event) => {
  1063. code = event.target.value;
  1064. updateAttributes();
  1065. adjustFontSize(codeString);
  1066. });
  1067.  
  1068. updateAttributes();
  1069. adjustFontSize(codeString);
  1070.  
  1071. const deleteButton = document.createElement("button");
  1072. deleteButton.id = "deleteButton";
  1073. deleteButton.textContent = "Delete Build";
  1074. deleteButton.style.display = "block";
  1075. deleteButton.style.margin = "10px auto";
  1076. deleteButton.style.width = "80%";
  1077. deleteButton.style.textAlign = "center";
  1078. deleteButton.style.fontSize = "14px";
  1079. deleteButton.style.color = "black";
  1080. deleteButton.style.backgroundColor = "white";
  1081. deleteButton.style.border = "2px solid black";
  1082. deleteButton.style.borderRadius = "5px";
  1083. deleteButton.style.cursor = "pointer";
  1084. deleteButton.onclick = () => {
  1085. const confirmationPopup = document.createElement("div");
  1086. confirmationPopup.className = "popup";
  1087. confirmationPopup.id = "confirmationPopup";
  1088. confirmationPopup.innerHTML = `<div class="popup-header" id="confirmationPopupHeader">Drag Me</div> `;
  1089. document.body.appendChild(confirmationPopup);
  1090.  
  1091. const confirmationMessage = document.createElement("div");
  1092. confirmationMessage.textContent = "Are you sure you want to delete this build?";
  1093. confirmationMessage.style.textAlign = "center";
  1094. confirmationMessage.style.marginBottom = "20px";
  1095. confirmationPopup.appendChild(confirmationMessage);
  1096.  
  1097. const buttonsContainer = document.createElement("div");
  1098. buttonsContainer.style.display = "flex";
  1099. buttonsContainer.style.justifyContent = "space-between";
  1100.  
  1101. const noButton = document.createElement("button");
  1102. noButton.className = "button";
  1103. noButton.textContent = "NO";
  1104. noButton.onclick = () => {
  1105. document.body.removeChild(confirmationPopup);
  1106. };
  1107. buttonsContainer.appendChild(noButton);
  1108.  
  1109. const yesButton = document.createElement("button");
  1110. yesButton.className = "button";
  1111. yesButton.textContent = "YES";
  1112. yesButton.onclick = () => {
  1113. buttonContainer.remove();
  1114. const updatedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  1115. const newSavedButtons = updatedButtons.filter(b => b.name !== buttonData.name);
  1116. localStorage.setItem("savedButtons", JSON.stringify(newSavedButtons));
  1117. document.body.removeChild(confirmationPopup);
  1118. document.body.removeChild(popup);
  1119. };
  1120. buttonsContainer.appendChild(yesButton);
  1121.  
  1122. confirmationPopup.appendChild(buttonsContainer);
  1123. document.body.appendChild(confirmationPopup);
  1124. dragElement(document.getElementById("confirmationPopup"));
  1125. };
  1126. popup.appendChild(deleteButton);
  1127.  
  1128. const createBuildButton = document.createElement("button");
  1129. createBuildButton.id = "createBuildButton";
  1130. createBuildButton.textContent = "Save Changes";
  1131. createBuildButton.style.display = "block";
  1132. createBuildButton.style.margin = "10px auto";
  1133. createBuildButton.style.width = "80%";
  1134. createBuildButton.style.textAlign = "center";
  1135. createBuildButton.style.fontSize = "14px";
  1136. createBuildButton.style.color = "black";
  1137. createBuildButton.style.backgroundColor = "white";
  1138. createBuildButton.style.border = "2px solid black";
  1139. createBuildButton.style.borderRadius = "5px";
  1140. createBuildButton.style.cursor = "pointer";
  1141. createBuildButton.onclick = () => {
  1142. const buildName = buildNameInput.value.trim();
  1143. if (buildName === "") {
  1144. alert("Please enter a build name.");
  1145. return;
  1146. }
  1147.  
  1148. buttonData.name = buildName;
  1149. buttonData.cmd = codeString.value;
  1150. buttonContainer.querySelector(".button").textContent = buildName;
  1151.  
  1152. document.body.removeChild(popup);
  1153. };
  1154. popup.appendChild(createBuildButton);
  1155.  
  1156. document.body.appendChild(popup);
  1157. dragElement(document.getElementById("removePopup"));
  1158. }
  1159.  
  1160. function adjustFontSize(element) {
  1161. let fontSize = 16; // Initial font size
  1162. element.style.fontSize = fontSize + "px";
  1163. while (element.scrollWidth > element.clientWidth && fontSize > 6) {
  1164. fontSize--;
  1165. element.style.fontSize = fontSize + "px";
  1166. }
  1167. }
  1168. })();