Skip to content

Commit

Permalink
refactoring booster runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
saertna committed Oct 17, 2023
1 parent 566ecc9 commit 79231cc
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 31 deletions.
30 changes: 21 additions & 9 deletions main.js

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,18 @@ export const elements = [
];

export const boosterRecipes = [
{ boosterCooldown: 0, boosterDate: '', boosterSwitch: '', varname: 'temporalTweaker' ,name: 'Temporal Tweaker', incredients: ['2xS1', '1xS6'], description: 'Temporal Tweaker: reset the cooldown phase for a booster your choice' },
{ boosterCooldown: 36*60, boosterDate: 'boosterDatePerpetualProgress', boosterSwitch: 'boosterFactorPerpetualProgress', varname: 'perpetualProgress' ,name: 'Perpetual Progress', incredients: ['2xS2', '1xS4'], description: 'Perpetual Progress: get 3 times points an all your actions for the next 4 hours. You can use Perpetual Progress every three days, if you have the ingredients to craft it.' },
{ boosterCooldown: 120*60, boosterDate: 'boosterDateStrategicSynapses', boosterSwitch: 'boosterFactorStrategicSynapses', varname: 'strategicSynapses' ,name: 'Strategic Synapses', incredients: ['3xS1', '2xS2'], description: 'Strategic Synapses: gain 3 times EP for all actions on Map Of Content ratings for the next 4 hours. This booster has a cooldown time of 5 days.' },
{ boosterCooldown: 36*60, boosterDate: '', boosterSwitch: '', varname: 'acceleratedAcquisition' ,name: 'Accelerated Acquisition', incredients: ['1xS3', '2xS4'], description: 'Accelerated Acquisition: Use Accelerated Acquisition and collect much faster for the next 12 hours all sorts of ingredients when creating and improving notes' },
{ boosterCooldown: 48*60, boosterDate: 'boosterDateLinkersLode', boosterSwitch: 'boosterFactorLinkersLode', varname: 'linkersLode' ,name: 'Linkers Lode', incredients: ['3xS2', '1xS1'], description: 'Linkers Lode: collect extra points when creating chain of thoughts for the next 3 hours. (cooldown 2 days)' },
{ boosterCooldown: 480*60, boosterDate: '', boosterSwitch: '', varname: 'effortlessExpansion' ,name: 'Effortless Expansion', incredients: ['2xS3', '1xS6'], description: 'Effortless Expansion: Cast "Effortless Expansion" and lower the cap to the next level about 20% in the next 5 days. (Cooldown 20 days)' },
{ boosterCooldown: 36*60, boosterDate: 'boosterDateRecursiveReflection', boosterSwitch: 'boosterFactorRecursiveReflection', varname: 'recursiveReflection' ,name: 'Recursive Reflection', incredients: ['2xS4', '1xS5'], description: 'Recursive Reflection: Improve your notes and get 5 times the points you get on normal condition for the next 5 hours. Cooldown 3 days.' },
{ boosterCooldown: 36*60, boosterDate: 'boosterDateSynapticSurge', boosterSwitch: 'boosterFactorSynapticSurge', varname: 'synapticSurge' ,name: 'Synaptic Surge', incredients: ['2xS2', '1xS1'], description: 'Synaptic Surge: Link your ideas together, every increase in "linking maturity" pays out 20 times for the next 2 hours.' },
{ boosterCooldown: 48*60, boosterDate: '', boosterSwitch: '', varname: 'inspirationInfusion' ,name: 'Inspiration Infusion', incredients: ['2xS7', '1xS1'], description: 'Inspiration Infusion: Increase the frequency to get helpful prompts to power up you personal knowledge management for the next 2 days.' },
{ boosterCooldown: 36*60, boosterDate: 'boosterDateTitleTitan', boosterSwitch: 'boosterFactorTitleTitan', varname: 'titleTitan' ,name: 'Title Titan', incredients: ['2xS8', '1xS7'], description: 'Title Titan: Quadro your points when making your note title more to the point expressing the idea of you note for the next 3 hours.' },
{ boosterCooldown: 36*60, boosterDate: 'boosterDatePrecisionPrism', boosterSwitch: 'boosterFactorPrecisionPrism', varname: 'precisionPrism' ,name: 'Precision Prism', incredients: ['2xS8', '1xS2'], description: 'Precision Prism: 4 times the points when increasing the "note length majurity" for a note the next 3 hours.' },
{ boosterCooldown: 36*60, boosterDate: 'boosterDateHyperlinkHarmony', boosterSwitch: 'boosterFactorHyperlinkHarmony', varname: 'hyperlinkHarmony' ,name: 'Hyperlink Harmony', incredients: ['2xS2', '1xS6'], description: 'Hyperlink Harmony: Get for "Inlink majurity" AND "outlink majurity" improvements 5 times the point the next 3 hours.' },
{ boosterCooldown: 2160*60, boosterDate: 'boosterDateEphemeralEuphoria', boosterSwitch: 'boosterFactorEphemeralEuphoria', varname: 'ephemeralEuphoria' ,name: 'Ephemeral Euphoria', incredients: ['1000xSX'], description: 'Unearth the hidden potential within your knowledge repository with the Ephemeral Euphoria booster. For a fleeting two-hour window, your notes will resonate with an extraordinary vitality, allowing you to earn points at an astonishing rate. Seize this moment of boundless opportunity and watch your knowledge flourish like never before!' },
{ boosterRunTime: 0, boosterCooldown: 0, boosterDate: '', boosterSwitch: '', varname: 'temporalTweaker' ,name: 'Temporal Tweaker', incredients: ['2xS1', '1xS6'], description: 'Temporal Tweaker: reset the cooldown phase for a booster your choice' },
{ boosterRunTime: 4*60, boosterCooldown: 36*60, boosterDate: 'boosterDatePerpetualProgress', boosterSwitch: 'boosterFactorPerpetualProgress', varname: 'perpetualProgress' ,name: 'Perpetual Progress', incredients: ['2xS2', '1xS4'], description: 'Perpetual Progress: get 3 times points an all your actions for the next 4 hours. You can use Perpetual Progress every three days, if you have the ingredients to craft it.' },
{ boosterRunTime: 4*60, boosterCooldown: 120*60, boosterDate: 'boosterDateStrategicSynapses', boosterSwitch: 'boosterFactorStrategicSynapses', varname: 'strategicSynapses' ,name: 'Strategic Synapses', incredients: ['3xS1', '2xS2'], description: 'Strategic Synapses: gain 3 times EP for all actions on Map Of Content ratings for the next 4 hours. This booster has a cooldown time of 5 days.' },
{ boosterRunTime: 0, boosterCooldown: 36*60, boosterDate: '', boosterSwitch: '', varname: 'acceleratedAcquisition' ,name: 'Accelerated Acquisition', incredients: ['1xS3', '2xS4'], description: 'Accelerated Acquisition: Use Accelerated Acquisition and collect much faster for the next 12 hours all sorts of ingredients when creating and improving notes' },
{ boosterRunTime: 3*60, boosterCooldown: 48*60, boosterDate: 'boosterDateLinkersLode', boosterSwitch: 'boosterFactorLinkersLode', varname: 'linkersLode' ,name: 'Linkers Lode', incredients: ['3xS2', '1xS1'], description: 'Linkers Lode: collect extra points when creating chain of thoughts for the next 3 hours. (cooldown 2 days)' },
{ boosterRunTime: 0, boosterCooldown: 480*60, boosterDate: '', boosterSwitch: '', varname: 'effortlessExpansion' ,name: 'Effortless Expansion', incredients: ['2xS3', '1xS6'], description: 'Effortless Expansion: Cast "Effortless Expansion" and lower the cap to the next level about 20% in the next 5 days. (Cooldown 20 days)' },
{ boosterRunTime: 5*60, boosterCooldown: 36*60, boosterDate: 'boosterDateRecursiveReflection', boosterSwitch: 'boosterFactorRecursiveReflection', varname: 'recursiveReflection' ,name: 'Recursive Reflection', incredients: ['2xS4', '1xS5'], description: 'Recursive Reflection: Improve your notes and get 5 times the points you get on normal condition for the next 5 hours. Cooldown 3 days.' },
{ boosterRunTime: 2*60, boosterCooldown: 36*60, boosterDate: 'boosterDateSynapticSurge', boosterSwitch: 'boosterFactorSynapticSurge', varname: 'synapticSurge' ,name: 'Synaptic Surge', incredients: ['2xS2', '1xS1'], description: 'Synaptic Surge: Link your ideas together, every increase in "linking maturity" pays out 20 times for the next 2 hours.' },
{ boosterRunTime: 0, boosterCooldown: 48*60, boosterDate: '', boosterSwitch: '', varname: 'inspirationInfusion' ,name: 'Inspiration Infusion', incredients: ['2xS7', '1xS1'], description: 'Inspiration Infusion: Increase the frequency to get helpful prompts to power up you personal knowledge management for the next 2 days.' },
{ boosterRunTime: 3*60, boosterCooldown: 36*60, boosterDate: 'boosterDateTitleTitan', boosterSwitch: 'boosterFactorTitleTitan', varname: 'titleTitan' ,name: 'Title Titan', incredients: ['2xS8', '1xS7'], description: 'Title Titan: Quadro your points when making your note title more to the point expressing the idea of you note for the next 3 hours.' },
{ boosterRunTime: 3*60, boosterCooldown: 36*60, boosterDate: 'boosterDatePrecisionPrism', boosterSwitch: 'boosterFactorPrecisionPrism', varname: 'precisionPrism' ,name: 'Precision Prism', incredients: ['2xS8', '1xS2'], description: 'Precision Prism: 4 times the points when increasing the "note length majurity" for a note the next 3 hours.' },
{ boosterRunTime: 3*60, boosterCooldown: 36*60, boosterDate: 'boosterDateHyperlinkHarmony', boosterSwitch: 'boosterFactorHyperlinkHarmony', varname: 'hyperlinkHarmony' ,name: 'Hyperlink Harmony', incredients: ['2xS2', '1xS6'], description: 'Hyperlink Harmony: Get for "Inlink majurity" AND "outlink majurity" improvements 5 times the point the next 3 hours.' },
{ boosterRunTime: 2*60, boosterCooldown: 2160*60, boosterDate: 'boosterDateEphemeralEuphoria', boosterSwitch: 'boosterFactorEphemeralEuphoria', varname: 'ephemeralEuphoria' ,name: 'Ephemeral Euphoria', incredients: ['1000xSX'], description: 'Unearth the hidden potential within your knowledge repository with the Ephemeral Euphoria booster. For a fleeting two-hour window, your notes will resonate with an extraordinary vitality, allowing you to earn points at an astonishing rate. Seize this moment of boundless opportunity and watch your knowledge flourish like never before!' },
];

30 changes: 21 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,41 +567,46 @@ export default class gamification extends Plugin {
}

// deativate boosters
if (this.settings.boosterFactorPerpetualProgress == true && isMinutesPassed(window.moment(this.settings.boosterDatePerpetualProgress, 'YYYY-MM-DD HH:mm:ss'),4*60)){
if (this.settings.boosterFactorPerpetualProgress == true && isMinutesPassed(window.moment(this.settings.boosterDatePerpetualProgress, 'YYYY-MM-DD HH:mm:ss'),getBoosterRunTimeFromVarName('perpetualProgress'))){
this.setSettingBoolean('boosterFactorPerpetualProgress',false);
console.log('"Perpetual Progress" has ended.')
}
if (this.settings.boosterFactorStrategicSynapses == true && isMinutesPassed(window.moment(this.settings.boosterDateStrategicSynapses, 'YYYY-MM-DD HH:mm:ss'),4*60)){
if (this.settings.boosterFactorStrategicSynapses == true && isMinutesPassed(window.moment(this.settings.boosterDateStrategicSynapses, 'YYYY-MM-DD HH:mm:ss'),getBoosterRunTimeFromVarName('strategicSynapses'))){
this.setSettingBoolean('boosterFactorStrategicSynapses',false);
console.log('"Strategic Synapses" has ended.')
}
if (this.settings.boosterFactorLinkersLode == true && isMinutesPassed(window.moment(this.settings.boosterDateLinkersLode, 'YYYY-MM-DD HH:mm:ss'),3*60)){
if (this.settings.boosterFactorLinkersLode == true && isMinutesPassed(window.moment(this.settings.boosterDateLinkersLode, 'YYYY-MM-DD HH:mm:ss'),getBoosterRunTimeFromVarName('linkersLode'))){
this.setSettingBoolean('boosterFactorLinkersLode',false);
console.log('"Linkers Lode" has ended.')
}
if (this.settings.boosterFactorRecursiveReflection == true && isMinutesPassed(window.moment(this.settings.boosterDateRecursiveReflection, 'YYYY-MM-DD HH:mm:ss'),5*60)){
if (this.settings.boosterFactorRecursiveReflection == true && isMinutesPassed(window.moment(this.settings.boosterDateRecursiveReflection, 'YYYY-MM-DD HH:mm:ss'),getBoosterRunTimeFromVarName('recursiveReflection'))){
this.setSettingBoolean('boosterFactorRecursiveReflection',false);
console.log('"Recursive Reflection" has ended.')
}
if (this.settings.boosterFactorSynapticSurge == true && isMinutesPassed(window.moment(this.settings.boosterDateSynapticSurge, 'YYYY-MM-DD HH:mm:ss'),2*60)){
if (this.settings.boosterFactorSynapticSurge == true && isMinutesPassed(window.moment(this.settings.boosterDateSynapticSurge, 'YYYY-MM-DD HH:mm:ss'),getBoosterRunTimeFromVarName('synapticSurge'))){
this.setSettingBoolean('boosterFactorSynapticSurge',false);
console.log('"Synaptic Surge" has ended.')
}
if (this.settings.boosterFactorTitleTitan == true && isMinutesPassed(window.moment(this.settings.boosterDateTitleTitan, 'YYYY-MM-DD HH:mm:ss'),3*60)){
if (this.settings.boosterFactorTitleTitan == true && isMinutesPassed(window.moment(this.settings.boosterDateTitleTitan, 'YYYY-MM-DD HH:mm:ss'),getBoosterRunTimeFromVarName('titleTitan'))){
this.setSettingBoolean('boosterFactorTitleTitan',false);
console.log('"Title Titan" has ended.')
}
if (this.settings.boosterFactorPrecisionPrism == true && isMinutesPassed(window.moment(this.settings.boosterDatePrecisionPrism, 'YYYY-MM-DD HH:mm:ss'),3*60)){
if (this.settings.boosterFactorPrecisionPrism == true && isMinutesPassed(window.moment(this.settings.boosterDatePrecisionPrism, 'YYYY-MM-DD HH:mm:ss'),getBoosterRunTimeFromVarName('precisionPrism'))){
this.setSettingBoolean('boosterFactorPrecisionPrism',false);
console.log('"Precision Prism" has ended.')
}
if (this.settings.boosterFactorHyperlinkHarmony == true && isMinutesPassed(window.moment(this.settings.boosterDateHyperlinkHarmony, 'YYYY-MM-DD HH:mm:ss'),3*60)){
if (this.settings.boosterFactorHyperlinkHarmony == true && isMinutesPassed(window.moment(this.settings.boosterDateHyperlinkHarmony, 'YYYY-MM-DD HH:mm:ss'),getBoosterRunTimeFromVarName('hyperlinkHarmony'))){
this.setSettingBoolean('boosterFactorHyperlinkHarmony',false);
console.log('"Hyperlink Harmony" has ended.')
}
if (this.settings.boosterFactorEphemeralEuphoria == true && isMinutesPassed(window.moment(this.settings.boosterDateEphemeralEuphoria, 'YYYY-MM-DD HH:mm:ss'),getBoosterRunTimeFromVarName('ephemeralEuphoria'))){
this.setSettingBoolean('boosterFactorEphemeralEuphoria',false);
console.log('"Ephemeral Euphoria" has ended.')
}

}


async increaseDailyCreatedNoteCount(){
let newDailyNoteCreationTask = this.settings.dailyNoteCreationTask;
if (newDailyNoteCreationTask < 2){
Expand Down Expand Up @@ -1158,7 +1163,14 @@ export default class gamification extends Plugin {




function getBoosterRunTimeFromVarName(boosterVarName: string) {
for (const element of boosterRecipes) {
if (element.varname === boosterVarName) {
return element.boosterRunTime as number;
}
}
return 0; // Return null if no matching element is found
}

function isSameDay(inputDate: Moment): boolean {
const currentDate = window.moment(); // Get the current date
Expand Down

0 comments on commit 79231cc

Please sign in to comment.