From 79cf7d2bb97a001b2e37d61ac7761f57357b8302 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Thu, 6 Sep 2012 12:27:41 -0400 Subject: [PATCH] use linear growth TNL algorithm --- lib/app/index.js | 2 +- lib/app/scoring.js | 2 +- src/app/index.coffee | 5 +++-- src/app/scoring.coffee | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/app/index.js b/lib/app/index.js index 5b9c3073c8..62f90d8073 100644 --- a/lib/app/index.js +++ b/lib/app/index.js @@ -59,7 +59,7 @@ get('/:uidParam?', function(page, model, _arg, next) { reroll: content.items.reroll }); model.fn('_user._tnl', '_user.stats.lvl', function(lvl) { - return (50 * Math.pow(lvl, 2) - 150 * lvl + 200) / 5; + return (lvl * 100) / 5; }); model.refList("_habitList", "_user.tasks", "_user.habitIds"); model.refList("_dailyList", "_user.tasks", "_user.dailyIds"); diff --git a/lib/app/scoring.js b/lib/app/scoring.js index 7f8434bc4b..aa4a810277 100644 --- a/lib/app/scoring.js +++ b/lib/app/scoring.js @@ -205,7 +205,7 @@ module.exports.tally = function(user, momentDate) { lvl = 0; while (lvl < (user.get('stats.lvl') - 1)) { lvl++; - expTally += (50 * Math.pow(lvl, 2) - 150 * lvl + 200) / 5; + expTally += (lvl * 100) / 5; } return user.push('history.exp', { date: new Date(), diff --git a/src/app/index.coffee b/src/app/index.coffee index 1bc1f4f234..6d98d87399 100644 --- a/src/app/index.coffee +++ b/src/app/index.coffee @@ -47,8 +47,9 @@ get '/:uidParam?', (page, model, {uidParam}, next) -> reroll: content.items.reroll model.fn '_user._tnl', '_user.stats.lvl', (lvl) -> - # http://tibia.wikia.com/wiki/Formula - (50 * Math.pow(lvl, 2) - 150 * lvl + 200)/5 + # see https://github.com/lefnire/habitrpg/issues/4 + # also update in scoring.coffee. TODO create a function accessible in both locations + (lvl*100)/5 # Default Tasks model.refList "_habitList", "_user.tasks", "_user.habitIds" diff --git a/src/app/scoring.coffee b/src/app/scoring.coffee index bf2a632b14..698cc7be2f 100644 --- a/src/app/scoring.coffee +++ b/src/app/scoring.coffee @@ -166,5 +166,5 @@ module.exports.tally = (user, momentDate) -> lvl = 0 #iterator while lvl < (user.get('stats.lvl')-1) lvl++ - expTally += (50 * Math.pow(lvl, 2) - 150 * lvl + 200)/5 + expTally += (lvl*100)/5 user.push 'history.exp', { date: new Date(), value: expTally } \ No newline at end of file