feat(event): Implement Seasonal Shop

This commit is contained in:
Sabe Jones
2014-12-25 14:33:11 -06:00
parent a8459c2f96
commit 0e28f04c90
2 changed files with 22 additions and 9 deletions
+12 -6
View File
@@ -87,16 +87,22 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', '$window', 'User',
}
$scope.purchase = function(type, item){
if (item.key=='spookDust') return User.user.ops.buySpookDust({});
var gems = User.user.balance * 4;
if(gems < item.value) return $rootScope.openModal('buyGems');
var string = (type == 'hatchingPotions') ? window.env.t('hatchingPotion') : (type == 'eggs') ? window.env.t('eggSingular') : (type == 'quests') ? window.env.t('quest') : (item.key == 'Saddle') ? window.env.t('foodSaddleText').toLowerCase() : (type == 'special') ? item.key : type; // this is ugly but temporary, once the purchase modal is done this will be removed
var message = window.env.t('buyThis', {text: string, price: item.value, gems: gems})
var string = (type == 'weapon') ? window.env.t('weapon') : (type == 'armor') ? window.env.t('armor') : (type == 'head') ? window.env.t('headgear') : (type == 'shield') ? window.env.t('offhand') : (type == 'hatchingPotions') ? window.env.t('hatchingPotion') : (type == 'eggs') ? window.env.t('eggSingular') : (type == 'quests') ? window.env.t('quest') : (item.key == 'Saddle') ? window.env.t('foodSaddleText').toLowerCase() : type; // this is ugly but temporary, once the purchase modal is done this will be removed
if (type == 'weapon' || type == 'armor' || type == 'head' || type == 'shield') {
if (gems < ((item.specialClass == "wizard") && (item.type == "weapon")) + 1) return $rootScope.openModal('buyGems');
var message = window.env.t('buyThis', {text: string, price: ((item.specialClass == "wizard") && (item.type == "weapon")) + 1, gems: gems})
if($window.confirm(message))
User.user.ops.purchase({params:{type:"gear",key:item.key}});
} else {
if(gems < item.value) return $rootScope.openModal('buyGems');
var message = window.env.t('buyThis', {text: string, price: item.value, gems: gems})
if($window.confirm(message))
User.user.ops.purchase({params:{type:type,key:item.key}});
}
if($window.confirm(message))
User.user.ops.purchase({params:{type:type,key:item.key}});
}
$scope.choosePet = function(egg, potion){
+10 -3
View File
@@ -23,13 +23,20 @@ script(type='text/ng-template', id='partials/options.inventory.seasonalshop.html
.container-fluid
.stable.row
.col-md-2
.seasonalshop_closed
.seasonalshop_winter2015
.col-md-10
.popover.static-popover.fade.right.in
.arrow
h3.popover-title!=env.t('seasonalShopClosedTitle', {linkStart:"<a href='http://blog.habitrpg.com/who' target='_blank'>", linkEnd: "</a>"})
h3.popover-title!=env.t('seasonalShopTitle', {linkStart:"<a href='http://blog.habitrpg.com/who' target='_blank'>", linkEnd: "</a>"})
.popover-content
p!=env.t('seasonalShopClosedText', {linkStart: "<a href='http://habitrpg.wikia.com/wiki/Grand_Galas' target='_blank'>", linkEnd: "</a>"})
p!=env.t('seasonalShopText')
li.customize-menu.inventory-gear
menu(label='{{::label}}', ng-repeat='(set,label) in {candycane:env.t("candycaneSet"), ski:env.t("skiSet"), snowflake:env.t("snowflakeSet"), yeti:env.t("yetiSet")}')
div(ng-repeat='item in Content.gear.flat | toArray | where:{index:set}')
button.customize-option(popover='{{::item.notes()}}', popover-title='{{::item.text()}}', popover-trigger='mouseenter', popover-placement='right', ng-click='purchase(item.type,item)', class='shop_{{::item.key}}')
.center
| {{((item.specialClass == "wizard") && (item.type == "weapon")) + 1}}&nbsp;
span.Pet_Currency_Gem1x.inline-gems
script(type='text/ng-template', id='partials/options.inventory.timetravelers.html')
.container-fluid