FeedEgg
This commit is contained in:
@@ -78,6 +78,27 @@ module.exports.app = (appExports, model) ->
|
||||
appExports.customizeArmorSet = (e, el) ->
|
||||
user.set 'preferences.armorSet', $(el).attr('data-value')
|
||||
|
||||
appExports.chooseEgg = (e, el) ->
|
||||
egg = model.at el
|
||||
|
||||
model.ref '_feedEgg', egg
|
||||
|
||||
appExports.feedEgg = (e, el) ->
|
||||
food = $(el).children('select').val()
|
||||
foods = user.get 'items.food'
|
||||
egg = model.get '_feedEgg'
|
||||
eggs = user.get 'items.eggs'
|
||||
|
||||
foodIdx = foods.indexOf food
|
||||
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
|
||||
|
||||
user.push 'items.pets', egg.name + '-' + food
|
||||
user.remove 'items.food', foodIdx, 1
|
||||
user.remove 'items.eggs', eggIdx, 1
|
||||
|
||||
appExports.restoreSave = (e, el) ->
|
||||
batch = new BatchUpdate(model)
|
||||
batch.startTransaction()
|
||||
@@ -99,7 +120,6 @@ module.exports.app = (appExports, model) ->
|
||||
content: html
|
||||
$('.main-avatar').popover 'show'
|
||||
|
||||
|
||||
userSchema =
|
||||
# _id
|
||||
stats: { gp: 0, exp: 0, lvl: 1, hp: 50 }
|
||||
|
||||
@@ -46,3 +46,7 @@ module.exports.viewHelpers = (view) ->
|
||||
view.fn "encodeiCalLink", (uid, apiToken) ->
|
||||
loc = window?.location.host or process.env.BASE_URL
|
||||
encodeURIComponent "http://#{loc}/v1/users/#{uid}/calendar.ics?apiToken=#{apiToken}"
|
||||
|
||||
view.fn 'removeWhitespace', (str) ->
|
||||
return '' unless str
|
||||
str.replace /\s/g, ''
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ module.exports.app = (appExports, model) ->
|
||||
if tokens > pet.value
|
||||
r = confirm("Buy this pet with #{pet.value} of your #{tokens} tokens?");
|
||||
if r
|
||||
user.push "items.pets", name
|
||||
user.push 'items.pets', name
|
||||
user.set 'items.currentPet', pet
|
||||
user.set 'balance', (tokens - pet.value)/4
|
||||
else
|
||||
|
||||
@@ -116,15 +116,15 @@ score = (model, taskId, direction, times, batch, cron) ->
|
||||
batch.commit()
|
||||
|
||||
# 1% chance of getting a pet or meat
|
||||
if obj.flags.dropsEnabled and Math.random() < .01
|
||||
if obj.flags.dropsEnabled and Math.random() < .50
|
||||
if Math.random() < .5
|
||||
drop = randomProp(food)
|
||||
user.push 'items.food', drop.name
|
||||
drop.type = 'food'
|
||||
drop.type = 'Food'
|
||||
else
|
||||
drop = randomProp(pets)
|
||||
user.push 'items.eggs', drop
|
||||
drop.type = 'egg'
|
||||
drop.type = 'Egg'
|
||||
|
||||
model.set '_drop', drop
|
||||
$('#item-dropped-modal').modal 'show'
|
||||
|
||||
Reference in New Issue
Block a user