From 8ff86c1cce2dc2cb9aa4c663b6a623fbb8b794a7 Mon Sep 17 00:00:00 2001 From: gesslar <1266935+gesslar@users.noreply.github.com> Date: Sat, 7 Feb 2026 21:49:52 -0500 Subject: [PATCH] update --- .github/workflows/release.yml | 51 +---------- .gitignore | 6 +- .vscode/settings.json | 3 + README.md | 79 ++++++++++------- mfile | 4 +- package.json | 4 +- pnpm-lock.yaml | 9 ++ src/scripts/Connection_Script.lua | 6 +- src/scripts/Event_Handlers.lua | 30 +++---- src/scripts/GUI/BarContainer.lua | 6 +- src/scripts/GUI/Feedback.lua | 10 ++- src/scripts/GUI/FoeXPShield.lua | 60 ++++++++----- src/scripts/GUI/Inactive_Container.lua | 31 ++++--- src/scripts/GUI/Main_Container.lua | 12 +-- src/scripts/GUI/MetersTime.lua | 65 +++++++------- src/scripts/GUI/SettleDown.lua | 0 src/scripts/GUI/Vitals.lua | 72 ++++++++++------ src/scripts/GUI/scripts.json | 6 -- src/scripts/Install_Uninstall.lua | 27 ++++-- src/scripts/Styles.lua | 112 +++++++++---------------- src/scripts/ThreshTime.lua | 15 ++-- src/scripts/ThresholdUI.lua | 16 ++-- src/scripts/scripts.json | 96 ++++++++++----------- 23 files changed, 367 insertions(+), 353 deletions(-) create mode 100644 pnpm-lock.yaml delete mode 100644 src/scripts/GUI/SettleDown.lua diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b84081d..9a7e234 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,54 +1,11 @@ -name: Build project using muddler and upload artifact +name: Release on: push: - branches: [ main ] + branches: [main] jobs: - build: - runs-on: ubuntu-latest + Release: + uses: gesslar/Maint/.github/workflows/ReleaseMuddyInjectMupdate.yaml@main permissions: contents: write - - steps: - - uses: actions/checkout@v6.0.2 - - - name: Download Updater.lua - run: | - mkdir -p src/scripts - curl -L -o src/scripts/Updater.lua https://github.com/gesslar/mupdate/releases/latest/download/Updater.lua - - - name: Check and create scripts.json if it doesn't exist - run: | - if [ ! -f src/scripts/scripts.json ]; then - mkdir -p src/scripts - echo '[]' > src/scripts/scripts.json - fi - - - name: Update scripts.json - run: | - jq '. += [{"isActive": "yes", "isFolder": "no", "name": "Updater", "script": ""}]' src/scripts/scripts.json > tmp.json && mv tmp.json src/scripts/scripts.json - - - name: JSON to variables - uses: antifree/json-to-variables@v1.3.0 - with: - filename: "./mfile" - prefix: "mfile" - - - name: "create version file" - id: create_version_file - run: | - echo "filename=${{ env.mfile_package }}_version.txt" >> $GITHUB_ENV - echo "${{ env.mfile_version }}" > "${{ env.mfile_package }}_version.txt" - - - name: Build With Muddler - uses: demonnic/build-with-muddler@main - with: - muddlerVersion: LATEST - - - uses: ncipollo/release-action@v1 - with: - artifacts: "build/${{ env.mfile_package }}.mpackage,${{ env.filename }}" - allowUpdates: true - bodyFile: "./README.md" - tag: ${{ env.mfile_version }} diff --git a/.gitignore b/.gitignore index 4d0ea54..418eea1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,4 @@ # in the repo build/ .output - -# Ignore any file starting with "muddle" in the project root directory -# This utility file is specific to individual developers and should not be -# included in the repo -/muddle* +node_modules/ diff --git a/.vscode/settings.json b/.vscode/settings.json index 214618d..20687da 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,8 @@ ], "Lua.diagnostics.disable": [ "lowercase-global" + ], + "Lua.workspace.library": [ + "/home/gesslar/.config/Code/User/globalStorage/delwing.mudlet-scripts-sdk\\docs" ] } diff --git a/README.md b/README.md index fd7e126..3689ff9 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,69 @@ # ThresholdUI -ThresholdUI is a lightweight, scriptable graphical user interface package for Mudlet (a MUD client). It provides a set of Lua scripts, GUI components, and packaged builds to add customizable HUD and meter features to your Mudlet profile. +A dark-themed, gold-accented HUD for Threshold RPG in Mudlet that displays your vitals, combat info, progression, and game clock in a persistent bottom-of-screen bar. -## Key features +## Installation -- Modular Lua-based GUI components (see `src/scripts/GUI/`) -- Timers, styles, and event handlers for in-game thresholds and meters -- Packaged build in `build/ThresholdUI.mpackage` for easy import into Mudlet +In Threshold, type `gmcp gui` to install fresh or update to the latest version. -## Repository layout +## Features Overview -- `src/` - source Lua scripts and supporting assets used during development - - `scripts/` - core scripts (connection, event handlers, timers, styles) - - `scripts/GUI/` - GUI components and containers loaded by the scripts - - `aliases/` - example aliases and helper scripts - - `resources/` - bundled assets such as images and preference defaults -- `package.json` - project metadata; may include build/tooling configuration -- `mfile` - Mudlet package manifest used when exporting +### Vitals Gauges -> **Note:** Historical references to `build/`, `tmp/`, or `filtered/` directories refer to paths that are generated during packaging and are not checked into the repository. Packaging tools will create them when you run the export workflow. +Three horizontal bars on the left side showing your current and maximum values for: -## Installation +- **HP** (Hit Points) - red +- **SP** (Spell Points) - blue +- **EP** (Endurance Points) - teal + +When you are stunned or immobilized, all three bars dim to give you an immediate visual cue. + +### Combat, XP, and Shielding + +Three horizontal bars in the center showing: + +- **Foe** - your current enemy's health percentage with their name displayed on the bar; also shows who the enemy is targeting if it isn't you +- **XP** - your experience progress to the next level as a percentage +- **Shield** - your magical shielding percentage; this bar only appears when shielding is active and hides when it is not + +### Vertical Meters + +Four thin vertical meters on the right side: + +- **C** (Capacity) - how full your inventory is +- **T** (Tummy) - your hunger/fullness level +- **H** (HealBank) - your stored healing reserves +- **R** (Regen) - progress toward your next healing tick (can be toggled on/off) + +### In-Game Date and Time + +A small panel showing the in-game calendar clock, updated every second: + +- Date (month/day/year) +- Day of the week (e.g. Coronea, Solus, Lunas) +- Time as an ordinal toll (e.g. "14th toll") +- Current devotion period -1. Import a packaged release: open Mudlet and import the generated `ThresholdUI.mpackage` or `ThresholdUI.xml` (produced by the export workflow in the `build/` directory). -2. Alternatively, copy the relevant `src/` Lua files into your Mudlet profile's scripts directory. +This panel can be toggled on/off. -After installing, restart Mudlet or reload your profile to ensure scripts initialize correctly. +### Inactive Timer -## Development +When you are resting, trancing, or meditating, a bar appears above the HUD showing how long you have been inactive (e.g. "You have been Trancing for 5m 32s") with a subtle breathing background animation. -- Edit source files in `src/`. The primary entry points are in `src/scripts/` and `src/scripts/GUI/`. -- When exporting a package, Mudlet (or related tooling) will create a `build/` directory containing distributable `.mpackage` and `.xml` files. -- If your workflow uses temporary testing outputs, keep them outside the repository or ensure they are ignored via tooling configuration. +### Psion Feedback -## Contributing +For psion players, a row of four indicators appears above the HUD showing the state of your feedback abilities: **shock**, **net**, **mastery**, and **gaze**. Each indicator lights up in gold when that ability has feedback and stays dim when it does not. This bar only appears when the game sends feedback data and is hidden while the inactive timer is shown. -Contributions are welcome. Open issues or pull requests with a clear description of changes. When submitting code, prefer small focused commits and include brief tests or usage notes when relevant. +## Useful Commands (Aliases) -## License +ThresholdUI provides several aliases (commands) you can type in Mudlet to control the UI: -This repository is released into the public domain under the Unlicense. See `UNLICENSE.txt` for the full text. +- **Toggle Heal Tick Gauge** + - Type: `regen on` or `regen off` + - Shows or hides the healing tick gauge. ---- +- **Toggle Date Time Box** + - Type: `datetime on` or `datetime off` + - Displays or hides the in-game date and time box. -If anything in this README is unclear or you want help importing the package into Mudlet, open an issue with details about your Mudlet version and what you tried. +Enjoy your adventures with ThresholdUI! diff --git a/mfile b/mfile index 6ef438e..4b28ca1 100644 --- a/mfile +++ b/mfile @@ -1,9 +1,9 @@ { "package": "ThresholdUI", "title": "UI for ThresholdRPG", - "description": "Threshold RPG UI", + "description": "", "version": "4.2.0", - "author": "Gesslar", + "author": "gesslar", "icon": "griffon-right.jpg", "dependencies": "", "outputFile": true diff --git a/package.json b/package.json index cdff602..5179be4 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "description": "The main Threshold Graphical User Interface package for Mudlet", "main": "index.js", "scripts": { - "build": "/home/gesslar/bin/muddle-shadow-1.1.0/bin/muddle", - "watch": "/home/gesslar/bin/muddle-shadow-1.1.0/bin/muddle -w", + "build": "pnpx @gesslar/muddy", + "watch": "pnpx @gesslar/muddy -w", "pr": "gt submit --publish --restack --ai" }, "repository": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..9b60ae1 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,9 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: {} diff --git a/src/scripts/Connection_Script.lua b/src/scripts/Connection_Script.lua index 65eaefa..8757df0 100644 --- a/src/scripts/Connection_Script.lua +++ b/src/scripts/Connection_Script.lua @@ -25,8 +25,8 @@ function ThresholdUI:DisconnectionScript() end ThresholdUI.ConnectionHandlers = { - {"sysConnectionEvent", function() ThresholdUI:ConnectionScript() end}, - {"sysDisconnectionEvent", function() ThresholdUI:DisconnectionScript() end}, + { "sysConnectionEvent", function() ThresholdUI:ConnectionScript() end }, + { "sysDisconnectionEvent", function() ThresholdUI:DisconnectionScript() end }, } function ThresholdUI.modifyModules() @@ -37,7 +37,7 @@ function ThresholdUI.modifyModules() -- Disable Modules local DisableString = - f[[Core.Supports.Remove [ {table.concat(ThresholdUI.disableModules, ", ")} ] ]] + f [[Core.Supports.Remove [ {table.concat(ThresholdUI.disableModules, ", ")} ] ]] sendGMCP(DisableString) end diff --git a/src/scripts/Event_Handlers.lua b/src/scripts/Event_Handlers.lua index c236700..f2fac14 100644 --- a/src/scripts/Event_Handlers.lua +++ b/src/scripts/Event_Handlers.lua @@ -1,19 +1,19 @@ ThresholdUI.EventHandlers = ThresholdUI.EventHandlers or { - {"gmcp.Char.Vitals", nil, f[[ThresholdUI:UpdateVitals]]}, - {"gmcp.Char.Afflictions.Add", nil, f[[ThresholdUI:Afflictions_Add]]}, - {"gmcp.Char.Afflictions.Remove", nil, f[[ThresholdUI:Afflictions_Remove]]}, - {"gmcp.Char.Shielding", nil, f[[ThresholdUI:UpdateShielding]]}, - {"gmcp.Char.Status", "XP", f[[ThresholdUI:UpdateXP]]}, - {"gmcp.Char.Status", "Foe", f[[ThresholdUI:UpdateFoe]]}, - {"gmcp.Char.Status", "Capacity", f[[ThresholdUI:UpdateCapacity]]}, - {"gmcp.Char.Status", "Tummy", f[[ThresholdUI:UpdateTummy]]}, - {"gmcp.Char.Status", "HealBank", f[[ThresholdUI:UpdateHealBank]]}, - {"gmcp.Char.Status", "HealTick", f[[ThresholdUI:UpdateHealTick]]}, - {"gmcp.Char.Status", "Inactive", f[[ThresholdUI:DoInactiveTimer]]}, - {"ThresholdUI.ToggleHealTick", nil, f[[ThresholdUI:ToggleHealTick]]}, - {"ThresholdUI.ToggleTimeBox", nil, f[[ThresholdUI:ToggleTimeBox]]}, - {"gmcp.Char.Feedback", "Feedback", f[[ThresholdUI:UpdateFeedback]]}, - {"ThresholdUI.FeedbackToggle", nil, f[[ThresholdUI:FeedbackToggle]]}, + { "gmcp.Char.Vitals", nil, f [[ThresholdUI:UpdateVitals]] }, + { "gmcp.Char.Afflictions.Add", nil, f [[ThresholdUI:Afflictions_Add]] }, + { "gmcp.Char.Afflictions.Remove", nil, f [[ThresholdUI:Afflictions_Remove]] }, + { "gmcp.Char.Shielding", nil, f [[ThresholdUI:UpdateShielding]] }, + { "gmcp.Char.Status", "XP", f [[ThresholdUI:UpdateXP]] }, + { "gmcp.Char.Status", "Foe", f [[ThresholdUI:UpdateFoe]] }, + { "gmcp.Char.Status", "Capacity", f [[ThresholdUI:UpdateCapacity]] }, + { "gmcp.Char.Status", "Tummy", f [[ThresholdUI:UpdateTummy]] }, + { "gmcp.Char.Status", "HealBank", f [[ThresholdUI:UpdateHealBank]] }, + { "gmcp.Char.Status", "HealTick", f [[ThresholdUI:UpdateHealTick]] }, + { "gmcp.Char.Status", "Inactive", f [[ThresholdUI:DoInactiveTimer]] }, + { "ThresholdUI.ToggleHealTick", nil, f [[ThresholdUI:ToggleHealTick]] }, + { "ThresholdUI.ToggleTimeBox", nil, f [[ThresholdUI:ToggleTimeBox]] }, + { "gmcp.Char.Feedback", "Feedback", f [[ThresholdUI:UpdateFeedback]] }, + { "ThresholdUI.FeedbackToggle", nil, f [[ThresholdUI:FeedbackToggle]] }, } function ThresholdUI:RegisterEventHandlers() diff --git a/src/scripts/GUI/BarContainer.lua b/src/scripts/GUI/BarContainer.lua index 4ea2f5a..1c5fa78 100644 --- a/src/scripts/GUI/BarContainer.lua +++ b/src/scripts/GUI/BarContainer.lua @@ -1,5 +1,7 @@ ThresholdUI.BarBox = ThresholdUI.BarBox or Geyser.HBox:new({ name = "BarBox", - x = 0, y = 0, - width = "100%", height = "100%" + x = 0, + y = 0, + width = "100%", + height = "100%" }, ThresholdUI.MainContainer) diff --git a/src/scripts/GUI/Feedback.lua b/src/scripts/GUI/Feedback.lua index 70a55b2..3b2e37d 100644 --- a/src/scripts/GUI/Feedback.lua +++ b/src/scripts/GUI/Feedback.lua @@ -1,9 +1,11 @@ ThresholdUI.Feedback = ThresholdUI.Feedback or {} -ThresholdUI.FeedbackLabels = {"shock", "net", "mastery", "gaze"} +ThresholdUI.FeedbackLabels = { "shock", "net", "mastery", "gaze" } ThresholdUI.FeedbackBox = ThresholdUI.FeedbackBox or Geyser.HBox:new({ name = "FeedbackContainer", - x = 0, y = -(ThresholdUI.metrics.height + ThresholdUI.metrics.inactiveHeight), - height = ThresholdUI.metrics.inactiveHeight, width = "100%", + x = 0, + y = -(ThresholdUI.metrics.height + ThresholdUI.metrics.inactiveHeight), + height = ThresholdUI.metrics.inactiveHeight, + width = "100%", }) -- Create the labels for each feedback ability @@ -34,7 +36,7 @@ function ThresholdUI:FeedbackToggle() setBorderBottom(self.metrics.height + self.metrics.inactiveHeight) end - -- Inactive bar is being shown + -- Inactive bar is being shown else self.FeedbackBox:hide() end diff --git a/src/scripts/GUI/FoeXPShield.lua b/src/scripts/GUI/FoeXPShield.lua index 4cdaaa0..ed018ea 100644 --- a/src/scripts/GUI/FoeXPShield.lua +++ b/src/scripts/GUI/FoeXPShield.lua @@ -8,14 +8,18 @@ ThresholdUI.OtherBox = ThresholdUI.OtherBox or Geyser.VBox:new({ -- Foe ThresholdUI.FoeContainer = ThresholdUI.FoeContainer or Geyser.Container:new({ name = "FoeContainer", - x = 0, y = 0, - height = "100%", width = "100%" + x = 0, + y = 0, + height = "100%", + width = "100%" }, ThresholdUI.OtherBox); ThresholdUI.FoeBar = ThresholdUI.FoeBar or Geyser.Gauge:new({ name = "FoeBar", - x = 0, y = 0, - width = "100%", height = "100%" + x = 0, + y = 0, + width = "100%", + height = "100%" }, ThresholdUI.FoeContainer) ThresholdUI.FoeBar:setStyleSheet( @@ -29,8 +33,10 @@ ThresholdUI.FoeBar.text:echo(nil, "nocolor", nil) ThresholdUI.FoeLabel = ThresholdUI.FoeLabel or Geyser.Label:new({ name = "FoeLabel", - x = 0, y = 0, - width = "100%", height = "100%", + x = 0, + y = 0, + width = "100%", + height = "100%", message = "Foe" }, ThresholdUI.FoeContainer) @@ -40,8 +46,10 @@ ThresholdUI.FoeLabel:echo(nil, "nocolor", nil) ThresholdUI.FoeFoeLabel = ThresholdUI.FoeFoeLabel or Geyser.Label:new({ name = "FoeFoeLabel", - x = 0, y = 0, - width = "100%", height = "100%", + x = 0, + y = 0, + width = "100%", + height = "100%", }, ThresholdUI.FoeContainer) ThresholdUI.FoeFoeLabel:setStyleSheet(ThresholdUI.Styles.FoeFoeLabelStyle) @@ -51,12 +59,18 @@ ThresholdUI.FoeFoeLabel:echo(nil, "nocolor", nil) -- XP ThresholdUI.XPContainer = ThresholdUI.XPContainer or Geyser.Container:new({ name = "XPContainer", - x = 0, y = 0, height = "100%", width = "100%" + x = 0, + y = 0, + height = "100%", + width = "100%" }, ThresholdUI.OtherBox); ThresholdUI.XPBar = ThresholdUI.XPBar or Geyser.Gauge:new({ name = "XPBar", - x = 0, y = 0, width = "100%", height = "100%" + x = 0, + y = 0, + width = "100%", + height = "100%" }, ThresholdUI.XPContainer) ThresholdUI.XPBar:setStyleSheet( @@ -69,10 +83,12 @@ ThresholdUI.XPBar.text:echo(nil, "nocolor", nil) ThresholdUI.XPLabel = ThresholdUI.XPLabel or Geyser.Label:new({ name = "XPLabel", - x = 0, y = 0, - width = "100%", height = "100%", + x = 0, + y = 0, + width = "100%", + height = "100%", message = "XP" -},ThresholdUI.XPContainer) +}, ThresholdUI.XPContainer) ThresholdUI.XPLabel:setStyleSheet(ThresholdUI.Styles.GaugeLabel) ThresholdUI.XPLabel:setFontSize(ThresholdUI.metrics.gaugeLabelFontSize) @@ -81,14 +97,18 @@ ThresholdUI.XPLabel:echo(nil, "nocolor", nil) -- Shielding ThresholdUI.ShieldContainer = ThresholdUI.ShieldContainer or Geyser.Container:new({ name = "ShieldContainer", - x = 0, y = 0, - width = "100%", height = "100%", + x = 0, + y = 0, + width = "100%", + height = "100%", }, ThresholdUI.OtherBox); ThresholdUI.ShieldBar = ThresholdUI.ShieldBar or Geyser.Gauge:new({ name = "ShieldBar", - x = 0, y = 0, - width = "100%", height = "100%" + x = 0, + y = 0, + width = "100%", + height = "100%" }, ThresholdUI.ShieldContainer) ThresholdUI.ShieldBar:setStyleSheet( @@ -102,8 +122,10 @@ ThresholdUI.ShieldBar.text:echo(nil, "nocolor", nil) ThresholdUI.ShieldLabel = ThresholdUI.ShieldLabel or Geyser.Label:new({ name = "ShieldLabel", - x = 0, y = 0, - width = "100%", height = "100%", + x = 0, + y = 0, + width = "100%", + height = "100%", message = "Shielding" }, ThresholdUI.ShieldContainer) diff --git a/src/scripts/GUI/Inactive_Container.lua b/src/scripts/GUI/Inactive_Container.lua index af020e4..1108de8 100644 --- a/src/scripts/GUI/Inactive_Container.lua +++ b/src/scripts/GUI/Inactive_Container.lua @@ -1,13 +1,17 @@ ThresholdUI.InactiveContainer = ThresholdUI.InactiveContainer or Geyser.Container:new({ name = "InactiveContainer", - x = 0, y = -(ThresholdUI.metrics.height + ThresholdUI.metrics.inactiveHeight)+2, - width = "100%", height = ThresholdUI.metrics.inactiveHeight, + x = 0, + y = -(ThresholdUI.metrics.height + ThresholdUI.metrics.inactiveHeight) + 2, + width = "100%", + height = ThresholdUI.metrics.inactiveHeight, }) ThresholdUI.InactiveLabel = ThresholdUI.InactiveLabel or Geyser.Label:new({ name = "InactiveLabel", - x = 0, y = 0, - width = "100%", height = "100%", + x = 0, + y = 0, + width = "100%", + height = "100%", stylesheet = ThresholdUI.Styles.InactiveLabel, fontSize = ThresholdUI.metrics.inactiveFontSize, message = "You have been inactive for 0s" @@ -18,14 +22,14 @@ ThresholdUI.InactiveContainer:hide() ThresholdUI.InactiveStart = nil ThresholdUI.InactiveType = "" -ThresholdUI.InactivePhase = 0 -- Start at black +ThresholdUI.InactivePhase = 0 -- Start at black ThresholdUI.BreathSpeed = 0.02 -ThresholdUI.BrightColor = {r = 18, g = 22, b = 25} -- Previously the middle color, now the brightest +ThresholdUI.BrightColor = { r = 18, g = 22, b = 25 } -- Previously the middle color, now the brightest function ThresholdUI:UpdateInactiveGradient() local style = ThresholdUI.Styles.InactiveLabel - local t = math.sin(self.InactivePhase) * 0.5 + 0.5 -- Oscillate between 0 and 1 + local t = math.sin(self.InactivePhase) * 0.5 + 0.5 -- Oscillate between 0 and 1 -- Interpolate between black and bright color local r = math.floor(self.BrightColor.r * t) @@ -57,19 +61,19 @@ function ThresholdUI:FormatDuration(duration) local answer if days > 0 then - answer = f"{answer or \"\"}{days}d " + answer = f "{answer or \"\"}{days}d " end if hours > 0 then - answer = f"{answer or \"\"}{hours}h " + answer = f "{answer or \"\"}{hours}h " end if minutes > 0 then - answer = f"{answer or \"\"}{minutes}m " + answer = f "{answer or \"\"}{minutes}m " end if seconds > 0 then - answer = f"{answer or \"\"}{seconds}s" + answer = f "{answer or \"\"}{seconds}s" end return answer @@ -96,13 +100,14 @@ function ThresholdUI:StartInactiveTimer() self.InactiveType = "Resting" end - self.InactivePhase = 0 -- Start at black + self.InactivePhase = 0 -- Start at black self:UpdateInactiveGradient() -- Reset the gradient self.InactiveContainer:show() setBorderBottom(self.metrics.height + self.metrics.inactiveHeight) registerNamedTimer(self.AppName, self.Timers.InactiveTimer, 0.1, function() self:UpdateInactiveDisplay() end, true) - registerNamedTimer(self.AppName, self.Timers.InactiveEffectTimer, 0.05, function() self:UpdateInactiveGradient() end, true) + registerNamedTimer(self.AppName, self.Timers.InactiveEffectTimer, 0.05, function() self:UpdateInactiveGradient() end, + true) end function ThresholdUI:CancelInactiveTimer() diff --git a/src/scripts/GUI/Main_Container.lua b/src/scripts/GUI/Main_Container.lua index ae37a58..bf67d8e 100644 --- a/src/scripts/GUI/Main_Container.lua +++ b/src/scripts/GUI/Main_Container.lua @@ -1,15 +1,11 @@ --- Adjust the dimensions based on the font and font sizes used in the UI -ThresholdUI:AdjustFontMetrics() - --- Set the new height -ThresholdUI.metrics.height = ThresholdUI.metrics.maxDim.height * 3 - -- Now that we know our height, BAM! SET THE THINGS! setBorderBottom(ThresholdUI.metrics.height) ThresholdUI.MainContainer = ThresholdUI.MainContainer or Geyser.Label:new({ name = "MainContainer", - x = 2, y = -(ThresholdUI.metrics.height-2), - width = "100%", height = (ThresholdUI.metrics.height-2), + x = 2, + y = -(ThresholdUI.metrics.height), + width = "100%", + height = (ThresholdUI.metrics.height), stylesheet = ThresholdUI.Styles.MainContainer }) diff --git a/src/scripts/GUI/MetersTime.lua b/src/scripts/GUI/MetersTime.lua index 8e98bd6..fcbc829 100644 --- a/src/scripts/GUI/MetersTime.lua +++ b/src/scripts/GUI/MetersTime.lua @@ -1,7 +1,7 @@ -- Let's find out how big everything is! local numMeters = 4 -local metersBoxWidth = numMeters * (ThresholdUI.metrics.devotionDim.width) -local DateTimeBgWidth = ThresholdUI.metrics.devotionDim.width * ThreshTime.config.longestDevotion +local metersBoxWidth = numMeters * 10 +local DateTimeBgWidth = 10 * (ThreshTime.config.longestDevotion + 2) local RightBoxWidth = metersBoxWidth + DateTimeBgWidth @@ -11,10 +11,6 @@ ThresholdUI.RightBox = ThresholdUI.RightBox or Geyser.HBox:new({ h_policy = Geyser.Fixed }, ThresholdUI.BarBox) --- We need to know how wide to make the meters, since that box is going to be --- statically sized and the time stuff will be auto. - - -- Meters ThresholdUI.MetersBox = ThresholdUI.MetersBox or Geyser.HBox:new({ name = "MetersBox", @@ -39,10 +35,12 @@ ThresholdUI.CapacityBar:setStyleSheet( ThresholdUI.CapacityLabel = ThresholdUI.CapacityLabel or Geyser.Label:new({ name = "CapacityLabel", - width = "100%", height = ThresholdUI.metrics.maxDim.height, + width = "100%", + height = 25, v_policy = Geyser.Fixed, message = "C", - font = ThresholdUI.Styles.MeterFontName, fontSize = ThresholdUI.metrics.meterFontSize, + font = ThresholdUI.Styles.MeterFontName, + fontSize = ThresholdUI.metrics.meterFontSize, }, ThresholdUI.CapacityBox) ThresholdUI.CapacityLabel:setStyleSheet(ThresholdUI.Styles.MeterLabel) ThresholdUI.CapacityLabel:echo(nil, "nocolor", nil) @@ -64,10 +62,12 @@ ThresholdUI.TummyBar:setStyleSheet( ThresholdUI.TummyLabel = ThresholdUI.TummyLabel or Geyser.Label:new({ name = "TummyLabel", - width = "100%", height = ThresholdUI.metrics.maxDim.height, + width = "100%", + height = 25, v_policy = Geyser.Fixed, message = "T", - font = ThresholdUI.Styles.MeterFontName, fontSize = ThresholdUI.metrics.meterFontSize, + font = ThresholdUI.Styles.MeterFontName, + fontSize = ThresholdUI.metrics.meterFontSize, }, ThresholdUI.TummyBox) ThresholdUI.TummyLabel:setStyleSheet(ThresholdUI.Styles.MeterLabel) @@ -90,11 +90,13 @@ ThresholdUI.HealBankBar:setStyleSheet( ThresholdUI.HealBankLabel = ThresholdUI.HealBankLabel or Geyser.Label:new({ name = "HealBankLabel", - width = "100%", height = ThresholdUI.metrics.maxDim.height, + width = "100%", + height = 25, v_policy = Geyser.Fixed, message = "H", - font = ThresholdUI.Styles.MeterFontName, fontSize = ThresholdUI.metrics.meterFontSize, -},ThresholdUI.HealBankBox) + font = ThresholdUI.Styles.MeterFontName, + fontSize = ThresholdUI.metrics.meterFontSize, +}, ThresholdUI.HealBankBox) ThresholdUI.HealBankLabel:setStyleSheet(ThresholdUI.Styles.MeterLabel) ThresholdUI.HealBankLabel:echo(nil, "nocolor", nil) @@ -116,10 +118,12 @@ ThresholdUI.HealTickBar:setStyleSheet( ThresholdUI.HealTickLabel = ThresholdUI.HealTickLabel or Geyser.Label:new({ name = "HealTickLabel", - width = "100%", height = ThresholdUI.metrics.maxDim.height, + width = "100%", + height = 25, v_policy = Geyser.Fixed, message = "R", - font = ThresholdUI.Styles.MeterFontName, fontSize = ThresholdUI.metrics.meterFontSize, + font = ThresholdUI.Styles.MeterFontName, + fontSize = ThresholdUI.metrics.meterFontSize, }, ThresholdUI.HealTickBox) ThresholdUI.HealTickLabel:setStyleSheet(ThresholdUI.Styles.MeterLabel) @@ -167,7 +171,6 @@ function ThresholdUI:ToggleHealTick(event, arg, silent) self.Prefs.HealTick = true self:SavePrefs() - elseif arg == "off" then self.HealTickBox:hide() self.MetersBox:remove(self.HealTickBox) @@ -178,7 +181,6 @@ function ThresholdUI:ToggleHealTick(event, arg, silent) if silent ~= true then echo("Regen tick gauge disabled.\n") end - else echo("Syntax: regen \n") end @@ -189,38 +191,45 @@ end -- Background label to prevent bleeding colours ThresholdUI.DateTimeBg = ThresholdUI.DateTimeBg or Geyser.Label:new({ name = "DateTimeBg", - width = DateTimeBgWidth, height = ThresholdUI.metrics.height, + width = DateTimeBgWidth, + height = ThresholdUI.metrics.height, h_policy = Geyser.Fixed, stylesheet = ThresholdUI.Styles.DateTimeLabel }, ThresholdUI.RightBox) ThresholdUI.DateTimeBox = ThresholdUI.DateTimeBox or Geyser.VBox:new({ name = "TimeBox", - x = 0, y = 0, - width = "100%", height = "100%" + x = 0, + y = 0, + width = "100%", + height = "100%" }, ThresholdUI.DateTimeBg) ThresholdUI.DateLabel = ThresholdUI.DateLabel or Geyser.Label:new({ name = "DateLabel", - font = ThresholdUI.Styles.DateTimeFont, fontSize = ThresholdUI.metrics.dateFontSize, + font = ThresholdUI.Styles.DateTimeFont, + fontSize = ThresholdUI.metrics.dateFontSize, stylesheet = ThresholdUI.Styles.DateTimeLabel }, ThresholdUI.DateTimeBox) ThresholdUI.DayLabel = ThresholdUI.DayLabel or Geyser.Label:new({ name = "DayLabel", - font = ThresholdUI.Styles.DateTimeFont, fontSize = ThresholdUI.metrics.dayFontSize, + font = ThresholdUI.Styles.DateTimeFont, + fontSize = ThresholdUI.metrics.dayFontSize, stylesheet = ThresholdUI.Styles.DateTimeLabel }, ThresholdUI.DateTimeBox) ThresholdUI.TimeLabel = ThresholdUI.TimeLabel or Geyser.Label:new({ name = "TimeLabel", - font = ThresholdUI.Styles.DateTimeFont, fontSize = ThresholdUI.metrics.hourFontSize, + font = ThresholdUI.Styles.DateTimeFont, + fontSize = ThresholdUI.metrics.hourFontSize, stylesheet = ThresholdUI.Styles.DateTimeLabel }, ThresholdUI.DateTimeBox) ThresholdUI.Devotion = ThresholdUI.Devotion or Geyser.Label:new({ name = "DevotionLabel", - font = ThresholdUI.Styles.DateTimeFont, fontSize = ThresholdUI.metrics.devotionFontSize, + font = ThresholdUI.Styles.DateTimeFont, + fontSize = ThresholdUI.metrics.devotionFontSize, stylesheet = ThresholdUI.Styles.DateTimeLabel }, ThresholdUI.DateTimeBox) @@ -235,12 +244,11 @@ function ThresholdUI:ToggleTimeBox(event, arg, silent) self:startTime() if silent ~= true then - echo("Time box enabled.\n") + echo("Time box enabled.\n") end self.Prefs.TimeBox = true self:SavePrefs() - elseif arg == "off" then self.DateTimeBg:hide() self.RightBox:remove(self.DateTimeBg) @@ -253,9 +261,8 @@ function ThresholdUI:ToggleTimeBox(event, arg, silent) self:SavePrefs() if silent ~= true then - echo("Time box disabled.\n") + echo("Time box disabled.\n") end - else echo("Syntax: timebox \n") end @@ -286,7 +293,7 @@ function ThresholdUI:refreshTime() suffix = "rd" end - timemess = f"{timeAsString}{suffix} toll" + timemess = f "{timeAsString}{suffix} toll" self.DateLabel:echo(datemess, "nocolor", nil) self.DayLabel:echo(datetime.weekday, "nocolor", nil) self.TimeLabel:echo(timemess, "nocolor", nil) diff --git a/src/scripts/GUI/SettleDown.lua b/src/scripts/GUI/SettleDown.lua deleted file mode 100644 index e69de29..0000000 diff --git a/src/scripts/GUI/Vitals.lua b/src/scripts/GUI/Vitals.lua index a3553c7..481bc5b 100644 --- a/src/scripts/GUI/Vitals.lua +++ b/src/scripts/GUI/Vitals.lua @@ -8,14 +8,18 @@ ThresholdUI.VitalsBox = ThresholdUI.VitalsBox or Geyser.VBox:new({ -- HP ThresholdUI.HPContainer = ThresholdUI.HPContainer or Geyser.Container:new({ name = "HPContainer", - x = 0, y = 0, - width = "100%", height = "100%", + x = 0, + y = 0, + width = "100%", + height = "100%", }, ThresholdUI.VitalsBox); ThresholdUI.HPBar = ThresholdUI.HPBar or Geyser.Gauge:new({ name = "HPBar", - x = 0, y = 0, - width = "100%", height = "100%", + x = 0, + y = 0, + width = "100%", + height = "100%", show_text = false }, ThresholdUI.HPContainer) @@ -29,8 +33,10 @@ ThresholdUI.HPBar.text:echo(nil, "nocolor", nil) ThresholdUI.HPLabel = ThresholdUI.HPLabel or Geyser.Label:new({ name = "HPLabel", - x = 0, y = 0, - width = "100%", height = "100%", + x = 0, + y = 0, + width = "100%", + height = "100%", message = "HP" }, ThresholdUI.HPContainer) @@ -41,14 +47,18 @@ ThresholdUI.HPLabel:echo(nil, "nocolor", nil) -- SP ThresholdUI.SPContainer = ThresholdUI.SPContainer or Geyser.Container:new({ name = "SPContainer", - x = 0, y = 0, - width = "100%", height = "100%", + x = 0, + y = 0, + width = "100%", + height = "100%", }, ThresholdUI.VitalsBox); ThresholdUI.SPBar = ThresholdUI.SPBar or Geyser.Gauge:new({ name = "SPBar", - x = 0, y = 0, - width = "100%", height = "100%" + x = 0, + y = 0, + width = "100%", + height = "100%" }, ThresholdUI.SPContainer) ThresholdUI.SPBar:setStyleSheet( @@ -62,8 +72,10 @@ ThresholdUI.SPBar.text:echo(nil, "nocolor", nil) ThresholdUI.SPLabel = ThresholdUI.SPLabel or Geyser.Label:new({ name = "SPLabel", - x = 0, y = 0, - width = "100%", height = "100%", + x = 0, + y = 0, + width = "100%", + height = "100%", message = "SP" }, ThresholdUI.SPContainer) @@ -74,28 +86,34 @@ ThresholdUI.SPLabel:echo(nil, "nocolor", nil) -- EP ThresholdUI.EPContainer = ThresholdUI.EPContainer or Geyser.Container:new({ name = "EPContainer", - x = 30, y = 0, - width = "100%", height = "100%", + x = 30, + y = 0, + width = "100%", + height = "100%", }, ThresholdUI.VitalsBox); ThresholdUI.EPBar = ThresholdUI.EPBar or Geyser.Gauge:new({ name = "EPBar", - x = 0, y = 0, - width = "100%", height = "100%" + x = 0, + y = 0, + width = "100%", + height = "100%" }, ThresholdUI.EPContainer) ThresholdUI.EPBar:setStyleSheet( - ThresholdUI.Styles.EPFrontNormal, - ThresholdUI.Styles.EPBack, - ThresholdUI.Styles.GaugeText + ThresholdUI.Styles.EPFrontNormal, + ThresholdUI.Styles.EPBack, + ThresholdUI.Styles.GaugeText ) ThresholdUI.EPBar.text:setFontSize(ThresholdUI.metrics.gaugeFontSize) ThresholdUI.EPBar.text:echo(nil, "nocolor", nil) ThresholdUI.EPLabel = ThresholdUI.EPLabel or Geyser.Label:new({ name = "EPLabel", - x = 0, y = 0, - width = "100%", height = "100%", + x = 0, + y = 0, + width = "100%", + height = "100%", message = "EP" }, ThresholdUI.EPContainer) @@ -145,9 +163,9 @@ function ThresholdUI:Afflictions_Add() local aff = gmcp.Char.Afflictions.Add if aff[1] == "stun" or aff[1] == "immobile" then - self.HPBar.front:setStyleSheet(self.Styles.HPFrontStunned) - self.SPBar.front:setStyleSheet(self.Styles.SPFrontStunned) - self.EPBar.front:setStyleSheet(self.Styles.EPFrontStunned) + self.HPBar:setStyleSheet(self.Styles.HPFrontStunned) + self.SPBar:setStyleSheet(self.Styles.SPFrontStunned) + self.EPBar:setStyleSheet(self.Styles.EPFrontStunned) end end @@ -155,8 +173,8 @@ function ThresholdUI:Afflictions_Remove() local aff = gmcp.Char.Afflictions.Remove if aff == "stun" or aff == "immobile" then - self.HPBar.front:setStyleSheet(self.Styles.HPFrontNormal) - self.SPBar.front:setStyleSheet(self.Styles.SPFrontNormal) - self.EPBar.front:setStyleSheet(self.Styles.EPFrontNormal) + self.HPBar:setStyleSheet(self.Styles.HPFrontNormal) + self.SPBar:setStyleSheet(self.Styles.SPFrontNormal) + self.EPBar:setStyleSheet(self.Styles.EPFrontNormal) end end diff --git a/src/scripts/GUI/scripts.json b/src/scripts/GUI/scripts.json index 48bff59..b779a58 100644 --- a/src/scripts/GUI/scripts.json +++ b/src/scripts/GUI/scripts.json @@ -40,11 +40,5 @@ "isFolder": "no", "name": "MetersTime", "script": "" - }, - { - "isActive": "yes", - "isFolder": "no", - "name": "SettleDown", - "script": "" } ] diff --git a/src/scripts/Install_Uninstall.lua b/src/scripts/Install_Uninstall.lua index 8615e74..8528bab 100644 --- a/src/scripts/Install_Uninstall.lua +++ b/src/scripts/Install_Uninstall.lua @@ -1,29 +1,30 @@ ThresholdUI.SysHandlers = ThresholdUI.SysHandlers or { - {"sysInstall", f[[ThresholdUI:Install]]}, - {"sysUninstall", f[[ThresholdUI:Uninstall]]}, + { "sysInstall", f [[ThresholdUI:Install]] }, + { "sysUninstall", f [[ThresholdUI:Uninstall]] }, + { "sysLoadEvent", f [[ThresholdUI:SysLoadEvent]] } } function ThresholdUI:Install(event, package) if package ~= self.AppName then return end - deleteNamedEventHandler(self.AppName, self.AppName..".sysInstall") + deleteNamedEventHandler(self.AppName, self.AppName .. ".sysInstall") self:ConnectionScript() cecho("Thank you for installing ThresholdUI!\nInitializing GMCP in Threshold.\n") - tempTimer(1, f[[send("gmcp reset", false)]]) + tempTimer(1, f [[send("gmcp reset", false)]]) end function ThresholdUI:Uninstall(event, package) - if package ~= self.AppName then return end + if package ~= self.AppName then return end setBorderTop(0) setBorderBottom(0) setBorderLeft(0) setBorderRight(0) - setBorderColor(0,0,0) - setBgColor(0,0,0) - setBackgroundColor(0,0,0) + setBorderColor(0, 0, 0) + setBgColor(0, 0, 0) + setBackgroundColor(0, 0, 0) self.MainContainer:hide() self.FeedbackBox:hide() deleteAllNamedTimers(self.AppName) @@ -32,8 +33,16 @@ function ThresholdUI:Uninstall(event, package) cecho("You have uninstalled ThresholdUI.\n") end +function ThresholdUI:SysLoadEvent(_, notProfileReset) + if not notProfileReset then + self:ConnectionScript() + + tempTimer(0.5, f [[send("gmcp reset", false)]]) + end +end + for _, v in ipairs(ThresholdUI.SysHandlers) do local event, handler = v[1], v[2] - registerNamedEventHandler(ThresholdUI.AppName, ThresholdUI.AppName.."."..event, event, handler) + registerNamedEventHandler(ThresholdUI.AppName, ThresholdUI.AppName .. "." .. event, event, handler) end diff --git a/src/scripts/Styles.lua b/src/scripts/Styles.lua index 1c145f1..7e1fa34 100644 --- a/src/scripts/Styles.lua +++ b/src/scripts/Styles.lua @@ -1,8 +1,8 @@ local FontName = "Ubuntu" local DateTimeFontName = FontName -local Font = f[[ font-family: '{FontName}'; ]] -local DateTimeFont = f[[ font-family: '{DateTimeFontName}'; ]] -local MainTextFont = f[[ {Font} ]] +local Font = f [[ font-family: '{FontName}'; ]] +local DateTimeFont = f [[ font-family: '{DateTimeFontName}'; ]] +local MainTextFont = f [[ {Font} ]] local MainTextColour = "color: rgba(200,200,200,90%);" local Bold = "font-weight: 500;" local Left = "qproperty-alignment: 'AlignLeft | AlignVCenter';" @@ -10,96 +10,64 @@ local Center = "qproperty-alignment: 'AlignCenter | AlignVCenter';" local Right = "qproperty-alignment: 'AlignRight | AlignVCenter';" local MainBackgroundColour = "background-color: rgba(224, 173, 45, 10%);" local MainBorder = "1px solid rgba(224, 173, 45, 10%)" -local GaugeTextFont = f[[ {Font} {MainTextColour} ]] +local GaugeTextFont = f [[ {Font} {MainTextColour} ]] local GaugeBorder = "border-radius: 3px; border: 1px solid rgba(224, 173, 45, 22%);" local GaugeMargin = "margin: 2px 3px;" local MeterBorder = "border-radius: 3px; border: 1px solid rgba(20, 20, 20, 100%);" local MeterFontName = FontName -local MeterTextFont = f[[ {Font} {MainTextColour} ]] -local MeterFGColour = "background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 1, stop: 0 #ffddc9, stop: 0.1 #9e6e3a, stop: 0.95 #6a4825, stop: 1 #ffddc9);" +local MeterTextFont = f [[ {Font} {MainTextColour} ]] +local MeterFGColour = +"background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 1, stop: 0 #ffddc9, stop: 0.1 #9e6e3a, stop: 0.95 #6a4825, stop: 1 #ffddc9);" local MeterBGColour = "background: rgba(224, 173, 45, 15%);" -local MeterLabel = "background-color: rgba(0,0,0,0%); color: rgba(224, 173, 45, 100%); qproperty-alignment: 'AlignCenter | AlignVCenter';" +local MeterLabel = +"background-color: rgba(0,0,0,0%); color: rgba(224, 173, 45, 100%); qproperty-alignment: 'AlignCenter | AlignVCenter';" local FeedbackBorder = "border-radius: 3px; border: 1px solid rgba(20, 20, 20, 100%);" local Transparent = "background-color: rgba(0,0,0,0%);" ThresholdUI.Styles = ThresholdUI.Styles or { FontName = FontName, - MainContainer = f[[ {MainBackgroundColour} border-top: {MainBorder}; border-bottom: {MainBorder}; ]], + MainContainer = f [[ {MainBackgroundColour} border-top: {MainBorder}; border-bottom: {MainBorder}; ]], - GaugeLabel = f[[ {Transparent} padding-left: 4px; padding-right: 4px; {Left} {MainTextFont} {MainTextColour} ]], - GaugeLabelCombat = f[[ {Transparent} padding-left: 4px; padding-right: 4px; {Left} {MainTextFont} {MainTextColour} {Bold} ]], - GaugeText = f[[ {MainTextColour} {GaugeTextFont} {Center} {Bold} ]], + GaugeLabel = f [[ {Transparent} padding-left: 4px; padding-right: 4px; {Left} {MainTextFont} {MainTextColour} ]], + GaugeLabelCombat = f [[ {Transparent} padding-left: 4px; padding-right: 4px; {Left} {MainTextFont} {MainTextColour} {Bold} ]], + GaugeText = f [[ {MainTextColour} {GaugeTextFont} {Center} {Bold} ]], - HPFrontNormal = f[[ background-color: rgb(164, 25, 25); {GaugeBorder} {GaugeMargin} ]], - HPFrontStunned = f[[ background-color: rgba(165,0,0, 35%); {GaugeBorder} {GaugeMargin} ]], - HPBack = f[[ background-color: rgb(32, 5, 5); {GaugeBorder} {GaugeMargin} ]], + HPFrontNormal = f [[ background-color: rgb(164, 25, 25); {GaugeBorder} {GaugeMargin} ]], + HPFrontStunned = f [[ background-color: rgba(165,0,0, 35%); {GaugeBorder} {GaugeMargin} ]], + HPBack = f [[ background-color: rgb(32, 5, 5); {GaugeBorder} {GaugeMargin} ]], - SPFrontNormal = f[[ background-color: rgb(0, 64, 128); {GaugeBorder} {GaugeMargin} ]], - SPFrontStunned = f[[ background-color: rgba(0, 51, 103, 35%); {GaugeBorder} {GaugeMargin} ]], - SPBack = f[[ background-color: rgb(44, 48, 50); {GaugeBorder} {GaugeMargin} ]], + SPFrontNormal = f [[ background-color: rgb(0, 64, 128); {GaugeBorder} {GaugeMargin} ]], + SPFrontStunned = f [[ background-color: rgba(0, 51, 103, 35%); {GaugeBorder} {GaugeMargin} ]], + SPBack = f [[ background-color: rgb(44, 48, 50); {GaugeBorder} {GaugeMargin} ]], - EPFrontNormal = f[[ background-color: rgb(0, 128, 128); {GaugeBorder} {GaugeMargin} ]], - EPFrontStunned = f[[ background-color: rgba(0, 102, 102, 35%); {GaugeBorder} {GaugeMargin} ]], - EPBack = f[[ background-color: rgb(0, 51, 51); {GaugeBorder} {GaugeMargin} ]], + EPFrontNormal = f [[ background-color: rgb(0, 128, 128); {GaugeBorder} {GaugeMargin} ]], + EPFrontStunned = f [[ background-color: rgba(0, 102, 102, 35%); {GaugeBorder} {GaugeMargin} ]], + EPBack = f [[ background-color: rgb(0, 51, 51); {GaugeBorder} {GaugeMargin} ]], - FoeFrontNormal = f[[ background-color: rgb(129,83,0); {GaugeBorder} {GaugeMargin} ]], - FoeFrontCombat = f[[ background-color: rgb(129,83,0); {GaugeBorder} {GaugeMargin} {Font} {MainTextColour} {Center} {Bold} ]], - FoeLabelCombat = f[[ {MainTextColour} {Font} {MainTextColour} {Right} {Transparent} padding-right: 4px; {Bold} ]], - FoeBack = f[[ background-color: rgb(54, 44, 27); {GaugeBorder} {GaugeMargin} ]], - FoeFoeLabelStyle = f[[ {MainTextColour} {Font} {MainTextColour} {Right} {Transparent} padding-right: 4px; {Bold} ]], + FoeFrontNormal = f [[ background-color: rgb(129,83,0); {GaugeBorder} {GaugeMargin} ]], + FoeFrontCombat = f [[ background-color: rgb(129,83,0); {GaugeBorder} {GaugeMargin} {Font} {MainTextColour} {Center} {Bold} ]], + FoeLabelCombat = f [[ {MainTextColour} {Font} {MainTextColour} {Right} {Transparent} padding-right: 4px; {Bold} ]], + FoeBack = f [[ background-color: rgb(54, 44, 27); {GaugeBorder} {GaugeMargin} ]], + FoeFoeLabelStyle = f [[ {MainTextColour} {Font} {MainTextColour} {Right} {Transparent} padding-right: 4px; {Bold} ]], - XPFrontNormal = f[[ background-color: rgb(122, 0, 122); {GaugeBorder} {GaugeMargin} ]], - XPFrontStunned = f[[ background-color: rgba(153, 0, 153,35%); {GaugeBorder} {GaugeMargin} ]], - XPBack = f[[ background-color: rgb(52, 0, 52); {GaugeBorder} {GaugeMargin} ]], + XPFrontNormal = f [[ background-color: rgb(122, 0, 122); {GaugeBorder} {GaugeMargin} ]], + XPFrontStunned = f [[ background-color: rgba(153, 0, 153,35%); {GaugeBorder} {GaugeMargin} ]], + XPBack = f [[ background-color: rgb(52, 0, 52); {GaugeBorder} {GaugeMargin} ]], - ShieldFrontNormal = f[[ background-color: rgb(34, 90, 34); {GaugeBorder} {GaugeMargin} ]], - ShieldFrontStunned = f[[ background-color: rgba(34, 90, 34, 35%); {GaugeBorder} {GaugeMargin} ]], - ShieldBack = f[[ background-color: rgb(0, 26, 0); {GaugeBorder} {GaugeMargin} ]], + ShieldFrontNormal = f [[ background-color: rgb(34, 90, 34); {GaugeBorder} {GaugeMargin} ]], + ShieldFrontStunned = f [[ background-color: rgba(34, 90, 34, 35%); {GaugeBorder} {GaugeMargin} ]], + ShieldBack = f [[ background-color: rgb(0, 26, 0); {GaugeBorder} {GaugeMargin} ]], - MeterFront = f[[ {MeterFGColour} {MeterBorder} ]], - MeterBack = f[[ {MeterBGColour} {MeterBorder} ]], - MeterLabel = f[[ {MeterLabel} ]], + MeterFront = f [[ {MeterFGColour} {MeterBorder} ]], + MeterBack = f [[ {MeterBGColour} {MeterBorder} ]], + MeterLabel = f [[ {MeterLabel} ]], MeterFontName = MeterFontName, MeterTextFont = MeterTextFont, - DateTimeLabel = f[[ {DateTimeFont} color: rgba(224, 173, 45, 100%); {Transparent} letter-spacing: 1px; {Center} ]], + DateTimeLabel = f [[ {DateTimeFont} color: rgba(224, 173, 45, 100%); {Transparent} letter-spacing: 1px; {Center} ]], - InactiveLabel = f[[ {Font} {MainTextColour} letter-spacing: 1px; {Center} ]], + InactiveLabel = f [[ {Font} {MainTextColour} letter-spacing: 1px; {Center} ]], - FeedbackInactive = f[[ {FeedbackBorder} color: rgb(47,79,79); background-color: rgb(0,0,0); ]], - FeedbackActive = f[[ {FeedbackBorder} color: rgb(255,215,0); background-color: rgb(0,83,160); ]], + FeedbackInactive = f [[ {FeedbackBorder} color: rgb(47,79,79); background-color: rgb(0,0,0); ]], + FeedbackActive = f [[ {FeedbackBorder} color: rgb(255,215,0); background-color: rgb(0,83,160); ]], } - -function ThresholdUI:AdjustFontMetrics() - local FontName = self.Styles.FontName - local tallest = 0 - local widest = 0 - - -- First, collect all FontSize keys - local fontSizeKeys = {} - for key, value in pairs(self.metrics) do - if string.match(key, "FontSize$") then - table.insert(fontSizeKeys, key) - end - end - - -- Now process them - for _, key in ipairs(fontSizeKeys) do - local value = self.metrics[key] - local width, height = calcFontSize(value, FontName) - local dimKey = string.gsub(key, "FontSize$", "Dim") - - self.metrics[dimKey] = { - width = width + (self.metrics.fontPaddingX * 2), - height = height + (self.metrics.fontPaddingY * 2) - } - - widest = self.metrics[dimKey].width > widest and self.metrics[dimKey].width or widest - tallest = self.metrics[dimKey].height > tallest and self.metrics[dimKey].height or tallest - end - - self.metrics.maxDim = { - width = widest, - height = tallest, - } -end diff --git a/src/scripts/ThreshTime.lua b/src/scripts/ThreshTime.lua index bb3d72a..b6c72b9 100644 --- a/src/scripts/ThreshTime.lua +++ b/src/scripts/ThreshTime.lua @@ -1,11 +1,11 @@ ThreshTime = ThreshTime or { config = { - epochStart = 631170000, -- The start of the game's clock in UNIX time + epochStart = 631170000, -- The start of the game's clock in UNIX time start = { month = 1, year = 100 }, -- The first game day, arrays are 1-based - dayLength = 7200, -- The number of UNIX seconds in a game day - monthLength = 216000, -- The number of UNIX seconds in a game month - daysInMonth = 30, -- The number of game days in a game month - yearLength = 2592000, -- The number of UNIX seconds in a game year + dayLength = 7200, -- The number of UNIX seconds in a game day + monthLength = 216000, -- The number of UNIX seconds in a game month + daysInMonth = 30, -- The number of game days in a game month + yearLength = 2592000, -- The number of UNIX seconds in a game year months = { "Dawn", "Cuspis", "Thawing", "Renasci", "Tempest", "Serenus", "Solaria", "Torrid", "Sojourn", "Hoerfest", "Twilight", "Deepchill" }, days = { "Vidi", "Aubus", "Tikun", "Coronea", "Dashen", "Merida", "Solus", "Ganymor", "Dianis", "Misma", "Duskus", "Lunas" }, seasonProgress = { 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0 }, @@ -104,13 +104,14 @@ function ThreshTime:getTime(current) -- Determine the Devotion local devotionCount = #self.config.devotions local devotionDaysDuration = 24 - local currentDay = ( ( results.month - 1 ) * 30 ) + results.day + local currentDay = ((results.month - 1) * 30) + results.day local devotionIndex = math.floor(currentDay / devotionDaysDuration) + 1 if devotionIndex <= devotionCount then results.devotion = self.config.devotions[devotionIndex] else - results.devotion = self.config.voidDevotion end + results.devotion = self.config.voidDevotion + end return results end diff --git a/src/scripts/ThresholdUI.lua b/src/scripts/ThresholdUI.lua index 62f846c..2c64361 100644 --- a/src/scripts/ThresholdUI.lua +++ b/src/scripts/ThresholdUI.lua @@ -5,14 +5,14 @@ ThresholdUI = ThresholdUI or {} ThresholdUI.AppName = ThresholdUI.AppName or "ThresholdUI" -- Threshold App Directory -ThresholdUI.AppDir = f"{getMudletHomeDir()}/{ThresholdUI.AppName}" +ThresholdUI.AppDir = f "{getMudletHomeDir()}/{ThresholdUI.AppName}" -- Prefs -ThresholdUI.PrefsFile = f"{ThresholdUI.AppDir}/prefs.lua" +ThresholdUI.PrefsFile = f "{ThresholdUI.AppDir}/prefs.lua" ThresholdUI.Prefs = ThresholdUI.Prefs or {} -- Assets directory -ThresholdUI.AssetsPath = f"{ThresholdUI.AppDir}/assets" +ThresholdUI.AssetsPath = f "{ThresholdUI.AppDir}/assets" -- Enable these GMCP modules ThresholdUI.enableModules = { "Char", "Core", "External" } @@ -58,8 +58,10 @@ function ThresholdUI:SetBarValue(bar, curr, max, text) local curr_value local bar_value, bar_max - if curr < 0 then curr_value = 0 - else curr_value = curr + if curr < 0 then + curr_value = 0 + else + curr_value = curr end bar_value = round(curr_value * 100 / max) @@ -69,9 +71,9 @@ function ThresholdUI:SetBarValue(bar, curr, max, text) bar_value = 0 end if text ~= nil then - bar:setValue(bar_value, bar_max, f"{text}") + bar:setValue(bar_value, bar_max, f "{text}") else - bar:setValue(bar_value, bar_max, f"{curr}/{max}") + bar:setValue(bar_value, bar_max, f "{curr}/{max}") end end diff --git a/src/scripts/scripts.json b/src/scripts/scripts.json index 257ff1d..dbf7f2e 100644 --- a/src/scripts/scripts.json +++ b/src/scripts/scripts.json @@ -1,50 +1,50 @@ [ - { - "isActive": "yes", - "isFolder": "no", - "name": "ThresholdUI", - "script": "" - }, - { - "isActive": "yes", - "isFolder": "no", - "name": "Timers", - "script": "" - }, - { - "isActive": "yes", - "isFolder": "no", - "name": "Event Handlers", - "script": "" - }, - { - "isActive": "yes", - "isFolder": "no", - "name": "Timers", - "script": "" - }, - { - "isActive": "yes", - "isFolder": "no", - "name": "Connection Script", - "script": "" - }, - { - "isActive": "yes", - "isFolder": "no", - "name": "Styles", - "script": "" - }, - { - "isActive": "yes", - "isFolder": "no", - "name": "ThreshTime", - "script": "" - }, - { - "isActive": "yes", - "isFolder": "no", - "name": "Install Uninstall", - "script": "" - } + { + "isActive": "yes", + "isFolder": "no", + "name": "ThresholdUI", + "script": "" + }, + { + "isActive": "yes", + "isFolder": "no", + "name": "Timers", + "script": "" + }, + { + "isActive": "yes", + "isFolder": "no", + "name": "Event Handlers", + "script": "" + }, + { + "isActive": "yes", + "isFolder": "no", + "name": "Timers", + "script": "" + }, + { + "isActive": "yes", + "isFolder": "no", + "name": "Connection Script", + "script": "" + }, + { + "isActive": "yes", + "isFolder": "no", + "name": "Styles", + "script": "" + }, + { + "isActive": "yes", + "isFolder": "no", + "name": "ThreshTime", + "script": "" + }, + { + "isActive": "yes", + "isFolder": "no", + "name": "Install Uninstall", + "script": "" + } ]