refactor: Extract constants into constants file

This commit is contained in:
Blade Barringer
2015-12-26 19:40:36 -06:00
parent ba31cda85d
commit 1b118d86b2
4 changed files with 26 additions and 35 deletions

View File

@@ -2,6 +2,11 @@ import {
daysSince,
shouldDo,
} from '../../common/script/cron';
import {
MAX_HEALTH,
MAX_LEVEL,
MAX_STAT_POINTS,
} from './constants';
import * as statHelpers from './statHelpers';
var $w, _, api, content, i18n, moment, preenHistory, sortOrder,
@@ -20,10 +25,9 @@ api = module.exports = {};
api.i18n = i18n;
api.shouldDo = shouldDo;
api.maxLevel = statHelpers.MAX_LEVEL;
api.maxStatPoints = statHelpers.MAX_STAT_POINTS;
api.maxLevel = MAX_LEVEL;
api.capByLevel = statHelpers.capByLevel;
api.maxHealth = statHelpers.MAX_HEALTH;
api.maxHealth = MAX_HEALTH;
api.tnl = statHelpers.toNextLevel;
api.diminishingReturns = statHelpers.diminishingReturns;
@@ -2283,7 +2287,8 @@ api.wrap = function(user, main) {
tnl = api.tnl(user.stats.lvl);
user.stats.hp = 50;
var userTotalStatPoints = user.stats.str + user.stats.int + user.stats.con + user.stats.per;
if (userTotalStatPoints >= api.maxStatPoints) {
if (userTotalStatPoints >= MAX_STAT_POINTS) {
continue;
}
if (user.preferences.automaticAllocation) {