From 082d9cf4af63495a3d8709b0ee87dc935ed986dc Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Mon, 18 Apr 2022 00:25:15 +0800 Subject: Many changes --- features/betterGuis/dungeonReadyGui.js | 4 +- features/betterGuis/index.js | 20 +- features/betterGuis/museumGui.js | 166 ++--- features/dataLoader/index.js | 15 +- features/dungeonMap/index.js | 12 +- features/dungeonSolvers/index.js | 1185 +++++++++++++++++------------- features/globalSettings/firstLoadPage.js | 2 + features/globalSettings/index.js | 5 +- features/hud/HudTextElement.js | 125 ++-- features/hud/index.js | 365 +++++---- features/lockedFeatures/index.js | 2 +- 11 files changed, 1051 insertions(+), 850 deletions(-) (limited to 'features') diff --git a/features/betterGuis/dungeonReadyGui.js b/features/betterGuis/dungeonReadyGui.js index 2428f5b..956d4a6 100644 --- a/features/betterGuis/dungeonReadyGui.js +++ b/features/betterGuis/dungeonReadyGui.js @@ -25,7 +25,7 @@ class DungeonReadyGui { if(event.gui && event.gui.field_147002_h){ Player.getPlayer().field_71070_bA = event.gui.field_147002_h - if(!Player.getOpenedInventory().getName().startsWith("Catacombs - Floor ")){ + if(!Player.getContainer().getName().startsWith("Catacombs - Floor ")){ return } @@ -34,7 +34,7 @@ class DungeonReadyGui { } return } - if(name === "Start Dungeon"){ + 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 this.soopyGui.open() diff --git a/features/betterGuis/index.js b/features/betterGuis/index.js index 23a7efa..1e9c144 100644 --- a/features/betterGuis/index.js +++ b/features/betterGuis/index.js @@ -118,7 +118,7 @@ class BetterGuis extends Feature { // logger.logMessage(hoveredSlotId, 4) - if(this.guiSlotClicked(ChatLib.removeFormatting(Player.getOpenedInventory().getName()), hoveredSlotId)){ + if(this.guiSlotClicked(ChatLib.removeFormatting(Player.getContainer().getName()), hoveredSlotId)){ cancel(event) } } @@ -129,19 +129,19 @@ class BetterGuis extends Feature { // if(this.dungeonReadyGuiEnabled.getValue()) this.dungeonReady.tick.call(this.dungeonReady) if(this.replaceSbMenuClicks.getValue()){ - if(Player.getOpenedInventory() && Player.getOpenedInventory().getName()==="SkyBlock Menu"){ + if(Player.getContainer() && Player.getContainer().getName()==="SkyBlock Menu"){ if(this.lastWindowId === 0){ - this.lastWindowId = Player.getOpenedInventory().getWindowId() + this.lastWindowId = Player.getContainer().getWindowId() return; } - if(Player.getOpenedInventory().getWindowId()!==this.lastWindowId){ - this.lastWindowId = Player.getOpenedInventory().getWindowId() + if(Player.getContainer().getWindowId()!==this.lastWindowId){ + this.lastWindowId = Player.getContainer().getWindowId() this.shouldHold+= 10 if(Date.now()-this.clickSlotTime >1000){ this.clickSlot = -1 } if(this.clickSlot && this.clickSlot != -1){ - Player.getOpenedInventory().click(this.clickSlot, false, "MIDDLE") + Player.getContainer().click(this.clickSlot, false, "MIDDLE") this.clickSlot = -1 } }else{ @@ -169,7 +169,7 @@ class BetterGuis extends Feature { this.clickSlot = slotId this.clickSlotTime = Date.now() }else{ - Player.getOpenedInventory().click(slotId, false, "MIDDLE") + Player.getContainer().click(slotId, false, "MIDDLE") } break; } @@ -177,18 +177,18 @@ class BetterGuis extends Feature { break default: if(this.middleClickGuis.includes(inventoryName)){ - Player.getOpenedInventory().click(slotId, false, "MIDDLE") + Player.getContainer().click(slotId, false, "MIDDLE") return true } for(let thing of this.middleClickStartsWith){ if(inventoryName.startsWith(thing)){ - Player.getOpenedInventory().click(slotId, false, "MIDDLE") + Player.getContainer().click(slotId, false, "MIDDLE") return true } } for(let thing of this.middleClickEndsWith){ if(inventoryName.endsWith(thing)){ - Player.getOpenedInventory().click(slotId, false, "MIDDLE") + Player.getContainer().click(slotId, false, "MIDDLE") return true } } diff --git a/features/betterGuis/museumGui.js b/features/betterGuis/museumGui.js index 7015e5f..0f7a3e9 100644 --- a/features/betterGuis/museumGui.js +++ b/features/betterGuis/museumGui.js @@ -46,7 +46,7 @@ class MuseumGui { this.weaponsIndicator = new SoopyBoxElement().setLocation(leftOffset, 0.05, widthPer*4/5, 0.15) this.weaponsIndicator.addEvent(new SoopyRenderEvent().setHandler(()=>{ - if(this.weaponsIndicator.hovered && ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()) !== "Weapons"){ + if(this.weaponsIndicator.hovered && ChatLib.removeFormatting(Player.getContainer().getStackInSlot(4).getName()) !== "Weapons"){ this.weaponText.location.location.x.set(0.05, 500) this.weaponText.location.size.x.set(0.9, 500) this.weaponText.location.location.y.set(0.025, 500) @@ -56,7 +56,7 @@ class MuseumGui { Renderer.translate(0,0,100) Renderer.drawRect(Renderer.color(0,0,0,100), this.weaponsIndicator.location.getXExact(), this.weaponsIndicator.location.getYExact(), this.weaponsIndicator.location.getWidthExact(), this.weaponsIndicator.location.getHeightExact()) - let clicks = Player.getOpenedInventory().getName() === "Your Museum"?"1":"2" + let clicks = Player.getContainer().getName() === "Your Museum"?"1":"2" Renderer.translate(0,0,100) renderLibs.drawStringCenteredFull(clicks, this.weaponsIndicator.location.getXExact()+this.weaponsIndicator.location.getWidthExact()/2, this.weaponsIndicator.location.getYExact()+this.weaponsIndicator.location.getHeightExact()/2, Math.min(this.weaponsIndicator.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, this.weaponsIndicator.location.getHeightExact()/4/2)) }else{ @@ -81,7 +81,7 @@ class MuseumGui { this.armourIndicator = new SoopyBoxElement().setLocation(leftOffset+widthPer, 0.05, widthPer*4/5, 0.15) this.armourIndicator.addEvent(new SoopyRenderEvent().setHandler(()=>{ - if(this.armourIndicator.hovered && ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()) !== "Armor Sets"){ + if(this.armourIndicator.hovered && ChatLib.removeFormatting(Player.getContainer().getStackInSlot(4).getName()) !== "Armor Sets"){ this.armourText.location.location.x.set(0.05, 500) this.armourText.location.size.x.set(0.9, 500) this.armourText.location.location.y.set(0.025, 500) @@ -91,7 +91,7 @@ class MuseumGui { Renderer.translate(0,0,100) Renderer.drawRect(Renderer.color(0,0,0,100), this.armourIndicator.location.getXExact(), this.armourIndicator.location.getYExact(), this.armourIndicator.location.getWidthExact(), this.armourIndicator.location.getHeightExact()) - let clicks = Player.getOpenedInventory().getName() === "Your Museum"?"1":"2" + let clicks = Player.getContainer().getName() === "Your Museum"?"1":"2" Renderer.translate(0,0,100) renderLibs.drawStringCenteredFull(clicks, this.armourIndicator.location.getXExact()+this.armourIndicator.location.getWidthExact()/2, this.armourIndicator.location.getYExact()+this.armourIndicator.location.getHeightExact()/2, Math.min(this.armourIndicator.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, this.armourIndicator.location.getHeightExact()/4/2)) }else{ @@ -115,7 +115,7 @@ class MuseumGui { this.raritiesIndicator = new SoopyBoxElement().setLocation(leftOffset+widthPer*2, 0.05, widthPer*4/5, 0.15) this.raritiesIndicator.addEvent(new SoopyRenderEvent().setHandler(()=>{ - if(this.raritiesIndicator.hovered && ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()) !== "Rarities"){ + if(this.raritiesIndicator.hovered && ChatLib.removeFormatting(Player.getContainer().getStackInSlot(4).getName()) !== "Rarities"){ this.raritiesText.location.location.x.set(0.05, 500) this.raritiesText.location.size.x.set(0.9, 500) this.raritiesText.location.location.y.set(0.025, 500) @@ -125,7 +125,7 @@ class MuseumGui { Renderer.translate(0,0,100) Renderer.drawRect(Renderer.color(0,0,0,100), this.raritiesIndicator.location.getXExact(), this.raritiesIndicator.location.getYExact(), this.raritiesIndicator.location.getWidthExact(), this.raritiesIndicator.location.getHeightExact()) - let clicks = Player.getOpenedInventory().getName() === "Your Museum"?"1":"2" + let clicks = Player.getContainer().getName() === "Your Museum"?"1":"2" Renderer.translate(0,0,100) renderLibs.drawStringCenteredFull(clicks, this.raritiesIndicator.location.getXExact()+this.raritiesIndicator.location.getWidthExact()/2, this.raritiesIndicator.location.getYExact()+this.raritiesIndicator.location.getHeightExact()/2, Math.min(this.raritiesIndicator.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, this.raritiesIndicator.location.getHeightExact()/4/2)) }else{ @@ -150,7 +150,7 @@ class MuseumGui { this.specialIndicator = new SoopyBoxElement().setLocation(leftOffset+widthPer*3, 0.05, widthPer*4/5, 0.15) this.specialIndicator.addEvent(new SoopyRenderEvent().setHandler(()=>{ - if(this.specialIndicator.hovered && ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()) !== "Special Items"){ + if(this.specialIndicator.hovered && ChatLib.removeFormatting(Player.getContainer().getStackInSlot(4).getName()) !== "Special Items"){ this.specialText.location.location.x.set(0.05, 500) this.specialText.location.size.x.set(0.9, 500) this.specialText.location.location.y.set(0.025, 500) @@ -160,7 +160,7 @@ class MuseumGui { Renderer.translate(0,0,100) Renderer.drawRect(Renderer.color(0,0,0,100), this.specialIndicator.location.getXExact(), this.specialIndicator.location.getYExact(), this.specialIndicator.location.getWidthExact(), this.specialIndicator.location.getHeightExact()) - let clicks = Player.getOpenedInventory().getName() === "Your Museum"?"1":"2" + let clicks = Player.getContainer().getName() === "Your Museum"?"1":"2" Renderer.translate(0,0,100) renderLibs.drawStringCenteredFull(clicks, this.specialIndicator.location.getXExact()+this.specialIndicator.location.getWidthExact()/2, this.specialIndicator.location.getYExact()+this.specialIndicator.location.getHeightExact()/2, Math.min(this.specialIndicator.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, this.specialIndicator.location.getHeightExact()/4/2)) @@ -302,61 +302,61 @@ class MuseumGui { } clickedTopButton(type){ - if(ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())===type) return + if(ChatLib.removeFormatting(Player.getContainer().getStackInSlot(4).getName())===type) return - if(Player.getOpenedInventory().getName() === "Your Museum"){ + if(Player.getContainer().getName() === "Your Museum"){ //if on main page can just directly click on it switch(type){ case "Weapons": - Player.getOpenedInventory().click(19, false, "MIDDLE") + Player.getContainer().click(19, false, "MIDDLE") break case "Armor Sets": - Player.getOpenedInventory().click(21, false, "MIDDLE") + Player.getContainer().click(21, false, "MIDDLE") break case "Rarities": - Player.getOpenedInventory().click(23, false, "MIDDLE") + Player.getContainer().click(23, false, "MIDDLE") break case "Special Items": - Player.getOpenedInventory().click(25, false, "MIDDLE") + Player.getContainer().click(25, false, "MIDDLE") break } }else{ - Player.getOpenedInventory().click(48, false, "MIDDLE") + Player.getContainer().click(48, false, "MIDDLE") } } nextPage(){ let itempages = ["Weapons", "Armor Sets", "Rarities", "Special Items"] - if(itempages.includes(this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()])){ - Player.getOpenedInventory().click(53, false, "MIDDLE") + if(itempages.includes(this.replacePage[Player.getContainer().getName().split("➜").pop()])){ + Player.getContainer().click(53, false, "MIDDLE") - let [currPage, pageNum] = Player.getOpenedInventory().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)) + let [currPage, pageNum] = Player.getContainer().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)) this.regenItems(currPage+1) } } previousPage(){ let itempages = ["Weapons", "Armor Sets", "Rarities", "Special Items"] - if(itempages.includes(this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()])){ - Player.getOpenedInventory().click(45, false, "MIDDLE") + if(itempages.includes(this.replacePage[Player.getContainer().getName().split("➜").pop()])){ + Player.getContainer().click(45, false, "MIDDLE") - let [currPage, pageNum] = Player.getOpenedInventory().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)) + let [currPage, pageNum] = Player.getContainer().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)) this.regenItems(currPage-1) } } tickMenu(first=false){ if(!first && (this.tickI++)%5!==0){ - if(this.lastGuiTitle === Player.getOpenedInventory().getName()){ + if(this.lastGuiTitle === Player.getContainer().getName()){ return } } - this.lastGuiTitle = Player.getOpenedInventory().getName() + this.lastGuiTitle = Player.getContainer().getName() - if(Player.getOpenedInventory().getName() === "Your Museum"){//main page - if(!Player.getOpenedInventory().getStackInSlot(19)) return + if(Player.getContainer().getName() === "Your Museum"){//main page + if(!Player.getContainer().getStackInSlot(19)) return - let lore = Player.getOpenedInventory().getStackInSlot(19).getLore() + let lore = Player.getContainer().getStackInSlot(19).getLore() lore.forEach((line, i)=>{ if(i===0) return @@ -369,7 +369,7 @@ class MuseumGui { }) this.weaponsIndicator.setLore(lore) - lore = Player.getOpenedInventory().getStackInSlot(21).getLore() + lore = Player.getContainer().getStackInSlot(21).getLore() lore.forEach((line, i)=>{ if(i===0) return @@ -382,7 +382,7 @@ class MuseumGui { }) this.armourIndicator.setLore(lore) - lore = Player.getOpenedInventory().getStackInSlot(23).getLore() + lore = Player.getContainer().getStackInSlot(23).getLore() lore.forEach((line, i)=>{ if(i===0) return @@ -395,7 +395,7 @@ class MuseumGui { }) this.raritiesIndicator.setLore(lore) - lore = Player.getOpenedInventory().getStackInSlot(25).getLore() + lore = Player.getContainer().getStackInSlot(25).getLore() lore.forEach((line, i)=>{ if(i===0) return @@ -405,16 +405,16 @@ class MuseumGui { }) this.specialIndicator.setLore(lore) - if((this.pageTitle.text !== ("§5"+Player.getOpenedInventory().getName()) || first) && !this.searchText){ + if((this.pageTitle.text !== ("§5"+Player.getContainer().getName()) || first) && !this.searchText){ this.itemsBox.clearChildren() let rewardsButton = new ButtonWithArrow().setText("§5Rewards").setLocation(0.1,0.05,0.8,0.2) rewardsButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ - Player.getOpenedInventory().click(40, false, "MIDDLE") + Player.getContainer().click(40, false, "MIDDLE") })) this.itemsBox.addChild(rewardsButton) let browserButton = new ButtonWithArrow().setText("§5Museum Browser").setLocation(0.1,0.3,0.8,0.2) browserButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ - Player.getOpenedInventory().click(50, false, "MIDDLE") + Player.getContainer().click(50, false, "MIDDLE") })) this.itemsBox.addChild(browserButton) @@ -429,18 +429,18 @@ class MuseumGui { this.donateBox.visable = false let itempages = ["Weapons", "Armor Sets", "Rarities", "Special Items"] - if(itempages.includes(this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()])){ - let page = this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()] - let [currPage, pageNum] = Player.getOpenedInventory().getName().includes("/")?Player.getOpenedInventory().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)):[1,1] + if(itempages.includes(this.replacePage[Player.getContainer().getName().split("➜").pop()])){ + let page = this.replacePage[Player.getContainer().getName().split("➜").pop()] + let [currPage, pageNum] = Player.getContainer().getName().includes("/")?Player.getContainer().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)):[1,1] if(!this.searchText){ if(currPage > 1){ this.previousButton.visable = true - if(Player.getOpenedInventory().getStackInSlot(45)) this.previousButton.setLore(Player.getOpenedInventory().getStackInSlot(45).getLore()) + if(Player.getContainer().getStackInSlot(45)) this.previousButton.setLore(Player.getContainer().getStackInSlot(45).getLore()) } if(currPage < pageNum){ this.nextButton.visable = true - if(Player.getOpenedInventory().getStackInSlot(53))this.nextButton.setLore(Player.getOpenedInventory().getStackInSlot(53).getLore()) + if(Player.getContainer().getStackInSlot(53))this.nextButton.setLore(Player.getContainer().getStackInSlot(53).getLore()) } } @@ -449,7 +449,7 @@ class MuseumGui { let oldDonateItems = JSON.stringify(this.donateItems) this.donateItems = [] let donateArmorSets = {} - Player.getOpenedInventory().getItems().forEach((item, slot)=>{ + Player.getContainer().getItems().forEach((item, slot)=>{ if(!item) return if(item.getID() === -1) return item.getLore().forEach(line=>{ @@ -495,7 +495,7 @@ class MuseumGui { for(let i = 0;i<4;i++){ for(let j = 10;j<17;j++){ let slot = i*9+j - let item = Player.getOpenedInventory().getStackInSlot(slot) + let item = Player.getContainer().getStackInSlot(slot) let sb_id = utils.getSBID(item) if(!this.itemsInPages[page][currPage]) this.itemsInPages[page][currPage] = [] @@ -529,37 +529,37 @@ class MuseumGui { if(changed || this.guiUpdated || first) this.regenItems(currPage) } - if(Player.getOpenedInventory().getName() === "Confirm Donation"){ - let this_confirm_temp_str = (Player.getOpenedInventory().getStackInSlot(4)?.getName() || "") +(Player.getOpenedInventory().getStackInSlot(2)?.getName() || "") + (Player.getOpenedInventory().getStackInSlot(20)?.getName() || "") + (Player.getOpenedInventory().getStackInSlot(24)?.getName() || "")//4, 24, 20 + if(Player.getContainer().getName() === "Confirm Donation"){ + let this_confirm_temp_str = (Player.getContainer().getStackInSlot(4)?.getName() || "") +(Player.getContainer().getStackInSlot(2)?.getName() || "") + (Player.getContainer().getStackInSlot(20)?.getName() || "") + (Player.getContainer().getStackInSlot(24)?.getName() || "")//4, 24, 20 if(this.confirm_temp !== this_confirm_temp_str || first){ this.confirm_temp = this_confirm_temp_str this.itemsBox.clearChildren() - let isArmour = utils.getSBID(Player.getOpenedInventory().getStackInSlot(4))===null + let isArmour = utils.getSBID(Player.getContainer().getStackInSlot(4))===null if(isArmour){ - let name = Player.getOpenedInventory().getStackInSlot(2).getName() - let itemBox = new BoxWithText().setText(name.startsWith("§f")?"&7"+name.substr(2):name).setLocation(0.1,0.05,0.8,0.2).setLore(Player.getOpenedInventory().getStackInSlot(2).getLore()) + let name = Player.getContainer().getStackInSlot(2).getName() + let itemBox = new BoxWithText().setText(name.startsWith("§f")?"&7"+name.substr(2):name).setLocation(0.1,0.05,0.8,0.2).setLore(Player.getContainer().getStackInSlot(2).getLore()) this.itemsBox.addChild(itemBox) }else{ - let name = Player.getOpenedInventory().getStackInSlot(4).getName() - let itemBox = new BoxWithText().setText(name.startsWith("§f")?"&7"+name.substr(2):name).setLocation(0.1,0.05,0.8,0.2).setLore(Player.getOpenedInventory().getStackInSlot(4).getLore()) + let name = Player.getContainer().getStackInSlot(4).getName() + let itemBox = new BoxWithText().setText(name.startsWith("§f")?"&7"+name.substr(2):name).setLocation(0.1,0.05,0.8,0.2).setLore(Player.getContainer().getStackInSlot(4).getLore()) this.itemsBox.addChild(itemBox) } - if(Player.getOpenedInventory().getStackInSlot(24) && Player.getOpenedInventory().getStackInSlot(20)){ + if(Player.getContainer().getStackInSlot(24) && Player.getContainer().getStackInSlot(20)){ - let cancelButton = new ButtonWithArrow().setText("§cCancel").setLocation(0.1,0.4,0.35,0.2).setDirectionRight(false).setLore(Player.getOpenedInventory().getStackInSlot(24).getLore()) + let cancelButton = new ButtonWithArrow().setText("§cCancel").setLocation(0.1,0.4,0.35,0.2).setDirectionRight(false).setLore(Player.getContainer().getStackInSlot(24).getLore()) cancelButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ - Player.getOpenedInventory().click(24, false, "LEFT") + Player.getContainer().click(24, false, "LEFT") })) this.itemsBox.addChild(cancelButton) - let confirmButton = new ButtonWithArrow().setText("§aConfirm Donation").setLocation(0.55,0.4,0.35,0.2).setLore(Player.getOpenedInventory().getStackInSlot(20).getLore()) + let confirmButton = new ButtonWithArrow().setText("§aConfirm Donation").setLocation(0.55,0.4,0.35,0.2).setLore(Player.getContainer().getStackInSlot(20).getLore()) confirmButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ - Player.getOpenedInventory().click(20, false, "LEFT") + Player.getContainer().click(20, false, "LEFT") })) this.itemsBox.addChild(confirmButton) } @@ -579,7 +579,7 @@ class MuseumGui { this.favoriteTitleBox.visable = true } - this.pageTitle.setText("§5"+Player.getOpenedInventory().getName()) + this.pageTitle.setText("§5"+Player.getContainer().getName()) this.guiUpdated = false } @@ -588,7 +588,7 @@ class MuseumGui { this.donateItems.forEach((item, i)=>{ let itemButton = new ButtonWithArrow().setText(item.name.startsWith("§f")?"&7"+item.name.substr(2):item.name).setLocation(0.05,0.025+0.125*i,0.9,0.1).setLore(item.lore) itemButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ - Player.getOpenedInventory().click(item.slot, false, "LEFT") + Player.getContainer().click(item.slot, false, "LEFT") })) this.donateBox.addChild(itemButton) }) @@ -597,7 +597,7 @@ class MuseumGui { } showSearchItems(){ - if(Player.getOpenedInventory().getName() === "Confirm Donation") return + if(Player.getContainer().getName() === "Confirm Donation") return if(!this.searchText){ this.tickMenu(true) @@ -663,21 +663,21 @@ class MuseumGui { this.addItemToFavorites(fItem, fItem.page, fItem.page2, fItem.slotNum) return } - // Player.getOpenedInventory().click(item.slotNum, false,button===1?"RIGHT":"LEFT") + // Player.getContainer().click(item.slotNum, false,button===1?"RIGHT":"LEFT") let currPage, pageNum - if(Player.getOpenedInventory().getName().includes("/")){ - [currPage, pageNum] = Player.getOpenedInventory().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)) + if(Player.getContainer().getName().includes("/")){ + [currPage, pageNum] = Player.getContainer().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)) } - if(this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()]===fItem.page){ + if(this.replacePage[Player.getContainer().getName().split("➜").pop()]===fItem.page){ if(currPage === fItem.page2){ - Player.getOpenedInventory().click(fItem.slotNum, false,"LEFT") + Player.getContainer().click(fItem.slotNum, false,"LEFT") }else{ if(currPage < fItem.page2){ - Player.getOpenedInventory().click(53, false,"MIDDLE") + Player.getContainer().click(53, false,"MIDDLE") }else{ - Player.getOpenedInventory().click(45, false,"MIDDLE") + Player.getContainer().click(45, false,"MIDDLE") } } }else{ @@ -693,14 +693,14 @@ class MuseumGui { let clicks = "?" let currPage, pageNum - if(Player.getOpenedInventory().getName().includes("/")){ - [currPage, pageNum] = Player.getOpenedInventory().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)) + if(Player.getContainer().getName().includes("/")){ + [currPage, pageNum] = Player.getContainer().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)) } let pageClicks = Math.abs(currPage-fItem.page2) - if(this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()]===fItem.page){ + if(this.replacePage[Player.getContainer().getName().split("➜").pop()]===fItem.page){ clicks = (pageClicks+1) + "" }else{ - if(Player.getOpenedInventory().getName() === "Your Museum"){ + if(Player.getContainer().getName() === "Your Museum"){ clicks = (1+fItem.page2) + "" }else{ clicks = (2+fItem.page2) + "" @@ -734,7 +734,7 @@ class MuseumGui { this.itemsBox.clearChildren() - let page = this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()] + let page = this.replacePage[Player.getContainer().getName().split("➜").pop()] let y = 0.0325 let itemNum = 0 @@ -766,8 +766,8 @@ class MuseumGui { this.addItemToFavorites(slot, page, page2, slotNum) return } - // Player.getOpenedInventory().click(slotNum, false,button===1?"RIGHT":"LEFT") - Player.getOpenedInventory().click(slotNum, false,"LEFT") //TODO: add right click support for viewing armour sets + // Player.getContainer().click(slotNum, false,button===1?"RIGHT":"LEFT") + Player.getContainer().click(slotNum, false,"LEFT") //TODO: add right click support for viewing armour sets })) if(this.favoriteIds.includes(slot.sb_id)){ child.setColor(200, 255, 200) @@ -830,21 +830,21 @@ class MuseumGui { this.addItemToFavorites(fItem, fItem.page, fItem.page2, fItem.slotNum) return } - // Player.getOpenedInventory().click(item.slotNum, false,button===1?"RIGHT":"LEFT") + // Player.getContainer().click(item.slotNum, false,button===1?"RIGHT":"LEFT") let currPage, pageNum - if(Player.getOpenedInventory().getName().includes("/")){ - [currPage, pageNum] = Player.getOpenedInventory().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)) + if(Player.getContainer().getName().includes("/")){ + [currPage, pageNum] = Player.getContainer().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)) } - if(this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()]===fItem.page){ + if(this.replacePage[Player.getContainer().getName().split("➜").pop()]===fItem.page){ if(currPage === fItem.page2){ - Player.getOpenedInventory().click(fItem.slotNum, false,"LEFT") + Player.getContainer().click(fItem.slotNum, false,"LEFT") }else{ if(currPage < fItem.page2){ - Player.getOpenedInventory().click(53, false,"MIDDLE") + Player.getContainer().click(53, false,"MIDDLE") }else{ - Player.getOpenedInventory().click(45, false,"MIDDLE") + Player.getContainer().click(45, false,"MIDDLE") } } }else{ @@ -860,14 +860,14 @@ class MuseumGui { let clicks = "?" let currPage, pageNum - if(Player.getOpenedInventory().getName().includes("/")){ - [currPage, pageNum] = Player.getOpenedInventory().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)) + if(Player.getContainer().getName().includes("/")){ + [currPage, pageNum] = Player.getContainer().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a)) } let pageClicks = Math.abs(currPage-fItem.page2) - if(this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()]===fItem.page){ + if(this.replacePage[Player.getContainer().getName().split("➜").pop()]===fItem.page){ clicks = (pageClicks+1) + "" }else{ - if(Player.getOpenedInventory().getName() === "Your Museum"){ + if(Player.getContainer().getName() === "Your Museum"){ clicks = (1+fItem.page2) + "" }else{ clicks = (2+fItem.page2) + "" @@ -904,10 +904,10 @@ class MuseumGui { if(event.gui && event.gui.field_147002_h){ Player.getPlayer().field_71070_bA = event.gui.field_147002_h - if(Player.getOpenedInventory().getName() === "Museum Rewards"){ + if(Player.getContainer().getName() === "Museum Rewards"){ return } - if(Player.getOpenedInventory().getName().startsWith("Museum Browser")){ + if(Player.getContainer().getName().startsWith("Museum Browser")){ return } @@ -937,12 +937,12 @@ class MuseumGui { this.itemsBox.clearChildren() let rewardsButton = new ButtonWithArrow().setText("§5Rewards").setLocation(0.1,0.05,0.8,0.2) rewardsButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ - Player.getOpenedInventory().click(40, false, "MIDDLE") + Player.getContainer().click(40, false, "MIDDLE") })) this.itemsBox.addChild(rewardsButton) let browserButton = new ButtonWithArrow().setText("§5Museum Browser").setLocation(0.1,0.3,0.8,0.2) browserButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ - Player.getOpenedInventory().click(50, false, "MIDDLE") + Player.getContainer().click(50, false, "MIDDLE") })) this.itemsBox.addChild(browserButton) diff --git a/features/dataLoader/index.js b/features/dataLoader/index.js index dbaf841..fe11e42 100644 --- a/features/dataLoader/index.js +++ b/features/dataLoader/index.js @@ -18,6 +18,8 @@ class DataLoader extends Feature { this.isInSkyblock = false + this.dungeonPercentCleared = 0 + this.registerStep(true, 2, this.step) this.registerEvent("worldLoad", this.worldLoad) @@ -91,7 +93,15 @@ class DataLoader extends Feature { TabList.getNames().forEach(n=>{ n = ChatLib.removeFormatting(n) if(n.includes(": ")){ - this.stats[n.split(": ")[0].trim()] = n.split(": ")[1].trim() + if(n.includes('Secrets Found')){ + if(n.includes('%')){ + this.stats["Secrets Found%"] = n.split(": ")[1] + }else{ + this.stats["Secrets Found"] = n.split(": ")[1] + } + }else{ + this.stats[n.split(": ")[0].trim()] = n.split(": ")[1].trim() + } } }) } @@ -121,6 +131,9 @@ class DataLoader extends Feature { 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.endsWith("Combat XP")){ this.slayerXpToSpawn = ChatLib.removeFormatting(name).split("(")[1].split(")")[0].split("/").map(parseInt) diff --git a/features/dungeonMap/index.js b/features/dungeonMap/index.js index f8abb4e..db22135 100644 --- a/features/dungeonMap/index.js +++ b/features/dungeonMap/index.js @@ -720,7 +720,7 @@ class SpiritLeapOverlay { tick(){ let itemsNew = {} - if(Player.getOpenedInventory()?.getName() === "Spirit Leap"){ + if(Player.getContainer()?.getName() === "Spirit Leap"){ this.players = {} Scoreboard.getLines().forEach(line=>{ @@ -733,7 +733,7 @@ class SpiritLeapOverlay { }) for(let i = 1;i<9*3;i++){ - let item = Player.getOpenedInventory().getStackInSlot(i) + let item = Player.getContainer().getStackInSlot(i) if(item && item.getID()!==160){ itemsNew[item.getName()] = i } @@ -745,7 +745,7 @@ class SpiritLeapOverlay { Object.keys(this.items).forEach((name, i)=>{ let button = new ButtonWithArrow().setText((ChatLib.removeFormatting(name)===this.parent.lastDoorOpener?"&4":"&2")+"["+this.players[ChatLib.removeFormatting(name)]+"] "+ChatLib.removeFormatting(name)).addEvent(new SoopyMouseClickEvent().setHandler(()=>{ - Player.getOpenedInventory().click(itemsNew[name]) + Player.getContainer().click(itemsNew[name]) ChatLib.chat("Leaping to " + name) })).setLocation((i%2)*0.5,Math.floor(i/2)*0.5,0.5,0.5) button.text.setLocation(0.5, 0, 0.4, 1) @@ -833,12 +833,12 @@ class soopyGuiMapRendererThing extends SoopyGuiElement { let closestPlayer = this.getClosestPlayerTo(x, y, size, scale, mouseX, mouseY) if(closestPlayer){ - if(Player.getOpenedInventory()?.getName() === "Spirit Leap"){ + if(Player.getContainer()?.getName() === "Spirit Leap"){ for(let i = 1;i<9*3;i++){ - let item = Player.getOpenedInventory().getStackInSlot(i) + let item = Player.getContainer().getStackInSlot(i) if(item && item.getID()!==160){ if(ChatLib.removeFormatting(item.getName()) === closestPlayer.username){ - Player.getOpenedInventory().click(i) + Player.getContainer().click(i) ChatLib.chat("Leaping to " + closestPlayer.username) } } diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js index 8e95961..b4f1793 100644 --- a/features/dungeonSolvers/index.js +++ b/features/dungeonSolvers/index.js @@ -9,224 +9,369 @@ import HudTextElement from "../hud/HudTextElement"; import LocationSetting from "../settings/settingThings/location"; import ToggleSetting from "../settings/settingThings/toggle"; -const EntityArrow = Java.type("net.minecraft.entity.projectile.EntityArrow") -const EntityBlaze = Java.type("net.minecraft.entity.monster.EntityBlaze") -const AxisAlignedBB = Java.type("net.minecraft.util.AxisAlignedBB") -let translate -try{ - translate = net.minecraft.util.StringTranslate.func_74808_a() -}catch(e){ +const EntityArrow = Java.type("net.minecraft.entity.projectile.EntityArrow"); +const EntityBlaze = Java.type("net.minecraft.entity.monster.EntityBlaze"); +const AxisAlignedBB = Java.type("net.minecraft.util.AxisAlignedBB"); +let translate; +try { + translate = net.minecraft.util.StringTranslate.func_74808_a(); +} catch (e) { //player doesent have translate (using english default) } class DungeonSolvers extends Feature { - constructor() { - super(); - } - - onEnable() { - this.initVariables(); - - this.lividData = {}; - this.lividData.lividColor = { - Vendetta: "&f", - Crossed: "&d", - Hockey: "&c", - Doctor: "&7", - Frog: "&2", - Smile: "&a", - Scream: "&9", - Purple: "&5", - Arcade: "&e", - }; - this.onWorldLoad(); - - this.lividFindEnabled = new ToggleSetting("Correct livid finder", "Finds the real livid to kill in the f5 boss fight", true, "livid_find_enabled", this); - this.lividFindHud = new ToggleSetting("Show Livid Hp", "Shows the nametag of the correct livid", true, "livid_hud_enabled", this).requires(this.lividFindEnabled); - this.lividHpElement = new HudTextElement().setToggleSetting(this.lividFindHud).setLocationSetting(new LocationSetting("Correct Livid Hp Location", "Allows you to edit the location of the correct livid hp text", "livid_hp_location", this, [10, 50, 1, 1]).requires(this.lividFindHud).editTempText("§r§e﴾ §c§lLivid§r §a7M§c❤ §e﴿§r")); - - this.hudElements.push(this.lividHpElement); - - this.lividFindBox = new ToggleSetting("Put a box around the correct livid", "This helps to locate it in the group", true, "livid_box_enabled", this).requires(this.lividFindEnabled); - this.lividFindNametags = new ToggleSetting("Hide the nametags of incorrect livids", "This helps to locate it in the group", true, "livid_nametags_enabled", this).requires(this.lividFindEnabled); - - this.spiritBowDestroyTimer = new ToggleSetting("Timer for when the spirit bow will self destruct", "", true, "spirit_bow_destroy_timer", this); - this.spiritBowDestroyElement = new HudTextElement().setToggleSetting(this.spiritBowDestroyTimer).setLocationSetting(new LocationSetting("Spirit bow destroy timer location", "Allows you to edit the location of the timer", "spirit_destroy_location", this, [10, 70, 3, 1]).requires(this.spiritBowDestroyTimer).editTempText("&dBow Destroyed in: &c15s")); - - this.spiritBearSpawnTimer = new ToggleSetting("Timer for when the spirit bear will spawn", "", true, "spirit_bear_spawn_timer", this); - this.spiritBearSpawnElement = new HudTextElement().setToggleSetting(this.spiritBearSpawnTimer).setLocationSetting(new LocationSetting("Spirit bear spawn timer location", "Allows you to edit the location of the timer", "spirit_bear_spawn_location", this, [10, 70, 3, 1]).requires(this.spiritBearSpawnTimer).editTempText("&dBear spawned in: &c1.57s")); - - this.hudElements.push(this.spiritBearSpawnElement); - this.hudElements.push(this.spiritBowDestroyElement); - - this.bloodCampAssist = new ToggleSetting("Assist blood camp", "Helps guess where and when blood mobs will spawn", true, "blood_camp_assist", this); - - this.runSpeedRates = new ToggleSetting("Show run speed and exp rates", "(Run speed includes downtime inbetween runs, only shows while doing dungeon runs)", true, "run_speed_rates", this); - this.runSpeedRatesElement = new HudTextElement() - .setText("&6Run speed&7> &fLoading...\n&6Exp/hour&7> &fLoading...\n&6Runs/hour&7> &fLoading...") - .setToggleSetting(this.runSpeedRates) - .setLocationSetting(new LocationSetting("Run speed and exp rates location", "Allows you to edit the location of the information", "run_speed_rates_location", this, [10, 100, 1, 1]).requires(this.runSpeedRates).editTempText("&6Run speed&7> &f4:30\n&6Exp/hour&7> &f1,234,567\n&6Runs/hour&7> &f17")); - - this.hudElements.push(this.runSpeedRatesElement); - - this.blazeSolver = new ToggleSetting("Blaze Puzzle Solver", "Shows what order to kill the blazes in", true, "blaze_solver", this); - - this.lastDungFinishes = []; - this.lastDungExps = []; - this.registerChat("${start}+&r&3${exp} Catacombs Experience&r", (start, exp) => { - if (ChatLib.removeFormatting(start).replace(/ /gi, "").length > 0) return; - this.lastDungExps.push(parseFloat(exp.replace(/,/gi, ""))); - if (this.lastDungExps.length > 5) { - this.lastDungExps.shift(); - } - - this.lastDungFinishes.push(Date.now()); - if (this.lastDungFinishes.length > 5) { - this.lastDungFinishes.shift(); - } - }); - this.forgorEnabled = new ToggleSetting("Change withermancer death message to forgor ", "", true, "withermancer_forgor", this); - - this.registerChat("&r&c ☠ &r${player} were killed by Withermancer&r&7 and became a ghost&r&7.&r", (player, e) => { - if (this.forgorEnabled.getValue()) { - cancel(e); - ChatLib.chat(player + " forgor ☠"); - } - }); - this.registerChat("&r&c ☠ &r${player} was killed by Withermancer&r&7 and became a ghost&r&7.&r", (player, e) => { - if (this.forgorEnabled.getValue()) { - cancel(e); - ChatLib.chat(player + " forgor ☠"); - } - }); - - this.spiritBowPickUps = []; - this.registerChat("&r&aYou picked up the &r&5Spirit Bow&r&a! Use it to attack &r&cThorn&r&a!&r", () => { - this.spiritBowPickUps.push(Date.now()); - }); - - - this.bearSpawning = 0 - this.registerChat("&r&a&lThe &r&5&lSpirit Bow &r&a&lhas dropped!&r", ()=>{ - this.bearSpawning = -Date.now() - }) - - this.todoE = []; - this.eMovingThing = {}; - this.bloodX = -1; - this.bloodY = -1; - this.startSpawningTime = 0; - this.spawnIdThing = 0; - - this.checkingPing = false; - this.lastPingCheck = 0; - this.lastPings = [undefined, undefined, undefined]; - this.ping = 0; - this.pingI = 0; - - this.arrows = [] - this.blazes = [] - this.blazeX = -1; - this.blazeY = -1; - - this.registerStep(true, 2, this.step); - this.registerStep(true, 10, this.step2); - this.registerEvent("worldLoad", this.onWorldLoad); - - this.registerEvent("renderOverlay", this.renderHud); - this.registerEvent("renderWorld", this.renderWorld); - - this.registerChat("&b&bYou are currently connected to server &6${*}&r", (e) => { - if (this.checkingPing) { - this.lastPings[this.pingI % 3] = Date.now() - this.lastPingCheck; - cancel(e); - this.checkingPing = false; - - if (this.lastPings.includes(undefined)) { - this.ping = this.lastPings[this.pingI % 3]; - } else { - this.ping = [...this.lastPings].sort((a, b) => a - b)[1]; - } - this.pingI++; - } - }); - - this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent); - // this.registerEvent("renderEntity", this.renderEntity) - this.renderEntityEvent = undefined; - - this.onWorldLoad(); - } - - entityJoinWorldEvent(event) { - if (this.bloodCampAssist.getValue()) this.todoE.push(event.entity); - - // if(event.entity instanceof EntityArrow){ - // this.arrows.push(new Entity(event.entity)) - // } - if(event.entity instanceof EntityBlaze){ - // console.log("Blaze joined world") - this.addBlaze(new Entity(event.entity)) + constructor() { + super(); } - } - renderWorld(ticks) { - if (this.lividFindBox.getValue()) { - if (this.lividData.correctLividEntity) { - renderUtils.drawBoxAtEntity(this.lividData.correctLividEntity, 255, 0, 0, 0.75, -2, ticks); - } - } + onEnable() { + this.initVariables(); + + this.lividData = {}; + this.lividData.lividColor = { + Vendetta: "&f", + Crossed: "&d", + Hockey: "&c", + Doctor: "&7", + Frog: "&2", + Smile: "&a", + Scream: "&9", + Purple: "&5", + Arcade: "&e", + }; + this.onWorldLoad(); + + this.lividFindEnabled = new ToggleSetting("Correct livid finder", "Finds the real livid to kill in the f5 boss fight", true, "livid_find_enabled", this); + this.lividFindHud = new ToggleSetting("Show Livid Hp", "Shows the nametag of the correct livid", true, "livid_hud_enabled", this).requires(this.lividFindEnabled); + this.lividHpElement = new HudTextElement().setToggleSetting(this.lividFindHud).setLocationSetting(new LocationSetting("Correct Livid Hp Location", "Allows you to edit the location of the correct livid hp text", "livid_hp_location", this, [10, 50, 1, 1]).requires(this.lividFindHud).editTempText("§r§e﴾ §c§lLivid§r §a7M§c❤ §e﴿§r")); + + this.hudElements.push(this.lividHpElement); + + this.lividFindBox = new ToggleSetting("Put a box around the correct livid", "This helps to locate it in the group", true, "livid_box_enabled", this).requires(this.lividFindEnabled); + this.lividFindNametags = new ToggleSetting("Hide the nametags of incorrect livids", "This helps to locate it in the group", true, "livid_nametags_enabled", this).requires(this.lividFindEnabled); + + this.spiritBowDestroyTimer = new ToggleSetting("Timer for when the spirit bow will self destruct", "", true, "spirit_bow_destroy_timer", this); + this.spiritBowDestroyElement = new HudTextElement().setToggleSetting(this.spiritBowDestroyTimer).setLocationSetting(new LocationSetting("Spirit bow destroy timer location", "Allows you to edit the location of the timer", "spirit_destroy_location", this, [10, 70, 3, 1]).requires(this.spiritBowDestroyTimer).editTempText("&dBow Destroyed in: &c15s")); + + this.spiritBearSpawnTimer = new ToggleSetting("Timer for when the spirit bear will spawn", "", true, "spirit_bear_spawn_timer", this); + this.spiritBearSpawnElement = new HudTextElement().setToggleSetting(this.spiritBearSpawnTimer).setLocationSetting(new LocationSetting("Spirit bear spawn timer location", "Allows you to edit the location of the timer", "spirit_bear_spawn_location", this, [10, 70, 3, 1]).requires(this.spiritBearSpawnTimer).editTempText("&dBear spawned in: &c1.57s")); + + this.hudElements.push(this.spiritBearSpawnElement); + this.hudElements.push(this.spiritBowDestroyElement); + + this.bloodCampAssist = new ToggleSetting("Assist blood camp", "Helps guess where and when blood mobs will spawn", true, "blood_camp_assist", this); + + this.runSpeedRates = new ToggleSetting("Show run speed and exp rates", "(Run speed includes downtime inbetween runs, only shows while doing dungeon runs)", true, "run_speed_rates", this); + this.runSpeedRatesElement = new HudTextElement() + .setText("&6Run speed&7> &fLoading...\n&6Exp/hour&7> &fLoading...\n&6Runs/hour&7> &fLoading...") + .setToggleSetting(this.runSpeedRates) + .setLocationSetting(new LocationSetting("Run speed and exp rates location", "Allows you to edit the location of the information", "run_speed_rates_location", this, [10, 100, 1, 1]).requires(this.runSpeedRates).editTempText("&6Run speed&7> &f4:30\n&6Exp/hour&7> &f1,234,567\n&6Runs/hour&7> &f17")); + + this.scoreCalculation = new ToggleSetting("Show score calculation", "", true, "run_score_calc", this); + this.scoreElement = new HudTextElement().setToggleSetting(this.scoreCalculation).setLocationSetting(new LocationSetting("Score calculation location", "Allows you to edit the location of the score calc", "score_calc_location", this, [10, 130, 1, 1]).requires(this.scoreCalculation).editTempText("Editing temp text here")); + + this.hudElements.push(this.runSpeedRatesElement); + this.hudElements.push(this.scoreElement); + + this.blazeSolver = new ToggleSetting("Blaze Puzzle Solver", "Shows what order to kill the blazes in", true, "blaze_solver", this); + + this.lastDungFinishes = []; + this.lastDungExps = []; + this.registerChat("${start}+&r&3${exp} Catacombs Experience&r", (start, exp) => { + if (ChatLib.removeFormatting(start).replace(/ /gi, "").length > 0) return; + this.lastDungExps.push(parseFloat(exp.replace(/,/gi, ""))); + if (this.lastDungExps.length > 5) { + this.lastDungExps.shift(); + } + + this.lastDungFinishes.push(Date.now()); + if (this.lastDungFinishes.length > 5) { + this.lastDungFinishes.shift(); + } + }); + this.forgorEnabled = new ToggleSetting("Change withermancer death message to forgor ", "", true, "withermancer_forgor", this); - if (this.bloodCampAssist.getValue()) { - this.skulls.forEach((skull) => { - let skullE = skull.getEntity(); - // renderUtils.drawBoxAtEntity(skull, 255, 0, 0, 0.5, 0.5, ticks) + this.registerChat("&r&c ☠ &r${player} were killed by Withermancer&r&7 and became a ghost&r&7.&r", (player, e) => { + if (this.forgorEnabled.getValue()) { + cancel(e); + ChatLib.chat(player + " forgor ☠"); + } + }); + this.registerChat("&r&c ☠ &r${player} was killed by Withermancer&r&7 and became a ghost&r&7.&r", (player, e) => { + if (this.forgorEnabled.getValue()) { + cancel(e); + ChatLib.chat(player + " forgor ☠"); + } + }); - if (this.eMovingThing[skull.getUUID().toString()] && this.eMovingThing[skull.getUUID().toString()].timeTook) { - let startPoint = [skullE[f.posX.Entity], skullE[f.posY.Entity], skullE[f.posZ.Entity]]; + this.spiritBowPickUps = []; + this.registerChat("&r&aYou picked up the &r&5Spirit Bow&r&a! Use it to attack &r&cThorn&r&a!&r", () => { + this.spiritBowPickUps.push(Date.now()); + }); - let xSpeed2 = (startPoint[0] - this.eMovingThing[skull.getUUID().toString()].startX) / this.eMovingThing[skull.getUUID().toString()].timeTook; - let ySpeed2 = (startPoint[1] - this.eMovingThing[skull.getUUID().toString()].startY) / this.eMovingThing[skull.getUUID().toString()].timeTook; - let zSpeed2 = (startPoint[2] - this.eMovingThing[skull.getUUID().toString()].startZ) / this.eMovingThing[skull.getUUID().toString()].timeTook; + this.bearSpawning = 0; + this.registerChat("&r&a&lThe &r&5&lSpirit Bow &r&a&lhas dropped!&r", () => { + this.bearSpawning = -Date.now(); + }); - let time = (this.spawnIdThing >= 4 ? 2900 : 4850) - this.eMovingThing[skull.getUUID().toString()].timeTook; - let endPoint1 = this.eMovingThing[skull.getUUID().toString()].endPoint; - let endPoint2 = this.eMovingThing[skull.getUUID().toString()].endPointLast; - let endPointUpdated = Math.min(Date.now() - this.eMovingThing[skull.getUUID().toString()].endPointUpdated, 100); - if(!endPoint2) return - let endPoint = [endPoint2[0] + ((endPoint1[0] - endPoint2[0]) * endPointUpdated) / 100, endPoint2[1] + ((endPoint1[1] - endPoint2[1]) * endPointUpdated) / 100, endPoint2[2] + ((endPoint1[2] - endPoint2[2]) * endPointUpdated) / 100]; - let pingPoint = [startPoint[0] + xSpeed2 * this.ping, startPoint[1] + ySpeed2 * this.ping, startPoint[2] + zSpeed2 * this.ping]; + this.todoE = []; + this.eMovingThing = {}; + this.bloodX = -1; + this.bloodY = -1; + this.startSpawningTime = 0; + this.spawnIdThing = 0; + + this.failedPuzzleCount = 0; + this.totalPuzzleCount = 0; + this.completedPuzzleCount = 0; + + this.checkingPing = false; + this.lastPingCheck = 0; + this.lastPings = [undefined, undefined, undefined]; + this.ping = 0; + this.pingI = 0; + + this.arrows = []; + this.blazes = []; + this.blazeX = -1; + this.blazeY = -1; + + this.dungeonSecretRquired = { + 1: 0.3, + 2: 0.4, + 3: 0.5, + 4: 0.6, + 5: 0.7, + 6: 0.85, + 7: 1, + }; + this.floorSecondMod = { + 1: 120, + 2: 120, + 3: 120, + 4: 120, + 5: 240, + 6: 120, + 7: 360, + }; + + this.registerStep(true, 2, this.step); + this.registerStep(true, 10, this.step2); + this.registerEvent("worldLoad", this.onWorldLoad); + + this.registerEvent("renderOverlay", this.renderHud); + this.registerEvent("renderWorld", this.renderWorld); + + this.bloodOpenedBonus = false; + this.goneInBonus = false; + this.registerChat("&r&cThe &r&c&lBLOOD DOOR&r&c has been opened!&r", () => { + this.bloodOpenedBonus = true; + this.goneInBonus = true; + }); + this.registerChat("&r&c[BOSS] The Watcher&r&f: You have proven yourself. You may pass.&r", () => { + this.bloodOpenedBonus = false; + this.goneInBonus = true; + }); + let enteredBossMessages = ["&r&4[BOSS] Maxor&r&c: &r&cWELL WELL WELL LOOK WHO’S HERE!&r", "&r&c[BOSS] Livid&r&f: Welcome, you arrive right on time. I am Livid, the Master of Shadows.&r", "&r&c[BOSS] Thorn&r&f: Welcome Adventurers! I am Thorn, the Spirit! And host of the Vegan Trials!&r", "&r&c[BOSS] The Professor&r&f: I was burdened with terrible news recently...&r", "&r&c[BOSS] Scarf&r&f: This is where the journey ends for you, Adventurers.&r", "&r&c[BOSS] Bonzo&r&f: Gratz for making it this far, but I’m basically unbeatable.&r", "&r&c[BOSS] Sadan&r&f: So you made it all the way &r&fhere...and&r&f you wish to defy me? Sadan?!&r"] + enteredBossMessages.forEach(msg => { + this.registerChat(msg, () => { + this.goneInBonus = false; + this.bloodOpenedBonus = false; + }); + }) - renderUtils.drawLineWithDepth(startPoint[0], startPoint[1] + 2, startPoint[2], endPoint[0], endPoint[1] + 2, endPoint[2], 255, 0, 0, 2); + this.registerChat("&b&bYou are currently connected to server &6${*}&r", (e) => { + if (this.checkingPing) { + this.lastPings[this.pingI % 3] = Date.now() - this.lastPingCheck; + cancel(e); + this.checkingPing = false; - if (this.ping < time) { - renderUtils.drawBoxAtBlockNotVisThruWalls(pingPoint[0] - 0.5, pingPoint[1] + 1.5, pingPoint[2] - 0.5, 0, 255, 0); - renderUtils.drawBoxAtBlockNotVisThruWalls(endPoint[0] - 0.5, endPoint[1] + 1.5, endPoint[2] - 0.5, 255, 0, 0); + if (this.lastPings.includes(undefined)) { + this.ping = this.lastPings[this.pingI % 3]; } else { - renderUtils.drawBoxAtBlockNotVisThruWalls(endPoint[0] - 0.5, endPoint[1] + 1.5, endPoint[2] - 0.5, 0, 0, 255); + this.ping = [...this.lastPings].sort((a, b) => a - b)[1]; } - - // if(this.eMovingThing[skull.getUUID().toString()] && this.eMovingThing[skull.getUUID().toString()].timeTook){ - // Tessellator.drawString((time/1000).toFixed(3)+"s", endPoint[0], endPoint[1]+2, endPoint[2]) - // } + this.pingI++; } }); - } - if(this.blazeX !== -1 && this.blazes.length > 0 && this.blazeSolver.getValue()){ - renderUtils.drawBoxAtEntity(this.blazes[0], 255, 0, 0, 1, 2, ticks, 2) + this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent); + // this.registerEvent("renderEntity", this.renderEntity) + this.renderEntityEvent = undefined; + + this.onWorldLoad(); + } + + calculateDungeonScore() { + if (!this.FeatureManager.features["dataLoader"].class.dungeonFloor) { + this.scoreElement.setText(""); + return; + } + + // Information about the dungeon + let deaths = parseInt(this.FeatureManager.features["dataLoader"].class.stats.Deaths.replace("(", "").replace(")", "")); + let firstDeathHadSpirit = false; //TODO: this + + let seconds = 0; + if (this.FeatureManager.features["dataLoader"].class.stats.Time !== "Soon!") { + let data = this.FeatureManager.features["dataLoader"].class.stats.Time.split(" "); + seconds += parseInt(data.pop() || 0); + seconds += parseInt(data.pop() || 0) * 60; + seconds += parseInt(data.pop() || 0) * 60 * 60; + } + let timeLimit = this.FeatureManager.features["dataLoader"].class.dungeonFloor[0] === "M" ? 480 : this.floorSecondMod[this.FeatureManager.features["dataLoader"].class.dungeonFloor[1]]; + let inDungeonSeconds = seconds - timeLimit; - let lastLoc = [this.blazes[0].getX(), this.blazes[0].getY()+1.5, this.blazes[0].getZ()] - this.blazes.forEach((blaze, 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()] + let clearedPercent = this.FeatureManager.features["dataLoader"].class.dungeonPercentCleared; + + let dungeonFloor = this.FeatureManager.features["dataLoader"].class.dungeonFloor[1]; + + let secretPercentRequired = this.FeatureManager.features["dataLoader"].class.dungeonFloor[0] === "M" ? 1 : this.dungeonSecretRquired[dungeonFloor]; + + let clearedRooms = parseInt(this.FeatureManager.features["dataLoader"].class.stats["Completed Rooms"]); + + let totalRooms = clearedRooms / clearedPercent || 25; + + let currentSecretsFound = parseInt(this.FeatureManager.features["dataLoader"].class.stats["Secrets Found"]); + let currentSecretPercent = parseFloat(this.FeatureManager.features["dataLoader"].class.stats["Secrets Found%"].replace("%", "")) / 100; + + let mimicKilled = false; //TODO: this + let crypts = parseInt(this.FeatureManager.features["dataLoader"].class.stats["Crypts"]); + + let ezpz = false; + + let maxSecrets = currentSecretsFound / currentSecretPercent || 50; + + //Actual Score Calculation + let skillScore = Math.floor(Math.max(20, (20 - (this.totalPuzzleCount - this.completedPuzzleCount) * 10 + (((80 * (clearedRooms + this.bloodOpenedBonus + this.goneInBonus)) / totalRooms) - deaths * 2 + firstDeathHadSpirit)))); + let exploreScore = (Math.floor((60 * (clearedRooms + this.bloodOpenedBonus + this.goneInBonus)) / totalRooms) + Math.floor(Math.min(40, (40 * currentSecretsFound) / secretPercentRequired / maxSecrets))); + let speedScore; + if (inDungeonSeconds < 480) { + speedScore = 100; + } else if (inDungeonSeconds < 600) { + speedScore = Math.ceil(140 - inDungeonSeconds / 12); + } else if (inDungeonSeconds < 840) { + speedScore = Math.ceil(115 - inDungeonSeconds / 24); + } else if (inDungeonSeconds < 1140) { + speedScore = Math.ceil(108 - inDungeonSeconds / 30); + } else if (inDungeonSeconds < 3940) { + speedScore = Math.ceil(98.5 - inDungeonSeconds / 40); + } else { + speedScore = 0; + } + let bonus = Math.min(5, crypts) + mimicKilled * 2 + ezpz * 10; + + //Calculating secrets for s/s+ + + let hypotheticalSkillScore = Math.floor(Math.max(20, (20 - (this.failedPuzzleCount) * 10 + 80 - deaths * 2 + firstDeathHadSpirit))); + let hypotheticalSpeedScore = speedScore + + //Calculating for S + let hypotheticalBonusScoreS = Math.min(5, crypts) + mimicKilled * 2 + ezpz * 10; + + let sNeededSecrets = Math.min(maxSecrets * secretPercentRequired, Math.ceil((270 - hypotheticalSkillScore - hypotheticalBonusScoreS - hypotheticalSpeedScore - 60) * maxSecrets * secretPercentRequired / 40)); + + sNeededSecrets = Math.max(currentSecretsFound, sNeededSecrets) + + let hypotheticalScoreGottenS = hypotheticalSkillScore + hypotheticalSpeedScore + hypotheticalBonusScoreS + 60 + Math.floor(Math.min(40, (40 * sNeededSecrets) / secretPercentRequired / maxSecrets)); + let sCryptsNeeded = Math.max(crypts, Math.min(5, (270 - hypotheticalScoreGottenS))) + hypotheticalScoreGottenS -= hypotheticalBonusScoreS + hypotheticalBonusScoreS = sCryptsNeeded + mimicKilled * 2 + ezpz * 10 + hypotheticalScoreGottenS += hypotheticalBonusScoreS + + let sPossible = hypotheticalScoreGottenS >= 270 + + //Calculating for S+ + let hypotheticalBonusScoreSplus = 5 + mimicKilled * 2 + ezpz * 10; + + let splusNeededSecrets = Math.ceil((300 - hypotheticalSkillScore - hypotheticalBonusScoreSplus - hypotheticalSpeedScore - 60) * maxSecrets * secretPercentRequired / 40); + + let splusPossible = splusNeededSecrets <= maxSecrets * secretPercentRequired + + splusNeededSecrets = Math.max(currentSecretsFound, splusNeededSecrets) + + let hypotheticalScoreGottenSPlus = hypotheticalSkillScore + hypotheticalSpeedScore + hypotheticalBonusScoreSplus + 60 + Math.floor(Math.min(40, (40 * splusNeededSecrets) / secretPercentRequired / maxSecrets)); + let splusCryptsNeeded = Math.max(crypts, 5 - (hypotheticalScoreGottenSPlus - 300)) + hypotheticalScoreGottenSPlus -= hypotheticalBonusScoreSplus + hypotheticalBonusScoreSplus = splusCryptsNeeded + mimicKilled * 2 + ezpz * 10 + hypotheticalScoreGottenSPlus += hypotheticalBonusScoreSplus + + //Setting hud element + let sPlusText = currentSecretsFound === 0 ? "??" : (skillScore + exploreScore + speedScore + bonus) >= 300 ? ": ✔" : splusPossible ? `(${hypotheticalScoreGottenSPlus}): ${currentSecretsFound}/${splusNeededSecrets} +${crypts}c/${splusCryptsNeeded}` : "✖" + let sText = currentSecretsFound === 0 ? " ??" : (skillScore + exploreScore + speedScore + bonus) >= 270 ? " : ✔" : sPossible ? `(${hypotheticalScoreGottenS}): ${currentSecretsFound}/${sNeededSecrets} +${crypts}c/${sCryptsNeeded}` : "✖" + + this.scoreElement.setText(`&dScore: ${skillScore + exploreScore + speedScore + bonus}\n&aS+ ${sPlusText}\n&aS ${sText}`); + } + + entityJoinWorldEvent(event) { + if (this.bloodCampAssist.getValue()) this.todoE.push(event.entity); + + // if(event.entity instanceof EntityArrow){ + // this.arrows.push(new Entity(event.entity)) + // } + if (event.entity instanceof EntityBlaze) { + // console.log("Blaze joined world") + this.addBlaze(new Entity(event.entity)); + } + } + + renderWorld(ticks) { + if (this.lividFindBox.getValue()) { + if (this.lividData.correctLividEntity) { + renderUtils.drawBoxAtEntity(this.lividData.correctLividEntity, 255, 0, 0, 0.75, -2, ticks); } - }) + } + + if (this.bloodCampAssist.getValue()) { + this.skulls.forEach((skull) => { + let skullE = skull.getEntity(); + // renderUtils.drawBoxAtEntity(skull, 255, 0, 0, 0.5, 0.5, ticks) + + if (this.eMovingThing[skull.getUUID().toString()] && this.eMovingThing[skull.getUUID().toString()].timeTook) { + let startPoint = [skullE[f.posX.Entity], skullE[f.posY.Entity], skullE[f.posZ.Entity]]; + + let xSpeed2 = (startPoint[0] - this.eMovingThing[skull.getUUID().toString()].startX) / this.eMovingThing[skull.getUUID().toString()].timeTook; + let ySpeed2 = (startPoint[1] - this.eMovingThing[skull.getUUID().toString()].startY) / this.eMovingThing[skull.getUUID().toString()].timeTook; + let zSpeed2 = (startPoint[2] - this.eMovingThing[skull.getUUID().toString()].startZ) / this.eMovingThing[skull.getUUID().toString()].timeTook; + + let time = (this.spawnIdThing >= 4 ? 2900 : 4850) - this.eMovingThing[skull.getUUID().toString()].timeTook; + let endPoint1 = this.eMovingThing[skull.getUUID().toString()].endPoint; + let endPoint2 = this.eMovingThing[skull.getUUID().toString()].endPointLast; + let endPointUpdated = Math.min(Date.now() - this.eMovingThing[skull.getUUID().toString()].endPointUpdated, 100); + if (!endPoint2) return; + let endPoint = [endPoint2[0] + ((endPoint1[0] - endPoint2[0]) * endPointUpdated) / 100, endPoint2[1] + ((endPoint1[1] - endPoint2[1]) * endPointUpdated) / 100, endPoint2[2] + ((endPoint1[2] - endPoint2[2]) * endPointUpdated) / 100]; + let pingPoint = [startPoint[0] + xSpeed2 * this.ping, startPoint[1] + ySpeed2 * this.ping, startPoint[2] + zSpeed2 * this.ping]; + + renderUtils.drawLineWithDepth(startPoint[0], startPoint[1] + 2, startPoint[2], endPoint[0], endPoint[1] + 2, endPoint[2], 255, 0, 0, 2); + + if (this.ping < time) { + renderUtils.drawBoxAtBlockNotVisThruWalls(pingPoint[0] - 0.5, pingPoint[1] + 1.5, pingPoint[2] - 0.5, 0, 255, 0); + renderUtils.drawBoxAtBlockNotVisThruWalls(endPoint[0] - 0.5, endPoint[1] + 1.5, endPoint[2] - 0.5, 255, 0, 0); + } else { + renderUtils.drawBoxAtBlockNotVisThruWalls(endPoint[0] - 0.5, endPoint[1] + 1.5, endPoint[2] - 0.5, 0, 0, 255); + } + + // if(this.eMovingThing[skull.getUUID().toString()] && this.eMovingThing[skull.getUUID().toString()].timeTook){ + // 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) => { + 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()]; + } + }); + } } - } - renderEntity(entity, position, ticks, event) { + renderEntity(entity, position, ticks, event) { if (this.lividFindNametags.getValue()) { if (this.lividData.correctLividEntity) { if (entity.getName().includes("Livid") && entity.getName().includes("❤") && entity.getUUID() !== this.lividData.correctLividEntity.getUUID()) { @@ -234,353 +379,379 @@ class DungeonSolvers extends Feature { } } } - } - - renderHud() { - if(this.bearSpawning && this.bearSpawning > 0){ - this.spiritBearSpawnElement.setText("&dBear spawned in: &c" + (Math.max(0,this.bearSpawning-Date.now())/1000).toFixed(2) + "s") - }else{ - this.spiritBearSpawnElement.setText("") } - for (let element of this.hudElements) { - element.render(); - } - } - - onWorldLoad() { - this.lividData.correctLividColor = undefined; - this.lividData.correctLividColorHP = undefined; - this.lividData.sayLividColors = []; - this.lividData.sayLividColors2 = []; - this.lividData.correctLividEntity = undefined; - this.lividHpElement && this.lividHpElement.setText(""); - - this.startSpawningTime = 0; - this.spawnIdThing = 0; - this.eMovingThing = {}; - this.bloodX = -1; - this.bloodY = -1; - this.blazeX = -1; - this.blazeY = -1; - this.skulls = []; - this.arrows = [] - this.blazes = [] - World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach((e) => { - if (e.getEntity()[m.getEquipmentInSlot](4) && e.getEntity()[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().endsWith(getSkullName())) { - this.addSkull(e); + renderHud() { + if (this.bearSpawning && this.bearSpawning > 0) { + this.spiritBearSpawnElement.setText("&dBear spawned in: &c" + (Math.max(0, this.bearSpawning - Date.now()) / 1000).toFixed(2) + "s"); + } else { + this.spiritBearSpawnElement.setText(""); } - }); - World.getAllEntitiesOfType(EntityBlaze).forEach((e) => { - this.addBlaze(e) - }); - // World.getAllEntitiesOfType(EntityArrow).forEach((e) => { - // this.arrows.push(e) - // }); - } - - step2() { - if (this.bloodCampAssist.getValue()) { - this.skulls.forEach((skull) => { - let skullE = skull.getEntity(); - // renderUtils.drawBoxAtEntity(skull, 255, 0, 0, 0.5, 0.5, ticks) - - let xSpeed = skullE[f.posX.Entity] - skullE[f.lastTickPosX]; - let ySpeed = skullE[f.posY.Entity] - skullE[f.lastTickPosY]; - let zSpeed = skullE[f.posZ.Entity] - skullE[f.lastTickPosZ]; - - if (this.eMovingThing[skull.getUUID().toString()] && Date.now() - this.eMovingThing[skull.getUUID().toString()].startMovingTime > 5000) { - this.eMovingThing[skull.getUUID().toString()].logged = true; - this.spawnIdThing++; - - delete this.eMovingThing[skull.getUUID().toString()]; - this.skulls = this.skulls.filter((e) => { - if (e.getUUID().toString() === skull.getUUID().toString()) { - return false; - } - return true; - }); - return; - } - - if (xSpeed !== 0 || ySpeed !== 0) { - if (!this.eMovingThing[skull.getUUID().toString()]) this.eMovingThing[skull.getUUID().toString()] = { startMovingTime: Date.now(), startX: skullE[f.posX.Entity], startY: skullE[f.posY.Entity], startZ: skullE[f.posZ.Entity] }; - - if (this.eMovingThing[skull.getUUID().toString()].lastX !== skullE[f.posX.Entity] || this.eMovingThing[skull.getUUID().toString()].lastY !== skullE[f.posY.Entity]) { - this.eMovingThing[skull.getUUID().toString()].timeTook = Date.now() - this.eMovingThing[skull.getUUID().toString()].startMovingTime; - } else if (!this.eMovingThing[skull.getUUID().toString()].logged && (skullE[f.isDead] || !skullE[m.getEquipmentInSlot](4) || !skullE[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().endsWith(getSkullName()))) { - this.eMovingThing[skull.getUUID().toString()].logged = true; - this.spawnIdThing++; - - delete this.eMovingThing[skull.getUUID().toString()]; - this.skulls = this.skulls.filter((e) => { - if (e.getUUID().toString() === skull.getUUID().toString()) { - return false; - } - return true; - }); - return; - } - - this.eMovingThing[skull.getUUID().toString()].lastX = skullE[f.posX.Entity]; - this.eMovingThing[skull.getUUID().toString()].lastY = skullE[f.posY.Entity]; - - if (!this.startSpawningTime) this.startSpawningTime = Date.now(); - } - - if (this.eMovingThing[skull.getUUID().toString()] && this.eMovingThing[skull.getUUID().toString()].timeTook) { - let startPoint = [skullE[f.posX.Entity], skullE[f.posY.Entity], skullE[f.posZ.Entity]]; - - let xSpeed2 = (startPoint[0] - this.eMovingThing[skull.getUUID().toString()].startX) / this.eMovingThing[skull.getUUID().toString()].timeTook; - let ySpeed2 = (startPoint[1] - this.eMovingThing[skull.getUUID().toString()].startY) / this.eMovingThing[skull.getUUID().toString()].timeTook; - let zSpeed2 = (startPoint[2] - this.eMovingThing[skull.getUUID().toString()].startZ) / this.eMovingThing[skull.getUUID().toString()].timeTook; - - let time = (this.spawnIdThing >= 4 ? 2900 : 4875) - this.eMovingThing[skull.getUUID().toString()].timeTook; - let endPoint = [startPoint[0] + xSpeed2 * time, startPoint[1] + ySpeed2 * time, startPoint[2] + zSpeed2 * time]; - - this.eMovingThing[skull.getUUID().toString()].endPointLast = this.eMovingThing[skull.getUUID().toString()].endPoint; - this.eMovingThing[skull.getUUID().toString()].endPoint = endPoint; - this.eMovingThing[skull.getUUID().toString()].endPointUpdated = Date.now(); - - // if(this.eMovingThing[skull.getUUID().toString()] && this.eMovingThing[skull.getUUID().toString()].timeTook){ - // Tessellator.drawString((time/1000).toFixed(3)+"s", endPoint[0], endPoint[1]+2, endPoint[2]) - // } - } - }); - } - - if(this.blazeX !== -1){ - this.blazes = this.blazes.filter(e=>!e.getEntity()[f.isDead]) - - this.blazes.sort((a, b)=>a.getEntity().func_110143_aJ()-b.getEntity().func_110143_aJ()) - if(World.getBlockAt(this.blazeX+17-43, 18, this.blazeY+16-43).getType().getID() === 9){ - this.blazes = this.blazes.reverse() + + for (let element of this.hudElements) { + element.render(); } } - // this.arrows = this.arrows.filter(e=>{ - // let x = e.getX() - // let y = e.getY() - // let z = e.getZ() + onWorldLoad() { + this.goneInBonus = false; + this.bloodOpenedBonus = false; + this.lividData.correctLividColor = undefined; + this.lividData.correctLividColorHP = undefined; + this.lividData.sayLividColors = []; + this.lividData.sayLividColors2 = []; + this.lividData.correctLividEntity = undefined; + this.lividHpElement && this.lividHpElement.setText(""); + + this.startSpawningTime = 0; + this.spawnIdThing = 0; + this.eMovingThing = {}; + this.bloodX = -1; + this.bloodY = -1; + this.blazeX = -1; + this.blazeY = -1; + this.skulls = []; + this.arrows = []; + this.blazes = []; + World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach((e) => { + if (e.getEntity()[m.getEquipmentInSlot](4) && e.getEntity()[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().endsWith(getSkullName())) { + this.addSkull(e); + } + }); + World.getAllEntitiesOfType(EntityBlaze).forEach((e) => { + this.addBlaze(e); + }); + // World.getAllEntitiesOfType(EntityArrow).forEach((e) => { + // this.arrows.push(e) + // }); + } + + step2() { + if (this.scoreCalculation.getValue()) this.calculateDungeonScore(); + if (this.bloodCampAssist.getValue()) { + this.skulls.forEach((skull) => { + let skullE = skull.getEntity(); + // renderUtils.drawBoxAtEntity(skull, 255, 0, 0, 0.5, 0.5, ticks) + + let xSpeed = skullE[f.posX.Entity] - skullE[f.lastTickPosX]; + let ySpeed = skullE[f.posY.Entity] - skullE[f.lastTickPosY]; + let zSpeed = skullE[f.posZ.Entity] - skullE[f.lastTickPosZ]; + + if (this.eMovingThing[skull.getUUID().toString()] && Date.now() - this.eMovingThing[skull.getUUID().toString()].startMovingTime > 5000) { + this.eMovingThing[skull.getUUID().toString()].logged = true; + this.spawnIdThing++; + + delete this.eMovingThing[skull.getUUID().toString()]; + this.skulls = this.skulls.filter((e) => { + if (e.getUUID().toString() === skull.getUUID().toString()) { + return false; + } + return true; + }); + return; + } + + if (xSpeed !== 0 || ySpeed !== 0) { + if (!this.eMovingThing[skull.getUUID().toString()]) this.eMovingThing[skull.getUUID().toString()] = { startMovingTime: Date.now(), startX: skullE[f.posX.Entity], startY: skullE[f.posY.Entity], startZ: skullE[f.posZ.Entity] }; + + if (this.eMovingThing[skull.getUUID().toString()].lastX !== skullE[f.posX.Entity] || this.eMovingThing[skull.getUUID().toString()].lastY !== skullE[f.posY.Entity]) { + this.eMovingThing[skull.getUUID().toString()].timeTook = Date.now() - this.eMovingThing[skull.getUUID().toString()].startMovingTime; + } else if (!this.eMovingThing[skull.getUUID().toString()].logged && (skullE[f.isDead] || !skullE[m.getEquipmentInSlot](4) || !skullE[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().endsWith(getSkullName()))) { + this.eMovingThing[skull.getUUID().toString()].logged = true; + this.spawnIdThing++; + + delete this.eMovingThing[skull.getUUID().toString()]; + this.skulls = this.skulls.filter((e) => { + if (e.getUUID().toString() === skull.getUUID().toString()) { + return false; + } + return true; + }); + return; + } + + this.eMovingThing[skull.getUUID().toString()].lastX = skullE[f.posX.Entity]; + this.eMovingThing[skull.getUUID().toString()].lastY = skullE[f.posY.Entity]; - // let mX = e.getMotionX() - // let mY = e.getMotionY() - // let mZ = e.getMotionZ() + if (!this.startSpawningTime) this.startSpawningTime = Date.now(); + } + + if (this.eMovingThing[skull.getUUID().toString()] && this.eMovingThing[skull.getUUID().toString()].timeTook) { + let startPoint = [skullE[f.posX.Entity], skullE[f.posY.Entity], skullE[f.posZ.Entity]]; + + let xSpeed2 = (startPoint[0] - this.eMovingThing[skull.getUUID().toString()].startX) / this.eMovingThing[skull.getUUID().toString()].timeTook; + let ySpeed2 = (startPoint[1] - this.eMovingThing[skull.getUUID().toString()].startY) / this.eMovingThing[skull.getUUID().toString()].timeTook; + let zSpeed2 = (startPoint[2] - this.eMovingThing[skull.getUUID().toString()].startZ) / this.eMovingThing[skull.getUUID().toString()].timeTook; + + let time = (this.spawnIdThing >= 4 ? 2900 : 4875) - this.eMovingThing[skull.getUUID().toString()].timeTook; + let endPoint = [startPoint[0] + xSpeed2 * time, startPoint[1] + ySpeed2 * time, startPoint[2] + zSpeed2 * time]; + + this.eMovingThing[skull.getUUID().toString()].endPointLast = this.eMovingThing[skull.getUUID().toString()].endPoint; + this.eMovingThing[skull.getUUID().toString()].endPoint = endPoint; + this.eMovingThing[skull.getUUID().toString()].endPointUpdated = Date.now(); + + // if(this.eMovingThing[skull.getUUID().toString()] && this.eMovingThing[skull.getUUID().toString()].timeTook){ + // Tessellator.drawString((time/1000).toFixed(3)+"s", endPoint[0], endPoint[1]+2, endPoint[2]) + // } + } + }); + } + + if (this.blazeX !== -1) { + this.blazes = this.blazes.filter((e) => !e.getEntity()[f.isDead]); - // for(let i = 0;i<100;i++){ - // x+=mX - // y+=mY - // z+=mZ + this.blazes.sort((a, b) => a.getEntity().func_110143_aJ() - b.getEntity().func_110143_aJ()); + if ( + World.getBlockAt(this.blazeX + 17 - 43, 18, this.blazeY + 16 - 43) + .getType() + .getID() === 9 + ) { + this.blazes = this.blazes.reverse(); + } + } + + // this.arrows = this.arrows.filter(e=>{ + // let x = e.getX() + // let y = e.getY() + // let z = e.getZ() + + // let mX = e.getMotionX() + // let mY = e.getMotionY() + // let mZ = e.getMotionZ() + + // for(let i = 0;i<100;i++){ + // x+=mX + // y+=mY + // z+=mZ - // mX*=0.99 - // mY*=0.99 - // mZ*=0.99 + // mX*=0.99 + // mY*=0.99 + // mZ*=0.99 - // mY-=0.05 + // mY-=0.05 - // this.blazes = this.blazes.filter(e1=>{ - // let boundingBox = e1.getEntity().func_174813_aQ() + // this.blazes = this.blazes.filter(e1=>{ + // let boundingBox = e1.getEntity().func_174813_aQ() - // if(boundingBox.intersectsWith(new AxisAlignedBB(x-e.getEntity().field_70130_N/2,y,z-e.getEntity().field_70130_N/2,x+e.getEntity().field_70130_N/2,y+e.getEntity().field_70131_O,z+e.getEntity().field_70130_N/2))){ - // return false - // } - // return true - // }) - - // if(World.getBlockAt(x, y, z).getType().getID() !== 0){ - // break; - // } - // } + // if(boundingBox.intersectsWith(new AxisAlignedBB(x-e.getEntity().field_70130_N/2,y,z-e.getEntity().field_70130_N/2,x+e.getEntity().field_70130_N/2,y+e.getEntity().field_70131_O,z+e.getEntity().field_70130_N/2))){ + // return false + // } + // return true + // }) - // return !e.getEntity()[f.isDead] - // }) + // if(World.getBlockAt(x, y, z).getType().getID() !== 0){ + // break; + // } + // } - if(this.spiritBearSpawnTimer.getValue() && (this.FeatureManager.features["dataLoader"].class.dungeonFloor === "F4" || this.FeatureManager.features["dataLoader"].class.dungeonFloor === "M4")){ - let id = World.getBlockAt(7, 77, 34).type.getID() + // return !e.getEntity()[f.isDead] + // }) - if((!this.bearSpawning || (this.bearSpawning<0 && this.bearSpawning>-Date.now()+500)) && id === 169){ - this.bearSpawning = Date.now()+3500 + if (this.spiritBearSpawnTimer.getValue() && (this.FeatureManager.features["dataLoader"].class.dungeonFloor === "F4" || this.FeatureManager.features["dataLoader"].class.dungeonFloor === "M4")) { + let id = World.getBlockAt(7, 77, 34).type.getID(); + + if ((!this.bearSpawning || (this.bearSpawning < 0 && this.bearSpawning > -Date.now() + 500)) && id === 169) { + this.bearSpawning = Date.now() + 3500; + } } } - } - - addSkull(skull) { - if (this.bloodX !== -1) { - let xA = (skull.getX()+8) - ((skull.getX()+8) % 32); - let yA = (skull.getZ()+8) - ((skull.getZ()+8) % 32); - - if (xA !== this.bloodX || yA !== this.bloodY) return; - } else { - if (skull.getEntity()[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().trim() === getPlayerHeadName().replace("%s",Player.getName())) { - this.bloodX = (skull.getX()+8) - ((skull.getX()+8) % 32); - this.bloodY = (skull.getZ()+8) - ((skull.getZ()+8) % 32); - this.skulls = []; - World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach((e) => { - if (e.getEntity()[m.getEquipmentInSlot](4) && e.getEntity()[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().endsWith(getSkullName())) { - this.addSkull(e); - } - }); - } - return; - } - this.skulls.push(skull); - } - - addBlaze(blaze){ - if(!this.FeatureManager.features["dataLoader"].class.dungeonFloor) return - if(this.blazeX === -1){ - this.blazes.push(blaze) - let locs = {} - - this.blazes.forEach(b=>{ - if(!locs[((b.getX()+8)-((b.getX()+8)%32))+"_"+((b.getZ()+8)-((b.getZ()+8)%32))])locs[((b.getX()+8)-((b.getX()+8)%32))+"_"+((b.getZ()+8)-((b.getZ()+8)%32))] = 0 - locs[((b.getX()+8)-((b.getX()+8)%32))+"_"+((b.getZ()+8)-((b.getZ()+8)%32))]++ - }) - - Object.keys(locs).forEach(k=>{ - if(locs[k] === 4){ - [this.blazeX, this.blazeY] = k.split("_").map(a=>~~a) + + addSkull(skull) { + if (this.bloodX !== -1) { + let xA = skull.getX() + 8 - ((skull.getX() + 8) % 32); + let yA = skull.getZ() + 8 - ((skull.getZ() + 8) % 32); + + if (xA !== this.bloodX || yA !== this.bloodY) return; + } else { + if (skull.getEntity()[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().trim() === getPlayerHeadName().replace("%s", Player.getName())) { + this.bloodX = skull.getX() + 8 - ((skull.getX() + 8) % 32); + this.bloodY = skull.getZ() + 8 - ((skull.getZ() + 8) % 32); + this.skulls = []; + World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach((e) => { + if (e.getEntity()[m.getEquipmentInSlot](4) && e.getEntity()[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().endsWith(getSkullName())) { + this.addSkull(e); + } + }); + } + return; + } + this.skulls.push(skull); + } + + addBlaze(blaze) { + if (!this.FeatureManager.features["dataLoader"].class.dungeonFloor) return; + if (this.blazeX === -1) { + this.blazes.push(blaze); + let locs = {}; + + this.blazes.forEach((b) => { + if (!locs[b.getX() + 8 - ((b.getX() + 8) % 32) + "_" + (b.getZ() + 8 - ((b.getZ() + 8) % 32))]) locs[b.getX() + 8 - ((b.getX() + 8) % 32) + "_" + (b.getZ() + 8 - ((b.getZ() + 8) % 32))] = 0; + locs[b.getX() + 8 - ((b.getX() + 8) % 32) + "_" + (b.getZ() + 8 - ((b.getZ() + 8) % 32))]++; + }); + + Object.keys(locs).forEach((k) => { + if (locs[k] === 4) { + [this.blazeX, this.blazeY] = k.split("_").map((a) => ~~a); } - }) + }); - if(this.blazeX !== -1){ - this.blazes = [] - World.getAllEntitiesOfType(EntityBlaze).forEach((e)=>{ - if((e.getX()+8)-(e.getX()+8)%32 === this.blazeX && (e.getZ()+8)-(e.getZ()+8)%32 === this.blazeY){ - this.blazes.push(e) + if (this.blazeX !== -1) { + this.blazes = []; + World.getAllEntitiesOfType(EntityBlaze).forEach((e) => { + if (e.getX() + 8 - ((e.getX() + 8) % 32) === this.blazeX && e.getZ() + 8 - ((e.getZ() + 8) % 32) === this.blazeY) { + this.blazes.push(e); } - }) + }); } - }else{ - if((blaze.getX()+8)-(blaze.getX()+8)%32 === this.blazeX && (blaze.getZ()+8)-(blaze.getZ()+8)%32 === this.blazeY){ - this.blazes.push(blaze) - this.blazes.sort((a, b)=>a.getEntity().func_110143_aJ()-b.getEntity().func_110143_aJ()) - if(World.getBlockAt(this.blazeX+17-43, 18, this.blazeY+16-43).getType().getID() === 9){ - this.blazes = this.blazes.reverse() + } else { + if (blaze.getX() + 8 - ((blaze.getX() + 8) % 32) === this.blazeX && blaze.getZ() + 8 - ((blaze.getZ() + 8) % 32) === this.blazeY) { + this.blazes.push(blaze); + this.blazes.sort((a, b) => a.getEntity().func_110143_aJ() - b.getEntity().func_110143_aJ()); + if ( + World.getBlockAt(this.blazeX + 17 - 43, 18, this.blazeY + 16 - 43) + .getType() + .getID() === 9 + ) { + this.blazes = this.blazes.reverse(); } } } } - step() { - //2fps - if (this.lividFindEnabled.getValue() && (this.FeatureManager.features["dataLoader"].class.dungeonFloor === "F5" || this.FeatureManager.features["dataLoader"].class.dungeonFloor === "M5")) { - let type = World.getBlockAt(3, 108, 30).getMetadata(); - - let typeReplace = { - 0: "Vendetta", - 2: "Crossed", - 4: "Arcade", - 5: "Smile", - 6: "Crossed", - 7: "Doctor", - 8: "Doctor", - 10: "Purple", - 11: "Scream", - 13: "Frog", - 14: "Hockey", - }; - - World.getAllEntities().forEach((entity) => { - let entityName = entity.getName(); - - if (entityName.includes("Livid") && entityName.includes("❤")) { - // ChatLib.chat("D: " + entityName.substr(1, 1) + " asd " + this.lividData.lividColor[typeReplace[type]].split("").pop()) - if (entityName.substr(1, 1) === this.lividData.lividColor[typeReplace[type]].split("").pop()) { - this.lividHpElement.setText(entityName); - this.lividData.correctLividEntity = entity; - } - } - }); - } - - if (this.lividData.correctLividEntity) { - if (!this.renderEntityEvent) { - this.renderEntityEvent = this.registerEvent("renderEntity", this.renderEntity); - } - } else { - if (this.renderEntityEvent) { - this.unregisterEvent(this.renderEntityEvent); - this.renderEntityEvent = undefined; - } - } - - this.spiritBowPickUps = this.spiritBowPickUps.filter((pickUp) => Date.now() - pickUp < 20000); - if (this.spiritBowPickUps[0]) { - this.spiritBowDestroyElement.setText("&dBow Destroyed in: &c" + Math.round((this.spiritBowPickUps[0] + 20000 - Date.now()) / 1000) + "s"); - } else { - this.spiritBowDestroyElement.setText(""); - } - // this.spiritBowPickUps - if (this.bloodCampAssist.getValue()) { - this.todoE.forEach((e) => { - let en = new Entity(e); - // console.log(en.getName()) - if (en.getName().trim() === getArmorStandName() && e[m.getEquipmentInSlot](4) && e[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().endsWith(getSkullName())) { - this.addSkull(en); - } - }); - - this.todoE = []; - - if (Date.now() - this.lastPingCheck > 60000 * 30 || (Date.now() - this.lastPingCheck > 60000 && this.lastPings.includes(undefined)) && this.bloodX!== -1) { - this.lastPingCheck = Date.now(); - ChatLib.command("whereami"); - this.checkingPing = true; - } - } - - let averageExp = this.lastDungExps.reduce((a, b) => a + b, 0) / this.lastDungExps.length; - let averageLength = (this.lastDungFinishes[this.lastDungFinishes.length - 1] - this.lastDungFinishes[0]) / (this.lastDungFinishes.length - 1); - let runsperHour = (60000 * 60) / averageLength; - let expPerHour = averageExp * runsperHour; - - if (Date.now() - this.lastDungFinishes[this.lastDungFinishes.length - 1] < 60000 * 5 || this.FeatureManager.features["dataLoader"].class.dungeonFloor) { - if (this.lastDungFinishes.length > 1) { - this.runSpeedRatesElement.setText("&6Run speed&7> &f" + Math.floor(averageLength / 60000) + ":" + ((Math.floor(averageLength / 1000) % 60 < 10 ? "0" : "") + (Math.floor(averageLength / 1000) % 60)) + "\n&6Exp/hour&7> &f" + numberWithCommas(Math.round(expPerHour)) + "\n&6Runs/hour&7> &f" + Math.floor(runsperHour)); - } else { - this.runSpeedRatesElement.setText("&6Run speed&7> &fLoading...\n&6Exp/hour&7> &fLoading...\n&6Runs/hour&7> &fLoading..."); - } - } else { - this.runSpeedRatesElement.setText(""); - } - } - - initVariables() { - this.lividFindEnabled = undefined; - this.lividData = undefined; - this.hudElements = []; - } - - onDisable() { - this.initVariables(); - } + step() { + this.failedPuzzleCount = 0; + this.totalPuzzleCount = 0; + this.completedPuzzleCount = 0; + TabList.getNames().forEach((n) => { + let name = ChatLib.removeFormatting(n).trim().split(" "); + let end = name.pop(); + // console.log(end) Water Board: [✔] + if (end !== "[✦]" && end !== "[✔]" && end !== "[✖]") { + end = name.pop(); + // console.log(end) Water Board: [✔] + if (end !== "[✦]" && end !== "[✔]" && end !== "[✖]") return; + } + this.totalPuzzleCount++; + if (end === "[✖]") this.failedPuzzleCount++; + if (end === "[✔]") this.completedPuzzleCount++; + }); + + if (this.lividFindEnabled.getValue() && (this.FeatureManager.features["dataLoader"].class.dungeonFloor === "F5" || this.FeatureManager.features["dataLoader"].class.dungeonFloor === "M5")) { + let type = World.getBlockAt(3, 108, 30).getMetadata(); + + let typeReplace = { + 0: "Vendetta", + 2: "Crossed", + 4: "Arcade", + 5: "Smile", + 6: "Crossed", + 7: "Doctor", + 8: "Doctor", + 10: "Purple", + 11: "Scream", + 13: "Frog", + 14: "Hockey", + }; + + World.getAllEntities().forEach((entity) => { + let entityName = entity.getName(); + + if (entityName.includes("Livid") && entityName.includes("❤")) { + // ChatLib.chat("D: " + entityName.substr(1, 1) + " asd " + this.lividData.lividColor[typeReplace[type]].split("").pop()) + if (entityName.substr(1, 1) === this.lividData.lividColor[typeReplace[type]].split("").pop()) { + this.lividHpElement.setText(entityName); + this.lividData.correctLividEntity = entity; + } + } + }); + } + + if (this.lividData.correctLividEntity) { + if (!this.renderEntityEvent) { + this.renderEntityEvent = this.registerEvent("renderEntity", this.renderEntity); + } + } else { + if (this.renderEntityEvent) { + this.unregisterEvent(this.renderEntityEvent); + this.renderEntityEvent = undefined; + } + } + + this.spiritBowPickUps = this.spiritBowPickUps.filter((pickUp) => Date.now() - pickUp < 20000); + if (this.spiritBowPickUps[0]) { + this.spiritBowDestroyElement.setText("&dBow Destroyed in: &c" + Math.round((this.spiritBowPickUps[0] + 20000 - Date.now()) / 1000) + "s"); + } else { + this.spiritBowDestroyElement.setText(""); + } + // this.spiritBowPickUps + if (this.bloodCampAssist.getValue()) { + this.todoE.forEach((e) => { + let en = new Entity(e); + // console.log(en.getName()) + if (en.getName().trim() === getArmorStandName() && e[m.getEquipmentInSlot](4) && e[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().endsWith(getSkullName())) { + this.addSkull(en); + } + }); + + this.todoE = []; + + if (Date.now() - this.lastPingCheck > 60000 * 30 || (Date.now() - this.lastPingCheck > 60000 && this.lastPings.includes(undefined) && this.bloodX !== -1)) { + this.lastPingCheck = Date.now(); + ChatLib.command("whereami"); + this.checkingPing = true; + } + } + + let averageExp = this.lastDungExps.reduce((a, b) => a + b, 0) / this.lastDungExps.length; + let averageLength = (this.lastDungFinishes[this.lastDungFinishes.length - 1] - this.lastDungFinishes[0]) / (this.lastDungFinishes.length - 1); + let runsperHour = (60000 * 60) / averageLength; + let expPerHour = averageExp * runsperHour; + + if (Date.now() - this.lastDungFinishes[this.lastDungFinishes.length - 1] < 60000 * 5 || this.FeatureManager.features["dataLoader"].class.dungeonFloor) { + if (this.lastDungFinishes.length > 1) { + this.runSpeedRatesElement.setText("&6Run speed&7> &f" + Math.floor(averageLength / 60000) + ":" + ((Math.floor(averageLength / 1000) % 60 < 10 ? "0" : "") + (Math.floor(averageLength / 1000) % 60)) + "\n&6Exp/hour&7> &f" + numberWithCommas(Math.round(expPerHour)) + "\n&6Runs/hour&7> &f" + Math.floor(runsperHour)); + } else { + this.runSpeedRatesElement.setText("&6Run speed&7> &fLoading...\n&6Exp/hour&7> &fLoading...\n&6Runs/hour&7> &fLoading..."); + } + } else { + this.runSpeedRatesElement.setText(""); + } + } + + initVariables() { + this.lividFindEnabled = undefined; + this.lividData = undefined; + this.hudElements = []; + } + + onDisable() { + this.initVariables(); + } } module.exports = { - class: new DungeonSolvers(), + class: new DungeonSolvers(), }; - -function getSkullName(){ - if(translate){ - return translate.func_74805_b("item.skull.char.name") +function getSkullName() { + if (translate) { + return translate.func_74805_b("item.skull.char.name"); } - return "Head" + return "Head"; } -function getPlayerHeadName(){ - if(translate){ - return translate.func_74805_b("item.skull.player.name") +function getPlayerHeadName() { + if (translate) { + return translate.func_74805_b("item.skull.player.name"); } - return "%s's Head" + return "%s's Head"; } -function getArmorStandName(){ - if(translate){ - return translate.func_74805_b("item.armorStand.name") +function getArmorStandName() { + if (translate) { + return translate.func_74805_b("item.armorStand.name"); } - return "Armor Stand" -} \ No newline at end of file + return "Armor Stand"; +} diff --git a/features/globalSettings/firstLoadPage.js b/features/globalSettings/firstLoadPage.js index 429c867..d38f927 100644 --- a/features/globalSettings/firstLoadPage.js +++ b/features/globalSettings/firstLoadPage.js @@ -17,6 +17,7 @@ class FirstLoadPage extends SoopyGuiElement { backButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ this.guiPage.prevPage() + this.guiPage.closeSidebarPage() })) this.addChild(backButton) @@ -26,6 +27,7 @@ class FirstLoadPage extends SoopyGuiElement { nextButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ this.guiPage.nextPage() + this.guiPage.closeSidebarPage() })) this.addChild(nextButton) diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 14f51bd..604f887 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -40,9 +40,8 @@ class Hud extends Feature { 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.sendChatSetting = new ToggleSetting("Send (hashed) chat messages to soopy server", "This will allow the hide spam feature to detect messages that are spam", false, "privacy_send_chat", this) - - this.privacySettings = [this.reportErrorsSetting, this.sendChatSetting] + + this.privacySettings = [this.reportErrorsSetting] this.firstLoadPageData = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2firstloaddata.json") || "{}") || {} diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js index be9e4ee..d2a2c91 100644 --- a/features/hud/HudTextElement.js +++ b/features/hud/HudTextElement.js @@ -1,5 +1,5 @@ -class HudTextElement{ - constructor(){ +class HudTextElement { + constructor() { this.text = "" this.toggleSetting = undefined @@ -14,104 +14,123 @@ class HudTextElement{ this.editBaseHeight = undefined this.tempDisableTime = 0 + + this.renderTextCache = [[""], [""]] + this.textChanged = false } - setBaseEditWidth(width){ + setBaseEditWidth(width) { this.editBaseWidth = width return this } - setBaseEditHeight(height){ + setBaseEditHeight(height) { this.editBaseHeight = height return this } - setText(text){ + setText(text = "") { this.text = text - - if(this.locationSetting && this.locationSetting.shadowType === 2){ + + if (this.locationSetting && this.locationSetting.shadowType === 2) { this.blackText = "&0" + ChatLib.removeFormatting(text) } + + this.renderTextCache = [this.text.split("\n"), this.blackText.split("\n")] return this } - setToggleSetting(setting){ + setToggleSetting(setting) { this.toggleSetting = setting return this } - setLocationSetting(setting){ + setLocationSetting(setting) { this.locationSetting = setting setting.setParent(this) - if(this.locationSetting.shadowType === 2){ + if (this.locationSetting.shadowType === 2) { this.blackText = "&0" + ChatLib.removeFormatting(text) } return this } - isEnabled(){ - if(!this.toggleSetting) return true + isEnabled() { + if (!this.toggleSetting) return true return this.locationSetting && this.toggleSetting.getValue() } - render(){ - if(this.toggleSetting && !this.toggleSetting.getValue() || !this.locationSetting) return - if(Date.now()-this.tempDisableTime < 100) return + render() { + if (this.toggleSetting && !this.toggleSetting.getValue() || !this.locationSetting) return + if (Date.now() - this.tempDisableTime < 100) return this.renderRaw() } - getWidth(locationBox=false){ - if(locationBox && this.editBaseWidth) return this.editBaseWidth - return Math.max(...(this.getText()[0].map(a=>Renderer.getStringWidth(ChatLib.removeFormatting(a))))) + getWidth(locationBox = false) { + if (locationBox && this.editBaseWidth) return this.editBaseWidth + return Math.max(...(this.getText()[0].map(a => Renderer.getStringWidth(ChatLib.removeFormatting(a))))) } - getHeight(locationBox=false){ - if(locationBox && this.editBaseHeight) return this.editBaseHeight - return 9*this.getText()[0].length + getHeight(locationBox = false) { + if (locationBox && this.editBaseHeight) return this.editBaseHeight + return 9 * this.getText()[0].length } - getText(){ - let text = this.text - let blackText = this.blackText - if(Date.now()-this.editTempTimeV < 100){ - if(this.editTempTextV){ + getText() { + if (Date.now() - this.editTempTimeV < 100) { + let text = this.text + if (this.editTempTextV) { text = this.editTempTextV - blackText = "&0" + ChatLib.removeFormatting(text) } - - if(ChatLib.removeFormatting(text) === ""){ + + if (ChatLib.removeFormatting(text) === "") { text = "&0Empty string" + } + + return text.split("\n") + } + return this.renderTextCache + } + + getBlackText() { + if (Date.now() - this.editTempTimeV < 100) { + let text = this.text + let blackText = this.blackText + if (this.editTempTextV) { + text = this.editTempTextV + blackText = "&0" + ChatLib.removeFormatting(text) + } + + if (ChatLib.removeFormatting(text) === "") { blackText = "&0Empty string" } + + return blackText.split("\n") } - return [text.split("\n"), blackText.split("\n")] + return this.renderBlackTextCache } - renderRaw(){ - try{ - let [text, blackText] = 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) + renderRaw() { + 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) + case 1: + Renderer.drawStringWithShadow(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i) break; - case 2: - 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) + 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; - } - }) - Renderer.scale(1, 1) - }catch(e){ //incase of wrong opengl context - } + } + }) } } diff --git a/features/hud/index.js b/features/hud/index.js index 823f489..27d12e5 100644 --- a/features/hud/index.js +++ b/features/hud/index.js @@ -19,8 +19,8 @@ class Hud extends Feature { super() } - initVariables(){ - + initVariables() { + this.hudElements = [] this.fpsElement = undefined @@ -30,21 +30,21 @@ class Hud extends Feature { this.fpsEnabledSetting = undefined this.cpsEnabledSetting = undefined this.soulflowEnabledSetting = undefined - this.soulflowShowWarningSetting=undefined - this.soulflowShowWhen0Setting=undefined - this.petEnabledSetting=undefined + this.soulflowShowWarningSetting = undefined + this.soulflowShowWhen0Setting = undefined + this.petEnabledSetting = undefined this.fpsFastSetting = undefined this.fpsLowSetting = undefined - this.cpsSeperate =undefined - this.cpsIncludeRight =undefined - + this.cpsSeperate = undefined + this.cpsIncludeRight = undefined + this.petLevels = undefined this.lastTickTime = undefined this.framesSince = undefined this.lastframe = undefined this.Instant = undefined - + this.lastFrameRates = undefined this.fps = undefined @@ -63,7 +63,7 @@ class Hud extends Feature { this.impactTest = undefined } - onEnable(){ + onEnable() { this.initVariables() this.numberUtils = require("../../utils/numberUtils.js") @@ -95,7 +95,7 @@ class Hud extends Feature { .requires(this.petEnabledSetting) .editTempText("&6Pet&7> &7[Lvl 100] &aEnderman")) this.hudElements.push(this.petElement) - + this.soulflowEnabledSetting = new ToggleSetting("Show Soulflow", "Whether the soulflow count is rendered onto the screen", true, "soulflow_enabled", this) this.soulflowShowWarningSetting = new ToggleSetting("Show no Talisman Warning", "Shows a warning if you dont have a soulflow talis in ur inv", true, "soulflow_notalis_warning", this).requires(this.soulflowEnabledSetting) this.soulflowShowWhen0Setting = new ToggleSetting("Show When 0 Soulflow", "If this is off it wont render when you have 0 soulflow", true, "soulflow_showwhen_0", this).requires(this.soulflowEnabledSetting) @@ -109,18 +109,18 @@ class Hud extends Feature { this.witherImpactCooldownSetting = new ToggleSetting("Show Wither Impact Cooldown", "This will render a small cooldown above your crosshair", true, "wither_impact_cooldown_enabled", this) this.guidedSheepCooldownSetting = new ToggleSetting("Show Guided Sheep / Explosive Shot Cooldown", "This will render a small cooldown below your crosshair", true, "guided_sheep_cooldown_enabled", this) - + this.showSpotifyPlaying = new ToggleSetting("Show Current Playing Spotify Song", "(WINDOWS + Spotify Desktop only)", false, "spotify_now_playing", this) this.spotifyElement = new HudTextElement() .setText("&6Spotify&7> ") - .setBaseEditWidth(Renderer.getStringWidth("Spotify> ")+150) + .setBaseEditWidth(Renderer.getStringWidth("Spotify> ") + 150) .setToggleSetting(this.showSpotifyPlaying) .setLocationSetting(new LocationSetting("Spotify Location", "Allows you to edit the location of the spotify text", "spotify_now_playing_location", this, [10, 80, 1, 1]) .requires(this.showSpotifyPlaying) .editTempText("&6Spotify&7> &cNot open")) this.spotifyElement2 = new HudTextElement().setToggleSetting(this.showSpotifyPlaying).setLocationSetting({ - setParent: ()=>{}, - x: this.spotifyElement.locationSetting.x+this.spotifyElement.getWidth(), + setParent: () => { }, + x: this.spotifyElement.locationSetting.x + this.spotifyElement.getWidth(), y: this.spotifyElement.locationSetting.y, scale: this.spotifyElement.locationSetting.scale, shadowType: this.spotifyElement.locationSetting.shadowType @@ -147,29 +147,29 @@ class Hud extends Feature { }) hudStatTypes.completions_enterance = "Enterance completions" - for(let i = 1;i<8;i++){ - hudStatTypes["completions_floor_"+i] = "Floor " + i + " completions" + for (let i = 1; i < 8; i++) { + hudStatTypes["completions_floor_" + i] = "Floor " + i + " completions" } - for(let i = 1;i<8;i++){ - hudStatTypes["completions_master_"+i] = "Master " + i + " completions" + for (let i = 1; i < 8; i++) { + hudStatTypes["completions_master_" + i] = "Master " + i + " completions" } - for(let i = 1;i<8;i++){ - hudStatTypes["completions_dungeon_"+i] = "Dungeon " + i + " completions" + for (let i = 1; i < 8; i++) { + hudStatTypes["completions_dungeon_" + i] = "Dungeon " + i + " completions" } this.hudStat = [] - for(let i = 0;i<5;i++){ + for (let i = 0; i < 5; i++) { this.hudStat[i] = {} - this.hudStat[i].enabled = new ToggleSetting("Hud Stat Slot #"+(i+1), "Allows you to render a custom stat on your hud", false, "hud_stat_"+i, this) - this.hudStat[i].type = new DropdownSetting("Hud Stat Slot #" + (i + 1) + " Type", "The type of stat to render", "weight" , "hud_stat_" + i + "_type", this, hudStatTypes) - this.hudStat[i].location = new LocationSetting("Hud Stat Slot #"+(i+1)+" Location", "Allows you to edit the location of the hud stat", "hud_stat_"+i+"_location", this, [10, 50+i*10, 1, 1]).editTempText("&6Hud Stat&7> &f12,345") + this.hudStat[i].enabled = new ToggleSetting("Hud Stat Slot #" + (i + 1), "Allows you to render a custom stat on your hud", false, "hud_stat_" + i, this) + this.hudStat[i].type = new DropdownSetting("Hud Stat Slot #" + (i + 1) + " Type", "The type of stat to render", "weight", "hud_stat_" + i + "_type", this, hudStatTypes) + this.hudStat[i].location = new LocationSetting("Hud Stat Slot #" + (i + 1) + " Location", "Allows you to edit the location of the hud stat", "hud_stat_" + i + "_location", this, [10, 50 + i * 10, 1, 1]).editTempText("&6Hud Stat&7> &f12,345") this.hudStat[i].textElement = new HudTextElement().setToggleSetting(this.hudStat[i].enabled).setLocationSetting(this.hudStat[i].location).setText("&6Hud Stat&7> &fLoading...") - this.hudStat[i].onlySb = new ToggleSetting("Hud Stat Slot #"+(i+1)+" Only SB", "Only render this stat when you are in skyblock", true, "hud_stat_"+i+"_only_sb", this).requires(this.hudStat[i].enabled) + this.hudStat[i].onlySb = new ToggleSetting("Hud Stat Slot #" + (i + 1) + " Only SB", "Only render this stat when you are in skyblock", true, "hud_stat_" + i + "_only_sb", this).requires(this.hudStat[i].enabled) this.hudStat[i].location.requires(this.hudStat[i].enabled) this.hudStat[i].type.requires(this.hudStat[i].enabled) - if(this.hudStat[i-1]){ - this.hudStat[i].enabled.requires(this.hudStat[i-1].enabled) + if (this.hudStat[i - 1]) { + this.hudStat[i].enabled.requires(this.hudStat[i - 1].enabled) } } @@ -201,8 +201,8 @@ class Hud extends Feature { this.lastStatData = undefined - this.lastFrameRates = [0,0,0,0,0,0,0,0,0,0] - this.lastFrameRatesS = [0,0,0,0,0,0,0,0,0,0] + this.lastFrameRates = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + this.lastFrameRatesS = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] this.Instant = Java.type("java.time.Instant"); @@ -218,43 +218,43 @@ class Hud extends Feature { this.petLevels = {} this.petText = "&6Pet&7> &fLoading..." this.petElement.setText(this.petText) - this.registerChat("&cAutopet &eequipped your ${pet}&e! &a&lVIEW RULE&r", (pet)=>{ - this.petElement.setText("&6Pet&7> "+pet) - this.petText = "&6Pet&7> "+pet + this.registerChat("&cAutopet &eequipped your ${pet}&e! &a&lVIEW RULE&r", (pet) => { + this.petElement.setText("&6Pet&7> " + pet) + this.petText = "&6Pet&7> " + pet this.lastSwappedPet = Date.now() }) - this.registerChat("&r&aYou summoned your &r${pet}&r&a!&r", (pet)=>{ - this.petElement.setText("&6Pet&7> &7[Lvl " + (this.petLevels[pet.replace("&", "§")]||"??") +"] "+pet) - this.petText = "&6Pet&7> &7[Lvl " + (this.petLevels[pet.replace("&", "§")]||"??") +"] "+pet + this.registerChat("&r&aYou summoned your &r${pet}&r&a!&r", (pet) => { + this.petElement.setText("&6Pet&7> &7[Lvl " + (this.petLevels[pet.replace("&", "§")] || "??") + "] " + pet) + this.petText = "&6Pet&7> &7[Lvl " + (this.petLevels[pet.replace("&", "§")] || "??") + "] " + pet this.lastSwappedPet = Date.now() }) - this.registerChat("&r&aYou despawned your &r${*}&r&a!&r", ()=>{ + this.registerChat("&r&aYou despawned your &r${*}&r&a!&r", () => { this.petElement.setText("&6Pet&7> &cNone") this.petText = "&6Pet&7> &cNone" this.lastSwappedPet = Date.now() }) - this.registerChat("&r&aYour &r${pet} &r&alevelled up to level &r&9${level}&r&a!&r", (pet, level)=>{ - this.petElement.setText("&6Pet&7> &7[Lvl " + (level||"??") +"] "+pet) - this.petText = "&6Pet&7> &7[Lvl " + (level||"??") +"] "+pet + this.registerChat("&r&aYour &r${pet} &r&alevelled up to level &r&9${level}&r&a!&r", (pet, level) => { + this.petElement.setText("&6Pet&7> &7[Lvl " + (level || "??") + "] " + pet) + this.petText = "&6Pet&7> &7[Lvl " + (level || "??") + "] " + pet this.lastSwappedPet = Date.now() }) this.registerSoopy("apiLoad", this.apiLoad) - if(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock){ + if (this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock) { this.apiLoad(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock, "skyblock", true, true) this.lastSwappedPet = Date.now() } - if(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw){ + if (this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw) { this.apiLoad(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock_raw, "skyblock", false, true) } - new Thread(()=>{ //TODO: dont create this thread if you have the feature disabled - while(this.enabled){ + new Thread(() => { //TODO: dont create this thread if you have the feature disabled + while (this.enabled) { this.updateSpotify() Thread.sleep(5000) } @@ -263,7 +263,7 @@ class Hud extends Feature { this.registerActionBar("${m}", this.actionbarMessage) } - onDisable(){ + onDisable() { this.fpsEnabledSetting.delete() this.fpsFastSetting.delete() this.cpsEnabledSetting.delete() @@ -271,140 +271,138 @@ class Hud extends Feature { this.initVariables() } - renderHud(){ - - if(this.fpsFastSetting.getValue()){ - if(this.fpsLowSetting.getValue()){ + renderHud() { + if (this.fpsFastSetting.getValue()) { + if (this.fpsLowSetting.getValue()) { this.fpsElement.setText("&6Fps&7> &f" + Math.round(this.fps.get()) + "&7/" + Math.round(this.lowFps.get())) - }else{ + } else { this.fpsElement.setText("&6Fps&7> &f" + Math.round(this.fps.get())) } } - for(let element of this.hudElements){ + for (let element of this.hudElements) { element.render() } - if(this.showSpotifyPlaying.getValue() && Date.now()-this.spotifyElement.tempDisableTime > 100){ + if (this.showSpotifyPlaying.getValue() && Date.now() - this.spotifyElement.tempDisableTime > 100) { let scale = this.spotifyElement.locationSetting.scale - let spotifyWidth1 = this.spotifyElement.getWidth()*scale + let spotifyWidth1 = this.spotifyElement.getWidth() * scale this.spotifyElement.render() - this.spotifyElement2.locationSetting.x = this.spotifyElement.locationSetting.x+spotifyWidth1 + this.spotifyElement2.locationSetting.x = this.spotifyElement.locationSetting.x + spotifyWidth1 this.spotifyElement2.locationSetting.y = this.spotifyElement.locationSetting.y this.spotifyElement2.locationSetting.scale = scale - this.spotifyElement2.locationSetting.shadowType = this.spotifyElement.locationSetting.shadowType - - let spotifyWidth2 = this.spotifyElement2.getWidth()*scale - if(spotifyWidth2>150*scale){ - let w2 = spotifyWidth2/scale-150 - let offX = (Date.now()/50)%(w2*2+100) - offX=Math.max(0,offX-50) - if(offX>w2+50){ - offX = w2-(offX-w2-50) - }else if(offX>w2){ + this.spotifyElement2.locationSetting.shadowType = this.spotifyElement.locationSetting.shadowType + + let spotifyWidth2 = this.spotifyElement2.getWidth() * scale + if (spotifyWidth2 > 150 * scale) { + let w2 = spotifyWidth2 / scale - 150 + let offX = (Date.now() / 50) % (w2 * 2 + 100) + offX = Math.max(0, offX - 50) + if (offX > w2 + 50) { + offX = w2 - (offX - w2 - 50) + } else if (offX > w2) { offX = w2 } - this.spotifyElement2.locationSetting.x = this.spotifyElement.locationSetting.x+spotifyWidth1-offX*scale - - renderLibs.scizzorFast(this.spotifyElement.locationSetting.x+spotifyWidth1, this.spotifyElement2.locationSetting.y, 150*scale, this.spotifyElement2.getHeight()*scale) + this.spotifyElement2.locationSetting.x = this.spotifyElement.locationSetting.x + spotifyWidth1 - offX * scale + + renderLibs.scizzorFast(this.spotifyElement.locationSetting.x + spotifyWidth1, this.spotifyElement2.locationSetting.y, 150 * scale, this.spotifyElement2.getHeight() * scale) this.spotifyElement2.render() renderLibs.stopScizzor() - }else{ + } else { this.spotifyElement2.render() } } - if (this.witherImpactCooldownSetting.getValue() && Date.now()-this.lastWitherImpact < 10000) { - Renderer.drawString(Math.max(0,Math.ceil((5000-(Date.now()-this.lastWitherImpact))/1000)) + "s", Renderer.screen.getWidth() / 2 - Renderer.getStringWidth(Math.max(0,Math.ceil((5000-(Date.now()-this.lastWitherImpact))/1000)) + "s") / 2, Renderer.screen.getHeight() / 2 - 15) + if (this.witherImpactCooldownSetting.getValue() && Date.now() - this.lastWitherImpact < 10000) { + Renderer.drawString(Math.max(0, Math.ceil((5000 - (Date.now() - this.lastWitherImpact)) / 1000)) + "s", Renderer.screen.getWidth() / 2 - Renderer.getStringWidth(Math.max(0, Math.ceil((5000 - (Date.now() - this.lastWitherImpact)) / 1000)) + "s") / 2, Renderer.screen.getHeight() / 2 - 15) } - - for(let stat of this.hudStat){ + for (let stat of this.hudStat) { stat.textElement.render() } } - - renderWorld(){ - if(!this.fpsEnabledSetting.getValue() ||!this.fpsFastSetting.getValue()) return + + renderWorld() { + if (!this.fpsEnabledSetting.getValue() || !this.fpsFastSetting.getValue()) return this.framesSince++ - + let instant = this.Instant.now() - let time = instant.getEpochSecond() + (instant.getNano() / 1000000000); + let time = instant.getEpochSecond() + (instant.getNano() / 1000000000); let thisframeTime = time - this.lastFrame - if(thisframeTime > this.slowestFrameTime){ + if (thisframeTime > this.slowestFrameTime) { this.slowestFrameTime = thisframeTime } this.lastFrame = time } - actionbarMessage(m){ - if(ChatLib.removeFormatting(m).includes("(Wither Impact)")){ - if(Date.now()-this.aup < 750){ + actionbarMessage(m) { + if (ChatLib.removeFormatting(m).includes("(Wither Impact)")) { + if (Date.now() - this.aup < 750) { this.lastWitherImpact = Date.now() this.aup = 0 - }else{ + } else { this.impactTest = Date.now() } } } - - step(){ - if(!Player.getPlayer()) return + + step() { + if (!Player.getPlayer()) return this.updateHudThingos() let fps = 0 - if(this.fpsEnabledSetting.getValue() && this.fpsFastSetting.getValue()){ + if (this.fpsEnabledSetting.getValue() && this.fpsFastSetting.getValue()) { //set fps to fast fps // console.log(`${this.framesSince} ${this.lastFrame-this.lastTickTime}`) - fps = this.framesSince/(this.lastFrame-this.lastTickTime) - if(this.lastFrame===this.lastTickTime) fps = 0 + fps = this.framesSince / (this.lastFrame - this.lastTickTime) + if (this.lastFrame === this.lastTickTime) fps = 0 this.lastTickTime = this.lastFrame this.framesSince = 0 this.lastFrameRates.push(fps) this.lastFrameRates.shift() - if(this.slowestFrameTime > 0){ - this.lastFrameRatesS.push(1/this.slowestFrameTime) - }else{ + if (this.slowestFrameTime > 0) { + this.lastFrameRatesS.push(1 / this.slowestFrameTime) + } else { this.lastFrameRatesS.push(0) } this.lastFrameRatesS.shift() this.slowestFrameTime = 0 - - fps = this.lastFrameRates.reduce((a,b) => a+b, 0) / this.lastFrameRates.length + + fps = this.lastFrameRates.reduce((a, b) => a + b, 0) / this.lastFrameRates.length this.fps.set(fps, 200) - if(this.fpsLowSetting.getValue()) this.lowFps.set(this.lastFrameRatesS.reduce((a,b) => a+b, 0) / this.lastFrameRatesS.length, 200) - }else{ + if (this.fpsLowSetting.getValue()) this.lowFps.set(this.lastFrameRatesS.reduce((a, b) => a + b, 0) / this.lastFrameRatesS.length, 200) + } else { fps = Client.getFPS() this.fpsElement.setText("&6Fps&7> &f" + fps) } let cpsText = CPS.getLeftClicksAverage() - if(this.cpsIncludeRight.getValue()){ - if(this.cpsSeperate.getValue()){ + if (this.cpsIncludeRight.getValue()) { + if (this.cpsSeperate.getValue()) { cpsText += "&7 | &f" + CPS.getRightClicksAverage() - }else{ + } else { cpsText += CPS.getRightClicksAverage() } } this.cpsElement.setText("&6Cps&7> &f" + cpsText) //Scan opened inventory for all pet levels - if(Player && Player.getOpenedInventory() && Player.getOpenedInventory().getName().includes(") Pets")){ - let inv = Player.getOpenedInventory().getItems() - for(let i = 0; i < inv.length; i++){ - if(inv[i]!=null && inv[i].getName().includes("[Lvl ")){ + if (Player && Player.getContainer() && Player.getContainer().getName().includes(") Pets")) { + let inv = Player.getContainer().getItems() + for (let i = 0; i < inv.length; i++) { + if (inv[i] != null && inv[i].getName().includes("[Lvl ")) { let level = inv[i].getName().split(" ")[1].replace("]", "") - if(!this.petLevels[inv[i].getName().split("] ")[1]] || this.petLevels[inv[i].getName().split("] ")[1]] < level)this.petLevels[inv[i].getName().split("] ")[1]] = level + if (!this.petLevels[inv[i].getName().split("] ")[1]] || this.petLevels[inv[i].getName().split("] ")[1]] < level) this.petLevels[inv[i].getName().split("] ")[1]] = level - if(Date.now()-this.lastSwappedPet > 1000){ + if (Date.now() - this.lastSwappedPet > 1000) { inv[i].getLore().forEach(line => { - if(line.includes("Click to despawn.")){ + if (line.includes("Click to despawn.")) { this.petElement.setText("&6Pet&7> &7" + inv[i].getName().split("(")[0]) this.petText = "&6Pet&7> &7" + inv[i].getName().split("(")[0] } @@ -414,59 +412,58 @@ class Hud extends Feature { } } - if(Player.getPlayer()[m.getAbsorptionAmount]() > this.lastAbsorbtion){ - if(Date.now()-this.impactTest < 750){ + if (Player.getPlayer()[m.getAbsorptionAmount]() > this.lastAbsorbtion) { + if (Date.now() - this.impactTest < 750) { this.lastWitherImpact = Date.now() this.impactTest = 0 - }else{ + } else { this.aup = Date.now() } } this.lastAbsorbtion = Player.getPlayer()[m.getAbsorptionAmount]() } - step_5second(){ - - if(!this.soulflowEnabledSetting.getValue()) return - if(!Player.getPlayer()) return - if(!Player.getInventory()) return + step_5second() { + if (!this.soulflowEnabledSetting.getValue()) return + if (!Player.getPlayer()) return + if (!Player.getInventory()) return - if(!this.FeatureManager.features["dataLoader"].class.isInSkyblock){ + if (!this.FeatureManager.features["dataLoader"].class.isInSkyblock) { this.soulflowElement.setText("") this.petElement.setText("") return - }else{ + } else { this.petElement.setText(this.petText) } let soulflowCount = 0 let hasSoulflowItem = false - Player.getInventory().getItems().forEach(i=>{ - + Player.getInventory().getItems().forEach(i => { + let id; - try{ + try { id = i.getNBT().getCompoundTag("tag").getCompoundTag("ExtraAttributes").getString("id") - }catch(e){} + } catch (e) { } - if(id === "SOULFLOW_PILE" || id=== "SOULFLOW_BATTERY" || id === "SOULFLOW_SUPERCELL"){ + if (id === "SOULFLOW_PILE" || id === "SOULFLOW_BATTERY" || id === "SOULFLOW_SUPERCELL") { //soulflowCount - i.getLore().forEach(line=>{ - if(line.startsWith("§5§o§7Internalized:")){ + i.getLore().forEach(line => { + if (line.startsWith("§5§o§7Internalized:")) { hasSoulflowItem = true - soulflowCount = parseInt(ChatLib.removeFormatting(line).substr("Internalized: ".length).split("⸎")[0].replace(/,/g,"")) + soulflowCount = parseInt(ChatLib.removeFormatting(line).substr("Internalized: ".length).split("⸎")[0].replace(/,/g, "")) } }) } }) - if(!hasSoulflowItem){ - if(this.soulflowShowWarningSetting.getValue()){ + if (!hasSoulflowItem) { + if (this.soulflowShowWarningSetting.getValue()) { this.soulflowElement.setText("&6Soulflow&7> &cNO TALISMAN") - }else{ + } else { this.soulflowElement.setText("") } return; } - if(soulflowCount > 0 && !this.soulflowShowWhen0Setting.getValue()){ + if (soulflowCount > 0 && !this.soulflowShowWhen0Setting.getValue()) { this.soulflowElement.setText("") return; } @@ -474,19 +471,19 @@ class Hud extends Feature { this.soulflowElement.setText("&6Soulflow&7> &f" + this.numberUtils.numberWithCommas(soulflowCount)) } - statApiLoadThingo(data){ - data.profiles.forEach(p=>{ - if(!this.lastStatData || (p.members[Player.getUUID().toString().replace(/-/g,"")] && p.members[Player.getUUID().toString().replace(/-/g,"")].last_save > this.lastStatData.last_save)){ - this.lastStatData = p.members[Player.getUUID().toString().replace(/-/g,"")] + statApiLoadThingo(data) { + data.profiles.forEach(p => { + if (!this.lastStatData || (p.members[Player.getUUID().toString().replace(/-/g, "")] && p.members[Player.getUUID().toString().replace(/-/g, "")].last_save > this.lastStatData.last_save)) { + this.lastStatData = p.members[Player.getUUID().toString().replace(/-/g, "")] } }) this.updateHudThingos() } - updateSpotify(){ - if(!this.showSpotifyPlaying.getValue()) return - + updateSpotify() { + if (!this.showSpotifyPlaying.getValue()) return + let currentSong = "&cNot open" let spotifyProcesses = [] let process = new ProcessBuilder("tasklist.exe", "/fo", "csv", "/nh").start(); @@ -494,17 +491,17 @@ class Hud extends Feature { if (sc.hasNextLine()) sc.nextLine(); while (sc.hasNextLine()) { let line = sc.nextLine(); - let parts = line.replace("\"","").split("\",\""); + let parts = line.replace("\"", "").split("\",\""); let unq = parts[0] let pid = parts[1] - if(unq==="Spotify.exe"){ + if (unq === "Spotify.exe") { spotifyProcesses.push(pid) // console.log(parts.join(" ")); } } process.waitFor(); - while(spotifyProcesses.length > 0){ + while (spotifyProcesses.length > 0) { let pid = spotifyProcesses.pop() // console.log("Loading pid " + pid) let process = new ProcessBuilder("tasklist.exe", "/FO", "csv", "/V", "/FI", "\"PID eq " + pid + "\"").start(); @@ -512,15 +509,15 @@ class Hud extends Feature { if (sc.hasNextLine()) sc.nextLine(); while (sc.hasNextLine()) { let line = sc.nextLine(); - let parts = line.replace("\"","").split("\",\""); - let song = parts[parts.length-1].substr(0,parts[parts.length-1].length-1) - if(song === "N/A") continue - - if(song === "Spotify Free"||song === "Spotify Premium"||song === "AngleHiddenWindow"){ + let parts = line.replace("\"", "").split("\",\""); + let song = parts[parts.length - 1].substr(0, parts[parts.length - 1].length - 1) + if (song === "N/A") continue + + if (song === "Spotify Free" || song === "Spotify Premium" || song === "AngleHiddenWindow") { currentSong = "&cPaused" - }else{ - if(song === "Spotify") song = "Advertisement" - currentSong = "&a" + song.replace(/&/g, "&⭍").replace(" - "," &7-&b ") + } else { + if (song === "Spotify") song = "Advertisement" + currentSong = "&a" + song.replace(/&/g, "&⭍").replace(" - ", " &7-&b ") } } @@ -530,9 +527,9 @@ class Hud extends Feature { this.spotifyElement2.setText(currentSong.normalize("NFD").replace(/[\u0300-\u036f]/g, "")) } - updateHudThingos(){ + updateHudThingos() { let insb = this.FeatureManager.features["dataLoader"].class.isInSkyblock - if(Date.now()-this.lastUpdatedStatData > 5*60000 && this.hudStat[0].enabled.getValue() && (!this.lastStatData || insb || this.hudStat.map(a=>(!a.enabled.getValue() || a.onlySb.getValue())).includes(false))){ + if (Date.now() - this.lastUpdatedStatData > 5 * 60000 && this.hudStat[0].enabled.getValue() && (!this.lastStatData || insb || this.hudStat.map(a => (!a.enabled.getValue() || a.onlySb.getValue())).includes(false))) { this.FeatureManager.features["dataLoader"].class.loadApiData("skyblock", false) @@ -540,87 +537,87 @@ class Hud extends Feature { return } - this.hudStat.forEach(stat=>{ - if(stat.enabled.getValue()){ + this.hudStat.forEach(stat => { + if (stat.enabled.getValue()) { this.updateHudThing(stat, insb) } }) } - updateHudThing(thing, insb){ - if(!this.lastStatData) return + updateHudThing(thing, insb) { + if (!this.lastStatData) return - if(!insb && thing.onlySb.getValue()){ + if (!insb && thing.onlySb.getValue()) { thing.textElement.setText("") return } let type = thing.type.getValue() - + let string = "Unknown stat" - if(type === "totaldeaths"){ + if (type === "totaldeaths") { string = "&6Deaths&7> &f" + this.numberUtils.numberWithCommas(this.lastStatData.death_count) } - if(type === "cata"){ + if (type === "cata") { let cataData = getLevelByXp(this.lastStatData.dungeons.dungeon_types.catacombs.experience, 2, Infinity) - string = "&6Cata&7> &f" + (~~((cataData.level+cataData.progress)*100)/100).toFixed(2) + " &7(" + this.numberUtils.numberWithCommas(cataData.xpCurrent) + (cataData.level===50?"":"/" + this.numberUtils.numberWithCommas(cataData.xpForNext)) + ")" + string = "&6Cata&7> &f" + (~~((cataData.level + cataData.progress) * 100) / 100).toFixed(2) + " &7(" + this.numberUtils.numberWithCommas(cataData.xpCurrent) + (cataData.level === 50 ? "" : "/" + this.numberUtils.numberWithCommas(cataData.xpForNext)) + ")" } - + Object.keys(this.skillLevelCaps).forEach(skill => { - if(type === skill){ + if (type === skill) { let skillData = getLevelByXp(this.lastStatData[skill], 0, this.skillLevelCaps[skill]) - string = "&6" + firstLetterCapital(skill.split("_").pop()) + "&7> &f" + (skillData.level+skillData.progress).toFixed(2) + " &7(" + this.numberUtils.numberWithCommas(skillData.xpCurrent) + (skillData.level===this.skillLevelCaps[skill]?"":"/" + this.numberUtils.numberWithCommas(skillData.xpForNext)) + ")" + string = "&6" + firstLetterCapital(skill.split("_").pop()) + "&7> &f" + (skillData.level + skillData.progress).toFixed(2) + " &7(" + this.numberUtils.numberWithCommas(skillData.xpCurrent) + (skillData.level === this.skillLevelCaps[skill] ? "" : "/" + this.numberUtils.numberWithCommas(skillData.xpForNext)) + ")" } }) - if(type === "completions_enterance"){ - string = "&6E Comps&7> &f" + this.numberUtils.numberWithCommas((this.lastStatData.dungeons?.dungeon_types?.catacombs?.tier_completions?.[0]||0)) + if (type === "completions_enterance") { + string = "&6E Comps&7> &f" + this.numberUtils.numberWithCommas((this.lastStatData.dungeons?.dungeon_types?.catacombs?.tier_completions?.[0] || 0)) } - if(type.startsWith("completions_floor_")){ + if (type.startsWith("completions_floor_")) { let floor = parseInt(type.split("_").pop()) - string = "&6F" + floor +" Comps&7> &f" + this.numberUtils.numberWithCommas((this.lastStatData.dungeons?.dungeon_types?.catacombs?.tier_completions?.[floor]||0)) + string = "&6F" + floor + " Comps&7> &f" + this.numberUtils.numberWithCommas((this.lastStatData.dungeons?.dungeon_types?.catacombs?.tier_completions?.[floor] || 0)) } - if(type.startsWith("completions_master_")){ + if (type.startsWith("completions_master_")) { let floor = parseInt(type.split("_").pop()) - string = "&6M" + floor +" Comps&7> &f" + this.numberUtils.numberWithCommas((this.lastStatData.dungeons?.dungeon_types?.master_catacombs?.tier_completions?.[floor]||0)) + string = "&6M" + floor + " Comps&7> &f" + this.numberUtils.numberWithCommas((this.lastStatData.dungeons?.dungeon_types?.master_catacombs?.tier_completions?.[floor] || 0)) } - if(type.startsWith("completions_dungeon_")){ + if (type.startsWith("completions_dungeon_")) { let floor = parseInt(type.split("_").pop()) - string = "&6Dungeon " + floor +" Comps&7> &f" + this.numberUtils.numberWithCommas((this.lastStatData.dungeons?.dungeon_types?.catacombs?.tier_completions?.[floor]||0)+(this.lastStatData.dungeons?.dungeon_types?.master_catacombs?.tier_completions?.[floor]||0)) + string = "&6Dungeon " + floor + " Comps&7> &f" + this.numberUtils.numberWithCommas((this.lastStatData.dungeons?.dungeon_types?.catacombs?.tier_completions?.[floor] || 0) + (this.lastStatData.dungeons?.dungeon_types?.master_catacombs?.tier_completions?.[floor] || 0)) } - + thing.textElement.setText(string) } - apiLoad(data, dataType, isSoopyServer, isLatest){ - if(dataType === "skyblock" && !isSoopyServer){ + apiLoad(data, dataType, isSoopyServer, isLatest) { + if (dataType === "skyblock" && !isSoopyServer) { this.statApiLoadThingo(data) } - if(!isSoopyServer || !isLatest) return - if(dataType !== "skyblock") return + if (!isSoopyServer || !isLatest) return + if (dataType !== "skyblock") return let pet = data.data.profiles[data.data.stats.currentProfileId].members[Player.getUUID().replace(/-/g, "")].selectedPet - if(!pet){ + if (!pet) { this.petElement.setText("&6Pet&7> &cNone") this.petText = "&6Pet&7> &cNone" return; } - let petTierColor = { - "COMMON": "&f", - "UNCOMMON": "&a", - "RARE": "&9", - "EPIC": "&5", - "LEGENDARY": "&6", - "MYTHIC": "&d" - } + let petTierColor = { + "COMMON": "&f", + "UNCOMMON": "&a", + "RARE": "&9", + "EPIC": "&5", + "LEGENDARY": "&6", + "MYTHIC": "&d" + } - this.petElement.setText("&6Pet&7> &7[Lvl " + (pet.level.level||"??") + "] " + petTierColor[pet.tier] + pet.name) - this.petText = "&6Pet&7> &7[Lvl " + (pet.level.level||"??") + "] " + petTierColor[pet.tier] + pet.name + this.petElement.setText("&6Pet&7> &7[Lvl " + (pet.level.level || "??") + "] " + petTierColor[pet.tier] + pet.name) + this.petText = "&6Pet&7> &7[Lvl " + (pet.level.level || "??") + "] " + petTierColor[pet.tier] + pet.name } - worldLoad(){ + worldLoad() { this.lastUpdatedStatData = 0 } } diff --git a/features/lockedFeatures/index.js b/features/lockedFeatures/index.js index ca69a27..1332cd1 100644 --- a/features/lockedFeatures/index.js +++ b/features/lockedFeatures/index.js @@ -76,7 +76,7 @@ class LockedFeatures extends Feature { 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){ + if(i === playerPos-1 || i === playerPos || i === playerPos+1 || (playerPos === 0 && i===playerPos+2)){ text += "§6#" + (i+1) text += "§7 - " text += "§e"+u.username -- cgit