mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
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:
@@ -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'});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user