Fix issue #67: Don't show all items on the items sidebar
All checks were successful
Test / test (push) Successful in 2s

This commit is contained in:
Gitea OpenCode Agent
2026-10-15 16:40:15 +00:00
parent 0caacf434f
commit 495e528124
5 changed files with 103 additions and 37 deletions

View File

@@ -82,16 +82,16 @@ The optional read-only snapshot bridge is not affected: it keeps publishing the
### Items
The campaign's Item list is synchronized with the world's gear, both ways:
The campaign's Item list mirrors the world's item directory (Foundry's **items tab**) and nothing
else (Syndria98/dragonroll#67):
- The GM sends the world item directory (`game.items`) with every snapshot, and world items created,
changed or deleted in Foundry are pushed as they happen. Items embedded in a character travel with
that character's snapshot instead.
- Gear is deduplicated by name: the same sword in the world directory and in three characters'
inventories becomes one Dragonroll item. Names Dragonroll renames away from are remembered on the
item (`foundryNames`), so Foundry's copies keep folding into it rather than coming back as a
duplicate. Spells, classes, subclasses, backgrounds, feats and species are not gear and are not
imported.
changed or deleted in Foundry are pushed as they happen. The items embedded in a character are that
character's own inventory: they travel with its snapshot and stay on its sheet, so gear a character
merely carries does not stand in the campaign's item list.
- A world item folds into a Dragonroll row that already carries its name — one a campaign made by hand,
or one it renamed away from and remembers (`foundryNames`) — instead of doubling it. Spells, classes,
subclasses, backgrounds, feats and species are not gear and are not imported.
- Foundry owns the fields it sends (category from the item type, rarity, quantity, weight, weapon
properties, description). An item made by hand in Dragonroll is created in the world's item
directory on the next reconcile, mapped afterwards, and editing it in Dragonroll updates the Foundry
@@ -101,10 +101,9 @@ The campaign's Item list is synchronized with the world's gear, both ways:
what the GM colours in Foundry shows on the campaign's folder, and what the campaign colours lands on
the world's folder on the next reconcile (the world's document keeps its name and nesting either way).
- A full snapshot keeps Dragonroll edits on reconnect; live Foundry edits overwrite. Item removal is
pruned only by a full snapshot, so a live item push never deletes anything. Deleting a synced item in
Dragonroll removes its Foundry world copy on the next reconcile. Items that live only in an actor's
inventory are owned by that actor's snapshot: editing such an item in Dragonroll does not rewrite the
actor's copy.
pruned only by a full snapshot, so a live item push never deletes anything: only a full snapshot sees
the whole world directory and can tell which synced rows it has let go of. Deleting a synced item in
Dragonroll removes its Foundry world copy on the next reconcile.
The module calls these Dragonroll routes with the campaign sync token (no Dragonroll login):

View File

@@ -530,8 +530,9 @@ async function pushFoundryActors(actors, fullSync = false) {
const result = await postDragonroll("foundry/sync/snapshot", {
worldId: game.world.id,
actors: supportedActors.map(serializeFoundryActor),
// Dragonroll deduplicates by name, so sending the world directory next to
// the actor copies keeps a single Item per piece of gear.
// The world item directory is what the campaign lists as its items
// (Syndria98/dragonroll#67); the gear a character carries travels inside that
// actor's snapshot as its inventory, not as campaign items.
items: getWorldItemSnapshots(),
// The folder tree those world items stand in (see worldItemFolderSnapshots).
folders: worldItemFolderSnapshots(),