aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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("&r&c&oHalf way there! The boss is starting to become weaker!&r", () => {
this.balHP = 125
})
- this.registerChat("&r&c&oNearly there! The boss is shaking it can't last much longer!&r", ()=>{
+ this.registerChat("&r&c&oNearly there! The boss is shaking it can't last much longer!&r", () => {
this.balHP = 75
})
- this.registerChat("&r&c&oThe boss looks weak and tired and retreats into the lava...&r", ()=>{
+ this.registerChat("&r&c&oThe boss looks weak and tired and retreats into the lava...&r", () => {
this.balHP = 0
})
}
- itemTooltipEvent(lore, item, event){
+ itemTooltipEvent(lore, item, event) {
this.addLore(item)
}
/**
* @param {Item} item
*/
- addLore(item){
- if(!item) return
- if(this.showUnlockedGemstoneSlots.getValue()){
+ addLore(item) {
+ if (!item) return
+ if (this.showUnlockedGemstoneSlots.getValue()) {
let gems = item.getNBT().getCompoundTag("tag").getCompoundTag("ExtraAttributes").getCompoundTag("gems")
- if(gems){
+ if (gems) {
let unlockedGems = gems.getTagMap().get("unlocked_slots")
- if(unlockedGems){
+ if (unlockedGems) {
- if(unlockedGems[m.tagCount]() === 0){
+ if (unlockedGems[m.tagCount]() === 0) {
utils.addLore(item, ChatLib.addColor("&d&lGemstones Unlocked: &f"), ChatLib.addColor("&cNone!"))
- }else{
+ } else {
let gemstoneString = ""
- for(let i = 0; i < unlockedGems[m.tagCount](); i++){
+ for (let i = 0; i < unlockedGems[m.tagCount](); i++) {
let gem = String(unlockedGems[m.getStringTagAt](i)).split("_")
let name = stringUtils.firstLetterCapital(gem[0].toLowerCase())
- gemstoneString += (gemstoneString===""?"":"&7, &a")+name
+ gemstoneString += (gemstoneString === "" ? "" : "&7, &a") + name
}
- utils.addLore(item, ChatLib.addColor("&d&lGemstones Unlocked: &f"), ChatLib.addColor("&a"+gemstoneString))
+ utils.addLore(item, ChatLib.addColor("&d&lGemstones Unlocked: &f"), ChatLib.addColor("&a" + gemstoneString))
}
}
}
- }
- if(this.showContainedGemstoneSlots.getValue()){
+ }
+ if (this.showContainedGemstoneSlots.getValue()) {
let gems = item.getNBT().getCompoundTag("tag").getCompoundTag("ExtraAttributes").getCompoundTag("gems")
- if(gems){
+ if (gems) {
let unlockedGems = gems.getTagMap()
let gemStr = ""
unlockedGems.keySet().forEach(gem => {
- if(gem !== "unlocked_slots" && !gem.endsWith("_gem")){
+ if (gem !== "unlocked_slots" && !gem.endsWith("_gem")) {
gem = gem.split("_")
- let gemName = stringUtils.firstLetterCapital(gems.getString(gem.join("_") + "_gem").toLowerCase()) ||stringUtils.firstLetterCapital(gem[0].toLowerCase())
+ let gemName = stringUtils.firstLetterCapital(gems.getString(gem.join("_") + "_gem").toLowerCase()) || stringUtils.firstLetterCapital(gem[0].toLowerCase())
let name = stringUtils.firstLetterCapital(gems.getString(gem.join("_")).toLowerCase()) + " " + gemName
-
- gemStr += (gemStr===""?"":"&7, &a")+name
+
+ gemStr += (gemStr === "" ? "" : "&7, &a") + name
}
});
- if(gemStr !== ""){
- utils.addLore(item, ChatLib.addColor("&d&lGemstones: &f"), ChatLib.addColor("&a"+gemStr))
+ if (gemStr !== "") {
+ utils.addLore(item, ChatLib.addColor("&d&lGemstones: &f"), ChatLib.addColor("&a" + gemStr))
}
}
- }
+ }
}
- renderWorld(){
- if(this.guessBalHp.getValue()){
- if(this.balEntity) Tessellator.drawString(this.balHP + "/250" , this.balEntity.getX(), this.balEntity.getY()+12, this.balEntity.getZ())
+ renderWorld() {
+ if (this.guessBalHp.getValue()) {
+ if (this.balEntity) Tessellator.drawString(this.balHP + "/250", this.balEntity.getX(), this.balEntity.getY() + 12, this.balEntity.getZ())
}
}
- tick(){
+ tick() {
let oldCompactItems = this.compactItems
let oldTotalCompact = this.totalCompact
this.totalCompact = 0
this.compactItems = 0
let slots = [0, 1, 2, 3, 4, 5, 6, 7, 8]
-
- slots.forEach(a=>{
+
+ slots.forEach(a => {
item = Player.getInventory().getStackInSlot(a)
- if(!item) return
- if(item.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getInteger("compact_blocks")){
+ if (!item) return
+ if (item.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getInteger("compact_blocks")) {
this.compactItems++
this.totalCompact += item.getNBT().getCompoundTag("tag").getCompoundTag("ExtraAttributes").getInteger("compact_blocks")
}
})
- if(oldCompactItems === this.compactItems){
- this.compactProgress += this.totalCompact-oldTotalCompact
+ if (oldCompactItems === this.compactItems) {
+ this.compactProgress += this.totalCompact - oldTotalCompact
}
- if(this.compactItems === 0){
+ if (this.compactItems === 0) {
this.compactProgress = 0
}
- if(this.compactProgress === 0 && this.compactProgressHudOnlyWhenMoreThan0.getValue()){
+ if (this.compactProgress === 0 && this.compactProgressHudOnlyWhenMoreThan0.getValue()) {
this.compactHudElement.setText("")
- }else{
+ } else {
this.compactHudElement.setText("&6Compact Session&7> &f" + numberWithCommas(this.compactProgress))
}
- if(!this.FeatureManager.features["dataLoader"]) return
- if(this.guessBalHp.getValue() || this.balRespawnHud.getValue()){
- if(this.FeatureManager.features["dataLoader"].class.area === "Crystal Hollows" && this.FeatureManager.features["dataLoader"].class.areaFine === "Khazad-dm"){
-
+ if (!this.FeatureManager.features["dataLoader"]) return
+ if (this.guessBalHp.getValue() || this.balRespawnHud.getValue()) {
+ if (this.FeatureManager.features["dataLoader"].class.area === "Crystal Hollows" && this.FeatureManager.features["dataLoader"].class.areaFine === "Khazad-dm") {
+
this.balEntity = undefined
- World.getAllEntities().filter(a=>a.getName()==="Magma Cube").filter(a=>a.getEntity()[m.getSlimeSize]() > 10).forEach((bal)=>{
+ World.getAllEntities().filter(a => a.getName() === "Magma Cube").filter(a => a.getEntity()[m.getSlimeSize]() > 10).forEach((bal) => {
//Bal found
this.balEntity = bal
})
- if(this.balEntity){
- this.balDespawnDebounce=0
- if(this.lastBalAlive !== 0){
+ if (this.balEntity) {
+ this.balDespawnDebounce = 0
+ if (this.lastBalAlive !== 0) {
this.lastBalAlive = 0
}
- World.getAllEntitiesOfType(this.armourstandClass).forEach(e=>{
- if(Math.abs(e.getX()-this.balEntity.getX())<=5 && Math.abs(e.getZ()-this.balEntity.getZ())<=5 && Math.abs(e.getY()-(this.balEntity.getY()+12))<=5){
- if(!this.seenBalDamages.includes(e.getUUID())){
+ World.getAllEntitiesOfType(this.armourstandClass).forEach(e => {
+ if (Math.abs(e.getX() - this.balEntity.getX()) <= 5 && Math.abs(e.getZ() - this.balEntity.getZ()) <= 5 && Math.abs(e.getY() - (this.balEntity.getY() + 12)) <= 5) {
+ if (!this.seenBalDamages.includes(e.getUUID())) {
this.balHP--
this.seenBalDamages.push(e.getUUID())
}
}
})
- }else{
+ } else {
this.balDespawnDebounce++
- if(this.balDespawnDebounce > 10){
+ if (this.balDespawnDebounce > 10) {
this.seenBalDamages = []
this.balHP = 250
- if(this.lastBalAlive === 0) this.lastBalAlive = Date.now()
+ if (this.lastBalAlive === 0) this.lastBalAlive = Date.now()
}
}
}
}
- if(this.balRespawnHud.getValue() && this.FeatureManager.features["dataLoader"].class.area === "Crystal Hollows" && this.FeatureManager.features["dataLoader"].class.areaFine === "Khazad-dm"){
- if(this.balEntity){
+ if (this.balRespawnHud.getValue() && this.FeatureManager.features["dataLoader"].class.area === "Crystal Hollows" && this.FeatureManager.features["dataLoader"].class.areaFine === "Khazad-dm") {
+ if (this.balEntity) {
this.balHudElement.setText("&6Bal&7> &f" + this.balHP + "/250")
- }else{
- this.balHudElement.setText("&6Bal&7> &f" + Math.max(0, Math.floor((290000-(Date.now()-this.lastBalAlive))/1000)) + "s")
+ } else {
+ this.balHudElement.setText("&6Bal&7> &f" + Math.max(0, Math.floor((290000 - (Date.now() - this.lastBalAlive)) / 1000)) + "s")
}
- }else{
+ } else {
this.balHudElement.setText("")
}
}
- renderOverlay(){
- for(let element of this.hudElements){
+ renderOverlay() {
+ for (let element of this.hudElements) {
element.render()
}
}
-
- initVariables(){
+
+ initVariables() {
this.hudElements = undefined
this.guessBalHp = undefined
this.balRespawnHud = undefined
@@ -238,7 +238,7 @@ class Mining extends Feature {
this.balPetAlert = undefined
}
- onDisable(){
+ onDisable() {
this.initVariables()
}
}
diff --git a/features/nether/index.js b/features/nether/index.js
index 26ab29a..ee75c35 100644
--- a/features/nether/index.js
+++ b/features/nether/index.js
@@ -28,6 +28,16 @@ class Nether extends Feature {
super();
}
+ isInDojo() {
+ if (!this.FeatureManager || !this.FeatureManager.features["dataLoader"]) return false
+ return this.FeatureManager.features["dataLoader"].class.areaFine === "Dojo" || this.FeatureManager.features["dataLoader"].class.areaFine === "Dojo Arena"
+ }
+
+ isInNether() {
+ if (!this.FeatureManager || !this.FeatureManager.features["dataLoader"]) return false
+ return this.FeatureManager.features["dataLoader"].class.area === "Crimson Isle"
+ }
+
onEnable() {
this.initVariables();
@@ -35,12 +45,11 @@ class Nether extends Feature {
this.speedNextBlock = new ToggleSetting("Show next block to stand on for dojo swiftness", "", true, "dojo_swiftness", this)
this.tenacityLine = new ToggleSetting("Show line for fireball in dojo tenacity", "This may help you to dodge the fireballs", false, "dojo_tanacity", this)
- this.registerCustom("packetReceived", this.packetReceived)
-
- this.registerStep(true, 1, this.step1S)
- this.registerEvent("renderWorld", this.renderWorld)
+ this.registerCustom("packetReceived", this.packetReceived).registeredWhen(() => this.isInDojo())
+ this.registerStep(true, 1, this.step1S).registeredWhen(() => this.isInDojo())
+ this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.isInNether())
- this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent);
+ this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(() => this.isInDojo());
this.registerEvent("tick", this.tick)
this.todoE = []
@@ -61,12 +70,6 @@ class Nether extends Feature {
this.inSwiftness = false
this.lastBlock = undefined
})
- //&e[NPC] &eRescue Recruiter&f: &rPerfect! Go see our &eUndercover Agent &rat the &5Cathedral &rarea in &5Mage &rterritory to get started.&r
- this.registerChat("&e[NPC] &eRescue Recruiter&f: &rPerfect! Go see our &eUndercover Agent &rat the ${*} in ${type} &rterritory to get started.&r", (type) => {
- // console.log(type)
- this.rescueMissionType = ChatLib.removeFormatting(type) === "Mage" ? "barbarian" : "mage"
- // console.log(this.rescueMissionDifficulty, this.rescueMissionType)
- })
this.registerChat("You completed your rescue quest! Visit the Town Board to claim the rewards,", () => {
this.rescueMissionDifficulty = this.rescueMissionType = undefined
@@ -77,13 +80,18 @@ class Nether extends Feature {
}
tick() {
- if (Player.getContainer().getName() === "Rescue") {
+ if (Player.getContainer().getName() === "Rescue" && Player.getContainer().getStackInSlot(22)) {
let difficulty = ChatLib.removeFormatting(Player.getContainer().getStackInSlot(22).getName()).trim()[0]
this.rescueMissionDifficulty = difficulty
- // console.log(this.rescueMissionDifficulty, this.rescueMissionType)
+ TabList.getNames().forEach(n => {
+ if (n.toLowerCase().includes("barbarian rep")) this.rescueMissionType = "barbarian"// : "mage"
+ if (n.toLowerCase().includes("mage rep")) this.rescueMissionType = "mage"// : "mage"
+ })
}
+
+
this.todoE2.forEach(e => {
let item = e[m.getHeldItem]()
if (!item) return
diff --git a/features/nether/metadata.json b/features/nether/metadata.json
index 8b8a989..687abd6 100644
--- a/features/nether/metadata.json
+++ b/features/nether/metadata.json
@@ -1,8 +1,8 @@
{
"name": "Nether",
- "description": "May cause some lag if enabled when not in nether",
+ "description": "",
"isHidden": false,
"isTogglable": true,
- "defaultEnabled": false,
+ "defaultEnabled": true,
"sortA": 1
} \ No newline at end of file
diff --git a/features/slayers/index.js b/features/slayers/index.js
index db5983c..6ebeb3b 100644
--- a/features/slayers/index.js
+++ b/features/slayers/index.js
@@ -90,7 +90,7 @@ class Slayers extends Feature {
this.lastBossNotSpawnedTime = 0;
this.lastBossSpawned = 0;
- this.registerEvent("renderOverlay", this.renderOverlay);
+ 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) {
@@ -114,11 +114,12 @@ class Slayers extends Feature {
this.lastServer = undefined
this.lastSentServer = 0
this.slayerLocationDataH = {}
+ this.hasQuest = false
this.entityAttackEventLoaded = false;
this.entityAttackEventE = undefined;
- this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent);
+ this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(() => this.hasQuest);
this.registerEvent("tick", this.tick);
this.registerEvent("renderWorld", this.renderWorld);
this.registerEvent("worldLoad", this.worldLoad);
@@ -224,7 +225,7 @@ class Slayers extends Feature {
} else {
if (this.entityAttackEventLoaded) {
this.entityAttackEventLoaded = false;
- this.unregisterForge(this.entityAttackEventE);
+ this.entityAttackEventE.unregister()
}
}
@@ -237,10 +238,12 @@ class Slayers extends Feature {
let lastBossSlainMessage = this.bossSlainMessage
this.bossSlainMessage = false;
+ this.hasQuest = false
let dis1 = false;
this.dulkirThingElement.setText("")
Scoreboard.getLines().forEach((line, i) => {
if (ChatLib.removeFormatting(line.getName()).includes("Slayer Quest")) {
+ this.hasQuest = true
let slayerInfo = ChatLib.removeFormatting(Scoreboard.getLines()[i - 1].getName().replace(/§/g, "&"));
let levelString = slayerInfo.split(" ").pop().trim();
let slayerLevelToExp = {
diff --git a/features/spamHider/index.js b/features/spamHider/index.js
index 36c9a95..dee4046 100644
--- a/features/spamHider/index.js
+++ b/features/spamHider/index.js
@@ -11,7 +11,7 @@ class SpamHider extends Feature {
super()
}
- onEnable(){
+ onEnable() {
this.initVariables()
this.hideMessages = []
@@ -32,7 +32,7 @@ class SpamHider extends Feature {
this.textShadowSetting = new ToggleSetting("Spam Hider Text Shadow", "Whether to give the spam hider text shadow", true, "spam_text_shadow", this)
this.SpamHiderMessagesRenderer = new SpamHiderMessagesRenderer()
- this.textShadowSetting.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{
+ this.textShadowSetting.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => {
this.SpamHiderMessagesRenderer.textShadow = this.textShadowSetting.getValue()
}))
@@ -40,7 +40,7 @@ class SpamHider extends Feature {
this.registerChat("${*}", this.onChat)
- this.registerEvent("renderOverlay", this.renderOverlay)
+ this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.moveMessagesSetting.getValue())
// this.registerChat("&r${userandrank}&r&f: ${message}&r", this.chatPlayerMessage)
}
@@ -65,37 +65,37 @@ class SpamHider extends Feature {
// }
// }
- onChat(e){
+ onChat(e) {
let msg = ChatLib.getChatMessage(e, true).replace(/§/g, "&").replace(/(?:^&r)|(?:&r$)/g, "")
- if(msg.length > 1000) return //performance
+ if (msg.length > 1000) return //performance
- if(this.hideMessagesSetting.getValue()){
+ if (this.hideMessagesSetting.getValue()) {
// console.log("testing " + (this.hideMessagesDict[msg.substring(0,5)]?.length || 0) + this.hideMessagesDict.all.length + " hide messages")
- this.hideMessagesDict[msg.substring(0,5)]?.forEach(regex => {
- if(regex.test(msg)){
+ this.hideMessagesDict[msg.substring(0, 5)]?.forEach(regex => {
+ if (regex.test(msg)) {
cancel(e)
return
}
})
this.hideMessagesDict.all.forEach(regex => {
- if(regex.test(msg)){
+ if (regex.test(msg)) {
cancel(e)
return
}
})
}
- if(this.moveMessagesSetting.getValue()){
+ if (this.moveMessagesSetting.getValue()) {
// console.log("testing " + (this.moveMessagesDict[msg.substring(0,5)]?.length || 0) + this.moveMessagesDict.all.length + " spam messages")
- this.moveMessagesDict[msg.substring(0,5)]?.forEach(regex => {
- if(regex.test(msg)){
+ this.moveMessagesDict[msg.substring(0, 5)]?.forEach(regex => {
+ if (regex.test(msg)) {
this.SpamHiderMessagesRenderer.addMessage(msg)
cancel(e)
return
}
})
this.moveMessagesDict.all.forEach(regex => {
- if(regex.test(msg)){
+ if (regex.test(msg)) {
this.SpamHiderMessagesRenderer.addMessage(msg)
cancel(e)
return
@@ -103,45 +103,45 @@ class SpamHider extends Feature {
})
}
}
- renderOverlay(){
- this.SpamHiderMessagesRenderer.render(100,100,1, 1)
+ renderOverlay() {
+ this.SpamHiderMessagesRenderer.render(100, 100, 1, 1)
}
- loadSpamMessages(){
- fetch("http://soopymc.my.to/api/soopyv2/spamHiderMessages.json").json(messages=>{
+ loadSpamMessages() {
+ fetch("http://soopymc.my.to/api/soopyv2/spamHiderMessages.json").json(messages => {
this.hideMessages = messages.hideMessages
this.moveMessages = messages.moveMessages
-
+
this.hideMessagesDict = {
all: []
}
-
+
this.hideMessagesRexex = []
- this.hideMessages.forEach(message=>{
+ this.hideMessages.forEach(message => {
let regex = new RegExp(message.replace(/[\\^$*+?.()|[\]{}]/g, '$&')
- .replace(/\$\{\*\}/g, "(?:.+)"))
- if(!message.substring(0,5).includes("$")){
- if(!this.hideMessagesDict[message.substring(0,5)]) this.hideMessagesDict[message.substring(0,5)] = []
- this.hideMessagesDict[message.substring(0,5)].push(regex)
- }else{
+ .replace(/\$\{\*\}/g, "(?:.+)"))
+ if (!message.substring(0, 5).includes("$")) {
+ if (!this.hideMessagesDict[message.substring(0, 5)]) this.hideMessagesDict[message.substring(0, 5)] = []
+ this.hideMessagesDict[message.substring(0, 5)].push(regex)
+ } else {
this.hideMessagesDict.all.push(regex)
}
this.hideMessagesRexex.push(regex)
})
-
+
this.moveMessagesDict = {
all: []
}
-
+
this.moveMessagesRexex = []
- this.moveMessages.forEach(message=>{
+ this.moveMessages.forEach(message => {
let regex = new RegExp(message.replace(/[\\^$*+?.()|[\]{}]/g, '$&')
- .replace(/\$\{\*\}/g, "(?:.+)"))
-
- if(!message.substring(0,5).includes("$")){
- if(!this.moveMessagesDict[message.substring(0,5)]) this.moveMessagesDict[message.substring(0,5)] = []
- this.moveMessagesDict[message.substring(0,5)].push(regex)
- }else{
+ .replace(/\$\{\*\}/g, "(?:.+)"))
+
+ if (!message.substring(0, 5).includes("$")) {
+ if (!this.moveMessagesDict[message.substring(0, 5)]) this.moveMessagesDict[message.substring(0, 5)] = []
+ this.moveMessagesDict[message.substring(0, 5)].push(regex)
+ } else {
this.moveMessagesDict.all.push(regex)
}
this.moveMessagesRexex.push(regex)
@@ -149,7 +149,7 @@ class SpamHider extends Feature {
})
}
- initVariables(){
+ initVariables() {
this.hideMessages = undefined
this.hideMessagesRexex = undefined
this.moveMessages = undefined
@@ -157,13 +157,13 @@ class SpamHider extends Feature {
this.SpamHiderMessagesRenderer = undefined
}
- onDisable(){
+ onDisable() {
this.initVariables()
}
}
-class SpamHiderMessagesRenderer{
- constructor(){
+class SpamHiderMessagesRenderer {
+ constructor() {
this.messages = []
this.x = 0 //offset from corner, not absolute location
this.y = 0 //offset from corner, not absolute location
@@ -175,26 +175,26 @@ class SpamHiderMessagesRenderer{
this.textShadow = true
}
- addMessage(str){
+ addMessage(str) {
this.messages.push([str, Date.now(), this.y])
}
- render(){
+ render() {
Renderer.drawString("", -100, -100)//Fixes skytils issue //idk if this is still needed, it was in old code and imma just leave it ig
let now = Date.now()
- let animDiv = (now-this.lastRender) / 1000
+ let animDiv = (now - this.lastRender) / 1000
this.lastRender = now
let swidth = Renderer.screen.getWidth()
let sheight = Renderer.screen.getHeight()
//loop over all messages backwards
- for(let i = this.messages.length - 1; i >= 0; i--){
+ for (let i = this.messages.length - 1; i >= 0; i--) {
let message = this.messages[i]
-
+
let [str, time, height] = message
- time = now-time
+ time = now - time
let messageWidth = Renderer.getStringWidth(ChatLib.removeFormatting(str))
@@ -202,15 +202,15 @@ class SpamHiderMessagesRenderer{
let y = 0;
if (this.corner === 0) { //top left
x = 20
- this.messages[i][2] = height + (((this.messages.length-i) * -10) - height) * (animDiv * 5)
+ this.messages[i][2] = height + (((this.messages.length - i) * -10) - height) * (animDiv * 5)
}
if (this.corner === 1) { //top right
x = swidth - 20 - messageWidth
- this.messages[i][2] = height + (((this.messages.length-i) * -10) - height) * (animDiv * 5)
+ this.messages[i][2] = height + (((this.messages.length - i) * -10) - height) * (animDiv * 5)
}
if (this.corner === 2) { //bottom right
x = swidth - 20 - messageWidth
- this.messages[i][2] = height + (((this.messages.length-i) * 10) - height) * (animDiv * 5)
+ this.messages[i][2] = height + (((this.messages.length - i) * 10) - height) * (animDiv * 5)
}
let animOnOff = 0
@@ -244,9 +244,9 @@ class SpamHiderMessagesRenderer{
y = sheight - 30 - (height)
}
- if(this.textShadow){
+ if (this.textShadow) {
Renderer.drawStringWithShadow(str, x + this.x, y + this.y);
- }else{
+ } else {
Renderer.drawString(str, x + this.x, y + this.y);
}
@@ -263,66 +263,66 @@ module.exports = {
var sha256 = function a(b) {
function c(a, b) {
- return (a >>> b) | (a << (32 - b));
+ return (a >>> b) | (a << (32 - b));
}
for (
- var d,
- e,
- f = Math.pow,
- g = f(2, 32),
- h = "length",
- i = "",
- j = [],
- k = 8 * b[h],
- l = (a.h = a.h || []),
- m = (a.k = a.k || []),
- n = m[h],
- o = {},
- p = 2;
- 64 > n;
- p++
+ var d,
+ e,
+ f = Math.pow,
+ g = f(2, 32),
+ h = "length",
+ i = "",
+ j = [],
+ k = 8 * b[h],
+ l = (a.h = a.h || []),
+ m = (a.k = a.k || []),
+ n = m[h],
+ o = {},
+ p = 2;
+ 64 > n;
+ p++
)
- if (!o[p]) {
- for (d = 0; 313 > d; d += p) o[d] = p;
- (l[n] = (f(p, 0.5) * g) | 0), (m[n++] = (f(p, 1 / 3) * g) | 0);
- }
+ if (!o[p]) {
+ for (d = 0; 313 > d; d += p) o[d] = p;
+ (l[n] = (f(p, 0.5) * g) | 0), (m[n++] = (f(p, 1 / 3) * g) | 0);
+ }
for (b += "\x80"; (b[h] % 64) - 56;) b += "\x00";
for (d = 0; d < b[h]; d++) {
- if (((e = b.charCodeAt(d)), e >> 8)) return;
- j[d >> 2] |= e << (((3 - d) % 4) * 8);
+ if (((e = b.charCodeAt(d)), e >> 8)) return;
+ j[d >> 2] |= e << (((3 - d) % 4) * 8);
}
for (j[j[h]] = (k / g) | 0, j[j[h]] = k, e = 0; e < j[h];) {
- var q = j.slice(e, (e += 16)),
- r = l;
- for (l = l.slice(0, 8), d = 0; 64 > d; d++) {
- var s = q[d - 15],
- t = q[d - 2],
- u = l[0],
- v = l[4],
- w =
- l[7] +
- (c(v, 6) ^ c(v, 11) ^ c(v, 25)) +
- ((v & l[5]) ^ (~v & l[6])) +
- m[d] +
- (q[d] =
- 16 > d
- ? q[d]
- : (q[d - 16] +
- (c(s, 7) ^ c(s, 18) ^ (s >>> 3)) +
- q[d - 7] +
- (c(t, 17) ^ c(t, 19) ^ (t >>> 10))) |
- 0),
- x =
- (c(u, 2) ^ c(u, 13) ^ c(u, 22)) +
- ((u & l[1]) ^ (u & l[2]) ^ (l[1] & l[2]));
- (l = [(w + x) | 0].concat(l)), (l[4] = (l[4] + w) | 0);
- }
- for (d = 0; 8 > d; d++) l[d] = (l[d] + r[d]) | 0;
+ var q = j.slice(e, (e += 16)),
+ r = l;
+ for (l = l.slice(0, 8), d = 0; 64 > d; d++) {
+ var s = q[d - 15],
+ t = q[d - 2],
+ u = l[0],
+ v = l[4],
+ w =
+ l[7] +
+ (c(v, 6) ^ c(v, 11) ^ c(v, 25)) +
+ ((v & l[5]) ^ (~v & l[6])) +
+ m[d] +
+ (q[d] =
+ 16 > d
+ ? q[d]
+ : (q[d - 16] +
+ (c(s, 7) ^ c(s, 18) ^ (s >>> 3)) +
+ q[d - 7] +
+ (c(t, 17) ^ c(t, 19) ^ (t >>> 10))) |
+ 0),
+ x =
+ (c(u, 2) ^ c(u, 13) ^ c(u, 22)) +
+ ((u & l[1]) ^ (u & l[2]) ^ (l[1] & l[2]));
+ (l = [(w + x) | 0].concat(l)), (l[4] = (l[4] + w) | 0);
+ }
+ for (d = 0; 8 > d; d++) l[d] = (l[d] + r[d]) | 0;
}
for (d = 0; 8 > d; d++)
- for (e = 3; e + 1; e--) {
- var y = (l[d] >> (8 * e)) & 255;
- i += (16 > y ? 0 : "") + y.toString(16);
- }
+ for (e = 3; e + 1; e--) {
+ var y = (l[d] >> (8 * e)) & 255;
+ i += (16 > y ? 0 : "") + y.toString(16);
+ }
return i;
- }; \ No newline at end of file
+}; \ No newline at end of file