aboutsummaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
authorNinjune <enderknight537@gmail.com>2022-10-28 18:34:34 -0500
committerNinjune <enderknight537@gmail.com>2022-10-28 18:34:34 -0500
commit2c63075f255687131ce077d2c8de7b8735d60169 (patch)
treef589d5ba61e32be010ccb83e42a9f3fb3524bef3 /index.js
parent114cf1050c1d960af7447755df58be9a4e5f7652 (diff)
downloadcoleweight-2c63075f255687131ce077d2c8de7b8735d60169.tar.gz
coleweight-2c63075f255687131ce077d2c8de7b8735d60169.tar.bz2
coleweight-2c63075f255687131ce077d2c8de7b8735d60169.zip
Updated to 1.5.1 (bug fixes)v1.5.1
Diffstat (limited to 'index.js')
-rw-r--r--index.js58
1 files changed, 8 insertions, 50 deletions
diff --git a/index.js b/index.js
index 2be68ef..2414c4f 100644
--- a/index.js
+++ b/index.js
@@ -2,49 +2,10 @@ import axios from '../axios'
import './commandManager'
import constants from './util/constants';
import "./util/updater"
+import Settings from "./gui/settingsGui.js"
const PREFIX = constants.PREFIX
-//gui
-register("dragged", (dx, dy, x, y) => {
- if (!constants.cwGui.isOpen()) return
- constants.data.x = x
- constants.data.y = y
- constants.data.save()
-});
-
-register("renderOverlay", () => {
- if (constants.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(`&aCW: &b0\n&aCW/hr: &b0\n&aUptime: &b0m\n&aColeweight Gained: &b0`, constants.data.x, constants.data.y)
- }
- if(!constants.data.cwToggle || constants.data.api_key == undefined) return
- let coleweight = constants.data.coleweight || 0,
- coleweightMessage = ""
-
- 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)
- {
- constants.cwValuesSum = 0
- for(let i = 0; i < constants.cwValues.length; i++)
- {
- constants.cwValuesSum += constants.cwValues[i]
- }
- let eq = Math.ceil((constants.cwValuesSum*(3600/constants.uptime)) * 100) / 100
- eq != Infinity ? constants.coleweightHr = eq : constants.coleweightHr = "Calculating..."
- constants.calcCwPerHr = false
- }
-
- if (constants.cwGui.isOpen() || !constants.upTimeTrack) return
- let uptimeHr = Math.floor(constants.uptime/60/60)
- 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}m\n&aColeweight Gained: &b${Math.ceil(constants.cwValuesSum*100) / 100}`, constants.data.x, constants.data.y)
- 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)
-})
//world update (coords)
register("renderWorld", () => {
@@ -65,21 +26,18 @@ register("renderWorld", () => {
})
-//update checker
-
-
//update every second (dogshit code)
register("step", () => {
// first time check
if (constants.data.first_time)
{
- constants.data.first_time = false;
- constants.data.save();
- ChatLib.chat("");
- new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bPlease Set Your Api Key By Doing /api new`)).chat();
- new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bOr By Doing /cw setkey (key)`)).chat();
- new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bView commands: /cw help`)).chat();
- ChatLib.chat("");
+ constants.data.first_time = false
+ constants.data.save()
+ ChatLib.chat("")
+ new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bPlease Set Your Api Key By Doing /api new`)).chat()
+ new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bOr By Doing /cw setkey (key)`)).chat()
+ new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bView commands: /cw help`)).chat()
+ ChatLib.chat("")
}
if (constants.data.api_key == undefined) return