aboutsummaryrefslogtreecommitdiff
path: root/render/guis/collectionGui.js
diff options
context:
space:
mode:
Diffstat (limited to 'render/guis/collectionGui.js')
-rw-r--r--render/guis/collectionGui.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/render/guis/collectionGui.js b/render/guis/collectionGui.js
new file mode 100644
index 0000000..8f96d4a
--- /dev/null
+++ b/render/guis/collectionGui.js
@@ -0,0 +1,53 @@
+import constants from "../../util/constants"
+import settings from "../../settings"
+import { trackerGui } from "../../util/helperFunctions"
+const PREFIX = constants.PREFIX
+const collectionMoveGui = new Gui()
+const collectionGui = new trackerGui("", "Collection Not set! /cw track", settings.collectionNotation)
+
+
+export function trackCollection(arg)
+{
+ collectionGui.resetVars()
+ let collections = JSON.parse(FileLib.read("Coleweight", "data/collections.json"))
+ if(arg == "obby") arg = "obsidian"
+ if(arg == "cobble") arg = "cobblestone"
+ if(collections[arg.toLowerCase()] == undefined) return ChatLib.chat(`${PREFIX}&eThat is not a valid collection! (or is not supported)`)
+ collectionGui.trackedItem = collections[arg].collectionToTrack
+ collectionGui.itemStringed = collections[arg].collectionStringed
+
+ ChatLib.chat(`${PREFIX}&bSet collection to ${collectionGui.itemStringed}!`)
+}
+
+export function openCollectionGui()
+{
+ collectionGui.moveGui()
+}
+
+export function reloadCollection()
+{
+ collectionGui.resetVars()
+}
+
+register("dragged", (dx, dy, x, y) => {
+ if (!collectionGui.collectionMoveGui.isOpen()) return
+ constants.collectiondata.x = x
+ constants.collectiondata.y = y
+ constants.collectiondata.save()
+})
+
+register("renderOverlay", () => {
+ collectionGui.renderGui(constants.collectiondata.x, constants.collectiondata.y, settings.collectionNotation, settings.collectionTracker)
+})
+
+register("step", () => {
+ let date_ob = new Date(),
+ seconds = date_ob.getSeconds()
+
+ if(collectionGui.trackingItem == true)
+ collectionGui.uptimeSeconds += 1
+ if(seconds == 0 || seconds == 15 || seconds == 30 || seconds == 45)
+ {
+ collectionGui.calcApi(["members", Player.getUUID().replace(/-/g, ""), "collection"], Player.getUUID())
+ }
+}).setFps(1) \ No newline at end of file