V1.0.1: Aldenfell campaign seed, content library, party overview

- Seed now resets the database and seeds the Aldenfell campaign from the
  campaign book: admin DM user, default weapons, locations, bestiary,
  pre-built encounters, and DM/shared notes
- Default weapon/spell/monster library, character profile fields,
  locations and dice mode (new migration)
- Party overview page, pagination, info tips, build preview calc
- Remove stale demo-login hint; notes preserve line breaks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-23 10:24:48 +02:00
co-authored by Claude Opus 5.5
parent 9b29dc8253
commit 94067f1268
34 changed files with 3158 additions and 391 deletions
+44 -3
View File
@@ -3,7 +3,7 @@ const { z } = require('zod');
const prisma = require('../db');
const { requireAuth } = require('../middleware/auth');
const { loadCampaignMembership } = require('../middleware/campaignAccess');
const { computeCharacterSheet } = require('../game/calculations');
const { computeCharacterSheet, computeWeaponStats } = require('../game/calculations');
const router = express.Router();
@@ -26,19 +26,60 @@ async function requireEncounterAccess(req, res, next) {
}
}
// Every campaign member looking at an encounter can see a character
// combatant's equipped weapons and known spells (attack/damage bonus, save
// DC) — not just HP/AC — so the party can plan around each other mid-fight,
// not only the DM. Uses the same calculation-engine functions the
// quick-stats panel already uses, never re-deriving the formulas.
function characterCombatInfo(character) {
const sheet = computeCharacterSheet(character, character.skillProficiencies, character.saveProficiencies);
const weapons = character.weapons.map((cw) => ({
characterWeaponId: cw.id,
name: cw.weapon.name,
equipped: cw.equipped,
quantity: cw.quantity,
...computeWeaponStats(cw.weapon, sheet.abilities, sheet.proficiencyBonus, true),
}));
const spells = character.spells.map((cs) => ({
characterSpellId: cs.id,
name: cs.spell.name,
level: cs.spell.level,
prepared: cs.prepared,
}));
return { armorClass: sheet.armorClass, weapons, spells, spellcasting: sheet.spellcasting };
}
async function serializeEncounter(encounterId) {
return prisma.encounter.findUnique({
const encounter = await prisma.encounter.findUnique({
where: { id: encounterId },
include: {
participants: {
include: {
character: { select: { id: true, name: true } },
character: {
include: {
skillProficiencies: true,
saveProficiencies: true,
weapons: { include: { weapon: true } },
spells: { include: { spell: true } },
},
},
monster: { select: { id: true, name: true } },
},
orderBy: { initiative: 'desc' },
},
},
});
if (!encounter) return encounter;
encounter.participants = encounter.participants.map((p) => {
if (!p.character) return p;
return {
...p,
character: { id: p.character.id, name: p.character.name },
characterCombatInfo: characterCombatInfo(p.character),
};
});
return encounter;
}
router.get('/:id', requireEncounterAccess, async (req, res, next) => {