From 322b257b72ee94a4f3b97f42f8c8eac8e1745141 Mon Sep 17 00:00:00 2001 From: Lorian Date: Sat, 8 Feb 2014 16:57:28 -0800 Subject: [PATCH] Separated stable into dropped pets, quest pets, and rare pets, and made countPets only count the former. Made countMounts only count dropped and quest-hatched mounts, not rare mounts. --- public/js/controllers/inventoryCtrl.js | 3 ++- src/models/user.js | 4 +++- views/options/inventory/stable.jade | 23 ++++++++++++++++++----- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/public/js/controllers/inventoryCtrl.js b/public/js/controllers/inventoryCtrl.js index 618dd9b72d..81c7437d1e 100644 --- a/public/js/controllers/inventoryCtrl.js +++ b/public/js/controllers/inventoryCtrl.js @@ -7,7 +7,8 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', '$window', 'User', $scope.selectedEgg = null; // {index: 1, name: "Tiger", value: 5} $scope.selectedPotion = null; // {index: 5, name: "Red", value: 3} - $scope.totalPets = _.size(Content.eggs) * _.size(Content.hatchingPotions); + $scope.totalPets = _.size(Content.dropEggs) * _.size(Content.hatchingPotions); + $scope.totalMounts = _.size(Content.eggs) * _.size(Content.hatchingPotions); // count egg, food, hatchingPotion stack totals var countStacks = function(items) { return _.reduce(items,function(m,v){return m+v;},0);} diff --git a/src/models/user.js b/src/models/user.js index 38dd2409b4..9dcdc73869 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -139,7 +139,7 @@ var UserSchema = new Schema({ snowball: {type: Number, 'default': 0} }, - // -------------- Animals ------------------- + // -------------- Animals ------------------- // Complex bit here. The result looks like: // pets: { // 'Wolf-Desert': 0, // 0 means does not own @@ -150,6 +150,8 @@ var UserSchema = new Schema({ _.defaults( // First transform to a 1D eggs/potions mapping _.transform(shared.content.pets, function(m,v,k){ m[k] = Number; }), + // Then add quest pets + _.transform(shared.content.questPets, function(m,v,k){ m[k] = Number; }), // Then add additional pets (backer, contributor) _.transform(shared.content.specialPets, function(m,v,k){ m[k] = Number; }) ), diff --git a/views/options/inventory/stable.jade b/views/options/inventory/stable.jade index e38114cf7f..ad5f9c8a11 100644 --- a/views/options/inventory/stable.jade +++ b/views/options/inventory/stable.jade @@ -12,7 +12,8 @@ script(type='text/ng-template', id='partials/options.inventory.mounts.html') a(target='_blank', href='http://www.kickstarter.com/profile/mattboch')=env.t('mattBoch') .popover-content p=env.t('mattShall', {name: "{{user.profile.name}}"}) - h4= '{{mountCount}} / {{totalPets}} ' + env.t('mountsTamed') + h4= '{{Shared.countMounts(null,User.user.items.mounts)}} / {{totalMounts}} ' + env.t('mountsTamed') + menu.pets(type='list') li.customize-menu(ng-repeat='egg in Content.eggs') menu @@ -46,13 +47,13 @@ script(type='text/ng-template', id='partials/options.inventory.pets.html') p =env.t('mattBochText1') + ' ' | - =env.t('mattBochText2') - | + =env.t('mattBochText2') + | = ' ' + env.t('mattBochText3') - h4= '{{petCount}} / {{totalPets}} ' + env.t('petsFound') + h4= env.t('beastmasterProgress') + ': {{petCount}} / {{totalPets}} ' + env.t('petsFound') menu.pets(type='list') - li.customize-menu(ng-repeat='egg in Content.eggs') + li.customize-menu(ng-repeat='egg in Content.dropEggs') menu div(ng-repeat='potion in Content.hatchingPotions', popover-trigger='mouseenter', popover='{{potion.text}} {{egg.text}}', popover-placement='bottom', ng-init='pet = egg.key+"-"+potion.key') button(class="pet-button Pet-{{pet}}", ng-if='user.items.pets[pet]>0', ng-class='{active: user.items.currentPet == pet, selectableInventory: selectedFood}', ng-click='choosePet(egg.key, potion.key)') @@ -63,6 +64,18 @@ script(type='text/ng-template', id='partials/options.inventory.pets.html') button(class="pet-button Pet-{{pet}}" ng-if='user.items.pets[pet]<0',style='opacity:0.1;filter:alpha(opacity=10)') //if this could be changed to the opacity talked about? can't figure it out + h4=env.t('questPets') + menu.pets(type='list') + li.customize-menu(ng-repeat='egg in Content.questEggs') + menu + div(ng-repeat='potion in Content.hatchingPotions', popover-trigger='mouseenter', popover='{{potion.text}} {{egg.text}}', popover-placement='bottom', ng-init='pet = egg.key+"-"+potion.key') + button(class="pet-button Pet-{{pet}}", ng-if='user.items.pets[pet]>0', ng-class='{active: user.items.currentPet == pet, selectableInventory: selectedFood}', ng-click='choosePet(egg.key, potion.key)') + .progress(ng-show='!user.items.mounts[pet]') + .progress-bar.progress-bar-success(style="width:{{user.items.pets[pet]/.5}}%") + button(class="pet-button pet-not-owned", ng-if='!user.items.pets[pet]') + .PixelPaw + button(class="pet-button Pet-{{pet}}" ng-if='user.items.pets[pet]<0',style='opacity:0.1;filter:alpha(opacity=10)') + h4=env.t('rarePets') menu div