Record Roll20 smoke tests and improve character export
Roll20 Sheet Build Failed The Ravenous Roll20 sheet build or deployment failed.
Ravenous/ravenous_roll20/pipeline/head There was a failure building this commit Details

This commit is contained in:
Dandaedre 2026-09-17 20:23:15 +02:00
parent 2c50e1b98e
commit 2583c84755
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
6 changed files with 56 additions and 11 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ __pycache__/
*.pyc
build/
build-*/
/character.json

View File

@ -123,12 +123,15 @@ la bio, les notes MJ et les droits de consultation/contrôle sont conservés.
Dans le chat, en tant que MJ :
```text
!ravenous-export ID_DU_PERSONNAGE
!ravenous-export
!ravenous-export --id ID_DU_PERSONNAGE
!ravenous-import --handout ID_DU_HANDOUT
!ravenous-import {"format":"ravenous-roll20-character","version":1,"name":"Ariane","attributes":[]}
```
L'export crée un handout réservé au MJ, dont les **GM Notes** contiennent le JSON
Sans ID, sélectionnez exactement un token lié au personnage avant la commande.
Utilisez `--id` si vous ne disposez pas d'un token lié. L'export crée un handout
réservé au MJ, dont les **GM Notes** contiennent le JSON
lisible. Copiez ce JSON dans un fichier pour le stocker hors de Roll20. Pour
importer un fichier volumineux, créez un handout, collez le JSON dans ses GM
Notes, puis utilisez `--handout` avec son ID. La commande directe convient aux

View File

@ -25,16 +25,25 @@ parser, browser, or chat.
## Next: Roll20 smoke test
- [ ] Install `roll20_mod/ravenous_import_name.js` as a New Script in a test
- [x] Install `roll20_mod/ravenous_import_name.js` as a New Script in a test
game, run `!ravenous-import-name {"name":"Ariane"}` as GM, and confirm a
single new character appears in the journal. Record the date and result.
- [ ] Install `roll20_mod/ravenous_character_io.js` in a test game. Export an
single new character appears in the journal. **2026-09-17:** user reports
that the test worked in Roll20.
- [x] Install `roll20_mod/ravenous_character_io.js` in a test game. Export an
edited sheet, save its JSON outside Roll20, import it from a GM handout, and
compare notes, abilities, attributes, and repeating rows. Import one converted
monster and check each mapped row and any worker recalculations.
monster and check each mapped row and any worker recalculations. **2026-09-17:**
user reports this workflow completed successfully in Roll20; `character.json`
is the local saved export in the repository root and is excluded from Git.
- [ ] Load `build/ravenous.html`, `build/ravenous.css`, and
`build/translation.json` into a Custom Sheet Sandbox with Legacy Sanitization
disabled. Record the date, browser, and any console or worker errors.
**2026-09-17 attempt:** user supplied a Firefox console log (browser inferred
from Firefox-specific messages). It shows `Starting up WEB WORKER`, CSP
warnings for inline scripts/event handlers, Sentry CDN CORS/integrity errors,
and `Uncaught SyntaxError: missing ] after element list` in `vtt.bundle`.
The log does not confirm the Legacy Sanitization setting or whether the sheet
itself loaded and its workers ran; the syntax error needs a reproduction.
- [ ] Load one alternate theme (for example `build-steel/`) and inspect the
sheet and chat cards for legibility and contrast in Roll20.
- [ ] Create an attacker and defender, plus a token representing the defender.

View File

@ -1,5 +1,6 @@
/* Ravenous character exchange for Roll20 Mod. GM commands:
* !ravenous-export CHARACTER_ID
* !ravenous-export (selected token's character)
* !ravenous-export --id CHARACTER_ID
* !ravenous-import {"format":"ravenous-roll20-character",...}
* !ravenous-import --handout HANDOUT_ID
* Exports are stored in a GM-only handout. Each import creates a new character.
@ -87,11 +88,29 @@
});
});
}
function selectedCharacterId(message) {
var selected = message.selected || [];
if (selected.length !== 1 || selected[0]._type !== 'graphic') {
whisper('Select one token representing a character, or use !ravenous-export --id CHARACTER_ID.');
return '';
}
var token = getObj('graphic', selected[0]._id);
var id = token && token.get('represents');
if (!id) whisper('The selected token does not represent a character.');
return id || '';
}
on('chat:message', function (message) {
if (message.type !== 'api' || !playerIsGM(message.playerid)) return;
var content = message.content.trim();
if (content === '!ravenous-export') {
var selectedId = selectedCharacterId(message);
if (selectedId) return exportCharacter(selectedId);
return;
}
if (content.indexOf('!ravenous-export ') === 0) {
return exportCharacter(content.slice('!ravenous-export '.length).trim());
var argument = content.slice('!ravenous-export '.length).trim();
if (argument.indexOf('--id ') === 0) argument = argument.slice('--id '.length).trim();
return exportCharacter(argument);
}
if (content.indexOf('!ravenous-import ') !== 0) return;
var input = content.slice('!ravenous-import '.length).trim();

View File

@ -35,7 +35,7 @@
.stat span { padding:0 4px 3px; color:var(--muted); font-size:8px; text-align:center; text-transform:uppercase; letter-spacing:.05em; }
.stat input { height:32px; margin:0; padding:4px; font-size:18px; line-height:24px; }
.stat input:nth-of-type(2) { background:var(--accent); }
.ravenous-sheet .stat input.stat-total { width:100%; margin:0; color:var(--blood); background:#fff; font:italic bold 18px/24px Georgia,serif; text-align:center; }
.ravenous-sheet .stat input.stat-total { width:100%; margin:0; color:var(--blood); font:italic bold 18px/24px Georgia,serif; text-align:center; }
.legend { text-align:right; color:var(--muted); font-size:10px; }
.dashboard { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:14px; }
.resource { display:grid; grid-template-columns:minmax(0,1fr) 30px minmax(0,1fr) minmax(0,.8fr); grid-template-rows:54px; gap:4px; align-items:end; min-width:0; padding:4px 8px; background:var(--accent); border-left:3px solid var(--gold); }

View File

@ -33,7 +33,7 @@ function session() {
encodeURIComponent,
decodeURIComponent,
});
const send = (content, playerid = 'gm') => handler({ type: 'api', playerid, content });
const send = (content, playerid = 'gm', selected = []) => handler({ type: 'api', playerid, content, selected });
return { createObj, objects, chat, send };
}
@ -45,7 +45,7 @@ test('export handout and import preserve notes and repeating attributes', () =>
game.createObj('attribute', { characterid: original.id, name: 'repeating_attacks_row1_name', current: 'Griffe', max: '' });
game.createObj('attribute', { characterid: original.id, name: 'hp', current: '0', max: '20' });
game.createObj('ability', { characterid: original.id, name: 'Roar', action: '/em Roars', istokenaction: true });
game.send(`!ravenous-export ${original.id}`);
game.send(`!ravenous-export --id ${original.id}`);
const handout = [...game.objects.values()].find(obj => obj.type === 'handout');
assert.ok(handout);
assert.equal(handout.get('inplayerjournals'), '');
@ -66,6 +66,19 @@ test('export handout and import preserve notes and repeating attributes', () =>
assert.equal(ability.get('action'), '/em Roars');
});
test('export uses the selected token by default and requires one linked token', () => {
const game = session();
const character = game.createObj('character', { name: 'Ariane' });
const linked = game.createObj('graphic', { represents: character.id });
const unlinked = game.createObj('graphic', { represents: '' });
game.send('!ravenous-export');
game.send('!ravenous-export', 'gm', [{ _type: 'graphic', _id: unlinked.id }]);
game.send('!ravenous-export', 'gm', [{ _type: 'graphic', _id: linked.id }, { _type: 'graphic', _id: unlinked.id }]);
assert.equal([...game.objects.values()].filter(obj => obj.type === 'handout').length, 0);
game.send('!ravenous-export', 'gm', [{ _type: 'graphic', _id: linked.id }]);
assert.equal([...game.objects.values()].filter(obj => obj.type === 'handout').length, 1);
});
test('inline JSON imports a character, while non-GM and invalid input do not', () => {
const game = session();
const json = JSON.stringify({ format: 'ravenous-roll20-character', version: 1,