allow buying when tokens == item.value

This commit is contained in:
Tyler Renelle 2013-05-06 19:51:15 +01:00
parent 9737e0e2a2
commit a0faa3ea05

View file

@ -54,7 +54,7 @@ module.exports.app = (appExports, model) ->
name = $(el).attr 'data-hatchingPotion'
newHatchingPotion = _.findWhere hatchingPotions, name: name
tokens = user.get('balance') * 4
if tokens > newHatchingPotion.value
if tokens >= newHatchingPotion.value
if confirm "Buy this hatching potion with #{newHatchingPotion.value} of your #{tokens} tokens?"
user.push 'items.hatchingPotions', newHatchingPotion.name
user.set 'balance', (tokens - newHatchingPotion.value) / 4
@ -65,7 +65,7 @@ module.exports.app = (appExports, model) ->
name = $(el).attr 'data-egg'
newEgg = _.findWhere pets, name: name
tokens = user.get('balance') * 4
if tokens > newEgg.value
if tokens >= newEgg.value
if confirm "Buy this egg with #{newEgg.value} of your #{tokens} tokens?"
user.push 'items.eggs', newEgg
user.set 'balance', (tokens - newEgg.value) / 4