Ported User Serivce to client side and to api v3

This commit is contained in:
Keith Holliday
2016-05-05 13:02:56 -05:00
parent 9146e4601e
commit b037ddd14c
16 changed files with 474 additions and 331 deletions

View File

@@ -17,17 +17,17 @@ habitrpg.controller("UserCtrl", ['$rootScope', '$scope', '$location', 'User', '$
});
$scope.allocate = function(stat){
User.user.ops.allocate({query:{stat:stat}});
User.allocate({query:{stat:stat}});
}
$scope.changeClass = function(klass){
if (!klass) {
if (!confirm(window.env.t('sureReset')))
return;
return User.user.ops.changeClass({});
return User.changeClass({});
}
User.user.ops.changeClass({query:{class:klass}});
User.changeClass({query:{class:klass}});
$scope.selectedClass = undefined;
Shared.updateStore(User.user);
Guide.goto('classes', 0,true);
@@ -46,7 +46,7 @@ habitrpg.controller("UserCtrl", ['$rootScope', '$scope', '$location', 'User', '$
}
$scope.acknowledgeHealthWarning = function(){
User.user.ops.update && User.set({'flags.warnedLowHealth':true});
User.set({'flags.warnedLowHealth':true});
}
/**
@@ -69,7 +69,7 @@ habitrpg.controller("UserCtrl", ['$rootScope', '$scope', '$location', 'User', '$
if (confirm(window.env.t('purchaseFor',{cost:cost*4})) !== true) return;
if (User.user.balance < cost) return $rootScope.openModal('buyGems');
}
User.user.ops.unlock({query:{path:path}})
User.unlock({query:{path:path}})
}
$scope.ownsSet = function(type,_set) {