Compare commits
18 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
868fa87edb | |
|
|
b0edc9c58a | |
|
|
6516c98335 | |
|
|
df97d0e56f | |
|
|
742e0938c8 | |
|
|
f53fe21faf | |
|
|
5eae4f0914 | |
|
|
d291508726 | |
|
|
a7c3dc77e3 | |
|
|
d5bd131422 | |
|
|
16d43aef12 | |
|
|
8c3fac5cea | |
|
|
2840646473 | |
|
|
9f298f8298 | |
|
|
97bbea1bef | |
|
|
ee51947439 | |
|
|
d386201c40 | |
|
|
ed4498884b |
|
|
@ -10,7 +10,6 @@ __pycache__/
|
|||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
/RPG/d10_character_sheet/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
|
|
@ -111,8 +110,8 @@ venv.bak/
|
|||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# User-provided agent/reference models; keep outside project commits.
|
||||
agent_models/
|
||||
model_ravenous_roll20/
|
||||
/styles/
|
||||
.idea/vcs.xml
|
||||
.idea/sys_d10.iml
|
||||
.idea/modules.xml
|
||||
.idea/misc.xml
|
||||
.idea/inspectionProfiles/profiles_settings.xml
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "minitest"]
|
||||
path = helpers/minitest
|
||||
url = git@github.com:Malphaet/minitest.git
|
||||
54
AGENTS.md
54
AGENTS.md
|
|
@ -1,54 +0,0 @@
|
|||
# D10 Roll20 sheet agent guide
|
||||
|
||||
## 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. `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
|
||||
|
||||
Keep skills in YAML and sheet structure in explicit model data. HTML/CSS/JSON
|
||||
under build/ are generated and must not be hand edited. Preserve existing
|
||||
Roll20 attribute names and repeating section identifiers when feasible;
|
||||
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
|
||||
focused commit after each completed stage. Each commit must leave the generator
|
||||
and its applicable tests passing. Document commands, output files, variant
|
||||
behavior, and migration caveats in README.md. Consult old source in Git history
|
||||
only when necessary for compatibility.
|
||||
|
||||
For each behavior change, test the generated artifact, including attribute
|
||||
references and roll expressions. Check both variants and every theme. Use a
|
||||
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.
|
||||
198
ARCHITECTURE.md
198
ARCHITECTURE.md
|
|
@ -1,198 +0,0 @@
|
|||
# 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_<id>` fieldset creates names
|
||||
such as `repeating_<id>_<row-id>_<field>`. 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.
|
||||
216
FEATURES.md
216
FEATURES.md
|
|
@ -1,216 +0,0 @@
|
|||
# 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_<section>` 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.
|
||||
```
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
options {
|
||||
skipDefaultCheckout(true)
|
||||
timestamps()
|
||||
}
|
||||
|
||||
environment {
|
||||
DEPLOY_DIR = '/mnt/books/RPG/d10_character_sheet'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
deleteDir()
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
stage('Dependencies') {
|
||||
steps {
|
||||
sh 'python3 -m venv .venv'
|
||||
sh '.venv/bin/python -m pip install -r requirements.txt'
|
||||
}
|
||||
}
|
||||
stage('Build and verify') {
|
||||
steps {
|
||||
sh '.venv/bin/python -m unittest discover -s tests -v'
|
||||
sh '.venv/bin/python tools/publish_builds.py'
|
||||
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 checks.'
|
||||
fi
|
||||
'''
|
||||
}
|
||||
}
|
||||
stage('Publish') {
|
||||
steps {
|
||||
archiveArtifacts artifacts: 'RPG/d10_character_sheet/**', fingerprint: true, onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
when {
|
||||
branch 'master'
|
||||
}
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
mkdir -p "$DEPLOY_DIR"
|
||||
rsync -a --delete RPG/d10_character_sheet/ "$DEPLOY_DIR/"
|
||||
test -f "$DEPLOY_DIR/assets/robotman_health_r.png"
|
||||
test -f "$DEPLOY_DIR/assets/robotman_armor_r.png"
|
||||
test -f "$DEPLOY_DIR/cyberpunk/sheet.html"
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
247
README.md
247
README.md
|
|
@ -1,224 +1,33 @@
|
|||
# Système D10 — feuilles Roll20
|
||||
## Introduction
|
||||
Vous trouverez ici la feuille de personnage type pour le système D10. Cette feuille a été crée pour fonctionner avec Roll20.
|
||||
|
||||
Ce dépôt génère deux feuilles de personnage Roll20 : **base** et **cyberpunk**.
|
||||
Les compétences fixes sont dans `data/base_skills.yaml` et
|
||||
`data/cyberpunk_skills.yaml`. Les champs et variantes sont dans
|
||||
`data/sheet_model.yaml`, les couleurs dans `data/themes.yaml`, et le style
|
||||
commun dans `templates/sheet.css`. `tools/build.py` produit les fichiers à
|
||||
charger dans Roll20.
|
||||
## Macros roll20
|
||||
Peuvent etre utile a modifier ou récuperer:
|
||||
- ```Life_Points / Life_Points_maximum``` : Points de Vie
|
||||
- ```Endurance_Points / Endurance_Points_maximum``` : Points de fatigue
|
||||
- ```general_item_weapon1``` : La valeur de dégats de l'arme 1
|
||||
- ```general_item_weapon1_name``` : Le nom de l'arme 1
|
||||
- ```general_effective_weapon1``` : La valeur de dégats de l'arme 1 si elle est activée; 0 sinon
|
||||
- ```base_damage_dices``` : La base de dégats offensif (a priori, rien sauf compétence particulière)
|
||||
- ```exal_damage_dices``` : Le modificateur de dégats (Un bonus de charge, un buff de dégats temporaires)
|
||||
|
||||
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.
|
||||
[`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.
|
||||
Exemple (avec chatSetAttr) [chatSetAttr](https://github.com/Roll20/roll20-api-scripts/blob/master/ChatSetAttr/README.md):
|
||||
- ```!setattr --sel --Life_Points|21```
|
||||
- ```!setattr --set --mod --Life_Points|-5```
|
||||
- ```!setattr --name Basil --general_item_weapon1|55```
|
||||
|
||||
## Construire
|
||||
## HTML
|
||||
- Ne pas utiliser d'ID, seulement des classes. Il y a en effet
|
||||
plusieurs copies de la feuille lors d'une partie, l'utilisation d'ID
|
||||
pourra par conséquent entraîner des comportements inattendus.
|
||||
|
||||
```sh
|
||||
python -m venv .venv
|
||||
.venv/bin/python -m pip install -r requirements.txt
|
||||
./build.sh
|
||||
./build.sh --clean
|
||||
```
|
||||
## CSS
|
||||
- La feuille complète est contenue dans une grande div
|
||||
```.charsheet```, pour éviter d'appliquer le CSS au reste de roll20.
|
||||
Le CSS sera modifié en conséquence lors de l'import.
|
||||
- Lors de
|
||||
l'import, toutes les classes qui ne sont pas préfixées de
|
||||
```shield```, ```roll_``` ou ```repeating_``` seront préfixées de
|
||||
```sheet-```. Il faut donc prévoir le CSS en conséquence.
|
||||
|
||||
`build.sh` génère les deux variantes avec leurs sélecteurs de thème sous
|
||||
`RPG/d10_character_sheet/`. Avec `--clean`, il supprime d'abord ce dossier
|
||||
ainsi que `build/`, puis reconstruit les fichiers publiables. Il utilise
|
||||
`.venv/bin/python` si disponible, sinon `python3` avec les dépendances déjà
|
||||
installées. Pour générer un thème isolé ou lister les thèmes :
|
||||
|
||||
```sh
|
||||
.venv/bin/python tools/build.py --variant base --theme parchment
|
||||
.venv/bin/python tools/build.py --variant cyberpunk --theme night
|
||||
.venv/bin/python tools/build.py --list-themes
|
||||
```
|
||||
|
||||
Chaque build crée `sheet.html`, `sheet.css`, `translation.json`, `sheet.json`
|
||||
et `build-info.json` dans `build/<variante>/<thème>/`. Le build cyberpunk copie
|
||||
aussi les deux images originales de `assets/`. Il est possible de
|
||||
choisir un autre répertoire avec `--output-dir`. Charger le HTML, le CSS et
|
||||
la traduction dans les onglets correspondants de l'éditeur de feuille
|
||||
personnalisée Roll20. `sheet.json` est un manifeste; `build-info.json` contient
|
||||
la variante, le thème, le nombre de compétences et une empreinte du résultat.
|
||||
|
||||
Les sections **01 Caractéristiques** et **02 Ressources** restent visibles.
|
||||
La variante base a deux onglets principaux, **Compétences** et **Combat**.
|
||||
Dans Compétences, quatre sous-onglets séparent **Combat et combat libre**,
|
||||
**Compétences libres**, **Magie** et **Équipement**. Les lignes répétables
|
||||
gardent leurs noms d'attributs et de section. La variante cyberpunk conserve
|
||||
les onglets **Compétences**, **Combat** et **Autres**. Ses sous-onglets issus du
|
||||
catalogue YAML sont **Physique**, **Intellectuelles** et **Social**.
|
||||
Les compétences libres et les contacts répétables restent dans **Autres**.
|
||||
Les contacts ont un nom et un niveau, sans caractéristique associée. Leur
|
||||
bouton **Show** affiche ces informations dans le chat sans lancer de dé.
|
||||
Les consommables d'**Arsenal** ont aussi un bouton **Show** qui affiche leur
|
||||
nom, leur quantité et leurs notes sans lancer de dé ni modifier la quantité.
|
||||
L'onglet **Combat** cyberpunk contient seulement l'initiative et son jet;
|
||||
les attaques et dégâts des armes sont gérés dans **Arsenal**, sous **Combat**.
|
||||
Les personnages qui avaient sélectionné l'ancien onglet de compétences
|
||||
**Arsenal** voient **Physique** lors du prochain affichage des compétences.
|
||||
La variante base
|
||||
conserve ses champs de combat génériques et ses armes équipées.
|
||||
Le choix principal est stocké dans `d10_tab`, celui des sous-onglets base dans
|
||||
`d10_skill_tab` et celui des catégories cyberpunk dans `d10_category_tab`.
|
||||
Les personnages qui avaient enregistré `core` ou, pour la variante base,
|
||||
`other` affichent **Compétences** jusqu'au prochain clic. L'en-tête reste visible.
|
||||
**Arsenal** contient **Distance**, **Mêlée** et **Consommable**. Les armes restent
|
||||
dans les sections répétables `distance` et `melee`. Le sélecteur de thème dans l'en-tête des deux variantes conserve
|
||||
le choix dans `d10_theme_choice` et applique immédiatement la palette via
|
||||
`d10_theme`. La variante base propose **Parchemin** et **Nuit** uniquement.
|
||||
Les 18 palettes du dossier local `styles/themes/` ont été
|
||||
adaptées aux cinq couleurs de la feuille et copiées dans `data/themes.yaml`;
|
||||
le build ne dépend pas de ce dossier. `parchment` et `night` restent disponibles
|
||||
sous les noms **Parchemin** et **Nuit** dans le sélecteur cyberpunk.
|
||||
`--theme` choisit le thème initial; tous les thèmes modifient seulement les
|
||||
couleurs et la visibilité de la silhouette, sans modifier les champs ni les jets.
|
||||
|
||||
Chaque arme cyberpunk a un seuil de base, une précision et une spécialité de
|
||||
combat facultative. Le nombre de dés est demandé à chaque attaque dans une
|
||||
fenêtre Roll20, avec 1 par défaut. Les jets de combat utilisent des d10 avec
|
||||
`cs1cf10`; les autres jets utilisent le dé sélectionné avec `cs1cfX`, où X
|
||||
est le nombre de faces. L'attaque compte les dés inférieurs ou
|
||||
égaux à `seuil de base + compétence + précision`. Pour un tir simple ou une
|
||||
attaque de mêlée, les dégâts valent `dégâts de base + (réussites retenues − 1)
|
||||
× dégâts / réussite`, ou zéro sans réussite. **Rmax** limite les réussites
|
||||
retenues; `0` signifie sans limite et préserve les anciennes fiches. Pour une
|
||||
rafale ou un tir automatique, la carte affiche séparément les dégâts de chaque
|
||||
tir réussi (`X, X, X`) sans les additionner. Chaque tir inflige les dégâts de
|
||||
base; un dé naturel de 1 inflige `dégâts de base + dégâts / réussite` pour ce
|
||||
tir (`X + bonus, X, X`). Le nombre d'instances de dégâts ne peut jamais dépasser
|
||||
le nombre de balles tirées, même lorsque Rmax vaut 0. Rmax ne s'applique pas à ces modes. Une rafale ajoute
|
||||
un dé. Les tirs vérifient le coût en munitions du mode choisi et retirent
|
||||
ces munitions du chargeur après le jet. Une rafale ou un tir automatique peut
|
||||
être déclenché avec moins de munitions que son coût normal; il vide alors le
|
||||
chargeur. Un chargeur vide bloque toujours le tir. La réserve compte les **chargeurs de
|
||||
rechange**, et non les balles. Recharger consomme un chargeur de réserve et
|
||||
remplit le chargeur actuel à sa capacité; les balles qui restaient dans
|
||||
l'ancien chargeur sont perdues. Les personnages existants dont la réserve
|
||||
comptait des balles doivent corriger cette valeur. Le bouton
|
||||
**Dégâts** applique la formule du tir simple avec Rmax aux réussites saisies
|
||||
manuellement, sans dépenser de
|
||||
munitions. Les champs historiques `name`, `damage` et `notes` de ces deux
|
||||
sections sont conservés; les nouvelles valeurs doivent être renseignées sur
|
||||
les personnages existants. Les anciennes sections historiques
|
||||
`ranged-weapons` et `melee-weapons` ne migrent pas automatiquement.
|
||||
|
||||
Les boutons de Distance utilisent chacun un événement nommé. Les identifiants
|
||||
d'action répétables n'utilisent plus de tiret bas
|
||||
(`firesingle`, `fireburst`, `fireauto` et `damage`); ce sont des identifiants de
|
||||
boutons, pas des attributs sauvegardés, donc ce changement ne déplace aucune
|
||||
donnée de personnage.
|
||||
|
||||
Dans la variante cyberpunk, 02 affiche aussi deux cartes côte à côte :
|
||||
**Santé** (PV de la tête, du torse et des membres) et **Armure** (protection,
|
||||
intégrité et intégrité maximale aux mêmes localisations). Les cases sont
|
||||
posées sur les images originales `robotman_health_r.png` et
|
||||
`robotman_armor_r.png`. Les attributs de localisation existants gardent leurs
|
||||
noms; les nouveaux maxima portent le suffixe `_maximum`. Sur un écran étroit,
|
||||
les cartes se placent l'une sous l'autre. Les champs numériques masquent les
|
||||
flèches de réglage des navigateurs Firefox et Chromium.
|
||||
|
||||
Par défaut, le HTML cyberpunk référence directement les deux PNG publiés dans
|
||||
[`RPG/d10_character_sheet/assets/`](https://books.dandaedre.com/RPG/d10_character_sheet/assets/).
|
||||
Pour un aperçu local sans réseau, les PNG restent copiés à côté de `sheet.html`
|
||||
et peuvent être référencés avec une valeur vide :
|
||||
|
||||
```sh
|
||||
.venv/bin/python tools/build.py --variant cyberpunk --theme parchment \
|
||||
--asset-base-url ''
|
||||
```
|
||||
|
||||
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`. 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
|
||||
fichiers HTML, CSS et JSON de chaque build sont dans
|
||||
`RPG/d10_character_sheet/<variante>/`. Les anciens dossiers par thème sont
|
||||
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
|
||||
`master` vers `/mnt/books/RPG/d10_character_sheet/` avec `rsync`, selon le même
|
||||
principe que le pipeline Ravenous. Les autres branches ne sont pas déployées.
|
||||
Les builds Jenkins utilisent désormais directement l'URL publique du dossier
|
||||
`assets/` pour les images de la feuille cyberpunk.
|
||||
|
||||
## Vérifier
|
||||
|
||||
```sh
|
||||
.venv/bin/python -m unittest discover -s tests -v
|
||||
./build.sh
|
||||
.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 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, 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).
|
||||
|
||||
## Sources et compatibilité
|
||||
|
||||
Le modèle de base reprend les attributs principaux de l'ancienne feuille
|
||||
`feuille_sysd10.html`; les compétences cyberpunk viennent de la branche
|
||||
`origin/cyberpunk-latest`, vérifiée contre `origin/cyberpunk`. Les anciennes
|
||||
sources sont conservées dans l'historique Git, pas dans la génération.
|
||||
Les noms des caractéristiques, ressources et de plusieurs champs de combat
|
||||
ont été gardés quand cela était possible. Les sections répétables reconstruites
|
||||
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. 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.
|
||||
##### Ces informations proviennent de la doc Roll20, et plus particulièrement de la page [Building Character Sheet](https://wiki.roll20.net/Building_Character_Sheets).
|
||||
|
|
|
|||
56
TASKS.md
56
TASKS.md
|
|
@ -1,56 +0,0 @@
|
|||
# D10 sheet work
|
||||
|
||||
- [x] Inventory base, cyberpunk, and Ravenous model; set scope and agent rules.
|
||||
- [x] Define variant models, skill YAML, and stable identifiers; document source mapping.
|
||||
- [x] Build a deterministic generator for Roll20 HTML, CSS, translation.json, and sheet.json.
|
||||
- [x] Add parchment and night themes without altering rolls or stored fields.
|
||||
- [x] Test validation, generated fields, references, and both variant builds.
|
||||
- [x] Document build, use, variant differences, migration limits, and Roll20 sandbox checks.
|
||||
- [x] Replace stacked characteristic and skill controls with compact themed grids; verify both variants and themes.
|
||||
- [x] Split the generated sheet into Personnage, Compétences, Combat, and Autres tabs; verify action handlers and builds.
|
||||
- [x] Remove unused legacy sheet sources and minitest, retain Mod scripts in scripts/, and keep the Ravenous model local.
|
||||
- [x] Keep 01 Caractéristiques and 02 Ressources visible above the three remaining tabs; preserve the old core tab value.
|
||||
- [x] Present cyberpunk health and armour locations on side-by-side body maps without changing field names.
|
||||
- [x] Divide base skills into fight/free fight, free skills, magic, and equipment subtabs; keep cyberpunk navigation and stored fields.
|
||||
- [x] Restore original cyberpunk health and armor figures, add integrity maximum per location, and hide number spinners.
|
||||
- [x] Restore readable labels in night-theme repeating rows after Roll20 restructures their fieldsets.
|
||||
- [x] Add cyberpunk skill category subtabs for the full catalogue, preserving fixed skills and repeating fields.
|
||||
- [x] Map all supplied corporation palettes into the D10 theme model and add a saved cyberpunk theme selector.
|
||||
- [x] Add Jenkins artifact publication under RPG/d10_character_sheet/ for both variants, all themes, and the original body images.
|
||||
- [x] Allow Jenkins agents without Node.js to publish after the Python checks; keep the JavaScript tab check when Node.js is available.
|
||||
- [x] Mirror Ravenous Jenkins publication by deploying successful master artifacts to /mnt/books/RPG/d10_character_sheet/.
|
||||
- [x] Link the published body images in generated cyberpunk HTML by default, with a local preview override.
|
||||
- [x] Improve roll result contrast and spacing in the chat template across light and dark themes.
|
||||
- [x] Restore cyberpunk Arsenal subtabs and add functional ranged and melee weapon attacks, damage, ammunition checks, and reloads.
|
||||
- [x] Reduce cyberpunk Combat to initiative and its roll; keep generic combat fields and equipped weapons in base only.
|
||||
- [x] Remove the characteristic selector from cyberpunk contacts and replace their dice roll with a Show chat card.
|
||||
- [x] Rename the parchment and night theme labels in the cyberpunk selector without changing saved theme IDs.
|
||||
- [x] Prompt for the cyberpunk weapon dice count on each attack instead of storing a fixed value on the weapon.
|
||||
- [x] Count cyberpunk ammo reserve as spare magazines and consume one per reload.
|
||||
- [x] Add a Show chat card for cyberpunk consumables without changing their quantity.
|
||||
- [x] Add a root build script for all publishable variants with an optional clean rebuild.
|
||||
- [x] Move cyberpunk Arsenal from Skills into Combat while preserving its subtabs and repeating sections.
|
||||
- [x] Add Rmax to ranged and melee weapons; cap single strikes and apply base damage per success for burst and automatic fire.
|
||||
- [x] Publish one build per variant and add a base-only Parchemin/Nuit selector.
|
||||
- [x] Show burst and automatic damage per successful shot, with the per-success bonus on natural 1s.
|
||||
- [x] Mark combat rolls with cs1cf10 and all other dice rolls with cs1cfX for the selected die.
|
||||
- [x] Simplify ranged attack ammunition roll data and expose worker progress in the weapon row.
|
||||
- [x] Remove ammunition fields from ranged chat commands while retaining worker-side checks and deductions.
|
||||
- [x] Reduce ranged startRoll commands to the minimum attack and damage fields accepted by Roll20.
|
||||
- [x] Add a temporary default-template diagnostic path for every cyberpunk weapon roll action.
|
||||
- [x] Reduce weapon diagnostics to fixed chat messages without attribute access or game calculations.
|
||||
- [x] Route every ranged action through Roll20's repeating-section click event.
|
||||
- [x] Remove underscores from repeating weapon action names for Roll20 event compatibility.
|
||||
- [x] Replace the ignored ranged section dispatcher with individual underscore-free events.
|
||||
- [x] Remove temporary weapon diagnostics and restore attacks, damage, ammunition, reloads, and chat details.
|
||||
- [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.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 9.5 KiB |
33
build.sh
33
build.sh
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
root=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
cd "$root"
|
||||
|
||||
case "${1-}" in
|
||||
'')
|
||||
if [ "$#" -ne 0 ]; then
|
||||
echo "Usage: ./build.sh [--clean]" >&2
|
||||
exit 2
|
||||
fi
|
||||
;;
|
||||
--clean)
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: ./build.sh [--clean]" >&2
|
||||
exit 2
|
||||
fi
|
||||
rm -rf -- "$root/build" "$root/RPG/d10_character_sheet"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ./build.sh [--clean]" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$root/.venv/bin/python" ]; then
|
||||
python="$root/.venv/bin/python"
|
||||
else
|
||||
python=python3
|
||||
fi
|
||||
|
||||
"$python" tools/publish_builds.py
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
sections:
|
||||
- name: Compétences
|
||||
groups:
|
||||
- name: Offense
|
||||
skills:
|
||||
- id: Perfection
|
||||
name: Perfection
|
||||
- id: Technique_martiale
|
||||
name: Technique martiale
|
||||
- id: Coup_dechirant
|
||||
name: Coup dechirant
|
||||
- id: Fauchage
|
||||
name: Fauchage
|
||||
- id: Exploiter_les_points_faibles
|
||||
name: Exploiter les points faibles
|
||||
- name: Défense
|
||||
skills:
|
||||
- id: Defense_impenetrable
|
||||
name: Defense impenetrable
|
||||
- id: Rempart_parfait
|
||||
name: Rempart parfait
|
||||
- id: Endurance_surnaturelle
|
||||
name: Endurance surnaturelle
|
||||
- id: Encaissement
|
||||
name: Encaissement
|
||||
- name: Tir et charge
|
||||
skills:
|
||||
- id: Tir_precis
|
||||
name: Tir precis
|
||||
- id: Tir_implacable
|
||||
name: Tir implacable
|
||||
- id: Charge
|
||||
name: Charge
|
||||
- id: Charge_indomptable
|
||||
name: Charge indomptable
|
||||
|
|
@ -1,454 +0,0 @@
|
|||
sections:
|
||||
- id: physique
|
||||
name: Physique
|
||||
groups:
|
||||
- name: Combat
|
||||
skills:
|
||||
- id: armesfeu
|
||||
name: Armes à feu
|
||||
- id: armesdassaut
|
||||
name: Armes d'Assaut
|
||||
parent: armesfeu
|
||||
- id: armesdepoing
|
||||
name: Armes de Poing
|
||||
parent: armesfeu
|
||||
- id: armeslourdes
|
||||
name: Armes Lourdes
|
||||
- id: munitionssolides
|
||||
name: Munitions Solides
|
||||
parent: armeslourdes
|
||||
- id: projectilesautopropulss
|
||||
name: Projectiles Autopropulsés
|
||||
parent: armeslourdes
|
||||
- id: armementlaser
|
||||
name: Armement Laser
|
||||
parent: armeslourdes
|
||||
- id: artillerie
|
||||
name: Artillerie
|
||||
- id: projectilesbalistiques
|
||||
name: Projectiles Balistiques
|
||||
parent: artillerie
|
||||
- id: guidagedemissiles
|
||||
name: Guidage de Missiles
|
||||
parent: artillerie
|
||||
- id: systmesdedfenses
|
||||
name: Systèmes de Défenses
|
||||
parent: artillerie
|
||||
- id: balistiquesuperlative
|
||||
name: Balistique Superlative
|
||||
parent: artillerie
|
||||
- id: combatmainsnues
|
||||
name: Combat à Mains Nues
|
||||
- id: neokwondo
|
||||
name: Neo Kwon Do
|
||||
parent: combatmainsnues
|
||||
- id: zrog
|
||||
name: Zéro-G
|
||||
parent: combatmainsnues
|
||||
- id: kravsystema
|
||||
name: Krav-Systema
|
||||
parent: combatmainsnues
|
||||
- id: accoladeeridani
|
||||
name: Accolade Eridani
|
||||
parent: combatmainsnues
|
||||
- id: centauriccma
|
||||
name: Centauri CCMA
|
||||
parent: combatmainsnues
|
||||
- id: combatarm
|
||||
name: Combat Armé
|
||||
- id: armescontondantes
|
||||
name: Armes Contondantes
|
||||
parent: combatarm
|
||||
- id: armestranchantes
|
||||
name: Armes Tranchantes
|
||||
parent: combatarm
|
||||
- id: maniementdesexplosifs
|
||||
name: Maniement des Explosifs
|
||||
- id: lancer
|
||||
name: Lancer
|
||||
- name: Physiques
|
||||
skills:
|
||||
- id: athltisme
|
||||
name: Athlétisme
|
||||
- id: arien
|
||||
name: Aérien
|
||||
parent: athltisme
|
||||
- id: terrestre
|
||||
name: Terrestre
|
||||
parent: athltisme
|
||||
- id: maritime
|
||||
name: Maritime
|
||||
parent: athltisme
|
||||
- id: zrog
|
||||
name: Zéro G
|
||||
parent: athltisme
|
||||
- id: survie
|
||||
name: Survie
|
||||
- id: environnementsauvage
|
||||
name: Environnement Sauvage
|
||||
parent: survie
|
||||
- id: environnementurbain
|
||||
name: Environnement Urbain
|
||||
parent: survie
|
||||
- id: environnementspatial
|
||||
name: Environnement Spatial
|
||||
parent: survie
|
||||
- id: vigilance
|
||||
name: Vigilance
|
||||
- name: Implants
|
||||
skills:
|
||||
- id: utilisationdecyberware
|
||||
name: Utilisation de Cyberware
|
||||
- id: overdrivedeneuroacclrateurs
|
||||
name: Overdrive de Neuro-Accélérateurs
|
||||
parent: utilisationdecyberware
|
||||
- id: overdrivedinterfacesdetir
|
||||
name: Overdrive d'Interfaces de tir
|
||||
parent: utilisationdecyberware
|
||||
- id: overdrivephysique
|
||||
name: Overdrive Physique
|
||||
parent: utilisationdecyberware
|
||||
- id: dive
|
||||
name: Dive
|
||||
- id: fulldive
|
||||
name: Full Dive
|
||||
parent: dive
|
||||
- id: ralitaugmente
|
||||
name: Réalité Augmentée
|
||||
parent: dive
|
||||
- name: Pilotage
|
||||
skills:
|
||||
- id: pilotageatmosphrique
|
||||
name: Pilotage Atmosphérique
|
||||
- id: pilotagedechasseurs
|
||||
name: Pilotage de Chasseurs
|
||||
parent: pilotageatmosphrique
|
||||
- id: pilotagedenavettes
|
||||
name: Pilotage de Navettes
|
||||
parent: pilotageatmosphrique
|
||||
- id: vhiculesterrestres
|
||||
name: Véhicules Terrestres
|
||||
- id: vhiculeslgers
|
||||
name: Véhicules Légers
|
||||
parent: vhiculesterrestres
|
||||
- id: vhiculeslourds
|
||||
name: Véhicules Lourds
|
||||
parent: vhiculesterrestres
|
||||
- id: vhiculesdecourse
|
||||
name: Véhicules de Course
|
||||
parent: vhiculesterrestres
|
||||
- id: vaisseauxspatiaux
|
||||
name: Vaisseaux Spatiaux
|
||||
- id: btimentslgers
|
||||
name: Bâtiments Légers
|
||||
parent: vaisseauxspatiaux
|
||||
- id: btimentslourds
|
||||
name: Bâtiments Lourds
|
||||
parent: vaisseauxspatiaux
|
||||
- id: btimentssuperlourds
|
||||
name: Bâtiments Super-lourds
|
||||
parent: vaisseauxspatiaux
|
||||
- id: pilotagededrones
|
||||
name: Pilotage de Drones
|
||||
- id: essaimdedrones
|
||||
name: Essaim de Drones
|
||||
parent: pilotagededrones
|
||||
- id: intellectuelles
|
||||
name: Intellectuelles
|
||||
groups:
|
||||
- name: Techniques
|
||||
skills:
|
||||
- id: mcanique
|
||||
name: Mécanique
|
||||
- id: rparationsdefortune
|
||||
name: Réparations de Fortune
|
||||
parent: mcanique
|
||||
- id: racteursfusion
|
||||
name: Réacteurs à Fusion
|
||||
parent: mcanique
|
||||
- id: racteursfission
|
||||
name: Réacteurs à Fission
|
||||
parent: mcanique
|
||||
- id: compensateursdinertie
|
||||
name: Compensateurs d'Inertie
|
||||
parent: mcanique
|
||||
- id: technologielightfold
|
||||
name: Technologie Lightfold
|
||||
parent: mcanique
|
||||
- id: systmesdesurvie
|
||||
name: Systèmes de Survie
|
||||
parent: mcanique
|
||||
- id: systmesdepropulsion
|
||||
name: Systèmes de Propulsion
|
||||
parent: mcanique
|
||||
- id: armement
|
||||
name: Armement
|
||||
parent: mcanique
|
||||
- id: crationdaugmentiques
|
||||
name: Création d'Augmentiques
|
||||
- id: implantscphaliens
|
||||
name: Implants Céphaliens
|
||||
parent: crationdaugmentiques
|
||||
- id: implantscorporels
|
||||
name: Implants Corporels
|
||||
parent: crationdaugmentiques
|
||||
- id: augmentiquesdarmure
|
||||
name: Augmentiques d'Armure
|
||||
parent: crationdaugmentiques
|
||||
- id: augmentiquesdarmes
|
||||
name: Augmentiques d'Armes
|
||||
parent: crationdaugmentiques
|
||||
- id: crationdarmement
|
||||
name: Création d'Armement
|
||||
- id: crationdarmesafeu
|
||||
name: Création d'armes a feu
|
||||
parent: crationdarmement
|
||||
- id: crationdarmures
|
||||
name: Création d'armures
|
||||
parent: crationdarmement
|
||||
- id: prospectionstellaire
|
||||
name: Prospection stellaire
|
||||
- id: paves
|
||||
name: Épaves
|
||||
parent: prospectionstellaire
|
||||
- id: corpsstellaires
|
||||
name: Corps stellaires
|
||||
parent: prospectionstellaire
|
||||
- id: excavation
|
||||
name: Excavation
|
||||
parent: prospectionstellaire
|
||||
- name: Électronique
|
||||
skills:
|
||||
- id: analysesoftware
|
||||
name: Analyse Software
|
||||
- id: dtection
|
||||
name: Détection
|
||||
parent: analysesoftware
|
||||
- id: pistagenumrique
|
||||
name: Pistage Numérique
|
||||
parent: analysesoftware
|
||||
- id: reverseengineering
|
||||
name: Reverse Engineering
|
||||
parent: analysesoftware
|
||||
- id: utilisationsoftware
|
||||
name: Utilisation Software
|
||||
- id: neutralisation
|
||||
name: Neutralisation
|
||||
parent: utilisationsoftware
|
||||
- id: infiltration
|
||||
name: Infiltration
|
||||
parent: utilisationsoftware
|
||||
- id: persistance
|
||||
name: Persistance
|
||||
parent: utilisationsoftware
|
||||
- id: backdoor
|
||||
name: Backdoor
|
||||
parent: utilisationsoftware
|
||||
- id: lectronique
|
||||
name: Électronique
|
||||
- id: hardware
|
||||
name: Hardware
|
||||
parent: lectronique
|
||||
- id: interconnexion
|
||||
name: Interconnexion
|
||||
parent: lectronique
|
||||
- id: systmesembarqus
|
||||
name: Systèmes Embarqués
|
||||
parent: lectronique
|
||||
- id: systmesdescurit
|
||||
name: Systèmes de Sécurité
|
||||
parent: lectronique
|
||||
- name: Connaissances
|
||||
skills:
|
||||
- id: premierssecours
|
||||
name: Premiers Secours
|
||||
- id: mdecine
|
||||
name: Médecine
|
||||
- id: soinsintensifs
|
||||
name: Soins Intensifs
|
||||
parent: mdecine
|
||||
- id: chirurgiedimplants
|
||||
name: Chirurgie d’Implants
|
||||
parent: mdecine
|
||||
- id: cybernetisation
|
||||
name: Cybernetisation
|
||||
parent: mdecine
|
||||
- id: mathmatiques
|
||||
name: Mathématiques
|
||||
- id: cryptographie
|
||||
name: Cryptographie
|
||||
parent: mathmatiques
|
||||
- id: astromathmatiques
|
||||
name: Astromathématiques
|
||||
parent: mathmatiques
|
||||
- id: biologie
|
||||
name: Biologie
|
||||
- id: agrogntique
|
||||
name: Agrogénétique
|
||||
parent: biologie
|
||||
- id: xenobiologie
|
||||
name: Xenobiologie
|
||||
parent: biologie
|
||||
- id: thrapiegnique
|
||||
name: Thérapie Génique
|
||||
parent: biologie
|
||||
- id: chimie
|
||||
name: Chimie
|
||||
- id: explosifs
|
||||
name: Explosifs
|
||||
parent: chimie
|
||||
- id: biochimie
|
||||
name: Biochimie
|
||||
parent: chimie
|
||||
- id: physique
|
||||
name: Physique
|
||||
- id: astrophysique
|
||||
name: Astrophysique
|
||||
parent: physique
|
||||
- id: arospatial
|
||||
name: Aérospatial
|
||||
parent: physique
|
||||
- id: thermodynamique
|
||||
name: Thermodynamique
|
||||
parent: physique
|
||||
- id: lightfold
|
||||
name: Lightfold
|
||||
- id: thoriedeschampsfinis
|
||||
name: Théorie des champs finis
|
||||
parent: lightfold
|
||||
- id: srieinfiniescongrues
|
||||
name: Série infinies congrues
|
||||
parent: lightfold
|
||||
- id: sociologie
|
||||
name: Sociologie
|
||||
- id: dshumanisation
|
||||
name: Déshumanisation
|
||||
parent: sociologie
|
||||
- id: syndromedepandorum
|
||||
name: Syndrome de Pandorum
|
||||
parent: sociologie
|
||||
- id: thormedenym
|
||||
name: Théorème de Nym
|
||||
parent: sociologie
|
||||
- name: Culture Générale
|
||||
skills:
|
||||
- id: instructioncivique
|
||||
name: Instruction Civique
|
||||
- id: alphacentauri
|
||||
name: Alpha Centauri
|
||||
parent: instructioncivique
|
||||
- id: eridani
|
||||
name: Eridani
|
||||
parent: instructioncivique
|
||||
- id: banard
|
||||
name: Banard
|
||||
parent: instructioncivique
|
||||
- id: tau
|
||||
name: Tau
|
||||
parent: instructioncivique
|
||||
- id: sirius
|
||||
name: Sirius
|
||||
parent: instructioncivique
|
||||
- id: cic
|
||||
name: C.I.C.
|
||||
parent: instructioncivique
|
||||
- id: sol
|
||||
name: Sol
|
||||
parent: instructioncivique
|
||||
- id: administrationinterstellaire
|
||||
name: Administration Interstellaire
|
||||
- id: politiquestellaire
|
||||
name: Politique Stellaire
|
||||
- id: droitinternational
|
||||
name: Droit International
|
||||
- id: droitstellaire
|
||||
name: Droit Stellaire
|
||||
parent: droitinternational
|
||||
- id: droitcorporatiste
|
||||
name: Droit Corporatiste
|
||||
parent: droitinternational
|
||||
- id: droitmilitaire
|
||||
name: Droit Militaire
|
||||
parent: droitinternational
|
||||
- id: thoriemilitaire
|
||||
name: Théorie Militaire
|
||||
- id: tactique
|
||||
name: Tactique
|
||||
parent: thoriemilitaire
|
||||
- id: stratgie
|
||||
name: Stratégie
|
||||
parent: thoriemilitaire
|
||||
- id: social
|
||||
name: Social
|
||||
groups:
|
||||
- name: Sociales
|
||||
skills:
|
||||
- id: tiquette
|
||||
name: Étiquette
|
||||
- id: corporations
|
||||
name: Corporations
|
||||
parent: tiquette
|
||||
- id: mercenaire
|
||||
name: Mercenaire
|
||||
parent: tiquette
|
||||
- id: stellaire
|
||||
name: Stellaire
|
||||
parent: tiquette
|
||||
- id: militaire
|
||||
name: Militaire
|
||||
parent: tiquette
|
||||
- id: pgre
|
||||
name: Pègre
|
||||
parent: tiquette
|
||||
- id: impersonnation
|
||||
name: Impersonnation
|
||||
- id: enqute
|
||||
name: Enquête
|
||||
- id: interrogation
|
||||
name: Interrogation
|
||||
- id: intimidation
|
||||
name: Intimidation
|
||||
- id: commandement
|
||||
name: Commandement
|
||||
- id: ngociation
|
||||
name: Négociation
|
||||
- id: baratin
|
||||
name: Baratin
|
||||
- id: psychologie
|
||||
name: Psychologie
|
||||
- name: Clandestines
|
||||
skills:
|
||||
- id: discrtion
|
||||
name: Discrétion
|
||||
- id: crochetage
|
||||
name: Crochetage
|
||||
- id: larcin
|
||||
name: Larcin
|
||||
- id: falsification
|
||||
name: Falsification
|
||||
- id: cyberware
|
||||
name: Cyberware
|
||||
parent: falsification
|
||||
- id: marchsnoirs
|
||||
name: Marchés noirs
|
||||
- id: acquisitiondobjets
|
||||
name: Acquisition d’Objets
|
||||
parent: marchsnoirs
|
||||
- id: acquisitiondinformations
|
||||
name: Acquisition d’Informations
|
||||
parent: marchsnoirs
|
||||
- name: Contacts
|
||||
skills: []
|
||||
custom: true
|
||||
- id: arsenal
|
||||
name: Arsenal
|
||||
groups:
|
||||
- name: Distance
|
||||
skills: []
|
||||
equipment: distance
|
||||
- name: Mêlée
|
||||
skills: []
|
||||
equipment: melee
|
||||
- name: Consommable
|
||||
skills: []
|
||||
equipment: consommable
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
version: 1
|
||||
variants:
|
||||
base:
|
||||
title: Système D10
|
||||
skills: base_skills.yaml
|
||||
attributes:
|
||||
- {id: Force, name: Force}
|
||||
- {id: Agilite, name: Agilité}
|
||||
- {id: Perception, name: Perception}
|
||||
- {id: Charisme, name: Charisme}
|
||||
- {id: Intelligence, name: Intelligence}
|
||||
- {id: Volonte, name: Volonté}
|
||||
- {id: Psyche, name: Psyché}
|
||||
- {id: Chance, name: Chance}
|
||||
resources:
|
||||
- {id: Life_Points, name: Points de vie}
|
||||
- {id: Endurance_Points, name: Points de fatigue}
|
||||
combat:
|
||||
- {id: Initiative, name: Initiative}
|
||||
- {id: base_damage_dices, name: Dégâts de base}
|
||||
- {id: exal_damage_dices, name: Bonus de dégâts}
|
||||
- {id: additional_damage_dices, name: Dégâts additionnels}
|
||||
- {id: general_attack_threshold, name: Seuil d'attaque}
|
||||
weapons: 3
|
||||
repeating:
|
||||
- {id: skills, name: Compétences libres, fields: [skillname, skilllevel, skillcost]}
|
||||
- {id: general-combat-skills, name: Combat libre, fields: [skillname, skilllevel]}
|
||||
- {id: magic-skills, name: Magie, fields: [skillname, skilllevel]}
|
||||
- {id: equipment, name: Équipement, fields: [name, notes]}
|
||||
skill_tabs:
|
||||
- {id: fight, name: Combat et combat libre, content: [fixed_skills, general-combat-skills]}
|
||||
- {id: free, name: Compétences libres, content: [skills]}
|
||||
- {id: magic, name: Magie, content: [magic-skills]}
|
||||
- {id: equipment, name: Équipement, content: [equipment]}
|
||||
cyberpunk:
|
||||
title: Système D10 Cyberpunk
|
||||
skills: cyberpunk_skills.yaml
|
||||
skill_category_tabs: true
|
||||
attributes:
|
||||
- {id: Force, name: Force}
|
||||
- {id: Agilite, name: Agilité}
|
||||
- {id: Perception, name: Perception}
|
||||
- {id: Charisme, name: Charisme}
|
||||
- {id: Intelligence, name: Intelligence}
|
||||
- {id: Volonte, name: Volonté}
|
||||
- {id: Accred, name: Accréditation}
|
||||
- {id: Chance, name: Chance}
|
||||
resources:
|
||||
- {id: Life_Points, name: Points de vie}
|
||||
- {id: Endurance_Points, name: Points de fatigue}
|
||||
combat:
|
||||
- {id: Initiative, name: Initiative}
|
||||
health_locations: [head, body, left_arm, right_arm, left_leg, right_leg]
|
||||
repeating:
|
||||
- {id: skills, name: Compétences libres, fields: [skillname, skilllevel, skillcost]}
|
||||
- {id: contacts-skills, name: Contacts, fields: [skillname, skilllevel]}
|
||||
- {id: distance, name: Armes à distance, fields: [name, damage, notes, weapon_type, accuracy, base_threshold, skill_id, single_cost, burst_cost, auto_cost, ammo_current, magazine_size, ammo_reserve, damage_per_success, rmax, weapon_status]}
|
||||
- {id: melee, name: Armes de mêlée, fields: [name, damage, notes, weapon_type, accuracy, base_threshold, skill_id, damage_per_success, rmax, weapon_status]}
|
||||
- {id: consommable, name: Consommables, fields: [name, quantity, notes]}
|
||||
141
data/themes.yaml
141
data/themes.yaml
|
|
@ -1,141 +0,0 @@
|
|||
themes:
|
||||
parchment:
|
||||
name: Parchemin
|
||||
background: '#f3ebda'
|
||||
panel: '#fffaf0'
|
||||
ink: '#30251f'
|
||||
accent: '#7a2830'
|
||||
border: '#c9ad76'
|
||||
night:
|
||||
name: Nuit
|
||||
background: '#17212b'
|
||||
panel: '#233342'
|
||||
ink: '#f3f4f6'
|
||||
accent: '#48d4bf'
|
||||
border: '#567489'
|
||||
bluecore:
|
||||
name: Bluetech
|
||||
background: '#1a222d'
|
||||
panel: '#232f3a'
|
||||
ink: '#d0e4ff'
|
||||
accent: '#3399ff'
|
||||
border: '#4488cc'
|
||||
corporate:
|
||||
name: Corporate
|
||||
background: '#f4f5f7'
|
||||
panel: '#ffffff'
|
||||
ink: '#222222'
|
||||
accent: '#2e3440'
|
||||
border: '#bbbbbb'
|
||||
dupont-monsanto:
|
||||
name: Dupont-Monsanto
|
||||
background: '#1f2c1a'
|
||||
panel: '#2f3d26'
|
||||
ink: '#eaffcc'
|
||||
accent: '#d5e6aa'
|
||||
border: '#bbdd44'
|
||||
eden-green:
|
||||
name: Eridani
|
||||
background: '#1c2b1a'
|
||||
panel: '#263f25'
|
||||
ink: '#cceebb'
|
||||
accent: '#99cc66'
|
||||
border: '#66aa55'
|
||||
foxified-dark:
|
||||
name: Foxified sombre
|
||||
background: '#2e1f16'
|
||||
panel: '#3b261b'
|
||||
ink: '#ffcc99'
|
||||
accent: '#ff9b4d'
|
||||
border: '#aa6033'
|
||||
foxified-light:
|
||||
name: Foxified clair
|
||||
background: '#fff8f2'
|
||||
panel: '#fff0e6'
|
||||
ink: '#5a2e0c'
|
||||
accent: '#8a3c00'
|
||||
border: '#cc7744'
|
||||
hci:
|
||||
name: Habea Corpus
|
||||
background: '#f2f9f6'
|
||||
panel: '#e3f0eb'
|
||||
ink: '#144d40'
|
||||
accent: '#144d40'
|
||||
border: '#66ccb3'
|
||||
iron-docks:
|
||||
name: Saturn Heavy Foundries
|
||||
background: '#1e1e1e'
|
||||
panel: '#2b2b2b'
|
||||
ink: '#e0e0e0'
|
||||
accent: '#ff9b35'
|
||||
border: '#aaaaaa'
|
||||
peaceframe:
|
||||
name: ISF Peaceframe
|
||||
background: '#e8f3fb'
|
||||
panel: '#d4e8f5'
|
||||
ink: '#1c3f55'
|
||||
accent: '#1c3f55'
|
||||
border: '#77aac6'
|
||||
rebel:
|
||||
name: Rebel
|
||||
background: '#1a1a1a'
|
||||
panel: '#2a2a2a'
|
||||
ink: '#f5f5f5'
|
||||
accent: '#dddddd'
|
||||
border: '#666666'
|
||||
sirius-mind:
|
||||
name: Sirius
|
||||
background: '#0e1a2b'
|
||||
panel: '#162538'
|
||||
ink: '#d0e6ff'
|
||||
accent: '#86bfff'
|
||||
border: '#4477aa'
|
||||
solarized:
|
||||
name: Sol
|
||||
background: '#fdf6e3'
|
||||
panel: '#fefcea'
|
||||
ink: '#586e75'
|
||||
accent: '#516a73'
|
||||
border: '#cccccc'
|
||||
sons-of-banard:
|
||||
name: Banard
|
||||
background: '#1e1c18'
|
||||
panel: '#2c2a26'
|
||||
ink: '#f0d9b5'
|
||||
accent: '#e4b05a'
|
||||
border: '#cc9966'
|
||||
storm-pilot:
|
||||
name: Centauri
|
||||
background: '#101022'
|
||||
panel: '#1b1b33'
|
||||
ink: '#ccddff'
|
||||
accent: '#aabbee'
|
||||
border: '#5577aa'
|
||||
tessier-ashpol:
|
||||
name: Tessier-Ashpol
|
||||
background: '#12171b'
|
||||
panel: '#1a2025'
|
||||
ink: '#ccf2ff'
|
||||
accent: '#77cce0'
|
||||
border: '#77cce0'
|
||||
ustf:
|
||||
name: USTF
|
||||
background: '#0f1b2b'
|
||||
panel: '#162536'
|
||||
ink: '#e0e8f0'
|
||||
accent: '#ff7777'
|
||||
border: '#446688'
|
||||
verdant-rebel:
|
||||
name: Green Pastures
|
||||
background: '#1b2a1b'
|
||||
panel: '#273a27'
|
||||
ink: '#ccffd9'
|
||||
accent: '#77efaa'
|
||||
border: '#66dd99'
|
||||
weicat-industrial:
|
||||
name: Weycat Industrial
|
||||
background: '#1c1a14'
|
||||
panel: '#2a261d'
|
||||
ink: '#fff5cc'
|
||||
accent: '#ffda55'
|
||||
border: '#e6b800'
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,61 @@
|
|||
General
|
||||
Initiative (Comp)
|
||||
Rapidite_surnaturelle @Actions
|
||||
Frères_d'arme @Reserve
|
||||
Perfection P
|
||||
Prescience_ @Reserve
|
||||
Rage_primale @Reserve
|
||||
A_corps_perdu @Reserve
|
||||
undescored_name :
|
||||
|
||||
Defence
|
||||
Encaissement @Defence
|
||||
Encaissement @Defence
|
||||
Resistances @Defence
|
||||
Endurance_surnaturelle @PV
|
||||
Riposte @Reserve
|
||||
Riposte @Reserve
|
||||
Parade @Reserve
|
||||
Defense_impenetrable I_1
|
||||
Defense_impenetrable I_2
|
||||
Defense_impenetrable I_4
|
||||
Rempart_parfait R
|
||||
Infatigable (Rappel)
|
||||
Dernier_Souffle_ (Rappel)
|
||||
Envers_et_contre_tout (Rappel)
|
||||
Regeneration (Rappel)
|
||||
Regeneration (Rappel)
|
||||
Presence_ecrasante (Rappel)
|
||||
Maîtrise_du_combat (Rappel)
|
||||
|
||||
Offense
|
||||
Technique_martiale M_1
|
||||
Technique_martiale M_2
|
||||
Coup_en_Puissance @Reserve
|
||||
Coup_Double @Reserve
|
||||
Coup_dechirant D
|
||||
Fauchage F
|
||||
Coup_mortel (Rappel)@Reserve
|
||||
Combat_acrobatique (Rappel)
|
||||
Assaut_implacable (Rappel)
|
||||
Tir_en_mouvement (Rappel)
|
||||
Exploiter_les_points_faibles E_1
|
||||
Exploiter_les_points_faibles E_2
|
||||
Exploiter_les_points_faibles E_4
|
||||
Double_initiative (Rappel)**
|
||||
Marcher_dans_les_ombres (Rappel)
|
||||
Rage_Berserk (Rappel)**
|
||||
Influx_meurtrier (Rappel)**
|
||||
|
||||
|
||||
|
||||
Special
|
||||
Tir_mortel @Reserve
|
||||
Tir_precis T_1
|
||||
Tir_precis T_2
|
||||
replace L
|
||||
add_to_add l
|
||||
Tir_implacable i
|
||||
Charge C
|
||||
Charge_Mortelle (Rappel)
|
||||
Charge_indomptable N
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
//Variables a initialiser par parse
|
||||
/*
|
||||
var nb_dices=0;
|
||||
Action a a e d
|
||||
var all_dices d*
|
||||
var nb_2add=0; //+
|
||||
var nb_2sub=0; //-
|
||||
|
||||
var relances=0; //r
|
||||
Perfection P
|
||||
|
||||
Defense
|
||||
Défense_impénétrable I 1
|
||||
Défense_impénétrable I 2 - Rappel
|
||||
Défense_impénétrable I 4
|
||||
Rempart_parfait R
|
||||
|
||||
Offense
|
||||
Technique_martiale M 1
|
||||
Technique_martiale M 2
|
||||
Coup_déchirant D
|
||||
Fauchage F
|
||||
Exploiter_les_points_faibles E 1
|
||||
Exploiter_les_points_faibles E 2 - Rappel
|
||||
Exploiter_les_points_faibles E 4
|
||||
|
||||
Spécial
|
||||
Tir_précis T 1
|
||||
Tir_précis T 2
|
||||
Tir_implacable i
|
||||
Charge C
|
||||
Charge_indomptable N - (Sur la feuille de perso)
|
||||
Seuil s
|
||||
On Hit crit H
|
||||
Attribute values A
|
||||
Encaissement S
|
||||
|
||||
*/
|
||||
|
||||
// SKILLNAME
|
||||
on("change:skill_SKILLNAME_activation change:general_skilllevel_SKILLNAME", function() {
|
||||
getAttrs(["skill_SKILLNAME_activation", "general_skilllevel_SKILLNAME"], function(values) {
|
||||
setAttrs({"general_effective_SKILLNAME":values.skill_SKILLNAME_activation*values.general_skilllevel_SKILLNAME});
|
||||
});
|
||||
});
|
||||
|
||||
<!--SKILLNAME -->
|
||||
<input class="sheet-skill_name" style="margin-right: 4px;" type="text" name="attr_general_skill_SKILLNAME" disabled="true" value="SKILLNAME" title="Nom de la compétence" />
|
||||
<input type="number" min="0" value= "0" name="attr_skillcost_SKILLNAME" title="Coût de la compétence"/>
|
||||
<input class="sheet-skill_name" value= "0" style="margin-right: 4px;" type="number" min="0" max="10" name="attr_general_skilllevel_SKILLNAME" title="Niveau dans la compétence" />
|
||||
<select class="sheet-skill_select" style="margin-right:4px" name="attr_Skill_general_attribute_select_SKILLNAME"><option value="@{base-Force} + @{exal-Force}">For</option><option value="@{base-Agilite} + @{exal-Agilite}">Agi</option><option value="@{base-Perception} + @{exal-Perception}">Per</option><option value="@{base-Charisme} + @{exal-Charisme}">Cha</option><option value="@{base-Intelligence} + @{exal-Intelligence}">Int</option><option value="@{base-Perception} + @{exal-Perception}">Per</option><option value="@{base-Volonte} + @{exal-Volonte}">Vol</option><option value="@{base-Psyche} + @{exal-Psyche}">Psy</option><option value="@{base-Chance} + @{exal-Chance}">Chn</option></select>
|
||||
<button type='roll' class="sheet-skillbutton" value="/e fait un jet de @{general_skill_SKILLNAME} [[(@{general_skilllevel_SKILLNAME}+(@{Skill_general_attribute_select_SKILLNAME}) - d@{dice})]] "></button>
|
||||
<input type="checkbox" class="sheet-skill_activation" style="margin-right: 4px;" value="1" name="attr_skill_SKILLNAME_activation" />
|
||||
<input class="sheet-skill_hidden" value= "0" type="number" name="attr_general_effective_SKILLNAME"/>
|
||||
|
||||
<!--FIELD_TYPE -->
|
||||
<fieldset class="repeating_FIELD_TYPE-skills">
|
||||
<input class="sheet-skill_name" type="text" name="attr_FIELD_TYPE_skillname" title="Nom de la compétence" />
|
||||
<input type="number" name="attr_FIELD_TYPE_skillcost" title="Coût de la compétence" />
|
||||
<input type="number" min="-10" max="10" name="attr_FIELD_TYPE_skilllevel" title="Niveau dans la compétence" />
|
||||
<select class="sheet-skill_select" name="attr_FIELD_TYPE_attribute_select">
|
||||
<option value="@{base-Force} + @{exal-Force}">For</option>
|
||||
<option value="@{base-Agilite} + @{exal-Agilite}">Agi</option>
|
||||
<option value="@{base-Perception} + @{exal-Perception}">Per</option>
|
||||
<option value="@{base-Charisme} + @{exal-Charisme}">Cha</option>
|
||||
<option value="@{base-Intelligence} + @{exal-Intelligence}">Int</option>
|
||||
<option value="@{base-Perception} + @{exal-Perception}">Per</option>
|
||||
<option value="@{base-Volonte} + @{exal-Volonte}">Vol</option>
|
||||
<option value="@{base-Psyche} + @{exal-Psyche}">Psy</option>
|
||||
<option value="@{base-Chance} + @{exal-Chance}">Chn</option>
|
||||
</select>
|
||||
<button type='roll' class="sheet-skillbutton" value="/e fait un jet de @{FIELD_TYPE_skillname} au d@{dice} [[@{FIELD_TYPE_skilllevel}+(@{FIELD_TYPE_attribute_select}) - d@{dice}]]"></button>
|
||||
</fieldset>
|
||||
|
||||
<!--shield3 -->
|
||||
<input class="sheet-skill_name" style="margin-right: 0px;" type="text" name="attr_general_item_shield3_name" value="shield3" />
|
||||
<input class="sheet-skill_name" value="0" style="margin-right: 0px;" type="number" name="attr_general_item_shield3" title="Valeur de l'équipemet" />
|
||||
<input type="checkbox" class="sheet-skill_activation" value="1" name="attr_item_shield3_activation" />
|
||||
<input class="sheet-skill_hidden" value="0" type="number" name="attr_general_effective_shield3" />
|
||||
|
||||
// shield3
|
||||
on("change:item_shield3_activation change:general_item_shield3", function() {
|
||||
getAttrs(["item_shield3_activation", "general_item_shield3"], function(values) {
|
||||
setAttrs({"general_effective_shield3":values.item_shield3_activation*values.general_item_shield3});
|
||||
});
|
||||
});
|
||||
|
||||
name roll_name dice_name result threshold
|
||||
/e - Test d.+(\w*).*\[\[(.*)-.*\]\]
|
||||
&{template:d10skillcheck}{{name=@{character_name}} {{roll_name=$1}} {{dice_name=@{dice}}} {{result=$2}} {{threshold=[[]]}}
|
||||
|
||||
/e .* @{(\w*)}.*\[(.*) -.*\)?\]\]
|
||||
&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=@{$1}}} {{dice_name=@{dice}}} {{result=[[$2-d@{dice}cs1cf@{dice}]]}} {{threshold=[[$2]]}}
|
||||
|
|
@ -0,0 +1,597 @@
|
|||
head="""<head>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"/>
|
||||
"""
|
||||
script=""" <script type="text/worker">
|
||||
// Life_Points
|
||||
// on("change:base-Force change:base-Agilite change:base-Volonte change:general_skilllevel_Endurance_surnaturelle", function() {
|
||||
// getAttrs(["base-Force","base-Agilite","base-Volonte","general_skilllevel_Endurance_surnaturelle"], function(values) {
|
||||
// setAttrs({"Life_Points_max":Number(values['base-Force'])+Number(values['base-Volonte'])+Number(values['base-Agilite'])+Number(values.general_skilllevel_Endurance_surnaturelle)*2+10});
|
||||
// setAttrs({"Life_Points_maximum":Number(values['base-Force'])+Number(values['base-Volonte'])+Number(values['base-Agilite'])+Number(values.general_skilllevel_Endurance_surnaturelle)*2+10});
|
||||
// });
|
||||
// });
|
||||
// Endurance_Points
|
||||
on("change:base-Force change:base-Agilite change:general_skilllevel_Endurance_surnaturelle", function() {
|
||||
getAttrs(["base-Force","base-Agilite","general_skilllevel_Endurance_surnaturelle"], function(values) {
|
||||
setAttrs({"Endurance_Points_maximum":Number(values['base-Force'])*4});
|
||||
setAttrs({"Endurance_Points_max":Number(values['base-Force'])*4});
|
||||
});
|
||||
});
|
||||
// undescored_name
|
||||
// on("change:character_name change:character_race", function() {
|
||||
// getAttrs(["character_name"], function(values) {
|
||||
// setAttrs({"undescored_name":values.character_name.replace(/ /g,"_").replace(/'/g,"/")});
|
||||
// });
|
||||
// });
|
||||
// dice_with_tanscendance
|
||||
</script>
|
||||
</head>
|
||||
"""
|
||||
header="""
|
||||
<div class="sheet-content">
|
||||
<div class="sheet-center">
|
||||
<input type="text" class="sheet-bigname" name="attr_character_name" placeholder="Nom"/>
|
||||
<span style="color:#ffffff;" name="attr_undescored_name" /><span/><br/>
|
||||
<input type="text" class="sheet-mediumname" name="attr_character_race" placeholder="Race"/>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="sheet-2colrow">
|
||||
<div class='sheet-col'>
|
||||
<h3 class="sheet-center">Ressources</h3>
|
||||
<table class="sheet-center sheet-black">
|
||||
<tr>
|
||||
<td><h4>Points de Vie</h4></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_Life_Points_head" title="Tête" value="0"/></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_Life_Points_body" title="Torse" value="0"/></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_Life_Points_left_arm" title="Bras gauche" value="0"/></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_Life_Points_right_arm" title="Bras droit" value="0"/></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_Life_Points_left_leg" title="Jambe gauche" value="0"/></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_Life_Points_right_leg" title="Jambe droite" value="0"/></td>
|
||||
<!-- <td><input class="sheet-trait" disabled="true" name="attr_mirror_Life_Points" value="@{Life_Points_maximum}"/></td> -->
|
||||
</tr>
|
||||
<tr>
|
||||
<td><h4>Points de Fatigue</h4></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_Endurance_Points" value="0"/></td>
|
||||
<td><input class="sheet-trait" disabled="true" name="attr_mirror_Endurance_Points" value="@{Endurance_Points_maximum}"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="sheet-col">
|
||||
<table class="sheet-center sheet-black">
|
||||
<tr>
|
||||
<td><h3 class="sheet-center">Points de compétence :</h3></td>
|
||||
<br/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="number" class="sheet-trait" name="attr_Character_points_spent" value="0"/> Utilisés</td>
|
||||
<td rowspan="2">
|
||||
<select class="sheet-dice_select sheet-dice" name="attr_dice">
|
||||
<option value="2">d2</option>
|
||||
<option value="4">d4</option>
|
||||
<option value="6">d6</option>
|
||||
<option value="8">d8</option>
|
||||
<option value="10" selected>d10</option>
|
||||
<option value="12">d12</option>
|
||||
<option value="20">d20</option>
|
||||
<option value="30">d30</option>
|
||||
<option value="100">d100</option>
|
||||
<option value="1000">d1000</option>
|
||||
<option value="10000">d10000</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="number" class="sheet-trait" name="attr_Character_points_unspent" value="0"/> Restants</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class='sheet-2colrow'>
|
||||
<div class='sheet-col'>
|
||||
<h3 class="sheet-center">Caractéristiques</h3>
|
||||
<table class="">
|
||||
<tr>
|
||||
<th>Carac</th>
|
||||
<th>Valeur</th>
|
||||
<th>Bonus</th>
|
||||
<th colspan="2">Lancer</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Force</td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_base-Force" title="Force de base" value="0" min="0" max="10" /></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_exal-Force" title="Modificateur" value="0" /></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Force}} {{dice_name=@{dice}}} {{result=[[(@{base-Force}+@{exal-Force})*2-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Force}+@{exal-Force})*2]]}}"></button></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Force brute}} {{dice_name=@{dice}}} {{result=[[(@{base-Force}+@{exal-Force})-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Force}+@{exal-Force})]]}}">Brut</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Agilité</td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_base-Agilite" title="Agilité de base" value="0" min="0" max="10"/></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_exal-Agilite" title="Modificateur" value="0"/></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Agilité}} {{dice_name=@{dice}}} {{result=[[(@{base-Agilite}+@{exal-Agilite})*2-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Agilite}+@{exal-Agilite})*2]]}}"></button></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Agilité}} {{dice_name=@{dice}}} {{result=[[(@{base-Agilite}+@{exal-Agilite})-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Agilite}+@{exal-Agilite})]]}}">Brut</button></td>
|
||||
</tr><tr>
|
||||
<td>Perception</td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_base-Perception" title="Perception de base" value="0" min="0" max="10"/></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_exal-Perception" title="Modificateur" value="0"/></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Perception}} {{dice_name=@{dice}}} {{result=[[(@{base-Perception}+@{exal-Perception})*2-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Perception}+@{exal-Perception})*2]]}}"></button></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Perception}} {{dice_name=@{dice}}} {{result=[[(@{base-Perception}+@{exal-Perception})-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Perception}+@{exal-Perception})]]}}">Brut</button></td>
|
||||
</tr><tr>
|
||||
<td>Charisme</td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_base-Charisme" title="Charisme de base" value="0" min="0" max="10"/></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_exal-Charisme" title="Modificateur" value="0"/></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Charisme}} {{dice_name=@{dice}}} {{result=[[(@{base-Charisme}+@{exal-Charisme})*2-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Charisme}+@{exal-Charisme})*2]]}}"></button></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Charisme}} {{dice_name=@{dice}}} {{result=[[(@{base-Charisme}+@{exal-Charisme})-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Charisme}+@{exal-Charisme})]]}}">Brut</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class='sheet-col'>
|
||||
<h3 class="sheet-center"> </h3>
|
||||
<table class="">
|
||||
<tr>
|
||||
<th>Carac</th>
|
||||
<th>Valeur</th>
|
||||
<th>Bonus</th>
|
||||
<th colspan="2">Lancer</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Intelligence</td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_base-Intelligence" title="Intelligence de base" value="0" min="0" max="10" /></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_exal-Intelligence" title="Modificateur" value="0" /></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Intelligence}} {{dice_name=@{dice}}} {{result=[[(@{base-Intelligence}+@{exal-Intelligence})*2-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Intelligence}+@{exal-Intelligence})*2]]}}"></button></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Intelligence brute}} {{dice_name=@{dice}}} {{result=[[(@{base-Intelligence}+@{exal-Intelligence})-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Intelligence}+@{exal-Intelligence})]]}}">Brut</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Volonté</td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_base-Volonte" title="Volonté de base" value="0" min="0" max="10"/></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_exal-Volonte" title="Modificateur" value="0"/></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Volonté}} {{dice_name=@{dice}}} {{result=[[(@{base-Volonte}+@{exal-Volonte})*2-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Volonte}+@{exal-Volonte})*2]]}}"></button></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Volonté}} {{dice_name=@{dice}}} {{result=[[(@{base-Volonte}+@{exal-Volonte})-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Volonte}+@{exal-Volonte})]]}}">Brut</button></td>
|
||||
</tr><tr>
|
||||
<td>Psyché</td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_base-Psyche" title="Psyché de base" value="0" min="0" max="10"/></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_exal-Psyche" title="Modificateur" value="0"/></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Psyché}} {{dice_name=@{dice}}} {{result=[[(@{base-Psyche}+@{exal-Psyche})*2-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Psyche}+@{exal-Psyche})*2]]}}"></button></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Psyché}} {{dice_name=@{dice}}} {{result=[[(@{base-Psyche}+@{exal-Psyche})-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Psyche}+@{exal-Psyche})]]}}">Brut</button></td>
|
||||
</tr><tr>
|
||||
<td>Chance</td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_base-Chance" title="Chance de base" value="0" min="0" max="10"/></td>
|
||||
<td><input type="number" class="sheet-trait" name="attr_exal-Chance" title="Modificateur" value="0"/></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Chance}} {{dice_name=@{dice}}} {{result=[[(@{base-Chance}+@{exal-Chance})*2-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Chance}+@{exal-Chance})*2]]}}"></button></td>
|
||||
<td><button type='roll' class="sheet-trait_roll" value="&{template:d10skillcheck}{{name=@{character_name}}} {{roll_name=Chance}} {{dice_name=@{dice}}} {{result=[[(@{base-Chance}+@{exal-Chance})-d@{dice}cs1cf@{dice}]]}} {{threshold=[[(@{base-Chance}+@{exal-Chance})]]}}">Brut</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
"""
|
||||
|
||||
footer="""
|
||||
</div>
|
||||
<rolltemplate class="sheet-rolltemplate-d10skillcheck">
|
||||
<table class="">
|
||||
<tr><th class="roll-title">{{name}} — {{roll_name}}</th></tr>
|
||||
<tr><td class="roll-attr"> Test au d{{dice_name}} seuil {{threshold}} </td></tr>
|
||||
<tr>
|
||||
{{#rollWasCrit() result}}
|
||||
<td class="roll-crit">Critique ! {{result}}<span class="inline fullcrit">x2</span> degrés de réussite</td>
|
||||
{{/rollWasCrit() result}}
|
||||
{{#^rollWasCrit() result}}
|
||||
{{#rollWasFumble() result}}
|
||||
{{#rollGreater() result 1}}
|
||||
<td class="roll-fumble">Échec critique ! {{result}}<span class="inline fullfail">/2</span> degrés de réussite</td>
|
||||
{{/rollGreater() result 1}}
|
||||
{{#rollBetween() result 0 1}}
|
||||
<td class="roll-fumble">Échec critique ! {{result}}<span class="inline fullfail">/2</span> degré de réussite</td>
|
||||
{{/rollBetween() result 0 1}}
|
||||
{{#rollLess() result 0}}
|
||||
<td class="roll-fumble">Échec critique ! {{result}}<span class="inline fullfail">x2</span> degrés d'échec</td>
|
||||
{{/rollLess() result 0}}
|
||||
{{/rollWasFumble() result}}
|
||||
{{#^rollWasFumble() result}}
|
||||
{{#rollGreater() result 1}}
|
||||
<td class="roll-sucess">{{result}} degrés de réussite</td>
|
||||
{{/rollGreater() result 1}}
|
||||
{{#rollBetween() result 0 1}}
|
||||
<td class="roll-sucess">{{result}} degré de réussite</td>
|
||||
{{/rollBetween() result 0 1}}
|
||||
{{#rollLess() result 0}}
|
||||
<td class="roll-fail">{{result}} degrés d'échec</td>
|
||||
{{/rollLess() result 0}}
|
||||
{{/^rollWasFumble() result}}
|
||||
{{/^rollWasCrit() result}}
|
||||
</tr>
|
||||
</table>
|
||||
</rolltemplate>
|
||||
<rolltemplate class="sheet-rolltemplate-d10init">
|
||||
<table class="">
|
||||
<tr><th class="roll-title">{{name}} — {{roll_name}}</th></tr>
|
||||
<tr><td class="roll-sucess"> 1d10+{{value}} = {{result}}
|
||||
{{#rollWasCrit() result}}
|
||||
<span class="inline fullcrit">+{{base}}</span>
|
||||
{{/rollWasCrit() result}}
|
||||
{{#rollWasFumble() result}}
|
||||
{{result}}<span class="inline fullfail">-{{base}}</span>
|
||||
{{/rollWasFumble() result}}
|
||||
</td></tr>
|
||||
</table>
|
||||
</rolltemplate>
|
||||
<rolltemplate class="sheet-rolltemplate-d10Shooting">
|
||||
<div class="container">
|
||||
<div><h1>{{name}}</h1></div>
|
||||
<div><span class="subheader">{{subtags}}</span></div>
|
||||
<div class="arrow-container"><div class="arrow-right"></div></div>
|
||||
{{#attack}}
|
||||
<div class="rowcolor"><span class="tcat">Attack: </span>{{attack}} sucesses</div>
|
||||
{{#mode}}
|
||||
<div class="rowcolor"><span class="tcat">Mode: </span>{{mode}} ({{usedammo}})</div>
|
||||
{{/mode}}
|
||||
{{/attack}}
|
||||
{{#damage}}
|
||||
<div>
|
||||
<span class="tcat">Damage: </span>{{damage}}
|
||||
</div>
|
||||
{{#ammocurrent}}
|
||||
<div>
|
||||
<span class="tcat">Ammunition: </span> {{ammocurrent}}/{{magsize}} | {{ammototal}}
|
||||
</div>
|
||||
{{/ammocurrent}}
|
||||
{{/damage}}
|
||||
{{#damagedone}}
|
||||
<div>
|
||||
<span class="tcat">Damage: </span>{{damagedone}}
|
||||
</div>
|
||||
{{#ammocurrent}}
|
||||
<div>
|
||||
<span class="tcat">Ammunition: </span> {{ammocurrent}}/{{magsize}} | {{ammototal}}
|
||||
</div>
|
||||
{{/ammocurrent}}
|
||||
{{/damagedone}}
|
||||
{{#special}}
|
||||
<div>
|
||||
<span class="tcat">Special: </span>{{special}}
|
||||
</div>
|
||||
{{/special}}
|
||||
</div>
|
||||
</rolltemplate>
|
||||
"""
|
||||
css_footer="""input.sheet-tab{
|
||||
-moz-appearance: none;
|
||||
width:150px;
|
||||
height: 20px;
|
||||
top: 5px;
|
||||
left: 6px;
|
||||
margin: 5px;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
content: attr(title);
|
||||
}
|
||||
input.sheet-tab::before{
|
||||
-moz-appearance: none;
|
||||
content: attr(title);
|
||||
border-radius:.5em;
|
||||
border:2px solid black;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
background: black;
|
||||
color:white;
|
||||
width: 150px;
|
||||
height: 20px;
|
||||
font-size: 18px;
|
||||
}
|
||||
input.sheet-tab:checked::before{
|
||||
-moz-appearance: none;
|
||||
background:#CCCCCC;
|
||||
color:black;
|
||||
border-radius:.5em;
|
||||
border:2px solid black;
|
||||
}
|
||||
|
||||
input.sheet-small_tab{
|
||||
-moz-appearance: none;
|
||||
width:120px;
|
||||
height: 20px;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
margin:5px;
|
||||
}
|
||||
input.sheet-small_tab::before{
|
||||
-moz-appearance: none;
|
||||
content: attr(title);
|
||||
border-radius:.5em;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
color:white;
|
||||
background:black;
|
||||
border:2px solid black;
|
||||
width: 120px;
|
||||
height:20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
input.sheet-small_tab:checked::before{
|
||||
-moz-appearance: none;
|
||||
border:2px solid black;
|
||||
background:#CCCCCC;
|
||||
color:black;
|
||||
border-radius:.5em;
|
||||
}
|
||||
|
||||
input.sheet-skill_name{
|
||||
-moz-appearance: none;
|
||||
width:400px;
|
||||
}
|
||||
input.sheet-skill_hidden{
|
||||
visibility: hidden;
|
||||
}
|
||||
div.sheet-tab-content{
|
||||
border-top-color: #000;
|
||||
margin: 2px 0 0 0;
|
||||
}
|
||||
select.sheet-skill_select{
|
||||
width:55px;
|
||||
margin-bottom:-1px;
|
||||
}
|
||||
select.sheet-dice_select{
|
||||
width:85px;
|
||||
margin-bottom:-1px;
|
||||
}
|
||||
.sheet-trait{
|
||||
width: 30px;
|
||||
}
|
||||
.sheet-numberbox {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10init table,
|
||||
.sheet-rolltemplate-d10skillcheck table {
|
||||
border-radius: 6px;
|
||||
width:100%;
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding: 2px;
|
||||
border: 1px solid;
|
||||
background-color: #ffffff;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #000;
|
||||
border-image-source: none;
|
||||
}
|
||||
.sheet-rolltemplate-d10init .sheet-roll-title,
|
||||
.sheet-rolltemplate-d10init th,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-title,
|
||||
.sheet-rolltemplate-d10skillcheck th {
|
||||
color: rgb(42, 42, 42);
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 5px;
|
||||
font-size: 1.2em;
|
||||
text-align: left;
|
||||
font-family: "Times New Roman", Times, serif;
|
||||
font-variant: small-caps;
|
||||
text-transform: capitalize;
|
||||
border-width: 0px;
|
||||
}
|
||||
.sheet-rolltemplate-d10init .sheet-roll-attr,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-attr{
|
||||
color: #555555;
|
||||
font-size: 1em;
|
||||
font-style: italic;
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 9px;
|
||||
border-width: 0px;
|
||||
margin-top: -10px;
|
||||
}
|
||||
.sheet-rolltemplate-d10init .sheet-roll-sucess,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-sucess ,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-fail {
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border-width: 0px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-crit {
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border-width: 0px;
|
||||
padding-left: 5px;
|
||||
background-color:#b0d6ad;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-fumble {
|
||||
padding-left: 5px;
|
||||
border-width: 0px;
|
||||
background-color:#d6adad;
|
||||
}
|
||||
.sheet-rolltemplate-d10init .sheet-inline,
|
||||
.sheet-rolltemplate-d10init .inlinerollresult,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-inline,
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
font-weight: bold;
|
||||
padding:0px;
|
||||
font-family: "Times New Roman", Times, serif;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-inline.sheet-fullcrit,
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult.fullcrit {
|
||||
color: #3FB315;
|
||||
border: none;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-inline.sheet-fullfail,
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult.fullfail {
|
||||
color: #B31515;
|
||||
border: none;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult.importantroll {
|
||||
color: #4A57ED;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10fight-blob{
|
||||
border-radius: 6px;
|
||||
border: 1px solid #898989;
|
||||
z-index: 1;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight table{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
text-align: left;
|
||||
width:100%;
|
||||
border:none;
|
||||
cellpadding:3px;
|
||||
cellspacing:0px;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-sum{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border:none;
|
||||
text-align: right;
|
||||
padding-right:10px;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-sucess,
|
||||
.sheet-rolltemplate-d10fight .sheet-line{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 3px;
|
||||
border:none;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-critical{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border:none;
|
||||
padding-left: 3px;
|
||||
border-radius: 4px;
|
||||
background-color:#b0d6ad;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-hit{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 3px;
|
||||
border-radius: 4px;
|
||||
background-color:#b0d6ad;
|
||||
border:none;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-miss{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 3px;
|
||||
border:none;
|
||||
border-radius: 4px;
|
||||
background-color:#d6adad;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-name{
|
||||
padding:0px;
|
||||
padding-left: 3px;
|
||||
margin:0px;
|
||||
border:none;
|
||||
border-radius: 4px;
|
||||
border-bottom-left-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
background-color: #999999;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-additional{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border:none;
|
||||
padding-left:10px;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight-grey{
|
||||
color: #999999;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight-green{
|
||||
color: #009900;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight a,
|
||||
.sheet-rolltemplate-d10fight a[href^="!"],
|
||||
.sheet-rolltemplate-d10fight a[href^="~"]{
|
||||
text-align:right;
|
||||
background-color: #999999; !important
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .sheet-container {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid;
|
||||
padding: 2px;
|
||||
width: 189px;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .sheet-container h1 {
|
||||
color: rgb(126, 45, 64);
|
||||
font-size: 1.2em;
|
||||
font-variant: small-caps;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting div {
|
||||
padding: 2px;
|
||||
};
|
||||
|
||||
.sheet-rolltemplate-d10Shooting span {
|
||||
color: rgb(126, 45, 64);
|
||||
font-family: "Times New Roman", Times, serif;
|
||||
font-size: 1.2em;
|
||||
font-variant: small-caps;
|
||||
line-height: 1.6em;
|
||||
padding-left: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .sheet-subheader {
|
||||
color: #000;
|
||||
font-size: 1em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .sheet-arrow-right {
|
||||
border-bottom: 2px solid transparent;
|
||||
border-left: 180px solid rgb(126, 45, 64);
|
||||
border-top: 2px solid transparent;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .sheet-tcat {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .inlinerollresult {
|
||||
background-color: #ffffff;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .inlinerollresult.fullcrit {
|
||||
color: #3FB315;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .inlinerollresult.fullfail {
|
||||
color: #B31515;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .inlinerollresult.importandivoll {
|
||||
color: #4A57ED;
|
||||
border: none;
|
||||
}
|
||||
|
||||
select.sheet-weapon_type_select{
|
||||
line-height: 0px;
|
||||
margin-bottom:0px;
|
||||
margin: 0px;
|
||||
}
|
||||
label {
|
||||
display: inline;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
div.sheet-row{
|
||||
margin: 0px;
|
||||
padding: 3px;
|
||||
}
|
||||
div.sheet-quickborder{
|
||||
border: 1px solid #ccc;
|
||||
border-color: grey;
|
||||
margin:5px;
|
||||
padding:5px;
|
||||
}
|
||||
div.repeating_ranged-weapon{
|
||||
margin:5px;
|
||||
}
|
||||
"""
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
import generator
|
||||
|
||||
__ALL__=["DISTANCE","MELEE"]
|
||||
|
||||
class DISTANCE(generator.Node):
|
||||
"""DISTANCE Weapons"""
|
||||
|
||||
def __init__(self, name,nb):
|
||||
super(DISTANCE, self).__init__("repeating_ranged-weapons",0)
|
||||
|
||||
def content(self):
|
||||
ret=""" <!--ranged -->
|
||||
<fieldset class="repeating_ranged-weapons">
|
||||
<div class="quickborder">
|
||||
<div class="sheet-row">
|
||||
<input class="sheet-skill_name" type="number" name="attr_wid" title="Numero de ligne" />
|
||||
<input class="sheet-skill_name" type="text" name="attr_ranged_weaponname" title="Nom de l'arme" />
|
||||
<label>P</label>
|
||||
<input type="number" name="attr_ranged_accuracy" title="Précision" />
|
||||
<label>Mode</label>
|
||||
<input type="number" name="attr_ranged_single" title="Coup par coup" />
|
||||
<label>/</label>
|
||||
<input type="number" name="attr_ranged_burst" title="Rafale" />
|
||||
<label>/</label>
|
||||
<input type="number" name="attr_ranged_auto" title="Automatique" />
|
||||
</div>
|
||||
<div class="sheet-row">
|
||||
<label>Type</label>
|
||||
<input type="text" name="attr_typename" title="Type d'arme" />
|
||||
<select class="sheet-weapon_type_select" name="attr_ranged_type_select">
|
||||
<option value="@{combat_skilllevel_armesdassaut}">Arme d'Assaut</option>
|
||||
<option value="@{combat_skilllevel_armesdepoing}">Arme de Poing</option>
|
||||
<option value="@{combat_skilllevel_munitionssolide}">Munitions Solides</option>
|
||||
<option value="@{combat_skilllevel_projectilesbalistiques}">Arme Balistique</option>
|
||||
<option value="@{combat_skilllevel_projectilesautopropulss}">Projectile Autopropulsé</option>
|
||||
<option value="@{combat_skilllevel_armementlaser}">Armement Laser</option>
|
||||
<option value="@{combat_skilllevel_guidagedemissiles}">Guidage de Missiles</option>
|
||||
<option value="@{combat_skilllevel_balistique}">Balistique Superlative</option>
|
||||
<option value="0">Aucune spécialité</option>
|
||||
</select>
|
||||
<button type='roll' class="sheet-skillbutton" title ="Dégats" value="&{template:d10Shooting} {{name=@{ranged_weaponname}}} {{subtags=@{typename}}} {{damagedone=[[(?{Sucesses}-1)*@{ranged_dmgPlus}+@{ranged_dmgBase}]]}} {{magsize=@{ranged_magT}}} {{ammocurrent=@{ranged_magA}}} {{ammototal=@{ranged_ammoT}}}">Dégats</button>
|
||||
<button type='roll' class="sheet-skillbutton" title ="Rechargement" value="/em reloads the @{ranged_weaponname} loosing @{ranged_magA} ammo in the process. !setattr --name @{character_name} --repeating_ranged-weapons_$@{wid}_ranged_magA|[[{@{ranged_magT},@{ranged_ammoT}}kl1]] --repeating_ranged-weapons_$@{wid}_ranged_ammoT|[[{0,@{ranged_ammoT}-@{ranged_magT}}kh1]]">Rechargement</button>
|
||||
</div>
|
||||
<div class="sheet-row">
|
||||
<label>Chargeur</label>
|
||||
<input type="number" name="attr_ranged_magA" title="Chargeur Actuel" />
|
||||
<label>/</label>
|
||||
<input type="number" name="attr_ranged_magT" title="Chargeur Total" />
|
||||
<label>|</label>
|
||||
<input type="number" name="attr_ranged_ammoT" title="Munitions Totales" />
|
||||
<label>Dégats</label>
|
||||
<input type="number" name="attr_ranged_dmgBase" title="Dégats base" />
|
||||
<label>/</label>
|
||||
<input type="number" name="attr_ranged_dmgPlus" title="Dégats additionels" />
|
||||
<label>Spécial</label>
|
||||
<input type="text" name="attr_ranged_special" title="Spécial" />
|
||||
<button type='roll' class="sheet-skillbutton" title ="Tir simple" value="&{template:d10Shooting}{{name=@{ranged_weaponname}}}{{subtags=@{typename}}} {{attack=[[?{Dices}d10<[[@{ranged_type_select}+?{Seuil|4}+@{ranged_accuracy}]]cs1cf11]]}} {{mode=Single Shot}} {{damage=@{ranged_dmgBase}/+@{ranged_dmgPlus}}} {{usedammo=@{ranged_single}}} {{magsize=@{ranged_magT}}} {{ammocurrent=[[@{ranged_magA}-@{ranged_single}]]}} {{ammototal=@{ranged_ammoT}}} {{special=@{ranged_special}}} !modattr --name @{character_name} --repeating_ranged-weapons_$@{wid}_ranged_magA|-@{ranged_single}!!!">S</button>
|
||||
<button type='roll' class="sheet-skillbutton" title ="Rafale" value="&{template:d10Shooting}{{name=@{ranged_weaponname}}}{{subtags=@{typename}}} {{attack=[[[[?{Dices}+1]]d10<[[@{ranged_type_select}+?{Seuil|4}+@{ranged_accuracy}]]cs1cf11]]}} {{mode=Burst}} {{damage=@{ranged_dmgBase}/@{ranged_dmgPlus}}} {{usedammo=@{ranged_burst}}} {{magsize=@{ranged_magT}}} {{ammocurrent=[[@{ranged_magA}-@{ranged_burst}]]}} {{ammototal=@{ranged_ammoT}}} {{special=@{ranged_special}}} !modattr --name @{character_name} --repeating_ranged-weapons_$@{wid}_ranged_magA|-@{ranged_burst}!!!">B</button>
|
||||
<button type='roll' class="sheet-skillbutton" title ="Automatique" value="&{template:d10Shooting}{{name=@{ranged_weaponname}}}{{subtags=@{typename}}} {{attack=[[?{Dices}d10<[[@{ranged_type_select}+?{Seuil|4}+@{ranged_accuracy}]]cs1cf11]]}} {{mode=Auto}} {{damage=@{ranged_dmgBase}/@{ranged_dmgPlus}}} {{usedammo=@{ranged_auto}}} {{magsize=@{ranged_magT}}} {{ammocurrent=[[@{ranged_magA}-@{ranged_auto}]]}} {{ammototal=@{ranged_ammoT}}} {{special=@{ranged_special}}} !modattr --name @{character_name} --repeating_ranged-weapons_$@{wid}_ranged_magA|-@{ranged_auto}!!!">A</button>
|
||||
</div> </div>
|
||||
</fieldset>
|
||||
"""
|
||||
return ret
|
||||
|
||||
|
||||
class MELEE(generator.Node):
|
||||
"""MELEE Weapons"""
|
||||
|
||||
def __init__(self, name,nb):
|
||||
super(MELEE, self).__init__(name,nb)
|
||||
|
||||
def content(self):
|
||||
ret=""" <!-- Melée -->
|
||||
<fieldset class="repeating_melee-weapons">
|
||||
<div class="quickborder">
|
||||
<div class="sheet-row">
|
||||
<input class="sheet-skill_name" type="number" name="attr_wid" title="Numero de ligne" />
|
||||
<input class="sheet-skill_name" type="text" name="attr_melee_weaponname" title="Nom de l'arme" />
|
||||
<label>P</label>
|
||||
<input type="number" name="attr_melee_accuracy" title="Précision" />
|
||||
</div>
|
||||
<div class="sheet-row">
|
||||
<label>Type</label>
|
||||
<input type="text" name="attr_typename" title="Type d'arme" />
|
||||
<select class="sheet-weapon_type_select" name="attr_melee_type_select">
|
||||
<option value="@{combat_skilllevel_armescontandantes}">Arme Contandante</option>
|
||||
<option value="@{combat_skilllevel_armestranchantes}">Arme Tranchante</option>
|
||||
<option value="0">Aucune spécialité</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="sheet-row">
|
||||
<label>Dégats</label>
|
||||
<input type="number" name="attr_melee_dmgBase" title="Dégats base" />
|
||||
<label>/</label>
|
||||
<input type="number" name="attr_melee_dmgPlus" title="Dégats additionels" />
|
||||
<label>Spécial</label>
|
||||
<input type="text" name="attr_melee_special" title="Spécial" />
|
||||
<button type='roll' class="sheet-skillbutton" title ="Attaque" value="&{template:d10Shooting}{{name=@{melee_weaponname}}}{{subtags=@{typename}}} {{attack=[[?{Dices}d10<[[@{melee_type_select}+?{Seuil|4}+@{melee_accuracy}]]cs1cf11]]}} {{damage=@{melee_dmgBase}/+@{melee_dmgPlus}}} {{special=@{melee_special}}}">Attaque</button>
|
||||
<button type='roll' class="sheet-skillbutton" title ="Dégats" value="&{template:d10Shooting}{{name=@{melee_weaponname}}}{{subtags=@{typename}}} {{damagedone=[[(?{Sucesses}-1)*@{melee_dmgPlus}+@{melee_dmgBase}]]}}">Dégats</button>
|
||||
</div> </div>
|
||||
</fieldset>
|
||||
"""
|
||||
return ret
|
||||
|
||||
class CONSOMMABLE(generator.Node):
|
||||
"""CONSUMMABLES"""
|
||||
|
||||
def __init__(self, name,nb):
|
||||
super(CONSOMMABLE, self).__init__(name,nb)
|
||||
|
||||
def content(self):
|
||||
return """ <fieldset class="repeating_consumables">
|
||||
<div class="quickborder">
|
||||
<div class="sheet-row">
|
||||
<input class="sheet-skill_name" type="number" name="attr_wid" title="Numero de ligne" />
|
||||
<input class="sheet-skill_name" type="text" style="width:250px" name="attr_consumable_name" title="Nom du consommable" />
|
||||
<input class="sheet-skill_name" type="text" style="width:200px" name="attr_consumable_type" title="Type de consommable" />
|
||||
<label>Nb</label>
|
||||
<input type="number" name="attr_consumable_nb" title="Quantité" />
|
||||
<button type='roll' class="sheet-skillbutton" title ="Utilisation" value="&{template:d10Shooting}{{name=@{consumable_name}}}{{subtags=@{consumable_type}}} {{special=@{consumable_effect}}} !modattr --name @{character_name} --repeating_consumables_$@{wid}_consumable_nb|-1!!!">Utiliser</button>
|
||||
</div>
|
||||
<div class="sheet-row">
|
||||
<input type="text" style="" name="attr_consumable_effect" style="width:100%" title="Description (short)" />
|
||||
</div> </div>
|
||||
</fieldset>
|
||||
"""
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
@ Physique
|
||||
+ Combat
|
||||
= Armes à feu
|
||||
- ⇥ Armes d'assaut
|
||||
- ⇥ Armes de poing
|
||||
= Armes Lourdes
|
||||
- ⇥ Munitions solide
|
||||
- ⇥ Projectiles autopropulsés
|
||||
- ⇥ Armement laser
|
||||
= Artillerie
|
||||
- ⇥ Projectiles balistiques
|
||||
- ⇥ Guidage de missiles
|
||||
- ⇥ Systemes de défences
|
||||
- ⇥ Balistique superlative
|
||||
= Combat à Mains Nues
|
||||
- ⇥ Neo Kwon Do
|
||||
- ⇥ Zero-G
|
||||
= Combat Armé
|
||||
- ⇥ Armes Contandantes
|
||||
- ⇥ Armes Tranchantes
|
||||
= Maniement des Explosifs
|
||||
|
||||
+ Physiques
|
||||
= Athlétisme
|
||||
- ⇥ Aerien
|
||||
- ⇥ Terrestre
|
||||
- ⇥ Maritime
|
||||
- ⇥ Zero G
|
||||
= Survie
|
||||
- ⇥ Environnement Sauvage
|
||||
- ⇥ Environnement Urbain
|
||||
- ⇥ Environnement Spacial
|
||||
|
||||
+ Implants
|
||||
= Utilisation de Cyberware
|
||||
- ⇥ Utilisation de Neuro Accelerateurs
|
||||
- ⇥ Utilisation d'Interfaces de tir
|
||||
- ⇥ Overdrive Physique
|
||||
|
||||
+ Pilotage
|
||||
= Pilotage athmosphérique
|
||||
- ⇥ Pilotage de Chasseurs
|
||||
- ⇥ Pilotage de Navettes
|
||||
= Vehicules Terestres
|
||||
- ⇥ Vehicules Legers
|
||||
- ⇥ Vehicules Lourds
|
||||
- ⇥ Véhicules de Course
|
||||
= Vaisseaux Spatiaux
|
||||
- ⇥ Batiments légers
|
||||
- ⇥ Batiments lourds
|
||||
- ⇥ Batiments super lourds
|
||||
|
||||
@ Intelectuelles
|
||||
+ Techniques
|
||||
= Biotech
|
||||
- ⇥ Chirurgie d’implants
|
||||
= Electronique
|
||||
- ⇥ Interconnection des systèmes
|
||||
- ⇥ Verrous magnétiques
|
||||
= Informatique
|
||||
- ⇥ Hardware
|
||||
- ⇥ Software
|
||||
- ⇥ Systèmes embarqués
|
||||
= Mécanique
|
||||
- ⇥ Réacteurs à Fusion
|
||||
- ⇥ Réacteurs à Fission
|
||||
- ⇥ Compensateurs d'Inertie
|
||||
- ⇥ Technologie Lightfold
|
||||
- ⇥ Systèmes de Survie
|
||||
- ⇥ Systemes de Propultion
|
||||
= Prospection stellaire
|
||||
- ⇥ Corps stellaires
|
||||
- ⇥ Excavation planetaire
|
||||
|
||||
+ Connaissances
|
||||
= Bioware
|
||||
- ⇥ Implants Céphaliens
|
||||
- ⇥ Implants Corporels
|
||||
= Médecine
|
||||
- ⇥ Soins Intensifs
|
||||
- ⇥ Cybernetisation
|
||||
= Sciences
|
||||
- ⇥ Astromathématiques
|
||||
- ⇥ Biologie
|
||||
- ⇥ Xenobiologie
|
||||
- ⇥ Mathématiques
|
||||
- ⇥ Physique/Chimie
|
||||
- ⇥ Lightfold
|
||||
- ⇥ Sociologie
|
||||
|
||||
+ Culture Générale
|
||||
= Instruction Civique
|
||||
- ⇥ Administratif/Politique/Droit
|
||||
- ⇥ Finances
|
||||
- ⇥ Psychologie
|
||||
= Théorie Militaire
|
||||
- ⇥ Tactique
|
||||
- ⇥ Stratégie
|
||||
|
||||
@ Social
|
||||
+ Sociales
|
||||
= Etiquette
|
||||
- ⇥ Alpha Centauri
|
||||
- ⇥ Eridani
|
||||
- ⇥ Banard
|
||||
- ⇥ Tau
|
||||
- ⇥ Sirius
|
||||
- ⇥ C.I.C.
|
||||
- ⇥ Sol
|
||||
- ⇥ Pègre
|
||||
= Interrogation
|
||||
- ⇥ Intimidation
|
||||
= Commandement
|
||||
= Négociation
|
||||
= Baratin
|
||||
|
||||
+ Clandestines
|
||||
= Discretion
|
||||
= Crochetage
|
||||
= Informations
|
||||
= Larcin
|
||||
= Marchés noirs
|
||||
- ⇥ Acquisition d’Objets
|
||||
- ⇥ Acquisition d’Informations
|
||||
|
||||
+ Contacts
|
||||
. Contacts
|
||||
|
||||
@ Arsenal
|
||||
+ Distance
|
||||
# DISTANCE
|
||||
+ Melée
|
||||
# MELEE
|
||||
+ Consommable
|
||||
# CONSOMMABLE
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,373 @@
|
|||
div.sheet-tab-content { display: none; }
|
||||
input.sheet-tab1:checked ~ div.sheet-tab1,
|
||||
input.sheet-tab2:checked ~ div.sheet-tab2,
|
||||
input.sheet-tab3:checked ~ div.sheet-tab3,
|
||||
input.sheet-tab4:checked ~ div.sheet-tab4
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
|
||||
input.sheet-secondary_physique_tab1:checked ~ div.sheet-secondary_physique_tab1,
|
||||
input.sheet-secondary_physique_tab2:checked ~ div.sheet-secondary_physique_tab2,
|
||||
input.sheet-secondary_physique_tab3:checked ~ div.sheet-secondary_physique_tab3,
|
||||
input.sheet-secondary_physique_tab4:checked ~ div.sheet-secondary_physique_tab4
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
input.sheet-secondary_intelectuelles_tab1:checked ~ div.sheet-secondary_intelectuelles_tab1,
|
||||
input.sheet-secondary_intelectuelles_tab2:checked ~ div.sheet-secondary_intelectuelles_tab2,
|
||||
input.sheet-secondary_intelectuelles_tab3:checked ~ div.sheet-secondary_intelectuelles_tab3
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
input.sheet-secondary_social_tab1:checked ~ div.sheet-secondary_social_tab1,
|
||||
input.sheet-secondary_social_tab2:checked ~ div.sheet-secondary_social_tab2,
|
||||
input.sheet-secondary_social_tab3:checked ~ div.sheet-secondary_social_tab3
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
input.sheet-secondary_arsenal_tab1:checked ~ div.sheet-secondary_arsenal_tab1,
|
||||
input.sheet-secondary_arsenal_tab2:checked ~ div.sheet-secondary_arsenal_tab2,
|
||||
input.sheet-secondary_arsenal_tab3:checked ~ div.sheet-secondary_arsenal_tab3
|
||||
{
|
||||
display: block;
|
||||
}input.sheet-tab{
|
||||
-moz-appearance: none;
|
||||
width:150px;
|
||||
height: 20px;
|
||||
top: 5px;
|
||||
left: 6px;
|
||||
margin: 5px;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
content: attr(title);
|
||||
}
|
||||
input.sheet-tab::before{
|
||||
-moz-appearance: none;
|
||||
content: attr(title);
|
||||
border-radius:.5em;
|
||||
border:2px solid black;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
background: black;
|
||||
color:white;
|
||||
width: 150px;
|
||||
height: 20px;
|
||||
font-size: 18px;
|
||||
}
|
||||
input.sheet-tab:checked::before{
|
||||
-moz-appearance: none;
|
||||
background:#CCCCCC;
|
||||
color:black;
|
||||
border-radius:.5em;
|
||||
border:2px solid black;
|
||||
}
|
||||
|
||||
input.sheet-small_tab{
|
||||
-moz-appearance: none;
|
||||
width:120px;
|
||||
height: 20px;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
margin:5px;
|
||||
}
|
||||
input.sheet-small_tab::before{
|
||||
-moz-appearance: none;
|
||||
content: attr(title);
|
||||
border-radius:.5em;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
color:white;
|
||||
background:black;
|
||||
border:2px solid black;
|
||||
width: 120px;
|
||||
height:20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
input.sheet-small_tab:checked::before{
|
||||
-moz-appearance: none;
|
||||
border:2px solid black;
|
||||
background:#CCCCCC;
|
||||
color:black;
|
||||
border-radius:.5em;
|
||||
}
|
||||
|
||||
input.sheet-skill_name{
|
||||
-moz-appearance: none;
|
||||
width:400px;
|
||||
}
|
||||
input.sheet-skill_hidden{
|
||||
visibility: hidden;
|
||||
}
|
||||
div.sheet-tab-content{
|
||||
border-top-color: #000;
|
||||
margin: 2px 0 0 0;
|
||||
}
|
||||
select.sheet-skill_select{
|
||||
width:55px;
|
||||
margin-bottom:-1px;
|
||||
}
|
||||
select.sheet-dice_select{
|
||||
width:85px;
|
||||
margin-bottom:-1px;
|
||||
}
|
||||
.sheet-trait{
|
||||
width: 30px;
|
||||
}
|
||||
.sheet-numberbox {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10init table,
|
||||
.sheet-rolltemplate-d10skillcheck table {
|
||||
border-radius: 6px;
|
||||
width:100%;
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding: 2px;
|
||||
border: 1px solid;
|
||||
background-color: #ffffff;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #000;
|
||||
border-image-source: none;
|
||||
}
|
||||
.sheet-rolltemplate-d10init .sheet-roll-title,
|
||||
.sheet-rolltemplate-d10init th,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-title,
|
||||
.sheet-rolltemplate-d10skillcheck th {
|
||||
color: rgb(42, 42, 42);
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 5px;
|
||||
font-size: 1.2em;
|
||||
text-align: left;
|
||||
font-family: "Times New Roman", Times, serif;
|
||||
font-variant: small-caps;
|
||||
text-transform: capitalize;
|
||||
border-width: 0px;
|
||||
}
|
||||
.sheet-rolltemplate-d10init .sheet-roll-attr,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-attr{
|
||||
color: #555555;
|
||||
font-size: 1em;
|
||||
font-style: italic;
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 9px;
|
||||
border-width: 0px;
|
||||
margin-top: -10px;
|
||||
}
|
||||
.sheet-rolltemplate-d10init .sheet-roll-sucess,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-sucess ,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-fail {
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border-width: 0px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-crit {
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border-width: 0px;
|
||||
padding-left: 5px;
|
||||
background-color:#b0d6ad;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-fumble {
|
||||
padding-left: 5px;
|
||||
border-width: 0px;
|
||||
background-color:#d6adad;
|
||||
}
|
||||
.sheet-rolltemplate-d10init .sheet-inline,
|
||||
.sheet-rolltemplate-d10init .inlinerollresult,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-inline,
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
font-weight: bold;
|
||||
padding:0px;
|
||||
font-family: "Times New Roman", Times, serif;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-inline.sheet-fullcrit,
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult.fullcrit {
|
||||
color: #3FB315;
|
||||
border: none;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-inline.sheet-fullfail,
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult.fullfail {
|
||||
color: #B31515;
|
||||
border: none;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult.importantroll {
|
||||
color: #4A57ED;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10fight-blob{
|
||||
border-radius: 6px;
|
||||
border: 1px solid #898989;
|
||||
z-index: 1;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight table{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
text-align: left;
|
||||
width:100%;
|
||||
border:none;
|
||||
cellpadding:3px;
|
||||
cellspacing:0px;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-sum{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border:none;
|
||||
text-align: right;
|
||||
padding-right:10px;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-sucess,
|
||||
.sheet-rolltemplate-d10fight .sheet-line{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 3px;
|
||||
border:none;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-critical{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border:none;
|
||||
padding-left: 3px;
|
||||
border-radius: 4px;
|
||||
background-color:#b0d6ad;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-hit{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 3px;
|
||||
border-radius: 4px;
|
||||
background-color:#b0d6ad;
|
||||
border:none;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-miss{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 3px;
|
||||
border:none;
|
||||
border-radius: 4px;
|
||||
background-color:#d6adad;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-name{
|
||||
padding:0px;
|
||||
padding-left: 3px;
|
||||
margin:0px;
|
||||
border:none;
|
||||
border-radius: 4px;
|
||||
border-bottom-left-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
background-color: #999999;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-additional{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border:none;
|
||||
padding-left:10px;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight-grey{
|
||||
color: #999999;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight-green{
|
||||
color: #009900;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight a,
|
||||
.sheet-rolltemplate-d10fight a[href^="!"],
|
||||
.sheet-rolltemplate-d10fight a[href^="~"]{
|
||||
text-align:right;
|
||||
background-color: #999999; !important
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .sheet-container {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid;
|
||||
padding: 2px;
|
||||
width: 189px;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .sheet-container h1 {
|
||||
color: rgb(126, 45, 64);
|
||||
font-size: 1.2em;
|
||||
font-variant: small-caps;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting div {
|
||||
padding: 2px;
|
||||
};
|
||||
|
||||
.sheet-rolltemplate-d10Shooting span {
|
||||
color: rgb(126, 45, 64);
|
||||
font-family: "Times New Roman", Times, serif;
|
||||
font-size: 1.2em;
|
||||
font-variant: small-caps;
|
||||
line-height: 1.6em;
|
||||
padding-left: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .sheet-subheader {
|
||||
color: #000;
|
||||
font-size: 1em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .sheet-arrow-right {
|
||||
border-bottom: 2px solid transparent;
|
||||
border-left: 180px solid rgb(126, 45, 64);
|
||||
border-top: 2px solid transparent;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .sheet-tcat {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .inlinerollresult {
|
||||
background-color: #ffffff;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .inlinerollresult.fullcrit {
|
||||
color: #3FB315;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .inlinerollresult.fullfail {
|
||||
color: #B31515;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10Shooting .inlinerollresult.importandivoll {
|
||||
color: #4A57ED;
|
||||
border: none;
|
||||
}
|
||||
|
||||
select.sheet-weapon_type_select{
|
||||
line-height: 0px;
|
||||
margin-bottom:0px;
|
||||
margin: 0px;
|
||||
}
|
||||
label {
|
||||
display: inline;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
div.sheet-row{
|
||||
margin: 0px;
|
||||
padding: 3px;
|
||||
}
|
||||
div.sheet-quickborder{
|
||||
border: 1px solid #ccc;
|
||||
border-color: grey;
|
||||
margin:5px;
|
||||
padding:5px;
|
||||
}
|
||||
div.repeating_ranged-weapon{
|
||||
margin:5px;
|
||||
}
|
||||
|
|
@ -0,0 +1,250 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
# content skills sections and others from a file, on the long run, it should be able to content the whole sheet
|
||||
|
||||
import argparse, sys, os
|
||||
import string
|
||||
# from unidecode import unidecode
|
||||
# import unicode
|
||||
|
||||
def remove_non_ascii(text):
|
||||
return "".join([c for c in text if c in string.ascii_letters]).strip(" ")
|
||||
# return unidecode(text)
|
||||
|
||||
class Node(object):
|
||||
"""Generic Node."""
|
||||
def __init__(self, name,nb):
|
||||
self.name = name#name.strip(" ")
|
||||
self.number=nb
|
||||
self.children=[]
|
||||
self.checked=""
|
||||
self.parent=None
|
||||
self.pname=u""+remove_non_ascii(self.name.replace(" ","")).lower()
|
||||
if nb==1:
|
||||
self.checked='checked="checked"'
|
||||
|
||||
def content(self):
|
||||
return ""
|
||||
|
||||
def header(self):
|
||||
return ""
|
||||
|
||||
def css(self):
|
||||
return ""
|
||||
|
||||
def addchild(self,child):
|
||||
self.children+=[child]
|
||||
child.parent=self
|
||||
|
||||
class Root(Node):
|
||||
"""docstring for Root."""
|
||||
def __init__(self):
|
||||
super(Root,self).__init__("",0)
|
||||
|
||||
def generate(self):
|
||||
"Return the whole tree, printable"
|
||||
return self.content()
|
||||
|
||||
def content(self):
|
||||
ret=""
|
||||
for child in self.children:
|
||||
ret+=child.header() # Ligne de chaque tab direct, puis tout
|
||||
for child in self.children:
|
||||
ret+=child.content()
|
||||
ret+="</div>\n"
|
||||
return ret
|
||||
|
||||
def css(self):
|
||||
"Return the whole css, printable"
|
||||
ret="div.sheet-tab-content { display: none; }"
|
||||
for child in self.children:
|
||||
ret+="\ninput.sheet-tab{node.number}:checked ~ div.sheet-tab{node.number},".format(node=child)
|
||||
ret=ret[:-1]
|
||||
ret+="\n{\n display: block;\n}\n"
|
||||
for child in self.children:
|
||||
ret+=child.css()
|
||||
return ret
|
||||
|
||||
class Tab(Node):
|
||||
"""Tab node, contains"""
|
||||
def __init__(self, name,nb):
|
||||
super(Tab, self).__init__(name,nb)
|
||||
|
||||
def header(self): # Comes first
|
||||
return '<input type="radio" name="attr_tab" class="sheet-tab sheet-tab{self.number}" value="{self.number}" title="{self.name}" {self.checked}/><span></span>\n'.format(self=self)
|
||||
|
||||
def content(self):
|
||||
ret='<!-- {self.pname} -->\n<div class="sheet-tab-content sheet-tab{self.number}">\n'.format(self=self) # And add all content
|
||||
for child in self.children:
|
||||
ret+=child.header()
|
||||
for child in self.children:
|
||||
ret+=child.content()
|
||||
return ret
|
||||
|
||||
def css(self):
|
||||
ret=" "
|
||||
for child in self.children:
|
||||
ret+="\ninput.sheet-secondary_{node.pname}_tab{child.number}:checked ~ div.sheet-secondary_{node.pname}_tab{child.number},".format(child=child,node=self)
|
||||
ret=ret[:-1]
|
||||
ret+="\n{\n display: block;\n}"
|
||||
return ret
|
||||
|
||||
class SubTab(Node):
|
||||
def __init__(self,name,nb):
|
||||
super(SubTab,self).__init__(name,nb)
|
||||
|
||||
def header(self):
|
||||
return """ <input type="radio" name="secondary_{self.parent.pname}_tab" class="small_tab secondary_{self.parent.pname}_tab{self.number}" value="{self.number}" {self.checked} title="{self.name}" />\n""".format(self=self)
|
||||
|
||||
def content(self):
|
||||
ret= ' <div class="sheet-tab-content sheet-secondary_{self.parent.pname}_tab{self.number}">\n'.format(self=self)
|
||||
ret+=" <!-- {self.name} -->\n <h3>{self.name}</h3>\n".format(self=self)
|
||||
for child in self.children:
|
||||
ret+=child.content()
|
||||
ret+=" </div>\n"
|
||||
return ret
|
||||
def css(self):
|
||||
return ""
|
||||
|
||||
class Skill(Node):
|
||||
"""Print a skill."""
|
||||
def __init__(self, name,nb):
|
||||
super(Skill, self).__init__(name,nb)
|
||||
|
||||
def content(self): # {self.parent.pname} is not needed, else _skilllevel_ cause a confict, legacy keeping I guess ?
|
||||
ret=""" <!--{self.name} -->
|
||||
<input class="sheet-skill_name" style="margin-right: 4px;" type="text" name="attr_{self.parent.pname}_skill_{self.pname}" disabled="true" value="{self.name}" />
|
||||
<input type="number" min="0" value="0" name="attr_{self.parent.pname}_skillcost_{self.pname}" title="Coût de la compétence" />
|
||||
<input class="sheet-skill_name" value="0" style="margin-right: 4px;" type="number" min="0" max="10" name="attr_{self.parent.pname}_skilllevel_{self.pname}" title="Niveau dans la compétence" />
|
||||
<select class="sheet-skill_select" style="margin-right:4px" name="attr_skill_{self.parent.pname}_attribute_select_{self.pname}">
|
||||
<option value="@{{base-Force}} + @{{exal-Force}}">For</option>
|
||||
<option value="@{{base-Agilite}} + @{{exal-Agilite}}">Agi</option>
|
||||
<option value="@{{base-Perception}} + @{{exal-Perception}}">Per</option>
|
||||
<option value="@{{base-Charisme}} + @{{exal-Charisme}}">Cha</option>
|
||||
<option value="@{{base-Intelligence}} + @{{exal-Intelligence}}">Int</option>
|
||||
<option value="@{{base-Perception}} + @{{exal-Perception}}">Per</option>
|
||||
<option value="@{{base-Volonte}} + @{{exal-Volonte}}">Vol</option>
|
||||
<option value="@{{base-Psyche}} + @{{exal-Psyche}}">Psy</option>
|
||||
<option value="@{{base-Chance}} + @{{exal-Chance}}">Chn</option>
|
||||
</select>
|
||||
<button type='roll' class="sheet-skillbutton" value="&{{template:d10skillcheck}} {{{{name=@{{character_name}}}}}} {{{{roll_name=@{{{self.parent.pname}_skill_{self.pname}}}}}}} {{{{dice_name=@{{dice}}}}}} {{{{result=[[@{{{self.parent.pname}_skilllevel_{self.pname}}}+(@{{skill_{self.parent.pname}_attribute_select_{self.pname}}})-d@{{dice}}cs1cf@{{dice}}]]}}}} {{{{threshold=[[@{{{self.parent.pname}_skilllevel_{self.pname}}}+(@{{skill_{self.parent.pname}_attribute_select_{self.pname}}})]]}}}}"></button>
|
||||
<br/>\n""".format(self=self)
|
||||
return ret
|
||||
|
||||
class SubSkill(Node):
|
||||
"""Print a subskill."""
|
||||
def __init__(self, name,nb,superskill):
|
||||
super(SubSkill, self).__init__(name,nb)
|
||||
self.superskill=superskill
|
||||
print(name,superskill.pname)
|
||||
def content(self): # {self.parent.pname} is not needed, else _skilllevel_ cause a confict, legacy keeping I guess ?
|
||||
ret=""" <!--{self.name} -->
|
||||
<input class="sheet-skill_name" style="margin-right: 4px;" type="text" name="attr_{self.parent.pname}_skill_{self.pname}" disabled="true" value="{self.name}" />
|
||||
<input type="number" min="0" value="0" name="attr_{self.parent.pname}_skillcost_{self.pname}" title="Coût de la compétence" />
|
||||
<input class="sheet-skill_name" value="0" style="margin-right: 4px;" type="number" min="0" max="10" name="attr_{self.parent.pname}_skilllevel_{self.pname}" title="Niveau dans la compétence" />
|
||||
<select class="sheet-skill_select" style="margin-right:4px" name="attr_skill_{self.parent.pname}_attribute_select_{self.pname}">
|
||||
<option value="@{{base-Force}} + @{{exal-Force}}">For</option>
|
||||
<option value="@{{base-Agilite}} + @{{exal-Agilite}}">Agi</option>
|
||||
<option value="@{{base-Perception}} + @{{exal-Perception}}">Per</option>
|
||||
<option value="@{{base-Charisme}} + @{{exal-Charisme}}">Cha</option>
|
||||
<option value="@{{base-Intelligence}} + @{{exal-Intelligence}}">Int</option>
|
||||
<option value="@{{base-Perception}} + @{{exal-Perception}}">Per</option>
|
||||
<option value="@{{base-Volonte}} + @{{exal-Volonte}}">Vol</option>
|
||||
<option value="@{{base-Psyche}} + @{{exal-Psyche}}">Psy</option>
|
||||
<option value="@{{base-Chance}} + @{{exal-Chance}}">Chn</option>
|
||||
</select>
|
||||
<button type='roll' class="sheet-skillbutton" value="&{{template:d10skillcheck}} {{{{name=@{{character_name}}}}}} {{{{roll_name=@{{{self.parent.pname}_skill_{self.pname}}}}}}} {{{{dice_name=@{{dice}}}}}} {{{{result=[[@{{{self.parent.pname}_skilllevel_{self.pname}}}+(@{{skill_{self.parent.pname}_attribute_select_{self.pname}}}+@{{{self.parent.pname}_skilllevel_{self.superskill.pname}}})-d@{{dice}}cs1cf@{{dice}}]]}}}} {{{{threshold=[[@{{{self.parent.pname}_skilllevel_{self.pname}}}+@{{{self.parent.pname}_skilllevel_{self.superskill.pname}}}+(@{{skill_{self.parent.pname}_attribute_select_{self.pname}}})]]}}}}"></button>
|
||||
<br/>\n""".format(self=self)
|
||||
return ret
|
||||
|
||||
class Repeating(Node):
|
||||
"""Repeating section"""
|
||||
|
||||
def __init__(self, name,nb):
|
||||
super(Repeating, self).__init__(name,nb)
|
||||
|
||||
def content(self):
|
||||
ret=""" <!-- {node.pname} -->
|
||||
<fieldset class="repeating_{node.pname}-skills">
|
||||
<input class="sheet-skill_name" type="text" name="attr_{node.pname}_skillname" />
|
||||
<input type="number" name="attr_{node.pname}_skillcost" title="Coût de la compétence" />
|
||||
<input type="number" min="-10" max="10" name="attr_{node.pname}_skilllevel" title="Niveau dans la compétence" />
|
||||
<select class="sheet-skill_select" name="attr_{node.pname}_attribute_select">
|
||||
<option value="@{{base-Force}} + @{{exal-Force}}">For</option>
|
||||
<option value="@{{base-Agilite}} + @{{exal-Agilite}}">Agi</option>
|
||||
<option value="@{{base-Perception}} + @{{exal-Perception}}">Per</option>
|
||||
<option value="@{{base-Charisme}} + @{{exal-Charisme}}">Cha</option>
|
||||
<option value="@{{base-Intelligence}} + @{{exal-Intelligence}}">Int</option>
|
||||
<option value="@{{base-Perception}} + @{{exal-Perception}}">Per</option>
|
||||
<option value="@{{base-Volonte}} + @{{exal-Volonte}}">Vol</option>
|
||||
<option value="@{{base-Psyche}} + @{{exal-Psyche}}">Psy</option>
|
||||
<option value="@{{base-Chance}} + @{{exal-Chance}}">Chn</option>
|
||||
</select>
|
||||
<button type='roll' class="sheet-skillbutton" value="&{{template:d10skillcheck}}\
|
||||
{{{{name=@{{character_name}}}}}}\
|
||||
{{{{roll_name=@{{{node.pname}_skillname}}}}}}\
|
||||
{{{{dice_name=@{{dice}}}}}}\
|
||||
{{{{result=[[@{{{node.pname}_skilllevel}}+(@{{{node.pname}_attribute_select}})-d@{{dice}}cs1cf@{{dice}}]]}}}}\
|
||||
{{{{threshold=[[@{{{node.pname}_skilllevel}}+(@{{{node.pname}_attribute_select}})]]}}}}">\
|
||||
</button>
|
||||
</fieldset>
|
||||
<br/>\n""".format(node=self)
|
||||
return ret
|
||||
|
||||
if __name__ == '__main__':
|
||||
# filen=sys.argv[1]
|
||||
# filen="light.txt"
|
||||
import customs as custom_skills
|
||||
filen="cyberpnk.txt"
|
||||
output="gent.html"
|
||||
outcss="gencss.css"
|
||||
def parse(filen):
|
||||
root=Root()
|
||||
active_tab,active_subtab=None,None
|
||||
tab_nb,subtab_nb,skill_nb,repeating_nb=1,1,1,1
|
||||
mainskill=None
|
||||
try:
|
||||
with open(filen,encoding="utf-8") as f:
|
||||
for line in f.readlines():
|
||||
if line[0]=="@": # Tab
|
||||
active_tab=Tab(line[1:-1],tab_nb)
|
||||
root.addchild(active_tab)
|
||||
tab_nb+=1
|
||||
subtab_nb=1
|
||||
elif line[0]=="+":
|
||||
active_subtab=SubTab(line[1:-1],subtab_nb)
|
||||
active_tab.addchild(active_subtab)
|
||||
subtab_nb+=1
|
||||
skill_nb=1
|
||||
elif line[0]=="=":
|
||||
tech_content=Skill(line[1:-1],skill_nb)
|
||||
active_subtab.addchild(tech_content)
|
||||
mainskill=tech_content
|
||||
skill_nb+=1
|
||||
elif line[0]=="-":
|
||||
tech_content=SubSkill(line[1:-1],skill_nb,mainskill)
|
||||
active_subtab.addchild(tech_content)
|
||||
skill_nb+=1
|
||||
elif line[0]==".":
|
||||
tech_content=Repeating(line[1:-1],repeating_nb)
|
||||
active_subtab.addchild(tech_content)
|
||||
repeating_nb+=1
|
||||
elif line[0]=="#":
|
||||
skill=custom_skills.__getattribute__(line[2:-1])("","")
|
||||
active_subtab.addchild(skill)
|
||||
repeating_nb+=1 # ???
|
||||
except FileNotFoundError:
|
||||
print(filen,"was not found")
|
||||
return root
|
||||
root=parse(filen)
|
||||
import base
|
||||
with open(output,"w",encoding="utf-8") as f:
|
||||
f.write(base.head)
|
||||
f.write(base.script)
|
||||
f.write(base.header)
|
||||
f.write(root.content())
|
||||
f.write(base.footer)
|
||||
with open(outcss,"w",encoding="utf-8") as f:
|
||||
f.write(root.css())
|
||||
f.write(base.css_footer)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
@ Physique
|
||||
+ Combat
|
||||
- Armes à feu
|
||||
+ Soc
|
||||
- Charisme
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 11a1157bd86f0166e43445ab137bb483ec85d71f
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,423 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
# Not actually part of the project; just easier to maintain everything here
|
||||
import importlib
|
||||
import re
|
||||
import sys,os
|
||||
import traceback
|
||||
|
||||
try:
|
||||
# path=os.path.join(os.path.dirname(__file__),"..","minitest")
|
||||
# minitest=importlib.import_module("...minitest.minitest","skill_generator")
|
||||
from minitest import minitest
|
||||
term = minitest.Terminal()
|
||||
from test import testReroll,testInit,testWrapper,testParser
|
||||
|
||||
except ImportError as e:
|
||||
print(e)
|
||||
print("Minitest isn't imported, the system cannot execute test units")
|
||||
|
||||
|
||||
try:
|
||||
args = sys.argv[1:]
|
||||
command = sys.argv[1]
|
||||
except:
|
||||
print("No command specified, just outputting the help")
|
||||
command = "help"
|
||||
|
||||
EOL = "\n"
|
||||
tab = " "
|
||||
# Custom parsing
|
||||
ENCAISSEMENT_PARSE = """d_vars.encaissement=to_number(tab[i+1]);
|
||||
d_vars.encaissement_dices="d20";
|
||||
if (tab[i+2]=="4") d_vars.encaissement_dices="d10";
|
||||
i+=3;
|
||||
break;"""
|
||||
|
||||
FLAT_DICES_PARSE = """d_vars.flat_dices[d_vars.nb_flat_dices]=to_p_number(tab[i+1]);
|
||||
d_vars.nb_flat_dices++;
|
||||
i+=2;
|
||||
break;"""
|
||||
|
||||
TECHNIQUE_PARSE = """d_vars.technique_m=to_p_number(tab[i+2]);
|
||||
i+=3;
|
||||
break;"""
|
||||
## Custom adders:
|
||||
lambda_flat_dices = lambda a: "@flat_dices[@flat_dices]=type({tab+1});\n@nb_flat_dices++;"
|
||||
|
||||
## Custom rerolls:
|
||||
|
||||
categories = ['varname', 'Pretty name', 'nb_args', 'type', 'code', 'id', 'default', 'action', 'parser']
|
||||
hashedCategories = {}
|
||||
for c in range(len(categories)):
|
||||
hashedCategories[categories[c]] = c
|
||||
|
||||
|
||||
def findCat(element, category):
|
||||
return element[hashedCategories[category]]
|
||||
|
||||
|
||||
list = []
|
||||
# list.append(['varname','Pretty name','nb_args','type','code','id','default','action','parser'])
|
||||
list.append(['perfection', 'Perfection', 1, 'pint', 'P', 0, 0, "", None])
|
||||
list.append(['defense_i_0', 'Defence impénétrable simple', 2, 'pint', 'I', 1, 0, "", None])
|
||||
list.append(['defense_i_1', 'Defence impénétrable expert', 2, 'pint', 'I', 2, 0, "", None])
|
||||
list.append(['defense_i_2', 'Defence impénétrable meta', 2, 'pint', 'I', 4, 0, "", None])
|
||||
list.append(['rempart_p', 'Rempart parfait', 1, 'pint', 'R', 0, 0, "", None])
|
||||
list.append(['technique_m', 'Perfection', 1, 'pint', 'M', 0, 0, "", TECHNIQUE_PARSE]) # +=3
|
||||
list.append(['coup_d', 'Coup_déchirant', 1, 'pint', 'D', 0, 0, "", None])
|
||||
list.append(['fauchage', 'Fauchage', 1, 'pint', 'F', 0, 0, "", None])
|
||||
list.append(['exploiter_p_0', 'Exploiter_les_points_faibles simple', 2, 'pint', 'E', 1, 0, "", None])
|
||||
list.append(['exploiter_p_1', 'Exploiter_les_points_faibles expert', 2, 'pint', 'E', 2, 0, "", None])
|
||||
list.append(['exploiter_p_2', 'Exploiter_les_points_faibles meta', 2, 'pint', 'E', 4, 0, "", None])
|
||||
list.append(['tir_p_0', 'Tir_précis expert', 2, 'pint', 'T', 2, 0, "", None])
|
||||
list.append(['tir_p_1', 'Tir_précis meta', 2, 'pint', 'T', 4, 0, "", None])
|
||||
list.append(['tir_i', 'Tir_implacable', 1, 'pint', 'i', 0, 0, "", None])
|
||||
list.append(['charge', 'Charge', 1, 'pint', 'C', 0, 0, "", None])
|
||||
list.append(['charge_i', 'Charge_indomptable', 1, 'pint', 'N', 0, 0, "", None])
|
||||
list.append(['nb_2add', 'Nombre à ajouter', 1, 'int', '+', 0, 0, "+", None])
|
||||
list.append(['nb_2sub', 'Nombre a soustraire', 1, 'int', '-', 0, 0, "+", None])
|
||||
list.append(['relances', 'Relances', 1, 'pint', 'r', 0, 0, "", None])
|
||||
list.append(['seuil', 'Seuil', 1, 'pint', 's', 0, 0, "", None])
|
||||
list.append(['action', 'Type d\'Action', 1, 'str', 'a', 0, '""', "", None])
|
||||
list.append(['flat_dices', 'Des fixes', 1, 'pint', 'd', 0, "[]", "+", FLAT_DICES_PARSE])
|
||||
list.append(['on_hit_c', 'Dégats a l\'impact critique', 1, 'int', 'H', 0, 0, "+", None])
|
||||
list.append(['attribute', 'Caractéristique', 1, 'int', 'A', 0, 0, "+", None])
|
||||
list.append(['encaissement', 'Encaissement', 1, 'pint', 'S', 0, 0, "",
|
||||
ENCAISSEMENT_PARSE]) # It's actually 2 args but no switch
|
||||
list.append(['replace', 'Des de substitution', 1, 'int', 'L', 0, -1, "", None])
|
||||
list.append(['add_to_all', 'Valeur d\'ajout aux des', 1, 'int', 'l', 0, 0, "", None])
|
||||
list.append(['max_dices', 'Nombre de des max', 1, 'pint', 'm', 0, -1, "", None])
|
||||
list.append(['player_name', 'Nom du joueur', 1, 'str', 'n', 0, '""', "", None])
|
||||
|
||||
list.append(['crit_level', 'Niveau de critique', 1, 'pint', 'c', 0, 2, "", None])
|
||||
list.append(['transcendence', 'Transcendence', 1, 'pint', 't', 0, 3, "", None])
|
||||
list.append(['pctreceived', 'Pourcentage dégats recus', 1, 'int', 'v', 0, 0, "", None])
|
||||
list.append(['pctinflicted', 'Pourcentage dégats infligés', 1, 'int', 'f', 0, 0, "", None])
|
||||
|
||||
list.append(['nb_dices', 'Nombre de des', 1, 'pint', '', 0, 0, "", None])
|
||||
list.append(['nb_flat_dices', 'Nombre de des fixes', 1, 'pint', '', 0, 0, "", None])
|
||||
list.append(['encaissement_dices', 'Perfection', 1, 'pint', '', 0, '""', "", None])
|
||||
list.append(['results', 'Resultats', 1, 'pint', '', 0, "[]", "", None])
|
||||
list.append(['cleave', 'Fauchage', 1, 'pint', '', 0, "[]", "", None])
|
||||
list.append(['encaissement_result', 'Resultat d\'encaissement', 1, 'pint', '', 0, 0, "", None])
|
||||
list.append(['technique_result', 'Dégats technique martiale', 1, 'int', '', 0, 0, "", None])
|
||||
list.append(['coup_d_results', 'Coup déchirant results', 1, 'pint', '', 0, "[]", "", None])
|
||||
|
||||
|
||||
class megaListWrapper():
|
||||
def __init__(self, table=list):
|
||||
self.table = table
|
||||
self.len = len(table)
|
||||
self.indexes = {}
|
||||
for i in range(len(table)):
|
||||
self.indexes[findCat(table[i], "varname")] = i
|
||||
# Theese are array because you can't acess them directly
|
||||
self.singles = []
|
||||
self.code = []
|
||||
self.doubles = {}
|
||||
for i in table:
|
||||
if findCat(i, 'nb_args') == 1:
|
||||
self.singles.append(i)
|
||||
elif findCat(i, 'nb_args') == 2:
|
||||
n = findCat(i, 'code')
|
||||
if n not in self.doubles:
|
||||
self.doubles[n] = []
|
||||
self.doubles[n].append(i)
|
||||
if findCat(i, 'code') != '':
|
||||
self.code.append(i)
|
||||
|
||||
def __getitem__(self, argument): # Actually return the full line as a list wrapper
|
||||
return listWrapper(self.table[self.indexes[argument]])
|
||||
|
||||
def __iter__(self):
|
||||
for index, key in self.indexes.items():
|
||||
yield self[index]
|
||||
|
||||
def itersingles(self):
|
||||
"Only iterate over the simple argument ones"
|
||||
for index in self.singles:
|
||||
yield self[findCat(index, 'varname')]
|
||||
|
||||
def iterdoubles(self):
|
||||
"Only iterate over the double arguments ones return a table with all"
|
||||
for table in self.doubles.values():
|
||||
yield [self[findCat(l, 'varname')] for l in table]
|
||||
|
||||
def iterdefined(self):
|
||||
"Only iterate over the ones with defined code"
|
||||
pass
|
||||
|
||||
def __contains__(self, val):
|
||||
return val in self.indexes
|
||||
|
||||
def __len__(self):
|
||||
return self.len
|
||||
|
||||
def pprint(self):
|
||||
for e in self:
|
||||
print(e[0], ":", e)
|
||||
|
||||
|
||||
class listWrapper():
|
||||
def __init__(self, list, index=hashedCategories):
|
||||
self.list = list
|
||||
self.indexes = index
|
||||
|
||||
def pprint(self):
|
||||
print(self.list)
|
||||
|
||||
def asList(self):
|
||||
return self.list
|
||||
|
||||
def __len__(self):
|
||||
return len(self.list)
|
||||
|
||||
def __repr__(self):
|
||||
return str(self.list)
|
||||
|
||||
def __getitem__(self, nb):
|
||||
return self.list[nb]
|
||||
|
||||
def __getattr__(self, index):
|
||||
return self.list[self.indexes[index]]
|
||||
|
||||
def __iter__(self):
|
||||
for e in self.list:
|
||||
yield e
|
||||
|
||||
|
||||
## Commands
|
||||
def initialise(args):
|
||||
"Initialise the variables for the switch"
|
||||
text = "var d_vars={"
|
||||
for line in list:
|
||||
text += '"{}":{},'.format(line[0], line[6])
|
||||
text = text[:-1] + '};'
|
||||
return text
|
||||
|
||||
|
||||
def pprint(args):
|
||||
"Print the whole list of values"
|
||||
for i in list:
|
||||
print(i)
|
||||
|
||||
|
||||
def pErrors(name, errors):
|
||||
"Print sucess or error of given test"
|
||||
if errors:
|
||||
print("{:<15}: {} errors occured".format(name, errors))
|
||||
else:
|
||||
print("{:<15}: All test sucessful".format(name))
|
||||
return errors
|
||||
|
||||
|
||||
def reroll(args):
|
||||
"Generate the reroll inline message"
|
||||
|
||||
reroll = "var msg_relance=\"<a class='sheet-rolltemplate-d10fight' href='!crit 0"
|
||||
|
||||
def addZero(name):
|
||||
return '"+d_vars.{}+"'.format(name)
|
||||
|
||||
def addOne(code, name):
|
||||
return ' {} {}'.format(code, addZero(name))
|
||||
|
||||
def addTwo(code, id, name):
|
||||
return ' {} {} {}'.format(code, id, addZero(name))
|
||||
|
||||
def addSimple(wline):
|
||||
if wline.code != "" and wline.code not in ("r", "+", 'M', 'D', "d", "S"):
|
||||
if wline.nb_args == 1:
|
||||
return addOne(wline.code, wline.varname)
|
||||
elif wline.nb_args == 2:
|
||||
return addTwo(wline.code, wline.id, wline.varname)
|
||||
else:
|
||||
# print("{} must be handled differently".format(wline.varname))
|
||||
return ""
|
||||
|
||||
# Actual adding of all the lines
|
||||
for l in wrapper:
|
||||
reroll += addSimple(l)
|
||||
|
||||
# Some lines needs to be added afterwards
|
||||
reroll += ' + "+(d_vars.{}+d_vars.{}+d_vars.{})'.format(wrapper["nb_2add"].varname,
|
||||
wrapper["technique_result"].varname,
|
||||
wrapper["encaissement_result"].varname)
|
||||
|
||||
# Last part of the command
|
||||
reroll += '+" r ?{Relances ?}";\n'
|
||||
reroll += 'for (var i=0,len=d_vars.results.length;i<len;i++) msg_relance+=" d "+d_vars.results[i];\n'
|
||||
reroll += 'msg_relance+="\'>Relancer ce jet</a>";'
|
||||
|
||||
return reroll
|
||||
|
||||
|
||||
def find_code(args):
|
||||
"Find the next available code for given name"
|
||||
try:
|
||||
code = args[1]
|
||||
except:
|
||||
print("One argument expected")
|
||||
return 0
|
||||
listFree = ''
|
||||
for letter in code:
|
||||
Letter = letter.capitalize()
|
||||
free, Free = 1, 1
|
||||
for line in wrapper:
|
||||
if free and letter == line.code:
|
||||
free = 0
|
||||
if Free and Letter == line.code:
|
||||
Free = 0
|
||||
if not free and not Free:
|
||||
break
|
||||
if Free and Letter not in listFree:
|
||||
listFree += Letter
|
||||
if free and letter not in listFree:
|
||||
listFree += letter
|
||||
if listFree:
|
||||
if len(listFree) == 1:
|
||||
return 'The code "{}" is available.'.format(listFree)
|
||||
else:
|
||||
return 'The following codes "{}" are available'.format(listFree)
|
||||
else:
|
||||
print('No letter from name "{}" is available'.format(code))
|
||||
print(find_code([0, "abcdefghijklmnopqrstuvwxyz&_?.§!;"]))
|
||||
|
||||
|
||||
def parser(args):
|
||||
"Generate the argument parser"
|
||||
res = tab + "if (len_args>0){" + EOL
|
||||
res += tab * 2 + "d_vars.nb_dices=to_p_number(tab[0]);" + EOL
|
||||
res += tab + "}" + EOL
|
||||
res += tab + "for (i = 1; i < len_args;) {" + EOL
|
||||
res += tab * 2 + "switch(tab[i]) {" + EOL
|
||||
|
||||
def typewise(type):
|
||||
if type == "pint":
|
||||
return "to_p_number({});"
|
||||
elif type == 'int':
|
||||
return "to_number({});"
|
||||
return "{};"
|
||||
|
||||
doubles = {}
|
||||
for elt in wrapper.itersingles():
|
||||
if elt.parser:
|
||||
res += tab * 3 + 'case "{}":'.format(elt.code) + EOL
|
||||
for l in elt.parser.splitlines():
|
||||
res += tab * 4 + l + EOL
|
||||
elif elt.code != "":
|
||||
res += tab * 3 + 'case "{}":'.format(elt.code) + EOL
|
||||
res += tab * 4 + 'd_vars.{}{}={}'.format(elt.varname, elt.action,
|
||||
typewise(elt.type).format("tab[i+1]")) + EOL
|
||||
res += tab * 4 + 'i+=2;' + EOL
|
||||
res += tab * 4 + 'break;' + EOL
|
||||
for grp in wrapper.iterdoubles():
|
||||
res += tab * 3 + 'case "{}":'.format(grp[0].code) + EOL
|
||||
res += tab * 4 + 'switch (tab[i+1]) {' + EOL
|
||||
for elt in grp:
|
||||
if elt.parser:
|
||||
for l in elt.parser.splitlines():
|
||||
res += tab * 5 + l + EOL
|
||||
elif elt.code != "":
|
||||
res += tab * 5 + 'case "{}":'.format(elt.id) + EOL
|
||||
res += tab * 6 + 'd_vars.{}{}={}'.format(elt.varname, elt.action,
|
||||
typewise(elt.type).format("tab[i+2]")) + EOL
|
||||
res += tab * 6 + 'break;' + EOL
|
||||
if not elt.parser:
|
||||
res += tab * 4 + "}" + EOL
|
||||
res += tab * 4 + 'i+=3;' + EOL
|
||||
res += tab * 4 + 'break;' + EOL
|
||||
|
||||
res += tab * 3 + "default:" + EOL
|
||||
res += tab * 4 + 'logit("Argument "+tab[i]+" unknown.");' + EOL
|
||||
res += tab * 4 + "i++;" + EOL
|
||||
res += tab * 4 + "break;" + EOL
|
||||
res += tab * 2 + "}" + EOL
|
||||
res += tab * 1 + "}" + EOL
|
||||
return res
|
||||
|
||||
def export(args):
|
||||
if len(args) > 1:
|
||||
filen = args[1]
|
||||
try:
|
||||
f = open(filen)
|
||||
except:
|
||||
filen = "export.log"
|
||||
f = open(filen, "w+")
|
||||
|
||||
def title(t):
|
||||
return "{} {} {}".format("#" * 10, t, "#" * 10) + EOL
|
||||
|
||||
f.write(title("Relances"))
|
||||
f.write(reroll([]) + EOL)
|
||||
f.write(title("Reroll"))
|
||||
f.write(initialise([]) + EOL)
|
||||
f.write(title("Parse"))
|
||||
f.write(parser([]) + EOL)
|
||||
|
||||
f.close()
|
||||
|
||||
return "All data written in '{}'".format(filen)
|
||||
|
||||
|
||||
def test_all(args):
|
||||
"Execute all tests"
|
||||
subclass = minitest.testGroup("Main Classes", term, verbose=True)
|
||||
all_s, t = ["reroll", "init", "wrapper", "parser"], 0
|
||||
if len(args) > 1:
|
||||
sub = [] # A list of test to execute
|
||||
for a in args[1:]:
|
||||
a = a.strip("-")
|
||||
if a in all_s or a == "all":
|
||||
t += 1
|
||||
sub.append(a.strip("-"))
|
||||
else:
|
||||
print("Argument {} unknown".format(a))
|
||||
else:
|
||||
sub = all_s
|
||||
t = len(sub)
|
||||
|
||||
if "all" in sub or "reroll" in sub:
|
||||
# "Check the reroll inline generation"
|
||||
subclass.addTest(testReroll())
|
||||
if "all" in sub or "init" in sub:
|
||||
# "Check the initialisation message"
|
||||
subclass.addTest(testInit())
|
||||
if "all" in sub or "wrapper" in sub:
|
||||
# "Test the wrapper, only useful internally"
|
||||
subclass.addTest(testWrapper())
|
||||
if "all" in sub or "parser" in sub:
|
||||
# "Check the reroll inline generation"
|
||||
subclass.addTest(testParser())
|
||||
|
||||
if t > 0:
|
||||
subclass.test()
|
||||
status = subclass.get_status()
|
||||
return status['failure']
|
||||
return 0
|
||||
|
||||
def help(args):
|
||||
"Help, print the following message"
|
||||
print("List of availables commands")
|
||||
for key in commands.keys():
|
||||
print(" {}: {}".format(key, commands[key].__doc__))
|
||||
|
||||
|
||||
commands = {"init": initialise, "print": pprint, "reroll": reroll,
|
||||
"test": test_all, "code": find_code, "parser": parser, "export": export, "help": help}
|
||||
|
||||
if __name__ == '__main__':
|
||||
wrapper = megaListWrapper()
|
||||
try:
|
||||
ret = commands[command](args)
|
||||
if ret:
|
||||
print(ret)
|
||||
except KeyError:
|
||||
print("Command {} doesn't exist".format(command))
|
||||
commands['help'](args)
|
||||
except Exception:
|
||||
print("Couldn't execute command " + command)
|
||||
print(" > {} ({})".format(sys.exc_info()[1], sys.exc_info()[0]))
|
||||
traceback.print_tb(sys.exc_info()[2])
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<script type="text/javascript">
|
||||
var raw_msg = "4 P 2 I 4 2 E 4 1 T 1 4 + 11 - 22";
|
||||
/*var nb_dices=0;
|
||||
var perfection=0; //P
|
||||
var defense_i_0=0; // I_1
|
||||
var defense_i_1=0; // I_2
|
||||
var defense_i_2=0; // I_4
|
||||
|
||||
var rempart_p=0; //R
|
||||
|
||||
var technique_m_0=0; //M_1
|
||||
var technique_m_1=0; //M_2
|
||||
var coup_d=0; //D
|
||||
|
||||
var fauchage=0; //F
|
||||
|
||||
var exploiter_p_0=0; //E_1
|
||||
var exploiter_p_1=0; //E_2
|
||||
var exploiter_p_2=0; //E_4
|
||||
|
||||
var tir_p_0=0; //T_1
|
||||
var tir_p_1=0; //T_2
|
||||
var tir_i=0; // O
|
||||
var charge=0; //C
|
||||
var charge_i=0; //N
|
||||
var nb_2add=0; //+
|
||||
var nb_2sub=0; //-
|
||||
var replace=-1; //P
|
||||
var add_to_all=0; //A
|
||||
*/
|
||||
// Internal Variables
|
||||
|
||||
logit("Parsing : "+raw_msg);
|
||||
|
||||
d_vars=parse_command(raw_msg);
|
||||
/*
|
||||
logit("nb_dices : " + d_vars.nb_dices);
|
||||
logit("perfection : " + d_vars.perfection); //P
|
||||
logit("defense_i_0 : " + d_vars.defense_i_0); // I_1
|
||||
logit("defense_i_1 : " + d_vars.defense_i_1); // I_2
|
||||
logit("defense_i_2 : " + d_vars.defense_i_2); // I_4
|
||||
|
||||
logit("rempart_p : " + d_vars.rempart_p); //R
|
||||
|
||||
logit("technique_m_0 : " + d_vars.technique_m_0); //M_1
|
||||
logit("technique_m_1 : " + d_vars.technique_m_1); //M_2
|
||||
logit("coup_d : " + d_vars.coup_d); //D
|
||||
|
||||
logit("fauchage : " + d_vars.fauchage); //F
|
||||
|
||||
logit("exploiter_p_0 : " + d_vars.exploiter_p_0); //E_1
|
||||
logit("exploiter_p_1 : " + d_vars.exploiter_p_1); //E_2
|
||||
logit("exploiter_p_2 : " + d_vars.exploiter_p_2); //E_4
|
||||
|
||||
logit("tir_p_0 : " + d_vars.tir_p_0); //T_1
|
||||
logit("tir_p_1 : " + d_vars.tir_p_1); //T_2
|
||||
logit("tir_i : " + d_vars.tir_i); // O
|
||||
logit("charge : " + d_vars.charge); //C
|
||||
logit("charge_i : " + d_vars.charge_i); //N
|
||||
logit("+ " + d_vars.nb_2add);
|
||||
logit("- " + d_vars.nb_2sub);
|
||||
logit("+ " + d_vars.replace); //P
|
||||
logit("+ " + d_vars.var add_to_all); //A*/
|
||||
function to_number(nb){
|
||||
var tmp=Number(nb);
|
||||
if (isNaN(tmp)) return 0;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
function parse_command(message){
|
||||
var d_vars={"nb_dices":0,"perfection":0,"defense_i_0":0,"defense_i_1":0,"defense_i_2":0,"rempart_p":0,
|
||||
"technique_m_0":0,"technique_m_1":0,"coup_d":0,"fauchage":0,"exploiter_p_0":0,"exploiter_p_1":0,
|
||||
"exploiter_p_2":0,"tir_p_0":0,"tir_p_1":0,"tir_i":0,"charge":0,"charge_i":0,"nb_2add":0,"nb_2sub":0};
|
||||
var tab=message.split(" ");
|
||||
var len_args=tab.length;
|
||||
var i;
|
||||
//logit(tab);
|
||||
//logit(tab.length);
|
||||
|
||||
if (len_args>0){
|
||||
d_vars.nb_dices=tab[0];
|
||||
}
|
||||
for (i = 1; i < tab.length;) {
|
||||
switch(tab[i]) {
|
||||
case "+":
|
||||
d_vars.nb_2add=to_number(tab[i+1]);
|
||||
i+=2;
|
||||
break;
|
||||
case "-":
|
||||
d_vars.nb_2sub=to_number(tab[i+1]);
|
||||
i+=2;
|
||||
break;
|
||||
case "P":
|
||||
d_vars.perfection=to_number(tab[i+1]);
|
||||
i+=2;
|
||||
break;
|
||||
case "I":
|
||||
switch (tab[i+1]) {
|
||||
case "1":
|
||||
d_vars.defense_i_0=to_number(tab[i+2]);
|
||||
break;
|
||||
case "2":
|
||||
d_vars.defense_i_1=to_number(tab[i+2]);
|
||||
break;
|
||||
case "4":
|
||||
d_vars.defense_i_2=to_number(tab[i+2]);
|
||||
break;
|
||||
}
|
||||
i+=3;
|
||||
break;
|
||||
case "E":
|
||||
switch (tab[i+1]) {
|
||||
case "1":
|
||||
d_vars.exploiter_p_0=to_number(tab[i+2]);
|
||||
break;
|
||||
case "2":
|
||||
d_vars.exploiter_p_1=to_number(tab[i+2]);
|
||||
break;
|
||||
case "4":
|
||||
d_vars.exploiter_p_2=to_number(tab[i+2]);
|
||||
break;
|
||||
}
|
||||
i+=3;
|
||||
break;
|
||||
case "T":
|
||||
switch (tab[i+1]) {
|
||||
case "1":
|
||||
d_vars.tir_p_0=to_number(tab[i+2]);
|
||||
break;
|
||||
case "2":
|
||||
d_vars.tir_p_1=to_number(tab[i+2]);
|
||||
break;
|
||||
}
|
||||
i+=3;
|
||||
break;
|
||||
case "R":
|
||||
d_vars.rempart_p=to_number(tab[i+1]);
|
||||
i+=2;
|
||||
break;
|
||||
case "C":
|
||||
d_vars.charge=to_number(tab[i+1]);
|
||||
i+=2;
|
||||
break;
|
||||
case "M":
|
||||
switch (tab[i+1]) {
|
||||
case "1":
|
||||
d_vars.technique_m_0=to_number(tab[i+2]);
|
||||
break;
|
||||
|
||||
case "2":
|
||||
d_vars.technique_m_1=to_number(tab[i+2]);
|
||||
break;
|
||||
}
|
||||
i+=3;
|
||||
break;
|
||||
case "D":
|
||||
d_vars.coup_d=to_number(tab[i+1]);
|
||||
i+=2;
|
||||
break;
|
||||
case "F":
|
||||
d_vars.fauchage=to_number(tab[i+1]);
|
||||
i+=2;
|
||||
break;
|
||||
case "N":
|
||||
d_vars.charge_i=to_number(tab[i+1]);
|
||||
i+=2;
|
||||
break;
|
||||
case "O":
|
||||
d_vars.tir_i=to_number(tab[i+1]);
|
||||
i+=2;
|
||||
break;
|
||||
case "r":
|
||||
d_vars.relance=to_number(tab[i+1]);
|
||||
i+=2;
|
||||
break;
|
||||
default:
|
||||
logit("Argument "+tab[i]+" unknown.");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return d_vars;
|
||||
}
|
||||
function logit(txt){
|
||||
//Due to the incomprehensible restriction of console. in roll20
|
||||
console.log(txt);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,215 @@
|
|||
import minitest
|
||||
import re
|
||||
from skill_generator import *
|
||||
|
||||
__all__=["testParser","testWrapper","testInit","testReroll"]
|
||||
|
||||
class testInit(minitest.simpleTestUnit):
|
||||
"""Check the initialisation message"""
|
||||
|
||||
def __init__(self):
|
||||
super(testInit, self).__init__("initialisation variables")
|
||||
|
||||
def _testInit(self):
|
||||
self.currentTest("generating test values")
|
||||
|
||||
test_values = {"nb_dices": 0, "perfection": 0, "defense_i_0": 0, "defense_i_1": 0,
|
||||
"defense_i_2": 0, "rempart_p": 0, "technique_m": 0, "coup_d": 0, "coup_d_results": "[]",
|
||||
"fauchage": 0, "exploiter_p_0": 0, "exploiter_p_1": 0, "exploiter_p_2": 0, "tir_p_0": 0,
|
||||
"tir_p_1": 0, "tir_i": 0, "charge": 0, "charge_i": 0, "nb_2add": 0, "nb_2sub": 0, "relances": 0,
|
||||
"seuil": 0, "nb_flat_dices": 0, "action": '""', "flat_dices": "[]", "results": "[]",
|
||||
"technique_result": 0,
|
||||
"cleave": "[]", "on_hit_c": 0, "attribute": 0, "encaissement": 0, "encaissement_dices": '""',
|
||||
"encaissement_result": 0, "replace": -1, "add_to_all": 0, "max_dices": -1, "player_name": '""'}
|
||||
a = len(test_values)
|
||||
b = len(list)
|
||||
try:
|
||||
dict_list = {}
|
||||
for l in list:
|
||||
dict_list[l[0]] = l[6]
|
||||
self.addSuccess()
|
||||
except Exception as ex:
|
||||
self.addFailure(str(ex))
|
||||
|
||||
self.currentTest("testing list")
|
||||
if a < b:
|
||||
pass # Only if the values are updated
|
||||
# self.addFailure("Too many values in the list")
|
||||
# for l in dict_list.keys():
|
||||
# if l not in test_values:
|
||||
# self.currentTest(l)
|
||||
# self.addFailure("{} missing from the test template".format(l))
|
||||
elif b < a:
|
||||
self.addFailure("Too few values in the list")
|
||||
for t, v in test_values.items():
|
||||
if t not in dict_list.keys():
|
||||
self.currentTest(t)
|
||||
self.addFailure("Missing element {}".format(v))
|
||||
else:
|
||||
for l, vl in dict_list.items():
|
||||
if l in test_values.keys():
|
||||
if test_values[l] != vl:
|
||||
self.currentTest(test_values[l])
|
||||
self.addFailure("Expected {}, got {}".format(l, vl))
|
||||
else:
|
||||
self.currentTest(l)
|
||||
self.addFailure("The element is not in the test values")
|
||||
self.addSuccess()
|
||||
|
||||
|
||||
class testReroll(minitest.simpleTestUnit):
|
||||
"""Check the reroll inline message"""
|
||||
|
||||
def __init__(self):
|
||||
super(testReroll, self).__init__("inline message")
|
||||
|
||||
def _testReroll(self):
|
||||
self.currentTest("regex generation")
|
||||
model = """"var msg_relance="<a class='sheet-rolltemplate-d10fight' href='!crit 0 P "+d_vars.perfection+" I 1 "+d_vars.defense_i_0+" I 2 "+d_vars.defense_i_1+" I 4 "+d_vars.defense_i_2+" R "+d_vars.rempart_p+" F "+d_vars.fauchage+" E 1 "+d_vars.exploiter_p_0+" E 2 "+d_vars.exploiter_p_1+" E 4 "+d_vars.exploiter_p_2+" T 2 "+d_vars.tir_p_0+" T 4 "+d_vars.tir_p_1+" i "+d_vars.tir_i+" C "+d_vars.charge+" N "+d_vars.charge_i+" + "+(d_vars.nb_2add+d_vars.technique_result+d_vars.encaissement_result)+" - "+d_vars.nb_2sub+" r ?{Relances ?}"+" s "+d_vars.seuil+" a "+d_vars.action+" H "+d_vars.on_hit_c+" A "+d_vars.attribute+" L "+d_vars.replace+" l "+d_vars.add_to_all+" m "+d_vars.max_dices+" n "+d_vars.player_name;
|
||||
for (var i=0,len=d_vars.results.length;i<len;i++) msg_relance+=" d "+d_vars.results[i];
|
||||
msg_relance+="'>Relancer ce jet</a>";"""
|
||||
var = re.compile(' ([a-zA-Z:+_] .*?".*?)(?:\+"|;)')
|
||||
self.addSuccess()
|
||||
|
||||
self.currentTest('generating inline message')
|
||||
roll = reroll(args)
|
||||
self.addSuccess()
|
||||
|
||||
self.currentTest("checking generated roll")
|
||||
for e in (var.findall(model)):
|
||||
if roll.find(e) < 0:
|
||||
self.currentTest("[{}]".format(e))
|
||||
self.addFailure("missing value")
|
||||
self.addSuccess()
|
||||
|
||||
# Only if the args are updated
|
||||
# self.currentTest("checking model")
|
||||
# for e in var.findall(roll):
|
||||
# if model.find(e)<0:
|
||||
# self.currentTest("[{}]".format(e))
|
||||
# self.addFailure("missing value")
|
||||
# self.addSuccess()
|
||||
|
||||
|
||||
class testWrapper(minitest.simpleTestUnit):
|
||||
"""Check the reroll inline message"""
|
||||
|
||||
def __init__(self):
|
||||
super(testWrapper, self).__init__("inline message")
|
||||
|
||||
def _testWrapper(self):
|
||||
self.currentTest("generating wrapper")
|
||||
s = len(hashedCategories)
|
||||
errors=0
|
||||
try:
|
||||
wrapper[-1]
|
||||
errors += 1
|
||||
self.addFailure("Error: Element -1 shouldn't exist")
|
||||
except:
|
||||
self.addSuccess()
|
||||
|
||||
f = 0
|
||||
self.currentTest("hashing categories")
|
||||
for ele in wrapper:
|
||||
for c in hashedCategories.keys():
|
||||
if ele.__getattr__(c) != findCat(ele, c):
|
||||
f += 1
|
||||
self.currentTest(ele[0])
|
||||
self.addFailure("{} found, should be {}".format(findCat(ele, c), ele.__getattr__(c)))
|
||||
|
||||
for i in range(s):
|
||||
if wrapper[ele[0]][i] != ele.asList()[i] or wrapper[ele[0]][i] != ele[i]:
|
||||
f += 1
|
||||
self.currentTest(i)
|
||||
self.addFailure("Element differs {}!={}".format(wrapper[ele[0]][i], ele.asList()[i]))
|
||||
if f == 0:
|
||||
self.addSuccess()
|
||||
else:
|
||||
self.addFailure("{} elements failed".format(f))
|
||||
|
||||
f = 0
|
||||
self.currentTest("single variable")
|
||||
for i in wrapper.itersingles():
|
||||
if i[0] not in wrapper:
|
||||
f += 1
|
||||
self.addFailure("{} element missing".format(i[0]), nonDestructive=True)
|
||||
if f == 0:
|
||||
self.addSuccess()
|
||||
else:
|
||||
self.addFailure("{} elements failed".format(f))
|
||||
|
||||
f = 0
|
||||
self.currentTest("double variables")
|
||||
for l in wrapper.iterdoubles():
|
||||
for i in l:
|
||||
if i[0] not in wrapper:
|
||||
f += 1
|
||||
self.addFailure("{} element missing".format(i[0]), nonDestructive=True)
|
||||
if f == 0:
|
||||
self.addSuccess()
|
||||
else:
|
||||
self.addFailure("{} elements failed".format(f))
|
||||
|
||||
|
||||
class testParser(minitest.simpleTestUnit):
|
||||
"""Check the reroll inline message"""
|
||||
|
||||
def __init__(self):
|
||||
super(testParser, self).__init__("inline message")
|
||||
|
||||
def _testParser(self):
|
||||
self.currentTest("loading parser")
|
||||
par = parser(args)
|
||||
self.addSuccess()
|
||||
f = 0
|
||||
nb_code = 0
|
||||
self.currentTest("testing all variables")
|
||||
for line in list:
|
||||
cat = findCat(line, "code")
|
||||
if cat != "":
|
||||
nb_code += 1
|
||||
if 'case "{}"'.format(cat) not in par:
|
||||
f += 1
|
||||
self.addFailure("code {} not found".format(cat), nonDestructive=True)
|
||||
if 'd_vars.{}'.format(findCat(line, "varname")) not in par:
|
||||
f += 1
|
||||
self.addFailure("variable {} not found".format(findCat(line, "varname")), nonDestructive=True)
|
||||
if f == 0:
|
||||
self.addSuccess()
|
||||
else:
|
||||
self.addFailure("{} failures".format(f))
|
||||
|
||||
self.currentTest("testing i++ count")
|
||||
count = par.count("i+=")
|
||||
nb_code = nb_code + len([l for l in wrapper.iterdoubles()]) - sum([len(l) for l in wrapper.iterdoubles()])
|
||||
if count != nb_code:
|
||||
self.addFailure("{} occurences found (expected {})".format(par.count("i+="), nb_code))
|
||||
else:
|
||||
self.addSuccess()
|
||||
|
||||
self.currentTest("counting {}")
|
||||
counto = par.count("{")
|
||||
countc = par.count("}")
|
||||
tot = len([l for l in wrapper.iterdoubles()]) + 3
|
||||
if counto != countc or counto != tot:
|
||||
self.addFailure("found {} '{{' and {} '}} ' instead of {}".format(counto, countc, tot))
|
||||
else:
|
||||
self.addSuccess()
|
||||
|
||||
f = 0
|
||||
self.currentTest("checking special text")
|
||||
for line in list:
|
||||
cat = findCat(line, "parser")
|
||||
if cat:
|
||||
for l in cat.splitlines():
|
||||
if l not in par:
|
||||
self.addFailure("{} isn't in the end result".format(l), nonDestructive=True)
|
||||
if f == 0:
|
||||
self.addSuccess()
|
||||
else:
|
||||
self.addFailure("{} failures".format(f))
|
||||
"""for varname with symbol, find symbol
|
||||
for Special text, find special
|
||||
"""
|
||||
|
||||
term = minitest.Terminal()
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<fieldset class="repeating_ranged-weapons">
|
||||
<div class="quickborder">
|
||||
<div class="sheet-row">
|
||||
<input class="sheet-skill_name" type="number" name="attr_wid" title="Numero de ligne" />
|
||||
<input class="sheet-skill_name" type="text" name="attr_ranged_weaponname" title="Nom de l'arme" />
|
||||
<label>P</label>
|
||||
<input type="number" name="attr_ranged_accuracy" title="Précision" />
|
||||
<label>Mode</label>
|
||||
<input type="number" name="attr_ranged_single" title="Coup par coup" />
|
||||
<label>/</label>
|
||||
<input type="number" name="attr_ranged_burst" title="Rafale" />
|
||||
<label>/</label>
|
||||
<input type="number" name="attr_ranged_auto" title="Automatique" />
|
||||
</div>
|
||||
<div class="sheet-row">
|
||||
<label>Type</label>
|
||||
<input type="text" name="attr_typename" title="Type d'arme" />
|
||||
<select class="sheet-weapon_type_select" name="attr_ranged_type_select">
|
||||
<option value="@{combat_skilllevel_armesdassaut}">Arme d'Assaut</option>
|
||||
<option value="@{combat_skilllevel_armesdepoing}">Arme de Poing</option>
|
||||
<option value="@{combat_skilllevel_munitionssolide}">Munitions Solides</option>
|
||||
<option value="@{combat_skilllevel_projectilesbalistiques}">Arme Balistique</option>
|
||||
<option value="@{combat_skilllevel_projectilesautopropulss}">Projectile Autopropulsé</option>
|
||||
<option value="@{combat_skilllevel_armementlaser}">Armement Laser</option>
|
||||
<option value="@{combat_skilllevel_guidagedemissiles}">Guidage de Missiles</option>
|
||||
<option value="@{combat_skilllevel_balistique}">Balistique Superlative</option>
|
||||
<option value="0">Aucune spécialité</option>
|
||||
</select>
|
||||
<button type='roll' class="sheet-skillbutton" title ="Dégats" value="&{template:d10Shooting} {{name=@{ranged_weaponname}}} {{subtags=@{typename}}} {{damagedone=[[(?{Sucesses}-1)*@{ranged_dmgPlus}+@{ranged_dmgBase}]]}} {{magsize=@{ranged_magT}}} {{ammocurrent=@{ranged_magA}}} {{ammototal=@{ranged_ammoT}}}">Dégats</button>
|
||||
<button type='roll' class="sheet-skillbutton" title ="Rechargement" value="/em reloads the @{ranged_weaponname} loosing @{ranged_magA} ammo in the process. !setattr --name @{character_name} --repeating_ranged-weapons_$@{wid}_ranged_magA|[[{@{ranged_magT},@{ranged_ammoT}}kl1]] !setattr --name @{character_name} --modb --repeating_ranged-weapons_$@{wid}_ranged_ammoT|-@{ranged_magT}">Rechargement</button>
|
||||
</div>
|
||||
<div class="sheet-row">
|
||||
<label>Chargeur</label>
|
||||
<input type="number" name="attr_ranged_magA" title="Chargeur Actuel" />
|
||||
<label>/</label>
|
||||
<input type="number" name="attr_ranged_magT" title="Chargeur Total" />
|
||||
<label>|</label>
|
||||
<input type="number" name="attr_ranged_ammoT" title="Munitions Totales" />
|
||||
<label>Dégats</label>
|
||||
<input type="number" name="attr_ranged_dmgBase" title="Dégats base" />
|
||||
<label>/</label>
|
||||
<input type="number" name="attr_ranged_dmgPlus" title="Dégats additionels" />
|
||||
<label>Spécial</label>
|
||||
<input type="text" name="attr_ranged_special" title="Spécial" />
|
||||
<button type='roll' class="sheet-skillbutton" title ="Tir simple" value="&{template:d10Shooting}{{name=@{ranged_weaponname}}}{{subtags=@{typename}}} {{attack=[[?{Dices}d10<[[@{ranged_type_select}+?{Seuil|4}+@{ranged_accuracy}]]cs1cf11]]}} {{mode=Single Shot}} {{damage=@{ranged_dmgBase}/+@{ranged_dmgPlus}}} {{usedammo=@{ranged_single}}} {{magsize=@{ranged_magT}}} {{ammocurrent=[[@{ranged_magA}-@{ranged_single}]]}} {{ammototal=@{ranged_ammoT}}} {{special=@{ranged_special}}} !modattr --name @{character_name} --repeating_ranged-weapons_$@{wid}_ranged_magA|-@{ranged_single}!!!">S</button>
|
||||
<button type='roll' class="sheet-skillbutton" title ="Rafale" value="&{template:d10Shooting}{{name=@{ranged_weaponname}}}{{subtags=@{typename}}} {{attack=[[[[?{Dices}+1]]d10<[[@{ranged_type_select}+?{Seuil|4}+@{ranged_accuracy}]]cs1cf11]]}} {{mode=Burst}} {{damage=@{ranged_dmgBase}/@{ranged_dmgPlus}}} {{usedammo=@{ranged_burst}}} {{magsize=@{ranged_magT}}} {{ammocurrent=[[@{ranged_magA}-@{ranged_burst}]]}} {{ammototal=@{ranged_ammoT}}} {{special=@{ranged_special}}} !modattr --name @{character_name} --repeating_ranged-weapons_$@{wid}_ranged_magA|-@{ranged_burst}!!!">B</button>
|
||||
<button type='roll' class="sheet-skillbutton" title ="Automatique" value="&{template:d10Shooting}{{name=@{ranged_weaponname}}}{{subtags=@{typename}}} {{attack=[[?{Dices}d10<[[@{ranged_type_select}+?{Seuil|4}+@{ranged_accuracy}]]cs1cf11]]}} {{mode=Auto}} {{damage=@{ranged_dmgBase}/@{ranged_dmgPlus}}} {{usedammo=@{ranged_auto}}} {{magsize=@{ranged_magT}}} {{ammocurrent=[[@{ranged_magA}-@{ranged_auto}]]}} {{ammototal=@{ranged_ammoT}}} {{special=@{ranged_special}}} !modattr --name @{character_name} --repeating_ranged-weapons_$@{wid}_ranged_magA|-@{ranged_auto}!!!">A</button>
|
||||
</div> </div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
|
||||
<fieldset class="repeating_melee-weapons">
|
||||
<div class="quickborder">
|
||||
<div class="sheet-row">
|
||||
<input class="sheet-skill_name" type="number" name="attr_wid" title="Numero de ligne" />
|
||||
<input class="sheet-skill_name" type="text" name="attr_melee_weaponname" title="Nom de l'arme" />
|
||||
<label>P</label>
|
||||
<input type="number" name="attr_melee_accuracy" title="Précision" />
|
||||
</div>
|
||||
<div class="sheet-row">
|
||||
<label>Type</label>
|
||||
<input type="text" name="attr_typename" title="Type d'arme" />
|
||||
<select class="sheet-weapon_type_select" name="attr_melee_type_select">
|
||||
<option value="@{combat_skilllevel_armescontandantes}">Arme Contandante</option>
|
||||
<option value="@{combat_skilllevel_armestranchantes}">Arme Tranchante</option>
|
||||
<option value="0">Aucune spécialité</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="sheet-row">
|
||||
<label>Dégats</label>
|
||||
<input type="number" name="attr_melee_dmgBase" title="Dégats base" />
|
||||
<label>/</label>
|
||||
<input type="number" name="attr_melee_dmgPlus" title="Dégats additionels" />
|
||||
<label>Spécial</label>
|
||||
<input type="text" name="attr_melee_special" title="Spécial" />
|
||||
<button type='roll' class="sheet-skillbutton" title ="Attaque" value="&{template:d10Shooting}{{name=@{melee_weaponname}}}{{subtags=@{typename}}} {{attack=[[?{Dices}d10<[[@{melee_type_select}+?{Seuil|4}+@{melee_accuracy}]]cs1cf11]]}} {{damage=@{melee_dmgBase}/+@{melee_dmgPlus}}} {{special=@{melee_special}}}">Attaque</button>
|
||||
<button type='roll' class="sheet-skillbutton" title ="Dégats" value="&{template:d10Shooting}{{name=@{melee_weaponname}}}{{subtags=@{typename}}} {{damagedone=[[(?{Sucesses}-1)*@{melee_dmgPlus}+@{melee_dmgBase}]]}}">Dégats</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<fieldset class="repeating_consumables">
|
||||
<div class="quickborder">
|
||||
<div class="sheet-row">
|
||||
<input class="sheet-skill_name" type="number" name="attr_wid" title="Numero de ligne" />
|
||||
<input class="sheet-skill_name" type="text" name="attr_consumable_name" title="Nom du consommable" />
|
||||
<input class="sheet-skill_name" type="text" name="attr_consumable_type" title="Type de consommable" />
|
||||
<label>Nb</label>
|
||||
<input type="number" name="attr_consumable_nb" title="Quantité" />
|
||||
</div>
|
||||
<div class="sheet-row">
|
||||
<label>Type</label>
|
||||
<input type="text" style="" name="attr_consumable_effect" title="Description (short)" />
|
||||
<button type='roll' class="sheet-skillbutton" title ="Utilisation" value="&{template:d10Shooting}{{name=@{consumable_name}}}{{subtags=@{consumable_type}}} {{special=@{consumable_effect}}} !modattr --name @{character_name} --repeating_consumables_$@{wid}_consumable_nb|-1!!!">Utiliser</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
|
@ -1 +0,0 @@
|
|||
PyYAML>=6,<7
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# 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
|
||||
sheet or by `tools/build.py`. `change.js` was an unfinished prototype; these
|
||||
scripts have not been validated against the new sheets. Review them before
|
||||
installing them in a Roll20 game.
|
||||
|
|
@ -1,211 +0,0 @@
|
|||
/* 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(/<br\s*\/?\s*>/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, '<').replace(/>/g, '>');
|
||||
handout.set(isGM ? 'gmnotes' : 'notes', '<pre>' + readable + '</pre>');
|
||||
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.'); }
|
||||
});
|
||||
}());
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"html": "feuille_sysd10.html",
|
||||
"css": "style.css",
|
||||
"authors": "Dandaedre",
|
||||
"roll20userid": "1067910",
|
||||
"preview": "exemple.png",
|
||||
"instructions": "v0.1a (2018-25-07) Ajout des equipements"
|
||||
}
|
||||
|
|
@ -0,0 +1,288 @@
|
|||
div.sheet-tab-content { display: none; }
|
||||
input.sheet-tab1:checked ~ div.sheet-tab1,
|
||||
input.sheet-tab2:checked ~ div.sheet-tab2,
|
||||
input.sheet-tab3:checked ~ div.sheet-tab3
|
||||
{
|
||||
display: block;
|
||||
|
||||
div.sheet-header-tab-content { display: none; }
|
||||
input.sheet-header-tab1:checked ~ div.sheet-header-tab1,
|
||||
input.sheet-header-tab2:checked ~ div.sheet-header-tab2,
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
|
||||
input.sheet-secondary_physique_tab1:checked ~ div.sheet-secondary_physique_tab1,
|
||||
input.sheet-secondary_physique_tab2:checked ~ div.sheet-secondary_physique_tab2,
|
||||
input.sheet-secondary_physique_tab3:checked ~ div.sheet-secondary_physique_tab3,
|
||||
input.sheet-secondary_physique_tab4:checked ~ div.sheet-secondary_physique_tab4
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
input.sheet-secondary_intelectuelles_tab1:checked ~ div.sheet-secondary_intelectuelles_tab1,
|
||||
input.sheet-secondary_intelectuelles_tab2:checked ~ div.sheet-secondary_intelectuelles_tab2,
|
||||
input.sheet-secondary_intelectuelles_tab3:checked ~ div.sheet-secondary_intelectuelles_tab3
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
input.sheet-secondary_social_tab1:checked ~ div.sheet-secondary_social_tab1,
|
||||
input.sheet-secondary_social_tab2:checked ~ div.sheet-secondary_social_tab2,
|
||||
input.sheet-secondary_social_tab3:checked ~ div.sheet-secondary_social_tab3
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
|
||||
input.sheet-tab{
|
||||
-moz-appearance: none;
|
||||
width:150px;
|
||||
height: 20px;
|
||||
top: 5px;
|
||||
left: 6px;
|
||||
margin: 5px;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
content: attr(title);
|
||||
}
|
||||
input.sheet-tab::before{
|
||||
-moz-appearance: none;
|
||||
content: attr(title);
|
||||
border-radius:.5em;
|
||||
border:2px solid black;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
background: black;
|
||||
color:white;
|
||||
width: 150px;
|
||||
height: 20px;
|
||||
font-size: 18px;
|
||||
}
|
||||
input.sheet-tab:checked::before{
|
||||
-moz-appearance: none;
|
||||
background:#CCCCCC;
|
||||
color:black;
|
||||
border-radius:.5em;
|
||||
border:2px solid black;
|
||||
}
|
||||
|
||||
input.sheet-small_tab{
|
||||
-moz-appearance: none;
|
||||
width:120px;
|
||||
height: 20px;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
margin:5px;
|
||||
}
|
||||
input.sheet-small_tab::before{
|
||||
-moz-appearance: none;
|
||||
content: attr(title);
|
||||
border-radius:.5em;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
color:white;
|
||||
background:black;
|
||||
border:2px solid black;
|
||||
width: 120px;
|
||||
height:20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
input.sheet-small_tab:checked::before{
|
||||
-moz-appearance: none;
|
||||
border:2px solid black;
|
||||
background:#CCCCCC;
|
||||
color:black;
|
||||
border-radius:.5em;
|
||||
}
|
||||
|
||||
input.sheet-skill_name{
|
||||
-moz-appearance: none;
|
||||
width:400px;
|
||||
}
|
||||
input.sheet-skill_hidden{
|
||||
visibility: hidden;
|
||||
}
|
||||
div.sheet-tab-content{
|
||||
border-top-color: #000;
|
||||
margin: 2px 0 0 0;
|
||||
}
|
||||
select.sheet-skill_select{
|
||||
width:55px;
|
||||
margin-bottom:-1px;
|
||||
}
|
||||
select.sheet-dice_select{
|
||||
width:85px;
|
||||
margin-bottom:-1px;
|
||||
}
|
||||
.sheet-trait{
|
||||
width: 30px;
|
||||
}
|
||||
.sheet-numberbox {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.sheet-rolltemplate-d10init table,
|
||||
.sheet-rolltemplate-d10skillcheck table {
|
||||
border-radius: 6px;
|
||||
width:100%;
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding: 2px;
|
||||
border: 1px solid;
|
||||
background-color: #ffffff;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #000;
|
||||
border-image-source: none;
|
||||
}
|
||||
.sheet-rolltemplate-d10init .sheet-roll-title,
|
||||
.sheet-rolltemplate-d10init th,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-title,
|
||||
.sheet-rolltemplate-d10skillcheck th {
|
||||
color: rgb(42, 42, 42);
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 5px;
|
||||
font-size: 1.2em;
|
||||
text-align: left;
|
||||
font-family: "Times New Roman", Times, serif;
|
||||
font-variant: small-caps;
|
||||
text-transform: capitalize;
|
||||
border-width: 0px;
|
||||
}
|
||||
.sheet-rolltemplate-d10init .sheet-roll-attr,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-attr{
|
||||
color: #555555;
|
||||
font-size: 1em;
|
||||
font-style: italic;
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 9px;
|
||||
border-width: 0px;
|
||||
margin-top: -10px;
|
||||
}
|
||||
.sheet-rolltemplate-d10init .sheet-roll-sucess,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-sucess ,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-fail {
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border-width: 0px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-crit {
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border-width: 0px;
|
||||
padding-left: 5px;
|
||||
background-color:#b0d6ad;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-fumble {
|
||||
padding-left: 5px;
|
||||
border-width: 0px;
|
||||
background-color:#d6adad;
|
||||
}
|
||||
.sheet-rolltemplate-d10init .sheet-inline,
|
||||
.sheet-rolltemplate-d10init .inlinerollresult,
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-inline,
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
font-weight: bold;
|
||||
padding:0px;
|
||||
font-family: "Times New Roman", Times, serif;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-inline.sheet-fullcrit,
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult.fullcrit {
|
||||
color: #3FB315;
|
||||
border: none;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-inline.sheet-fullfail,
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult.fullfail {
|
||||
color: #B31515;
|
||||
border: none;
|
||||
}
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult.importantroll {
|
||||
color: #4A57ED;
|
||||
border: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.sheet-rolltemplate-d10fight-blob{
|
||||
border-radius: 6px;
|
||||
border: 1px solid #898989;
|
||||
z-index: 1;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight table{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
text-align: left;
|
||||
width:100%;
|
||||
border:none;
|
||||
cellpadding:3px;
|
||||
cellspacing:0px;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-sum{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border:none;
|
||||
text-align: right;
|
||||
padding-right:10px;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-sucess,
|
||||
.sheet-rolltemplate-d10fight .sheet-line{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 3px;
|
||||
border:none;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-critical{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border:none;
|
||||
padding-left: 3px;
|
||||
border-radius: 4px;
|
||||
background-color:#b0d6ad;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-hit{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 3px;
|
||||
border-radius: 4px;
|
||||
background-color:#b0d6ad;
|
||||
border:none;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-miss{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
padding-left: 3px;
|
||||
border:none;
|
||||
border-radius: 4px;
|
||||
background-color:#d6adad;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-name{
|
||||
padding:0px;
|
||||
padding-left: 3px;
|
||||
margin:0px;
|
||||
border:none;
|
||||
border-radius: 4px;
|
||||
border-bottom-left-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
background-color: #999999;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight .sheet-additional{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
border:none;
|
||||
padding-left:10px;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight-grey{
|
||||
color: #999999;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight-green{
|
||||
color: #009900;
|
||||
}
|
||||
.sheet-rolltemplate-d10fight a,
|
||||
.sheet-rolltemplate-d10fight a[href^="!"],
|
||||
.sheet-rolltemplate-d10fight a[href^="~"]{
|
||||
text-align:right;
|
||||
background-color: #999999; !important
|
||||
}
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
const D10_COMBAT_SKILLS = __COMBAT_SKILLS__;
|
||||
const d10Number = value => Number.isFinite(Number(value)) ? Number(value) : 0;
|
||||
const d10Whole = value => Math.max(0, Math.floor(d10Number(value)));
|
||||
const d10Text = value => String(value || '').replace(/[{}]/g, '');
|
||||
const d10Damage = (successes, base, bonus, rmax) => {
|
||||
if (!successes) return 0;
|
||||
const capped = d10Whole(rmax) ? Math.min(successes, d10Whole(rmax)) : successes;
|
||||
return Math.max(0, d10Number(base) + (capped - 1) * d10Number(bonus));
|
||||
};
|
||||
const d10ShotDamage = (roll, successes, threshold, base, bonus, maxShots) => {
|
||||
const dice = Array.isArray(roll && roll.dice) ? roll.dice : [];
|
||||
const successful = dice.map(die => d10Number(die && die.v !== undefined ? die.v : die))
|
||||
.filter(value => value > 0 && value <= threshold);
|
||||
const limit = d10Whole(maxShots);
|
||||
const shots = (successful.length ? successful : Array(d10Whole(successes)).fill(null)).slice(0, limit);
|
||||
return shots.map(value => Math.max(0, d10Number(base) + (value === 1 ? d10Number(bonus) : 0))).join(', ');
|
||||
};
|
||||
|
||||
function d10WeaponFields(prefix, callback) {
|
||||
const fields = ['name', 'weapon_type', 'accuracy', 'base_threshold', 'skill_id',
|
||||
'damage', 'damage_per_success', 'rmax', 'notes', 'ammo_current',
|
||||
'magazine_size', 'ammo_reserve', 'single_cost', 'burst_cost', 'auto_cost'];
|
||||
getAttrs(fields.map(field => prefix + field), values => {
|
||||
const skillId = values[prefix + 'skill_id'];
|
||||
const skillField = D10_COMBAT_SKILLS.includes(skillId) ? 'combat_skilllevel_' + skillId : '';
|
||||
if (skillField) {
|
||||
getAttrs([skillField], skillValues => callback(values, d10Number(skillValues[skillField])));
|
||||
} else {
|
||||
callback(values, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function d10WeaponAttack(event, mode, ranged) {
|
||||
const prefix = event.sourceAttribute.replace(/(?:firesingle|fireburst|fireauto|attack)$/, '');
|
||||
d10WeaponFields(prefix, (values, skill) => {
|
||||
const get = field => values[prefix + field];
|
||||
const multipleShots = mode === 'burst' || mode === 'auto';
|
||||
const cost = ranged ? Math.max(1, d10Whole(get(mode + '_cost'))) : 0;
|
||||
const current = d10Whole(get('ammo_current'));
|
||||
if (ranged && (!current || (!multipleShots && current < cost))) {
|
||||
setAttrs({[prefix + 'weapon_status']: 'Chargeur insuffisant : ' + current + '/' + cost});
|
||||
return;
|
||||
}
|
||||
const threshold = Math.max(0, Math.floor(d10Number(get('base_threshold')) + skill + d10Number(get('accuracy'))));
|
||||
const spent = multipleShots ? Math.min(current, cost) : cost;
|
||||
const remaining = current - spent;
|
||||
const modeName = {single: 'Tir simple', burst: 'Rafale', auto: 'Automatique', melee: 'Mêlée'}[mode];
|
||||
const dice = mode === 'burst' ? '(?{Nombre de dés|1}+1)' : '?{Nombre de dés|1}';
|
||||
const command = `&{template:d10weapon} {{name=${d10Text(get('name') || 'Arme')}}} ` +
|
||||
`{{mode=${modeName}}} {{type=${d10Text(get('weapon_type'))}}} ` +
|
||||
`{{attack_roll=[[${dice}d10<${threshold}cs1cf10]]}} {{threshold=[[${threshold}]]}} ` +
|
||||
`${multipleShots ? '{{damage_list=[[0]]}}' : '{{damage=[[0]]}}'} ` +
|
||||
`{{special=${d10Text(get('notes'))}}}` +
|
||||
(multipleShots ? '' : ` {{rmax=${d10Whole(get('rmax')) || 'sans limite'}}}`) +
|
||||
(ranged ? ` {{ammo_info=1}} {{ammo=${remaining}}} ` +
|
||||
`{{magazine=${d10Whole(get('magazine_size'))}}} {{reserve=${d10Whole(get('ammo_reserve'))}}}` : '');
|
||||
setAttrs({[prefix + 'weapon_status']: 'Jet en cours…'});
|
||||
startRoll(command, result => {
|
||||
const successes = d10Whole(result.results.attack_roll.result);
|
||||
const computed = multipleShots
|
||||
? {damage_list: d10ShotDamage(result.results.attack_roll, successes, threshold,
|
||||
get('damage'), get('damage_per_success'), spent) || 'Aucun dégât'}
|
||||
: {damage: d10Damage(successes, get('damage'), get('damage_per_success'), get('rmax'))};
|
||||
finishRoll(result.rollId, computed);
|
||||
if (ranged) setAttrs({[prefix + 'ammo_current']: remaining,
|
||||
[prefix + 'weapon_status']: 'Chargeur : ' + remaining + '/' + d10Whole(get('magazine_size'))});
|
||||
else setAttrs({[prefix + 'weapon_status']: ''});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function d10WeaponReload(event) {
|
||||
const prefix = event.sourceAttribute.replace(/reload$/, '');
|
||||
getAttrs([prefix + 'ammo_current', prefix + 'magazine_size', prefix + 'ammo_reserve'], values => {
|
||||
const current = d10Whole(values[prefix + 'ammo_current']);
|
||||
const size = d10Whole(values[prefix + 'magazine_size']);
|
||||
const reserve = d10Whole(values[prefix + 'ammo_reserve']);
|
||||
if (!size || current >= size || !reserve) {
|
||||
const status = !size ? 'Taille du chargeur manquante'
|
||||
: current >= size ? 'Chargeur déjà plein' : 'Aucun chargeur de réserve';
|
||||
setAttrs({[prefix + 'weapon_status']: status});
|
||||
return;
|
||||
}
|
||||
setAttrs({[prefix + 'ammo_current']: size,
|
||||
[prefix + 'ammo_reserve']: reserve - 1,
|
||||
[prefix + 'weapon_status']: 'Rechargé : 1 chargeur utilisé'});
|
||||
});
|
||||
}
|
||||
|
||||
function d10WeaponDamage(event) {
|
||||
const prefix = event.sourceAttribute.replace(/damage$/, '');
|
||||
getAttrs([prefix + 'name', prefix + 'damage', prefix + 'damage_per_success', prefix + 'rmax'], values => {
|
||||
const command = `&{template:d10weapon} {{name=${d10Text(values[prefix + 'name'] || 'Arme')}}} ` +
|
||||
`{{mode=Dégâts}} {{damage_roll=[[?{Réussites|1}]]}} {{damage=[[0]]}} ` +
|
||||
`{{rmax=${d10Whole(values[prefix + 'rmax']) || 'sans limite'}}}`;
|
||||
startRoll(command, result => {
|
||||
const successes = d10Whole(result.results.damage_roll.result);
|
||||
finishRoll(result.rollId, {damage: d10Damage(successes, values[prefix + 'damage'],
|
||||
values[prefix + 'damage_per_success'], values[prefix + 'rmax'])});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
for (const [action, mode] of [
|
||||
['firesingle', 'single'],
|
||||
['fireburst', 'burst'],
|
||||
['fireauto', 'auto'],
|
||||
]) {
|
||||
on('clicked:repeating_distance:' + action, event => d10WeaponAttack(event, mode, true));
|
||||
}
|
||||
on('clicked:repeating_distance:reload', d10WeaponReload);
|
||||
on('clicked:repeating_distance:damage', d10WeaponDamage);
|
||||
|
||||
on('clicked:repeating_melee:attack', event => d10WeaponAttack(event, 'melee', false));
|
||||
on('clicked:repeating_melee:damage', d10WeaponDamage);
|
||||
|
|
@ -1,158 +0,0 @@
|
|||
.sheet-d10 {
|
||||
box-sizing: border-box;
|
||||
max-width: 1080px;
|
||||
min-width: 0;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
color: var(--d10-ink);
|
||||
background: var(--d10-background);
|
||||
font: 13px/1.4 Georgia, serif;
|
||||
border: 1px solid var(--d10-border);
|
||||
}
|
||||
.sheet-d10 *, .sheet-d10 *::before, .sheet-d10 *::after { box-sizing: border-box; }
|
||||
.sheet-d10 .sheet-hero { display: grid; grid-template-columns: 60px minmax(0,1fr) 112px 170px; gap: 16px; align-items: center; padding: 16px; background: var(--d10-panel); border: 1px solid var(--d10-border); border-left: 5px solid var(--d10-accent); }
|
||||
.sheet-d10 .sheet-hero-mark { display: grid; place-items: center; width: 54px; height: 54px; color: var(--d10-panel); background: var(--d10-accent); font: bold 18px Georgia,serif; letter-spacing: -.08em; }
|
||||
.sheet-d10 .sheet-eyebrow { display: block; color: var(--d10-accent); font: bold 10px Arial,sans-serif; letter-spacing: .14em; text-transform: uppercase; }
|
||||
.sheet-d10 h1 { margin: 2px 0 11px; color: var(--d10-ink); font: bold 26px Georgia,serif; }
|
||||
.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)); }
|
||||
.sheet-d10 .sheet-tab-nav button[type=action] { width: 100%; min-height: 38px; margin: 0 !important; padding: 7px 5px; color: var(--d10-accent); background: var(--d10-background); border: 1px solid var(--d10-border); border-bottom: 0; border-radius: 3px 3px 0 0; box-shadow: none; font: bold 12px Georgia,serif; text-shadow: none; }
|
||||
.sheet-d10 .sheet-tab-nav button[type=action]:hover, .sheet-d10 .sheet-tab-nav button[type=action]:focus { background: var(--d10-panel); outline: 2px solid var(--d10-border); outline-offset: -2px; }
|
||||
.sheet-d10 .sheet-page { display: none; }
|
||||
.sheet-d10 .sheet-tab-state[value="core"] ~ .sheet-page-skills,
|
||||
.sheet-d10 .sheet-tab-state[value="skills"] ~ .sheet-page-skills,
|
||||
.sheet-d10 .sheet-tab-state[value="combat"] ~ .sheet-page-combat,
|
||||
.sheet-d10 .sheet-tab-state[value="other"] ~ .sheet-page-other { display: block; }
|
||||
.sheet-d10.sheet-variant-base .sheet-tab-state[value="other"] ~ .sheet-page-skills { display: block; }
|
||||
.sheet-d10 .sheet-tab-state[value="core"] ~ .sheet-tab-nav .sheet-tab-skills,
|
||||
.sheet-d10 .sheet-tab-state[value="skills"] ~ .sheet-tab-nav .sheet-tab-skills,
|
||||
.sheet-d10 .sheet-tab-state[value="combat"] ~ .sheet-tab-nav .sheet-tab-combat,
|
||||
.sheet-d10 .sheet-tab-state[value="other"] ~ .sheet-tab-nav .sheet-tab-other { color: var(--d10-panel); background: var(--d10-accent); border-color: var(--d10-accent); }
|
||||
.sheet-d10.sheet-variant-base .sheet-tab-state[value="other"] ~ .sheet-tab-nav .sheet-tab-skills { color: var(--d10-panel); background: var(--d10-accent); border-color: var(--d10-accent); }
|
||||
.sheet-d10 .sheet-skill-tab-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; margin: 2px 0 12px; }
|
||||
.sheet-d10 .sheet-category-tab-nav { grid-template-columns: repeat(3,minmax(0,1fr)); }
|
||||
.sheet-d10 .sheet-arsenal-tab-nav { grid-template-columns: repeat(3,minmax(0,1fr)); }
|
||||
.sheet-d10 .sheet-skill-tab-nav button[type=action] { min-height: 37px; margin: 0 !important; padding: 6px 4px; color: var(--d10-accent); background: var(--d10-background); border: 1px solid var(--d10-border); border-radius: 3px; box-shadow: none; font: bold 11px Georgia,serif; text-shadow: none; }
|
||||
.sheet-d10 .sheet-skill-tab-nav button[type=action]:hover, .sheet-d10 .sheet-skill-tab-nav button[type=action]:focus { background: var(--d10-panel); outline: 2px solid var(--d10-border); outline-offset: -2px; }
|
||||
.sheet-d10 .sheet-skill-pane { display: none; }
|
||||
.sheet-d10 .sheet-skill-pane details { margin-top: 0; }
|
||||
.sheet-d10 input, .sheet-d10 select { box-sizing: border-box; width: 100%; min-width: 0; height: 30px; margin: 0 !important; padding: 3px 6px; color: var(--d10-ink); background: var(--d10-panel); border: 1px solid var(--d10-border); border-radius: 2px; box-shadow: none; font: 13px Arial,sans-serif; }
|
||||
.sheet-d10 input:focus, .sheet-d10 select:focus { outline: 2px solid var(--d10-accent); outline-offset: 1px; }
|
||||
.sheet-d10 input[type=checkbox] { width: 18px; height: 18px; padding: 0; accent-color: var(--d10-accent); }
|
||||
.sheet-d10 input[type=number] { text-align: center; appearance: textfield; -moz-appearance: textfield; }
|
||||
.sheet-d10 input[type=number]::-webkit-inner-spin-button, .sheet-d10 input[type=number]::-webkit-outer-spin-button { margin: 0; appearance: none; -webkit-appearance: none; }
|
||||
.sheet-d10 .sheet-panel { margin: 14px 0 0; padding: 13px 15px 16px; background: var(--d10-panel); border: 1px solid var(--d10-border); }
|
||||
.sheet-d10 .sheet-section-title { display: flex; gap: 9px; align-items: baseline; padding-bottom: 6px; margin-bottom: 11px; border-bottom: 1px solid var(--d10-border); }
|
||||
.sheet-d10 .sheet-section-title span { color: var(--d10-accent); font: bold 11px Arial,sans-serif; }
|
||||
.sheet-d10 .sheet-section-title h2 { margin: 0; color: var(--d10-accent); font: bold 19px Georgia,serif; }
|
||||
.sheet-d10 .sheet-subheading { margin: 14px 0 6px; color: var(--d10-accent); font: bold 14px Georgia,serif; }
|
||||
.sheet-d10 .sheet-stat { display: grid; grid-template-columns: minmax(0,1fr) 66px 66px 42px; gap: 7px; align-items: center; }
|
||||
.sheet-d10 .sheet-stat-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 10px; }
|
||||
.sheet-d10 .sheet-stat { min-height: 43px; padding: 6px 9px; border: 1px solid var(--d10-border); border-left: 3px solid var(--d10-accent); background: var(--d10-background); }
|
||||
.sheet-d10 .sheet-stat strong { overflow: hidden; color: var(--d10-ink); font: bold 12px Georgia,serif; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.sheet-d10 .sheet-stat label { display: grid; gap: 2px; margin: 0 !important; color: var(--d10-accent); font: bold 9px Arial,sans-serif; text-align: center; text-transform: uppercase; }
|
||||
.sheet-d10 .sheet-resource-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
|
||||
.sheet-d10 .sheet-resource { display: grid; grid-template-columns: minmax(110px,1fr) 75px 12px 75px; gap: 6px; align-items: end; padding: 9px 11px; background: var(--d10-background); border-left: 3px solid var(--d10-accent); }
|
||||
.sheet-d10 .sheet-resource strong { align-self: center; font-size: 12px; }
|
||||
.sheet-d10 .sheet-resource label { display: grid; gap: 3px; margin: 0 !important; color: var(--d10-accent); font: bold 9px Arial,sans-serif; text-transform: uppercase; }
|
||||
.sheet-d10 .sheet-resource > span { align-self: end; text-align: center; font-size: 18px; }
|
||||
.sheet-d10 .sheet-body-maps { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 13px; }
|
||||
.sheet-d10 .sheet-map-card { min-width: 0; overflow-x: auto; padding: 10px; background: var(--d10-background); border: 1px solid var(--d10-border); }
|
||||
.sheet-d10 .sheet-map-card h3 { margin: 0; padding: 2px 4px 8px; color: var(--d10-accent); font: bold 16px Georgia,serif; text-align: center; border-bottom: 1px solid var(--d10-border); }
|
||||
.sheet-d10 .sheet-body-figure { position: relative; width: 330px; height: 365px; margin: 8px auto 0; }
|
||||
.sheet-d10 .sheet-body-image { position: absolute; top: 32px; left: 92px; display: block; width: 146px; height: 300px; filter: var(--d10-figure-filter); pointer-events: none; }
|
||||
.sheet-d10 .sheet-zone { position: absolute; z-index: 1; display: grid; justify-items: center; gap: 2px; min-width: 56px; padding: 3px; background: var(--d10-panel); border: 1px solid var(--d10-border); border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,.12); }
|
||||
.sheet-d10 .sheet-zone-label { color: var(--d10-accent); font: bold 9px Arial,sans-serif; white-space: nowrap; }
|
||||
.sheet-d10 .sheet-zone input[type=number] { width: 46px; height: 28px; padding: 2px; font-size: 12px; }
|
||||
.sheet-d10 .sheet-zone-head { top: 8px; left: 136px; }
|
||||
.sheet-d10 .sheet-zone-body { top: 112px; left: 136px; }
|
||||
.sheet-d10 .sheet-zone-left_arm { top: 180px; left: 31px; }
|
||||
.sheet-d10 .sheet-zone-right_arm { top: 180px; right: 31px; }
|
||||
.sheet-d10 .sheet-zone-left_leg { top: 280px; left: 61px; }
|
||||
.sheet-d10 .sheet-zone-right_leg { top: 280px; right: 61px; }
|
||||
.sheet-d10 .sheet-map-armor .sheet-zone { grid-template-columns: repeat(3,42px); column-gap: 3px; }
|
||||
.sheet-d10 .sheet-map-armor .sheet-zone-label { grid-column: 1/-1; }
|
||||
.sheet-d10 .sheet-map-armor .sheet-zone label { display: grid; justify-items: center; gap: 2px; margin: 0 !important; color: var(--d10-accent); font: bold 8px Arial,sans-serif; }
|
||||
.sheet-d10 .sheet-map-armor .sheet-zone input[type=number] { width: 42px; }
|
||||
.sheet-d10 .sheet-map-armor .sheet-zone-head, .sheet-d10 .sheet-map-armor .sheet-zone-body { left: 95px; }
|
||||
.sheet-d10 .sheet-map-armor .sheet-zone-left_arm { left: 0; }
|
||||
.sheet-d10 .sheet-map-armor .sheet-zone-right_arm { right: 0; }
|
||||
.sheet-d10 .sheet-map-armor .sheet-zone-left_leg { left: 14px; }
|
||||
.sheet-d10 .sheet-map-armor .sheet-zone-right_leg { right: 14px; }
|
||||
.sheet-d10 .sheet-map-legend { margin: 0; color: var(--d10-accent); font: italic 11px Georgia,serif; text-align: center; }
|
||||
.sheet-d10 .sheet-combat-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
|
||||
.sheet-d10 .sheet-combat-field { display: grid; gap: 4px; margin: 0 !important; padding: 8px; color: var(--d10-accent); background: var(--d10-background); font: bold 10px Arial,sans-serif; text-transform: uppercase; }
|
||||
.sheet-d10 .sheet-combat-field-initiative { grid-template-columns: 90px 34px; align-items: end; justify-content: start; gap: 9px; }
|
||||
.sheet-d10 .sheet-combat-field-initiative label { display: grid; gap: 4px; margin: 0 !important; color: var(--d10-accent); }
|
||||
.sheet-d10 .sheet-combat-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px; background: var(--d10-background); }
|
||||
.sheet-d10 .sheet-combat-actions span { margin-right: auto; color: var(--d10-accent); font-weight: bold; }
|
||||
.sheet-d10 .sheet-weapon-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
|
||||
.sheet-d10 .sheet-weapon { display: grid; grid-template-columns: minmax(0,1fr) 65px 18px; gap: 5px; align-items: center; padding: 8px; background: var(--d10-background); border: 1px solid var(--d10-border); }
|
||||
.sheet-d10 .sheet-weapon span { grid-column: 1/-1; color: var(--d10-accent); font: bold 10px Arial,sans-serif; text-transform: uppercase; }
|
||||
.sheet-d10 .sheet-skill-group { margin: 9px 0 16px; border: 1px solid var(--d10-border); }
|
||||
.sheet-d10 .sheet-skill-group h4 { margin: 0; padding: 7px 10px; color: var(--d10-panel); background: var(--d10-accent); font: bold 13px Georgia,serif; }
|
||||
.sheet-d10 .sheet-skill-head, .sheet-d10 .sheet-skill-row { display: grid; grid-template-columns: minmax(170px,1fr) 110px 60px 60px 42px; gap: 8px; align-items: center; padding: 5px 10px; }
|
||||
.sheet-d10 .sheet-skill-head { color: var(--d10-accent); font: bold 9px Arial,sans-serif; letter-spacing: .05em; text-transform: uppercase; text-align: center; border-bottom: 1px solid var(--d10-border); }
|
||||
.sheet-d10 .sheet-skill-head span:first-child { text-align: left; }
|
||||
.sheet-d10 .sheet-skill-row { min-height: 38px; }
|
||||
.sheet-d10 .sheet-skill-row:nth-child(even) { background: var(--d10-background); }
|
||||
.sheet-d10 .sheet-skill-name { overflow: hidden; font-weight: bold; text-overflow: ellipsis; }
|
||||
.sheet-d10 .sheet-subskill .sheet-skill-name { padding-left: 16px; font-weight: normal; }
|
||||
.sheet-d10 .sheet-subskill .sheet-skill-name::before { content: '↳ '; color: var(--d10-accent); }
|
||||
.sheet-d10 button[type=roll].sheet-roll { display: inline-grid; place-items: center; width: 34px; min-width: 34px; height: 30px; margin: 0 !important; padding: 0 !important; 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; line-height: 1; text-shadow: none; }
|
||||
.sheet-d10 button[type=roll].sheet-show { width: 52px; min-width: 52px; }
|
||||
.sheet-d10 button[type=roll].sheet-roll::before { content: none !important; display: none !important; }
|
||||
.sheet-d10 button[type=roll].sheet-roll:hover, .sheet-d10 button[type=roll].sheet-roll:focus { filter: brightness(1.15); outline: 2px solid var(--d10-border); }
|
||||
.sheet-d10 details { margin: 8px 0; border: 1px solid var(--d10-border); }
|
||||
.sheet-d10 summary { padding: 7px 10px; color: var(--d10-accent); background: var(--d10-background); font-weight: bold; cursor: pointer; }
|
||||
.sheet-d10 fieldset { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px; border: 0; }
|
||||
.sheet-d10 .sheet-repeater label { display: grid; gap: 3px; margin: 0 !important; color: var(--d10-accent); font: bold 9px Arial,sans-serif; text-transform: uppercase; }
|
||||
.sheet-d10 .sheet-repeater { display: flex; flex-wrap: wrap; gap: 7px; align-items: end; width: 100%; }
|
||||
.sheet-d10 .sheet-repeater label { flex: 1 1 110px; min-width: 0; }
|
||||
.sheet-d10 .sheet-repeater .sheet-repeater-skillname, .sheet-d10 .sheet-repeater .sheet-repeater-name, .sheet-d10 .sheet-repeater .sheet-repeater-notes { flex-grow: 2; }
|
||||
.sheet-d10 .sheet-repeater .sheet-repeater-skilllevel, .sheet-d10 .sheet-repeater .sheet-repeater-skillcost, .sheet-d10 .sheet-repeater .sheet-repeater-quantity, .sheet-d10 .sheet-repeater .sheet-repeater-damage { flex: 0 1 70px; }
|
||||
.sheet-d10 .sheet-repeater .sheet-repeater-attribute { flex: 1 1 130px; }
|
||||
.sheet-d10 .sheet-repeater .sheet-roll { flex: 0 0 34px; }
|
||||
.sheet-d10 .sheet-repeater .sheet-show { flex-basis: 52px; }
|
||||
.sheet-d10 .sheet-weapon-repeater { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 9px; padding: 10px; background: var(--d10-background); border: 1px solid var(--d10-border); }
|
||||
.sheet-d10 .sheet-weapon-field { display: grid; gap: 3px; min-width: 0; margin: 0 !important; color: var(--d10-accent); font: bold 10px Arial,sans-serif; text-transform: uppercase; }
|
||||
.sheet-d10 .sheet-weapon-field input, .sheet-d10 .sheet-weapon-field select { min-width: 0; }
|
||||
.sheet-d10 .sheet-weapon-name, .sheet-d10 .sheet-weapon-notes { grid-column: span 3; }
|
||||
.sheet-d10 .sheet-weapon-skill_id, .sheet-d10 .sheet-weapon-weapon_type { grid-column: span 2; }
|
||||
.sheet-d10 .sheet-weapon-actions { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 1/-1; }
|
||||
.sheet-d10 .sheet-weapon-actions button[type=action] { min-height: 30px; margin: 0 !important; padding: 3px 9px; color: var(--d10-panel); background: var(--d10-accent); border: 1px solid var(--d10-accent); border-radius: 2px; box-shadow: none; font: bold 11px Arial,sans-serif; text-shadow: none; }
|
||||
.sheet-d10 .sheet-weapon-status { grid-column: 1/-1; min-height: 16px; color: var(--d10-accent); font: 11px Arial,sans-serif; }
|
||||
.sheet-rolltemplate-d10skillcheck, .sheet-rolltemplate-d10weapon, .sheet-rolltemplate-d10contact, .sheet-rolltemplate-d10consumable { overflow: hidden; color: var(--d10-ink); background: var(--d10-panel); border: 1px solid var(--d10-border); border-left: 4px solid var(--d10-accent); font: 12px Georgia,serif; }
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-title, .sheet-rolltemplate-d10weapon .sheet-roll-title, .sheet-rolltemplate-d10contact .sheet-roll-title, .sheet-rolltemplate-d10consumable .sheet-roll-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 7px; padding: 7px 9px; border-bottom: 1px solid var(--d10-border); }
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-title strong, .sheet-rolltemplate-d10weapon .sheet-roll-title strong, .sheet-rolltemplate-d10contact .sheet-roll-title strong, .sheet-rolltemplate-d10consumable .sheet-roll-title strong { font-size: 14px; }
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-title span, .sheet-rolltemplate-d10weapon .sheet-roll-title span, .sheet-rolltemplate-d10contact .sheet-roll-title span, .sheet-rolltemplate-d10consumable .sheet-roll-title span { opacity: .85; }
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-values, .sheet-rolltemplate-d10weapon .sheet-roll-values { display: grid; grid-template-columns: auto minmax(36px,auto) auto minmax(36px,auto); gap: 6px; align-items: center; justify-content: start; padding: 8px 9px; }
|
||||
.sheet-rolltemplate-d10skillcheck .sheet-roll-value, .sheet-rolltemplate-d10weapon .sheet-roll-value { min-width: 30px; text-align: center; }
|
||||
.sheet-rolltemplate-d10weapon .sheet-roll-damage-list { text-align: left; white-space: normal; }
|
||||
.sheet-rolltemplate-d10skillcheck .inlinerollresult, .sheet-rolltemplate-d10weapon .inlinerollresult { display: inline-block; min-width: 28px; padding: 2px 5px; color: #20242b !important; background: #ffffff !important; border: 1px solid #68717d !important; border-radius: 3px; font-weight: bold; text-align: center; text-shadow: none !important; }
|
||||
.sheet-rolltemplate-d10weapon .sheet-roll-detail, .sheet-rolltemplate-d10contact .sheet-roll-detail, .sheet-rolltemplate-d10consumable .sheet-roll-detail { padding: 4px 9px; border-top: 1px solid var(--d10-border); }
|
||||
@media (max-width: 760px) {
|
||||
.sheet-d10 { padding: 9px; }
|
||||
.sheet-d10 .sheet-stat-grid, .sheet-d10 .sheet-resource-grid, .sheet-d10 .sheet-weapon-grid { grid-template-columns: 1fr; }
|
||||
.sheet-d10 .sheet-hero { grid-template-columns: 45px minmax(0,1fr); gap: 9px; }
|
||||
.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)); }
|
||||
.sheet-d10 .sheet-weapon-name, .sheet-d10 .sheet-weapon-notes, .sheet-d10 .sheet-weapon-skill_id, .sheet-d10 .sheet-weapon-weapon_type { grid-column: span 2; }
|
||||
.sheet-d10 .sheet-skill-head, .sheet-d10 .sheet-skill-row { grid-template-columns: minmax(110px,1fr) 72px 48px 48px 36px; gap: 4px; padding: 4px; }
|
||||
.sheet-d10 .sheet-body-maps { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
|
@ -1,236 +0,0 @@
|
|||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tools'))
|
||||
import build
|
||||
|
||||
|
||||
class BuildTests(unittest.TestCase):
|
||||
def test_all_variants_and_themes(self):
|
||||
for variant in ('base', 'cyberpunk'):
|
||||
for theme in ('parchment', 'night'):
|
||||
with self.subTest(variant=variant, theme=theme), tempfile.TemporaryDirectory() as tmp:
|
||||
files = build.build(variant, theme, Path(tmp))
|
||||
self.assertEqual(set(files), {p.name for p in Path(tmp).iterdir()})
|
||||
info = json.loads(files['build-info.json'])
|
||||
self.assertEqual(info['variant'], variant)
|
||||
self.assertGreater(info['skills'], 10)
|
||||
self.assertIn('repeating_', files['sheet.html'])
|
||||
self.assertIn('sheet-rolltemplate-d10skillcheck', files['sheet.html'])
|
||||
self.assertIn('class="sheet-roll-values"', files['sheet.html'])
|
||||
self.assertIn('class="sheet-roll-value">{{result}}', files['sheet.html'])
|
||||
self.assertIn('.sheet-rolltemplate-d10skillcheck .inlinerollresult', files['sheet.css'])
|
||||
self.assertIn('color: #20242b !important; background: #ffffff !important', files['sheet.css'])
|
||||
self.assertIn('class="sheet-stat-grid"', files['sheet.html'])
|
||||
self.assertIn('1d@{dice}cs1cf@{dice}', files['sheet.html'])
|
||||
self.assertIn('1d10cs1cf10', files['sheet.html'])
|
||||
self.assertIn('class="sheet-skill-head"', files['sheet.html'])
|
||||
self.assertEqual(files['sheet.html'].count('class="sheet-page sheet-page-'), 2 if variant == 'base' else 3)
|
||||
self.assertIn('name="attr_d10_tab" value="skills"', files['sheet.html'])
|
||||
self.assertIn('name="attr_d10_theme_choice"', files['sheet.html'])
|
||||
self.assertIn(f'.sheet-theme-state[value="{theme}"] ~ .sheet-d10', files['sheet.css'])
|
||||
self.assertNotIn('name="act_tab_core"', files['sheet.html'])
|
||||
self.assertLess(files['sheet.html'].index('01</span>'), files['sheet.html'].index('class="sheet-tab-nav"'))
|
||||
self.assertLess(files['sheet.html'].index('02</span>'), files['sheet.html'].index('class="sheet-tab-nav"'))
|
||||
self.assertIn('.sheet-tab-state[value="skills"] ~ .sheet-page-skills', files['sheet.css'])
|
||||
self.assertIn('.sheet-tab-state[value="core"] ~ .sheet-page-skills', files['sheet.css'])
|
||||
self.assertEqual(files['sheet.html'].count('class="sheet-skill-row'), info['skills'])
|
||||
if variant == 'base':
|
||||
markup = files['sheet.html']
|
||||
self.assertIn('<option value="parchment"', markup)
|
||||
self.assertIn('<option value="night"', markup)
|
||||
self.assertNotIn('<option value="bluecore"', markup)
|
||||
self.assertNotIn('.sheet-theme-state[value="bluecore"]', files['sheet.css'])
|
||||
self.assertNotIn('name="act_tab_other"', markup)
|
||||
self.assertEqual(markup.count('class="sheet-skill-pane sheet-skill-pane-'), 4)
|
||||
self.assertLess(markup.index('name="attr_general_skilllevel_Perfection"'), markup.index('class="sheet-skill-pane sheet-skill-pane-free"'))
|
||||
for tab, section in (('fight', 'general-combat-skills'), ('free', 'skills'),
|
||||
('magic', 'magic-skills'), ('equipment', 'equipment')):
|
||||
self.assertIn(f'name="act_skill_tab_{tab}"', markup)
|
||||
self.assertIn(f'.sheet-skill-tab-state[value="{tab}"] ~ .sheet-skill-pane-{tab}', files['sheet.css'])
|
||||
self.assertLess(markup.index(f'class="sheet-skill-pane sheet-skill-pane-{tab}"'),
|
||||
markup.index(f'class="repeating_{section}"'))
|
||||
self.assertEqual(markup.count(f'class="repeating_{section}"'), 1)
|
||||
else:
|
||||
self.assertEqual(files['sheet.html'].count('class="sheet-skill-pane sheet-category-pane-'), 3)
|
||||
self.assertIn('name="attr_d10_category_tab" value="physique"', files['sheet.html'])
|
||||
for tab in ('physique', 'intellectuelles', 'social'):
|
||||
self.assertIn(f'.sheet-category-tab-state[value="{tab}"] ~ .sheet-category-pane-{tab}', files['sheet.css'])
|
||||
self.assertNotIn('name="act_category_tab_arsenal"', files['sheet.html'])
|
||||
combat_page = files['sheet.html'].split('class="sheet-page sheet-page-combat"', 1)[1].split('class="sheet-page sheet-page-skills"', 1)[0]
|
||||
self.assertIn('name="attr_d10_arsenal_tab"', combat_page)
|
||||
self.assertIn('class="repeating_distance"', combat_page)
|
||||
self.assertIn('class="repeating_melee"', combat_page)
|
||||
self.assertIn('class="repeating_consommable"', combat_page)
|
||||
for section in ('distance', 'melee', 'consommable'):
|
||||
self.assertIn(f'name="act_arsenal_tab_{section}"', files['sheet.html'])
|
||||
self.assertEqual(files['sheet.html'].count(f'class="repeating_{section}"'), 1)
|
||||
for action in ('firesingle', 'fireburst', 'fireauto', 'reload', 'damage'):
|
||||
self.assertIn(f'name="act_{action}"', files['sheet.html'])
|
||||
self.assertIn('name="attr_ammo_current"', files['sheet.html'])
|
||||
self.assertIn('<span class="sheet-weapon-status" name="attr_weapon_status"></span>', files['sheet.html'])
|
||||
self.assertIn('name="attr_damage_per_success"', files['sheet.html'])
|
||||
self.assertIn('d10<${threshold}cs1cf10', files['sheet.html'])
|
||||
self.assertNotIn('D10_WEAPON_DIAGNOSTIC', files['sheet.html'])
|
||||
self.assertIn('{{#ammo_info}}<div class="sheet-roll-detail">Chargeur :', files['sheet.html'])
|
||||
self.assertEqual(files['sheet.html'].count('name="attr_rmax"'), 2)
|
||||
self.assertNotIn('name="attr_attack_dice"', files['sheet.html'])
|
||||
contacts = re.search(r'<fieldset class="repeating_contacts-skills">(.*?)</fieldset>',
|
||||
files['sheet.html'], re.DOTALL)
|
||||
self.assertIsNotNone(contacts)
|
||||
self.assertNotIn('attr_attribute_select', contacts.group(1))
|
||||
self.assertNotIn('Caractéristique', contacts.group(1))
|
||||
self.assertIn('>Show</button>', contacts.group(1))
|
||||
self.assertIn('&{template:d10contact}', contacts.group(1))
|
||||
self.assertIn('sheet-rolltemplate-d10contact', files['sheet.html'])
|
||||
consumables = re.search(r'<fieldset class="repeating_consommable">(.*?)</fieldset>',
|
||||
files['sheet.html'], re.DOTALL)
|
||||
self.assertIsNotNone(consumables)
|
||||
self.assertIn('>Show</button>', consumables.group(1))
|
||||
self.assertIn('&{template:d10consumable}', consumables.group(1))
|
||||
for field in ('name', 'quantity', 'notes'):
|
||||
self.assertIn(f'@{{{field}}}', consumables.group(1))
|
||||
self.assertIn('<rolltemplate class="sheet-rolltemplate-d10consumable">', files['sheet.html'])
|
||||
self.assertIn('Quantité : {{quantity}}', files['sheet.html'])
|
||||
self.assertIn('.sheet-d10 .sheet-stat-grid { display: grid;', files['sheet.css'])
|
||||
self.assertIn('.sheet-d10 .sheet-skill-head, .sheet-d10 .sheet-skill-row { display: grid;', files['sheet.css'])
|
||||
self.assertIn('.sheet-d10 .sheet-body-maps { display: grid; grid-template-columns: repeat(2,minmax(0,1fr));', files['sheet.css'])
|
||||
self.assertIn('.sheet-d10 .sheet-zone-body { top: 112px;', files['sheet.css'])
|
||||
self.assertIn('-moz-appearance: textfield', files['sheet.css'])
|
||||
self.assertIn('::-webkit-inner-spin-button', files['sheet.css'])
|
||||
self.assertNotIn('Ravenous', files['sheet.html'])
|
||||
self.assertIn('--d10-accent:', files['sheet.css'])
|
||||
self.assertEqual(files, build.build(variant, theme, Path(tmp)))
|
||||
build.build(variant, theme, Path(tmp), check=True)
|
||||
(Path(tmp) / 'sheet.css').write_text('stale', encoding='utf-8')
|
||||
with self.assertRaisesRegex(ValueError, 'stale'):
|
||||
build.build(variant, theme, Path(tmp), check=True)
|
||||
|
||||
def test_attributes_referenced_by_generated_rolls(self):
|
||||
for variant in ('base', 'cyberpunk'):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
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 - {'character_id'}, referenced - declared)
|
||||
self.assertEqual(len(declared), len(set(declared)))
|
||||
self.assertIn('<summary>Échanges JSON</summary>', 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':
|
||||
self.assertIn('Initiative', declared)
|
||||
self.assertNotIn('general_attack_threshold', declared)
|
||||
self.assertNotIn('base_damage_dices', declared)
|
||||
self.assertNotIn('exal_damage_dices', declared)
|
||||
self.assertNotIn('general_item_weapon1', declared)
|
||||
self.assertNotIn('Jets de combat', markup)
|
||||
self.assertNotIn('Armes équipées', markup)
|
||||
self.assertIn('class="sheet-combat-field sheet-combat-field-initiative"', markup)
|
||||
self.assertIn('Life_Points_head', declared)
|
||||
self.assertIn('repeating_distance', markup)
|
||||
self.assertIn('class="sheet-body-maps"', markup)
|
||||
self.assertIn('class="sheet-map-card sheet-map-health"', markup)
|
||||
self.assertIn('class="sheet-map-card sheet-map-armor"', markup)
|
||||
for kind in ('health', 'armor'):
|
||||
image = f'robotman_{kind}_r.png'
|
||||
self.assertIn(f'src="{build.DEFAULT_ASSET_BASE_URL}{image}"', markup)
|
||||
self.assertEqual(build.ASSETS.joinpath(image).read_bytes(),
|
||||
Path(tmp, image).read_bytes())
|
||||
for location in build.LOCATIONS:
|
||||
for prefix in ('Life_Points', 'Armor_Protection_Points', 'Armor_Integrity_Points'):
|
||||
self.assertEqual(markup.count(f'name="attr_{prefix}_{location}"'), 1)
|
||||
self.assertEqual(markup.count(f'name="attr_Armor_Integrity_Points_{location}_maximum"'), 1)
|
||||
else:
|
||||
self.assertIn('general_attack_threshold', declared)
|
||||
self.assertIn('general_item_weapon1', declared)
|
||||
self.assertIn('Jets de combat', markup)
|
||||
self.assertIn('Armes équipées', markup)
|
||||
self.assertNotIn('class="sheet-body-maps"', markup)
|
||||
self.assertNotIn('robotman_health_r.png', markup)
|
||||
|
||||
def test_theme_is_visual_only(self):
|
||||
for variant in ('base', 'cyberpunk'):
|
||||
with self.subTest(variant=variant), tempfile.TemporaryDirectory() as tmp:
|
||||
one = build.build(variant, 'parchment', Path(tmp))
|
||||
two = build.build(variant, 'night', Path(tmp))
|
||||
def normalize(markup, theme):
|
||||
markup = markup.replace(f'theme-{theme}', 'theme-compiled').replace(' selected', '')
|
||||
return re.sub(r'(class="sheet-theme-state" name="attr_d10_theme" value=")[^"]+',
|
||||
r'\1compiled', markup)
|
||||
self.assertEqual(normalize(one['sheet.html'], 'parchment'), normalize(two['sheet.html'], 'night'))
|
||||
self.assertNotEqual(one['sheet.css'], two['sheet.css'])
|
||||
|
||||
def test_corporate_theme_selector(self):
|
||||
themes = build.read_yaml(build.DATA / 'themes.yaml')['themes']
|
||||
self.assertEqual(len(themes), 20)
|
||||
self.assertEqual(themes['parchment']['name'], 'Parchemin')
|
||||
self.assertEqual(themes['night']['name'], 'Nuit')
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
with self.assertRaisesRegex(ValueError, 'unknown theme for base'):
|
||||
build.build('base', 'bluecore', Path(tmp))
|
||||
def luminance(color):
|
||||
channels = [int(color[index:index + 2], 16) / 255 for index in (1, 3, 5)]
|
||||
linear = [value / 12.92 if value <= 0.04045 else ((value + 0.055) / 1.055) ** 2.4
|
||||
for value in channels]
|
||||
return sum(value * weight for value, weight in zip(linear, (0.2126, 0.7152, 0.0722)))
|
||||
for key, palette in themes.items():
|
||||
with self.subTest(theme=key), tempfile.TemporaryDirectory() as tmp:
|
||||
accent, panel = luminance(palette['accent']), luminance(palette['panel'])
|
||||
self.assertGreaterEqual((max(accent, panel) + 0.05) / (min(accent, panel) + 0.05), 4.5)
|
||||
files = build.build('cyberpunk', key, Path(tmp))
|
||||
self.assertIn(f'<option value="{key}" selected>', files['sheet.html'])
|
||||
self.assertIn(f'>{palette.get("name", key)}</option>', files['sheet.html'])
|
||||
self.assertIn(f'.sheet-theme-state[value="{key}"] ~ .sheet-d10', files['sheet.css'])
|
||||
self.assertIn(f'--d10-background: {palette["background"]}', files['sheet.css'])
|
||||
self.assertIn(f'--d10-figure-filter: {build.figure_filter(palette["background"])}', files['sheet.css'])
|
||||
build.build('cyberpunk', key, Path(tmp), check=True)
|
||||
|
||||
def test_hosted_image_urls(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
files = build.build('cyberpunk', 'parchment', Path(tmp),
|
||||
asset_base_url='https://example.org/d10/assets')
|
||||
self.assertIn('src="https://example.org/d10/assets/robotman_health_r.png"', files['sheet.html'])
|
||||
self.assertIn('src="https://example.org/d10/assets/robotman_armor_r.png"', files['sheet.html'])
|
||||
build.build('cyberpunk', 'parchment', Path(tmp), check=True,
|
||||
asset_base_url='https://example.org/d10/assets')
|
||||
with self.assertRaisesRegex(ValueError, 'missing or stale'):
|
||||
build.build('cyberpunk', 'parchment', Path(tmp), check=True)
|
||||
with self.assertRaisesRegex(ValueError, 'HTTPS'):
|
||||
build.build('cyberpunk', 'parchment', Path(tmp), asset_base_url='http://example.org')
|
||||
local = build.build('cyberpunk', 'parchment', Path(tmp), asset_base_url='')
|
||||
self.assertIn('src="robotman_health_r.png"', local['sheet.html'])
|
||||
|
||||
def test_rejects_bad_data(self):
|
||||
source = build.read_yaml(build.DATA / 'sheet_model.yaml')
|
||||
skills = build.read_yaml(build.DATA / 'cyberpunk_skills.yaml')
|
||||
theme = build.read_yaml(build.DATA / 'themes.yaml')['themes']['night']
|
||||
model = {**source['variants']['cyberpunk'], 'version': 1}
|
||||
build.validate(model, skills, theme)
|
||||
bad = {'sections': [{'id': 'test', 'name': 'Test', 'groups': [{'name': 'Test', 'skills': [
|
||||
{'id': 'one', 'name': 'One'}, {'id': 'one', 'name': 'Duplicate'}]}]}]}
|
||||
with self.assertRaisesRegex(ValueError, 'duplicate skill'):
|
||||
build.validate({**model, 'skill_category_tabs': False}, bad, theme)
|
||||
with self.assertRaisesRegex(ValueError, 'at least two unique'):
|
||||
build.validate(model, bad, theme)
|
||||
with self.assertRaisesRegex(ValueError, 'invalid theme color'):
|
||||
build.validate(model, skills, {**theme, 'accent': 'red'})
|
||||
with self.assertRaisesRegex(ValueError, 'unsupported health location'):
|
||||
build.validate({**model, 'health_locations': ['tail']}, skills, theme)
|
||||
broken_weapons = [{**block, 'fields': [field for field in block['fields'] if field != 'ammo_current']}
|
||||
if block['id'] == 'distance' else block for block in model['repeating']]
|
||||
with self.assertRaisesRegex(ValueError, 'invalid weapon fields'):
|
||||
build.validate({**model, 'repeating': broken_weapons}, skills, theme)
|
||||
base = {**source['variants']['base'], 'version': 1}
|
||||
base_skills = build.read_yaml(build.DATA / 'base_skills.yaml')
|
||||
with self.assertRaisesRegex(ValueError, 'each skill group and repeating section exactly once'):
|
||||
build.validate({**base, 'skill_tabs': base['skill_tabs'][:-1]}, base_skills, theme)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
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(`<pre>${JSON.stringify(replacement)}</pre>`));
|
||||
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: '<b>Test</b>', attributes: [] };
|
||||
const escaped = JSON.stringify(payload).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
const handout = game.createObj('handout', { gmnotes: `<p>${escaped}</p>` });
|
||||
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'), '<b>Test</b>');
|
||||
});
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
from pathlib import Path
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tools'))
|
||||
import build
|
||||
import publish_builds
|
||||
|
||||
|
||||
class PublishBuildsTests(unittest.TestCase):
|
||||
def test_complete_artifact_tree(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = publish_builds.publish(Path(tmp) / 'RPG' / 'd10_character_sheet')
|
||||
for kind in ('health', 'armor'):
|
||||
filename = f'robotman_{kind}_r.png'
|
||||
self.assertEqual((root / 'assets' / filename).read_bytes(),
|
||||
(build.ASSETS / filename).read_bytes())
|
||||
for variant in ('base', 'cyberpunk'):
|
||||
target = root / variant
|
||||
self.assertTrue((target / 'sheet.html').is_file())
|
||||
self.assertTrue((target / 'sheet.css').is_file())
|
||||
self.assertFalse((target / 'night').exists())
|
||||
if variant == 'cyberpunk':
|
||||
self.assertIn(build.DEFAULT_ASSET_BASE_URL + 'robotman_health_r.png',
|
||||
(target / 'sheet.html').read_text(encoding='utf-8'))
|
||||
build.build(variant, 'parchment', target, check=True)
|
||||
(root / 'cyberpunk' / 'night').mkdir()
|
||||
publish_builds.publish(root)
|
||||
self.assertFalse((root / 'cyberpunk' / 'night').exists())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
@ -1,152 +0,0 @@
|
|||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import vm from 'node:vm';
|
||||
|
||||
const buildRoot = process.env.D10_BUILD_ROOT ?? 'RPG/d10_character_sheet';
|
||||
|
||||
for (const variant of ['base', 'cyberpunk']) {
|
||||
const tabs = variant === 'base' ? ['skills', 'combat'] : ['skills', 'combat', 'other'];
|
||||
const skillTabs = variant === 'base' ? ['fight', 'free', 'magic', 'equipment'] : [];
|
||||
const categoryTabs = variant === 'cyberpunk' ? ['physique', 'intellectuelles', 'social'] : [];
|
||||
const arsenalTabs = variant === 'cyberpunk' ? ['distance', 'melee', 'consommable'] : [];
|
||||
const html = readFileSync(`${buildRoot}/${variant}/sheet.html`, 'utf8');
|
||||
const script = html.match(/<script type="text\/worker">\s*([\s\S]*?)<\/script>/)?.[1];
|
||||
assert.ok(script, `${variant}: generated sheet worker`);
|
||||
const handlers = new Map();
|
||||
const attributes = { d10_tab: 'core' };
|
||||
const rolls = [];
|
||||
const finished = [];
|
||||
let attackResult = 2;
|
||||
let attackDice = [{ v: 1 }, { v: 4 }, { v: 9 }];
|
||||
let damageResult = 3;
|
||||
vm.runInNewContext(script, {
|
||||
on: (event, handler) => {
|
||||
assert.ok(!handlers.has(event), `duplicate handler: ${event}`);
|
||||
handlers.set(event, handler);
|
||||
},
|
||||
setAttrs: changes => Object.assign(attributes, changes),
|
||||
getAttrs: (names, callback) => callback(Object.fromEntries(names.map(name => [name, attributes[name]]))),
|
||||
startRoll: (command, callback) => {
|
||||
rolls.push(command);
|
||||
callback({ rollId: String(rolls.length), results: {
|
||||
attack_roll: { result: attackResult, dice: attackDice }, damage_roll: { result: damageResult },
|
||||
} });
|
||||
},
|
||||
finishRoll: (id, computed) => finished.push({ id, computed }),
|
||||
});
|
||||
assert.equal(handlers.size, tabs.length + skillTabs.length + categoryTabs.length + arsenalTabs.length + 1 + (variant === 'cyberpunk' ? 7 : 0));
|
||||
assert.ok(!handlers.has('clicked:tab_core'));
|
||||
for (const tab of tabs) {
|
||||
assert.match(html, new RegExp(`name="act_tab_${tab}"`));
|
||||
assert.match(html, new RegExp(`class="sheet-page sheet-page-${tab}"`));
|
||||
handlers.get(`clicked:tab_${tab}`)();
|
||||
assert.equal(attributes.d10_tab, tab);
|
||||
}
|
||||
for (const tab of skillTabs) {
|
||||
assert.match(html, new RegExp(`name="act_skill_tab_${tab}"`));
|
||||
assert.match(html, new RegExp(`class="sheet-skill-pane sheet-skill-pane-${tab}"`));
|
||||
handlers.get(`clicked:skill_tab_${tab}`)();
|
||||
assert.equal(attributes.d10_skill_tab, tab);
|
||||
}
|
||||
for (const tab of categoryTabs) {
|
||||
assert.match(html, new RegExp(`name="act_category_tab_${tab}"`));
|
||||
assert.match(html, new RegExp(`class="sheet-skill-pane sheet-category-pane-${tab}"`));
|
||||
handlers.get(`clicked:category_tab_${tab}`)();
|
||||
assert.equal(attributes.d10_category_tab, tab);
|
||||
}
|
||||
for (const tab of arsenalTabs) {
|
||||
assert.match(html, new RegExp(`name="act_arsenal_tab_${tab}"`));
|
||||
assert.match(html, new RegExp(`class="sheet-skill-pane sheet-arsenal-pane-${tab}"`));
|
||||
handlers.get(`clicked:arsenal_tab_${tab}`)();
|
||||
assert.equal(attributes.d10_arsenal_tab, tab);
|
||||
}
|
||||
if (variant === 'base') assert.match(html, /name="attr_d10_skill_tab" value="fight"/);
|
||||
if (variant === 'cyberpunk') assert.ok(!handlers.has('clicked:skill_tab_fight'));
|
||||
if (variant === 'cyberpunk') {
|
||||
assert.match(html, /name="attr_d10_category_tab" value="physique"/);
|
||||
assert.ok(!handlers.has('clicked:category_tab_arsenal'));
|
||||
assert.match(html, /class="sheet-page sheet-page-combat"[\s\S]*name="attr_d10_arsenal_tab"[\s\S]*class="sheet-page sheet-page-skills"/);
|
||||
}
|
||||
assert.match(html, /name="attr_d10_theme_choice"/);
|
||||
assert.match(html, /name="attr_d10_theme" value="parchment"/);
|
||||
handlers.get('change:d10_theme_choice')({ newValue: variant === 'base' ? 'night' : 'bluecore' });
|
||||
assert.equal(attributes.d10_theme, variant === 'base' ? 'night' : 'bluecore');
|
||||
if (variant === 'base') {
|
||||
assert.ok(!html.includes('<option value="bluecore"'));
|
||||
}
|
||||
if (variant === 'cyberpunk') {
|
||||
const ranged = 'repeating_distance_-test_';
|
||||
Object.assign(attributes, {
|
||||
dice: '10', combat_skilllevel_armesfeu: '3',
|
||||
[ranged + 'name']: 'Torpille', [ranged + 'skill_id']: 'armesfeu',
|
||||
[ranged + 'base_threshold']: '4', [ranged + 'accuracy']: '1',
|
||||
[ranged + 'damage']: '5',
|
||||
[ranged + 'damage_per_success']: '1', [ranged + 'rmax']: '1', [ranged + 'ammo_current']: '5',
|
||||
[ranged + 'magazine_size']: '10', [ranged + 'ammo_reserve']: '3',
|
||||
[ranged + 'single_cost']: '1', [ranged + 'burst_cost']: '3',
|
||||
});
|
||||
handlers.get('clicked:repeating_distance:firesingle')({ sourceAttribute: ranged + 'firesingle' });
|
||||
assert.match(rolls.at(-1), /template:d10weapon/);
|
||||
assert.match(rolls.at(-1), /name=Torpille/);
|
||||
assert.match(rolls.at(-1), /mode=Tir simple/);
|
||||
assert.match(rolls.at(-1), /\?\{Nombre de dés\|1\}d10<8cs1cf10/);
|
||||
assert.match(rolls.at(-1), /ammo=4/);
|
||||
assert.equal(attributes[ranged + 'ammo_current'], 4);
|
||||
assert.equal(finished.at(-1).computed.damage, 5);
|
||||
attributes[ranged + 'ammo_current'] = 2;
|
||||
handlers.get('clicked:repeating_distance:fireburst')({ sourceAttribute: ranged + 'fireburst' });
|
||||
assert.match(rolls.at(-1), /mode=Rafale/);
|
||||
assert.match(rolls.at(-1), /\(\?\{Nombre de dés\|1\}\+1\)d10<8cs1cf10/);
|
||||
assert.equal(attributes[ranged + 'ammo_current'], 0);
|
||||
assert.equal(finished.at(-1).computed.damage_list, '6, 5');
|
||||
attributes[ranged + 'ammo_current'] = 2;
|
||||
attributes[ranged + 'auto_cost'] = '5';
|
||||
handlers.get('clicked:repeating_distance:fireauto')({ sourceAttribute: ranged + 'fireauto' });
|
||||
assert.match(rolls.at(-1), /mode=Automatique/);
|
||||
assert.equal(attributes[ranged + 'ammo_current'], 0);
|
||||
assert.equal(finished.at(-1).computed.damage_list, '6, 5');
|
||||
attackResult = 3;
|
||||
attributes[ranged + 'ammo_current'] = 1;
|
||||
handlers.get('clicked:repeating_distance:fireauto')({ sourceAttribute: ranged + 'fireauto' });
|
||||
assert.equal(attributes[ranged + 'ammo_current'], 0);
|
||||
assert.equal(finished.at(-1).computed.damage_list, '6');
|
||||
attackResult = 2;
|
||||
handlers.get('clicked:repeating_distance:damage')({ sourceAttribute: ranged + 'damage' });
|
||||
assert.match(rolls.at(-1), /mode=Dégâts/);
|
||||
assert.equal(finished.at(-1).computed.damage, 5);
|
||||
const rollCount = rolls.length;
|
||||
handlers.get('clicked:repeating_distance:firesingle')({ sourceAttribute: ranged + 'firesingle' });
|
||||
assert.equal(rolls.length, rollCount);
|
||||
assert.match(attributes[ranged + 'weapon_status'], /Chargeur insuffisant/);
|
||||
attributes[ranged + 'ammo_current'] = '4';
|
||||
handlers.get('clicked:repeating_distance:reload')({ sourceAttribute: ranged + 'reload' });
|
||||
assert.equal(attributes[ranged + 'ammo_current'], 10);
|
||||
assert.equal(attributes[ranged + 'ammo_reserve'], 2);
|
||||
handlers.get('clicked:repeating_distance:reload')({ sourceAttribute: ranged + 'reload' });
|
||||
assert.equal(attributes[ranged + 'ammo_reserve'], 2);
|
||||
assert.match(attributes[ranged + 'weapon_status'], /déjà plein/);
|
||||
attributes[ranged + 'ammo_current'] = 4;
|
||||
attributes[ranged + 'ammo_reserve'] = 0;
|
||||
handlers.get('clicked:repeating_distance:reload')({ sourceAttribute: ranged + 'reload' });
|
||||
assert.equal(attributes[ranged + 'ammo_current'], 4);
|
||||
assert.match(attributes[ranged + 'weapon_status'], /Aucun chargeur/);
|
||||
attributes[ranged + 'ammo_reserve'] = 2;
|
||||
attributes[ranged + 'magazine_size'] = 0;
|
||||
handlers.get('clicked:repeating_distance:reload')({ sourceAttribute: ranged + 'reload' });
|
||||
assert.equal(attributes[ranged + 'ammo_reserve'], 2);
|
||||
assert.match(attributes[ranged + 'weapon_status'], /Taille du chargeur/);
|
||||
const melee = 'repeating_melee_-test_';
|
||||
Object.assign(attributes, {
|
||||
[melee + 'name']: 'Kataba', [melee + 'damage']: '4',
|
||||
[melee + 'damage_per_success']: '2', [melee + 'rmax']: '2',
|
||||
[melee + 'base_threshold']: '4',
|
||||
});
|
||||
handlers.get('clicked:repeating_melee:attack')({ sourceAttribute: melee + 'attack' });
|
||||
assert.match(rolls.at(-1), /mode=Mêlée/);
|
||||
assert.match(rolls.at(-1), /\?\{Nombre de dés\|1\}d10<4cs1cf10/);
|
||||
assert.equal(finished.at(-1).computed.damage, 6);
|
||||
handlers.get('clicked:repeating_melee:damage')({ sourceAttribute: melee + 'damage' });
|
||||
assert.match(rolls.at(-1), /mode=Dégâts/);
|
||||
assert.equal(finished.at(-1).computed.damage, 6);
|
||||
}
|
||||
}
|
||||
562
tools/build.py
562
tools/build.py
|
|
@ -1,562 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Build the two D10 Roll20 sheets from explicit models and skill YAML."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import html
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
||||
import yaml
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DATA = ROOT / 'data'
|
||||
ASSETS = ROOT / 'assets'
|
||||
DEFAULT_ASSET_BASE_URL = 'https://books.dandaedre.com/RPG/d10_character_sheet/assets/'
|
||||
BASE_THEMES = ('parchment', 'night')
|
||||
IDENT = re.compile(r'^[A-Za-z][A-Za-z0-9_-]*$')
|
||||
COLOR = re.compile(r'^#[0-9a-fA-F]{6}$')
|
||||
TABS = (('skills', 'Compétences'), ('combat', 'Combat'), ('other', 'Autres'))
|
||||
LOCATIONS = {
|
||||
'head': 'Tête', 'body': 'Torse',
|
||||
'left_arm': 'Bras gauche', 'right_arm': 'Bras droit',
|
||||
'left_leg': 'Jambe gauche', 'right_leg': 'Jambe droite',
|
||||
}
|
||||
FIELD_LABELS = {
|
||||
'skillname': 'Nom', 'skilllevel': 'Niveau', 'skillcost': 'Coût',
|
||||
'name': 'Nom', 'notes': 'Notes', 'damage': 'Dégâts', 'quantity': 'Quantité',
|
||||
}
|
||||
WEAPON_FIELDS = {
|
||||
'distance': {'name', 'damage', 'notes', 'weapon_type', 'accuracy', 'base_threshold',
|
||||
'skill_id', 'single_cost', 'burst_cost', 'auto_cost',
|
||||
'ammo_current', 'magazine_size', 'ammo_reserve', 'damage_per_success', 'rmax',
|
||||
'weapon_status'},
|
||||
'melee': {'name', 'damage', 'notes', 'weapon_type', 'accuracy', 'base_threshold',
|
||||
'skill_id', 'damage_per_success', 'rmax', 'weapon_status'},
|
||||
}
|
||||
|
||||
|
||||
def read_yaml(path):
|
||||
return yaml.safe_load(path.read_text(encoding='utf-8'))
|
||||
|
||||
|
||||
def ident(value):
|
||||
if not isinstance(value, str) or not IDENT.fullmatch(value):
|
||||
raise ValueError(f'invalid Roll20 identifier: {value!r}')
|
||||
return value
|
||||
|
||||
|
||||
def esc(value):
|
||||
return html.escape(str(value), quote=True)
|
||||
|
||||
|
||||
def figure_filter(background):
|
||||
channels = [int(background[index:index + 2], 16) for index in (1, 3, 5)]
|
||||
return 'invert(1)' if sum(channels) / 3 < 130 else 'none'
|
||||
|
||||
|
||||
def validate(model, skills, theme):
|
||||
if model.get('version') != 1:
|
||||
raise ValueError('unsupported model version')
|
||||
for color in (theme[key] for key in ('background', 'panel', 'ink', 'accent', 'border') if key in theme):
|
||||
if not isinstance(color, str) or not COLOR.fullmatch(color):
|
||||
raise ValueError(f'invalid theme color: {color!r}')
|
||||
for required in ('background', 'panel', 'ink', 'accent', 'border'):
|
||||
if required not in theme:
|
||||
raise ValueError(f'missing theme color: {required}')
|
||||
fields = set()
|
||||
for item in model['attributes'] + model['resources']:
|
||||
key = ident(item['id'])
|
||||
if key in fields:
|
||||
raise ValueError(f'duplicate field: {key}')
|
||||
fields.add(key)
|
||||
for item in model.get('combat', []):
|
||||
key = ident(item['id'])
|
||||
if key in fields:
|
||||
raise ValueError(f'duplicate field: {key}')
|
||||
fields.add(key)
|
||||
for location in model.get('health_locations', []):
|
||||
ident(location)
|
||||
if location not in LOCATIONS:
|
||||
raise ValueError(f'unsupported health location: {location}')
|
||||
if len(set(model.get('health_locations', []))) != len(model.get('health_locations', [])):
|
||||
raise ValueError('duplicate health location')
|
||||
if not isinstance(model.get('weapons', 0), int) or not 0 <= model.get('weapons', 0) <= 10:
|
||||
raise ValueError('weapons must be an integer from 0 to 10')
|
||||
sections = skills['sections']
|
||||
if not isinstance(sections, list) or not sections:
|
||||
raise ValueError('skills need sections')
|
||||
if model.get('skill_category_tabs'):
|
||||
if model.get('skill_tabs'):
|
||||
raise ValueError('choose one skill tab layout')
|
||||
category_ids = [ident(section.get('id')) for section in sections
|
||||
if any(group.get('skills') for group in section['groups'])]
|
||||
if len(category_ids) < 2 or len(category_ids) != len(set(category_ids)):
|
||||
raise ValueError('skill categories need at least two unique tab identifiers')
|
||||
generated_fields = set()
|
||||
for section in sections:
|
||||
for group in section['groups']:
|
||||
prefix = ''.join(c for c in group['name'].replace(' ', '') if c.isascii() and c.isalpha()).lower()
|
||||
if not prefix:
|
||||
raise ValueError(f'group has no usable identifier: {group["name"]!r}')
|
||||
seen = set()
|
||||
for skill in group.get('skills', []):
|
||||
key = ident(skill['id'])
|
||||
if key in seen:
|
||||
raise ValueError(f'duplicate skill in {group["name"]}: {key}')
|
||||
seen.add(key)
|
||||
stem = f'{prefix}_skilllevel_{key}'
|
||||
if stem in generated_fields:
|
||||
raise ValueError(f'duplicate generated skill field: {stem}')
|
||||
generated_fields.add(stem)
|
||||
if skill.get('parent') and skill['parent'] not in seen:
|
||||
raise ValueError(f'unknown or later parent for {key}')
|
||||
repeating_ids = set()
|
||||
for block in model['repeating']:
|
||||
ident(block['id'])
|
||||
if block['id'] in repeating_ids:
|
||||
raise ValueError(f'duplicate repeating section: {block["id"]}')
|
||||
repeating_ids.add(block['id'])
|
||||
for field in block['fields']:
|
||||
ident(field)
|
||||
if model.get('skill_category_tabs') and block['id'] in WEAPON_FIELDS and set(block['fields']) != WEAPON_FIELDS[block['id']]:
|
||||
raise ValueError(f'invalid weapon fields: {block["id"]}')
|
||||
if model.get('skill_category_tabs'):
|
||||
equipment_ids = [ident(group['equipment']) for section in sections for group in section['groups']
|
||||
if group.get('equipment')]
|
||||
if len(equipment_ids) != len(set(equipment_ids)) or not set(equipment_ids) <= repeating_ids:
|
||||
raise ValueError('equipment categories must reference unique repeating sections')
|
||||
if not combat_skills(skills):
|
||||
raise ValueError('cyberpunk weapons need combat skills')
|
||||
if model.get('skill_tabs'):
|
||||
tab_ids = set()
|
||||
content_ids = []
|
||||
for tab in model['skill_tabs']:
|
||||
key = ident(tab['id'])
|
||||
if key in tab_ids:
|
||||
raise ValueError(f'duplicate skill tab: {key}')
|
||||
tab_ids.add(key)
|
||||
content_ids.extend(tab['content'])
|
||||
expected = repeating_ids | {'fixed_skills'}
|
||||
if set(content_ids) != expected or len(content_ids) != len(expected):
|
||||
raise ValueError('skill tabs must place each skill group and repeating section exactly once')
|
||||
|
||||
|
||||
def roll(label, threshold, combat=False):
|
||||
die = '10' if combat else '@{dice}'
|
||||
expression = f'{threshold}-1d{die}cs1cf{die}'
|
||||
value = ('&{template:d10skillcheck} '
|
||||
'{{name=@{character_name}}} '
|
||||
f'{{{{roll_name={label}}}}} '
|
||||
f'{{{{dice_name={die}}}}} '
|
||||
f'{{{{threshold=[[{threshold}]]}}}} '
|
||||
f'{{{{result=[[{expression}]]}}}}')
|
||||
return f'<button type="roll" class="sheet-roll" value="{esc(value)}" title="Lancer {esc(label)}">Jet</button>'
|
||||
|
||||
|
||||
def render_skill(group, skill, variant):
|
||||
# Cyberpunk names follow the original generator's subgroup prefix and ID.
|
||||
prefix = ''.join(c for c in group['name'].replace(' ', '') if c.isascii() and c.isalpha()).lower()
|
||||
if variant == 'base':
|
||||
stem = f'general_skilllevel_{skill["id"]}'
|
||||
name_field = skill['name']
|
||||
else:
|
||||
stem = f'{prefix}_skilllevel_{skill["id"]}'
|
||||
name_field = skill['name']
|
||||
threshold = f'@{{{stem}}}+@{{skill_{prefix}_attribute_select_{skill["id"]}}}'
|
||||
if skill.get('parent'):
|
||||
threshold += f'+@{{{prefix}_skilllevel_{skill["parent"]}}}'
|
||||
options = [('Force', 'For'), ('Agilite', 'Agi'), ('Perception', 'Per'),
|
||||
('Charisme', 'Cha'), ('Intelligence', 'Int'), ('Volonte', 'Vol'),
|
||||
(('Psyche' if variant == 'base' else 'Accred'), ('Psy' if variant == 'base' else 'Acc')),
|
||||
('Chance', 'Chn')]
|
||||
selector = f'skill_{prefix}_attribute_select_{skill["id"]}'
|
||||
choices = ''.join(f'<option value="@{{base-{key}}}+@{{exal-{key}}}">{esc(short)}</option>' for key, short in options)
|
||||
depth = ' sheet-subskill' if skill.get('parent') else ''
|
||||
return (f'<div class="sheet-skill-row{depth}"><span class="sheet-skill-name">{esc(name_field)}</span>'
|
||||
f'<select name="attr_{selector}" title="Caractéristique">{choices}</select>'
|
||||
f'<input type="number" name="attr_{stem}" value="0" min="0" title="Niveau">'
|
||||
f'<input type="number" name="attr_{prefix}_skillcost_{skill["id"]}" value="0" min="0" title="Coût">'
|
||||
f'{roll(name_field, threshold)}</div>')
|
||||
|
||||
|
||||
def render_body_map(locations, kind, asset_base_url=''):
|
||||
title = 'Santé' if kind == 'health' else 'Armure'
|
||||
legend = 'PV par localisation' if kind == 'health' else 'P = protection · I = intégrité · Max = intégrité maximale'
|
||||
image_name = f'robotman_{kind}_r.png'
|
||||
image_url = f'{asset_base_url.rstrip("/")}/{image_name}' if asset_base_url else image_name
|
||||
parts = [f'<div class="sheet-map-card sheet-map-{kind}"><h3>{title}</h3>',
|
||||
f'<div class="sheet-body-figure"><img class="sheet-body-image" src="{esc(image_url)}" alt="" aria-hidden="true" width="146" height="300">']
|
||||
for location in locations:
|
||||
label = LOCATIONS[location]
|
||||
parts.append(f'<div class="sheet-zone sheet-zone-{location}"><span class="sheet-zone-label">{label}</span>')
|
||||
if kind == 'health':
|
||||
parts.append(f'<input type="number" name="attr_Life_Points_{location}" value="0" aria-label="PV {label}" title="PV {label}">')
|
||||
else:
|
||||
for field, short, descriptor in (('Armor_Protection_Points', 'P', 'Protection'),
|
||||
('Armor_Integrity_Points', 'I', 'Intégrité'),
|
||||
('Armor_Integrity_Points', 'Max', 'Intégrité maximale')):
|
||||
suffix = '_maximum' if short == 'Max' else ''
|
||||
parts.append(f'<label>{short}<input type="number" name="attr_{field}_{location}{suffix}" value="0" aria-label="{descriptor} {label}" title="{descriptor} {label}"></label>')
|
||||
parts.append('</div>')
|
||||
parts.append(f'</div><p class="sheet-map-legend">{legend}</p></div>')
|
||||
return ''.join(parts)
|
||||
|
||||
|
||||
def render_fixed_skills(skills, variant, show_sections=True, sections=None):
|
||||
parts = []
|
||||
for section in (skills['sections'] if sections is None else sections):
|
||||
if show_sections:
|
||||
parts.append(f'<h3 class="sheet-subheading">{esc(section["name"])}</h3>')
|
||||
for group in section['groups']:
|
||||
parts.append(f'<div class="sheet-skill-group"><h4>{esc(group["name"])}</h4>'
|
||||
'<div class="sheet-skill-head"><span>Compétence</span><span>Carac.</span><span>Niveau</span><span>Coût</span><span>Jet</span></div>')
|
||||
parts.extend(render_skill(group, skill, variant) for skill in group.get('skills', []))
|
||||
parts.append('</div>')
|
||||
return ''.join(parts)
|
||||
|
||||
|
||||
def combat_skills(skills):
|
||||
return next((group['skills'] for section in skills['sections'] for group in section['groups']
|
||||
if group['name'] == 'Combat'), [])
|
||||
|
||||
|
||||
def render_repeating_block(block, attributes, expanded=False):
|
||||
parts = [f'<details{" open" if expanded else ""}><summary>{esc(block["name"])}</summary>'
|
||||
f'<fieldset class="repeating_{esc(block["id"])}"><div class="sheet-repeater">']
|
||||
for field in block['fields']:
|
||||
kind = 'number' if field in ('skilllevel', 'skillcost', 'quantity', 'damage') else 'text'
|
||||
parts.append(f'<label class="sheet-repeater-{field}">{esc(FIELD_LABELS.get(field, field))}<input type="{kind}" name="attr_{esc(field)}"></label>')
|
||||
if block['id'] == 'contacts-skills':
|
||||
command = '&{template:d10contact} {{name=@{skillname}}} {{level=@{skilllevel}}}'
|
||||
parts.append(f'<button type="roll" class="sheet-roll sheet-show" value="{esc(command)}" title="Afficher le contact">Show</button>')
|
||||
elif block['id'] == 'consommable':
|
||||
command = '&{template:d10consumable} {{name=@{name}}} {{quantity=@{quantity}}} {{notes=@{notes}}}'
|
||||
parts.append(f'<button type="roll" class="sheet-roll sheet-show" value="{esc(command)}" title="Afficher le consommable">Show</button>')
|
||||
elif 'skilllevel' in block['fields']:
|
||||
options = ''.join(
|
||||
f'<option value="@{{base-{item["id"]}}}+@{{exal-{item["id"]}}}">{esc(item["name"])}</option>'
|
||||
for item in attributes)
|
||||
parts.append(f'<label class="sheet-repeater-attribute">Caractéristique<select name="attr_attribute_select">{options}</select></label>')
|
||||
parts.append(roll('@{skillname}', '@{skilllevel}+@{attribute_select}'))
|
||||
parts.append('</div></fieldset></details>')
|
||||
return ''.join(parts)
|
||||
|
||||
|
||||
def render_weapon_block(block, combat_skills):
|
||||
ranged = block['id'] == 'distance'
|
||||
options = '<option value="">Aucune spécialité</option>' + ''.join(
|
||||
f'<option value="{esc(skill["id"])}">{esc(skill["name"])}</option>' for skill in combat_skills)
|
||||
def field(name, label, kind='number', value='0', extra=''):
|
||||
return (f'<label class="sheet-weapon-field sheet-weapon-{name}">{label}'
|
||||
f'<input type="{kind}" name="attr_{name}" value="{esc(value)}" {extra}></label>')
|
||||
parts = [f'<fieldset class="repeating_{esc(block["id"])}"><div class="sheet-weapon-repeater">',
|
||||
field('name', 'Nom', 'text', ''), field('weapon_type', 'Type', 'text', ''),
|
||||
field('accuracy', 'Précision', value='0'),
|
||||
field('base_threshold', 'Seuil de base', value='4'),
|
||||
'<label class="sheet-weapon-field sheet-weapon-skill_id">Compétence'
|
||||
f'<select name="attr_skill_id">{options}</select></label>',
|
||||
field('damage', 'Dégâts de base', value='0'),
|
||||
field('damage_per_success', 'Dégâts / réussite', value='0'),
|
||||
field('rmax', 'Rmax (0 = sans limite)', value='0', extra='min="0"'),
|
||||
field('notes', 'Spécial / notes', 'text', '')]
|
||||
if ranged:
|
||||
parts.extend([field('single_cost', 'Coup par coup', value='1', extra='min="1"'),
|
||||
field('burst_cost', 'Rafale', value='3', extra='min="1"'),
|
||||
field('auto_cost', 'Automatique', value='5', extra='min="1"'),
|
||||
field('ammo_current', 'Chargeur actuel', value='0', extra='min="0"'),
|
||||
field('magazine_size', 'Taille du chargeur', value='0', extra='min="0"'),
|
||||
field('ammo_reserve', 'Chargeurs de réserve', value='0', extra='min="0"')])
|
||||
actions = ([('firesingle', 'Tir simple'), ('fireburst', 'Rafale'),
|
||||
('fireauto', 'Automatique'), ('reload', 'Recharger')]
|
||||
if ranged else [('attack', 'Attaque')])
|
||||
actions.append(('damage', 'Dégâts'))
|
||||
parts.append('<div class="sheet-weapon-actions">' + ''.join(
|
||||
f'<button type="action" name="act_{key}">{label}</button>' for key, label in actions) + '</div>')
|
||||
parts.append('<span class="sheet-weapon-status" name="attr_weapon_status"></span></div></fieldset>')
|
||||
return ''.join(parts)
|
||||
|
||||
|
||||
def render(model, skills, variant, theme_name, theme, themes, asset_base_url=''):
|
||||
tabs = TABS[:-1] if model.get('skill_tabs') else TABS
|
||||
switchable = variant == 'cyberpunk'
|
||||
parts = []
|
||||
parts.extend(['<div class="sheet-theme-shell">',
|
||||
f'<input type="hidden" class="sheet-theme-state" name="attr_d10_theme" value="{esc(theme_name)}">'])
|
||||
parts.extend([f'<div class="sheet-d10 sheet-variant-{variant} sheet-theme-{esc(theme_name)}">',
|
||||
'<header class="sheet-hero"><div class="sheet-hero-mark">D10</div>',
|
||||
f'<div class="sheet-hero-main"><span class="sheet-eyebrow">Feuille de personnage</span><h1>{esc(model["title"])}</h1>',
|
||||
'<div class="sheet-identity"><label>Nom <input type="text" name="attr_character_name"></label>',
|
||||
'<label>Origine <input type="text" name="attr_character_race"></label></div></div>',
|
||||
'<label class="sheet-die-choice">Dé de jeu <select name="attr_dice">' + ''.join(
|
||||
f'<option value="{n}"{" selected" if n == 10 else ""}>d{n}</option>'
|
||||
for n in (4, 6, 8, 10, 12, 20)) + '</select></label>',
|
||||
])
|
||||
parts.append('<div class="sheet-hero-tools"><label class="sheet-theme-choice">Thème <select name="attr_d10_theme_choice">' + ''.join(
|
||||
f'<option value="{esc(key)}"{" selected" if key == theme_name else ""}>{esc(palette.get("name", key))}</option>'
|
||||
for key, palette in themes.items()) + '</select></label>')
|
||||
parts.append('<details class="sheet-character-io-menu"><summary>Échanges JSON</summary>'
|
||||
'<div class="sheet-character-io-actions">'
|
||||
'<button type="roll" name="roll_export_character" '
|
||||
'value="!d10-export --id @{character_id}">Exporter</button>'
|
||||
'<button type="roll" name="roll_replace_character" '
|
||||
'value="!d10-import --replace --id @{character_id} --handout ?{ID du handout personnage}">Restaurer</button>'
|
||||
'</div></details></div>')
|
||||
parts.extend(['</header>',
|
||||
'<section class="sheet-panel"><div class="sheet-section-title"><span>01</span><h2>Caractéristiques</h2></div>',
|
||||
'<div class="sheet-stat-grid">'])
|
||||
for item in model['attributes']:
|
||||
key = item['id']
|
||||
threshold = f'(@{{base-{key}}}+@{{exal-{key}}})*2'
|
||||
parts.append(f'<div class="sheet-stat"><strong>{esc(item["name"])}</strong>'
|
||||
f'<label>Base<input type="number" name="attr_base-{key}" value="0" title="Base"></label>'
|
||||
f'<label>Bonus<input type="number" name="attr_exal-{key}" value="0" title="Bonus"></label>'
|
||||
f'{roll(item["name"], threshold)}</div>')
|
||||
parts.append('</div></section><section class="sheet-panel"><div class="sheet-section-title"><span>02</span><h2>Ressources</h2></div><div class="sheet-resource-grid">')
|
||||
for item in model['resources']:
|
||||
key = item['id']
|
||||
parts.append(f'<div class="sheet-resource"><strong>{esc(item["name"])}</strong>'
|
||||
f'<label>Actuel<input type="number" name="attr_{key}" value="0" title="Actuel"></label>'
|
||||
f'<span>/</span><label>Maximum<input type="number" name="attr_{key}_maximum" value="0" title="Maximum"></label></div>')
|
||||
if model.get('health_locations'):
|
||||
parts.append('</div><div class="sheet-body-maps">')
|
||||
parts.append(render_body_map(model['health_locations'], 'health', asset_base_url))
|
||||
parts.append(render_body_map(model['health_locations'], 'armor', asset_base_url))
|
||||
parts.append('</div>')
|
||||
else:
|
||||
parts.append('</div>')
|
||||
parts.extend([
|
||||
'</section>',
|
||||
'<input type="hidden" class="sheet-tab-state" name="attr_d10_tab" value="skills">',
|
||||
'<nav class="sheet-tab-nav" aria-label="Sections de la feuille">',
|
||||
*(f'<button type="action" class="sheet-tab-button sheet-tab-{key}" name="act_tab_{key}">{label}</button>'
|
||||
for key, label in tabs),
|
||||
'</nav><div class="sheet-page sheet-page-combat"><section class="sheet-panel"><div class="sheet-section-title"><span>03</span><h2>Combat</h2></div><div class="sheet-combat-grid">',
|
||||
])
|
||||
for item in model.get('combat', []):
|
||||
if switchable:
|
||||
field = (f'<label>{esc(item["name"])}'
|
||||
f'<input type="number" name="attr_{esc(item["id"])}" value="0"></label>')
|
||||
parts.append('<div class="sheet-combat-field sheet-combat-field-initiative">' + field +
|
||||
roll('Initiative', '@{base-Agilite}+@{exal-Agilite}+@{Initiative}', combat=True) + '</div>')
|
||||
else:
|
||||
parts.append(f'<label class="sheet-combat-field">{esc(item["name"])}'
|
||||
f'<input type="number" name="attr_{esc(item["id"])}" value="0"></label>')
|
||||
if not switchable:
|
||||
parts.append('</div><div class="sheet-combat-actions"><span>Jets de combat</span>')
|
||||
parts.append(roll('Initiative', '@{base-Agilite}+@{exal-Agilite}+@{Initiative}', combat=True))
|
||||
parts.append(roll('Attaque', '@{general_attack_threshold}', combat=True))
|
||||
parts.append('</div><h3 class="sheet-subheading">Armes équipées</h3><div class="sheet-weapon-grid">')
|
||||
for number in range(1, model.get('weapons', 0) + 1):
|
||||
parts.append(f'<div class="sheet-weapon"><span>Arme {number}</span>'
|
||||
f'<input type="text" name="attr_general_item_weapon{number}_name" title="Nom">'
|
||||
f'<input type="number" name="attr_general_item_weapon{number}" value="0" title="Dégâts">'
|
||||
f'<input type="checkbox" name="attr_item_weapon{number}_activation" value="1" title="Équipée"></div>')
|
||||
else:
|
||||
equipment = [group for section in skills['sections'] for group in section['groups']
|
||||
if group.get('equipment')]
|
||||
repeating = {block['id']: block for block in model['repeating']}
|
||||
weapon_skills = combat_skills(skills)
|
||||
parts.append('</div><h3 class="sheet-subheading">Arsenal</h3><div class="sheet-arsenal">')
|
||||
parts.append('<input type="hidden" class="sheet-arsenal-tab-state" name="attr_d10_arsenal_tab" value="distance">')
|
||||
parts.append('<nav class="sheet-skill-tab-nav sheet-arsenal-tab-nav" aria-label="Catégories d’arsenal">')
|
||||
for group in equipment:
|
||||
key = group['equipment']
|
||||
parts.append(f'<button type="action" class="sheet-arsenal-tab-{key}" name="act_arsenal_tab_{key}">{esc(group["name"])}</button>')
|
||||
parts.append('</nav>')
|
||||
for group in equipment:
|
||||
key = group['equipment']
|
||||
parts.append(f'<div class="sheet-skill-pane sheet-arsenal-pane-{key}">')
|
||||
parts.append(render_weapon_block(repeating[key], weapon_skills) if key in ('distance', 'melee')
|
||||
else render_repeating_block(repeating[key], model['attributes'], expanded=True))
|
||||
parts.append('</div>')
|
||||
parts.append('</div></section></div><div class="sheet-page sheet-page-skills"><section class="sheet-panel"><div class="sheet-section-title"><span>04</span><h2>Compétences</h2></div>')
|
||||
if model.get('skill_tabs'):
|
||||
skill_tabs = model['skill_tabs']
|
||||
parts.append(f'<input type="hidden" class="sheet-skill-tab-state" name="attr_d10_skill_tab" value="{skill_tabs[0]["id"]}">')
|
||||
parts.append('<nav class="sheet-skill-tab-nav" aria-label="Catégories de compétences">')
|
||||
for tab in skill_tabs:
|
||||
parts.append(f'<button type="action" class="sheet-skill-tab-button sheet-skill-tab-{tab["id"]}" name="act_skill_tab_{tab["id"]}">{esc(tab["name"])}</button>')
|
||||
parts.append('</nav>')
|
||||
repeating = {block['id']: block for block in model['repeating']}
|
||||
for tab in skill_tabs:
|
||||
parts.append(f'<div class="sheet-skill-pane sheet-skill-pane-{tab["id"]}">')
|
||||
for content in tab['content']:
|
||||
parts.append(render_fixed_skills(skills, variant, show_sections=False) if content == 'fixed_skills'
|
||||
else render_repeating_block(repeating[content], model['attributes'], expanded=True))
|
||||
parts.append('</div>')
|
||||
elif model.get('skill_category_tabs'):
|
||||
categories = [section for section in skills['sections']
|
||||
if any(group.get('skills') for group in section['groups'])]
|
||||
parts.append(f'<input type="hidden" class="sheet-category-tab-state" name="attr_d10_category_tab" value="{esc(categories[0]["id"])}">')
|
||||
parts.append('<nav class="sheet-skill-tab-nav sheet-category-tab-nav" aria-label="Catégories de compétences">')
|
||||
for section in categories:
|
||||
key = section['id']
|
||||
parts.append(f'<button type="action" class="sheet-skill-tab-button sheet-category-tab-{key}" name="act_category_tab_{key}">{esc(section["name"])}</button>')
|
||||
parts.append('</nav>')
|
||||
for section in categories:
|
||||
parts.append(f'<div class="sheet-skill-pane sheet-category-pane-{section["id"]}">')
|
||||
parts.append(render_fixed_skills(skills, variant, show_sections=False, sections=[section]))
|
||||
parts.append('</div>')
|
||||
else:
|
||||
parts.append(render_fixed_skills(skills, variant))
|
||||
parts.append('</section></div>')
|
||||
if not model.get('skill_tabs'):
|
||||
parts.append('<div class="sheet-page sheet-page-other"><section class="sheet-panel"><div class="sheet-section-title"><span>05</span><h2>Autres</h2></div>')
|
||||
equipment_ids = {group['equipment'] for section in skills['sections'] for group in section['groups']
|
||||
if group.get('equipment')} if model.get('skill_category_tabs') else set()
|
||||
for block in model['repeating']:
|
||||
if block['id'] in equipment_ids:
|
||||
continue
|
||||
parts.append(render_repeating_block(block, model['attributes']))
|
||||
parts.append('</section></div>')
|
||||
parts.append('</div>')
|
||||
parts.append('</div>')
|
||||
html_text = '\n'.join(parts) + '\n'
|
||||
css = ('.sheet-d10, .sheet-rolltemplate-d10skillcheck, .sheet-rolltemplate-d10weapon, .sheet-rolltemplate-d10contact, .sheet-rolltemplate-d10consumable {\n' + '\n'.join(
|
||||
f' --d10-{key}: {theme[key]};' for key in ('background', 'panel', 'ink', 'accent', 'border')) +
|
||||
f'\n --d10-figure-filter: {figure_filter(theme["background"])};\n}}\n')
|
||||
css += (ROOT / 'templates' / 'sheet.css').read_text(encoding='utf-8')
|
||||
for key, palette in themes.items():
|
||||
css += f'\n.sheet-theme-state[value="{key}"] ~ .sheet-d10 {{\n'
|
||||
css += '\n'.join(f' --d10-{color}: {palette[color]};' for color in
|
||||
('background', 'panel', 'ink', 'accent', 'border'))
|
||||
css += f'\n --d10-figure-filter: {figure_filter(palette["background"])};\n}}\n'
|
||||
if model.get('skill_tabs'):
|
||||
css += '\n'.join(
|
||||
f'.sheet-d10 .sheet-skill-tab-state[value="{tab["id"]}"] ~ .sheet-skill-pane-{tab["id"]} {{ display: block; }}\n'
|
||||
f'.sheet-d10 .sheet-skill-tab-state[value="{tab["id"]}"] ~ .sheet-skill-tab-nav .sheet-skill-tab-{tab["id"]} {{ color: var(--d10-panel); background: var(--d10-accent); border-color: var(--d10-accent); }}\n'
|
||||
for tab in model['skill_tabs'])
|
||||
if model.get('skill_category_tabs'):
|
||||
css += '\n'.join(
|
||||
f'.sheet-d10 .sheet-category-tab-state[value="{section["id"]}"] ~ .sheet-category-pane-{section["id"]} {{ display: block; }}\n'
|
||||
f'.sheet-d10 .sheet-category-tab-state[value="{section["id"]}"] ~ .sheet-category-tab-nav .sheet-category-tab-{section["id"]} {{ color: var(--d10-panel); background: var(--d10-accent); border-color: var(--d10-accent); }}\n'
|
||||
for section in skills['sections'] if any(group.get('skills') for group in section['groups']))
|
||||
css += ('.sheet-d10 .sheet-category-tab-state[value="arsenal"] ~ .sheet-category-pane-physique { display: block; }\n'
|
||||
'.sheet-d10 .sheet-category-tab-state[value="arsenal"] ~ .sheet-category-tab-nav .sheet-category-tab-physique { color: var(--d10-panel); background: var(--d10-accent); border-color: var(--d10-accent); }\n')
|
||||
arsenal = [group['equipment'] for section in skills['sections'] for group in section['groups']
|
||||
if group.get('equipment')]
|
||||
css += '\n'.join(
|
||||
f'.sheet-d10 .sheet-arsenal-tab-state[value="{key}"] ~ .sheet-arsenal-pane-{key} {{ display: block; }}\n'
|
||||
f'.sheet-d10 .sheet-arsenal-tab-state[value="{key}"] ~ .sheet-arsenal-tab-nav .sheet-arsenal-tab-{key} {{ color: var(--d10-panel); background: var(--d10-accent); border-color: var(--d10-accent); }}\n'
|
||||
for key in arsenal)
|
||||
html_text += '''<rolltemplate class="sheet-rolltemplate-d10skillcheck">
|
||||
<div class="sheet-roll-title"><strong>{{name}}</strong><span>{{roll_name}}</span></div>
|
||||
<div class="sheet-roll-values"><span>Seuil</span><span class="sheet-roll-value">{{threshold}}</span><span>Résultat</span><span class="sheet-roll-value">{{result}}</span></div>
|
||||
</rolltemplate>
|
||||
'''
|
||||
if variant == 'cyberpunk':
|
||||
html_text += '''<rolltemplate class="sheet-rolltemplate-d10contact">
|
||||
<div class="sheet-roll-title"><strong>Contact</strong><span>{{name}}</span></div>
|
||||
<div class="sheet-roll-detail">Niveau : {{level}}</div>
|
||||
</rolltemplate>
|
||||
'''
|
||||
html_text += '''<rolltemplate class="sheet-rolltemplate-d10consumable">
|
||||
<div class="sheet-roll-title"><strong>Consommable</strong><span>{{name}}</span></div>
|
||||
<div class="sheet-roll-detail">Quantité : {{quantity}}</div>
|
||||
{{#notes}}<div class="sheet-roll-detail">{{notes}}</div>{{/notes}}
|
||||
</rolltemplate>
|
||||
'''
|
||||
html_text += '''<rolltemplate class="sheet-rolltemplate-d10weapon">
|
||||
<div class="sheet-roll-title"><strong>{{name}}</strong><span>{{mode}}</span></div>
|
||||
{{#type}}<div class="sheet-roll-detail">{{type}}</div>{{/type}}
|
||||
<div class="sheet-roll-values"><span>Réussites</span><span class="sheet-roll-value">{{#attack_roll}}{{attack_roll}}{{/attack_roll}}{{#damage_roll}}{{damage_roll}}{{/damage_roll}}</span>{{#damage}}<span>Dégâts</span><span class="sheet-roll-value">{{computed::damage}}</span>{{/damage}}{{#damage_list}}<span>Dégâts par tir</span><span class="sheet-roll-value sheet-roll-damage-list">{{computed::damage_list}}</span>{{/damage_list}}</div>
|
||||
{{#threshold}}<div class="sheet-roll-detail">Seuil : {{threshold}}</div>{{/threshold}}
|
||||
{{#rmax}}<div class="sheet-roll-detail">Rmax : {{rmax}}</div>{{/rmax}}
|
||||
{{#ammo_info}}<div class="sheet-roll-detail">Chargeur : {{ammo}} / {{magazine}} · chargeurs de réserve : {{reserve}}</div>{{/ammo_info}}
|
||||
{{#special}}<div class="sheet-roll-detail">{{special}}</div>{{/special}}
|
||||
</rolltemplate>
|
||||
'''
|
||||
html_text += '<script type="text/worker">\n'
|
||||
html_text += ''.join(
|
||||
f'on("clicked:tab_{key}", function () {{ setAttrs({{d10_tab: "{key}"}}); }});\n'
|
||||
for key, _ in tabs)
|
||||
html_text += ''.join(
|
||||
f'on("clicked:skill_tab_{tab["id"]}", function () {{ setAttrs({{d10_skill_tab: "{tab["id"]}"}}); }});\n'
|
||||
for tab in model.get('skill_tabs', []))
|
||||
if model.get('skill_category_tabs'):
|
||||
html_text += ''.join(
|
||||
f'on("clicked:category_tab_{section["id"]}", function () {{ setAttrs({{d10_category_tab: "{section["id"]}"}}); }});\n'
|
||||
for section in skills['sections'] if any(group.get('skills') for group in section['groups']))
|
||||
html_text += ''.join(
|
||||
f'on("clicked:arsenal_tab_{key}", function () {{ setAttrs({{d10_arsenal_tab: "{key}"}}); }});\n'
|
||||
for key in arsenal)
|
||||
html_text += 'on("change:d10_theme_choice", function (event) { setAttrs({d10_theme: event.newValue}); });\n'
|
||||
if switchable:
|
||||
weapon_skills = combat_skills(skills)
|
||||
worker = (ROOT / 'templates' / 'cyberpunk-weapons.js').read_text(encoding='utf-8')
|
||||
html_text += worker.replace('__COMBAT_SKILLS__', json.dumps([skill['id'] for skill in weapon_skills]))
|
||||
html_text += '</script>\n'
|
||||
return html_text, css
|
||||
|
||||
|
||||
def build(variant, theme_name, output, check=False, asset_base_url=None):
|
||||
source = read_yaml(DATA / 'sheet_model.yaml')
|
||||
themes = read_yaml(DATA / 'themes.yaml')['themes']
|
||||
if variant not in source['variants']:
|
||||
raise ValueError(f'unknown variant: {variant}')
|
||||
allowed_themes = ({key: themes[key] for key in BASE_THEMES} if variant == 'base' else themes)
|
||||
if theme_name not in allowed_themes:
|
||||
raise ValueError(f'unknown theme for {variant}: {theme_name}')
|
||||
if asset_base_url is None:
|
||||
asset_base_url = DEFAULT_ASSET_BASE_URL
|
||||
if asset_base_url and not re.fullmatch(r'https://[^\s<>"\']+', asset_base_url):
|
||||
raise ValueError('asset base URL must be HTTPS')
|
||||
model = source['variants'][variant]
|
||||
skills = read_yaml(DATA / model['skills'])
|
||||
theme = allowed_themes[theme_name]
|
||||
validate({**model, 'version': source['version']}, skills, theme)
|
||||
html_text, css = render(model, skills, variant, theme_name, theme, allowed_themes, asset_base_url)
|
||||
manifest = {'html': 'sheet.html', 'css': 'sheet.css', 'authors': 'Dandaedre',
|
||||
'roll20userid': '1067910', 'instructions': f'{model["title"]} generated from D10 YAML'}
|
||||
translation = {}
|
||||
files = {'sheet.html': html_text, 'sheet.css': css,
|
||||
'sheet.json': json.dumps(manifest, ensure_ascii=False, indent=2) + '\n',
|
||||
'translation.json': json.dumps(translation, indent=2) + '\n'}
|
||||
if model.get('health_locations'):
|
||||
for kind in ('health', 'armor'):
|
||||
name = f'robotman_{kind}_r.png'
|
||||
files[name] = (ASSETS / name).read_bytes()
|
||||
digest = hashlib.sha256((html_text + css).encode())
|
||||
for name in sorted(files):
|
||||
if isinstance(files[name], bytes):
|
||||
digest.update(files[name])
|
||||
files['build-info.json'] = json.dumps({'variant': variant, 'theme': theme_name,
|
||||
'skills': sum(len(g.get('skills', [])) for s in skills['sections'] for g in s['groups']),
|
||||
'sha256': digest.hexdigest()}, indent=2) + '\n'
|
||||
if check:
|
||||
stale = [name for name, content in files.items()
|
||||
if not (output / name).exists() or (output / name).read_bytes() !=
|
||||
(content if isinstance(content, bytes) else content.encode('utf-8'))]
|
||||
if stale:
|
||||
raise ValueError(f'generated files are missing or stale: {", ".join(stale)}')
|
||||
else:
|
||||
output.mkdir(parents=True, exist_ok=True)
|
||||
for name, content in files.items():
|
||||
(output / name).write_bytes(content if isinstance(content, bytes) else content.encode('utf-8'))
|
||||
return files
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--variant', choices=('base', 'cyberpunk'), default='base')
|
||||
parser.add_argument('--theme', default='parchment')
|
||||
parser.add_argument('--output-dir', type=Path)
|
||||
parser.add_argument('--list-themes', action='store_true')
|
||||
parser.add_argument('--check', action='store_true', help='verify existing output without writing')
|
||||
parser.add_argument('--asset-base-url', default=None,
|
||||
help='override the default public HTTPS image directory; pass an empty value for local preview')
|
||||
args = parser.parse_args()
|
||||
if args.list_themes:
|
||||
themes = read_yaml(DATA / 'themes.yaml')['themes']
|
||||
print('\n'.join(BASE_THEMES if args.variant == 'base' else themes))
|
||||
return
|
||||
output = args.output_dir or ROOT / 'build' / args.variant / args.theme
|
||||
try:
|
||||
build(args.variant, args.theme, output, check=args.check, asset_base_url=args.asset_base_url)
|
||||
except ValueError as error:
|
||||
parser.error(str(error))
|
||||
print(output)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Generate the complete artifact tree archived by Jenkins."""
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
|
||||
import build
|
||||
|
||||
|
||||
DEFAULT_OUTPUT = build.ROOT / 'RPG' / 'd10_character_sheet'
|
||||
|
||||
|
||||
def publish(output=DEFAULT_OUTPUT):
|
||||
output.mkdir(parents=True, exist_ok=True)
|
||||
assets = output / 'assets'
|
||||
assets.mkdir(exist_ok=True)
|
||||
for kind in ('health', 'armor'):
|
||||
filename = f'robotman_{kind}_r.png'
|
||||
shutil.copyfile(build.ASSETS / filename, assets / filename)
|
||||
for variant in ('base', 'cyberpunk'):
|
||||
target = output / variant
|
||||
if target.exists():
|
||||
shutil.rmtree(target)
|
||||
build.build(variant, 'parchment', target)
|
||||
build.build(variant, 'parchment', target, check=True)
|
||||
return output
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--output-dir', type=Path, default=DEFAULT_OUTPUT)
|
||||
args = parser.parse_args()
|
||||
print(publish(args.output_dir))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Loading…
Reference in New Issue