1
0
2026-01-10 14:30:32 -06:00

70 lines
1.9 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("Settlement Name")
: tp.file.title;
const adjective = tp.frontmatter?.adjective ?? "";
const types = [
"thorp",
"hamlet",
"village",
"small town",
"large town",
"city ward",
"neighborhood",
"small city",
"large city",
"metropolis",
];
const govTypes = [
"anarchy",
"athenian democracy",
"caste",
"clan/tribal",
"corporate state",
"dictatorship",
"feudal",
"hive mind",
"representative democracy",
"technocracy",
"theocracy",
"bureaucracy",
"charismatic rule",
"cybercracy/machine civilization",
"meritocracy",
"military government",
"oligarchy",
"thaumatocracy",
];
const type = tp.frontmatter.settlementType ?? await tp.system.suggester(v => v, types, true, "Type of Settlement");
const metadata = {
tags: ['ttrpg/place/settlement'],
data: {
icon: "building-2",
title,
pronunciation: tp.frontmatter.pronunciation ?? "",
summary: tp.frontmatter?.summary ?? "",
campaigns: [campaignData.link],
setting: settingData.link,
settlementType: type,
location: tp.frontmatter?.location ?? "",
population: tp.frontmatter?.population ?? 0,
government: tp.frontmatter?.government ?? (await tp.system.suggester(v => v, govTypes, false, "Type of Government")) ?? "",
leader: tp.frontmatter?.leader ?? "",
residents: tp.frontmatter?.residents ?? [],
adjective: tp.frontmatter?.adjective ?? "",
},
title,
};
await tp.user.util.updateMetadata(tp, metadata);
%>
<% tp.file.cursor() %>
![[zz_meta/bases/ttrpg/SettlementInfo.base#Places|SettlementInfo]]
![[zz_meta/bases/ttrpg/SettlementInfo.base#People|SettlementInfo]]