Repository navigation
API
game.modules.get("dxcufgbs-quest-log").api (set when the world is ready; see From another module below). Functions that change data return a Promise, so await them. Players can use everything not marked GM, also with no GM online.
| Function | |
|---|---|
open() |
Opens the Quest Log tab. |
openQuest(id) / newQuest(prefill)
|
Opens a quest's window / the new-quest form (prefill: title, questType ("main"/"side"), chapter, giver, acquiredAt, location (one text; commas split it into places) or locations ([{name, hidden}]), reward, description, tags, objectivesText (one objective per line), images (paths), hidden (GM)). Nothing is saved until the user clicks Create. |
addToQuestLog({text, images, source, type, title}) |
Opens the Add to Quest Log dialog (type: note, clue, objective or quest). |
quests() / getQuest(id)
|
Quests the current user can see (getQuest returns null for an unknown quest, and for players for a hidden one). For players, hidden parts are left out and hidden fields come back empty. |
createQuest(data, {hidden}) |
Creates a quest and returns its id (null before the quest log is set up). data: title, questType, chapter, giver, acquiredAt, locations ([{name, hidden}]; the one-text location of prefill isn't read here), reward, description, tags, objectives (a list of texts) and images (paths). hidden: true (GM) creates it hidden from players. |
updateQuest(id, data), setStatus(id, status), addObjective(id, text, {hidden, stage}), addItem(id, {name, uuid, img, hidden}), addNpc(id, {name, faceId, uuid, img, hidden}), addNote(id, {type, text, images, source, hidden})
|
Changes a quest. status: active, completed or failed. stage: a stage id of the quest. faceId: the id of a Familiar Faces & Places NPC. type: note or clue; source: {uuid, label} of where it came from. hidden works for GMs only. The add… calls return the new entry's id. |
exportQuests() / importQuests(file?)
|
GM: the export dialog / import from a File (asks for one when left out). |
deleteAllQuests() |
GM: the Delete all quests confirmation; deletes every quest when confirmed. Returns how many were deleted. |
convertCategoryTags() |
GM: turns Main quest / Side quest / Chapter … tags into the quest type and chapter (see Main quest / Side quest), without asking. Returns how many quests were changed. |
importAdventureQuests(adventure, {notify, quests, rewards, partyNotes}) |
GM: adds the quests, rewards and notes stored in an Adventure (document or UUID) to the log, skipping ones already there. quests, rewards or partyNotes false leaves that kind out (all default to true). Returns the counts {added, skipped, hidden, rewards, partyNotes} (added, skipped, hidden count quests; rewards, partyNotes the ones added), or null when the adventure has no quest log or all three are false. notify: false shows no notifications. |
storeInAdventure(adventure, {includeHidden}) |
GM: stores the world's quest log (quests, rewards and notes) in an Adventure (its compendium must be unlocked), so the adventure brings them along. includeHidden: false leaves out hidden quests, rewards, notes and hidden parts. Returns how many quests were stored. |
setPartHidden(id, kind, partId, hidden) / setFieldHidden(id, field, hidden)
|
GM: hides or reveals one stage, objective, note/clue, image, place, item needed or related NPC (kind: stages, objectives, notes, gallery, locations, items, npcs) / one field (questType, chapter, giver, acquiredAt, reward, description, tags, or location for every place at once). |
| Function | |
|---|---|
openRewards() / openReward(id) / newReward(prefill)
|
Opens the Quest Rewards view / a reward's window / the new-reward form (prefill: name, description, img, maxUses (0 = no limit), perCharacter (uses per character for a "one each" reward; the total follows the party size), usesLeft, questId, links ([{type, name, uuid}], type: place, npc, faction, other), hidden). |
addAsReward({text, images, source, title}) |
Opens the new-reward form filled in from a piece of text. |
rewards() / getReward(id)
|
Quest rewards the current user can see (status active or claimed, maxUses (for a "one each" reward: perCharacter × the party size now), perCharacter, usesLeft, unlimited, log of uses, links, questId). |
createReward(data, {hidden}) / updateReward(id, data) / deleteReward(id)
|
Creates (returns the id), changes or deletes a reward (data as prefill above). |
useReward(id), undoRewardUse(id), refillReward(id), setRewardClaimed(id, claimed), setRewardHidden(id, hidden)
|
Uses a reward once (the last use moves it to claimed; rewards with no limit have no uses to count), takes back the last use, fills it again, claims or restores it, hides or reveals it (GM). |
offerQuestRewards(questId) |
GM: asks whether to add a completed quest's reward to the Quest Rewards (what happens when a quest is completed). Does nothing unless the quest is completed and has something in its Reward field. |
| Function | |
|---|---|
openNotes() / openPartyNote(id) / newPartyNote(prefill)
|
Opens the Notes view / a note's window / the new-note form (prefill: title, text, tags, questId, links ([{type, name, uuid}]), images (paths), pinned, hidden). |
addAsPartyNote({text, images, source, title}) |
Opens the new-note form filled in from a piece of text. |
partyNotes() / getPartyNote(id)
|
Notes the current user can see (title, text, tags, questId, links, gallery ([{id, src}]), pinned, hidden). |
createPartyNote(data, {hidden}) / updatePartyNote(id, data) / deletePartyNote(id)
|
Creates (returns the id), changes or deletes a note (data as prefill above; when changing a note, paths in images are added to its images). |
setPartyNotePinned(id, pinned), setPartyNoteHidden(id, hidden), addPartyNoteImages(id, paths), sharePartyNote(id)
|
Pins or unpins a note, hides or reveals it (GM), adds images (paths) to it, posts it to the chat (not while it is hidden). |
The module calls no hooks of its own.
The API is set at the end of the module's own ready hook, after the quest log's journals are checked, so it may not be there yet while another module's ready hook runs. Look it up when you need it (a button, a macro, a later hook) and make the integration optional:
const questLog = game.modules.get("dxcufgbs-quest-log");
const api = questLog?.active ? questLog.api : null;
if (api) {
const id = await api.createQuest({ title: "The Missing Blacksmith", giver: "Mayor Holt", objectives: ["Find the blacksmith"] });
await api.addNote(id, { type: "clue", text: "Soot on the mayor's boots." });
}Add { "id": "dxcufgbs-quest-log", "type": "module" } to relationships.recommends in your module.json.
Read and change the log through the API, not the flags: the data journals (flags.dxcufgbs-quest-log.store is "shared" or "secret") and the shape of their quests, rewards and partyNotes flags are internal and may change. The stable formats are the export file / adventure format (see Adventures That Bring Quests) and the links:
@Quest[<id>]{label}@Quest[<id>/<part kind>/<part id>]{label}@Reward[<id>]{label}@PartyNote[<id>]{label}-
@NPC[<Familiar Faces & Places NPC id>]{label}, which links an NPC for every user who knows them in Familiar Faces & Places (plain text for everyone else, and without that module).
Familiar Faces & Places has its own API: see its API page.
Dxcufgb's Workshop: every Foundry VTT project, video and changelog in one place · Support on Ko-fi · MIT License
Using it
- Installation
- Quests
- Objectives, Stages and Items
- Search and Grouping
- Adding from the Game
- Quest Rewards
- Notes
For the GM
Works with
For module and adventure authors
Help