From a503e9dd2fb936cf94ab79546161401db06acc40 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Thu, 14 Jul 2022 00:21:53 +0800 Subject: + maby fix crash for some people --- features/dungeonMap/index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'features/dungeonMap/index.js') diff --git a/features/dungeonMap/index.js b/features/dungeonMap/index.js index ddfb534..68adf7e 100644 --- a/features/dungeonMap/index.js +++ b/features/dungeonMap/index.js @@ -861,11 +861,21 @@ class DungeonMap extends Feature { let renderX = Math.round((parseInt(x) + 16) / this.mapScale + this.offset[0]) // / 128 * size let renderY = Math.round((parseInt(y) + 16) / this.mapScale + this.offset[1])// / 128 * size - - if (bytes[renderX + renderY * 128] === 30) { - let [first, second] = ent[1].split(" ") - ent[1] = "&a" + second + " " + second + // console.log(renderX, renderY) + let isGreen = false + for (let i = 0; i < 10; i++) { + if (bytes[renderX + i + (renderY + i) * 128] === 30 + || bytes[renderX + i + 1 + (renderY + i) * 128] === 30) { + isGreen = true + } + } + console.log(ent[1], isGreen) + if (isGreen) { + let total = ent[1].split(" ")[1] + ent[1] = "&a" + total + " " + total + console.log(ent[1]) } + console.log(ent[1], isGreen) } } // if (!this.renderImage) return -- cgit