fixes to gold / silver. Add copper, but not using it in the html (it's

currently always calculated at 00)
This commit is contained in:
Tyler Renelle 2013-02-08 16:41:04 -05:00
parent 6f3d958a21
commit 63bef37e98
4 changed files with 37 additions and 19 deletions

View file

@ -32,24 +32,6 @@ module.exports.viewHelpers = (view) ->
view.fn "round", (num) ->
Math.round num
view.fn "gold", (num) ->
if num
return num.toFixed(1).split('.')[0]
else
return "0"
view.fn "silver", (num) ->
if num
num.toFixed(1).split('.')[1]
else
return "0"
view.fn "gp", (num) ->
if num
return num.toFixed(2)
else
return "0.00"
view.fn "lt", (a, b) ->
a < b
view.fn 'gt', (a, b) -> a > b

View file

@ -62,6 +62,25 @@ module.exports.view = (view) ->
else
return "m_head_#{head}"
view.fn "gold", (num) ->
if num
return (num).toFixed(1).split('.')[0]
else
return "0"
view.fn "silver", (num) ->
if num
(num).toFixed(2).split('.')[1]
else
return "00"
view.fn "copper", (num) ->
if num
c = (num).toFixed(4).split('.')[1]
c.toString().substr(2,2)
else
return "00"
###
server exports
###

View file

@ -25,3 +25,11 @@
position:absolute
top: 0
left: 50px
#money
position:relative
.shop_gold, .shop_silver, .shop_copper
float:right
.money-table
position:absolute
top: 0

View file

@ -322,7 +322,16 @@
<!--Title -->
<div class="row-fluid">
<div class="span6"><h2>Rewards</h2></div>
<div class="span6" id="money">{gold(_user.stats.gp)} <img src='/img/coin_single_gold.png'/> {silver(_user.stats.gp)} <img src='/img/coin_single_silver.png'/></div>
<div class="span6">
<table><tr>
<td>{gold(_user.stats.gp)} </td>
<td><div class='shop_gold' rel='tooltip' title='Gold'></div></td>
<td>{silver(_user.stats.gp)} </td>
<td><div class='shop_silver' rel='tooltip' title='Silver'></div></td>
<!--<td>{copper(_user.stats.gp)} </td>
<td><div class='shop_copper' rel='tooltip' title='shop_copper'></div></td>-->
</tr></table>
</div>
</div>
<!-- Content -->