🏠

Greasy Fork is available in English.

Mxo New Bot Librarys/Depencens - Task Processor

For Mxo New Bot - Library/Depencens

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.org/scripts/465120/1185626/Mxo%20New%20Bot%20LibrarysDepencens%20-%20Task%20Processor.js

提问、发表评价,或者 举报这个脚本
// ==UserScript==
// @version      1.0
// @author       https://github.com/bababoyy
// @license      GPL-3.0
// ==/UserScript==
onmessage = function (v) {
var args = v.data;
var tasks = [];
for (let yAxis = 0; yAxis < args.image.length; yAxis++) {
for (let xAxis = 0; xAxis < args.image[yAxis].length; xAxis++) {
let pixel = args.image[yAxis][xAxis];
let [x, y] = args.coords;
x += xAxis;
y += yAxis;
var color = pixel.charCodeAt(0) - "0".charCodeAt(0);
if (color == 64) {
continue;
}
tasks.push({
x: x,
y: y,
color: color,
});
}
}
postMessage(tasks);
};