From 59f8727cbfe752af9aa882728f9f8f4d50ca0ef2 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Sat, 7 Dec 2013 11:31:11 -0700 Subject: [PATCH] classes: small tweaks --- migrations/20131204_classes.js | 2 ++ public/js/services/userServices.js | 1 + src/models/user.js | 4 ++-- views/options/profile.jade | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/migrations/20131204_classes.js b/migrations/20131204_classes.js index c760da4c4b..8dddd0a826 100644 --- a/migrations/20131204_classes.js +++ b/migrations/20131204_classes.js @@ -11,6 +11,8 @@ db.users.find().forEach(function(user){ // grant backer/contrib gear, 300, rather than using js logic + // customizations redo: https://trello.com/c/YKXmHNjY/306-customization-redo + // migrate current owned items // gender => size diff --git a/public/js/services/userServices.js b/public/js/services/userServices.js index bf9b605a87..9db94b7828 100644 --- a/public/js/services/userServices.js +++ b/public/js/services/userServices.js @@ -23,6 +23,7 @@ angular.module('userServices', []). //first we populate user with schema _.extend(user, $window.habitrpgShared.helpers.newUser()); user.apiToken = user._id = ''; // we use id / apitoken to determine if registered + $window.habitrpgShared.algos.defineComputed(user); //than we try to load localStorage if (localStorage.getItem(STORAGE_USER_ID)) { diff --git a/src/models/user.js b/src/models/user.js index c1e723d1ae..2fbd5e6e4d 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -233,7 +233,7 @@ var UserSchema = new Schema({ 'class': {type: String, enum: ['warrior','rogue','wizard','rogue'], 'default': 'warrior'}, points: {type: Number, 'default': 0}, str: {type: Number, 'default': 0}, - def: {type: Number, 'default': 0}, + con: {type: Number, 'default': 0}, int: {type: Number, 'default': 0}, per: {type: Number, 'default': 0}, buffs: { @@ -306,7 +306,7 @@ UserSchema.pre('save', function(next) { // FIXME handle this on level-up instead, and come up with how we're going to handle retroactively // Actually, can this be used as an attr default? (schema {type: ..., 'default': function(){}}) - this.stats.points = this.stats.lvl - (this.stats.def + this.stats.str + this.stats.per + this.stats.int); + this.stats.points = this.stats.lvl - (this.stats.con + this.stats.str + this.stats.per + this.stats.int); var petCount = helpers.countPets(_.reduce(this.items.pets,function(m,v){ //HOTFIX - Remove when solution is found, the first argument passed to reduce is a function diff --git a/views/options/profile.jade b/views/options/profile.jade index e457457cfb..b0d32c24a0 100644 --- a/views/options/profile.jade +++ b/views/options/profile.jade @@ -123,7 +123,7 @@ script(id='partials/options.profile.stats.html', type='text/ng-template') i.icon-question-sign(popover-title='Defense', popover='Defense decreases damage inflicted by tasks, and increases the effectiveness of healing and buff spells', popover-trigger='mouseenter') |  DEF: {{user.stats.def}} td - a.btn.btn-primary(ng-show='user.stats.points', ng-click='allocate("def")') + + a.btn.btn-primary(ng-show='user.stats.points', ng-click='allocate("con")') + tr td i.icon-question-sign(popover-title='Perception', popover='Perception increases the likelihood of drops, Gold bonuses, and critical hit chances', popover-trigger='mouseenter')