diff options
| author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-17 19:39:05 +0800 |
|---|---|---|
| committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-17 19:39:05 +0800 |
| commit | 431e4fc9d1657a50ebc34b8ac24f9bfaea06417f (patch) | |
| tree | 5987bb14f38d2999c682970429f34b41eb3e5826 /src/features/dungeonSolvers | |
| parent | e73f2efdf0f50aa775c540317394d46428e9704f (diff) | |
| download | SoopyV2-431e4fc9d1657a50ebc34b8ac24f9bfaea06417f.tar.gz SoopyV2-431e4fc9d1657a50ebc34b8ac24f9bfaea06417f.tar.bz2 SoopyV2-431e4fc9d1657a50ebc34b8ac24f9bfaea06417f.zip | |
Initial move to babel + change fetch to use async/await
Diffstat (limited to 'src/features/dungeonSolvers')
| -rw-r--r-- | src/features/dungeonSolvers/f7data.json | 263 | ||||
| -rw-r--r-- | src/features/dungeonSolvers/index.js | 1270 | ||||
| -rw-r--r-- | src/features/dungeonSolvers/metadata.json | 8 |
3 files changed, 1541 insertions, 0 deletions
diff --git a/src/features/dungeonSolvers/f7data.json b/src/features/dungeonSolvers/f7data.json new file mode 100644 index 0000000..72e3ec6 --- /dev/null +++ b/src/features/dungeonSolvers/f7data.json @@ -0,0 +1,263 @@ +[ + { + "type": "device", + "location": [ + 110, + 118, + 91 + ], + "phase": 0 + }, + { + "type": "terminal", + "location": [ + 110, + 112, + 73 + ], + "phase": 0 + }, + { + "type": "terminal", + "location": [ + 110, + 118, + 79 + ], + "phase": 0 + }, + { + "type": "terminal", + "location": [ + 90, + 111, + 92 + ], + "phase": 0 + }, + { + "type": "terminal", + "location": [ + 90, + 121, + 101 + ], + "phase": 0 + }, + { + "type": "lever", + "location": [ + 106, + 124, + 113 + ], + "phase": 0 + }, + { + "type": "lever", + "location": [ + 94, + 124, + 113 + ], + "phase": 0 + }, + { + "type": "terminal", + "location": [ + 68, + 108, + 122 + ], + "phase": 1 + }, + { + "type": "terminal", + "location": [ + 59, + 119, + 123 + ], + "phase": 1 + }, + { + "type": "device", + "location": [ + 60, + 131, + 142 + ], + "phase": 1 + }, + { + "type": "terminal", + "location": [ + 47, + 108, + 122 + ], + "phase": 1 + }, + { + "type": "lever", + "location": [ + 27, + 124, + 127 + ], + "phase": 1 + }, + { + "type": "terminal", + "location": [ + 40, + 123, + 123 + ], + "phase": 1 + }, + { + "type": "terminal", + "location": [ + 39, + 107, + 142 + ], + "phase": 1 + }, + { + "type": "lever", + "location": [ + 23, + 132, + 138 + ], + "phase": 1 + }, + { + "type": "terminal", + "location": [ + -1, + 108, + 112 + ], + "phase": 2 + }, + { + "type": "terminal", + "location": [ + 18, + 122, + 93 + ], + "phase": 2 + }, + { + "type": "terminal", + "location": [ + -1, + 118, + 93 + ], + "phase": 2 + }, + { + "type": "terminal", + "location": [ + -1, + 108, + 77 + ], + "phase": 2 + }, + { + "type": "device", + "location": [ + -3, + 120, + 77 + ], + "phase": 2 + }, + { + "type": "lever", + "location": [ + 14, + 122, + 55 + ], + "phase": 2 + }, + { + "type": "lever", + "location": [ + 2, + 122, + 55 + ], + "phase": 2 + }, + { + "type": "terminal", + "location": [ + 44, + 120, + 30 + ], + "phase": 3 + }, + { + "type": "device", + "location": [ + 63, + 126, + 34 + ], + "phase": 3 + }, + { + "type": "terminal", + "location": [ + 72, + 114, + 47 + ], + "phase": 3 + }, + { + "type": "lever", + "location": [ + 86, + 128, + 46 + ], + "phase": 3 + }, + { + "type": "lever", + "location": [ + 84, + 121, + 34 + ], + "phase": 3 + }, + { + "type": "terminal", + "location": [ + 41, + 108, + 30 + ], + "phase": 3 + }, + { + "type": "terminal", + "location": [ + 67, + 108, + 30 + ], + "phase": 3 + } +]
\ No newline at end of file diff --git a/src/features/dungeonSolvers/index.js b/src/features/dungeonSolvers/index.js new file mode 100644 index 0000000..a959a66 --- /dev/null +++ b/src/features/dungeonSolvers/index.js @@ -0,0 +1,1270 @@ +/// <reference types="../../../../CTAutocomplete" /> +/// <reference lib="es2015" /> +import { f, m } from "../../../mappings/mappings"; +import Feature from "../../featureClass/class"; +import { addNotation, numberWithCommas } from "../../utils/numberUtils"; +import * as renderUtils from "../../utils/renderUtils"; +import HudTextElement from "../hud/HudTextElement"; +import LocationSetting from "../settings/settingThings/location"; +import ToggleSetting from "../settings/settingThings/toggle"; +import TextSetting from "../settings/settingThings/textSetting"; +import { fetch } from "../../utils/networkUtils"; +import { delay } from "../../utils/delayUtils"; +import { Waypoint } from "../../utils/renderJavaUtils"; +import { calculateDistanceQuick } from "../../utils/utils"; +import { drawLinePoints } from "../../utils/renderUtils"; + +const entityGuardian = Java.type("net.minecraft.entity.monster.EntityGuardian") + +const MCBlock = Java.type("net.minecraft.block.Block"); +const EntityBlaze = Java.type("net.minecraft.entity.monster.EntityBlaze"); +let translate; +try { + translate = net.minecraft.util.StringTranslate.func_74808_a(); +} catch (e) { + //player doesent have translate (using english default) +} +let wrongColorList = { + "light grey": "silver", + "wool": "white wool", + "ink": "black ink", + "lapis": "blue lapis", + "cocoa": "brown cocoa" +} + +class DungeonSolvers extends Feature { + constructor() { + super(); + } + + isInDungeon() { + if (!this.FeatureManager || !this.FeatureManager.features["dataLoader"]) return false + return this.FeatureManager.features["dataLoader"].class.isInDungeon + } + + 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.bonzoMaskTimer = 0; + this.fraggedBonzoMaskTimer = 0; + this.spiritMaskTimer = 0; + this.eraseBonzoTimer = true; + this.bonzoMaskCooldown = 0; + + this.lastWorldload = Date.now() + 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.fireFreezeTimer = new ToggleSetting("Timer for when to fire freeze in m3/f3", "", true, "ff_timer", this); + this.fireFreezeTimerElement = new HudTextElement().setToggleSetting(this.fireFreezeTimer).setLocationSetting(new LocationSetting("Fire freeze timer location", "Allows you to edit the location of the timer", "fire_freeze_location", this, [10, 80, 3, 1]).requires(this.fireFreezeTimer).editTempText("&dFire freeze in: &c1.57s")); + + this.hudElements.push(this.spiritBearSpawnElement); + this.hudElements.push(this.fireFreezeTimerElement); + 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("&dScore: 120\n&aS+ ??\n&aS ??")); + + 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.respawnTimerTerra = new ToggleSetting("Terracotter respawn timer", "", true, "f6_timer_thing", 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.bonzoMaskTimer = 0; + this.fraggedBonzoMaskTimer = 0; + this.spiritMaskTimer = 0; + this.eraseBonzoTimer = true; + }); + this.registerStep(false, 30, this.getBonzoMaskCooldown); + this.bonzoSpiritMaskTimer = new ToggleSetting("Timer for when bonzo/spirit mask will be ready", "works for both bonzo masks, hides bonzo masks' timers after you leave the run", false, "bonzo_mask_timer", this); + this.bonzoSpiritMaskTimerElement = new HudTextElement().setToggleSetting(this.bonzoSpiritMaskTimer).setLocationSetting(new LocationSetting("Bonzo/Spirit Mask timer location", "Allows you to edit the location of the timer", "bonzo_mask_timer_location", this, [10, 100, 1, 1]).requires(this.bonzoSpiritMaskTimer).editTempText("&9Bonzo's Mask: &c157s")); + this.hudElements.push(this.bonzoSpiritMaskTimerElement); + this.spiritMaskOutsideDungeon = new ToggleSetting("Spirit Mask Timer Outside Dungeons", "should spirit mask timer be shown outside dungeon?", false, "spirit_mask_timer", this).requires(this.bonzoSpiritMaskTimer); + + this.normalBonzoMask = new ToggleSetting("Bonzo Mask Proc'ed Alert", "Enable this to change the message", true, "bonzo_mask_alert", this).requires(this.bonzoSpiritMaskTimer); + this.normalBonzoMaskMessage = new TextSetting("Bonzo Mask Proc'ed Message", "change bonzo mask proc message here", "&cBonzo Mask Used", "bonzo_mask_alert_message", this, "&cBonzo Mask Used", false).requires(this.normalBonzoMask); + this.fraggedBonzoMask = new ToggleSetting("⚚ Bonzo Mask Proc'ed Alert", "Enable this to change the message", true, "fragged_bonzo_mask_alert", this).requires(this.bonzoSpiritMaskTimer); + this.fraggedBonzoMaskMessage = new TextSetting("⚚ Bonzo Mask Proc'ed Message", "change bonzo mask proc message here", "&c⚚ Bonzo Mask Used", "fragged_bonzo_mask_alert_message", this, "&c⚚ Bonzo Mask Used", false).requires(this.fraggedBonzoMask); + this.spiritMask = new ToggleSetting("Spirit Mask Proc'ed Alert", "Enable this to change the message", true, "spirit_mask_alert", this).requires(this.bonzoSpiritMaskTimer); + this.spiritMaskMessage = new TextSetting("Spirit Mask Proc'ed Message", "change spirit mask proc message here", "&cSpirit Mask Used", "spirit_mask_alert_message", this, "&cSpirit Mask Used", false).requires(this.spiritMask); + + this.registerChat("&r&aYour &r&9Bonzo's Mask &r&asaved your life!&r", () => { + this.eraseBonzoTimer = false; + if (this.bonzoSpiritMaskTimer.getValue()) { + this.bonzoMaskTimer = Date.now() + this.bonzoMaskCooldown * 1000; + } + if (this.normalBonzoMask.getValue()) { + let m = this.normalBonzoMaskMessage.getValue() + Client.showTitle(m ? m : "&cBonzo Mask Used", "", 0, 60, 10) + } + }) + + this.registerChat("&r&aYour &r&9⚚ Bonzo's Mask &r&asaved your life!&r", () => { + this.eraseBonzoTimer = false; + if (this.bonzoSpiritMaskTimer.getValue()) { + this.fraggedBonzoMaskTimer = Date.now() + this.bonzoMaskCooldown * 1000; + } + if (this.fraggedBonzoMask.getValue()) { + let m = this.fraggedBonzoMaskMessage.getValue() + Client.showTitle(m ? m : "&c⚚ Bonzo Mask Used", "", 0, 60, 10) + } + }) + + this.registerChat("&r&6Second Wind Activated&r&a! &r&aYour Spirit Mask saved your life!&r", () => { + if (this.bonzoSpiritMaskTimer.getValue()) { + if (this.spiritMaskOutsideDungeon.getValue() ? true : !this.eraseBonzoTimer) { + this.spiritMaskTimer = Date.now() + 30 * 1000; + } + } + if (this.fraggedBonzoMask.getValue()) { + let m = this.spiritMaskMessage.getValue() + Client.showTitle((m ? m : "&cSpirit Mask Used"), "", 0, 60, 10) + } + }) + + this.registerStep(true, 10, () => { + if (!this.bonzoSpiritMaskTimer.getValue()) return + let timerText = "" + if (this.spiritMaskOutsideDungeon.getValue() ? true : !this.eraseBonzoTimer) { + if (this.spiritMask.getValue()) { + let timer1 = Math.round((this.spiritMaskTimer - Date.now()) / 100) / 10 + timerText += "&5Spirit Mask: " + (timer1 > 0 ? "&c" + timer1 + "&6s" : "&6READY") + "\n" + } + } + if (!this.eraseBonzoTimer) { + if (this.normalBonzoMask.getValue()) { + let timer2 = Math.round((this.bonzoMaskTimer - Date.now()) / 100) / 10 + timerText += "&9Bonzo's Mask: " + (timer2 > 0 ? "&c" + timer2 + "&6s" : "&6READY") + "\n" + } + if (this.fraggedBonzoMask.getValue()) { + let timer3 = Math.round((this.fraggedBonzoMaskTimer - Date.now()) / 100) / 10 + timerText += "&9⚚ Bonzo's Mask: " + (timer3 > 0 ? "&c" + timer3 + "&6s" : "&6READY") + } + } + this.bonzoSpiritMaskTimerElement.setText(timerText) + }) + this.forgorEnabled = new ToggleSetting("Change withermancer death message to forgor ", "", true, "withermancer_forgor", this); + this.f7waypoints = new ToggleSetting("Waypoints for P3 F7/M7", "(Only shows unfinished ones)", true, "f7_waypoints", this); + + this.IceSprayWarn = new ToggleSetting("Ice Spray Drop Ping", "Renders a big title so you don't miss ice spray wands", false, "ice_spray_ping", this).contributor("EmeraldMerchant"); + + this.guardianHp = new ToggleSetting("m3/f3 guardian hp", "", true, "guardian_hp", 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.registerChat("&r&c ☠ ${info} and became a ghost&r&7.&r", (info, e) => { + let player = ChatLib.removeFormatting(info.split(" ")[0]) + + this.scanFirstDeathForSpiritPet(player) + }); + + 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.nameToUuid = { + "you": Player.getUUID().toString() + } + this.bloodX = -1; + this.bloodY = -1; + this.startSpawningTime = 0; + this.spawnIdThing = 0; + + this.failedPuzzleCount = 0; + this.totalPuzzleCount = 0; + this.completedPuzzleCount = 0; + + this.ezpz = false + + this.arrows = []; + this.blazes = []; + this.blazeX = -1; + this.blazeY = -1; + this.timersData = [] + + 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.renderEntityEvent = this.registerEvent("renderEntity", this.renderEntity); + + this.registerStep(true, 2, this.stepNotDung).registeredWhen(() => !this.isInDungeon()); + this.registerStep(true, 2, this.step).registeredWhen(() => this.isInDungeon()); + this.registerStep(false, 60, this.step) + this.registerStep(true, 10, this.step2).registeredWhen(() => this.isInDungeon()); + this.registerStep(true, 1, this.step_1fps).registeredWhen(() => this.isInDungeon()); + this.registerStep(false, 60 * 5, this.step_5min) + this.registerEvent("worldLoad", this.onWorldLoad); + + this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.isInDungeon()); + + this.bloodOpenedBonus = false; + this.goneInBonus = false; + this.mimicDead = false + this.inBoss = false + this.registerChat("&r&cThe &r&c&lBLOOD DOOR&r&c has been opened!&r", () => { + this.bloodOpenedBonus = true; + this.goneInBonus = true; + }); + this.registerChat("[BOSS] The Watcher: You have proven yourself. You may pass.", () => { + delay(5000, () => { + this.bloodOpenedBonus = false; + this.goneInBonus = true; + }) + }); + let enteredBossMessages = ["[BOSS] Maxor: WELL WELL WELL LOOK WHO’S HERE!", "[BOSS] Livid: Welcome, you arrive right on time. I am Livid, the Master of Shadows.", "[BOSS] Thorn: Welcome Adventurers! I am Thorn, the Spirit! And host of the Vegan Trials!", "[BOSS] The Professor: I was burdened with terrible news recently...", "[BOSS] Scarf: This is where the journey ends for you, Adventurers.", "[BOSS] Bonzo: Gratz for making it this far, but I’m basically unbeatable.", "[BOSS] Sadan: So you made it all the way here...and you wish to defy me? Sadan?!"] + enteredBossMessages.forEach(msg => { + this.registerChat(msg, () => { + this.goneInBonus = false; + this.bloodOpenedBonus = false; + this.inBoss = true + }); + }) + this.registerEvent("entityDeath", (entity) => { + if (entity.getClassName() === "EntityZombie") { + if (entity.getEntity().func_70631_g_()) { + if (entity.getEntity().func_82169_q(0) === null && entity.getEntity().func_82169_q(1) === null && entity.getEntity().func_82169_q(2) === null && entity.getEntity().func_82169_q(3) === null) { + this.mimicDead = true + } + } + } + }) + let mimicDeadMessages = ["$SKYTILS-DUNGEON-SCORE-MIMIC$", "Mimic Killed!", "Mimic Dead!", "Mimic dead!"] + this.registerChat("&r&9Party &8> ${msg}", (msg) => { + mimicDeadMessages.forEach(dmsg => { + if (msg.includes(dmsg)) this.mimicDead = true + }) + }) + + this.registerChat("&r&aDungeon starts in 1 second.&r", () => { + this.goneInBonus = false; + this.bloodOpenedBonus = false; + + this.firstDeath = false + this.firstDeathHadSpirit = false + }) + + this.registerChat("&r&aDungeon starts in 1 second. Get ready!&r", () => { + this.goneInBonus = false; + this.bloodOpenedBonus = false; + + this.firstDeath = false + this.firstDeathHadSpirit = false + }) + + this.firstDeath = false + this.firstDeathHadSpirit = false + + + this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(() => this.isInDungeon() && !this.inBoss); + + + this.onWorldLoad(); + + this.registerEvent("tick", () => { + this.terminals.forEach(w => w.update()) + this.levers.forEach(w => w.update()) + this.devices.forEach(w => w.update()) + }).registeredWhen(() => this.f7waypoints.getValue()) + this.terminals = [] + this.levers = [] + this.devices = [] + this.data = [] + this.area = -1 + this.registerChat("[BOSS] Goldor: You have done it, you destroyed the factory…", () => { + this.area = -1 + this.areaUpdated() + }) + this.registerEvent("worldLoad", () => { + if (this.area !== -1) { + this.area = -1 + this.areaUpdated() + } + }) + this.registerChat("[BOSS] Goldor: Who dares trespass into my domain?", () => { + this.area = 0 + this.areaUpdated() + }) + + this.loadf7data() + + this.ffCountdownTo = 0 + this.registerChat("[BOSS] The Professor: Oh? You found my Guardians one weakness?", () => { + this.ffCountdownTo = Date.now() + 5000 + + delay(5000, () => { + this.ffCountdownTo = 0 + }) + }) + + this.registerChat("${name} activated a lever! (${start}/${end})", (name, start, end) => { + let player = World.getPlayerByName(ChatLib.removeFormatting(name)) + + if (!player) return + + let closestDist = calculateDistanceQuick([this.levers[0].params.x, this.levers[0].params.y, this.levers[0].params.z], [player.getX(), player.getY(), player.getZ()]) + let closest = this.levers[0] + this.levers.forEach(l => { + if (!l.rendering) return + let dist = calculateDistanceQuick([l.params.x, l.params.y, l.params.z], [player.getX(), player.getY(), player.getZ()]) + if (dist < closestDist) { + closestDist = dist + closest = l + } + }) + closest.stopRender() + + + if (start == "0" || start == end) { + this.area++ + this.areaUpdated() + } + }).registeredWhen(() => this.f7waypoints.getValue()) + + this.registerChat("${name} completed a device! (${start}/${end})", (name, start, end) => { + + let closest = this.devices[0] + + closest.stopRender() + + if (start == "0" || start == end) { + this.area++ + this.areaUpdated() + } + }).registeredWhen(() => this.f7waypoints.getValue()) + + this.registerChat("${name} activated a terminal! (${start}/${end})", (name, start, end) => { + let player = World.getPlayerByName(ChatLib.removeFormatting(name)) + + if (!player) return + + let closestDist = calculateDistanceQuick([this.terminals[0].params.x, this.terminals[0].params.y, this.terminals[0].params.z], [player.getX(), player.getY(), player.getZ()]) + let closest = this.terminals[0] + this.terminals.forEach(l => { + if (!l.rendering) return + let dist = calculateDistanceQuick([l.params.x, l.params.y, l.params.z], [player.getX(), player.getY(), player.getZ()]) + if (dist < closestDist) { + closestDist = dist + closest = l + } + }) + closest.stopRender() + + + if (start == "0" || start == end) { + this.area++ + this.areaUpdated() + } + }).registeredWhen(() => this.f7waypoints.getValue()) + //§r§6Soopyboo32§r§a activated a lever! (§r§c8§r§a/8)§r + //§r§6Soopyboo32§r§a completed a device! (§r§c3§r§a/8)§r + //§r§bBossmanLeo§r§a activated a terminal! (§r§c2§r§a/8)§r + + this.inf6boss = false + this.registerStep(true, 1, () => { + this.inf6boss = this.getCurrentRoomId() === "sadan" + }) + + let packetRecieved = this.registerCustom("packetReceived", this.packetReceived).registeredWhen(() => this.inf6boss && this.respawnTimerTerra.getValue()) + + try { + packetRecieved.trigger.setPacketClasses([net.minecraft.network.play.server.S23PacketBlockChange, net.minecraft.network.play.server.S22PacketMultiBlockChange]) + } catch (e) { }//older ct version + + } + getBonzoMaskCooldown() { + [...Player.getInventory().getItems()].forEach(i => { + if (!i) return + let itemName = i.getName() + if (itemName.removeFormatting().includes("Bonzo's Mask")) { + i.getLore().forEach(line => { + if (line.includes("Cooldown:")) { + this.bonzoMaskCooldown = Number(line.removeFormatting().split("n: ")[1].replace("s", "")) + } + }) + } + }) + } + getCurrentRoomId() { + if (Scoreboard.getLines().length === 0) return + let id = ChatLib.removeFormatting(Scoreboard.getLineByIndex(Scoreboard.getLines().length - 1).getName()).trim().split(" ").pop() + + return id + } + getBlockIdFromState(state) { + return MCBlock[m.getStateId](state) + } + + packetReceived(packet, event) { + if (!this.inf6boss || !this.respawnTimerTerra.getValue()) return + + let packetType = new String(packet.class.getSimpleName()).valueOf() + if (packetType === "S23PacketBlockChange") { + let position = new BlockPos(packet[m.getBlockPosition.S23PacketBlockChange]()) + let blockState = this.getBlockIdFromState(packet[m.getBlockState.S23PacketBlockChange]()) + let oldBlockState = this.getBlockIdFromState(World.getBlockStateAt(position)) + + if (oldBlockState === 0 && blockState === 4240 && this.inf6boss) { + this.timerThing(position) + } + } + if (packetType === "S22PacketMultiBlockChange") { + packet[m.getChangedBlocks]().forEach(b => { + let position = new BlockPos(b[m.getPos.S22PacketMultiBlockChange$BlockUpdateData]()) + let blockState = this.getBlockIdFromState(b[m.getBlockState.S22PacketMultiBlockChange$BlockUpdateData]()) + let oldBlockState = this.getBlockIdFromState(World.getBlockStateAt(position)) + + if (oldBlockState === 0 && blockState === 4240 && this.inf6boss) { + this.timerThing(position) + } + }) + } + } + + timerThing(position) { + this.timersData.push([position, Date.now() + (this.FeatureManager.features["dataLoader"].class.dungeonFloor[0] === "M" ? 3500 : 5000)]) + } + + areaUpdated() { + this.terminals.forEach(w => w.stopRender()) + this.levers.forEach(w => w.stopRender()) + this.devices.forEach(w => w.stopRender()) + + this.terminals = [] + this.levers = [] + this.devices = [] + + if (!this.f7waypoints.getValue()) return + + this.data.forEach(term => { + if (term.phase !== this.area) return + + if (term.type === "lever") { + this.levers.push(new Waypoint(term.location[0], term.location[1], term.location[2], 1, 0, 0, { name: "Lever" }).startRender()) + } + if (term.type === "terminal") { + this.terminals.push(new Waypoint(term.location[0], term.location[1], term.location[2], 1, 0, 0, { name: "Terminal" }).startRender()) + } + if (term.type === "device") { + this.devices.push(new Waypoint(term.location[0], term.location[1], term.location[2], 1, 0, 0, { name: "Device" }).startRender()) + } + }) + } + + loadf7data() { + this.unloadf7data() + + let data = FileLib.read("SoopyV2", "features/dungeonSolvers/f7data.json") + data = JSON.parse(data) + + this.data = data + } + + unloadf7data() { + this.terminals.forEach(w => w.stopRender()) + this.levers.forEach(w => w.stopRender()) + this.devices.forEach(w => w.stopRender()) + + this.terminals = [] + this.levers = [] + this.devices = [] + this.data = [] + this.area = 0 + } + + step_5min() { + this.ezpz = false + if (!this.FeatureManager.features["dataLoader"].class.mayorData) return + if (this.FeatureManager.features["dataLoader"].class.mayorData.mayor.name === "Paul") { + if (this.FeatureManager.features["dataLoader"].class.currentMayorPerks.has("EZPZ")) { + this.ezpz = true + } + } + } + + calculateDungeonScore() { + if (!this.FeatureManager.features["dataLoader"].class.dungeonFloor) { + this.scoreElement.setText(""); + return; + } + + if (!this.FeatureManager.features["dataLoader"].class.stats.Deaths) return + + // Information about the dungeon + let deaths = parseInt(this.FeatureManager.features["dataLoader"].class.stats.Deaths.replace("(", "").replace(")", "")); + + 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 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 crypts = parseInt(this.FeatureManager.features["dataLoader"].class.stats["Crypts"]); + + 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 + this.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) + this.mimicDead * 2 + this.ezpz * 10; + + //Calculating secrets for s/s+ + + let hypotheticalSkillScore = Math.floor(Math.max(20, (20 - (this.failedPuzzleCount) * 10 + 80 - deaths * 2 + this.firstDeathHadSpirit))); + let hypotheticalSpeedScore = speedScore + + //Calculating for S + let hypotheticalBonusScoreS = Math.min(5, crypts) + this.mimicDead * 2 + this.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 + this.mimicDead * 2 + this.ezpz * 10 + hypotheticalScoreGottenS += hypotheticalBonusScoreS + + let sPossible = hypotheticalScoreGottenS >= 270 + + //Calculating for S+ + let hypotheticalBonusScoreSplus = 5 + this.mimicDead * 2 + this.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 + this.mimicDead * 2 + this.ezpz * 10 + hypotheticalScoreGottenSPlus += hypotheticalBonusScoreSplus + + //Setting hud element + let sPlusText = currentSecretsFound === 0 ? "??" : (skillScore + exploreScore + speedScore + bonus) >= 300 ? "✔" : splusPossible ? `(${hypotheticalScoreGottenSPlus}): ${currentSecretsFound}/${splusNeededSecrets} +${crypts}c/${splusCryptsNeeded}` : "✖" + let sText = currentSecretsFound === 0 ? " ??" : (skillScore + exploreScore + speedScore + bonus) >= 270 ? " ✔" : sPossible ? ` (${hypotheticalScoreGottenS}): ${currentSecretsFound}/${sNeededSecrets} +${crypts}c/${sCryptsNeeded}` : "✖" + + this.scoreElement.setText(`&dScore: ${skillScore + exploreScore + speedScore + bonus}\n&aS+ ${sPlusText}\n&aS ${sText}`); + } + + async scanFirstDeathForSpiritPet(username) { + if (this.firstDeath) return + this.firstDeath = true + if (!this.nameToUuid[username.toLowerCase()]) return + let uuid = this.nameToUuid[username.toLowerCase()]?.replace(/-/g, "") + + if (this.FeatureManager.features["globalSettings"] && this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue()) { + let data = await fetch(`https://api.hypixel.net/skyblock/profiles?key=${this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue()}&uuid=${uuid}`).json() + if (!data.success) return + + let latestProfile = [0, undefined] < |
