many bug fixes, but weapon is still tripping out

This commit is contained in:
Tyler Renelle
2012-07-08 19:56:55 -04:00
parent ecc3bdee2d
commit f58cd5609a
3 changed files with 21 additions and 13 deletions
+1 -1
View File
@@ -137,7 +137,7 @@ module.exports = {
{type: 'armor', index: 5, text: "Golden Armor", icon: 'item-goldenarmor', notes:'', value:500}
]
potion: {type: 'potion', text: "Potion", notes: "Recover 15 HP", value: 100, icon: 'item-flask'}
reroll: {type: 'reroll', text: "Re-Roll", icon: 'chest', notes: "Reset your task values to 0. Do this only if you're floundering."}
reroll: {type: 'reroll', text: "Re-Roll", icon: 'favicon', notes: "Reset your task values to 0. Do this only if you're floundering.", value:0}
}
}
+17 -10
View File
@@ -65,11 +65,20 @@ getRoom = (page, model, userId) ->
# Default Items & Stats
user.setNull 'stats', { money: 0, exp: 0, lvl: 1, hp: 50 }
user.setNull 'items', { itemsEnabled: false, armor: 0, weapon: 0 }
model.set '_items', []
model.push '_items', content.items.armor[user.get('items.armor')+1] if content.items.armor[user.get('items.armor')+1]
model.push '_items', content.items.armor[user.get('items.weapon')+1] if content.items.weapon[user.get('items.weapon')+1]
model.push '_items', content.items.potion
model.push '_items', content.items.reroll
nextArmor = content.items.armor[user.get('items.armor')+1]
unless nextArmor?
nextArmor = content.items.armor[user.get('items.armor')]
nextArmor.disabled = true
nextWeapon = content.items.weapon[user.get('items.weapon')+1]
unless nextWeapon?
nextWeapon = content.items.weapon[user.get('items.weapon')]
nextWeapon.disabled = true
model.set '_items', [
nextArmor
nextWeapon
content.items.potion
content.items.reroll
]
# http://tibia.wikia.com/wiki/Formula
model.fn '_tnl', '_user.stats.lvl', (lvl) -> 50 * Math.pow(lvl, 2) - 150 * lvl + 200
@@ -96,11 +105,9 @@ ready (model) ->
if stats.hp?
# game over
if stats.hp < 0
user.set 'stats.hp', 50
user.set 'stats.lvl', 1
user.set 'stats.exp', 0
user.set 'stats.money', 0
user.set 'items', { weapon: 0, armor: 0 }
user.set 'stats', {hp: 50, lvl: 1, exp: 0, money: 0}
user.set 'items.armor', 0
user.set 'items.weapon', 0
else
user.set 'stats.hp', stats.hp
+3 -2
View File
@@ -220,8 +220,9 @@
<span data-placement="left" data-content="{:item.notes}" data-original-title="{:item.text}" class='task-notes'><i class="icon-comment"></i></span>
</div>
<div class="task-controls">
<!-- need to come up with a better identifier -->
<a x-bind=click:buyItem class="item-buy-link" data-item-id={:item.id}>{:item.value}<img src="img/coin_single_gold.png"/></a>
{#unless :item.disabled}
<a x-bind=click:buyItem class="item-buy-link" data-item-id={:item.id}>{:item.value}<img src="img/coin_single_gold.png"/></a>
{/}
</div>
<div class="task-text"><img src="/img/BrowserQuest/{:item.icon}.png" /> {:item.text}</div>
</pre>