mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
do not count rare pets into pet counts & fix beast master achievement
This commit is contained in:
@@ -7,13 +7,15 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', 'User', 'API_URL',
|
|||||||
|
|
||||||
$scope.selectedEgg = null; // {index: 1, name: "Tiger", value: 5}
|
$scope.selectedEgg = null; // {index: 1, name: "Tiger", value: 5}
|
||||||
$scope.selectedPotion = null; // {index: 5, name: "Red", value: 3}
|
$scope.selectedPotion = null; // {index: 5, name: "Red", value: 3}
|
||||||
$scope.petCount = _.size(User.user.items.pets);
|
$scope.petCount = window.habitrpgShared.helpers.countPets(null, User.user.items.pets);
|
||||||
$scope.totalPets = _.size($scope.Items.eggs) * _.size($scope.Items.hatchingPotions);
|
$scope.totalPets = _.size($scope.Items.eggs) * _.size($scope.Items.hatchingPotions);
|
||||||
|
|
||||||
// count egg, food, hatchingPotion stack totals
|
// count egg, food, hatchingPotion stack totals
|
||||||
var countStacks = function(items) { return _.reduce(items,function(m,v){return m+v;},0);}
|
var countStacks = function(items) { return _.reduce(items,function(m,v){return m+v;},0);}
|
||||||
|
|
||||||
$scope.$watch('user.items.pets', function(pets){ $scope.petCount = $rootScope.countExists(pets); }, true);
|
$scope.$watch('user.items.pets', function(pets){
|
||||||
|
window.habitrpgShared.helpers.countPets($rootScope.countExists(pets), User.user.items.pets);
|
||||||
|
}, true);
|
||||||
$scope.$watch('user.items.mounts', function(mounts){ $scope.mountCount = $rootScope.countExists(mounts); }, true);
|
$scope.$watch('user.items.mounts', function(mounts){ $scope.mountCount = $rootScope.countExists(mounts); }, true);
|
||||||
$scope.$watch('user.items.eggs', function(eggs){ $scope.eggCount = countStacks(eggs); }, true);
|
$scope.$watch('user.items.eggs', function(eggs){ $scope.eggCount = countStacks(eggs); }, true);
|
||||||
$scope.$watch('user.items.hatchingPotions', function(pots){ $scope.potCount = countStacks(pots); }, true);
|
$scope.$watch('user.items.hatchingPotions', function(pots){ $scope.potCount = countStacks(pots); }, true);
|
||||||
|
|||||||
@@ -44,10 +44,11 @@ habitrpg.controller('NotificationCtrl',
|
|||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$watch('user.items.pets', function(after, before){
|
$rootScope.$watch('user.items.pets', function(after, before){
|
||||||
if(_.size(after) === _.size(before) || _.size(after) < 90) return;
|
if(_.size(after) === _.size(before) ||
|
||||||
|
window.habitrpgShared.helpers.countPets(null, after) < 90) return;
|
||||||
User.user.achievements.beastMaster = true;
|
User.user.achievements.beastMaster = true;
|
||||||
$rootScope.modals.achievements.beastMaster = true;
|
$rootScope.modals.achievements.beastMaster = true;
|
||||||
})
|
}, true);
|
||||||
|
|
||||||
/*_.each(['weapon', 'head', 'chest', 'shield'], function(watched){
|
/*_.each(['weapon', 'head', 'chest', 'shield'], function(watched){
|
||||||
$rootScope.$watch('user.items.' + watched, function(before, after){
|
$rootScope.$watch('user.items.' + watched, function(before, after){
|
||||||
|
|||||||
Reference in New Issue
Block a user