<%* // // Helper Functions //

// Return modified path based on location const dv = app.plugins.plugins.dataview.api; function getPath(location) { const match = dv.pages(‘“Compendium/Atlas”’) .where(p p.type = 'plane' && p.file.name = location) .map(obj obj.file.path.split(’/‘).slice(2, -1).join(’/’)) .find(Boolean);

return match || '';

}

// // Main Code Section //

// Call modal form const result = await MF.openForm(‘REALM’);

// Declare variables after form returns values const location = result.Location.value; const name = result.Name.value; const path = getPath(location);

// Rename, move, & open note await tp.file.move(Compendium/Atlas/${location ? {path}/` : ''}{name}/{name} added`; _%>


type: realm locations:

  • <% location ? "[[${location}]]" : ” %> tags:

banner

<% name %>

:RiGlobalLine: Realm (world)


SUMMARY

Description of the realm <% name %>.

marker

Column

dv.container.className += ’ npcDirect’; dv.list(dv.pages(‘“Compendium/NPC’s”’) .where(p p.file.outlinks.includes(dv.current().file.link)) .sort(p p.file.link) .map(p p.headerLink), 1);

```dataviewjs

dv.container.className += ’ npcChild’; let page = dv.current().file.path; let pages = new Set(); let stack = [page]; while (stack.length > 0) { let elem = stack.pop(); let meta = dv.page(elem); if (!meta) continue; for (let inlink of meta.file.inlinks.concat(meta.file.outlinks).array()) { let locations = dv.page(inlink.path); if (!locations || pages.has(inlink.path) || inlink.path === meta.locations?.[0]) continue; if (dv.array(locations.locations).join(”, “).includes(meta.file.path)) { pages.add(inlink.path); stack.push(inlink.path); }}} let data = Array.from(pages) .filter(p dv.page(p)?.type === “npc”) .map(p dv.page(p).headerLink) .sort((a, b) { if (a < b) return -1; if (a > b) return 1; return 0; }); dv.list(data);

LIST WITHOUT ID headerLink FROM “Compendium/Atlas/<% location ? ${path}/ : ” %><% name %>” WHERE type= “continent” OR type=“ocean” SORT file.name ASC

LIST WITHOUT ID headerLink FROM “Session Notes” AND <% name %> SORT file.ctime DESC