From 688e13930681bca7881d19468745f7067e9bc5c2 Mon Sep 17 00:00:00 2001 From: Ninjune x Date: Sun, 8 Jan 2023 02:12:14 -0600 Subject: v1.8.6 --- commands/calculate/calculate.js | 3 +- commands/calculate/hotmCalc.js | 58 ++++++++++++-------- commands/calculate/tick.js | 17 +++++- commands/claim.js | 117 ---------------------------------------- commands/coords/automatons.js | 53 ++++++++++++++++++ commands/coords/divans.js | 83 ++++++++++++++++++++++++++++ commands/coords/spiral.js | 55 +++++++++++++++++++ commands/coords/throne.js | 50 +++++++++++++++++ commands/coords/yog.js | 62 +++++++++++++++++++++ commands/divans.js | 83 ---------------------------- commands/drawLine.js | 43 +++++++++++++++ commands/findColeweight.js | 16 ++++-- commands/help.js | 6 +-- commands/info.js | 29 +++++----- commands/setkey.js | 2 +- commands/spiral.js | 55 ------------------- commands/throne.js | 50 ----------------- commands/yog.js | 62 --------------------- 18 files changed, 427 insertions(+), 417 deletions(-) delete mode 100644 commands/claim.js create mode 100644 commands/coords/automatons.js create mode 100644 commands/coords/divans.js create mode 100644 commands/coords/spiral.js create mode 100644 commands/coords/throne.js create mode 100644 commands/coords/yog.js delete mode 100644 commands/divans.js create mode 100644 commands/drawLine.js delete mode 100644 commands/spiral.js delete mode 100644 commands/throne.js delete mode 100644 commands/yog.js (limited to 'commands') diff --git a/commands/calculate/calculate.js b/commands/calculate/calculate.js index 3d9d750..8ed05bf 100644 --- a/commands/calculate/calculate.js +++ b/commands/calculate/calculate.js @@ -23,7 +23,8 @@ export function calculate(args) calcSpeed(args[1]) break case "help": - ChatLib.chat("&b--------------[ &a&l/cw calculate &b]--------------") + ChatLib.chat("&b--------------[ &a&l/cw calculate &b]------------") + ChatLib.chat("&7(Hover over command to see usage.)") helpCommand("calculate tick", "Calculates tick data.", "(mining speed) (('r','jade', etc) || breaking power of block))") helpCommand("calculate speed", "Calculates the ratio of mining speed 2 to professional with a certain amount of powder.", "(powder)") helpCommand("calculate hotm", "Calculates powder between two levels of a certain perk.", "(perk) (minlevel) [maxlevel]") diff --git a/commands/calculate/hotmCalc.js b/commands/calculate/hotmCalc.js index 583b2b8..1b449d4 100644 --- a/commands/calculate/hotmCalc.js +++ b/commands/calculate/hotmCalc.js @@ -16,28 +16,35 @@ export function hotmCalc(hotmName, minLevel, maxLevel) } return } - if(maxLevel == undefined) - { - maxLevel = minLevel - minLevel = 1 - } + new Thread(() => { + if(maxLevel == undefined) + { + maxLevel = minLevel + minLevel = 2 + } - if(minLevel != parseInt(minLevel) || maxLevel != parseInt(maxLevel)) return ChatLib.chat(constants.CALCULATEERRORMESSAGE) + if(minLevel != parseInt(minLevel) || maxLevel != parseInt(maxLevel)) return ChatLib.chat(constants.CALCULATEERRORMESSAGE) - minLevel = parseInt(minLevel) - maxLevel = parseInt(maxLevel) - let hotmObjectToFind = findHotmObject(hotmName) - if(hotmObjectToFind == undefined) return ChatLib.chat(`${PREFIX}&cDid not find HOTM perk with name '${hotmName}'!`) + minLevel = parseInt(minLevel) + maxLevel = parseInt(maxLevel) + let hotmObjectToFind = findHotmObject(hotmName) + if(hotmObjectToFind == undefined) return ChatLib.chat(`${PREFIX}&cDid not find HOTM perk with name '${hotmName}'!`) - maxLevel = (maxLevel < hotmObjectToFind.maxLevel ? maxLevel : hotmObjectToFind.maxLevel) + maxLevel = (maxLevel < hotmObjectToFind.maxLevel ? maxLevel : hotmObjectToFind.maxLevel) + let powderSum, + reward = findReward(hotmObjectToFind.rewardFormula, minLevel, maxLevel) - let powderSum = findCost(hotmObjectToFind.costFormula, minLevel, maxLevel), - reward = findReward(hotmObjectToFind.rewardFormula, minLevel, maxLevel) - - ChatLib.chat("") - ChatLib.chat(`&6${hotmObjectToFind.nameStringed} ${minLevel} - ${maxLevel} &bwill cost &6&l${addCommas(Math.round(powderSum))} &6${hotmObjectToFind.powderType[0].toUpperCase() + hotmObjectToFind.powderType.slice(1)} &bpowder.`) - ChatLib.chat(`&6${hotmObjectToFind.nameStringed} ${minLevel} - ${maxLevel} &bwill give &6&l${addCommas(Math.round(reward * 100) / 100)} &bof whatever reward is listed.`) - ChatLib.chat("") + if(hotmObjectToFind.names[0] == "fortunate") + powderSum = findCost(undefined, minLevel, maxLevel, true) + else + powderSum = findCost(hotmObjectToFind.costFormula, minLevel, maxLevel) + + + ChatLib.chat("") + ChatLib.chat(`&6${hotmObjectToFind.nameStringed} ${minLevel} - ${maxLevel} &bwill cost &6&l${addCommas(Math.round(powderSum))} &6${hotmObjectToFind.powderType[0].toUpperCase() + hotmObjectToFind.powderType.slice(1)} &bpowder.`) + ChatLib.chat(`&6${hotmObjectToFind.nameStringed} ${minLevel} - ${maxLevel} &bwill give &6&l${addCommas(Math.round(reward * 100) / 100)} &bof whatever reward is listed.`) + ChatLib.chat("") + }).start() } export function findHotmObject(hotmName) @@ -46,21 +53,26 @@ export function findHotmObject(hotmName) for(let i = 0; i < hotmData.length; i++) { - if(hotmData[i].names.includes(hotmName)) + if(hotmData[i].names.includes(hotmName.toLowerCase())) return hotmData[i] } } -export function findCost(costFormula, minLevel, maxLevel) +export function findCost(costFormula, minLevel, maxLevel, fortunate = false) { let powderSum = 0 - for(let currentLevel = minLevel; currentLevel < maxLevel; currentLevel++) // finds cost - powderSum += eval(costFormula.replace("currentLevel", currentLevel)) + if(fortunate) + powderSum = Math.pow(maxLevel+1, 3.05) + else + { + for(let currentLevel = minLevel; currentLevel <= maxLevel; currentLevel++) // finds cost + powderSum += eval(costFormula.replace("currentLevel", currentLevel)) + } return powderSum } 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/calculate/tick.js b/commands/calculate/tick.js index f8b2433..674aa91 100644 --- a/commands/calculate/tick.js +++ b/commands/calculate/tick.js @@ -23,10 +23,23 @@ export function tickCommand(speed, block) export function findTick(speed, block) { let ticks = {err: false}, - strength = findStrength(block) + strength = findStrength(block), + tickStrength = strength-200 ticks.currentBlockTick = strength*30/speed - ticks.currentShardTick = (strength-200)*30/speed + ticks.currentShardTick = tickStrength*30/speed + + if(ticks.currentBlockTick < 4.5) + { + if(ticks.currentBlockTick > 0.5) + ticks.currentBlockTick = 4 + } + + if(ticks.currentShardTick < 4.5) + { + if(ticks.currentShardTick > 0.5) + ticks.currentShardTick = 4 + } if(strength < 1) return ticks.err = true diff --git a/commands/claim.js b/commands/claim.js deleted file mode 100644 index ef40b99..0000000 --- a/commands/claim.js +++ /dev/null @@ -1,117 +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 - getClaimed() - 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 new file mode 100644 index 0000000..4114eec --- /dev/null +++ b/commands/coords/automatons.js @@ -0,0 +1,53 @@ +import constants from "../../util/constants" +import { waypointRender } from "../../util/helperFunctions" + +const PREFIX = constants.PREFIX +let waypoints = [] + +export function automatons(arg) +{ + const WAYPOINTNAME = "Automatons" + + if(arg != "toggle") + { + new TextComponent(`${PREFIX}&bStand in the pot in &3this&b picture and do /cw ${WAYPOINTNAME} toggle`) + .setClickAction("open_url") + .setClickValue("https://media.discordapp.net/attachments/1049475464667856926/1052749218055475210/image.png") + .chat() + } + else + { + if(waypoints[0] == undefined) + { + let startPos = [Player.getX(), Player.getY(), Player.getZ()], + x = startPos[0], + y = startPos[1], + z = startPos[2] + + let coordsRows = FileLib.read("Coleweight", "data/automatons.txt").split("\r\n") + coordsRows.forEach(unsplitRow => { + let row = unsplitRow.split(" ") + + waypoints.push([x + parseInt(row[0]), y + parseInt(row[1]), z + parseInt(row[2])]) + }) + + 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/coords/divans.js b/commands/coords/divans.js new file mode 100644 index 0000000..98b56dd --- /dev/null +++ b/commands/coords/divans.js @@ -0,0 +1,83 @@ +import constants from "../../util/constants" +import { waypointRender } from "../../util/helperFunctions" + +const PREFIX = constants.PREFIX +let divanWaypoints = [] + +export function divans(arg2) +{ + const WAYPOINTNAME = "Divan" + + if(arg2 != "toggle") + { + new TextComponent(`${PREFIX}&bGo to the middle of jade crystal then do /cw coords divans toggle.`) + .chat() + } + else + { + if(divanWaypoints[0] == undefined) + { + let startPos = [Player.getX(), Player.getY(), Player.getZ()], + x = startPos[0], + y = startPos[1], + z = startPos[2] + + console.log(x + " " + y + " " + z) + divanWaypoints.push([x + 1, y + -40, z + -20]) + divanWaypoints.push([x + 30, y + -39, z + -25]) + divanWaypoints.push([x + -31, y + -39, z + -12]) + divanWaypoints.push([x + 1, y + -39, z + 20]) + divanWaypoints.push([x + -14, y + -39, z + 43]) + divanWaypoints.push([x + -12, y + -39, z + -44]) + divanWaypoints.push([x + -20, y + -40, z + 0]) + divanWaypoints.push([x + 22, y + -39, z + -14]) + divanWaypoints.push([x + 29, y + -39, z + -44]) + divanWaypoints.push([x + 12, y + -39, z + 7]) + divanWaypoints.push([x + 23, y + -40, z + -39]) + divanWaypoints.push([x + -37, y + -39, z + 11]) + divanWaypoints.push([x + 7, y + -39, z + 11]) + divanWaypoints.push([x + 6, y + -39, z + 11]) + divanWaypoints.push([x + -38, y + -40, z + 26]) + divanWaypoints.push([x + 12, y + -40, z + -22]) + divanWaypoints.push([x + -5, y + -39, z + 16]) + divanWaypoints.push([x + 40, y + -40, z + -30]) + divanWaypoints.push([x + 42, y + -37, z + -41]) + divanWaypoints.push([x + -23, y + -40, z + 40]) + divanWaypoints.push([x + 20, y + -40, z + 0]) + divanWaypoints.push([x + -24, y + -40, z + 12]) + divanWaypoints.push([x + 38, y + -40, z + -26]) + divanWaypoints.push([x + 43, y + -39, z + -16]) + divanWaypoints.push([x + -40, y + -40, z + 18]) + divanWaypoints.push([x + -17, y + -39, z + 20]) + divanWaypoints.push([x + 19, y + -40, z + 29]) + divanWaypoints.push([x + -37, y + -39, z + -14]) + divanWaypoints.push([x + -14, y + -39, z + 22]) + divanWaypoints.push([x + -42, y + -38, z + -28]) + divanWaypoints.push([x + -43, y + -40, z + -40]) + divanWaypoints.push([x + 25, y + -40, z + 17]) + divanWaypoints.push([x + 12, y + -40, z + 31]) + divanWaypoints.push([x + -31, y + -39, z + -40]) + divanWaypoints.push([x + -36, y + -38, z + 42]) + divanWaypoints.push([x + 7, y + -39, z + 22]) + divanWaypoints.push([x + 20, y + -39, z + -26]) + divanWaypoints.push([x + 12, y + -39, z + -43]) + ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned on!`) + } + else + { + divanWaypoints = [] + ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned off!`) + } + } +} + +register("renderWorld", () => { + waypointRender(divanWaypoints) +}) + + +register("worldLoad", () => { + divanWaypoints = [] +}) + +export default "" \ No newline at end of file diff --git a/commands/coords/spiral.js b/commands/coords/spiral.js new file mode 100644 index 0000000..7092aa9 --- /dev/null +++ b/commands/coords/spiral.js @@ -0,0 +1,55 @@ +import constants from "../../util/constants" +import { waypointRender } from "../../util/helperFunctions" + +const PREFIX = constants.PREFIX +let spiralWaypoints = [] + +export function spiral(arg2) +{ + if(arg2 != "toggle") + { + new TextComponent(`${PREFIX}&bGo to the place in &3this&b picture and do /cw spiral toggle`) + .setClickAction("open_url") + .setClickValue("https://i.imgur.com/dyL30GD.png") + .chat() + } + else + { + if(spiralWaypoints[0] == undefined) + { + let startPos = [Player.getX(), Player.getY(), Player.getZ()] + spiralWaypoints.push([startPos[0]+2, startPos[1]-3, startPos[2]+14]) + spiralWaypoints.push([startPos[0]+3, startPos[1]-21, startPos[2]+6]) + spiralWaypoints.push([startPos[0]+6, startPos[1]-23, startPos[2]-1]) + spiralWaypoints.push([startPos[0]+19, startPos[1]+4, startPos[2]-5]) + spiralWaypoints.push([startPos[0]+21, startPos[1]-7, startPos[2]]) + spiralWaypoints.push([startPos[0]+25, startPos[1]-35, startPos[2]-8]) + spiralWaypoints.push([startPos[0]+39, startPos[1]-36, startPos[2]]) + spiralWaypoints.push([startPos[0]+52, startPos[1]-24, startPos[2]+1]) + spiralWaypoints.push([startPos[0]+48, startPos[1]+3, startPos[2]+3]) + spiralWaypoints.push([startPos[0]+47, startPos[1]+4, startPos[2]+22]) + spiralWaypoints.push([startPos[0]+55, startPos[1]-8, startPos[2]+42]) + spiralWaypoints.push([startPos[0]+46, startPos[1]-11, startPos[2]+49]) + spiralWaypoints.push([startPos[0]+26, startPos[1]+5, startPos[2]+39]) + spiralWaypoints.push([startPos[0]+20, startPos[1]+3, startPos[2]+41]) + spiralWaypoints.push([startPos[0]+8, startPos[1]-23, startPos[2]+32]) + spiralWaypoints.push([startPos[0]+4, startPos[1]-23, startPos[2]+28]) + ChatLib.chat(`${PREFIX}&bSpiral waypoints turned on!`) + } + else + { + spiralWaypoints = [] + ChatLib.chat(`${PREFIX}&bSpiral waypoints turned off!`) + } + } +} + +register("renderWorld", () => { + waypointRender(spiralWaypoints, true, true) +}) + +register("worldLoad", () => { + spiralWaypoints = [] +}) + +export default "" \ No newline at end of file diff --git a/commands/coords/throne.js b/commands/coords/throne.js new file mode 100644 index 0000000..6e1e104 --- /dev/null +++ b/commands/coords/throne.js @@ -0,0 +1,50 @@ +import constants from "../../util/constants" +import { waypointRender } from "../../util/helperFunctions" + +const PREFIX = constants.PREFIX +let throneWaypoints = [] + + +export function throne(arg2) +{ + if(arg2 != "toggle") + { + ChatLib.chat(`${PREFIX}&bGo to the throne and sit on the back block then run /cw throne toggle.`) + } + else + { + if(throneWaypoints[0] == undefined) + { + let startPos = [Player.getX()-24, Player.getY()+6, Player.getZ()-59] // calculated below values at a weird start so adjusting them + throneWaypoints.push([startPos[0]+8, startPos[1]+2, startPos[2]-5]) + throneWaypoints.push([startPos[0]+11, startPos[1]-35, startPos[2]-3]) + throneWaypoints.push([startPos[0]+2, startPos[1]-34, startPos[2]-4]) + throneWaypoints.push([startPos[0]+-2, startPos[1]-1, startPos[2]+49]) + throneWaypoints.push([startPos[0]+2, startPos[1]-13, startPos[2]+52]) + throneWaypoints.push([startPos[0]+27, startPos[1]-9, startPos[2]+51]) + throneWaypoints.push([startPos[0]+38, startPos[1]-15, startPos[2]+47]) + throneWaypoints.push([startPos[0]+41, startPos[1]-44, startPos[2]+46]) + throneWaypoints.push([startPos[0]+50, startPos[1]-28, startPos[2]+38]) + throneWaypoints.push([startPos[0]+55, startPos[1]-36, startPos[2]+29]) + throneWaypoints.push([startPos[0]+49, startPos[1]-31, startPos[2]+1]) + throneWaypoints.push([startPos[0]+50, startPos[1]-1, startPos[2]+10]) + throneWaypoints.push([startPos[0]+45, startPos[1]-3, startPos[2]-4]) + ChatLib.chat(`${PREFIX}&bThrone waypoints turned on!`) + } + else + { + throneWaypoints = [] + ChatLib.chat(`${PREFIX}&bThrone waypoints turned off!`) + } + } +} + + +register("renderWorld", () => { + waypointRender(throneWaypoints, true, true) +}) + + +register("worldLoad", () => { + throneWaypoints = [] +}) diff --git a/commands/coords/yog.js b/commands/coords/yog.js new file mode 100644 index 0000000..e02b4a2 --- /dev/null +++ b/commands/coords/yog.js @@ -0,0 +1,62 @@ +import constants from "../../util/constants" +import { waypointRender } from "../../util/helperFunctions" + +const PREFIX = constants.PREFIX +let yogWaypoints = [] + +export function yog(arg2) +{ + const WAYPOINTNAME = "Yog" + + if(arg2 != "toggle") + { + new TextComponent(`${PREFIX}&bGo to the leftmost corner of the topaz crystal facing bal close to bal then do /cw coords yog toggle.`) + .chat() + } + else + { + if(yogWaypoints[0] == undefined) + { + let startPos = [Player.getX(), Player.getY(), Player.getZ()], + x = startPos[0], + y = startPos[1], + z = startPos[2] + + console.log(x + " " + y + " " + z) + yogWaypoints.push([x + 10, y - 7, z - 27]) + yogWaypoints.push([x + 10, y - 7, z - 27]) + yogWaypoints.push([x + 28, y - 8, z + 15]) + yogWaypoints.push([x - 41, y - 3, z + 26]) + yogWaypoints.push([x - 32, y - 3, z + 45]) + yogWaypoints.push([x - 22, y - 3, z - 34]) + yogWaypoints.push([x + 28, y - 8, z + 36]) + yogWaypoints.push([x - 47, y - 3, z + 32]) + yogWaypoints.push([x - 43, y - 1, z + 4]) + yogWaypoints.push([x - 47, y + 2, z - 20]) + yogWaypoints.push([x + 11, y - 13, z + 40]) + yogWaypoints.push([x + 15, y - 13, z + 43]) + yogWaypoints.push([x - 44, y + 2, z - 29]) + yogWaypoints.push([x + 33, y - 4, z - 15]) + yogWaypoints.push([x - 6, y - 4, z - 34]) + yogWaypoints.push([x + 19, y - 12, z + 35]) + yogWaypoints.push([x + 16, y - 9, z - 15]) + ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned on!`) + } + else + { + yogWaypoints = [] + ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned off!`) + } + } +} + +register("renderWorld", () => { + if(yogWaypoints.length < 1) return + waypointRender(yogWaypoints) +}) + +register("worldLoad", () => { + yogWaypoints = [] +}) + +export default "" \ No newline at end of file diff --git a/commands/divans.js b/commands/divans.js deleted file mode 100644 index c5e618a..0000000 --- a/commands/divans.js +++ /dev/null @@ -1,83 +0,0 @@ -import constants from "../util/constants" -import { waypointRender } from "../util/helperFunctions" - -const PREFIX = constants.PREFIX -let divanWaypoints = [] - -export function divans(arg2) -{ - const WAYPOINTNAME = "Divan" - - if(arg2 != "toggle") - { - new TextComponent(`${PREFIX}&bGo to the middle of jade crystal then do /cw coords divans toggle.`) - .chat() - } - else - { - if(divanWaypoints[0] == undefined) - { - let startPos = [Player.getX(), Player.getY(), Player.getZ()], - x = startPos[0], - y = startPos[1], - z = startPos[2] - - console.log(x + " " + y + " " + z) - divanWaypoints.push([x + 1, y + -40, z + -20]) - divanWaypoints.push([x + 30, y + -39, z + -25]) - divanWaypoints.push([x + -31, y + -39, z + -12]) - divanWaypoints.push([x + 1, y + -39, z + 20]) - divanWaypoints.push([x + -14, y + -39, z + 43]) - divanWaypoints.push([x + -12, y + -39, z + -44]) - divanWaypoints.push([x + -20, y + -40, z + 0]) - divanWaypoints.push([x + 22, y + -39, z + -14]) - divanWaypoints.push([x + 29, y + -39, z + -44]) - divanWaypoints.push([x + 12, y + -39, z + 7]) - divanWaypoints.push([x + 23, y + -40, z + -39]) - divanWaypoints.push([x + -37, y + -39, z + 11]) - divanWaypoints.push([x + 7, y + -39, z + 11]) - divanWaypoints.push([x + 6, y + -39, z + 11]) - divanWaypoints.push([x + -38, y + -40, z + 26]) - divanWaypoints.push([x + 12, y + -40, z + -22]) - divanWaypoints.push([x + -5, y + -39, z + 16]) - divanWaypoints.push([x + 40, y + -40, z + -30]) - divanWaypoints.push([x + 42, y + -37, z + -41]) - divanWaypoints.push([x + -23, y + -40, z + 40]) - divanWaypoints.push([x + 20, y + -40, z + 0]) - divanWaypoints.push([x + -24, y + -40, z + 12]) - divanWaypoints.push([x + 38, y + -40, z + -26]) - divanWaypoints.push([x + 43, y + -39, z + -16]) - divanWaypoints.push([x + -40, y + -40, z + 18]) - divanWaypoints.push([x + -17, y + -39, z + 20]) - divanWaypoints.push([x + 19, y + -40, z + 29]) - divanWaypoints.push([x + -37, y + -39, z + -14]) - divanWaypoints.push([x + -14, y + -39, z + 22]) - divanWaypoints.push([x + -42, y + -38, z + -28]) - divanWaypoints.push([x + -43, y + -40, z + -40]) - divanWaypoints.push([x + 25, y + -40, z + 17]) - divanWaypoints.push([x + 12, y + -40, z + 31]) - divanWaypoints.push([x + -31, y + -39, z + -40]) - divanWaypoints.push([x + -36, y + -38, z + 42]) - divanWaypoints.push([x + 7, y + -39, z + 22]) - divanWaypoints.push([x + 20, y + -39, z + -26]) - divanWaypoints.push([x + 12, y + -39, z + -43]) - ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned on!`) - } - else - { - divanWaypoints = [] - ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned off!`) - } - } -} - -register("renderWorld", () => { - waypointRender(divanWaypoints) -}) - - -register("worldLoad", () => { - divanWaypoints = [] -}) - -export default "" \ No newline at end of file diff --git a/commands/drawLine.js b/commands/drawLine.js new file mode 100644 index 0000000..1374dea --- /dev/null +++ b/commands/drawLine.js @@ -0,0 +1,43 @@ +import constants from "../util/constants" +import { trace, drawEspBox } from "../util/renderUtil" +const PREFIX = constants.PREFIX + +let x = 0, + y = 0, + z = 0 + +export function drawLine(args) +{ + switch(args.length - 1) + { + case 0: + case 1: + x = 0 + y = 0 + z = 0 + ChatLib.chat(`${PREFIX}&bStopped drawing line.`) + return + case 2: + x = args[1] + y = Player.getY() + 1 + z = args[2] + break + case 3: + x = args[1] + y = args[2] + z = args[3] + break + default: + ChatLib.chat(constants.INVALIDARGS) + return + } + ChatLib.chat(`${PREFIX}&bNow drawing line to &a${x} ${Math.round(y)} ${z}`) +} + + +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 d3fa38a..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${res.data.exp}\n&fPowder&f: &a${res.data.pow}\n&fCollection&f: &a${res.data.col}\n&fMiscellaneous&f: &a${res.data.bes + res.data.nuc}`) + 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 8e06b51..bda7951 100644 --- a/commands/help.js +++ b/commands/help.js @@ -3,6 +3,7 @@ const PREFIX = "◆" export function help() { ChatLib.chat("&b--------------[ &a&lColeweight &b]--------------") + ChatLib.chat("&7(Hover over command to see usage.)") ChatLib.chat(ChatLib.getCenteredText("&a&lInfo")) helpCommand("", "Gets Coleweight of specified user", "(username)") helpCommand("help", "This menu.", "") @@ -12,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,11 +23,11 @@ export function help() helpCommand("yog", "Shows instructions for yog waypoints.", "[toggle]") helpCommand("divans", "Guide for setting up waypoints for Mines of Divan treasures.", "[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)`) - ChatLib.chat("&b------------------------------------------") + ChatLib.chat("&b--------------------------------------------") } -// Made by Almighty Stylla <3 export function helpCommand(command, desc, usage) { ChatLib.chat(new TextComponent(`&a${PREFIX} /cw ${command} => &b${desc}`).setHoverValue(`${"/cw " + command + " " + usage}`)) diff --git a/commands/info.js b/commands/info.js index 3967863..ed427f8 100644 --- a/commands/info.js +++ b/commands/info.js @@ -1,23 +1,20 @@ -import axios from "../../axios" import constants from "../util/constants" +import { addCommas } from "../util/helperFunctions" const PREFIX = constants.PREFIX export function info() { - axios.get(`https://ninjune.dev/api/cwinfo`) - .then((res) => { - let values = res.data, - powder = values.powder, - collection = values.collection, - miscellaneous = values.miscellaneous - - ChatLib.chat(`${PREFIX}&bEach of the following are equivalent to one unit of ColeWeight` + - `\n\n&4&lExperience \n&b${values.experience.req} mining exp` + - `\n\n&4&lPowder \n&b${powder[0].req} &bmithril powder\n&b${powder[1].req} gemstone powder` + // in theory I should have just added formatted names to the api - `\n\n&4&lCollections \n&b${collection[0].req} &bmithril\n&b${collection[1].req} gemstone\n&b${collection[2].req} gold\n&b${collection[3].req}netherrack\n&b${collection[4].req} diamond\n&b${collection[5].req} ice\n&b${collection[6].req} redstone\n&b${collection[7].req} lapis\n&b${collection[8].req} sulphur\n&b${collection[9].req} coal\n&b${collection[10].req} emerald\n&b${collection[11].req} endstone\n&b${collection[12].req} glowstone\n&b${collection[13].req} gravel\n&b${collection[14].req} iron\n&b${collection[15].req} mycelium\n&b${collection[16].req} quartz\n&b${collection[17].req} obsidian\n&b${collection[18].req} red sand\n&b${collection[19].req} sand\n&b${collection[20].req} cobblestone\n&b${collection[21].req} hardstone` + - `\n\n&4&lMiscellaneous \n&b${miscellaneous[0].req} scatha kills\n&b${miscellaneous[1].req} worm kills\n&b${miscellaneous[2].req} nucleus runs`) - }) - .catch((e) => { - return `${PREFIX}&cThere was an error. (api may be down)` + let cwinfo = constants.CWINFO, + values = {"experience" : "", "powder": "", "collection": "", "miscellaneous": ""} + + cwinfo.forEach(info => { + values[info.category] += `&b${addCommas(info.cost)} ${info.nameStringed}\n` }) + + ChatLib.chat( + `${PREFIX}&bEach of the following are equivalent to one unit of ColeWeight` + + "\n&4&lExperience\n" + values.experience + + "\n&4&lPowder\n" + values.powder + + "\n&4&lCollections\n" + values.collection + + "\n&4&lMiscellaneous\n" + values.miscellaneous) } \ No newline at end of file diff --git a/commands/setkey.js b/commands/setkey.js index 530bf28..f4dba64 100644 --- a/commands/setkey.js +++ b/commands/setkey.js @@ -17,6 +17,6 @@ export function setkey(arg2) ChatLib.chat(`${PREFIX}&eKey is not valid!`) }) .catch(err => { - ChatLib.chat(`${PREFIX}&eKey is not valid!`) + ChatLib.chat(`${PREFIX}&eKey is not valid! if this is a mistake report: ${err}`) }) } \ No newline at end of file diff --git a/commands/spiral.js b/commands/spiral.js deleted file mode 100644 index f9f00aa..0000000 --- a/commands/spiral.js +++ /dev/null @@ -1,55 +0,0 @@ -import constants from "../util/constants" -import { waypointRender } from "../util/helperFunctions" - -const PREFIX = constants.PREFIX -let spiralWaypoints = [] - -export function spiral(arg2) -{ - if(arg2 != "toggle") - { - new TextComponent(`${PREFIX}&bGo to the place in &3this&b picture and do /cw spiral toggle`) - .setClickAction("open_url") - .setClickValue("https://i.imgur.com/dyL30GD.png") - .chat() - } - else - { - if(spiralWaypoints[0] == undefined) - { - let startPos = [Player.getX(), Player.getY(), Player.getZ()] - spiralWaypoints.push([startPos[0]+2, startPos[1]-3, startPos[2]+14]) - spiralWaypoints.push([startPos[0]+3, startPos[1]-21, startPos[2]+6]) - spiralWaypoints.push([startPos[0]+6, startPos[1]-23, startPos[2]-1]) - spiralWaypoints.push([startPos[0]+19, startPos[1]+4, startPos[2]-5]) - spiralWaypoints.push([startPos[0]+21, startPos[1]-7, startPos[2]]) - spiralWaypoints.push([startPos[0]+25, startPos[1]-35, startPos[2]-8]) - spiralWaypoints.push([startPos[0]+39, startPos[1]-36, startPos[2]]) - spiralWaypoints.push([startPos[0]+52, startPos[1]-24, startPos[2]+1]) - spiralWaypoints.push([startPos[0]+48, startPos[1]+3, startPos[2]+3]) - spiralWaypoints.push([startPos[0]+47, startPos[1]+4, startPos[2]+22]) - spiralWaypoints.push([startPos[0]+55, startPos[1]-8, startPos[2]+42]) - spiralWaypoints.push([startPos[0]+46, startPos[1]-11, startPos[2]+49]) - spiralWaypoints.push([startPos[0]+26, startPos[1]+5, startPos[2]+39]) - spiralWaypoints.push([startPos[0]+20, startPos[1]+3, startPos[2]+41]) - spiralWaypoints.push([startPos[0]+8, startPos[1]-23, startPos[2]+32]) - spiralWaypoints.push([startPos[0]+4, startPos[1]-23, startPos[2]+28]) - ChatLib.chat(`${PREFIX}&bSpiral waypoints turned on!`) - } - else - { - spiralWaypoints = [] - ChatLib.chat(`${PREFIX}&bSpiral waypoints turned off!`) - } - } -} - -register("renderWorld", () => { - waypointRender(spiralWaypoints, true, true) -}) - -register("worldLoad", () => { - spiralWaypoints = [] -}) - -export default "" \ No newline at end of file diff --git a/commands/throne.js b/commands/throne.js deleted file mode 100644 index c3a2e1c..0000000 --- a/commands/throne.js +++ /dev/null @@ -1,50 +0,0 @@ -import constants from "../util/constants" -import { waypointRender } from "../util/helperFunctions" - -const PREFIX = constants.PREFIX -let throneWaypoints = [] - - -export function throne(arg2) -{ - if(arg2 != "toggle") - { - ChatLib.chat(`${PREFIX}&bGo to the throne and sit on the back block then run /cw throne toggle.`) - } - else - { - if(throneWaypoints[0] == undefined) - { - let startPos = [Player.getX()-24, Player.getY()+6, Player.getZ()-59] // calculated below values at a weird start so adjusting them - throneWaypoints.push([startPos[0]+8, startPos[1]+2, startPos[2]-5]) - throneWaypoints.push([startPos[0]+11, startPos[1]-35, startPos[2]-3]) - throneWaypoints.push([startPos[0]+2, startPos[1]-34, startPos[2]-4]) - throneWaypoints.push([startPos[0]+-2, startPos[1]-1, startPos[2]+49]) - throneWaypoints.push([startPos[0]+2, startPos[1]-13, startPos[2]+52]) - throneWaypoints.push([startPos[0]+27, startPos[1]-9, startPos[2]+51]) - throneWaypoints.push([startPos[0]+38, startPos[1]-15, startPos[2]+47]) - throneWaypoints.push([startPos[0]+41, startPos[1]-44, startPos[2]+46]) - throneWaypoints.push([startPos[0]+50, startPos[1]-28, startPos[2]+38]) - throneWaypoints.push([startPos[0]+55, startPos[1]-36, startPos[2]+29]) - throneWaypoints.push([startPos[0]+49, startPos[1]-31, startPos[2]+1]) - throneWaypoints.push([startPos[0]+50, startPos[1]-1, startPos[2]+10]) - throneWaypoints.push([startPos[0]+45, startPos[1]-3, startPos[2]-4]) - ChatLib.chat(`${PREFIX}&bThrone waypoints turned on!`) - } - else - { - throneWaypoints = [] - ChatLib.chat(`${PREFIX}&bThrone waypoints turned off!`) - } - } -} - - -register("renderWorld", () => { - waypointRender(throneWaypoints, true, true) -}) - - -register("worldLoad", () => { - throneWaypoints = [] -}) diff --git a/commands/yog.js b/commands/yog.js deleted file mode 100644 index 1544553..0000000 --- a/commands/yog.js +++ /dev/null @@ -1,62 +0,0 @@ -import constants from "../util/constants" -import { waypointRender } from "../util/helperFunctions" - -const PREFIX = constants.PREFIX -let yogWaypoints = [] - -export function yog(arg2) -{ - const WAYPOINTNAME = "Yog" - - if(arg2 != "toggle") - { - new TextComponent(`${PREFIX}&bGo to the leftmost corner of the topaz crystal facing bal close to bal then do /cw coords yog toggle.`) - .chat() - } - else - { - if(yogWaypoints[0] == undefined) - { - let startPos = [Player.getX(), Player.getY(), Player.getZ()], - x = startPos[0], - y = startPos[1], - z = startPos[2] - - console.log(x + " " + y + " " + z) - yogWaypoints.push([x + 10, y - 7, z - 27]) - yogWaypoints.push([x + 10, y - 7, z - 27]) - yogWaypoints.push([x + 28, y - 8, z + 15]) - yogWaypoints.push([x - 41, y - 3, z + 26]) - yogWaypoints.push([x - 32, y - 3, z + 45]) - yogWaypoints.push([x - 22, y - 3, z - 34]) - yogWaypoints.push([x + 28, y - 8, z + 36]) - yogWaypoints.push([x - 47, y - 3, z + 32]) - yogWaypoints.push([x - 43, y - 1, z + 4]) - yogWaypoints.push([x - 47, y + 2, z - 20]) - yogWaypoints.push([x + 11, y - 13, z + 40]) - yogWaypoints.push([x + 15, y - 13, z + 43]) - yogWaypoints.push([x - 44, y + 2, z - 29]) - yogWaypoints.push([x + 33, y - 4, z - 15]) - yogWaypoints.push([x - 6, y - 4, z - 34]) - yogWaypoints.push([x + 19, y - 12, z + 35]) - yogWaypoints.push([x + 16, y - 9, z - 15]) - ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned on!`) - } - else - { - yogWaypoints = [] - ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned off!`) - } - } -} - -register("renderWorld", () => { - if(yogWaypoints.length < 1) return - waypointRender(yogWaypoints) -}) - -register("worldLoad", () => { - yogWaypoints = [] -}) - -export default "" \ No newline at end of file -- cgit