many bug fixes, but weapon is still tripping out
This commit is contained in:
@@ -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
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user