mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
bug fix: needed to kill user before checking their exp - tnl() >= 0
when lvl == 0 Conflicts: test/test.coffee
This commit is contained in:
@@ -33,13 +33,6 @@ hpModifier = function(user, value) {
|
||||
|
||||
updateStats = function(user, stats) {
|
||||
var money, tnl;
|
||||
if (stats.hp != null) {
|
||||
if (stats.hp < 0) {
|
||||
user.set('stats.lvl', 0);
|
||||
} else {
|
||||
user.set('stats.hp', stats.hp);
|
||||
}
|
||||
}
|
||||
if (stats.exp != null) {
|
||||
tnl = user.get('_tnl');
|
||||
if (stats.exp >= tnl) {
|
||||
@@ -61,6 +54,13 @@ updateStats = function(user, stats) {
|
||||
}
|
||||
user.set('stats.exp', stats.exp);
|
||||
}
|
||||
if (stats.hp != null) {
|
||||
if (stats.hp < 0) {
|
||||
user.set('stats.lvl', 0);
|
||||
} else {
|
||||
user.set('stats.hp', stats.hp);
|
||||
}
|
||||
}
|
||||
if (stats.money != null) {
|
||||
if (!(typeof money !== "undefined" && money !== null) || money < 0) {
|
||||
money = 0.0;
|
||||
|
||||
Reference in New Issue
Block a user