Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export type PluginState = {
hp?: number;
stress?: number;
uses?: { [key: string]: number };
countdown?: { [key: string]: number }
countdown?: { [key: string]: number };
conditions?: string[];
instanceName?: string;
};
};
};
Expand Down Expand Up @@ -198,7 +200,7 @@ export default class BeastVault extends Plugin {
this.updateState = debounce(() => this.saveData(this.state), 1000, true);

this.registerMarkdownCodeBlockProcessor("daggerheart", (src, el, ctx) => {
const child = new AdversaryCard(el, tryParseYaml(src, false), this);
const child = new AdversaryCard(el, tryParseYaml(src, false), this, ctx);
ctx.addChild(child);
child.render();
// Track it so we can refresh on settings change:
Expand Down Expand Up @@ -311,7 +313,7 @@ export default class BeastVault extends Plugin {
}

updateCard(keys: (string | number)[], value: string | number) {
type Data = { [key: string]: Data | number | string };
type Data = { [key: string]: Data | number | string | string[] };
let data: Data = this.state.cards;
const keysCopy = [...keys];
const lastKey = keysCopy.pop()!;
Expand All @@ -324,7 +326,7 @@ export default class BeastVault extends Plugin {
}

getCardState(keys: (string | number)[]): number | undefined {
type Data = { [key: string]: Data | string | number }
type Data = { [key: string]: Data | string | number | string[] }
let data: Data = this.state.cards;
for (const [i, key] of keys.entries()) {
if (!data[key]) return undefined;
Expand Down
Loading