Improvement #6912: New achievement modal service and more achievement tests (#6943)

* 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:
Kaitlin Hipkin
2016-09-09 08:58:44 -04:00
committed by Blade Barringer
parent 31a1a14bae
commit a3f83b9076
11 changed files with 267 additions and 48 deletions

View File

@@ -1,6 +1,6 @@
habitrpg.controller("InventoryCtrl",
['$rootScope', '$scope', 'Shared', '$window', 'User', 'Content', 'Analytics', 'Quests', 'Stats', 'Social',
function($rootScope, $scope, Shared, $window, User, Content, Analytics, Quests, Stats, Social) {
['$rootScope', '$scope', 'Shared', '$window', 'User', 'Content', 'Analytics', 'Quests', 'Stats', 'Social', 'Achievement',
function($rootScope, $scope, Shared, $window, User, Content, Analytics, Quests, Stats, Social, Achievement) {
var user = User.user;
@@ -167,7 +167,7 @@ habitrpg.controller("InventoryCtrl",
if(!user.achievements.beastMaster
&& $scope.petCount >= 90) {
User.user.achievements.beastMaster = true;
$rootScope.openModal('achievements/beastMaster', {controller:'UserCtrl', size:'sm'});
Achievement.displayAchievement('beastMaster');
}
// Checks if Triad Bingo has been reached for the first time
@@ -175,7 +175,7 @@ habitrpg.controller("InventoryCtrl",
&& $scope.mountCount >= 90
&& Shared.count.dropPetsCurrentlyOwned(User.user.items.pets) >= 90) {
User.user.achievements.triadBingo = true;
$rootScope.openModal('achievements/triadBingo', {controller:'UserCtrl', size:'sm'});
Achievement.displayAchievement('triadBingo');
}
}
@@ -216,7 +216,7 @@ habitrpg.controller("InventoryCtrl",
if(!user.achievements.mountMaster
&& $scope.mountCount >= 90) {
User.user.achievements.mountMaster = true;
$rootScope.openModal('achievements/mountMaster', {controller:'UserCtrl', size:'sm'});
Achievement.displayAchievement('mountMaster');
}
// Selecting Pet