mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Refactor how cards are recieved
This commit is contained in:
@@ -216,7 +216,17 @@ habitrpg.controller("InventoryCtrl",
|
||||
$scope.selectedFood = null;
|
||||
$scope.selectedPotion = null;
|
||||
$scope.selectedEgg = null;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.openCardsModal = function(type, numberOfVariations) {
|
||||
var cardsModalScope = $rootScope.$new();
|
||||
cardsModalScope.cardType = type;
|
||||
cardsModalScope.cardMessage = _generateCard(type, numberOfVariations);
|
||||
|
||||
$rootScope.openModal('cards', {
|
||||
scope: cardsModalScope
|
||||
});
|
||||
};
|
||||
|
||||
function _updateDropAnimalCount(items) {
|
||||
$scope.petCount = Shared.count.beastMasterProgress(items.pets);
|
||||
@@ -224,5 +234,11 @@ habitrpg.controller("InventoryCtrl",
|
||||
$scope.beastMasterProgress = Stats.beastMasterProgress(items.pets);
|
||||
$scope.mountMasterProgress = Stats.mountMasterProgress(items.mounts);
|
||||
}
|
||||
|
||||
function _generateCard(kind, numberOfVariations) {
|
||||
var random = Math.random() * numberOfVariations;
|
||||
var selection = Math.floor(random);
|
||||
return env.t(kind + selection);
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user