diff options
Diffstat (limited to 'commands')
-rw-r--r-- | commands/calculate/calculate.js | 3 | ||||
-rw-r--r-- | commands/calculate/hotmCalc.js | 58 | ||||
-rw-r--r-- | commands/calculate/tick.js | 17 | ||||
-rw-r--r-- | commands/claim.js | 117 | ||||
-rw-r--r-- | commands/coords/automatons.js | 53 | ||||
-rw-r--r-- | commands/coords/divans.js (renamed from commands/divans.js) | 4 | ||||
-rw-r--r-- | commands/coords/spiral.js (renamed from commands/spiral.js) | 4 | ||||
-rw-r--r-- | commands/coords/throne.js (renamed from commands/throne.js) | 4 | ||||
-rw-r--r-- | commands/coords/yog.js (renamed from commands/yog.js) | 4 | ||||
-rw-r--r-- | commands/drawLine.js | 43 | ||||
-rw-r--r-- | commands/findColeweight.js | 16 | ||||
-rw-r--r-- | commands/help.js | 6 | ||||
-rw-r--r-- | commands/info.js | 29 | ||||
-rw-r--r-- | commands/setkey.js | 2 |
14 files changed, 185 insertions, 175 deletions
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/divans.js b/commands/coords/divans.js index c5e618a..98b56dd 100644 --- a/commands/divans.js +++ b/commands/coords/divans.js @@ -1,5 +1,5 @@ -import constants from "../util/constants" -import { waypointRender } from "../util/helperFunctions" +import constants from "../../util/constants" +import { waypointRender } from "../../util/helperFunctions" const PREFIX = constants.PREFIX let divanWaypoints = [] diff --git a/commands/spiral.js b/commands/coords/spiral.js index f9f00aa..7092aa9 100644 --- a/commands/spiral.js +++ b/commands/coords/spiral.js @@ -1,5 +1,5 @@ -import constants from "../util/constants" -import { waypointRender } from "../util/helperFunctions" +import constants from "../../util/constants" +import { waypointRender } from "../../util/helperFunctions" const PREFIX = constants.PREFIX let spiralWaypoints = [] diff --git a/commands/throne.js b/commands/coords/throne.js index c3a2e1c..6e1e104 100644 --- a/commands/throne.js +++ b/commands/coords/throne.js @@ -1,5 +1,5 @@ -import constants from "../util/constants" -import { waypointRender } from "../util/helperFunctions" +import constants from "../../util/constants" +import { waypointRender } from "../../util/helperFunctions" const PREFIX = constants.PREFIX let throneWaypoints = [] diff --git a/commands/yog.js b/commands/coords/yog.js index 1544553..e02b4a2 100644 --- a/commands/yog.js +++ b/commands/coords/yog.js @@ -1,5 +1,5 @@ -import constants from "../util/constants" -import { waypointRender } from "../util/helperFunctions" +import constants from "../../util/constants" +import { waypointRender } from "../../util/helperFunctions" const PREFIX = constants.PREFIX let yogWaypoints = [] 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 |