fix: expose player character restore controls
Roll20 Sheet Build Successful The Ravenous Roll20 sheet was generated and validated successfully.
Ravenous/ravenous_roll20/pipeline/head This commit looks good
Details
Roll20 Sheet Build Successful The Ravenous Roll20 sheet was generated and validated successfully.
Ravenous/ravenous_roll20/pipeline/head This commit looks good
Details
This commit is contained in:
parent
af91983bc7
commit
01735d679a
|
|
@ -143,6 +143,10 @@ Pour un joueur, sélectionnez un token lié à son personnage :
|
|||
!ravenous-import --replace --handout ID_DU_HANDOUT
|
||||
```
|
||||
|
||||
Les boutons **Exporter** et **Restaurer** dans l'en-tête de la feuille envoient
|
||||
ces mêmes commandes avec l'ID du personnage courant ; ils ne nécessitent donc
|
||||
pas de token sélectionné. **Restaurer** demande l'ID du handout source.
|
||||
|
||||
L'export joueur crée un handout contrôlé par ce joueur et place le JSON dans ses
|
||||
**Notes** visibles. Le remplacement conserve l'objet personnage, son ID, ses
|
||||
tokens liés, son avatar, ses droits et ses notes MJ ; il remplace son nom, sa bio,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,11 @@
|
|||
});
|
||||
}
|
||||
function decodeHandout(raw) {
|
||||
var text = String(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(/<br\s*\/?\s*>/gi, '\n').replace(/<\/(?:p|div)>/gi, '\n')
|
||||
.replace(/<[^>]*>/g, '').replace(/"/g, '"').replace(/'/g, "'")
|
||||
.replace(/</g, '<').replace(/>/g, '>')
|
||||
|
|
@ -194,8 +198,11 @@
|
|||
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) {
|
||||
try { importCharacter(decodeHandout(notes), message.playerid, targetId); }
|
||||
catch (error) { whisper(message.playerid, 'Handout does not contain valid Ravenous JSON.'); }
|
||||
var data;
|
||||
try { data = decodeHandout(notes); }
|
||||
catch (error) { return whisper(message.playerid, 'Handout does not contain valid Ravenous 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); }
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
.identity-grid { display:grid; grid-template-columns:2fr 2fr 1.5fr 1fr; gap:8px; margin-top:6px; }
|
||||
.identity-grid label,.ravenous-sheet label { color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.05em; }
|
||||
.motto { color:var(--dark-gold); font-style:italic; text-align:center; }
|
||||
.character-io-actions { display:flex; gap:5px; justify-content:center; }
|
||||
.ravenous-sheet .character-io-actions button[type=roll] { width:auto; margin:0; padding:4px 7px; color:var(--light); border:1px solid var(--dark-gold); border-radius:2px; background:var(--blood); font:700 9px "Cinzel",Georgia,serif; box-shadow:none; }
|
||||
.ravenous-sheet .character-io-actions button[type=roll]::before { content:""; margin:0; }
|
||||
.secret-rolls { display:flex; justify-content:center; align-items:center; gap:6px; margin-top:7px; color:var(--blood)!important; font-style:normal; }
|
||||
.secret-rolls input { margin:0; }
|
||||
.tabs { display:flex; margin:14px 0; border-bottom:2px solid var(--gold); }
|
||||
|
|
|
|||
|
|
@ -14,7 +14,13 @@
|
|||
<label>Stade<input type="number" name="attr_stage" value="1" min="0"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="motto"><label class="secret-rolls">Jets secrets<input type="checkbox" name="attr_secret_rolls" value="1"></label></div>
|
||||
<div class="motto">
|
||||
<div class="character-io-actions">
|
||||
<button type="roll" name="roll_export_character" value="!ravenous-export --id @{character_id}">Exporter</button>
|
||||
<button type="roll" name="roll_replace_character" value="!ravenous-import --replace --id @{character_id} --handout ?{ID du handout personnage}">Restaurer</button>
|
||||
</div>
|
||||
<label class="secret-rolls">Jets secrets<input type="checkbox" name="attr_secret_rolls" value="1"></label>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<nav class="tabs" aria-label="Sections de la feuille">
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ class BuildTests(unittest.TestCase):
|
|||
self.assertIn('<script type="text/worker">', sheet)
|
||||
for section in ("customskills", "attacks", "protections", "locations", "consumables", "modifiers", "techniques", "powers"):
|
||||
self.assertIn(f'class="repeating_{section}"', sheet)
|
||||
self.assertIn('value="!ravenous-export --id @{character_id}"', sheet)
|
||||
self.assertIn('value="!ravenous-import --replace --id @{character_id} --handout ?{ID du handout personnage}"', sheet)
|
||||
|
||||
def test_origins_and_powers_are_imported(self):
|
||||
from tools.build import read_glossary_labels, read_origins
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ test('a player can export and replace a controlled character in place', () => {
|
|||
bio: 'Nouvelle bio', gmnotes: 'Tentative joueur', controlledby: 'intrus', inplayerjournals: 'intrus',
|
||||
attributes: [{ name: 'force', current: '9', max: '' }],
|
||||
abilities: [{ name: 'Nouvelle', action: '/em nouveau', istokenaction: true }] };
|
||||
exported.set('notes', `<pre>${JSON.stringify(replacement)}</pre>`);
|
||||
exported.set('notes', encodeURIComponent(`<pre>${JSON.stringify(replacement)}</pre>`));
|
||||
game.send(`!ravenous-import --replace --handout ${exported.id}`, 'player',
|
||||
[{ _type: 'graphic', _id: token.id }]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue