diff --git a/CHANGELOG.md b/CHANGELOG.md index 7352b65c..0c32029f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed +- **The catalogue and item import boxes show your game's own example.** Their grey hint showed Cities Without Number's weapons (a Zip Gun) and a fixed GEAR list in every game. Each now shows your own first section, in its own columns. A type with its own PRICE column also no longer lists price twice in the catalogue files. - **Selling back typed gear from the shop window.** A line of one of your item types, or one of your own items, could be bought but not sold back: the shop window didn't recognize it, and the sale was refused. It now sells back at the shop's buyback rate, and a new browser test sells one and checks the money. - **A catalogue section that names nothing is now said.** A section like `[rocks]`, which is neither a shelf nor one of your item types, used to be saved quietly where no shop would ever sell it. The preview now says so, listing your types, and its lines are not saved. - **The bank's windows now follow the theme.** BANK.EXE, PAYROLL.EXE and the GM's BANK_ADMIN.EXE drew in the classic green and grey whatever theme was picked; their boxes, numbers, chart and celebrations now take the theme's colors. @@ -105,6 +106,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added +- **EDIT CURRENT in SHOP_CATALOGUES.** A new button beside DOWNLOAD CURRENT puts what your shops sell now straight into the box, ready to change, PREVIEW and SAVE, with no file to download and upload again. If the box already has text in it, it asks before replacing it. - **Publishing tidies the shop catalogue.** When you publish a system, any catalogue line that is now exactly one of your items, same name, price and columns, is taken out of the file, since the item sells itself. That includes lines that ADD NEW LINES TO ITEMS turned into items. The builder's publish message says how many. Lines naming an item kept out of the shops stay, so they sell again if you switch it back on. - **Catalogue lines can become items.** In SHOP_CATALOGUES, PREVIEW now offers ADD NEW LINES TO ITEMS, off to start. Switched on, it lists what it will add and how many items your system will hold. SAVE then makes each line that isn't one of your items yet into an item: of its section's type (a shelf's lines go to your DEFAULT type), with its columns, price and words, in the shops. They go into the builder's draft and are kept once you publish; until then the catalogue line sells them. If the builder is open, it takes them in, so its next save keeps them. - **One-of-a-kind items sell back.** An item kept out of the shops is never on a shelf, but a player can still sell one to a shop that sells its type, at the item's own price times that shop's buyback rate. A ring sells at an Armorer, never at a Gun Shop. diff --git a/README.md b/README.md index 46538810..9cbc2c39 100644 --- a/README.md +++ b/README.md @@ -893,7 +893,7 @@ CITY_NET/ │ │ │ ├── BuildingPreview.tsx # The corner picture: the GM's photo, else the building's own parts turning as a wireframe in its own small canvas, else the CITY_NET badge. The color is read from the theme's CSS variable where it sits - the info windows render outside the ThemeContext provider, so the context alone drew every theme in classic green │ │ │ ├── BuildingExtrasEditor.tsx # The photo and GM notes in the admin edit view. Nothing saves on its own: UPDATE_DATA_POINT commits them after the building saves, and a 200 with nothing in it - an old server not yet restarted - is reported rather than called saved │ │ │ ├── CityNetIcon.tsx # The CITY_NET badge from assets/citynet-logo.svg in the theme's colors, for anywhere that needs a picture and has none -│ │ │ ├── CatalogueWindow.tsx # Where a GM adds to what shops sell: download an example or the current list, paste or upload, preview, save. SAVE only ever stores text that was previewed, and the preview is the server's own parser, so it cannot show something different from what gets stored; a custom system's items (7e3c): DOWNLOAD ITEMS, and the preview naming the lines that are items and those only nearly named as one; a type's section by its name in the preview, its problems and the save (GUNS ×2), a line's blank columns noted as kept (8a7a1); ALSO ON SALE FROM ITEMS, each line overruling an item and how, each left out and why (8a7a3c1); ADD NEW LINES TO ITEMS under the preview (8a7a4a), off to start: what it adds and how many ITEMS will hold, the save saying what was added and handing it to an open builder +│ │ │ ├── CatalogueWindow.tsx # Where a GM adds to what shops sell: download an example or the current list, paste or upload, preview, save. SAVE only ever stores text that was previewed, and the preview is the server's own parser, so it cannot show something different from what gets stored; a custom system's items (7e3c): DOWNLOAD ITEMS, and the preview naming the lines that are items and those only nearly named as one; a type's section by its name in the preview, its problems and the save (GUNS ×2), a line's blank columns noted as kept (8a7a1); ALSO ON SALE FROM ITEMS, each line overruling an item and how, each left out and why (8a7a3c1); ADD NEW LINES TO ITEMS under the preview (8a7a4a), off to start: what it adds and how many ITEMS will hold, the save saying what was added and handing it to an open builder; EDIT CURRENT puts what the shops sell now in the box, asking first over text there, and the box's grey hint is the system's own (8a7a5) │ │ │ ├── EmptyShopSteps.tsx # What a GM is told when a shop has nothing on any shelf, which outside CWN is every new one: the steps to stock it, a button straight to SHOP_CATALOGUES, and the header line for that shop's section in this game. Shown where the building type is set and to an admin opening the shop. A game's own item types by their sections' names and columns ([WEAPONS], 8a7a2) │ │ │ ├── CyberwareSection.tsx # What the GEAR tab shows: a count, the humanity cost, and the way in. Says when pieces are still unplaced, because an import lands everything unfiled and nothing else would mention it │ │ │ ├── ImportPreviewWindow.tsx # What an import would do, in its own window: what was recognised, what the source never held, what a custom system's importer left and why (worked out, GM-only, not one of the choices), and which of your fields a replace would clear. The window is the confirmation — applying replaces the sheet @@ -930,7 +930,7 @@ CITY_NET/ │ │ │ ├── EncumbranceSection.tsx # ENCUMBRANCE on ITEMS (8a5c): COUNTED BY a NUMBER column IN its unit, CAN CARRY a formula box, BANDS each named and placed by the GM and the word past them, what counts as carried, the names formulas read, STOP COUNTING asked first; under each band and past them WHAT IT MEANS and a CONDITION, NONE first, one gone said (8a5d2) │ │ │ ├── ItemTypesSection.tsx # ITEM TYPES (8a2; approved mockup item-types, 2026-11-14): a tab for each type, + FROM A PRESET (WEAPON, ARMOR, GEAR, CONSUMABLE, SPELL) and + BLANK; the open type's NAME, ONE and its columns, each a name, a KIND and what the kind has (a unit; a button, the rest that refills it and the items it reloads from; PICK ONE's words), + COLUMN, ×, DELETE TYPE asking; on an item, its TYPE and a field for each column by its kind, DAMAGE and DICE a formula box; the types listed beside the open one (8aL1), the DEFAULT first with MAKE DEFAULT on the others, each with how many items are of it, and ON THE SHEET: the open type's table with its first item as the line; an item's PRICE and IN SHOPS under TYPE, its type's PRICE column shown there once, a price asked for while IN SHOPS (8a7a3b1) │ │ │ ├── ChoicesImport.tsx # IMPORT on a CHOICES list (choices import 2; approved mockup choices-import, 2026-10-28): over the list and option columns, DOWNLOAD THIS LIST and DOWNLOAD EXAMPLE, a file pasted or uploaded, PREVIEW read by the server, mistakes warned of by line (named at the top as links that select the line, marked in the line numbers beside the text), APPLY into the draft only for the text previewed -│ │ │ ├── ItemsImport.tsx # IMPORT on the ITEMS tab (8aL3b; approved mockup items-layout, 2026-11-14): beside the list in place of the open item, a file pasted or uploaded, PREVIEW read by the server, mistakes named by line and marked beside the text, APPLY into the draft only for the text previewed, DOWNLOAD THIS LIST and DOWNLOAD EXAMPLE +│ │ │ ├── ItemsImport.tsx # IMPORT on the ITEMS tab (8aL3b; approved mockup items-layout, 2026-11-14): beside the list in place of the open item, a file pasted or uploaded, PREVIEW read by the server, mistakes named by line and marked beside the text, APPLY into the draft only for the text previewed, DOWNLOAD THIS LIST and DOWNLOAD EXAMPLE; its box's grey hint from the system (8a7a5) │ │ │ ├── FormulaIcon.tsx # The formula box's button mark: "math format professional" from Microsoft's Fluent UI System Icons (MIT), picked by the user 2026-10-29, drawn in the text's color so it follows the theme │ │ │ ├── FormulaWords.tsx # The line under a formula: in words with the sample's value, or its mistake in red with USE @name; the formula box's (a live status) and STATS & RULES' and the graph panel's (read with its box, no value, a condition's parts only when wrong) │ │ │ ├── FeaturesEditor.tsx # An option's features on CHOICES (7a2b2): grouped by the level each unlocks at in a levelled list, each row tagged with what it does (MODIFIER, USES, ROLL, CHANGE, CHOICE, TEXT); the open one with its name, AT LEVEL (set when the box is left or on Enter, so typing 12 never moves it to 1 on the way), words, modifiers (what each changes, grouped stats / formulas / health, and by how much), uses and the rest that refills them, rolls it gives, roll changes it lets the character take, and a list it opens; DELETE FEATURE asks first; a "?" beside every setting; RAISES STATS, an INCREASE's points, most on one, group and cap, in words (7d6a); OR INSTEAD, the list an increase offers (7d6c1); ADD or AT LEAST on each modifier, an ADD's STOPS AT, neither AT LEAST nor STOPS AT on the token's maximum (7e1b); the same form for an item's features on ITEMS, without a level, list or increase (7e2b) @@ -1224,7 +1224,7 @@ CITY_NET/ │ │ │ ├── cwnArmorPresets.ts # The armor table (p53): 14 pieces in three groups. Accessories add to AC where armor sets it. Obsolete Tech is kept as a constant, not a row, because its penalties are rolled after the sale │ │ │ ├── cwnGearPresets.ts # Common Operator Gear (p50), 27 items. The Enc column's ~ and * are kept as a note beside a numeric Enc, so the encumbrance sum never has to parse a symbol │ │ │ ├── ownedItems.ts # What a character owns, from inventory rows, weapon slots and stash, cyberware and vehicle slots, reading the rows that system's sheet has. Consults the CWN book only on CWN. Mirrored from backend/shops/owned.js and run against it on every system. Boxed chrome is listed before installed, so selling one of two sells the spare. A line is found on the game's type shelves too, and an item kept out of the shops is priced as a shop buys it back (8a7a3c2) -│ │ │ ├── catalogueSchema.ts # The shape of an uploaded catalogue, read out of each system's own sheet template rather than written down - so the example a GM downloads cannot drift. Also writes the 'download current' file, with the built-in rows behind a #; a section per item type first in a custom system with types of its own (8a7a1): its name as heading where it reads back (else its id), its columns after name and price, a sample line behind a # in EXAMPLE, its lines in CURRENT, the game's own items behind a # there so uploading it back repeats none (8a7a3a) +│ │ │ ├── catalogueSchema.ts # The shape of an uploaded catalogue, read out of each system's own sheet template rather than written down - so the example a GM downloads cannot drift. Also writes the 'download current' file, with the built-in rows behind a #; a section per item type first in a custom system with types of its own (8a7a1): its name as heading where it reads back (else its id), its columns after name and price, a sample line behind a # in EXAMPLE, its lines in CURRENT, the game's own items behind a # there so uploading it back repeats none (8a7a3a); a type's own price column listed once in a file, and the catalogue box's hint from the system (catalogueHint, 8a7a5) │ │ │ ├── uploadedCatalogues.ts # What the GM uploaded, as the window sees it, so shelves and the SELL tab can show what the server would sell; uploadedOf, the server's catalogues as a shop keeps them, the uploaded entries and the game's own items on a type's shelf (8n1, 8a7a3a); what a shop buys back of the items kept out of the shops (loadBuyback, 8a7a3c2) │ │ │ ├── sheetSlots.ts # Where each system's sheet keeps weapons and vehicles, read out of the templates: rows are the highest numbered name field, fields are everything row 1 declares. The source the server's copy is checked against │ │ │ ├── quickRolls.ts # What QUICK ACTIONS can roll, read off the sheet template: fields with a roll outside a skills section as buttons, skills grouped for the picker, house-rule-hidden tabs left out @@ -1293,7 +1293,7 @@ CITY_NET/ │ │ │ ├── rollTotal.ts # A roll line's final total, found for the dice history to bold: after the last = in its first [ ], or the lone number; never what follows a · │ │ │ ├── catalogueItems.ts # A system's items in the shops' catalogues (7e3c): the preview's lines read against the items (named as one, landing as gear or not; nearly named, the closest said), the shelf a starter file uses (the gear's, or the first landing as gear), and the starter file itself, prices left blank; with types of its own, DOWNLOAD ITEMS puts each item in its type's section with its columns, and a type's section counts as gear in the preview (8a7a1); ITEMS_ADDED_EVENT and withAddedItems, a catalogue's new items merged into a draft by id (8a7a4a) │ │ │ ├── choicesImport.ts # IMPORT as logic (choices import 2): DOWNLOAD EXAMPLE made from the system (its @names, its rests by name, a level column only for a levelled list, made-up rows) and DOWNLOAD THIS LIST (cells quoted as a spreadsheet would, rests by name where the reader finds them so, a # note for what a feature does beyond words and uses), a previewed list put into the draft, a line to select, and changes in the page's words. A levelled list's files have a die column, the example's d10 and d6 and the list's own (R1a); a list with a table's, a roll column (7a5b); gives and money columns, what an option gives read back unchanged (7c4e) -│ │ │ ├── itemsImport.ts # The ITEMS tab's IMPORT as logic (8aL3b): DOWNLOAD EXAMPLE made from the system (a section per type with its own columns, needs in its words, cost only with an install, made-up rows fitting each column), DOWNLOAD THIS LIST, a preview put in place, each change in words; held to the server's reader; each section's price and in shops columns, IN SHOPS written only where an item says it, so the list reads back unchanged (8a7a3b2) +│ │ │ ├── itemsImport.ts # The ITEMS tab's IMPORT as logic (8aL3b): DOWNLOAD EXAMPLE made from the system (a section per type with its own columns, needs in its words, cost only with an install, made-up rows fitting each column), DOWNLOAD THIS LIST, a preview put in place, each change in words; held to the server's reader; each section's price and in shops columns, IN SHOPS written only where an item says it, so the list reads back unchanged (8a7a3b2); the import box's hint from the system (itemsHint, 8a7a5) │ │ │ ├── formulaBox.ts # The formula box as logic (formula box 1): a formula in words (+2 for each level, needs Strength 13 or more), its sample line, INSERT's groups (no formulas for an amount), and the SHAPES with why one can't be used yet and what each writes (a name at the cursor is statsRules.ts' insertToken). Formula box 2: ADD (+ your rolled stat's modifier), AGAINST (against 13, against your rolled stat) and a rest's amount (1d8 + CON modifier, sample 3 to 10); THIS ROLL in INSERT, no levels or tables for a rest; the shapes THE STAT ROLLED, ITS MODIFIER, DICE, DICE AND A STAT. Formula box 3: a STATS & RULES formula said as a value with no sign (2 for each level, your Strength), formulaTexts (each formula, or a condition's three parts, keyed id:box) and isMistake. has() in words, and INSERT's CHOICES group: each option and feature as has(name) (7b); AT LEAST in words: at least 19, at least your Con (7e1b); a cost (7f2b), reading the stat raised, and an option's price, said as what it costs; IMPROVE BY USE's boxes, dice and @this (7f3a2); INSERT's GEAR, @carried, @capacity and what is worn by column, wherever the gear is read (8a5c); a condition's TIMES, SET TO and AT MOST as kinds of box, read as formulas, the sample said its way (8a5e2) │ │ │ ├── carrying.ts # CARRYING on GEAR as logic (8a6a): what the server worked out (_worked.carrying) read safely; the meter (filled against the last band's end, a tick where each other band ends, green in the first band, the warning color past it, danger past every band); the bands in the sheet's numbers; the band's condition said where it is on, or that there is no token │ │ │ ├── choicesShown.ts # The CHOICES block as logic (7a3b1): the lists in words from the render copy, the character's picks, levels, uses and what isn't met from the sheet's worked-out view (_worked) read safely; each list as drawn (picks with levels, unlocked features by level, the next to come, room, what's left to pick and what it needs, the total and its breakdown), a use pip's click, and what a feature does in a few words. Works no number out: the server does. choiceEffects (7a3b2): what the picks do to each field, for the sheet's badge (a stat as typed and with its bonuses, a formula as saved and without them, each bonus named), from what the server says each modifier came from. The recovery dice a save wrote, read safely, who may spend now, where they are spent in words, and how many a spend rolls (R2b). The RESTS section as logic (R3b): the buttons a viewer gets, a rest the GM called, and where the dice show. ROLL FOR IT as logic (7a5b2): what a list last rolled (rolledOf), and what the offer shows this viewer (rollOffer); a feature's INCREASE, said as RAISES STATS (7d6b2); a list picked under a feature named, the one an increase offers instead too (7d6c2); the increases left open (7d7b2); the badge naming what a bonus really gave: one its STOPS AT cut, an AT LEAST (7e1b); the server's bonuses on a system with items and no lists too (effectsWorked, 7e3b); conditionWords, a condition's change in the sheet's words ("SLOWED: Speed ×0.5"), each field's conditions, and the server's bonuses shown wherever it has worked lines out (8a5e3) diff --git a/e2e/COVERAGE.md b/e2e/COVERAGE.md index 9419335d..a9fff2fa 100644 --- a/e2e/COVERAGE.md +++ b/e2e/COVERAGE.md @@ -38,6 +38,7 @@ panel), so a control that looks fine but does nothing is caught for all of them. | 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** | | A catalogue file held against the game's items | an exact copy of an item left out, an item kept out of the shops left out, one of an item's name overruling it, ALSO ON SALE FROM ITEMS (8a7a3c1) | `shop_items_on_sale`, `CatalogueWindow` | `catalogue-and-items` | **AT THE TABLE** | | ADD NEW LINES TO ITEMS | a catalogue's new lines made items in the draft (8a7a4a), off to start; on PUBLISH the lines now exactly an item leave the file (8a7a4b) | `catalogue_into_items`, `CatalogueWindow`, `catalogueItems`, `BuilderScreen` | `catalogue-and-items` (the Hand Cannon into the draft, then out of the file once published) | **AT THE TABLE** | +| EDIT CURRENT | what the shops sell now in the catalogue box to change, asked first over text there (8a7a5) | `CatalogueWindow` | `catalogue-and-items` | **AT THE TABLE** | | Building types and catalogues renamed or off | | `buildings` | | **GAP** | | Currencies | several, decimals, a catalogue's currency, the cart per currency, PAYROLL | `currencies`, `currency_icons`, `catalogue_currency`, `bank_currencies`, `shop_checkout_currencies` | | **GAP** | | The bank's celebrations | on / off | `bank` | | **GAP** | diff --git a/e2e/README.md b/e2e/README.md index e2fd6aa5..f8bc8b58 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -219,7 +219,7 @@ kept; the job itself stops at 30 (`timeout-minutes`), for a hang outside the tes | `tests/shop-stress.spec.ts` | The shop under load in a real browser (8n3, the user asked for a 1000+ item stress test). A GUNS shelf of 1000 lines saved from SHOP_CATALOGUES; the player opens it (200 rows and SHOWING 200 OF 1000), scrolls to the end for 200 more, filters it key by key to Gun 99 (11 rows, found past the first page), clears it and sorts by PRICE both ways (Gun 0 and Gun 999 at the top in turn). Each step under 5 s; on a desk each took under half a second, and the times are logged. | | `tests/shop-items-on-sale.spec.ts` | The game's own items at the table (8a7a3a), found by the user testing 8a7a2. A game whose WEAPONS type has a PRICE column, its Pistol priced 200 and a Ring of Might kept out of the shops, and no catalogue saved: the player's General Store has the Pistol on its WEAPONS shelf at 200 with its damage, never the ring, and no empty-shop steps; bought through the cart, it lands on the gear as a Weapon with its damage; sold back from the window at the store's 50% (8a7a3c2), 900 left and off the sheet. Run once without the window's fix, it fails at that balance. | | `tests/shop-typed-lines.spec.ts` | Lines of an item type at the table (8a7a2). A game with a GUNS type (DAMAGE, AMMO) and no SOLD AT, so sold at the General Store: the GM saves a [GUNS] catalogue with a Pistol and pays the player 1000; the player's General Store has a GUNS tab saying GOES INTO YOUR GEAR AS A GUN, sortable by DAMAGE and AMMO; the Pistol bought through the cart lands on the sheet as a Gun with its damage and ammo, and one given from GIVE.EXE stacks onto it. | -| `tests/catalogue-and-items.spec.ts` | A catalogue file held against the game's own items (8a7a3c1). WEAPONS selling a Pistol at 200 and a Cutlass at 120 by themselves, a Ring of Might kept out of the shops: a file with the Pistol at 260, the Cutlass exactly as it is, the Ring and a Hand Cannon previews as WEAPONS ×2, ALSO ON SALE FROM ITEMS: 2 (1 overruled by this file), the Pistol overruling 200 → 260, the Cutlass and the Ring left out and why; saved as WEAPONS ×2, DOWNLOAD CURRENT has the Pistol at 260, the Hand Cannon and the game's Cutlass behind a #, no Ring. With ADD NEW LINES TO ITEMS switched on (8a7a4a, off to start), the Hand Cannon becomes an item of WEAPONS at 900 in the builder's draft (ITEMS 3 OF 200 → 4), said on SAVE, the published system untouched; published (8a7a4b), the Hand Cannon's line leaves the file (dropped 1) and DOWNLOAD CURRENT has it only behind a #. | +| `tests/catalogue-and-items.spec.ts` | A catalogue file held against the game's own items (8a7a3c1). WEAPONS selling a Pistol at 200 and a Cutlass at 120 by themselves, a Ring of Might kept out of the shops: a file with the Pistol at 260, the Cutlass exactly as it is, the Ring and a Hand Cannon previews as WEAPONS ×2, ALSO ON SALE FROM ITEMS: 2 (1 overruled by this file), the Pistol overruling 200 → 260, the Cutlass and the Ring left out and why; saved as WEAPONS ×2, DOWNLOAD CURRENT has the Pistol at 260, the Hand Cannon and the game's Cutlass behind a #, no Ring. With ADD NEW LINES TO ITEMS switched on (8a7a4a, off to start), the Hand Cannon becomes an item of WEAPONS at 900 in the builder's draft (ITEMS 3 OF 200 → 4), said on SAVE, the published system untouched; published (8a7a4b), the Hand Cannon's line leaves the file (dropped 1) and DOWNLOAD CURRENT has it only behind a #; EDIT CURRENT (8a7a5) asks before replacing the box's text, then fills it with what is on sale. | | `tests/catalogue-types.spec.ts` | A catalogue section per item type (8a7a1). In a game with a GUNS type (DAMAGE, AMMO, GRADE), DOWNLOAD EXAMPLE has a [GUNS] section in those columns; a file with a good pistol, a Hand Cannon whose AMMO is "six" and a Blank Gun with columns left blank previews as 2 ROWS READ · 1 PROBLEM, GUNS ×2, the cannon said by its line and the blanks noted as kept; SAVE says GUNS ×2; DOWNLOAD CURRENT has the pistol and the blank gun with their columns, never the cannon | | `tests/shop-items-catalogue.spec.ts` | Items in the shops (7e3c): CATALOGUES.EXE's DOWNLOAD ITEMS gives the ring on the gear's shelf, its price blank; with a price filled in and a line named Ring of Migt, the preview names RING OF MIGHT as an item and the other as nearly it; saved, GIVE.EXE lists the ring from the gear's catalogue at 500 beside the system's ITEMS | | `tests/sheet-level-up.spec.ts` | Going up a level (7d2b): XP reaches the next level and LEVEL UP READY blinks, opening LEVEL_UP.EXE (7d3a), where the player picks which of two classes goes up, leaves and comes back to it where they were, sees what the new level unlocks and FINISHES. In the window (7d3b) a Path Soldier 2 opens is picked, FINISH waiting for it, and then a class not held yet is taken up at level 1; what's past it carries over, with no + on a class, and LEVEL_DOWN brings READY back. With milestone there's no XP anywhere: the GM's LEVEL_UP gives a level, the rail blinks, the player takes it, and a stat called level can't be typed. An uploaded sheet brings its XP under the game's word, and one with none keeps what they have (7d2c). FILL IT IN FOR THEM (7d7a): the GM, on a player's sheet at level 1 with no XP, opens LEVEL_UP.EXE for them, adds a Path they don't meet, and finishes with nothing rolled: Soldier 2, the Path under its feature, health at its average | diff --git a/e2e/tests/catalogue-and-items.spec.ts b/e2e/tests/catalogue-and-items.spec.ts index 9e5c58bc..439cb56f 100644 --- a/e2e/tests/catalogue-and-items.spec.ts +++ b/e2e/tests/catalogue-and-items.spec.ts @@ -8,7 +8,8 @@ import { signInAsGm, gmToken, runningSystem, openGameSystem, asGm } from './help // ITEMS: 2 (1 overruled), the Pistol overruling 200 → 260, the Cutlass and the Ring left out and why; saved, DOWNLOAD CURRENT // has the file's two lines and the game's items behind a #. With ADD NEW LINES TO ITEMS on (8a7a4a), the Hand Cannon becomes // an item of WEAPONS in the builder's draft, priced 900, the running game untouched until a publish; published (8a7a4b), its -// catalogue line, now exactly the item, leaves the file and the item sells itself. +// catalogue line, now exactly the item, leaves the file and the item sells itself. EDIT CURRENT (8a7a5) then puts what is on +// sale in the box, asking first as the box still holds the file. const SYSTEM = (name: string) => ({ format: 1, name, core: { health: { model: 'pool' } }, @@ -85,4 +86,13 @@ test('a catalogue held against the game\'s items: one overruling, an exact copy expect(then).toMatch(/^# Hand Cannon\s*, 900\s*, 3d6/m); expect(then).not.toMatch(/^Hand Cannon/m); expect(then).toMatch(/^Pistol\s*, 260\s*, 2d6/m); + + // EDIT CURRENT: the box still holds the file, so it asks; replaced, the box is what is on sale now, ready to change. + const text = page.getByLabel('Catalogue text'); + await page.getByRole('button', { name: 'EDIT CURRENT', exact: true }).click(); + const asked = page.getByRole('group', { name: 'Replace the box' }); + await asked.getByRole('button', { name: 'REPLACE', exact: true }).click(); + await expect(page.getByText('What the shops sell now is in the box. Change it, then PREVIEW and SAVE.')).toBeVisible({ timeout: 15_000 }); + await expect(text).toHaveValue(/^Pistol\s*, 260\s*, 2d6/m); + await expect(text).toHaveValue(/^# Hand Cannon\s*, 900/m); }); diff --git a/frontend/src/components/CatalogueWindow.tsx b/frontend/src/components/CatalogueWindow.tsx index ab18dbd9..2c413fdf 100644 --- a/frontend/src/components/CatalogueWindow.tsx +++ b/frontend/src/components/CatalogueWindow.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react'; import { DraggableWindow } from './DraggableWindow'; -import { exampleFor, currentFor, type StoredEntry } from '../sheets/catalogueSchema'; +import { exampleFor, currentFor, catalogueHint, type StoredEntry } from '../sheets/catalogueSchema'; import { catalogueLabel, type ShopStock } from '../data/buildingTypes'; import { downloadText } from '../utils/downloadText'; import { customTemplate } from '../sheets/customTemplates'; @@ -58,13 +58,17 @@ export function CatalogueWindow({ pos, setPos, onClose, socket, system }: Props) const [preview, setPreview] = useState(null); /** The text that preview was of. SAVE is offered only while the box still matches it. */ const [previewedText, setPreviewedText] = useState(null); - const [busy, setBusy] = useState<'preview' | 'save' | 'current' | null>(null); + const [busy, setBusy] = useState<'preview' | 'save' | 'current' | 'edit' | null>(null); const [message, setMessage] = useState<{ tone: 'ok' | 'bad'; text: string } | null>(null); /** ADD NEW LINES TO ITEMS (8a7a4a): off to start, afresh with each preview. */ const [toItems, setToItems] = useState(false); const fileRef = useRef(null); /** Set when this window asked for the current catalogues, so their arrival means "download". */ const awaitingCurrent = useRef(false); + /** Set when EDIT CURRENT asked for them (8a7a5), so their arrival fills the box instead. */ + const awaitingEdit = useRef(false); + /** EDIT CURRENT asking before it replaces text in the box. */ + const [askingEdit, setAskingEdit] = useState(false); useEffect(() => { if (!socket) return; @@ -102,6 +106,16 @@ export function CatalogueWindow({ pos, setPos, onClose, socket, system }: Props) * a state updater would run it twice wherever React calls updaters twice. */ const onCatalogues = (payload: { entries?: Partial> }) => { + // EDIT CURRENT (8a7a5): what DOWNLOAD CURRENT would give, in the box to change, preview and save. + if (awaitingEdit.current) { + awaitingEdit.current = false; + setText(currentFor(system, payload?.entries ?? {})); + setPreview(null); + setPreviewedText(null); + setMessage({ tone: 'ok', text: 'What the shops sell now is in the box. Change it, then PREVIEW and SAVE.' }); + setBusy(null); + return; + } if (!awaitingCurrent.current) return; awaitingCurrent.current = false; downloadText(`${system}-storefronts-current.csv`, currentFor(system, payload?.entries ?? {})); @@ -129,6 +143,14 @@ export function CatalogueWindow({ pos, setPos, onClose, socket, system }: Props) const starter = itemsCatalogue(system, items); const itemRows = preview ? itemsInPreview(system, items, preview.sections) : { matched: [], near: [] }; + /** EDIT CURRENT (8a7a5): asks the server what the shops sell now; it arrives in the box. */ + const editCurrent = () => { + if (!socket) return; + awaitingEdit.current = true; + setBusy('edit'); + socket.emit('requestCatalogues'); + }; + const runPreview = () => { if (!text.trim() || tooBig || !socket) return; setMessage(null); @@ -204,6 +226,14 @@ export function CatalogueWindow({ pos, setPos, onClose, socket, system }: Props) socket?.emit('requestCatalogues'); }} >{busy === 'current' ? 'FETCHING…' : 'DOWNLOAD CURRENT'} + {starter && ( + + + )} +