mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
Add more achievements to notifications list (#11332)
* Add more achievements to notifications list * use addNotification * Fix logic to not award stable achievements over and over * Improve achievement display * Fix setting notifications for party inviter * Add tests that notifications are added correctly * Fix tests
This commit is contained in:
committed by
Matteo Pagliazzi
parent
ec7ded042b
commit
360aaa9f0b
@@ -188,23 +188,26 @@ schema.pre('save', true, function preSaveUser (next, done) {
|
||||
// Determines if Beast Master should be awarded
|
||||
let beastMasterProgress = common.count.beastMasterProgress(this.items.pets);
|
||||
|
||||
if (beastMasterProgress >= 90 || this.achievements.beastMasterCount > 0) {
|
||||
if ((beastMasterProgress >= 90 || this.achievements.beastMasterCount > 0) && this.achievements.beastMaster !== true) {
|
||||
this.achievements.beastMaster = true;
|
||||
this.addNotification('ACHIEVEMENT_BEAST_MASTER');
|
||||
}
|
||||
|
||||
// Determines if Mount Master should be awarded
|
||||
let mountMasterProgress = common.count.mountMasterProgress(this.items.mounts);
|
||||
|
||||
if (mountMasterProgress >= 90 || this.achievements.mountMasterCount > 0) {
|
||||
if ((mountMasterProgress >= 90 || this.achievements.mountMasterCount > 0) && this.achievements.mountMaster !== true) {
|
||||
this.achievements.mountMaster = true;
|
||||
this.addNotification('ACHIEVEMENT_MOUNT_MASTER');
|
||||
}
|
||||
|
||||
// Determines if Triad Bingo should be awarded
|
||||
let dropPetCount = common.count.dropPetsCurrentlyOwned(this.items.pets);
|
||||
let qualifiesForTriad = dropPetCount >= 90 && mountMasterProgress >= 90;
|
||||
|
||||
if (qualifiesForTriad || this.achievements.triadBingoCount > 0) {
|
||||
if ((qualifiesForTriad || this.achievements.triadBingoCount > 0) && this.achievements.triadBingo !== true) {
|
||||
this.achievements.triadBingo = true;
|
||||
this.addNotification('ACHIEVEMENT_TRIAD_BINGO');
|
||||
}
|
||||
|
||||
// EXAMPLE CODE for allowing all existing and new players to be
|
||||
|
||||
Reference in New Issue
Block a user