DigDig.IO X-Ray

Let's you see more in digdig.io

当前为 2021-09-06 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         DigDig.IO X-Ray
// @namespace    https://tampermonkey.net/
// @version      0.0.1
// @description  Let's you see more in digdig.io
// @author       Zertalious (Zert)
// @match        *://digdig.io/*
// @icon         https://www.google.com/s2/favicons?domain=digdig.io
// @require      https://cdn.jsdelivr.net/gh/Qwokka/WAIL@9ed21abc43045e19f9b3756de109a6e361fb9292/wail.js
// ==/UserScript==

// Only works when fow is done client side
// Should or shouldn't work depending on the current live build
// Created on build: 41e6c4662ebb8e04b62e5ac95c03eb1d8f5427d1

// code block ids:
// 4 = lava, diamond, gold, uranium
// 3 = ?? (not empty, maybe some reversed id)
// 0 = dirt
// 1 = quartz
// 2 = bedrock

// Changes the shape of the fog to a square.
// Isn't really needed but kinda cool.

/*find( array, [
	OP_F64_CONST, ...Float64ToArray( 1.4142135623730951 )
], function ( start, end ) {

	array.set( Float64ToArray( 1 ), start + 1 );

} );*/

const _instantiateStreaming = WebAssembly.instantiateStreaming;

WebAssembly.instantiateStreaming = function () {

	return _instantiateStreaming( new Response() );

}

const _instantiate = WebAssembly.instantiate;

WebAssembly.instantiate = function ( buffer, imports ) {

	const array = new Uint8Array( buffer );

	find( array, [
		OP_BR_TABLE, 7, 4, 4, 4, 2, 4, 1, 3, 0
	], function ( i, end ) {

		i += 2;

		for ( ; i <= end; i ++ ) {

			array[ i ] = 1;

		}

	} );

	find( array, [
		OP_F32_CONST, ...Float32ToArray( 2 ), 
		OP_SET_LOCAL, 28
	], function ( start, end ) {

		find( array, [
			OP_F32_CONST, ...Float32ToArray( 2 ), 
			OP_SET_LOCAL, 28
		], function ( start, end ) {

			array.set( Float32ToArray( - 1 ), start + 1 );

		} );

	} );

	return _instantiate( buffer, imports );

}

function find( array, search, callback ) {

	main: for ( let i = 0; i < array.length; i ++ ) {

		for ( let j = 0; j < search.length; j ++ ) {

			if ( search[ j ] !== - 1 && array[ i + j ] !== search[ j ] ) {

				continue main;

			}

		}

		callback( i, i + search.length - 1 );

	}

}

function Float32ToArray( x ) {

	return new Uint8Array( new Float32Array( [ x ] ).buffer );

}

function Float64ToArray( x ) {

	return new Uint8Array( new Float64Array( [ x ] ).buffer );

}