diff --git a/src/app/browser.coffee b/src/app/browser.coffee index 55a6c9229f..f12ab9832f 100644 --- a/src/app/browser.coffee +++ b/src/app/browser.coffee @@ -4,16 +4,6 @@ moment = require 'moment' restoreRefs = module.exports.restoreRefs = (model) -> - # tnl function - model.fn '_tnl', '_user.stats.lvl', (lvl) -> - # see https://github.com/lefnire/habitrpg/issues/4 - # also update in scoring.coffee. TODO create a function accessible in both locations - #TODO find a method of calling algos.tnl() - if lvl==100 - 0 - else - Math.round(((Math.pow(lvl,2)*0.25)+(10 * lvl) + 139.75)/10)*10 - #refLists _.each ['habit', 'daily', 'todo', 'reward'], (type) -> model.refList "_#{type}List", "_user.tasks", "_user.#{type}Ids" diff --git a/src/app/character.coffee b/src/app/character.coffee index 9846811aa8..047005baa5 100644 --- a/src/app/character.coffee +++ b/src/app/character.coffee @@ -1,6 +1,7 @@ character = require './character' browser = require './browser' items = require './items' +algos = require './algos' moment = require 'moment' _ = require 'underscore' @@ -21,6 +22,9 @@ module.exports.username = username = (auth) -> module.exports.view = (view) -> view.fn "username", (auth) -> username(auth) + view.fn "tnl", (level) -> algos.tnl(level) + + module.exports.app = (appExports, model) -> user = model.at '_user' diff --git a/src/app/debug.coffee b/src/app/debug.coffee index 1f2172d272..1017118a9f 100644 --- a/src/app/debug.coffee +++ b/src/app/debug.coffee @@ -1,4 +1,5 @@ moment = require 'moment' +algos = require './algos' module.exports.app = (appExports, model) -> user = model.at('_user') @@ -14,7 +15,7 @@ module.exports.app = (appExports, model) -> window.location.reload() appExports.cheat = -> - user.incr 'stats.exp', model.get '_tnl' + user.incr 'stats.exp', algos.tnl(user.get('stats.lvl')) user.incr 'stats.gp', 1000 appExports.reset = -> diff --git a/src/app/scoring.coffee b/src/app/scoring.coffee index f6a5dd2e15..4a4882c02d 100644 --- a/src/app/scoring.coffee +++ b/src/app/scoring.coffee @@ -136,7 +136,7 @@ updateStats = (model, newStats, batch) -> obj.stats.hp = newStats.hp if newStats.exp? - tnl = model.get '_tnl' + tnl = algos.tnl(obj.stats.lvl) #silent = false # if we're at level 100, turn xp to gold if obj.stats.lvl >= 100 diff --git a/views/app/header.html b/views/app/header.html index d7bc716b3e..b3ce77e220 100644 --- a/views/app/header.html +++ b/views/app/header.html @@ -8,13 +8,21 @@ - {#each _partyMembers as :member} - {#unless equal(:member.id, _userId)} -
- + {{#each _partyMembers as :member}} + {{#unless equal(:member.id, _userId)}} +
+ +
+
+
+
+
+
+
+
- {/} - {/} + {{/}} + {{/}}
@@ -24,12 +32,12 @@
-
+
{#if _user.history.exp}   {/} - {floor(_user.stats.exp)} / {_tnl} + {floor(_user.stats.exp)} / {tnl(_user.stats.lvl)}