diff options
author | Ninjune <enderknight537@gmail.com> | 2023-01-14 18:51:28 -0600 |
---|---|---|
committer | Ninjune <enderknight537@gmail.com> | 2023-01-14 18:51:28 -0600 |
commit | 8fa7fe39d9edbdd8b00ec238c4e40b6ecd0808cc (patch) | |
tree | 04000ede45a86ebfb76b5b01ad4a169be8234470 | |
parent | 329dccf50ed5e9f87531580f679522238b6a019b (diff) | |
download | coleweight-8fa7fe39d9edbdd8b00ec238c4e40b6ecd0808cc.tar.gz coleweight-8fa7fe39d9edbdd8b00ec238c4e40b6ecd0808cc.tar.bz2 coleweight-8fa7fe39d9edbdd8b00ec238c4e40b6ecd0808cc.zip |
-rw-r--r-- | chat/apiNew.js | 8 | ||||
-rw-r--r-- | chat/grieferTrack.js | 34 | ||||
-rw-r--r-- | commandManager.js | 12 | ||||
-rw-r--r-- | commands/calculate/hotmCalc.js | 4 | ||||
-rw-r--r-- | commands/claim.js | 116 | ||||
-rw-r--r-- | commands/coords/automatons.js | 3 | ||||
-rw-r--r-- | commands/coords/temple.js | 46 | ||||
-rw-r--r-- | commands/drawLine.js | 3 | ||||
-rw-r--r-- | commands/findColeweight.js | 14 | ||||
-rw-r--r-- | commands/help.js | 2 | ||||
-rw-r--r-- | data/collections.json | 26 | ||||
-rw-r--r-- | data/hotm.json | 6 | ||||
-rw-r--r-- | index.js | 1 | ||||
-rw-r--r-- | metadata.json | 2 | ||||
-rw-r--r-- | render/efficientMinerOverlay.js | 189 | ||||
-rw-r--r-- | render/gemstoneMiningStats.js | 23 | ||||
-rw-r--r-- | render/guis/collectionGui.js | 3 | ||||
-rw-r--r-- | render/guis/efficientMinerOverlayGui.js | 113 | ||||
-rw-r--r-- | render/miningAbilities.js | 20 | ||||
-rw-r--r-- | render/treecapTimer.js | 2 | ||||
-rw-r--r-- | settings.js | 51 | ||||
-rw-r--r-- | util/helperFunctions.js | 10 | ||||
-rw-r--r-- | util/renderUtil.js | 93 |
23 files changed, 598 insertions, 183 deletions
diff --git a/chat/apiNew.js b/chat/apiNew.js index 76a2418..36025e3 100644 --- a/chat/apiNew.js +++ b/chat/apiNew.js @@ -7,13 +7,11 @@ register("chat", (key) => { axios.get(`https://api.hypixel.net/key?key=${key}`) .then(res => { if(res.data.success == true) - { - constants.data.api_key = key - constants.data.save() ChatLib.chat(`${PREFIX}&aSuccsessfully set api key!`) - } else - ChatLib.chat(`${PREFIX}&eKey is not valid!`) + ChatLib.chat(`${PREFIX}&eKey might not be valid!`) + constants.data.api_key = key + constants.data.save() }) .catch(err => { ChatLib.chat(`${PREFIX}&eKey is not valid! if this is a mistake report: ${err}`) diff --git a/chat/grieferTrack.js b/chat/grieferTrack.js index a939b45..157696b 100644 --- a/chat/grieferTrack.js +++ b/chat/grieferTrack.js @@ -1,6 +1,7 @@ import axios from "../../axios" import settings from "../settings" import constants from "../util/constants" +import { checkInDwarven, checkInHollows } from "../util/helperFunctions" const PREFIX = constants.PREFIX let checkedPlayers = [], griefers = [] @@ -25,7 +26,7 @@ register("worldLoad", () => { function checkMMiners() { - if (!settings.trackGriefers) return + if (!settings.trackGriefers || (!settings.grieferEverywhere && !(checkInDwarven() || checkInHollows()))) return try { const NetHandlerPlayClient = Client.getConnection(), @@ -36,14 +37,13 @@ function checkMMiners() if(!checkedPlayers.includes(player)) { - griefers.forEach(griefer => { - let dateObj = new Date(0) - dateObj.setUTCMilliseconds(griefer.timestamp) - - if(griefer.name == player) - ChatLib.chat(`${PREFIX}&e'${player}' has griefed &e&l${griefer.offences} &etime(s). Their last grief was on ${dateObj.toString().slice(4, 15)}.`) - }) - checkedPlayers.push(player) + let griefer = findGriefer(player) + + if(griefer.found) + { + ChatLib.chat(`${PREFIX}&e'${player}' has griefed &e&l${griefer.offences} &etime(s). Their last grief was on ${griefer.dateObj.toString().slice(4, 15)}.`) + checkedPlayers.push(player) + } } }) } catch(err) { if(settings.debug) console.log("grieferTrack trycatch: " + err) } @@ -64,4 +64,20 @@ register("gameLoad", () => { }) +export function findGriefer(player) +{ + let grieferReturnObj = {} + grieferReturnObj.found = false + griefers.forEach(griefer => { + griefer.dateObj = new Date(0) + griefer.dateObj.setUTCMilliseconds(griefer.timestamp) + + if(griefer.name.toLowerCase() == player.toLowerCase()) + { + grieferReturnObj = griefer + grieferReturnObj.found = true + } + }) + return grieferReturnObj +} export default ""
\ No newline at end of file diff --git a/commandManager.js b/commandManager.js index f1b6dee..35ccb7a 100644 --- a/commandManager.js +++ b/commandManager.js @@ -10,7 +10,6 @@ import { leaderboard } from "./commands/leaderboard" import { update } from "./commands/update" import { fetchDiscord } from "./commands/fetchDiscord" import { findColeweight } from "./commands/findColeweight" -import { claim } from "./commands/claim" import { time } from "./commands/time" import { info } from "./commands/info" import { credits } from "./commands/credits" @@ -24,7 +23,8 @@ import { throne } from "./commands/coords/throne" import { divans } from "./commands/coords/divans" import { yog } from "./commands/coords/yog" import { automatons } from "./commands/coords/automatons" -import { drawLine } from "./commands/drawline.js" +import { temple } from "./commands/coords/temple.js" +import { drawLine } from "./commands/drawLine.js" register("command", (...args) => { @@ -97,9 +97,6 @@ register("command", (...args) => { case "settings": Settings.openGUI() break - case "claim": - claim(args[1]) - break case "powdertrackersync": updateDisplay() break @@ -123,6 +120,9 @@ register("command", (...args) => { case "automatons": automatons(args[1]) break + case "temple": + temple(args[1]) + break case "coord": case "coords": openCoordsGui() @@ -148,7 +148,7 @@ register("command", (...args) => { reloadOptions = ["coleweight", "collection"], calculateOptions = ["tick", "ms2toprofessional", "hotm", "calchotm"], commands = ["setkey", "help", "move", "toggle", "throne", "spiral", "reload", "leaderboard", - "settings", "claim", "time", "info", "clearlobbies", "yog", "divan", "automatons", "coords", "credits", "track", "calculate", "drawline"] + "settings", "time", "info", "clearlobbies", "yog", "divan", "automatons", "temple", "coords", "credits", "track", "calculate", "drawline"] if(args[0].length == 0 || args[0] == undefined) return output = commands diff --git a/commands/calculate/hotmCalc.js b/commands/calculate/hotmCalc.js index 7fa947c..1b449d4 100644 --- a/commands/calculate/hotmCalc.js +++ b/commands/calculate/hotmCalc.js @@ -20,7 +20,7 @@ export function hotmCalc(hotmName, minLevel, maxLevel) if(maxLevel == undefined) { maxLevel = minLevel - minLevel = 1 + minLevel = 2 } if(minLevel != parseInt(minLevel) || maxLevel != parseInt(maxLevel)) return ChatLib.chat(constants.CALCULATEERRORMESSAGE) @@ -74,5 +74,5 @@ export function findCost(costFormula, minLevel, maxLevel, fortunate = false) export function findReward(rewardFormula, minLevel, maxLevel) { - return eval(rewardFormula.replace("Level", 1+maxLevel-minLevel)) + return eval(rewardFormula.replace("Level", 2+maxLevel-minLevel)) }
\ No newline at end of file diff --git a/commands/claim.js b/commands/claim.js deleted file mode 100644 index a8c51c6..0000000 --- a/commands/claim.js +++ /dev/null @@ -1,116 +0,0 @@ -import axios from "../../axios" -import settings from "../settings" -import constants from "../util/constants" -const PREFIX = constants.PREFIX -const path = `https://ninjune.dev` -const serverId = java.util.UUID.randomUUID().toString().replace("-", "") -let claimedServers = [] - - -export function claim(structure) -{ - if(!settings.claiming) - { - ChatLib.chat(`${PREFIX}&cPlease turn on the &3Claiming&c setting in /cw settings!`) - return - } - - if (constants.serverData.map != "Crystal Hollows") - { - ChatLib.chat(`${PREFIX}&cThis command is only available in the crystal hollows!`) - return - } - - if (structure == undefined || !(structure.toLowerCase() == "throne" || structure.toLowerCase() == "spiral")) - { - ChatLib.chat(`${PREFIX}&cPlease enter the structure you wish to claim! (&3throne&c or &3spiral&c)`) - return - } - - axios.get(`${path}/api/claim?type=${structure}&lobby=${constants.serverData.server}&username=${Player.getName()}&serverID=${serverId}`) - .then(res => { - if(res.data.success) - { - ChatLib.chat(`${PREFIX}&aSuccessfully claimed ${constants.serverData.server} as your server!`) - claimedServers.push({player: Player.getName(), server: constants.serverData.server, structure: structure}) - return - } - else - { - - if(res.data.code == 501) - { - ChatLib.chat(`${PREFIX}&cError: Not logged into the auth server. Try running the command again.`) - return Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId) - } - else - return ChatLib.chat(`${PREFIX}&cError: ${res.data.reason}.`) - } - }) - .catch(err => { - return ChatLib.chat(`${PREFIX}&cError: ${err}`) - }) -} - - -register('gameLoad', (event) => { - try - { - Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId) - } - catch(e) {} - getClaimed() -}) - - -register('worldLoad', () => { - if(!settings.claiming) return - setTimeout(() => { - const NetHandlerPlayClient = Client.getConnection(), - PlayerMap = NetHandlerPlayClient.func_175106_d() // getPlayerInfoMap - let player - - if(settings.debug) console.log(constants.serverData.server) - - claimedServers.forEach((claimedServer) => { - PlayerMap.filter(player => player.func_178853_c() > 0 && !player.func_178845_a().name.startsWith("!")).forEach((PlayerMP) => { - player = PlayerMP.func_178845_a().name - - if (player == claimedServer.player && claimedServer.server == constants.serverData.server) - ChatLib.chat(`${PREFIX}&cThe ${claimedServer.structure} in ${claimedServer.server} is claimed by ${claimedServer.player}.`) - }) - - if (Player.getName() == claimedServer.player) - { - axios.get(`${path}/api/unclaim?username=${Player.getName()}&serverID=${serverId}`) - .then(res => { - if(settings.debug && !res.data.success) - ChatLib.chat("Unclaim: " + res.data.reason) - if(res.data.code == 501) - Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId) - }) - .catch(err => { - if(settings.debug) - ChatLib.chat(`${PREFIX}&cError: ${err}`) - }) - } - }) - }, 2000) -}) - - -function getClaimed() -{ - axios.get(`${path}/api/claimed?authServer=${serverId}&passedName=${Player.getName()}`) - .then(res => { - if(res.data.code == 501) - { - Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId) - return - } - claimedServers = [] - res.data.forEach(server => { - claimedServers.push(server) - }) - }) -} diff --git a/commands/coords/automatons.js b/commands/coords/automatons.js index 4114eec..3284edf 100644 --- a/commands/coords/automatons.js +++ b/commands/coords/automatons.js @@ -24,10 +24,9 @@ export function automatons(arg) y = startPos[1], z = startPos[2] - let coordsRows = FileLib.read("Coleweight", "data/automatons.txt").split("\r\n") + let coordsRows = FileLib.read("Coleweight", "data/automatons.txt").split("\n") coordsRows.forEach(unsplitRow => { let row = unsplitRow.split(" ") - waypoints.push([x + parseInt(row[0]), y + parseInt(row[1]), z + parseInt(row[2])]) }) diff --git a/commands/coords/temple.js b/commands/coords/temple.js new file mode 100644 index 0000000..f60e724 --- /dev/null +++ b/commands/coords/temple.js @@ -0,0 +1,46 @@ +import constants from "../../util/constants" +import { waypointRender } from "../../util/helperFunctions" + +const PREFIX = constants.PREFIX +let waypoints = [] + +export function temple(arg) +{ + const WAYPOINTNAME = "Temple" + + if(arg != "toggle") + { + new TextComponent(`${PREFIX}&bStand on the leftmost key guardian and do /cw ${WAYPOINTNAME} toggle`) + .chat() + } + else + { + if(waypoints[0] == undefined) + { + let startPos = [Player.getX(), Player.getY(), Player.getZ()], + x = startPos[0], + y = startPos[1], + z = startPos[2] + + waypoints.push([x + 61, y + -44, z + 18]) + + ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned on!`) + } + else + { + waypoints = [] + ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned off!`) + } + } +} + +register("renderWorld", () => { + waypointRender(waypoints) +}) + + +register("worldLoad", () => { + waypoints = [] +}) + +export default ""
\ No newline at end of file diff --git a/commands/drawLine.js b/commands/drawLine.js index 7fd9742..1374dea 100644 --- a/commands/drawLine.js +++ b/commands/drawLine.js @@ -1,5 +1,5 @@ import constants from "../util/constants" -import { trace } from "../util/renderUtil" +import { trace, drawEspBox } from "../util/renderUtil" const PREFIX = constants.PREFIX let x = 0, @@ -39,4 +39,5 @@ register("renderWorld", () => { if(x == 0 && y == 0 && z == 0) return trace(x, y, z, 0, 0, 1, 0.86) + drawEspBox(x, y, z, 0, 0, 1, 0.86) // y no work })
\ No newline at end of file diff --git a/commands/findColeweight.js b/commands/findColeweight.js index ace0ec6..a2c5156 100644 --- a/commands/findColeweight.js +++ b/commands/findColeweight.js @@ -1,4 +1,6 @@ import axios from "../../axios" +import { findGriefer } from "../chat/grieferTrack" +import settings from "../settings" import constants from "../util/constants" const PREFIX = constants.PREFIX @@ -12,11 +14,17 @@ export function findColeweight(arg) username = arg axios.get(`https://ninjune.dev/api/coleweight?username=${username}`) .then(res => { - let coleweightMessage = new TextComponent(`${PREFIX}&b${res.data.rank}. ${res.data.name}&b's Coleweight: ${res.data.coleweight} (Top &l${res.data.percentile}&b%)`) - .setHoverValue(`&fExperience&f: &a${Math.round(res.data.experience.total*100) / 100}\n&fPowder&f: &a${Math.round(res.data.powder.total*100) / 100}\n&fCollection&f: &a${Math.round(res.data.experience.total*100) / 100}\n&fMiscellaneous&f: &a${Math.round(res.data.miscellaneous.total*100) / 100}`) + let griefer = findGriefer(username), coleweightMessage + console.log(griefer.offenses) + if(griefer.found) + coleweightMessage = new TextComponent(`${PREFIX}&b${res.data.rank}. ${res.data.name}&b's Coleweight: ${res.data.coleweight} (Top &l${res.data.percentile}&b%) &c&lGriefed ${griefer.offences} time(s) &c(last grief: &a${griefer.dateObj.toString().slice(4, 15)}&c)`) + else + coleweightMessage = new TextComponent(`${PREFIX}&b${res.data.rank}. ${res.data.name}&b's Coleweight: ${res.data.coleweight} (Top &l${res.data.percentile}&b%)`) + coleweightMessage.setHoverValue(`&fExperience&f: &a${Math.round(res.data.experience.total*100) / 100}\n&fPowder&f: &a${Math.round(res.data.powder.total*100) / 100}\n&fCollection&f: &a${Math.round(res.data.collection.total*100) / 100}\n&fMiscellaneous&f: &a${Math.round(res.data.miscellaneous.total*100) / 100}`) ChatLib.chat(coleweightMessage) }) .catch(err => { - ChatLib.chat(`${PREFIX}&eError. (api may be down)`) + if(settings.debug) ChatLib.chat(`${PREFIX}&eError. (api may be down) ${err}`) + else ChatLib.chat(`${PREFIX}&eError. (api may be down)`) }) }
\ No newline at end of file diff --git a/commands/help.js b/commands/help.js index f46cc2c..69abcee 100644 --- a/commands/help.js +++ b/commands/help.js @@ -13,7 +13,6 @@ export function help() helpCommand("info", "Prints coleweight info.", "") ChatLib.chat(ChatLib.getCenteredText("&a&lSettings")) helpCommand("settings", "Opens settings.", "") - helpCommand("claim", "Claims a chollows sapphire structure in a lobby.", "(throne || spiral)") helpCommand("setkey", "Sets API key (can also use /api new)", "(key)") helpCommand("reload", "Reloads the gui.", "") helpCommand("track", "Sets tracked collection for collection tracker.", "(collection)") @@ -23,6 +22,7 @@ export function help() helpCommand("spiral", "Guide for setting up waypoints for spiral", "[toggle]") helpCommand("yog", "Shows instructions for yog waypoints.", "[toggle]") helpCommand("divans", "Guide for setting up waypoints for Mines of Divan treasures.", "[toggle]") + helpCommand("jungle", "Guide for setting up temple clip waypoint (nuc runs).", "[toggle]") ChatLib.chat(ChatLib.getCenteredText("&a&lMiscellaneous")) helpCommand("drawline", "Draws a line to coords. (y defaults to the player's y)", "(x) [y] (z)") ChatLib.chat(`&a${PREFIX} /fetchdiscord (username) => &bGets discord of username (if linked)`) diff --git a/data/collections.json b/data/collections.json index e61a942..db90b8f 100644 --- a/data/collections.json +++ b/data/collections.json @@ -54,7 +54,7 @@ "collectionToTrack": "EMERALD", "collectionStringed": "Emerald" }, - "endstone": + "end": { "collectionToTrack": "ENDER_STONE", "collectionStringed": "Endstone" @@ -77,11 +77,31 @@ "quartz": { "collectionToTrack": "QUARTZ", - "collectionStringed": "Endstone" + "collectionStringed": "Quartz" }, "cobblestone": { "collectionToTrack": "COBBLESTONE", "collectionStringed": "Cobblestone" - } + }, + "hard": + { + "collectionToTrack": "HARD_STONE", + "collectionStringed": "Hard Stone" + }, + "red": + { + "collectionToTrack": "SAND:1", + "collectionStringed": "Red Sand" + }, + "sand": + { + "collectionToTrack": "SAND", + "collectionStringed": "Sand" + }, + "gravel": + { + "collectionToTrack": "GRAVEL", + "collectionStringed": "Gravel" + } }
\ No newline at end of file diff --git a/data/hotm.json b/data/hotm.json index 8d27a20..d0c31e8 100644 --- a/data/hotm.json +++ b/data/hotm.json @@ -25,8 +25,8 @@ "powderType": "mithril" }, { - "costFormula": "200+((currentLevel-1)*18)", - "rewardFormula": "(200+((Level-1)*18))*2", + "costFormula": "Math.pow((currentLevel+1), 3.1)", + "rewardFormula": "2+(Level*0.1)", "nameStringed": "Titanium Insanium", "names": ["titaniuminsanium", "titanium", "tita"], "maxLevel": 50, @@ -35,7 +35,7 @@ { "costFormula": "200+((currentLevel-1)*18)", "rewardFormula": "(200+((Level-1)*18))*2", - "nameStringed": "Titanium Insanium", + "nameStringed": "Daily powder", "names": ["dailypowder"], "maxLevel": 100, "powderType": "mithril" @@ -1,5 +1,6 @@ import './render/naturals' import './render/tabList' +import './render/efficientMinerOverlay' import './render/gemstoneMiningStats' import './render/dwarvenNotifier' import './render/treecapTimer' diff --git a/metadata.json b/metadata.json index e87d02a..84a02ed 100644 --- a/metadata.json +++ b/metadata.json @@ -3,6 +3,6 @@ "creator": "Ninjune", "entry": "index.js", "description": "Mining utilities.", - "version": "1.8.3", + "version": "1.8.7", "requires": ["axios", "PogData", "Vigilance", "Elementa"] }
\ No newline at end of file diff --git a/render/efficientMinerOverlay.js b/render/efficientMinerOverlay.js new file mode 100644 index 0000000..cd6468d --- /dev/null +++ b/render/efficientMinerOverlay.js @@ -0,0 +1,189 @@ +import { drawEspBox, trace } from "../util/renderUtil" +import settings from "../settings" + +let blockStatesToFind = [ + {name: "minecraft:wool[color=light_blue]", prio: 2}, + {name: "minecraft:obsidian", prio: 0}, + {name: "minecraft:prismarine[variant=prismarine_bricks]", prio: 0}, + {name: "minecraft:prismarine[variant=prismarine_bricks]", prio: 0}, + {name: "minecraft:prismarine[variant=prismarine]", prio: 0}] +let threadActive = false, + maxPrio = -10000000, + drawBlocks = [], + lookingAt + +let thread = new Thread(() => { + threadActive = true + let tempPrio, tempMax = { prio: -100000 }, tempSecondMax = { prio: -100000 }, block, blockState, tempBlocks = [] + + const playerX = Player.getX(), + playerY = Player.getY(), + playerZ = Player.getZ(), + playerReach = 4 + + if(playerX == undefined || playerY == undefined || playerZ == undefined || !World.isLoaded()) { threadActive = false; return thread.stop() } + + + for(let x = Math.round(playerX-playerReach); x < Math.ceil(playerX+playerReach); x++) + { + for(let y = Math.round(playerY-playerReach); y < Math.ceil(playerY+playerReach); y++) + { + for(let z = Math.round(playerZ-playerReach); z < Math.ceil(playerZ+playerReach); z++) + { + block = World.getBlockAt(x, y, z) + blockState = block.getState().toString() + + if(blockStatesToFind.some(obj => obj.name === blockState) && isVisible(x, y, z)) + { + tempPrio = findPrio(x, y, z, blockState, blockStatesToFind[blockStatesToFind.findIndex(obj => obj.name === blockState)].prio) + tempBlocks.push({x: Math.round(x) + 0.5, y: y, z: Math.round(z) + 0.5, prio: tempPrio}) + } + } + } + } + for(let i = 0; i < tempBlocks.length; i++) + { + if(tempBlocks[i].prio > tempMax.prio) + { + tempMax = tempBlocks[i] + } + if(tempBlocks[i].prio > tempSecondMax.prio && tempBlocks[i].prio < tempMax.prio) + { + tempSecondMax = tempBlocks[i] + } + } + + if(tempMax == undefined || tempSecondMax == undefined) drawBlocks = [] + else if(drawBlocks[0] != undefined && drawBlocks[1] != undefined && drawBlocks[0].x != undefined && drawBlocks[1].x != undefined && + World.getBlockAt(drawBlocks[0].x, drawBlocks[0].y, drawBlocks[0].z).type.getRegistryName() === "minecraft:bedrock") // if player just mined block + { + drawBlocks[0] = drawBlocks[1] + threadActive = false + drawBlocks[1] = tempSecondMax + } + else + { + drawBlocks[0] = tempMax + drawBlocks[1] = tempSecondMax + maxPrio = tempMax.prio + } + + threadActive = false +}) + + +register("renderWorld", () => { + if(!settings.efficientMinerOverlay || drawBlocks.length < 2 || drawBlocks[0] == undefined || drawBlocks[1] == undefined + || drawBlocks[0].x == undefined || drawBlocks[1].x == undefined) return + + try{ + trace(drawBlocks[0].x, drawBlocks[0].y + 5/10, drawBlocks[0].z, 1, 0, 0.3, 0.7, true) + drawEspBox(drawBlocks[0].x, drawBlocks[0].y, drawBlocks[0].z, 1, 0, 0.3, 0.7, true) + drawEspBox(drawBlocks[1].x, drawBlocks[1].y, drawBlocks[1].z, 1, 0.5, 0.3, 0.7, true) + } catch(err) {if(settings.debug) console.log(err)} + +}) + +/*register("step", () => { // debug, comment when done + +}).setFps(1)*/ + +register("step", () => { + if(!threadActive) + thread.start() +}).setFps(20) + +register("gameUnload", () => { + thread.stop() +}) + + +function findPrio(originX, originY, originZ, blockStateToFind, prio) +{ + let radius = 2 + 1/2, + blockCount = 0, + rayTraceX, rayTraceY, rayTraceZ + if(Player.lookingAt() != undefined && Player.lookingAt()?.getRegistryName() != "minecraft:air") + lookingAt = Player.lookingAt() + + if(lookingAt != undefined) + { + rayTraceX = lookingAt.getX() + rayTraceY = lookingAt.getY() + rayTraceZ = lookingAt.getZ() + } + + + for(let x = Math.round(originX-radius); x < Math.round(originX+radius); x++) // second cube + { + for(let y = Math.round(originY-radius); y < Math.round(originY+radius); y++) + { + for(let z = Math.round(originZ-radius); z < Math.round(originZ+radius); z++) + { + if(World.getBlockAt(x, y, z)?.getState()?.toString() === blockStateToFind) + { + if(checkConnectedBlocks(x, y, z, originX, originY, originZ, blockStateToFind, 2.5)) + blockCount++ + } + else if (World.getBlockAt(x, y, z)?.getState()?.toString() === "minecraft:stone[variant=smooth_diorite]") + { + if(prio > 0) + prio = 0 + else + prio += 2/10 + } + + // RAYTRACE + if(lookingAt != undefined) + { + prio -= Math.abs(rayTraceX - x)/100 // = 0.01 per block of distance + prio -= Math.abs(rayTraceY - y)/100 + prio -= Math.abs(rayTraceZ - z)/100 + } + + } + } + } + if(blockCount > 6) + blockCount = 6 + prio += blockCount*3/10 + + return Math.round(prio*100)/100 +} + +function isVisible(x, y, z) +{ + if(World.getBlockAt(x, y, z).type.getRegistryName() === "minecraft:bedrock") return false + if (World.getBlockAt(x, y+1, z).type.getRegistryName() === "minecraft:air") return true // above + if (World.getBlockAt(x, y-1, z).type.getRegistryName() === "minecraft:air") return true // below + if (World.getBlockAt(x+1, y, z).type.getRegistryName() === "minecraft:air") return true // east + if (World.getBlockAt(x-1, y, z).type.getRegistryName() === "minecraft:air") return true // west + if (World.getBlockAt(x, y, z+1).type.getRegistryName() === "minecraft:air") return true // north + if (World.getBlockAt(x, y, z-1).type.getRegistryName() === "minecraft:air") return true // south + + return false +} + + +function checkConnectedBlocks(x, y, z, originX, originY, originZ, blockStateToFind, distance) { + if (World.getBlockAt(x, y, z).getState().toString() !== blockStateToFind) { + return false; + } + if (Math.abs(x - originX) + Math.abs(y - originY) + Math.abs(z - originZ) > distance) { + return false; + } + + for (let dx = -1; dx <= 1; dx++) { + for (let dy = -1; dy <= 1; dy++) { + for (let dz = -1; dz <= 1; dz++) { + if (dx === 0 && dy === 0 && dz === 0) { + continue; + } + if (!checkConnectedBlocks(x + dx, y + dy, z + dz, distance)) { + return false; + } + } + } + } + return true; +}
\ No newline at end of file diff --git a/render/gemstoneMiningStats.js b/render/gemstoneMiningStats.js index b0bf4b8..40eed1a 100644 --- a/render/gemstoneMiningStats.js +++ b/render/gemstoneMiningStats.js @@ -5,7 +5,7 @@ import { addCommas, getSelectedProfile } from "../util/helperFunctions" import axios from "../../axios" import { findCost, findHotmObject } from "../commands/calculate/hotmCalc" const NBTTagString = Java.type("net.minecraft.nbt.NBTTagString") - +let powderTotals = {} register("itemTooltip", (lore, item) => { // this is so bad 💀 if(!item.getLore()[0].startsWith("§o§aYour SkyBlock Profile") || !settings.gemstoneMiningStats) return @@ -62,8 +62,17 @@ register("itemTooltip", (lore, item) => { // this is so bad 💀 register("gameLoad", () => { axios.get(`https://api.hypixel.net/skyblock/profiles?key=${constants.data.api_key}&uuid=${Player.getUUID()}`) .then(res => { - let professional = getSelectedProfile(res)?.members[Player.getUUID().replace(/-/g, "")]?.mining_core?.nodes?.professional, - fortunate = getSelectedProfile(res)?.members[Player.getUUID().replace(/-/g, "")]?.mining_core?.nodes?.fortunate + let + selected = getSelectedProfile(res)?.members[Player.getUUID().replace(/-/g, "")] + professional = selected?.mining_core?.nodes?.professional, + fortunate = selected?.mining_core?.nodes?.fortunate + + powderTotals = { + gemstone: (selected?.mining_core?.powder_gemstone_total ?? 0) + + (selected?.mining_core?.powder_spent_gemstone ?? 0), + mithril: (selected?.mining_core?.powder_mithril_total ?? 0) + + (selected?.mining_core?.powder_spent_mithril ?? 0) + } if(professional != undefined) constants.data.professional = professional @@ -106,16 +115,16 @@ register("itemTooltip", (lore, item) => { // powder put into each perk let perk = item.getLore()[0].replace(/§.|\(.+\)/g, "").replace(/ /g, "") let level = /Level (\d+)/g.exec(item.getLore()[1])[1] let hotmObjectToFind = findHotmObject(perk) - if(hotmObjectToFind == undefined) return + if(hotmObjectToFind == undefined || (hotmObjectToFind.costFormula == undefined && perk != "Fortunate")) return let powderSum if(perk == "Fortunate") - powderSum = findCost(undefined, 1, parseInt(level), true) + powderSum = findCost(undefined, 2, parseInt(level), true) else - powderSum = findCost(hotmObjectToFind.costFormula, 1, parseInt(level)) + powderSum = findCost(hotmObjectToFind.costFormula, 2, parseInt(level)) if(item.getLore()[1].includes("💀")) return - list.set(0, new NBTTagString(item.getLore()[1] + ` §7(§b${addCommas(Math.round(powderSum))}§7)💀`)) // this is a perfect solution no cap + list.set(0, new NBTTagString(item.getLore()[1] + ` §7(§b${addCommas(Math.round(powderSum))} §l${Math.round(powderSum/powderTotals[hotmObjectToFind.powderType]*100)}%§7)💀`)) // this is a perfect solution no cap }).start() })
\ No newline at end of file diff --git a/render/guis/collectionGui.js b/render/guis/collectionGui.js index 8f96d4a..3764fcf 100644 --- a/render/guis/collectionGui.js +++ b/render/guis/collectionGui.js @@ -2,7 +2,6 @@ import constants from "../../util/constants" import settings from "../../settings" import { trackerGui } from "../../util/helperFunctions" const PREFIX = constants.PREFIX -const collectionMoveGui = new Gui() const collectionGui = new trackerGui("", "Collection Not set! /cw track", settings.collectionNotation) @@ -37,7 +36,7 @@ register("dragged", (dx, dy, x, y) => { }) register("renderOverlay", () => { - collectionGui.renderGui(constants.collectiondata.x, constants.collectiondata.y, settings.collectionNotation, settings.collectionTracker) + collectionGui.renderGui(constants.collectiondata.x, constants.collectiondata.y, settings.collectionTracker, settings.collectionNotation, settings.showCollectionTrackerAlways) }) register("step", () => { diff --git a/render/guis/efficientMinerOverlayGui.js b/render/guis/efficientMinerOverlayGui.js new file mode 100644 index 0000000..8c2f609 --- /dev/null +++ b/render/guis/efficientMinerOverlayGui.js @@ -0,0 +1,113 @@ +/*import { // after careful consideration I have decided not to make this with elementa, if anyone wants to make it for me (be it with elementa or Renderer) make https://imgur.com/a/D0XpIUx, dm Ninjune#0670 if need help + AdditiveConstraint, + CenterConstraint, + ConstantColorConstraint, + UIBlock, + UIImage, + UIWrappedText, + UIText, + WindowScreen, + } from "../../../Elementa" + +const Color = Java.type("java.awt.Color"), + URL = Java.type("java.net.URL"), + COORDS_WIDTH = 3.5, // not actually width more like reverse of width lmao, bigger = smaller + COORDS_HEIGHT = 2.877 // ^ + ITEM_WIDTH = 3.5, + ITEM_HEIGHT = 2.877 +let ScreenW = Renderer.screen.getWidth(), + ScreenH = Renderer.screen.getHeight(), + itemCount = 0 + + class itemGui + { + constructor(item) + { + this.item = item + itemCount++ + + const textWindow = new UIBlock(new Color(0, 0, 0, 0.5)) // 320 960 + .setX(new CenterConstraint()) + .setY((ScreenH/2*itemCount + ScreenH/10.8).pixels()) + .setWidth((ScreenW/ITEM_WIDTH).pixels()) + .setHeight((ScreenH/ITEM_HEIGHT).pixels()) + .onMouseClick(() => { + ChatLib.command(command, true) + }) + new UIText(this.item, false) + .setX(new RelativeConstraint()) + .setY((2).pixels()) + .setTextScale((1).pixels()) + .setColor(new ConstantColorConstraint(Color.WHITE)) + .setChildOf(textWindow) + } +} + +function coordsWindow(row, column, title, command, desc, image=false, alternateText="") +{ + const coordWindow = new UIBlock(new Color(0, 0, 0, 0.5)) // 320 960 + .setX(((ScreenW/3*(column))-ScreenW/3.25).pixels()) + .setY((ScreenH/2*(row-1)+ScreenH/10.8).pixels()) + .setWidth((ScreenW/COORDS_WIDTH).pixels()) + .setHeight((ScreenH/COORDS_HEIGHT).pixels()) + .onMouseClick(() => { + ChatLib.command(command, true) + }) + new UIText(title, false) + .setX(new CenterConstraint()) + .setY((2).pixels()) + .setTextScale((2).pixels()) + .setColor(new ConstantColorConstraint(Color.GREEN.darker())) + .setChildOf(coordWindow) + if(image == true) + { + new UIWrappedText(alternateText) + .setX((12).pixels()) + .setY((25).pixels()) + .setWidth((ScreenW/5).pixels()) + .setTextScale((1).pixels()) + .setColor(new ConstantColorConstraint(Color.WHITE)) + .setChildOf(coordWindow) + new UIImage.ofURL(new URL(desc)) + .setX(new CenterConstraint()) + .setY(new AdditiveConstraint(new CenterConstraint(), (4).pixels())) + .setWidth((ScreenW/3.7).pixels()) + .setHeight((ScreenH/3.7).pixels()) + .setChildOf(coordWindow) + } + else + { + new UIWrappedText(desc) + .setX((2).pixels()) + .setY((25).pixels()) + .setWidth((ScreenW/3.7).pixels()) + .setTextScale((1).pixels()) + .setColor(new ConstantColorConstraint(Color.WHITE)) + .setChildOf(coordWindow) + } + + return coordWindow +} + +export function openCoordsGui() +{ + ScreenW = Renderer.screen.getWidth() + ScreenH = Renderer.screen.getHeight() + const CoordsGui = new JavaAdapter(WindowScreen, { + init() { + coordsWindow(1, 1, "Spiral", "cw spiral toggle", "https://i.imgur.com/dyL30GD.png", true, "Do /cw spiral to see image. (image isn't loading.)").setChildOf(this.getWindow()) + coordsWindow(1, 2, "Throne", "cw throne toggle", "https://i.imgur.com/7BWzO1c.jpg", true, "Go back of throne. (image isn't loading)").setChildOf(this.getWindow()) + coordsWindow(1, 3, "Yog", "cw yog toggle", "https://i.imgur.com/DojoypL.jpg", true, "Go to the leftmost corner of the topaz crystal facing bal close to bal. (image isn't loading)").setChildOf(this.getWindow()) + coordsWindow(2, 1, "Divans", "cw divans toggle", "https://i.imgur.com/bkC6yp3.jpg", true, "Go to the middle of jade crystal. (image isn't loading)").setChildOf(this.getWindow()) + coordsWindow(2, 2, "Automatons", "cw automatons toggle", "https://media.discordapp.net/attachments/1049475464667856926/1052749218055475210/image.png", true, "Sit in pot somewhere (check image in command) (image isn't loading)").setChildOf(this.getWindow()) + new UIText("Click box to enable/disable.") + .setX(new CenterConstraint()) + .setY((ScreenH-ScreenH/12).pixels()) + .setTextScale((2).pixels()) + .setColor(Color.WHITE) + .setChildOf(this.getWindow()) + }, + }) + CoordsGui.init() + GuiHandler.openGui(CoordsGui) +}*/
\ No newline at end of file diff --git a/render/miningAbilities.js b/render/miningAbilities.js index 4663327..41113ed 100644 --- a/render/miningAbilities.js +++ b/render/miningAbilities.js @@ -68,6 +68,19 @@ register("step", () => { register("chat", (abilityName, event) => { let found = false + let timer + + switch(capitalizeFirst(abilityName)) + { + case "Pickobulus": + timer = 110 + break + case "Vein seeker": + timer = 60 + break + default: + timer = 120 + } activeAbilities.forEach(ability => { if(ability.name == capitalizeFirst(abilityName)) @@ -75,16 +88,13 @@ register("chat", (abilityName, event) => { found = true drawTimestamp = undefined ability.drawTitle = 0 - if (capitalizeFirst(abilityName) === "Pickobulus") - ability.timer = 110 - else - ability.timer = 120 + ability.timer = timer } }) if (!found) { - let object = {timer: capitalizeFirst(abilityName) === "Pickobulus" ? 110 : 120, name: capitalizeFirst(abilityName), drawTitle: 0, drawTimestamp: undefined} + let object = {timer: timer, name: capitalizeFirst(abilityName), drawTitle: 0, drawTimestamp: undefined} activeAbilities.push(object) } diff --git a/render/treecapTimer.js b/render/treecapTimer.js index 3d9ecef..51352ef 100644 --- a/render/treecapTimer.js +++ b/render/treecapTimer.js @@ -7,7 +7,7 @@ monkeyLevel = 0 register("renderOverlay", () => { if(!settings.treecapTimer || !checkInPark()) return // ChatLib.chat(Player.getHeldItem().getItemNBT().getTag('tag').getTag('ExtraAttributes').getTag("id").toString()) - let itemId = Player?.getHeldItem()?.getItemNBT()?.getTag('tag')?.getTag('ExtraAttributes')?.getTag("id")?.toString() + let itemId = Player.getHeldItem()?.getItemNBT()?.getTag('tag')?.getTag('ExtraAttributes')?.getTag("id")?.toString() if(!(itemId == `"TREECAPITATOR_AXE"` || itemId == `"ASPECT_OF_THE_VOID"` || Player?.getHeldItem()?.getRegistryName() == "minecraft:fishing_rod")) return let txt = Math.ceil(treecapCooldown*10)/10 Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2 - Renderer.screen.getHeight()/25) diff --git a/settings.js b/settings.js index c49b803..5928ae6 100644 --- a/settings.js +++ b/settings.js @@ -2,7 +2,7 @@ import { @Vigilant, @ButtonProperty, @SwitchProperty, @SelectorProperty, @Slider @Vigilant("Coleweight/config", "Coleweight Settings", { getCategoryComparator: () => (a, b) => { - const categories = ["General", "Powdertracker", "Naturals", "Gui", "Stats", "Foraging"]; + const categories = ["General", "Naturals", "Gui", "Stats", "Foraging"]; return categories.indexOf(a.name) - categories.indexOf(b.name); } @@ -52,12 +52,12 @@ class Settings { trackGriefers = true; @SwitchProperty({ - name: "Claiming", - description: "Enables lobby claiming (/claim).", + name: "Griefer messages everywhere", + description: "Makes griefer messages appear in all lobbies (not just CH/DM)", subcategory: "Random Features", category: "General" }) - claiming = true; + grieferEverywhere = false; @SwitchProperty({ name: "Dwarven notifier", @@ -95,6 +95,14 @@ class Settings { } @SwitchProperty({ + name: "Efficient Miner Overlay", + description: "Points towards the best block to break with efficient miner. (Also dwarven mines mithril overlay)", + subcategory: "Efficient Miner Overlay", + category: "Gui" + }) + efficientMinerOverlay = false; + + @SwitchProperty({ name: "Collection tracker", description: "Tracks collections ('/cw track (collection)' to set).", subcategory: "Collection", @@ -110,6 +118,14 @@ class Settings { }) collectionNotation = true; + @SwitchProperty({ + name: "Collection show always", + description: "Changes collection tracker to show always.", + subcategory: "Collection", + category: "Gui" + }) + showCollectionTrackerAlways = false; + @ButtonProperty({ name: "Change collection tracker position", description: "Move the location of the collection tracker.", @@ -120,7 +136,7 @@ class Settings { moveCollectionLocation() { ChatLib.command("cw move collection", true); } - + @SwitchProperty({ name: "Marked lobbies", description: "Enables lobby marking (automatic).", @@ -198,28 +214,32 @@ class Settings { @SwitchProperty({ // Powdertracker name: "Show powdertracker", description: "If the tracker overlay should be visible.", - category: "Powdertracker" + subcategory: "Powdertracker", + category: "Gui" }) trackerVisible = false; @SwitchProperty({ name: "Show totals", description: "If the tracker should show the total amount.", - category: "Powdertracker" + subcategory: "Powdertracker", + category: "Gui" }) showTotals = true; @SwitchProperty({ name: "Show rates", description: "If the tracker should show the estimated rates per hour.", - category: "Powdertracker" + subcategory: "Powdertracker", + category: "Gui" }) showRates = true; @SelectorProperty({ name: "Alignment", description: "Sets the alignment of the tracker.", - category: "Powdertracker", + subcategory: "Powdertracker", + category: "Gui", options: ["Left", "Right", "Center"] }) trackerAlignment = 0; @@ -227,7 +247,8 @@ class Settings { @ButtonProperty({ name: "Change Powdertracker position", description: "Move the location of the powdertracker.", - category: "Powdertracker", + subcategory: "Powdertracker", + category: "Gui", placeholder: "Open" }) movePowderLocation() { @@ -290,8 +311,8 @@ class Settings { this.registerListener("Track griefers", value => { this.trackGriefers = value; }) - this.registerListener("Claiming", value => { - this.claiming = value; + this.registerListener("Griefer messages everywhere", value => { + this.grieferEverywhere = value; }) this.registerListener("Dwarven notifier", value => { this.dwarvenNotifier = value; @@ -317,12 +338,18 @@ class Settings { this.registerListener("Downtime tracker", value => { this.downtimeTracker = value; }) + this.registerListener("Efficient Miner Overlay", value => { + this.efficientMinerOverlay = value; + }) this.registerListener("Collection tracker", value => { this.collectionTracker = value; }) this.registerListener("Collection notation", value => { this.collectionNotation = value; }) + this.registerListener("Collection show always", value => { + this.showCollectionTrackerAlways = value; + }) this.registerListener("Show powdertracker", value => { this.trackerVisible = value; }) diff --git a/util/helperFunctions.js b/util/helperFunctions.js index ea91b68..b731e10 100644 --- a/util/helperFunctions.js +++ b/util/helperFunctions.js @@ -172,8 +172,9 @@ export class trackerGui this.collectionMoveGui = new Gui() } - renderGui(x, y, notation = false, renderGui = true) // can only be called in renderOverlay + renderGui(x, y, toggle = true, notation = false, alwaysShow = false) // can only be called in renderOverlay { + if(!toggle) return let leftValues = [`${this.itemStringed}`, `${this.itemStringed}/hr`, `${this.itemStringed} gained`, "Uptime"] this.itemGui.x = x this.itemGui.y = y @@ -189,8 +190,8 @@ export class trackerGui return this.itemGui.renderGui() } - if(!renderGui) return - if(this.itemValues[0] != undefined && /*this.trackingItem && */this.calcItemPerHour) + if(!toggle || !(alwaysShow || this.trackingItem || this.trackedItem == "")) return + if(this.itemValues[0] != undefined && this.calcItemPerHour) { this.itemValuesSum = 0 for(let i = 0; i < this.itemValues.length; i++) @@ -385,7 +386,8 @@ export function checkInDwarven() return false } -const foragingLocations = ["Dark", "Birch", "Spruce", "Savanna", "Jungle", "Forest"] +const foragingLocations = ["§aDark Thic🐍§aket", "§aBirch Par🐍§ak", "§aSpruce Wo🐍§aods", "§aSavanna W🐍§aoodland", "§aJungle Is🐍§aland", "§bForest"] +// pov: hypixel making a working game (i do the same thing) export function checkInPark() { const scoreboard = Scoreboard.getLines() diff --git a/util/renderUtil.js b/util/renderUtil.js index f989cde..f3dce1d 100644 --- a/util/renderUtil.js +++ b/util/renderUtil.js @@ -1,7 +1,12 @@ export function trace(x, y, z, red, green, blue, alpha) { GL11.glLineWidth(2.0) + GlStateManager.func_179129_p() // disableCullFace + GlStateManager.func_179147_l() // enableBlend + GlStateManager.func_179112_b(770, 771) // blendFunc + GlStateManager.func_179132_a(false) // depthMask GlStateManager.func_179090_x() // disableTexture2D + Tessellator.begin(1).colorize(red, green, blue, alpha) if(Player.isSneaking()) @@ -10,6 +15,94 @@ export function trace(x, y, z, red, green, blue, alpha) Tessellator.pos(Player.getRenderX(), Player.getRenderY()+1.6203, Player.getRenderZ()).tex(0, 0) Tessellator.pos(x, y, z).tex(0, 0) Tessellator.draw() + GlStateManager.func_179089_o() // enableCull + GlStateManager.func_179084_k() // disableBlend + GlStateManager.func_179132_a(true) // depthMask + GlStateManager.func_179098_w() // enableTexture2D +} + + +export function drawEspBox (x, y, z, red, green, blue, alpha, phase = true) // thanks to renderlib, don't need the whole module so I'm not adding it. +{ + Tessellator.pushMatrix() + GL11.glLineWidth(2.0) + GlStateManager.func_179129_p() // disableCullFace + GlStateManager.func_179147_l() // enableBlend + GlStateManager.func_179112_b(770, 771) // blendFunc + GlStateManager.func_179132_a(false) // depthMask + GlStateManager.func_179090_x() // disableTexture2D + + if(phase) + GlStateManager.func_179097_i() // disableDepth + const locations = [ + // x, y, z x, y, z + [ + [0, 0, 0], + [1, 0, 0], + ], + [ + [0, 0, 0], + [0, 0, 1], + ], + [ + [1, 0, 1], + [1, 0, 0], + ], + [ + [1, 0, 1], + [0, 0, 1], + ], + + [ + [0, 1, 0], + [1, 1, 0], + ], + [ + [0, 1, 0], + [0, 1, 1], + ], + [ + [1, 1, 1], + [1, 1, 0], + ], + [ + [1, 1, 1], + [0, 1, 1], + ], + + [ + [0, 0, 0], + [0, 1, 0], + ], + [ + [1, 0, 0], + [1, 1, 0], + ], + [ + [0, 0, 1], + [0, 1, 1], + ], + [ + [1, 0, 1], + [1, 1, 1], + ], + ] + + locations.forEach((loc) => { + Tessellator.begin(3).colorize(red, green, blue, alpha); + Tessellator.pos(x + loc[0][0] - 1 / 2, y + loc[0][1], z + loc[0][2] - 1 / 2).tex(0, 0) + Tessellator.pos(x + loc[1][0] - 1 / 2, y + loc[1][1], z + loc[1][2] - 1 / 2).tex(0, 0) + Tessellator.draw() + }) + + GlStateManager.func_179089_o() // enableCull + GlStateManager.func_179084_k() // disableBlend + GlStateManager.func_179132_a(true) // depthMask GlStateManager.func_179098_w() // enableTexture2D + + if(phase) + GlStateManager.func_179126_j() // enableDepth + + Tessellator.popMatrix() }
\ No newline at end of file |