diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/bestiary/index.js | 13 | ||||
-rw-r--r-- | features/dungeonMap/index.js | 24 | ||||
-rw-r--r-- | features/dungeonSolvers/index.js | 17 | ||||
-rw-r--r-- | features/events/index.js | 1 | ||||
-rw-r--r-- | features/globalSettings/index.js | 9 | ||||
-rw-r--r-- | features/hud/HudTextElement.js | 9 | ||||
-rw-r--r-- | features/hud/index.js | 9 | ||||
-rw-r--r-- | features/lockedFeatures/index.js | 1 | ||||
-rw-r--r-- | features/mining/index.js | 1 | ||||
-rw-r--r-- | features/slayers/index.js | 1 | ||||
-rw-r--r-- | features/spamHider/index.js | 2 | ||||
-rw-r--r-- | features/waypoints/index.js | 83 |
12 files changed, 116 insertions, 54 deletions
diff --git a/features/bestiary/index.js b/features/bestiary/index.js index 00d5752..d21fc2a 100644 --- a/features/bestiary/index.js +++ b/features/bestiary/index.js @@ -59,10 +59,6 @@ class Bestiary extends Feature { } this.registerStep(false, 5, this.updateHudElements) - this.registerEvent("renderOverlay", this.renderHUD) - // TODO - // dragon - // headless_horseman let lastThing = undefined let lastThingTime = 0 this.registerChat("${chat}", (chat) => { @@ -120,12 +116,6 @@ class Bestiary extends Feature { } } - renderHUD() { - for (let stat of this.hudStat) { - stat.textElement.render() - } - } - getBestiaryCount(id) { if (!this.bestiaryData[id]) return "???" let count = this.bestiaryData[id].count @@ -156,6 +146,8 @@ class Bestiary extends Feature { let type = stat.type.getValue() stat.textElement.setText(`&6${this.bestiaryData[type]?.guiName}&7> &f${numberWithCommas(this.getBestiaryCount(type))}`) + } else { + stat.textElement.setText("") } }) } @@ -248,6 +240,7 @@ class Bestiary extends Feature { } onDisable() { + this.hudStat.forEach(h => h.textElement.delete()) this.saveData() } diff --git a/features/dungeonMap/index.js b/features/dungeonMap/index.js index 40bd292..d349fa6 100644 --- a/features/dungeonMap/index.js +++ b/features/dungeonMap/index.js @@ -16,6 +16,7 @@ import ImageLocationSetting from "../settings/settingThings/imageLocation"; import socketConnection from "../../socketConnection"; import SoopyKeyPressEvent from "../../../guimanager/EventListener/SoopyKeyPressEvent"; import SettingBase from "../settings/settingThings/settingBase"; +import { Box } from "../../utils/renderJavaUtils"; const BufferedImage = Java.type("java.awt.image.BufferedImage") const AlphaComposite = Java.type("java.awt.AlphaComposite") @@ -39,7 +40,6 @@ class DungeonMap extends Feature { this.showMapInBoss = new ToggleSetting("Keep showing the map in the dungeon boss room", "This will center the map when in boss to still be usefull", true, "dmap_enable_boss", this) this.borderedHeads = new ToggleSetting("Add a black border around heads on map", "", false, "dmap_border_head", this) this.brBox = new ToggleSetting("Box around doors in br", "In map category because it uses map to find location (no esp)", true, "dmap_door", this) - this.brBoxDisableWhenBloodOpened = new ToggleSetting("Disable blood rush box when blood open", "", true, "dmap_door_disable", this).requires(this.brBox) this.spiritLeapOverlay = new ToggleSetting("Spirit leap overlay", "Cool overlay for the spirit leap menu", true, "spirit_leap_overlay", this) // this.spiritLeapOverlay = new ToggleSetting("Spirit leap overlay", "Cool overlay for the spirit leap menu", true, "spirit_leap_overlay", this).requires(this.spiritLeapOverlay) @@ -91,24 +91,30 @@ class DungeonMap extends Feature { } this.currDungeonBossImage = undefined + this.dungeonBrBoxElm = new Box([0, 0, 0], [3, 4, 3], 1, 0, 0, 1, 3, false) this.bloodOpened = false this.registerChat("&r&cThe &r&c&lBLOOD DOOR&r&c has been opened!&r", () => { this.bloodOpened = true this.keys-- + this.dungeonBrBoxElm.setRGBA(1, 0, 0, 1) + this.dungeonBrBoxElm.stopRender() }) this.registerChat("&r${*}&r&f &r&ehas obtained &r&a&r&${*} Key&r&e!&r", () => { this.keys++ + this.dungeonBrBoxElm.setRGBA(0, 1, 0, 1) }) this.registerChat("&r&eA &r&a&r&${*} Key&r&e was picked up!&r", () => { this.keys++ + this.dungeonBrBoxElm.setRGBA(0, 1, 0, 1) }) this.lastDoorOpener = undefined this.registerChat("&r&a${player}&r&a opened a &r&8&lWITHER &r&adoor!&r", (player) => { this.lastDoorOpener = ChatLib.removeFormatting(player) this.keys-- + this.dungeonBrBoxElm.setRGBA(1, 0, 0, 1) }) this.spiritLeapOverlayGui = new SpiritLeapOverlay(this) @@ -120,7 +126,6 @@ class DungeonMap extends Feature { }).registeredWhen(() => this.isInDungeon()) this.registerStep(false, 5, this.step5s).registeredWhen(() => this.isInDungeon()) this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.isInDungeon()) - this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.isInDungeon()) this.registerEvent("worldLoad", this.worldLoad) this.renderingPlayerList = false this.registerEvent("renderPlayerList", () => { @@ -162,6 +167,7 @@ class DungeonMap extends Feature { } worldLoad() { + this.dungeonBrBoxElm.stopRender() this.mortLocation = undefined this.mapDataPlayers = {} this.offset = [] @@ -174,14 +180,6 @@ class DungeonMap extends Feature { this.keys = 0 } - renderWorld() { - if (this.isInDungeon() && this.brBox.getValue()) { - if (this.brBoxLoc && (!this.bloodOpened || !this.brBoxDisableWhenBloodOpened.getValue())) { - drawBoxAtBlock(this.brBoxLoc[0] - 1.5, 69, this.brBoxLoc[1] - 1.5, this.keys === 0 ? 255 : 0, this.keys === 0 ? 0 : 255, 0, 3, 4) - } - } - } - renderOverlay() { if (!this.renderingPlayerList && this.isInDungeon() && this.renderMap.getValue() && !this.spiritLeapOverlayGui.soopyGui.ctGui.isOpen()) { this.drawMap(this.mapLocation.getValue()[0], this.mapLocation.getValue()[1], 100 * this.mapLocation.getValue()[2], 0.5 * this.mapLocation.getValue()[2]) @@ -592,6 +590,11 @@ class DungeonMap extends Feature { this.brBoxLoc = brBoxTemp + + if (this.brBox.getValue() && !this.bloodOpened) this.dungeonBrBoxElm.startRender() + + this.dungeonBrBoxElm.setLocationSize([this.brBoxLoc[0] - 1.5, 69, this.brBoxLoc[1] - 1.5], [3, 4, 3]) + if (roomOffsets) { // for(let x = 0;x<128;x++){ // for(let y = 0;y<128;y++){ @@ -731,6 +734,7 @@ class DungeonMap extends Feature { } onDisable() { + this.dungeonBrBoxElm.stopRender() this.initVariables() this.running = false } diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js index 8cd5da0..34c236f 100644 --- a/features/dungeonSolvers/index.js +++ b/features/dungeonSolvers/index.js @@ -169,11 +169,11 @@ class DungeonSolvers extends Feature { }; this.registerStep(true, 2, this.step).registeredWhen(() => this.isInDungeon()); + this.registerStep(false, 60, this.step) this.registerStep(true, 10, this.step2).registeredWhen(() => this.isInDungeon()); this.registerStep(false, 60 * 5, this.step_5min) this.registerEvent("worldLoad", this.onWorldLoad); - this.registerEvent("renderOverlay", this.renderHud).registeredWhen(() => this.isInDungeon()); this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.isInDungeon()); this.bloodOpenedBonus = false; @@ -543,14 +543,6 @@ class DungeonSolvers extends Feature { } } - renderHud() { - if (this.bearSpawning && this.bearSpawning > 0) { - this.spiritBearSpawnElement.setText("&dBear spawned in: &c" + (Math.max(0, this.bearSpawning - Date.now()) / 1000).toFixed(2) + "s"); - } else { - this.spiritBearSpawnElement.setText(""); - } - } - onWorldLoad() { this.goneInBonus = false; this.bloodOpenedBonus = false; @@ -589,6 +581,11 @@ class DungeonSolvers extends Feature { } step2() { + if (this.bearSpawning && this.bearSpawning > 0) { + this.spiritBearSpawnElement.setText("&dBear spawned in: &c" + (Math.max(0, this.bearSpawning - Date.now()) / 1000).toFixed(2) + "s"); + } else { + this.spiritBearSpawnElement.setText(""); + } if (this.scoreCalculation.getValue()) this.calculateDungeonScore(); if (this.bloodCampAssist.getValue()) { this.skulls.forEach((skull) => { @@ -891,6 +888,8 @@ class DungeonSolvers extends Feature { } onDisable() { + this.hudElements.forEach(h => h.delete()) + this.initVariables(); } } diff --git a/features/events/index.js b/features/events/index.js index d1a075d..9ff7078 100644 --- a/features/events/index.js +++ b/features/events/index.js @@ -450,7 +450,6 @@ class Events extends Feature { this.showingWaypoints = undefined this.lastPath = undefined this.updatingPath = undefined - this.hudElements = undefined this.lastPathCords = undefined } diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index ef566c9..856791e 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -44,6 +44,8 @@ class GlobalSettings extends Feature { this.reportErrorsSetting = new ToggleSetting("Send module errors to soopy server", "This will allow me to more effectivly fix them", false, "privacy_send_errors", this) + this.hideFallingBlocks = new ToggleSetting("Hide falling blocks", "NOTE: this may cause more/less lag because of render entity event", false, "hide_falling_sand", this) + this.privacySettings = [this.reportErrorsSetting] this.firstLoadPageData = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2firstloaddata.json") || "{}") || {} @@ -53,6 +55,13 @@ class GlobalSettings extends Feature { soopyV2Server.reportErrorsSetting = this.reportErrorsSetting this.registerChat("&aYour new API key is &r&b${key}&r", this.newKey) + const EntityFallingBlock = Java.type("net.minecraft.entity.item.EntityFallingBlock"); + + this.registerEvent('renderEntity', (entity, posVec, partialTicks, event) => { + if (entity.getEntity() instanceof EntityFallingBlock) { + cancel(event); + } + }).registeredWhen(() => this.hideFallingBlocks.getValue()) this.ranFirstLoadThing = false diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js index de031a2..834ef28 100644 --- a/features/hud/HudTextElement.js +++ b/features/hud/HudTextElement.js @@ -21,6 +21,10 @@ class HudTextElement { this.renderElm = new HudText([""], 0, 0, true).startRender() } + delete() { + this.renderElm.stopRender() + } + setBaseEditWidth(width) { this.editBaseWidth = width return this @@ -49,6 +53,11 @@ class HudTextElement { this.renderElm.stopRender() } } + if (this.toggleSetting.getValue()) { + this.renderElm.startRender() + } else { + this.renderElm.stopRender() + } return this } setLocationSetting(setting) { diff --git a/features/hud/index.js b/features/hud/index.js index b7ea05a..7c679ff 100644 --- a/features/hud/index.js +++ b/features/hud/index.js @@ -130,6 +130,7 @@ class Hud extends Feature { .setLocationSetting(new LocationSetting("Spotify Location", "Allows you to edit the location of the spotify text", "spotify_now_playing_location", this, [10, 80, 1, 1]) .requires(this.showSpotifyPlaying) .editTempText("&6Spotify&7> &cNot open")) + this.hudElements.push(this.spotifyElement) this.spotifyElement2 = new HudTextElement().setToggleSetting(this.showSpotifyPlaying).setLocationSetting({ setParent: () => { }, x: this.spotifyElement.locationSetting.x + this.spotifyElement.getWidth(), @@ -197,6 +198,7 @@ class Hud extends Feature { // .editTempText("Test Line 1\nTest line 2\nTest line 3\nTest line 4 (longer KEKW)")) // this.hudElements.push(this.dragonDamageElement) + this.step_5second() this.lastTickTime = 0 @@ -225,7 +227,7 @@ class Hud extends Feature { this.fps = new SoopyNumber(0) this.lowFps = new SoopyNumber(0) - this.registerEvent("renderOverlay", this.renderHud) + this.registerEvent("renderOverlay", this.renderHud).registeredWhen(() => this.showSpotifyPlaying.getValue() || this.witherImpactCooldownSetting.getValue()) this.registerStep(true, 5, this.step) this.registerStep(false, 5, this.step_5second) this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.fpsEnabledSetting.getValue() && this.fpsFastSetting.getValue()) @@ -333,6 +335,9 @@ class Hud extends Feature { this.fpsFastSetting.delete() this.cpsEnabledSetting.delete() + this.hudStat.forEach(h => h.textElement.delete()) + this.hudElements.forEach(h => h.delete()) + this.initVariables() if (this.packetReceived) this.packetReceived.unregister() @@ -640,6 +645,8 @@ class Hud extends Feature { this.hudStat.forEach(stat => { if (stat.enabled.getValue()) { this.updateHudThing(stat, insb) + } else { + stat.textElement.setText("") } }) } diff --git a/features/lockedFeatures/index.js b/features/lockedFeatures/index.js index 2826626..9314105 100644 --- a/features/lockedFeatures/index.js +++ b/features/lockedFeatures/index.js @@ -111,6 +111,7 @@ class LockedFeatures extends Feature { } onDisable() { + this.hudElements.forEach(h => h.delete()) this.initVariables() } } diff --git a/features/mining/index.js b/features/mining/index.js index d028450..31fa716 100644 --- a/features/mining/index.js +++ b/features/mining/index.js @@ -322,6 +322,7 @@ class Mining extends Feature { } onDisable() { + this.hudElements.forEach(h => h.delete()) this.initVariables() } } diff --git a/features/slayers/index.js b/features/slayers/index.js index 16ac357..5546cad 100644 --- a/features/slayers/index.js +++ b/features/slayers/index.js @@ -565,6 +565,7 @@ class Slayers extends Feature { } onDisable() { + this.hudElements.forEach(h => h.delete()) this.initVariables(); } } diff --git a/features/spamHider/index.js b/features/spamHider/index.js index f5f2259..e1c79f3 100644 --- a/features/spamHider/index.js +++ b/features/spamHider/index.js @@ -127,7 +127,7 @@ class SpamHider extends Feature { }) } } - renderOverlay() { + renderOverlay() { //TODO: move this to java this.SpamHiderMessagesRenderer.render(100, 100, 1, 1) } diff --git a/features/waypoints/index.js b/features/waypoints/index.js index e378898..2dfe46f 100644 --- a/features/waypoints/index.js +++ b/features/waypoints/index.js @@ -2,6 +2,7 @@ /// <reference lib="es2015" /> import { m } from "../../../mappings/mappings"; import Feature from "../../featureClass/class"; +import { Waypoint } from "../../utils/renderJavaUtils"; import { drawCoolWaypoint } from "../../utils/renderUtils"; import SettingBase from "../settings/settingThings/settingBase"; import ToggleSetting from "../settings/settingThings/toggle"; @@ -27,14 +28,13 @@ class Waypoints extends Feature { this.userWaypoints = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2userwaypoints.json") || "{}") this.userWaypointsHash = {} this.userWaypointsAll = [] + this.lastArea = undefined this.userWaypointsArr = Object.values(this.userWaypoints) this.updateWaypointsHashes() this.waypointsChanged = false this.patcherWaypoints = [] - this.registerEvent("renderWorld", this.renderWorld) - this.registerCommand("addwaypoint", (name, x = Math.floor(Player.getX()).toString(), y = Math.floor(Player.getY()).toString(), z = Math.floor(Player.getZ()).toString(), r = "0", g = "255", b = "0", area = "") => { let lx = 0 let ly = 0 @@ -96,55 +96,90 @@ class Waypoints extends Feature { if (this.showInfoInChat.getValue()) ChatLib.chat(this.FeatureManager.messagePrefix + "Loaded waypoints from clipboard!") } catch (e) { if (this.showInfoInChat.getValue()) ChatLib.chat(this.FeatureManager.messagePrefix + "Error loading from clipboard!") + console.log(JSON.stringify(e, undefined, 2)) + console.log(e.stack) } }) this.registerChat("&r${*} &8> ${player}&f: &rx: ${x}, y: ${y}, z: ${z}", (player, x, y, z, e) => { if (this.loadWaypointsFromSendCoords.getValue()) { - this.patcherWaypoints.push([Date.now(), parseInt(x), parseInt(y), parseInt(ChatLib.removeFormatting(z)), ChatLib.addColor(player)]) + this.patcherWaypoints.push([Date.now(), new Waypoint(parseInt(x), parseInt(y), parseInt(ChatLib.removeFormatting(z)), 0, 0, 1, { name: ChatLib.addColor(player), showDist: true }).startRender()]) if (this.patcherWaypoints.length > 10) this.patcherWaypoints.shift() } }) this.registerChat("${player}&r&f: x: ${x}, y: ${y}, z: ${z}", (player, x, y, z, e) => { if (player.includes(">")) return - if (this.loadWaypointsFromSendCoords.getValue()) { - this.patcherWaypoints.push([Date.now(), parseInt(x), parseInt(y), parseInt(ChatLib.removeFormatting(z)), ChatLib.addColor(player)]) + if (this.loadWaypointsFromSendCoords.getValue()) {//parseInt(x), parseInt(y), parseInt(ChatLib.removeFormatting(z)), ChatLib.addColor(player) + this.patcherWaypoints.push([Date.now(), new Waypoint(parseInt(x), parseInt(y), parseInt(ChatLib.removeFormatting(z)), 0, 0, 1, { name: ChatLib.addColor(player), showDist: true }).startRender()]) if (this.patcherWaypoints.length > 10) this.patcherWaypoints.shift() } }) this.registerStep(false, 5, () => { while (this.patcherWaypoints[0]?.[0] < Date.now() - 60000) { - this.patcherWaypoints.shift() + this.patcherWaypoints.shift()[1].stopRender() } }) + + let lastX = 0 + let lastY = 0 + let lastZ = 0 + let lastTick = 0 + this.registerEvent("renderWorld", () => { + if (Math.round(Player.getX()) !== lastX + || Math.round(Player.getY()) !== lastY + || Math.round(Player.getZ()) !== lastZ + || Date.now() - lastTick > 500) { + lastX = Math.round(Player.getX()) + lastY = Math.round(Player.getY()) + lastZ = Math.round(Player.getZ()) + lastTick = Date.now() + + this.tickWaypoints() + } + }) + } + + tickWaypoints() { + for (let waypoint of this.userWaypointsAll) { + waypoint.update() + } + for (let waypoint of this.patcherWaypoints) { + waypoint[1].update() + } + let area = this.FeatureManager.features["dataLoader"] ? this.FeatureManager.features["dataLoader"].class.area : "NONE" + if (this.lastArea && this.lastArea !== area) { + if (this.userWaypointsHash[lastArea]) { + for (let waypoint of this.userWaypointsHash[lastArea]) { + waypoint.stopRender() + } + + } + } + this.lastArea = area + + if (this.userWaypointsHash[area]) { + for (let waypoint of this.userWaypointsHash[area]) { + waypoint.update() + waypoint.startRender() + } + } } updateWaypointsHashes() { + this.userWaypointsAll.forEach(w => w.stopRender()) + Object.values(this.userWaypointsHash).forEach(a => a.forEach(w => w.stopRender())) + this.userWaypointsAll = [] this.userWaypointsHash = {} for (let waypoint of this.userWaypointsArr) { if (!waypoint.area) { - this.userWaypointsAll.push(waypoint) + this.userWaypointsAll.push(new Waypoint(waypoint.x, waypoint.y, waypoint.z, waypoint.r, waypoint.g, waypoint.b, waypoint.options).startRender()) } else { if (!this.userWaypointsHash[waypoint.area]) this.userWaypointsHash[waypoint.area] = [] - this.userWaypointsHash[waypoint.area].push(waypoint) - } - } - } - - renderWorld() { - for (let waypoint of this.userWaypointsAll) { - drawCoolWaypoint(waypoint.x, waypoint.y, waypoint.z, waypoint.r, waypoint.g, waypoint.b, waypoint.options) - } - if (this.userWaypointsHash[this.FeatureManager.features["dataLoader"].class.area]) { - for (let waypoint of this.userWaypointsHash[this.FeatureManager.features["dataLoader"].class.area]) { - drawCoolWaypoint(waypoint.x, waypoint.y, waypoint.z, waypoint.r, waypoint.g, waypoint.b, waypoint.options) + this.userWaypointsHash[waypoint.area].push(new Waypoint(waypoint.x, waypoint.y, waypoint.z, waypoint.r, waypoint.g, waypoint.b, waypoint.options)) } } - for (let waypoint of this.patcherWaypoints) { - drawCoolWaypoint(waypoint[1], waypoint[2], waypoint[3], 0, 255, 0, { name: waypoint[4] }) - } } initVariables() { @@ -152,6 +187,10 @@ class Waypoints extends Feature { } onDisable() { + this.userWaypointsAll.forEach(w => w.stopRender()) + Object.values(this.userWaypointsHash).forEach(a => a.forEach(w => w.stopRender())) + this.patcherWaypoints.forEach(p => p[1].stopRender()) + if (this.waypointsChanged) { FileLib.write("soopyAddonsData", "soopyv2userwaypoints.json", JSON.stringify(this.userWaypoints)) } |