aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/cwGui.js35
-rw-r--r--render/powertrackerGui.js80
-rw-r--r--render/timerGui.js33
3 files changed, 55 insertions, 93 deletions
diff --git a/render/cwGui.js b/render/cwGui.js
index d0f4a5c..96c0bf6 100644
--- a/render/cwGui.js
+++ b/render/cwGui.js
@@ -1,39 +1,30 @@
import settings from "../settings";
import constants from "../util/constants";
-const cwMove = new Gui(),
- cwGui = new Display()
-
-cwGui.setBackgroundColor(Renderer.color(0, 0, 0, 75));
-cwGui.setBackground("full");
-cwGui.setMinWidth(100)
+const cwGui = new Gui()
+let txt = "Please set your api key with /cw setkey (key)!"
export function openCwGui()
{
- cwMove.open()
+ cwGui.open()
}
register("dragged", (dx, dy, x, y) => {
- if (!cwMove.isOpen()) return
+ if (!cwGui.isOpen()) return
constants.data.x = x
constants.data.y = y
constants.data.save()
-});
+})
register("renderOverlay", () => {
- cwGui.setShouldRender(false)
- cwGui.clearLines()
- cwGui.setRenderLoc(constants.data.x, constants.data.y)
-
- if (cwMove.isOpen())
+ 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!"
+ txt = "Click anywhere to move!"
Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2)
- cwGui.addLines([`&aCW: &b0`, `&aCW/hr: &b0`, `&aUptime: &b69h 420m `, `&aColeweight Gained: &b0 `])
- cwGui.setShouldRender(true)
+ 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)
}
if(!settings.cwToggle || constants.data.api_key == undefined) return
@@ -54,12 +45,10 @@ register("renderOverlay", () => {
constants.calcCwPerHr = false
}
- if (cwMove.isOpen() || !constants.upTimeTrack) return
-
- cwGui.setShouldRender(true)
+ if (cwGui.isOpen() || !constants.upTimeTrack) return
if(uptimeHr >= 1)
- 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}`])
+ 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)
else
- 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}`])
+ 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)
}) \ No newline at end of file
diff --git a/render/powertrackerGui.js b/render/powertrackerGui.js
index 0e7985a..cf6fc2c 100644
--- a/render/powertrackerGui.js
+++ b/render/powertrackerGui.js
@@ -4,13 +4,9 @@ Major credit to Fabi019 for Powdertracker module.
import constants from "../util/constants"
import settings from "../settings"
-const moveGui = new Gui(),
- powderGui = new Display(),
+const powderGui = new Gui(),
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,
@@ -20,7 +16,7 @@ let sessionRunning = false,
export function openPowderGui()
{
- moveGui.open()
+ powderGui.open()
}
function DoublePowderActive()
@@ -29,9 +25,7 @@ function DoublePowderActive()
}
register("dragged", (dx, dy, x, y) => {
- if (!moveGui.isOpen()) return
- sessionRunning = true
- powderGui.setRenderLoc(x, y)
+ if (!powderGui.isOpen()) return
constants.powderdata.x = x
constants.powderdata.y = y
constants.powderdata.save()
@@ -52,6 +46,7 @@ register("chat", (value, type) => {
constants.powderdata.mithrilPowder += powder
sessionMithril += powder
}
+ constants.powderdata.save()
timeSinceLastGain = 0
sessionRunning = true
}).setCriteria(/You received \+([0-9]+) ([a-zA-Z]+) Powder/g)
@@ -62,60 +57,50 @@ register("chat", event => {
sessionRunning = true
}).setCriteria("&r&6You have successfully picked the lock on this chest!&r");
-export function updateDisplay()
-{
- if (!sessionRunning) {powderGui.setShouldRender(false); return}
- else if (!settings.trackerVisible) {powderGui.setShouldRender(false); return}
- else {powderGui.setShouldRender(true)}
-
- const renderText = (text, value) => {
- powderGui.setLine(line++, `§a${text}: §b${value}`)
+register("renderOverlay", () => {
+ if (powderGui.isOpen())
+ {
+ let txt = "Drag to move."
+ Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2)
}
+ if (!settings.trackerVisible || !sessionRunning) return
let uptimeHr = Math.floor(seconds/60/60),
- lines = [],
- line = 0
+ lines = [],
+ message =""
- powderGui.clearLines()
- powderGui.setRenderLoc(constants.powderdata.x, constants.powderdata.y)
- powderGui.setAlign(
- settings.trackerAlignment == 0 ? "left" :
- settings.trackerAlignment == 1 ? "right" :
- "center"
- )
-
+ function addText(item, value)
+ {
+ lines.push("&a" + item + ": &b" + value)
+ }
+
if (settings.showTotals)
{
- renderText("Total Chests", constants.powderdata.chests)
- renderText("Total Gemstone", constants.powderdata.gemstonePowder)
- renderText("Total Mithril", constants.powderdata.mithrilPowder)
- line++
+ addText("Total Chest", constants.powderdata.chests)
+ addText("Total Gemstone", constants.powderdata.gemstonePowder)
+ addText("Total Mithril", constants.powderdata.mithrilPowder)
}
- renderText("Session Chests", sessionChests)
- renderText("Session Gemstone", sessionGemstone)
- renderText("Session Mithril", sessionMithril)
+ addText("Session Chests", sessionChests)
+ addText("Session Gemstone", sessionGemstone)
+ addText("Session Mithril", sessionMithril)
if (settings.showRates)
{
- line++
- renderText("Chests/hr", Math.round(((sessionChests ?? 0)/(seconds ?? 1)) * 3600))
- renderText("Gemstone/hr", Math.round(((sessionGemstone ?? 0)/(seconds ?? 1)) * 3600))
- renderText("Mithril/hr", Math.round(((sessionMithril ?? 0)/(seconds ?? 1)) * 3600))
+ addText("Chests/hr", Math.round(((sessionChests ?? 0)/(seconds ?? 1)) * 3600))
+ addText("Gemstone/hr", Math.round(((sessionGemstone ?? 0)/(seconds ?? 1)) * 3600))
+ addText("Mithril/hr", Math.round(((sessionMithril ?? 0)/(seconds ?? 1)) * 3600))
if(uptimeHr >= 1)
- renderText("Uptime", `${uptimeHr}h ${Math.floor(seconds/60) - uptimeHr*60}m`)
+ addText("Uptime", `${uptimeHr}h ${Math.floor(seconds/60) - uptimeHr*60}m`)
else
- renderText("Uptime", `${Math.floor(seconds/60)}m ${Math.floor(seconds%60)}s`)
+ addText("Uptime", `${Math.floor(seconds/60)}m ${Math.floor(seconds%60)}s`)
}
-}
-register("renderOverlay", () => {
- if (moveGui.isOpen())
- {
- let txt = "Drag to move."
- Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2)
- }
+ lines.forEach((line) => {
+ message += line + "\n"
+ })
+ Renderer.drawStringWithShadow(message, constants.powderdata.x, constants.powderdata.y)
})
register("step", () => {
@@ -128,5 +113,4 @@ register("step", () => {
{
sessionRunning = false
}
- updateDisplay()
}).setFps(1)
diff --git a/render/timerGui.js b/render/timerGui.js
index a46451f..87171ff 100644
--- a/render/timerGui.js
+++ b/render/timerGui.js
@@ -2,47 +2,36 @@ import settings from "../settings";
import constants from "../util/constants";
-const timerMove = new Gui(),
- timerGui = new Display()
-
-timerGui.setBackgroundColor(Renderer.color(0, 0, 0, 50));
-timerGui.setBackground("full");
+const timerGui = new Gui()
export function openTimerGui()
{
- timerMove.open()
+ timerGui.open()
}
register("dragged", (dx, dy, x, y) => {
- if (!timerMove.isOpen()) return
+ if (!timerGui.isOpen()) return
constants.timerdata.x = x
constants.timerdata.y = y
constants.timerdata.save()
});
register("renderOverlay", () => {
- timerGui.setShouldRender(false)
- timerGui.clearLines()
- timerGui.setRenderLoc(constants.timerdata.x, constants.timerdata.y)
-
- if (timerMove.isOpen())
+ if (timerGui.isOpen())
{
- let txt = "Click anywhere to move!"
+ let txt = "Drag to move."
Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2)
- timerGui.addLines([`&aTimer: &b0h 0m`])
- timerGui.setShouldRender(true)
- return
}
-
- if(!settings.timerVisible) return
- timerGui.setShouldRender(true)
- let timerHr = Math.floor(constants.timerdata.timer/60/60)
+ if (!settings.timerVisible) return
+ let timerHr = Math.floor(constants.timerdata.timer/60/60), message
if(timerHr >= 1)
- timerGui.addLine(`&aTimer: &b${timerHr}h ${Math.floor(constants.timerdata.timer/60) - timerHr*60}m`)
+ message = `&aTimer: &b${timerHr}h ${Math.floor(constants.timerdata.timer/60) - timerHr*60}m`
else
- timerGui.addLine(`&aTimer: &b${Math.floor(constants.timerdata.timer/60)}m ${Math.floor(constants.timerdata.timer%60)}s`)
+ message = `&aTimer: &b${Math.floor(constants.timerdata.timer/60)}m ${Math.floor(constants.timerdata.timer%60)}s`
+
+ Renderer.drawStringWithShadow(message, constants.timerdata.x, constants.timerdata.y)
})
register('worldLoad', () => {