Merge branch 'develop' into api-v3
This commit is contained in:
@@ -5,6 +5,8 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
||||
// challenge
|
||||
$scope.cid = $state.params.cid;
|
||||
|
||||
$scope.groupIdFilter = $stateParams.groupIdFilter;
|
||||
|
||||
_getChallenges();
|
||||
|
||||
// FIXME $scope.challenges needs to be resolved first (see app.js)
|
||||
@@ -325,6 +327,21 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
||||
});
|
||||
};
|
||||
|
||||
$scope.filterInitialChallenges = function() {
|
||||
$scope.groupsFilter = _.uniq(_.pluck($scope.challenges, 'group'), function(g){return g._id});
|
||||
$scope.search = {
|
||||
group: _.transform($scope.groups, function(m,g){m[g._id]=true;}),
|
||||
_isMember: "either",
|
||||
_isOwner: "either"
|
||||
};
|
||||
//If we game from a group, then override the filter to that group
|
||||
|
||||
if ($scope.groupIdFilter) {
|
||||
$scope.search.group = {};
|
||||
$scope.search.group[$scope.groupIdFilter] = true ;
|
||||
}
|
||||
}
|
||||
|
||||
function _calculateMaxPrize(gid) {
|
||||
|
||||
var userBalance = User.getBalanceInGems() || 0;
|
||||
@@ -375,12 +392,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
||||
} else {
|
||||
Challenges.Challenge.query(function(challenges){
|
||||
$scope.challenges = challenges;
|
||||
$scope.groupsFilter = _.uniq(_.pluck(challenges, 'group'), function(g){return g._id});
|
||||
$scope.search = {
|
||||
group: _.transform($scope.groups, function(m,g){m[g._id]=true;}),
|
||||
_isMember: "either",
|
||||
_isOwner: "either"
|
||||
};
|
||||
$scope.filterInitialChallenges();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -114,8 +114,12 @@ habitrpg.controller("InventoryCtrl",
|
||||
var eggName = Content.eggs[egg.key].text();
|
||||
var potName = Content.hatchingPotions[potion.key].text();
|
||||
if (!$window.confirm(window.env.t('hatchAPot', {potion: potName, egg: eggName}))) return;
|
||||
|
||||
var userHasPet = user.items.pets[egg.key + '-' + potion.key];
|
||||
|
||||
user.ops.hatch({params:{egg:egg.key, hatchingPotion:potion.key}});
|
||||
if (!user.preferences.suppressModals.hatchPet) {
|
||||
|
||||
if (!user.preferences.suppressModals.hatchPet && !userHasPet) {
|
||||
$scope.hatchedPet = {
|
||||
egg: eggName,
|
||||
potion: potName,
|
||||
@@ -159,7 +163,7 @@ habitrpg.controller("InventoryCtrl",
|
||||
// Feeding Pet
|
||||
if ($scope.selectedFood) {
|
||||
var food = $scope.selectedFood;
|
||||
var startingMounts = Stats.totalCount(user.items.mounts);
|
||||
var startingMounts = $rootScope.countExists(user.items.mounts);
|
||||
if (food.key === 'Saddle') {
|
||||
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()}))) {
|
||||
@@ -169,7 +173,7 @@ habitrpg.controller("InventoryCtrl",
|
||||
$scope.selectedFood = null;
|
||||
|
||||
_updateDropAnimalCount(user.items);
|
||||
if (Stats.totalCount(user.items.mounts) > startingMounts && !user.preferences.suppressModals.raisePet) {
|
||||
if ($rootScope.countExists(user.items.mounts) > startingMounts && !user.preferences.suppressModals.raisePet) {
|
||||
$scope.raisedPet = {
|
||||
displayName: petDisplayName,
|
||||
spriteName: pet,
|
||||
|
||||
Reference in New Issue
Block a user