diff --git a/manifest.json b/manifest.json index d867baa..a46c983 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "gamified-pkm", "name": "Gamificate your PKM", - "version": "0.0.88", + "version": "0.0.89", "minAppVersion": "0.15.0", "description": "Enhance your Personal Knowledge Management with gamification elements. Boost motivation and achieve growth as you engage with your PKM.", "author": "Andreas Trebing", diff --git a/package-lock.json b/package-lock.json index 4ed91ef..2c0354d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obsidian-gamified-pkm", - "version": "0.0.88", + "version": "0.0.89", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "obsidian-gamified-pkm", - "version": "0.0.88", + "version": "0.0.89", "license": "MIT", "dependencies": { "crypto-js": "^4.1.1", diff --git a/package.json b/package.json index fa7db0a..670b59e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-gamified-pkm", - "version": "0.0.88", + "version": "0.0.89", "description": "Enhance your Personal Knowledge Management with gamification elements. Boost motivation and achieve growth as you engage with your PKM.", "main": "main.js", "scripts": { diff --git a/src/Messages.ts b/src/Messages.ts index 2d7d3d7..c8a467e 100644 --- a/src/Messages.ts +++ b/src/Messages.ts @@ -16,7 +16,9 @@ I develop this plugin as a hobby, spending my free time doing this. If you find "0.0.89": ` ## New - Introduction to Release Note showcase -- Added automatic triggering of rate, can be enabled in settings`, +- Added automatic triggering of rate, can be enabled in settings +- booster factor is not going below a multiple of 5. Means, whenever you reach a multiple of 5, it's a secured milestone. +- inform about booster factor milestone achievement`, "0.0.88":` ## Changed - Support more levels, up to 200, and fix incorrect calculations diff --git a/src/constants.ts b/src/constants.ts index 57ef999..86292ea 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,5 +1,5 @@ import { Badge } from './badges' -export const PLUGIN_VERSION = '0.0.88'; +export const PLUGIN_VERSION = '0.0.89'; export const pointsNoteMajurity = 100; export const pointsMajurity = 10; export const pointsForDailyChallenge = 500; diff --git a/src/main.ts b/src/main.ts index 2011975..b174053 100644 --- a/src/main.ts +++ b/src/main.ts @@ -31,12 +31,13 @@ import { rateOutlinks, rateProgressiveSummarization } from './maturitycalculation' -import {Badge, checkIfReceiveABadge, getBadge, getBadgeDetails, getBadgeForInitLevel, getBadgeForLevel} from './badges' +import {Badge, checkIfReceiveABadge, getBadge, getBadgeForInitLevel, getBadgeForLevel} from './badges' import {getLevelForPoints, statusPointsForLevel} from './levels' import { getRandomMessagePoints, getRandomMessageTwoNoteChallenge, - getRandomMessageWeeklyChallenge + getRandomMessageWeeklyChallenge, + getRandomMessageBoosterFactor } from './randomNotificationText' import {ModalInformationbox} from 'ModalInformationbox'; import {ModalBooster} from 'ModalBooster'; @@ -220,12 +221,16 @@ export default class gamification extends Plugin implements GamificationMediator //await this.checkForContinuouslyNoteCreation(180) //const obsidianJustInstalled = this.settings.previousRelease === "0.0.0" - new ReleaseNotes( - this.app, - this, - //obsidianJustInstalled ? null : - PLUGIN_VERSION - ).open(); + + // new ReleaseNotes( + // this.app, + // this, + // //obsidianJustInstalled ? null : + // PLUGIN_VERSION + // ).open(); + + //await this.decreaseStreakbooster(50); + await this.increaseStreakbooster(0.8); //this.setBadgeSave(getBadgeDetails('Brainiac Trailblazer'),'23-09-07', 'level 20'); //this.setBadgeSave(getBadgeDetails('Savvy Scholar'), '23-08-15', 'level 15'); @@ -1011,23 +1016,43 @@ export default class gamification extends Plugin implements GamificationMediator } - async increaseStreakbooster(increaseValue:number){ - let newBoosterFakfor = parseFloat((this.getSettingNumber('streakbooster') + increaseValue).toFixed(1)); - if(newBoosterFakfor > 80){ - newBoosterFakfor = 80; + async increaseStreakbooster(increaseValue: number) { + const oldBoosterFactor = this.getSettingNumber('streakbooster'); + let newBoosterFactor = parseFloat((oldBoosterFactor + increaseValue).toFixed(1)); + + if (newBoosterFactor > 80) { + newBoosterFactor = 80; } - if(debugLogs) console.debug(`newBoosterFakfor: ${newBoosterFakfor}`) - //if(debugLogs) console.debug(`old value streakbooster: ${this.getSettingNumber('streakbooster')}`) - this.setSettingNumber('streakbooster', newBoosterFakfor); - this.setSettingBoolean('streakboosterDate', true); - //if(debugLogs) console.debug(`new value streakbooster: ${this.getSettingNumber('streakbooster')}`) - //await this.saveData(this.settings) - //if(debugLogs) console.debug(`streakbooster: ${this.getSettingNumber('streakbooster')}`) + + // Send message if newBoosterFactor crosses a multiple of 5 + const oldIntegerPart = Math.floor(oldBoosterFactor); + const newIntegerPart = Math.floor(newBoosterFactor); + if (oldBoosterFactor <= 80 && newBoosterFactor <= 80 && newBoosterFactor > oldBoosterFactor && + newIntegerPart !== oldIntegerPart && newIntegerPart % 5 === 0) { + new Notice(getRandomMessageBoosterFactor(),this.getSettingNumber('timeShowNotice') * 1000 * 1.2) + console.log(`${getRandomMessageBoosterFactor()} : ${newBoosterFactor}`) } + if (debugLogs) console.debug(`newBoosterFakfor: ${newBoosterFactor}`); + + this.setSettingNumber('streakbooster', newBoosterFactor); + this.setSettingBoolean('streakboosterDate', true); + } + + async decreaseStreakbooster(decreaseValue:number){ - let newBoosterFakfor = parseFloat((this.getSettingNumber('streakbooster') - decreaseValue * streakboosterDecrease).toFixed(1)) + //let newBoosterFakfor = parseFloat((this.getSettingNumber('streakbooster') - decreaseValue * streakboosterDecrease).toFixed(1)) + const currentValue = this.getSettingNumber('streakbooster'); + let newBoosterFakfor; + if (streakboosterDecrease >= currentValue % 5) { + // If streakboosterDecrease is greater than or equal to the difference to the next multiple of 5 + newBoosterFakfor = Math.floor(currentValue / 5) * 5; // Round down to the nearest multiple of 5 + } else { + // If streakboosterDecrease is smaller than the difference to the next multiple of 5 + newBoosterFakfor = currentValue - (currentValue % 5 - streakboosterDecrease); // Subtract the difference + } + this.setSettingNumber('streakbooster', newBoosterFakfor) if (newBoosterFakfor < 0){ newBoosterFakfor = 0 diff --git a/src/randomNotificationText.ts b/src/randomNotificationText.ts index eeff6aa..b14a445 100644 --- a/src/randomNotificationText.ts +++ b/src/randomNotificationText.ts @@ -162,6 +162,58 @@ const randomPointNotices: string[] = [ "Well deserved! [X] points earned!" ]; +const boosterFactorMessage : string[] = [ + "Boom! You just hit a new Boosterfactor milestone! High five, booster pro!", + "Boosting it up! High five for reaching that Boosterfactor benchmark!", + "Way to amplify your game! High five for hitting that Boosterfactor goal!", + "You're turbocharging your progress! High five for achieving that Boosterfactor milestone!", + "Bam! Another Boosterfactor milestone smashed! High five, booster champion!", + "You're on turbo mode! High five for maximizing your Boosterfactor!", + "High five alert! You just boosted your way to a new milestone!", + "You're officially a booster master! High five for your unstoppable Boosterfactor streak!", + "Nailed it! High five for reaching another Boosterfactor milestone!", + "Woo hoo! High five for leveling up your Boosterfactor game!", + "On a boost spree! High five for maximizing your Boosterfactor!", + "High fives all around for reaching that Boosterfactor milestone!", + "Look at you go! High five for turbocharging your Boosterfactor!", + "You're making waves with your Boosterfactor! High five for the milestone!", + "High five incoming! You're a Boosterfactor maestro!", + "Keep 'em coming! High five for reaching another Boosterfactor milestone!", + "Bravo! High five for your stellar Boosterfactor progress!", + "High fives galore for hitting that Boosterfactor milestone!", + "You're unstoppable! High five for your Boosterfactor mayhem!", + "Kaboom! High five for blowing past that Boosterfactor milestone!", + "Way to hustle with your Boosterfactor! High five, booster hustler!", + "High five vibes for boosting your way to that milestone!", + "Bringing the heat with your Boosterfactor! High five for the milestone heatwave!", + "You're a Boosterfactor machine! High five, keep it up!", + "High fives incoming! You're a Boosterfactor mastermind!", + "Boosting like a boss! High five, booster superstar!", + "Look out, world! High five for your Boosterfactor domination!", + "High fives on repeat! You're a Boosterfactor magician!", + "Impressive stuff! High five for your Boosterfactor magic!", + "You're unstoppable! High five for your Boosterfactor momentum!", + "Keep the boost alive! High five for your Boosterfactor mojo!", + "High fives are in order! You're a Boosterfactor ninja!", + "Mission accomplished! High five for reaching that Boosterfactor milestone!", + "You're on a boost roll! High five for your Boosterfactor rampage!", + "High five alert! You're a Boosterfactor rockstar!", + "Two thumbs up! High five for your Boosterfactor success!", + "You're boosting it! High five for your Boosterfactor spree!", + "High fives incoming! You're a Boosterfactor sensation!", + "You're a Boosterfactor superhero! High five, booster caped crusader!", + "High five vibes! You're a Boosterfactor sensation!", + "You're a Boosterfactor legend! High five, oh mighty booster!", + "High fives all around! You're a Boosterfactor superstar!", + "You're a Boosterfactor champion! High five, boost conqueror!", + "High five incoming! You're a Boosterfactor warrior!", + "You're on fire with your Boosterfactor! High five for the victory!", + "You're a Boosterfactor guru! High five, wise booster!", + "High five vibes! You're a Boosterfactor wizard!", + "You're a Boosterfactor icon! High five, illustrious booster!", + "High five alert! You're a Boosterfactor prodigy!", + "You're unstoppable! High five for your Boosterfactor triumph!" +] export function getRandomMessageWeeklyChallenge(points: number): string { const randomIndex = Math.floor(Math.random() * messagesWeeklyChallenge.length); @@ -183,6 +235,11 @@ export function getRandomMessagePoints(points: number): string { return message.replace("[X]", points.toString()); } +export function getRandomMessageBoosterFactor(): string { + const randomIndex = Math.floor(Math.random() * boosterFactorMessage.length); + return boosterFactorMessage[randomIndex]; +} + // Example usage // const randomPoints = 100; // Replace with your actual points value // const randomMessage = getRandomMessageWeeklyChallenge(randomPoints);