pets: bug fix for can't feed pet
This commit is contained in:
+2
-1
@@ -29,13 +29,14 @@ module.exports.app = (appExports, model) ->
|
||||
myFood = user.get 'items.food'
|
||||
egg = model.get '_feedEgg'
|
||||
eggs = user.get 'items.eggs'
|
||||
pets = user.get 'items.pets'
|
||||
|
||||
foodIdx = myFood.indexOf foodName
|
||||
eggIdx = eggs.indexOf egg
|
||||
|
||||
return alert "You don't own that food :\\" if foodIdx is -1
|
||||
return alert "You don't own that egg :\\" if eggIdx is -1
|
||||
return alert "You already have that pet." if user.get('items.pets').indexOf("#{egg.name}-#{foodName}") != -1
|
||||
return alert "You already have that pet." if pets and pets.indexOf("#{egg.name}-#{foodName}") != -1
|
||||
|
||||
user.push 'items.pets', egg.name + '-' + foodName
|
||||
|
||||
|
||||
Reference in New Issue
Block a user