aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chat/apiNew.js24
-rw-r--r--chat/message.js51
-rw-r--r--chat/serverdata.js20
-rw-r--r--commandManager.js98
-rw-r--r--commands/claim.js59
-rw-r--r--commands/fetchDiscord.js26
-rw-r--r--commands/findColeweight.js22
-rw-r--r--commands/help.js9
-rw-r--r--commands/info.js23
-rw-r--r--commands/tick.js64
-rw-r--r--commands/time.js13
-rw-r--r--commands/toggle.js9
-rw-r--r--config.toml4
-rw-r--r--gui/settingsGui.js29
-rw-r--r--index.js16
-rw-r--r--metadata.json2
-rw-r--r--render/bobombOverlay.js22
-rw-r--r--render/collectionGui.js43
-rw-r--r--render/cwGui.js (renamed from gui/cwGui.js)39
-rw-r--r--render/powertrackerGui.js132
-rw-r--r--render/tabList.js26
-rw-r--r--render/timerGui.js54
-rw-r--r--settings.js136
-rw-r--r--util/constants.js30
-rw-r--r--util/grieferTrack.js44
-rw-r--r--util/helperFunctions.js10
-rw-r--r--util/updater.js36
27 files changed, 902 insertions, 139 deletions
diff --git a/chat/apiNew.js b/chat/apiNew.js
new file mode 100644
index 0000000..eaab375
--- /dev/null
+++ b/chat/apiNew.js
@@ -0,0 +1,24 @@
+import constants from "../util/constants"
+import axios from "../../axios"
+const PREFIX = constants.PREFIX
+
+
+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!`)
+ })
+ .catch(err => {
+ ChatLib.chat(`${PREFIX}&eKey is not valid!`)
+ })
+ ChatLib.chat(ChatLib.getCenteredText(`${PREFIX}&aApi Key Successfully Set!`))
+}).setCriteria(/Your new API key is (.+)/)
+
+export default "" \ No newline at end of file
diff --git a/chat/message.js b/chat/message.js
new file mode 100644
index 0000000..7a221c7
--- /dev/null
+++ b/chat/message.js
@@ -0,0 +1,51 @@
+/*
+Created 11/11/2022 by Ninjune.
+*/
+
+import axios from "../../axios"
+import settings from "../settings"
+import constants from "../util/constants"
+import { addCommas } from "../util/helperFunctions"
+const PREFIX = constants.PREFIX
+
+register("chat", (level, typeOfChat, hypixelRank, username, playerMessage, event) => { // CW Rank
+ if(!settings.rankChat) return
+ if(!settings.rankEverywhere && !(constants.serverData.map == "Crystal Hollows" || constants.serverData.map == "Dwarven Mines")) return
+ if(!settings.rankEverywhere && typeOfChat != "") return
+ let onward = true
+
+ playerMessage.split(" ").forEach((chunk) => {
+ if (chunk.startsWith("https"))
+ onward = false
+ })
+ if(!onward) return
+
+ let message = ChatLib.getChatMessage(event, true),
+ messagePrefix = message,
+ newMessage = new Message()
+ cancel(event)
+ axios.get(`https://ninjune.dev/api/lbpos?username=${username}`)
+ .then(res => {
+ if(res.data.rank > 0 && res.data.rank < 501)
+ messagePrefix = message.slice(0, message.indexOf(':')) + ` &8[&6#${addCommas(res.data.rank)}&8]&f: `
+ else if(hypixelRank == "" && typeOfChat == "")
+ messagePrefix = message.slice(0, message.indexOf(':')) + `&7: `
+ else
+ messagePrefix = message.slice(0, message.indexOf(':')) + `&f: `
+
+ newMessage.addTextComponent(messagePrefix)
+
+ if (hypixelRank == "" && typeOfChat == "")
+ playerMessage = "&7" + playerMessage.slice(0)
+ else
+ playerMessage = "&f" + playerMessage.slice(0)
+
+ newMessage.addTextComponent(playerMessage)
+ ChatLib.chat(newMessage)
+ })
+ .catch(err => {
+ ChatLib.chat(err)
+ })
+}).setCriteria(/^(\[\d+\] )?((?:(?:Guild|Party|Co-op) > )|(?:\[:v:\] ))?(\[\w+\+{0,2}\] )?(\w{1,16})(?: \[\w{1,6}\])?: (.*)$/g)
+
+export default "" \ No newline at end of file
diff --git a/chat/serverdata.js b/chat/serverdata.js
new file mode 100644
index 0000000..6b634d0
--- /dev/null
+++ b/chat/serverdata.js
@@ -0,0 +1,20 @@
+import constants from "../util/constants";
+let needCheck = false
+
+register("chat", (message, event) => {
+ if(needCheck)
+ {
+ try
+ {
+ constants.serverData = JSON.parse(message)
+ cancel(event)
+ needCheck = false
+ }
+ catch (e) {}
+ }
+}).setCriteria(/(\{"server":"(?:.*)","gametype":"(?:.*)","mode":"(?:.*)","map":"(?:.*)"\})/g)
+
+register('worldLoad', () => {
+ needCheck = true
+ ChatLib.command('locraw')
+}) \ No newline at end of file
diff --git a/commandManager.js b/commandManager.js
index 9acc4e4..c903e6b 100644
--- a/commandManager.js
+++ b/commandManager.js
@@ -1,19 +1,24 @@
-import axios from '../axios'
+import { openTimerGui } from "./render/timerGui.js"
+import { openPowderGui, updateDisplay } from "./render/powertrackerGui"
+import { openCwGui } from "./render/cwGui"
import { help } from "./commands/help.js"
import { reload } from "./commands/reload.js"
import { setkey } from "./commands/setkey.js"
import { spiral } from "./commands/spiral.js"
import { throne } from "./commands/throne.js"
-import { toggle } from "./commands/toggle.js"
import { leaderboard } from "./commands/leaderboard.js"
-import { update } from './commands/update'
-import { openCwGui } from './gui/cwGui'
-import Settings from "./gui/settingsGui";
-import constants from './util/constants.js'
-
-const PREFIX = constants.PREFIX
+import { update } from "./commands/update"
+import { fetchDiscord } from "./commands/fetchDiscord"
+import { findColeweight } from "./commands/findColeweight"
+import { claim } from "./commands/claim"
+import { tick } from "./commands/tick"
+import { time } from "./commands/time"
+import { info } from "./commands/info"
+import Settings from "./settings"
+import constants from "./util/constants"
register("command", (arg, arg2, arg3) => {
+ if (arg == undefined) {findColeweight(arg); return}
switch(arg.toLowerCase())
{
case "setkey":
@@ -23,10 +28,22 @@ register("command", (arg, arg2, arg3) => {
help()
break
case "move":
- openCwGui()
- break
- case "toggle":
- toggle()
+ if (arg2 == undefined) {ChatLib.chat(`${constants.PREFIX}&cNot enough arguments.`); return}
+ switch(arg2.toLowerCase())
+ {
+ case "coleweight":
+ openCwGui()
+ break
+ case "powdertracker":
+ openPowderGui()
+ break
+ case "time":
+ case "timer":
+ openTimerGui()
+ break
+ default:
+ ChatLib.chat(`${constants.PREFIX}&cNo such gui as '${arg2}'.`)
+ }
break
case "throne":
throne(arg2)
@@ -43,29 +60,31 @@ register("command", (arg, arg2, arg3) => {
case "update":
update()
break
+ case "config":
case "settings":
Settings.openGUI()
break
+ case "claim":
+ claim(arg2)
+ break
+ case "powdertrackersync":
+ updateDisplay()
+ break
+ case "tick":
+ tick(arg2, arg3)
+ break
+ case "time":
+ time()
+ break
+ case "info":
+ info()
+ break
default:
- ChatLib.chat(`${constants.PREFIX}Finding Coleweight!`)
- let username = ""
- if(arg == undefined)
- username = Player.getUUID()
- else
- username = arg
- axios.get(`https://ninjune.dev/api/coleweight?username=${username}`)
- .then(res => {
- let coleweightMessage = new TextComponent(`${constants.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}`)
- ChatLib.chat(coleweightMessage)
- })
- .catch(err => {
- ChatLib.chat(`${PREFIX}&eError. (api may be down)`)
- })
+ findColeweight(arg)
}
}).setTabCompletions((args) => {
let output = [],
- commands = ["setkey", "help", "gui", "toggle", "throne", "spiral", "reload", "leaderboard", "settings"]
+ commands = ["setkey", "help", "move", "toggle", "throne", "spiral", "reload", "leaderboard", "settings", "claim", "tick", "time", "info"]
if(args[0].length == 0 || args[0] == undefined)
output = commands
@@ -86,30 +105,13 @@ register("command", (arg, arg2, arg3) => {
}).setName("cw").setAliases(["coleweight"])
register("command", (arg) => {
- if(arg == undefined) { ChatLib.chat(`${PREFIX}&eRequires a username!`); return; }
- axios.get(`https://api.ashcon.app/mojang/v2/user/${arg}`)
- .then(res => {
- let uuid = res.data.uuid;
- axios.get(`https://api.hypixel.net/player?key=${constants.data.api_key}&uuid=${uuid}`)
- .then(res2 => {
- let discordMessage = new TextComponent(`${PREFIX}&a${res.data.username}'s Discord: `)
- ChatLib.chat(discordMessage);
- ChatLib.chat(`&b${res2.data.player.socialMedia.links.DISCORD}`)
- })
- .catch(err => {
- ChatLib.chat(`${PREFIX}&eNo discord linked :( (or no key linked)`)
- })
- })
- .catch(err => {
- ChatLib.chat(`${PREFIX}&eInvalid name! `)
- });
+ fetchDiscord(arg)
}).setTabCompletions((args) => {
let players = World.getAllPlayers().map((p) => p.getName())
.filter((n) =>
n.toLowerCase().startsWith(args.length ? args[0].toLowerCase() : "")
)
- .sort(),
- output = players
+ .sort()
- return output
+ return players
}).setName("fetchdiscord").setAliases(["fdiscord"]); \ No newline at end of file
diff --git a/commands/claim.js b/commands/claim.js
new file mode 100644
index 0000000..fc0bc57
--- /dev/null
+++ b/commands/claim.js
@@ -0,0 +1,59 @@
+import axios from "../../axios"
+import settings from "../settings"
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+
+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(`https://ninjune.dev/api/claim?type=${structure}&id=${constants.serverData.server}&key=${constants.data.api_key}`)
+ .then(res => {
+ if(res.data.success)
+ ChatLib.chat(`${PREFIX}&aSuccessfully claimed ${constants.serverData.server} as your server!`)
+ else
+ ChatLib.chat(`${PREFIX}&cError: ${res.data.reason}`)
+ })
+ .catch(err => {
+ ChatLib.chat(`${PREFIX}&cError: ${err}`)
+ })
+ // key is used above to verify that the player trying to claim the lobby is the intended player, don't know a better way of doing this.
+}
+
+
+register('worldLoad', () => {
+ if(!settings.claiming) return
+ setTimeout(() => {
+ console.log(constants.serverData.server)
+ axios.get(`https://ninjune.dev/api/claim?claimedlobby=${constants.serverData.server}`)
+ .then(res => {
+ if(res.data.claimed)
+ {
+ World.getAllPlayers().forEach((player) => {
+ if (player.getName() == res.data.player)
+ ChatLib.chat(`${PREFIX}&cThe ${res.data.structure} in this lobby is claimed by ${res.data.player}.`)
+ })
+ }
+ })
+ .catch(err => {
+ ChatLib.chat(`${PREFIX}Error: ${err}`)
+ })
+ }, 2000)
+}) \ No newline at end of file
diff --git a/commands/fetchDiscord.js b/commands/fetchDiscord.js
new file mode 100644
index 0000000..f44c385
--- /dev/null
+++ b/commands/fetchDiscord.js
@@ -0,0 +1,26 @@
+import axios from "../../axios"
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function fetchDiscord(arg)
+{
+ if(arg == undefined) { ChatLib.chat(`${PREFIX}&eRequires a username!`); return }
+
+ axios.get(`https://api.ashcon.app/mojang/v2/user/${arg}`)
+ .then(res => {
+ let uuid = res.data.uuid
+ axios.get(`https://api.hypixel.net/player?key=${constants.data.api_key}&uuid=${uuid}`)
+ .then(res2 => {
+ let discordMessage = new TextComponent(`${PREFIX}&a${res.data.username}'s Discord: `)
+ ChatLib.chat(discordMessage);
+ ChatLib.chat(`&b${res2.data.player.socialMedia.links.DISCORD}`)
+ })
+ .catch(err => {
+ ChatLib.chat(`${PREFIX}&eNo discord linked :( (or no key linked)`)
+ })
+ })
+ .catch(err => {
+ ChatLib.chat(`${PREFIX}&eInvalid name! `)
+ })
+}
+
diff --git a/commands/findColeweight.js b/commands/findColeweight.js
new file mode 100644
index 0000000..d3fa38a
--- /dev/null
+++ b/commands/findColeweight.js
@@ -0,0 +1,22 @@
+import axios from "../../axios"
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function findColeweight(arg)
+{
+ ChatLib.chat(`${PREFIX}Finding Coleweight!`)
+ let username = ""
+ if(arg == undefined)
+ username = Player.getUUID()
+ else
+ 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}`)
+ ChatLib.chat(coleweightMessage)
+ })
+ .catch(err => {
+ 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 bc22fda..3c20b01 100644
--- a/commands/help.js
+++ b/commands/help.js
@@ -6,9 +6,12 @@ export function help()
ChatLib.chat("")
ChatLib.chat(`${PREFIX}&b/cw [username] => Gets coleweight`)
ChatLib.chat(`${PREFIX}&b/cw help => This menu.`)
- ChatLib.chat(`${PREFIX}&b/cw move => Change gui location`)
- ChatLib.chat(`${PREFIX}&b/cw toggle => Toggle gui (gui is only active when mining)`)
- ChatLib.chat(`${PREFIX}&b/cw setkey (key) => Sets API key (can also use /api new)`)
+ ChatLib.chat(`${PREFIX}&b/cw settings => Open settings.`)
+ ChatLib.chat(`${PREFIX}&b/cw time => Prints time on timer (timer gui doesn't have to be visible).`)
+ ChatLib.chat(`${PREFIX}&b/cw tick <mining speed> <('r','jade', etc) || breaking power of block> => Shows tick data.`)
+ ChatLib.chat(`${PREFIX}&b/cw info => Prints coleweight info.`)
+ ChatLib.chat(`${PREFIX}&b/cw claim <throne || spiral> => Claims a chollows sapphire structure in a lobby.`)
+ ChatLib.chat(`${PREFIX}&b/cw setkey <key> => Sets API key (can also use /api new)`)
ChatLib.chat(`${PREFIX}&b/cw reload => Reloads the gui.`)
ChatLib.chat(`${PREFIX}&b/cw throne => Guide for setting up waypoints for throne.`)
ChatLib.chat(`${PREFIX}&b/cw spiral => Guide for setting up waypoints for spiral.`)
diff --git a/commands/info.js b/commands/info.js
new file mode 100644
index 0000000..3967863
--- /dev/null
+++ b/commands/info.js
@@ -0,0 +1,23 @@
+import axios from "../../axios"
+import constants from "../util/constants"
+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)`
+ })
+} \ No newline at end of file
diff --git a/commands/tick.js b/commands/tick.js
new file mode 100644
index 0000000..7af81e2
--- /dev/null
+++ b/commands/tick.js
@@ -0,0 +1,64 @@
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function tick(speed, block)
+{
+ if(speed == undefined || parseInt(speed) != speed)
+ return `${PREFIX}&cMining speed must be an integer!`
+ let strength = findStrength(block)
+ if(strength < 1) return `${PREFIX}&cBlock must be a gemstone or positive breaking power! (or starting letter of gemstone)`
+ let currentBlockTick = strength*30/speed,
+ currentShardTick = (strength-200)*30/speed,
+ nextBlockSpeed, nextShardSpeed
+
+ if(currentBlockTick < Math.floor(currentBlockTick) + 0.5)
+ nextBlockSpeed = strength*30/(Math.floor(currentBlockTick)-0.5)
+ else
+ nextBlockSpeed = strength*30/(Math.floor(currentBlockTick)+0.5)
+
+ if(currentShardTick < Math.floor(currentShardTick) + 0.5)
+ nextShardSpeed = strength*30/(Math.floor(currentShardTick)-0.5)
+ else
+ nextShardSpeed = strength*30/(Math.floor(currentShardTick)+0.5)
+
+ ChatLib.chat(`\n&bCurrently mining blocks in &6&l${Math.round(currentBlockTick)} ticks` +
+ `\n&bCurrently mining shards in &6&l${Math.round(currentShardTick)} ticks` +
+ `\n&bNext block tick will be at: &6&l${Math.round(nextBlockSpeed)} mining speed` +
+ `\n&bNext shard tick will be at: &6&l${Math.round(nextShardSpeed)} mining speed` +
+ `\n&bYou need &6&l${Math.round(nextBlockSpeed - speed)} mining speed&b to get the next block tick.` +
+ `\n&bYou need &6&l${Math.round(nextShardSpeed - speed)} mining speed&b to get the next shard tick.\n`)
+}
+
+function findStrength(block)
+{
+ let strength = -1
+
+ if(block == parseInt(block))
+ strength = block
+ else
+ {
+ switch(block.toLowerCase())
+ {
+ case "ruby":
+ case "r":
+ strength = 2500
+ break
+ case "j":
+ case "jade":
+ case "a":
+ case "amber":
+ case "amethyst":
+ case "s":
+ case "sapphire":
+ strength = 3200
+ break
+ case "t":
+ case "topaz":
+ case "o":
+ case "opal":
+ strength = 4000
+ }
+ }
+
+ return strength
+}
diff --git a/commands/time.js b/commands/time.js
new file mode 100644
index 0000000..115964e
--- /dev/null
+++ b/commands/time.js
@@ -0,0 +1,13 @@
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+
+export function time()
+{
+ let timerHr = Math.floor(constants.timerdata.timer/60/60)
+
+ if(timerHr >= 1)
+ ChatLib.chat(`${PREFIX}&aTimer (${constants.serverData.server}): &b${timerHr}h ${Math.floor(constants.timerdata.timer/60) - timerHr*60}m`)
+ else
+ ChatLib.chat(`${PREFIX}&aTimer (${constants.serverData.server}): &b${Math.floor(constants.timerdata.timer/60)}m ${Math.floor(constants.timerdata.timer%60)}s`)
+} \ No newline at end of file
diff --git a/commands/toggle.js b/commands/toggle.js
deleted file mode 100644
index a5e0ec2..0000000
--- a/commands/toggle.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import constants from "../util/constants"
-const PREFIX = constants.PREFIX
-
-export function toggle()
-{
- constants.data.cwToggle = !constants.data.cwToggle
- constants.data.save()
- ChatLib.chat(`${PREFIX}&bSet gui to: &3${constants.data.cwToggle}`)
-} \ No newline at end of file
diff --git a/config.toml b/config.toml
deleted file mode 100644
index 7b57afa..0000000
--- a/config.toml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-[general]
- tba = ""
-
diff --git a/gui/settingsGui.js b/gui/settingsGui.js
deleted file mode 100644
index 48dbad7..0000000
--- a/gui/settingsGui.js
+++ /dev/null
@@ -1,29 +0,0 @@
-import { @Vigilant, @ButtonProperty, @SwitchProperty, @SelectorProperty, @TextProperty } from 'Vigilance'
-import constants from "../util/constants.js"
-
-@Vigilant("Coleweight")
-class Settings {
- @ButtonProperty({
- name: "Change tracker position",
- description: "Move the location of the tracker.",
- category: "General",
- placeholder: "Open"
- })
- moveLocation() {
- ChatLib.command("cw move", true);
- }
-
- @TextProperty({
- name: "TBA",
- description: "TBA; This menu will probably not work while this text is here.",
- category: "General",
- protected: false
- })
- key = "";
-
- constructor() {
- this.initialize(this);
- }
-}
-
-export default new Settings() \ No newline at end of file
diff --git a/index.js b/index.js
index 7fe755a..e3bdad8 100644
--- a/index.js
+++ b/index.js
@@ -1,12 +1,15 @@
-import axios from '../axios'
+import './chat/apiNew'
+import './chat/message'
+
+import './chat/serverdata'
+import './render/tabList'
import './commandManager'
+import './util/updater'
+import './util/grieferTrack'
+import axios from '../axios'
import constants from './util/constants';
-import "./util/updater"
-import Settings from "./gui/settingsGui.js"
-
const PREFIX = constants.PREFIX
-
//world update (coords)
register("renderWorld", () => {
if(constants.throneValues[0] != undefined)
@@ -26,6 +29,7 @@ register("renderWorld", () => {
})
+
//update every second (dogshit code)
register("step", () => {
// first time check
@@ -39,7 +43,7 @@ register("step", () => {
new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bView commands: /cw help`)).chat()
ChatLib.chat("")
}
- if (constants.data.api_key == undefined) return
+ if (constants.data.api_key == undefined || constants.data.api_key == "") return
// updates coleweight for gui
let date_ob = new Date(),
diff --git a/metadata.json b/metadata.json
index 654a808..67d1e43 100644
--- a/metadata.json
+++ b/metadata.json
@@ -3,6 +3,6 @@
"creator": "Ninjune",
"entry": "index.js",
"description": "Simple Coleweight module to measure mining progression.",
- "version": "1.5.3",
+ "version": "1.6.0",
"requires": ["axios", "PogData", "Vigilance"]
} \ No newline at end of file
diff --git a/render/bobombOverlay.js b/render/bobombOverlay.js
new file mode 100644
index 0000000..02526bd
--- /dev/null
+++ b/render/bobombOverlay.js
@@ -0,0 +1,22 @@
+/*import RenderLib from "../../RenderLib/index.js";
+Disabled.
+register('renderWorld', () => {
+ try{
+ if(Player.getHeldItem().getItemNBT().getTag('tag').getTag('ExtraAttributes').getTag("id").toString() != `"BOB_OMB"`) return
+ } catch(e) {return}
+
+ const boxR = 0.3,
+ boxB = 0.5,
+ boxG = 0,
+ boxAlpha = 0.3
+
+ let x = Math.floor(Player.getX()) + 0.5,
+ y = Math.floor(Player.getY())
+ z = Math.floor(Player.getZ()) + 0.5
+
+
+
+ RenderLib.drawInnerEspBox(x, y - 1, z - 8, 1, 1, boxR, boxB, boxG, boxAlpha, true)
+ RenderLib.drawInnerEspBox(x + 1, y + 1, z - 7, 1, 1, boxR, boxB, boxG, boxAlpha, true)
+ RenderLib.drawInnerEspBox(x + 1, y + 1, z - 7, 1, 1, boxR, boxB, boxG, boxAlpha, true)
+})*/ \ No newline at end of file
diff --git a/render/collectionGui.js b/render/collectionGui.js
new file mode 100644
index 0000000..8197b11
--- /dev/null
+++ b/render/collectionGui.js
@@ -0,0 +1,43 @@
+/*import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+let collectionGui = new Gui(),
+ collection = ""
+
+export function trackCollection(arg)
+{
+ switch(arg)
+ {
+ case "obby":
+ case "obsidian":
+ collection = "OBSIDIAN"
+ break
+ default:
+ ChatLib.chat(`${PREFIX}&eThat is not a valid collection! (or is not supported)`)
+ }
+}
+
+export function moveCollection()
+{
+ collectionGui.open()
+}
+
+register("dragged", (dx, dy, x, y) => {
+ if (!collectionGui.isOpen()) return
+ constants.data.collectionX = x
+ constants.data.collectionY = y
+ constants.data.save()
+})
+
+register("renderOverlay", () => {
+ if (cwGui.isOpen())
+ {
+ let txt = "Please set your api key with /cw setkey (key)!"
+ if (constants.data.api_key != undefined)
+ txt = "Click anywhere to move!"
+ Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2)
+ Renderer.drawStringWithShadow(`&aCollection: &b0\n&aCW/hr: &b0\n&aUptime: &b0m\n&aColeweight Gained: &b0`, constants.data.collectionX, constants.data.collectionY)
+ }
+ if(collection == "") return
+ coleweight > 1000 ?collectionMessage = `&b${coleweight.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`: coleweightMessage = `&b${coleweight.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`
+})*/ \ No newline at end of file
diff --git a/gui/cwGui.js b/render/cwGui.js
index 734593c..d0f4a5c 100644
--- a/gui/cwGui.js
+++ b/render/cwGui.js
@@ -1,33 +1,46 @@
+import settings from "../settings";
import constants from "../util/constants";
-let cwGui = new Gui()
+const cwMove = new Gui(),
+ cwGui = new Display()
+
+cwGui.setBackgroundColor(Renderer.color(0, 0, 0, 75));
+cwGui.setBackground("full");
+cwGui.setMinWidth(100)
export function openCwGui()
{
- cwGui.open()
+ cwMove.open()
}
register("dragged", (dx, dy, x, y) => {
- if (!cwGui.isOpen()) return
+ if (!cwMove.isOpen()) return
constants.data.x = x
constants.data.y = y
constants.data.save()
});
register("renderOverlay", () => {
- if (cwGui.isOpen())
+ cwGui.setShouldRender(false)
+ cwGui.clearLines()
+ cwGui.setRenderLoc(constants.data.x, constants.data.y)
+
+ if (cwMove.isOpen())
{
let txt = "Please set your api key with /cw setkey (key)!"
if (constants.data.api_key != undefined)
txt = "Click anywhere to move!"
Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2)
- Renderer.drawStringWithShadow(`&aCW: &b0\n&aCW/hr: &b0\n&aUptime: &b0m\n&aColeweight Gained: &b0`, constants.data.x, constants.data.y)
+ cwGui.addLines([`&aCW: &b0`, `&aCW/hr: &b0`, `&aUptime: &b69h 420m `, `&aColeweight Gained: &b0 `])
+ cwGui.setShouldRender(true)
}
- if(!constants.data.cwToggle || constants.data.api_key == undefined) return
- let coleweight = constants.data.coleweight || 0,
- coleweightMessage = ""
+ if(!settings.cwToggle || constants.data.api_key == undefined) return
+ let coleweight = constants.data.coleweight || 0,
+ coleweightMessage = "",
+ uptimeHr = Math.floor(constants.uptime/60/60)
+
coleweight > 1000 ?coleweightMessage = `&b${coleweight.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`: coleweightMessage = `&b${coleweight.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`
if(constants.cwValues[0] != undefined && constants.upTimeTrack && constants.calcCwPerHr)
{
@@ -41,10 +54,12 @@ register("renderOverlay", () => {
constants.calcCwPerHr = false
}
- if (cwGui.isOpen() || !constants.upTimeTrack) return
- let uptimeHr = Math.floor(constants.uptime/60/60)
+ if (cwMove.isOpen() || !constants.upTimeTrack) return
+
+ cwGui.setShouldRender(true)
+
if(uptimeHr >= 1)
- Renderer.drawStringWithShadow(`&aCW: &b${coleweightMessage}\n&aCW/hr: &b${constants.coleweightHr}\n&aUptime: &b${uptimeHr}h ${Math.floor(constants.uptime/60) - uptimeHr*60}m\n&aColeweight Gained: &b${Math.ceil(constants.cwValuesSum*100) / 100}`, constants.data.x, constants.data.y)
+ cwGui.addLines([`&aCW: &b${coleweightMessage}`, `&aCW/hr: &b${constants.coleweightHr}`, `&aUptime: &b${uptimeHr}h ${Math.floor(constants.uptime/60) - uptimeHr*60}m`, `&aColeweight Gained: &b${Math.ceil(constants.cwValuesSum*100) / 100}`])
else
- Renderer.drawStringWithShadow(`&aCW: &b${coleweightMessage}\n&aCW/hr: &b${constants.coleweightHr}\n&aUptime: &b${Math.floor(constants.uptime/60)}m ${Math.floor(constants.uptime%60)}s\n&aColeweight Gained: &b${Math.ceil(constants.cwValuesSum*100) / 100}`, constants.data.x, constants.data.y)
+ cwGui.addLines([`&aCW: &b${coleweightMessage}`, `&aCW/hr: &b${constants.coleweightHr}`, `&aUptime: &b${Math.floor(constants.uptime/60)}m ${Math.floor(constants.uptime%60)}s`, `&aColeweight Gained: &b${Math.ceil(constants.cwValuesSum*100) / 100}`])
}) \ No newline at end of file
diff --git a/render/powertrackerGui.js b/render/powertrackerGui.js
new file mode 100644
index 0000000..0e7985a
--- /dev/null
+++ b/render/powertrackerGui.js
@@ -0,0 +1,132 @@
+/*
+Major credit to Fabi019 for Powdertracker module.
+*/
+import constants from "../util/constants"
+import settings from "../settings"
+
+const moveGui = new Gui(),
+ powderGui = new Display(),
+ bossBar = Java.type("net.minecraft.entity.boss.BossStatus").field_82827_c
+
+powderGui.setBackgroundColor(Renderer.color(0, 0, 0, 75));
+powderGui.setBackground("full");
+
+let sessionRunning = false,
+ sessionChests = 0,
+ sessionGemstone = 0,
+ sessionMithril = 0,
+ seconds = 0,
+ timeSinceLastGain = 0
+
+export function openPowderGui()
+{
+ moveGui.open()
+}
+
+function DoublePowderActive()
+{
+ return bossBar.includes("2X POWDER")
+}
+
+register("dragged", (dx, dy, x, y) => {
+ if (!moveGui.isOpen()) return
+ sessionRunning = true
+ po