diep_Shortcut

try to take over the world!

当前为 2022-12-29 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/456843/1133071/diep_Shortcut.js

  1. // ==UserScript==
  2. // @name diep_Shortcut
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author tariteur
  7. // @match https://diep.io/
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=diep.io
  9. // @grant none
  10. // ==/UserScript==
  11. (() => {
  12. const _window = 'undefined' == typeof unsafeWindow ? window : unsafeWindow;
  13. if (_window.diep_Shortcut) return;
  14.  
  15. //diepAPI start
  16. var diep_Shortcut;
  17. /******/ (() => {
  18. // webpackBootstrap
  19. /******/ 'use strict';
  20. /******/ // The require scope
  21. /******/ var __webpack_require__ = {};
  22. /******/
  23. /************************************************************************/
  24. /******/ /* webpack/runtime/define property getters */
  25. /******/ (() => {
  26. /******/ // define getter functions for harmony exports
  27. /******/ __webpack_require__.d = (exports, definition) => {
  28. /******/ for (var key in definition) {
  29. /******/ if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  30. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  31. /******/
  32. }
  33. /******/
  34. }
  35. /******/
  36. };
  37. /******/
  38. })();
  39. /******/
  40. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  41. /******/ (() => {
  42. /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
  43. /******/
  44. })();
  45. /******/
  46. /******/ /* webpack/runtime/make namespace object */
  47. /******/ (() => {
  48. /******/ // define __esModule on exports
  49. /******/ __webpack_require__.r = (exports) => {
  50. /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  51. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  52. /******/
  53. }
  54. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  55. /******/
  56. };
  57. /******/
  58. })();
  59. /******/
  60. /************************************************************************/
  61. var __webpack_exports__ = {};
  62. // ESM COMPAT FLAG
  63. __webpack_require__.r(__webpack_exports__);
  64.  
  65. // EXPORTS
  66. __webpack_require__.d(__webpack_exports__, {
  67. core: () => /* reexport */ core_namespaceObject,
  68. });
  69.  
  70. // NAMESPACE OBJECT: ./src/core/index.ts
  71. var core_namespaceObject = {};
  72. __webpack_require__.r(core_namespaceObject);
  73. __webpack_require__.d(core_namespaceObject, {
  74. Canvas: () => Canvas,
  75. });
  76.  
  77. const { Vector, CanvasKit } = window.diepAPI.core;
  78. const { EntityColor } = window.diepAPI.types;
  79. const { scaling, player, game, minimap, camera, arena } = window.diepAPI.apis;
  80. const { backgroundOverlay } = window.diepAPI.tools;
  81. const { entityManager } = window.diepAPI.extensions;
  82. const ctx = backgroundOverlay.ctx;
  83. const canvas = document.getElementById('canvas');
  84. const ctx2 = canvas.getContext('2d');
  85. const colors = ["#E8B18A", "#E666EA", "#9566EA", "#6690EA", "#E7D063", "#EA6666", "#92EA66", "#808080"];
  86. ////////////////////pink////////violet/////bleu///////jaune//////rouge//////vert///////bleu clair//gris////
  87. const textShadow = 'text-shadow:black 0.18vh 0, black -0.18vh 0, black 0 -0.18vh, black 0 0.18vh, black 0.18vh 0.18vh, black -0.18vh 0.18vh, black 0.18vh -0.18vh, black -0.18vh -0.18vh, black 0.09vh 0.18vh, black -0.09vh 0.18vh, black 0.09vh -0.18vh, black -0.09vh -0.18vh, black 0.18vh 0.09vh, black -0.18vh 0.09vh, black 0.18vh -0.09vh, black -0.18vh -0.09vh'
  88. class CANVAS {
  89. GUI_create(id, Class, text, x, y,width, height, color, border, fontSize, callback) {
  90. // Créer l'élément de l'interface graphique
  91. const guiElement = document.createElement('d-button');
  92. guiElement.id = id;
  93. guiElement.classList.add(Class);
  94. guiElement.innerHTML = text;
  95. guiElement.style.top = x+"%";
  96. guiElement.style.left = y+"%";
  97. guiElement.border = border;
  98. guiElement.style.fontSize = fontSize+"vw";
  99. guiElement.textBorder = fontSize;
  100. guiElement.style.position = 'absolute';
  101. guiElement.style.width = width+"vw";
  102. guiElement.style.height = height+"vh";
  103.  
  104. const baseElement = document.getElementById('base');
  105. baseElement.style.backgroundColor = color;
  106. guiElement.addEventListener('click', callback);
  107. // Append the GUI element to the body of the document
  108. document.body.appendChild(guiElement);
  109. }
  110.  
  111. GUI_changeName(id, text) {
  112. const element = document.getElementById(id);
  113. element.innerHTML = text;
  114. }
  115. GUI_hide_or_showID(id, truefalse) {
  116. const element = document.getElementById(id);
  117. if (truefalse == undefined) {
  118. if (element.style.display === 'none') {
  119. element.style.display = 'block';
  120. } else {
  121. element.style.display = 'none';
  122. }
  123. } else if (truefalse == true) {
  124. element.style.display = 'block';
  125. } else if (truefalse == false) {
  126. element.style.display = 'none';
  127. }
  128. }
  129. GUI_hide_or_showClass(Class, truefalse) {
  130. const elements = document.querySelectorAll(Class);
  131. for (const element of elements) {
  132. if (truefalse == undefined) {
  133. if (element.style.display === 'none') {
  134. element.style.display = 'block';
  135. } else {
  136. element.style.display = 'none';
  137. }
  138. } else if (truefalse == true) {
  139. element.style.display = 'block';
  140. } else if (truefalse == false) {
  141. element.style.display = 'none';
  142. }
  143. }
  144. }
  145. GUI_delete(id) {
  146. const element = document.getElementById(id);
  147. if (element) {
  148. element.parentNode.removeChild(element);
  149. }
  150. }
  151. drawText(canvasType , x, y, text1, text2, color, size, visibility, StrokeStyle, strokeStyleColor) {
  152. canvasType.save();
  153. canvasType.textAlign = "center"
  154. canvasType.font = `${size}px Ubuntu`;
  155. canvasType.fillStyle = color;
  156. canvasType.globalAlpha = visibility;
  157. canvasType.fillText(text1, x, y)
  158. if (StrokeStyle) {
  159. canvasType.strokeStyle = strokeStyleColor;
  160. canvasType.strokeText(text1, x, y);
  161. }
  162. canvasType.restore();
  163. }
  164. drawLine(canvasType, xy, XY, color, visibility) {
  165. canvasType.save();
  166. canvasType.fillStyle = color;
  167. canvasType.globalAlpha = visibility;
  168. canvasType.beginPath();
  169. canvasType.moveTo(xy.x, xy.y);
  170. canvasType.lineTo(XY.x, XY.y);
  171. canvasType.stroke();
  172. canvasType.restore();
  173. }
  174.  
  175. drawPoint(canvasType, xy, radius, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
  176. canvasType.save();
  177. canvasType.fillStyle = color;
  178. canvasType.globalAlpha = visibility;
  179. canvasType.beginPath();
  180. canvasType.arc(xy.x, xy.y, radius, 0, 2 * Math.PI);
  181. canvasType.fill();
  182. if (StrokeStyle) {
  183. canvasType.lineWidth = strokeStyleSize;
  184. canvasType.strokeStyle = strokeStyleColor;
  185. canvasType.stroke();
  186. }
  187. canvasType.restore();
  188. }
  189.  
  190. drawSquar(canvasType, x1, y1, x2, y2, size, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
  191. canvasType.save();
  192. canvasType.fillStyle = color;
  193. canvasType.globalAlpha = visibility;
  194. canvasType.fillRect(x1, y1, x2 - x1, y2 - y1);
  195. if (StrokeStyle) {
  196. canvasType.lineWidth = strokeStyleSize;
  197. canvasType.strokeStyle = strokeStyleColor;
  198. canvasType.stroke();
  199. }
  200. canvasType.restore();
  201. }
  202. }
  203. const Canvas = new CANVAS(); // CONCATENATED MODULE: ./src/tools/index.ts // CONCATENATED MODULE: ./src/types/index.ts // CONCATENATED MODULE: ./src/index.ts
  204.  
  205. // const shortcut = new Shortcut();
  206. diep_Shortcut = __webpack_exports__;
  207. /******/
  208. })();
  209. //diepAPI end
  210.  
  211. _window.diep_Shortcut = diep_Shortcut;
  212. })();