From 533ad02163c43a0370b6f4308bf61d488d32358f Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Thu, 25 Apr 2024 00:25:20 -0400 Subject: [PATCH 01/33] failure. --- asm/asm.js | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 asm/asm.js diff --git a/asm/asm.js b/asm/asm.js new file mode 100644 index 00000000..8662f84e --- /dev/null +++ b/asm/asm.js @@ -0,0 +1,51 @@ +const modifiedWords = [ + { phrase: 'hello', replacement: 'hi', enabled: true }, + { phrase: 'world', replacement: 'planet', enabled: true } +]; + +/** + * Modify the original text based on the defined modified words. + * + * @param {string} originalText - The original text to be modified. + * @returns {string} The modified text. + */ +function modifyText(originalText) { + ChatLib.chat(originalText); + let modifiedText = originalText; + + for (const word of modifiedWords) { + if (word.enabled) { + modifiedText = modifiedText.replace(new RegExp(word.phrase, 'gi'), word.replacement); + } + } + + return modifiedText; +} + +export default ASM => { + const { desc, L, OBJECT, JumpCondition, BOOLEAN } = ASM; + + print("Start Test"); + + ASM.injectBuilder( + 'net/minecraft/client/gui/FontRenderer', + 'renderStringAtPos', + desc("Ljava/lang/String;", "FFIZLnet/minecraft/client/renderer/Matrix4f;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ZII)V"), + ASM.At(ASM.At.HEAD) + ) + .instructions($ => { + $.aload(0); + $.invokeJS("modifyText"); + const result = $.astore(); + + // Check if the result is undefined to prevent crashes + $.aload(result.index); + $.instanceof('org/mozilla/javascript/Undefined'); + $.ifClause([JumpCondition.TRUE], $ => { + $.return(); + }); + }) + .execute(); + + print("End Test"); +}; From e6a5aa4418ec6f87eefa4869a0f4d4d73a85fc1d Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Thu, 25 Apr 2024 13:55:13 -0400 Subject: [PATCH 02/33] Fixed overlay width --- changelog.json | 2 +- utils/overlay.js | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/changelog.json b/changelog.json index 08d562b8..ca6d902f 100644 --- a/changelog.json +++ b/changelog.json @@ -1,3 +1,3 @@ [ - "- TBD" + "- Fixed overlay width being off on bold" ] \ No newline at end of file diff --git a/utils/overlay.js b/utils/overlay.js index b91136bb..2286cc08 100644 --- a/utils/overlay.js +++ b/utils/overlay.js @@ -53,7 +53,7 @@ const moving = register("renderOverlay", () => { // GUI Instructions renderScale( 1.2, GUI_INSTRUCT, - Renderer.screen.getWidth() / 2 - Renderer.getStringWidth(GUI_INSTRUCT) / 1.2, + Renderer.screen.getWidth() / 2 - Renderer.getStringWidth(GUI_INSTRUCT) / 1.4, Renderer.screen.getHeight() / 2.4, false, false ); }).unregister(); @@ -275,14 +275,22 @@ export class Overlay { this.width = 0; this.height = lines.length * 9 * this.loc[2]; lines.forEach(line => { - const regex = /&l(.*?)(?:&|$)/g; - const matches = []; - let match; + if (line.includes('§l')) { + const splitLine = line.split('§l'); + let stringWidth = 0; - while ((match = regex.exec(line)) !== null) matches.push(match[1]); + for (let i = 0; i < splitLine.length; i++) { + if (i % 2 === 0) stringWidth += Renderer.getStringWidth(splitLine[i]); + else { + let clearIndex = splitLine[i].indexOf("§"); + let boldedString = clearIndex !== -1 ? splitLine[i].substring(0, clearIndex) : splitLine[i]; + let unboldedString = clearIndex !== -1 ? splitLine[i].substring(clearIndex, splitLine[i].length) : ""; + stringWidth += Renderer.getStringWidth(boldedString) * 1.2 + Renderer.getStringWidth(unboldedString); + } + } - const width = 1.1*Renderer.getStringWidth(matches.join('')) + Renderer.getStringWidth(line.replace(regex, '')); - this.width = Math.max(this.width, width * this.loc[2]); + this.width = Math.max(this.width, stringWidth * this.loc[2]); + } else this.width = Math.max(this.width, Renderer.getStringWidth(line) * this.loc[2]); }); } } From bfc2a7f7dd5fa74fc6fbebb158f3eb237cc79a40 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Thu, 25 Apr 2024 14:51:53 -0400 Subject: [PATCH 03/33] Added overlay background toggle --- changelog.json | 1 + features/combat/ComboDisplay.js | 17 +++--- features/combat/EntityDetect.js | 6 +- features/combat/GyroTimer.js | 4 +- features/combat/KillCounter.js | 8 +-- features/crimsonIsle/GoldenFishTimer.js | 4 +- features/crimsonIsle/TrophyCounter.js | 6 +- features/crimsonIsle/VanqFeatures.js | 14 ++--- features/economy/CoinTracker.js | 4 +- features/economy/ContainerValue.js | 8 +-- features/economy/ItemPrice.js | 8 +-- features/economy/TradeValue.js | 8 +-- features/event/BingoCard.js | 18 +++--- features/event/HippityHoppity.js | 7 ++- features/event/InquisitorDetect.js | 11 +--- features/farming/GardenTab.js | 20 ++++--- features/farming/PestTracking.js | 15 +++-- features/general/Performance.js | 22 +++---- features/general/SkillTracker.js | 10 ++-- features/general/Statistics.js | 18 +++--- features/general/WidgetDisplay.js | 6 +- features/kuudra/CrateEdit.js | 8 +-- features/kuudra/KuudraProfit.js | 8 +-- features/kuudra/KuudraSplits.js | 4 +- features/mining/CommissionsDisplay.js | 8 ++- features/mining/FossilHelper.js | 11 ++-- features/mining/PowderChest.js | 2 +- features/mining/PowderTracker.js | 4 +- features/rift/VampireSlayer.js | 11 ++-- utils/overlay.js | 78 ++++++++++++++++++------- utils/variables.js | 68 ++++++++++----------- 31 files changed, 235 insertions(+), 182 deletions(-) diff --git a/changelog.json b/changelog.json index ca6d902f..b0003948 100644 --- a/changelog.json +++ b/changelog.json @@ -1,3 +1,4 @@ [ + "- Added option to render overlay background", "- Fixed overlay width being off on bold" ] \ No newline at end of file diff --git a/features/combat/ComboDisplay.js b/features/combat/ComboDisplay.js index c5409e7c..d85902e9 100644 --- a/features/combat/ComboDisplay.js +++ b/features/combat/ComboDisplay.js @@ -13,17 +13,20 @@ const comboExample = ${DARK_GRAY}+${GOLD}420 coins per kill ${DARK_AQUA}+911☯ Combat Wisdom`; const comboOverlay = new Overlay("comboDisplay", ["all"], () => true, data.WL, "moveCombo", comboExample); -comboOverlay.message = ""; +comboOverlay.setMessage(""); let stats = ["", 0, 0, 0]; /** * Resets and updates overlay message to match stats. */ function updateOverlay() { - comboOverlay.message = stats[0]; - if (stats[1] !== 0) comboOverlay.message += `\n${AQUA}+${stats[1]}✯ Magic Find`; - if (stats[2] !== 0) comboOverlay.message += `\n${DARK_AQUA}+${stats[2]}☯ Combat Wisdom`; - if (stats[3] !== 0) comboOverlay.message += `\n${DARK_GRAY}+${GOLD + stats[3]} coins per kill`; + let comboMessage = ''; + comboMessage = stats[0]; + if (stats[1] !== 0) comboMessage += `\n${AQUA}+${stats[1]}✯ Magic Find`; + if (stats[2] !== 0) comboMessage += `\n${DARK_AQUA}+${stats[2]}☯ Combat Wisdom`; + if (stats[3] !== 0) comboMessage += `\n${DARK_GRAY}+${GOLD + stats[3]} coins per kill`; + + comboOverlay.setMessage(comboMessage); } /** @@ -54,9 +57,9 @@ registerWhen(register("chat", (color, kills) => { */ registerWhen(register("chat", () => { stats = ["", 0, 0, 0]; - comboOverlay.message = ""; + comboOverlay.setMessage(""); }).setCriteria("Your Kill Combo has expired! You reached a ${kills} Kill Combo!"), () => settings.comboDisplay); registerWhen(register("worldUnload", () => { stats = ["", 0, 0, 0]; - comboOverlay.message = ""; + comboOverlay.setMessage(""); }), () => settings.comboDisplay); diff --git a/features/combat/EntityDetect.js b/features/combat/EntityDetect.js index d60d2cc6..0f24e9e6 100644 --- a/features/combat/EntityDetect.js +++ b/features/combat/EntityDetect.js @@ -183,10 +183,10 @@ registerWhen(register("step", () => { } else { nextSpawn--; if (nextSpawn === 0) { - broodmotherOverlay.message = `${GRAY + BOLD}Next Spawn: ${GREEN}Soon TM`; + broodmotherOverlay.setMessage(`${GRAY + BOLD}Next Spawn: ${GREEN}Soon TM`); Client.showTitle("", `${RED}Broodmother Spawning Soon!`, 0, 25, 5); if (server in broodLobbies) delete broodLobbies[server]; - } else broodmotherOverlay.message = `${GRAY + BOLD}Next Spawn: ${WHITE + getTime(nextSpawn)}`; + } else broodmotherOverlay.setMessage(`${GRAY + BOLD}Next Spawn: ${WHITE + getTime(nextSpawn)}`); } }).setFps(1), () => settings.broodmotherDetect); @@ -196,5 +196,5 @@ registerWhen(register("step", () => { registerWhen(register("worldUnload", () => { broodLobbies[getServer()] = nextSpawn; nextSpawn = 0; - broodmotherOverlay.message = `${GRAY + BOLD}Next Spawn: ${RED}???`; + broodmotherOverlay.setMessage(`${GRAY + BOLD}Next Spawn: ${RED}???`); }), () => getWorld() === "Spider's Den" && settings.broodmotherDetect); diff --git a/features/combat/GyroTimer.js b/features/combat/GyroTimer.js index fff3f0e7..bc4f3c31 100644 --- a/features/combat/GyroTimer.js +++ b/features/combat/GyroTimer.js @@ -31,8 +31,8 @@ registerWhen(register("tick", () => { if (settings.gyroAlert && align > 0.5 && align < 1 && cd === 0) Client.showTitle(`${DARK_RED + BOLD}USE ALIGN`, "", 0, 25, 5); align = (align - 0.05).toFixed(2); - gyroOverlay.message = `${GREEN + BOLD}Align Timer: ${RESET + align}s`; - } else gyroOverlay.message = `${GREEN + BOLD}Align Timer: ${RED}NO ALIGN`; + gyroOverlay.setMessage(`${GREEN + BOLD}Align Timer: ${RESET + align}s`); + } else gyroOverlay.setMessage(`${GREEN + BOLD}Align Timer: ${RED}NO ALIGN`); if (cd > 0) cd = (cd - 0.05).toFixed(2); }), () => settings.gyroAlert || settings.gyroTimer); diff --git a/features/combat/KillCounter.js b/features/combat/KillCounter.js index fb21f40f..13c7fc41 100644 --- a/features/combat/KillCounter.js +++ b/features/combat/KillCounter.js @@ -25,7 +25,7 @@ ${RED + BOLD}ゴウセル: ${RESET}0^0 ${DARK_RED + BOLD}Total Kills: ${RESET}∞^∞ ${DARK_RED + BOLD}Time Passed: ${RESET}-∞`; const counterOverlay = new Overlay("killCounter", ["all"], () => true, data.JL, "moveKills", counterExample); -counterOverlay.message = ""; +counterOverlay.setMessage(""); function updateCounter() { // Sort the mobs object @@ -38,9 +38,9 @@ function updateCounter() { return `${RED + BOLD + mob}: ${RESET + formatNumber(kills) + GRAY} (${formatNumber(kills / time * 3600)}/hr)`; }); - counterOverlay.message = messageLines.join('\n') + + counterOverlay.setMessage(messageLines.join('\n') + `\n\n${DARK_RED + BOLD}Total Kills: ${RESET + formatNumber(total) + GRAY} (${formatNumber(total / time * 3600)}/hr)` + - `\n${DARK_RED + BOLD}Time Passed: ${RESET + getTime(time)}`; + `\n${DARK_RED + BOLD}Time Passed: ${RESET + getTime(time)}`); } /** @@ -104,6 +104,6 @@ register("command", () => { mobs = {} total = 0; time = 0; - counterOverlay.message = ""; + counterOverlay.setMessage(""); ChatLib.chat(`${LOGO + GREEN}Successfully reset kill counter!`) }).setName("resetKills"); diff --git a/features/crimsonIsle/GoldenFishTimer.js b/features/crimsonIsle/GoldenFishTimer.js index 33403fee..f82f0489 100644 --- a/features/crimsonIsle/GoldenFishTimer.js +++ b/features/crimsonIsle/GoldenFishTimer.js @@ -25,9 +25,9 @@ registerWhen(register("step", () => { if (lastCast > 270) lastFish = 0; - fishOverlay.message = + fishOverlay.setMessage( `${GOLD + BOLD}Last Cast: ${lastCast > 240 ? DARK_RED : WHITE + getTime(lastCast)} -${GOLD + BOLD}Last Fish: ${RESET + getTime(lastCast > 270 ? 0 : lastFish)}` +${GOLD + BOLD}Last Fish: ${RESET + getTime(lastCast > 270 ? 0 : lastFish)}`); }).setFps(1), () => getWorld() === "Crimson Isle" && settings.goldenFishAlert); /** diff --git a/features/crimsonIsle/TrophyCounter.js b/features/crimsonIsle/TrophyCounter.js index 5f017be5..d2707563 100644 --- a/features/crimsonIsle/TrophyCounter.js +++ b/features/crimsonIsle/TrophyCounter.js @@ -30,7 +30,7 @@ const trophyExample = &5Soul Fish&f: &373 &850 &720 &61 &b2 &5Moldfin&f: &360 &837 &721 &61 &b1`; const trophyOverlay = new Overlay("trophyCounter", ["Crimson Isle"], () => true, data.FL, "moveTrophy", trophyExample); -trophyOverlay.message = ""; +trophyOverlay.setMessage(""); /** * Variables used for formatting @@ -77,7 +77,7 @@ let timePassed = 0; register("command", () => { sessionTrophy = {}; timePassed = 0; - trophyOverlay.message = ""; + trophyOverlay.setMessage(""); ChatLib.chat(`${LOGO + GREEN}Successfully reset trophy fish counter!`); }).setName("resetTrophy"); @@ -95,7 +95,7 @@ function updateMessage() { return sorted; }, []); - if (sortedTrophy.length != 0) trophyOverlay.message = `${GOLD + BOLD}Trophy Fishing:\n${sortedTrophy.join("\n")}`; + if (sortedTrophy.length != 0) trophyOverlay.setMessage(`${GOLD + BOLD}Trophy Fishing:\n${sortedTrophy.join("\n")}`); } /** diff --git a/features/crimsonIsle/VanqFeatures.js b/features/crimsonIsle/VanqFeatures.js index 6074e0ca..2c305941 100644 --- a/features/crimsonIsle/VanqFeatures.js +++ b/features/crimsonIsle/VanqFeatures.js @@ -25,7 +25,7 @@ ${RED + BOLD}Total Kills: ${RESET}Hua ${RED + BOLD}Kills Since: ${RESET}Piao ${RED + BOLD}Average Kills: ${RESET}Piao`; const counterOverlay = new Overlay("vanqCounter", ["Crimson Isle"], () => true, data.CL, "moveCounter", counterExample); -counterOverlay.message = ""; +counterOverlay.setMessage(""); /** * Uses the "Book of Stats" to track whenever player kills an entity and updates the Vanquisher Overlay. @@ -64,7 +64,7 @@ registerWhen(register("entityDeath", (death) => { items[heldItem] = newKills; // Update HUD - counterOverlay.message = settings.vanqCounter === 1 ? + counterOverlay.setMessage(settings.vanqCounter === 1 ? `${RED + BOLD}Total Vanqs: ${RESET + data.vanqSession.vanqs} ${RED + BOLD}Total Kills: ${RESET + data.vanqSession.kills} ${RED + BOLD}Kills Since: ${RESET + data.vanqSession.last} @@ -73,7 +73,7 @@ ${RED + BOLD}Average Kills: ${RESET + data.vanqSession.average}` `${RED + BOLD}Total Vanqs: ${RESET + session.vanqs} ${RED + BOLD}Total Kills: ${RESET + session.kills} ${RED + BOLD}Kills Since: ${RESET + session.last} -${RED + BOLD}Average Kills: ${RESET + session.average}`; +${RED + BOLD}Average Kills: ${RESET + session.average}`); }); }), () => getWorld() === "Crimson Isle" && settings.vanqCounter !== 0); @@ -137,18 +137,18 @@ registerWhen(register("chat", () => { */ const vanqExample = `${DARK_PURPLE + BOLD}Vanquisher ${WHITE}Detected`; const vanqOverlay = new Overlay("vanqDetect", ["Crimson Isle"], () => true, data.QL, "moveVanq", vanqExample); -vanqOverlay.message = ""; +vanqOverlay.setMessage(""); registerWhen(register("step", () => { vanquishers = World.getAllEntitiesOfType(WITHER_CLASS).filter(entity => entity.getEntity().func_110138_aP() === 1024); if (vanquishers.length > 0) { if (vanquishers.find(vanquisher => vanquisher.getEntity().func_110143_aJ() === 0) !== undefined) - vanqOverlay.message = `${DARK_PURPLE + BOLD}Vanquisher ${RED}Dead!`; - else vanqOverlay.message = vanqExample; + vanqOverlay.setMessage(`${DARK_PURPLE + BOLD}Vanquisher ${RED}Dead!`); + else vanqOverlay.setMessage(vanqExample); if (settings.vanqSound)playSound(AMOGUS, 10000); if (!data.moblist.includes("vanquisher")) vanquishers = []; - } else vanqOverlay.message = ""; + } else vanqOverlay.setMessage(""); }).setFps(2), () => getWorld() === "Crimson Isle" && settings.vanqDetect); new Hitbox(() => getWorld() === "Crimson Isle" && settings.vanqDetect, (pt) => { renderEntities(vanquishers, 0.5, 0, 0.5, pt, "Vanquisher"); diff --git a/features/economy/CoinTracker.js b/features/economy/CoinTracker.js index 005272cd..ad476603 100644 --- a/features/economy/CoinTracker.js +++ b/features/economy/CoinTracker.js @@ -43,8 +43,8 @@ registerWhen(register("step", () => { // Update GUI const timeDisplay = piggy.since < settings.coinTracker * 60 ? getTime(piggy.time) : `${RED}Inactive`; - coinOverlay.message = + coinOverlay.setMessage( `${GOLD + BOLD}Gained: ${WHITE + commafy(piggy.getGain())} ¢ ${GOLD + BOLD}Time Passed: ${WHITE + timeDisplay} -${GOLD + BOLD}Rate: ${WHITE + commafy(piggy.getRate())} ¢/hr`; +${GOLD + BOLD}Rate: ${WHITE + commafy(piggy.getRate())} ¢/hr`); }).setFps(1), () => settings.coinTracker !== 0); diff --git a/features/economy/ContainerValue.js b/features/economy/ContainerValue.js index eb35e8b2..ee515d82 100644 --- a/features/economy/ContainerValue.js +++ b/features/economy/ContainerValue.js @@ -24,7 +24,7 @@ ${RED}Item 9${GRAY} - ${WHITE}Formlessness ${DARK_RED}-Sun Tzu, The Art of War`; const containerOverlay = new Overlay("containerValue", ["all", "misc"], () => true, data.RL, "moveContainer", containerExample); -containerOverlay.message = ""; +containerOverlay.setMessage(""); /** * Set the message of the overlay given the items object and value. @@ -35,7 +35,7 @@ containerOverlay.message = ""; */ function setMessage(itemValues, totalValue) { if (totalValue === 0) { - containerOverlay.message = ""; + containerOverlay.setMessage(""); return; } @@ -59,7 +59,7 @@ function setMessage(itemValues, totalValue) { } } - containerOverlay.message = overlayMessage; + containerOverlay.setMessage(overlayMessage); } /** @@ -162,5 +162,5 @@ registerWhen(register("guiMouseRelease", (x, y, button, gui) => { * This function clears the content of the container overlay message, effectively removing it from display. */ registerWhen(register("guiClosed", () => { - containerOverlay.message = ""; + containerOverlay.setMessage(""); }), () => settings.containerValue !== 0); diff --git a/features/economy/ItemPrice.js b/features/economy/ItemPrice.js index c6bb0fc0..b8f86452 100644 --- a/features/economy/ItemPrice.js +++ b/features/economy/ItemPrice.js @@ -126,7 +126,7 @@ const valueExample = &3Total Value: &aKATSU.`; const valueOverlay = new Overlay("itemPrice", ["all", "misc"], () => settings.itemPrice === 1 || settings.itemPrice == 3, data.EL, "moveValue", valueExample); -valueOverlay.message = ""; +valueOverlay.setMessage(""); let savedValues = {}; /** @@ -448,14 +448,14 @@ registerWhen(register("itemTooltip", (lore, item) => { const list = new NBTTagList(loreTag); for (let i = 0; i < list.getTagCount(); i++) { if (list.getStringTagAt(i).startsWith("§3§lItem Value:")) { - valueOverlay.message = savedValues?.[itemUUID]?.[1] ?? ""; + valueOverlay.setMessage(savedValues?.[itemUUID]?.[1] ?? ""); return; } } // Add to item lore. const value = getItemValue(item); - valueOverlay.message = savedValues?.[itemUUID]?.[1] ?? ""; + valueOverlay.setMessage(savedValues?.[itemUUID]?.[1] ?? ""); if (value !== 0 && (settings.itemPrice === 2 || settings.itemPrice === 3)) list.appendTag(new NBTTagString(`§3§lItem Value: §6${commafy(value)}`)); }), () => settings.itemPrice !== 0); @@ -463,5 +463,5 @@ registerWhen(register("itemTooltip", (lore, item) => { /** * Reset data on data transfers. */ -register("guiClosed", () => { valueOverlay.message = "" }); +register("guiClosed", () => { valueOverlay.setMessage("") }); register("worldUnload", () => { savedValues = {} }); diff --git a/features/economy/TradeValue.js b/features/economy/TradeValue.js index 206e47b3..43c512b8 100644 --- a/features/economy/TradeValue.js +++ b/features/economy/TradeValue.js @@ -11,7 +11,7 @@ ${DARK_GREEN + BOLD}Receiving: ${GREEN}I'd ${GOLD + BOLD}Profit: ${GREEN}Win`; const tradeOverlay = new Overlay("tradeValue", ["all", "misc"], () => true, data.TVL, "moveTrade", tradeExample); -tradeOverlay.message = ""; +tradeOverlay.setMessage(""); const updateTrade = register("step", () => { const container = Player.getContainer(); @@ -29,14 +29,14 @@ const updateTrade = register("step", () => { } const profit = receiving - giving; - tradeOverlay.message = `${DARK_RED + BOLD}Giving: ${RED + formatNumber(giving)} + tradeOverlay.setMessage(`${DARK_RED + BOLD}Giving: ${RED + formatNumber(giving)} ${DARK_GREEN + BOLD}Receiving: ${GREEN + formatNumber(receiving)} -${GOLD + BOLD}Profit: ${(profit > 0 ? GREEN : RED) + formatNumber(profit)}`; +${GOLD + BOLD}Profit: ${(profit > 0 ? GREEN : RED) + formatNumber(profit)}`); }).setFps(1).unregister(); const setTrade = register("guiClosed", () => { updateTrade.unregister(); - tradeOverlay.message = ""; + tradeOverlay.setMessage(""); }).unregister(); register("guiOpened", () => { diff --git a/features/event/BingoCard.js b/features/event/BingoCard.js index 983b7a23..2242cf78 100644 --- a/features/event/BingoCard.js +++ b/features/event/BingoCard.js @@ -27,31 +27,33 @@ ${DARK_GREEN}Bingo Goals ${GRAY + BOLD}楽しい時間${GREEN}、${GRAY + BOLD}ビンゴ${GREEN}! ${GRAY + BOLD}ビンゴをする時間です${GREEN}!`; const bingoOverlay = new Overlay("bingoCard", ["all"], () => true, data.BCL, "moveBingo", bingoExample); -bingoOverlay.message = ""; +bingoOverlay.setMessage(""); /** * Updates bingo overlay based on current uncompleted goals. */ function updateBingo() { - bingoOverlay.message = ""; + let bingoMessage = ""; // Update community bingo goals if (settings.bingoCard === 1 || settings.bingoCard === 3) { - bingoOverlay.message += `${DARK_GREEN + BOLD}Community Goals\n`; + bingoMessage += `${DARK_GREEN + BOLD}Community Goals\n`; Object.keys(community).forEach(goal => { - bingoOverlay.message += ` ${community[goal]}\n`; + bingoMessage += ` ${community[goal]}\n`; }); } - bingoOverlay.message += '\n'; + bingoMessage += '\n'; // Update peersonal bingo goals if (settings.bingoCard === 1 || settings.bingoCard === 2) { - bingoOverlay.message += `${DARK_GREEN + BOLD}Bingo Goals\n`; + bingoMessage += `${DARK_GREEN + BOLD}Bingo Goals\n`; Object.keys(personal).forEach(goal => { - bingoOverlay.message += ` ${personal[goal]}\n`; + bingoMessage += ` ${personal[goal]}\n`; }); } + + bingoOverlay.setMessage(bingoMessage); } registerWhen(register("guiOpened", () => { @@ -86,5 +88,5 @@ registerWhen(register("chat", (goal) => { }).setCriteria("BINGO GOAL COMPLETE! ${goal}"), () => settings.bingoCard !== 0); registerWhen(register("chat", () => { - bingoOverlay.message = ""; + bingoOverlay.setMessage(""); }).setCriteria("Switching to profile ${profile}..."), () => settings.bingoCard !== 0); diff --git a/features/event/HippityHoppity.js b/features/event/HippityHoppity.js index ce29f5db..b5114fac 100644 --- a/features/event/HippityHoppity.js +++ b/features/event/HippityHoppity.js @@ -36,9 +36,10 @@ register("step", () => { const now = Math.floor(Date.now() / 1000); const chocoCalc = (now - data.chocoLast) * data.chocoProduction; const chocoAll = chocoCalc + data.chocoAll; - chocoOverlay.message = `${GOLD + BOLD}Chocolate: ${YELLOW + formatNumber(chocoCalc + data.chocolate) + DARK_GRAY} (${formatNumber(data.chocoProduction)}/s)`; - chocoOverlay.message += `\n${GOLD + BOLD}Total: ${YELLOW + formatNumber(chocoAll)}`; - chocoOverlay.message += `\n${GOLD + BOLD}Time: ${YELLOW + formatTimeElapsed(data.chocoLast, now)}`; + + chocoOverlay.setMessage(`${GOLD + BOLD}Chocolate: ${YELLOW + formatNumber(chocoCalc + data.chocolate) + DARK_GRAY} (${formatNumber(data.chocoProduction)}/s) +${GOLD + BOLD}Total: ${YELLOW + formatNumber(chocoAll)} +${GOLD + BOLD}Time: ${YELLOW + formatTimeElapsed(data.chocoLast, now)}`); }).setFps(1); diff --git a/features/event/InquisitorDetect.js b/features/event/InquisitorDetect.js index 0f827410..643f77db 100644 --- a/features/event/InquisitorDetect.js +++ b/features/event/InquisitorDetect.js @@ -8,11 +8,6 @@ import { getWorld } from "../../utils/worlds"; import { Hitbox, renderEntities } from "../../utils/waypoints"; -/** - * Inquisitor alert variables. - */ -let inquisitor = undefined; - /** * Variables used to track and display Inquisitor counter. */ @@ -54,7 +49,7 @@ export function updateInqCounter(inqSpawned) { if (session.inqs) session.average = Math.round(session.burrows / session.inqs); // Update HUD - counterOverlay.message = settings.inqCounter === 1 ? + counterOverlay.setMessage(settings.inqCounter === 1 ? `${GOLD + BOLD}Total Inqs: ${RESET + data.inqSession.inqs} ${GOLD + BOLD}Total Burrows: ${RESET + data.inqSession.burrows} ${GOLD + BOLD}Burrows Since: ${RESET + data.inqSession.last} @@ -63,7 +58,7 @@ ${GOLD + BOLD}Average Burrows: ${RESET + data.inqSession.average}` `${GOLD + BOLD}Total Inqs: ${RESET + session.inqs} ${GOLD + BOLD}Total Burrows: ${RESET + session.burrows} ${GOLD + BOLD}Burrows Since: ${RESET + session.last} -${GOLD + BOLD}Average Burrows: ${RESET + session.average}`; +${GOLD + BOLD}Average Burrows: ${RESET + session.average}`); } /** @@ -76,7 +71,7 @@ register("command", () => { "last": 0, "average": 0, }; - counterOverlay.message = counterExample; + counterOverlay.setMessage(counterExample); }).setName("resetInq"); /** diff --git a/features/farming/GardenTab.js b/features/farming/GardenTab.js index a61701be..73191634 100644 --- a/features/farming/GardenTab.js +++ b/features/farming/GardenTab.js @@ -28,7 +28,8 @@ registerWhen(register("step", () => { if (!World.isLoaded()) return; const tablist = TabList.getNames(); - gardenOverlay.message = ""; + gardenOverlay.setMessage(""); + let gardenMessage = ""; let visitorIndex = tablist.findIndex(tab => tab.startsWith("§r§b§lVisitors:")); if (visitorIndex === -1) return; @@ -37,7 +38,7 @@ registerWhen(register("step", () => { visitors = []; for (let i = 0; i <= visitorCount; i++) { let visitor = tablist[visitorIndex + i]; - gardenOverlay.message += visitor + '\n'; + gardenMessage += visitor + '\n'; visitors.push(visitor); } @@ -52,8 +53,10 @@ registerWhen(register("step", () => { // Update next display if (tabTime !== 0 && tabTime < nextVisitor - 60 || tabTime > nextVisitor + 60 || nextVisitor === 0) nextVisitor = tabTime; - if (nextVisitor > 0) gardenOverlay.message += ` Next Visitor: ${AQUA + getTime(nextVisitor)}`; - else gardenOverlay.message += ` Next Visitor: ${RED + BOLD}Queue Full!`; + if (nextVisitor > 0) gardenMessage += ` Next Visitor: ${AQUA + getTime(nextVisitor)}`; + else gardenMessage += ` Next Visitor: ${RED + BOLD}Queue Full!`; + + gardenOverlay.setMessage(gardenMessage); }).setFps(1), () => getWorld() === "Garden" && settings.gardenTab); @@ -73,12 +76,13 @@ registerWhen(register("step", () => { nextVisitor = 720; } - gardenOverlay.message = ""; + let gardenMessage = ""; visitors.forEach(visitor => { - gardenOverlay.message += visitor + '\n'; + gardenMessage += visitor + '\n'; }); - if (nextVisitor > 0) gardenOverlay.message += ` Next Visitor: ${AQUA + getTime(nextVisitor)}`; - else gardenOverlay.message += ` Next Visitor: ${RED + BOLD}Queue Full!`; + if (nextVisitor > 0) gardenMessage += ` Next Visitor: ${AQUA + getTime(nextVisitor)}`; + else gardenMessage += ` Next Visitor: ${RED + BOLD}Queue Full!`; + gardenOverlay.setMessage(gardenMessage); }).setFps(1), () => settings.gardenTab); // Set next visitor time (assuming with 20% visitor reduction) diff --git a/features/farming/PestTracking.js b/features/farming/PestTracking.js index a09eb7d2..69682fd4 100644 --- a/features/farming/PestTracking.js +++ b/features/farming/PestTracking.js @@ -45,7 +45,7 @@ register("chat", (plot) => { * Decrement spray timers every second */ register("step", () => { - sprayOverlay.message = `${GREEN + BOLD}Sprays:`; + let sprayMessage = ""; const keys = Object.keys(sprays) keys.forEach(plot => { @@ -57,9 +57,10 @@ register("step", () => { const time = sprays[plot]; const sprayColor = time > 1200 ? GREEN : time > 600 ? YELLOW : RED; - sprayOverlay.message += `\n ${AQUA}Plot ${plot + DARK_GRAY} (${sprayColor + getTime(time) + DARK_GRAY})` + sprayMessage += `\n ${AQUA}Plot ${plot + DARK_GRAY} (${sprayColor + getTime(time) + DARK_GRAY})` }); - if (keys.length === 0) sprayOverlay.message += `\n ${RED + BOLD}None...`; + if (keys.length === 0) sprayMessage += `\n ${RED + BOLD}None...`; + sprayOverlay.setMessage(sprayMessage); }).setFps(1); /** @@ -226,17 +227,19 @@ registerWhen(register("chat", (_, fortune) => { const bonusExample = `${YELLOW + BOLD}Pest Bonus: ${GREEN}T1 FIGHTING`; const bonusOverlay = new Overlay("pesthunterBonus", ["Garden"], () => true, data.PHL, "movePest", bonusExample); registerWhen(register("step", () => { - bonusOverlay.message = `${YELLOW + BOLD}Pest Bonus: `; + let bonusMessage = `${YELLOW + BOLD}Pest Bonus: `; let fortune = 0; Object.keys(bonuses).forEach(bonus => { if (fortune === 0) time = bonuses[bonus]; if (--bonuses[bonus] === 0) delete bonuses[bonus]; else fortune += parseInt(bonus.replace(/[^0-9]/g, '')); }); - if (fortune === 0) bonusOverlay.message += `${RED + BOLD}Inactive!`; + if (fortune === 0) bonusMessage += `${RED + BOLD}Inactive!`; else { const bonusColor = remain > 1200 ? GREEN : remain > 600 ? YELLOW : RED; - bonusOverlay.message += `${GOLD + fortune}☘ ${bonusColor}(${getTime(--remain)})` + bonusMessage += `${GOLD + fortune}☘ ${bonusColor}(${getTime(--remain)})` } + + bonusOverlay.setMessage(bonusMessage); }).setFps(1), () => getWorld() === "Garden" && settings.pesthunterBonus); diff --git a/features/general/Performance.js b/features/general/Performance.js index dd97fbf4..0899bef4 100644 --- a/features/general/Performance.js +++ b/features/general/Performance.js @@ -112,21 +112,21 @@ const statusOverlay = new Overlay("serverStatus", ["all"], () => true, data.LL, * and FPS (frames per second) using the values from the `ping`, `tps`, and `Client.getFPS()` respectively. */ registerWhen(register('tick', () => { - statusOverlay.message = ""; + let statusMessage = ""; // XYZ if (toggles.xyzDisplay) { const x = Math.round(Player.getX()); const y = Math.round(Player.getY()); const z = Math.round(Player.getZ()); - statusOverlay.message += `${DARK_AQUA + BOLD}XYZ: ${GREEN + x}, ${y}, ${z}\n`; + statusMessage += `${DARK_AQUA + BOLD}XYZ: ${GREEN + x}, ${y}, ${z}\n`; } // Yaw and Pitch if (toggles.angleDisplay) { const yaw = Player.getYaw(); const pitch = Player.getPitch(); - statusOverlay.message += `${DARK_AQUA + BOLD}Y/P: ${AQUA + yaw.toFixed(2)} / ${AQUA + pitch.toFixed(2)}\n`; + statusMessage += `${DARK_AQUA + BOLD}Y/P: ${AQUA + yaw.toFixed(2)} / ${AQUA + pitch.toFixed(2)}\n`; } // Direction @@ -135,7 +135,7 @@ registerWhen(register('tick', () => { const direction = yaw >= 45 && yaw < 135 ? "West" : yaw >= 135 && yaw < 255 ? "North" : yaw >= 225 && yaw < 315 ? "East" : "South" - statusOverlay.message += `${DARK_AQUA + BOLD}Dir: ${AQUA + direction}\n`; + statusMessage += `${DARK_AQUA + BOLD}Dir: ${AQUA + direction}\n`; } // Ping @@ -145,7 +145,7 @@ registerWhen(register('tick', () => { ping < 300 ? YELLOW : ping < 420 ? GOLD : ping < 690 ? RED : DARK_RED; - statusOverlay.message += `${DARK_AQUA + BOLD}Ping: ${pingColor + ping + AQUA} ms\n`; + statusMessage += `${DARK_AQUA + BOLD}Ping: ${pingColor + ping + AQUA} ms\n`; } // FPS @@ -158,7 +158,7 @@ registerWhen(register('tick', () => { fpsRatio > 0.7 ? YELLOW : fpsRatio > 0.6 ? GOLD : fpsRatio > 0.5 ? RED : DARK_RED; - statusOverlay.message += `${DARK_AQUA + BOLD}FPS: ${fpsColor + fps + AQUA} fps\n`; + statusMessage += `${DARK_AQUA + BOLD}FPS: ${fpsColor + fps + AQUA} fps\n`; } // TPS @@ -168,8 +168,7 @@ registerWhen(register('tick', () => { tps > 13 ? YELLOW : tps > 10 ? GOLD : tps > 7 ? RED : DARK_RED; - - statusOverlay.message += `${DARK_AQUA + BOLD}TPS: ${tpsColor + tps.toFixed(1) + AQUA} tps\n`; + statusMessage += `${DARK_AQUA + BOLD}TPS: ${tpsColor + tps.toFixed(1) + AQUA} tps\n`; } // CPS @@ -186,15 +185,16 @@ registerWhen(register('tick', () => { rightCPS < 13 ? YELLOW : rightCPS < 21 ? GOLD : rightCPS < 30 ? RED : DARK_RED; - - statusOverlay.message += `${DARK_AQUA + BOLD}CPS: ${leftColor + leftCPS + AQUA} : ${rightColor + rightCPS}\n`; + statusMessage += `${DARK_AQUA + BOLD}CPS: ${leftColor + leftCPS + AQUA} : ${rightColor + rightCPS}\n`; } // Day if (toggles.dayDisplay) { const daytime = (World.getTime() / 24000).toFixed(2); - statusOverlay.message += `${DARK_AQUA + BOLD}Day: ${AQUA + daytime}` + statusMessage += `${DARK_AQUA + BOLD}Day: ${AQUA + daytime}` } + + statusOverlay.setMessage(statusMessage); }), () => settings.serverStatus || toggles.statusCommand); /** diff --git a/features/general/SkillTracker.js b/features/general/SkillTracker.js index 84c82c5e..a2902353 100644 --- a/features/general/SkillTracker.js +++ b/features/general/SkillTracker.js @@ -157,7 +157,7 @@ registerWhen(register("step", () => { // Set HUD const timeDisplay = skill.since < settings.skillTracker * 60 ? getTime(skill.time) : `${RED}Inactive`; - skillOverlay.message = + let skillMessage = `${DARK_AQUA + BOLD}Skill: ${WHITE + current} ${DARK_AQUA + BOLD}XP Gained: ${WHITE + commafy(skill.getGain())} xp ${DARK_AQUA + BOLD}Time Passed: ${WHITE + timeDisplay} @@ -167,7 +167,9 @@ ${DARK_AQUA + BOLD}Level Up: `; // Set time until next if (skill.level !== 60) { const neededXP = xpTable[skill.level + 1] - skill.now; - if (neededXP > 0) skillOverlay.message += `${WHITE + getTime(neededXP / rate * 3600)}`; - else skillOverlay.message += `${GREEN}MAXED`; - } else skillOverlay.message += `${GREEN}MAXED`; + if (neededXP > 0) skillMessage += `${WHITE + getTime(neededXP / rate * 3600)}`; + else skillMessage += `${GREEN}MAXED`; + } else skillMessage += `${GREEN}MAXED`; + + skillOverlay.setMessage(skillMessage); }).setFps(1), () => settings.skillTracker !== 0); diff --git a/features/general/Statistics.js b/features/general/Statistics.js index 1963ff22..33c6122f 100644 --- a/features/general/Statistics.js +++ b/features/general/Statistics.js @@ -137,17 +137,17 @@ register("step", () => { * Update statsOverlay message */ registerWhen(register("tick", () => { - statsOverlay.message = ""; + let statsMessage = ""; // Pet if (toggles.petDisplay) { - statsOverlay.message += `${DARK_AQUA + BOLD}Pet: ${data.pet}\n`; + statsMessage += `${DARK_AQUA + BOLD}Pet: ${data.pet}\n`; } // Stats if (toggles.statsDisplay) { - statsOverlay.message += `${DARK_AQUA + BOLD}Stats:\n`; - stats.forEach(stat => statsOverlay.message += `${GRAY}-${stat}\n` ); + statsMessage += `${DARK_AQUA + BOLD}Stats:\n`; + stats.forEach(stat => statsMessage += `${GRAY}-${stat}\n` ); } // Legion @@ -160,7 +160,7 @@ registerWhen(register("tick", () => { legionCount > 8 ? YELLOW : legionCount > 4 ? GOLD : legionColor > 0 ? RED : DARK_RED; - statsOverlay.message += `${DARK_AQUA + BOLD}Legion: ${legionColor + legionCount + DARK_GRAY} (${legionPercent}%)\n`; + statsMessage += `${DARK_AQUA + BOLD}Legion: ${legionColor + legionCount + DARK_GRAY} (${legionPercent}%)\n`; } // Soulflow @@ -170,8 +170,7 @@ registerWhen(register("tick", () => { soulflow > 50_000 ? YELLOW : soulflow > 25_000 ? GOLD : soulflow > 10_000 ? RED : DARK_RED; - - statsOverlay.message += `${DARK_AQUA + BOLD}SF: ${soulflowColor + formatNumber(soulflow) + AQUA} ⸎\n`; + statsMessage += `${DARK_AQUA + BOLD}SF: ${soulflowColor + formatNumber(soulflow) + AQUA} ⸎\n`; } // Playtime @@ -181,9 +180,10 @@ registerWhen(register("tick", () => { data.playtime < 10_800 ? YELLOW : data.playtime < 18_000 ? GOLD : data.playtime < 28_800 ? RED : DARK_RED; - - statsOverlay.message += `${DARK_AQUA + BOLD}Daily PT: ${ptColor + getTime(data.playtime)}`; + statsMessage += `${DARK_AQUA + BOLD}Daily PT: ${ptColor + getTime(data.playtime)}`; } + + statsOverlay.setMessage(statsMessage); }), () => settings.statsDisplay); /** diff --git a/features/general/WidgetDisplay.js b/features/general/WidgetDisplay.js index ec7e3722..52c0f7b5 100644 --- a/features/general/WidgetDisplay.js +++ b/features/general/WidgetDisplay.js @@ -22,7 +22,7 @@ export function updateWidgetList() { }); Object.keys(widgetOverlays).forEach(widget => { - widgetOverlays[widget].message = ""; + widgetOverlays[widget].setMessage(""); if (!data.widgetlist.includes(widget)) delete widgetOverlays[widget]; }) } @@ -35,12 +35,12 @@ registerWhen(register("step", () => { Object.keys(widgetOverlays).forEach(widget => { let index = tablist.findIndex(line => line.removeFormatting().toLowerCase() === `${widget.toLowerCase()}:`); if (index === -1) { - widgetOverlays[widget].message = ""; + widgetOverlays[widget].setMessage(""); return; } let message = tablist[index++] + '\n'; while (tablist[index].startsWith("§r ") && !tablist[index].endsWith("§r§3§lInfo§r")) message += tablist[index++] + '\n'; - widgetOverlays[widget].message = message; + widgetOverlays[widget].setMessage(message); }); }).setFps(1), () => settings.widgetDisplay); diff --git a/features/kuudra/CrateEdit.js b/features/kuudra/CrateEdit.js index d503d163..e26e2484 100644 --- a/features/kuudra/CrateEdit.js +++ b/features/kuudra/CrateEdit.js @@ -9,7 +9,7 @@ import { getWorld } from "../../utils/worlds"; */ const crateExample = "§8[§a|||||||||||||§f|||||||§8] §b69%§r"; const crateOverlay = new Overlay("crateEdit", ["all"], () => getWorld() === "Kuudra", data.CEL, "moveCrate", crateExample); -crateOverlay.message = ""; +crateOverlay.setMessage(""); /** * Cancel crate title render and replay with overlay render. @@ -17,7 +17,7 @@ crateOverlay.message = ""; registerWhen(register("renderTitle", (title, _, event) => { if (!title.startsWith("§8[") || !title.endsWith("%§r")) return; - crateOverlay.message = title; + crateOverlay.setMessage(title); cancel(event); }), () => settings.crateEdit && getWorld() === "Kuudra"); @@ -25,8 +25,8 @@ registerWhen(register("renderTitle", (title, _, event) => { * Reset on crate pickup/cancel */ register("chat", () => { - Client.scheduleTask(20, () => crateOverlay.message = ""); + Client.scheduleTask(20, () => crateOverlay.setMessage("")); }).setCriteria("You retrieved some of Elle's supplies from the Lava!"); register("chat", () => { - Client.scheduleTask(20, () => crateOverlay.message = ""); + Client.scheduleTask(20, () => crateOverlay.setMessage("")); }).setCriteria("You moved and the Chest slipped out of your hands!"); diff --git a/features/kuudra/KuudraProfit.js b/features/kuudra/KuudraProfit.js index db197d39..f89ac6b7 100644 --- a/features/kuudra/KuudraProfit.js +++ b/features/kuudra/KuudraProfit.js @@ -90,12 +90,12 @@ function updateProfitTracker(openedChest) { data.kuudraSession.rate = kuudraSession.profit / kuudraSession.time * 3600; const profitView = settings.kuudraProfitTracker === 1 ? data.kuudraSession : kuudraSession; - coinageOverlay.message = + coinageOverlay.setMessage( `${DARK_RED + BOLD}Profit: ${WHITE + formatNumber(profitView.profit.toFixed(0))} ¢ ${DARK_RED + BOLD}Chests: ${WHITE + commafy(profitView.chests)} chests ${DARK_RED + BOLD}Average: ${WHITE + formatNumber(profitView.average.toFixed(0))} ¢/chest ${DARK_RED + BOLD}Time Passed: ${WHITE + getTime(profitView.time)} -${DARK_RED + BOLD}Rate: ${WHITE + formatNumber(profitView.rate.toFixed(0))} ¢/hr` +${DARK_RED + BOLD}Rate: ${WHITE + formatNumber(profitView.rate.toFixed(0))} ¢/hr`); } /** @@ -141,13 +141,13 @@ registerWhen(register("guiOpened", () => { chestProfit = value - cost; const profitMessage = chestProfit >= 0 ? `${GREEN}+${commafy(chestProfit)}` : `${RED}-${commafy(chestProfit)}`; - profitOverlay.message = + profitOverlay.setMessage( `${GOLD + BOLD}Profit/Loss: ${profitMessage} ${AQUA + BOLD}Primary: ${GREEN}+${commafy(primary)} ${DARK_AQUA + BOLD}Secondary: ${GREEN}+${commafy(secondary)} ${DARK_PURPLE + BOLD}Teeth: ${GREEN}+${commafy(teeth)} ${RED + BOLD}Essence: ${GREEN}+${commafy(essence)} -${DARK_RED + BOLD}Key: ${RED}-${commafy(cost)}`; +${DARK_RED + BOLD}Key: ${RED}-${commafy(cost)}`); }); }), () => getWorld() === "Kuudra"); diff --git a/features/kuudra/KuudraSplits.js b/features/kuudra/KuudraSplits.js index bb822853..cec234f3 100644 --- a/features/kuudra/KuudraSplits.js +++ b/features/kuudra/KuudraSplits.js @@ -185,11 +185,11 @@ registerWhen(register("step", () => { } // Draw Splits - splitsOverlay.message = + splitsOverlay.setMessage( `${AQUA + BOLD}Supplies: ${RESET + times[0]} ${AQUA + BOLD}Build: ${RESET + times[1]} ${AQUA + BOLD}Fuel/Stun: ${RESET + times[2]} -${AQUA + BOLD}Kuudra: ${RESET + times[3]}` +${AQUA + BOLD}Kuudra: ${RESET + times[3]}`); }).setFps(19), () => getWorld() === "Kuudra" && settings.kuudraSplits); /** diff --git a/features/mining/CommissionsDisplay.js b/features/mining/CommissionsDisplay.js index 0fab4248..584b66f3 100644 --- a/features/mining/CommissionsDisplay.js +++ b/features/mining/CommissionsDisplay.js @@ -56,7 +56,7 @@ registerWhen(register("step", () => { let index = tab.findIndex(name => name === "§r§9§lCommissions:§r"); if (index === -1) return; - commissionOverlay.message = tab[index++] + '\n'; + let commissionMessage = tab[index++] + '\n'; commissionWaypoints = [["Base Camp", 0xffd700, 0.5, 129, 200.5]]; closestWaypoints = []; while (tab[index].startsWith("§r §r§f")) { @@ -74,12 +74,14 @@ registerWhen(register("step", () => { closestCopy[0] = `${BOLD + UNDERLINE}${closestCopy[0]}`; if (settings.commissionWaypoints !== 2) commissionWaypoints.push(closestCopy); - commissionOverlay.message += `${tab[index].replace("§f", GOLD)}\n`; - } else commissionOverlay.message += `${tab[index]}\n`; + commissionMessage += `${tab[index].replace("§f", GOLD)}\n`; + } else commissionMessage += `${tab[index]}\n`; // Set commission message index++; } + + commissionOverlay.setMessage(commissionMessage); }).setFps(4), () => (getWorld() === "Crystal Hollows" || getWorld() === "Dwarven Mines" || getWorld() === "Mineshaft") && (settings.commissionsDisplay || settings.commissionWaypoints !== 0)); diff --git a/features/mining/FossilHelper.js b/features/mining/FossilHelper.js index 394bbbf7..e1d5ecb2 100644 --- a/features/mining/FossilHelper.js +++ b/features/mining/FossilHelper.js @@ -194,17 +194,18 @@ function findTile() { // Update fossil display const auction = getAuction(); - fossilOverlay.message = `${DARK_AQUA + BOLD}Fossil Probability:`; - if (maxPos === 0) fossilOverlay.message += `\n ${RED}No possible fossils!`; + let fossilMessage = `${DARK_AQUA + BOLD}Fossil Probability:`; + if (maxPos === 0) fossilMessage += `\n ${RED}No possible fossils!`; else { let profit = 0; Object.keys(fossilProbability).forEach(fossil => { const possibility = fossilProbability[fossil] / totalPossible; profit += possibility * (auction[fossil.toUpperCase() + "_FOSSIL"]?.lbin ?? 0); - if (possibility !== 0) fossilOverlay.message += `\n ${DARK_GRAY}- ${GOLD + fossil} ${GRAY}(${(possibility * 100).toFixed(2)}%)`; + if (possibility !== 0) fossilMessage += `\n ${DARK_GRAY}- ${GOLD + fossil} ${GRAY}(${(possibility * 100).toFixed(2)}%)`; }); - fossilOverlay.message += ` \n\n${AQUA + BOLD}Profit: ${YELLOW + formatNumber(profit)}` + fossilMessage += ` \n\n${AQUA + BOLD}Profit: ${YELLOW + formatNumber(profit)}` } + fossilOverlay.setMessage(fossilMessage); return best; } @@ -257,7 +258,7 @@ const untrackFossils = register("guiClosed", () => { trackClicks.unregister(); untrackFossils.unregister(); highlightTile.unregister(); - fossilOverlay.message = fossilExample; + fossilOverlay.setMessage(fossilExample); patterns = FOSSILS; bestTile = [2, 4]; }).unregister(); diff --git a/features/mining/PowderChest.js b/features/mining/PowderChest.js index 4b1d9802..33b542be 100644 --- a/features/mining/PowderChest.js +++ b/features/mining/PowderChest.js @@ -19,7 +19,7 @@ const powderOverlay = new Overlay("powderChest", ["Crystal Hollows"], () => true registerWhen(register("tick", () => { nearbyChests = World.getAllTileEntitiesOfType(CHEST_CLASS) .filter(chest => Player.asPlayerMP().distanceTo(chest.getBlockPos()) <= settings.powderChest); - powderOverlay.message = `${DARK_AQUA + BOLD}Nearby Chests: ${WHITE + nearbyChests.length}`; + powderOverlay.setMessage(`${DARK_AQUA + BOLD}Nearby Chests: ${WHITE + nearbyChests.length}`); }), () => getWorld() === "Crystal Hollows" && settings.powderChest !== 0); /** diff --git a/features/mining/PowderTracker.js b/features/mining/PowderTracker.js index 8bf096d3..ee58c6ff 100644 --- a/features/mining/PowderTracker.js +++ b/features/mining/PowderTracker.js @@ -75,12 +75,12 @@ registerWhen(register("step", () => { // Set HUD const timeDisplay = displayTime !== 0 ? getTime(displayTime) : `${RED}Inactive`; - powderOverlay.message = + powderOverlay.setMessage( `${DARK_GREEN + BOLD}Mithril: ${WHITE + commafy(powders.Mithril.getGain())} ᠅ ${DARK_GREEN + BOLD}Rate: ${WHITE + commafy(powders.Mithril.getRate())} ᠅/hr ${LIGHT_PURPLE + BOLD}Gemstone: ${WHITE + commafy(powders.Gemstone.getGain())} ᠅ ${LIGHT_PURPLE + BOLD}Rate: ${WHITE + commafy(powders.Gemstone.getRate())} ᠅/hr ${AQUA + BOLD}Glacite: ${WHITE + commafy(powders.Glacite.getGain())} ᠅ ${AQUA + BOLD}Rate: ${WHITE + commafy(powders.Glacite.getRate())} ᠅/hr -${BLUE + BOLD}Time Passed: ${WHITE + timeDisplay}`; +${BLUE + BOLD}Time Passed: ${WHITE + timeDisplay}`); }).setFps(1), () => (getWorld() === "Crystal Hollows" || getWorld() === "Dwarven Mines") && settings.powderTracker !== 0); diff --git a/features/rift/VampireSlayer.js b/features/rift/VampireSlayer.js index a65cfbee..902bff99 100644 --- a/features/rift/VampireSlayer.js +++ b/features/rift/VampireSlayer.js @@ -27,7 +27,8 @@ let inMania = false; * Tracks player boss on spawn and updates vampire attack overlay every tick. */ registerWhen(register("tick", () => { - vampireOverlay.message = ""; + let vampireMessage = ""; + vampireOverlay.setMessage(""); if (!getSlayerBoss()) { bossUUID = 0; mania = 0; @@ -52,7 +53,7 @@ registerWhen(register("tick", () => { // Mania Detect const maniaIndex = name.indexOf("§5§lMANIA"); if (maniaIndex !== -1) { - vampireOverlay.message += `${name[maniaIndex]}: ${name[maniaIndex + 1]}\n`; + vampireMessage += `${name[maniaIndex]}: ${name[maniaIndex + 1]}\n`; if (!inMania) { mania++; inMania = true; @@ -70,11 +71,13 @@ registerWhen(register("tick", () => { // Twinclaw Detect const clawIndex = name.indexOf("§6§lTWINCLAWS"); - if (clawIndex !== -1) vampireOverlay.message += `${name[clawIndex]}: ${name[clawIndex + 1]}\n`; + if (clawIndex !== -1) vampireMessage += `${name[clawIndex]}: ${name[clawIndex + 1]}\n`; // Ichor Detect const ichorIndex = name.indexOf("§3§lICHOR"); if (ichorIndex !== -1) ichorSpawn = true; + + vampireOverlay.setMessage(vampireMessage); } // Ichor Nametag Shit @@ -86,7 +89,7 @@ registerWhen(register("tick", () => { ichorUUID = 0; return; } - vampireOverlay.message += `${DARK_AQUA + BOLD}ICHOR: ${ichor.func_95999_t()}\n`; + vampireOverlay.setMessage(vampireMessage + `${DARK_AQUA + BOLD}ICHOR: ${ichor.func_95999_t()}\n`); } else { const ichor = stands.find(stand => stand.func_95999_t().includes('24.')); if (ichor === undefined) return; diff --git a/utils/overlay.js b/utils/overlay.js index 2286cc08..ce5680e3 100644 --- a/utils/overlay.js +++ b/utils/overlay.js @@ -22,7 +22,7 @@ function renderScale(scale, text, x, y, align, flex) { /** * Variables used to move all active GUIs. */ -const GUI_INSTRUCT = "Use +/- to scale, R to reset, L to swap align, H to swap flex, or W to change view"; +const GUI_INSTRUCT = "Use +/- to scale, R to reset, L to swap align, H to swap flex, B to show BG, or W to change view"; const gui = new Gui(); const background = new Gui(); @@ -39,13 +39,13 @@ const moving = register("renderOverlay", () => { if (!settings[overlay.setting]) return; // Draw example text and box const scale = overlay.loc[2]; - const x = overlay.loc[0] - (overlay.loc[3] ? overlay.width - 3*scale : 0); + const x = overlay.loc[0] - (overlay.loc[3] ? overlay.eWidth - 3*scale : 0); const y = overlay.loc[1]; Renderer.drawRect( - Renderer.color(69, 69, 69, 169), + Renderer.color(0, 0, 0, 128), x - 3*scale, y - 3*scale, - overlay.width + 6*scale, overlay.height + 6*scale + overlay.eWidth + 6*scale, overlay.eHeight + 6*scale ); renderScale(overlay.loc[2], overlay.example, overlay.X, overlay.Y, overlay.loc[3], overlay.loc[4]); }); @@ -53,7 +53,7 @@ const moving = register("renderOverlay", () => { // GUI Instructions renderScale( 1.2, GUI_INSTRUCT, - Renderer.screen.getWidth() / 2 - Renderer.getStringWidth(GUI_INSTRUCT) / 1.4, + Renderer.screen.getWidth() / 2 - Renderer.getStringWidth(GUI_INSTRUCT) * 0.6, Renderer.screen.getHeight() / 2.4, false, false ); }).unregister(); @@ -61,18 +61,18 @@ const moving = register("renderOverlay", () => { /** * Handles overlay selection when clicking on the screen. */ -const clicking = register("guiMouseClick", (x, y, button, screen) => { +const clicking = register("guiMouseClick", (x, y) => { currentOverlay = undefined; overlays.forEach(overlay => { const scale = overlay.loc[2]; - const oX = overlay.loc[0] - (overlay.loc[3] ? overlay.width - 3*scale : 0); + const oX = overlay.loc[0] - (overlay.loc[3] ? overlay.eWidth - 3*scale : 0); const oY = overlay.loc[1]; if (x > oX - 3*scale && - x < oX + 3*scale + overlay.width && + x < oX + 3*scale + overlay.eWidth && y > oY - 3*scale && - y < oY + 3*scale + overlay.height + y < oY + 3*scale + overlay.eHeight ) currentOverlay = overlay; }); }).unregister(); @@ -140,6 +140,8 @@ const keying = register("guiKey", (char, keyCode, currentGui, event) => { currentOverlay.loc[3] = !currentOverlay.loc[3]; } else if (keyCode === 35) { // Swap flex (h key) currentOverlay.loc[4] = !currentOverlay.loc[4]; + } else if (keyCode === 48) { // Set BG (b key) + currentOverlay.loc[5] = !currentOverlay.loc[5]; } else return; currentOverlay.setSize(); @@ -179,11 +181,15 @@ export class Overlay { this.example = example; this.message = example; this.gui = new Gui(); - this.setSize(); - // loc array changes for versions < 2.8.9 + // Set size for background rendering + this.setSize(this.message, "message"); + this.setSize(this.example, "example"); + + // loc array changes for versions < 2.9.4 if (this.loc[3] === undefined) this.loc.push(false); if (this.loc[4] === undefined) this.loc.push(false); + if (this.loc[5] === undefined) this.loc.push(false); // Register a render function to display the overlay and GUI instructions. // The overlay is shown when the GUI is open or in requires specified in 'requires' array.' @@ -200,6 +206,12 @@ export class Overlay { Renderer.drawLine(Renderer.WHITE, width, this.loc[1], 1, this.loc[1], 0.5); // Draw example text + if (this.loc[5] && this.width !== 0) + Renderer.drawRect( + Renderer.color(0, 0, 0, 128), + this.loc[0] - 3*this.loc[2], this.loc[1] - 3*this.loc[2], + this.eWidth + 6*this.loc[2], this.eHeight + 6*this.loc[2] + ); renderScale(this.loc[2], this.example, this.X, this.Y, this.loc[3], this.loc[4]); // GUI Instructions @@ -213,6 +225,12 @@ export class Overlay { registerWhen(register(this.requires.has("misc") ? "guiRender" : "renderOverlay", () => { if (!special() && condition() && !gui.isOpen() && !this.gui.isOpen()) { if (this.requires.has("misc")) background.func_146278_c(0); + if (this.loc[5] && this.width !== 0) + Renderer.drawRect( + Renderer.color(0, 0, 0, 128), + this.loc[0] - 3*this.loc[2], this.loc[1] - 3*this.loc[2], + this.width + 6*this.loc[2], this.height + 6*this.loc[2] + ); renderScale(this.loc[2], this.message, this.X, this.Y, this.loc[3], this.loc[4]); } }), () => settings[this.setting] && (this.requires.has(getWorld()) || this.requires.has("all"))); @@ -246,13 +264,15 @@ export class Overlay { this.loc[3] = !this.loc[3]; } else if (keyCode === 35) { // Swap flex (h key) this.loc[4] = !this.loc[4]; + } else if (keyCode === 48) { // Swap flex (b key) + this.loc[5] = !this.loc[5]; } else if (keyCode === 1) { this.moving.unregister(); this.dragging.unregister(); this.keying.unregister(); } else return; - this.setSize(); + this.setSize(this.message, "message"); } }).unregister(); @@ -266,14 +286,27 @@ export class Overlay { } /** - * Calculates and sets overlay dimensions based on example text. - * Splits text into lines, calculates total height, and determines width for each line. - * Maximum width across lines is stored in `this.width`. + * Replaces current overlay message with provided message. + * + * @param {String} message - Message to be updated to. + */ + setMessage(message) { + this.message = message; + this.setSize(this.message, "message"); + } + + /** + * Sets width and height of overlay. + * Fixes getStringWidth not setting bolded size correctly. */ - setSize() { - const lines = this.example.split("\n"); - this.width = 0; - this.height = lines.length * 9 * this.loc[2]; + setSize(message, type) { + const lines = message.split("\n"); + + + if (type === "message") this.height = lines.length * 9 * this.loc[2]; + else this.eHeight = lines.length * 9 * this.loc[2]; + + let maxWidth = 0; lines.forEach(line => { if (line.includes('§l')) { const splitLine = line.split('§l'); @@ -289,8 +322,11 @@ export class Overlay { } } - this.width = Math.max(this.width, stringWidth * this.loc[2]); - } else this.width = Math.max(this.width, Renderer.getStringWidth(line) * this.loc[2]); + maxWidth = Math.max(maxWidth, stringWidth * this.loc[2]); + } else maxWidth = Math.max(maxWidth, Renderer.getStringWidth(line) * this.loc[2]); }); + + if (type === "message") this.width = maxWidth; + else this.eWidth = maxWidth; } } diff --git a/utils/variables.js b/utils/variables.js index 588fd23f..73e62be7 100644 --- a/utils/variables.js +++ b/utils/variables.js @@ -5,40 +5,40 @@ import { delay } from "./thread"; const DEFAULT_GUI = { - "AL": [780, 430, 1.2, false, false], // Skill Tracker Location - "BL": [10, 120, 1.2, false, false], // Vampire Location - "CL": [10, 180, 1.2, false, false], // Counter Location - "DL": [10, 180, 1.2, false, false], // Broodmother Location - "EL": [100, 150, 1.1, false, false], // Advanced Value Location - "FL": [220, 10, 1.2, false, false], // Trophy Fish Location - "GL": [10, 140, 1.2, false, false], // Gyro Location - "HL": [10, 240, 1.2, false, false], // Powder Chest Location - "IL": [10, 180, 1.2, false, false], // Inq Location - "JL": [150, 180, 1.2, false, false], // Kill Counter Location - "KL": [600, 220, 1.2, false, false], // Kuudra Profit Location - "LL": [770, 70, 1.2, false, false], // Server Status Location - "ML": [780, 390, 1.2, false, false], // Coins Location - "OL": [10, 130, 1.2, false, false], // Composter Location - "PL": [10, 100, 1.2, false, false], // Powder Location - "QL": [250, 225, 4, false, false], // Vanquisher Location - "RL": [600, 175, 1, false, false], // Container Value Location - "SL": [10, 180, 1.2, false, false], // Splits Location - "TL": [10, 130, 1.2, false, false], // Golden Fish Timer Location - "UL": [930, 65, 1.2, false, false], // Armor Display Location - "VL": [10, 180, 1.2, false, false], // Visitors Location - "WL": [730, 130, 1.2, false, false], // Wolf Combo Location - "XL": [Renderer.screen.getWidth()/2 - 96, Renderer.screen.getHeight()*6/7, 1, false, false], // Searchbox location - "YL": [770, 170, 1.2, false, false], // SkyBlock Stats Location - "ZL": [780, 330, 1.2, false, false], // Kuudra Profit Tracker Location - "BCL": [180, 10, 1, false, false], // Bingo Card Location - "CDL": [190, 115, 1.2, false, false], // Commission Display Location - "CEL": [375, 275, 3, false, false], // Crate edit location - "CFL": [10, 260, 1.2, false, false], // Chocolate factory location - "EQL": [905, 65, 1.2, false, false], // Equipment Location - "FHL": [580, 160, 1.2, false, false], // Fossil Helper Location - "PHL": [170, 160, 1.2, false, false], // Pesthunter Location - "SDL": [170, 180, 1.2, false, false], // Spray Display Location - "TVL": [600, 150, 1.2, false, false], // Trade Value Location + "AL": [780, 430, 1.2, false, false, false], // Skill Tracker Location + "BL": [10, 120, 1.2, false, false, false], // Vampire Location + "CL": [10, 180, 1.2, false, false, false], // Counter Location + "DL": [10, 180, 1.2, false, false, false], // Broodmother Location + "EL": [100, 150, 1.1, false, false, false], // Advanced Value Location + "FL": [220, 10, 1.2, false, false, false], // Trophy Fish Location + "GL": [10, 140, 1.2, false, false, false], // Gyro Location + "HL": [10, 240, 1.2, false, false, false], // Powder Chest Location + "IL": [10, 180, 1.2, false, false, false], // Inq Location + "JL": [150, 180, 1.2, false, false, false], // Kill Counter Location + "KL": [600, 220, 1.2, false, false, false], // Kuudra Profit Location + "LL": [770, 70, 1.2, false, false, false], // Server Status Location + "ML": [780, 390, 1.2, false, false, false], // Coins Location + "OL": [10, 130, 1.2, false, false, false], // Composter Location + "PL": [10, 100, 1.2, false, false, false], // Powder Location + "QL": [250, 225, 4, false, false, false], // Vanquisher Location + "RL": [600, 175, 1, false, false, false], // Container Value Location + "SL": [10, 180, 1.2, false, false, false], // Splits Location + "TL": [10, 130, 1.2, false, false, false], // Golden Fish Timer Location + "UL": [930, 65, 1.2, false, false, false], // Armor Display Location + "VL": [10, 180, 1.2, false, false, false], // Visitors Location + "WL": [730, 130, 1.2, false, false, false], // Wolf Combo Location + "XL": [Renderer.screen.getWidth()/2 - 96, Renderer.screen.getHeight()*6/7, 1, false, false, false], // Searchbox location + "YL": [770, 170, 1.2, false, false, false], // SkyBlock Stats Location + "ZL": [780, 330, 1.2, false, false, false], // Kuudra Profit Tracker Location + "BCL": [180, 10, 1, false, false, false], // Bingo Card Location + "CDL": [190, 115, 1.2, false, false, false], // Commission Display Location + "CEL": [375, 275, 3, false, false, false], // Crate edit location + "CFL": [10, 260, 1.2, false, false, false], // Chocolate factory location + "EQL": [905, 65, 1.2, false, false, false], // Equipment Location + "FHL": [580, 160, 1.2, false, false, false], // Fossil Helper Location + "PHL": [170, 160, 1.2, false, false, false], // Pesthunter Location + "SDL": [170, 180, 1.2, false, false, false], // Spray Display Location + "TVL": [600, 150, 1.2, false, false, false], // Trade Value Location } // --- PERSISTENT DATA --- From 855ac64e175165c64e34845c5e87c89a351b60c9 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Thu, 25 Apr 2024 14:58:51 -0400 Subject: [PATCH 04/33] Limited pet display length --- features/general/Statistics.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/features/general/Statistics.js b/features/general/Statistics.js index 33c6122f..d07b7516 100644 --- a/features/general/Statistics.js +++ b/features/general/Statistics.js @@ -141,7 +141,8 @@ registerWhen(register("tick", () => { // Pet if (toggles.petDisplay) { - statsMessage += `${DARK_AQUA + BOLD}Pet: ${data.pet}\n`; + let pet = data.pet.length > 36 ? data.pet.split(' ').slice(2).join(' ') : data.pet; + statsMessage += `${DARK_AQUA + BOLD}Pet: ${pet}\n`; } // Stats From a257ef971c9cb0e07c4b9d5a46246f5cf23dfcc4 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Thu, 25 Apr 2024 15:08:48 -0400 Subject: [PATCH 05/33] cleaned up incorrect overlay settings --- changelog.json | 3 ++- features/farming/GardenTab.js | 5 +++-- features/farming/PestTracking.js | 4 ++-- features/general/WidgetDisplay.js | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/changelog.json b/changelog.json index b0003948..6e111941 100644 --- a/changelog.json +++ b/changelog.json @@ -1,4 +1,5 @@ [ "- Added option to render overlay background", - "- Fixed overlay width being off on bold" + "- Fixed overlay width being off on bold", + "- Fixed some overlay settings/displays" ] \ No newline at end of file diff --git a/features/farming/GardenTab.js b/features/farming/GardenTab.js index 73191634..27b09620 100644 --- a/features/farming/GardenTab.js +++ b/features/farming/GardenTab.js @@ -95,8 +95,9 @@ registerWhen(register("chat", () => { * Composter timers */ const compostExample = -`${DARK_GREEN + BOLD}Empty Compost: ${WHITE}loading -${DARK_GREEN + BOLD}Next Compost: ${WHITE}...`; +`${DARK_GREEN + BOLD}Composter: +${GREEN}Empty: ${WHITE}Loading +${GREEN}Next: ${WHITE}...`; const compostOverlay = new Overlay("compostTab", ["Garden"], () => settings.compostTab === 2, data.OL, "moveCompost", compostExample); let emptyCompost = 0; diff --git a/features/farming/PestTracking.js b/features/farming/PestTracking.js index 69682fd4..3636d410 100644 --- a/features/farming/PestTracking.js +++ b/features/farming/PestTracking.js @@ -45,7 +45,7 @@ register("chat", (plot) => { * Decrement spray timers every second */ register("step", () => { - let sprayMessage = ""; + let sprayMessage = `${GREEN + BOLD}Sprays:`; const keys = Object.keys(sprays) keys.forEach(plot => { @@ -225,7 +225,7 @@ registerWhen(register("chat", (_, fortune) => { * Track bonus timer */ const bonusExample = `${YELLOW + BOLD}Pest Bonus: ${GREEN}T1 FIGHTING`; -const bonusOverlay = new Overlay("pesthunterBonus", ["Garden"], () => true, data.PHL, "movePest", bonusExample); +const bonusOverlay = new Overlay("pesthunterBonus", ["Garden"], () => true, data.PHL, "moveBonus", bonusExample); registerWhen(register("step", () => { let bonusMessage = `${YELLOW + BOLD}Pest Bonus: `; let fortune = 0; diff --git a/features/general/WidgetDisplay.js b/features/general/WidgetDisplay.js index 52c0f7b5..212fc7e2 100644 --- a/features/general/WidgetDisplay.js +++ b/features/general/WidgetDisplay.js @@ -39,8 +39,8 @@ registerWhen(register("step", () => { return; } - let message = tablist[index++] + '\n'; - while (tablist[index].startsWith("§r ") && !tablist[index].endsWith("§r§3§lInfo§r")) message += tablist[index++] + '\n'; + let message = tablist[index++]; + while (tablist[index].startsWith("§r ") && !tablist[index].endsWith("§r§3§lInfo§r")) message += '\n' + tablist[index++]; widgetOverlays[widget].setMessage(message); }); }).setFps(1), () => settings.widgetDisplay); From ffb5e1590eb4e5c835cce5cc7f443d9e7bb7e6ab Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Thu, 25 Apr 2024 20:16:11 -0400 Subject: [PATCH 06/33] adjusted overlay rendering --- changelog.json | 2 ++ features/event/HippityHoppity.js | 4 +-- features/mining/CommissionsDisplay.js | 4 +-- utils/overlay.js | 40 +++++++++++++-------------- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/changelog.json b/changelog.json index 6e111941..5a021a4b 100644 --- a/changelog.json +++ b/changelog.json @@ -1,5 +1,7 @@ [ "- Added option to render overlay background", + "- Changed `pesttp` detection", + "- Changed garden box to be red/green if pests/spray", "- Fixed overlay width being off on bold", "- Fixed some overlay settings/displays" ] \ No newline at end of file diff --git a/features/event/HippityHoppity.js b/features/event/HippityHoppity.js index b5114fac..71073abb 100644 --- a/features/event/HippityHoppity.js +++ b/features/event/HippityHoppity.js @@ -27,7 +27,7 @@ const updateChocolate = register("step", () => { * Chocolate overlay. */ const chocoExample = -`§6§lChocolate: §e3.95m§8 (1.49k/s) +`§6§lChoco: §e3.95m§8 (1.49k/s) §6§lTotal: §e4.20m §6§lTime: §e00:00:11:03`; const chocoOverlay = new Overlay("chocoDisplay", ["all"], () => true, data.CFL, "moveChoco", chocoExample); @@ -37,7 +37,7 @@ register("step", () => { const chocoCalc = (now - data.chocoLast) * data.chocoProduction; const chocoAll = chocoCalc + data.chocoAll; - chocoOverlay.setMessage(`${GOLD + BOLD}Chocolate: ${YELLOW + formatNumber(chocoCalc + data.chocolate) + DARK_GRAY} (${formatNumber(data.chocoProduction)}/s) + chocoOverlay.setMessage(`${GOLD + BOLD}Choco: ${YELLOW + formatNumber(chocoCalc + data.chocolate) + DARK_GRAY} (${formatNumber(data.chocoProduction)}/s) ${GOLD + BOLD}Total: ${YELLOW + formatNumber(chocoAll)} ${GOLD + BOLD}Time: ${YELLOW + formatTimeElapsed(data.chocoLast, now)}`); }).setFps(1); diff --git a/features/mining/CommissionsDisplay.js b/features/mining/CommissionsDisplay.js index 584b66f3..3f0c485b 100644 --- a/features/mining/CommissionsDisplay.js +++ b/features/mining/CommissionsDisplay.js @@ -74,8 +74,8 @@ registerWhen(register("step", () => { closestCopy[0] = `${BOLD + UNDERLINE}${closestCopy[0]}`; if (settings.commissionWaypoints !== 2) commissionWaypoints.push(closestCopy); - commissionMessage += `${tab[index].replace("§f", GOLD)}\n`; - } else commissionMessage += `${tab[index]}\n`; + commissionMessage += `\n${tab[index].replace("§f", GOLD)}`; + } else commissionMessage += `\n${tab[index]}`; // Set commission message index++; diff --git a/utils/overlay.js b/utils/overlay.js index ce5680e3..17fe0616 100644 --- a/utils/overlay.js +++ b/utils/overlay.js @@ -39,13 +39,13 @@ const moving = register("renderOverlay", () => { if (!settings[overlay.setting]) return; // Draw example text and box const scale = overlay.loc[2]; - const x = overlay.loc[0] - (overlay.loc[3] ? overlay.eWidth - 3*scale : 0); + const x = overlay.loc[0] - (overlay.loc[3] ? (overlay.eWidth - 3) * scale : 0); const y = overlay.loc[1]; Renderer.drawRect( - Renderer.color(0, 0, 0, 128), + overlay.loc[5] ? Renderer.color(0, 0, 0, 128) : Renderer.color(128, 128, 128, 128), x - 3*scale, y - 3*scale, - overlay.eWidth + 6*scale, overlay.eHeight + 6*scale + (overlay.eWidth + 6) * scale, (overlay.eHeight + 6) * scale ); renderScale(overlay.loc[2], overlay.example, overlay.X, overlay.Y, overlay.loc[3], overlay.loc[4]); }); @@ -53,8 +53,8 @@ const moving = register("renderOverlay", () => { // GUI Instructions renderScale( 1.2, GUI_INSTRUCT, - Renderer.screen.getWidth() / 2 - Renderer.getStringWidth(GUI_INSTRUCT) * 0.6, - Renderer.screen.getHeight() / 2.4, false, false + Renderer.screen.getWidth() / 2 - Renderer.getStringWidth(GUI_INSTRUCT) * 0.65, + Renderer.screen.getHeight() * 0.65, false, false ); }).unregister(); @@ -66,13 +66,13 @@ const clicking = register("guiMouseClick", (x, y) => { overlays.forEach(overlay => { const scale = overlay.loc[2]; - const oX = overlay.loc[0] - (overlay.loc[3] ? overlay.eWidth - 3*scale : 0); + const oX = overlay.loc[0] - (overlay.loc[3] ? (overlay.eWidth - 3) * scale : 0); const oY = overlay.loc[1]; - if (x > oX - 3*scale && - x < oX + 3*scale + overlay.eWidth && - y > oY - 3*scale && - y < oY + 3*scale + overlay.eHeight + if (x > oX - 3 * scale && + x < oX + 3 * (scale + overlay.eWidth) && + y > oY - 3 * scale && + y < oY + 3 * (scale + overlay.eHeight) ) currentOverlay = overlay; }); }).unregister(); @@ -209,8 +209,8 @@ export class Overlay { if (this.loc[5] && this.width !== 0) Renderer.drawRect( Renderer.color(0, 0, 0, 128), - this.loc[0] - 3*this.loc[2], this.loc[1] - 3*this.loc[2], - this.eWidth + 6*this.loc[2], this.eHeight + 6*this.loc[2] + this.loc[0] - 3 * this.loc[2], this.loc[1] - 3 * this.loc[2], + (this.eWidth + 6) * this.loc[2], (this.eHeight + 6) * this.loc[2] ); renderScale(this.loc[2], this.example, this.X, this.Y, this.loc[3], this.loc[4]); @@ -223,13 +223,13 @@ export class Overlay { }).unregister(); registerWhen(register(this.requires.has("misc") ? "guiRender" : "renderOverlay", () => { - if (!special() && condition() && !gui.isOpen() && !this.gui.isOpen()) { + if (!special() && condition() && !gui.isOpen() && !this.gui.isOpen() && this.message) { if (this.requires.has("misc")) background.func_146278_c(0); if (this.loc[5] && this.width !== 0) Renderer.drawRect( Renderer.color(0, 0, 0, 128), - this.loc[0] - 3*this.loc[2], this.loc[1] - 3*this.loc[2], - this.width + 6*this.loc[2], this.height + 6*this.loc[2] + this.loc[0] - 3 * this.loc[2], this.loc[1] - 3 * this.loc[2], + (this.width + 6) * this.loc[2], (this.height + 6) * this.loc[2] ); renderScale(this.loc[2], this.message, this.X, this.Y, this.loc[3], this.loc[4]); } @@ -300,11 +300,11 @@ export class Overlay { * Fixes getStringWidth not setting bolded size correctly. */ setSize(message, type) { + if (message === "") return; const lines = message.split("\n"); - - if (type === "message") this.height = lines.length * 9 * this.loc[2]; - else this.eHeight = lines.length * 9 * this.loc[2]; + if (type === "message") this.height = lines.length * 9; + else this.eHeight = lines.length * 9; let maxWidth = 0; lines.forEach(line => { @@ -322,8 +322,8 @@ export class Overlay { } } - maxWidth = Math.max(maxWidth, stringWidth * this.loc[2]); - } else maxWidth = Math.max(maxWidth, Renderer.getStringWidth(line) * this.loc[2]); + maxWidth = Math.max(maxWidth, stringWidth); + } else maxWidth = Math.max(maxWidth, Renderer.getStringWidth(line)); }); if (type === "message") this.width = maxWidth; From ee0a666962c8fa75285ed7b546aa8f819a06e01d Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Thu, 25 Apr 2024 21:16:00 -0400 Subject: [PATCH 07/33] Added garden box coloring for pests/sprays --- features/farming/GardenBox.js | 15 --------------- features/farming/PestTracking.js | 16 ++++++++++++++++ index.js | 1 - 3 files changed, 16 insertions(+), 16 deletions(-) delete mode 100644 features/farming/GardenBox.js diff --git a/features/farming/GardenBox.js b/features/farming/GardenBox.js deleted file mode 100644 index 72153942..00000000 --- a/features/farming/GardenBox.js +++ /dev/null @@ -1,15 +0,0 @@ -import RenderLib from "../../../RenderLib/index.js"; -import settings from "../../utils/settings"; -import { registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; - - -/** - * Draw bounding box on current plot. - */ -registerWhen(register("renderWorld", () => { - const x = Math.floor((Player.getX() + 240) / 96); - const z = Math.floor((Player.getZ() + 240) / 96); - - RenderLib.drawEspBox(-192 + x * 96, 67, -192 + z * 96, 96, 10, 1, 1, 1, 1, true); -}), () => getWorld() === "Garden" && settings.gardenBox); diff --git a/features/farming/PestTracking.js b/features/farming/PestTracking.js index 3636d410..27952f98 100644 --- a/features/farming/PestTracking.js +++ b/features/farming/PestTracking.js @@ -5,6 +5,7 @@ import { getTime } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; import { getWorld } from "../../utils/worlds"; +import RenderLib from "../../../RenderLib"; /** @@ -243,3 +244,18 @@ registerWhen(register("step", () => { bonusOverlay.setMessage(bonusMessage); }).setFps(1), () => getWorld() === "Garden" && settings.pesthunterBonus); + + +/** + * Garden box rendering. + */ +registerWhen(register("renderWorld", () => { + const plotLine = Scoreboard.getLines().find(line => line.getName().startsWith(" §aPlot"))?.getName(); + const plot = plotLine?.removeFormatting()?.replace(/[^0-9]/g, ''); + const color = plotLine?.includes("§4§lൠ") ? [1, 0, 0] : + sprays.hasOwnProperty(plot) ? [0, 1, 0] : [1, 1, 1]; + const x = Math.floor((Player.getX() + 240) / 96); + const z = Math.floor((Player.getZ() + 240) / 96); + + RenderLib.drawEspBox(-192 + x * 96, 67, -192 + z * 96, 96, 10, ...color, 1, true); +}), () => getWorld() === "Garden" && settings.gardenBox); diff --git a/index.js b/index.js index ba57b142..2dfe0c45 100644 --- a/index.js +++ b/index.js @@ -78,7 +78,6 @@ import "./features/mining/WishingCompass"; // Farming Features import { calcCompost } from "./features/farming/ComposterCalc"; import "./features/farming/FarmingWebhook"; -import "./features/farming/GardenBox"; import "./features/farming/GardenTab"; import "./features/farming/JacobHighlight"; import "./features/farming/PestTracking"; From abb28db48f245d7e756a9de58cbbf7de832b56df Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Thu, 25 Apr 2024 21:39:55 -0400 Subject: [PATCH 08/33] `/pesttp` detection changes --- changelog.json | 2 +- features/farming/PestTracking.js | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/changelog.json b/changelog.json index 5a021a4b..45e82896 100644 --- a/changelog.json +++ b/changelog.json @@ -1,6 +1,6 @@ [ "- Added option to render overlay background", - "- Changed `pesttp` detection", + "- Changed `/pesttp` detection", "- Changed garden box to be red/green if pests/spray", "- Fixed overlay width being off on bold", "- Fixed some overlay settings/displays" diff --git a/features/farming/PestTracking.js b/features/farming/PestTracking.js index 27952f98..cfda7f2e 100644 --- a/features/farming/PestTracking.js +++ b/features/farming/PestTracking.js @@ -1,5 +1,5 @@ import settings from "../../utils/settings"; -import { AQUA, BOLD, DARK_GRAY, DARK_GREEN, GOLD, GRAY, GREEN, LOGO, RED, RESET, YELLOW } from "../../utils/constants"; +import { AQUA, BOLD, DARK_GRAY, DARK_GREEN, DARK_RED, GOLD, GRAY, GREEN, LOGO, RED, RESET, YELLOW } from "../../utils/constants"; import { getSlotCoords } from "../../utils/functions/find"; import { getTime } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; @@ -157,15 +157,20 @@ registerWhen(register("guiClosed", () => { let lastPlot = undefined; register("command", () => { setHive(); - const plot = hive.find(p => p != lastPlot); - if (plot === undefined) { - ChatLib.chat(`${LOGO + RED}No infested plots found...\n${DARK_GRAY}If there are pests, please open plots menu to track!`); + + // Check if currently standing in infested plot + if (Scoreboard.getLines().find(line => line.getName().startsWith(" §aPlot"))?.getName()?.includes("§4§lൠ")) { + Client.showTitle(`${DARK_RED}Infested!`, "You are standing in a plot with pests!", 10, 50, 10); return; } + // Otherwise warp to plot with most pests + const plot = hive[0]; delete swarm[plot]; - ChatLib.command(`plottp ${plot}`); lastPlot = plot; + + Client.showTitle(`${DARK_GREEN}Warping...`, `Teleporting to plot ${plot}!`, 10, 50, 10); + ChatLib.command(`plottp ${plot}`); setHive(); }).setName("pesttp"); From db6ca69adefb912636bff9bad86be18c011cdd3c Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Thu, 25 Apr 2024 21:45:05 -0400 Subject: [PATCH 09/33] Fixed instruction alignment --- utils/overlay.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/overlay.js b/utils/overlay.js index 17fe0616..8c951256 100644 --- a/utils/overlay.js +++ b/utils/overlay.js @@ -23,6 +23,7 @@ function renderScale(scale, text, x, y, align, flex) { * Variables used to move all active GUIs. */ const GUI_INSTRUCT = "Use +/- to scale, R to reset, L to swap align, H to swap flex, B to show BG, or W to change view"; +const INSTRUCT_WIDTH = Renderer.getStringWidth(GUI_INSTRUCT); const gui = new Gui(); const background = new Gui(); @@ -53,8 +54,8 @@ const moving = register("renderOverlay", () => { // GUI Instructions renderScale( 1.2, GUI_INSTRUCT, - Renderer.screen.getWidth() / 2 - Renderer.getStringWidth(GUI_INSTRUCT) * 0.65, - Renderer.screen.getHeight() * 0.65, false, false + (Renderer.screen.getWidth() - INSTRUCT_WIDTH * 1.4) / 2, + Renderer.screen.getHeight() * 0.6, false, false ); }).unregister(); @@ -217,7 +218,7 @@ export class Overlay { // GUI Instructions renderScale( 1.2, GUI_INSTRUCT, - width / 2 - Renderer.getStringWidth(GUI_INSTRUCT) / 1.2, + (width - INSTRUCT_WIDTH * 1.4) / 2, height / 2.4, false, false ); }).unregister(); From 8e58b4af0a23d4b25b98965dfc595090da7aa1e9 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Fri, 26 Apr 2024 00:08:22 -0400 Subject: [PATCH 10/33] Changed skill warnings to titles --- features/general/SkillTracker.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/features/general/SkillTracker.js b/features/general/SkillTracker.js index a2902353..3fb0e3a5 100644 --- a/features/general/SkillTracker.js +++ b/features/general/SkillTracker.js @@ -66,7 +66,7 @@ const trackSkills = register("guiOpened", () => { skillsTracked = true; trackSkills.unregister(); - ChatLib.chat(`${LOGO + GREEN}Skills tracked successfully!`); + Client.showTitle(`${GREEN}Skills tracked!`, "Now begin the grind.", 0, 50, 10); }); }); @@ -86,7 +86,7 @@ register("command", () => { skills[skill].time = 0; skills[skill].since = 600; }); - ChatLib.chat(`${LOGO + GREEN}Successfully reset skills, please open skills menu to re-track!`); + Client.showTitle(`${GREEN}Successfully reset skills!`, "Please open skills menu to retrack.", 10, 50, 10); }).setName("resetSkills"); /** @@ -94,8 +94,7 @@ register("command", () => { */ registerWhen(register("actionBar", (health, gain, type, amount, next, mana) => { if (!skillsTracked) { - ChatLib.clearChat(56194) - new Message(`${LOGO + RED}Please open skills menu to begin skill tracking!`).setChatLineId(56194).chat(); + Client.showTitle(`${RED}Skills not tracked!`, "Please open skills menu to track.", 0, 50, 10); return; } if (getPaused()) return; @@ -116,7 +115,7 @@ registerWhen(register("actionBar", (health, gain, type, amount, next, mana) => { */ registerWhen(register("actionBar", (health, gain, type, percent, mana) => { if (!skillsTracked) { - ChatLib.chat(`${LOGO + RED}Please open skills menu to begin skill tracking!`); + Client.showTitle(`${RED}Skills not tracked!`, "Please open skills menu to track.", 0, 50, 10); return; } if (getPaused()) return; From 5859bc2010cd46fa6f4da0d3d5cdaa6177f0895d Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Fri, 26 Apr 2024 00:11:08 -0400 Subject: [PATCH 11/33] Fixed compostOverlay message setting --- features/farming/GardenTab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/farming/GardenTab.js b/features/farming/GardenTab.js index 27b09620..ce6808d3 100644 --- a/features/farming/GardenTab.js +++ b/features/farming/GardenTab.js @@ -162,8 +162,8 @@ registerWhen(register("step", () => { const time = tablist.find(tab => tab.includes("Time Left")).removeFormatting().match(/(\d+)m (\d+)s|(\d+)s/); const nextCompost = !time ? `${RED + BOLD}Inactive` : getTime((time[1] ? parseInt(time[1], 10) : 0) * 60 + (time[2] ? parseInt(time[2], 10) : parseInt(time[3], 10))); - compostOverlay.message = + compostOverlay.setMessage( `${DARK_GREEN + BOLD}Composter: ${GREEN}Empty: ${message} -${GREEN}Next: ${WHITE + nextCompost}`; +${GREEN}Next: ${WHITE + nextCompost}`); }).setFps(1), () => getWorld() === "Garden" && settings.gardenTab !== 0); From aa5580270f1974b8d39e1797ca303b6d9570df38 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Fri, 26 Apr 2024 13:34:54 -0400 Subject: [PATCH 12/33] Fixed pest tracking features --- changelog.json | 1 + features/farming/PestTracking.js | 42 ++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/changelog.json b/changelog.json index 45e82896..e1f2864a 100644 --- a/changelog.json +++ b/changelog.json @@ -2,6 +2,7 @@ "- Added option to render overlay background", "- Changed `/pesttp` detection", "- Changed garden box to be red/green if pests/spray", + "- Changed pest alert to be slider", "- Fixed overlay width being off on bold", "- Fixed some overlay settings/displays" ] \ No newline at end of file diff --git a/features/farming/PestTracking.js b/features/farming/PestTracking.js index cfda7f2e..d453b29b 100644 --- a/features/farming/PestTracking.js +++ b/features/farming/PestTracking.js @@ -21,6 +21,7 @@ const plots = new Set(); const pests = new Set(); let swarm = {}; let hive = []; +let plotZone = "0"; /** * Sort the swarm dictionary into hive in descending pest order. @@ -28,19 +29,29 @@ let hive = []; function setHive() { const tablist = TabList.getNames(); const pestIndex = tablist.findIndex(tab => tab === "§r§4§lPests:§r"); + hive = []; + if (pestIndex === -1) { let entries = Object.entries(swarm); entries.sort((a, b) => b[1] - a[1]); hive = entries.map(entry => entry[0]); - } else hive = tablist[pestIndex + 2].split("§r§f, §r§b").map(plot => plot.replace(/\D/g, '')); + } else if (!tablist[pestIndex + 2].startsWith("§r Spray:")) + hive = tablist[pestIndex + 2].split("§r§f, §r§b").map(plot => plot.replace(/\D/g, '')); } +registerWhen(register("step", () => { + if (!World.isLoaded()) return; + const plotLine = Scoreboard.getLines().find(line => line.getName().startsWith(" §aPlot")); + plotZone = plotLine?.getName()?.removeFormatting()?.split(' ')?.[5]?.replace(/[^0-9]/g, '') ?? "0"; + setHive(); +}).setFps(2), () => getWorld() === "Garden" && settings.gardenBox); + /** * Track sprays using chat */ -register("chat", (plot) => { +registerWhen(register("chat", (plot) => { sprays[plot] = 1800; -}).setCriteria("SPRAYONATOR! You sprayed Plot - ${plot} with ${material}!"); +}).setCriteria("SPRAYONATOR! You sprayed Plot - ${plot} with ${material}!"), () => getWorld() === "Garden"); /** * Decrement spray timers every second @@ -157,21 +168,22 @@ registerWhen(register("guiClosed", () => { let lastPlot = undefined; register("command", () => { setHive(); - - // Check if currently standing in infested plot - if (Scoreboard.getLines().find(line => line.getName().startsWith(" §aPlot"))?.getName()?.includes("§4§lൠ")) { - Client.showTitle(`${DARK_RED}Infested!`, "You are standing in a plot with pests!", 10, 50, 10); + if (hive.length === 0) { + Client.showTitle(`${DARK_RED}Pests Controlled!`, "No plots have any pests!", 10, 50, 10); return; } - // Otherwise warp to plot with most pests - const plot = hive[0]; - delete swarm[plot]; - lastPlot = plot; + const plot = hive.find(p => p != lastPlot && p != plotZone); + if (plot === undefined) { + Client.showTitle(`${DARK_RED}Infested!`, "You are standing in a plot with pests!", 10, 50, 10); + return; + } Client.showTitle(`${DARK_GREEN}Warping...`, `Teleporting to plot ${plot}!`, 10, 50, 10); ChatLib.command(`plottp ${plot}`); - setHive(); + + lastPlot = plot; + delete swarm[plot]; }).setName("pesttp"); @@ -255,10 +267,8 @@ registerWhen(register("step", () => { * Garden box rendering. */ registerWhen(register("renderWorld", () => { - const plotLine = Scoreboard.getLines().find(line => line.getName().startsWith(" §aPlot"))?.getName(); - const plot = plotLine?.removeFormatting()?.replace(/[^0-9]/g, ''); - const color = plotLine?.includes("§4§lൠ") ? [1, 0, 0] : - sprays.hasOwnProperty(plot) ? [0, 1, 0] : [1, 1, 1]; + const color = hive.includes(plotZone) ? [1, 0, 0] : + sprays.hasOwnProperty(plotZone) ? [0, 1, 0] : [1, 1, 1]; const x = Math.floor((Player.getX() + 240) / 96); const z = Math.floor((Player.getZ() + 240) / 96); From 3911ef64b724299ae253dd5416f6301882b51ef6 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Fri, 26 Apr 2024 13:35:12 -0400 Subject: [PATCH 13/33] Adjusted skill title timing --- features/general/SkillTracker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/general/SkillTracker.js b/features/general/SkillTracker.js index 3fb0e3a5..5e63c9f8 100644 --- a/features/general/SkillTracker.js +++ b/features/general/SkillTracker.js @@ -66,7 +66,7 @@ const trackSkills = register("guiOpened", () => { skillsTracked = true; trackSkills.unregister(); - Client.showTitle(`${GREEN}Skills tracked!`, "Now begin the grind.", 0, 50, 10); + Client.showTitle(`${GREEN}Skills tracked!`, "Now begin the grind.", 10, 50, 10); }); }); From b46d889fbb4e1643542bef5cc95311d32a6c505e Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Fri, 26 Apr 2024 13:47:43 -0400 Subject: [PATCH 14/33] Added viewrecipe button --- changelog.json | 1 + features/farming/PestTracking.js | 2 +- index.js | 38 ++++++++++++++++++++++++++------ utils/variables.js | 1 + 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/changelog.json b/changelog.json index e1f2864a..27c06738 100644 --- a/changelog.json +++ b/changelog.json @@ -1,5 +1,6 @@ [ "- Added option to render overlay background", + "- Added `/viewrecipe` button in GUI", "- Changed `/pesttp` detection", "- Changed garden box to be red/green if pests/spray", "- Changed pest alert to be slider", diff --git a/features/farming/PestTracking.js b/features/farming/PestTracking.js index d453b29b..779aa197 100644 --- a/features/farming/PestTracking.js +++ b/features/farming/PestTracking.js @@ -173,7 +173,7 @@ register("command", () => { return; } - const plot = hive.find(p => p != lastPlot && p != plotZone); + const plot = hive.find(p => p != lastPlot || p != plotZone); if (plot === undefined) { Client.showTitle(`${DARK_RED}Infested!`, "You are standing in a plot with pests!", 10, 50, 10); return; diff --git a/index.js b/index.js index 2dfe0c45..ccb15a77 100644 --- a/index.js +++ b/index.js @@ -153,6 +153,10 @@ ${AQUA + BOLD}Stats Commands: ${WHITE}/va ${GRAY}<${WHITE}pet, stats, pt, sf${GR ${AQUA + BOLD}Party Commands: ${WHITE}Refer to '/va toggles'`); } +// `viewrecipe` GUI Button +const recipeKey = new KeyBind("View Recipe", data.recipeKey, "./VolcAddons.xdd"); +register("gameUnload", () => { data.recipeKey = recipeKey.getKeyCode() }); + // Dev Mode const devKey = new KeyBind("Developer Mode", data.devKey, "./VolcAddons.xdd"); register("gameUnload", () => { data.devKey = devKey.getKeyCode() }); @@ -183,14 +187,34 @@ devKey.registerKeyPress(() => { ChatLib.chat(`${LOGO + GREEN}Successfully copied block data!`); } }); + register("guiKey", (_, keyCode, gui) => { - if (keyCode !== devKey.getKeyCode()) return; - const slot = gui?.getSlotUnderMouse()?.field_75222_d; - if (slot === undefined) return; - const item = Player.getContainer().getStackInSlot(slot); - if (item === null) return; - ChatLib.command(`ct copy ${item.getNBT()}`, true); - ChatLib.chat(`${LOGO + GREEN}Successfully copied ${GRAY}[${item.getName() + GRAY}] ${GREEN}NBT!`); + if (keyCode === devKey.getKeyCode()) { + const slot = gui?.getSlotUnderMouse()?.field_75222_d; + if (slot === undefined) return; + const item = Player.getContainer().getStackInSlot(slot); + if (item === null) return; + ChatLib.command(`ct copy ${item.getNBT()}`, true); + ChatLib.chat(`${LOGO + GREEN}Successfully copied ${GRAY}[${item.getName() + GRAY}] ${GREEN}NBT!`); + } else if (keyCode === recipeKey.getKeyCode()) { + // Check if hovering valid slot + const slot = gui?.getSlotUnderMouse()?.field_75222_d; + if (slot === undefined) { + ChatLib.chat(`${LOGO + RED}Cannot viewrecipe of nothing.`); + return; + } + + // Check if item is null + const item = Player.getContainer().getItems()[slot]; + if (item === null) { + ChatLib.chat(`${LOGO + RED}Cannot viewrecipe of nothing.`) + return; + } + + // Viewrecipe using item NBT ID + const id = item.getNBT().getCompoundTag("tag").getCompoundTag("ExtraAttributes").getString("id"); + ChatLib.command(`viewrecipe ${id}`); + } }); // Open settings diff --git a/utils/variables.js b/utils/variables.js index 73e62be7..682fbcea 100644 --- a/utils/variables.js +++ b/utils/variables.js @@ -119,6 +119,7 @@ export let data = new PogObject("VolcAddons", { "dianaKey": 0, "pauseKey": 0, "devKey": 0, + "recipeKey": 0, "bindKey": 0, "chunkey": 0, "wardKey": 0, From bb4fcec7ef3bac1fdff992d366646b92aa6d3370 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Fri, 26 Apr 2024 13:51:56 -0400 Subject: [PATCH 15/33] Made `/pesttp` more consistant --- features/farming/PestTracking.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/farming/PestTracking.js b/features/farming/PestTracking.js index 779aa197..d62dcf86 100644 --- a/features/farming/PestTracking.js +++ b/features/farming/PestTracking.js @@ -4,7 +4,7 @@ import { getSlotCoords } from "../../utils/functions/find"; import { getTime } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; +import { findZone, getWorld } from "../../utils/worlds"; import RenderLib from "../../../RenderLib"; @@ -168,7 +168,7 @@ registerWhen(register("guiClosed", () => { let lastPlot = undefined; register("command", () => { setHive(); - if (hive.length === 0) { + if (hive.length === 0 || !findZone().includes("ൠ")) { Client.showTitle(`${DARK_RED}Pests Controlled!`, "No plots have any pests!", 10, 50, 10); return; } From 49ddda7626b9d4de3e78e4be48c0c8faaa746dc0 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Fri, 26 Apr 2024 13:58:22 -0400 Subject: [PATCH 16/33] Fixed plot detection --- features/farming/PestTracking.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/features/farming/PestTracking.js b/features/farming/PestTracking.js index d62dcf86..9b6c4a2d 100644 --- a/features/farming/PestTracking.js +++ b/features/farming/PestTracking.js @@ -41,11 +41,12 @@ function setHive() { registerWhen(register("step", () => { if (!World.isLoaded()) return; - const plotLine = Scoreboard.getLines().find(line => line.getName().startsWith(" §aPlot")); - plotZone = plotLine?.getName()?.removeFormatting()?.split(' ')?.[5]?.replace(/[^0-9]/g, '') ?? "0"; + const plotLine = Scoreboard.getLines().find(line => line.getName().startsWith(" §7⏣ §aPlot")); + plotZone = plotLine?.getName()?.removeFormatting()?.split(' ')?.[4]?.replace(/[^0-9]/g, '') ?? "0"; setHive(); }).setFps(2), () => getWorld() === "Garden" && settings.gardenBox); +Scoreboard.getLines().forEach(line => print(line)); /** * Track sprays using chat */ @@ -252,6 +253,7 @@ registerWhen(register("step", () => { if (--bonuses[bonus] === 0) delete bonuses[bonus]; else fortune += parseInt(bonus.replace(/[^0-9]/g, '')); }); + if (fortune === 0) bonusMessage += `${RED + BOLD}Inactive!`; else { const bonusColor = remain > 1200 ? GREEN : From 0043c3f948a0938e27133c6314d495dd7a520dc4 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Fri, 26 Apr 2024 14:01:28 -0400 Subject: [PATCH 17/33] Fixed recipe spam --- index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/index.js b/index.js index ccb15a77..def7fbf9 100644 --- a/index.js +++ b/index.js @@ -199,10 +199,7 @@ register("guiKey", (_, keyCode, gui) => { } else if (keyCode === recipeKey.getKeyCode()) { // Check if hovering valid slot const slot = gui?.getSlotUnderMouse()?.field_75222_d; - if (slot === undefined) { - ChatLib.chat(`${LOGO + RED}Cannot viewrecipe of nothing.`); - return; - } + if (slot === undefined) return; // Check if item is null const item = Player.getContainer().getItems()[slot]; From 006456d5adbb1f0a22b4675dd6e9488e922e9a17 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Fri, 26 Apr 2024 19:40:17 -0400 Subject: [PATCH 18/33] Changed infestation alert to slider --- features/farming/PestTracking.js | 28 ++++++++-------------------- index.js | 2 +- utils/settings.js | 12 +++++++----- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/features/farming/PestTracking.js b/features/farming/PestTracking.js index 9b6c4a2d..ed2401b6 100644 --- a/features/farming/PestTracking.js +++ b/features/farming/PestTracking.js @@ -41,12 +41,12 @@ function setHive() { registerWhen(register("step", () => { if (!World.isLoaded()) return; - const plotLine = Scoreboard.getLines().find(line => line.getName().startsWith(" §7⏣ §aPlot")); - plotZone = plotLine?.getName()?.removeFormatting()?.split(' ')?.[4]?.replace(/[^0-9]/g, '') ?? "0"; + const plotLine = Scoreboard.getLines().find(line => line.getName().startsWith(" §aPlot")); + plotZone = plotLine?.getName()?.removeFormatting()?.trim()?.split(' ')?.[2]?.replace(/[^0-9]/g, '') ?? "0"; setHive(); }).setFps(2), () => getWorld() === "Garden" && settings.gardenBox); -Scoreboard.getLines().forEach(line => print(line)); + /** * Track sprays using chat */ @@ -204,25 +204,13 @@ registerWhen(register("chat", (_, num, plot) => { /** - * Pest swarm (more than 4 = loss farming fortune) + * Pest swarm */ -const infested = register("step", () => { - const loc = Scoreboard.getLines().find(line => line.getName().startsWith(" §7⏣")); - if (loc === undefined) return; - - const count = loc.getName().removeFormatting().replace(/[^0-9]/g, ''); +registerWhen(register("step", () => { + const count = parseInt(TabList.getNames().find(name => name.startsWith("§r Alive:"))?.split(' ')?.[2]?.removeFormatting() ?? 0); + if (count < settings.infestationAlert) return; Client.showTitle(`${DARK_GREEN + BOLD}SPREADING PLAGUE`, `${count} minions with ${BOLD}Taunt ${RESET}are in the way!`, 0, 25, 5); -}).setFps(1).unregister(); - -/** - * Track chat for pest fortune messages - */ -registerWhen(register("chat", () => { - infested.register(); -}).setCriteria(" ൠ ☘ Farming Fortune has been reduced by ${percent}%!"), () => getWorld() === "Garden" && settings.infestationAlert); -registerWhen(register("chat", () => { - infested.unregister(); -}).setCriteria("Your Garden is no longer infested and your ☘ Farming Fortune has returned to normal!"), () => getWorld() === "Garden" && settings.infestationAlert); +}).setFps(1).unregister(), () => settings.infestationAlert !== 0 && getWorld() === "Garden"); /** diff --git a/index.js b/index.js index def7fbf9..10b87e25 100644 --- a/index.js +++ b/index.js @@ -204,7 +204,7 @@ register("guiKey", (_, keyCode, gui) => { // Check if item is null const item = Player.getContainer().getItems()[slot]; if (item === null) { - ChatLib.chat(`${LOGO + RED}Cannot viewrecipe of nothing.`) + ChatLib.chat(`${LOGO + RED}Cannot viewrecipe of nothing.`); return; } diff --git a/utils/settings.js b/utils/settings.js index 086b5db6..569b5cac 100644 --- a/utils/settings.js +++ b/utils/settings.js @@ -869,13 +869,15 @@ Move GUI with ${AQUA}/movePowder ${GRAY}or reset tracker with ${AQUA}/resetPowde webhookTimer = 0; // --- Pests --- - @SwitchProperty({ - name: "Infestation Alert", - description: "Displays a title on screen when there are enough pests to cause a loss in farming fortune.", + @SliderProperty({ + name: "Infested Alert", + description: "Select minimum amount of pests .", category: "Farming", - subcategory: "Pests" + subcategory: "Pests", + min: 0, + max: 8 }) - infestationAlert = false; + infestationAlert = 0; @SwitchProperty({ name: "Pest Alert", From e93056c3f76b7948a9a50d3fba907d6cc24bee67 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sat, 27 Apr 2024 13:33:09 -0400 Subject: [PATCH 19/33] Limited visitor name parsing --- features/farming/GardenTab.js | 1 + 1 file changed, 1 insertion(+) diff --git a/features/farming/GardenTab.js b/features/farming/GardenTab.js index ce6808d3..8009d829 100644 --- a/features/farming/GardenTab.js +++ b/features/farming/GardenTab.js @@ -38,6 +38,7 @@ registerWhen(register("step", () => { visitors = []; for (let i = 0; i <= visitorCount; i++) { let visitor = tablist[visitorIndex + i]; + if (visitor.length > 34) visitor = visitor.split(' ').splice(0, 3).join(' '); gardenMessage += visitor + '\n'; visitors.push(visitor); } From 1f7ad951f87297636a9fe4589e98150250c3087e Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 02:10:21 -0400 Subject: [PATCH 20/33] Fixed overlay death --- changelog.json | 3 ++- features/event/HippityHoppity.js | 4 ++++ utils/overlay.js | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/changelog.json b/changelog.json index 27c06738..c300aa77 100644 --- a/changelog.json +++ b/changelog.json @@ -5,5 +5,6 @@ "- Changed garden box to be red/green if pests/spray", "- Changed pest alert to be slider", "- Fixed overlay width being off on bold", - "- Fixed some overlay settings/displays" + "- Fixed some overlay settings/displays", + "- Fixed overlay death" ] \ No newline at end of file diff --git a/features/event/HippityHoppity.js b/features/event/HippityHoppity.js index 71073abb..86f2cd53 100644 --- a/features/event/HippityHoppity.js +++ b/features/event/HippityHoppity.js @@ -9,6 +9,10 @@ import { announceMob } from "../../utils/functions/misc"; /** * Choco latte + * + * Breakfast- 7:00 am + * Lunch- 2:00 pm + * Dinner- 9:00 pm */ const updateChocolate = register("step", () => { if (Player?.getContainer()?.getName() !== "Chocolate Factory") return; diff --git a/utils/overlay.js b/utils/overlay.js index 8c951256..ca4096b3 100644 --- a/utils/overlay.js +++ b/utils/overlay.js @@ -301,8 +301,8 @@ export class Overlay { * Fixes getStringWidth not setting bolded size correctly. */ setSize(message, type) { - if (message === "") return; - const lines = message.split("\n"); + const lines = message?.split("\n"); + if (!(lines?.length)) return; if (type === "message") this.height = lines.length * 9; else this.eHeight = lines.length * 9; From 0812b4e3db63b95887d2a3ad643be4a52a2dcd77 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 02:44:37 -0400 Subject: [PATCH 21/33] added egg timers --- changelog.json | 1 + features/event/HippityHoppity.js | 36 ++++++++++++++++++++++++++------ utils/settings.js | 8 +++++++ utils/variables.js | 1 + 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/changelog.json b/changelog.json index c300aa77..185defc7 100644 --- a/changelog.json +++ b/changelog.json @@ -1,5 +1,6 @@ [ "- Added option to render overlay background", + "- Added choco egg timers", "- Added `/viewrecipe` button in GUI", "- Changed `/pesttp` detection", "- Changed garden box to be red/green if pests/spray", diff --git a/features/event/HippityHoppity.js b/features/event/HippityHoppity.js index 86f2cd53..267d468c 100644 --- a/features/event/HippityHoppity.js +++ b/features/event/HippityHoppity.js @@ -1,7 +1,7 @@ import settings from "../../utils/settings"; -import { BOLD, DARK_GRAY, GOLD, STAND_CLASS, YELLOW } from "../../utils/constants"; +import { BOLD, DARK_GRAY, GOLD, STAND_CLASS, WHITE, YELLOW } from "../../utils/constants"; import { getSlotCoords } from "../../utils/functions/find"; -import { convertToTitleCase, formatNumber, formatTimeElapsed } from "../../utils/functions/format"; +import { convertToTitleCase, formatNumber, formatTimeElapsed, getTime } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; import { announceMob } from "../../utils/functions/misc"; @@ -9,10 +9,6 @@ import { announceMob } from "../../utils/functions/misc"; /** * Choco latte - * - * Breakfast- 7:00 am - * Lunch- 2:00 pm - * Dinner- 9:00 pm */ const updateChocolate = register("step", () => { if (Player?.getContainer()?.getName() !== "Chocolate Factory") return; @@ -47,6 +43,34 @@ ${GOLD + BOLD}Time: ${YELLOW + formatTimeElapsed(data.chocoLast, now)}`); }).setFps(1); +/** + * Egg timer overlay. + * + * 18k = midnight + * Breakfast- 7:00 am = 1_000 + * Lunch- 2:00 pm = 8_000 + * Dinner- 9:00 pm = 15_000 + */ +const eggExample = +`${GOLD + BOLD}Egg Timers: + ${YELLOW}Breakfast: ${WHITE}bling + ${YELLOW}Lunch: ${WHITE}bang + ${YELLOW}Dinner: ${WHITE}bang`; +const eggOverlay = new Overlay("eggTimers", ["all"], () => true, data.CGL, "moveEgg", eggExample); + +registerWhen(register("step", () => { + const time = World.getTime() % 24_000; + const breakfastTime = time > 1_000 ? 25_000 - time : 1_000 - time; + const lunchTime = time > 8_000 ? 32_000 - time : 8_000 - time; + const dinnerTime = time > 15_000 ? 39_000 - time : 15_000 - time; + eggOverlay.setMessage( +`${GOLD + BOLD}Egg Timers: + ${YELLOW}Breakfast: ${WHITE + getTime(breakfastTime / 20)} + ${YELLOW}Lunch: ${WHITE + getTime(lunchTime / 20)} + ${YELLOW}Dinner: ${WHITE + getTime(dinnerTime / 20)}`); +}).setFps(2), () => settings.eggTimers); + + /** * Highlight best worker. */ diff --git a/utils/settings.js b/utils/settings.js index 569b5cac..d28f80ca 100644 --- a/utils/settings.js +++ b/utils/settings.js @@ -942,6 +942,14 @@ Move GUI with ${AQUA}/movePowder ${GRAY}or reset tracker with ${AQUA}/resetPowde }) chocoAlert = 0; + @SwitchProperty({ + name: "Egg Timers", + description: `${DARK_RED}NEW! ${GRAY}Displays overlay off how long until an egg spawns. Also shows title whenever an egg spawns.`, + category: "Event", + subcategory: "Chocolate Factory" + }) + eggTimers = false; + @SwitchProperty({ name: "Egg Waypoints", description: `Display waypoints for nearby corpses. ${DARK_RED}Technically uses ESP so UAYOR!`, diff --git a/utils/variables.js b/utils/variables.js index 682fbcea..6c302588 100644 --- a/utils/variables.js +++ b/utils/variables.js @@ -34,6 +34,7 @@ const DEFAULT_GUI = { "CDL": [190, 115, 1.2, false, false, false], // Commission Display Location "CEL": [375, 275, 3, false, false, false], // Crate edit location "CFL": [10, 260, 1.2, false, false, false], // Chocolate factory location + "CGL": [10, 115, 1.2, false, false, false], // Chocolate egg location "EQL": [905, 65, 1.2, false, false, false], // Equipment Location "FHL": [580, 160, 1.2, false, false, false], // Fossil Helper Location "PHL": [170, 160, 1.2, false, false, false], // Pesthunter Location From ca5df719eead11b040311407cb20d330ca4cc618 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 02:59:06 -0400 Subject: [PATCH 22/33] Added season check --- features/event/HippityHoppity.js | 3 ++- utils/worlds.js | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/features/event/HippityHoppity.js b/features/event/HippityHoppity.js index 267d468c..d13925e3 100644 --- a/features/event/HippityHoppity.js +++ b/features/event/HippityHoppity.js @@ -5,6 +5,7 @@ import { convertToTitleCase, formatNumber, formatTimeElapsed, getTime } from ".. import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; import { announceMob } from "../../utils/functions/misc"; +import { getSeason } from "../../utils/worlds"; /** @@ -68,7 +69,7 @@ registerWhen(register("step", () => { ${YELLOW}Breakfast: ${WHITE + getTime(breakfastTime / 20)} ${YELLOW}Lunch: ${WHITE + getTime(lunchTime / 20)} ${YELLOW}Dinner: ${WHITE + getTime(dinnerTime / 20)}`); -}).setFps(2), () => settings.eggTimers); +}).setFps(2), () => settings.eggTimers && getSeason() === "Spring"); /** diff --git a/utils/worlds.js b/utils/worlds.js index 8b821469..63867ccd 100644 --- a/utils/worlds.js +++ b/utils/worlds.js @@ -15,6 +15,10 @@ let server = undefined; export function getServer() { return server }; let noFind = 0; +let season = undefined; +export function getSeason() { return season }; +const SEASONS = ["Spring", "Summer", "Autumn", "Winter"]; + /** * Load server ID on chat message */ @@ -33,6 +37,10 @@ export function findZone() { return zoneLine === undefined ? "None" : zoneLine.getName().removeFormatting(); } +Scoreboard.getLines().forEach(line => { + print(line.getName()); +}); + /** * Identifies the current world the player is in based on the tab list. */ @@ -49,6 +57,11 @@ function findWorld() { // If the world is not found, try again after a delay delay(() => findWorld(), 1000); } else { + // Set season + Scoreboard.getLines().find(line => { + season = SEASONS.find(s => line.getName().includes(s)) ?? season; + }); + // Get world formatted world = world.removeFormatting(); world = world.substring(world.indexOf(': ') + 2); From 811764aad0bc492a9645b0ce7f225e25043f7de0 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 03:08:59 -0400 Subject: [PATCH 23/33] Added egg spawn alert --- features/event/HippityHoppity.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/features/event/HippityHoppity.js b/features/event/HippityHoppity.js index d13925e3..82ee41f2 100644 --- a/features/event/HippityHoppity.js +++ b/features/event/HippityHoppity.js @@ -1,5 +1,5 @@ import settings from "../../utils/settings"; -import { BOLD, DARK_GRAY, GOLD, STAND_CLASS, WHITE, YELLOW } from "../../utils/constants"; +import { BOLD, DARK_GRAY, GOLD, LIGHT_PURPLE, STAND_CLASS, WHITE, YELLOW } from "../../utils/constants"; import { getSlotCoords } from "../../utils/functions/find"; import { convertToTitleCase, formatNumber, formatTimeElapsed, getTime } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; @@ -71,6 +71,10 @@ registerWhen(register("step", () => { ${YELLOW}Dinner: ${WHITE + getTime(dinnerTime / 20)}`); }).setFps(2), () => settings.eggTimers && getSeason() === "Spring"); +registerWhen(register("chat", (type) => { + Client.showTitle(`${LIGHT_PURPLE + BOLD}EGG SPAWNED!`, `${GOLD}A ${type} Egg has spawned.`, 10, 50, 10); +}).setCriteria("HOPPITY'S HUNT A ${type} Egg has appeared!"), () => settings.eggTimers && getSeason() === "Spring"); + /** * Highlight best worker. From 5532a4082bdc7484c091b4abf750135175940cd0 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 03:14:41 -0400 Subject: [PATCH 24/33] Added color to egg announce --- features/event/HippityHoppity.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/event/HippityHoppity.js b/features/event/HippityHoppity.js index 82ee41f2..0563f599 100644 --- a/features/event/HippityHoppity.js +++ b/features/event/HippityHoppity.js @@ -73,7 +73,7 @@ registerWhen(register("step", () => { registerWhen(register("chat", (type) => { Client.showTitle(`${LIGHT_PURPLE + BOLD}EGG SPAWNED!`, `${GOLD}A ${type} Egg has spawned.`, 10, 50, 10); -}).setCriteria("HOPPITY'S HUNT A ${type} Egg has appeared!"), () => settings.eggTimers && getSeason() === "Spring"); +}).setCriteria("&r&d&lHOPPITY'S HUNT &r&dA &r${type} Egg &r&dhas appeared!&r"), () => settings.eggTimers && getSeason() === "Spring"); /** From 6e524ae1a99dd2f284ad50015ca91f246b71a790 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 11:56:49 -0400 Subject: [PATCH 25/33] reworked world into Location class --- utils/worlds.js | 186 ++++++++++++++++++++++++++++-------------------- 1 file changed, 107 insertions(+), 79 deletions(-) diff --git a/utils/worlds.js b/utils/worlds.js index 63867ccd..d12ed2de 100644 --- a/utils/worlds.js +++ b/utils/worlds.js @@ -2,98 +2,126 @@ import settings from "./settings"; import { setPlayer } from "../features/combat/HealthAlert"; import { delay } from "./thread"; import { setRegisters } from "./variables"; +import { AQUA, BOLD, DARK_AQUA, DARK_GRAY, LOGO, WHITE } from "./constants"; -/** - * Variables used to store world data. - */ -let world = undefined; -export function getWorld() { return world }; -let tier = 0; -export function getTier() { return tier }; -let server = undefined; -export function getServer() { return server }; -let noFind = 0; +class Location { + #world = undefined; + #tier = 0; + #server = undefined + #season = undefined; -let season = undefined; -export function getSeason() { return season }; -const SEASONS = ["Spring", "Summer", "Autumn", "Winter"]; + constructor() { + this.SEASONS = ["Spring", "Summer", "Autumn", "Winter"]; + + /** + * Set registers. + */ + register("chat", (id) => { + this.#server = id; + }).setCriteria("Sending to server ${id}..."); + + register("worldLoad", () => { + this.findWorld(); + }).setPriority(Priority.LOWEST); -/** - * Load server ID on chat message - */ -register("chat", (serv) => { - server = serv; -}).setCriteria("Sending to server ${serv}..."); + register("worldUnload", () => { + this.#world = undefined; + setRegisters(off = settings.skyblockToggle && !Scoreboard.getTitle().removeFormatting().includes("SKYBLOCK")); + }).setPriority(Priority.LOWEST); -/** - * Searches for the current zone based on the scoreboard lines. - * @returns {string} - The name of the current zone or "None" if not identified. - */ -export function findZone() { - let zoneLine = Scoreboard?.getLines()?.find((line) => line.getName().includes("⏣")); - // Rift has a different symbol - if (zoneLine === undefined) zoneLine = Scoreboard?.getLines()?.find((line) => line.getName().includes("ф")); - return zoneLine === undefined ? "None" : zoneLine.getName().removeFormatting(); -} + register("serverDisconnect", () => { + this.#world = undefined; + setRegisters(off = true); + }); + } -Scoreboard.getLines().forEach(line => { - print(line.getName()); -}); + /** + * + * @returns + */ + getWorld() { + return this.#world; + } -/** - * Identifies the current world the player is in based on the tab list. - */ -function findWorld() { - if (!World.isLoaded()) return; + /** + * + * @returns + */ + getTier() { + return this.#tier; + } - // Infinite loop prevention - if (noFind === 10) return; - noFind++; + /** + * + * @returns + */ + getServer() { + return this.#server; + } - // Get world from tab list - world = TabList.getNames().find(tab => tab.includes("Area:") || tab.includes("Dungeon:")); - if (world === undefined) { - // If the world is not found, try again after a delay - delay(() => findWorld(), 1000); - } else { - // Set season - Scoreboard.getLines().find(line => { - season = SEASONS.find(s => line.getName().includes(s)) ?? season; - }); + /** + * + * @returns + */ + getSeason() { + return this.#season; + } + + /** + * + * @returns + */ + findZone() { + let zoneLine = Scoreboard?.getLines()?.find((line) => line.getName().includes("⏣")); + if (zoneLine === undefined) zoneLine = Scoreboard?.getLines()?.find((line) => line.getName().includes("ф")); + return zoneLine === undefined ? "None" : zoneLine.getName().removeFormatting(); + } - // Get world formatted - world = world.removeFormatting(); - world = world.substring(world.indexOf(': ') + 2); + test() { + ChatLib.chat( +`${LOGO + DARK_AQUA + BOLD}World Test: + ${DARK_GRAY} - ${AQUA}World: ${WHITE + this.#world} + ${DARK_GRAY} - ${AQUA}Tier: ${WHITE + this.#tier} + ${DARK_GRAY} - ${AQUA}Server: ${WHITE + this.#server} + ${DARK_GRAY} - ${AQUA}Season: ${WHITE + this.#season}` + ); + } - // Get tier (for Kuudra and Dungeons) - if (world === "Kuudra") { + /** + * Private. + */ + findWorld = (noFind = 0) => { + // Make sure Hypixel world is loaded + if (!World.isLoaded() || noFind > 9) return; + + // Get world from tab list + let world = TabList.getNames()?.find(tab => tab.startsWith("§r§b§lArea:") || tab.startsWith("§r§b§lDungeon:")); + if (world === undefined) Client.scheduleTask(20, () => this.findWorld(noFind + 1)); + else { + // Set season + Scoreboard.getLines().find(line => { + this.#season = SEASONS.find(s => line.getName().includes(s)) ?? this.#season; + }); + + // Get world formatted + this.#world = world.removeFormatting().split(' ').splice(1).join(' '); + ChatLib.chat(this.#world) + + // Get tier for Kuudra + if (this.#world === "Kuudra") { + delay(() => { + const zone = this.findZone(); + this.#tier = parseInt(zone.charAt(zone.length - 2)); + }, 1000); + } + + // Call functions when world is loaded delay(() => { - const zone = findZone(); - tier = parseInt(zone.charAt(zone.length - 2)); + setRegisters(off = settings.skyblockToggle && !Scoreboard.getTitle().removeFormatting().includes("SKYBLOCK")); + setPlayer(); }, 1000); } - - // Register/unregister features for the current world - delay(() => { - setRegisters(off = settings.skyblockToggle && !Scoreboard.getTitle().removeFormatting().includes("SKYBLOCK")); - setPlayer(); - }, 1000); } } - -/** - * Set and reset world on world change. - */ -register("worldLoad", () => { - noFind = 0; - findWorld(); -}).setPriority(Priority.LOWEST); -register("worldUnload", () => { - world = undefined; - setRegisters(off = settings.skyblockToggle && !Scoreboard.getTitle().removeFormatting().includes("SKYBLOCK")); -}).setPriority(Priority.LOWEST); -register("serverDisconnect", () => { - world = undefined; - setRegisters(off = true); -}) +export default new Location; From d99f8e0ba4e172c0cee5c1cf8d94b61845d3022e Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 12:24:19 -0400 Subject: [PATCH 26/33] Updated features to use location class --- features/combat/EntityDetect.js | 8 +++---- features/combat/SlayerDetect.js | 4 ++-- features/crimsonIsle/GoldenFishTimer.js | 8 +++---- features/crimsonIsle/MythicDetect.js | 10 ++++---- features/crimsonIsle/TrophyCounter.js | 8 +++---- features/crimsonIsle/VanqFeatures.js | 32 ++++++++++++------------- features/dungeon/StarDetect.js | 10 ++++---- features/economy/CoinTracker.js | 4 ++-- features/event/BurrowDetect.js | 12 +++++----- features/event/HippityHoppity.js | 6 ++--- features/event/InquisitorDetect.js | 8 +++---- features/event/MythRitual.js | 10 ++++---- features/farming/ComposterCalc.js | 4 ++-- features/farming/FarmingWebhook.js | 19 ++++++++------- features/farming/GardenTab.js | 13 +++++----- features/farming/JacobHighlight.js | 9 +++---- features/farming/PestTracking.js | 28 +++++++++++----------- features/general/ArmorDisplay.js | 2 +- features/general/Autocorrect.js | 2 +- features/general/FairySouls.js | 10 ++++---- features/general/Performance.js | 4 ++-- features/general/ServerAlert.js | 4 ++-- features/general/SkillTracker.js | 6 ++--- features/kuudra/CrateEdit.js | 6 ++--- features/kuudra/KuudraAlerts.js | 26 ++++++++++---------- features/kuudra/KuudraCrates.js | 8 +++---- features/kuudra/KuudraDetect.js | 12 +++++----- features/kuudra/KuudraProfit.js | 8 +++---- features/kuudra/KuudraSplits.js | 20 ++++++++-------- features/kuudra/KuudraView.js | 2 +- features/mining/CommissionsDisplay.js | 8 +++---- features/mining/PowderChest.js | 6 ++--- features/mining/PowderTracker.js | 6 ++--- features/mining/ShaftAnnounce.js | 18 +++++++------- features/mining/WishingCompass.js | 12 +++++----- features/party/AutoTransfer.js | 4 ++-- features/rift/DDR.js | 10 ++++---- features/rift/RiftWaypoints.js | 18 +++++++------- features/rift/VampireSlayer.js | 10 ++++---- index.js | 8 +++---- utils/{worlds.js => location.js} | 3 +-- utils/overlay.js | 6 ++--- 42 files changed, 207 insertions(+), 205 deletions(-) rename utils/{worlds.js => location.js} (96%) diff --git a/features/combat/EntityDetect.js b/features/combat/EntityDetect.js index 0f24e9e6..2094ab15 100644 --- a/features/combat/EntityDetect.js +++ b/features/combat/EntityDetect.js @@ -1,10 +1,10 @@ +import location from "../../utils/location" import settings from "../../utils/settings"; import { AMOGUS, BOLD, GRAY, DARK_RED, GREEN, RED, WHITE, SMA, SPIDER_CLASS, EntityArmorStand } from "../../utils/constants"; import { convertToPascalCase, getTime, unformatNumber } from "../../utils/functions/format"; import { playSound } from "../../utils/functions/misc"; import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; -import { getServer, getWorld } from "../../utils/worlds"; import { Hitbox, renderEntities } from "../../utils/waypoints"; @@ -171,7 +171,7 @@ const broodmotherExample = `${GRAY + BOLD}Next Spawn: ${RED}???`; const broodmotherOverlay = new Overlay("broodmotherDetect", ["Spider's Den"], () => true, data.DL, "moveBrood", broodmotherExample); const broodLobbies = {}; registerWhen(register("step", () => { - const server = getServer(); + const server = location.getServer(); if (nextSpawn === 0) { nextSpawn = broodLobbies[server] ?? 0; const broodmother = World.getAllEntitiesOfType(SPIDER_CLASS) @@ -194,7 +194,7 @@ registerWhen(register("step", () => { * World timer of world leave. */ registerWhen(register("worldUnload", () => { - broodLobbies[getServer()] = nextSpawn; + broodLobbies[location.getServer()] = nextSpawn; nextSpawn = 0; broodmotherOverlay.setMessage(`${GRAY + BOLD}Next Spawn: ${RED}???`); -}), () => getWorld() === "Spider's Den" && settings.broodmotherDetect); +}), () => location.getWorld() === "Spider's Den" && settings.broodmotherDetect); diff --git a/features/combat/SlayerDetect.js b/features/combat/SlayerDetect.js index ccc0345d..c385e7f5 100644 --- a/features/combat/SlayerDetect.js +++ b/features/combat/SlayerDetect.js @@ -1,3 +1,4 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { BLAZE_CLASS, BOLD, DARK_GREEN, ENDERMAN_CLASS, GREEN, RED, SMA, SPIDER_CLASS, WHITE, WOLF_CLASS, ZOMBIE_CLASS } from "../../utils/constants"; import { romanToNum } from "../../utils/functions/format"; @@ -5,7 +6,6 @@ import { announceMob } from "../../utils/functions/misc"; import { delay } from "../../utils/thread"; import { registerWhen } from "../../utils/variables"; import { Hitbox, renderEntities } from "../../utils/waypoints"; -import { getWorld } from "../../utils/worlds"; /** @@ -57,7 +57,7 @@ registerWhen(register("tick", () => { if (settings.bossAlert === 3) Client.showTitle(`${RED + BOLD}SLAYER BOSS SPAWNED!`, "", 5, 25, 5); else if (settings.bossAlert !== 0) announceMob(settings.bossAlert, "Boss Slayer", Player.getX(), Player.getY(), Player.getZ()); }), () => settings.bossAlert !== 0 || settings.slayerSpawn !== 0 || -(getWorld() === "The Rift" && (settings.vampireAttack || settings.announceMania))); +(location.getWorld() === "The Rift" && (settings.vampireAttack || settings.announceMania))); /** * Close to spawn alert diff --git a/features/crimsonIsle/GoldenFishTimer.js b/features/crimsonIsle/GoldenFishTimer.js index f82f0489..94d33e92 100644 --- a/features/crimsonIsle/GoldenFishTimer.js +++ b/features/crimsonIsle/GoldenFishTimer.js @@ -1,9 +1,9 @@ +import location from "../../utils/location"; import settings from "../../utils/settings" import { BOLD, DARK_RED, GOLD, RESET, WHITE } from "../../utils/constants"; import { getTime } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -28,7 +28,7 @@ registerWhen(register("step", () => { fishOverlay.setMessage( `${GOLD + BOLD}Last Cast: ${lastCast > 240 ? DARK_RED : WHITE + getTime(lastCast)} ${GOLD + BOLD}Last Fish: ${RESET + getTime(lastCast > 270 ? 0 : lastFish)}`); -}).setFps(1), () => getWorld() === "Crimson Isle" && settings.goldenFishAlert); +}).setFps(1), () => location.getWorld() === "Crimson Isle" && settings.goldenFishAlert); /** * Resets "lastCast" variable whenever player right clicks with a fishing rod in hand. @@ -38,7 +38,7 @@ registerWhen(register("clicked", (x, y, button, state) => { if (Player.getHeldItem().getNBT().getCompoundTag("tag").getCompoundTag("ExtraAttributes").getString("id").includes("ROD")) lastCast = 0; -}), () => getWorld() === "Crimson Isle" && settings.goldenFishAlert); +}), () => location.getWorld() === "Crimson Isle" && settings.goldenFishAlert); /** * Resets "lastFish" variable whenever the Golden Fish message appears in chat. @@ -46,4 +46,4 @@ registerWhen(register("clicked", (x, y, button, state) => { registerWhen(register("chat", () => { lastFish = 0; }).setCriteria("You spot a Golden Fish surface from beneath the lava!"), -() => getWorld() === "Crimson Isle" && settings.goldenFishAlert); +() => location.getWorld() === "Crimson Isle" && settings.goldenFishAlert); diff --git a/features/crimsonIsle/MythicDetect.js b/features/crimsonIsle/MythicDetect.js index dda9150d..82aa3700 100644 --- a/features/crimsonIsle/MythicDetect.js +++ b/features/crimsonIsle/MythicDetect.js @@ -1,9 +1,9 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { BOLD, DARK_BLUE, DARK_RED, GOLEM_CLASS, GUARDIAN_CLASS, RED, WHITE } from "../../utils/constants"; import { announceMob } from "../../utils/functions/misc"; import { data, registerWhen } from "../../utils/variables"; import { Hitbox, renderEntities } from "../../utils/waypoints"; -import { getWorld } from "../../utils/worlds"; /** @@ -12,11 +12,11 @@ import { getWorld } from "../../utils/worlds"; registerWhen(register("chat", () => { announceMob(settings.mythicLavaAnnounce, "Lord Jawbus", Player.getX(), Player.getY(), Player.getZ()); }).setCriteria("You have angered a legendary creature... Lord Jawbus has arrived."), -() => getWorld() === "Crimson Isle" && settings.mythicLavaAnnounce !== 0); +() => location.getWorld() === "Crimson Isle" && settings.mythicLavaAnnounce !== 0); registerWhen(register("chat", () => { announceMob(settings.mythicLavaAnnounce, "Thunder", Player.getX(), Player.getY(), Player.getZ()); }).setCriteria("You hear a massive rumble as Thunder emerges."), -() => getWorld() === "Crimson Isle" && settings.mythicLavaAnnounce !== 0); +() => location.getWorld() === "Crimson Isle" && settings.mythicLavaAnnounce !== 0); /** * Detects if any mythic lava creatures are near the player. @@ -41,8 +41,8 @@ registerWhen(register("step", () => { if (!data.moblist.includes("thunder")) thunders = []; } -}).setFps(2), () => getWorld() === "Crimson Isle" && settings.mythicLavaDetect); -new Hitbox(() => getWorld() === "Crimson Isle" && settings.mythicLavaDetect, (pt) => { +}).setFps(2), () => location.getWorld() === "Crimson Isle" && settings.mythicLavaDetect); +new Hitbox(() => location.getWorld() === "Crimson Isle" && settings.mythicLavaDetect, (pt) => { renderEntities(jawbussy, 0.55, 0, 0, pt, "Jawbussy"); renderEntities(thunders, 0, 0, 0.55, pt, "T1 Zeus"); }); diff --git a/features/crimsonIsle/TrophyCounter.js b/features/crimsonIsle/TrophyCounter.js index d2707563..c587f6d7 100644 --- a/features/crimsonIsle/TrophyCounter.js +++ b/features/crimsonIsle/TrophyCounter.js @@ -1,9 +1,9 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { AQUA, BLUE, BOLD, DARK_AQUA, DARK_GRAY, DARK_PURPLE, GOLD, GRAY, GREEN, LOGO, WHITE } from "../../utils/constants"; import { convertToTitleCase } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; import { data, getPaused, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -121,11 +121,11 @@ function updateCounter(fish) { */ registerWhen(register("chat", (fish) => { updateCounter(fish); -}).setCriteria("TROPHY FISH! You caught a ${fish}."), () => getWorld() === "Crimson Isle" && settings.trophyCounter); +}).setCriteria("TROPHY FISH! You caught a ${fish}."), () => location.getWorld() === "Crimson Isle" && settings.trophyCounter); registerWhen(register("chat", (fish) => { updateCounter(fish); -}).setCriteria("NEW DISCOVERY: ${fish}"), () => getWorld() === "Crimson Isle" && settings.trophyCounter); +}).setCriteria("NEW DISCOVERY: ${fish}"), () => location.getWorld() === "Crimson Isle" && settings.trophyCounter); /** * Update time for session view @@ -134,4 +134,4 @@ registerWhen(register("step", () => { if (getPaused()) return; if (Object.keys(sessionTrophy).length !== 0) timePassed++; updateMessage(); -}).setFps(1), () => getWorld() === "Crimson Isle" && settings.trophyCounter); +}).setFps(1), () => location.getWorld() === "Crimson Isle" && settings.trophyCounter); diff --git a/features/crimsonIsle/VanqFeatures.js b/features/crimsonIsle/VanqFeatures.js index 2c305941..222f8e0d 100644 --- a/features/crimsonIsle/VanqFeatures.js +++ b/features/crimsonIsle/VanqFeatures.js @@ -1,3 +1,4 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { AMOGUS, BOLD, DARK_PURPLE, GREEN, LOGO, RED, RESET, WHITE, WITHER_CLASS } from "../../utils/constants"; import { announceMob, playSound } from "../../utils/functions/misc"; @@ -6,7 +7,6 @@ import { delay } from "../../utils/thread"; import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; import { Hitbox, renderEntities } from "../../utils/waypoints"; -import { findZone, getWorld } from "../../utils/worlds"; /** @@ -75,7 +75,7 @@ ${RED + BOLD}Total Kills: ${RESET + session.kills} ${RED + BOLD}Kills Since: ${RESET + session.last} ${RED + BOLD}Average Kills: ${RESET + session.average}`); }); -}), () => getWorld() === "Crimson Isle" && settings.vanqCounter !== 0); +}), () => location.getWorld() === "Crimson Isle" && settings.vanqCounter !== 0); /** * Tracks whenever the player spawns a Vanquisher and updates the counter. @@ -90,7 +90,7 @@ registerWhen(register("chat", () => { session.vanqs++; session.average = (session.kills / session.vanqs); session.last = 0; -}).setCriteria("A Vanquisher is spawning nearby!"), () => getWorld() === "Crimson Isle" && settings.vanqCounter !== 0); +}).setCriteria("A Vanquisher is spawning nearby!"), () => location.getWorld() === "Crimson Isle" && settings.vanqCounter !== 0); /** * Command to reset the stats for the overall counter. @@ -123,14 +123,14 @@ let vanquishers = []; */ registerWhen(register("chat", () => { announceMob(settings.vanqAlert, "Vanquisher", Player.getX(), Player.getY(), Player.getZ()); -}).setCriteria("A Vanquisher is spawning nearby!"), () => getWorld() === "Crimson Isle" && settings.vanqAlert !== 0); +}).setCriteria("A Vanquisher is spawning nearby!"), () => location.getWorld() === "Crimson Isle" && settings.vanqAlert !== 0); /** * Alerts player when another VA user posts coords. */ registerWhen(register("chat", () => { playSound(AMOGUS, 10000); -}).setCriteria("${player}: ${coords} | Vanquisher Spawned at [${location}]!"), () => getWorld() === "Crimson Isle" && settings.vanqSound); +}).setCriteria("${player}: ${coords} | Vanquisher Spawned at [${location}]!"), () => location.getWorld() === "Crimson Isle" && settings.vanqSound); /** * Tracks world for any vanquishers near player. @@ -149,8 +149,8 @@ registerWhen(register("step", () => { if (settings.vanqSound)playSound(AMOGUS, 10000); if (!data.moblist.includes("vanquisher")) vanquishers = []; } else vanqOverlay.setMessage(""); -}).setFps(2), () => getWorld() === "Crimson Isle" && settings.vanqDetect); -new Hitbox(() => getWorld() === "Crimson Isle" && settings.vanqDetect, (pt) => { +}).setFps(2), () => location.getWorld() === "Crimson Isle" && settings.vanqDetect); +new Hitbox(() => location.getWorld() === "Crimson Isle" && settings.vanqDetect, (pt) => { renderEntities(vanquishers, 0.5, 0, 0.5, pt, "Vanquisher"); }); register("worldUnload", () => vanquishers = []); @@ -169,7 +169,7 @@ let vanqMessage = ""; */ registerWhen(register("chat", () => { // Set message to copy and post - vanqMessage = `x: ${Math.round(Player.getX())}, y: ${Math.round(Player.getY())}, z: ${Math.round(Player.getZ())} | Vanquisher Spawned at [${findZone()} ]!`; + vanqMessage = `x: ${Math.round(Player.getX())}, y: ${Math.round(Player.getY())}, z: ${Math.round(Player.getZ())} | Vanquisher Spawned at [${location.findZone()} ]!`; ChatLib.command(`ct copy ${vanqMessage}`, true); ChatLib.chat(`${LOGO + GREEN}Copied vanquisher waypoint to clipboard!`); @@ -191,10 +191,10 @@ registerWhen(register("chat", () => { notInParty++; timeout += 500; }); -}).setCriteria("A Vanquisher is spawning nearby!"), () => getWorld() === "Crimson Isle" && settings.vanqParty !== ""); +}).setCriteria("A Vanquisher is spawning nearby!"), () => location.getWorld() === "Crimson Isle" && settings.vanqParty !== ""); registerWhen(register("chat", () => { vanqSpawned = false; -}).setCriteria("RARE DROP! Nether Star"), () => getWorld() === "Crimson Isle" && settings.vanqParty !== ""); +}).setCriteria("RARE DROP! Nether Star"), () => location.getWorld() === "Crimson Isle" && settings.vanqParty !== ""); /** * Tracks whenever a player joins/fails to join the party and warps party to lobby whenever all players have joined. @@ -213,10 +213,10 @@ function warpParty() { } registerWhen(register("chat", () => { delay(warpParty(), 500); -}).setCriteria("${player} joined the party."), () => getWorld() === "Crimson Isle" && settings.vanqParty !== ""); +}).setCriteria("${player} joined the party."), () => location.getWorld() === "Crimson Isle" && settings.vanqParty !== ""); registerWhen(register("chat", () => { delay(warpParty(), 500); -}).setCriteria("The party invite to ${player} has expired"), () => getWorld() === "Crimson Isle" && settings.vanqParty !== ""); +}).setCriteria("The party invite to ${player} has expired"), () => location.getWorld() === "Crimson Isle" && settings.vanqParty !== ""); /** * Fail safe for whenever a player goes offline or player inputs invalid username. @@ -232,10 +232,10 @@ function noInvite() { } registerWhen(register("chat", () => { delay(noInvite(), 500); -}).setCriteria("Couldn't find a player with that name!"), () => getWorld() === "Crimson Isle" && settings.vanqParty !== ""); +}).setCriteria("Couldn't find a player with that name!"), () => location.getWorld() === "Crimson Isle" && settings.vanqParty !== ""); registerWhen(register("chat", () => { delay(noInvite(), 500); -}).setCriteria("You cannot invite that player since they're not online."), () => getWorld() === "Crimson Isle" && settings.vanqParty !== ""); +}).setCriteria("You cannot invite that player since they're not online."), () => location.getWorld() === "Crimson Isle" && settings.vanqParty !== ""); /** * Fail safe in the event that two players spawn at same time or the Vanquisher you spawn dies before warp. @@ -243,9 +243,9 @@ registerWhen(register("chat", () => { registerWhen(register("chat", () => { vanqSpawned = false; notInParty = 0; -}).setCriteria("You have joined ${player} party!"), () => getWorld() === "Crimson Isle" && settings.vanqParty !== ""); +}).setCriteria("You have joined ${player} party!"), () => location.getWorld() === "Crimson Isle" && settings.vanqParty !== ""); registerWhen(register("chat", () => { vanqSpawned = false; notInParty = 0; -}).setCriteria("RARE DROP! Nether Star"), () => getWorld() === "Crimson Isle" && settings.vanqParty !== ""); +}).setCriteria("RARE DROP! Nether Star"), () => location.getWorld() === "Crimson Isle" && settings.vanqParty !== ""); diff --git a/features/dungeon/StarDetect.js b/features/dungeon/StarDetect.js index 649f3000..97be4b6e 100644 --- a/features/dungeon/StarDetect.js +++ b/features/dungeon/StarDetect.js @@ -1,9 +1,9 @@ import RenderLib from "../../../RenderLib"; -import { EntityArmorStand, EntityWither } from "../../utils/constants"; +import location from "../../utils/location"; import settings from "../../utils/settings"; +import { EntityArmorStand, EntityWither } from "../../utils/constants"; import { data, registerWhen } from "../../utils/variables"; import { Hitbox } from "../../utils/waypoints"; -import { getWorld } from "../../utils/worlds"; /** @@ -37,12 +37,12 @@ registerWhen(register("step", () => { if (closestEntity.entity)starMobs[closestEntity.entity.func_145782_y()] = closestEntity.entity; }); -}).setFps(2), () => getWorld() === "Catacombs" && settings.starDetect !== 0); +}).setFps(2), () => location.getWorld() === "Catacombs" && settings.starDetect !== 0); /** * Rendering for box and outline of star mobs. */ -new Hitbox(() => getWorld() === "Catacombs" && (settings.starDetect === 2 || settings.starDetect === 3), () => { +new Hitbox(() => location.getWorld() === "Catacombs" && (settings.starDetect === 2 || settings.starDetect === 3), () => { const c = settings.starColor; Object.keys(starMobs).forEach(key => { // Check dead @@ -69,4 +69,4 @@ registerWhen(register("renderEntity", (entity) => { if (!starMobs.hasOwnProperty(entity.getEntity().func_145782_y())) return; const c = settings.starColor; Tessellator.colorize(c.getRed()/255, c.getGreen()/255, c.getBlue()/255, 1); -}), () => getWorld() === "Catacombs" && settings.starDetect === 1); +}), () => location.getWorld() === "Catacombs" && settings.starDetect === 1); diff --git a/features/economy/CoinTracker.js b/features/economy/CoinTracker.js index ad476603..9d7a012f 100644 --- a/features/economy/CoinTracker.js +++ b/features/economy/CoinTracker.js @@ -1,9 +1,9 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { BOLD, GOLD, GREEN, LOGO, RED, WHITE } from "../../utils/constants"; import { commafy, getTime } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; import { Stat, data, getPaused, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -18,7 +18,7 @@ const coinExample = `${GOLD + BOLD}Gained: ${WHITE}COUNTING ${GOLD + BOLD}Time Passed: ${WHITE}ME ${GOLD + BOLD}Rate: ${WHITE}MONEY`; -const coinOverlay = new Overlay("coinTracker", ["all"], () => getWorld() !== undefined, data.ML, "moveCoins", coinExample); +const coinOverlay = new Overlay("coinTracker", ["all"], () => location.getWorld() !== undefined, data.ML, "moveCoins", coinExample); /** * Tracks Piggybank in Scoreboard for changes in coins and updates Coins Overlay every second. diff --git a/features/event/BurrowDetect.js b/features/event/BurrowDetect.js index 9a8ec0bf..3b7b093c 100644 --- a/features/event/BurrowDetect.js +++ b/features/event/BurrowDetect.js @@ -1,11 +1,11 @@ +import location from "../../utils/location"; +import settings from "../../utils/settings"; import { AMOGUS, GRAY, LOGO, WHITE } from "../../utils/constants"; import { getClosest } from "../../utils/functions/find"; import { getPerks } from "../../utils/mayor"; import { playSound } from "../../utils/functions/misc"; -import settings from "../../utils/settings"; import { delay } from "../../utils/thread"; import { registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -24,7 +24,7 @@ registerWhen(register("clicked", (_, __, button, isButtonDown) => { echo = true; delay(() => echo = false, 3000); -}), () => getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.burrowDetect !== 0); +}), () => location.getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.burrowDetect !== 0); /** * Detect for mytholigical burrows @@ -63,7 +63,7 @@ registerWhen(register("spawnParticle", (particle, type) => { if (closest[1] < 3) burrows[burrows.indexOf(closest[0])][0] = `§cMob`; break; } -}), () => getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.burrowDetect !== 0); +}), () => location.getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.burrowDetect !== 0); /** * Events to remove burrows from list @@ -72,7 +72,7 @@ registerWhen(register("chat", () => { const closest = getClosest(["Player", Player.getX(), Player.getY(), Player.getZ()], burrows); if (closest !== undefined) Client.scheduleTask(2, () => burrows.splice(burrows.indexOf(closest[0]), 1)); }).setCriteria("You ${completed} Griffin ${burrow}! (${x}/4)"), -() => getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.burrowDetect !== 0); +() => location.getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.burrowDetect !== 0); register("worldUnload", () => { burrows.length = 0; @@ -81,4 +81,4 @@ register("worldUnload", () => { registerWhen(register("chat", () => { burrows.length = 0; }).setCriteria(" ☠ You ${died}."), -() => getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.burrowDetect !== 0); +() => location.getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.burrowDetect !== 0); diff --git a/features/event/HippityHoppity.js b/features/event/HippityHoppity.js index 0563f599..3564fed7 100644 --- a/features/event/HippityHoppity.js +++ b/features/event/HippityHoppity.js @@ -1,3 +1,4 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { BOLD, DARK_GRAY, GOLD, LIGHT_PURPLE, STAND_CLASS, WHITE, YELLOW } from "../../utils/constants"; import { getSlotCoords } from "../../utils/functions/find"; @@ -5,7 +6,6 @@ import { convertToTitleCase, formatNumber, formatTimeElapsed, getTime } from ".. import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; import { announceMob } from "../../utils/functions/misc"; -import { getSeason } from "../../utils/worlds"; /** @@ -69,11 +69,11 @@ registerWhen(register("step", () => { ${YELLOW}Breakfast: ${WHITE + getTime(breakfastTime / 20)} ${YELLOW}Lunch: ${WHITE + getTime(lunchTime / 20)} ${YELLOW}Dinner: ${WHITE + getTime(dinnerTime / 20)}`); -}).setFps(2), () => settings.eggTimers && getSeason() === "Spring"); +}).setFps(2), () => settings.eggTimers && location.getSeason() === "Spring"); registerWhen(register("chat", (type) => { Client.showTitle(`${LIGHT_PURPLE + BOLD}EGG SPAWNED!`, `${GOLD}A ${type} Egg has spawned.`, 10, 50, 10); -}).setCriteria("&r&d&lHOPPITY'S HUNT &r&dA &r${type} Egg &r&dhas appeared!&r"), () => settings.eggTimers && getSeason() === "Spring"); +}).setCriteria("&r&d&lHOPPITY'S HUNT &r&dA &r${type} Egg &r&dhas appeared!&r"), () => settings.eggTimers && location.getSeason() === "Spring"); /** diff --git a/features/event/InquisitorDetect.js b/features/event/InquisitorDetect.js index 643f77db..4cf4fc8e 100644 --- a/features/event/InquisitorDetect.js +++ b/features/event/InquisitorDetect.js @@ -1,10 +1,10 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { BOLD, GOLD, WHITE, RESET, RED, PLAYER_CLASS } from "../../utils/constants"; import { getPerks } from "../../utils/mayor"; import { announceMob } from "../../utils/functions/misc"; import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; import { Hitbox, renderEntities } from "../../utils/waypoints"; @@ -82,7 +82,7 @@ registerWhen(register("chat", (wow, mob) => { announceMob(settings.inqAlert, "Minos Inquisitor", Player.getX(), Player.getY(), Player.getZ()); if (settings.inqCounter !== 0) updateInqCounter(true); } else if (settings.inqCounter !== 0) updateInqCounter(false); -}).setCriteria("${wow}! You dug out a ${mob}!"), () => getWorld() === "Hub" && getPerks().has("Mythological Ritual")); +}).setCriteria("${wow}! You dug out a ${mob}!"), () => location.getWorld() === "Hub" && getPerks().has("Mythological Ritual")); /** * Tracks world for any inquisitors near player. @@ -99,8 +99,8 @@ registerWhen(register("step", () => { if (!data.moblist.includes("inquisitor")) inquisitors = []; } -}).setFps(2), () => getWorld() === "Hub" && settings.detectInq && getPerks().has("Mythological Ritual")); -new Hitbox(() => getWorld() === "Hub" && settings.detectInq && getPerks().has("Mythological Ritual"), (pt) => { +}).setFps(2), () => location.getWorld() === "Hub" && settings.detectInq && getPerks().has("Mythological Ritual")); +new Hitbox(() => location.getWorld() === "Hub" && settings.detectInq && getPerks().has("Mythological Ritual"), (pt) => { renderEntities(inquisitors, 1, 0.84, 0, pt, "Inspector Gadget"); }); register("worldUnload", () => inquisitors = []); diff --git a/features/event/MythRitual.js b/features/event/MythRitual.js index 860a8839..bfb8e0cf 100644 --- a/features/event/MythRitual.js +++ b/features/event/MythRitual.js @@ -1,10 +1,10 @@ +import settings from "../../utils/settings"; +import location from "../../utils/location"; import { GREEN, LOGO } from "../../utils/constants"; import { getClosest } from "../../utils/functions/find"; import { getPerks } from "../../utils/mayor"; -import settings from "../../utils/settings"; import { delay } from "../../utils/thread"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -101,7 +101,7 @@ registerWhen(register("clicked", (_, __, button, isButtonDown) => { echo = true; delay(() => echo = false, 3000); path = [[Player.getX(), Player.getY(), Player.getZ()]]; -}), () => getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.dianaWaypoint); +}), () => location.getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.dianaWaypoint); let guess = []; export function getGuess() { return guess }; @@ -121,14 +121,14 @@ registerWhen(register("spawnParticle", (particle, type) => { // Push to particles list and make a guess path.push([x, y, z]); guess = [guessBurrow(path, distance)]; -}), () => getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.dianaWaypoint); +}), () => location.getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.dianaWaypoint); /** * Get distance using Echo note pitch. */ registerWhen(register("soundPlay", (_, __, ___, pitch) => { distance = (Math.E / pitch) ** (Math.E + (1 - 2 * pitch)) - Math.E ** (1 - pitch ** 2) + Math.E ** (0.8 - Math.E * pitch); -}).setCriteria("note.harp"), () => getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.dianaWaypoint); +}).setCriteria("note.harp"), () => location.getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.dianaWaypoint); /** * Remove guess on world unload. diff --git a/features/farming/ComposterCalc.js b/features/farming/ComposterCalc.js index da63e660..3df0588d 100644 --- a/features/farming/ComposterCalc.js +++ b/features/farming/ComposterCalc.js @@ -1,7 +1,7 @@ +import location from "../../utils/location"; import { AQUA, BOLD, DARK_GRAY, DARK_GREEN, GREEN, LOGO, RED, WHITE } from "../../utils/constants"; import { commafy, romanToNum } from "../../utils/functions/format"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; import { getBazaar } from "../economy/Economy"; @@ -23,7 +23,7 @@ registerWhen(register("guiOpened", () => { data.composterUpgrades["Multi Drop"] = romanToNum(items[container.indexOf(293)].getName().removeFormatting().split(" ").pop()); data.composterUpgrades["Cost Reduction"] = romanToNum(items[container.indexOf(266)].getName().removeFormatting().split(" ").pop()); }); -}), () => getWorld() === "Garden"); +}), () => location.getWorld() === "Garden"); /** * Calculates composting profit and cost considering composter upgrades and bazaar prices. diff --git a/features/farming/FarmingWebhook.js b/features/farming/FarmingWebhook.js index f5ab900f..591be2a3 100644 --- a/features/farming/FarmingWebhook.js +++ b/features/farming/FarmingWebhook.js @@ -1,8 +1,9 @@ import request from "../../../requestV2"; import settings from "../../utils/settings"; +import location from "../../utils/location"; +import settings from "../../utils/settings"; import { formatNumber, getTime, unformatNumber } from "../../utils/functions/format"; import { registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; import { getBazaar } from "../economy/Economy"; import { getWaifu } from "../party/PartyCommands"; @@ -182,7 +183,7 @@ registerWhen(register("step", () => { const fortune = tablist.find(line => line.includes("Farming Fortune")); if (fortune === undefined) return; farmingFortune = parseInt(fortune.substring(fortune.indexOf('☘') + 1)); -}).setDelay(10), () => getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); +}).setDelay(10), () => location.getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); /** * Updates crop statistics for a harvested crop block. @@ -200,7 +201,7 @@ registerWhen(register("blockBreak", (block) => { farmingStats.cropStats[blockName][0] += dropAmount; farmingStats.cropStats[blockName][1] += dropAmount * CROP_DROP[blockName][1]; downtime = 0; -}), () => getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); +}), () => location.getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); /** * Updates farm visitor statistics based on their arrival. @@ -222,7 +223,7 @@ registerWhen(register("chat", (visitor) => { break; } }).setCriteria("&r&a&r${visitor} &r&ehas arrived on your &r&bGarden&r&e!&r"), -() => getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); +() => location.getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); /** * Handles mouse click interactions in a GUI related to trade offers. @@ -268,21 +269,21 @@ registerWhen(register("guiMouseClick", (x, y, button, gui) => { } } farmingStats.visitorStats.accepted++; -}), () => getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); +}), () => location.getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); /** * Function handling for player statistics. */ registerWhen(register("worldUnload", () => { farmingStats.playerStats.disconnects++; -}), () => getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); +}), () => location.getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); registerWhen(register("chat", () => { farmingStats.playerStats.deaths++; -}).setCriteria(" ☠ You ${death}."), () => getWorld() === "Garden" && settings.gardenWebhook && settings.webhookTimer !== 0); +}).setCriteria(" ☠ You ${death}."), () => location.getWorld() === "Garden" && settings.gardenWebhook && settings.webhookTimer !== 0); registerWhen(register("chat", (medal, crop) => { farmingStats.playerStats[medal]++; }).setCriteria("[NPC] Jacob: You earned a ${medal} medal in the ${crop} contest!"), -() => getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); +() => location.getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); /** * Manages time-based events and player downtime tracking. @@ -298,4 +299,4 @@ registerWhen(register("step", () => { downtime++; if (downtime >= 10) farmingStats.playerStats.downtime++; -}).setDelay(1), () => getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); +}).setDelay(1), () => location.getWorld() === "Garden" && settings.gardenWebhook !== "" && settings.webhookTimer !== 0); diff --git a/features/farming/GardenTab.js b/features/farming/GardenTab.js index 8009d829..eaed9544 100644 --- a/features/farming/GardenTab.js +++ b/features/farming/GardenTab.js @@ -1,9 +1,10 @@ import settings from "../../utils/settings"; +import location from "../../utils/location"; +import settings from "../../utils/settings"; import { AQUA, BOLD, DARK_GREEN, DARK_RED, GREEN, RED, WHITE } from "../../utils/constants"; import { Overlay } from "../../utils/overlay"; import { getTime } from "../../utils/functions/format"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -58,7 +59,7 @@ registerWhen(register("step", () => { else gardenMessage += ` Next Visitor: ${RED + BOLD}Queue Full!`; gardenOverlay.setMessage(gardenMessage); -}).setFps(1), () => getWorld() === "Garden" && settings.gardenTab); +}).setFps(1), () => location.getWorld() === "Garden" && settings.gardenTab); /** @@ -67,7 +68,7 @@ registerWhen(register("step", () => { registerWhen(register("step", () => { // Decrement visitor timer nextVisitor--; - if (getWorld() === "Garden") return; + if (location.getWorld() === "Garden") return; // Update visitor display outside Garden if (nextVisitor <= 0 && visitorCount < 5) { @@ -125,10 +126,10 @@ function updateCompost() { } registerWhen(register("guiOpened", () => { Client.scheduleTask(1, updateCompost); -}), () => getWorld() === "Garden" && settings.compostTab === 2); +}), () => location.getWorld() === "Garden" && settings.compostTab === 2); registerWhen(register("guiMouseClick", () => { Client.scheduleTask(1, updateCompost); -}), () => getWorld() === "Garden" && settings.compostTab === 2); +}), () => location.getWorld() === "Garden" && settings.compostTab === 2); /** * Update compost overlay. @@ -167,4 +168,4 @@ registerWhen(register("step", () => { `${DARK_GREEN + BOLD}Composter: ${GREEN}Empty: ${message} ${GREEN}Next: ${WHITE + nextCompost}`); -}).setFps(1), () => getWorld() === "Garden" && settings.gardenTab !== 0); +}).setFps(1), () => location.getWorld() === "Garden" && settings.gardenTab !== 0); diff --git a/features/farming/JacobHighlight.js b/features/farming/JacobHighlight.js index 7f9a6ac9..46547b2a 100644 --- a/features/farming/JacobHighlight.js +++ b/features/farming/JacobHighlight.js @@ -1,7 +1,8 @@ import settings from "../../utils/settings"; +import location from "../../utils/location"; +import settings from "../../utils/settings"; import { getSlotCoords } from "../../utils/functions/find"; import { registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -33,10 +34,10 @@ registerWhen(register("guiOpened", () => { } } }) -}), () => getWorld() === "Garden" && settings.jacobReward); +}), () => location.getWorld() === "Garden" && settings.jacobReward); registerWhen(register("guiClosed", () => { unclaimed = []; -}), () => getWorld() === "Garden" && settings.jacobReward); +}), () => location.getWorld() === "Garden" && settings.jacobReward); /** * Renders neon green box over unclaimed rewards. @@ -52,4 +53,4 @@ registerWhen(register("guiRender", () => { Renderer.translate(0, 0, 100); Renderer.drawRect(Renderer.color(...color, 255), x, y, 16, 16); }); -}), () => getWorld() === "Garden" && settings.jacobReward); +}), () => location.getWorld() === "Garden" && settings.jacobReward); diff --git a/features/farming/PestTracking.js b/features/farming/PestTracking.js index ed2401b6..89c1cdb7 100644 --- a/features/farming/PestTracking.js +++ b/features/farming/PestTracking.js @@ -1,11 +1,11 @@ +import RenderLib from "../../../RenderLib"; +import location from "../../utils/location"; import settings from "../../utils/settings"; -import { AQUA, BOLD, DARK_GRAY, DARK_GREEN, DARK_RED, GOLD, GRAY, GREEN, LOGO, RED, RESET, YELLOW } from "../../utils/constants"; +import { AQUA, BOLD, DARK_GRAY, DARK_GREEN, DARK_RED, GOLD, GRAY, GREEN, RED, RESET, YELLOW } from "../../utils/constants"; import { getSlotCoords } from "../../utils/functions/find"; import { getTime } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; -import { findZone, getWorld } from "../../utils/worlds"; -import RenderLib from "../../../RenderLib"; /** @@ -44,7 +44,7 @@ registerWhen(register("step", () => { const plotLine = Scoreboard.getLines().find(line => line.getName().startsWith(" §aPlot")); plotZone = plotLine?.getName()?.removeFormatting()?.trim()?.split(' ')?.[2]?.replace(/[^0-9]/g, '') ?? "0"; setHive(); -}).setFps(2), () => getWorld() === "Garden" && settings.gardenBox); +}).setFps(2), () => location.getWorld() === "Garden" && settings.gardenBox); /** @@ -52,7 +52,7 @@ registerWhen(register("step", () => { */ registerWhen(register("chat", (plot) => { sprays[plot] = 1800; -}).setCriteria("SPRAYONATOR! You sprayed Plot - ${plot} with ${material}!"), () => getWorld() === "Garden"); +}).setCriteria("SPRAYONATOR! You sprayed Plot - ${plot} with ${material}!"), () => location.getWorld() === "Garden"); /** * Decrement spray timers every second @@ -153,14 +153,14 @@ registerWhen(register("guiOpened", () => { setPlots.register(); setHighlight.register(); }) -}), () => getWorld() === "Garden" && (settings.pestHighlight || settings.sprayDisplay)); +}), () => location.getWorld() === "Garden" && (settings.pestHighlight || settings.sprayDisplay)); registerWhen(register("guiClosed", () => { setPlots.unregister(); setHighlight.unregister(); pests.clear(); plots.clear(); setHive(); -}), () => getWorld() === "Garden" && (settings.pestHighlight || settings.sprayDisplay)); +}), () => location.getWorld() === "Garden" && (settings.pestHighlight || settings.sprayDisplay)); /** @@ -169,7 +169,7 @@ registerWhen(register("guiClosed", () => { let lastPlot = undefined; register("command", () => { setHive(); - if (hive.length === 0 || !findZone().includes("ൠ")) { + if (hive.length === 0 || !location.findZone().includes("ൠ")) { Client.showTitle(`${DARK_RED}Pests Controlled!`, "No plots have any pests!", 10, 50, 10); return; } @@ -195,12 +195,12 @@ registerWhen(register("chat", (_, plot) => { Client.showTitle(`${GREEN}Plot ${GRAY}- ${AQUA + plot}`, `${GOLD}1 ${RED}Pest ${GRAY}has spawned...`, 10, 50, 10); swarm[plot] = (swarm[plot] ?? 0) + 1; setHive(); -}).setCriteria("${ew}! A Pest has appeared in Plot - ${plot}!"), () => getWorld() === "Garden" && settings.pestAlert); +}).setCriteria("${ew}! A Pest has appeared in Plot - ${plot}!"), () => location.getWorld() === "Garden" && settings.pestAlert); registerWhen(register("chat", (_, num, plot) => { Client.showTitle(`${GREEN}Plot ${GRAY}- ${AQUA + plot}`, `${GOLD + num} ${RED}Pests ${GRAY}have spawned...`, 10, 50, 10); swarm[plot] = (swarm[plot] ?? 0) + num; setHive(); -}).setCriteria("${ew}! ${num} Pests have spawned in Plot - ${plot}!"), () => getWorld() === "Garden" && settings.pestAlert); +}).setCriteria("${ew}! ${num} Pests have spawned in Plot - ${plot}!"), () => location.getWorld() === "Garden" && settings.pestAlert); /** @@ -210,7 +210,7 @@ registerWhen(register("step", () => { const count = parseInt(TabList.getNames().find(name => name.startsWith("§r Alive:"))?.split(' ')?.[2]?.removeFormatting() ?? 0); if (count < settings.infestationAlert) return; Client.showTitle(`${DARK_GREEN + BOLD}SPREADING PLAGUE`, `${count} minions with ${BOLD}Taunt ${RESET}are in the way!`, 0, 25, 5); -}).setFps(1).unregister(), () => settings.infestationAlert !== 0 && getWorld() === "Garden"); +}).setFps(1).unregister(), () => settings.infestationAlert !== 0 && location.getWorld() === "Garden"); /** @@ -226,7 +226,7 @@ registerWhen(register("chat", (_, fortune) => { remain = 1800; addPests(fortune); }).setCriteria("[NPC] Phillip: In exchange for ${pests} Pests, I've given you +${fortune}☘ Farming Fortune for 30m!"), -() => getWorld() === "Garden" && settings.pesthunterBonus); +() => location.getWorld() === "Garden" && settings.pesthunterBonus); /** * Track bonus timer @@ -250,7 +250,7 @@ registerWhen(register("step", () => { } bonusOverlay.setMessage(bonusMessage); -}).setFps(1), () => getWorld() === "Garden" && settings.pesthunterBonus); +}).setFps(1), () => location.getWorld() === "Garden" && settings.pesthunterBonus); /** @@ -263,4 +263,4 @@ registerWhen(register("renderWorld", () => { const z = Math.floor((Player.getZ() + 240) / 96); RenderLib.drawEspBox(-192 + x * 96, 67, -192 + z * 96, 96, 10, ...color, 1, true); -}), () => getWorld() === "Garden" && settings.gardenBox); +}), () => location.getWorld() === "Garden" && settings.gardenBox); diff --git a/features/general/ArmorDisplay.js b/features/general/ArmorDisplay.js index 1e764455..4163ee3e 100644 --- a/features/general/ArmorDisplay.js +++ b/features/general/ArmorDisplay.js @@ -1,5 +1,5 @@ -import { Overlay } from "../../utils/overlay"; import settings from "../../utils/settings"; +import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; diff --git a/features/general/Autocorrect.js b/features/general/Autocorrect.js index d8fc80e8..e2b20cf1 100644 --- a/features/general/Autocorrect.js +++ b/features/general/Autocorrect.js @@ -1,5 +1,5 @@ -import { GREEN, LOGO, RED } from "../../utils/constants"; import settings from "../../utils/settings"; +import { GREEN, LOGO, RED } from "../../utils/constants"; import { delay } from "../../utils/thread"; import { data, registerWhen } from "../../utils/variables"; diff --git a/features/general/FairySouls.js b/features/general/FairySouls.js index be4b3346..d2ce1a7b 100644 --- a/features/general/FairySouls.js +++ b/features/general/FairySouls.js @@ -1,13 +1,13 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { getClosest } from "../../utils/functions/find"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** * Variables used to represent soul waypoints. */ -let fairyClose = data.fairySouls[getWorld()] ?? []; +let fairyClose = data.fairySouls[location.getWorld()] ?? []; export function getFairy() { return settings.fairyWaypoint ? fairyClose : [] }; /** @@ -15,7 +15,7 @@ export function getFairy() { return settings.fairyWaypoint ? fairyClose : [] }; */ registerWhen(register("chat", () => { // Delete closest soul - const souls = data.fairySouls[getWorld()]; + const souls = data.fairySouls[location.getWorld()]; const closest = getClosest([Player.getX(), Player.getY(), Player.getZ()], souls); if (closest !== undefined && closest[1] < 10) souls.splice(souls.indexOf(closest[0]), 1); }).setCriteria("SOUL! You found a Fairy Soul!"), () => settings.fairyWaypoint !== 0); @@ -24,7 +24,7 @@ registerWhen(register("chat", () => { * Fail safe fairy soul remove in case player clicks on an unregistered soul. */ registerWhen(register("chat", () => { - const souls = data.fairySouls[getWorld()]; + const souls = data.fairySouls[location.getWorld()]; if (souls.length === 0) return; // Delete duplicate soul @@ -37,5 +37,5 @@ registerWhen(register("chat", () => { */ registerWhen(register("step", () => { // Filters to closest souls - fairyClose = data.fairySouls[getWorld()]?.filter((fairy) => Math.hypot(Player.getX() - fairy[0], Player.getZ() - fairy[2]) < settings.fairyWaypoint) ?? []; + fairyClose = data.fairySouls[location.getWorld()]?.filter((fairy) => Math.hypot(Player.getX() - fairy[0], Player.getZ() - fairy[2]) < settings.fairyWaypoint) ?? []; }).setFps(1), () => settings.fairyWaypoint !== 0); diff --git a/features/general/Performance.js b/features/general/Performance.js index 0899bef4..890f6b76 100644 --- a/features/general/Performance.js +++ b/features/general/Performance.js @@ -1,10 +1,10 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import toggles from "../../utils/toggles"; import { AQUA, BOLD, DARK_AQUA, DARK_GREEN, DARK_RED, GOLD, GREEN, LOGO, RED, WHITE, YELLOW } from "../../utils/constants"; import { Overlay } from "../../utils/overlay"; import { isPlayer } from "../../utils/functions/player"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -279,7 +279,7 @@ registerWhen(register("renderEntity", (entity, _, __, event) => { cancel(event); }).setPriority(Priority.LOWEST), () => { if (settings.hideFarEntity === 0 && settings.hideCloseEntity === 0) return false; - const world = getWorld()?.toLowerCase() ?? ""; + const world = location.getWorld()?.toLowerCase() ?? ""; const worlds = settings.hideWorlds.toLowerCase().split(", "); return worlds[0] === "" || worlds.includes(world); }); diff --git a/features/general/ServerAlert.js b/features/general/ServerAlert.js index cc18fc19..f9355fa5 100644 --- a/features/general/ServerAlert.js +++ b/features/general/ServerAlert.js @@ -1,8 +1,8 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { BOLD, DARK_RED, WHITE } from "../../utils/constants"; import { getTime } from "../../utils/functions/format"; import { registerWhen } from "../../utils/variables"; -import { getServer } from "../../utils/worlds"; /** @@ -26,7 +26,7 @@ registerWhen(register("chat", (server, event) => { * Clears server entry after X minutes when leaving it. */ registerWhen(register("worldUnload", () => { - const server = getServer(); + const server = location.getServer(); if (server === undefined) return; servers[server] = Date.now(); }), () => settings.serverAlert); diff --git a/features/general/SkillTracker.js b/features/general/SkillTracker.js index 5e63c9f8..da6b4c25 100644 --- a/features/general/SkillTracker.js +++ b/features/general/SkillTracker.js @@ -1,9 +1,9 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; -import { BOLD, DARK_AQUA, GREEN, LOGO, RED, WHITE } from "../../utils/constants"; +import { BOLD, DARK_AQUA, GREEN, RED, WHITE } from "../../utils/constants"; import { commafy, getTime, romanToNum, unformatNumber } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; import { Stat, data, getPaused, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -31,7 +31,7 @@ ${DARK_AQUA + BOLD}XP Gained: ${WHITE}0 ${DARK_AQUA + BOLD}Time Passed: ${RED}Inactive ${DARK_AQUA + BOLD}Rate: ${WHITE}0 xp/hr ${DARK_AQUA + BOLD}Level Up: ${GREEN}MAXED`; -const skillOverlay = new Overlay("skillTracker", ["all"], () => getWorld() !== undefined, data.AL, "moveSkills", skillExample); +const skillOverlay = new Overlay("skillTracker", ["all"], () => location.getWorld() !== undefined, data.AL, "moveSkills", skillExample); const xpTable = [0, 50, 175, 375, 675, 1175, 1925, 2925, 4425, 6425, 9925, 14925, 22425, 32425, 47425, 67425, 97425, 147425, 222425, 322425, 522425, 822425, 1222425, 1722425, 2322425, 3022425, 3822425, 4722425, 5722425, 6822425, 8022425, 9322425, 10722425, 12222425, 13822425, 15522425, 17322425, 19222425, 21222425, 23322425, diff --git a/features/kuudra/CrateEdit.js b/features/kuudra/CrateEdit.js index e26e2484..114db4fd 100644 --- a/features/kuudra/CrateEdit.js +++ b/features/kuudra/CrateEdit.js @@ -1,14 +1,14 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** * Crate overlay variables. */ const crateExample = "§8[§a|||||||||||||§f|||||||§8] §b69%§r"; -const crateOverlay = new Overlay("crateEdit", ["all"], () => getWorld() === "Kuudra", data.CEL, "moveCrate", crateExample); +const crateOverlay = new Overlay("crateEdit", ["all"], () => location.getWorld() === "Kuudra", data.CEL, "moveCrate", crateExample); crateOverlay.setMessage(""); /** @@ -19,7 +19,7 @@ registerWhen(register("renderTitle", (title, _, event) => { crateOverlay.setMessage(title); cancel(event); -}), () => settings.crateEdit && getWorld() === "Kuudra"); +}), () => settings.crateEdit && location.getWorld() === "Kuudra"); /** * Reset on crate pickup/cancel diff --git a/features/kuudra/KuudraAlerts.js b/features/kuudra/KuudraAlerts.js index 2657dfcf..cff40710 100644 --- a/features/kuudra/KuudraAlerts.js +++ b/features/kuudra/KuudraAlerts.js @@ -1,9 +1,9 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import toggles from "../../utils/toggles"; import {AQUA, BOLD, DARK_PURPLE, DARK_RED, GHAST_CLASS, GRAY, GREEN, MUSIC, RED, WHITE} from "../../utils/constants"; import { playSound } from "../../utils/functions/misc"; import { registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -12,7 +12,7 @@ import { getWorld } from "../../utils/worlds"; registerWhen(register("chat", () => { Client.showTitle(`${BOLD}NO KUUDRA KEY!`, "", 10, 50, 10); }).setCriteria("WARNING: You do not have a key for this tier in your inventory, you will not be able to claim rewards."), -() => getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.keyAlert); +() => location.getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.keyAlert); /** * Unready alert. @@ -21,7 +21,7 @@ registerWhen(register("chat", (player) => { const name = player.removeFormatting().toUpperCase(); playSound(MUSIC, 1000); Client.showTitle(`${DARK_RED + BOLD + name} ${WHITE}IS NO LONGER READY!`, "", 10, 50, 10); -}).setCriteria("${player} is no longer ready!"), () => getWorld() === "Kuudra" && toggles.kuudraAlerts && toggles.unreadyAlert); +}).setCriteria("${player} is no longer ready!"), () => location.getWorld() === "Kuudra" && toggles.kuudraAlerts && toggles.unreadyAlert); /** * Choose perk alert. @@ -30,7 +30,7 @@ registerWhen(register("chat", () => { playSound(MUSIC, 1000); Client.showTitle(`${AQUA + BOLD}BUY UPGRADE ROUTE!`, "", 10, 100, 10); }).setCriteria("[NPC] Elle: Okay adventurers, I will go and fish up Kuudra!"), -() => getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.routeAlert); +() => location.getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.routeAlert); /** * Supply spawned alert. @@ -38,7 +38,7 @@ registerWhen(register("chat", () => { registerWhen(register("chat", () => { playSound(MUSIC, 1000); Client.showTitle(`${AQUA + BOLD}PICKUP SUPPLY!`, "", 10, 100, 10); -}).setCriteria("[NPC] Elle: Not again!"), () => getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.supplyAlert); +}).setCriteria("[NPC] Elle: Not again!"), () => location.getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.supplyAlert); /** * Building started alert. @@ -47,7 +47,7 @@ registerWhen(register("chat", () => { playSound(MUSIC, 1000); Client.showTitle(`${AQUA + BOLD}START BUILDING!`, "", 10, 50, 10); }).setCriteria("[NPC] Elle: It's time to build the Ballista again! Cover me!"), -() => getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.buildingAlert); +() => location.getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.buildingAlert); /** * Fresh tools alert. @@ -56,7 +56,7 @@ registerWhen(register("chat", () => { playSound(MUSIC, 1000); Client.showTitle(`${GREEN + BOLD}EAT FRESH!`, "", 10, 50, 10); }).setCriteria("Your Fresh Tools Perk bonus doubles your building speed for the next ${time} seconds!"), -() => getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.freshAlert); +() => location.getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.freshAlert); /** * Fuel spawned alert. @@ -78,7 +78,7 @@ registerWhen(register("chat", (player, percentage) => { // Ballista full alert break; } }).setCriteria("${player} recovered a Fuel Cell and charged the Ballista! (${percentage}%)"), -() => getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.fuelAlert); +() => location.getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.fuelAlert); /** * Stunner eaten alert. @@ -92,7 +92,7 @@ registerWhen(register("chat", (player) => { Client.showTitle(`${GREEN + BOLD + ign} WAS EATEN!`, "", 10, 100, 10); } }).setCriteria("${player} has been eaten by Kuudra!"), -() => getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.kuudraStunner !== ""); +() => location.getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.kuudraStunner !== ""); /** * Ballista mounted alert. @@ -106,7 +106,7 @@ registerWhen(register("chat", (player) => { Client.showTitle(`${AQUA + BOLD + ign} ASSUMED THE POSITION!`, "", 10, 100, 10); } }).setCriteria("${player} mounted a Cannon!"), -() => getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.ballistaAlert !== ""); +() => location.getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.ballistaAlert !== ""); /** * Kuudra stunned alert. @@ -115,7 +115,7 @@ registerWhen(register("chat", () => { playSound(MUSIC, 1000); Client.showTitle(`${GREEN + BOLD}KUUDRA STUNNED!`, "", 10, 100, 10); }).setCriteria("{player} destroyed one of Kuudra's pods!"), -() => getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.stunAlert); +() => location.getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.stunAlert); /** * Warns player about dropship as they get close to center. @@ -128,7 +128,7 @@ registerWhen(register("step", () => { }); if (dropships !== undefined) Client.showTitle(`${RED + BOLD}ART IS AN EXPLOSION!`, "", 0, 50, 5); -}).setFps(1), () => getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.dropshipAlert); +}).setFps(1), () => location.getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.dropshipAlert); /** * Alerts player when token gathered surpasses set threshhold. @@ -143,5 +143,5 @@ registerWhen(register("step", () => { Client.showTitle(`${BOLD + tokens} ${DARK_PURPLE + BOLD}TOKENS GATHERED!`, "", 0, 50, 5); alerted = true } -}).setFps(5), () => getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.tokenAlert !== 0); +}).setFps(5), () => location.getWorld() === "Kuudra" && settings.kuudraAlerts && toggles.tokenAlert !== 0); register("worldLoad", () => { alerted = false }); diff --git a/features/kuudra/KuudraCrates.js b/features/kuudra/KuudraCrates.js index 8b1d6202..3ea38fed 100644 --- a/features/kuudra/KuudraCrates.js +++ b/features/kuudra/KuudraCrates.js @@ -1,7 +1,7 @@ -import { GIANT_CLASS, STAND_CLASS } from "../../utils/constants"; +import location from "../../utils/location"; import settings from "../../utils/settings"; +import { GIANT_CLASS, STAND_CLASS } from "../../utils/constants"; import { registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; import { getPhase } from "./KuudraSplits"; @@ -30,7 +30,7 @@ registerWhen(register("tick", () => { const z = supply.getZ() + 5 * Math.sin((yaw + 130) * (Math.PI / 180)); return [x, 75, z, distance > 32 ? 1 : 0, 1, distance > 32 ? 1 : 0]; }); -}), () => getWorld() === "Kuudra" && settings.kuudraCrates); +}), () => location.getWorld() === "Kuudra" && settings.kuudraCrates); /** * Marks build piles that are not completed. @@ -42,7 +42,7 @@ registerWhen(register("step", () => { const stands = World.getAllEntitiesOfType(STAND_CLASS); const piles = stands.filter(stand => stand.getName().includes('PUNCH')); piles.forEach((pile) => { builds.push([pile.getX(), pile.getY(), pile.getZ(), 1, 0, 0]) }); -}).setFps(2), () => getWorld() === "Kuudra" && settings.kuudraBuild); +}).setFps(2), () => location.getWorld() === "Kuudra" && settings.kuudraBuild); /** * Marks build piles that are not completed. diff --git a/features/kuudra/KuudraDetect.js b/features/kuudra/KuudraDetect.js index df094880..43cdc1d0 100644 --- a/features/kuudra/KuudraDetect.js +++ b/features/kuudra/KuudraDetect.js @@ -1,8 +1,8 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { CUBE_CLASS } from "../../utils/constants"; import { formatNumber } from "../../utils/functions/format"; import { registerWhen } from "../../utils/variables"; -import { getTier, getWorld } from "../../utils/worlds"; /** @@ -40,7 +40,7 @@ registerWhen(register("tick", () => { } // KUUDRA SPAWN DETECT - if (settings.kuudraSpawn && getTier() === 5 && currentHP <= 25_000 && currentHP > 24_900) { + if (settings.kuudraSpawn && location.getTier() === 5 && currentHP <= 25_000 && currentHP > 24_900) { x = kuudra.getX(); z = kuudra.getZ(); @@ -50,7 +50,7 @@ registerWhen(register("tick", () => { else if (z < -132) Client.showTitle("§4§lBACK!", "", 0, 25, 5); } } else HPDisplay = ["100k/100k ❤", 0, 0, 0]; -}), () => getWorld() === "Kuudra" && (settings.kuudraHP || settings.kuudraSpawn)); +}), () => location.getWorld() === "Kuudra" && (settings.kuudraHP || settings.kuudraSpawn)); /** * Cancel health rendering when announcing direction @@ -60,21 +60,21 @@ registerWhen(register("renderTitle", (title, _, event) => { if (currentHP > 25_000 || currentHP <= 24_900 || DIRECTIONS.has(title)) return; cancel(event); -}), () => getWorld() === "Kuudra" && settings.kuudraSpawn); +}), () => location.getWorld() === "Kuudra" && settings.kuudraSpawn); /** * Renders Kuudra's percent HP. */ registerWhen(register('renderOverlay', () => { percentHP.draw(); -}), () => getWorld() === "Kuudra" && settings.kuudraHP); +}), () => location.getWorld() === "Kuudra" && settings.kuudraHP); /** * Draws Kuudra HP onto its physical body. */ registerWhen(register('renderWorld', () => { if (HPDisplay[1]) Tessellator.drawString(HPDisplay[0], HPDisplay[1], HPDisplay[2] + 10, HPDisplay[3], 0xA7171A, true, 0.25, false); -}), () => getWorld() === "Kuudra" && settings.kuudraHP); +}), () => location.getWorld() === "Kuudra" && settings.kuudraHP); /** * Reset Kuudra's UUID on world exit. diff --git a/features/kuudra/KuudraProfit.js b/features/kuudra/KuudraProfit.js index f89ac6b7..5befb91a 100644 --- a/features/kuudra/KuudraProfit.js +++ b/features/kuudra/KuudraProfit.js @@ -1,9 +1,9 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { AQUA, BOLD, DARK_AQUA, DARK_PURPLE, DARK_RED, GOLD, GREEN, RED, WHITE } from "../../utils/constants"; import { commafy, formatNumber, getTime } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; -import { getTier, getWorld } from "../../utils/worlds"; import { getItemValue } from "../economy/ItemPrice"; import { getBazaar } from "../economy/Economy"; @@ -106,7 +106,7 @@ registerWhen(register("guiMouseClick", (x, y, button, gui) => { downtime = 0; updateProfitTracker(true); chestOpened = true; -}), () => getWorld() === "Kuudra" && settings.kuudraProfitTracker !== 0); +}), () => location.getWorld() === "Kuudra" && settings.kuudraProfitTracker !== 0); /** * Track time and downtime of runs. @@ -128,7 +128,7 @@ registerWhen(register("guiOpened", () => { const container = Player.getContainer(); if (container.getName() !== "Paid Chest") return; const bazaar = getBazaar(); - const tier = getTier(); + const tier = location.getTier(); const primary = getItemValue(container.getStackInSlot(11)); let secondary = container.getStackInSlot(12); @@ -150,4 +150,4 @@ ${DARK_PURPLE + BOLD}Teeth: ${GREEN}+${commafy(teeth)} ${RED + BOLD}Essence: ${GREEN}+${commafy(essence)} ${DARK_RED + BOLD}Key: ${RED}-${commafy(cost)}`); }); -}), () => getWorld() === "Kuudra"); +}), () => location.getWorld() === "Kuudra"); diff --git a/features/kuudra/KuudraSplits.js b/features/kuudra/KuudraSplits.js index cec234f3..c36d0236 100644 --- a/features/kuudra/KuudraSplits.js +++ b/features/kuudra/KuudraSplits.js @@ -1,3 +1,4 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { AQUA, BOLD, DARK_GREEN, GOLD, GRAY, GREEN, LOGO, RED, RESET } from "../../utils/constants"; import { getTime, isValidDate } from "../../utils/functions/format"; @@ -5,7 +6,6 @@ import { Overlay } from "../../utils/overlay"; import { getPlayerName } from "../../utils/functions/player"; import { delay } from "../../utils/thread"; import { data, registerWhen } from "../../utils/variables"; -import { getTier, getWorld } from "../../utils/worlds"; import { getKuudraHP } from "./KuudraDetect"; @@ -58,7 +58,7 @@ registerWhen(register("chat", () => { kuudraSplit[0] = Date.now() / 1000; phase = 1; }).setCriteria("[NPC] Elle: Okay adventurers, I will go and fish up Kuudra!"), -() => getWorld() === "Kuudra"); +() => location.getWorld() === "Kuudra"); /** * Second split. @@ -67,7 +67,7 @@ registerWhen(register("chat", () => { kuudraSplit[1] = Date.now() / 1000; phase = 2; }).setCriteria("[NPC] Elle: OMG! Great work collecting my supplies!"), -() => getWorld() === "Kuudra"); +() => location.getWorld() === "Kuudra"); /** * Third split. @@ -76,7 +76,7 @@ registerWhen(register("chat", () => { kuudraSplit[2] = Date.now() / 1000; phase = 3; }).setCriteria("[NPC] Elle: Phew! The Ballista is finally ready! It should be strong enough to tank Kuudra's blows now!"), -() => getWorld() === "Kuudra"); +() => location.getWorld() === "Kuudra"); /** * Fourth split. @@ -85,7 +85,7 @@ registerWhen(register("chat", () => { kuudraSplit[3] = Date.now() / 1000; phase = 4; }).setCriteria("[NPC] Elle: POW! SURELY THAT'S IT! I don't think he has any more in him!"), -() => getWorld() === "Kuudra"); +() => location.getWorld() === "Kuudra"); /** * Fifth (final) split. @@ -108,7 +108,7 @@ registerWhen(register("chat", () => { // Record splits let splitFormat = ""; - if (getTier() === 5) { + if (location.getTier() === 5) { // Check if new best split / run for (let i = 0; i < data.splits.last.length; i++) { if (!broken) @@ -139,7 +139,7 @@ registerWhen(register("chat", () => { // Resets party tracker party = []; -}).setCriteria("${before}KUUDRA DOWN${after}"), () => getWorld() === "Kuudra"); +}).setCriteria("${before}KUUDRA DOWN${after}"), () => location.getWorld() === "Kuudra"); /** * Fifth (final split) if you fail :skull:. @@ -147,14 +147,14 @@ registerWhen(register("chat", () => { registerWhen(register("chat", () => { kuudraSplit[4] = Date.now() / 1000; phase = 5; -}).setCriteria("${before}DEFEAT${after}"), () => getWorld() === "Kuudra" && settings.kuudraSplits); +}).setCriteria("${before}DEFEAT${after}"), () => location.getWorld() === "Kuudra" && settings.kuudraSplits); /** * Updates time splits overlay. */ registerWhen(register("step", () => { // Phase 4 fail safe - if (phase === 3 && getKuudraHP() < 25000 && getTier() === 5) { + if (phase === 3 && getKuudraHP() < 25000 && location.getTier() === 5) { kuudraSplit[3] = Date.now() / 1000; phase = 4; } @@ -190,7 +190,7 @@ registerWhen(register("step", () => { ${AQUA + BOLD}Build: ${RESET + times[1]} ${AQUA + BOLD}Fuel/Stun: ${RESET + times[2]} ${AQUA + BOLD}Kuudra: ${RESET + times[3]}`); -}).setFps(19), () => getWorld() === "Kuudra" && settings.kuudraSplits); +}).setFps(19), () => location.getWorld() === "Kuudra" && settings.kuudraSplits); /** * Party commands for splits. diff --git a/features/kuudra/KuudraView.js b/features/kuudra/KuudraView.js index 278ecc79..06072479 100644 --- a/features/kuudra/KuudraView.js +++ b/features/kuudra/KuudraView.js @@ -1,8 +1,8 @@ import axios from "../../../axios"; +import settings from "../../utils/settings"; import { AQUA, BOLD, DARK_AQUA, DARK_GRAY, DARK_PURPLE, DARK_RED, GOLD, GRAY, LOGO, RED, WHITE, YELLOW } from "../../utils/constants"; import { convertToTitleCase, formatNumber } from "../../utils/functions/format"; import { decode } from "../../utils/functions/misc"; -import settings from "../../utils/settings"; import { registerWhen } from "../../utils/variables"; diff --git a/features/mining/CommissionsDisplay.js b/features/mining/CommissionsDisplay.js index 3f0c485b..319aa74d 100644 --- a/features/mining/CommissionsDisplay.js +++ b/features/mining/CommissionsDisplay.js @@ -1,6 +1,6 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; import { Overlay } from "../../utils/overlay"; import { getClosest } from "../../utils/functions/find"; import { BOLD, GOLD, GREEN, UNDERLINE, YELLOW } from "../../utils/constants"; @@ -48,7 +48,7 @@ registerWhen(register("renderWorld", () => { commissionWaypoints.forEach(gem => { Tessellator.drawString(gem[0], gem[2], gem[3], gem[4], gem[1], true); }); -}), () => (getWorld() === "Crystal Hollows" || getWorld() === "Dwarven Mines") && settings.commissionWaypoints !== 0); +}), () => (location.getWorld() === "Crystal Hollows" || location.getWorld() === "Dwarven Mines") && settings.commissionWaypoints !== 0); registerWhen(register("step", () => { if (!World.isLoaded()) return; @@ -82,7 +82,7 @@ registerWhen(register("step", () => { } commissionOverlay.setMessage(commissionMessage); -}).setFps(4), () => (getWorld() === "Crystal Hollows" || getWorld() === "Dwarven Mines" || getWorld() === "Mineshaft") && +}).setFps(4), () => (location.getWorld() === "Crystal Hollows" || location.getWorld() === "Dwarven Mines" || location.getWorld() === "Mineshaft") && (settings.commissionsDisplay || settings.commissionWaypoints !== 0)); /* Render closest lines */ @@ -113,7 +113,7 @@ registerWhen(register("renderWorld", (pt) => { GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }) -}), () => getWorld() === "Dwarven Mines" && (settings.commissionWaypoints === 2 || settings.commissionWaypoints === 3)) +}), () => location.getWorld() === "Dwarven Mines" && (settings.commissionWaypoints === 2 || settings.commissionWaypoints === 3)) /** diff --git a/features/mining/PowderChest.js b/features/mining/PowderChest.js index 33b542be..1026ecff 100644 --- a/features/mining/PowderChest.js +++ b/features/mining/PowderChest.js @@ -1,8 +1,8 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { BOLD, CHEST_CLASS, DARK_AQUA, WHITE } from "../../utils/constants"; import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -20,14 +20,14 @@ registerWhen(register("tick", () => { nearbyChests = World.getAllTileEntitiesOfType(CHEST_CLASS) .filter(chest => Player.asPlayerMP().distanceTo(chest.getBlockPos()) <= settings.powderChest); powderOverlay.setMessage(`${DARK_AQUA + BOLD}Nearby Chests: ${WHITE + nearbyChests.length}`); -}), () => getWorld() === "Crystal Hollows" && settings.powderChest !== 0); +}), () => location.getWorld() === "Crystal Hollows" && settings.powderChest !== 0); /** * Removes chest waypoints on world leave. */ registerWhen(register("worldUnload", () => { nearbyChests = []; -}), () => getWorld() === "Crystal Hollows" && settings.powderChest !== 0); +}), () => location.getWorld() === "Crystal Hollows" && settings.powderChest !== 0); /** * Remove powder chest spam. diff --git a/features/mining/PowderTracker.js b/features/mining/PowderTracker.js index ee58c6ff..ecda8b07 100644 --- a/features/mining/PowderTracker.js +++ b/features/mining/PowderTracker.js @@ -1,9 +1,9 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { AQUA, BLUE, BOLD, DARK_GREEN, GREEN, LIGHT_PURPLE, LOGO, RED, WHITE } from "../../utils/constants"; import { commafy, getTime } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; import { Stat, data, getPaused, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -62,7 +62,7 @@ registerWhen(register("step", () => { const currentGemstone = parseInt(tablist[powderIndex + 2].removeFormatting().trim().split(' ')[1].replace(/\D/g, '')); updatePowder(powders.Mithril, currentMithril); updatePowder(powders.Gemstone, currentGemstone); - if (getWorld() === "Dwarven Mines") { + if (location.getWorld() === "Dwarven Mines") { const currentGlacite = parseInt(tablist[powderIndex + 3].removeFormatting().trim().split(' ')[1]?.replace(/\D/g, '')); updatePowder(powders.Glacite, currentGlacite); } @@ -83,4 +83,4 @@ ${LIGHT_PURPLE + BOLD}Rate: ${WHITE + commafy(powders.Gemstone.getRate())} ᠅/h ${AQUA + BOLD}Glacite: ${WHITE + commafy(powders.Glacite.getGain())} ᠅ ${AQUA + BOLD}Rate: ${WHITE + commafy(powders.Glacite.getRate())} ᠅/hr ${BLUE + BOLD}Time Passed: ${WHITE + timeDisplay}`); -}).setFps(1), () => (getWorld() === "Crystal Hollows" || getWorld() === "Dwarven Mines") && settings.powderTracker !== 0); +}).setFps(1), () => (location.getWorld() === "Crystal Hollows" || location.getWorld() === "Dwarven Mines") && settings.powderTracker !== 0); diff --git a/features/mining/ShaftAnnounce.js b/features/mining/ShaftAnnounce.js index 0a194ff5..c0a9de8b 100644 --- a/features/mining/ShaftAnnounce.js +++ b/features/mining/ShaftAnnounce.js @@ -1,10 +1,10 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { getClosest } from "../../utils/functions/find"; import { getInParty, getIsLeader } from "../../utils/party"; import { registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; import { delay } from "../../utils/thread"; -import { AQUA, GREEN, STAND_CLASS } from "../../utils/constants"; +import { STAND_CLASS } from "../../utils/constants"; import { convertToTitleCase } from "../../utils/functions/format"; @@ -29,7 +29,7 @@ function attemptTransfer(index) { registerWhen(register("chat", () => { if (!getInParty()) return; attemptTransfer(0); -}).setCriteria("WOW! You found a Glacite Mineshaft portal!"), () => settings.shaftTransfer && getWorld() === "Dwarven Mines"); +}).setCriteria("WOW! You found a Glacite Mineshaft portal!"), () => settings.shaftTransfer && location.getWorld() === "Dwarven Mines"); /** @@ -56,20 +56,20 @@ let looted = []; registerWhen(register("chat", (type) => { looted.push([Player.getX(), Player.getY(), Player.getZ()]); if (settings.corpseAnnounce) announceCorpse(convertToTitleCase(type)); -}).setCriteria(" ${type} CORPSE LOOT! "), () => (settings.corpseAnnounce || settings.corpseWaypoints) && getWorld() === "Mineshaft"); +}).setCriteria(" ${type} CORPSE LOOT! "), () => (settings.corpseAnnounce || settings.corpseWaypoints) && location.getWorld() === "Mineshaft"); registerWhen(register("chat", () => { announceCorpse("Tungsten"); -}).setCriteria("You need to be holding a Tungsten Key to unlock this corpse!"), () => settings.corpseAnnounce && getWorld() === "Mineshaft"); +}).setCriteria("You need to be holding a Tungsten Key to unlock this corpse!"), () => settings.corpseAnnounce && location.getWorld() === "Mineshaft"); registerWhen(register("chat", () => { announceCorpse("Umber"); -}).setCriteria("You need to be holding an Umber Key to unlock this corpse!"), () => settings.corpseAnnounce && getWorld() === "Mineshaft"); +}).setCriteria("You need to be holding an Umber Key to unlock this corpse!"), () => settings.corpseAnnounce && location.getWorld() === "Mineshaft"); registerWhen(register("chat", () => { announceCorpse("Vanguard"); -}).setCriteria("You need to be holding a Skeleton Key to unlock this corpse!"), () => settings.corpseAnnounce && getWorld() === "Mineshaft"); +}).setCriteria("You need to be holding a Skeleton Key to unlock this corpse!"), () => settings.corpseAnnounce && location.getWorld() === "Mineshaft"); registerWhen(register("chat", (_, x, y, z) => { corpses.push([x, y, z.split(' ')[0]]); -}).setCriteria("${player}: x: ${x}, y: ${y}, z: ${z}"), () => settings.corpseAnnounce && getWorld() === "Mineshaft"); +}).setCriteria("${player}: x: ${x}, y: ${y}, z: ${z}"), () => settings.corpseAnnounce && location.getWorld() === "Mineshaft"); /** * Corpse detection @@ -108,7 +108,7 @@ registerWhen(register("step", () => { corpseWaypoints[type].push([ARMOR_MATCH[type], stand.getX(), stand.getY() + 2, stand.getZ()]); } }); -}).setDelay(1), () => settings.corpseWaypoints && getWorld() === "Mineshaft"); +}).setDelay(1), () => settings.corpseWaypoints && location.getWorld() === "Mineshaft"); register("worldUnload", () => { corpses = []; diff --git a/features/mining/WishingCompass.js b/features/mining/WishingCompass.js index 08223338..24eb708c 100644 --- a/features/mining/WishingCompass.js +++ b/features/mining/WishingCompass.js @@ -1,7 +1,7 @@ -import { GRAY, GREEN, LOGO } from "../../utils/constants"; +import location from "../../utils/location"; import settings from "../../utils/settings"; +import { GRAY, GREEN, LOGO } from "../../utils/constants"; import { registerWhen } from "../../utils/variables"; -import { findZone, getWorld } from "../../utils/worlds"; /** @@ -42,12 +42,12 @@ function findIntersection(line1, line2) { * Uses wishing compass shattered chat message to update path logic. */ registerWhen(register("chat", () => { - if (zone === findZone()) lastPath = path; + if (zone === location.findZone()) lastPath = path; else lastPath = []; - zone = findZone(); + zone = location.findZone(); path = []; -}).setCriteria("Your Wishing Compass shattered into pieces!"), () => getWorld() === "Crystal Hollows" && settings.compassLocator); +}).setCriteria("Your Wishing Compass shattered into pieces!"), () => location.getWorld() === "Crystal Hollows" && settings.compassLocator); /** * Uses compass particles to track and estimate compass location. @@ -79,4 +79,4 @@ registerWhen(register("spawnParticle", (particle, type) => { const close = Math.hypot(origin[0] - lastPath[0][0], origin[2] - lastPath[0][2]); if (close < 16) ChatLib.chat(`${LOGO + GRAY}Location may be incorrect due to proximity of compass uses...`); } -}), () => getWorld() === "Crystal Hollows" && settings.compassLocator); +}), () => location.getWorld() === "Crystal Hollows" && settings.compassLocator); diff --git a/features/party/AutoTransfer.js b/features/party/AutoTransfer.js index 3d07776b..3e4e18de 100644 --- a/features/party/AutoTransfer.js +++ b/features/party/AutoTransfer.js @@ -1,9 +1,9 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { getInParty, getIsLeader, getParty } from "../../utils/party"; import { getPlayerName } from "../../utils/functions/player"; import { delay } from "../../utils/thread"; import { registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -23,7 +23,7 @@ registerWhen(register("chat", (player1, player2) => { */ let transferred = false; registerWhen(register("chat", (player1, player2) => { - if (getWorld() !== undefined && !transferred) return; + if (location.getWorld() !== undefined && !transferred) return; const name1 = getPlayerName(player1).toLowerCase(); const name2 = getPlayerName(player2).toLowerCase(); diff --git a/features/rift/DDR.js b/features/rift/DDR.js index 2899eb3b..89d7e37f 100644 --- a/features/rift/DDR.js +++ b/features/rift/DDR.js @@ -1,6 +1,6 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** @@ -88,14 +88,14 @@ registerWhen(register("renderTitle", (title, subtitle, event) => { last = subtitle; print(subtitle); cancel(event); -}), () => getWorld() === "The Rift" && settings.ddrHelper); +}), () => location.getWorld() === "The Rift" && settings.ddrHelper); /** * Resets dance if player fails. */ registerWhen(register("chat", () => { dancing = [...DANCES] }).setCriteria("You were${failure}!"), -() => getWorld() === "The Rift" && settings.ddrHelper); +() => location.getWorld() === "The Rift" && settings.ddrHelper); registerWhen(register("chat", () => { dancing = [...DANCES] }).setCriteria("You d${failure}!"), -() => getWorld() === "The Rift" && settings.ddrHelper); +() => location.getWorld() === "The Rift" && settings.ddrHelper); registerWhen(register("chat", () => { dancing = [...DANCES] }).setCriteria("You're ${failure}!"), -() => getWorld() === "The Rift" && settings.ddrHelper); +() => location.getWorld() === "The Rift" && settings.ddrHelper); diff --git a/features/rift/RiftWaypoints.js b/features/rift/RiftWaypoints.js index bf0825a3..5518247e 100644 --- a/features/rift/RiftWaypoints.js +++ b/features/rift/RiftWaypoints.js @@ -1,16 +1,16 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { GRAY, GREEN, LOGO, RED, WHITE } from "../../utils/constants"; import { getClosest } from "../../utils/functions/find"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; /** * Variables used to represent soul waypoints. */ let enigmaClose = data.enigmaSouls; -export function getEnigma() { return settings.enigmaWaypoint && getWorld() === "The Rift" ? enigmaClose : [] }; -export function getCat() { return settings.catWaypoint && getWorld() === "The Rift" ? data.catSouls : [] }; +export function getEnigma() { return settings.enigmaWaypoint && location.getWorld() === "The Rift" ? enigmaClose : [] }; +export function getCat() { return settings.catWaypoint && location.getWorld() === "The Rift" ? data.catSouls : [] }; /** * Removes closest enigma soul to player once one is unlocked. @@ -19,7 +19,7 @@ registerWhen(register("chat", () => { // Delete closest soul const closest = getClosest([Player.getX(), Player.getY(), Player.getZ()], data.enigmaSouls); if (closest !== undefined) data.enigmaSouls.splice(data.enigmaSouls.indexOf(closest[0]), 1); -}).setCriteria("SOUL! You unlocked an Enigma Soul!"), () => getWorld() === "The Rift"); +}).setCriteria("SOUL! You unlocked an Enigma Soul!"), () => location.getWorld() === "The Rift"); /** * Fail safe enigma soul remove in case player clicks on an unregistered soul. @@ -30,7 +30,7 @@ registerWhen(register("chat", () => { // Delete duplicate soul const closest = getClosest([Player.getX(), Player.getY(), Player.getZ()], data.enigmaSouls); if (closest !== undefined && closest[1] < 5) data.enigmaSouls.splice(data.enigmaSouls.indexOf(closest[0]), 1); -}).setCriteria("You have already found that Enigma Soul!"), () => getWorld() === "The Rift"); +}).setCriteria("You have already found that Enigma Soul!"), () => location.getWorld() === "The Rift"); /** * Updates enigma soul array closer than set threshold to player. @@ -38,7 +38,7 @@ registerWhen(register("chat", () => { registerWhen(register("step", () => { // Filters to closest souls enigmaClose = data.enigmaSouls.filter((enigma) => Math.hypot(Player.getX() - enigma[0], Player.getZ() - enigma[2]) < settings.enigmaWaypoint); -}).setFps(1), () => getWorld() === "The Rift" && settings.enigmaWaypoint !== 0); +}).setFps(1), () => location.getWorld() === "The Rift" && settings.enigmaWaypoint !== 0); /** * Removes closest Montezuma soul piece when player finds one. @@ -48,7 +48,7 @@ registerWhen(register("chat", () => { const closest = getClosest([Player.getX(), Player.getY(), Player.getZ()], data.catSouls); if (closest !== undefined) data.catSouls.splice(data.catSouls.indexOf(closest[0]), 1); -}).setCriteria("You found a piece of Montezuma's soul!"), () => getWorld() === "The Rift"); +}).setCriteria("You found a piece of Montezuma's soul!"), () => location.getWorld() === "The Rift"); /** * Fail safe Montzuma soul piece remove in case player clicks on an unregistered soul. @@ -60,7 +60,7 @@ registerWhen(register("chat", () => { const closest = getClosest([Player.getX(), Player.getY(), Player.getZ()], data.catSouls); if (closest[1] < 5) data.catSouls.splice(data.catSouls.indexOf(closest[0]), 1); -}).setCriteria("You have already found this Montezuma soul piece!"), () => getWorld() === "The Rift"); +}).setCriteria("You have already found this Montezuma soul piece!"), () => location.getWorld() === "The Rift"); /** @@ -162,5 +162,5 @@ registerWhen(register("step", () => { effigies = effigies.getName().replace(/[^§7⧯]/g,'').split("§"); effigies.shift(); effigies.forEach((effigy, i) => { if (effigy.includes('7')) missingEffigies.push(EFFIGIES[i]) }); -}).setFps(1), () => getWorld() === "The Rift" && settings.effigyWaypoint); +}).setFps(1), () => location.getWorld() === "The Rift" && settings.effigyWaypoint); register("worldUnload", () => { missingEffigies = [] }); diff --git a/features/rift/VampireSlayer.js b/features/rift/VampireSlayer.js index 902bff99..d2d2b349 100644 --- a/features/rift/VampireSlayer.js +++ b/features/rift/VampireSlayer.js @@ -1,9 +1,9 @@ +import location from "../../utils/location"; import settings from "../../utils/settings"; import { AQUA, BOLD, DARK_AQUA, DARK_PURPLE, EntityArmorStand, GOLD, PLAYER_CLASS, SMA } from "../../utils/constants"; import { Overlay } from "../../utils/overlay"; import { getInParty } from "../../utils/party"; import { data, registerWhen } from "../../utils/variables"; -import { getWorld } from "../../utils/worlds"; import { getSlayerBoss } from "../combat/SlayerDetect"; import { renderEntities } from "../../utils/waypoints"; @@ -96,7 +96,7 @@ registerWhen(register("tick", () => { ichorUUID = ichor.persistentID; } } -}), () => getWorld() === "The Rift" && (settings.vampireAttack || settings.announceMania !== 0)); +}), () => location.getWorld() === "The Rift" && (settings.vampireAttack || settings.announceMania !== 0)); /** * Replaces Hypixel's impel subtitle with a flashy title. @@ -106,7 +106,7 @@ registerWhen(register("renderTitle", (title, subtitle, event) => { cancel(event); Client.showTitle(subtitle, "", 0, 20, 0); } -}), () => getWorld() === "The Rift" && settings.vampireImpel); +}), () => location.getWorld() === "The Rift" && settings.vampireImpel); /** * Highlights vampire bosses with steakable HP. @@ -125,7 +125,7 @@ registerWhen(register("step", () => { const max = entity.func_110148_a(SMA.field_111267_a).func_111125_b(); return max > 210 && entity.func_110143_aJ() / max <= 0.2; }); -}).setFps(2), () => getWorld() === "The Rift" && settings.vampireHitbox); +}).setFps(2), () => location.getWorld() === "The Rift" && settings.vampireHitbox); /** * Render boxx hitboxes @@ -133,4 +133,4 @@ registerWhen(register("step", () => { registerWhen(register("renderWorld", (pt) => { renderEntities(dracula, 1, 0, 0, pt, undefined, false); renderEntities(vamps, 1, 0, 0, pt); -}), () => getWorld() === "The Rift" && settings.vampireHitbox); +}), () => location.getWorld() === "The Rift" && settings.vampireHitbox); diff --git a/index.js b/index.js index 10b87e25..7fd5d07a 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,6 @@ // Utility Modules import "./utils/player"; +import location from "./utils/location"; import settings from "./utils/settings"; import toggles from "./utils/toggles"; import "./utils/waypoints"; @@ -9,7 +10,6 @@ import { openGUI } from "./utils/overlay"; import { delay } from "./utils/thread"; import { getLatestReleaseVersion } from "./utils/updates"; import { data, resetGUI, updateList } from "./utils/variables"; -import { findZone, getTier, getWorld } from "./utils/worlds"; // Utility Variable Control const CHANGED_SETTINGS = new Set(["itemPrice", "bossAlert", "miniAlert", "vanqCounter"]); for (const key in settings) if (CHANGED_SETTINGS.has(key) && typeof settings[key] !== "number") settings[key] = 0; @@ -307,9 +307,9 @@ ${DARK_GRAY}- ${AQUA + BOLD}pl: ${WHITE}prefix-list`); case "test": ChatLib.chat( `${LOGO + DARK_AQUA + BOLD}Important Values: -- ${AQUA + BOLD}World: ${WHITE + getWorld()} -- ${AQUA + BOLD}Zone: ${WHITE + findZone()} -- ${AQUA + BOLD}Tier: ${WHITE + getTier()} +- ${AQUA + BOLD}World: ${WHITE + location.getWorld()} +- ${AQUA + BOLD}Zone: ${WHITE + location.findZone()} +- ${AQUA + BOLD}Tier: ${WHITE + location.getTier()} - ${AQUA + BOLD}Leader: ${WHITE + getIsLeader()} - ${AQUA + BOLD}Party: ${WHITE + getInParty()}`); const party = getParty(); diff --git a/utils/worlds.js b/utils/location.js similarity index 96% rename from utils/worlds.js rename to utils/location.js index d12ed2de..3cb3337e 100644 --- a/utils/worlds.js +++ b/utils/location.js @@ -101,12 +101,11 @@ class Location { else { // Set season Scoreboard.getLines().find(line => { - this.#season = SEASONS.find(s => line.getName().includes(s)) ?? this.#season; + this.#season = this.SEASONS.find(s => line.getName().includes(s)) ?? this.#season; }); // Get world formatted this.#world = world.removeFormatting().split(' ').splice(1).join(' '); - ChatLib.chat(this.#world) // Get tier for Kuudra if (this.#world === "Kuudra") { diff --git a/utils/overlay.js b/utils/overlay.js index ca4096b3..137028d6 100644 --- a/utils/overlay.js +++ b/utils/overlay.js @@ -1,7 +1,7 @@ +import location from "./location"; import settings from "./settings"; import { GREEN, ITALIC, LOGO } from "./constants"; import { registerWhen } from "./variables"; -import { getWorld } from "./worlds"; /** @@ -105,7 +105,7 @@ const keying = register("guiKey", (char, keyCode, currentGui, event) => { worldView = !worldView; if (worldView) { overlays = overlays.filter(overlay => { - if (!overlay.requires.has(getWorld()) && !overlay.requires.has("all")) { + if (!overlay.requires.has(location.getWorld()) && !overlay.requires.has("all")) { overlaid.push(overlay); return false; } @@ -234,7 +234,7 @@ export class Overlay { ); renderScale(this.loc[2], this.message, this.X, this.Y, this.loc[3], this.loc[4]); } - }), () => settings[this.setting] && (this.requires.has(getWorld()) || this.requires.has("all"))); + }), () => settings[this.setting] && (this.requires.has(location.getWorld()) || this.requires.has("all"))); // Register editing stuff this.dragging = register("dragged", (dx, dy, x, y) => { From 08085caa06b8a5488ad26f46655f53cd90b33314 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 13:48:49 -0400 Subject: [PATCH 27/33] Changed mayor into class --- changelog.json | 1 + features/event/BurrowDetect.js | 4 +-- features/event/InquisitorDetect.js | 10 +++---- features/event/MythRitual.js | 4 +-- utils/mayor.js | 45 +++++++++++++++--------------- 5 files changed, 33 insertions(+), 31 deletions(-) diff --git a/changelog.json b/changelog.json index 185defc7..7daaa85c 100644 --- a/changelog.json +++ b/changelog.json @@ -5,6 +5,7 @@ "- Changed `/pesttp` detection", "- Changed garden box to be red/green if pests/spray", "- Changed pest alert to be slider", + "- Changed some utils", "- Fixed overlay width being off on bold", "- Fixed some overlay settings/displays", "- Fixed overlay death" diff --git a/features/event/BurrowDetect.js b/features/event/BurrowDetect.js index 3b7b093c..602e3888 100644 --- a/features/event/BurrowDetect.js +++ b/features/event/BurrowDetect.js @@ -1,8 +1,8 @@ import location from "../../utils/location"; +import mayor from "../../utils/mayor"; import settings from "../../utils/settings"; import { AMOGUS, GRAY, LOGO, WHITE } from "../../utils/constants"; import { getClosest } from "../../utils/functions/find"; -import { getPerks } from "../../utils/mayor"; import { playSound } from "../../utils/functions/misc"; import { delay } from "../../utils/thread"; import { registerWhen } from "../../utils/variables"; @@ -24,7 +24,7 @@ registerWhen(register("clicked", (_, __, button, isButtonDown) => { echo = true; delay(() => echo = false, 3000); -}), () => location.getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.burrowDetect !== 0); +}), () => location.getWorld() === "Hub" && mayor.getPerks().has("Mythological Ritual") && settings.burrowDetect !== 0); /** * Detect for mytholigical burrows diff --git a/features/event/InquisitorDetect.js b/features/event/InquisitorDetect.js index 4cf4fc8e..5f36e710 100644 --- a/features/event/InquisitorDetect.js +++ b/features/event/InquisitorDetect.js @@ -1,7 +1,7 @@ import location from "../../utils/location"; +import mayor from "../../utils/mayor"; import settings from "../../utils/settings"; import { BOLD, GOLD, WHITE, RESET, RED, PLAYER_CLASS } from "../../utils/constants"; -import { getPerks } from "../../utils/mayor"; import { announceMob } from "../../utils/functions/misc"; import { Overlay } from "../../utils/overlay"; import { data, registerWhen } from "../../utils/variables"; @@ -22,7 +22,7 @@ const counterExample = ${GOLD + BOLD}Total Burrows: ${RESET}Let. ${GOLD + BOLD}Burrows Since: ${RESET}Him. ${GOLD + BOLD}Average Burrows: ${RESET}Cook.` -const counterOverlay = new Overlay("inqCounter", ["Hub"], () => getPerks().has("Mythological Ritual"), data.IL, "moveInq", counterExample); +const counterOverlay = new Overlay("inqCounter", ["Hub"], () => mayor.getPerks().has("Mythological Ritual"), data.IL, "moveInq", counterExample); /** * Updates the inquisitor counter depending on if an inquisitor spawned. @@ -82,7 +82,7 @@ registerWhen(register("chat", (wow, mob) => { announceMob(settings.inqAlert, "Minos Inquisitor", Player.getX(), Player.getY(), Player.getZ()); if (settings.inqCounter !== 0) updateInqCounter(true); } else if (settings.inqCounter !== 0) updateInqCounter(false); -}).setCriteria("${wow}! You dug out a ${mob}!"), () => location.getWorld() === "Hub" && getPerks().has("Mythological Ritual")); +}).setCriteria("${wow}! You dug out a ${mob}!"), () => location.getWorld() === "Hub" && mayor.getPerks().has("Mythological Ritual")); /** * Tracks world for any inquisitors near player. @@ -99,8 +99,8 @@ registerWhen(register("step", () => { if (!data.moblist.includes("inquisitor")) inquisitors = []; } -}).setFps(2), () => location.getWorld() === "Hub" && settings.detectInq && getPerks().has("Mythological Ritual")); -new Hitbox(() => location.getWorld() === "Hub" && settings.detectInq && getPerks().has("Mythological Ritual"), (pt) => { +}).setFps(2), () => location.getWorld() === "Hub" && settings.detectInq && mayor.getPerks().has("Mythological Ritual")); +new Hitbox(() => location.getWorld() === "Hub" && settings.detectInq && mayor.getPerks().has("Mythological Ritual"), (pt) => { renderEntities(inquisitors, 1, 0.84, 0, pt, "Inspector Gadget"); }); register("worldUnload", () => inquisitors = []); diff --git a/features/event/MythRitual.js b/features/event/MythRitual.js index bfb8e0cf..397c95d0 100644 --- a/features/event/MythRitual.js +++ b/features/event/MythRitual.js @@ -1,8 +1,8 @@ import settings from "../../utils/settings"; +import mayor from "../../utils/mayor"; import location from "../../utils/location"; import { GREEN, LOGO } from "../../utils/constants"; import { getClosest } from "../../utils/functions/find"; -import { getPerks } from "../../utils/mayor"; import { delay } from "../../utils/thread"; import { data, registerWhen } from "../../utils/variables"; @@ -101,7 +101,7 @@ registerWhen(register("clicked", (_, __, button, isButtonDown) => { echo = true; delay(() => echo = false, 3000); path = [[Player.getX(), Player.getY(), Player.getZ()]]; -}), () => location.getWorld() === "Hub" && getPerks().has("Mythological Ritual") && settings.dianaWaypoint); +}), () => location.getWorld() === "Hub" && mayor.getPerks().has("Mythological Ritual") && settings.dianaWaypoint); let guess = []; export function getGuess() { return guess }; diff --git a/utils/mayor.js b/utils/mayor.js index 9fd70329..c18bd7c9 100644 --- a/utils/mayor.js +++ b/utils/mayor.js @@ -1,27 +1,28 @@ import { request } from "../../requestV2"; -import { DARK_RED, LOGO } from "./constants"; -/** - * Variables used to represent mayor data. - */ -const MAYOR_API = "https://api.hypixel.net/v2/resources/skyblock/election"; -let mayor = undefined; -export function getMayor() { return mayor } +class Mayor { + #mayor = undefined; + #perks = new Set([]); -// An array to store the names of the mayor's perks. -let perks = new Set([]); -export function getPerks() { return perks } + constructor() { + register("worldLoad", () => { + request({ + url: "https://api.hypixel.net/v2/resources/skyblock/election", + json: true + }).then(response => { + this.#mayor = response.mayor.name; + this.#perks = new Set([...response.mayor.perks.map(perk => perk.name)]); + }).catch(err => console.error(`VolcAddons: ${err.cause ?? err}`)); + }); + } -/** - * Makes a PULL request to get mayor info from Hypixel API. - */ -register("worldLoad", () => { - request({ - url: MAYOR_API, - json: true - }).then(response => { - mayor = response.mayor.name; - perks = new Set([...response.mayor.perks.map(perk => perk.name)]); - }).catch(err => console.error(`VolcAddons: ${err.cause ?? err}`)); -}); + getMayor() { + return this.#mayor; + } + + getPerks() { + return this.#perks; + } +} +export default new Mayor; From b65a2dded192b2e049cf9a510ce4d5fda9bce9d6 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 13:49:10 -0400 Subject: [PATCH 28/33] Fixed egg alert formatting --- features/event/HippityHoppity.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/event/HippityHoppity.js b/features/event/HippityHoppity.js index 3564fed7..6a8752f1 100644 --- a/features/event/HippityHoppity.js +++ b/features/event/HippityHoppity.js @@ -72,7 +72,7 @@ registerWhen(register("step", () => { }).setFps(2), () => settings.eggTimers && location.getSeason() === "Spring"); registerWhen(register("chat", (type) => { - Client.showTitle(`${LIGHT_PURPLE + BOLD}EGG SPAWNED!`, `${GOLD}A ${type} Egg has spawned.`, 10, 50, 10); + Client.showTitle(`${LIGHT_PURPLE + BOLD}EGG SPAWNED!`, `${GOLD}A ${type} Egg ${GOLD}has spawned.`, 10, 50, 10); }).setCriteria("&r&d&lHOPPITY'S HUNT &r&dA &r${type} Egg &r&dhas appeared!&r"), () => settings.eggTimers && location.getSeason() === "Spring"); From 598a15376fdc95ac5139c1bc90850f0a15cdf84a Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 15:18:03 -0400 Subject: [PATCH 29/33] Added check if egg has been collected --- changelog.json | 1 + features/event/HippityHoppity.js | 87 +++++++++++++++++++------------- 2 files changed, 54 insertions(+), 34 deletions(-) diff --git a/changelog.json b/changelog.json index 7daaa85c..522acce3 100644 --- a/changelog.json +++ b/changelog.json @@ -2,6 +2,7 @@ "- Added option to render overlay background", "- Added choco egg timers", "- Added `/viewrecipe` button in GUI", + "- Changed egg waypoints to dissapear on loot", "- Changed `/pesttp` detection", "- Changed garden box to be red/green if pests/spray", "- Changed pest alert to be slider", diff --git a/features/event/HippityHoppity.js b/features/event/HippityHoppity.js index 6a8752f1..66e64db1 100644 --- a/features/event/HippityHoppity.js +++ b/features/event/HippityHoppity.js @@ -1,6 +1,6 @@ import location from "../../utils/location"; import settings from "../../utils/settings"; -import { BOLD, DARK_GRAY, GOLD, LIGHT_PURPLE, STAND_CLASS, WHITE, YELLOW } from "../../utils/constants"; +import { BOLD, DARK_GRAY, GOLD, GREEN, LIGHT_PURPLE, RED, STAND_CLASS, WHITE, YELLOW } from "../../utils/constants"; import { getSlotCoords } from "../../utils/functions/find"; import { convertToTitleCase, formatNumber, formatTimeElapsed, getTime } from "../../utils/functions/format"; import { Overlay } from "../../utils/overlay"; @@ -44,38 +44,6 @@ ${GOLD + BOLD}Time: ${YELLOW + formatTimeElapsed(data.chocoLast, now)}`); }).setFps(1); -/** - * Egg timer overlay. - * - * 18k = midnight - * Breakfast- 7:00 am = 1_000 - * Lunch- 2:00 pm = 8_000 - * Dinner- 9:00 pm = 15_000 - */ -const eggExample = -`${GOLD + BOLD}Egg Timers: - ${YELLOW}Breakfast: ${WHITE}bling - ${YELLOW}Lunch: ${WHITE}bang - ${YELLOW}Dinner: ${WHITE}bang`; -const eggOverlay = new Overlay("eggTimers", ["all"], () => true, data.CGL, "moveEgg", eggExample); - -registerWhen(register("step", () => { - const time = World.getTime() % 24_000; - const breakfastTime = time > 1_000 ? 25_000 - time : 1_000 - time; - const lunchTime = time > 8_000 ? 32_000 - time : 8_000 - time; - const dinnerTime = time > 15_000 ? 39_000 - time : 15_000 - time; - eggOverlay.setMessage( -`${GOLD + BOLD}Egg Timers: - ${YELLOW}Breakfast: ${WHITE + getTime(breakfastTime / 20)} - ${YELLOW}Lunch: ${WHITE + getTime(lunchTime / 20)} - ${YELLOW}Dinner: ${WHITE + getTime(dinnerTime / 20)}`); -}).setFps(2), () => settings.eggTimers && location.getSeason() === "Spring"); - -registerWhen(register("chat", (type) => { - Client.showTitle(`${LIGHT_PURPLE + BOLD}EGG SPAWNED!`, `${GOLD}A ${type} Egg ${GOLD}has spawned.`, 10, 50, 10); -}).setCriteria("&r&d&lHOPPITY'S HUNT &r&dA &r${type} Egg &r&dhas appeared!&r"), () => settings.eggTimers && location.getSeason() === "Spring"); - - /** * Highlight best worker. */ @@ -152,8 +120,26 @@ const EGGS = { "55ae5624-c86b-359f-be54-e0ec7c175403": "Lunch", "e67f7c89-3a19-3f30-ada2-43a3856e5028": "Dinner" }; +let looted = { + "Breakfast": false, + "Lunch": false, + "Dinner": false +}; export function getEggs() { return eggWaypoints }; +// Track if egg was looted. +registerWhen(register("chat", (type) => { + looted[type] = true; +}).setCriteria("You have already collected this Chocolate ${type} Egg! Try again when it respawns!"), () => settings.chocoWaypoints); + +registerWhen(register("chat", (type) => { + looted[type] = true; +}).setCriteria("HOPPITY'S HUNT You found a Chocolate ${type} Egg ${loc}!"), () => settings.chocoWaypoints); + +registerWhen(register("chat", (type) => { + looted[type] = true; +}).setCriteria("HOPPITY'S HUNT You found a Chocolate ${type} Egg ${loc}!"), () => settings.chocoWaypoints); + registerWhen(register("step", () => { const stands = World.getAllEntitiesOfType(STAND_CLASS); eggWaypoints = []; @@ -162,7 +148,7 @@ registerWhen(register("step", () => { const helmet = stand.getEntity()?.func_71124_b(4); // getEquipmentInSlot(0: Tool in Hand; 1-4: Armor) if (helmet !== null) { const id = helmet.func_77978_p()?.func_74775_l("SkullOwner")?.func_74779_i("Id"); // getNBT() +> getNBTTagCompound() => getString() - if (id in EGGS) eggWaypoints.push([EGGS[id], stand.getX(), stand.getY() + 2, stand.getZ()]); + if (id in EGGS && !looted[EGGS[id]]) eggWaypoints.push([EGGS[id], stand.getX(), stand.getY() + 2, stand.getZ()]); } }); }).setDelay(1), () => settings.chocoWaypoints); @@ -188,3 +174,36 @@ registerWhen(register("chat", (type, loc) => { chocoLoc = convertToTitleCase(loc); announceOnClose.register(); }).setCriteria("HOPPITY'S HUNT You found a Chocolate ${type} Egg ${loc}!"), () => settings.chocoAlert !== 0); + + +/** + * Egg timer overlay. + * + * 18k = midnight + * Breakfast- 7:00 am = 1_000 + * Lunch- 2:00 pm = 8_000 + * Dinner- 9:00 pm = 15_000 + */ +const eggExample = +`${GOLD + BOLD}Egg Timers: + ${YELLOW}Breakfast: ${WHITE}bling + ${YELLOW}Lunch: ${WHITE}bang + ${YELLOW}Dinner: ${WHITE}bang`; +const eggOverlay = new Overlay("eggTimers", ["all"], () => true, data.CGL, "moveEgg", eggExample); +eggOverlay.setMessage(""); + +registerWhen(register("step", () => { + const time = World.getTime() % 24_000; + const breakfastTime = time > 1_000 ? 25_000 - time : 1_000 - time; + const lunchTime = time > 8_000 ? 32_000 - time : 8_000 - time; + const dinnerTime = time > 15_000 ? 39_000 - time : 15_000 - time; + eggOverlay.setMessage( +`${GOLD + BOLD}Egg Timers: + ${YELLOW}Breakfast: ${WHITE + getTime(breakfastTime / 20)} ${looted.Breakfast ? GREEN + "✔" : RED + "✘"} + ${YELLOW}Lunch: ${WHITE + getTime(lunchTime / 20)} ${looted.Lunch ? GREEN + "✔" : RED + "✘"} + ${YELLOW}Dinner: ${WHITE + getTime(dinnerTime / 20)} ${looted.Dinner ? GREEN + "✔" : RED + "✘"}`); +}).setFps(2), () => settings.eggTimers && location.getSeason() === "Spring"); + +registerWhen(register("chat", (type) => { + Client.showTitle(`${LIGHT_PURPLE + BOLD}EGG SPAWNED!`, `${GOLD}A ${type} Egg ${GOLD}has spawned.`, 10, 50, 10); +}).setCriteria("&r&d&lHOPPITY'S HUNT &r&dA &r${type} Egg &r&dhas appeared!&r"), () => settings.eggTimers && location.getSeason() === "Spring"); From 217647653f9da0fd88f2268fb53d694d590846f3 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 15:22:18 -0400 Subject: [PATCH 30/33] Added comments to location class --- utils/location.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/utils/location.js b/utils/location.js index 3cb3337e..1d44ec91 100644 --- a/utils/location.js +++ b/utils/location.js @@ -37,40 +37,45 @@ class Location { } /** + * Returns Location.#world * - * @returns + * @returns {String} - Current world name i.e. "Gold Mine". */ getWorld() { return this.#world; } /** + * Returns Location.#tier * - * @returns + * @returns {String} - Current tier of Kuudra or 0 if not in Kuudra. */ getTier() { return this.#tier; } /** + * Returns Location.#tier * - * @returns + * @returns {String} - Current server id i.e. "m188AJ". */ getServer() { return this.#server; } /** + * Returns Location.#season * - * @returns + * @returns {String} - Current Skyblock season. */ getSeason() { return this.#season; } /** + * Returns Location.#zone * - * @returns + * @returns {String} - Current zone player is standing in. */ findZone() { let zoneLine = Scoreboard?.getLines()?.find((line) => line.getName().includes("⏣")); @@ -78,6 +83,9 @@ class Location { return zoneLine === undefined ? "None" : zoneLine.getName().removeFormatting(); } + /** + * Used to output current location data to chat for testing. + */ test() { ChatLib.chat( `${LOGO + DARK_AQUA + BOLD}World Test: From 6d83a73ed591ca26dec4c199c63f84403c504049 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 15:24:49 -0400 Subject: [PATCH 31/33] Fixed egg tracking not resetting --- features/event/HippityHoppity.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/event/HippityHoppity.js b/features/event/HippityHoppity.js index 66e64db1..fe827664 100644 --- a/features/event/HippityHoppity.js +++ b/features/event/HippityHoppity.js @@ -137,8 +137,8 @@ registerWhen(register("chat", (type) => { }).setCriteria("HOPPITY'S HUNT You found a Chocolate ${type} Egg ${loc}!"), () => settings.chocoWaypoints); registerWhen(register("chat", (type) => { - looted[type] = true; -}).setCriteria("HOPPITY'S HUNT You found a Chocolate ${type} Egg ${loc}!"), () => settings.chocoWaypoints); + looted[type] = false; +}).setCriteria("HOPPITY'S HUNT A Chocolate ${type} Egg has appeared!"), () => settings.chocoWaypoints); registerWhen(register("step", () => { const stands = World.getAllEntitiesOfType(STAND_CLASS); From 3564d2df20071cfc00adde67cdbea05c6dd44b21 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 15:41:18 -0400 Subject: [PATCH 32/33] Added additional checks for looted eggs --- features/event/HippityHoppity.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/features/event/HippityHoppity.js b/features/event/HippityHoppity.js index fe827664..ea08dd45 100644 --- a/features/event/HippityHoppity.js +++ b/features/event/HippityHoppity.js @@ -130,16 +130,35 @@ export function getEggs() { return eggWaypoints }; // Track if egg was looted. registerWhen(register("chat", (type) => { looted[type] = true; -}).setCriteria("You have already collected this Chocolate ${type} Egg! Try again when it respawns!"), () => settings.chocoWaypoints); +}).setCriteria("You have already collected this Chocolate ${type} Egg! Try again when it respawns!"), +() => (settings.chocoWaypoints || settings.eggTimers) && location.getSeason() === "Spring"); registerWhen(register("chat", (type) => { looted[type] = true; -}).setCriteria("HOPPITY'S HUNT You found a Chocolate ${type} Egg ${loc}!"), () => settings.chocoWaypoints); +}).setCriteria("HOPPITY'S HUNT You found a Chocolate ${type} Egg ${loc}!"), +() => (settings.chocoWaypoints || settings.eggTimers) && location.getSeason() === "Spring"); registerWhen(register("chat", (type) => { looted[type] = false; -}).setCriteria("HOPPITY'S HUNT A Chocolate ${type} Egg has appeared!"), () => settings.chocoWaypoints); +}).setCriteria("HOPPITY'S HUNT A Chocolate ${type} Egg has appeared!"), +() => (settings.chocoWaypoints || settings.eggTimers) && location.getSeason() === "Spring"); +registerWhen(register("tick", () => { + const time = World.getTime() % 24_000; + if (Math.abs(time - 1_000) < 4) looted.Breakfast = false; + else if (Math.abs(time - 8_000) < 4) looted.Lunch = false; + else if (Math.abs(time - 15_000) < 4) looted.Dinner = false; +}), () => (settings.chocoWaypoints || settings.eggTimers) && location.getSeason() === "Spring"); + +register("gameUnload", () => { + looted = { + "Breakfast": false, + "Lunch": false, + "Dinner": false + }; +}); + +// ArmorStand ESP susge, UAYOR registerWhen(register("step", () => { const stands = World.getAllEntitiesOfType(STAND_CLASS); eggWaypoints = []; From 22871c601f6dad9c468e755278f3f809a1ee79c0 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Sun, 28 Apr 2024 15:45:09 -0400 Subject: [PATCH 33/33] Updated pages for v2.9.4 --- docs/_posts/2024-04-28-v2_9_4.md | 32 ++++++++++++++++++++++++++++++++ docs/features.md | 2 ++ 2 files changed, 34 insertions(+) create mode 100644 docs/_posts/2024-04-28-v2_9_4.md diff --git a/docs/_posts/2024-04-28-v2_9_4.md b/docs/_posts/2024-04-28-v2_9_4.md new file mode 100644 index 00000000..4e204a90 --- /dev/null +++ b/docs/_posts/2024-04-28-v2_9_4.md @@ -0,0 +1,32 @@ +--- +layout: post +title: v2.9.4 Temporarily +gh-repo: zhenga8533/VolcAddons +gh-badge: [star, fork, follow] +tags: [release] +comments: true +author: Volcaronitee +--- + +## [Changelog](https://github.com/zhenga8533/VolcAddons/releases/tag/v2.9.4) (download by clicking [here](https://github.com/zhenga8533/VolcAddons/releases/download/v2.9.4/VolcAddons.zip)) + +{: .box-note} +#### New Features +- Added option to render overlay background +- Added choco egg timers +- Added `/viewrecipe` button in GUI + +{: .box-warning} +#### Changes/Fixes +- Changed egg waypoints to dissapear on loot +- Changed `/pesttp` detection +- Changed garden box to be red/green if pests/spray +- Changed pest alert to be slider +- Changed some utils +- Fixed overlay width being off on bold +- Fixed some overlay settings/displays +- Fixed overlay death + +{: .box-error} +#### Deprecated +- None! diff --git a/docs/features.md b/docs/features.md index 34e5c2de..063fe7a0 100644 --- a/docs/features.md +++ b/docs/features.md @@ -14,6 +14,7 @@ subtitle: List of all features and their related commands. - Render Waypoint - Skill Tracker (`/moveSkills`, `/resetSkills`) - **Inventory** + - Recipe Hotkey - Searchbar (`/moveSearch`) - Slot Binding (`/Binds [key]`) - Wardrobe Hotkeys @@ -117,6 +118,7 @@ subtitle: List of all features and their related commands. - **Chocolate Factory** - Chocolate Overlay - Egg Announce + - Egg Timers - Egg Waypoints - Worker Highlight - **Great Spook**