Shape Aimbot UPDATED

try to take over the world!

目前為 2023-10-14 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Shape Aimbot UPDATED
// @namespace    http://tampermonkey.net/
// @version      10
// @description  try to take over the world!
// @author       Mi300
// @match        https://diep.io/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @license      dont copy thx
// @grant        none
// ==/UserScript==
setTimeout(function(){
const canvas = document.getElementById ('canvas');
const context = canvas.getContext ('2d');
let mouse = [0, 0]
let shapes = {};
const
p = CanvasRenderingContext2D.prototype,
_fill = p.fill,
_moveTo = p.moveTo,
_lineTo = p.lineTo,
_beginPath = p.beginPath,
_toString = Function.prototype.toString;

let fill,
moveTo,
lineTo,
beginPath;


function clearShapes() {
shapes = {
  squares: [],
  triangles: [],
  pentagons: [],
}
}
clearShapes();
let shapeData = {
  triangles: {
    sides: 3,
    colour: '',
  },
  squares: {
    sides: 4,
    colour: '',
  },
  pentagons: {
    sides: 5,
    colour: '',
  },
}
let debugOptions = {
  lines: true,
  shapeInfo: true,
  aim: false,
}
const names = {
  squares: 'square',
  triangles: 'triangle',
  pentagons: 'pentagon',
}
document.addEventListener('keydown', function(e) {
  if (e.key === 't') {
    debugOptions.aim = !debugOptions.aim;
  }
  if (e.key === 'r') {
    debugOptions.lines = !debugOptions.lines;
  }
  if (e.key === 'q') {
    debugOptions.shapeInfo = !debugOptions.shapeInfo;
  }
});


  let calls = 0;
  let points = [];
 const onClose = (c) => {
    if(['#999999', '#000000', '#00b2e1', '#fcc376'].includes(c)) {
      return;
    }
    if(calls == 4){
      shapes.triangles.push(getCentre(points))
    }
    if(calls == 5){
      shapes.squares.push(getCentre(points))
    }
    if(calls == 6){
      shapes.pentagons.push(getCentre(points))
    }
 }
  beginPath = function(...args) {
    calls = 1;
    points = [];
    _beginPath.call(this, ...args);
  }
  moveTo = function(...args) {
    calls = 2;
    points.push (args);
    _moveTo.call(this, ...args)
  }
  lineTo = function(...args) {
    if (calls >= 2 && calls <= 5) {
      calls ++;
      points.push (args);
    } else {
      calls = 0;
   }
   _lineTo.call(this, ...args)
  }
  fill = function(...args) {
      onClose(this.fillStyle);
    _fill.call(this, ...args)
  }

function getCentre (vertices) {
  let centre = [0, 0];
  vertices.forEach (vertex => {
    centre [0] += vertex[0]
    centre [1] += vertex[1]
  });
  centre[0] /= vertices.length;
  centre[1] /= vertices.length;
  return centre;
}
document.addEventListener('mousemove', function() {
  if (!debugOptions.aim) {
    return;
  }
  input.mouse(...mouse)
});

function getDist(t1, t2){
  const distX = t1[0] - t2[0];
  const distY = t1[1] - t2[1];

  return [Math.hypot(distX, distY), distX, distY];
 };
function getClosest (entities) {
  let acc = [0, 0]
  for (let i = 0; i < entities.length; i ++) {
    const accumulator = getDist (acc, [canvas.width / 2, canvas.height / 2])[0];
    const current = getDist (entities[i], [canvas.width / 2, canvas.height / 2])[0];

    if (current < accumulator) acc = entities[i];
  }
  return acc;
}
function aim() {
  const target = getClosest
  (
    shapes.pentagons.length>0
    ?shapes.pentagons
    :shapes.triangles.length>0
    ?shapes.triangles
    :shapes.squares
  )
  if (!debugOptions.aim) {
    return;
  }
  mouse = target;
  input.mouse(...target)
}
function drawDebug() {

  if (debugOptions.lines) {
    const everyshape = [].concat(
      shapes.squares,
      shapes.triangles,
      shapes.pentagons,
    )
    everyshape.forEach(function(shape){
      context.beginPath();
      context.lineWidth = 0.5;
      context.strokeStyle == 'black';
      context.moveTo(canvas.width / 2, canvas.height / 2);
      context.lineTo(...shape)

      context.stroke()
      context.closePath()
    });
  }
  if (debugOptions.shapeInfo) {
    for (let key in shapes) {
      const type = shapeData[key];

      context.strokeStyle = 'red';
      context.lineWidth = 2;
      shapes[key].forEach(function(shape){
        const size = 75;
        context.beginPath();
        context.strokeRect(shape[0] - size / 2, shape[1] - size / 2, size, size);
        context.closePath();
      });
    }
    for (let key in shapes) {
      const type = shapeData[key];
      shapes[key].forEach(function(shape){
        const size = 75;
        context.beginPath();
        context.lineWidth = 2;
        context.font = "bold 23px serif";
        context.strokeStyle = '#000000';
        context.fillStyle = 'red';
        context.strokeText(names[key], shape[0] - 25, shape[1] + size / 2.5)
        context.fillText(names[key], shape[0] - 25, shape[1] + size / 2.5)
        context.closePath();
      });
    }
  }
}

function mainloop() {
  window.requestAnimationFrame(mainloop);
  drawDebug();
  aim();
  clearShapes();
}
mainloop();



const toString = function() {
  switch(this) {
    case fill: return _toString.call(_fill);
    case moveTo: return _toString.call(_moveTo);
    case beginPath: return _toString.call(_beginPath);
    case lineTo: return _toString.call(_lineTo);
    case toString: return _toString.call(_toString);
  }
  return _toString.call(this);
};
p.fill = fill;
p.beginPath = beginPath;
p.moveTo = moveTo;
p.lineTo = lineTo;
Function.prototype.toString = toString;
},2500);