purchasing weapons & armor now updates the images
This commit is contained in:
@@ -118,12 +118,13 @@ module.exports = {
|
||||
unlockedMessage:
|
||||
title: "Item Store Unlocked"
|
||||
content: "Congradulations, you have unlocked the Item Store! You can now buy weapons, armor, potions, etc. Read each item's comment for more information."
|
||||
#TODO: figure out how to calculate index & type without having to store it in the JSON
|
||||
weapon: [
|
||||
{type: 'weapon', index: 0, text: "Sword 1", icon: "item-sword1", notes:'', value:0}
|
||||
{type: 'weapon', index: 1, text: "Sword 2", icon:'item-sword2', notes:'', value:100}
|
||||
{type: 'weapon', index: 2, text: "Blue Sword", icon:'item-bluesword', notes:'', value:200}
|
||||
{type: 'weapon', index: 3, text: "Axe", icon:'item-axe', notes:'', value:300}
|
||||
{type: 'weapon', index: 4, text: "Morningstar", icon:'item-morningstar', notes:'', value:400}
|
||||
{type: 'weapon', index: 2, text: "Axe", icon:'item-axe', notes:'', value:200}
|
||||
{type: 'weapon', index: 3, text: "Morningstar", icon:'item-morningstar', notes:'', value:300}
|
||||
{type: 'weapon', index: 4, text: "Blue Sword", icon:'item-bluesword', notes:'', value:400}
|
||||
{type: 'weapon', index: 5, text: "Red Sword", icon:'item-redsword', notes:'', value:500}
|
||||
{type: 'weapon', index: 6, text: "Gold Sword", icon:'item-goldsword', notes:'', value:600}
|
||||
]
|
||||
@@ -131,9 +132,9 @@ module.exports = {
|
||||
{type: 'armor', index: 0, text: "Cloth Armor", icon: 'item-clotharmor', notes:'', value:0}
|
||||
{type: 'armor', index: 1, text: "Leather Armor", icon: 'item-leatherarmor', notes:'', value:100}
|
||||
{type: 'armor', index: 2, text: "Chain Mail", icon: 'item-mailarmor', notes:'', value:200}
|
||||
{type: 'armor', index: 3, text: "Plate Mail", icon: 'item-platearmor', notes:'', value:200}
|
||||
{type: 'armor', index: 4, text: "Red Armor", icon: 'item-redarmor', notes:'', value:200}
|
||||
{type: 'armor', index: 5, text: "Golden Armor", icon: 'item-goldenarmor', notes:'', value:200}
|
||||
{type: 'armor', index: 3, text: "Plate Mail", icon: 'item-platearmor', notes:'', value:300}
|
||||
{type: 'armor', index: 4, text: "Red Armor", icon: 'item-redarmor', notes:'', value:400}
|
||||
{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."}
|
||||
|
||||
+11
-8
@@ -65,12 +65,12 @@ 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', [
|
||||
content.items.armor[user.get('items.armor')+1]
|
||||
content.items.weapon[user.get('items.weapon')+1]
|
||||
content.items.potion
|
||||
content.items.reroll
|
||||
]
|
||||
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
|
||||
|
||||
# http://tibia.wikia.com/wiki/Formula
|
||||
model.fn '_tnl', '_user.stats.lvl', (lvl) -> 50 * Math.pow(lvl, 2) - 150 * lvl + 200
|
||||
|
||||
@@ -96,8 +96,11 @@ ready (model) ->
|
||||
if stats.hp?
|
||||
# game over
|
||||
if stats.hp < 0
|
||||
user.set 'stats', { hp: 50, lvl: 1, exp: 0, money: 0 }
|
||||
user.set 'items', { weapon: 1, armor: 1 }
|
||||
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 }
|
||||
else
|
||||
user.set 'stats.hp', stats.hp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user