From ac4bec7b9a9feb8372ede945f9869c197789c660 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Thu, 6 Oct 2022 17:32:46 +0800 Subject: Location hud element --- src/features/bestiary/index.js | 4 +-- src/features/betterGuis/index.js | 2 +- src/features/dataLoader/index.js | 14 +++++------ src/features/dungeonMap/index.js | 1 - src/features/dungeonMap2/index.js | 1 - src/features/dungeonSolvers/index.js | 5 ++-- src/features/events/index.js | 10 ++++---- src/features/hud/index.js | 48 ++++++++++++++++++++++++++++++++---- src/features/slayers/index.js | 6 ++--- src/features/waypoints/index.js | 2 +- 10 files changed, 63 insertions(+), 30 deletions(-) (limited to 'src/features') diff --git a/src/features/bestiary/index.js b/src/features/bestiary/index.js index ead03ef..14c00b1 100644 --- a/src/features/bestiary/index.js +++ b/src/features/bestiary/index.js @@ -107,7 +107,7 @@ class Bestiary extends Feature { }) this.registerSoopy("apiLoad", this.apiLoad); - if (this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw) { + if (this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw) { this.apiLoad(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw, "skyblock", false, true); } } @@ -119,8 +119,6 @@ class Bestiary extends Feature { } updateHudElements() { - if (!this.FeatureManager.features["dataLoader"]) return - let insb = this.FeatureManager.features["dataLoader"].class.isInSkyblock this.hudStat.forEach(stat => { diff --git a/src/features/betterGuis/index.js b/src/features/betterGuis/index.js index d125a2f..6d7f85f 100644 --- a/src/features/betterGuis/index.js +++ b/src/features/betterGuis/index.js @@ -16,7 +16,7 @@ class BetterGuis extends Feature { } inSkyblock() { - return this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.isInSkyblock; + return this.FeatureManager.features["dataLoader"].class.isInSkyblock; } onEnable() { diff --git a/src/features/dataLoader/index.js b/src/features/dataLoader/index.js index 4745d85..b119a2b 100644 --- a/src/features/dataLoader/index.js +++ b/src/features/dataLoader/index.js @@ -16,6 +16,13 @@ class DataLoader extends Feature { this.area = undefined this.areaFine = undefined + this.lastApiData = { + "skyblock": undefined, + "player": undefined, + "skyblock_raw": undefined, //the _raw is loaded from hypixel api instead of soopy api + "player_raw": undefined + } + this.isInSkyblock = false this.dungeonPercentCleared = 0 @@ -61,13 +68,6 @@ class DataLoader extends Feature { this.partyMembers = new Set() this.partyMembers.add(Player.getName()) - this.lastApiData = { - "skyblock": undefined, - "player": undefined, - "skyblock_raw": undefined, //the _raw is loaded from hypixel api instead of soopy api - "player_raw": undefined - } - this.worldLoaded = true this.loadApi() diff --git a/src/features/dungeonMap/index.js b/src/features/dungeonMap/index.js index b3f1e5f..2003e85 100644 --- a/src/features/dungeonMap/index.js +++ b/src/features/dungeonMap/index.js @@ -26,7 +26,6 @@ class DungeonMap extends Feature { } isInDungeon() { - if (!this.FeatureManager || !this.FeatureManager.features["dataLoader"]) return false return this.FeatureManager.features["dataLoader"].class.isInDungeon } diff --git a/src/features/dungeonMap2/index.js b/src/features/dungeonMap2/index.js index 199bc05..026b09a 100644 --- a/src/features/dungeonMap2/index.js +++ b/src/features/dungeonMap2/index.js @@ -189,7 +189,6 @@ class DungeonMap extends Feature { } isInDungeon() { - if (!this.FeatureManager || !this.FeatureManager.features["dataLoader"]) return false return this.FeatureManager.features["dataLoader"].class.isInDungeon } diff --git a/src/features/dungeonSolvers/index.js b/src/features/dungeonSolvers/index.js index 96b303c..344f460 100644 --- a/src/features/dungeonSolvers/index.js +++ b/src/features/dungeonSolvers/index.js @@ -37,7 +37,6 @@ class DungeonSolvers extends Feature { } isInDungeon() { - if (!this.FeatureManager || !this.FeatureManager.features["dataLoader"]) return false return this.FeatureManager.features["dataLoader"].class.isInDungeon } @@ -1064,7 +1063,7 @@ class DungeonSolvers extends Feature { } addBlaze(blaze) { - if (!this.FeatureManager.features["dataLoader"] || !this.FeatureManager.features["dataLoader"].class.dungeonFloor) return; + if (!this.FeatureManager.features["dataLoader"].class.dungeonFloor) return; if (this.blazeX === -1) { this.blazes.push(blaze); let locs = {}; @@ -1142,7 +1141,7 @@ class DungeonSolvers extends Feature { if (end === "[✔]") this.completedPuzzleCount++; }); - if (this.FeatureManager.features["dataLoader"] && this.lividFindEnabled.getValue() && (this.FeatureManager.features["dataLoader"].class.dungeonFloor === "F5" || this.FeatureManager.features["dataLoader"].class.dungeonFloor === "M5")) { + if (this.lividFindEnabled.getValue() && (this.FeatureManager.features["dataLoader"].class.dungeonFloor === "F5" || this.FeatureManager.features["dataLoader"].class.dungeonFloor === "M5")) { let type = World.getBlockAt(3, 108, 30).getMetadata(); let typeReplace = { diff --git a/src/features/events/index.js b/src/features/events/index.js index 8495001..73b20a5 100644 --- a/src/features/events/index.js +++ b/src/features/events/index.js @@ -197,7 +197,7 @@ class Events extends Feature { } if (this.limitPMembRecieve.getValue()) { - if (!this.FeatureManager.features["dataLoader"] || !this.FeatureManager.features["dataLoader"].class.partyMembers.has(user)) return + if (!this.FeatureManager.features["dataLoader"].class.partyMembers.has(user)) return } this.slayerLocationDataH[user] = [loc, Date.now()] if (this.otherInquisPing.getValue()) { @@ -284,7 +284,7 @@ class Events extends Feature { } }) - let showingWaypointsNew = (this.lastWorldChange + 5000 < Date.now() ? hasDianaShovle && this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.area === "Hub" && (this.loadFromParticles.getValue() || this.showBurrialGuess.getValue()) : this.showingWaypoints || (hasDianaShovle && this.FeatureManager.features["dataLoader"].class.area === "Hub" && (this.loadFromParticles.getValue() || this.showBurrialGuess.getValue()))) + let showingWaypointsNew = (this.lastWorldChange + 5000 < Date.now() ? hasDianaShovle && this.FeatureManager.features["dataLoader"].class.area === "Hub" && (this.loadFromParticles.getValue() || this.showBurrialGuess.getValue()) : this.showingWaypoints || (hasDianaShovle && this.FeatureManager.features["dataLoader"].class.area === "Hub" && (this.loadFromParticles.getValue() || this.showBurrialGuess.getValue()))) this.showingWaypoints = showingWaypointsNew @@ -313,7 +313,7 @@ class Events extends Feature { self = true } }) - if (self && this.FeatureManager.features["dataLoader"]) { + if (self) { let pmemb = [] this.FeatureManager.features["dataLoader"].class.partyMembers.forEach(a => pmemb.push(a)) socketConnection.sendInquisData({ loc: [Math.round(Player.getX()), Math.round(Player.getY()), Math.round(Player.getZ())], pmemb, limitPMemb: pmemb.length > 1 && this.limitPMemb.getValue() }); @@ -610,7 +610,7 @@ class Events extends Feature { this.guessPoint = [this.lastSoundPoint[0] + changes[0] * distance, this.lastSoundPoint[1] + changes[1] * distance, this.lastSoundPoint[2] + changes[2] * distance] } } - if (this.shinyBlockOverlayEnabled.getValue() && this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.areaFine === "The End") { + if (this.shinyBlockOverlayEnabled.getValue() && this.FeatureManager.features["dataLoader"].class.areaFine === "The End") { if (particle.toString().startsWith("EntitySpellParticleFX,")) { if (particle.getUnderlyingEntity().func_70534_d() === particle.getUnderlyingEntity().func_70535_g()) { let arr = [particle.getX(), particle.getY(), particle.getZ()] @@ -620,7 +620,7 @@ class Events extends Feature { } } } - if (this.showGlowingMushrooms.getValue() && this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.areaFine === "Glowing Mushroom Cave") { + if (this.showGlowingMushrooms.getValue() && this.FeatureManager.features["dataLoader"].class.areaFine === "Glowing Mushroom Cave") { if (particle.toString().startsWith("EntitySpellParticleFX,")) { // console.log([particle.getX(), particle.getY(), particle.getZ()].map(a => a % 1)) if (Math.abs(particle.getX() % 1) === 0.5 && Math.abs(particle.getZ() % 1) === 0.5) { diff --git a/src/features/hud/index.js b/src/features/hud/index.js index 81f9285..52868da 100644 --- a/src/features/hud/index.js +++ b/src/features/hud/index.js @@ -102,6 +102,23 @@ class Hud extends Feature { this.hudElements.push(this.petElement) this.scanGuiForPet = new ToggleSetting("Scan pets menu gui for selected pet", "Only disable if you get a lot of lag in the pets menu", true, "scan_pets_menu", this).requires(this.petEnabledSetting) + this.locationEnabledSetting = new ToggleSetting("Show Location", "Whether the location (xyz) is rendered onto the screen", false, "location_enabled", this) + this.locationElement = new HudTextElement() + .setToggleSetting(this.locationEnabledSetting) + .setLocationSetting(new LocationSetting("XYZ Location", "Allows you to edit the location of the location text", "location_location", this, [10, 120, 1, 1]) + .requires(this.locationEnabledSetting) + .editTempText("&6Loc&7> &f123.456 | 123.456 | 123.456")) + this.hudElements.push(this.locationElement) + this.locationYEnabledSetting = new ToggleSetting("Show Y in location", "Wether to include ur Y value in location", true, "location_y_enabled", this).requires(this.locationEnabledSetting) + this.locationOnlyDungSetting = new ToggleSetting("Only show location in dungeon", "(If u want to use this to show how to mine thru stairs)", false, "location_dung_enabled", this).requires(this.locationEnabledSetting) + this.locationDecimals = new DropdownSetting("Decimal places in location setting", "", "3", "location_decimal_setting", this, { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }).requires(this.locationEnabledSetting) + this.soulflowEnabledSetting = new ToggleSetting("Show Soulflow", "Whether the soulflow count is rendered onto the screen", true, "soulflow_enabled", this) this.soulflowShowWhen0Setting = new ToggleSetting("Show When 0 Soulflow", "If this is off it wont render when you have 0 soulflow", true, "soulflow_showwhen_0", this).requires(this.soulflowEnabledSetting) this.soulflowElement = new HudTextElement() @@ -311,12 +328,12 @@ class Hud extends Feature { }) this.registerSoopy("apiLoad", this.apiLoad) - if (this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock) { + if (this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock) { this.apiLoad(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock, "skyblock", true, true) this.lastSwappedPet = Date.now() } - if (this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw) { + if (this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw) { this.apiLoad(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw, "skyblock", false, true) } @@ -377,6 +394,27 @@ class Hud extends Feature { } } + if (this.locationEnabledSetting.getValue()) { + + if (this.locationOnlyDungSetting.getValue()) { + if (!this.FeatureManager.features["dataLoader"].class.isInDungeon) { + this.locationElement.setText("") + return + } + } + + let locData = [] + locData.push(Player.getX()) + if (this.locationYEnabledSetting.getValue()) locData.push(Player.getY()) + locData.push(Player.getZ()) + + locData = locData.map(a => a.toFixed(parseInt(this.locationDecimals.getValue()))) + + let locString = locData.join("&7 | &f") + + this.locationElement.setText("&6Loc&7> &f" + locString) + } + if (!this.lagEnabled.getValue()) return if (this.packetMoves > 0) { this.secondPackets++ @@ -600,7 +638,7 @@ class Hud extends Feature { if (!Player.getPlayer()) return if (!Player.getInventory()) return - if (this.FeatureManager.features["dataLoader"] && !this.FeatureManager.features["dataLoader"].class.isInSkyblock) { + if (!this.FeatureManager.features["dataLoader"].class.isInSkyblock) { this.soulflowElement.setText("") this.petElement.setText("") return @@ -618,7 +656,7 @@ class Hud extends Feature { updatePotsTime() { if (!this.showPotsHud.getValue()) return - if (!this.FeatureManager.features["dataLoader"] || !this.FeatureManager.features["dataLoader"].class.isInSkyblock || this.FeatureManager.features["dataLoader"].class.isInDungeon) { + if (!this.FeatureManager.features["dataLoader"].class.isInSkyblock || this.FeatureManager.features["dataLoader"].class.isInDungeon) { this.potsHudElement.setText("") return } @@ -798,7 +836,7 @@ class Hud extends Feature { } updateHudThingos() { - let insb = !!(this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class?.isInSkyblock) + let insb = !!(this.FeatureManager.features["dataLoader"].class?.isInSkyblock) this.hudStat.forEach(stat => { if (stat.enabled.getValue()) { diff --git a/src/features/slayers/index.js b/src/features/slayers/index.js index a88734f..47817e2 100644 --- a/src/features/slayers/index.js +++ b/src/features/slayers/index.js @@ -34,7 +34,7 @@ class Slayers extends Feature { } inSkyblock() { - return this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.isInSkyblock + return this.FeatureManager.features["dataLoader"].class.isInSkyblock } onEnable() { this.initVariables(); @@ -234,7 +234,7 @@ class Slayers extends Feature { this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.spawnAlert.getValue() || this.slainAlert.getValue()); this.registerSoopy("apiLoad", this.apiLoad); - if (this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock) { + if (this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock) { this.apiLoad(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock, "skyblock", true, true); } @@ -886,7 +886,7 @@ class Slayers extends Feature { let runsperHour = (60000 * 60) / averageLength; let expPerHour = averageExp * runsperHour; - if (this.FeatureManager.features["dataLoader"] && Date.now() - this.lastSlayerFinishes[this.lastSlayerFinishes.length - 1] < 60000 * 5 || (this.FeatureManager.features["dataLoader"].class?.slayerXpToSpawn && this.FeatureManager.features["dataLoader"].class.slayerXpToSpawn[0] !== 0)) { + if (Date.now() - this.lastSlayerFinishes[this.lastSlayerFinishes.length - 1] < 60000 * 5 || (this.FeatureManager.features["dataLoader"].class?.slayerXpToSpawn && this.FeatureManager.features["dataLoader"].class.slayerXpToSpawn[0] !== 0)) { if (this.lastSlayerFinishes.length > 1) { this.slayerSpeedRatesElement.setText("&6Slayer speed&7> &f" + Math.floor(averageLength / 60000) + ":" + ((Math.floor(averageLength / 1000) % 60 < 10 ? "0" : "") + (Math.floor(averageLength / 1000) % 60)) + "\n&6Exp/hour&7> &f" + numberWithCommas(Math.round(expPerHour)) + "\n&6Kills/hour&7> &f" + Math.floor(runsperHour)); } else { diff --git a/src/features/waypoints/index.js b/src/features/waypoints/index.js index ef5a5b8..6ee3368 100644 --- a/src/features/waypoints/index.js +++ b/src/features/waypoints/index.js @@ -375,7 +375,7 @@ class Waypoints extends Feature { for (let waypoint of this.patcherWaypoints) { waypoint[1].update() } - let area = this.FeatureManager.features["dataLoader"] ? this.FeatureManager.features["dataLoader"].class.area : "NONE" + let area = this.FeatureManager.features["dataLoader"].class.area if (this.lastArea && this.lastArea !== area) { if (this.userWaypointsHash[this.lastArea]) { for (let waypoint of this.userWaypointsHash[lastArea]) { -- cgit