V1.12.0: worlds from a code, shops and cash in the seeds, up-to-date packages
- A DM can start a campaign from a ready-made world by typing its six-character code: "+ New Campaign" on the Campaigns page, then "Or start from a ready-made world". The whole world is built in one go with them as its DM: locations, weapons, items, spells, monsters, NPCs, encounters and notes. ALDENF is Aldenfell, HOLLOW is Hollowcrown. - A world is one file in /backend/seeds. Drop another in and its code works straight away, with no restart. "npm run seeds:check" lists every world, or what is wrong with one: a misspelt field, a name used twice, an encounter pointing at something the file does not have. A file with a mistake in it is never offered. docs/SEEDS.md has the format. - A seed can now hold everything a campaign can: gear effects, an NPC's wares and exchange rate, things for sale at an encounter, and rewards in silver, copper and cash. - The database seed creates the admin account and nothing else. The Aldenfell and Hollowcrown seed commands are gone: worlds come from codes. - Hollowcrown follows the V3 book: 4 starting items and 3 things equipped, the book's effects on every weapon and item, armor as items (library, modern and magic), worn gear at the book's levels, damage types on monsters, ten shop scenes with prices and stock, five money changers, Meridian loot as cash and mixed hoards as gold, silver and copper. - Aldenfell: the Shield and Leather Armor change AC, Mireille and the Founding Fair stalls sell things, and the book's missing scenes are in (E5, E7, E15, E16, E18, E23-24, E26, the Drowned Shrine, Sevrisk's Hollow, a wyvern pass). The locket is found with Investigation, as the book has it. - Packages are up to date: Prisma 7 (with the pg driver adapter and a prisma.config.js that holds the database URL), Express 5, zod 4, dotenv 18, jest 30, bcrypt 6 and TypeScript 7. "npm audit" finds nothing. Install scripts are approved for Prisma and bcrypt. On a server: "npm install", then "npm run deploy". - The frontend's five lint warnings are fixed; useAuth and usePagination have files of their own. - All packages at version 1.12.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Link, useMatch } from 'react-router-dom';
|
||||
import { useCampaign, useCampaignCharacters, usePatchCharacterWeapon, usePatchInventoryItem, useQuickStats } from '../api/queries';
|
||||
import { useAuth } from '../auth/AuthContext';
|
||||
import { useAuth } from '../auth/useAuth';
|
||||
import { useLastCampaignId } from '../lib/lastCampaign';
|
||||
import { closeCharacterPanel, openCharacterPanel, useCharacterPanelId } from '../lib/characterPanel';
|
||||
import { CLASS_LABELS, SPECIES_LABELS, fmtMod, formatPurse, spellLevelLabel } from '../lib/format';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { createPortal } from 'react-dom';
|
||||
// Short explanations for the stat labels sprinkled across the sheet, quick
|
||||
// stats, party table, and builder — "what is this, and how is it worked
|
||||
// out" for someone who doesn't already know D&D 5e by heart.
|
||||
export const STAT_HELP: Record<string, string> = {
|
||||
const STAT_HELP: Record<string, string> = {
|
||||
AC: 'Armor Class — how hard you are to hit. 10 + your Dexterity modifier + any armor bonus.',
|
||||
HP: 'Hit Points — damage you can take before falling unconscious. Max HP is set by your class hit die, Constitution modifier, and level.',
|
||||
TEMP_HP: 'Temporary Hit Points — an extra buffer that absorbs damage first and disappears when it runs out (it does not stack with more temp HP).',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Link, NavLink, Outlet, useMatch } from 'react-router-dom';
|
||||
import { useAuth } from '../auth/AuthContext';
|
||||
import { useAuth } from '../auth/useAuth';
|
||||
import { useLastCampaignId, useRememberCampaign } from '../lib/lastCampaign';
|
||||
import { DiceRoller } from './DiceRoller';
|
||||
import { CharacterPanel } from './CharacterPanel';
|
||||
|
||||
@@ -1,27 +1,4 @@
|
||||
import { useMemo, useState } from 'react';
|
||||
|
||||
// Small generic pager shared by every list-turned-table in the app, so page
|
||||
// state isn't hand-rolled per screen. Resets to page 1 whenever the
|
||||
// underlying item count shrinks below the current page (e.g. after a delete
|
||||
// or a filter change).
|
||||
export function usePagination<T>(items: T[] | undefined, pageSize = 10) {
|
||||
const [page, setPage] = useState(1);
|
||||
const all = items || [];
|
||||
const pageCount = Math.max(1, Math.ceil(all.length / pageSize));
|
||||
const safePage = Math.min(page, pageCount);
|
||||
const pageItems = useMemo(() => all.slice((safePage - 1) * pageSize, safePage * pageSize), [all, safePage, pageSize]);
|
||||
|
||||
return {
|
||||
page: safePage,
|
||||
pageCount,
|
||||
pageItems,
|
||||
total: all.length,
|
||||
setPage,
|
||||
nextPage: () => setPage((p) => Math.min(pageCount, p + 1)),
|
||||
prevPage: () => setPage((p) => Math.max(1, p - 1)),
|
||||
};
|
||||
}
|
||||
|
||||
// The controls for a paged list; the page state itself is hooks/usePagination.
|
||||
export function Pagination({
|
||||
page,
|
||||
pageCount,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Navigate, Outlet } from 'react-router-dom';
|
||||
import { useAuth } from '../auth/AuthContext';
|
||||
import { useAuth } from '../auth/useAuth';
|
||||
import { Spinner } from './Spinner';
|
||||
|
||||
export function ProtectedRoute() {
|
||||
|
||||
Reference in New Issue
Block a user