mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-26 21:24:08 +00:00
16 lines
393 B
JavaScript
16 lines
393 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, $w('stats'))) : void 0;
|
||
|
|
};
|