From dab9ddbda27f5e10e4545fea703deebfe2dd9975 Mon Sep 17 00:00:00 2001 From: Cole Gleason Date: Sun, 2 Feb 2014 01:51:51 -0600 Subject: [PATCH] fix(quests): quests with a level cap cannot be bought before that level. Users were buying the vice quest hoping to play it, not realizing it would drop at that level. Let's restrict buying the quest (at least in the short term) until you reach that level. Fixes #2707. --- public/js/controllers/inventoryCtrl.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/js/controllers/inventoryCtrl.js b/public/js/controllers/inventoryCtrl.js index 6d769ca47f..122295ddb9 100644 --- a/public/js/controllers/inventoryCtrl.js +++ b/public/js/controllers/inventoryCtrl.js @@ -142,6 +142,8 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', '$window', 'User', } $scope.buyQuest = function(quest) { var item = Content.quests[quest]; + if (item.lvl && item.lvl > user.stats.lvl) + return alert("You must be level " + item.lvl + ' to buy this quest!'); var completedPrevious = !item.previous || (User.user.achievements.quests && User.user.achievements.quests[item.previous]); if (!completedPrevious) return $scope.purchase("quests", item);