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 /commands | |
parent | 329dccf50ed5e9f87531580f679522238b6a019b (diff) | |
download | coleweight-8fa7fe39d9edbdd8b00ec238c4e40b6ecd0808cc.tar.gz coleweight-8fa7fe39d9edbdd8b00ec238c4e40b6ecd0808cc.tar.bz2 coleweight-8fa7fe39d9edbdd8b00ec238c4e40b6ecd0808cc.zip |
Diffstat (limited to 'commands')
-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 |
7 files changed, 63 insertions, 125 deletions
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)`) |