diff --git a/common/locales/en/content.json b/common/locales/en/content.json index bf95afddb9..ffe1e85eae 100644 --- a/common/locales/en/content.json +++ b/common/locales/en/content.json @@ -3,8 +3,8 @@ "potionNotes": "Recover 15 Health (Instant Use)", "armoireText": "Enchanted Armoire", - "armoireNotesFull": "Open the Armoire to randomly receive special Equipment, Experience, or food!", - "armoireNotesEmpty": "The Enchanted Armoire will have more Equipment soon. Keep clicking for Experience and Food!", + "armoireNotesFull": "Open the Armoire to randomly receive special equipment, Experience, or food!", + "armoireNotesEmpty": "The Enchanted Armoire will have new Equipment every month. Until then, keep clicking for Experience and Food!", "dropEggWolfText": "Wolf", "dropEggWolfAdjective": "loyal", diff --git a/common/locales/en/messages.json b/common/locales/en/messages.json index e4a900c46a..912599b13a 100644 --- a/common/locales/en/messages.json +++ b/common/locales/en/messages.json @@ -21,7 +21,7 @@ "messageDropEgg": "You've found a <%= dropText %> Egg! <%= dropNotes %>", "messageDropPotion": "You've found a <%= dropText %> Hatching Potion! <%= dropNotes %>", "messageFoundQuest": "You've found the quest \"<%= questText %>\"!", - "armoireEquipment": "<%= image %> You found a piece of rare Equipment in the Armoire: <%= dropText %>! Awesome!", + "armoireEquipment": "<%= image %> You found a piece of rare Equipment in the Armoire: <%= dropText %>! Awesome! There are <%= count %> pieces left.", "armoireFood": "<%= image %> You rummage in the Armoire and find <%= dropArticle %><%= dropText %>. What's that doing in here?", "armoireExp": "You wrestle with the Armoire and gain Experience. Take that!" } diff --git a/common/script/content.coffee b/common/script/content.coffee index 2296ab8f9b..0a307b6cde 100644 --- a/common/script/content.coffee +++ b/common/script/content.coffee @@ -494,7 +494,7 @@ api.timeTravelerStore = (owned) -> ### api.potion = type: 'potion', text: t('potionText'), notes: t('potionNotes'), value: 25, key: 'potion' -api.armoire = type: 'armoire', text: t('armoireText'), notes: t('armoireNotesFull'), value: 100, key: 'armoire', canOwn: ((u)-> _.contains(u.achievements.ultimateGearSets, true)) +api.armoire = type: 'armoire', text: t('armoireText'), notes: t('armoireNotesEmpty'), value: 100, key: 'armoire', canOwn: ((u)-> _.contains(u.achievements.ultimateGearSets, true)) ### --------------------------------------------------------------- diff --git a/common/script/index.coffee b/common/script/index.coffee index 7bef7a8348..1b80e4dd10 100644 --- a/common/script/index.coffee +++ b/common/script/index.coffee @@ -362,6 +362,10 @@ api.countTriad = (pets) -> if pets[egg + "-" + potion] > 0 then count3++ count3 +api.countArmoire = (gear) -> + count4 = _.size(_.filter(content.gear.flat, ((i)->i.klass is 'armoire' and !gear[i.key]))) + count4 + ### ------------------------------------------------------ User (prototype wrapper to give it ops, helper funcs, and virtuals @@ -852,7 +856,7 @@ api.wrap = (user, main=true) -> drop = user.fns.randomVal(eligibleEquipment) user.items.gear.owned[drop.key] = true user.flags.armoireOpened = true - message = i18n.t('armoireEquipment', {image: '', dropText: drop.text(req.language)}, req.language) + message = i18n.t('armoireEquipment', {image: '', dropText: drop.text(req.language), count: api.countArmoire(user.items.gear.owned)}, req.language) else if (!_.isEmpty(eligibleEquipment) and armoireResult < .85) or armoireResult < .6 drop = user.fns.randomVal _.where(content.food, {canDrop:true}) user.items.food[drop.key] ?= 0 diff --git a/test/common/algos.mocha.coffee b/test/common/algos.mocha.coffee index c62cf7e5ef..5b193efb0e 100644 --- a/test/common/algos.mocha.coffee +++ b/test/common/algos.mocha.coffee @@ -494,6 +494,10 @@ describe 'User', -> result ) + it 'counts all available equipment before any are claimed', -> + sinon.stub(user.fns, 'predictableRandom').returns 0 + expect(shared.countArmoire(user.items.gear.owned)).to.eql (_.size(fullArmoire) - 1) + it 'does not open without paying', -> sinon.stub(user.fns, 'predictableRandom').returns 0 user.ops.buy({params: {key: 'armoire'}}) @@ -516,6 +520,7 @@ describe 'User', -> user.achievements.ultimateGearSets = {'healer':false,'wizard':false,'rogue':true,'warrior':false} user.ops.buy({params: {key: 'armoire'}}) expect(user.items.gear.owned).to.eql {'weapon_warrior_0': true, 'shield_armoire_gladiatorShield':true} + expect(shared.countArmoire(user.items.gear.owned)).to.eql (_.size(fullArmoire) - 2) expect(user.items.food).to.eql {} expect(user.stats.exp).to.eql 0 expect(user.stats.gp).to.eql 400 @@ -540,6 +545,7 @@ describe 'User', -> sinon.stub(user.fns, 'predictableRandom', cycle [.6,.5]) user.ops.buy({params: {key: 'armoire'}}) expect(user.items.gear.owned).to.eql {'weapon_warrior_0': true, 'shield_armoire_gladiatorShield':true,'head_armoire_rancherHat':true} + expect(shared.countArmoire(user.items.gear.owned)).to.eql (_.size(fullArmoire) - 3) expect(user.items.food).to.eql {'Honey': 1} expect(user.stats.exp).to.eql 30 expect(user.stats.gp).to.eql 100 @@ -549,6 +555,7 @@ describe 'User', -> user.items.gear.owned = fullArmoire user.ops.buy({params: {key: 'armoire'}}) expect(user.items.gear.owned).to.eql fullArmoire + expect(shared.countArmoire(user.items.gear.owned)).to.eql 0 expect(user.items.food).to.eql {'Honey': 1} expect(user.stats.exp).to.eql 60 expect(user.stats.gp).to.eql 0 diff --git a/website/public/js/controllers/rootCtrl.js b/website/public/js/controllers/rootCtrl.js index 53e802a0b7..4006a9e4e6 100644 --- a/website/public/js/controllers/rootCtrl.js +++ b/website/public/js/controllers/rootCtrl.js @@ -34,6 +34,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ $rootScope.Groups = Groups; $rootScope.toJson = angular.toJson; $rootScope.Payments = Payments; + $rootScope.armoireCount = Shared.countArmoire(User.user.items.gear.owned); // Angular UI Router $rootScope.$state = $state; diff --git a/website/views/shared/tasks/lists.jade b/website/views/shared/tasks/lists.jade index 73567ff2cc..ef0fa8aec2 100644 --- a/website/views/shared/tasks/lists.jade +++ b/website/views/shared/tasks/lists.jade @@ -126,7 +126,7 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template") // Static Rewards ul.items.rewards(ng-if='main && list.type=="reward"') - li.task.reward-item(ng-repeat='item in itemStore',popover-trigger='mouseenter', popover-placement='top', popover='{{item.notes()}}') + li.task.reward-item(ng-repeat='item in itemStore',popover-trigger='mouseenter', popover-placement='top', popover='{{item.key == "armoire" && armoireCount > 0 ? env.t("armoireNotesFull") : item.notes()}}') // right-hand side control buttons .task-meta-controls span.task-notes