fix(modals): SM modal fixes

Fixes #6253, allows quest pets to appear in hatching and raising modals, and makes code for deciding whether or not to show a generic levelup modal a bit more readable per comments on #6042.
This commit is contained in:
Sabe Jones
2015-11-17 16:56:11 -05:00
parent 8b7f50bfcf
commit f5f33bd1b9
3 changed files with 12 additions and 7 deletions

View File

@@ -60,14 +60,19 @@ habitrpg.controller('NotificationCtrl',
Notification.mp(mana);
});
// Levels that already display modals and should not trigger generic Level Up
var unlockLevels = {
'3': 'drop system',
'10': 'class system',
'50': 'Orb of Rebirth'
}
$rootScope.$watch('user.stats.lvl', function(after, before) {
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;
if (after === 3) return; // Drop system unlock. FIXME can we do this without hardcoding?
if (after === 10) return; // Class system unlock. FIXME as above
if (after === 50) return; // Orb of Rebirth unlock FIXME as above
if (unlockLevels['' + after]) return;
if (!User.user.preferences.suppressModals.levelUp) $rootScope.openModal('levelUp', {controller:'UserCtrl', size:'sm'});
});