Skip to content

Commit

Permalink
Patch 1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
BusterBrown1218 committed Jul 12, 2024
1 parent 41bac6d commit 3632441
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 17 deletions.
7 changes: 3 additions & 4 deletions compiler/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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%" },
Expand Down
3 changes: 2 additions & 1 deletion compiler/exportAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: () => {
Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions gui/LoadActionGUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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');
}
}

Expand Down Expand Up @@ -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);
});
Expand Down
12 changes: 11 additions & 1 deletion gui/Queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) => {
Expand All @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="../CTAutocomplete" />

import './gui/LoadActionGUI';
import Config from "./utils/config";
import codeWindow from './gui/codeWindow';
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
9 changes: 5 additions & 4 deletions update/changelog.txt
Original file line number Diff line number Diff line change
@@ -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
- Minor QoL changes
- Emergency reload button for debugging
- Fixes for MacOS support (thanks @NorthFailer)
- Separated save filename and save directory settings
22 changes: 19 additions & 3 deletions utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit 3632441

Please sign in to comment.