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}` : "