purchasing weapons & armor now updates the images

This commit is contained in:
Tyler Renelle 2012-07-08 19:37:36 -04:00
parent 3305697a4e
commit ecc3bdee2d
24 changed files with 37 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -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."}

View file

@ -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

View file

@ -88,12 +88,25 @@ li:hover .task-meta-controls .hover-show
background-color: #DEE5F2
#character
img
width: 60px
td#avatar
vertical-align: top
text-align: center
.avatar-sprites
position: relative
.weapon
position: absolute
z-index: 200
left: -13px
bottom: 7px
.weapon-0
left: -7px
.weapon-5
left: -16px
.weapon-6
left:-20px
td#bars
padding: 10px 0 0 10px
@ -118,8 +131,6 @@ footer.footer
.item-store-popover img
float:left
padding-right:7px;
.item .task-text img
max-height: 16px

View file

@ -11,7 +11,10 @@
<table id="character">
<tr>
<td id="avatar">
<img src="/img/avatar/{_user.stats.lvl}.png" /><br/>
<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" />
</div>
<div id="lvl"><span class="badge badge-info">Lvl: {_user.stats.lvl}</span></div>
</td>
<td id="bars">