Skip to content

Commit

Permalink
Merge branch 'main' into selection-modal-booster-crafting
Browse files Browse the repository at this point in the history
  • Loading branch information
saertna authored Oct 21, 2023
2 parents a2ce9a3 + 3d42362 commit 85c8f2a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
5 changes: 5 additions & 0 deletions main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 27 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export default class gamification extends Plugin {
}



async onload() {
console.log('obsidian-pkm-gamification loaded!');
//this.settings = defaultSettings;
Expand Down Expand Up @@ -543,7 +544,7 @@ export default class gamification extends Plugin {
}
//console.log(`pointsReceived: ${pointsReceived}`)
if (pointsReceived > 0){
const messagePoints = getRandomMessagePoints(pointsReceived);// * (this.settings.badgeBoosterFactor + this.settings.streakbooster))
const messagePoints = getRandomMessagePoints(pointsReceived);
new Notice(messagePoints,4000)
console.log(messagePoints)
}
Expand Down Expand Up @@ -823,6 +824,31 @@ export default class gamification extends Plugin {
return this.updateAvatarPage(this.settings.avatarPageName)
}

async increaseStreakbooster(increaseValue:number){
let newBoosterFakfor = parseFloat((this.settings.streakbooster + increaseValue).toFixed(streakboosterIncreaseWeekly));
if(newBoosterFakfor > 80){
newBoosterFakfor = 80;
}
this.settings.streakbooster = newBoosterFakfor;
this.settings.streakboosterDate = true;
await this.saveData(this.settings)
console.log(`streakbooster: ${this.settings.streakbooster}`)
}


async decreaseStreakbooster(decreaseValue:number){
let newBoosterFakfor = parseFloat((this.settings.streakbooster - decreaseValue).toFixed(streakboosterDecrease))
this.settings.streakbooster = newBoosterFakfor
if (newBoosterFakfor < 0){
newBoosterFakfor = 0
}
this.settings.streakbooster = newBoosterFakfor
this.settings.streakboosterDate = false;
await this.saveData(this.settings)
}




async increaseStreakbooster(increaseValue:number){
let newBoosterFakfor = parseFloat((this.settings.streakbooster + increaseValue).toFixed(streakboosterIncreaseWeekly));
Expand Down Expand Up @@ -930,7 +956,6 @@ export default class gamification extends Plugin {
start4 = reference4 - 1 - 25; // no idea why offset 25 is needed
end4 = reference4 - 25 ; // no idea why offset 25 is needed


const newLines = [...lines.slice(0, start), newPointsString, ...lines.slice(end)];
const newLines2 = [...newLines.slice(0, start2), dailyChallenge, ...newLines.slice(end2)];
const newLines3 = [...newLines2.slice(0, start3), weeklyChallenge, ...newLines2.slice(end3)];
Expand Down

0 comments on commit 85c8f2a

Please sign in to comment.