lotsa changes! renaming male/female icons, fix tnl & current armor

refresh bug, model function for current armor (female pending)
This commit is contained in:
Tyler Renelle 2013-01-30 13:03:10 -05:00
parent 371b532e70
commit 466256f793
19 changed files with 18 additions and 12 deletions

View file

Before

Width:  |  Height:  |  Size: 887 B

After

Width:  |  Height:  |  Size: 887 B

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 977 B

After

Width:  |  Height:  |  Size: 977 B

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

Before

Width:  |  Height:  |  Size: 867 B

After

Width:  |  Height:  |  Size: 867 B

View file

Before

Width:  |  Height:  |  Size: 796 B

After

Width:  |  Height:  |  Size: 796 B

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 953 B

After

Width:  |  Height:  |  Size: 953 B

View file

Before

Width:  |  Height:  |  Size: 887 B

After

Width:  |  Height:  |  Size: 887 B

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

Before

Width:  |  Height:  |  Size: 979 B

After

Width:  |  Height:  |  Size: 979 B

View file

Before

Width:  |  Height:  |  Size: 991 B

After

Width:  |  Height:  |  Size: 991 B

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -54,4 +54,4 @@ module.exports.viewHelpers = (view) ->
a < b
view.fn "tokens", (money) ->
return money/0.25
return money/0.25

View file

@ -15,10 +15,21 @@ browser = require './browser'
_ = require('underscore')
setupListReferences = (model) ->
# Setup Task Lists
taskTypes = ['habit', 'daily', 'todo', 'reward']
_.each taskTypes, (type) -> model.refList "_#{type}List", "_user.tasks", "_user.#{type}Ids"
setupModelFns = (model) ->
model.fn '_user._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
(lvl*100)/5
model.fn '_user._armor', '_user.items.armor', '_user.preferences.gender', (armor, gender) ->
if gender == 'f'
"armor#{armor}_f.png"
else
"armor#{armor}_m.png"
# ========== ROUTES ==========
get '/', (page, model, next) ->
@ -79,12 +90,7 @@ get '/', (page, model, next) ->
user.set('notifications.kickstarter', 'show')
setupListReferences(model)
# Setup Model Functions
model.fn '_user._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
(lvl*100)/5
setupModelFns(model)
page.render()
@ -93,7 +99,7 @@ get '/', (page, model, next) ->
resetDom = (model) ->
window.DERBY.app.dom.clear()
view.render(model)
setupModelFns(model)
ready (model) ->
user = model.at('_user')
@ -250,10 +256,10 @@ ready (model) ->
user.set 'stats.money', money - value
if type == 'armor'
user.set 'items.armor', index
model.set '_items.armor', content.items.armor[parseInt(index) + 1]
model.set '_view.items.armor', content.items.armor[parseInt(index) + 1]
else if type == 'weapon'
user.set 'items.weapon', index
model.set '_items.weapon', content.items.weapon[parseInt(index) + 1]
model.set '_view.items.weapon', content.items.weapon[parseInt(index) + 1]
else if type == 'potion'
hp = user.get 'stats.hp'
hp += 15

View file

@ -124,7 +124,7 @@
<td id="avatar">
<div class='avatar-sprites'>
<img class='weapon weapon-{_user.items.weapon}' src="/img/BrowserQuest/habitrpg_mods/weapon{_user.items.weapon}.png" />
<img class='armor armor-{_user.items.armor}' src="/img/BrowserQuest/habitrpg_mods/armor{_user.items.armor}.png" />
<img class='armor armor-{_user.items.armor}' src="/img/BrowserQuest/habitrpg_mods/{_user._armor}" />
</div>
<div id="lvl"><span class="badge badge-info">Lvl {_user.stats.lvl}</span></div>
</td>