mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 03:30:25 +00:00
allow buying when tokens == item.value
This commit is contained in:
parent
9737e0e2a2
commit
a0faa3ea05
1 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue