This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
Foundry modules run in the game client, so the module cannot bind an HTTP port on the Foundry host.
|
||||
This integration uses a small companion bridge process on that host:
|
||||
|
||||
1. A linked GM client syncs character Actors directly with the Dragonroll campaign.
|
||||
1. A linked GM client syncs character Actors and world Items directly with the Dragonroll campaign.
|
||||
2. The module publishes the active world's actor and item snapshot to the optional bridge.
|
||||
3. The bridge serves authenticated HTTP read endpoints that Dragonroll proxies under `/api/foundry/*`.
|
||||
|
||||
@@ -45,7 +45,7 @@ The campaign settings show the linked world's title and system. A Foundry world
|
||||
only one campaign at a time. The pairing endpoint accepts cross-origin requests from the Foundry
|
||||
client and uses the one-time code instead of a Dragonroll login token.
|
||||
|
||||
## Character synchronization
|
||||
## Character and item synchronization
|
||||
|
||||
After linking, the GM client imports Foundry character, NPC, and creature Actors into the campaign.
|
||||
Creates, updates, and deletes sync in either direction; Dragonroll changes are applied in Foundry
|
||||
@@ -53,6 +53,44 @@ within about five seconds. The module currently creates Dragonroll characters in
|
||||
worlds. After updating an already-linked world to a version with character sync, create a fresh
|
||||
pairing code and enter it in Foundry once to issue the sync token.
|
||||
|
||||
### Items
|
||||
|
||||
The campaign's Item list is synchronized with the world's gear, both ways:
|
||||
|
||||
- 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.
|
||||
- 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
|
||||
document.
|
||||
- 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.
|
||||
|
||||
The module calls these Dragonroll routes with the campaign sync token (no Dragonroll login):
|
||||
|
||||
| Route | Use |
|
||||
|---|---|
|
||||
| `POST /api/foundry/sync/snapshot` | Actors and world items upsert; `fullSync` also prunes |
|
||||
| `POST /api/foundry/sync/item-snapshot` | Live world item edits, upsert only |
|
||||
| `POST /api/foundry/sync/item-delete` | A world item was deleted |
|
||||
| `GET /api/foundry/sync/characters` | Characters to apply back in Foundry |
|
||||
| `GET /api/foundry/sync/items` | Items to apply back in Foundry |
|
||||
| `POST /api/foundry/sync/map` / `map-item` | Store an id mapping after creating a document |
|
||||
| `POST /api/foundry/sync/delete` | An actor was deleted |
|
||||
|
||||
Foundry documents keep the Dragonroll id in the `dragonroll-foundry.actorId` / `dragonroll-foundry.itemId`
|
||||
flag, and world items are marked with `dragonroll-foundry.syncMutation` while Dragonroll writes them so
|
||||
the write is not echoed back.
|
||||
|
||||
## 2. Run the bridge on the Foundry host
|
||||
|
||||
The bridge uses only Node.js built-in modules and requires Node 18 or newer. Set separate random
|
||||
|
||||
Reference in New Issue
Block a user