diff options
42 files changed, 28059 insertions, 575 deletions
diff --git a/chat/apiNew.js b/chat/apiNew.js index eaab375..36025e3 100644 --- a/chat/apiNew.js +++ b/chat/apiNew.js @@ -7,18 +7,16 @@ 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!`) + ChatLib.chat(`${PREFIX}&eKey is not valid! if this is a mistake report: ${err}`) }) - ChatLib.chat(ChatLib.getCenteredText(`${PREFIX}&aApi Key Successfully Set!`)) + ChatLib.chat(`${PREFIX}&aApi Key Successfully Set!`) }).setCriteria(/Your new API key is (.+)/) export default ""
\ No newline at end of file diff --git a/chat/grieferTrack.js b/chat/grieferTrack.js index 2b745c3..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,9 +37,13 @@ function checkMMiners() if(!checkedPlayers.includes(player)) { - if(griefers.includes(player)) - ChatLib.chat(`${PREFIX}&e'${player}' is a griefer!`) - 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) } @@ -59,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/chat/message.js b/chat/message.js index 27cf78f..f55ecba 100644 --- a/chat/message.js +++ b/chat/message.js @@ -50,43 +50,6 @@ register("gameLoad", () => { }) }) - -register("messageSent", (origMessage, event) => { // emotes! this was fun to make :) - let commandState = 0, - command = "", - colonIndex1 = -1, - message = "" - - for(let charIndex = 0; charIndex < origMessage.length; charIndex++) - { - if(origMessage[charIndex] == ":" && commandState == 0) - { - colonIndex1 = charIndex - commandState = 1 - } - else if (origMessage[charIndex] == ":" && commandState == 1) - { - commandState = 2 - command = origMessage.slice(colonIndex1 + 1, charIndex).toLowerCase() - } - } - if(command == "shrug") - { - cancel(event) - emote = "¯\\_(ツ)_/¯" - } - else if (command == "lenny") - { - cancel(event) - emote = "( ͡° ͜ʖ ͡°)" - } - else - return - message = origMessage.slice(0, colonIndex1) + emote + origMessage.slice(colonIndex1 + 2 + command.length, origMessage.length) - ChatLib.say(`${message}`) -}) - - // first time check register("step", () => { if (constants.data.first_time) diff --git a/commandManager.js b/commandManager.js index 591676c..668ff7c 100644 --- a/commandManager.js +++ b/commandManager.js @@ -1,32 +1,33 @@ -import { openTimerGui } from "./render/timerGui.js" -import { openPowderGui } from "./render/powertrackerGui" -import { openCoordsGui } from "./render/coordsGui.js" -import { openDowntimeGui } from "./render/downtimeGui.js" -import { openCwGui, reloadColeweight } from "./render/cwGui" -import { openCollectionGui, reloadCollection, trackCollection } from "./render/collectionGui" +import { openTimerGui } from "./render/guis/timerGui.js" +import { openPowderGui } from "./render/guis/powertrackerGui" +import { openCoordsGui } from "./render/guis/coordsGui.js" +import { openDowntimeGui } from "./render/guis/downtimeGui.js" +import { openCwGui, reloadColeweight } from "./render/guis/cwGui" +import { openCollectionGui, reloadCollection, trackCollection } from "./render/guis/collectionGui" import { help } from "./commands/help" import { setkey } from "./commands/setkey" -import { spiral } from "./commands/spiral" -import { throne } from "./commands/throne" -import { yog } from "./commands/yog" 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" import Settings from "./settings" import constants from "./util/constants" import { clearLobbies } from "./commands/markingLobbies" -import { divans } from "./commands/divans.js" import { calculate } from "./commands/calculate/calculate.js" import { openMiningAbilitiesGui } from "./render/miningAbilities.js" +import { spiral } from "./commands/coords/spiral" +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" + register("command", (...args) => { - console.log(args[0]) - if (args[0] == undefined) {findColeweight(args[0]); return} + if (args[0] == undefined) {Settings.openGUI(); return} switch(args[0].toString().toLowerCase()) { case "setkey": @@ -69,6 +70,8 @@ register("command", (...args) => { spiral(args[1]) break case "reload": + if(args[1] == undefined) + return ChatLib.chat(`${constants.PREFIX}&cMust specify a gui. Hit tab on '/cw reload ' for options.`) switch(args[1].toLowerCase()) { case "coleweight": @@ -81,6 +84,8 @@ register("command", (...args) => { ChatLib.chat(`${constants.PREFIX}&cNo such gui as '${args[1]}'.`) } break + case "lb": + case "top": case "leaderboard": leaderboard(args[1], args[2]) break @@ -91,9 +96,6 @@ register("command", (...args) => { case "settings": Settings.openGUI() break - case "claim": - claim(args[1]) - break case "powdertrackersync": updateDisplay() break @@ -113,6 +115,10 @@ register("command", (...args) => { case "divan": divans(args[1]) break + case "automaton": + case "automatons": + automatons(args[1]) + break case "coord": case "coords": openCoordsGui() @@ -127,52 +133,34 @@ register("command", (...args) => { case "calculate": calculate(args.slice(1)) break + case "drawline": + drawLine(args) + break default: findColeweight(args[0]) } }).setTabCompletions((args) => { let output = [], - calculateOptions = ["tick", "ms2toprofessional", "hotmcalc", "calchotm"], + reloadOptions = ["coleweight", "collection"], + calculateOptions = ["tick", "ms2toprofessional", "hotm", "calchotm"], commands = ["setkey", "help", "move", "toggle", "throne", "spiral", "reload", "leaderboard", - "settings", "claim", "time", "info", "clearlobbies", "yog", "divan", "coords", "credits", "track", "calculate"] + "settings", "time", "info", "clearlobbies", "yog", "divan", "automatons", "coords", "credits", "track", "calculate", "drawline"] if(args[0].length == 0 || args[0] == undefined) return output = commands - if(args[0] == "calc" || args[0] == "calculate") + switch(args[0]) { - if(args[1] == undefined) output = calculateOptions - - else - { - calculateOptions.forEach(calculateOption => { - for(let char = 0; char < args[1].length; char++) - { - if(calculateOption[char] != args[1][char]) - break - else if(char == args[1].length - 1) - output.push(calculateOption) - } - }) - } - } - else - { - - if(args[0] == undefined) output = commands - - else - { - commands.forEach(command => { - for(let char = 0; char < args[0].length; char++) - { - if(command[char] != args[0][char]) - break - else if(char == args[0].length - 1) - output.push(command) - } - }) - } + case "reload": + output = findTabOutput(args[1], reloadOptions) + break + case "calculate": + case "calc": + output = findTabOutput(args[1], calculateOptions) + break + default: + output = findTabOutput(args[0], commands) + break } return output }).setName("cw").setAliases(["coleweight"]) @@ -187,4 +175,22 @@ register("command", (arg) => { .sort() return players -}).setName("fetchdiscord").setAliases(["fdiscord"]);
\ No newline at end of file +}).setName("fetchdiscord").setAliases(["fdiscord"]); + +function findTabOutput(input, options) +{ + let output = [] + + if(input == undefined || input == "") return options + options.forEach(option => { + for(let char = 0; char < input.length; char++) + { + if(option[char] != input[char]) + break + else if(char == input.length - 1) + output.push(option) + } + }) + + return output +}
\ No newline at end of file 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) / |
