feat: Disable spells on client when they cannot be cast

Closes #7110
Closes #6867
This commit is contained in:
Blade Barringer
2016-06-09 08:58:57 -05:00
parent a941ee8b84
commit b97d7cc9f9
4 changed files with 46 additions and 2 deletions

View File

@@ -334,4 +334,34 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
task.tags.splice(tagIndex, 1);
}
}
/*
------------------------
Disabling Spells
------------------------
*/
$scope.spellDisabled = function (skill) {
if (skill === 'frost' && $scope.user.stats.buffs.streaks) {
return true;
} else if (skill === 'stealth' && $scope.user.stats.buffs.stealth >= $scope.user.dailys.length) {
return true;
}
return false;
};
$scope.skillNotes = function (skill) {
var notes = skill.notes();
if (skill.key === 'frost' && $scope.spellDisabled(skill.key)) {
notes = window.env.t('spellWizardFrostAlreadyCast');
} else if (skill.key === 'stealth' && $scope.spellDisabled(skill.key)) {
notes = window.env.t('spellRogueStealthMaxedOut');
} else if (skill.key === 'stealth') {
notes = window.env.t('spellRogueStealthDaliesAvoided', { originalText: notes, number: $scope.user.stats.buffs.stealth });
}
return notes;
};
}]);