feat(hourglass): Buy pets/mounts

Functionally complete as of this commit. Further commits will provide more polish and refactoring.
This commit is contained in:
Sabe Jones 2015-09-16 14:35:43 -04:00
parent 25b133c562
commit c8cc01fc44
4 changed files with 27 additions and 13 deletions

View file

@ -1127,8 +1127,12 @@ api.specialMounts =
'Gryphon-RoyalPurple': 'royalPurpleGryphon'
api.timeTravelStable =
pets: ['Mammoth-Base','MantisShrimp-Base']
mounts: ['Mammoth-Base','MantisShrimp-Base']
pets:
'Mammoth-Base': t('mammoth')
'MantisShrimp-Base': t('mantisShrimp')
mounts:
'Mammoth-Base': t('mammoth')
'MantisShrimp-Base': t('mantisShrimp')
api.hatchingPotions =
Base: value: 2, text: t('hatchingPotionBase')

View file

@ -1021,7 +1021,7 @@ api.wrap = (user, main=true) ->
hourglassPurchase: (req, cb, analytics)->
{type, key} = req.params
return cb?({code:403, message:i18n.t('typeNotAllowedHourglass', req.language) + JSON.stringify(_.keys(content.timeTravelStable))}) unless content.timeTravelStable[type]
return cb?({code:403, message:i18n.t(type+'NotAllowedHourglass', req.language)}) unless _.contains(content.timeTravelStable[type], key)
return cb?({code:403, message:i18n.t(type+'NotAllowedHourglass', req.language)}) unless _.contains(_.keys(content.timeTravelStable[type]), key)
return cb?({code:403, message:i18n.t(type+'AlreadyOwned', req.language)}) if user.items[type][key]
return cb?({code:403, message:i18n.t('notEnoughHourglasses', req.language)}) unless user.purchased.plan.consecutive.trinkets > 0
user.purchased.plan.consecutive.trinkets--

View file

@ -197,7 +197,7 @@ module.exports = (swagger, v2) ->
]
action: user.hourglassPurchase
"/user/inventory/hourglass/mysterySet/{key}":
"/user/inventory/hourglass/mystery/{key}":
spec:
method: 'POST'
description: "Purchase a Mystery Item Set using a Mystic Hourglass"

View file

@ -17,12 +17,22 @@
.row: .col-md-7
.alert.alert-info(ng-if='hasAllTimeTravelerItems()')=env.t('timeTravelersAlreadyOwned')
.row: .col-md-12
li.customize-menu.inventory-gear
menu.pets-menu(label='{{::set.text}}', ng-repeat='set in Content.timeTravelerStore(user.items.gear.owned)')
div(ng-repeat='item in set.items')
button.customize-option(class='shop_{{::item.key}}',
popover='{{::item.notes()}}', popover-title='{{::item.text()}}',
popover-trigger='mouseenter', popover-placement='right',
popover-append-to-body='true',
ng-click='user.ops.buyMysterySet({params:{key:set.key}})')
.row
.col-md-12
li.customize-menu.inventory-gear
each prepend, type in {pets:'Pet-', mounts:'Mount_Head_'}
menu.pets-menu(label=env.t('#{type}'))
div(ng-repeat='(item, text) in Content.timeTravelStable["#{type}"]', style='margin-top:0')
button.pet-button(class='#{prepend}{{::item}}', style='margin-top:0',
ng-if='!user.items["#{type}"][item]',
popover='{{::text()}}', popover-trigger='mouseenter',
popover-placement='right', popover-append-to-body='true',
ng-click='user.ops.hourglassPurchase({params:{key:item,type:"#{type}"}})')
li.customize-menu.inventory-gear
menu.pets-menu(label='{{::set.text}}', ng-repeat='set in Content.timeTravelerStore(user.items.gear.owned)')
div(ng-repeat='item in set.items')
button.customize-option(class='shop_{{::item.key}}',
popover='{{::item.notes()}}', popover-title='{{::item.text()}}',
popover-trigger='mouseenter', popover-placement='right',
popover-append-to-body='true',
ng-click='user.ops.buyMysterySet({params:{key:set.key}})')