mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-04-14 19:56:23 +00:00
WIP(hourglass): Mystery sets API route
This commit is contained in:
parent
2ce52e980d
commit
ce764ca28e
3 changed files with 20 additions and 2 deletions
|
|
@ -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!"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) ->
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Reference in a new issue