diff options
Diffstat (limited to 'render/collectionGui.js')
-rw-r--r-- | render/collectionGui.js | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/render/collectionGui.js b/render/collectionGui.js index 8197b11..4e6deee 100644 --- a/render/collectionGui.js +++ b/render/collectionGui.js @@ -1,43 +1,53 @@ -/*import constants from "../util/constants" +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) -let collectionGui = new Gui(), - collection = "" export function trackCollection(arg) { - switch(arg) - { - case "obby": - case "obsidian": - collection = "OBSIDIAN" - break - default: - ChatLib.chat(`${PREFIX}&eThat is not a valid collection! (or is not supported)`) - } + 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 moveCollection() +export function reloadCollection() { - collectionGui.open() + collectionGui.resetVars() } register("dragged", (dx, dy, x, y) => { - if (!collectionGui.isOpen()) return - constants.data.collectionX = x - constants.data.collectionY = y - constants.data.save() + if (!collectionGui.collectionMoveGui.isOpen()) return + constants.collectiondata.x = x + constants.collectiondata.y = y + constants.collectiondata.save() }) register("renderOverlay", () => { - if (cwGui.isOpen()) + 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) { - 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(`&aCollection: &b0\n&aCW/hr: &b0\n&aUptime: &b0m\n&aColeweight Gained: &b0`, constants.data.collectionX, constants.data.collectionY) + collectionGui.calcApi(["members", Player.getUUID().replace(/-/g, ""), "collection"], Player.getUUID()) } - if(collection == "") return - coleweight > 1000 ?collectionMessage = `&b${coleweight.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`: coleweightMessage = `&b${coleweight.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}` -})*/
\ No newline at end of file +}).setFps(1)
\ No newline at end of file |