WIP(hourglass): Mystery sets API route

This commit is contained in:
Sabe Jones 2015-09-15 15:41:57 -04:00
parent 2ce52e980d
commit ce764ca28e
3 changed files with 20 additions and 2 deletions

View file

@ -73,5 +73,6 @@
"typeNotAllowedHourglass": "Item type not supported for purchase with Mystic Hourglass. Allowed types: ",
"petsNotAllowedHourglass": "Pet not available for purchase with Mystic Hourglass.",
"mountsNotAllowedHourglass": "Mount not available for purchase with Mystic Hourglass.",
"hourglassPurchase": "Purchased an item using a Mystic Hourglass!"
"hourglassPurchase": "Purchased an item using a Mystic Hourglass!",
"hourglassPurchaseSet": "Purchased an item set using a Mystic Hourglass!"
}

View file

@ -1016,7 +1016,7 @@ api.wrap = (user, main=true) ->
analytics?.track('acquire item', analyticsData)
user.purchased.plan.consecutive.trinkets--
cb? null, _.pick(user,$w 'items purchased.plan.consecutive')
cb? {code:200, message:i18n.t('hourglassPurchaseSet', req.language)}, _.pick(user,$w 'items purchased.plan.consecutive')
hourglassPurchase: (req, cb, analytics)->
{type, key} = req.params
@ -1029,6 +1029,14 @@ api.wrap = (user, main=true) ->
user.items.pets[key] = 5
if type is 'mounts'
user.items.mounts[key] = true
analyticsData = {
uuid: user._id,
itemKey: key,
itemType: type,
acquireMethod: 'Hourglass',
category: 'behavior'
}
analytics?.track('acquire item', analyticsData)
cb? {code:200, message:i18n.t('hourglassPurchase', req.language)}, _.pick(user,$w 'items purchased.plan.consecutive')
sell: (req, cb) ->

View file

@ -197,6 +197,15 @@ module.exports = (swagger, v2) ->
]
action: user.hourglassPurchase
"/user/inventory/hourglass/mysterySet/{key}"
spec:
method: 'POST'
description: "Purchase a Mystery Item Set using a Mystic Hourglass"
parameters:[
path('key',"The key for the Mystery Set you're purchasing (call /content route for available keys)",'string')
]
action: user.buyMysterySet
"/user/inventory/feed/{pet}/{food}":
spec:
method: 'POST'