Fixes #7958 - do not remove Battle Gear equipment when changing class (#8064)

* Changed files to fix Bug 7958:
 - website/client-old/.../userCtrl.js#38: removed to keep inventory constant
 - website/common/.../changeClass.js#33:  removed to stop 'classes' introduction

* Adjustments following Bug Review
 - Removed remaining 'foundKey' logic
 - Adjusted test logic to reflect feature change

* Reverting userCtrl.js to development version
 - Reintroduces "classes" Guide tour

* New version of Fixes #7958
 - Changed logic to only notify user the first time they choose a class
 - Changed message to represent this change in logic
 - #LINT: Cleaned interface for changing class
    - New method: enableClasses() -- because, really, should we be calling User.changeClass({}) from the UX?
    - New method: payForNewClass() -- handles prompting the user to confirm that they want to change class

* Remove new User Flag, use flags.tour.classes

* Whoopsie. Fix PR conflict.

* Changed files to fix Bug 7958:
 - website/client-old/.../userCtrl.js#38: removed to keep inventory constant
 - website/common/.../changeClass.js#33:  removed to stop 'classes' introduction

* Adjustments following Bug Review
 - Removed remaining 'foundKey' logic
 - Adjusted test logic to reflect feature change

* Reverting userCtrl.js to development version
 - Reintroduces "classes" Guide tour

* New version of Fixes #7958
 - Changed logic to only notify user the first time they choose a class
 - Changed message to represent this change in logic
 - #LINT: Cleaned interface for changing class
    - New method: enableClasses() -- because, really, should we be calling User.changeClass({}) from the UX?
    - New method: payForNewClass() -- handles prompting the user to confirm that they want to change class

* Remove new User Flag, use flags.tour.classes

* Whoopsie. Fix PR conflict.

* Removed Extraneous Flag

* Removed Extraneous Flag

* Changed files to fix Bug 7958:
 - website/client-old/.../userCtrl.js#38: removed to keep inventory constant
 - website/common/.../changeClass.js#33:  removed to stop 'classes' introduction

* New version of Fixes #7958
 - Changed logic to only notify user the first time they choose a class
 - Changed message to represent this change in logic
 - #LINT: Cleaned interface for changing class
    - New method: enableClasses() -- because, really, should we be calling User.changeClass({}) from the UX?
    - New method: payForNewClass() -- handles prompting the user to confirm that they want to change class

Remove new User Flag, use flags.tour.classes

Whoopsie. Fix PR conflict.

Removed Extraneous Flag

* Fixes handling architecture change

* Updates following Review 20170418-0602

* Remove cause of mocha/no-exclusive-tests lint failure
This commit is contained in:
CJ
2017-07-20 13:28:53 -04:00
committed by Sabe Jones
parent ca90d88289
commit 605391e4e7
7 changed files with 29 additions and 47 deletions
+10 -8
View File
@@ -23,16 +23,18 @@ habitrpg.controller('UserCtrl', ['$rootScope', '$scope', '$location', 'User', '$
}
$scope.changeClass = function(klass){
if (!klass) {
if (!confirm(window.env.t('sureReset')))
return;
return User.changeClass({});
}
User.changeClass({query:{class:klass}});
$scope.selectedClass = undefined;
Shared.updateStore(User.user);
Guide.goto('classes', 0,true);
Guide.goto('classes', 0, true);
}
$scope.enableClasses = function(){
return User.changeClass({});
}
$scope.payForNewClass = function(){
if (confirm(window.env.t('sureReset'))) return User.changeClass({});
}
$scope.save = function(){
@@ -64,11 +64,15 @@ function($rootScope, User, $timeout, $state, Analytics, Notification, Shared, So
classes: [
[
{
orphan: true,
content: window.env.t('classGearText'),
final: true,
state: 'options.inventory.equipment',
element: '.equipment-tab',
title: window.env.t('classGear'),
content: window.env.t('classGearText')
}, {
hideNavigation: true
}
/*, {
state: 'options.profile.stats',
element: ".allocate-stats",
title: window.env.t('stats'),
@@ -88,7 +92,7 @@ function($rootScope, User, $timeout, $state, Analytics, Notification, Shared, So
title: window.env.t('readMore'),
content: window.env.t('moreClass'),
final: true
}
}*/
]
],
stats: [[
@@ -265,6 +269,7 @@ function($rootScope, User, $timeout, $state, Analytics, Notification, Shared, So
var goto = function(chapter, page, force) {
if (chapter == 'intro' && User.user.flags.welcomed != true) User.set({'flags.welcomed': true});
if (chapter == 'classes' && User.user.flags.tour.classes === -2) return;
if (page === -1) page = 0;
var curr = User.user.flags.tour[chapter];
if (page != curr+1 && !force) return;
@@ -214,7 +214,7 @@ angular.module('habitrpg')
},
changeClass: function (data) {
callOpsFunctionAndRequest('changeClass', 'change-class', "POST",'', data);
callOpsFunctionAndRequest('changeClass', 'change-class', "POST", '', data);
},
disableClasses: function () {