aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNinjune <enderknight537@gmail.com>2022-11-27 19:41:13 -0600
committerNinjune <enderknight537@gmail.com>2022-11-27 19:41:13 -0600
commit584dbd71d9bfe6a3b6fdd5d91f8025df3193f889 (patch)
tree40972c73be86e71240afea9d7212192a2ac0dd6a
parentf8aacdf7e45003719efd949ecb8bc30001e24e17 (diff)
downloadcoleweight-584dbd71d9bfe6a3b6fdd5d91f8025df3193f889.tar.gz
coleweight-584dbd71d9bfe6a3b6fdd5d91f8025df3193f889.tar.bz2
coleweight-584dbd71d9bfe6a3b6fdd5d91f8025df3193f889.zip
v1.6.6v1.6.7
-rw-r--r--commandManager.js17
-rw-r--r--commands/divans.js83
-rw-r--r--commands/grieferList.js23
-rw-r--r--commands/help.js50
-rw-r--r--commands/spiral.js51
-rw-r--r--commands/throne.js43
-rw-r--r--commands/yog.js2
-rw-r--r--index.js19
-rw-r--r--metadata.json4
-rw-r--r--render/coordsGui.js94
-rw-r--r--render/downtimeGui.js86
-rw-r--r--render/textGuiCreator.js20
-rw-r--r--settings.js22
-rw-r--r--util/constants.js6
-rw-r--r--util/waypoints.js7
15 files changed, 450 insertions, 77 deletions
diff --git a/commandManager.js b/commandManager.js
index 0985e28..cf28a8c 100644
--- a/commandManager.js
+++ b/commandManager.js
@@ -1,5 +1,7 @@
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 } from "./render/cwGui"
import { help } from "./commands/help"
import { reload } from "./commands/reload"
@@ -18,6 +20,7 @@ import { info } from "./commands/info"
import Settings from "./settings"
import constants from "./util/constants"
import { clearLobbies } from "./commands/markingLobbies"
+import { divans } from "./commands/divans.js"
register("command", (arg, arg2, arg3) => {
if (arg == undefined) {findColeweight(arg); return}
@@ -43,6 +46,9 @@ register("command", (arg, arg2, arg3) => {
case "timer":
openTimerGui()
break
+ case "downtime":
+ openDowntimeGui()
+ break
default:
ChatLib.chat(`${constants.PREFIX}&cNo such gui as '${arg2}'.`)
}
@@ -87,12 +93,21 @@ register("command", (arg, arg2, arg3) => {
case "yog":
yog(arg2)
break
+ case "divans":
+ case "divan":
+ divans(arg2)
+ break
+ case "coord":
+ case "coords":
+ openCoordsGui()
+ break
default:
findColeweight(arg)
}
}).setTabCompletions((args) => {
let output = [],
- commands = ["setkey", "help", "move", "toggle", "throne", "spiral", "reload", "leaderboard", "settings", "claim", "tick", "time", "info", "clearlobbies", "yog"]
+ commands = ["setkey", "help", "move", "toggle", "throne", "spiral", "reload", "leaderboard",
+ "settings", "claim", "tick", "time", "info", "clearlobbies", "yog", "divan", "coords"]
if(args[0].length == 0 || args[0] == undefined)
output = commands
diff --git a/commands/divans.js b/commands/divans.js
new file mode 100644
index 0000000..b1ee97c
--- /dev/null
+++ b/commands/divans.js
@@ -0,0 +1,83 @@
+import constants from "../util/constants"
+import { waypointRender } from "../util/waypoints"
+
+const PREFIX = constants.PREFIX
+let divanWaypoints = []
+
+export function divans(arg2)
+{
+ const WAYPOINTNAME = "Divan"
+
+ if(arg2 != "toggle")
+ {
+ new TextComponent(`${PREFIX}&bGo to the middle of jade crystal then do /cw coords divans toggle.`)
+ .chat()
+ }
+ else
+ {
+ if(divanWaypoints[0] == undefined)
+ {
+ let startPos = [Player.getX(), Player.getY(), Player.getZ()],
+ x = startPos[0],
+ y = startPos[1],
+ z = startPos[2]
+
+ console.log(x + " " + y + " " + z)
+ divanWaypoints.push([x + 1, y + -40, z + -20])
+ divanWaypoints.push([x + 30, y + -39, z + -25])
+ divanWaypoints.push([x + -31, y + -39, z + -12])
+ divanWaypoints.push([x + 1, y + -39, z + 20])
+ divanWaypoints.push([x + -14, y + -39, z + 43])
+ divanWaypoints.push([x + -12, y + -39, z + -44])
+ divanWaypoints.push([x + -20, y + -40, z + 0])
+ divanWaypoints.push([x + 22, y + -39, z + -14])
+ divanWaypoints.push([x + 29, y + -39, z + -44])
+ divanWaypoints.push([x + 12, y + -39, z + 7])
+ divanWaypoints.push([x + 23, y + -40, z + -39])
+ divanWaypoints.push([x + -37, y + -39, z + 11])
+ divanWaypoints.push([x + 7, y + -39, z + 11])
+ divanWaypoints.push([x + 6, y + -39, z + 11])
+ divanWaypoints.push([x + -38, y + -40, z + 26])
+ divanWaypoints.push([x + 12, y + -40, z + -22])
+ divanWaypoints.push([x + -5, y + -39, z + 16])
+ divanWaypoints.push([x + 40, y + -40, z + -30])
+ divanWaypoints.push([x + 42, y + -37, z + -41])
+ divanWaypoints.push([x + -23, y + -40, z + 40])
+ divanWaypoints.push([x + 20, y + -40, z + 0])
+ divanWaypoints.push([x + -24, y + -40, z + 12])
+ divanWaypoints.push([x + 38, y + -40, z + -26])
+ divanWaypoints.push([x + 43, y + -39, z + -16])
+ divanWaypoints.push([x + -40, y + -40, z + 18])
+ divanWaypoints.push([x + -17, y + -39, z + 20])
+ divanWaypoints.push([x + 19, y + -40, z + 29])
+ divanWaypoints.push([x + -37, y + -39, z + -14])
+ divanWaypoints.push([x + -14, y + -39, z + 22])
+ divanWaypoints.push([x + -42, y + -38, z + -28])
+ divanWaypoints.push([x + -43, y + -40, z + -40])
+ divanWaypoints.push([x + 25, y + -40, z + 17])
+ divanWaypoints.push([x + 12, y + -40, z + 31])
+ divanWaypoints.push([x + -31, y + -39, z + -40])
+ divanWaypoints.push([x + -36, y + -38, z + 42])
+ divanWaypoints.push([x + 7, y + -39, z + 22])
+ divanWaypoints.push([x + 20, y + -39, z + -26])
+ divanWaypoints.push([x + 12, y + -39, z + -43])
+ ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned on!`)
+ }
+ else
+ {
+ divanWaypoints = []
+ ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned off!`)
+ }
+ }
+}
+
+register("renderWorld", () => {
+ waypointRender(divanWaypoints)
+})
+
+
+register("worldLoad", () => {
+ divanWaypoints = []
+})
+
+export default "" \ No newline at end of file
diff --git a/commands/grieferList.js b/commands/grieferList.js
new file mode 100644
index 0000000..0762f8e
--- /dev/null
+++ b/commands/grieferList.js
@@ -0,0 +1,23 @@
+/*import settings from "../settings" // future
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function grieferList(arg2, arg3)
+{
+ switch(arg2)
+ {
+ case "list":
+ break
+ case "add":
+ let griefers = JSON.parse(FileLib.read("Coleweight", "config/grieferlist.txt"))
+ griefers.push({griefers: [name]})
+ FileLib.write("Coleweight", "config/grieferlist.txt", `${JSON.stringify(griefers)}`)
+ ChatLib.chat(`${PREFIX}&aAdded ${arg3} to griefer list!`)
+ break
+ case "remove":
+ break
+ default:
+ ChatLib.chat(`${PREFIX}&cArgument '${arg2 ?? ""}' not found`)
+ break
+ }
+}*/ \ No newline at end of file
diff --git a/commands/help.js b/commands/help.js
index 1157c65..05c5a04 100644
--- a/commands/help.js
+++ b/commands/help.js
@@ -1,22 +1,34 @@
-import constants from "../util/constants"
-const PREFIX = constants.PREFIX
+const PREFIX = "◆"
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 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.`)
- ChatLib.chat(`${PREFIX}&b/cw yog => Guide for setting up waypoints for yogs.`)
- ChatLib.chat(`${PREFIX}&b/cw leaderboard => Gets leaderboard within a specific range (like 20 40)`)
- ChatLib.chat(`${PREFIX}&b/fetchdiscord (username) => Gets discord of username (if linked)`)
- ChatLib.chat("")
-} \ No newline at end of file
+ ChatLib.chat("&b--------------[ &a&lColeweight &b]--------------")
+ ChatLib.chat(ChatLib.getCenteredText("&a&lInfo"))
+ helpCommand("", "Gets Coleweight of specified user", "(username)")
+ helpCommand("help", "This menu.", "")
+ helpCommand("time", "Prints time on timer (timer gui doesn't have to be visible).", "")
+ helpCommand("tick", "Shows tick data.", "(mining speed) (('r','jade', etc) || breaking power of block))")
+ helpCommand("leaderboard", "Shows leaderboard.", "(min) [max]")
+ 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.", "")
+ ChatLib.chat(ChatLib.getCenteredText("&a&lWaypoints"))
+ helpCommand("coords", "Opens coords gui.", "")
+ helpCommand("throne", "Guide for setting up waypoints for throne.", "[toggle]")
+ 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]")
+ ChatLib.chat(ChatLib.getCenteredText("&a&lMiscellaneous"))
+ ChatLib.chat(`&a${PREFIX} /fetchdiscord (username) => &bGets discord of username (if linked)`)
+ ChatLib.chat("&b------------------------------------------")
+}
+
+// Made by Almighty Stylla <3
+function helpCommand(command, desc, usage)
+{
+ ChatLib.chat(new TextComponent(`&a${PREFIX} /cw ${command} => &b${desc}`).setHoverValue(`${"/cw " + command + " " + usage}`))
+}
+
diff --git a/commands/spiral.js b/commands/spiral.js
index 122ee08..e25bbb5 100644
--- a/commands/spiral.js
+++ b/commands/spiral.js
@@ -1,5 +1,8 @@
import constants from "../util/constants"
+import { waypointRender } from "../util/waypoints"
+
const PREFIX = constants.PREFIX
+let spiralWaypoints = []
export function spiral(arg2)
{
@@ -12,31 +15,41 @@ export function spiral(arg2)
}
else
{
- if(constants.spiralValues[0] == undefined)
+ if(spiralWaypoints[0] == undefined)
{
let startPos = [Player.getX(), Player.getY(), Player.getZ()]
- constants.spiralValues.push([startPos[0]+2, startPos[1]-3, startPos[2]+14])
- constants.spiralValues.push([startPos[0]+3, startPos[1]-21, startPos[2]+6])
- constants.spiralValues.push([startPos[0]+6, startPos[1]-23, startPos[2]-1])
- constants.spiralValues.push([startPos[0]+19, startPos[1]+4, startPos[2]-5])
- constants.spiralValues.push([startPos[0]+21, startPos[1]-7, startPos[2]])
- constants.spiralValues.push([startPos[0]+25, startPos[1]-35, startPos[2]-8])
- constants.spiralValues.push([startPos[0]+39, startPos[1]-36, startPos[2]])
- constants.spiralValues.push([startPos[0]+52, startPos[1]-24, startPos[2]+1])
- constants.spiralValues.push([startPos[0]+48, startPos[1]+3, startPos[2]+3])
- constants.spiralValues.push([startPos[0]+47, startPos[1]+4, startPos[2]+22])
- constants.spiralValues.push([startPos[0]+55, startPos[1]-8, startPos[2]+42])
- constants.spiralValues.push([startPos[0]+46, startPos[1]-11, startPos[2]+49])
- constants.spiralValues.push([startPos[0]+26, startPos[1]+5, startPos[2]+39])
- constants.spiralValues.push([startPos[0]+20, startPos[1]+3, startPos[2]+41])
- constants.spiralValues.push([startPos[0]+8, startPos[1]-23, startPos[2]+32])
- constants.spiralValues.push([startPos[0]+4, startPos[1]-23, startPos[2]+28])
+ spiralWaypoints.push([startPos[0]+2, startPos[1]-3, startPos[2]+14])
+ spiralWaypoints.push([startPos[0]+3, startPos[1]-21, startPos[2]+6])
+ spiralWaypoints.push([startPos[0]+6, startPos[1]-23, startPos[2]-1])
+ spiralWaypoints.push([startPos[0]+19, startPos[1]+4, startPos[2]-5])
+ spiralWaypoints.push([startPos[0]+21, startPos[1]-7, startPos[2]])
+ spiralWaypoints.push([startPos[0]+25, startPos[1]-35, startPos[2]-8])
+ spiralWaypoints.push([startPos[0]+39, startPos[1]-36, startPos[2]])
+ spiralWaypoints.push([startPos[0]+52, startPos[1]-24, startPos[2]+1])
+ spiralWaypoints.push([startPos[0]+48, startPos[1]+3, startPos[2]+3])
+ spiralWaypoints.push([startPos[0]+47, startPos[1]+4, startPos[2]+22])
+ spiralWaypoints.push([startPos[0]+55, startPos[1]-8, startPos[2]+42])
+ spiralWaypoints.push([startPos[0]+46, startPos[1]-11, startPos[2]+49])
+ spiralWaypoints.push([startPos[0]+26, startPos[1]+5, startPos[2]+39])
+ spiralWaypoints.push([startPos[0]+20, startPos[1]+3, startPos[2]+41])
+ spiralWaypoints.push([startPos[0]+8, startPos[1]-23, startPos[2]+32])
+ spiralWaypoints.push([startPos[0]+4, startPos[1]-23, startPos[2]+28])
ChatLib.chat(`${PREFIX}&bSpiral waypoints turned on!`)
}
else
{
- constants.spiralValues = []
+ spiralWaypoints = []
ChatLib.chat(`${PREFIX}&bSpiral waypoints turned off!`)
}
}
-} \ No newline at end of file
+}
+
+register("renderWorld", () => {
+ waypointRender(spiralWaypoints)
+})
+
+register("worldLoad", () => {
+ spiralWaypoints = []
+})
+
+export default "" \ No newline at end of file
diff --git a/commands/throne.js b/commands/throne.js
index 717ba3c..cab7779 100644
--- a/commands/throne.js
+++ b/commands/throne.js
@@ -1,5 +1,8 @@
import constants from "../util/constants"
+import { waypointRender } from "../util/waypoints"
+
const PREFIX = constants.PREFIX
+let throneWaypoints = []
export function throne(arg2)
{
@@ -9,28 +12,36 @@ export function throne(arg2)
}
else
{
- if(constants.throneValues[0] == undefined)
+ if(throneWaypoints[0] == undefined)
{
let startPos = [Player.getX()-24, Player.getY()+6, Player.getZ()-59] // calculated below values at a weird start so adjusting them
- constants.throneValues.push([startPos[0]+8, startPos[1]+2, startPos[2]-5])
- constants.throneValues.push([startPos[0]+11, startPos[1]-35, startPos[2]-3])
- constants.throneValues.push([startPos[0]+2, startPos[1]-34, startPos[2]-4])
- constants.throneValues.push([startPos[0]+-2, startPos[1]-1, startPos[2]+49])
- constants.throneValues.push([startPos[0]+2, startPos[1]-13, startPos[2]+52])
- constants.throneValues.push([startPos[0]+27, startPos[1]-9, startPos[2]+51])
- constants.throneValues.push([startPos[0]+38, startPos[1]-15, startPos[2]+47])
- constants.throneValues.push([startPos[0]+41, startPos[1]-44, startPos[2]+46])
- constants.throneValues.push([startPos[0]+50, startPos[1]-28, startPos[2]+38])
- constants.throneValues.push([startPos[0]+55, startPos[1]-36, startPos[2]+29])
- constants.throneValues.push([startPos[0]+49, startPos[1]-31, startPos[2]+1])
- constants.throneValues.push([startPos[0]+50, startPos[1]-1, startPos[2]+10])
- constants.throneValues.push([startPos[0]+45, startPos[1]-3, startPos[2]-4])
+ throneWaypoints.push([startPos[0]+8, startPos[1]+2, startPos[2]-5])
+ throneWaypoints.push([startPos[0]+11, startPos[1]-35, startPos[2]-3])
+ throneWaypoints.push([startPos[0]+2, startPos[1]-34, startPos[2]-4])
+ throneWaypoints.push([startPos[0]+-2, startPos[1]-1, startPos[2]+49])
+ throneWaypoints.push([startPos[0]+2, startPos[1]-13, startPos[2]+52])
+ throneWaypoints.push([startPos[0]+27, startPos[1]-9, startPos[2]+51])
+ throneWaypoints.push([startPos[0]+38, startPos[1]-15, startPos[2]+47])
+ throneWaypoints.push([startPos[0]+41, startPos[1]-44, startPos[2]+46])
+ throneWaypoints.push([startPos[0]+50, startPos[1]-28, startPos[2]+38])
+ throneWaypoints.push([startPos[0]+55, startPos[1]-36, startPos[2]+29])
+ throneWaypoints.push([startPos[0]+49, startPos[1]-31, startPos[2]+1])
+ throneWaypoints.push([startPos[0]+50, startPos[1]-1, startPos[2]+10])
+ throneWaypoints.push([startPos[0]+45, startPos[1]-3, startPos[2]-4])
ChatLib.chat(`${PREFIX}&bThrone waypoints turned on!`)
}
else
{
- constants.throneValues = []
+ throneWaypoints = []
ChatLib.chat(`${PREFIX}&bThrone waypoints turned off!`)
}
}
-} \ No newline at end of file
+}
+
+register("renderWorld", () => {
+ waypointRender(throneWaypoints)
+})
+
+register("worldLoad", () => {
+ throneWaypoints = []
+})
diff --git a/commands/yog.js b/commands/yog.js
index 15a3d9b..9758321 100644
--- a/commands/yog.js
+++ b/commands/yog.js
@@ -9,7 +9,7 @@ export function yog(arg2)
if(arg2 != "toggle")
{
- new TextComponent(`${PREFIX}&bGo to the leftmost corner of the topaz crystal facing bal close to bal then do /cw yog toggle.`)
+ new TextComponent(`${PREFIX}&bGo to the leftmost corner of the topaz crystal facing bal close to bal then do /cw coords yog toggle.`)
.chat()
}
else
diff --git a/index.js b/index.js
index eda6be1..bb38e78 100644
--- a/index.js
+++ b/index.js
@@ -11,25 +11,6 @@ import axios from '../axios'
import constants from './util/constants';
const PREFIX = constants.PREFIX
-//world update (coords)
-register("renderWorld", () => {
- if(constants.throneValues[0] != undefined)
- {
- for(let i = 0; i < constants.throneValues.length; i++)
- {
- Tessellator.drawString(i+1, constants.throneValues[i][0], constants.throneValues[i][1], constants.throneValues[i][2])
- }
- }
- if(constants.spiralValues[0] != undefined)
- {
- for(let i = 0; i < constants.spiralValues.length; i++)
- {
- Tessellator.drawString(i+1, constants.spiralValues[i][0], constants.spiralValues[i][1], constants.spiralValues[i][2])
- }
- }
-})
-
-
//update every second (dogshit code)
register("step", () => {
// first time check
diff --git a/metadata.json b/metadata.json
index bcc3bd6..626a589 100644
--- a/metadata.json
+++ b/metadata.json
@@ -2,7 +2,7 @@
"name": "Coleweight",
"creator": "Ninjune",
"entry": "index.js",
- "description": "Simple Coleweight module to measure mining progression.",
- "version": "1.6.5",
+ "description": "Mining utilities.",
+ "version": "1.6.6",
"requires": ["axios", "PogData", "Vigilance"]
} \ No newline at end of file
diff --git a/render/coordsGui.js b/render/coordsGui.js
new file mode 100644
index 0000000..f36ccf2
--- /dev/null
+++ b/render/coordsGui.js
@@ -0,0 +1,94 @@
+import {
+ AdditiveConstraint,
+ animate,
+ Animations,
+ CenterConstraint,
+ ChildBasedMaxSizeConstraint,
+ ChildBasedSizeConstraint,
+ ConstantColorConstraint,
+ FillConstraint,
+ MaxConstraint,
+ ScissorEffect,
+ SiblingConstraint,
+ SubtractiveConstraint,
+ UIBlock,
+ UIImage,
+ UIWrappedText,
+ UIMultilineTextInput,
+ UIText,
+ WindowScreen,
+ } from "../../Elementa"
+
+// stylla made 2 lines of code (gamer)
+const Color = Java.type("java.awt.Color")
+const URL = Java.type("java.net.URL")
+let ScreenW = Renderer.screen.getWidth(),
+ ScreenH = Renderer.screen.getHeight()
+
+function coordsWindow(row, column, title, command, desc, image=false, alternateText="")
+{
+ const coordWindow = new UIBlock(new Color(0, 0, 0, 0.5)) // 320 960
+ .setX(((ScreenW/3*(column))-ScreenW/3.5).pixels())
+ .setY((ScreenH/2*(row-1)+ScreenH/10.8).pixels())
+ .setWidth((ScreenW/4.5).pixels())
+ .setHeight((ScreenH/3.7).pixels())
+ .onMouseClick(() => {
+ ChatLib.command(command, true)
+ })
+ new UIText(title, false)
+ .setX(new CenterConstraint())
+ .setY((2).pixels())
+ .setTextScale((2).pixels())
+ .setColor(new ConstantColorConstraint(Color.GREEN.darker()))
+ .setChildOf(coordWindow)
+ if(image == true)
+ {
+ new UIWrappedText(alternateText)
+ .setX((12).pixels())
+ .setY((25).pixels())
+ .setWidth((ScreenW/5).pixels())
+ .setTextScale((1).pixels())
+ .setColor(new ConstantColorConstraint(Color.WHITE))
+ .setChildOf(coordWindow)
+ new UIImage.ofURL(new URL(desc))
+ .setX(new CenterConstraint())
+ .setY(new AdditiveConstraint(new CenterConstraint(), (4).pixels()))
+ .setWidth((ScreenW/5).pixels())
+ .setHeight((ScreenH/5).pixels())
+ .setChildOf(coordWindow)
+ }
+ else
+ {
+ new UIWrappedText(desc)
+ .setX((2).pixels())
+ .setY((25).pixels())
+ .setWidth((ScreenW/4.5).pixels())
+ .setTextScale((1).pixels())
+ .setColor(new ConstantColorConstraint(Color.WHITE))
+ .setChildOf(coordWindow)
+ }
+
+ return coordWindow
+}
+
+export function openCoordsGui()
+{
+ ScreenW = Renderer.screen.getWidth()
+ ScreenH = Renderer.screen.getHeight()
+ const CoordsGui = new JavaAdapter(WindowScreen, {
+ init() {
+ coordsWindow(1, 1, "Spiral", "cw spiral toggle", "https://i.imgur.com/dyL30GD.png", true, "Do /cw spiral to see image. (image isn't loading.)").setChildOf(this.getWindow())
+ coordsWindow(1, 2, "Throne", "cw throne toggle", "https://i.imgur.com/7BWzO1c.jpg", true, "Go back of throne. (image isn't loading)").setChildOf(this.getWindow())
+ coordsWindow(1, 3, "Yog", "cw yog toggle", "https://i.imgur.com/DojoypL.jpg", true, "Go to the leftmost corner of the topaz crystal facing bal close to bal. (image isn't loading)").setChildOf(this.getWindow())
+ coordsWindow(2, 1, "Divans", "cw divans toggle", "https://i.imgur.com/bkC6yp3.jpg", true, "Go to the middle of jade crystal. (image isn't loading)").setChildOf(this.getWindow())
+ new UIText("Click box to enable/disable.")
+ .setX(new CenterConstraint())
+ .setY((ScreenH-ScreenH/12).pixels())
+ .setTextScale((2).pixels())
+ .setColor(Color.WHITE)
+ .setChildOf(this.getWindow())
+ },
+ })
+ CoordsGui.init()
+ GuiHandler.openGui(CoordsGui)
+} \ No newline at end of file
diff --git a/render/downtimeGui.js b/render/downtimeGui.js
new file mode 100644
index 0000000..d40fa83
--- /dev/null
+++ b/render/downtimeGui.js
@@ -0,0 +1,86 @@
+import settings from "../settings"
+import { createGui } from "./textGuiCreator"
+import constants from "../util/constants"
+
+const downtimeGui = new Gui()
+let oldFuel = 0,
+ timeAtLastFuel = 0,
+ overallDowntime = 0,
+ trackingDowntime = false,
+ downtime = 0,
+ downtimeCount = 0,
+ uptime // for average
+
+
+export function openDowntimeGui()
+{
+ downtimeGui.open()
+}
+
+
+register("dragged", (dx, dy, x, y) => {
+ if (!downtimeGui.isOpen()) return
+ constants.downtimedata.x = x
+ constants.downtimedata.y = y
+ constants.downtimedata.save()
+})
+
+register('actionbar', (xp) => {
+ if(!settings.downtimeTracker) return
+ if(Player.getHeldItem() == null) return
+ let heldItem = Player.getHeldItem().getNBT().toObject()["tag"]["ExtraAttributes"],
+ newFuel = parseInt(heldItem["drill_fuel"]) // credit to DocilElm because I'm lazy.
+
+ if(!newFuel) return
+ else if(oldFuel == 0) oldFuel = newFuel
+ else if(oldFuel !== newFuel)
+ {
+ if(timeAtLastFuel == 0)
+ {
+ timeAtLastFuel = Date.now()
+ return
+ }
+ downtime = Date.now() - timeAtLastFuel
+ overallDowntime += downtime
+ downtimeCount += 1
+ timeAtLastFuel = Date.now()
+ trackingDowntime = true
+ oldFuel = newFuel
+ }
+}).setCriteria('${*}+${xp} Mining ${*}')
+
+
+register("renderOverlay", () => {
+ if (downtimeGui.isOpen())
+ {
+ let txt = "Drag to move."
+ Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2)
+ createGui(
+ {leftValues: ["Downtime", "Overall Downtime", "Average Downtime", "Uptime"], rightValues: [0, 0, 0, 0]},
+ constants.downtimedata.x,
+ constants.downtimedata.y
+ )
+ return
+ }
+ if (downtimeCount == 0 || !trackingDowntime) return
+ let avgDowntime = Math.ceil((overallDowntime/downtimeCount)*100) / 100
+ createGui(
+ {leftValues: ["Downtime", "Overall Downtime", "Average Downtime", "Uptime"], rightValues: [downtime, overallDowntime, avgDowntime, uptime]},
+ constants.downtimedata.x,
+ constants.downtimedata.y
+ )
+})
+
+
+register("step", () => {
+ if((Date.now()-timeAtLastFuel)/1000 >= 60)
+ {
+ uptime = 0
+ oldFuel = 0
+ overallDowntime = 0
+ timeAtLastFuel = 0
+ trackingDowntime = false
+ } // over 60 seconds then stop making gui
+ else
+ uptime += 1
+}).setFps(1) \ No newline at end of file
diff --git a/render/textGuiCreator.js b/render/textGuiCreator.js
new file mode 100644
index 0000000..e85b7e4
--- /dev/null
+++ b/render/textGuiCreator.js
@@ -0,0 +1,20 @@
+export function createGui(guiObject, x, y)
+// format: { leftValues: [], rightValues: [] } (must have same amount of each or error).
+{
+ let string = ""
+ guiObject.leftValues.forEach((leftValue, index) => {
+ if(leftValue == "Uptime")
+ {
+ let uptime = guiObject.rightValues[index],
+ uptimeHr = Math.floor(uptime/60/60)
+
+ if(uptimeHr >= 1)
+ string += `&aUptime: &b${uptimeHr}h ${Math.floor(uptime/60) - uptimeHr*60}m\n`
+ else
+ string += `&aUptime: &b${Math.floor(uptime/60)}m ${Math.floor(uptime%60)}s\n`
+ }
+ else
+ string += `&a${leftValue}: &b${guiObject.rightValues[index]}\n`
+ })
+ Renderer.drawStringWithShadow(string, x, y)
+} \ No newline at end of file
diff --git a/settings.js b/settings.js
index 4d46638..92c13d2 100644
--- a/settings.js
+++ b/settings.js
@@ -54,6 +54,25 @@ class Settings {
claiming = true;
@SwitchProperty({
+ name: "Downtime tracker",
+ description: "Tracks downtime.",
+ subcategory: "Downtime",
+ category: "General"
+ })
+ downtimeTracker = false;
+
+ @ButtonProperty({
+ name: "Change downtime tracker position",
+ description: "Move the location of the downtime tracker.",
+ subcategory: "Downtime",
+ category: "General",
+ placeholder: "Open"
+ })
+ moveDowntimeLocation() {
+ ChatLib.command("cw move downtime", true);
+ }
+
+ @SwitchProperty({
name: "Debug",
description: "Toggles debug mode.",
subcategory: "Random Features",
@@ -174,6 +193,9 @@ class Settings {
this.registerListener("Timer", value => {
this.timerVisible = value;
})
+ this.registerListener("Downtime tracker", value => {
+ this.downtimeTracker = value;
+ })
this.registerListener("Debug", value => {
this.debug = value;
})
diff --git a/util/constants.js b/util/constants.js
index 16cd037..51345fe 100644
--- a/util/constants.js
+++ b/util/constants.js
@@ -22,6 +22,11 @@ let TimerData = new PogObject("Coleweight", {
"timer": 0
}, "config/.timer_data.json")
+let DowntimeData = new PogObject("Coleweight", {
+ "x": 0,
+ "y": 0
+}, "config/.downtime_data.json")
+
export default
{
PREFIX: "&2[CW] ",
@@ -29,6 +34,7 @@ export default
data: PogData,
powderdata: PowderData,
timerdata: TimerData,
+ downtimedata: DowntimeData,
cwValues: [],
calcCwPerHr: false,
upTimeTrack: false,
diff --git a/util/waypoints.js b/util/waypoints.js
new file mode 100644
index 0000000..eb7dad8
--- /dev/null
+++ b/util/waypoints.js
@@ -0,0 +1,7 @@
+export function waypointRender(waypoints)
+{
+ if(waypoints.length < 1) return
+ waypoints.forEach((waypoint) => {
+ Tessellator.drawString(Math.floor((Math.abs(parseInt(Player.getX()) - waypoint[0]) + Math.abs(parseInt(Player.getY()) - waypoint[1]) + Math.abs(parseInt(Player.getZ()) - waypoint[2]))/3) + "m", waypoint[0], waypoint[1], waypoint[2])
+ })
+} \ No newline at end of file