aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-05-06 21:40:49 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-05-06 21:40:49 +0800
commitf0cfad5af93244618d5a60c88b1c0a4837e629ae (patch)
tree062a301f34c8e6d3284fa845676b23b2ab8d7f9a
parente2e2d676ee056e9f44f6c67e29f0952b9ef956b2 (diff)
downloadSoopyV2-f0cfad5af93244618d5a60c88b1c0a4837e629ae.tar.gz
SoopyV2-f0cfad5af93244618d5a60c88b1c0a4837e629ae.tar.bz2
SoopyV2-f0cfad5af93244618d5a60c88b1c0a4837e629ae.zip
+ Many performance improvements
+ Fix rescue mission waypoints
-rw-r--r--featureClass/class.js141
-rw-r--r--featureClass/featureManager.js4
-rw-r--r--features/dungeonMap/index.js13
-rw-r--r--features/dungeonSolvers/index.js34
-rw-r--r--features/events/index.js14
-rw-r--r--features/fragBot/index.js38
-rw-r--r--features/hud/HudTextElement.js47
-rw-r--r--features/hud/index.js3
-rw-r--r--features/lockedFeatures/index.js78
-rw-r--r--features/mining/index.js144
-rw-r--r--features/nether/index.js34
-rw-r--r--features/nether/metadata.json4
-rw-r--r--features/slayers/index.js9
-rw-r--r--features/spamHider/index.js204
14 files changed, 453 insertions, 314 deletions
diff --git a/featureClass/class.js b/featureClass/class.js
index bb438d9..04e9552 100644
--- a/featureClass/class.js
+++ b/featureClass/class.js
@@ -8,6 +8,7 @@ class Feature {
this.customEvents = {}
this.forgeEvents = {}
this.soopyEvents = {}
+ this.dynamicEvents = new Set()
this.id = undefined
@@ -32,6 +33,8 @@ class Feature {
this.events = {}
this.customEvents = {}
this.enabled = false
+
+ this.stepEvent.unregister()
}
_onEnable(parent) {
@@ -39,6 +42,10 @@ class Feature {
this.enabled = true
+ this.stepEvent = this.registerStep(false, 5, () => {
+ this.dynamicEvents.forEach(e => e.update())
+ })
+
this.onEnable()
}
@@ -50,7 +57,7 @@ class Feature {
this.events[theEvent.id] = theEvent
- return theEvent
+ return new CtEvent(theEvent, undefined, [event, func], this)
}
unregisterEvent(event) {
@@ -63,7 +70,7 @@ class Feature {
this.soopyEvents[theEvent.id] = theEvent
- return theEvent
+ return new SoopyEvent(theEvent, undefined, [event, func], this)
}
unregisterSoopy(event) {
@@ -82,7 +89,7 @@ class Feature {
}
if (theEvent) this.forgeEvents[theEvent.id] = theEvent
- return theEvent
+ return new ForgeEvent(theEvent, theEvent.trigger, [event, func, messageIfError], this)
}
unregisterForge(event) {
@@ -98,21 +105,21 @@ class Feature {
this.customEvents[theEvent.id] = theEvent
- return theEvent
+ return new CustomEvent(theEvent, theEvent.trigger, [criteria, func], this)
}
registerActionBar(criteria, func) {
let theEvent = this.FeatureManager.registerActionBar(criteria, func, this)
this.customEvents[theEvent.id] = theEvent
- return theEvent
+ return new CustomEvent(theEvent, theEvent.trigger, [criteria, func], this)
}
registerStep(isFps, interval, func) {
let theEvent = this.FeatureManager.registerStep(isFps, interval, func, this)
this.customEvents[theEvent.id] = theEvent
- return theEvent
+ return new CustomEvent(theEvent, theEvent.trigger, [isFps, interval, func], this)
}
registerCustom(event, func) {
@@ -120,7 +127,7 @@ class Feature {
this.customEvents[theEvent.id] = theEvent
- return theEvent
+ return new CustomEvent(theEvent, theEvent.trigger, [event, func], this)
}
registerCommand(name, func) {
@@ -133,6 +140,8 @@ class Feature {
ChatLib.chat(this.FeatureManager.messagePrefix + "This command is not available atm")
}
}, this)
+
+ return new CommandEvent(name, undefined, [name, func], this)
}
unregisterCommand(name) {
delete this.FeatureManager.commandFuncs[name]
@@ -149,4 +158,120 @@ class Feature {
}
}
-export default Feature \ No newline at end of file
+export default Feature
+
+class Event {
+ constructor(data, trigger, registerArgs = [], parent) {
+ this.data = data
+ this.trigger = trigger
+ this.registerArgs = registerArgs
+ this.parent = parent
+
+ this.enabled = true
+
+ this.when = undefined
+ }
+
+ update() {
+ if (this.enabled === this.when()) return
+
+ if (this.enabled) {
+ this.unregister()
+ } else {
+ this.register()
+ }
+ }
+
+ /**
+ * Runs the function given as the argument every 5seconds
+ * And will make sure that the event is only registered when the condition is true
+ */
+ registeredWhen(fun) {
+ this.when = fun
+
+ if (!fun()) {
+ this.unregister()
+ }
+
+ this.parent.dynamicEvents.add(this)
+
+ return this
+ }
+
+ register() {
+ if (this.enabled) return
+
+ this.enabled = true
+ this.actuallyRegister()
+ }
+
+ unregister() {
+ if (!this.enabled) return
+
+ this.enabled = false
+ this.actuallyUnregister()
+ }
+
+ actuallyRegister() { }
+
+ actuallyUnregister() { }
+}
+
+class CtEvent extends Event {
+ actuallyRegister() {
+ let newEvent = this.parent.registerEvent(...this.registerArgs)
+ this.data = newEvent.data
+ this.trigger = newEvent.trigger
+ }
+
+ actuallyUnregister() {
+ this.parent.unregisterEvent(this.data)
+ }
+}
+class SoopyEvent extends Event {
+ actuallyRegister() {
+ let newEvent = this.parent.registerSoopy(...this.registerArgs)
+ this.data = newEvent.data
+ this.trigger = newEvent.trigger
+ }
+
+ actuallyUnregister() {
+ this.parent.unregisterSoopy(this.data)
+ }
+}
+
+class CommandEvent extends Event {
+ actuallyRegister() {
+ let newEvent = this.parent.registerCommand(...this.registerArgs)
+ this.data = newEvent.data
+ this.trigger = newEvent.trigger
+ }
+
+ actuallyUnregister() {
+ this.parent.unregisterCommand(this.data)
+ }
+}
+
+class ForgeEvent extends Event {
+ actuallyRegister() {
+ let newEvent = this.parent.registerForge(...this.registerArgs)
+ this.data = newEvent.data
+ this.trigger = newEvent.trigger
+ }
+
+ actuallyUnregister() {
+ this.parent.unregisterForge(this.data)
+ }
+}
+
+class CustomEvent extends Event {
+ actuallyRegister() {
+ let newEvent = this.trigger.register()
+ this.data = newEvent.data
+ this.trigger = newEvent.trigger
+ }
+
+ actuallyUnregister() {
+ this.trigger.unregister()
+ }
+} \ No newline at end of file
diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js
index 3c7ff54..ad67c7f 100644
--- a/featureClass/featureManager.js
+++ b/featureClass/featureManager.js
@@ -304,6 +304,7 @@ class FeatureManager {
}
} catch (e) {
logger.logMessage("Error in " + event + " event: " + JSON.stringify(e, undefined, 2), 2)
+ console.log(e.stack)
soopyV2Server.reportError(e, "Error in " + event + " event.")
}
@@ -326,6 +327,7 @@ class FeatureManager {
}
} catch (e) {
logger.logMessage("Error in soopy " + event + " event: " + JSON.stringify(e, undefined, 2), 2)
+ console.log(e.stack)
soopyV2Server.reportError(e, "Error in soopy " + event + " event.")
}
}
@@ -424,6 +426,7 @@ class FeatureManager {
}
} catch (e) {
logger.logMessage("Error in " + type + " event: " + JSON.stringify(e, undefined, 2), 2)
+ console.log(e.stack)
soopyV2Server.reportError(e, "Error in " + type + " event.")
}
@@ -454,6 +457,7 @@ class FeatureManager {
}
} catch (e) {
logger.logMessage("Error in " + event.class.toString() + " (forge) event: " + JSON.stringify(e, undefined, 2), 2)
+ console.log(e.stack)
soopyV2Server.reportError(e, "Error in " + event.class.toString() + " (forge) event.")
}
diff --git a/features/dungeonMap/index.js b/features/dungeonMap/index.js
index cfa4fd9..fcb964b 100644
--- a/features/dungeonMap/index.js
+++ b/features/dungeonMap/index.js
@@ -25,6 +25,7 @@ class DungeonMap extends Feature {
}
isInDungeon() {
+ if (!this.FeatureManager || !this.FeatureManager.features["dataLoader"]) return false
return this.FeatureManager.features["dataLoader"].class.isInDungeon
}
@@ -112,13 +113,13 @@ class DungeonMap extends Feature {
this.spiritLeapOverlayGui = new SpiritLeapOverlay(this)
// this.registerEvent("tick", this.tick)
- this.registerStep(true, 3, this.step)
+ this.registerStep(true, 3, this.step).registeredWhen(() => this.isInDungeon())
this.registerStep(true, 10, () => {
this.spiritLeapOverlayGui.tick()
- })
- this.registerStep(false, 5, this.step5s)
- this.registerEvent("renderOverlay", this.renderOverlay)
- this.registerEvent("renderWorld", this.renderWorld)
+ }).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.registerEvent("guiOpened", (event) => {
@@ -150,7 +151,7 @@ class DungeonMap extends Feature {
new Thread(() => {
this.updateMapImage()
}).start()
- })
+ }).registeredWhen(() => this.isInDungeon())
this.registerChat("&r&r&r &r&cThe Catacombs &r&8- &r&eFloor ${*} Stats&r", () => {
this.puzzles = {}
diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js
index 218642b..f9e0026 100644
--- a/features/dungeonSolvers/index.js
+++ b/features/dungeonSolvers/index.js
@@ -4,7 +4,6 @@ import { f, m } from "../../../mappings/mappings";
import Feature from "../../featureClass/class";
import { numberWithCommas } from "../../utils/numberUtils";
import * as renderUtils from "../../utils/renderUtils";
-import { drawBoxAtBlock } from "../../utils/renderUtils";
import HudTextElement from "../hud/HudTextElement";
import LocationSetting from "../settings/settingThings/location";
import ToggleSetting from "../settings/settingThings/toggle";
@@ -23,6 +22,11 @@ class DungeonSolvers extends Feature {
super();
}
+ isInDungeon() {
+ if (!this.FeatureManager || !this.FeatureManager.features["dataLoader"]) return false
+ return this.FeatureManager.features["dataLoader"].class.isInDungeon
+ }
+
onEnable() {
this.initVariables();
@@ -163,12 +167,12 @@ class DungeonSolvers extends Feature {
7: 360,
};
- this.registerStep(true, 2, this.step);
- this.registerStep(true, 10, this.step2);
+ this.registerStep(true, 2, this.step).registeredWhen(() => this.isInDungeon());
+ this.registerStep(true, 10, this.step2).registeredWhen(() => this.isInDungeon());
this.registerEvent("worldLoad", this.onWorldLoad);
- this.registerEvent("renderOverlay", this.renderHud);
- this.registerEvent("renderWorld", this.renderWorld);
+ this.registerEvent("renderOverlay", this.renderHud).registeredWhen(() => this.isInDungeon());
+ this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.isInDungeon());
this.bloodOpenedBonus = false;
this.goneInBonus = false;
@@ -196,7 +200,7 @@ class DungeonSolvers extends Feature {
}
}
}
- })
+ }).registeredWhen(() => this.isInDungeon())
let mimicDeadMessages = ["$SKYTILS-DUNGEON-SCORE-MIMIC$", "Mimic Killed!", "Mimic Dead!", "Mimic dead!"]
this.registerChat("&r&9Party &8> ${msg}", (msg) => {
mimicDeadMessages.forEach(dmsg => {
@@ -238,7 +242,7 @@ class DungeonSolvers extends Feature {
}
});
- this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent);
+ this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(() => this.isInDungeon());
// this.registerEvent("renderEntity", this.renderEntity)
this.renderEntityEvent = undefined;
@@ -403,7 +407,7 @@ class DungeonSolvers extends Feature {
}
if (this.bloodCampAssist.getValue()) {
- this.skulls.forEach((skull) => {
+ for (let skull of this.skulls) {
let skullE = skull.getEntity();
// renderUtils.drawBoxAtEntity(skull, 255, 0, 0, 0.5, 0.5, ticks)
@@ -435,19 +439,23 @@ class DungeonSolvers extends Feature {
// Tessellator.drawString((time/1000).toFixed(3)+"s", endPoint[0], endPoint[1]+2, endPoint[2])
// }
}
- });
+ }
}
if (this.blazeX !== -1 && this.blazes.length > 0 && this.blazeSolver.getValue()) {
renderUtils.drawBoxAtEntity(this.blazes[0], 255, 0, 0, 1, 2, ticks, 2);
let lastLoc = [this.blazes[0].getX(), this.blazes[0].getY() + 1.5, this.blazes[0].getZ()];
- this.blazes.forEach((blaze, i) => {
+ // this.blazes.forEach((blaze, i) => {
+ for (let i = 0, blaze = this.blazes[0]; i < this.blazes.length; i++, blaze = this.blazes[i]) {
if (i < 3 && i !== 0) {
renderUtils.drawLineWithDepth(lastLoc[0], lastLoc[1], lastLoc[2], blaze.getX(), blaze.getY() + 1.5, blaze.getZ(), i === 1 ? 0 : 255, i === 1 ? 255 : 0, 0, 3 / i);
- lastLoc = [blaze.getX(), blaze.getY() + 1.5, blaze.getZ()];
+
+ lastLoc[0] = blaze.getX();
+ lastLoc[1] = blaze.getY() + 1.5;
+ lastLoc[2] = blaze.getZ();
}
- });
+ }
}
}
@@ -760,7 +768,7 @@ class DungeonSolvers extends Feature {
}
} else {
if (this.renderEntityEvent) {
- this.unregisterEvent(this.renderEntityEvent);
+ this.renderEntityEvent.unregister()
this.renderEntityEvent = undefined;
}
}
diff --git a/features/events/index.js b/features/events/index.js
index 8ab5f86..51081fd 100644
--- a/features/events/index.js
+++ b/features/events/index.js
@@ -25,7 +25,6 @@ class Events extends Feature {
this.showingWaypoints = false
this.lastPath = []
this.updatingPath = false
- this.hudElements = []
this.lastPathCords = undefined
@@ -48,24 +47,17 @@ class Events extends Feature {
this.shinyBlockOverlayEnabled = new ToggleSetting("Shiny blocks highlight", "Will highlight shiny blocks in the end", false, "shiny_blocks_overlay", this)
this.registerEvent("worldLoad", this.worldLoad)
- this.registerEvent("spawnParticle", this.spawnParticle)
- this.registerEvent("renderWorld", this.renderWorld)
- this.registerEvent("renderOverlay", this.renderOverlay)
+ this.registerEvent("spawnParticle", this.spawnParticle).registeredWhen(() => this.showingWaypoints)
+ this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.showingWaypoints || this.shinyBlockOverlayEnabled.getValue())
this.registerStep(true, 2, this.step)
this.registerStep(false, 5, this.step_5s)
- this.registerEvent("soundPlay", this.playSound)
+ this.registerEvent("soundPlay", this.playSound).registeredWhen(() => this.showingWaypoints)
this.registerChat("&r&eYou dug out a Griffin Burrow! &r&7(${*}/4)&r", this.burrialClicked)
this.registerChat("&r&eYou finished the Griffin burrow chain! &r&7(4/4)&r", this.burrialClicked)
}
- renderOverlay() {
- for (let element of this.hudElements) {
- element.render()
- }
- }
-
renderWorld(ticks) {
this.shinyBlocks.forEach(([loc]) => {
drawBoxAtBlockNotVisThruWalls(loc[0], loc[1], loc[2], 0, 255, 0, 0.1, 0.1)
diff --git a/features/fragBot/index.js b/features/fragBot/index.js
index 5662111..c6a2fd9 100644
--- a/features/fragBot/index.js
+++ b/features/fragBot/index.js
@@ -9,7 +9,7 @@ class FragBot extends Feature {
super()
}
- onEnable(){
+ onEnable() {
this.initVariables()
this.hostingFragBot = false
@@ -23,58 +23,58 @@ class FragBot extends Feature {
this.registerCommand("fragbot", this.fragbotCommand)
- this.registerStep(false, 5, this.step)
- this.registerStep(true, 2, this.step2)
+ this.registerStep(false, 5, this.step).registeredWhen(() => this.hostingFragBot)
+ this.registerStep(true, 2, this.step2).registeredWhen(() => this.hostingFragBot)
this.registerChat("&9&m---------------------------${*}&r&9\n&r${player} &r&ehas invited you to join their party!\n&r&eYou have &r&c60 &r&eseconds to accept. &r&6Click here to join!&r&9\n&r&9&m----------------------------${*}&r", this.recievedPartyInvite)
}
-
- step(){
- if(!this.hostingFragBot) return
- if(this.fragBotQueue.length > 0){
+ step() {
+ if (!this.hostingFragBot) return
+
+ if (this.fragBotQueue.length > 0) {
let player = this.fragBotQueue.shift()
- if(player){
+ if (player) {
this.commandQueue.push("/party leave")
this.commandQueue.push("/party accept " + player)
}
}
}
- step2(){
- if(!this.hostingFragBot) return
+ step2() {
+ if (!this.hostingFragBot) return
- if(this.commandQueue.length > 0){
+ if (this.commandQueue.length > 0) {
let command = this.commandQueue.shift()
- if(command){
+ if (command) {
ChatLib.say(command)
}
}
}
- recievedPartyInvite(player){
- if(!this.hostingFragBot) return
+ recievedPartyInvite(player) {
+ if (!this.hostingFragBot) return
player = ChatLib.removeFormatting(player).split(" ").pop()
this.fragBotQueue.push(player)
}
- fragbotCommand(...args){
- if(this.hostingFragBot){
+ fragbotCommand(...args) {
+ if (this.hostingFragBot) {
this.hostingFragBot = false
ChatLib.chat(this.FeatureManager.messagePrefix + "Fragbot has been disabled")
- }else{
+ } else {
this.hostingFragBot = true
ChatLib.chat(this.FeatureManager.messagePrefix + "Now acting as a fragbot, run /fragbot again to disable")
}
}
- initVariables(){
+ initVariables() {
this.hostingFragBot = undefined
this.fragBotQueue = undefined
this.commandQueue = undefined
}
- onDisable(){
+ onDisable() {
this.initVariables()
}
}
diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js
index 8646e45..3d09319 100644
--- a/features/hud/HudTextElement.js
+++ b/features/hud/HudTextElement.js
@@ -31,6 +31,7 @@ class HudTextElement {
}
setText(text = "") {
+ if (text === this.text) return this
this.text = text
if (this.locationSetting && this.locationSetting.shadowType === 2) {
@@ -111,30 +112,28 @@ class HudTextElement {
}
renderRaw() {
- try {
- let text = this.getText()
-
- text.forEach((line, i) => {
- Renderer.scale(this.locationSetting.scale, this.locationSetting.scale)
- switch (this.locationSetting.shadowType) {
- case 0:
- Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- break;
- case 1:
- Renderer.drawStringWithShadow(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- break;
- case 2:
- let blackText = this.getBlackText()
- Renderer.drawString(blackText[i], (this.locationSetting.x + 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- Renderer.drawString(blackText[i], (this.locationSetting.x - 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y + 1) / this.locationSetting.scale + 9 * i)
- Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y - 1) / this.locationSetting.scale + 9 * i)
-
- Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- break;
- }
- })
- } catch (e) { }//incase of wrong opengl context
+ let text = this.getText()
+
+ text.forEach((line, i) => {
+ Renderer.scale(this.locationSetting.scale, this.locationSetting.scale)
+ switch (this.locationSetting.shadowType) {
+ case 0:
+ Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ break;
+ case 1:
+ Renderer.drawStringWithShadow(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ break;
+ case 2:
+ let blackText = this.getBlackText()
+ Renderer.drawString(blackText[i], (this.locationSetting.x + 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ Renderer.drawString(blackText[i], (this.locationSetting.x - 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y + 1) / this.locationSetting.scale + 9 * i)
+ Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y - 1) / this.locationSetting.scale + 9 * i)
+
+ Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ break;
+ }
+ })
}
}
diff --git a/features/hud/index.js b/features/hud/index.js
index f3761d7..44ee38a 100644
--- a/features/hud/index.js
+++ b/features/hud/index.js
@@ -225,7 +225,7 @@ class Hud extends Feature {
this.registerEvent("renderOverlay", this.renderHud)
this.registerStep(true, 5, this.step)
this.registerStep(false, 5, this.step_5second)
- this.registerEvent("renderWorld", this.renderWorld)
+ this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.fpsEnabledSetting.getValue() && this.fpsFastSetting.getValue())
this.registerEvent("worldLoad", this.worldLoad)
this.petLevels = {}
@@ -378,7 +378,6 @@ class Hud extends Feature {
}
renderWorld() {
- if (!this.fpsEnabledSetting.getValue() || !this.fpsFastSetting.getValue()) return
this.framesSince++
let instant = this.Instant.now()
diff --git a/features/lockedFeatures/index.js b/features/lockedFeatures/index.js
index 1332cd1..44a4139 100644
--- a/features/lockedFeatures/index.js
+++ b/features/lockedFeatures/index.js
@@ -13,12 +13,12 @@ class LockedFeatures extends Feature {
super()
}
- onEnable(){
+ onEnable() {
this.initVariables()
this.guildEventLbPossible = new FakeRequireToggle(false)
this.guildEventLb = new ToggleSetting("Guild event leaderboard", "A gui element for guild leaderboard progress", true, "guild_event_lb", this).requires(this.guildEventLbPossible)
-
+
this.hudElements = []
this.guildLbElement = new HudTextElement()
.setToggleSetting(this.guildEventLb)
@@ -29,59 +29,59 @@ class LockedFeatures extends Feature {
this.eventCommand = undefined
this.registerStep(true, 1, this.step)
- this.registerEvent("renderOverlay", this.renderOverlay)
+ this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.guildEventLb.getValue())
}
- step(){
- if(!SoopyV2Server.lbdatathing){
+ step() {
+ if (!SoopyV2Server.lbdatathing) {
this.guildEventLbPossible.set(false)
- if(this.eventCommand){
- this.unregisterCommand("eventlb")
+ if (this.eventCommand) {
+ this.eventCommand.unregister()
this.eventCommand = undefined
}
return;
}
-
+
this.guildEventLbPossible.set(true)
- if(!this.eventCommand){
- this.eventCommand = this.registerCommand("eventlb", ()=>{
- SoopyV2Server.lbdatathing.forEach((u, i)=>{
+ if (!this.eventCommand) {
+ this.eventCommand = this.registerCommand("eventlb", () => {
+ SoopyV2Server.lbdatathing.forEach((u, i) => {
let text = ""
- text += "§6#" + (i+1)
+ text += "§6#" + (i + 1)
text += "§7 - "
- text += "§e"+u.username
- text += "&7: §r"+numberWithCommas(Math.round(parseFloat(u.startingAmount)))
- if(u.progress) text += " §7("+ (u.progress>0?"+":"-")+Math.abs(Math.round(u.progress)) + "/h)"
+ text += "§e" + u.username
+ text += "&7: §r" + numberWithCommas(Math.round(parseFloat(u.startingAmount)))
+ if (u.progress) text += " §7(" + (u.progress > 0 ? "+" : "-") + Math.abs(Math.round(u.progress)) + "/h)"
ChatLib.chat(text)
})
})
}
- if(!this.guildEventLb.getValue()) return
+ if (!this.guildEventLb.getValue()) return
let text = ""
let playerPos = 0
- SoopyV2Server.lbdatathing.forEach((u, i)=>{
- if(u.uuid === Player.getUUID().toString().replace(/-/g, "")) playerPos = i
+ SoopyV2Server.lbdatathing.forEach((u, i) => {
+ if (u.uuid === Player.getUUID().toString().replace(/-/g, "")) playerPos = i
})
let prevProgress
let playerProgress
let nextProgress
- SoopyV2Server.lbdatathing.forEach((u, i)=>{
- if(i === playerPos-1) nextProgress = [parseFloat(u.startingAmount), u.progress]
- if(i === playerPos) playerProgress = [parseFloat(u.startingAmount), u.progress]
- if(i === playerPos+1) prevProgress = [parseFloat(u.startingAmount), u.progress]
- if(i === playerPos-1 || i === playerPos || i === playerPos+1 || (playerPos === 0 && i===playerPos+2)){
- text += "§6#" + (i+1)
+ SoopyV2Server.lbdatathing.forEach((u, i) => {
+ if (i === playerPos - 1) nextProgress = [parseFloat(u.startingAmount), u.progress]
+ if (i === playerPos) playerProgress = [parseFloat(u.startingAmount), u.progress]
+ if (i === playerPos + 1) prevProgress = [parseFloat(u.startingAmount), u.progress]
+ if (i === playerPos - 1 || i === playerPos || i === playerPos + 1 || (playerPos === 0 && i === playerPos + 2)) {
+ text += "§6#" + (i + 1)
text += "§7 - "
- text += "§e"+u.username
- text += "&7: §r"+numberWithCommas(Math.round(parseFloat(u.startingAmount)))
- if(u.progress) text += " §7("+ (u.progress>0?"+":"-")+Math.abs(Math.round(u.progress)) + "/h)"
+ text += "§e" + u.username
+ text += "&7: §r" + numberWithCommas(Math.round(parseFloat(u.startingAmount)))
+ if (u.progress) text += " §7(" + (u.progress > 0 ? "+" : "-") + Math.abs(Math.round(u.progress)) + "/h)"
text += "\n"
}
})
@@ -90,32 +90,32 @@ class LockedFeatures extends Feature {
let timeTillIncrease = Infinity
let timeTillDecrease = Infinity
- if(nextProgress && nextProgress[1]-playerProgress[1] < 0){
- timeTillIncrease = ((nextProgress[0]-playerProgress[0])/(playerProgress[1]-nextProgress[1])*60*60*1000)
+ if (nextProgress && nextProgress[1] - playerProgress[1] < 0) {
+ timeTillIncrease = ((nextProgress[0] - playerProgress[0]) / (playerProgress[1] - nextProgress[1]) * 60 * 60 * 1000)
}
- if(prevProgress && prevProgress[1]-playerProgress[1] < 0){
- timeTillDecrease = ((playerProgress[0]-prevProgress[0])/(prevProgress[1]-playerProgress[1])*60*60*1000)
+ if (prevProgress && prevProgress[1] - playerProgress[1] < 0) {
+ timeTillDecrease = ((playerProgress[0] - prevProgress[0]) / (prevProgress[1] - playerProgress[1]) * 60 * 60 * 1000)
}
- if((timeTillIncrease < timeTillDecrease || (timeTillIncrease > 0)) && timeTillDecrease < 0 && timeTillIncrease < 10000000000){
- text = "&d ^ in " + timeNumber2(timeTillIncrease) + "\n"+text
+ if ((timeTillIncrease < timeTillDecrease || (timeTillIncrease > 0)) && timeTillDecrease < 0 && timeTillIncrease < 10000000000) {
+ text = "&d ^ in " + timeNumber2(timeTillIncrease) + "\n" + text
}
- if((timeTillIncrease > timeTillDecrease || (timeTillDecrease>0))&&timeTillIncrease<0 && timeTillDecrease < 10000000000){
- text = "&d v in " + timeNumber2(timeTillDecrease) + "\n"+text
+ if ((timeTillIncrease > timeTillDecrease || (timeTillDecrease > 0)) && timeTillIncrease < 0 && timeTillDecrease < 10000000000) {
+ text = "&d v in " + timeNumber2(timeTillDecrease) + "\n" + text
}
this.guildLbElement.setText(text)
}
- renderOverlay(){
- this.hudElements.forEach(a=>a.render())
+ renderOverlay() {
+ this.hudElements.forEach(a => a.render())
}
- initVariables(){
+ initVariables() {
}
- onDisable(){
+ onDisable() {
this.initVariables()
}
}
diff --git a/features/mining/index.js b/features/mining/index.js
index a2cfccf..a05552d 100644
--- a/features/mining/index.js
+++ b/features/mining/index.js
@@ -14,7 +14,7 @@ class Mining extends Feature {
super()
}
- onEnable(){
+ onEnable() {
this.initVariables()
this.hudElements = []
@@ -35,10 +35,10 @@ class Mining extends Feature {
this.compactProgressHud = new ToggleSetting("Show compact blocks in the current session", "This will add a HUD element with the compact progress", true, "compact_progress_hud", this)
this.compactHudElement = new HudTextElement()
- .setToggleSetting(this.compactProgressHud)
- .setLocationSetting(new LocationSetting("HUD Location", "Allows you to edit the location of the compact progress", "compact_progress_location", this, [10, 50, 1, 1])
- .requires(this.compactProgressHud)
- .editTempText("&6Compact Session&7> &f12,345"))
+ .setToggleSetting(this.compactProgressHud)
+ .setLocationSetting(new LocationSetting("HUD Location", "Allows you to edit the location of the compact progress", "compact_progress_location", this, [10, 50, 1, 1])
+ .requires(this.compactProgressHud)
+ .editTempText("&6Compact Session&7> &f12,345"))
this.hudElements.push(this.compactHudElement)
this.compactProgressHudOnlyWhenMoreThan0 = new ToggleSetting("Only show compact progress when it is above 0", "So that you dont need to disable it when you start doing something else", true, "compact_progress_disable_0", this).requires(this.compactProgressHud)
@@ -53,178 +53,178 @@ class Mining extends Feature {
this.armourstandClass = Java.type("net.minecraft.entity.item.EntityArmorStand").class
- this.registerEvent("renderOverlay", this.renderOverlay)
+ this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.balRespawnHud.getValue() || this.compactProgressHud.getValue())
this.registerEvent("tick", this.tick)
- this.registerEvent("itemTooltip", this.itemTooltipEvent)
- this.registerEvent("renderWorld", this.renderWorld)
+ this.registerEvent("itemTooltip", this.itemTooltipEvent).registeredWhen(() => this.showContainedGemstoneSlots.getValue() || this.showUnlockedGemstoneSlots.getValue())
+ this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.guessBalHp.getValue())
- this.registerChat("&r&c&o&r&6&lRARE DROP! &r&eA Bal Pet dropped!&r", ()=>{
- if(this.balPetAlert.getValue()){
+ this.registerChat("&r&c&o&r&6&lRARE DROP! &r&eA Bal Pet dropped!&r", () => {
+ if (this.balPetAlert.getValue()) {
World.playSound("random.orb", 1, 1)
Client.showTitle("§r§c§o§r§6§lRARE DROP! §r§eA Bal Pet dropped!§r", "", 20, 50, 20)
}
})
- this.registerChat("&r&c&oThe bosses outer shell looks to be weakening!&r", ()=>{
+ this.registerChat("&r&c&oThe bosses outer shell looks to be weakening!&r", () => {
this.balHP = 200
})
- this.registerChat("&r&c&oHalf way there! The boss is starting to become weaker!&r", ()=>{
+ this.registerChat