Files
habitica/common/script/ops/allocate.js
T
Blade Barringer 0a7b6b65e7 Revert "API v3 [WIP] (#6144)"
This reverts commit 28f2e9c356.
2016-05-23 07:53:14 -05:00

16 lines
406 B
JavaScript

import _ from 'lodash';
import splitWhitespace from '../libs/splitWhitespace';
module.exports = function(user, req, cb) {
var stat;
stat = req.query.stat || 'str';
if (user.stats.points > 0) {
user.stats[stat]++;
user.stats.points--;
if (stat === 'int') {
user.stats.mp++;
}
}
return typeof cb === "function" ? cb(null, _.pick(user, splitWhitespace('stats'))) : void 0;
};