Fixed quest drop modal (#7377)

* Fixed quest drop modal

* Fixed broken party test
This commit is contained in:
Keith Holliday
2016-05-21 11:21:39 +01:00
committed by Matteo Pagliazzi
parent d36c514c06
commit f4ca97ffc3
4 changed files with 23 additions and 13 deletions

View File

@@ -68,7 +68,7 @@ habitrpg.controller('NotificationCtrl',
}
$rootScope.$watch('user.stats.lvl', function(after, before) {
if (after <= before) return;
if (after <= before) return;
Notification.lvl();
$rootScope.playSound('Level_Up');
if (User.user._tmp && User.user._tmp.drop && (User.user._tmp.drop.type === 'Quest')) return;
@@ -127,7 +127,7 @@ habitrpg.controller('NotificationCtrl',
Notification.drop(env.t('messageDropFood', {dropArticle: after.article, dropText: text, dropNotes: notes}), after);
} else if (after.type === 'Quest') {
$rootScope.selectedQuest = Content.quests[after.key];
$rootScope.openModal('questDrop', {controller:'PartyCtrl',size:'sm'});
$rootScope.openModal('questDrop', {controller:'PartyCtrl', size:'sm'});
} else if (after.notificationType === 'Mystery') {
text = Content.gear.flat[after.key].text();
Notification.drop(env.t('messageDropMysteryItem', {dropText: text}), after);

View File

@@ -11,15 +11,13 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
$scope.inviteOrStartParty = Groups.inviteOrStartParty;
$scope.loadWidgets = Social.loadWidgets;
if ($state.is('options.social.party')) {
Groups.Group.syncParty()
.then(function successCallback(group) {
$rootScope.party = $scope.group = group;
checkForNotifications();
}, function errorCallback(response) {
$rootScope.party = $scope.group = $scope.newGroup = { type: 'party' };
});
}
Groups.Group.syncParty()
.then(function successCallback(group) {
$rootScope.party = $scope.group = group;
checkForNotifications();
}, function errorCallback(response) {
$rootScope.party = $scope.group = $scope.newGroup = { type: 'party' };
});
function checkForNotifications () {
// Checks if user's party has reached 2 players for the first time.
@@ -148,6 +146,15 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
User.set({'invitations.party':{}});
}
$scope.questInit = function() {
var key = $rootScope.selectedQuest.key;
Quests.initQuest(key).then(function() {
$rootScope.selectedQuest = undefined;
$scope.$close();
});
};
$scope.questCancel = function(){
if (!confirm(window.env.t('sureCancel'))) return;