diff options
-rw-r--r-- | features/betterGuis/dungeonReadyGui.js | 319 | ||||
-rw-r--r-- | features/betterGuis/index.js | 140 |
2 files changed, 234 insertions, 225 deletions
diff --git a/features/betterGuis/dungeonReadyGui.js b/features/betterGuis/dungeonReadyGui.js index c0bf7e0..6af07a1 100644 --- a/features/betterGuis/dungeonReadyGui.js +++ b/features/betterGuis/dungeonReadyGui.js @@ -7,151 +7,171 @@ import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement" import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement" -const ContainerChest = Java.type("net.minecraft.inventory.ContainerChest") +const ContainerChest = Java.type("net.minecraft.inventory.ContainerChest"); class DungeonReadyGui { constructor() { - this.checkMenu = false + this.checkMenu = false; - this.soopyGui = new SoopyGui() + this.soopyGui = new SoopyGui(); - this.soopyGui.optimisedLocations = true + this.soopyGui.optimisedLocations = true; - this.mainPage = new SoopyGuiElement().setLocation(0, 0, 1, 1) - this.soopyGui.element.addChild(this.mainPage) - this.soopyGui.element.addEvent(new SoopyKeyPressEvent().setHandler((...args) => { + this.mainPage = new SoopyGuiElement().setLocation(0, 0, 1, 1); + this.soopyGui.element.addChild(this.mainPage); + this.soopyGui.element.addEvent(new SoopyKeyPressEvent().setHandler((...args) => this.keyPress(...args) - })) - - - this.startButton = new ButtonWithArrow().setText("§0Start Dungeon").setLocation(0.25, 0.25, 0.5, 0.5).addEvent(new SoopyMouseClickEvent().setHandler(() => { - this.startDungeon() - })) - this.soopyGui.element.addChild(this.startButton) - - this.startButton.desc = new SoopyTextElement().setMaxTextScale(2).setLocation(0.05, 0.6, 0.7, 0.4).setText("") - this.startButton.addChild(this.startButton.desc) - - this.closeMenu = 0 - this.nameToId = {} - this.nextId = 0 - this.currPlayers = 1 - this.readyBoxes = [] - this.confirmationCooldown = 0 + )); + + + this.startButton = new ButtonWithArrow() + .setText("§0Start Dungeon") + .setLocation(0.25, 0.25, 0.5, 0.5) + .addEvent(new SoopyMouseClickEvent().setHandler(() => + this.startDungeon() + )); + this.soopyGui.element.addChild(this.startButton); + + this.startButton.desc = new SoopyTextElement() + .setMaxTextScale(2) + .setLocation(0.05, 0.6, 0.7, 0.4) + .setText(""); + this.startButton.addChild(this.startButton.desc); + + this.closeMenu = 0; + this.nameToId = {}; + this.nextId = 0; + this.currPlayers = 1; + this.readyBoxes = []; + this.confirmationCooldown = 0; for (let i = 0; i < 4; i++) { - let readyBox = new BoxWithTextAndDescription().setText("§0").setDesc("§0").setLocation(0.1 + 0.2 * i, 0.75, 0.15, 0.15).setColor(255, 150, 150) - this.readyBoxes.push(readyBox) + let readyBox = new BoxWithTextAndDescription() + .setText("§0") + .setDesc("§0") + .setLocation(0.1 + 0.2 * i, 0.75, 0.15, 0.15) + .setColor(255, 150, 150); + this.readyBoxes.push(readyBox); - readyBox.text.setLocation(0, 0, 1, 0.6) - readyBox.description.setLocation(0.05, 0.6, 0.9, 0.4) - readyBox.visable = false + readyBox.text.setLocation(0, 0, 1, 0.6); + readyBox.description.setLocation(0.05, 0.6, 0.9, 0.4); + readyBox.visable = false; - this.mainPage.addChild(readyBox) + this.mainPage.addChild(readyBox); } - this.classBoxes = [] - this.currentPlayerClass = -1 - this.classes = { "Healer": new Item("minecraft:potion"), "Mage": new Item("minecraft:blaze_rod"), "Berserker": new Item("minecraft:iron_sword"), "Archer": new Item("minecraft:bow"), "Tank": new Item("minecraft:leather_chestplate") } + this.classBoxes = []; + this.currentPlayerClass = -1; + this.classes = { + "Healer": new Item("minecraft:potion"), + "Mage": new Item("minecraft:blaze_rod"), + "Berserker": new Item("minecraft:iron_sword"), + "Archer": new Item("minecraft:bow"), + "Tank": new Item("minecraft:leather_chestplate") + }; Object.keys(this.classes).forEach((clas, i) => { - let classBox = new BoxWithTextAndDescription().setText("§0" + clas + "&7 - 0").setDesc("§0").setLocation(0.1 + 0.1625 * i, 0.1, 0.15, 0.1) - this.classBoxes.push(classBox) - - let classIndex = i - - classBox.text.setLocation(0, 0, 1, 0.6) - classBox.description.setLocation(0.05, 0.6, 0.9, 0.4) - classBox.addEvent(new SoopyRenderEvent().setHandler(() => { - let scale = 16 / Math.min(classBox.location.getWidthExact(), classBox.location.getHeightExact() / 2) * 3 - this.classes[clas].draw(classBox.location.getXExact() + classBox.location.getWidthExact() / 2 - 16 * scale / 2, classBox.location.getYExact() + classBox.location.getHeightExact() - 16 * scale - 4, scale) - })).addEvent(new SoopyMouseClickEvent().setHandler(() => { - this.clickedClass(classIndex) - })) + let classBox = new BoxWithTextAndDescription() + .setText("§0" + clas + "&7 - 0") + .setDesc("§0") + .setLocation(0.1 + 0.1625 * i, 0.1, 0.15, 0.1); + this.classBoxes.push(classBox); + + let classIndex = i; + + classBox.text.setLocation(0, 0, 1, 0.6); + classBox.description.setLocation(0.05, 0.6, 0.9, 0.4); + classBox.addEvent(new SoopyRenderEvent() + .setHandler(() => { + let scale = 16 / Math.min(classBox.location.getWidthExact(), classBox.location.getHeightExact() / 2) * 3; + this.classes[clas].draw(classBox.location.getXExact() + classBox.location.getWidthExact() / 2 - 16 * scale / 2, classBox.location.getYExact() + classBox.location.getHeightExact() - 16 * scale - 4, scale); + })).addEvent(new SoopyMouseClickEvent().setHandler(() => + this.clickedClass(classIndex) + )); this.mainPage.addChild(classBox) }) - this.playerReadyButton = new ButtonWithArrow().setText("§0Ready").setLocation(0.33, 0.33, 0.33, 0.33).setColor(255, 150, 150).addEvent(new SoopyMouseClickEvent().setHandler(() => { - this.ready() - })) - this.mainPage.addChild(this.playerReadyButton) + this.playerReadyButton = new ButtonWithArrow() + .setText("§0Ready") + .setLocation(0.33, 0.33, 0.33, 0.33) + .setColor(255, 150, 150) + .addEvent(new SoopyMouseClickEvent() + .setHandler(() => this.ready())); + this.mainPage.addChild(this.playerReadyButton); } joinedDungeon(players) { - this.currPlayers = players + this.currPlayers = players; } startDungeon() { - if (Player.getContainer().getName() !== "Start Dungeon?") return + if (Player.getContainer().getName() !== "Start Dungeon?") return; if (!this.confirmationCooldown && World.getAllPlayers().filter(p => p.getPing() === 1).length !== this.currPlayers && !(World.getAllPlayers().filter(p => p.getPing() === 1).length === 1 && this.currPlayers === 2)) { - this.startButton.setText("§0Confirm starting Dungeon? (3s)") - this.startButton.desc.setText("§0(" + World.getAllPlayers().filter(p => p.getPing() === 1).length + "/" + this.currPlayers + " in dungeon)") - this.confirmationCooldown = Date.now() + 3000 - return + this.startButton.setText("§0Confirm starting Dungeon? (3s)"); + this.startButton.desc.setText("§0(" + World.getAllPlayers().filter(p => p.getPing() === 1).length + "/" + this.currPlayers + " in dungeon)"); + this.confirmationCooldown = Date.now() + 3000; + return; } - if (Date.now() < this.confirmationCooldown) return + if (Date.now() < this.confirmationCooldown) return; - this.startButton.visable = false - Player.getContainer().click(13, false, "MIDDLE") + this.startButton.visable = false; + Player.getContainer().click(13, false, "MIDDLE"); } ready() { - if (!Player.getContainer().getName().startsWith("Catacombs - Floor ")) return - this.playerReadyButton.setColor(150, 150, 150) + if (!Player.getContainer().getName().startsWith("Catacombs - Floor ")) return; + this.playerReadyButton.setColor(150, 150, 150); for (let i = 0; i < 5; i++) { - if (ChatLib.removeFormatting(Player.getContainer().getStackInSlot(3 + i).getName().split(" ").pop()) === Player.getName()) { - Player.getContainer().drop(12 + i, false) - } + if (ChatLib.removeFormatting(Player.getContainer().getStackInSlot(3 + i).getName().split(" ").pop()) === Player.getName()) + Player.getContainer().drop(12 + i, false); } } clickedClass(classIndex) { - if (!Player.getContainer().getName().startsWith("Catacombs - Floor ")) return + if (!Player.getContainer().getName().startsWith("Catacombs - Floor ")) return; - Player.getContainer().drop(2 + 4 * 9 + classIndex, false) + Player.getContainer().drop(2 + 4 * 9 + classIndex, false); - this.classBoxes[classIndex].setColor(150, 150, 150) + this.classBoxes[classIndex].setColor(150, 150, 150); - if (this.currentPlayerClass !== -1) this.classBoxes[this.currentPlayerClass].setColor(253, 255, 227) + if (this.currentPlayerClass !== -1) this.classBoxes[this.currentPlayerClass].setColor(253, 255, 227); } reset() { - this.startButton.visable = true - this.playerReadyButton.setColor(255, 150, 150) + this.startButton.visable = true; + this.playerReadyButton.setColor(255, 150, 150); - this.nameToId = {} - this.nextId = 0 - this.closeMenu = 0 + this.nameToId = {}; + this.nextId = 0; + this.closeMenu = 0; - this.startButton.setText("§0Start Dungeon") - this.startButton.desc.setText("") - this.confirmationCooldown = 0 + this.startButton.setText("§0Start Dungeon"); + this.startButton.desc.setText(""); + this.confirmationCooldown = 0; - this.readyBoxes.forEach(b => { - b.visable = false - }) + this.readyBoxes.forEach(b => b.visable = false); } readyInOneSecond() { - this.closeMenu = Date.now() + 1000 + this.closeMenu = Date.now() + 1000; } tick() { - if (!this.soopyGui.ctGui.isOpen()) return + if (!this.soopyGui.ctGui.isOpen()) return; if (this.closeMenu > 0 && Date.now() > this.closeMenu) { - this.soopyGui.close() - Client.currentGui.close() - this.closeMenu = 0 - return + this.soopyGui.close(); + Client.currentGui.close(); + this.closeMenu = 0; + return; } if (Player.getContainer().getName().startsWith("Catacombs - Floor ")) { - this.startButton.visable = false + this.startButton.visable = false; - let clickingClassButton = -1 + let clickingClassButton = -1; for (let i = 0; i < 5; i++) { //ready up buttons @@ -159,111 +179,104 @@ class DungeonReadyGui { if (ChatLib.removeFormatting(Player.getContainer().getStackInSlot(3 + i).getName().split(" ").pop()) === Player.getName()) { if (Player.getContainer().getStackInSlot(12 + i)) { if (ChatLib.removeFormatting(Player.getContainer().getStackInSlot(12 + i).getName()) === "Ready") { - this.playerReadyButton.setColor(150, 255, 150) + this.playerReadyButton.setColor(150, 255, 150); } else { - this.playerReadyButton.setColor(255, 150, 150) + this.playerReadyButton.setColor(255, 150, 150); } } else { - this.playerReadyButton.setColor(150, 150, 150) + this.playerReadyButton.setColor(150, 150, 150); } } else { - let boxId = this.nameToId[ChatLib.removeFormatting(Player.getContainer().getStackInSlot(3 + i).getName().split(" ").pop())] - - if (boxId) { - if (ChatLib.removeFormatting(Player.getContainer().getStackInSlot(12 + i).getName()) === "Ready") { - this.readyBoxes[boxId].setColor(150, 255, 150) - } else { - this.readyBoxes[boxId].setColor(255, 150, 150) - } - this.readyBoxes[boxId].setLore(Player.getContainer().getStackInSlot(3 + i).getLore()) - this.readyBoxes[boxId].setDesc("§0" + ChatLib.removeFormatting(Player.getContainer().getStackInSlot(3 + i).getLore()[2])) + let boxId = this.nameToId[ChatLib.removeFormatting(Player.getContainer().getStackInSlot(3 + i).getName().split(" ").pop())]; + + if (boxId) { + this.readyBoxes[boxId].setColor(255, 150, 150); + if (ChatLib.removeFormatting(Player.getContainer().getStackInSlot(12 + i).getName()) === "Ready") + this.readyBoxes[boxId].setColor(150, 255, 150); + + this.readyBoxes[boxId].setLore(Player.getContainer().getStackInSlot(3 + i).getLore()); + this.readyBoxes[boxId].setDesc("§0" + ChatLib.removeFormatting(Player.getContainer().getStackInSlot(3 + i).getLore()[2])); } } } //select class buttons - if (Player.getContainer().getStackInSlot(2 + 4 * 9 + i)) { - if (Player.getContainer().getStackInSlot(2 + 4 * 9 + i).getDamage() === 10) { - this.classBoxes[i].setColor(250, 255, 150) - } else { - this.classBoxes[i].setColor(253, 255, 227) - } - this.classBoxes[i].setText("§0" + Object.keys(this.classes)[i] + "§7 - " + ChatLib.removeFormatting(Player.getContainer().getStackInSlot(2 + 4 * 9 + i).getName().split(" ")[0])).setLore(Player.getContainer().getStackInSlot(2 + 4 * 9 + i).getLore()) - - let isPlayerClass = false - Player.getContainer().getStackInSlot(2 + 4 * 9 + i).getLore().forEach(line => { - if (!ChatLib.removeFormatting(line).startsWith(" - ")) return - - if (ChatLib.removeFormatting(line.split(" ").pop()) === Player.getName()) { - isPlayerClass = true - } - }) + if (!Player.getContainer().getStackInSlot(2 + 4 * 9 + i)) clickingClassButton = i; + + this.classBoxes[i].setColor(253, 255, 227); + if (Player.getContainer().getStackInSlot(2 + 4 * 9 + i).getDamage() === 10) + this.classBoxes[i].setColor(250, 255, 150); + + this.classBoxes[i] + .setText("§0" + Object.keys(this.classes)[i] + "§7 - " + ChatLib.removeFormatting(Player.getContainer().getStackInSlot(2 + 4 * 9 + i).getName().split(" ")[0])) + .setLore(Player.getContainer().getStackInSlot(2 + 4 * 9 + i).getLore()); + + let isPlayerClass = false; + Player.getContainer().getStackInSlot(2 + 4 * 9 + i).getLore().forEach(line => { + if (!ChatLib.removeFormatting(line).startsWith(" - ")) return; + if (ChatLib.removeFormatting(line.split(" ").pop()) === Player.getName()) + isPlayerClass = true; + }) if (isPlayerClass) { - this.currentPlayerClass = i - this.classBoxes[i].setColor(150, 255, 150) + this.currentPlayerClass = i; + this.classBoxes[i].setColor(150, 255, 150); } - } else { - clickingClassButton = i - } } if (clickingClassButton !== -1) { - this.classBoxes[clickingClassButton].setColor(150, 150, 150) - if (this.currentPlayerClass !== -1) this.classBoxes[this.currentPlayerClass].setColor(253, 255, 227) + this.classBoxes[clickingClassButton].setColor(150, 150, 150); + if (this.currentPlayerClass !== -1) this.classBoxes[this.currentPlayerClass].setColor(253, 255, 227); } - } + }; if (this.confirmationCooldown) { - this.startButton.setText("§0Confirm starting Dungeon? (" + Math.ceil(Math.max(0, this.confirmationCooldown - Date.now()) / 1000) + "s)") - } + this.startButton.setText("§0Confirm starting Dungeon? (" + Math.ceil(Math.max(0, this.confirmationCooldown - Date.now()) / 1000) + "s)"); + }; World.getAllPlayers().filter(p => p.getPing() === 1).forEach(p => { - if (p.getUUID().toString() === Player.getUUID().toString()) return + if (p.getUUID().toString() === Player.getUUID().toString()) return; - if (p.getName() in this.nameToId) return + if (p.getName() in this.nameToId) return; - this.nameToId[p.getName()] = this.nextId++ + this.nameToId[p.getName()] = this.nextId++; - this.readyBoxes[this.nameToId[p.getName()]].setText("§0" + p.getName()).visable = true - }) + this.readyBoxes[this.nameToId[p.getName()]].setText("§0" + p.getName()).visable = true; + }); } guiOpened(event) { - let name = "" - if (event.gui && event.gui.field_147002_h instanceof ContainerChest) { - name = event.gui.field_147002_h.func_85151_d().func_145748_c_().func_150260_c() - } + let name = ""; + if (event.gui && event.gui.field_147002_h instanceof ContainerChest) + name = event.gui.field_147002_h.func_85151_d().func_145748_c_().func_150260_c(); + if (this.soopyGui.ctGui.isOpen()) { - if (event.gui && event.gui.field_147002_h) { - Player.getPlayer().field_71070_bA = event.gui.field_147002_h + if (!event.gui && !event.gui.field_147002_h) return; + Player.getPlayer().field_71070_bA = event.gui.field_147002_h - if (!Player.getContainer().getName().startsWith("Catacombs - Floor ")) { - return - } + if (!Player.getContainer().getName().startsWith("Catacombs - Floor ")) return; - event.gui = this.soopyGui.ctGui - this.soopyGui.ctGui.open() - } - return + event.gui = this.soopyGui.ctGui + this.soopyGui.ctGui.open(); } + if (name === "Start Dungeon?" || name.startsWith("Catacombs - Floor ")) { - if (event.gui && event.gui.field_147002_h) Player.getPlayer().field_71070_bA = event.gui.field_147002_h + if (event.gui && event.gui.field_147002_h) Player.getPlayer().field_71070_bA = event.gui.field_147002_h; - this.soopyGui.open() - event.gui = this.soopyGui.ctGui + this.soopyGui.open(); + event.gui = this.soopyGui.ctGui; } } keyPress(key, keyId) { - if (keyId === 1) { //escape key + if (keyId === 1) //escape key // this.dontOpen = 1 - Client.currentGui.close() - } - if (keyId === 18) { //'e' key - Client.currentGui.close() - } + Client.currentGui.close(); + + if (keyId === 18) //'e' key + Client.currentGui.close(); + } } diff --git a/features/betterGuis/index.js b/features/betterGuis/index.js index ff94c91..a2892d8 100644 --- a/features/betterGuis/index.js +++ b/features/betterGuis/index.js @@ -12,32 +12,32 @@ import SoopyNumber from "../../../guimanager/Classes/SoopyNumber"; class BetterGuis extends Feature { constructor() { - super() + super(); } inSkyblock() { - return this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.isInSkyblock + return this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.isInSkyblock; } onEnable() { - this.initVariables() + this.initVariables(); - this.museumGui = new MuseumGui() - this.dungeonReady = new DungeonReadyGui() + this.museumGui = new MuseumGui(); + this.dungeonReady = new DungeonReadyGui(); - this.replaceSbMenuClicks = new ToggleSetting("Improve Clicks on SBMENU", "This will change clicks to middle clicks, AND use commands where possible (eg /pets)", true, "sbmenu_clicks", this) + this.replaceSbMenuClicks = new ToggleSetting("Improve Clicks on SBMENU", "This will change clicks to middle clicks, AND use commands where possible (eg /pets)", true, "sbmenu_clicks", this); this.reliableSbMenuClicks = { getValue: () => false }//removed because hypixel fixed, code kept incase hypixel adds back bug later //new ToggleSetting("Make SBMENU clicks reliable", "This will delay clicks on sbmenu to time them so they dont get canceled", true, "sbmenu_time", this) - this.museumGuiEnabled = new ToggleSetting("Custom Museum GUI", "Custom gui for the Museum", true, "custom_museum_enabled", this) - this.dungeonReadyGuiEnabled = new ToggleSetting("Custom Dungeon Ready GUI", "Custom gui for the dungeon ready up menu", false, "custom_dungeon_ready_enabled", this) + this.museumGuiEnabled = new ToggleSetting("Custom Museum GUI", "Custom gui for the Museum", true, "custom_museum_enabled", this); + this.dungeonReadyGuiEnabled = new ToggleSetting("Custom Dungeon Ready GUI", "Custom gui for the dungeon ready up menu", false, "custom_dungeon_ready_enabled", this); - this.chestSearchBar = new ToggleSetting("Inventory Search Bar", "use '&' to make it filter by stuff that contains multiple things", false, "inv_search", this) - this.customBars = new ToggleSetting("Custom hp and mana bar", "Also hides stuff like armor bar", false, "custom_bars", this) + this.chestSearchBar = new ToggleSetting("Inventory Search Bar", "use '&' to make it filter by stuff that contains multiple things", false, "inv_search", this); + this.customBars = new ToggleSetting("Custom hp and mana bar", "Also hides stuff like armor bar", false, "custom_bars", this); - this.lastWindowId = 0 - this.shouldHold = 10 - this.clickSlot = -1 - this.clickSlotTime = 0 + this.lastWindowId = 0; + this.shouldHold = 10; + this.clickSlot = -1; + this.clickSlotTime = 0; this.middleClickGuis = [ "Your SkyBlock Profile", @@ -99,107 +99,103 @@ class BetterGuis extends Feature { "Mining", "Woods & Fishes", "Oddities" - ] + ]; this.middleClickEndsWith = [ "Recipe", "Recipes", ") Pets", "Collection", "Active Effects" - ] + ]; - this.registerChat("&r&aDungeon starts in 1 second.&r", () => { - this.dungeonReady.readyInOneSecond.call(this.dungeonReady) - }) - this.registerChat("&r&aDungeon starts in 1 second. Get ready!&r", () => { - this.dungeonReady.readyInOneSecond.call(this.dungeonReady) - }) - this.registerEvent("guiMouseClick", this.guiClicked) + this.registerChat("&r&aDungeon starts in 1 second.&r", () => + this.dungeonReady.readyInOneSecond.call(this.dungeonReady)); + this.registerChat("&r&aDungeon starts in 1 second. Get ready!&r", () => + this.dungeonReady.readyInOneSecond.call(this.dungeonReady)); + this.registerEvent("guiMouseClick", this.guiClicked); this.registerEvent("guiOpened", (event) => { - if (this.museumGuiEnabled.getValue()) this.museumGui.guiOpened.call(this.museumGui, event) - if (this.dungeonReadyGuiEnabled.getValue()) this.dungeonReady.guiOpened.call(this.dungeonReady, event) - }) - this.registerEvent("worldLoad", () => { - this.dungeonReady.reset() - }) + if (this.museumGuiEnabled.getValue()) this.museumGui.guiOpened.call(this.museumGui, event); + if (this.dungeonReadyGuiEnabled.getValue()) this.dungeonReady.guiOpened.call(this.dungeonReady, event); + }); + this.registerEvent("worldLoad", () => this.dungeonReady.reset()); this.registerChat("&e${*} &r&cThe Catacombs &r&ewith &r&9${players}/5 players &r&eon &r${*}&r", (players) => { - if (this.dungeonReadyGuiEnabled.getValue()) this.dungeonReady.joinedDungeon.call(this.dungeonReady, ~~players) + if (this.dungeonReadyGuiEnabled.getValue()) this.dungeonReady.joinedDungeon.call(this.dungeonReady, ~~players); }) this.registerChat("&eSkyBlock Dungeon Warp &r&7(${players} players)&r", (players) => { if (this.dungeonReadyGuiEnabled.getValue()) this.dungeonReady.joinedDungeon.call(this.dungeonReady, ~~players) }) this.registerStep(true, 10, this.step) - this.registerEvent("worldUnload", () => { this.museumGui.saveMuseumCache.call(this.museumGui) }) - this.registerStep(false, 30, () => { this.museumGui.saveMuseumCache.call(this.museumGui) }) + this.registerEvent("worldUnload", () => this.museumGui.saveMuseumCache.call(this.museumGui)); + this.registerStep(false, 30, () => this.museumGui.saveMuseumCache.call(this.museumGui)); - this.invSearchSoopyGui = new SoopyGui() - this.invSearchSoopyGui._renderBackground = () => { } + this.invSearchSoopyGui = new SoopyGui(); + this.invSearchSoopyGui._renderBackground = () => { }; - this.invSearchTextBox = new TextBox().setPlaceholder("Click to search").setLocation(0.4, 0.05, 0.2, 0.05) - this.invSearchSoopyGui.element.addChild(this.invSearchTextBox) + this.invSearchTextBox = new TextBox().setPlaceholder("Click to search").setLocation(0.4, 0.05, 0.2, 0.05); + this.invSearchSoopyGui.element.addChild(this.invSearchTextBox); - this.mana = new SoopyNumber(0) - this.overflowMana = new SoopyNumber(0) - this.maxMana = new SoopyNumber(0) - this.lastOverFlow = Date.now() + this.mana = new SoopyNumber(0); + this.overflowMana = new SoopyNumber(0); + this.maxMana = new SoopyNumber(0); + this.lastOverFlow = Date.now(); - this.slotMatches = new Map() - this.registerEvent("renderHealth", this.renderHealth).registeredWhen(() => this.inSkyblock() && this.customBars.getValue()) - this.registerEvent("renderFood", cancel).registeredWhen(() => this.inSkyblock() && this.customBars.getValue()) - this.registerEvent("renderArmor", this.renderMana).registeredWhen(() => this.inSkyblock() && this.customBars.getValue()) - let registerActionBar = this.registerCustom("actionbar", this.actionbarMana) + this.slotMatches = new Map(); + this.registerEvent("renderHealth", this.renderHealth).registeredWhen(() => this.inSkyblock() && this.customBars.getValue()); + this.registerEvent("renderFood", cancel).registeredWhen(() => this.inSkyblock() && this.customBars.getValue()); + this.registerEvent("renderArmor", this.renderMana).registeredWhen(() => this.inSkyblock() && this.customBars.getValue()); + let registerActionBar = this.registerCustom("actionbar", this.actionbarMana); registerActionBar.trigger.setCriteria('&b${curr}/${max}✎').setParameter('contains'); - let registerActionBar2 = this.registerCustom("actionbar", this.actionbarOverflowMana) + let registerActionBar2 = this.registerCustom("actionbar", this.actionbarOverflowMana); registerActionBar2.trigger.setCriteria('&3${curr}ʬ').setParameter('contains'); //&c2532/2532❤ &a798&a❈ Defense &b2525/2525✎ &31ʬ&r (100) //&c2532/2532❤ &f20&f❂ True Defense &b2414/2414✎ &3600ʬ&r (13) //&c2665/2665❤ &a972&a❈ Defense &b2145/2145✎ &3600ʬ&r //&c2,806/2,806❤ &a1,050&a❈ Defense &b1,945/1,945✎ &3600ʬ&r - this.registerEvent("guiRender", this.postGuiRender).registeredWhen(() => this.chestSearchBar.getValue()) - this.registerEvent("guiMouseClick", this.guiMouseClick).registeredWhen(() => this.chestSearchBar.getValue()) - this.registerEvent("guiKey", this.guiKey).registeredWhen(() => this.chestSearchBar.getValue()) - this.registerEvent("renderSlot", this.renderSlot).registeredWhen(() => this.chestSearchBar.getValue()) - this.registerEvent("guiOpened", this.guiOpened).registeredWhen(() => this.chestSearchBar.getValue()) + this.registerEvent("guiRender", this.postGuiRender).registeredWhen(() => this.chestSearchBar.getValue()); + this.registerEvent("guiMouseClick", this.guiMouseClick).registeredWhen(() => this.chestSearchBar.getValue()); + this.registerEvent("guiKey", this.guiKey).registeredWhen(() => this.chestSearchBar.getValue()); + this.registerEvent("renderSlot", this.renderSlot).registeredWhen(() => this.chestSearchBar.getValue()); + this.registerEvent("guiOpened", this.guiOpened).registeredWhen(() => this.chestSearchBar.getValue()); } actionbarMana(curr, max) { - if (curr.includes("Mana")) { - curr = curr.split("&b").pop() - } - this.mana.set(parseInt(curr.replace(/,/g, "")), 500) - this.maxMana.set(parseInt(max.replace(/,/g, "")), 500) - if (Date.now() - this.lastOverFlow > 1000) this.overflowMana.set(0, 500) + if (curr.includes("Mana")) + curr = curr.split("&b").pop(); + + this.mana.set(parseInt(curr.replace(/,/g, "")), 500); + this.maxMana.set(parseInt(max.replace(/,/g, "")), 500); + if (Date.now() - this.lastOverFlow > 1000) this.overflowMana.set(0, 500); } actionbarOverflowMana(curr) { - this.overflowMana.set(parseInt(curr.replace(/,/g, "")), 500) - this.lastOverFlow = Date.now() + this.overflowMana.set(parseInt(curr.replace(/,/g, "")), 500); + this.lastOverFlow = Date.now(); } renderMana(event) { - cancel(event) + cancel(event); let left = Renderer.screen.getWidth() / 2 + 91 - 80; let top = Renderer.screen.getHeight() - 40; - Renderer.retainTransforms(true) - Renderer.translate(left, top) + Renderer.retainTransforms(true); + Renderer.translate(left, top); - let totalAmt = Math.max(this.maxMana.get(), this.mana.get() + this.overflowMana.get()) + let totalAmt = Math.max(this.maxMana.get(), this.mana.get() + this.overflowMana.get()); - let manaPercent = this.mana.get() / totalAmt - let ofPercent = this.overflowMana.get() / totalAmt + let manaPercent = this.mana.get() / totalAmt; + let ofPercent = this.overflowMana.get() / totalAmt; - Renderer.drawRect(Renderer.color(0, 0, 0), 0, 0, 80, 10) - Renderer.drawRect(Renderer.color(50, 50, 50), 2, 2, 76, 6) - Renderer.drawRect(Renderer.color(0, 0, 255), 2, 2, manaPercent * 76, 6) - Renderer.drawRect(Renderer.color(0, 255, 255), 2 + manaPercent * 76, 2, ofPercent * 76, 6) - Renderer.retainTransforms(false) + Renderer.drawRect(Renderer.color(0, 0, 0), 0, 0, 80, 10); + Renderer.drawRect(Renderer.color(50, 50, 50), 2, 2, 76, 6); + Renderer.drawRect(Renderer.color(0, 0, 255), 2, 2, manaPercent * 76, 6); + Renderer.drawRect(Renderer.color(0, 255, 255), 2 + manaPercent * 76, 2, ofPercent * 76, 6); + Renderer.retainTransforms(false); } renderHealth(event) { - cancel(event) + cancel(event); let left = Renderer.screen.getWidth() / 2 - 91; let top = Renderer.screen.getHeight() - 40; @@ -240,7 +236,7 @@ class BetterGuis extends Feature { } } guiOpened() { - this.slotMatches.clear() + this.slotMatches.clear(); } renderSlot(slot, gui, event) { |