/Diep.io-Canvas-Hook

Used to edit the canvas in diep.io

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Diep.io Canvas Hook

Used to edit the canvas in diep.io. You can use it in your tampermonkey script like so:

// @require https://raw.githubusercontent.com/endless7z/Diep.io-Canvas-Hook/main/canvas-hook.js

Events

A list of events to listen for can be acquired using this code snippet:

Object.keys(CanvasRenderingContext2D.prototype);

Then,

const Canvas = new CanvasHook();

Canvas.on(YOUR_EVENT, event => {
    ...
});

Examples

Replace all text with "lol"

const Canvas = new CanvasHook();

Canvas.on(['fillText', 'strokeText'], text => {
    text.arguments[0] = 'lol'; // replaces all text with "lol"
});

lol

Change the stroke color of everything to red

const Canvas = new CanvasHook();

Canvas.on('stroke', text => {
    text.element.strokeStyle = '#FF0000'; // turns stuff red
});

stroke