mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
Better notifications
This commit is contained in:
parent
b1c770c0f9
commit
2a49b64023
2 changed files with 33 additions and 16 deletions
|
|
@ -6,7 +6,7 @@ module.exports.restoreRefs = restoreRefs = (model) ->
|
||||||
model.fn '_tnl', '_user.stats.lvl', (lvl) ->
|
model.fn '_tnl', '_user.stats.lvl', (lvl) ->
|
||||||
# see https://github.com/lefnire/habitrpg/issues/4
|
# see https://github.com/lefnire/habitrpg/issues/4
|
||||||
# also update in scoring.coffee. TODO create a function accessible in both locations
|
# also update in scoring.coffee. TODO create a function accessible in both locations
|
||||||
(lvl*100)/5
|
10*Math.pow(lvl,2)+(lvl*10)+80
|
||||||
|
|
||||||
#refLists
|
#refLists
|
||||||
_.each ['habit', 'daily', 'todo', 'reward'], (type) ->
|
_.each ['habit', 'daily', 'todo', 'reward'], (type) ->
|
||||||
|
|
@ -193,20 +193,30 @@ setupGrowlNotifications = (model) ->
|
||||||
num = captures - args
|
num = captures - args
|
||||||
rounded = Math.abs(num.toFixed(1))
|
rounded = Math.abs(num.toFixed(1))
|
||||||
if num < 0
|
if num < 0
|
||||||
statsNotification "<i class='icon-heart'></i> -#{rounded} HP", 'hp' # lost hp from purchase
|
statsNotification "<i class='icon-heart'></i> - #{rounded} HP", 'hp' # lost hp from purchase
|
||||||
|
else if num > 0
|
||||||
|
statsNotification "<i class='icon-heart'></i> + #{rounded} HP", 'hp' # gained hp from potion/level?
|
||||||
|
|
||||||
|
user.on 'set', 'stats.exp', (captures, args) ->
|
||||||
|
num = captures - args
|
||||||
|
rounded = Math.abs(num.toFixed(1))
|
||||||
|
if num < 0
|
||||||
|
statsNotification "<i class='icon-star'></i> - #{rounded} XP", 'xp'
|
||||||
|
else if num > 0
|
||||||
|
statsNotification "<i class='icon-star'></i> + #{rounded} XP", 'xp'
|
||||||
|
|
||||||
user.on 'set', 'stats.gp', (captures, args) ->
|
user.on 'set', 'stats.gp', (captures, args) ->
|
||||||
num = captures - args
|
num = captures - args
|
||||||
rounded = Math.abs(num.toFixed(1))
|
absolute = Math.abs(num)
|
||||||
# made purchase
|
gold = Math.floor(absolute)
|
||||||
if num < 0
|
silver = Math.floor((absolute-gold)*100)
|
||||||
# FIXME use 'warning' when unchecking an accidently completed daily/todo, and notify of exp too
|
sign = if num < 0 then '-' else '+'
|
||||||
statsNotification "<i class='icon-star'></i> -#{rounded} GP", 'gp'
|
if gold and silver > 0
|
||||||
# gained gp (and thereby exp)
|
statsNotification "#{sign} #{gold} <i class='icon-gold'></i> #{silver} <i class='icon-silver'></i>", 'gp'
|
||||||
else if num > 0
|
else if gold > 0
|
||||||
num = Math.abs(num)
|
statsNotification "#{sign} #{gold} <i class='icon-gold'></i>", 'gp'
|
||||||
statsNotification "<i class='icon-star'></i> +#{rounded} XP", 'xp'
|
else if silver > 0
|
||||||
statsNotification "<i class='icon-gp'></i> +#{rounded} GP", 'gp'
|
statsNotification "#{sign} #{silver} <i class='icon-silver'></i>", 'gp'
|
||||||
|
|
||||||
user.on 'set', 'stats.lvl', (captures, args) ->
|
user.on 'set', 'stats.lvl', (captures, args) ->
|
||||||
if captures > args
|
if captures > args
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,16 @@ borderDarken = 20%
|
||||||
|
|
||||||
// alert icons
|
// alert icons
|
||||||
|
|
||||||
.icon-gp
|
.icon-gold
|
||||||
background: url("img/sprites/shop_sprites.png") no-repeat
|
background: url("img/coin_single_gold.png") no-repeat
|
||||||
background-size: 400px
|
background-position: center center
|
||||||
background-position: -386px 0
|
background-size: 18px
|
||||||
|
width: 14px
|
||||||
|
height: 14px
|
||||||
|
|
||||||
|
.icon-silver
|
||||||
|
background: url("img/coin_single_silver.png") no-repeat
|
||||||
|
background-position: center center
|
||||||
|
background-size: 18px
|
||||||
width: 14px
|
width: 14px
|
||||||
height: 14px
|
height: 14px
|
||||||
Loading…
Reference in a new issue