From a30ee4368a4f525284f4f9ece1472de21d542909 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Sun, 3 Aug 2014 12:28:29 +0200 Subject: [PATCH] fix(notifications): fix drop notifications --- public/js/controllers/notificationCtrl.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/public/js/controllers/notificationCtrl.js b/public/js/controllers/notificationCtrl.js index d20082d471..c0c6968d58 100644 --- a/public/js/controllers/notificationCtrl.js +++ b/public/js/controllers/notificationCtrl.js @@ -1,8 +1,8 @@ 'use strict'; habitrpg.controller('NotificationCtrl', - ['$scope', '$rootScope', 'Shared', 'User', 'Guide', 'Notification', - function ($scope, $rootScope, Shared, User, Guide, Notification) { + ['$scope', '$rootScope', 'Shared', 'Content', 'User', 'Guide', 'Notification', + function ($scope, $rootScope, Shared, Content, User, Guide, Notification) { $rootScope.$watch('user.stats.hp', function(after, before) { if (after <= 0){ @@ -62,7 +62,23 @@ habitrpg.controller('NotificationCtrl', } User.user.items[type][after.key]++; } - Notification.drop(User.user._tmp.drop.dialog); + + if(drop.type === 'HatchingPotion'){ + var text = Content.hatchingPotions[drop.key].text(); + var notes = Content.hatchingPotions[drop.key].notes(); + Notification.drop(env.t('messageDropPotion', {dropText: text, dropNotes: notes})); + }else if(drop.type === 'Egg'){ + var text = Content.eggs[drop.key].text(); + var notes = Content.eggs[drop.key].notes(); + Notification.drop(env.t('messageDropEgg', {dropText: text, dropNotes: notes})); + }else if(drop.type === 'Food'){ + var text = Content.food[drop.key].text(); + var notes = Content.food[drop.key].notes(); + Notification.drop(env.t('messageDropFood', {dropArticle: drop.article, dropText: text, dropNotes: notes})); + }else{ + // Keep support for another type of drops that might be added + Notification.drop(User.user._tmp.drop.dialog); + } }); $rootScope.$watch('user.achievements.streak', function(after, before){