From a8a5a3f8c2c0c0897006a6a68cf4fb1eba2b9f9f Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Sat, 7 May 2022 15:42:00 +0800 Subject: + remove update button patcher module (removed soopyv2 from ct website) + updating will be same as updatebuttonpatcher used to be, but built into soopyv2 + new version avalible chat message + show other player's inquis waypoints --- featureClass/class.js | 3 +- features/changeLogGUI/index.js | 239 ++++++++++++++++++++------------------- features/dataLoader/index.js | 96 +++++++++------- features/dungeonSolvers/index.js | 12 +- features/events/index.js | 39 ++++++- features/globalSettings/index.js | 3 - features/hud/HudTextElement.js | 4 +- features/nether/metadata.json | 2 +- features/slayers/index.js | 141 +++++++++++------------ index.js | 9 +- metadata.json | 4 +- socketConnection.js | 20 +++- 12 files changed, 318 insertions(+), 254 deletions(-) diff --git a/featureClass/class.js b/featureClass/class.js index 04e9552..d595e4b 100644 --- a/featureClass/class.js +++ b/featureClass/class.js @@ -173,7 +173,8 @@ class Event { } update() { - if (this.enabled === this.when()) return + let shouldBeEnabled = !!this.when() + if (this.enabled === shouldBeEnabled) return if (this.enabled) { this.unregister() diff --git a/features/changeLogGUI/index.js b/features/changeLogGUI/index.js index 0d60b72..f12187d 100644 --- a/features/changeLogGUI/index.js +++ b/features/changeLogGUI/index.js @@ -21,54 +21,58 @@ class ChangeLogGui extends Feature { super() } - onEnable(){ + onEnable() { this.initVariables() this.ChangelogPage = new ChangelogPage() this.latestAnnouncedVersion = this.ChangelogPage.currVersionId - // this.registerEvent("worldLoad", this.worldLoad) + this.registerEvent("worldLoad", this.worldLoad) + + this.registerStep(false, 60 * 5, () => { + this.ChangelogPage.loadChangeLog() + }) + } + + worldLoad() { + if (this.ChangelogPage.downloadableVersion === -1) return + if (this.latestAnnouncedVersion < this.ChangelogPage.downloadableVersion) { + let version = "" + this.ChangelogPage.changelogData.forEach(data => { + + if (this.ChangelogPage.downloadableVersion === data.versionId && this.ChangelogPage.downloadableVersion > this.ChangelogPage.currVersionId) { + //add button to download this version + version = data.version + } + }) + + ChatLib.chat("§r") + ChatLib.chat("&1" + ChatLib.getChatBreak("-").trim()) + ChatLib.chat(" &6New SoopyV2 Version is avalible (" + version + ")") + ChatLib.chat("§r§r") + new TextComponent(" &e[CLICK] &7- View changelog and download update").setHover("show_text", "&2Open changelog").setClick("run_command", "/soopyv2 changelog").chat() + ChatLib.chat("&1" + ChatLib.getChatBreak("-").trim()) + ChatLib.chat("§r§r§r") + + this.latestAnnouncedVersion = this.ChangelogPage.downloadableVersion + } } - // worldLoad(){ - // if(!this.FeatureManager.features["globalSettings"]) return - // if(!this.FeatureManager.features["globalSettings"].class.notifyNewVersion.getValue()) return - // if(this.ChangelogPage.downloadableVersion === -1) return - // if(this.latestAnnouncedVersion < this.ChangelogPage.downloadableVersion){ - // let version = "" - // this.ChangelogPage.changelogData.forEach(data=>{ - - // if(this.ChangelogPage.downloadableVersion === data.versionId && this.ChangelogPage.downloadableVersion > this.ChangelogPage.currVersionId){ - // //add button to download this version - // version = data.version - // } - // }) - - // ChatLib.chat("&1" + ChatLib.getChatBreak("-").substr(1)) - // ChatLib.chat(" &6New Soopyaddons Version is avalible (" + version + ")") - // ChatLib.chat("") - // new TextComponent(" &e[CLICK] &7- View changelog and download update").setHover("show_text", "&2Open changelog").setClick("run_command", "/soopyv2 changelog").chat() - // ChatLib.chat("&1" + ChatLib.getChatBreak("-").substr(1)) - - // this.latestAnnouncedVersion = this.ChangelogPage.downloadableVersion - // } - // } - - initVariables(){ + initVariables() { this.ChangelogPage = undefined } - onDisable(){ + onDisable() { this.initVariables() } } class ChangelogPage extends GuiPage { - constructor(){ + constructor() { super(9) - + this.name = "Changelog" this.pages = [this.newPage()] @@ -83,40 +87,37 @@ class ChangelogPage extends GuiPage { this.pages[0].addChild(this.changelogArea) //Update confirmation page - this.updatingSidebar =new SoopyGuiElement().setLocation(0,0,1,1) - this.updatingSidebarConfirmPage = new SoopyGuiElement().setLocation(0,0,1,1) + this.updatingSidebar = new SoopyGuiElement().setLocation(0, 0, 1, 1) + this.updatingSidebarConfirmPage = new SoopyGuiElement().setLocation(0, 0, 1, 1) this.updatingSidebar.addChild(this.updatingSidebarConfirmPage) - this.updateTitle = new SoopyTextElement().setText("§0Update to SoopyAddons ").setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1) + this.updateTitle = new SoopyTextElement().setText("§0Update to SoopyV2 ").setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1) this.updatingSidebarConfirmPage.addChild(this.updateTitle) -// this.warningMessage = new SoopyMarkdownElement().setLocation(0.1, 0.2, 0.8, 0.8) -// this.warningMessage.setText(`# NOTE -// Updating SoopyAddons through this method is downloading the code from _§cmy server_ -// This means that there is _§cno_ third party that is double checking the code to ensure there is no virus in it. -// This is fine if you trust me to not put a virus in it, but if you dont you should instead wait for the update to be checked and verified by the chattriggers people.`) -// this.updatingSidebarConfirmPage.addChild(this.warningMessage) + // this.warningMessage = new SoopyMarkdownElement().setLocation(0.1, 0.2, 0.8, 0.8) + // this.warningMessage.setText(``) + // this.updatingSidebarConfirmPage.addChild(this.warningMessage) - // this.updateButton = new ButtonWithArrow().setText("§0Update").setLocation(0.3, 0.3+this.warningMessage.getHeight(), 0.4, 0.2) - // this.updatingSidebarConfirmPage.addChild(this.updateButton) + this.updateButton = new ButtonWithArrow().setText("§0Update").setLocation(0.3, 0.3, 0.4, 0.2) + this.updatingSidebarConfirmPage.addChild(this.updateButton) - // this.updatingSidebarConfirmPage.setScrollable(true) + this.updatingSidebarConfirmPage.setScrollable(true) - // this.updateButton.addEvent(new SoopyRenderEvent().setHandler(()=>{ - // this.updateButton.location.location.y.set(0.3+this.warningMessage.getHeight(),0) - // })) - // this.updateButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ - // this.downloadUpdate() - // })) + this.updateButton.addEvent(new SoopyRenderEvent().setHandler(() => { + this.updateButton.location.location.y.set(0.3, 0) + })) + this.updateButton.addEvent(new SoopyMouseClickEvent().setHandler(() => { + this.downloadUpdate() + })) - // this.updatingSidebarLoadingPage = new SoopyGuiElement().setLocation(1,0,1,1) - // this.updatingSidebar.addChild(this.updatingSidebarLoadingPage) + this.updatingSidebarLoadingPage = new SoopyGuiElement().setLocation(1, 0, 1, 1) + this.updatingSidebar.addChild(this.updatingSidebarLoadingPage) - // let updatingTitle = new SoopyTextElement().setText("§0Updating...").setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1) - // this.updatingSidebarLoadingPage.addChild(updatingTitle) + let updatingTitle = new SoopyTextElement().setText("§0Updating...").setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1) + this.updatingSidebarLoadingPage.addChild(updatingTitle) - // this.progressBar = new ProgressBar().setLocation(0.1, 0.2, 0.8, 0.1) - // this.updatingSidebarLoadingPage.addChild(this.progressBar) + this.progressBar = new ProgressBar().setLocation(0.1, 0.2, 0.8, 0.1) + this.updatingSidebarLoadingPage.addChild(this.progressBar) this.currVersionId = metadata.versionId @@ -125,113 +126,113 @@ class ChangelogPage extends GuiPage { this.loadChangeLog() } - loadChangeLog(){ - fetch("http://soopymc.my.to/api/soopyv2/changelog.json").json(data=>{ + loadChangeLog() { + fetch("http://soopymc.my.to/api/soopyv2/changelog.json").json(data => { this.changelogData = data.changelog.reverse() this.downloadableVersion = data.downloadableVersion - + this.updateText() }) } - onOpen(){ + onOpen() { this.loadChangeLog() } - // showConfirmUpdatePage(){ - // let version = "" - // this.changelogData.forEach(data=>{ + showConfirmUpdatePage() { + let version = "" + this.changelogData.forEach(data => { - // if(this.downloadableVersion === data.versionId && this.downloadableVersion > this.currVersionId){ - // //add button to download this version - // version = data.version - // } - // }) - // this.updateTitle.setText("§0Update to SoopyAddons " + version) + if (this.downloadableVersion === data.versionId && this.downloadableVersion > this.currVersionId) { + //add button to download this version + version = data.version + } + }) + this.updateTitle.setText("§0Update to SoopyV2 " + version) - // this.updateButton.location.location.y.set(0.3+this.warningMessage.getHeight(),0) + this.updateButton.location.location.y.set(0.3 + this.warningMessage.getHeight(), 0) - // this.openSidebarPage(this.updatingSidebar) - // } + this.openSidebarPage(this.updatingSidebar) + } - // downloadUpdate(){ - // new Thread(()=>{ - // this.updatingSidebarConfirmPage.location.location.x.set(-1,500) - // this.updatingSidebarLoadingPage.location.location.x.set(0,500) + downloadUpdate() { + new Thread(() => { + this.updatingSidebarConfirmPage.location.location.x.set(-1, 500) + this.updatingSidebarLoadingPage.location.location.x.set(0, 500) - // new File("./config/ChatTriggers/modules/SoopyAddonsTempDownload").mkdir() + new File("./config/ChatTriggers/modules/SoopyAddonsTempDownload").mkdir() - // this.progressBar.setProgress(0.1) + this.progressBar.setProgress(0.1) - // this.urlToFile("http://soopymc.my.to/api/soopyv2/downloadLatest.zip", "./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons.zip", 10000, 20000) + this.urlToFile("http://soopymc.my.to/api/soopyv2/downloadLatest.zip", "./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons.zip", 10000, 20000) - // this.progressBar.setProgress(0.5) + this.progressBar.setProgress(0.5) - // FileLib.unzip("./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons.zip", "./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons/") + FileLib.unzip("./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons.zip", "./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons/") - // this.progressBar.setProgress(0.75) + this.progressBar.setProgress(0.75) - // FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/SoopyV2")) + FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/SoopyV2")) - // this.progressBar.setProgress(0.9) + this.progressBar.setProgress(0.9) - // new File("./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons/SoopyV2").renameTo(new File("./config/ChatTriggers/modules/SoopyV2")) + new File("./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons/SoopyV2").renameTo(new File("./config/ChatTriggers/modules/SoopyV2")) - // FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/SoopyAddonsTempDownload")) + FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/SoopyAddonsTempDownload")) - // this.progressBar.setProgress(1) + this.progressBar.setProgress(1) - // Client.currentGui.close() + Client.currentGui.close() - // ChatLib.command("ct load", true) - // }).start() - // } + ChatLib.command("ct load", true) + }).start() + } - // urlToFile(url, destination, connecttimeout, readtimeout) { - // const d = new File(destination); - // d.getParentFile().mkdirs(); - // const connection = new URL(url).openConnection(); - // connection.setDoOutput(true); - // connection.setConnectTimeout(connecttimeout); - // connection.setReadTimeout(readtimeout); - // const IS = connection.getInputStream(); - // const FilePS = new PrintStream(destination); - // let buf = new Packages.java.lang.reflect.Array.newInstance(Byte.TYPE, 65536); - // let len; - // while ((len = IS.read(buf)) > 0) { - // FilePS.write(buf, 0, len); - // } - // IS.close(); - // FilePS.close(); - // } + urlToFile(url, destination, connecttimeout, readtimeout) { + const d = new File(destination); + d.getParentFile().mkdirs(); + const connection = new URL(url).openConnection(); + connection.setDoOutput(true); + connection.setConnectTimeout(connecttimeout); + connection.setReadTimeout(readtimeout); + const IS = connection.getInputStream(); + const FilePS = new PrintStream(destination); + let buf = new Packages.java.lang.reflect.Array.newInstance(Byte.TYPE, 65536); + let len; + while ((len = IS.read(buf)) > 0) { + FilePS.write(buf, 0, len); + } + IS.close(); + FilePS.close(); + } - updateText(){ + updateText() { this.changelogArea.children = [] let height = 0 - this.changelogData.forEach(data=>{ + this.changelogData.forEach(data => { - // if(this.downloadableVersion === data.versionId && this.downloadableVersion > this.currVersionId){ - // //add button to download this version - // let button = new ButtonWithArrow().setText("§0Download this version").setLocation(0.7, height, 0.3, 0.1) - // this.changelogArea.addChild(button) + if (this.downloadableVersion === data.versionId && this.downloadableVersion > this.currVersionId) { + //add button to download this version + let button = new ButtonWithArrow().setText("§0Download this version").setLocation(0.7, height, 0.3, 0.1) + this.changelogArea.addChild(button) - // button.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ - // this.showConfirmUpdatePage() - // })) + button.addEvent(new SoopyMouseClickEvent().setHandler(() => { + this.showConfirmUpdatePage() + })) - // height += 0.05 - // } + height += 0.05 + } - let changes = new SoopyMarkdownElement().setLocation(0,height, 1, 0) + let changes = new SoopyMarkdownElement().setLocation(0, height, 1, 0) this.changelogArea.addChild(changes) - changes.setText("# __" + data.version + "__" + (data.versionId === this.currVersionId?" §7Current" : "") + "\n" + data.description) + changes.setText("# __" + data.version + "__" + (data.versionId === this.currVersionId ? " §7Current" : "") + "\n" + data.description) height += changes.getHeight() diff --git a/features/dataLoader/index.js b/features/dataLoader/index.js index fe11e42..21bfe76 100644 --- a/features/dataLoader/index.js +++ b/features/dataLoader/index.js @@ -1,6 +1,7 @@ /// /// import Feature from "../../featureClass/class"; +import socketConnection from "../../socketConnection"; import { fetch } from "../../utils/networkUtils"; class DataLoader extends Feature { @@ -8,7 +9,7 @@ class DataLoader extends Feature { super() } - onEnable(){ + onEnable() { this.initVariables() this.stats = {} @@ -26,6 +27,9 @@ class DataLoader extends Feature { this.api_loaded_event = this.createCustomEvent("apiLoad") + this.lastServer = undefined + this.lastSentServer = 0 + this.loadedApiDatas = {} this.lastApiData = { @@ -40,44 +44,44 @@ class DataLoader extends Feature { this.loadApi() } - worldLoad(){ + worldLoad() { this.area = undefined this.areaFine = undefined this.worldLoaded = true } - loadApi(){ - fetch("http://soopymc.my.to/api/v2/player_skyblock/" + Player.getUUID().replace(/-/g, "")).json(data=>{ + loadApi() { + fetch("http://soopymc.my.to/api/v2/player_skyblock/" + Player.getUUID().replace(/-/g, "")).json(data => { - if(!data.success) return + if (!data.success) return this.api_loaded_event.trigger(data, "skyblock", true, true) this.lastApiData.skyblock = data }) } - loadApiData(type, soopyServer){ - if(this.FeatureManager.features["globalSettings"] === undefined || this.FeatureManager.features["globalSettings"].class.apiKeySetting === undefined){ + loadApiData(type, soopyServer) { + if (this.FeatureManager.features["globalSettings"] === undefined || this.FeatureManager.features["globalSettings"].class.apiKeySetting === undefined) { return } let key = this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue() - if(!key) return + if (!key) return - if(this.loadedApiDatas[type] !== undefined){ - if(Date.now()-this.loadedApiDatas[type] < 5000 && !this.worldLoaded) return + if (this.loadedApiDatas[type] !== undefined) { + if (Date.now() - this.loadedApiDatas[type] < 5000 && !this.worldLoaded) return } - this.worldLoaded =false + this.worldLoaded = false this.loadedApiDatas[type] = Date.now() - if(soopyServer){ + if (soopyServer) { + + } else { + if (type === "skyblock") { + fetch("https://api.hypixel.net/skyblock/profiles?key=" + key + "&uuid=" + Player.getUUID().replace(/-/g, "")).json(data => { + if (!data.success) return - }else{ - if(type === "skyblock"){ - fetch("https://api.hypixel.net/skyblock/profiles?key=" + key + "&uuid=" + Player.getUUID().replace(/-/g, "")).json(data=>{ - if(!data.success) return - this.api_loaded_event.trigger(data, "skyblock", false, true) this.lastApiData.skyblock_raw = data }) @@ -85,66 +89,80 @@ class DataLoader extends Feature { } } - step(){ //2fps + step() { //2fps + this.isInSkyblock = Scoreboard.getTitle()?.removeFormatting().includes("SKYBLOCK") + + if (!this.isInSkyblock) { + this.stats = {} + return + } + this.stats["Area"] = undefined this.stats["Dungeon"] = undefined - if(World.isLoaded() && TabList.getNames()){ - TabList.getNames().forEach(n=>{ + if (World.isLoaded() && TabList.getNames()) { + TabList.getNames().forEach(n => { n = ChatLib.removeFormatting(n) - if(n.includes(": ")){ - if(n.includes('Secrets Found')){ - if(n.includes('%')){ + if (n.includes(": ")) { + if (n.includes('Secrets Found')) { + if (n.includes('%')) { this.stats["Secrets Found%"] = n.split(": ")[1] - }else{ + } else { this.stats["Secrets Found"] = n.split(": ")[1] } - }else{ + } else { this.stats[n.split(": ")[0].trim()] = n.split(": ")[1].trim() } } }) } - if(this.stats["Dungeon"]){ + if (this.stats["Dungeon"]) { this.stats["Area"] = this.stats["Dungeon"] this.isInDungeon = true - }else{ + } else { this.isInDungeon = false } this.dungeonFloor = undefined this.slayerXpToSpawn = undefined - Scoreboard.getLines().forEach(line=>{ + Scoreboard.getLines().forEach(line => { let name = ChatLib.removeFormatting(line.getName()).replace(/[^A-z0-9 \:\(\)\.]/g, "") - if(this.isInDungeon){ - if(name.includes("The Catacombs (")){ + if (this.isInDungeon) { + if (name.includes("The Catacombs (")) { this.dungeonFloor = name.split("(")[1].split(")")[0].toUpperCase() } } - if(ChatLib.removeFormatting(line).startsWith(" ⏣ ")){ + if (ChatLib.removeFormatting(line).startsWith(" ⏣ ")) { this.areaFine = ChatLib.removeFormatting(line).split(" ⏣ ")[1].replace(/[^A-z0-9 \:\(\)\.\-]/g, "") } - if(name.startsWith("Purse: ")){ + if (name.startsWith("Purse: ")) { this.purse = parseInt(name.split("Purse: ")[1].split(" ")[0]) } - if(name.startsWith("Bits: ")){ + if (name.startsWith("Bits: ")) { this.bits = parseInt(name.split("Bits: ")[1].split(" ")[0]) } - if(name.startsWith("Cleared: ")){ - this.dungeonPercentCleared = parseInt(name.split(" ")[1])/100 + if (name.startsWith("Cleared: ")) { + this.dungeonPercentCleared = parseInt(name.split(" ")[1]) / 100 } - if(name.endsWith("Combat XP")){ + if (name.endsWith("Combat XP")) { this.slayerXpToSpawn = ChatLib.removeFormatting(name).split("(")[1].split(")")[0].split("/").map(parseInt) } }) - this.isInSkyblock = Scoreboard.getTitle()?.removeFormatting().includes("SKYBLOCK") this.area = this.stats["Area"] + + + if (this.lastServer !== this.FeatureManager.features["dataLoader"].class.stats.Server || Date.now() - this.lastSentServer > 60000 * 5) { + this.lastServer = this.FeatureManager.features["dataLoader"].class.stats.Server; + this.lastSentServer = Date.now() + + socketConnection.setServer(this.FeatureManager.features["dataLoader"].class.stats.Server); + } } - initVariables(){ + initVariables() { this.stats = undefined this.isInDungeon = false @@ -157,7 +175,7 @@ class DataLoader extends Feature { this.isInSkyblock = undefined } - onDisable(){ + onDisable() { this.initVariables() } } diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js index f9e0026..a0353e3 100644 --- a/features/dungeonSolvers/index.js +++ b/features/dungeonSolvers/index.js @@ -167,12 +167,12 @@ class DungeonSolvers extends Feature { 7: 360, }; - this.registerStep(true, 2, this.step).registeredWhen(() => this.isInDungeon()); - this.registerStep(true, 10, this.step2).registeredWhen(() => this.isInDungeon()); + 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).registeredWhen(() => this.isInDungeon()); - this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.isInDungeon()); + this.registerEvent("renderOverlay", this.renderHud).registeredWhen(()=>this.isInDungeon()); + this.registerEvent("renderWorld", this.renderWorld).registeredWhen(()=>this.isInDungeon()); this.bloodOpenedBonus = false; this.goneInBonus = false; @@ -200,7 +200,7 @@ class DungeonSolvers extends Feature { } } } - }).registeredWhen(() => this.isInDungeon()) + }).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 => { @@ -242,7 +242,7 @@ class DungeonSolvers extends Feature { } }); - this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(() => this.isInDungeon()); + this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(()=>this.isInDungeon()); // this.registerEvent("renderEntity", this.renderEntity) this.renderEntityEvent = undefined; diff --git a/features/events/index.js b/features/events/index.js index 51081fd..eb29128 100644 --- a/features/events/index.js +++ b/features/events/index.js @@ -32,6 +32,8 @@ class Events extends Feature { this.showBurrialGuess = new ToggleSetting("Estimate burrial location from ability", "Will show a line + box where it thinks the burrial is", true, "burrial_guess", this) new SettingBase("NOTE: You must have music disabled for burrial guessess to work", "/togglemusic", false, "burrial_guess_into", this).requires(this.showBurrialGuess) + this.otherInquisWaypoints = new ToggleSetting("Show other users inquis locations", "May be usefull for loot share", true, "inquis_location_other", this) + this.shinyBlocks = [] this.lastDing = 0 @@ -44,6 +46,8 @@ class Events extends Feature { this.guessPoint2 = undefined this.dingIndex = 0 + this.slayerLocationDataH = {} + this.shinyBlockOverlayEnabled = new ToggleSetting("Shiny blocks highlight", "Will highlight shiny blocks in the end", false, "shiny_blocks_overlay", this) this.registerEvent("worldLoad", this.worldLoad) @@ -56,6 +60,21 @@ class Events extends Feature { 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) + this.inquisWaypointSpawned = false + this.registerChat("${a}You dug out a ${thing}!", (a, thing) => { + if (a.includes(":") || a.length === 0 || a.length > 50) return + if (!thing.toLowerCase().includes("inquis")) return + this.inquisWaypointSpawned = true + socketConnection.sendInquisData({ loc: [Math.round(Player.getX()), Math.round(Player.getY()), Math.round(Player.getZ())] }); + }) + } + + inquisData(loc, user) { + if (!loc) { + delete this.slayerLocationDataH[user] + return + } + this.slayerLocationDataH[user] = [loc, Date.now()] } renderWorld(ticks) { @@ -64,8 +83,8 @@ class Events extends Feature { }) if (this.showingWaypoints) { if (this.guessPoint && this.showBurrialGuess.getValue()) { - drawCoolWaypoint(this.guessPoint[0] - 0.5, this.guessPoint[1] - 0.5, this.guessPoint[2] - 0.5, 0, 255, 0, { name: "Guess" }) - drawLine(this.guessPoint1[0], this.guessPoint1[1], this.guessPoint1[2], this.guessPoint2[0], this.guessPoint2[1], this.guessPoint2[2], 0, 255, 0) + drawCoolWaypoint(this.guessPoint[0] - 0.5, this.guessPoint[1] - 0.5, this.guessPoint[2] - 0.5, 255, 255, 0, { name: "§eGuess" }) + drawLine(this.guessPoint1[0], this.guessPoint1[1], this.guessPoint1[2], this.guessPoint2[0], this.guessPoint2[1], this.guessPoint2[2], 255, 255, 0) } this.burrialData.locations.forEach((loc, i) => { @@ -94,6 +113,12 @@ class Events extends Feature { } }) } + + if (this.otherInquisWaypoints.getValue()) { + Object.keys(this.slayerLocationDataH).forEach(key => { + drawCoolWaypoint(this.slayerLocationDataH[key][0][0], this.slayerLocationDataH[key][0][1], this.slayerLocationDataH[key][0][2], 255, 0, 0, { name: key + "'s inquis" }) + }) + } } sortBurrialLocations() { @@ -152,6 +177,13 @@ class Events extends Feature { if (this.showingWaypoints) Client.showTitle("&cGo!", "", 0, 20, 20) } + + + Object.keys(this.slayerLocationDataH).forEach(n => { + if (this.slayerLocationDataH[n][1] + 60000 * 3 < Date.now()) { + delete this.slayerLocationDataH[n] + } + }) } step_5s() { @@ -340,6 +372,9 @@ class Events extends Feature { } burrialClicked() { + if (this.inquisWaypointSpawned) { + socketConnection.sendInquisData({ loc: null }); + } if (!this.showingWaypoints) return let nearestBurriali = undefined diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 9c0ee12..09a85a9 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -38,9 +38,6 @@ class Hud extends Feature { this.fixNeuNetworth = new ToggleSetting("Change networth in NEU pv to soopynw", "This should make it a lot more accurate", true, "neu_nw_override", this) - // this.notifyNewVersion = new ToggleSetting("Notify when there is a new update", "Will notify you when there is a new version of soopyv2 avalible for download", false, "notify_update", this) - - this.reportErrorsSetting = new ToggleSetting("Send module errors to soopy server", "This will allow me to more effectivly fix them", false, "privacy_send_errors", this) this.privacySettings = [this.reportErrorsSetting] diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js index 3d09319..46c660d 100644 --- a/features/hud/HudTextElement.js +++ b/features/hud/HudTextElement.js @@ -114,7 +114,7 @@ class HudTextElement { renderRaw() { let text = this.getText() - text.forEach((line, i) => { + for (let i = 0, line = text[0]; i < text.length; i++, line = text[i]) { Renderer.scale(this.locationSetting.scale, this.locationSetting.scale) switch (this.locationSetting.shadowType) { case 0: @@ -133,7 +133,7 @@ class HudTextElement { Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i) break; } - }) + } } } diff --git a/features/nether/metadata.json b/features/nether/metadata.json index 687abd6..2a7c145 100644 --- a/features/nether/metadata.json +++ b/features/nether/metadata.json @@ -1,6 +1,6 @@ { "name": "Nether", - "description": "", + "description": "uga booga nether", "isHidden": false, "isTogglable": true, "defaultEnabled": true, diff --git a/features/slayers/index.js b/features/slayers/index.js index 6ebeb3b..20734e4 100644 --- a/features/slayers/index.js +++ b/features/slayers/index.js @@ -82,7 +82,7 @@ class Slayers extends Feature { }); this.registerChat("&r &r&c&lSLAYER QUEST FAILED!&r", () => { - socketConnection.sendSlayerSpawnData({ loc: null, lobby: this.FeatureManager.features["dataLoader"].class.stats.Server }); + socketConnection.sendSlayerSpawnData({ loc: null }); }) this.bossSlainMessage = false; @@ -111,8 +111,6 @@ class Slayers extends Feature { this.emanStartedSittingTime = -1 this.pillerE = undefined this.lastPillerDink = 0 - this.lastServer = undefined - this.lastSentServer = 0 this.slayerLocationDataH = {} this.hasQuest = false @@ -128,7 +126,6 @@ class Slayers extends Feature { } slayerLocationData(loc, user) { - console.log(user + " : " + JSON.stringify(loc)) if (!loc) { delete this.slayerLocationDataH[user] return @@ -205,7 +202,7 @@ class Slayers extends Feature { drawBoxAtBlock(x - 0.5, y + 0.7, z - 0.5, 255, 0, 0); }); - if (this.otherSlayerWaypoints) { + if (this.otherSlayerWaypoints.getValue()) { Object.keys(this.slayerLocationDataH).forEach(key => { drawCoolWaypoint(this.slayerLocationDataH[key][0][0], this.slayerLocationDataH[key][0][1], this.slayerLocationDataH[key][0][2], 255, 0, 0, { name: key + "'s boss" }) }) @@ -229,76 +226,6 @@ class Slayers extends Feature { } } - if (this.lastServer !== this.FeatureManager.features["dataLoader"].class.stats.Server || Date.now() - this.lastSentServer > 60000 * 5) { - this.lastServer = this.FeatureManager.features["dataLoader"].class.stats.Server; - this.lastSentServer = Date.now() - - socketConnection.setSlayerServer(this.FeatureManager.features["dataLoader"].class.stats.Server); - } - - 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 = { - I: 5, - II: 25, - III: 100, - IV: 500, - V: 1500, - }; - this.lastSlayerExp = slayerLevelToExp[levelString]; - let slayerStrToType = { - revenant: "zombie", - tarantula: "spider", - sven: "wolf", - voidgloom: "enderman", - inferno: "blaze" - } - this.lastSlayerType = slayerStrToType[slayerInfo.split(" ")[0].toLowerCase()]; - //slayerExp[lastSlayerType] += lastSlayerExp - } - if (line.getName().includes("Boss slain!")) { - if (!lastBossSlainMessage) { - socketConnection.sendSlayerSpawnData({ loc: null, lobby: this.FeatureManager.features["dataLoader"].class.stats.Server }); - } - this.bossSlainMessage = true; - } - - if (line.getName().includes("Slay the boss!")) { - if (!this.bossSpawnedMessage) { - socketConnection.sendSlayerSpawnData({ loc: [Math.round(Player.getX()), Math.round(Player.getY()), Math.round(Player.getZ())], lobby: this.FeatureManager.features["dataLoader"].class.stats.Server }); - } - if (!this.bossSpawnedMessage && !this.emanBoss) { - this.nextIsBoss = Date.now(); - } - - dis1 = true; - this.bossSpawnedMessage = true; - } - let lineSplitThing = ChatLib.removeFormatting(line.getName()).replace(/[^a-z/0-9 ]/gi, "").trim().split(" ") - // ChatLib.chat(ChatLib.removeFormatting(line.getName()).replace(/[^a-z/0-9 ]+/gi, "").trim()) - - if (this.slayerProgressAlert.getValue() && lineSplitThing[0] - && lineSplitThing[0].split("/").length === 2 - && lineSplitThing[1] === "Kills") { - let kills = lineSplitThing[0].split("/").map(a => parseInt(a)) - if (kills[0] / kills[1] >= 0.9) { - this.dulkirThingElement.setText(line.getName()) - } - } - }); - if (!dis1) { - this.lastBossNotSpawnedTime = Date.now(); - this.bossSpawnedMessage = false; - } - this.todoE.forEach((e) => { try { if (e instanceof net.minecraft.entity.item.EntityArmorStand && e[m.getEquipmentInSlot](4)) { @@ -526,6 +453,70 @@ class Slayers extends Feature { delete this.slayerLocationDataH[n] } }) + + + 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 = { + I: 5, + II: 25, + III: 100, + IV: 500, + V: 1500, + }; + this.lastSlayerExp = slayerLevelToExp[levelString]; + let slayerStrToType = { + revenant: "zombie", + tarantula: "spider", + sven: "wolf", + voidgloom: "enderman", + inferno: "blaze" + } + this.lastSlayerType = slayerStrToType[slayerInfo.split(" ")[0].toLowerCase()]; + //slayerExp[lastSlayerType] += lastSlayerExp + } + if (line.getName().includes("Boss slain!")) { + if (!lastBossSlainMessage) { + socketConnection.sendSlayerSpawnData({ loc: null }); + } + this.bossSlainMessage = true; + } + + if (line.getName().includes("Slay the boss!")) { + if (!this.bossSpawnedMessage) { + socketConnection.sendSlayerSpawnData({ loc: [Math.round(Player.getX()), Math.round(Player.getY()), Math.round(Player.getZ())] }); + } + if (!this.bossSpawnedMessage && !this.emanBoss) { + this.nextIsBoss = Date.now(); + } + + dis1 = true; + this.bossSpawnedMessage = true; + } + let lineSplitThing = ChatLib.removeFormatting(line.getName()).replace(/[^a-z/0-9 ]/gi, "").trim().split(" ") + // ChatLib.chat(ChatLib.removeFormatting(line.getName()).replace(/[^a-z/0-9 ]+/gi, "").trim()) + + if (this.slayerProgressAlert.getValue() && lineSplitThing[0] + && lineSplitThing[0].split("/").length === 2 + && lineSplitThing[1] === "Kills") { + let kills = lineSplitThing[0].split("/").map(a => parseInt(a)) + if (kills[0] / kills[1] >= 0.9) { + this.dulkirThingElement.setText(line.getName()) + } + } + }); + if (!dis1) { + this.lastBossNotSpawnedTime = Date.now(); + this.bossSpawnedMessage = false; + } } initVariables() { diff --git a/index.js b/index.js index 90121e6..362b434 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ /// /// +const File = Java.type("java.io.File") class SoopyAddons { constructor() { this.FeatureManager = require("./featureClass/featureManager.js") @@ -11,7 +12,6 @@ class SoopyAddons { if (FileLib.read("soopyAddonsData", "deletesoopyv1please.txt") === "true") { new Thread(() => { Thread.sleep(2000) - const File = Java.type("java.io.File") FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/soopyAddons")) FileLib.write("soopyAddonsData", "deletesoopyv1please.txt", "false") @@ -25,7 +25,6 @@ if (FileLib.read("soopyAddonsData", "deletesoopyv1please.txt") === "true") { FileLib.write("soopyAddonsData", "firstload.txt", "true") Thread.sleep(2000) - ChatLib.command("ct reload", true) }).start() } else { @@ -35,4 +34,10 @@ if (FileLib.read("soopyAddonsData", "deletesoopyv1please.txt") === "true") { a.unregister() }) } +} +if (new File("./config/ChatTriggers/modules/SoopyV2UpdateButtonPatcher").exists()) { + new Thread(() => { + ChatLib.chat("&7Deleting SoopyV2UpdateButtonPatcher as its no longer needed") + FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/SoopyV2UpdateButtonPatcher")) + }).start() } \ No newline at end of file diff --git a/metadata.json b/metadata.json index 5683642..3858fa8 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.63", - "versionId": 190, + "version": "2.1.64", + "versionId": 191, "requires": [ "soopyApis", "soopyAddonsData", diff --git a/socketConnection.js b/socketConnection.js index 3c22d54..a55e834 100644 --- a/socketConnection.js +++ b/socketConnection.js @@ -45,6 +45,9 @@ class SoopyV2Server extends WebsiteCommunicator { if (data.type === "slayerSpawnData") { if (global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.slayers) global.soopyv2featuremanagerthing.features.slayers.class.slayerLocationData(data.location, data.user) } + if (data.type === "inquisData") { + if (global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.events) global.soopyv2featuremanagerthing.features.events.class.inquisData(data.location, data.user) + } } onConnect() { @@ -127,10 +130,23 @@ class SoopyV2Server extends WebsiteCommunicator { data: data }) } + sendInquisData(data) { + this.sendData({ + type: "inquisData", + data: data + }) + } + + sendVancData(data) { + this.sendData({ + type: "vancData", + data: data + }) + } - setSlayerServer(server) { + setServer(server) { this.sendData({ - type: "slayerServer", + type: "server", server: server }) } -- cgit