diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-01-18 14:58:15 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-01-18 14:58:15 +0800 |
commit | 7b3120d3973e9a0dee83319b305efd67e2b73201 (patch) | |
tree | 599041c230b32180fe689b552f2546ed7781e02b /features | |
parent | 80a88035ee2f4374cad6e870010876352773a2a4 (diff) | |
download | SoopyV2-7b3120d3973e9a0dee83319b305efd67e2b73201.tar.gz SoopyV2-7b3120d3973e9a0dee83319b305efd67e2b73201.tar.bz2 SoopyV2-7b3120d3973e9a0dee83319b305efd67e2b73201.zip |
aaaaaaaa (also idk why it screwed the formatting)
Diffstat (limited to 'features')
-rw-r--r-- | features/dungeonSolvers/index.js | 748 | ||||
-rw-r--r-- | features/mining/index.js | 1 | ||||
-rw-r--r-- | features/slayers/index.js | 789 |
3 files changed, 754 insertions, 784 deletions
diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js index 55785d4..2757bd0 100644 --- a/features/dungeonSolvers/index.js +++ b/features/dungeonSolvers/index.js @@ -9,417 +9,397 @@ import LocationSetting from "../settings/settingThings/location"; import ToggleSetting from "../settings/settingThings/toggle"; class DungeonSolvers extends Feature { - constructor() { - super() + 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.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.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.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.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; + } + + entityJoinWorldEvent(event) { + if (this.bloodCampAssist.getValue()) this.todoE.push(event.entity); + } + + 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" + 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); + 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]) + // } } - 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.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.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.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.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 + }); } + } - entityJoinWorldEvent(event){ - if(this.bloodCampAssist.getValue())this.todoE.push(event.entity) + 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()) { + cancel(event); + } + } } + } - renderWorld(ticks){ - if(this.lividFindBox.getValue()){ - if(this.lividData.correctLividEntity){ - renderUtils.drawBoxAtEntity(this.lividData.correctLividEntity, 255, 0, 0, 0.75, -2, ticks) + renderHud() { + 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.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("Head")) { + this.addSkull(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(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) - 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 (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("Head"))) { + 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(); } - } - 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()){ - cancel(event) - } - } - } - } - - renderHud(){ - for(let element of this.hudElements){ - element.render() - } - } + 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]]; - 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.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("Head")){ - this.addSkull(e) - } - }) - } + 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; - 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("Head") - )){ - 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]) - // } - } - }) - } - } + 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]; - addSkull(skull){ - if(this.bloodX !== -1){ - let xA = skull.getX()-(skull.getX()%32) - let yA = skull.getZ()-(skull.getZ()%32) - - if(xA !== this.bloodX || yA !== this.bloodY) return - }else{ - if(skull.getEntity()[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().trim() === Player.getName() + "'s Head" - || skull.getEntity()[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().trim() === Player.getName() + "' Head"){ - this.bloodX = skull.getX()-(skull.getX()%32) - this.bloodY = skull.getZ()-(skull.getZ()%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("Head")){ - this.addSkull(e) - } - }) - } - return - } - this.skulls.push(skull) + 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]) + // } + } + }); } - - step(){ //2fps - if(this.lividFindEnabled.getValue() && (this.FeatureManager.features["dataLoader"].class.dungeonFloor === "F5" || this.FeatureManager.features["dataLoader"].class.dungeonFloor === "M5")){ - let type = World.getBlockAt(208,108,245).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 - } - } - }) + } + + addSkull(skull) { + if (this.bloodX !== -1) { + let xA = skull.getX() - (skull.getX() % 32); + let yA = skull.getZ() - (skull.getZ() % 32); + + if (xA !== this.bloodX || yA !== this.bloodY) return; + } else { + if (skull.getEntity()[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().trim() === Player.getName() + "'s Head" || skull.getEntity()[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().trim() === Player.getName() + "' Head") { + this.bloodX = skull.getX() - (skull.getX() % 32); + this.bloodY = skull.getZ() - (skull.getZ() % 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("Head")) { + this.addSkull(e); + } + }); + } + return; + } + this.skulls.push(skull); + } + + step() { + //2fps + if (this.lividFindEnabled.getValue() && (this.FeatureManager.features["dataLoader"].class.dungeonFloor === "F5" || this.FeatureManager.features["dataLoader"].class.dungeonFloor === "M5")) { + let type = World.getBlockAt(208, 108, 245).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 - } - } + 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() === "Armor Stand" && e[m.getEquipmentInSlot](4) && e[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().endsWith("Head")){ - this.addSkull(en) - } - }) - - this.todoE = [] - - if(Date.now()-this.lastPingCheck> 60000*30 - || Date.now()-this.lastPingCheck> 60000 && this.lastPings.includes(undefined)){ - this.lastPingCheck = Date.now() - ChatLib.command("whereami") - this.checkingPing = true - } + 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() === "Armor Stand" && e[m.getEquipmentInSlot](4) && e[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().endsWith("Head")) { + this.addSkull(en); } + }); - 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 + this.todoE = []; - 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("") - } + if (Date.now() - this.lastPingCheck > 60000 * 30 || (Date.now() - this.lastPingCheck > 60000 && this.lastPings.includes(undefined))) { + this.lastPingCheck = Date.now(); + ChatLib.command("whereami"); + this.checkingPing = true; + } } - initVariables(){ - this.lividFindEnabled = undefined - this.lividData = undefined - this.hudElements = [] + 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(""); } + } - onDisable(){ - this.initVariables() - } + initVariables() { + this.lividFindEnabled = undefined; + this.lividData = undefined; + this.hudElements = []; + } + + onDisable() { + this.initVariables(); + } } module.exports = { - class: new DungeonSolvers() -}
\ No newline at end of file + class: new DungeonSolvers(), +}; diff --git a/features/mining/index.js b/features/mining/index.js index 5c34b9b..fb2db0f 100644 --- a/features/mining/index.js +++ b/features/mining/index.js @@ -86,6 +86,7 @@ class Mining extends Feature { * @param {Item} item */ addLore(item){ + if(!item) return if(this.showUnlockedGemstoneSlots.getValue()){ let gems = item.getNBT().getCompoundTag("tag").getCompoundTag("ExtraAttributes").getCompoundTag("gems") if(gems){ diff --git a/features/slayers/index.js b/features/slayers/index.js index 02d6d71..8b0076c 100644 --- a/features/slayers/index.js +++ b/features/slayers/index.js @@ -9,440 +9,429 @@ import LocationSetting from "../settings/settingThings/location"; import ToggleSetting from "../settings/settingThings/toggle"; class Slayers extends Feature { - constructor() { - super() + constructor() { + super(); + } + + onEnable() { + this.initVariables(); + + this.expOnKill = new ToggleSetting("Show slayer exp on boss kill", "Says your slayer exp in chat when you kill a boss, also says time taken to spawn+kill", true, "slayer_xp", this); + this.slainAlert = new ToggleSetting("Show boss slain alert", "This helps you to not kill mobs for ages with an inactive quest", true, "boss_slain_alert", this); + this.spawnAlert = new ToggleSetting("Show boss spawned alert", "This helps you to not miss your boss when you spawn it", true, "boss_spawn_alert", this); + + this.boxAroundEmanBoss = new ToggleSetting("Box around enderman slayer boss", "This helps to know what boss it yours", true, "eman_box", this); + this.boxToEmanBeacon = new ToggleSetting("Box and line to the enderman beacon", "This will help to find the beacon when the boss throws it", true, "eman_beacon", this); + this.emanBeaconDinkDonk = new ToggleSetting("DinkDonk when beacon is spawned", "This will help to notice when the beacon is spawned", true, "eman_beacon_dinkdink", this); + this.emanEyeThings = new ToggleSetting("Put box around the enderman eye things", "This will help to find them", true, "eman_eye_thing", this); + this.emanHpGuiElement = new ToggleSetting("Render the enderman hp on your screen", "This will help you to know what stage u are in ect", true, "eman_hp", this); + + this.emanHpElement = new HudTextElement().setToggleSetting(this.emanHpGuiElement).setLocationSetting(new LocationSetting("Eman Hp Location", "Allows you to edit the location of the enderman hp", "eman_location", this, [10, 50, 1, 1]).requires(this.emanHpGuiElement).editTempText("&6Enderman&7> &f&l30 Hits")); + this.hudElements.push(this.emanHpElement); + + this.slayerSpeedRates = new ToggleSetting("Show slayer speed and exp rates", "(Slayer speed includes downtime inbetween slayers, only shows while doing slayers)", true, "slayer_speed_rates", this); + this.slayerSpeedRatesElement = new HudTextElement() + .setText("&6Slayer speed&7> &fLoading...\n&6Exp/hour&7> &fLoading...\n&6Kills/hour&7> &fLoading...") + .setToggleSetting(this.slayerSpeedRates) + .setLocationSetting(new LocationSetting("Slayer speed and exp rates location", "Allows you to edit the location of the information", "slayer_speed_rates_location", this, [10, 100, 1, 1]).requires(this.slayerSpeedRates).editTempText("&6Slayer speed&7> &f4:30\n&6Exp/hour&7> &f1,234,567\n&6Kills/hour&7> &f17")); + + this.hudElements.push(this.slayerSpeedRatesElement); + + this.lastSlayerFinishes = []; + this.lastSlayerExps = []; + this.slayerExp = {}; + this.slayerExpLoaded = false; + + this.lastSlayerType = ""; + this.lastSlayerExp = 0; + this.lastBossSlain = 0; + this.registerChat("&r &r&a&lSLAYER QUEST COMPLETE!&r", (e) => { + this.lastSlayerExps.push(this.lastSlayerExp); + if (this.lastSlayerExps.length > 5) { + this.lastSlayerExps.shift(); + } + + this.lastSlayerFinishes.push(Date.now()); + if (this.lastSlayerFinishes.length > 5) { + this.lastSlayerFinishes.shift(); + } + + this.slayerExp[this.lastSlayerType] = this.lastSlayerExp + (this.slayerExp[this.lastSlayerType] || 0); + if (this.expOnKill.getValue()) { + cancel(e); + ChatLib.chat("&r &r&a&lSLAYER QUEST COMPLETE!&a&r"); + ChatLib.chat("&r &r&aYou have &d" + numberWithCommas(this.slayerExp[this.lastSlayerType]) + " " + this.lastSlayerType + " XP&r&7!&r"); + ChatLib.chat("&r &r&aYou have &d" + numberWithCommas(Object.values(this.slayerExp).reduce((a, t) => t + a, 0)) + " total XP&r&7!&r"); + if (Date.now() - this.lastBossSlain < 60000 * 5) ChatLib.chat("&r &r&aBoss took &d" + timeNumber(Date.now() - this.lastBossSlain) + " &ato spawn and kill&r&7!" + /* (" + timeNumber(Date.now()-this.lastBossSpawned) + " to kill) */ "&r"); //TODO: Seperate setting for this + } + this.lastBossSlain = Date.now(); + }); + + this.bossSlainMessage = false; + this.bossSpawnedMessage = false; + this.lastBossNotSpawnedTime = 0; + this.lastBossSpawned = 0; + + this.registerEvent("renderOverlay", this.renderOverlay); + + this.registerSoopy("apiLoad", this.apiLoad); + if (this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock) { + this.apiLoad(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock, "skyblock", true, true); } - onEnable(){ - this.initVariables() - - this.expOnKill = new ToggleSetting("Show slayer exp on boss kill", "Says your slayer exp in chat when you kill a boss, also says time taken to spawn+kill", true, "slayer_xp", this) - this.slainAlert = new ToggleSetting("Show boss slain alert", "This helps you to not kill mobs for ages with an inactive quest", true, "boss_slain_alert", this) - this.spawnAlert = new ToggleSetting("Show boss spawned alert", "This helps you to not miss your boss when you spawn it", true, "boss_spawn_alert", this) - - - this.boxAroundEmanBoss = new ToggleSetting("Box around enderman slayer boss", "This helps to know what boss it yours", true, "eman_box", this) - this.boxToEmanBeacon = new ToggleSetting("Box and line to the enderman beacon", "This will help to find the beacon when the boss throws it", true, "eman_beacon", this) - this.emanBeaconDinkDonk = new ToggleSetting("DinkDonk when beacon is spawned", "This will help to notice when the beacon is spawned", true, "eman_beacon_dinkdink", this) - this.emanEyeThings = new ToggleSetting("Put box around the enderman eye things", "This will help to find them", true, "eman_eye_thing", this) - this.emanHpGuiElement = new ToggleSetting("Render the enderman hp on your screen", "This will help you to know what stage u are in ect", true, "eman_hp", this) - - this.emanHpElement = new HudTextElement() - .setToggleSetting(this.emanHpGuiElement) - .setLocationSetting(new LocationSetting("Eman Hp Location", "Allows you to edit the location of the enderman hp", "eman_location", this, [10, 50, 1, 1]) - .requires(this.emanHpGuiElement) - .editTempText("&6Enderman&7> &f&l30 Hits")) - this.hudElements.push(this.emanHpElement) - - this.slayerSpeedRates = new ToggleSetting("Show slayer speed and exp rates", "(Slayer speed includes downtime inbetween slayers, only shows while doing slayers)", true, "slayer_speed_rates", this) - this.slayerSpeedRatesElement = new HudTextElement().setText("&6Slayer speed&7> &floading...\n&6Exp/hour&7> &floading...\n&6Kills/hour&7> &floading...") - .setToggleSetting(this.slayerSpeedRates) - .setLocationSetting(new LocationSetting("Slayer speed and exp rates location", "Allows you to edit the location of the information", "slayer_speed_rates_location", this, [10, 100, 1, 1]) - .requires(this.slayerSpeedRates) - .editTempText("&6Slayer speed&7> &f4:30\n&6Exp/hour&7> &f1,234,567\n&6Kills/hour&7> &f17")) - - this.hudElements.push(this.slayerSpeedRatesElement) - - this.lastSlayerFinishes = [] - this.lastSlayerExps = [] - this.slayerExp = {} - this.slayerExpLoaded = false - - this.lastSlayerType = "" - this.lastSlayerExp = 0 - this.lastBossSlain = 0 - this.registerChat("&r &r&a&lSLAYER QUEST COMPLETE!&r",(e)=>{ - - this.lastSlayerExps.push(this.lastSlayerExp) - if(this.lastSlayerExps.length > 5){ - this.lastSlayerExps.shift() - } - - this.lastSlayerFinishes.push(Date.now()) - if(this.lastSlayerFinishes.length > 5){ - this.lastSlayerFinishes.shift() - } - - this.slayerExp[this.lastSlayerType] = this.lastSlayerExp + (this.slayerExp[this.lastSlayerType] || 0) - if(this.expOnKill.getValue()){ - cancel(e) - ChatLib.chat("&r &r&a&lSLAYER QUEST COMPLETE!&a&r") - ChatLib.chat("&r &r&aYou have &d" + numberWithCommas(this.slayerExp[this.lastSlayerType]) + " " + this.lastSlayerType + " XP&r&7!&r") - ChatLib.chat("&r &r&aYou have &d" + numberWithCommas(Object.values(this.slayerExp).reduce((a, t)=>t+a, 0)) + " total XP&r&7!&r") - if(Date.now()-this.lastBossSlain < 60000*5) ChatLib.chat("&r &r&aBoss took &d" + timeNumber((Date.now()-this.lastBossSlain)) + " &ato spawn and kill&r&7!"+/* (" + timeNumber(Date.now()-this.lastBossSpawned) + " to kill) */"&r") //TODO: Seperate setting for this - } - this.lastBossSlain = Date.now() - }) - - this.bossSlainMessage = false - this.bossSpawnedMessage = false - this.lastBossNotSpawnedTime = 0 - this.lastBossSpawned = 0 - - this.registerEvent("renderOverlay", this.renderOverlay) - - - this.registerSoopy("apiLoad", this.apiLoad) - if(this.FeatureManager.features["dataLoader"] && this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock){ - this.apiLoad(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock, "skyblock", true, true) - } - - this.todoE = [] - this.beaconPoints = {} - this.beaconE = [] - this.deadE = [] - this.beaconLocations = {} - this.eyeE = [] - this.todoE2 = [] - this.emanBoss = undefined - this.nextIsBoss = 0 - this.counter = 0 - - this.entityAttackEventLoaded = false - this.entityAttackEventE = undefined - - this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent) - this.registerEvent("tick", this.tick) - this.registerEvent("renderWorld", this.renderWorld) - this.registerEvent("worldLoad", this.worldLoad) - this.registerEvent("renderOverlay", this.renderHud) - this.registerStep(true, 2, this.step) + this.todoE = []; + this.beaconPoints = {}; + this.beaconE = []; + this.deadE = []; + this.beaconLocations = {}; + this.eyeE = []; + this.todoE2 = []; + this.emanBoss = undefined; + this.nextIsBoss = 0; + this.counter = 0; + + this.entityAttackEventLoaded = false; + this.entityAttackEventE = undefined; + + this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent); + this.registerEvent("tick", this.tick); + this.registerEvent("renderWorld", this.renderWorld); + this.registerEvent("worldLoad", this.worldLoad); + this.registerEvent("renderOverlay", this.renderHud); + this.registerStep(true, 2, this.step); + } + + renderHud() { + for (let element of this.hudElements) { + element.render(); } - - renderHud(){ - for(let element of this.hudElements){ - element.render() - } + } + + worldLoad() { + this.todoE = []; + this.beaconPoints = {}; + this.beaconE = []; + this.deadE = []; + this.todoE2 = []; + this.beaconLocations = {}; + this.eyeE = []; + this.emanBoss = undefined; + } + + entityAttackEvent(event) { + if (event.source.func_76346_g() === Player.getPlayer()) { + if (event.entity instanceof net.minecraft.entity.monster.EntityEnderman) { + World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach((e) => { + if (e.getName().includes("Voidgloom Seraph")) { + //if distance from e to event.entity < 5 + if ((e.getX() - event.entity[f.posX.Entity]) ** 2 + (e.getY() - event.entity[f.posY.Entity]) ** 2 + (e.getZ() - event.entity[f.posZ.Entity]) ** 2 < 25) { + this.emanBoss = e; + } + } + }); + } } - - worldLoad(){ - this.todoE = [] - this.beaconPoints = {} - this.beaconE = [] - this.deadE = [] - this.todoE2 = [] - this.beaconLocations = {} - this.eyeE = [] - this.emanBoss = undefined + } + + renderWorld(ticks) { + if (this.emanBoss && this.boxAroundEmanBoss.getValue()) drawBoxAtEntity(this.emanBoss, 0, 255, 0, 1, -3, ticks, 4, false); + + if (this.boxToEmanBeacon.getValue()) { + Object.values(this.beaconPoints).forEach((line) => { + let lastPoint = undefined; + line.forEach((p) => { + if (lastPoint) { + drawLine(lastPoint[0], lastPoint[1], lastPoint[2], p[0], p[1], p[2], 0, 0, 255, 3); + } + lastPoint = p; + }); + }); + Object.values(this.beaconLocations).forEach((loc) => { + drawFilledBox(loc[0] + 0.5, loc[1], loc[2] + 0.5, 1.01, 1.01, 0, 0, 1, 1, true); + }); } - entityAttackEvent(event){ - if(event.source.func_76346_g() === Player.getPlayer()){ - if(event.entity instanceof net.minecraft.entity.monster.EntityEnderman){ - World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach(e=>{ - if(e.getName().includes("Voidgloom Seraph")){ - //if distance from e to event.entity < 5 - if((e.getX() - event.entity[f.posX.Entity])**2 + (e.getY() - event.entity[f.posY.Entity])**2 + (e.getZ() - event.entity[f.posZ.Entity])**2 < 25){ - this.emanBoss = e - } - } - }) - } - } + this.eyeE.forEach((e) => { + let x = e.getX() + (e.getX() - e.getLastX()) * ticks; + let y = e.getY() + (e.getY() - e.getLastY()) * ticks; + let z = e.getZ() + (e.getZ() - e.getLastZ()) * ticks; + + drawBoxAtBlock(x - 0.5, y + 0.7, z - 0.5, 255, 0, 0); + }); + } + + entityJoinWorldEvent(event) { + this.todoE2.push(event.entity); + } + + tick() { + if (this.FeatureManager.features["dataLoader"].class.isInSkyblock) { + if (!this.entityAttackEventLoaded) { + this.entityAttackEventLoaded = true; + this.entityAttackEventE = this.registerForge(net.minecraftforge.event.entity.living.LivingAttackEvent, this.entityAttackEvent); + } + } else { + if (this.entityAttackEventLoaded) { + this.entityAttackEventLoaded = false; + this.unregisterForge(this.entityAttackEventE); + } } - renderWorld(ticks){ - - if(this.emanBoss && this.boxAroundEmanBoss.getValue()) drawBoxAtEntity(this.emanBoss, 0, 255, 0, 1, -3, ticks, 4, false) - - if(this.boxToEmanBeacon.getValue()){ - Object.values(this.beaconPoints).forEach(line=>{ - let lastPoint = undefined - line.forEach(p=>{ - if(lastPoint){ - drawLine(lastPoint[0], lastPoint[1], lastPoint[2], p[0], p[1], p[2], 0, 0, 255, 3) - } - lastPoint = p - }) - }) - Object.values(this.beaconLocations).forEach(loc=>{ - drawFilledBox(loc[0]+0.5, loc[1], loc[2]+0.5, 1.01, 1.01, 0, 0, 1, 1, true) - }) + this.bossSlainMessage = false; + let dis1 = false; + Scoreboard.getLines().forEach((line, i) => { + if (ChatLib.removeFormatting(line.getName()).includes("Slayer Quest")) { + let slayerInfo = ChatLib.removeFormatting(Scoreboard.getLines()[i - 1].getName().replace(/§/g, "&")); + let levelString = slayerInfo.split(" ").pop().trim(); + let slayerLevelToExp = { + I: 5, + II: 25, + III: 100, + IV: 500, + V: 1500, + }; + this.lastSlayerExp = slayerLevelToExp[levelString]; + let slayerStrToType = { + revenant: "zombie", + tarantula: "spider", + sven: "wolf", + voidgloom: "enderman", + }; + this.lastSlayerType = slayerStrToType[slayerInfo.split(" ")[0].toLowerCase()]; + //slayerExp[lastSlayerType] += lastSlayerExp + } + if (line.getName().includes("Boss slain!")) { + this.bossSlainMessage = true; + } + + if (line.getName().includes("Slay the boss!")) { + if (!this.bossSpawnedMessage && !this.emanBoss) { + this.nextIsBoss = Date.now(); } - this.eyeE.forEach(e=>{ - let x = e.getX() + ((e.getX()-e.getLastX())*ticks) - let y = e.getY() + ((e.getY()-e.getLastY())*ticks) - let z = e.getZ() + ((e.getZ()-e.getLastZ())*ticks) - - drawBoxAtBlock(x-0.5, y+0.7, z-0.5, 255, 0, 0) - }) - - } - - entityJoinWorldEvent(event){ - this.todoE2.push(event.entity) + dis1 = true; + this.bossSpawnedMessage = true; + } + }); + if (!dis1) { + this.lastBossNotSpawnedTime = Date.now(); + this.bossSpawnedMessage = false; } - tick(){ - - if(this.FeatureManager.features["dataLoader"].class.isInSkyblock){ - if(!this.entityAttackEventLoaded){ - this.entityAttackEventLoaded = true - this.entityAttackEventE = this.registerForge(net.minecraftforge.event.entity.living.LivingAttackEvent, this.entityAttackEvent) - } - }else{ - if(this.entityAttackEventLoaded){ - this.entityAttackEventLoaded = false - this.unregisterForge(this.entityAttackEventE) - } - } - - this.bossSlainMessage = false - let dis1 = false - Scoreboard.getLines().forEach((line, i) => { - if(ChatLib.removeFormatting(line.getName()).includes("Slayer Quest")){ - let slayerInfo = ChatLib.removeFormatting(Scoreboard.getLines()[i-1].getName().replace(/§/g,"&")) - let levelString = slayerInfo.split(" ").pop().trim() - let slayerLevelToExp = { - "I": 5, - "II": 25, - "III": 100, - "IV": 500, - "V": 1500 - } - this.lastSlayerExp = slayerLevelToExp[levelString] - let slayerStrToType = { - "revenant": "zombie", - "tarantula": "spider", - "sven": "wolf", - "voidgloom":"enderman" + this.todoE.forEach((e) => { + try { + if (e instanceof net.minecraft.entity.item.EntityArmorStand && e[m.getEquipmentInSlot](4)) { + if (e[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]() === "Beacon") { + let closestEIsGaming = false; + let closestDist = Infinity; + World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach((e2) => { + if (e2.getName().includes("Voidgloom Seraph")) { + if ((e2.getX() - e[f.posX.Entity]) ** 2 + (e2.getY() - e[f.posY.Entity]) ** 2 + (e2.getZ() - e[f.posZ.Entity]) ** 2 < closestDist) { + closestDist = (e2.getX() - e[f.posX.Entity]) ** 2 + (e2.getY() - e[f.posY.Entity]) ** 2 + (e2.getZ() - e[f.posZ.Entity]) ** 2; + closestEIsGaming = this.emanBoss ? e2.getUUID().toString() === this.emanBoss.getUUID().toString() : false; } - this.lastSlayerType = slayerStrToType[slayerInfo.split(" ")[0].toLowerCase()] - //slayerExp[lastSlayerType] += lastSlayerExp + } + }); + if (closestEIsGaming) { + this.beaconE.push(e); } - if (line.getName().includes('Boss slain!')) { - this.bossSlainMessage = true - } - - if (line.getName().includes('Slay the boss!')) { - - if(!this.bossSpawnedMessage && !this.emanBoss){ - this.nextIsBoss = Date.now() + } + if (e[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().startsWith("§a")) { + let closestEIsGaming = false; + let closestDist = Infinity; + World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach((e2) => { + if (e2.getName().includes("Voidgloom Seraph")) { + if ((e2.getX() - e[f.posX.Entity]) ** 2 + (e2.getY() - e[f.posY.Entity]) ** 2 + (e2.getZ() - e[f.posZ.Entity]) ** 2 < closestDist) { + closestDist = (e2.getX() - e[f.posX.Entity]) ** 2 + (e2.getY() - e[f.posY.Entity]) ** 2 + (e2.getZ() - e[f.posZ.Entity]) ** 2; + closestEIsGaming = this.emanBoss ? e2.getUUID().toString() === this.emanBoss.getUUID().toString() : false; } + } + }); - dis1 = true - this.bossSpawnedMessage = true + if (closestEIsGaming && new Item(e[m.getEquipmentInSlot](4)).getNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").getRawNBT()[m.getTagList]("textures", 10)[m.getCompoundTagAt](0)[m.getString.NBTTagCompound]("Value") === "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0=") { + this.eyeE.push(new Entity(e)); } - }) - if (!dis1) { - this.lastBossNotSpawnedTime = Date.now() - this.bossSpawnedMessage = false + // console.log(":" + new Item(e[m.getEquipmentInSlot](4)).getNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").getRawNBT().func_150295_c("textures", 10).func_150305_b(0).func_74779_i("Value")) + } } - - this.todoE.forEach((e)=>{ - try{ - if(e instanceof net.minecraft.entity.item.EntityArmorStand && e[m.getEquipmentInSlot](4)){ - if(e[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]() === "Beacon"){ - - let closestEIsGaming = false - let closestDist = Infinity - World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach(e2=>{ - if(e2.getName().includes("Voidgloom Seraph")){ - if((e2.getX() - e[f.posX.Entity])**2 + (e2.getY() - e[f.posY.Entity])**2 + (e2.getZ() - e[f.posZ.Entity])**2 < closestDist){ - closestDist = (e2.getX() - e[f.posX.Entity])**2 + (e2.getY() - e[f.posY.Entity])**2 + (e2.getZ() - e[f.posZ.Entity])**2 - closestEIsGaming = this.emanBoss?e2.getUUID().toString()===this.emanBoss.getUUID().toString():false - } - } - }) - if(closestEIsGaming){ - this.beaconE.push(e) - } - } - if(e[m.getEquipmentInSlot](4)[m.getDisplayName.ItemStack]().startsWith("§a")){ - - let closestEIsGaming = false - let closestDist = Infinity - World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach(e2=>{ - if(e2.getName().includes("Voidgloom Seraph")){ - if((e2.getX() - e[f.posX.Entity])**2 + (e2.getY() - e[f.posY.Entity])**2 + (e2.getZ() - e[f.posZ.Entity])**2 < closestDist){ - closestDist = (e2.getX() - e[f.posX.Entity])**2 + (e2.getY() - e[f.posY.Entity])**2 + (e2.getZ() - e[f.posZ.Entity])**2 - closestEIsGaming = this.emanBoss?e2.getUUID().toString()===this.emanBoss.getUUID().toString():false - } - } - }) - - if(closestEIsGaming && new Item(e[m.getEquipmentInSlot](4)).getNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").getRawNBT()[m.getTagList]("textures", 10)[m.getCompoundTagAt](0)[m.getString.NBTTagCompound]("Value") === "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0="){ - this.eyeE.push(new Entity(e)) - } - // console.log(":" + new Item(e[m.getEquipmentInSlot](4)).getNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").getRawNBT().func_150295_c("textures", 10).func_150305_b(0).func_74779_i("Value")) - } - } - - if(e[m.getCustomNameTag]() && e[m.getCustomNameTag]().includes("Voidgloom Seraph")){ - if(Date.now()-this.nextIsBoss < 3000){ - this.emanBoss = new Entity(e) - this.nextIsBoss = false - } - } - }catch(_){console.log(JSON.stringify(_, undefined, 2))} - }) - this.todoE = this.todoE2 - this.todoE2 = [] - - if(this.emanBoss && this.emanBoss.getEntity()[f.isDead]) this.emanBoss = undefined - this.eyeE = this.eyeE.filter(e=>!e.getEntity()[f.isDead]) - this.beaconE = this.beaconE.filter((e)=>{ - if(e[f.isDead]){ - this.deadE.push([Date.now(), e[m.getUniqueID.Entity]().toString()]) - - let pos = [e[f.posX.Entity]+0.5, e[f.posY.Entity]+0.7, e[f.posZ.Entity]+0.5] - //check for a beacon block within 5 blocks of pos - if(World.getBlockAt(0,0,0).getID){ - for(let x = pos[0] - 5; x <= pos[0] + 5; x++){ - for(let y = pos[1] - 5; y <= pos[1] + 5; y++){ - for(let z = pos[2] - 5; z <= pos[2] + 5; z++){ - if(World.getBlockAt(Math.floor(x), Math.floor(y), Math.floor(z)).getID() === 138){ - this.beaconLocations[e[m.getUniqueID.Entity]().toString()] = [Math.floor(x), Math.floor(y), Math.floor(z)] - } - } - } - } - }else{ //CT 2.0 support - for(let x = pos[0] - 5; x <= pos[0] + 5; x++){ - for(let y = pos[1] - 5; y <= pos[1] + 5; y++){ - for(let z = pos[2] - 5; z <= pos[2] + 5; z++){ - if(World.getBlockAt(Math.floor(x), Math.floor(y), Math.floor(z)).getType().getID() === 138){ - this.beaconLocations[e[m.getUniqueID.Entity]().toString()] = [Math.floor(x), Math.floor(y), Math.floor(z)] - } - } - } - } + if (e[m.getCustomNameTag]() && e[m.getCustomNameTag]().includes("Voidgloom Seraph")) { + if (Date.now() - this.nextIsBoss < 3000) { + this.emanBoss = new Entity(e); + this.nextIsBoss = false; + } + } + } catch (_) { + console.log(JSON.stringify(_, undefined, 2)); + } + }); + this.todoE = this.todoE2; + this.todoE2 = []; + + if (this.emanBoss && this.emanBoss.getEntity()[f.isDead]) this.emanBoss = undefined; + this.eyeE = this.eyeE.filter((e) => !e.getEntity()[f.isDead]); + this.beaconE = this.beaconE.filter((e) => { + if (e[f.isDead]) { + this.deadE.push([Date.now(), e[m.getUniqueID.Entity]().toString()]); + + let pos = [e[f.posX.Entity] + 0.5, e[f.posY.Entity] + 0.7, e[f.posZ.Entity] + 0.5]; + //check for a beacon block within 5 blocks of pos + if (World.getBlockAt(0, 0, 0).getID) { + for (let x = pos[0] - 5; x <= pos[0] + 5; x++) { + for (let y = pos[1] - 5; y <= pos[1] + 5; y++) { + for (let z = pos[2] - 5; z <= pos[2] + 5; z++) { + if (World.getBlockAt(Math.floor(x), Math.floor(y), Math.floor(z)).getID() === 138) { + this.beaconLocations[e[m.getUniqueID.Entity]().toString()] = [Math.floor(x), Math.floor(y), Math.floor(z)]; } - - // if(!this.beaconLocations[e[m.getUniqueID.Entity]().toString()]){ - // console.log("Diddnt find beacon wtf?????") - // } - - return false - } - return true - }) - - this.beaconE.forEach((e)=>{ - if(!this.beaconPoints[e[m.getUniqueID.Entity]().toString()])this.beaconPoints[e[m.getUniqueID.Entity]().toString()] = [] - - this.beaconPoints[e[m.getUniqueID.Entity]().toString()].push([e[f.posX.Entity]+0.5, e[f.posY.Entity]+0.7, e[f.posZ.Entity]+0.5])//x, y, z - }) - - this.deadE = this.deadE.filter(e=>{ - if(Date.now()-e[0] > 5000){ - delete this.beaconPoints[e[1]] - delete this.beaconLocations[e[1]] - return false - } - - let location = this.beaconLocations[e[1]] - if(!location){ - delete this.beaconPoints[e[1]] - delete this.beaconLocations[e[1]] - return false + } } - - if(World.getBlockAt(0,0,0).getID){ - if(World.getBlockAt(location[0], location[1], location[2]).getID() === 138){ - Client.showTitle("&cGO TO BEACON!","&c" + (Math.max(0,5000-(Date.now()-e[0]))/1000).toFixed(1) + "s",0,20,10) - World.playSound("note.pling",1,1) - }else{ - delete this.beaconPoints[e[1]] - delete this.beaconLocations[e[1]] - return false - } - }else{ //CT 2.0 support - if(World.getBlockAt(location[0], location[1], location[2]).getType().getID() === 138){ - Client.showTitle("&cGO TO BEACON!","&c" + (Math.max(0,5000-(Date.now()-e[0]))/1000).toFixed(1) + "s",0,20,10) - World.playSound("note.pling",1,1) - }else{ - delete this.beaconPoints[e[1]] - delete this.beaconLocations[e[1]] - return false + } + } else { + //CT 2.0 support + for (let x = pos[0] - 5; x <= pos[0] + 5; x++) { + for (let y = pos[1] - 5; y <= pos[1] + 5; y++) { + for (let z = pos[2] - 5; z <= pos[2] + 5; z++) { + if (World.getBlockAt(Math.floor(x), Math.floor(y), Math.floor(z)).getType().getID() === 138) { + this.beaconLocations[e[m.getUniqueID.Entity]().toString()] = [Math.floor(x), Math.floor(y), Math.floor(z)]; } + } } - return true - }) + } + } - if(this.emanBoss){ - this.emanHpElement.setText("&6Enderman&7> " + (this.emanBoss.getName().split("Voidgloom Seraph")[1]||"").trim()) - }else{ - this.emanHpElement.setText("") + // if(!this.beaconLocations[e[m.getUniqueID.Entity]().toString()]){ + // console.log("Diddnt find beacon wtf?????") + // } + + return false; + } + return true; + }); + + this.beaconE.forEach((e) => { + if (!this.beaconPoints[e[m.getUniqueID.Entity]().toString()]) this.beaconPoints[e[m.getUniqueID.Entity]().toString()] = []; + + this.beaconPoints[e[m.getUniqueID.Entity]().toString()].push([e[f.posX.Entity] + 0.5, e[f.posY.Entity] + 0.7, e[f.posZ.Entity] + 0.5]); //x, y, z + }); + + this.deadE = this.deadE.filter((e) => { + if (Date.now() - e[0] > 5000) { + delete this.beaconPoints[e[1]]; + delete this.beaconLocations[e[1]]; + return false; + } + + let location = this.beaconLocations[e[1]]; + if (!location) { + delete this.beaconPoints[e[1]]; + delete this.beaconLocations[e[1]]; + return false; + } + + if (World.getBlockAt(0, 0, 0).getID) { + if (World.getBlockAt(location[0], location[1], location[2]).getID() === 138) { + Client.showTitle("&cGO TO BEACON!", "&c" + (Math.max(0, 5000 - (Date.now() - e[0])) / 1000).toFixed(1) + "s", 0, 20, 10); + World.playSound("note.pling", 1, 1); + } else { + delete this.beaconPoints[e[1]]; + delete this.beaconLocations[e[1]]; + return false; + } + } else { + //CT 2.0 support + if (World.getBlockAt(location[0], location[1], location[2]).getType().getID() === 138) { + Client.showTitle("&cGO TO BEACON!", "&c" + (Math.max(0, 5000 - (Date.now() - e[0])) / 1000).toFixed(1) + "s", 0, 20, 10); + World.playSound("note.pling", 1, 1); + } else { + delete this.beaconPoints[e[1]]; + delete this.beaconLocations[e[1]]; + return false; } + } + return true; + }); + + if (this.emanBoss) { + this.emanHpElement.setText("&6Enderman&7> " + (this.emanBoss.getName().split("Voidgloom Seraph")[1] || "").trim()); + } else { + this.emanHpElement.setText(""); } + } - apiLoad(data, dataType, isSoopyServer, isLatest){ - if(!isSoopyServer || !isLatest) return - if(dataType !== "skyblock") return + apiLoad(data, dataType, isSoopyServer, isLatest) { + if (!isSoopyServer || !isLatest) return; + if (dataType !== "skyblock") return; - this.slayerExp.zombie = data.data.profiles[data.data.stats.currentProfileId].members[Player.getUUID().replace(/-/g, "")].slayer.zombie.xp - this.slayerExp.spider = data.data.profiles[data.data.stats.currentProfileId].members[Player.getUUID().replace(/-/g, "")].slayer.spider.xp - this.slayerExp.wolf = data.data.profiles[data.data.stats.currentProfileId].members[Player.getUUID().replace(/-/g, "")].slayer.wolf.xp - this.slayerExp.enderman = data.data.profiles[data.data.stats.currentProfileId].members[Player.getUUID().replace(/-/g, "")].slayer.enderman.xp - } - - renderOverlay(){ - if(this.slainAlert.getValue() && this.bossSlainMessage){ - let scale = Renderer.getStringWidth(ChatLib.removeFormatting("BOSS SLAIN"))/(Renderer.screen.getWidth()*0.75) + this.slayerExp.zombie = data.data.profiles[data.data.stats.currentProfileId].members[Player.getUUID().replace(/-/g, "")].slayer.zombie.xp; + this.slayerExp.spider = data.data.profiles[data.data.stats.currentProfileId].members[Player.getUUID().replace(/-/g, "")].slayer.spider.xp; + this.slayerExp.wolf = data.data.profiles[data.data.stats.currentProfileId].members[Player.getUUID().replace(/-/g, "")].slayer.wolf.xp; + this.slayerExp.enderman = data.data.profiles[data.data.stats.currentProfileId].members[Player.getUUID().replace(/-/g, "")].slayer.enderman.xp; + } - Renderer.scale(1/scale, 1/scale) - Renderer.drawString("&4BOSS SLAIN", (Renderer.screen.getWidth()*0.125)*scale, (Renderer.screen.getHeight()/2-9/scale)*scale) - Renderer.scale(1, 1) - } - if(this.spawnAlert.getValue() && this.bossSpawnedMessage && Date.now()-this.lastBossNotSpawnedTime<3000){ - let scale = Renderer.getStringWidth(ChatLib.removeFormatting("BOSS SPAWNED"))/(Renderer.screen.getWidth()*0.75) + renderOverlay() { + if (this.slainAlert.getValue() && this.bossSlainMessage) { + let scale = Renderer.getStringWidth(ChatLib.removeFormatting("BOSS SLAIN")) / (Renderer.screen.getWidth() * 0.75); - Renderer.scale(1/scale, 1/scale) - Renderer.drawString("&4BOSS SPAWNED", (Renderer.screen.getWidth()*0.125)*scale, (Renderer.screen.getHeight()/2-9/scale)*scale) - Renderer.scale(1, 1) - } - } - - step(){ - let averageExp = this.lastSlayerExps.reduce((a, b) => a + b, 0) / this.lastSlayerExps.length - let averageLength = (this.lastSlayerFinishes[this.lastSlayerFinishes.length-1] - this.lastSlayerFinishes[0])/(this.lastSlayerFinishes.length-1) - let runsperHour = 60000*60/averageLength - let expPerHour = averageExp*runsperHour - - if(Date.now()-this.lastSlayerFinishes[this.lastSlayerFinishes.length-1] < 60000*5 || (this.FeatureManager.features["dataLoader"].class.slayerXpToSpawn && this.FeatureManager.features["dataLoader"].class.slayerXpToSpawn[0] !== 0)){ - if(this.lastSlayerFinishes.length > 1){ - this.slayerSpeedRatesElement.setText("&6Slayer 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&6Kills/hour&7> &f" + Math.floor(runsperHour)) - }else{ - this.slayerSpeedRatesElement.setText("&6Slayer speed&7> &floading...\n&6Exp/hour&7> &floading...\n&6Kills/hour&7> &floading...") - } - }else{ - this.slayerSpeedRatesElement.setText("") - } + Renderer.scale(1 / scale, 1 / scale); + Renderer.drawString("&4BOSS SLAIN", Renderer.screen.getWidth() * 0.125 * scale, (Renderer.screen.getHeight() / 2 - 9 / scale) * scale); + Renderer.scale(1, 1); } + if (this.spawnAlert.getValue() && this.bossSpawnedMessage && Date.now() - this.lastBossNotSpawnedTime < 3000) { + let scale = Renderer.getStringWidth(ChatLib.removeFormatting("BOSS SPAWNED")) / (Renderer.screen.getWidth() * 0.75); - initVariables(){ - this.expOnKill = undefined - this.slainAlert = undefined - this.spawnAlert = undefined - this.slayerExp = undefined - this.slayerExpLoaded = undefined - this.lastSlayerType = undefined - this.lastSlayerExp = undefined - this.bossSpawnedMessage = undefined - this.lastBossNotSpawnedTime = undefined - this.bossSlainMessage = undefined - this.todoE = undefined - this.beaconPoints = undefined - this.beaconE = undefined - this.deadE = undefined - this.beaconLocations = undefined - this.emanBoss = undefined - this.eyeE = undefined - this.nextIsBoss = undefined - this.hudElements = [] - this.entityAttackEventLoaded = undefined - this.todoE2 = undefined - this.entityAttackEventE = undefined + Renderer.scale(1 / scale, 1 / scale); + Renderer.drawString("&4BOSS SPAWNED", Renderer.screen.getWidth() * 0.125 * scale, (Renderer.screen.getHeight() / 2 - 9 / scale) * scale); + Renderer.scale(1, 1); } - - onDisable(){ - this.initVariables() + } + + step() { + let averageExp = this.lastSlayerExps.reduce((a, b) => a + b, 0) / this.lastSlayerExps.length; + let averageLength = (this.lastSlayerFinishes[this.lastSlayerFinishes.length - 1] - this.lastSlayerFinishes[0]) / (this.lastSlayerFinishes.length - 1); + let runsperHour = (60000 * 60) / averageLength; + let expPerHour = averageExp * runsperHour; + + if (Date.now() - this.lastSlayerFinishes[this.lastSlayerFinishes.length - 1] < 60000 * 5 || (this.FeatureManager.features["dataLoader"].class.slayerXpToSpawn && this.FeatureManager.features["dataLoader"].class.slayerXpToSpawn[0] !== 0)) { + if (this.lastSlayerFinishes.length > 1) { + this.slayerSpeedRatesElement.setText("&6Slayer 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&6Kills/hour&7> &f" + Math.floor(runsperHour)); + } else { + this.slayerSpeedRatesElement.setText("&6Slayer speed&7> &fLoading...\n&6Exp/hour&7> &fLoading...\n&6Kills/hour&7> &fLoading..."); + } + } else { + this.slayerSpeedRatesElement.setText(""); } + } + + initVariables() { + this.expOnKill = undefined; + this.slainAlert = undefined; + this.spawnAlert = undefined; + this.slayerExp = undefined; + this.slayerExpLoaded = undefined; + this.lastSlayerType = undefined; + this.lastSlayerExp = undefined; + this.bossSpawnedMessage = undefined; + this.lastBossNotSpawnedTime = undefined; + this.bossSlainMessage = undefined; + this.todoE = undefined; + this.beaconPoints = undefined; + this.beaconE = undefined; + this.deadE = undefined; + this.beaconLocations = undefined; + this.emanBoss = undefined; + this.eyeE = undefined; + this.nextIsBoss = undefined; + this.hudElements = []; + this.entityAttackEventLoaded = undefined; + this.todoE2 = undefined; + this.entityAttackEventE = undefined; + } + + onDisable() { + this.initVariables(); + } } module.exports = { - class: new Slayers() -}
\ No newline at end of file + class: new Slayers(), +}; |