mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-17 19:28:53 +00:00
Create private method for how stats should be displayed
This commit is contained in:
parent
53fb0ec8b0
commit
c784b97586
1 changed files with 8 additions and 3 deletions
|
|
@ -15,7 +15,7 @@
|
|||
function hpDisplay(hp) {
|
||||
var remainingHP = Math.ceil(hp);
|
||||
var totalHP = Shared.maxHealth;
|
||||
var display = remainingHP + '/' + totalHP;
|
||||
var display = _formatOutOfTotalDisplay(remainingHP, totalHP);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
function mpDisplay(user) {
|
||||
var remainingMP = Math.floor(user.stats.mp);
|
||||
var totalMP = user._statsComputed.maxMP;
|
||||
var display = remainingMP + '/' + totalMP;
|
||||
var display = _formatOutOfTotalDisplay(remainingMP, totalMP);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
function expDisplay(user) {
|
||||
var exp = Math.floor(user.stats.exp);
|
||||
var toNextLevel = Shared.tnl(user.stats.lvl);
|
||||
var display = exp + '/' + toNextLevel;
|
||||
var display = _formatOutOfTotalDisplay(exp, toNextLevel);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
|
@ -85,6 +85,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
function _formatOutOfTotalDisplay(stat, totalStat) {
|
||||
var display = stat + "/" + totalStat;
|
||||
return display;
|
||||
}
|
||||
|
||||
return {
|
||||
classBonus: classBonus,
|
||||
equipmentStatBonus: equipmentStatBonus,
|
||||
|
|
|
|||
Loading…
Reference in a new issue