diff --git a/src/functions/funFact.ts b/src/functions/funFact.ts index 1f6c6ef..4be385c 100644 --- a/src/functions/funFact.ts +++ b/src/functions/funFact.ts @@ -3,9 +3,11 @@ // import { PerformanceEntry } from "../interfaces/performanceEntry"; // import { getTopPerformanceEntries } from "./getTopPerformanceEntries"; import PerformiumPlugin from "../main"; +import { getWeightedPP } from "./weightPP"; +import { App } from "obsidian"; // it may not be used or i don't know. -export function generateFact(plugin: PerformiumPlugin): string { +export async function generateFact(plugin: PerformiumPlugin, app: App): Promise { const array = [ `As of January 22, 2026, the old fun facts were removed in favor of the new ones!`, `As of this update, Performium is being developed in Arch Linux!`, @@ -52,6 +54,9 @@ export function generateFact(plugin: PerformiumPlugin): string { // count the total number of text lines array.push(`There are a total of ${array.length + 1} fun facts to encounter! Try to find them all!`); + // make use of the newly-made weighted pp + array.push(`From all the performance calculations you have executed, weighting them all would give you a total amount of ${new Intl.NumberFormat().format(Math.trunc(await getWeightedPP(app)))}`); + let fact: string = array[Math.floor(Math.random() * array.length)]; return fact; } diff --git a/src/functions/savePerformanceToFile.ts b/src/functions/savePerformanceToFile.ts index 54d2555..159635c 100644 --- a/src/functions/savePerformanceToFile.ts +++ b/src/functions/savePerformanceToFile.ts @@ -1,7 +1,7 @@ import { App } from "obsidian"; export async function savePerformanceToFile(app: App, value: number) { - const filePath = `.${app.vault.configDir}/pp-entries.json`; + const filePath = `${app.vault.configDir}/pp-entries.json`; const adapter = app.vault.adapter; const now = new Date(); diff --git a/src/options/base.ts b/src/options/base.ts index d8ffe41..27f3001 100644 --- a/src/options/base.ts +++ b/src/options/base.ts @@ -123,7 +123,7 @@ export class PerformiumSettingsTab extends PluginSettingTab { // const installTimestamp = this.plugin.settings.installTimestamp ?? Date.now(); - let factText: string = generateFact(this.plugin); + let factText: string = await generateFact(this.plugin, this.app); // const totalTime = installTimestamp - Date.now();