From 3632441ffe703dbfa331f092db68a38459082c65 Mon Sep 17 00:00:00 2001 From: BusterBrown1218 Date: Fri, 12 Jul 2024 12:53:23 -0500 Subject: [PATCH] Patch 1.1.5 --- compiler/compile.js | 7 +++---- compiler/exportAction.js | 3 ++- gui/LoadActionGUI.js | 6 +++--- gui/Queue.js | 12 +++++++++++- index.js | 2 ++ metadata.json | 2 +- update/changelog.txt | 9 +++++---- utils/config.js | 22 +++++++++++++++++++--- 8 files changed, 46 insertions(+), 17 deletions(-) diff --git a/compiler/compile.js b/compiler/compile.js index 4fc0ac3..6031a5c 100644 --- a/compiler/compile.js +++ b/compiler/compile.js @@ -100,10 +100,9 @@ function replaceMacros(text, macros) { */ function getArgs(input) { let conversions = [ - { regex: /(=|>|<|set|dec|mult|div|ment|inc|multiply|divide|equal|Less Than|Less Than or Equal|Greater Than|Greater Than or Equal) +globalstat +(.*)?/g, replacement: "$1 %stat.global/$2%" }, - { regex: /(=|>|<|set|dec|mult|div|ment|inc|multiply|divide|equal|Less Than|Less Than or Equal|Greater Than|Greater Than or Equal) +stat +(.*)?/g, replacement: "$1 %stat.player/$2%" }, - { regex: /(=|>|<|set|dec|mult|div|ment|inc|multiply|divide|equal|Less Than|Less Than or Equal|Greater Than|Greater Than or Equal) +teamstat +(.*)? +?(.*)?/g, replacement: "$1 \"%stat.team/$2 $3%\"" }, - { regex: /(=|>|<|set|dec|mult|div|ment|inc|multiply|divide|equal|Less Than|Less Than or Equal|Greater Than|Greater Than or Equal) +randomint +(.*)? +?(.*)?/g, replacement: "$1 \"%random.int/$2 $3%\"" }, + { regex: /(=|>|<|set|dec|mult|div|ment|inc|multiply|divide|equal|Less Than|Less Than or Equal|Greater Than|Greater Than or Equal) +globalstat +(?:"([^"]*)"|([^ ]*))/g, replacement: "$1 %stat.global/$2$3%" }, + { regex: /(=|>|<|set|dec|mult|div|ment|inc|multiply|divide|equal|Less Than|Less Than or Equal|Greater Than|Greater Than or Equal) +stat +(?:"([^"]*)"|([^ ]*))/g, replacement: "$1 %stat.player/$2$3%" }, + { regex: /(=|>|<|set|dec|mult|div|ment|inc|multiply|divide|equal|Less Than|Less Than or Equal|Greater Than|Greater Than or Equal) +teamstat +(.*)? +(?:"([^"]*)"|([^ ]*))/g, replacement: "$1 \"%stat.team/$2 $3$4%\"" }, { regex: /(=|>|<|set|dec|mult|div|ment|inc|multiply|divide|equal|Less Than|Less Than or Equal|Greater Than|Greater Than or Equal) +randomint +(.*)? +?(.*)?/g, replacement: "$1 \"%random.int/$2 $3%\"" }, { regex: /(=|>|<|set|dec|mult|div|ment|inc|multiply|divide|equal|Less Than|Less Than or Equal|Greater Than|Greater Than or Equal) +health/g, replacement: "$1 %player.health%" }, { regex: /(=|>|<|set|dec|mult|div|ment|inc|multiply|divide|equal|Less Than|Less Than or Equal|Greater Than|Greater Than or Equal) +maxHealth/g, replacement: "$1 %player.maxhealth%" }, { regex: /(=|>|<|set|dec|mult|div|ment|inc|multiply|divide|equal|Less Than|Less Than or Equal|Greater Than|Greater Than or Equal) +hunger/g, replacement: "$1 %player.hunger%" }, diff --git a/compiler/exportAction.js b/compiler/exportAction.js index 042538c..db7303f 100644 --- a/compiler/exportAction.js +++ b/compiler/exportAction.js @@ -178,6 +178,8 @@ function processPage(items, actionList, menuList, page) { break; } } + if (ChatLib.removeFormatting(items[i].getName()) == "No Actions!") continue; + if (!menu) return false; if (["Change Player's Group", "Set Gamemode"].includes(menu.action_name) && ChatLib.removeFormatting(items[i].getLore()[3]) == "You are not allowed to edit this action!") { forceOperation({ type: "actionOrder", func: () => { @@ -186,7 +188,6 @@ function processPage(items, actionList, menuList, page) { }) continue; } - if (!menu) return false; if (Object.keys(menu).length > 1) { // operations forced to the front of the queue, so they need to be added backwards diff --git a/gui/LoadActionGUI.js b/gui/LoadActionGUI.js index 4d64f7e..8d2e54d 100644 --- a/gui/LoadActionGUI.js +++ b/gui/LoadActionGUI.js @@ -305,7 +305,7 @@ register('guiMouseClick', (x, y, mouseButton) => { if (filteredFiles[index].endsWith('.htsl')) { if (Player.asPlayerMP().player.field_71075_bZ.field_75098_d === false) ChatLib.command("gmc"); if (compile(subDir.replace("\\", "/") + filteredFiles[index].substring(0, filteredFiles[index].length - 5))) World.playSound('random.click', 0.5, 1); - if (Settings.saveimports) { + if (Settings.saveFiles) { input.setText(filteredFiles[index].substring(0, filteredFiles[index].length - 5)); filteredFiles = files.filter(n => n.toLowerCase().includes(input.getText().toLowerCase())); } @@ -345,7 +345,7 @@ function handleInputClick(button, action, x, y) { input.setCursorPosition(0); input.setLineScrollOffset(0); input.setIsFocused(false); - if (!Settings.saveImports || input.getText() == "default") input.setText('Enter File Name'); + if (!Settings.saveFile || input.getText() == "default") input.setText('Enter File Name'); } } @@ -383,7 +383,7 @@ register('guiOpened', (gui) => { if (wasInActionGui) return; if (!wasInActionGui && isInActionGui()) wasInActionGui = true; - if (!Settings.saveimports) subDir = ""; + if (!Settings.saveDirectory) subDir = ""; readFiles(); }, 50); }); diff --git a/gui/Queue.js b/gui/Queue.js index 5d6d9c5..b0c9dad 100644 --- a/gui/Queue.js +++ b/gui/Queue.js @@ -128,9 +128,11 @@ function doneLoading() { const timeRemainingButton = new Button(0, 0, 0, 20, "Time Remaining:"); const cancelButton = new Button(0, 100, 100, 20, "Cancel"); +const reloadButton = new Button(0, Renderer.screen.getHeight() - 20, 100, 20, "Reload CT"); register("guiRender", (x, y) => { if (!Player.getContainer()) return; + reloadButton.render(x, y); if (queue.length === 0) return; timeRemainingButton.setWidth(200); @@ -143,7 +145,7 @@ register("guiRender", (x, y) => { timeRemainingButton.setY(timeRemainingButton.getHeight() * 3); cancelButton.setY(timeRemainingButton.getHeight() * 3 + 20); timeRemainingButton.render(x, y); - cancelButton.render(x, y); + if (Settings.reloadButton) cancelButton.render(x, y); }); register("guiMouseClick", (x, y) => { @@ -157,6 +159,14 @@ register("guiMouseClick", (x, y) => { ) { queue.splice(0, queue.length - 1); } + if (Settings.reloadButton) if ( + x > reloadButton.getX() && + x < reloadButton.getX() + reloadButton.getWidth() && + y > reloadButton.getY() && + y < reloadButton.getY() + reloadButton.getHeight() + ) { + ChatLib.command("ct load", true); + } }); export function addOperation(operation) { diff --git a/index.js b/index.js index 84d25be..4586876 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,5 @@ +/// + import './gui/LoadActionGUI'; import Config from "./utils/config"; import codeWindow from './gui/codeWindow'; diff --git a/metadata.json b/metadata.json index 80e6297..71e69e7 100644 --- a/metadata.json +++ b/metadata.json @@ -2,7 +2,7 @@ "name": "HTSL", "creator": "BusterBrown1218", "description": "A Chat Triggers module made to make creating housing code easier!", - "version": "1.1.4", + "version": "1.1.5", "entry": "index.js", "requires": ["axios", "Vigilance"] } \ No newline at end of file diff --git a/update/changelog.txt b/update/changelog.txt index 5280333..c1ad46d 100644 --- a/update/changelog.txt +++ b/update/changelog.txt @@ -1,5 +1,6 @@ -Update 1.1.4: +Patch 1.1.5: - Bugfixes -- Deprecated houseSpawn (Hypixel) -- Added optional click delay setting for importing -- Minor QoL changes \ No newline at end of file +- Minor QoL changes +- Emergency reload button for debugging +- Fixes for MacOS support (thanks @NorthFailer) +- Separated save filename and save directory settings \ No newline at end of file diff --git a/utils/config.js b/utils/config.js index 70addd5..47a6bae 100644 --- a/utils/config.js +++ b/utils/config.js @@ -13,12 +13,20 @@ class Settings { // General @SwitchProperty({ - name: "Save Imports", - description: 'Will keep the folder of your import inbetween imports so you don\'t have to navigate to the same thing multiple times', + name: "Save Import Directories", + description: 'Will keep the folder of your import inbetween imports so you don\'t have to navigate to the same directory multiple times', category: "General", subcategory: "General", }) - saveimports = false; + saveDirectory = true; + + @SwitchProperty({ + name: "Save Import File Name", + description: 'Will keep the name of your import inbetween imports so you don\'t have to type the same name multiple times', + category: "General", + subcategory: "General", + }) + saveFile = false; @SwitchProperty({ name: "Load Message", @@ -52,6 +60,14 @@ class Settings { }) cancelSounds = true; + @SwitchProperty({ + name: "Emergency reload button", + description: 'Reloads chattriggers in case of softlock. Mainly use for debugging.', + category: "General", + subcategory: "General", + }) + reloadButton = false; + // Importing/Exporting @SwitchProperty({