From f58cd5609a43d49157b8369ff836fbf875d3b6e8 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Sun, 8 Jul 2012 19:56:55 -0400 Subject: [PATCH] many bug fixes, but weapon is still tripping out --- src/app/content.coffee | 2 +- src/app/index.coffee | 27 +++++++++++++++++---------- views/app/index.html | 5 +++-- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/app/content.coffee b/src/app/content.coffee index fddd838f4b..bfc2d91ebd 100644 --- a/src/app/content.coffee +++ b/src/app/content.coffee @@ -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} } } diff --git a/src/app/index.coffee b/src/app/index.coffee index c1d87ee656..b64c90f283 100644 --- a/src/app/index.coffee +++ b/src/app/index.coffee @@ -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 diff --git a/views/app/index.html b/views/app/index.html index 1540fbdd4d..7d58fe5899 100644 --- a/views/app/index.html +++ b/views/app/index.html @@ -220,8 +220,9 @@
- - {:item.value} + {#unless :item.disabled} + {:item.value} + {/}
{:item.text}