aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorNinjune <enderknight537@gmail.com>2022-10-26 22:45:52 -0500
committerNinjune <enderknight537@gmail.com>2022-10-26 22:45:52 -0500
commite55e71c8c2ee5fc6541eed04e9b684c6167e8f07 (patch)
tree4bb43bc3aa158a2aa207470b37bc36556081f63a /util
parentf83001bc4a3543cdcd594001e7e6a7aeea749ba1 (diff)
downloadcoleweight-e55e71c8c2ee5fc6541eed04e9b684c6167e8f07.tar.gz
coleweight-e55e71c8c2ee5fc6541eed04e9b684c6167e8f07.tar.bz2
coleweight-e55e71c8c2ee5fc6541eed04e9b684c6167e8f07.zip
1.5.0 Release
Diffstat (limited to 'util')
-rw-r--r--util/constants.js28
-rw-r--r--util/updater.js22
2 files changed, 50 insertions, 0 deletions
diff --git a/util/constants.js b/util/constants.js
new file mode 100644
index 0000000..889ca14
--- /dev/null
+++ b/util/constants.js
@@ -0,0 +1,28 @@
+import PogObject from "PogData"
+
+let PogData = new PogObject("Coleweight", {
+ "api_key": undefined,
+ "x": 0.5,
+ "y": 141,
+ "coleweight": 0,
+ "cwToggle": true,
+ "first_time": true
+}, ".cw_data.json");
+
+export default
+{
+ PREFIX: "&2[CW] ",
+ VERSION: (JSON.parse(FileLib.read("Coleweight", "metadata.json"))).version,
+ data: PogData,
+ cwValues: [],
+ calcCwPerHr: false,
+ upTimeTrack: false,
+ uptime: 0,
+ baseColeweight: 0,
+ stepsSinceLast: 0,
+ cwGui: new Gui(),
+ throneValues: [],
+ spiralValues: [],
+ coleweightHr: 0,
+ cwValuesSum: 0
+} \ No newline at end of file
diff --git a/util/updater.js b/util/updater.js
new file mode 100644
index 0000000..dd497b6
--- /dev/null
+++ b/util/updater.js
@@ -0,0 +1,22 @@
+import axios from "../../axios"
+import constants from "./constants"
+PREFIX = constants.PREFIX
+VERSION = constants.VERSION
+
+register("worldLoad", () => {
+ axios.get(`https://raw.githubusercontent.com/Ninjune/coleweight/main/metadata.json`)
+ .then(res => {
+ if(res.data.version == VERSION) return
+ ChatLib.chat(`${PREFIX}&eYou are using an unsupported version of Coleweight!`)
+ new TextComponent(`${PREFIX}&eClick &3here&e to open the github releases!`)
+ .setClickAction("open_url")
+ .setClickValue(`https://github.com/Ninjune/coleweight/releases/${res.data.version}`)
+ .chat()
+ ChatLib.chat("")
+ })
+ .catch(err => {
+ ChatLib.chat(err)
+ })
+})
+
+export default "" \ No newline at end of file