From e2f1ef15eff6433b1afacf5f79b1fc97218fc290 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Wed, 5 Oct 2022 10:00:20 +0800 Subject: bettermap download command! --- src/features/changeLogGUI/index.js | 44 ++++++++++++++++++++++++++++++++++++++ src/features/dungeonMap/index.js | 1 + src/metadata.json | 4 ++-- 3 files changed, 47 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/features/changeLogGUI/index.js b/src/features/changeLogGUI/index.js index d8287ea..43e34c8 100644 --- a/src/features/changeLogGUI/index.js +++ b/src/features/changeLogGUI/index.js @@ -33,6 +33,50 @@ class ChangeLogGui extends Feature { this.registerStep(false, 60 * 5, () => { this.ChangelogPage.loadChangeLog() }) + + this.registerCommand("downloadbettermap", () => { + new Thread(() => { + ChatLib.chat("Downloading...") + + let url = FileLib.getUrlContent("http://soopy.dev/api/bettermap/downloadurl") + + new File("./config/ChatTriggers/modules/BetterMapTempDownload").mkdir() + + this.ChangelogPage.urlToFile(url, "./config/ChatTriggers/modules/BetterMapTempDownload/BetterMap.zip", 10000, 20000) + + FileLib.unzip("./config/ChatTriggers/modules/BetterMapTempDownload/BetterMap.zip", "./config/ChatTriggers/modules/BetterMapTempDownload/BetterMap/") + + FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/BetterMap")) + + new File("./config/ChatTriggers/modules/BetterMapTempDownload/BetterMap/BetterMap").renameTo(new File("./config/ChatTriggers/modules/BetterMap")) + + FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/BetterMapTempDownload")) + + ChatLib.command("ct load", true) + }).start() + }) + + this.registerCommand("updatebettermap", () => { + new Thread(() => { + ChatLib.chat("Updating...") + + let url = FileLib.getUrlContent("http://soopy.dev/api/bettermap/downloadurl") + + new File("./config/ChatTriggers/modules/BetterMapTempDownload").mkdir() + + this.ChangelogPage.urlToFile(url, "./config/ChatTriggers/modules/BetterMapTempDownload/BetterMap.zip", 10000, 20000) + + FileLib.unzip("./config/ChatTriggers/modules/BetterMapTempDownload/BetterMap.zip", "./config/ChatTriggers/modules/BetterMapTempDownload/BetterMap/") + + FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/BetterMap")) + + new File("./config/ChatTriggers/modules/BetterMapTempDownload/BetterMap/BetterMap").renameTo(new File("./config/ChatTriggers/modules/BetterMap")) + + FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/BetterMapTempDownload")) + + ChatLib.command("ct load", true) + }).start() + }) } worldLoad() { diff --git a/src/features/dungeonMap/index.js b/src/features/dungeonMap/index.js index 1f70ece..b3f1e5f 100644 --- a/src/features/dungeonMap/index.js +++ b/src/features/dungeonMap/index.js @@ -33,6 +33,7 @@ class DungeonMap extends Feature { onEnable() { this.initVariables() + this.mapInfo2 = new SettingBase("NOTE: This will soon be replaced with bettermap", "Do /downloadbettermap to download.", undefined, "map_info2", this) this.mapInfo = new SettingBase("NOTE: The more players in the party with this", "category enabled the more accurate the map will be.", undefined, "map_info", this) this.renderMap = new ToggleSetting("Render Map", "Toggles Rendering the map on the hud", false, "dmap_render", this) this.mapIcons = new ToggleSetting("Icons for puzzles on map", "Toggles Rendering the puzzle icons on map", true, "dmap_icons", this).requires(this.renderMap) diff --git a/src/metadata.json b/src/metadata.json index 3495317..b251f46 100644 --- a/src/metadata.json +++ b/src/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.174", - "versionId": 301, + "version": "2.1.175", + "versionId": 302, "requires": [ "soopyApis", "soopyAddonsData", -- cgit