feat(CombatEncounterDirector): Migrate primary command to !ced with legacy support#2255
Open
steverobertsuk wants to merge 20 commits into
Open
feat(CombatEncounterDirector): Migrate primary command to !ced with legacy support#2255steverobertsuk wants to merge 20 commits into
!ced with legacy support#2255steverobertsuk wants to merge 20 commits into
Conversation
Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
…erelease history To ensure the Rollup build configuration always uses the latest version after a bump, the configuration is now loaded lazily and bypasses the ESM cache. Additionally, prerelease versions are excluded from the `previousversions` history, keeping it focused on stable releases. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
The primary chat command has been changed from `!director` to `!ced` to avoid conflicts with other Roll20 mods also using `!director`. Backward compatibility is provided for the `!director` command. If another script using `!director` is detected, a GM whisper warns to use `!ced`. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
…and Russian translations Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit updates the `VALID_LAYERS` constant to use a `Set` instead of an array. Using a `Set` provides more efficient lookup performance for checking layer validity. Changes include: - `CombatEncounterDirector/src/constants.js`: Defines `VALID_LAYERS` as a `Set`. - `CombatEncounterDirector/src/battlefield.js`: Updates `moveSelectedToLayer` to use `VALID_LAYERS.has()` instead of `VALID_LAYERS.includes()` for checking layer membership, aligning with the `Set` data structure. Also removes the direct import of `LAYER_MAP` as it is only accessed via the `VALID_LAYERS` Set in this file. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit extracts the HP application logic from `applyBossPresetToToken` into a new, dedicated function `applyBossHp`. This improves readability, modularity, and makes the HP modification logic reusable and easier to test. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit updates string manipulation from `String.prototype.replace(/X/g, Y)` to the more direct `String.prototype.replaceAll(X, Y)` where appropriate. This improves readability and consistency across string operations. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit updates several integer parsing functions to explicitly use `Number.parseInt()` instead of the global `parseInt()`. This provides better clarity and is considered a best practice for numerical conversions in modern JavaScript. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit refines the state initialisation logic within `ensureState` to improve robustness and readability. It ensures that merge operations only occur on existing, valid state records. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit refactors the `handleScale` command logic by extracting individual sub-command handlers into dedicated functions. It uses a handler map to route commands, improving modularity, readability, and maintainability. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit refactors the `handleReinforce` command logic by extracting individual sub-command handlers into dedicated functions. It uses a handler map to route commands, improving modularity, readability, and maintainability. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit introduces a new `handleLegacyInput` function to manage older or alternative command formats. It registers this handler to process chat messages alongside the primary `handleInput`. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit extracts token property restoration logic during encounter loading into dedicated helper functions. This improves the readability and maintainability of the `loadEncounter` function. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit updates the `listEncounterNames` function to use `String.prototype.localeCompare()` for sorting. This provides more linguistically correct sorting of encounter names compared to a simple ASCII sort. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit includes a collection of minor cleanup and optimisation changes: - Remove unused imports to reduce bundle size. - Use nullish coalescing operator for clearer defaults. - Add robustness for edge cases in scaling. - Improve regex matching efficiency. - Enhance timezone formatting. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit refactors the rendering of various sections within the Command Deck journal. It standardises button rendering using array mapping and adds JSDoc for improved code clarity. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit introduces a new visual style for the Command Deck and Status Report journals. It adds a `wrapJournalContent` function to encapsulate content in a themed card container. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
This commit cleans up and reorders JSDoc comments for `handleJournal` and adds new JSDoc for `handleDeck` in `commands.js`. This improves documentation consistency and clarity. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
The version bump script now only appends the current stable version to the `previousversions` array if it differs from the new version being set. This avoids adding redundant entries when the version is explicitly set to the current stable version or when the script is run multiple times for the same stable version without an actual change. Prerelease versions continue to be excluded from history. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
The primary chat command has been changed from `!director` to `!ced` to prevent conflicts with other community scripts. Backward compatibility for `!director` is maintained, with an automatic warning to the GM if a conflict is detected. This release also includes several code quality enhancements, improved UI consistency for journal rendering, and better internationalisation handling. Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
!ced with legacy support!ced with legacy support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The primary command for the Combat Encounter Director has been migrated from
!directorto!cedto prevent conflicts with other Roll20 API scripts. To ensure a smooth transition, this update includes backward compatibility: macros using!directorwill still function as expected unless a conflict with another "Director" mod is detected. In such cases, Game Masters will receive a clear warning instructing them to update their macros to use!ced.Added
!director, providing a graceful transition for existing macros.Changed
!cedto avoid collisions with the "Director" community mod.!ced.Fixed
!directorcommand would clash with the "Director" community mod; now, a warning is whispered to the GM if a conflict is detected.encounterNotFoundHintin Finnish and Russian translations.Refactoring & Technical Improvements
Number.parseInt) and consistent string manipulation (String.prototype.replaceAll).VALID_LAYERSto use aSet.localeComparefor improved internationalisation consistency.Signed-off-by: Steve Roberts steve@shadowcomputers.co.uk