mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
* add tests for beastMaster, mountMaster, and triadBingo achievements * add tests for challengeWon, streak, ultimateGear, rebirth, and contributor achievements * add achievement service that has openModal function * achievement test pass again * fix indentation, rename openModal to more descriptive displayAchievement * add unit tests for achievements service * initialize user.preferences.suppressModals in specHelper.newUser * update achievement tests to account for new notification service * add new achievementServices file to manifest.json * fix tests * award wonChallenge achiev like other achievs * differentiate between small and normal achiev modals * refactor achievementService.displayAchievement() to take options param
This commit is contained in:
committed by
Blade Barringer
parent
31a1a14bae
commit
a3f83b9076
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
habitrpg.controller('NotificationCtrl',
|
||||
['$scope', '$rootScope', 'Shared', 'Content', 'User', 'Guide', 'Notification', 'Analytics',
|
||||
function ($scope, $rootScope, Shared, Content, User, Guide, Notification, Analytics) {
|
||||
['$scope', '$rootScope', 'Shared', 'Content', 'User', 'Guide', 'Notification', 'Analytics', 'Achievement',
|
||||
function ($scope, $rootScope, Shared, Content, User, Guide, Notification, Analytics, Achievement) {
|
||||
|
||||
$rootScope.$watch('user.stats.hp', function (after, before) {
|
||||
if (after <= 0){
|
||||
@@ -98,24 +98,24 @@ habitrpg.controller('NotificationCtrl',
|
||||
break;
|
||||
case 'WON_CHALLENGE':
|
||||
User.sync().then( function() {
|
||||
$rootScope.openModal('wonChallenge', {controller: 'UserCtrl', size: 'sm'});
|
||||
Achievement.displayAchievement('wonChallenge');
|
||||
});
|
||||
break;
|
||||
case 'STREAK_ACHIEVEMENT':
|
||||
Notification.streak(User.user.achievements.streak);
|
||||
$rootScope.playSound('Achievement_Unlocked');
|
||||
if (!User.user.preferences.suppressModals.streak) {
|
||||
$rootScope.openModal('achievements/streak', {controller:'UserCtrl'});
|
||||
Achievement.displayAchievement('streak', {size: 'md'});
|
||||
}
|
||||
break;
|
||||
case 'ULTIMATE_GEAR_ACHIEVEMENT':
|
||||
$rootScope.openModal('achievements/ultimateGear', {controller:'UserCtrl'});
|
||||
Achievement.displayAchievement('ultimateGear', {size: 'md'});
|
||||
break;
|
||||
case 'REBIRTH_ACHIEVEMENT':
|
||||
$rootScope.openModal('achievements/rebirth', {controller:'UserCtrl', size: 'sm'});
|
||||
Achievement.displayAchievement('rebirth');
|
||||
break;
|
||||
case 'NEW_CONTRIBUTOR_LEVEL':
|
||||
$rootScope.openModal('achievements/contributor',{controller:'UserCtrl'});
|
||||
Achievement.displayAchievement('contributor', {size: 'md'});
|
||||
break;
|
||||
case 'CRON':
|
||||
if (notification.data) {
|
||||
@@ -135,7 +135,7 @@ habitrpg.controller('NotificationCtrl',
|
||||
}
|
||||
|
||||
// Since we don't use localStorage anymore, notifications for achievements and new contributor levels
|
||||
// are now stored user.notifications.
|
||||
// are now stored in user.notifications.
|
||||
$rootScope.$watchCollection('userNotifications', function (after) {
|
||||
if (!User.user._wrapped) return;
|
||||
handleUserNotifications(after);
|
||||
|
||||
Reference in New Issue
Block a user