Skip to content

Commit

Permalink
fix(stats): cap more values
Browse files Browse the repository at this point in the history
  • Loading branch information
SabreCat committed Jul 11, 2023
1 parent 3a22769 commit 487ee97
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
2 changes: 2 additions & 0 deletions website/common/script/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ export const MAX_LEVEL = 100;
export const MAX_STAT_POINTS = MAX_LEVEL;
export const MAX_LEVEL_HARD_CAP = 9999;
export const MAX_FIELD_HARD_CAP = 99999;
export const MAX_GOLD_HARD_CAP = 999999;
export const MAX_EXPERIENCE_HARD_CAP = 25095129;
export const ATTRIBUTES = ['str', 'int', 'con', 'per'];
export const MAX_INCENTIVES = 500;

Expand Down
6 changes: 6 additions & 0 deletions website/common/script/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import {
MAX_INCENTIVES,
MAX_LEVEL,
MAX_LEVEL_HARD_CAP,
MAX_EXPERIENCE_HARD_CAP,
MAX_GOLD_HARD_CAP,
MAX_FIELD_HARD_CAP,
MAX_STAT_POINTS,
MAX_SUMMARY_SIZE_FOR_CHALLENGES,
MAX_SUMMARY_SIZE_FOR_GUILDS,
Expand Down Expand Up @@ -124,6 +127,9 @@ api.constants = {
MAX_MESSAGE_LENGTH,
MAX_GIFT_MESSAGE_LENGTH,
MAX_LEVEL_HARD_CAP,
MAX_EXPERIENCE_HARD_CAP,
MAX_GOLD_HARD_CAP,
MAX_FIELD_HARD_CAP,
};
// TODO Move these under api.constants
api.maxLevel = MAX_LEVEL;
Expand Down
26 changes: 22 additions & 4 deletions website/server/models/user/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,28 @@ export default new Schema({
},
},
stats: {
hp: { $type: Number, default: shared.maxHealth, max: shared.constants.MAX_FIELD_HARD_CAP },
mp: { $type: Number, default: 10, min: 0, max: shared.constants.MAX_FIELD_HARD_CAP },
exp: { $type: Number, default: 0, max: shared.constants.MAX_FIELD_HARD_CAP },
gp: { $type: Number, default: 0, min: 0, max: shared.constants.MAX_FIELD_HARD_CAP },
hp: {
$type: Number,
default: shared.maxHealth,
max: shared.constants.MAX_FIELD_HARD_CAP,
},
mp: {
$type: Number,
default: 10,
min: 0,
max: shared.constants.MAX_FIELD_HARD_CAP,
},
exp: {
$type: Number,
default: 0,
max: shared.constants.MAX_EXPERIENCE_HARD_CAP,
},
gp: {
$type: Number,
default: 0,
min: 0,
max: shared.constants.MAX_GOLD_HARD_CAP,
},
lvl: {
$type: Number,
default: 1,
Expand Down

0 comments on commit 487ee97

Please sign in to comment.