mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Create method to calculate whether or not user has attained all mystery equipment
This commit is contained in:
@@ -12,6 +12,7 @@ describe('Inventory Controller', function() {
|
||||
user = specHelper.newUser({
|
||||
balance: 4,
|
||||
items: {
|
||||
gear: { owned: {} },
|
||||
eggs: { Cactus: 1 },
|
||||
hatchingPotions: { Base: 1 },
|
||||
food: { Meat: 1 },
|
||||
@@ -155,4 +156,16 @@ describe('Inventory Controller', function() {
|
||||
expect(possibleValues).to.contain(cardsModalScope.cardMessage);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#hasAllTimeTravelerItems', function() {
|
||||
it('returns false if there are items left in the time traveler store', function() {
|
||||
expect(scope.hasAllTimeTravelerItems()).to.eql(false);
|
||||
});
|
||||
|
||||
it('returns true if there are no items left to purchase', inject(function(Content) {
|
||||
sandbox.stub(Content, 'timeTravelerStore').returns({});
|
||||
|
||||
expect(scope.hasAllTimeTravelerItems()).to.eql(true);
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -228,6 +228,13 @@ habitrpg.controller("InventoryCtrl",
|
||||
});
|
||||
};
|
||||
|
||||
$scope.hasAllTimeTravelerItems = function(items) {
|
||||
var itemsLeftInTimeTravlerStore = Content.timeTravelerStore(user.items.gear.owned);
|
||||
var keys = Object.keys(itemsLeftInTimeTravlerStore);
|
||||
|
||||
return keys.length === 0;
|
||||
};
|
||||
|
||||
function _updateDropAnimalCount(items) {
|
||||
$scope.petCount = Shared.count.beastMasterProgress(items.pets);
|
||||
$scope.mountCount = Shared.count.mountMasterProgress(items.mounts);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
.row: .col-md-12
|
||||
.row: .col-md-6
|
||||
.alert.alert-info(ng-if='_.isEmpty(Content.timeTravelerStore(user.items.gear.owned))')=env.t('timeTravelersAlreadyOwned')
|
||||
.alert.alert-info(ng-if='hasAllTimeTravelerItems()')=env.t('timeTravelersAlreadyOwned')
|
||||
|
||||
li.customize-menu.inventory-gear
|
||||
menu.pets-menu(label='{{::set.text}}', ng-repeat='set in Content.timeTravelerStore(user.items.gear.owned)')
|
||||
|
||||
Reference in New Issue
Block a user