45 lines
1.2 KiB
Markdown
45 lines
1.2 KiB
Markdown
<%*
|
|
const thisFile = tp.config.target_file;
|
|
const campaignData = tp.user.ttrpg.campaignData(thisFile)
|
|
const settingData = tp.user.ttrpg.settingData(thisFile);
|
|
const title = tp.file.title === "Untitled"
|
|
? await tp.system.prompt("Location Name")
|
|
: tp.file.title;
|
|
const adjective = tp.frontmatter?.adjective ?? "";
|
|
const types = [
|
|
"shop",
|
|
"landmark",
|
|
"residence",
|
|
"temple",
|
|
"government building",
|
|
"factory",
|
|
"fortress",
|
|
"military building",
|
|
"ruin",
|
|
"cave",
|
|
"ship",
|
|
];
|
|
const type = tp.frontmatter.poiType ?? await tp.system.suggester(v => v, types, true, "Type of PoI");
|
|
const metadata = {
|
|
tags: ['ttrpg/place/poi'],
|
|
data: {
|
|
icon: "map-pin",
|
|
title,
|
|
pronunciation: tp.frontmatter.pronunciation ?? "",
|
|
summary: tp.frontmatter?.summary ?? "",
|
|
campaigns: [campaignData.link],
|
|
setting: settingData.link,
|
|
poiType: type,
|
|
location: tp.frontmatter?.location ?? "",
|
|
wares: tp.frontmatter?.wares ?? "",
|
|
proprietor: tp.frontmatter?.proprietor ?? "",
|
|
residents: tp.frontmatter?.residents ?? [],
|
|
factions: tp.frontmatter?.factions ?? [],
|
|
},
|
|
title,
|
|
};
|
|
await tp.user.util.updateMetadata(tp, metadata);
|
|
%>
|
|
|
|
<% tp.file.cursor() %>
|