diep_Shortcut

try to take over the world!

目前為 2022-12-20 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/456843/1130316/diep_Shortcut.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         diep_Shortcut
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       tariteur
// @match        https://diep.io/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=diep.io
// @grant        none
// ==/UserScript==
(() => {
    const _window = 'undefined' == typeof unsafeWindow ? window : unsafeWindow;
    if (_window.diep_Shortcut) return;

    //diepAPI start
    var diep_Shortcut;
    /******/ (() => {
        // webpackBootstrap
        /******/ 'use strict';
        /******/ // The require scope
        /******/ var __webpack_require__ = {};
        /******/
        /************************************************************************/
        /******/ /* webpack/runtime/define property getters */
        /******/ (() => {
            /******/ // define getter functions for harmony exports
            /******/ __webpack_require__.d = (exports, definition) => {
                /******/ for (var key in definition) {
                    /******/ if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
                        /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
                        /******/
                    }
                    /******/
                }
                /******/
            };
            /******/
        })();
        /******/
        /******/ /* webpack/runtime/hasOwnProperty shorthand */
        /******/ (() => {
            /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
            /******/
        })();
        /******/
        /******/ /* webpack/runtime/make namespace object */
        /******/ (() => {
            /******/ // define __esModule on exports
            /******/ __webpack_require__.r = (exports) => {
                /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
                    /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
                    /******/
                }
                /******/ Object.defineProperty(exports, '__esModule', { value: true });
                /******/
            };
            /******/
        })();
        /******/
        /************************************************************************/
        var __webpack_exports__ = {};
        // ESM COMPAT FLAG
        __webpack_require__.r(__webpack_exports__);

        // EXPORTS
        __webpack_require__.d(__webpack_exports__, {
            core: () => /* reexport */ core_namespaceObject,
        });

        // NAMESPACE OBJECT: ./src/core/index.ts
        var core_namespaceObject = {};
        __webpack_require__.r(core_namespaceObject);
        __webpack_require__.d(core_namespaceObject, {
            Canvas: () => Canvas,
        });
    // const { backgroundOverlay, overlay } = window.diepAPI.tools;
    // const { Vector } = window.diepAPI.core;
    // const { scaling, player, game, minimap, arena } = window.diepAPI.apis;
    const ctx = document.getElementById('canvas').getContext('2d');
        // function toMinimapPosition(vector) {
        //         var unscale = arena.unscale(vector);
        //         var minimapPos = Vector.multiply(minimap.minimapDim, unscale);
        //         return Vector.add(minimap.minimapPos, minimapPos);
        //     }
        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'
            class CANVAS {
            GUI_create(id, Class, text, x, y,width, height, color, callback) {
                // Créer l'élément de l'interface graphique
                const guiElement = document.createElement('button');
                guiElement.id = id;
                guiElement.classList.add(Class);
                guiElement.innerHTML = text;
                guiElement.style.top = x;
                guiElement.style.left = y;
                guiElement.style.backgroundColor = color;
                guiElement.style.textShadow = textShadow;
                guiElement.style.position = 'absolute';
                guiElement.style.width = width+"vw";
                guiElement.style.height = height+"vh";
                // Appliquer les styles supplémentaires
                guiElement.style.borderRadius = '0.5vw';
                guiElement.style.fontFamily = 'Ubuntu';
                guiElement.style.opacity = '60%';
                guiElement.style.color = '#FFFFFF';
                guiElement.style.fontStyle = 'normal';
                guiElement.style.fontSize = '0.9vw';

                guiElement.addEventListener('mouseover', function() {
                guiElement.style.opacity = '100%'
                });
                guiElement.addEventListener('mouseout', function() {
                guiElement.style.opacity = '60%'
                });

                guiElement.addEventListener('click', callback);
                // Append the GUI element to the body of the document
                document.body.appendChild(guiElement);
            }
            GUI_changeName(id, text) {
                const element = document.getElementById(id);
                element.innerHTML = text;
            }
            GUI_hide_or_showID(id, truefalse) {
                const element = document.getElementById(id);
                if (truefalse == undefined) {
                if (element.style.display === 'none') {
                  element.style.display = 'block';
                } else {
                element.style.display = 'none';
                }
             } else if (truefalse == true) {
             element.style.display = 'block';
             } else if (truefalse == false) {
             element.style.display = 'none';
             }
            }
            GUI_hide_or_showClass(Class, truefalse) {
              const elements = document.querySelectorAll(Class);
              for (const element of elements) {
              if (truefalse == undefined) {
              if (element.style.display === 'none') {
                  element.style.display = 'block';
                } else {
                element.style.display = 'none';
                 }
             } else if (truefalse == true) {
             element.style.display = 'block';
             } else if (truefalse == false) {
             element.style.display = 'none';
             }
            }
            }
            GUI_delete(id) {
                const element = document.getElementById(id);
                if (element) {
                element.parentNode.removeChild(element);
                }
            }
            drawText(CTX , x, y, text, color, size, visibility, StrokeStyle, strokeStyleColor) {
                ctx.save();
                ctx.textAlign = "center"
                ctx.font = `${size}px Ubuntu`;
                ctx.fillStyle = color;
                ctx.globalAlpha = visibility;
                ctx.fillText(text, x, y)
                if (StrokeStyle) {
                ctx.strokeStyle = strokeStyleColor;
                ctx.strokeText(text, x, y);
                }
                ctx.restore();
            }
            drawLine(CTX, x1, y1, x2, y2, color, visibility) {
                ctx.save();
                ctx.fillStyle = color;
                ctx.globalAlpha = visibility;
                ctx.beginPath();
                ctx.moveTo(x1, y1);
                ctx.lineTo(x2, y2);
                ctx.stroke();
                ctx.restore();
            }

            drawPoint(CTX, x, y, size, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
                ctx.save();
                ctx.fillStyle = color;
                ctx.globalAlpha = visibility;
                ctx.beginPath();
                ctx.arc(x, y, size, 0, 2 * Math.PI);
                ctx.fill();
                if (StrokeStyle) {
                ctx.lineWidth = strokeStyleSize;
                ctx.strokeStyle = strokeStyleColor;
                ctx.stroke();
                }
                ctx.restore();
            }
            drawSquar(CTX, x1, y1, x2, y2, size, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
                ctx.save();
                ctx.fillStyle = color;
                ctx.globalAlpha = visibility;
                ctx.fillRect(x1, y1, x2 - x1, y2 - y1);
                if (StrokeStyle) {
                ctx.lineWidth = strokeStyleSize;
                ctx.strokeStyle = strokeStyleColor;
                ctx.stroke();
                }
                ctx.restore();
            }
        }
        const Canvas = new CANVAS(); // CONCATENATED MODULE: ./src/tools/index.ts // CONCATENATED MODULE: ./src/types/index.ts // CONCATENATED MODULE: ./src/index.ts

        // const shortcut = new Shortcut();
        diep_Shortcut = __webpack_exports__;
        /******/
    })();
    //diepAPI end

    _window.diep_Shortcut = diep_Shortcut;
})();