v1.8.0 commit

This commit is contained in:
Louie Sebastian Kurenai 2026-03-15 14:17:34 +08:00
parent dc173ce4d8
commit 6947c182bb
9 changed files with 203 additions and 11 deletions

View file

@ -1,5 +1,5 @@
name: Daily Build
run-name: Performium Daily Build (#${{ github.run_number }} - v1.7.0${{ github.run_number}})
run-name: Performium Daily Build (#${{ github.run_number }} - v1.8.0${{ github.run_number}})
on:
schedule:

View file

@ -21,6 +21,8 @@ This plugin adds a ribbon and command of a new function meant to calculate the p
- Complexity
- Information
It also adds a ribbon and command where you can see all of the values you have calculated throughout the times you have the plugin installed and enabled!
## Preview
- ![image](https://github.com/user-attachments/assets/149e6167-c5e0-4c99-b050-4540dbeee7e0)

View file

@ -1,7 +1,7 @@
{
"id": "performosu",
"name": "Performium",
"version": "1.7.0",
"version": "1.8.0",
"minAppVersion": "1.11.0",
"description": "Integrates the osu! Performance Points system to gamify your note-taking experience!",
"author": "Louie Kurenai",

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "performosu",
"version": "1.7.0",
"version": "1.8.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "performosu",
"version": "1.7.0",
"version": "1.8.0",
"license": "MIT",
"dependencies": {
"shelljs": "^0.10.0"

View file

@ -1,6 +1,6 @@
{
"name": "performosu",
"version": "1.7.0",
"version": "1.8.0",
"description": "Integrates the osu! Performance Points system to gamify your note-taking experience!",
"main": "main.js",
"scripts": {

View file

@ -17,6 +17,7 @@ import { calculatePerformance as calculatePerformance080325 } from "./utils/pp/0
import { calculatePerformance as calculatePerformance011726 } from "./utils/pp/011726";
import { calculatePerformance as calculatePerformance020426 } from "./utils/pp/020426";
import { calculatePerformance as calculatePerformance021426 } from "./utils/pp/021426";
import { calculatePerformance as calculatePerformance031526 } from "./utils/pp/031526";
import { calculatePerformance as calculatePerformanceTest } from "./utils/pp/test";
import { getPerformanceVersion } from "./functions/getPerformanceVersion";
@ -127,6 +128,8 @@ export default class PerformiumPlugin extends Plugin {
async calculatePerformance(): Promise < number > {
if (this.settings.ppSystem === "test") {
return calculatePerformanceTest(this);
} else if (this.settings.ppSystem === "031526") {
return calculatePerformance031526(this);
} else if (this.settings.ppSystem === "021426") {
return calculatePerformance021426(this);
} else if (this.settings.ppSystem === "020426") {
@ -153,8 +156,8 @@ export default class PerformiumPlugin extends Plugin {
async calculateSecondaryPerformance(): Promise < number > {
if (this.settings.secondaryPpSystem === "test") {
return calculatePerformanceTest(this);
} else if (this.settings.secondaryPpSystem === "021426") {
return calculatePerformance021426(this);
} else if (this.settings.secondaryPpSystem === "031526") {
return calculatePerformance031526(this);
} else if (this.settings.secondaryPpSystem === "020426") {
return calculatePerformance020426(this);
} else if (this.settings.secondaryPpSystem === "011726") {

View file

@ -24,7 +24,7 @@ export interface PerformiumBaseSettings {
}
export const DEFAULT_SETTINGS: PerformiumBaseSettings = {
ppSystem: "021426",
ppSystem: "031526",
installTimestamp: 0,
totalFocusTime: 0,
secondaryPpSystem: "test",
@ -141,7 +141,7 @@ export class PerformiumSettingsTab extends PluginSettingTab {
// version display, perhaps
new Setting(containerEl)
.setName("Performium v1.7.0")
.setDesc("Codename: Kinetisphere")
.setName("Performium v1.8.0")
.setDesc("Codename: Lightcore")
}
}

186
src/utils/pp/031526.ts Normal file
View file

@ -0,0 +1,186 @@
/*
031226.ts: the system used for version v1.8.0 (codename lightcore)
this will be an attempt to fully rewrite the performance values and rebalance them until it's ready for publish.
while it might use some older evaluators, most of the code uses the new ones.
certain variables will be commented out until it's possible for use.
*/
import PerformiumPlugin from "../../main";
import { calculateVaultStats } from "src/functions/vaultStats";
// the new evaluators used for the rewritten code
import { getOrphanCount } from "../values/newerEvaluators/orphanCount";
import { calculateVaultCleanliness } from "../values/newerEvaluators/vaultCleanliness";
import { getAllFiles, getAllFolders } from "../values/newerEvaluators/itemCount";
// import { countAllLinks, countAllWikiLinks } from "../values/newerEvaluators/linkCount";
import { getTotalWordCount } from "../values/newerEvaluators/newVaultStats";
// the function to calculate the pp values from the entire vault (confusion, my bad)
export async function calculatePerformance(plugin: PerformiumPlugin): Promise<number> {
const app = plugin.app;
let vaultStats = await calculateVaultStats(app);
let performanceValue = 0;
let totalWords = await getTotalWordCount(app);
async function calculateReadability(): Promise<number> {
// readability function
let value = 0;
// make use of the character-to-word ratio
let characterToWordRatio: number = totalWords / vaultStats.totalChars;
// add a variable similar to the visual calculation of the cs (circle size) formula from the osu! game
let wordRadiusValue = 64 * (1 - (0.7 * ((characterToWordRatio - 2.5) / 5)));
// debug
// console.log('wordRadiusValue: ' + wordRadiusValue);
// add a bonus with the use of the recently made value
let wordLengthMultiplier = Math.max(1.0, 1.0 + (30 - wordRadiusValue) / 40);
// add it as a bonus
value += wordRadiusValue * wordLengthMultiplier;
return value;
}
async function calculateVaultRating(): Promise<number> {
// vault rating function
let value = 1;
// for the multiplier of the value
let vaultCleanlinessValue = await calculateVaultCleanliness(vaultStats.totalFiles, vaultStats.totalFolders, vaultStats.totalParagraphs);
return value + (vaultCleanlinessValue / 9.95);
}
async function calculateInformability() {
// function to get values from equations with uses of the vault stats
let value = 1;
// use various vault stats to make a readable value
let wordToSentenceRatio = vaultStats.totalWords / vaultStats.totalSentences;
let sentencetoParagraphRatio = vaultStats.totalSentences / vaultStats.totalParagraphs;
// context bonus
let contextBonus = 0;
if (sentencetoParagraphRatio >= 3) {
contextBonus += (Math.log(sentencetoParagraphRatio) + Math.log(sentencetoParagraphRatio * 1.5)) * 2;
} else {
contextBonus += Math.log(sentencetoParagraphRatio) * 2;
}
value += contextBonus;
value += ((wordToSentenceRatio * sentencetoParagraphRatio) / 5) / vaultStats.totalFiles;
let fileToFolderRatio = await getAllFiles() / await getAllFolders();
value += fileToFolderRatio;
// add a bonus with math logarithm
value += Math.log(vaultStats.totalSentences);
// estimate the number of words and sentences in a paragraph
let paragraphWordCount = wordToSentenceRatio * sentencetoParagraphRatio;
// debug
// console.log(`${paragraphWordCount}pp`);
// add as a bonus
value += Math.log(paragraphWordCount) * (1 + ((paragraphWordCount / 25) / 10));
return value
}
async function calcualtePenalties(): Promise<number> {
// function to calculate penalties
let value = 0;
// if the words are too short
let characterToWordRatio = vaultStats.totalChars / await getTotalWordCount(app);
value += (Math.E ** ((4 - characterToWordRatio) / 2)) * 50;
// get the total amount of orphans in the vault
let orphanCount: number = await getOrphanCount(app);
// apply it to the value as a penalty
value += orphanCount;
// add a multiplier to make things fair
value *= 1 + 0.055 * Math.log(1 + vaultStats.totalChars);
// add another use to the character-to-word ratio variable
value += (characterToWordRatio / 2) * (characterToWordRatio * (1 / 125));
return value;
}
async function calculateStatBonuses(): Promise<number> {
// stat rating function
let value = 0;
// get the bonus value of the vault's file count with mathematic logarithms
value += Math.log(vaultStats.totalFiles) * Math.PI;
// as well as making use of the vault's folders
value += Math.log(vaultStats.totalFolders) * 1.5;
console.log(value);
// let wikiLinkCount = await countAllWikiLinks(app);
// let allLinkCount = await countAllLinks(app);
// let allLinkTowikiLinkRatio = allLinkCount / wikiLinkCount;
// let wikiLinkToAllLinkRatio = wikiLinkCount / allLinkCount;
// apply certain values as pieces of a penalty
// value += ((allLinkTowikiLinkRatio + wikiLinkToAllLinkRatio) / Math.E) - 10;
// add some value with the use of total characters typed in the vault
let characterBonus = Math.log(vaultStats.totalChars) + (vaultStats.totalChars / 3000);
value += characterBonus * Math.pow(Math.PI, 0.6);
value += ((417 - (1 / 3)) / 4) * (1 - Math.pow(0.9975, plugin.settings.totalExecutionCount));
// add a small multiplier to the full value
value += (Math.log(value) + (1 + (value * 0.025))) / 125;
return value;
}
// calculate the full value
let readabilityValue = await calculateReadability();
let vaultRatingValue = await calculateVaultRating();
let statBonusValue = await calculateStatBonuses();
let informabilityValue = await calculateInformability();
let penaltyValue = await calcualtePenalties();
performanceValue += ((readabilityValue + statBonusValue + informabilityValue - penaltyValue) * vaultRatingValue) / 1.075;
// debug
console.log(`readabilityValue: ${(readabilityValue * vaultRatingValue) / 1.075}pp`);
console.log(`statBonusValue: ${(statBonusValue * vaultRatingValue) / 1.075}pp`);
console.log(`informabilityValue: ${(informabilityValue * vaultRatingValue) / 1.075}pp`);
console.log(`penaltyValue: ${(penaltyValue * vaultRatingValue) / 1.075}pp`);
console.log(`vaultRatingValue: ${vaultRatingValue / 1.075}x`);
// console.log('performanceValue: ' + performanceValue);
// cleaner value handling
if (!Number.isFinite(performanceValue) || performanceValue <= 0) {
console.log("Invalid performance value. Setting to 0pp...");
performanceValue = 0;
}
return performanceValue;
}

View file

@ -10,5 +10,6 @@
"1.6.1": "1.11.0",
"1.6.2": "1.11.0",
"1.6.3": "1.11.0",
"1.7.0": "1.11.0"
"1.7.0": "1.11.0",
"1.8.0": "1.11.0"
}