diff --git a/.gitignore b/.gitignore index 7d7bd94..14522c8 100644 --- a/.gitignore +++ b/.gitignore @@ -112,6 +112,7 @@ venv.bak/ .dmypy.json dmypy.json -# User-provided local references; keep outside project commits. +# User-provided agent/reference models; keep outside project commits. +agent_models/ model_ravenous_roll20/ /styles/ diff --git a/AGENTS.md b/AGENTS.md index c820a08..01ea943 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -3,13 +3,15 @@ ## Scope and sources Build the base fantasy D10 and cyberpunk Roll20 sheets only. The former base -sheet in Git history is the compatibility reference; `origin/cyberpunk-latest` supplies the -cyberpunk skill catalogue. Check `origin/cyberpunk` when a latest -branch detail is ambiguous. `model_ravenous_roll20/` is an untracked reference -provided by the user: borrow its build discipline, not its game mechanics. -Do not edit, commit, or import that directory as part of this project. It is -ignored by Git so it remains local. Legacy Mod scripts live in `scripts/` and -are not part of the generated sheet. +sheet in Git history is the compatibility reference; `origin/cyberpunk-latest` +supplies the cyberpunk skill catalogue. Check `origin/cyberpunk` when a latest +branch detail is ambiguous. `agent_models/` (including the Ravenous model) is +an untracked reference area provided by the user: borrow its build discipline, +not its game mechanics. Do not edit, commit, or import that directory as part +of this project. It is ignored by Git so it remains local. Roll20 Mod scripts +live in `scripts/`, are installed separately, and are not embedded in the +generated sheet. `d10_character_io.js` is current; `change.js` and `crit.js` +are unvalidated legacy scripts. ## Source of truth @@ -20,6 +22,19 @@ record any deliberate incompatibility. Keep theme changes visual, with no change to rolls or stored attributes. Escape data inserted into HTML and validate YAML and model references before writing output. +`FEATURES.md` is the behavioral and portability contract. `ARCHITECTURE.md` is +the component, data-flow, and reconstruction contract. Update the applicable +feature dossier for every behavior change, including its persistent/runtime +interfaces and acceptance checks. Update the architecture document whenever a +source-of-truth boundary, generated artifact, runtime component, or build flow +changes. README remains the operator guide and must agree with both contracts. + +Keep character JSON exchange versioned and generic over Roll20 attributes so +both variants and repeating rows round-trip. Validate a complete payload before +mutation, retain player/GM permission boundaries, and test Mod behavior in the +local API mock. A sheet button is not proof that its separately installed Mod +command works. + ## Workflow Work through TASKS.md in order and update it as each task finishes. Make a @@ -34,3 +49,6 @@ local worker or calculation test when behavior can be simulated; structural string checks alone do not establish Roll20 correctness. Record any interaction that still requires the Roll20 Custom Sheet Sandbox. Do not claim a live Roll20 test unless it was actually done. + +Before completing a change, verify that `.gitignore` still excludes +`agent_models/` and that no file from that reference tree is staged. diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md new file mode 100644 index 0000000..54e5960 --- /dev/null +++ b/ARCHITECTURE.md @@ -0,0 +1,198 @@ +# D10 Roll20 generator architecture + +This document is the construction map for the repository. Together with +`FEATURES.md`, it should let another agent recreate the generator and its +observable behavior without relying on generated files or undocumented Git +history. + +## 1. System boundary + +The repository produces two Roll20 Custom Sheet bundles: base fantasy D10 and +cyberpunk D10. It also contains optional Roll20 Mod scripts. The sheet runs in +Roll20’s browser/sheet-worker environment; Mod scripts run separately in the +campaign API sandbox and are never embedded into generated HTML. + +Authoritative inputs are the YAML model/catalogues, CSS and worker templates, +binary assets, and generator code. `build/` and `RPG/d10_character_sheet/` are +derived output. `agent_models/` is a local, ignored research area and is not an +input, dependency, or distributable. + +## 2. Repository map + +| Path | Responsibility | +| --- | --- | +| `data/sheet_model.yaml` | Versioned variant structure, stable attributes, resources, repeating sections, and tab composition. | +| `data/base_skills.yaml` | Base fixed-skill catalogue. | +| `data/cyberpunk_skills.yaml` | Cyberpunk fixed-skill catalogue and equipment-category mapping. | +| `data/themes.yaml` | Named theme palettes with display names and five required colors. | +| `templates/sheet.css` | Shared Roll20 CSE layout, component, responsive, and roll-template CSS. | +| `templates/cyberpunk-weapons.js` | Cyberpunk-only repeating weapon sheet-worker behavior. | +| `assets/*.png` | Original cyberpunk body-map images. | +| `tools/build.py` | Validation, HTML/CSS/worker rendering, artifact writing, and stale-output checking. | +| `tools/publish_builds.py` | Canonical two-variant publication tree builder. | +| `scripts/d10_character_io.js` | Optional current Mod feature for versioned character JSON exchange. | +| `scripts/change.js`, `scripts/crit.js` | Unvalidated historical Mod scripts; not generator dependencies. | +| `tests/test_build.py` | Model validation and generated artifact contracts. | +| `tests/test_tabs.mjs` | Sheet-worker navigation and cyberpunk weapon simulation against published output. | +| `tests/test_character_io.mjs` | Roll20 API mock for JSON exchange permissions and round trips. | +| `build.sh` | Local publication entry point, with optional cleanup. | +| `Jenkinsfile` | Clean checkout, verification, archive, and master-only deployment. | + +## 3. Build data flow + +```text +sheet_model.yaml ─┐ +skills YAML ──────┼─> validate() ─> render() ─> sheet.html +themes.yaml ──────┤ ├───────> sheet.css +sheet.css ────────┤ ├───────> translation.json +weapon worker ────┤ ├───────> sheet.json +assets/*.png ─────┘ └───────> build-info.json + copied PNGs +``` + +`build(variant, theme, output, check, asset_base_url)` is the central API. +It selects the requested variant and its skill catalogue, restricts base to +the two base themes, validates all inputs, renders complete strings in memory, +and either writes them or compares them byte-for-byte with an existing target. +Validation happens before output creation. + +`publish_builds.publish()` is the deployment-level API. It recreates each +variant target, builds its default `parchment` entry artifact (which contains a +runtime theme selector), checks it, and copies shared public assets. + +## 4. Model contracts + +The top-level sheet-model version is `1`. Each variant defines: + +- `title` and a `skills` YAML filename; +- `attributes` and `resources`, each with stable `id` and display `name`; +- optional `combat`, `weapons`, and `health_locations`; +- `repeating` sections with stable section IDs and field IDs; +- exactly one navigation strategy: base `skill_tabs` or cyberpunk + `skill_category_tabs`. + +Skill YAML contains `sections`, each with groups. Groups may contain fixed +skills or identify a repeating equipment section. Fixed skill IDs must be +valid Roll20 identifiers and unique within the generated namespace. A child’s +`parent` must refer to an earlier skill in the same group. + +Every theme requires `background`, `panel`, `ink`, `accent`, and `border` as +six-digit hex colors. Names and colors are data; theme mechanics are not. + +Storage names are public compatibility interfaces. An `attr_` name in HTML is +stored without that prefix by Roll20. A `repeating_` fieldset creates names +such as `repeating___`. Changing any of these identifiers +requires an explicit migration plan. + +## 5. Generated sheet composition + +`render()` creates one `.sheet-theme-shell` containing a saved theme state and +one `.sheet-d10` variant root. The visible order is: + +1. header identity, die, theme, and JSON exchange controls; +2. always-visible characteristics; +3. always-visible resources and optional cyberpunk body maps; +4. saved primary navigation; +5. Combat and Skills pages, plus cyberpunk Other; +6. roll templates; +7. one `text/worker` script. + +Fixed skill rows are built from catalogue data. Repeating blocks are built from +the model. Specialized cyberpunk weapon rows share stable fields with ordinary +repeaters but receive action buttons and worker logic. HTML data is escaped at +generation time. + +CSS uses only classes, saved hidden-input sibling selectors, and custom color +properties. Roll template styles share the selected compiled palette. The +responsive breakpoint collapses grids and keeps body maps usable on a narrow +sheet. + +## 6. Roll20 runtime model + +Ordinary roll buttons interpolate Roll20 attributes and use the +`d10skillcheck` template. Navigation and theme controls are `type="action"` +buttons handled by `on("clicked:...")` or change handlers that call `setAttrs`. +Cyberpunk weapon actions use `getAttrs`, `getSectionIDs`, `startRoll`, and +`finishRoll` from the sheet-worker API. + +The local JavaScript harness implements only the subset of that API needed by +the workers. It proves event routing, reads/writes, and computed-result logic; +it does not reproduce Roll20’s dice parser, DOM rendering, persistence timing, +or sandbox permissions. Those remain explicit live-test responsibilities. + +## 7. Character JSON exchange boundary + +The generated header sends `!d10-export` and `!d10-import` commands. It cannot +read or create Roll20 characters itself. `scripts/d10_character_io.js`, when a +GM separately installs it as a Mod script, handles `chat:message`, permission +checks, handout encoding/decoding, validation, and Roll20 object mutation. + +The payload is versioned independently of the sheet model: + +```json +{ + "format": "d10-roll20-character", + "version": 1, + "name": "Character name", + "attributes": [ + {"name": "Life_Points", "current": "7", "max": "10"} + ], + "abilities": [] +} +``` + +The generic attribute list is deliberate: it transports both variants and all +repeating sections without teaching the Mod script the model. Import validation +has bounded counts/text sizes and exact format/version checks. Replace is a +full attribute/ability replacement, while player-level replacement protects +GM-only metadata and ownership. + +## 8. Verification layers + +Use all applicable layers, in order: + +1. Python unit tests validate source models and rendered artifacts across both + variants and every allowed theme. +2. `tools/build.py --check` proves a target exactly matches current sources. +3. `tests/test_tabs.mjs` simulates sheet-worker tab/theme/weapon behavior. +4. `tests/test_character_io.mjs` simulates Mod object access, permissions, and + JSON round trips. +5. Roll20 Custom Sheet Sandbox verifies browser layout, repeating controls, + dice parsing, chat output, saved state, and reopen behavior. +6. A campaign with the Mod script installed verifies real character/handout + permissions and JSON export/restore. + +Never label layers 1–4 as a live Roll20 test. + +## 9. Publication architecture + +`./build.sh` calls the publisher and optionally deletes local generated roots +first. Jenkins repeats the Python tests and publication from a clean checkout. +When Node exists, it runs both JavaScript suites; Python generation remains +publishable on agents without Node. Successful artifacts are archived under +`RPG/d10_character_sheet/`. Only `master` deploys, using `rsync --delete`, to +the matching server path. + +The optional Mod scripts are source-distributed from `scripts/`; they are not +embedded into or automatically installed by the artifact tree. + +## 10. Reconstruction sequence + +To recreate this repository from the contracts: + +1. Create the directory map in section 2 and ignore generated/reference roots. +2. Define sheet-model version 1 with both variant field and repeating-section + IDs before writing presentation code. +3. Populate and validate both skill catalogues and the theme palette file. +4. Implement an in-memory deterministic builder with HTML escaping and check + mode; add invalid-input tests first. +5. Render the shared header, characteristics, resources, tabs, skills, + repeaters, and roll templates; assert every roll reference resolves. +6. Add saved navigation and theme workers, then their JavaScript simulation. +7. Add cyberpunk body maps and weapon worker behavior with formula-level tests. +8. Add the versioned JSON Mod boundary and permission/round-trip tests. +9. Add publication, artifact-tree tests, Jenkins archive/deploy stages, and the + documented live Roll20 checklist. + +At every step, generated files remain disposable and existing stored IDs remain +stable. `FEATURES.md` is the source for observable behavior and porting +acceptance; this file is the source for component ownership and data flow. diff --git a/FEATURES.md b/FEATURES.md new file mode 100644 index 0000000..1dcc243 --- /dev/null +++ b/FEATURES.md @@ -0,0 +1,216 @@ +# Portable feature catalogue + +This file is the behavioral contract for the D10 Roll20 generator. Each +section is intentionally written so it can be handed to an agent working in a +different repository: port the intent and contracts, adapt names and layout to +the destination, and prove the acceptance criteria there. Do not copy D10 game +mechanics into another system unless that system uses the same rules. + +When a feature is added or changed, update its dossier here in the same change. +Record the user-visible behavior, persistent-data contract, source locations, +runtime boundary, and tests. Add a new dossier when none of the existing ones +fits. + +## F01 — Deterministic model-driven sheet generation + +**Intent.** Build complete Roll20 artifacts from reviewed data and templates, +without maintaining generated HTML or CSS by hand. + +**Contract.** `tools/build.py` reads a versioned sheet model, a variant skill +catalogue, theme data, shared CSS, optional worker JavaScript, and binary +assets. It validates identifiers and cross-references before writing UTF-8 +`sheet.html`, `sheet.css`, `translation.json`, `sheet.json`, and +`build-info.json`. Identical inputs produce identical output. `--check` reports +missing or stale output without rewriting it. + +**Porting recipe.** Define explicit source data for every structural choice; +escape all values inserted into HTML; reject duplicate or invalid identifiers; +generate into an ignored directory; include a content digest and useful counts +in build metadata; compare bytes in check mode. + +**Acceptance.** Build twice and compare every byte; mutate one output and prove +check mode fails; feed invalid identifiers, references, and colors and prove the +builder fails before writing output. + +## F02 — Base and cyberpunk variants with stable storage + +**Intent.** Generate two related sheets from one engine while retaining their +different catalogues, layout, and mechanics. + +**Contract.** Variant structure lives under `variants` in +`data/sheet_model.yaml`. Each variant selects its own skill YAML. Stable Roll20 +attribute names and repeating section identifiers are compatibility APIs. Base +has generic combat fields and four skill subtabs; cyberpunk has categorized +skills, localized health/armor, contacts, consumables, and weapon sections. + +**Porting recipe.** Put shared behavior in the renderer and variant differences +in data or narrowly scoped worker modules. Never infer a variant from a label. +Document every renamed stored field as a migration. + +**Acceptance.** Generate and inspect both variants; verify every roll attribute +reference resolves to a declared field (apart from Roll20 built-ins); verify +each repeating section occurs exactly once. + +## F03 — Persistent navigation and visual-only themes + +**Intent.** Let users organize a large sheet and choose its appearance without +altering game state or roll behavior. + +**Contract.** Action buttons update hidden attributes through sheet workers. +CSS sibling selectors show the selected page or subpage. Theme selectors save +`d10_theme_choice`, copy it to `d10_theme`, and switch CSS custom properties. +Base exposes `parchment` and `night`; cyberpunk exposes all validated palettes. +Theme IDs remain stable even if labels change. + +**Porting recipe.** Store navigation/theme state as ordinary attributes; keep +theme values out of roll expressions; compile all allowed palettes into the +same artifact; include fallbacks for retired tab values. + +**Acceptance.** Execute worker click/change handlers in a local Roll20 mock; +compare normalized HTML across themes; prove only CSS/theme defaults vary; test +every variant and palette. + +## F04 — Fixed skills and repeating user content + +**Intent.** Combine a curated skill catalogue with user-created skills, +equipment, contacts, consumables, and weapons. + +**Contract.** Fixed skills are generated from YAML with stable field stems. +User content uses Roll20 `repeating_
` fieldsets. Parent skills may +contribute to child thresholds. Labels are presentation; IDs are storage. + +**Porting recipe.** Version and validate catalogue IDs, generate selectors from +known characteristics, and keep section/field names stable. Test attribute +references rather than only visible labels. + +**Acceptance.** Reject duplicate skill IDs and invalid parents; verify fixed +and repeating fields are unique; manually add, reorder, reopen, and roll a +repeating row in the Roll20 Custom Sheet Sandbox. + +## F05 — Cyberpunk localized health and armor + +**Intent.** Present health, protection, integrity, and integrity maximum by body +location on readable diagrams. + +**Contract.** Location IDs are `head`, `body`, `left_arm`, `right_arm`, +`left_leg`, and `right_leg`. Existing `Life_Points_*`, +`Armor_Protection_Points_*`, and `Armor_Integrity_Points_*` names are retained; +maximum integrity adds `_maximum`. Source PNGs live in `assets/`, are copied to +cyberpunk output, and default to the public HTTPS asset directory. A blank +asset base URL creates a local-preview build. + +**Porting recipe.** Keep image assets independent of stored fields, validate +the URL scheme, include responsive fallback layout, and preserve the semantic +location IDs even if art changes. + +**Acceptance.** Compare copied assets byte-for-byte; verify each location field +appears exactly once; test public and local URLs; inspect both wide and narrow +layouts in Roll20. + +## F06 — Cyberpunk weapon actions + +**Intent.** Support melee, single, burst, and automatic attacks; damage-only +calculation; ammunition checks; and magazine reloads from repeating rows. + +**Contract.** `templates/cyberpunk-weapons.js` owns the worker behavior and is +included only in cyberpunk builds. Attack dice are prompted per action. Combat +dice are d10 with `cs1cf10`. Rmax caps retained successes for melee/single and +manual damage, but not burst/automatic fire. Multi-shot damage emits one value +per successful bullet and never exceeds bullets fired. Reserve stores spare +magazines, not rounds. Reload consumes one reserve magazine. Repeating action +IDs avoid underscores for Roll20 compatibility. + +**Porting recipe.** Keep formulas in one worker module, read a row snapshot +before rolling, mutate ammunition only after validation, and use `startRoll` / +`finishRoll` for computed results. Treat stored field names and action event +names as separate compatibility surfaces. + +**Acceptance.** Simulate every action with empty, partial, and full magazines; +test zero/some/excess successes, natural 1 bonuses, Rmax, and reload; then run +the same flows in the Custom Sheet Sandbox because a mock does not parse dice. + +## F07 — Versioned character JSON exchange + +**Intent.** Back up, transfer, and restore complete D10 Roll20 characters, +including repeating rows, without changing the sheet’s storage model. + +**User experience.** Both sheet variants show **Échanges JSON** in the header. +**Exporter** creates a handout containing readable JSON. **Restaurer** asks for +a handout ID and replaces the current character in place, preserving its +Roll20 ID and linked tokens. + +**Boundary.** The sheet buttons only send chat commands. The separately +installed Roll20 Mod script `scripts/d10_character_io.js` performs privileged +object access. The feature is unavailable when that script is not installed. + +**Wire format.** The top-level discriminator is +`{"format":"d10-roll20-character","version":1}`. Required values are a +non-empty `name` and an `attributes` array. Each attribute has string `name`, +`current`, and `max`. Optional data includes `abilities`, `bio`, `gmnotes`, +`controlledby`, and `inplayerjournals`. Unknown future versions are rejected. +All attributes are transported generically, so fixed fields and repeating rows +round-trip without a D10-specific mapping. + +**Commands.** `!d10-export` uses one selected linked token; +`!d10-export --id CHARACTER_ID` is used by the sheet. A GM may create a new +character with `!d10-import JSON` or `!d10-import --handout HANDOUT_ID`. +`!d10-import --replace [--id CHARACTER_ID] --handout HANDOUT_ID` restores into +an existing controlled character. Handout input is preferred for large JSON. + +**Security and mutation rules.** GMs may access all targets. Players may export +or replace only characters they control and may read only shared/controlled +handouts. Player exports omit GM notes; player restores cannot change GM notes, +ownership, or journal visibility. New-character creation is GM-only. Payload +shape, version, sizes, and scalar types are validated before mutation. Replace +deletes existing attributes and abilities, then recreates them; it is +destructive and should use a fresh export as a backup. + +**Porting recipe.** Choose a repository-specific format and command prefix; +keep the payload versioned; export generic Roll20 attributes; validate fully; +separate create from replace permissions; decode Roll20 HTML/URI handout +representations; add sheet buttons only after the Mod command is stable. + +**Acceptance.** In a Roll20 API mock, round-trip current/max values, repeating +attributes, abilities, bio, notes, and access lists; test GM creation, player +replacement, HTML-escaped handouts, malformed/version-mismatched data, and +unauthorized character/handout access. In Roll20, export each variant, restore +it, reopen the character, inspect repeating rows, and retest rolls. + +## F08 — Reproducible publication + +**Intent.** Publish one self-contained artifact set per variant from the same +verified generator used locally. + +**Contract.** `tools/publish_builds.py` creates +`RPG/d10_character_sheet/{base,cyberpunk}` plus shared body assets. Jenkins +starts from a clean checkout, installs Python dependencies, runs Python tests, +runs JavaScript checks when Node is available, archives the tree, and deploys +`master` to `/mnt/books/RPG/d10_character_sheet/`. + +**Porting recipe.** Make local and CI publication call the same code; rebuild +targets instead of merging stale files; archive only generated deliverables; +gate deployment on branch and successful verification. + +**Acceptance.** Assert the complete artifact tree and absence of retired +directories; run builder check mode against published variants; verify deploy +sentinels after synchronization. + +## Feature dossier template + +Copy this block when introducing a portable behavior: + +```markdown +## FXX — Name + +**Intent.** User problem and outcome. + +**Contract.** Observable behavior and persistent/runtime interfaces. + +**Boundary.** Which component owns privileged or external behavior. + +**Porting recipe.** Minimal implementation sequence without game-specific assumptions. + +**Acceptance.** Automated behavior checks plus any required live Roll20 checks. + +**Migration.** Stored names or behavior that existing characters must preserve. +``` diff --git a/Jenkinsfile b/Jenkinsfile index 7e31614..a8aff5a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,8 +30,9 @@ pipeline { sh ''' if command -v node >/dev/null 2>&1; then D10_BUILD_ROOT=RPG/d10_character_sheet node tests/test_tabs.mjs + node tests/test_character_io.mjs else - echo 'Node.js is unavailable on this agent; skipping the JavaScript tab check.' + echo 'Node.js is unavailable on this agent; skipping the JavaScript checks.' fi ''' } diff --git a/README.md b/README.md index ef46549..dcf2abe 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,12 @@ Les compétences fixes sont dans `data/base_skills.yaml` et commun dans `templates/sheet.css`. `tools/build.py` produit les fichiers à charger dans Roll20. -Le dossier `model_ravenous_roll20/` est une référence locale fournie par +Le dossier `agent_models/` est une zone de références locales fournie par l'utilisateur; il est ignoré par Git et n'entre pas dans la génération D10. -Les deux scripts Mod historiques sont conservés dans [`scripts/`](scripts/). +[`FEATURES.md`](FEATURES.md) décrit les comportements sous forme de dossiers +portables et [`ARCHITECTURE.md`](ARCHITECTURE.md) décrit les composants, les +flux et l'ordre de reconstruction. Les scripts Mod sont conservés dans +[`scripts/`](scripts/) et s'installent séparément de la feuille. ## Construire @@ -130,10 +133,39 @@ et peuvent être référencés avec une valeur vide : Une autre adresse HTTPS publique peut être fournie avec `--asset-base-url`. Charger le HTML généré dans l'éditeur Roll20 avec le CSS et la traduction. +## Échanges JSON de personnages + +Les deux variantes affichent **Échanges JSON** dans l'en-tête. Cette interface +requiert l'installation séparée de `scripts/d10_character_io.js` dans les Mod +Scripts de la campagne Roll20. **Exporter** crée un handout contenant le format +versionné `d10-roll20-character` version 1. **Restaurer** demande l'identifiant +de ce handout et remplace les attributs et capacités du personnage courant sans +changer son identifiant Roll20 ni ses tokens liés. + +L'export conserve les valeurs actuelles/maximales, les lignes répétables, les +capacités, la bio et les métadonnées auxquelles l'utilisateur a accès. Un joueur +ne peut exporter ou restaurer qu'un personnage qu'il contrôle; ses exports +n'incluent pas les notes MJ et sa restauration ne peut pas changer les notes +MJ, les contrôleurs ou la visibilité du journal. Seul un MJ peut créer un +nouveau personnage : + +```text +!d10-export +!d10-export --id CHARACTER_ID +!d10-import --handout HANDOUT_ID +!d10-import --replace --id CHARACTER_ID --handout HANDOUT_ID +``` + +La restauration supprime d'abord les attributs et capacités existants de la +cible. Conserver un export récent avant de l'utiliser. Les handouts privés +d'export MJ contiennent les notes MJ et doivent rester privés. Le contrat +complet et ses critères de portage sont dans la fonctionnalité F07 de +[`FEATURES.md`](FEATURES.md). + ## Publication Jenkins -L'agent Jenkins doit disposer de Python 3 avec `venv`. Le test JavaScript des -onglets s'exécute si Node.js est présent; son absence ne bloque pas la +L'agent Jenkins doit disposer de Python 3 avec `venv`. Les tests JavaScript des +onglets et des échanges JSON s'exécutent si Node.js est présent; son absence ne bloque pas la publication. Le `Jenkinsfile` exécute les tests Python, construit une feuille par variante et archive les résultats sous `RPG/d10_character_sheet/`. Le dossier `RPG/d10_character_sheet/assets/` contient les deux PNG originaux. Les @@ -144,6 +176,7 @@ supprimés lors de la publication. La commande locale équivalente est : ```sh .venv/bin/python tools/publish_builds.py D10_BUILD_ROOT=RPG/d10_character_sheet node tests/test_tabs.mjs +node tests/test_character_io.mjs ``` Jenkins archive ces fichiers comme artifacts du job, puis déploie les builds de @@ -160,12 +193,14 @@ Les builds Jenkins utilisent désormais directement l'URL publique du dossier .venv/bin/python tools/build.py --variant base --theme parchment --output-dir RPG/d10_character_sheet/base --check .venv/bin/python tools/build.py --variant cyberpunk --theme parchment --output-dir RPG/d10_character_sheet/cyberpunk --check D10_BUILD_ROOT=RPG/d10_character_sheet node tests/test_tabs.mjs +node tests/test_character_io.mjs ``` -Le test Node utilise les builds publiés `base` et `cyberpunk`; +Le test des onglets utilise les builds publiés `base` et `cyberpunk`; exécuter `./build.sh` avant de le lancer. `--check` compare les fichiers existants aux sources sans les réécrire. Les tests vérifient la -génération, les références d'attribut et les actions des onglets, mais ne +génération, les références d'attribut, les actions des onglets et les échanges +JSON dans une simulation de l'API Mod, mais ne simulent pas l'affichage, le parseur de dés ou la sauvegarde de Roll20. Le Custom Sheet Sandbox doit encore servir à valider les interactions et la persistance des valeurs; les points précis sont dans [`TASKS.md`](TASKS.md). @@ -182,7 +217,8 @@ sous un autre nom ne migrent pas automatiquement. La feuille historique utilisait aussi les macros `!crit` et des calculs de combat complexes. Le nouveau build utilise un seuil moins un dé et un roll -template; il n'appelle pas ces macros. Les scripts historiques sous -`scripts/` restent disponibles séparément, sans validation avec la nouvelle -feuille. Les fonctionnalités avancées non modélisées ne doivent pas être -supposées compatibles. +template; il n'appelle pas ces macros. Le script +`scripts/d10_character_io.js` est testé séparément pour les échanges JSON. Les +scripts historiques `change.js` et `crit.js` restent disponibles sans +validation avec la nouvelle feuille. Les fonctionnalités avancées non +modélisées ne doivent pas être supposées compatibles. diff --git a/TASKS.md b/TASKS.md index 87edf81..ff2725e 100644 --- a/TASKS.md +++ b/TASKS.md @@ -46,9 +46,11 @@ - [x] Let burst and automatic fire consume a partially filled magazine instead of rejecting the attack. - [x] Cap burst and automatic damage instances to the number of bullets actually fired. - [x] Raise the Torse control on both cyberpunk body maps for better silhouette alignment. +- [x] Add versioned character JSON export/restore through a separately installed Mod script; document portable features and reconstruction architecture. ## Live Roll20 checks after local verification - [ ] Load each generated variant in Custom Sheet Sandbox; inspect tabs and repeating rows. - [ ] Roll characteristic, skill, and combat buttons and compare results to the base rules. - [ ] Edit and reopen a character to verify stored values remain attached to their fields. +- [ ] With `d10_character_io.js` installed, export and restore each variant; reopen it and verify metadata, abilities, fixed attributes, and repeating rows. diff --git a/scripts/README.md b/scripts/README.md index 39dae1e..0fe43dc 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,4 +1,22 @@ -# Legacy Roll20 Mod scripts +# Roll20 Mod scripts + +`d10_character_io.js` est le script courant d'échange JSON de personnages. Il +doit être installé séparément dans les Mod Scripts de la campagne. Les boutons +**Échanges JSON** de la feuille envoient ses commandes `!d10-export` et +`!d10-import`. Le format, les permissions et les procédures sont documentés +dans la fonctionnalité F07 de [`../FEATURES.md`](../FEATURES.md) et dans le +README racine. + +Vérification locale : + +```sh +node tests/test_character_io.mjs +``` + +Cette simulation ne remplace pas un essai dans une campagne Roll20 avec le +script installé. + +## Scripts historiques `crit.js` and `change.js` are retained from the original project. They are separate Roll20 Mod scripts and are not loaded by the generated character diff --git a/scripts/d10_character_io.js b/scripts/d10_character_io.js new file mode 100644 index 0000000..dd13755 --- /dev/null +++ b/scripts/d10_character_io.js @@ -0,0 +1,211 @@ +/* D10 character exchange for Roll20 Mod. Commands: + * !d10-export (selected token's character) + * !d10-export --id CHARACTER_ID + * !d10-import {"format":"d10-roll20-character",...} + * !d10-import --handout HANDOUT_ID + * !d10-import --replace [--id CHARACTER_ID] --handout HANDOUT_ID + * Players may export and replace characters they control. New-character import is GM-only. + */ +(function () { + 'use strict'; + var FORMAT = 'd10-roll20-character'; + var VERSION = 1; + + function whisper(playerId, message) { + if (playerIsGM(playerId)) return sendChat('D10 IO', '/w gm ' + message); + var player = getObj('player', playerId); + var name = String(player && player.get('_displayname') || 'player').replace(/"/g, ''); + sendChat('D10 IO', '/w "' + name + '" ' + message); + } + function grantsAccess(list, playerId) { + return String(list || '').split(',').some(function (id) { return id === 'all' || id === playerId; }); + } + function canControl(character, playerId) { + return playerIsGM(playerId) || grantsAccess(character && character.get('controlledby'), playerId); + } + function canReadHandout(handout, playerId) { + return playerIsGM(playerId) || grantsAccess(handout && handout.get('controlledby'), playerId) || + grantsAccess(handout && handout.get('inplayerjournals'), playerId); + } + function validText(value) { return typeof value === 'string' && value.length <= 200000; } + function validPayload(data) { + if (!data || Array.isArray(data) || typeof data !== 'object' || + data.format !== FORMAT || data.version !== VERSION || + typeof data.name !== 'string' || !data.name.trim() || data.name.length > 100 || + !Array.isArray(data.attributes) || data.attributes.length > 5000 || + (data.abilities !== undefined && (!Array.isArray(data.abilities) || data.abilities.length > 1000)) || + !validText(data.bio || '') || !validText(data.gmnotes || '') || + !validText(data.controlledby || '') || !validText(data.inplayerjournals || '')) return false; + return data.attributes.every(function (item) { + return item && !Array.isArray(item) && typeof item === 'object' && + typeof item.name === 'string' && item.name.trim() && item.name.length <= 150 && + validText(item.current) && validText(item.max); + }) && (data.abilities || []).every(function (item) { + return item && typeof item.name === 'string' && item.name.length <= 150 && + validText(item.action) && typeof item.istokenaction === 'boolean'; + }); + } + function decodeHandout(raw) { + var text = String(raw || '').trim(); + if (/^(?:%7B|%3C)/i.test(text)) { + try { text = decodeURIComponent(text); } + catch (error) { /* Continue with the original Notes value. */ } + } + text = text.replace(//gi, '\n').replace(/<\/(?:p|div)>/gi, '\n') + .replace(/<[^>]*>/g, '').replace(/"/g, '"').replace(/'/g, "'") + .replace(/</g, '<').replace(/>/g, '>') + .replace(/&#(?:x([0-9a-f]+)|([0-9]+));/gi, function (_, hex, decimal) { + return String.fromCodePoint(parseInt(hex || decimal, hex ? 16 : 10)); + }).replace(/&/g, '&').replace(/ /g, ' ').trim(); + return JSON.parse(text); + } + function readHandout(handout, isGM, callback) { + if (!isGM) return handout.get('notes', callback); + handout.get('gmnotes', function (gmnotes) { + if (String(gmnotes || '').trim()) return callback(gmnotes); + handout.get('notes', callback); + }); + } + function populateCharacter(character, data, replace, isGM, playerId) { + if (replace) { + findObjs({ type: 'attribute', characterid: character.id }).forEach(function (item) { item.remove(); }); + findObjs({ type: 'ability', characterid: character.id }).forEach(function (item) { item.remove(); }); + } + character.set('name', data.name.trim()); + character.set('bio', data.bio || ''); + if (isGM) { + character.set('gmnotes', data.gmnotes || ''); + character.set('controlledby', data.controlledby || ''); + character.set('inplayerjournals', data.inplayerjournals || ''); + } + data.attributes.forEach(function (item) { + createObj('attribute', { characterid: character.id, name: item.name, + current: item.current, max: item.max }); + }); + (data.abilities || []).forEach(function (item) { + createObj('ability', { characterid: character.id, name: item.name, + action: item.action, istokenaction: item.istokenaction }); + }); + whisper(playerId, (replace ? 'Replaced ' : 'Imported ') + data.attributes.length + + ' attributes in character ' + character.id + '.'); + } + function importCharacter(data, playerId, targetId) { + if (!validPayload(data)) return whisper(playerId, 'Invalid or unsupported D10 character JSON.'); + if (targetId) { + var target = getObj('character', targetId); + if (!target) return whisper(playerId, 'Character not found.'); + if (!canControl(target, playerId)) return whisper(playerId, 'Permission denied for that character.'); + return populateCharacter(target, data, true, playerIsGM(playerId), playerId); + } + if (!playerIsGM(playerId)) return whisper(playerId, + 'Only a GM can create a new character. Use --replace on a character you control.'); + var character = createObj('character', { name: data.name.trim(), + controlledby: data.controlledby || '', inplayerjournals: data.inplayerjournals || '' }); + if (!character) return whisper(playerId, 'Roll20 could not create the character.'); + populateCharacter(character, data, false, true, playerId); + } + function exportCharacter(id, playerId) { + var character = getObj('character', id); + if (!character) return whisper(playerId, 'Character not found. Use its Roll20 character ID.'); + if (!canControl(character, playerId)) return whisper(playerId, 'Permission denied for that character.'); + var isGM = playerIsGM(playerId); + character.get('bio', function (bio) { + character.get('gmnotes', function (gmnotes) { + var attributes = findObjs({ type: 'attribute', characterid: id }).map(function (item) { + var current = item.get('current'); + var max = item.get('max'); + return { name: item.get('name'), current: current == null ? '' : String(current), + max: max == null ? '' : String(max) }; + }).sort(function (a, b) { return a.name.localeCompare(b.name); }); + var abilities = findObjs({ type: 'ability', characterid: id }).map(function (item) { + return { name: item.get('name'), action: item.get('action') || '', + istokenaction: item.get('istokenaction') === true || item.get('istokenaction') === 'true' }; + }); + var data = { format: FORMAT, version: VERSION, name: character.get('name'), + controlledby: character.get('controlledby') || '', + inplayerjournals: character.get('inplayerjournals') || '', bio: bio || '', + gmnotes: isGM ? gmnotes || '' : '', attributes: attributes, abilities: abilities }; + var handout = createObj('handout', { name: 'D10 export - ' + data.name, + inplayerjournals: isGM ? '' : playerId, controlledby: isGM ? '' : playerId }); + if (!handout) return whisper(playerId, 'Roll20 could not create the export handout.'); + var readable = JSON.stringify(data, null, 2).replace(/&/g, '&') + .replace(//g, '>'); + handout.set(isGM ? 'gmnotes' : 'notes', '
' + readable + '
'); + whisper(playerId, 'Exported ' + attributes.length + ' attributes to handout ' + handout.id + '.'); + }); + }); + } + function selectedCharacterId(message) { + var selected = message.selected || []; + if (selected.length !== 1 || selected[0]._type !== 'graphic') { + whisper(message.playerid, 'Select one token representing a character, or use --id CHARACTER_ID.'); + return ''; + } + var token = getObj('graphic', selected[0]._id); + var id = token && token.get('represents'); + if (!id) whisper(message.playerid, 'The selected token does not represent a character.'); + return id || ''; + } + function importArguments(input) { + var result = { replace: false, id: '', handout: '', json: '' }; + var rest = input.trim(); + while (rest.indexOf('--') === 0) { + var flag = rest.match(/^--replace(?:\s+|$)/); + if (flag) { + if (result.replace) return null; + result.replace = true; + rest = rest.slice(flag[0].length); + continue; + } + var option = rest.match(/^--(id|handout)\s+(\S+)\s*/); + if (!option || result[option[1]]) return null; + result[option[1]] = option[2]; + rest = rest.slice(option[0].length); + } + result.json = rest; + if (!!result.handout === !!result.json || (!result.replace && result.id)) return null; + return result; + } + on('chat:message', function (message) { + if (message.type !== 'api') return; + var content = message.content.trim(); + if (content === '!d10-export') { + var selectedId = selectedCharacterId(message); + if (selectedId) return exportCharacter(selectedId, message.playerid); + return; + } + if (content.indexOf('!d10-export ') === 0) { + var argument = content.slice('!d10-export '.length).trim(); + if (argument.indexOf('--id ') === 0) argument = argument.slice('--id '.length).trim(); + return exportCharacter(argument, message.playerid); + } + if (content.indexOf('!d10-import ') !== 0) return; + var args = importArguments(content.slice('!d10-import '.length)); + if (!args) return whisper(message.playerid, 'Invalid import command.'); + if (!playerIsGM(message.playerid) && !args.replace) + return whisper(message.playerid, 'Only a GM can create a new character. Use --replace.'); + var targetId = ''; + if (args.replace) { + targetId = args.id || selectedCharacterId(message); + if (!targetId) return; + if (!canControl(getObj('character', targetId), message.playerid)) + return whisper(message.playerid, 'Permission denied for that character.'); + } + if (args.handout) { + var handout = getObj('handout', args.handout); + if (!handout) return whisper(message.playerid, 'Handout not found.'); + if (!canReadHandout(handout, message.playerid)) + return whisper(message.playerid, 'Permission denied for that handout.'); + return readHandout(handout, playerIsGM(message.playerid), function (notes) { + var data; + try { data = decodeHandout(notes); } + catch (error) { return whisper(message.playerid, 'Handout does not contain valid D10 JSON.'); } + try { importCharacter(data, message.playerid, targetId); } + catch (error) { whisper(message.playerid, + 'Character replacement failed: ' + String(error && error.message || error)); } + }); + } + try { importCharacter(JSON.parse(args.json), message.playerid, targetId); } + catch (error) { whisper(message.playerid, 'Invalid JSON.'); } + }); +}()); diff --git a/templates/sheet.css b/templates/sheet.css index a8432f4..2e70ecb 100644 --- a/templates/sheet.css +++ b/templates/sheet.css @@ -17,6 +17,12 @@ .sheet-d10 .sheet-identity { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .sheet-d10 .sheet-identity label, .sheet-d10 .sheet-die-choice { display: grid; gap: 3px; margin: 0 !important; color: var(--d10-accent); font: bold 10px Arial,sans-serif; letter-spacing: .07em; text-transform: uppercase; } .sheet-d10 .sheet-theme-choice { display: grid; gap: 3px; margin: 0 !important; color: var(--d10-accent); font: bold 10px Arial,sans-serif; letter-spacing: .07em; text-transform: uppercase; } +.sheet-d10 .sheet-hero-tools { display: grid; gap: 7px; align-self: stretch; } +.sheet-d10 .sheet-character-io-menu { position: relative; margin: 0; } +.sheet-d10 .sheet-character-io-menu summary { padding: 6px; font: bold 10px Arial,sans-serif; letter-spacing: .04em; text-align: center; text-transform: uppercase; } +.sheet-d10 .sheet-character-io-actions { position: absolute; z-index: 20; right: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; width: 210px; padding: 7px; background: var(--d10-panel); border: 1px solid var(--d10-border); box-shadow: 0 4px 10px rgba(0,0,0,.2); } +.sheet-d10 .sheet-character-io-actions button[type=roll] { margin: 0 !important; padding: 5px; color: var(--d10-panel); background: var(--d10-accent); border: 1px solid var(--d10-accent); border-radius: 2px; box-shadow: none; font: bold 10px Arial,sans-serif; text-shadow: none; } +.sheet-d10 .sheet-character-io-actions button[type=roll]::before { content: none !important; display: none !important; } .sheet-d10 .sheet-die-choice { align-self: end; } .sheet-d10 .sheet-tab-nav { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; margin: 14px 0 0; border-bottom: 2px solid var(--d10-accent); } .sheet-d10.sheet-variant-base .sheet-tab-nav { grid-template-columns: repeat(2,minmax(0,1fr)); } @@ -142,6 +148,7 @@ .sheet-d10 .sheet-hero-mark { width: 42px; height: 42px; font-size: 14px; } .sheet-d10 .sheet-die-choice { grid-column: 2; } .sheet-d10 .sheet-theme-choice { grid-column: 2; } + .sheet-d10 .sheet-hero-tools { grid-column: 2; } .sheet-d10 .sheet-tab-nav button[type=action] { min-height: 36px; padding: 5px 2px; font-size: 10px; } .sheet-d10 .sheet-skill-tab-nav { grid-template-columns: repeat(2,minmax(0,1fr)); } .sheet-d10 .sheet-weapon-repeater { grid-template-columns: repeat(2,minmax(0,1fr)); } diff --git a/tests/test_build.py b/tests/test_build.py index 1feb754..d8404bd 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -116,8 +116,11 @@ class BuildTests(unittest.TestCase): markup = build.build(variant, 'parchment', Path(tmp))['sheet.html'] declared = set(re.findall(r'name="attr_([A-Za-z0-9_-]+)"', markup)) referenced = set(re.findall(r'@\{([A-Za-z0-9_-]+)\}', markup)) - self.assertFalse(referenced - declared, referenced - declared) + self.assertFalse(referenced - declared - {'character_id'}, referenced - declared) self.assertEqual(len(declared), len(set(declared))) + self.assertIn('Échanges JSON', markup) + self.assertIn('value="!d10-export --id @{character_id}"', markup) + self.assertIn('value="!d10-import --replace --id @{character_id} --handout ?{ID du handout personnage}"', markup) self.assertIn('base-Force', declared) self.assertIn('Life_Points', declared) if variant == 'cyberpunk': diff --git a/tests/test_character_io.mjs b/tests/test_character_io.mjs new file mode 100644 index 0000000..7f342a3 --- /dev/null +++ b/tests/test_character_io.mjs @@ -0,0 +1,130 @@ +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { test } from 'node:test'; +import vm from 'node:vm'; + +const script = readFileSync(new URL('../scripts/d10_character_io.js', import.meta.url), 'utf8'); + +function session() { + const objects = new Map(); + const chat = []; + let nextId = 0; + let handler; + const createObj = (type, fields) => { + const data = { ...fields }; + const object = { + id: `id${++nextId}`, + type, + get(key, callback) { + const value = data[key] ?? ''; + if (callback) callback(value); + else return value; + }, + set(key, value) { data[key] = value; }, + remove() { objects.delete(object.id); }, + }; + objects.set(object.id, object); + return object; + }; + vm.runInNewContext(script, { + on(event, callback) { assert.equal(event, 'chat:message'); handler = callback; }, + playerIsGM: id => id === 'gm', + createObj, + getObj: (type, id) => objects.get(id)?.type === type ? objects.get(id) : undefined, + findObjs: query => [...objects.values()].filter(object => object.type === query.type && + object.get('characterid') === query.characterid), + sendChat: (speaker, content) => chat.push({ speaker, content }), + encodeURIComponent, + decodeURIComponent, + }); + const send = (content, playerid = 'gm', selected = []) => + handler({ type: 'api', playerid, content, selected }); + return { createObj, objects, chat, send }; +} + +const objectsOf = (game, type) => [...game.objects.values()].filter(object => object.type === type); + +test('GM export and import preserve repeating attributes, notes, access, and abilities', () => { + const game = session(); + const original = game.createObj('character', { name: 'Ariane', bio: 'Bio é', + gmnotes: 'Secret', controlledby: 'player1', inplayerjournals: 'player1' }); + game.createObj('attribute', { characterid: original.id, name: 'base-Force', current: '4', max: '' }); + game.createObj('attribute', { characterid: original.id, + name: 'repeating_distance_row1_name', current: 'Pistolet', max: '' }); + game.createObj('attribute', { characterid: original.id, name: 'Life_Points', current: '7', max: '10' }); + game.createObj('ability', { characterid: original.id, name: 'Action', action: '/em agit', istokenaction: true }); + + game.send(`!d10-export --id ${original.id}`); + const handout = objectsOf(game, 'handout')[0]; + assert.ok(handout); + assert.match(handout.get('gmnotes'), /"format": "d10-roll20-character"/); + game.send(`!d10-import --handout ${handout.id}`); + + const imported = objectsOf(game, 'character')[1]; + assert.equal(imported.get('name'), 'Ariane'); + assert.equal(imported.get('bio'), 'Bio é'); + assert.equal(imported.get('gmnotes'), 'Secret'); + assert.equal(imported.get('controlledby'), 'player1'); + assert.deepEqual(objectsOf(game, 'attribute').filter(item => item.get('characterid') === imported.id) + .map(item => [item.get('name'), item.get('current'), item.get('max')]), [ + ['base-Force', '4', ''], ['Life_Points', '7', '10'], + ['repeating_distance_row1_name', 'Pistolet', ''], + ]); + assert.equal(objectsOf(game, 'ability').find(item => item.get('characterid') === imported.id) + .get('action'), '/em agit'); +}); + +test('player export and replace preserve character identity and protected metadata', () => { + const game = session(); + const player = game.createObj('player', { _displayname: 'Alice' }); + const character = game.createObj('character', { name: 'Avant', bio: 'Avant', gmnotes: 'MJ', + controlledby: player.id, inplayerjournals: player.id }); + const token = game.createObj('graphic', { represents: character.id }); + game.createObj('attribute', { characterid: character.id, name: 'obsolete', current: 'oui', max: '' }); + + game.send('!d10-export', player.id, [{ _type: 'graphic', _id: token.id }]); + const handout = objectsOf(game, 'handout')[0]; + assert.equal(handout.get('controlledby'), player.id); + assert.match(handout.get('notes'), /"gmnotes": ""/); + const replacement = { format: 'd10-roll20-character', version: 1, name: 'Après', + bio: 'Après', gmnotes: 'Tentative', controlledby: 'intrus', inplayerjournals: 'intrus', + attributes: [{ name: 'base-Force', current: '9', max: '' }], abilities: [] }; + handout.set('notes', encodeURIComponent(`
${JSON.stringify(replacement)}
`)); + game.send(`!d10-import --replace --handout ${handout.id}`, player.id, + [{ _type: 'graphic', _id: token.id }]); + + assert.equal(character.get('name'), 'Après'); + assert.equal(character.get('gmnotes'), 'MJ'); + assert.equal(character.get('controlledby'), player.id); + assert.equal(token.get('represents'), character.id); + assert.deepEqual(objectsOf(game, 'attribute').map(item => item.get('name')), ['base-Force']); +}); + +test('permissions and strict version validation reject unsafe imports', () => { + const game = session(); + const player = game.createObj('player', { _displayname: 'Alice' }); + const other = game.createObj('character', { name: 'Autre', controlledby: 'someone-else' }); + const token = game.createObj('graphic', { represents: other.id }); + const valid = { format: 'd10-roll20-character', version: 1, name: 'Nouveau', attributes: [] }; + const privateHandout = game.createObj('handout', { controlledby: 'someone-else', notes: JSON.stringify(valid) }); + + game.send(`!d10-import ${JSON.stringify(valid)}`, player.id); + game.send(`!d10-import --replace --handout ${privateHandout.id}`, player.id, + [{ _type: 'graphic', _id: token.id }]); + game.send('!d10-import {"format":"wrong","version":1,"name":"Bad","attributes":[]}'); + assert.equal(objectsOf(game, 'character').length, 1); + assert.equal(other.get('name'), 'Autre'); + assert.match(game.chat.at(-2).content, /Permission denied/); + assert.match(game.chat.at(-1).content, /Invalid or unsupported/); +}); + +test('GM handout import decodes Roll20 HTML escaping', () => { + const game = session(); + const payload = { format: 'd10-roll20-character', version: 1, + name: 'A & B', bio: 'Test', attributes: [] }; + const escaped = JSON.stringify(payload).replace(/&/g, '&').replace(//g, '>'); + const handout = game.createObj('handout', { gmnotes: `

${escaped}

` }); + game.send(`!d10-import --handout ${handout.id}`); + assert.equal(objectsOf(game, 'character')[0].get('name'), 'A & B'); + assert.equal(objectsOf(game, 'character')[0].get('bio'), 'Test'); +}); diff --git a/tools/build.py b/tools/build.py index 2aec10d..3374e63 100644 --- a/tools/build.py +++ b/tools/build.py @@ -292,9 +292,16 @@ def render(model, skills, variant, theme_name, theme, themes, asset_base_url='') f'' for n in (4, 6, 8, 10, 12, 20)) + '', ]) - parts.append('') + parts.append('
Échanges JSON' + '
' + '' + '' + '
') parts.extend(['', '
01

Caractéristiques

', '
'])