mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-16 19:12:04 +00:00
Refined triad Bingo calculation
This commit is contained in:
parent
d9ecd41c1e
commit
9b5b83871f
2 changed files with 5 additions and 18 deletions
|
|
@ -77,18 +77,6 @@ habitrpg.controller("InventoryCtrl",
|
|||
return _.pick(inventory, function(v,k){return v>0;});
|
||||
}
|
||||
|
||||
$scope.calcTriadBingo = function() {
|
||||
var hasPets = Shared.countPets(null, User.user.items.pets) >= 90 ;
|
||||
var hasMounts = Shared.countMounts(null, User.user.items.mounts) >= 90;
|
||||
|
||||
if(!(hasPets && hasMounts)) return false;
|
||||
|
||||
for (var p in User.user.items.pets) {
|
||||
if(User.user.items.pets[p] < 0) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$scope.hatch = function(egg, potion){
|
||||
var eggName = Content.eggs[egg.key].text();
|
||||
var potName = Content.hatchingPotions[potion.key].text();
|
||||
|
|
@ -97,16 +85,19 @@ habitrpg.controller("InventoryCtrl",
|
|||
$scope.selectedEgg = null;
|
||||
$scope.selectedPotion = null;
|
||||
|
||||
$rootScope.petCount = Shared.countPets($rootScope.countExists(User.user.items.pets), User.user.items.pets);
|
||||
|
||||
// Checks if beastmaster has been reached for the first time
|
||||
if(!User.user.achievements.beastMaster
|
||||
&& Shared.countPets(null, User.user.items.pets) >= 90) {
|
||||
&& $rootScope.petCount >= 90) {
|
||||
User.user.achievements.beastMaster = true;
|
||||
$rootScope.openModal('achievements/beastMaster');
|
||||
}
|
||||
|
||||
// Checks if Triad Bingo has been reached for the first time
|
||||
if(!User.user.achievements.triadBingo
|
||||
&& $scope.calcTriadBingo()) {
|
||||
&& $rootScope.mountCount >= 90
|
||||
&& Shared.countTriad(User.user.items.pets)) {
|
||||
User.user.achievements.triadBingo = true;
|
||||
$rootScope.openModal('achievements/triadBingo');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,10 +91,6 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||
$rootScope.petCount = Shared.countPets($rootScope.countExists(User.user.items.pets), User.user.items.pets);
|
||||
$rootScope.mountCount = Shared.countMounts($rootScope.countExists(User.user.items.mounts), User.user.items.mounts);
|
||||
|
||||
$rootScope.$watch('user.items.pets', function(pets){
|
||||
$rootScope.petCount = Shared.countPets($rootScope.countExists(pets), User.user.items.pets);
|
||||
}, true);
|
||||
|
||||
$scope.safeApply = function(fn) {
|
||||
var phase = this.$root.$$phase;
|
||||
if(phase == '$apply' || phase == '$digest') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue