Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added

- **UNIQUE on GEAR.** A thing changed from the item it is named after (the Cutlass made 2d8) now says UNIQUE on its line; hover it for the item's own value and who changed it, and when (a player by name, or the GM). In its card, each column made its own says UNIQUE with the item's value beside it and a THE ITEM'S button to put it back. Type unique in FIND to list them. SHEET.EXE and the sheet's own tab are the same.
- **FIND on GEAR.** A find box at the top of the sheet's GEAR tab, always there, keeps only the things that match as you type: a name, a type (GUNS), a value (2d6, 30 m) or a column (AMMO), in any case, every word somewhere on the line. Each band counts its matches and opens while you search, so nothing in a closed STASH is missed; clear it with its × or Esc and the bands are as you left them. When nothing matches, it says so. SHEET.EXE and the sheet's own tab are the same.
- **GEAR in bands.** The sheet's GEAR tab now sorts what you carry into EQUIPPED, USABLE and PACK, by each item type's ON THE SHEET, with a count on each band and what's in hand first. A fourth band, STASH, holds everything left in the stash whatever its type, and says each one's type; it starts closed. Click a band's head to close or open it, and the sheet remembers. The + buttons for adding a thing by hand sit in one row at the top, and the band it lands in opens. SHEET.EXE and the sheet's own tab are the same.
- **Where a type sits on the sheet.** Each item type on the builder's TYPES tab now has ON THE SHEET: EQUIPPED (worn or wielded), USABLE (used up or used often: potions, ammo, kits) or PACK. WEAPON and ARMOR presets start EQUIPPED, CONSUMABLE and SPELL start USABLE, and GEAR and every type you already have start in PACK.
Expand Down
14 changes: 7 additions & 7 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion e2e/COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ panel), so a control that looks fine but does nothing is caught for all of them.
| Items | An item's INSTALLED AS and COST (7e4) | `items.list[].needs`, `items.list[].cost` | `builder-items`, `sheet-installed-items` | Proven at the table (7e4c): installed, its cost on Strain named by it, its line locked, removed; fractions by server and unit tests |
| Items | ITEM TYPES: a name, one of them, columns of NUMBER (a unit), TEXT, DAMAGE, DICE, COUNT (a button, a rest, items it reloads from) and PICK ONE (its words), from a preset or blank (8a1, 8a2) | `items.types` | `builder-item-types`, `builder-clicks`, `sheet-item-types`, `sheet-gear-counts` | Made in the builder (8a2): WEAPONS from its preset, a COUNT's rest and reload, a PICK ONE's words. At the table (8a3a): a table per type on GEAR with its columns; DAMAGE rolled (8a3b): a stick's 1d4 in the dice tray's history; a COUNT at the table (8a4b): its button (FIRE) spending one, RELOAD from items it names (asked which of two carried, taken from the quantity, a line used up gone) and a rest it names refilling it |
| Items | The DEFAULT type: MAKE DEFAULT moves one to the top (8aL1) | `items.types` order | `builder-clicks` | Builder only so far (8aL1): the items that said nothing keep their type, held by tests; at the table, a line that is no item lands in the first type (8a3a) |
| Items | An item's TYPE and its VALUES, one per column (8a1, 8a2) | `items.list[].type`, `items.list[].values` | `builder-item-types`, `sheet-item-types` | Filled in the builder (8a2): a Pistol of WEAPONS with DAMAGE, RANGE, AMMO, WEIGHT and GRADE. At the table (8a3a): a line named like it shows them faint, its own typed over. A line with nothing filled in, on it or its item (G3): FILL IN, opening the card at its first box (`sheet-gear-bands`, the Draught's HEALS); a blank beside others filled doesn't apply and says nothing |
| Items | An item's TYPE and its VALUES, one per column (8a1, 8a2) | `items.list[].type`, `items.list[].values` | `builder-item-types`, `sheet-item-types` | Filled in the builder (8a2): a Pistol of WEAPONS with DAMAGE, RANGE, AMMO, WEIGHT and GRADE. At the table (8a3a): a line named like it shows them faint, its own typed over. A line with nothing filled in, on it or its item (G3): FILL IN, opening the card at its first box (`sheet-gear-bands`, the Draught's HEALS); a blank beside others filled doesn't apply and says nothing. A line changed from its item (G5a, G5b): UNIQUE on it with who changed it when, THE ITEM'S putting a column back (`sheet-item-types`, the Pistol's RANGE and DAMAGE) |
| Items | Uploading items: IMPORT, DOWNLOAD EXAMPLE (made from the system), DOWNLOAD THIS LIST (8aL3) | the draft's `items` | `builder-items-import` | Proven in the builder (8aL3b): the example downloaded, edited, imported with a mistake skipped by its line, saved; the list back unchanged held by tests |
| Items | A line of gear made by hand: its TYPE and its own VALUES (8a3a) | the sheet's `inventory[].type`, `inventory[].values` | `sheet-item-types` | Proven at the table (8a3a): + WEAPON made A stick with its own DAMAGE and GRADE, kept in its table after a reload |
| Items | ENCUMBRANCE: COUNTED BY a column, its unit, CAN CARRY, bands at a share of it and the word past them; an install's WEIGHS WHILE INSTALLED (8a5a, 8a5c) | `items.encumbrance`, `items.installs[].weighs` | `builder-encumbrance`, `builder-clicks`, `sheet-carrying` | Made in the builder (8a5c): counted by WEIGHT, CAN CARRY, bands renamed, moved and added, the word past them, an install that still weighs, saved and kept. Server tests (8a5a): @carried and @capacity on every save. At the table (8a6a): Might 5 carrying three 10 LB Packs reads CARRYING 30 / 50 LB, ENCUMBERED, its meter and LIGHT ≤ 25 · ENCUMBERED ≤ 50 · OVERLOADED; one stashed, 20 LB and LIGHT |
Expand Down
2 changes: 1 addition & 1 deletion e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ kept; the job itself stops at 30 (`timeout-minutes`), for a hang outside the tes
| `tests/sheet-ranks.spec.ts` | A rank on the sheet (7f1c1): a player with Level 3 sees Athletics as a picker of UNTRAINED, TRAINED and EXPERT, picks EXPERT, its worth = 7 shows beside it, the formula Climb reading it shows 8, and the server keeps the step 2 with Athletics 7 and Climb 8 |
| `tests/sheet-ranks-start.spec.ts` | Ranks making a character (7f1c2): a player in NEW CHARACTER types Grit, finds Lore under RANKS with UP TO TRAINED TO START and EXPERT off, picks TRAINED, and the server keeps the step 1 with Lore worth 2 |
| `tests/sheet-worn-items.spec.ts` | Items at the table (7e3b): two GEAR lines named like items get WEAR and ATTUNE; the ring worn does nothing yet, attuned it is WORKING, ATTUNED 1 OF 1, CON 14 → 16; the cloak worn with no slot free says so and can't attune; the GM, on the player's sheet, ATTUNES it ANYWAY (2 OF 1) and gives them 2 of their own; END frees the ring's slot and its +2 goes; the cloak taken off stays attuned and does nothing. A second test: the GM's GIVE.EXE lists the ring under ITEMS with NEEDS ATTUNED and its words, gives it to the player as a stowed gear line, the player is told and WEARS it; TERMINATE_SESSION closes GIVE.EXE while the session is still ending; and (2026-11-22) no ATTUNED bar on GEAR until the Ring's line is there |
| `tests/sheet-item-types.spec.ts` | The GEAR tab as a table per item type (8a3a): a player's sheet with WEAPONS and GEAR tables, each empty with its +; + WEAPON made A stick with DAMAGE 1d4 and GRADE HEAVY; a second line named Pistol showing 2d6 + @might faint, its RANGE typed over to 50 m; + GEAR made Rope at 10 lb; saved as made, each in its table after a reload; since 8a3b the stick's DAMAGE rolled with ROLL, "rolled A stick DAMAGE 1d4" in the dice tray's history; and (8a3c1) as compact lines: a line made by hand opened under ✎, DONE showing its words with ROLL, the Pistol's RANGE read as words after the reload, and no box on the GEAR tab scrolling sideways in SHEET.EXE; and (8a3c2) the Pistol's DAMAGE under ✎ said ON THIS CHARACTER: 2d6 + Might (12): 14 to 24, @strength flagged as not the system's, eˣ INSERT putting in @might; and (G2) in bands: PACK says "Nothing here." with no WEAPONS group before anything is carried, and things are added from the row of + at the top; and (G3) the Pistol's card opened by a click on its name; and (G5a) the Pistol, its RANGE its own, saved with who changed it and when |
| `tests/sheet-item-types.spec.ts` | The GEAR tab as a table per item type (8a3a): a player's sheet with WEAPONS and GEAR tables, each empty with its +; + WEAPON made A stick with DAMAGE 1d4 and GRADE HEAVY; a second line named Pistol showing 2d6 + @might faint, its RANGE typed over to 50 m; + GEAR made Rope at 10 lb; saved as made, each in its table after a reload; since 8a3b the stick's DAMAGE rolled with ROLL, "rolled A stick DAMAGE 1d4" in the dice tray's history; and (8a3c1) as compact lines: a line made by hand opened under ✎, DONE showing its words with ROLL, the Pistol's RANGE read as words after the reload, and no box on the GEAR tab scrolling sideways in SHEET.EXE; and (8a3c2) the Pistol's DAMAGE under ✎ said ON THIS CHARACTER: 2d6 + Might (12): 14 to 24, @strength flagged as not the system's, eˣ INSERT putting in @might; and (G2) in bands: PACK says "Nothing here." with no WEAPONS group before anything is carried, and things are added from the row of + at the top; and (G3) the Pistol's card opened by a click on its name; and (G5a) the Pistol, its RANGE its own, saved with who changed it and when; and (G5b) after the reload the Pistol says UNIQUE, its hover "RANGE 50 m, the item's: 30 m · changed by" the player, "unique" in FIND showing it and not the stick; THE ITEM'S on its DAMAGE and RANGE leaves a plain Pistol, saved so |
| `tests/sheet-gear-bands.spec.ts` | The GEAR tab in bands (G2): a game with WEAPONS EQUIPPED, POTIONS USABLE and GEAR unsaid; a player adds a Sword, a Draught and a Rope from the row of + at the top, each in its band and counted (EQUIPPED · 1, USABLE · 1, PACK · 1, STASH · 0 closed), saved as made; the Sword moved to the stash goes to STASH, which opens and says WEAPONS, EQUIPPED left at 0; USABLE closed by its head, and on the next visit USABLE is still closed and PACK open; and (G3) one line a thing: the Draught's HEALS blank, so FILL IN, which opens its card at that box, ready to type; 2d4 typed, DONE, the line says HEALS 2d4 and FILL IN is gone, saved; a Cloak, GEAR, made by hand sits in PACK, WEAR puts it in EQUIPPED (EQUIPPED · 1), taken off it is back in PACK; with EQUIPPED closed, WEAR lights its head (▸ EQUIPPED · 1), opened it is plain again; and (G4) FIND: 2d4 shows the Draught in USABLE, closed, opened while it shows (PACK · 0), lantern says nothing matches, cleared USABLE is closed again |
| `tests/sheet-gear-counts.spec.ts` | A gear line's COUNT at the table (8a4): a player's Pistol at AMMO 2 / 6 spends one with FIRE; RELOAD, with Pistol Rounds and AP Rounds both carried, asks which and takes all 3 AP Rounds, their line gone; RELOAD again takes 2 of the Pistol Rounds alone, full, RELOAD held; the Wand's CHARGES, with no RELOAD, filled by a SHORT REST from the sheet |
| `tests/sheet-standalone-tab.spec.ts` | The sheet in a new tab is the window (8s1a): a player makes two gear lines in SHEET.EXE, opens the tab with ⧉ (a `.crt-container`, so in the theme), WEARs the boots there and SHEET.EXE says WORKING too, and rolls the club's DAMAGE from the tab, said on it once the dice land; since 8s1b the roll from the tab opens DICE_TRAY.EXE in the main app's window; and (8s1c) a character being made: the flow left, SHEET.EXE says CREATING · CONTINUE, the tab says it too and opens NEW_CHARACTER.EXE on itself; and (8s1d) Cash on the tab opens BANK.EXE in the main window and the tab says so, then with the main window closed the tab says to open it; and (G2) gear added from the row of + at the top of GEAR |
Expand Down
16 changes: 16 additions & 0 deletions e2e/tests/sheet-item-types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ test('GEAR as a table per type: a stick made by hand and its DAMAGE rolled, the
await expect(weapons.getByText('WEAPONS · 2')).toBeVisible({ timeout: 15_000 });
await expect(gear.getByText('GEAR · 1')).toBeVisible();
await expect(weapons.getByRole('note', { name: 'Item 2 RANGE: 50 m' })).toBeVisible();
// UNIQUE (G5b): its RANGE its own, so the line says so, with the item's and who changed it when on hover; "unique" in FIND finds it.
const unique = weapons.getByRole('note', { name: 'Item 2 is unique' });
await expect(unique).toHaveText('UNIQUE');
await expect(unique).toHaveAttribute('title', new RegExp(`RANGE 50 m, the item's: 30 m · changed by ${player.username}, \\d{4}-\\d{2}-\\d{2}`));
const find = mine.getByRole('searchbox', { name: 'Find in your gear' });
await find.fill('unique');
await expect(weapons.getByRole('button', { name: 'Pistol, item 2', exact: true })).toBeVisible();
await expect(weapons.getByRole('button', { name: 'A stick, item 1', exact: true })).toHaveCount(0);
await find.fill('');
// Compact lines (8a3c1): in SHEET.EXE's width, nothing on the GEAR tab scrolls sideways.
// The sheet and any box inside it (the old table scrolled in a box of its own).
const sideways = await mine.locator('.sheet-scroll').evaluate((root) => [root, ...root.querySelectorAll('*')]
Expand All @@ -109,5 +118,12 @@ test('GEAR as a table per type: a stick made by hand and its DAMAGE rolled, the
await weapons.getByRole('group', { name: 'Help writing Item 2 DAMAGE' }).getByRole('button', { name: /^@might/ }).click();
await expect(weapons.getByLabel('Item 2 DAMAGE', { exact: true })).toHaveValue('1d6 + @might');
await expect(reads).toHaveText('ON THIS CHARACTER: 1d6 + Might (12): 13 to 18', { timeout: 15_000 });

// THE ITEM'S (G5b): DAMAGE and RANGE each put back to the item's; no longer unique, saved as a plain Pistol.
await weapons.getByRole('group', { name: 'Item 2 DAMAGE is unique' }).getByRole('button', { name: "Item 2 DAMAGE: the item's" }).click();
await expect(weapons.getByLabel('Item 2 DAMAGE', { exact: true })).toHaveValue('');
await weapons.getByRole('group', { name: 'Item 2 RANGE is unique' }).getByRole('button', { name: "Item 2 RANGE: the item's" }).click();
await expect(unique).toHaveCount(0);
await expect.poll(async () => JSON.parse(String((await sheetOf()).inventory ?? '[]'))[1], { timeout: 15_000 }).toEqual(line('Pistol', { type: 'weapons' }));
await context.close();
});
24 changes: 22 additions & 2 deletions frontend/src/components/GearTypeTables.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useEffectEvent, useRef, useState } from 'react';
import { CARRY_STATES, type InventoryItem } from '../sheets/inventory';
import type { ItemsShown } from '../sheets/gearItems';
import { gearTables, gearBands, foundIn, valueText, withLineValue, newLineOf, shownCells, cellWords, countOf, type Cell, type CountAnswer, type CountKind, type TableRow, type TypeShown } from '../sheets/gearTypes';
import { gearTables, gearBands, foundIn, uniqueCells, uniqueTitle, itemWas, valueText, withLineValue, newLineOf, shownCells, cellWords, countOf, type Cell, type CountAnswer, type CountKind, type TableRow, type TypeShown } from '../sheets/gearTypes';
import { useGearBands } from '../hooks/useGearBands';
import { diceWords, SHAPES, shapeText, insertName, type GearDiceRead } from '../sheets/gearDice';
import { FormulaIcon } from './FormulaIcon';
Expand All @@ -17,7 +17,9 @@ import { FormulaIcon } from './FormulaIcon';
// docs/mockups/sheet-gear-layout.html, layout A): EQUIPPED, USABLE and PACK by each type's ON THE SHEET, a group per type,
// in hand first; STASH, closed to start, whatever the type; a band's head closes it and the sheet remembers. A thing is
// made by hand from the row of + buttons at the top; a closed band something lands in pulses, then stays bright until
// opened; FIND at the top, always shown, keeps only the lines it matches, every band open while it has words (G4);
// opened; a line changed from its item says UNIQUE, each column it made its own too, with THE ITEM'S to put it back and
// the item's value and who changed it when, and "unique" in FIND lists them (G5b; no count at the top, the user: FIND
// is enough and saves the room); FIND at the top, always shown, keeps only the lines it matches, every band open while it has words (G4);
// a thing worn, attuned or installed is in EQUIPPED whatever its type. One line a thing (G3; the same mockup, decision 3): its name, how many,
// the columns it has as words with ROLL, FIRE and RELOAD, where it is carried; a click on it opens the card, every column a
// box with NAME, HOW MANY, LOCATION and REMOVE, one card at a time; ✎ at the end of every line opens it too. A line with
Expand Down Expand Up @@ -193,6 +195,7 @@ export function GearTypeTables({ items, itemsShown, readOnly, write, locked, on,
const blank = lc.cells.filter((c) => c.own === undefined && c.given === undefined);
const nothingFilled = blank.length > 0 && blank.length === lc.cells.length;
const editing = open === i;
const unique = uniqueCells(lc).length > 0;
const stashed = line.carry === 'stash';
const lockedTitle = locked(i) ? 'Installed: REMOVE it first' : undefined;
const name = line.name.trim() || 'UNNAMED';
Expand All @@ -210,6 +213,11 @@ export function GearTypeTables({ items, itemsShown, readOnly, write, locked, on,
onClick={() => openAt(null)}
style={{ background: 'none', border: 0, padding: 0, color: 'var(--green)', fontFamily: 'inherit', fontSize: '0.75rem', textAlign: 'left', cursor: 'pointer', overflowWrap: 'anywhere', textDecoration: editing ? 'underline' : 'none', opacity: line.name.trim() ? 1 : 0.6 }}>{name}</button>}
{line.qty > 1 && <span title="How many">×{line.qty}</span>}
{/* Changed from its item (G5b): the GM sees it at a glance, the item's value and who changed it on hover. */}
{unique && (
<span role="note" aria-label={`Item ${i + 1} is unique`} title={uniqueTitle({ index: i, line, columns: lc })}
style={{ ...smallButton, border: '1px solid var(--warning)', color: 'var(--warning)', padding: '0 4px', cursor: 'help' }}>UNIQUE</span>
)}
{/* Only the columns it has, as words: its item's faint, ROLL beside a DAMAGE or DICE (8a3b). */}
{cells.map((cell) => {
const label = `Item ${i + 1} ${cell.column.label}`;
Expand Down Expand Up @@ -294,6 +302,18 @@ export function GearTypeTables({ items, itemsShown, readOnly, write, locked, on,
{(cell.column.kind === 'damage' || cell.column.kind === 'dice') && onReadDice
? <DiceBox cell={cell} label={`Item ${i + 1} ${cell.column.label}`} focus={focusAt === cell.column.id} onType={(typed) => patch(i, withLineValue(line, cell.column, typed))} onRead={onReadDice} />
: <CellBox cell={cell} label={`Item ${i + 1} ${cell.column.label}`} readOnly={readOnly} focus={focusAt === cell.column.id} onType={(typed) => patch(i, withLineValue(line, cell.column, typed))} />}
{/* Made its own (G5b): said, with the item's value, who changed it when, and THE ITEM'S to put it back. */}
{cell.unique && (
<>
<span />
<span role="group" aria-label={`Item ${i + 1} ${cell.column.label} is unique`} style={{ display: 'flex', gap: '6px', alignItems: 'center', flexWrap: 'wrap', minWidth: 0 }}>
<span style={{ ...smallButton, border: '1px solid var(--warning)', color: 'var(--warning)', padding: '0 4px' }}>UNIQUE</span>
<button type="button" className="utility-btn" aria-label={`Item ${i + 1} ${cell.column.label}: the item's`} title="Back to the item's own"
onClick={() => patch(i, withLineValue(line, cell.column, ''))} style={smallButton}>THE ITEM&apos;S</button>
<span style={{ ...small, overflowWrap: 'anywhere', textAlign: 'left' }}>{itemWas(cell, line)}</span>
</span>
</>
)}
</React.Fragment>
))}
<span style={{ ...small, textAlign: 'right' }} title="Where a stashed item actually is">LOCATION</span>
Expand Down
Loading
Loading