feat(modals): Grew Mount

A modal now appears when you raise a pet into a mount, which allows the user to immediately equip the new mount.
This commit is contained in:
Sabe Jones
2015-10-15 17:33:20 -04:00
parent c6dd2a0d10
commit 338aced208
4 changed files with 33 additions and 2 deletions

View File

@@ -64,6 +64,10 @@
"earnedCompanion": "With all your productivity, you've earned a new companion. Feed it to make it grow!", "earnedCompanion": "With all your productivity, you've earned a new companion. Feed it to make it grow!",
"feedPet": "Feed <%= article %><%= text %> to your <%= name %>?", "feedPet": "Feed <%= article %><%= text %> to your <%= name %>?",
"useSaddle": "Saddle <%= pet %>?", "useSaddle": "Saddle <%= pet %>?",
"raisedPet": "You grew a <%= pet %>!",
"earnedSteed": "By completing your tasks, you've earned a faithful steed!",
"rideNow": "Ride Now",
"rideLater": "Ride Later",
"petName": "<%= potion %> <%= egg %>", "petName": "<%= potion %> <%= egg %>",
"mountName": "<%= potion %> <%= mount %>", "mountName": "<%= potion %> <%= mount %>",
"petKeyName": "Key to the Kennels", "petKeyName": "Key to the Kennels",

View File

@@ -144,8 +144,9 @@ habitrpg.controller("InventoryCtrl",
// Feeding Pet // Feeding Pet
if ($scope.selectedFood) { if ($scope.selectedFood) {
var food = $scope.selectedFood var food = $scope.selectedFood;
if (food.key == 'Saddle') { var startingMounts = $scope.mountCount;
if (food.key === 'Saddle') {
if (!$window.confirm(window.env.t('useSaddle', {pet: petDisplayName}))) return; if (!$window.confirm(window.env.t('useSaddle', {pet: petDisplayName}))) return;
} else if (!$window.confirm(window.env.t('feedPet', {name: petDisplayName, article: food.article, text: food.text()}))) { } else if (!$window.confirm(window.env.t('feedPet', {name: petDisplayName, article: food.article, text: food.text()}))) {
return; return;
@@ -154,6 +155,10 @@ habitrpg.controller("InventoryCtrl",
$scope.selectedFood = null; $scope.selectedFood = null;
_updateDropAnimalCount(user.items); _updateDropAnimalCount(user.items);
if ($scope.mountCount > startingMounts) {
$rootScope.raisedPet = {displayName: petDisplayName, spriteName: pet, egg: egg, potion: potion}
$rootScope.openModal('raisePet', {controller:'InventoryCtrl',size:'sm'});
}
// Checks if mountmaster has been reached for the first time // Checks if mountmaster has been reached for the first time
if(!user.achievements.mountMaster if(!user.achievements.mountMaster

View File

@@ -16,6 +16,7 @@ include ./welcome.jade
include ./low-health.jade include ./low-health.jade
include ./level-up.jade include ./level-up.jade
include ./hatch-pet.jade include ./hatch-pet.jade
include ./raise-pet.jade
//- Settings //- Settings
script(type='text/ng-template', id='modals/change-day-start.html') script(type='text/ng-template', id='modals/change-day-start.html')

View File

@@ -0,0 +1,21 @@
include ../avatar/generated_avatar
script(type='text/ng-template', id='modals/raisePet.html')
.modal-content(style='min-width:28em')
.modal-body.text-center
h3(style='margin-bottom: 0')=env.t('raisedPet',{pet:'{{::raisedPet.displayName}}'})
.container-fluid
.row(style='margin-bottom:1em', ng-controller='UserCtrl')
.col-xs-1
.col-xs-10
.herobox(style='margin:0; padding-top: 0')
.character-sprites(style='width:0; margin-top:.5em')
span(class='Mount_Body_{{::raisedPet.spriteName}}')
span
+generatedAvatar
span(class='Mount_Head_{{::raisedPet.spriteName}}')
p=env.t('earnedSteed')
.modal-footer(style='margin-top:0')
button.btn.btn-primary(ng-click='chooseMount(raisedPet.egg, raisedPet.potion); $close()')=env.t('rideNow')
button.btn.btn-default(ng-click='$close()')=env.t('rideLater')