mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-14 02:02:19 +00:00
at least onclick calls :s
This commit is contained in:
parent
ba09af4c39
commit
52b26c3f94
2 changed files with 13 additions and 13 deletions
|
|
@ -132,11 +132,10 @@ ready (model) ->
|
|||
|
||||
# up/down -voting as checkbox & assigning as done, 2 birds one stone
|
||||
done = task.get("done")
|
||||
if task.type != 'habit'
|
||||
if task.get('type') != 'habit'
|
||||
done = true if direction=="up"
|
||||
done = false if direction=="down"
|
||||
task.set({ score: score, done: done })
|
||||
# TODO: window.userStats.updateStats(this, delta)
|
||||
[task.score, task.done] = [score, done]
|
||||
|
||||
# Update the user's status
|
||||
[money, hp, exp, lvl] = [user.get('money'), user.get('hp'), user.get('exp'), user.get('lvl')]
|
||||
|
|
@ -158,27 +157,28 @@ ready (model) ->
|
|||
else if task.get('type') != 'reward'
|
||||
hp += delta
|
||||
|
||||
#TODO this should be a func, since called elswhere.. but getting error
|
||||
tnl = 50 * Math.pow(user.get('lvl'), 2) - 150 * user.get('lvl') + 200
|
||||
# level up & carry-over exp
|
||||
if exp > tnl()
|
||||
exp -= tnl()
|
||||
if exp > tnl
|
||||
exp -= tnl
|
||||
lvl += 1
|
||||
refresh = true
|
||||
|
||||
# game over
|
||||
if hp < 0
|
||||
[hp, lvl, exp] = [50, 1, 0]
|
||||
refresh = true
|
||||
|
||||
#TODO is this necessary?
|
||||
user.set({money: money, hp: hp, exp: exp, lvl: lvl})
|
||||
[user.money, user.hp, user.exp, user.lvl] = [money, hp, exp, lvl]
|
||||
|
||||
console.log user.exp
|
||||
|
||||
#TODO why do I have this?
|
||||
# @trigger 'updatedStats'
|
||||
|
||||
tnl: () ->
|
||||
exports.tnl = () ->
|
||||
# http://tibia.wikia.com/wiki/Formula
|
||||
user = model.at('_user')
|
||||
50 * Math.pow(usre.get('lvl'), 2) - 150 * user.get('lvl') + 200
|
||||
50 * Math.pow(user.get('lvl'), 2) - 150 * user.get('lvl') + 200
|
||||
|
||||
## RECONNECT & SHORTCUTS ##
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
<label>
|
||||
<!-- Habits -->
|
||||
{#if equal(.type, 'habit')}
|
||||
{#if up}<a href="#" class="vote-up"><img src="img/add.png" /></a>{/}
|
||||
{#if down}<a href="#" class="vote-down"><img src="img/remove.png" /></a>{/}
|
||||
{#if up}<a data-direction=up x-bind=click:vote><img src="img/add.png" /></a>{/}
|
||||
{#if down}<a data-direction=up x-bind=click:vote><img src="img/remove.png" /></a>{/}
|
||||
<!-- Rewards -->
|
||||
{else if equal(.type, 'reward')}
|
||||
<a class="vote-down buy-link" href="#">{.price}<img src="img/coin_single_gold.png"/></a>
|
||||
|
|
|
|||
Loading…
Reference in a new issue