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

- **SOLD AT on an item type, and + NEW SHOP.** On the builder's ITEMS page, each type now shows the game's shops as buttons, by what this game calls them: tick the kinds of shop that sell its lines, or none to have it only given. Type a name into + NEW SHOP (an Apothecary, a Fence) to make a kind of shop of your game's own, shown dashed and ticked. A type from a preset starts at its shop: WEAPON the Gun Shop, ARMOR the Armorer, CONSUMABLE the Clinic, GEAR the General Store; SPELL is sold nowhere, with a Magic Shop ready to ADD.
- **PLAYERS CHANGE GEAR.** A new switch on the GAME tab's house rules, on to start, for systems with their own item types. Switched off, only the GM changes the columns of a player's gear (a weapon's DAMAGE, a potion's HEALS): the player's card shows them but can't change them, and says "ONLY THE GM CHANGES THESE AT THIS TABLE". Players still name, count, move, add and remove their things, and the GM can always change anything.
- **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.
Expand Down
11 changes: 7 additions & 4 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions e2e/COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ panel), so a control that looks fine but does nothing is caught for all of them.
| GIVE ITEM and shop catalogues | a catalogue typed in, an item given with a note | `shops_give`, `shop_catalogue_*` | `player-journey`, `shop-cart-items` (a catalogue saved while a player is online, bought by them through the cart, 8n1), `shop-cart` (CWN's book: bought and sold back, 8n1), `give-item` (a ring and two ropes given, on the sheet as bought ones are, in GIVEN, 8n2) | **AT THE TABLE** |
| Shop catalogues by item type | a section per item type (8a7a1), its columns checked, blanks kept | `shop_catalogue_types`, `catalogueTypes` | `catalogue-types`, `shop-typed-lines` (bought at the General Store and given, landing typed, 8a7a2) | **AT THE TABLE** |
| The shops under load | 1000+ lines on a shelf, 200 items, a full cart, a long gear list (8n3); a long shelf drawn 200 rows at a time | `shop_stress`, `ShopWindow` | `shop-stress` | **AT THE TABLE** |
| An item type's SOLD AT | the kinds of shop that sell its lines (8a7a2), the General Store where unsaid; set in the builder in 8a7b | `shop_typed_lines`, `typedShelves` | `shop-typed-lines` (unsaid: the General Store) | **AT THE TABLE** unsaid; a kind of shop picked waits for 8a7b's box |
| The game's own shops, and what a shop BUYS | an Apothecary or a Fence of the game's own (8a7b1a), on or off; a shop's BUYS, WHAT IT SELLS or ANYTHING, every priced thing at the building's BUYBACK rate (8a7b1b) | `system_builder_own_shops`, `system_builder_shop_buys`, `shopBuys`, `ShopWindow` | | **GAP** until the builder sets them: + NEW SHOP in 8a7b2, BUYS and the BUILDING TYPE list in 8a7b3, each with its journey |
| An item type's SOLD AT | the kinds of shop that sell its lines (8a7a2), the General Store where unsaid; ticked in the builder (8a7b2), each preset at its shop | `shop_typed_lines`, `typedShelves`, `gameShops`, `ItemsPage` | `shop-typed-lines` (unsaid: the General Store), `builder-sold-at` (ticked by clicks: a Pistol bought at a Gun Shop) | **AT THE TABLE** |
| The game's own shops, and what a shop BUYS | an Apothecary or a Fence of the game's own (8a7b1a), on or off; a shop's BUYS, WHAT IT SELLS or ANYTHING, every priced thing at the building's BUYBACK rate (8a7b1b) | `system_builder_own_shops`, `gameShops`, `system_builder_shop_buys`, `shopBuys`, `ShopWindow` | `builder-sold-at` (an Apothecary made by + NEW SHOP, saved) | **GAP** at the table until a building can be one: BUYS and the BUILDING TYPE list in 8a7b3, each with its journey |
| An item type's ON THE SHEET band | EQUIPPED, USABLE or PACK (G1), PACK where unsaid; the sheet's GEAR tab in those bands plus STASH, closed to start, a band's head closing it, remembered (G2); a thing worn, attuned or installed in EQUIPPED whatever its type, a closed band something lands in lit until opened (G3) | `system_builder_item_types`, `itemTypes`, `ItemsPage`, `gearBands`, `GearTypeTables` | `builder-item-types` (the WEAPON preset EQUIPPED), `sheet-gear-bands` (a Sword, a Draught and a Rope in EQUIPPED, USABLE and PACK; the Sword stashed into STASH; USABLE kept closed; a Cloak of GEAR worn into a closed EQUIPPED, its head lit, taken off back into PACK) | **AT THE TABLE** |
| PLAYERS CHANGE GEAR | the GAME tab's switch, on to start, offered where a system makes its own item types (G6a, G6b): off, a player's gear columns are the GM's | `players_change_gear` setting, `switches.gear`, `uniqueLines.keepColumns`, `GearTypeTables` | `sheet-players-change-gear` (off: DAMAGE read only and said; the GM changes it, UNIQUE by the GM; on: the player changes it) | **AT THE TABLE** |
| An item's PRICE and IN SHOPS | priced and IN SHOPS, it sells itself at its type's shops (8a7a3a); off, never sold, not even from a file, but bought back at its price by a shop of its type (8a7a3c2); a type's PRICE column read as its price; set on ITEMS under TYPE, NOT SOLD in the list, a new item's price asked for (8a7a3b1); in the ITEMS import and downloads, price and in shops columns (8a7a3b2) | `shop_items_on_sale`, `itemPrice`, `ItemsPage`, `system_builder_items_import`, `itemsImport` | `shop-items-on-sale` (a type's PRICE column; a ring turned off; sold back from the window at 50%), `builder-item-price` (set by clicks), `builder-items-import` (imported priced and IN SHOPS) | **AT THE TABLE** |
Expand Down
1 change: 1 addition & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ kept; the job itself stops at 30 (`timeout-minutes`), for a hang outside the tes
| `tests/builder-items.spec.ts` | ITEMS (7e2b): + SLOT named ATTUNED with three each; + ITEM named Ring of Constitution, worded, needing WORN AND ATTUNED, with a feature Hardy giving +2 Con that STOPS AT 20, and no level, list or increase on it; saved with no problems as made, and kept after a reload. A second test (7e4b): + INSTALL made CYBERWARE costing against Strain, NEVER PAST @might (read in words), and a Cranial Jack INSTALLED AS CYBERWARE at a COST of 0.25, saved as made and there after a reload; on their tabs since 8aL1, each item made from + beside GEAR since 8aL2 |
| `tests/builder-items-import.spec.ts` | Uploading items (8aL3b): on the ITEMS tab, DOWNLOAD EXAMPLE gives a file made from the system (WEAPONS with its DAMAGE and GRADE); edited (a Hand Crossbow named, a Bad Bow with a GRADE the column hasn't), pasted into IMPORT and PREVIEWed: the crossbow new, the bow skipped by its line; APPLY, the crossbow in WEAPONS, saved with no problems Since 8a7a3b2 the example has PRICE and IN SHOPS too, and the crossbow imported from it is priced 25 and IN SHOPS. |
| `tests/builder-item-types.spec.ts` | ITEM TYPES (8a2; on their tabs since 8aL1): GEAR said to start on TYPES, where the page opens; WEAPONS from its preset, opened beside it; its AMMO refilled by LONG REST and reloaded from Pistol Rounds; + COLUMN named GRADE, PICK ONE of LIGHT, HEAVY; + ITEM named Pistol, a WEAPON, its DAMAGE, RANGE, AMMO, WEIGHT and GRADE filled; saved with no problems, the types and items as made; after a reload the Pistol a WEAPON and WEAPONS beside GEAR; since 8aL2 the Pistol made from + WEAPON, its name focused to type over, and FIND narrowing the list to the rounds, 1 OF 2 Since G1 the WEAPON preset starts EQUIPPED, checked on its ON THE SHEET buttons and in the saved draft. |
| `tests/builder-sold-at.spec.ts` | SOLD AT and + NEW SHOP on a type (8a7b2). WEAPONS from its preset starts at the Gun Shop, said under the chips; an Apothecary typed into + NEW SHOP and made by Enter is ticked, and the words say shops this game made are dashed; SPELLS from theirs is sold nowhere, Magic Shop filled in, ADDed and ticked. Saved as made (problems none, the shops and each type's SOLD AT). Then that game runs with a priced Pistol: a player paid 1000 buys it at a Gun Shop's WEAPONS shelf, 800 left. |
| `tests/builder-encumbrance.spec.ts` | ENCUMBRANCE on the builder's ITEMS page (8a5c): COUNT ENCUMBRANCE starting on GEAR's WEIGHT, CAN CARRY set to five times Might, the first band renamed UNBURDENED up to 40%, a third band HEAVY, the word past them CRUSHED, and the CYBERWARE install still weighing while installed; saved as made, there after a reload; and (8a5d2) ENCUMBERED saying "Speed -10 ft." and putting EXHAUSTED on, past them saying "Speed -20 ft.", kept after a reload |
| `tests/builder-condition-modifiers.spec.ts` | A condition's modifiers on the builder's CONDITIONS page (8a5e2): SLOWED made by clicks with the SNAIL icon (8a5i), ITS MODIFIERS APPLIED, Speed TIMES 0.5 and Might less by `@speed / -10`; saved as made, APPLIED, its way and its formula there after a reload |
| `tests/builder-condition-each-turn.spec.ts` | A condition's EACH TURN on the builder's CONDITIONS page (8a9b): BURNING made by clicks, ending after 3 rounds, + EACH TURN giving 1d4 damage at the start of its turn onto the token; POISONED a save at the end of its turn, d20 + @con_mod, off on 13, rolled by the player, its line in words saying Con mod; STUNNED ending AT THE END OF ITS NEXT TURN. Saved with nothing to fix, each as made after a reload |
Expand Down
4 changes: 4 additions & 0 deletions e2e/tests/builder-clicks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ test('every control in the builder takes a click, on every page', async ({ page
await expect(weapons.getByRole('textbox', { name: 'NEW COLUMN words' })).toBeVisible();
await expect(weapons.getByRole('button', { name: 'MAKE DEFAULT' })).toBeVisible();
await expect(weapons.getByRole('group', { name: 'WEAPONS on the sheet' })).toBeVisible();
// SOLD AT (8a7b2), with a shop of the game's own made, so a dashed chip is there too.
await weapons.getByRole('textbox', { name: 'New shop name' }).fill('Apothecary');
await weapons.getByRole('button', { name: 'ADD', exact: true }).click();
await expect(weapons.getByRole('group', { name: 'WEAPONS sold at' }).getByRole('button', { name: 'Apothecary' })).toHaveAttribute('aria-pressed', 'true');
missed['ITEMS · TYPES'] = await faults(page);
// A slot and an install (7e2b, 7e4b), side by side.
await itemsTab('SLOTS & INSTALLS').click();
Expand Down
3 changes: 2 additions & 1 deletion e2e/tests/builder-item-types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ test('ITEM TYPES: WEAPONS from its preset with AMMO and a GRADE, and a Pistol fi
expect(saved.draft.items).toEqual({
types: [
{ id: 'gear', label: 'GEAR', one: 'Gear', columns: [{ id: 'weight', label: 'WEIGHT', kind: 'number', unit: 'LB' }, { id: 'price', label: 'PRICE', kind: 'number' }] },
{ id: 'weapons', label: 'WEAPONS', one: 'Weapon', on_sheet: 'equipped', columns: [
// Sold at the Gun Shop, as its preset suggests (8a7b2).
{ id: 'weapons', label: 'WEAPONS', one: 'Weapon', on_sheet: 'equipped', sold_at: ['gun_shop'], columns: [
{ id: 'damage', label: 'DAMAGE', kind: 'damage' }, { id: 'range', label: 'RANGE', kind: 'text' },
{ id: 'ammo', label: 'AMMO', kind: 'count', button: 'FIRE', refill: 'long_rest', reload: ['rounds'] },
{ id: 'weight', label: 'WEIGHT', kind: 'number', unit: 'LB' }, { id: 'price', label: 'PRICE', kind: 'number' },
Expand Down
94 changes: 94 additions & 0 deletions e2e/tests/builder-sold-at.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { test, expect } from '@playwright/test';
import { signInAsGm, signInAsPlayer, openBuilder, builderPage, gmToken, asGm, runningSystem, approvedPlayer } from './helpers';
import { playerToken, payPlayer } from './shops';

// SOLD AT on a type, and + NEW SHOP (8a7b2; approved mockup docs/mockups/types-in-shops.html, section 2). By clicks: WEAPONS
// from its preset, sold at the Gun Shop to start; an Apothecary of the game's own made and ticked too; SPELLS from theirs,
// sold nowhere, its Magic Shop filled in and ADDed. Saved as made. Then that game at the table: a Pistol of WEAPONS bought
// at a Gun Shop.

test('SOLD AT: WEAPONS at the Gun Shop and a new Apothecary, SPELLS at a Magic Shop, saved; a Pistol bought at a Gun Shop (8a7b2)', async ({ page, browser, request }, info) => {
test.setTimeout(180_000);
const again = info.retry ? ` ${info.retry + 1}` : '';
const name = `Soldfall${again}`;
const gm = await gmToken(request);
const { id } = await asGm(request, gm, 'post', '/api/systems', { definition: { format: 1, name, core: { health: { model: 'pool' } },
stats: [{ id: 'abilities', label: 'ABILITIES', stats: [{ id: 'might', label: 'Might' }] }] } });
await page.setViewportSize({ width: 1280, height: 800 });
await signInAsGm(page);
await openBuilder(page);
const card = page.getByTestId(/^system-/).filter({ hasText: name.toUpperCase() });
if (!(await card.getByRole('button', { name: 'OPEN', exact: true }).isVisible())) await card.getByRole('button').first().click();
await card.getByRole('button', { name: 'OPEN', exact: true }).click();
await builderPage(page, 'ITEMS');

// WEAPONS from its preset: the Gun Shop ticked, said.
const types = page.getByRole('region', { name: 'Item types' });
const presets = types.getByRole('group', { name: 'Add an item type' });
await presets.getByRole('button', { name: 'WEAPON', exact: true }).click();
const weapons = page.getByRole('region', { name: 'WEAPONS type' });
const soldAt = weapons.getByRole('group', { name: 'WEAPONS sold at' });
await expect(soldAt.getByRole('button', { name: 'Gun Shop' })).toHaveAttribute('aria-pressed', 'true');
await expect(soldAt.getByRole('button', { name: 'General Store' })).toHaveAttribute('aria-pressed', 'false');
await expect(weapons.getByText('Sold at every Gun Shop in this game.')).toBeVisible();

// + NEW SHOP: an Apothecary, made by Enter, dashed and ticked.
await weapons.getByRole('textbox', { name: 'New shop name' }).fill('Apothecary');
await weapons.getByRole('textbox', { name: 'New shop name' }).press('Enter');
await expect(soldAt.getByRole('button', { name: 'Apothecary' })).toHaveAttribute('aria-pressed', 'true');
await expect(weapons.getByText('Sold at every Gun Shop, every Apothecary in this game. Dashed: shops this game made.')).toBeVisible();

// SPELLS from theirs: sold nowhere, a Magic Shop ready to ADD; ADDed, ticked.
await presets.getByRole('button', { name: 'SPELL', exact: true }).click();
const spells = page.getByRole('region', { name: 'SPELLS type' });
await expect(spells.getByText('Sold nowhere: only given, from GIVE.EXE.')).toBeVisible();
await expect(spells.getByRole('textbox', { name: 'New shop name' })).toHaveValue('Magic Shop');
await spells.getByRole('button', { name: 'ADD', exact: true }).click();
await expect(spells.getByRole('group', { name: 'SPELLS sold at' }).getByRole('button', { name: 'Magic Shop' })).toHaveAttribute('aria-pressed', 'true');

await expect(page.getByTestId('save-status')).toHaveText(/· SAVED /, { timeout: 15_000 });
const saved = await asGm(request, gm, 'get', `/api/systems/${id}`);
expect(saved.problems).toEqual([]);
expect(saved.draft.buildings).toEqual({ shops: [{ id: 'apothecary', name: 'Apothecary' }, { id: 'magic_shop', name: 'Magic Shop' }] });
const soldAtOf = (typeId: string) => saved.draft.items.types.find((t: { id: string }) => t.id === typeId).sold_at;
expect(soldAtOf('weapons')).toEqual(['gun_shop', 'apothecary']);
expect(soldAtOf('spells')).toEqual(['magic_shop']);
expect(saved.draft.items.types.find((t: { id: string }) => t.id === 'gear')).not.toHaveProperty('sold_at');

// At the table: that game, a priced Pistol of WEAPONS, a Gun Shop on the map, a player with 1000.
const table = { ...saved.draft, name: `Soldfall Table${again}`, items: { ...saved.draft.items,
list: [{ id: 'pistol', label: 'Pistol', type: 'weapons', values: { damage: '2d6', price: 200 }, in_shops: true }] } };
await runningSystem(request, gm, table);
const player = { username: `e2e_soldfall${again ? `_${info.retry + 1}` : ''}`, password: 'e2e-player-password' };
await approvedPlayer(request, gm, player);
await playerToken(request, gm, player.username);
const shop = `SOLDFALL_ARMS${again ? `_${info.retry + 1}` : ''}`;
const made = await asGm(request, gm, 'post', '/api/locations', { name: shop, description: '', shape: 'box', x: 10, y: 0, z: 10, width: 2, height: 2, depth: 2 });
const typed = await request.patch(`/api/locations/${made.data[0].id}/building-type`, { data: { building_type: 'gun_shop' }, headers: { Authorization: `Bearer ${gm}` } });
expect(typed.ok(), await typed.text()).toBe(true);

const context = await browser.newContext({ baseURL: info.project.use.baseURL, viewport: { width: 1280, height: 800 } });
const mine = await context.newPage();
await signInAsPlayer(mine, player);
await mine.getByRole('button', { name: 'CHARACTER_CONTROLS', exact: true }).click();
await mine.getByRole('button', { name: 'CHARACTER_SHEET', exact: true }).click();
await expect(mine.getByRole('group', { name: 'Vitals' })).toBeVisible({ timeout: 15_000 });
await mine.keyboard.press('Escape');
await page.reload();
await signInAsGm(page);
await payPlayer(page, player.username, 1000);

// The Gun Shop's WEAPONS shelf has the Pistol; bought, paid for.
await mine.getByRole('button', { name: 'QUICK_ACCESS', exact: true }).click();
const list = mine.locator('.quick-access-panel');
await list.getByText(/DEFINED_STRUCTURES/).click();
await list.getByText(shop, { exact: true }).click();
await mine.getByRole('button', { name: 'SHOP', exact: true }).click();
const window = mine.locator('.win95-window', { has: mine.getByText(`SHOP.EXE · ${shop}`, { exact: true }) });
await window.getByRole('tab', { name: 'WEAPONS' }).click({ timeout: 15_000 });
await window.getByRole('button', { name: 'Add Pistol to the cart' }).click();
await window.getByRole('tab', { name: 'CART' }).click();
await window.getByRole('button', { name: 'CHECK OUT' }).click();
await expect(window.getByRole('tabpanel')).toContainText('BALANCE 800cr', { timeout: 15_000 });
await context.close();
});
Loading
Loading