mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-03 08:21:07 +00:00
added mountmaster support
inventoryCtrl: Changed Matt to show 90 mounts instead of 180 notificationCtrl: added mountmaster achievement test userCtrl: added scope.profile.mountCount user.js: added fields for mountMaster and mountMasterCount (not used yet), mountCount function modals/achievements.jade - added modal dialog for mountmaster (note: wolf graphic was not available locally) profiles/achievements - jade - mountmaster added stats.jade -- uncommented broken Mounts Tamed section, since it works now
This commit is contained in:
parent
e004452257
commit
506ac6ebe7
7 changed files with 52 additions and 4 deletions
|
|
@ -8,7 +8,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.dropEggs) * _.size(Content.hatchingPotions);
|
||||
$scope.totalMounts = _.size(_.reject(Content.eggs,function(egg){return egg.noMount})) * _.size(Content.hatchingPotions);
|
||||
// previously: $scope.totalMounts = _.size(_.reject(Content.eggs,function(egg){return egg.noMount})) * _.size(Content.hatchingPotions);
|
||||
$scope.totalMounts = _.size(Content.dropEggs) * _.size(Content.hatchingPotions);
|
||||
|
||||
// count egg, food, hatchingPotion stack totals
|
||||
var countStacks = function(items) { return _.reduce(items,function(m,v){return m+v;},0);}
|
||||
|
|
|
|||
|
|
@ -113,6 +113,18 @@ habitrpg.controller('NotificationCtrl',
|
|||
}
|
||||
}, true);
|
||||
|
||||
|
||||
//start mountmaster test
|
||||
$rootScope.$watch('user.items.mounts', function(after, before){
|
||||
if(_.size(after) === _.size(before) ||
|
||||
Shared.countMounts(null, after) < 90) return;
|
||||
if (User.user.achievements.mountMaster == false) {
|
||||
User.user.achievements.mountMaster = true;
|
||||
$rootScope.openModal('achievements/mountMaster');
|
||||
}
|
||||
}, true);
|
||||
// end mountmaster test
|
||||
|
||||
$rootScope.$watch('user.achievements.rebirths', function(after, before){
|
||||
if(after === before) return;
|
||||
$rootScope.openModal('achievements/rebirth');
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ habitrpg.controller("UserCtrl", ['$rootScope', '$scope', '$location', 'User', '$
|
|||
function($rootScope, $scope, $location, User, $http, $state, Guide, Shared) {
|
||||
$scope.profile = User.user;
|
||||
$scope.profile.petCount = Shared.countPets(null, $scope.profile.items.pets);
|
||||
$scope.profile.mountCount = Shared.countMounts(null, $scope.profile.items.mounts); //added for mountmaster prep
|
||||
$scope.hideUserAvatar = function() {
|
||||
$(".userAvatar").hide();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ var UserSchema = new Schema({
|
|||
ultimateGear: Boolean,
|
||||
beastMaster: Boolean,
|
||||
beastMasterCount: Number,
|
||||
mountMaster: Boolean,
|
||||
mountMasterCount: Number,
|
||||
veteran: Boolean,
|
||||
snowball: Number,
|
||||
spookDust: Number,
|
||||
|
|
@ -412,6 +414,16 @@ UserSchema.pre('save', function(next) {
|
|||
if (petCount >= 90 || this.achievements.beastMasterCount > 0) {
|
||||
this.achievements.beastMaster = true
|
||||
}
|
||||
// mountmaster stuff starts
|
||||
var mountCount = shared.countMounts(_.reduce(this.items.mounts,function(m,v){
|
||||
//HOTFIX - Remove when solution is found, the first argument passed to reduce is a function
|
||||
if(_.isFunction(v)) return m;
|
||||
return m+(v?1:0)},0), this.items.mounts);
|
||||
|
||||
if (mountCount >= 90 || this.achievements.mountMasterCount > 0) {
|
||||
this.achievements.mountMaster = true
|
||||
}
|
||||
// mountmaster stuff ends
|
||||
|
||||
// TODO remove this after 11/01
|
||||
if (!this.items.pets['JackOLantern-Base'] && moment().isBefore('2014-11-01'))
|
||||
|
|
|
|||
|
|
@ -29,6 +29,18 @@ script(id='modals/achievements/beastMaster.html', type='text/ng-template')
|
|||
.modal-footer
|
||||
button.btn.btn-default(ng-click='$close()')=env.t('ok')
|
||||
|
||||
|
||||
// Beast Master
|
||||
script(id='modals/achievements/mountMaster.html', type='text/ng-template')
|
||||
.modal-header
|
||||
h4=env.t('modalAchievement')
|
||||
.modal-body
|
||||
p
|
||||
.achievement.achievement-wolf
|
||||
=env.t('mountAchievement')
|
||||
.modal-footer
|
||||
button.btn.btn-default(ng-click='$close()')=env.t('ok')
|
||||
|
||||
// Contributor
|
||||
// activated by user.flags.contributor
|
||||
script(id='modals/achievements/contributor.html', type='text/ng-template')
|
||||
|
|
|
|||
|
|
@ -87,6 +87,14 @@ div(ng-if='profile.achievements.beastMaster || user._id == profile._id')
|
|||
=env.t('beastMastText2', {count: "{{profile.achievements.beastMasterCount}}"})
|
||||
hr
|
||||
|
||||
div(ng-if='profile.achievements.mountMaster || user._id == profile._id')
|
||||
.achievement.achievement-rat(ng-show='profile.achievements.mountMaster')
|
||||
div(ng-class='{muted: !profile.achievements.mountMaster}')
|
||||
h5=env.t('mountMastName')
|
||||
small=env.t('mountMastText')
|
||||
=env.t('beastMastText2', {count: "{{profile.achievements.mountMasterCount}}"})
|
||||
hr
|
||||
|
||||
div(ng-if='profile.achievements.rebirths')
|
||||
.achievement.achievement-sun
|
||||
h5(ng-if='profile.achievements.rebirths == 1')=env.t('rebirthBegan')
|
||||
|
|
|
|||
|
|
@ -71,8 +71,10 @@ table.table.table-striped(ng-show='user.flags.dropsEnabled')
|
|||
td
|
||||
strong=env.t('petsFound')
|
||||
| : {{profile.petCount}}
|
||||
// Dunno why this doesn't work //
|
||||
// tr
|
||||
// this works now //
|
||||
h4(class=mobile?'item item-divider':'')=env.t('mounts')
|
||||
table.table.table-striped(ng-show='user.flags.dropsEnabled')
|
||||
tr
|
||||
td
|
||||
strong=env.t('mountsTamed')
|
||||
| : {{profile.mountCount}} //
|
||||
| : {{profile.mountCount}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue