mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
refactor(achievements): crush down to much fewer notification types
most work by @CuriousMagpie
This commit is contained in:
@@ -258,7 +258,13 @@ schema.pre('save', true, function preSaveUser (next, done) {
|
||||
&& this.achievements.beastMaster !== true
|
||||
) {
|
||||
this.achievements.beastMaster = true;
|
||||
this.addNotification('ACHIEVEMENT_BEAST_MASTER');
|
||||
this.addNotification(
|
||||
'ACHIEVEMENT_STABLE',
|
||||
{
|
||||
achievement: 'beastMaster',
|
||||
achievementNotification: 'beastAchievement',
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// Determines if Mount Master should be awarded
|
||||
@@ -269,7 +275,13 @@ schema.pre('save', true, function preSaveUser (next, done) {
|
||||
&& this.achievements.mountMaster !== true
|
||||
) {
|
||||
this.achievements.mountMaster = true;
|
||||
this.addNotification('ACHIEVEMENT_MOUNT_MASTER');
|
||||
this.addNotification(
|
||||
'ACHIEVEMENT_STABLE',
|
||||
{
|
||||
achievement: 'mountMaster',
|
||||
achievementNotification: 'mountAchievement',
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// Determines if Triad Bingo should be awarded
|
||||
@@ -281,7 +293,13 @@ schema.pre('save', true, function preSaveUser (next, done) {
|
||||
&& this.achievements.triadBingo !== true
|
||||
) {
|
||||
this.achievements.triadBingo = true;
|
||||
this.addNotification('ACHIEVEMENT_TRIAD_BINGO');
|
||||
this.addNotification(
|
||||
'ACHIEVEMENT_STABLE',
|
||||
{
|
||||
achievement: 'triadBingo',
|
||||
achievementNotification: 'triadBingoAchievement',
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// EXAMPLE CODE for allowing all existing and new players to be
|
||||
|
||||
Reference in New Issue
Block a user