diff options
Diffstat (limited to 'commandManager.js')
-rw-r--r-- | commandManager.js | 110 |
1 files changed, 58 insertions, 52 deletions
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 |