Skip to content

feat(CombatEncounterDirector): Migrate primary command to !ced with legacy support#2255

Open
steverobertsuk wants to merge 20 commits into
Roll20:masterfrom
steverobertsuk:sr/combatencounterdirector-v1-1
Open

feat(CombatEncounterDirector): Migrate primary command to !ced with legacy support#2255
steverobertsuk wants to merge 20 commits into
Roll20:masterfrom
steverobertsuk:sr/combatencounterdirector-v1-1

Conversation

@steverobertsuk

Copy link
Copy Markdown
Contributor

The primary command for the Combat Encounter Director has been migrated from !director to !ced to prevent conflicts with other Roll20 API scripts. To ensure a smooth transition, this update includes backward compatibility: macros using !director will 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

  • Implements legacy command compatibility for !director, providing a graceful transition for existing macros.

Changed

  • The primary chat command is now !ced to avoid collisions with the "Director" community mod.
  • Localised help messages and command examples now consistently reference !ced.
  • Command Deck and Status journals now render with a consistent dark theme, improving visual coherence.
  • The One-Click language configuration has been updated to a user-friendly select list, offering all supported locale options directly.

Fixed

  • Addresses a conflict where the !director command would clash with the "Director" community mod; now, a warning is whispered to the GM if a conflict is detected.
  • Corrects formatting for encounterNotFoundHint in Finnish and Russian translations.

Refactoring & Technical Improvements

  • Enhances script robustness through more explicit type parsing (Number.parseInt) and consistent string manipulation (String.prototype.replaceAll).
  • Improves state initialisation logic for greater reliability.
  • Optimises layer validation by migrating VALID_LAYERS to use a Set.
  • Increases code maintainability and clarity by extracting helper functions for boss HP application and encounter token restoration.
  • Standardises encounter name sorting using localeCompare for improved internationalisation consistency.

Signed-off-by: Steve Roberts steve@shadowcomputers.co.uk

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>
@steverobertsuk steverobertsuk changed the title feat(commands): Migrate primary command to !ced with legacy support feat(CombatEncounterDirector): Migrate primary command to !ced with legacy support Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant