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);
LOCATIONS
LIST WITHOUT ID headerLink
FROM “Compendium/Atlas/<% location ? ${path}/ : ” %><% name %>”
WHERE type= “region”
SORT file.name ASC
HISTORY
LIST WITHOUT ID headerLink
FROM “Session Notes” AND <% name %>
SORT file.ctime DESC