From 334393d33be7629703416eb2221fddf9754fb7de Mon Sep 17 00:00:00 2001 From: Kevin Gisi Date: Wed, 25 Mar 2015 11:48:38 -0400 Subject: [PATCH] Make Key to the Kennels free for Triad Bingoers. * Updated logic in `common/script/index.coffee` to accept Triad Bingo achievement in lieu of gems. * Removed Gem cost on inventory page if user has achievement. * Updated Key to the Kennels modal to hide "Buy Gems" button if user has achievement. * Removed Gem costs from buttons if user has achievement. * Added new copy for Key to the Kennels modal that omits gem prices if the user has the achievement. --- common/dist/scripts/habitrpg-shared.js | 18 ++++++---- common/locales/en/pets.json | 1 + common/script/index.coffee | 17 ++++++---- .../views/options/inventory/inventory.jade | 2 +- website/views/shared/modals/drops.jade | 33 +++++++++++-------- 5 files changed, 43 insertions(+), 28 deletions(-) diff --git a/common/dist/scripts/habitrpg-shared.js b/common/dist/scripts/habitrpg-shared.js index 692c079949..ac1e95b47a 100644 --- a/common/dist/scripts/habitrpg-shared.js +++ b/common/dist/scripts/habitrpg-shared.js @@ -6172,13 +6172,15 @@ api.wrap = function(user, main) { }, releasePets: function(req, cb) { var pet; - if (user.balance < 1) { + if (user.balance < 1 && !user.achievements.triadBingo) { return typeof cb === "function" ? cb({ code: 401, message: i18n.t('notEnoughGems', req.language) }) : void 0; } else { - user.balance--; + if (!user.achievements.triadBingo) { + user.balance -= 1; + } for (pet in content.pets) { user.items.pets[pet] = 0; } @@ -6192,13 +6194,15 @@ api.wrap = function(user, main) { }, releaseMounts: function(req, cb) { var mount; - if (user.balance < 1) { + if (user.balance < 1 && !user.achievements.triadBingo) { return typeof cb === "function" ? cb({ code: 401, message: i18n.t('notEnoughGems', req.language) }) : void 0; } else { - user.balance -= 1; + if (!user.achievements.triadBingo) { + user.balance -= 1; + } user.items.currentMount = ""; for (mount in content.pets) { user.items.mounts[mount] = null; @@ -6212,14 +6216,16 @@ api.wrap = function(user, main) { }, releaseBoth: function(req, cb) { var animal, giveTriadBingo; - if (user.balance < 1.5) { + if (user.balance < 1.5 && !user.achievements.triadBingo) { return typeof cb === "function" ? cb({ code: 401, message: i18n.t('notEnoughGems', req.language) }) : void 0; } else { giveTriadBingo = true; - user.balance -= 1.5; + if (!user.achievements.triadBingo) { + user.balance -= 1.5; + } user.items.currentMount = ""; user.items.currentPet = ""; for (animal in content.pets) { diff --git a/common/locales/en/pets.json b/common/locales/en/pets.json index 68f13bfe95..1518b832d8 100644 --- a/common/locales/en/pets.json +++ b/common/locales/en/pets.json @@ -56,6 +56,7 @@ "petKeyInfo": "Miss the thrill of collecting pets? Now you can let them go, and have those drops be meaningful again!", "petKeyInfo2": "Use the Key to the Kennels to reset your non-quest collectible pets and/or mounts to zero. (Quest-only and Rare pets and mounts are not affected.)", "petKeyInfo3": "There are three Keys to the Kennels: Release Pets Only (4 Gems), Release Mounts Only (4 Gems), or Release Both Pets and Mounts (6 Gems). Using a Key lets you stack the Beast Master and Mount Master achievements. The Triad Bingo achievement will only stack if you use the \"Release Both Pets and Mounts\" key and have collected all 90 pets a second time. Show the world just how much of collection master you are! But choose wisely, because once you use a Key and open the kennel or stable doors, you won't be able to get them back without collecting them all again...", + "petKeyInfo4": "There are three Keys to the Kennels: Release Pets Only, Release Mounts Only, or Release Both Pets and Mounts. Using a Key lets you stack the Beast Master and Mount Master achievements. The Triad Bingo achievement will only stack if you use the \"Release Both Pets and Mounts\" key and have collected all 90 pets a second time. Show the world just how much of collection master you are! But choose wisely, because once you use a Key and open the kennel or stable doors, you won't be able to get them back without collecting them all again...", "petKeyPets": "Release My Pets", "petKeyMounts": "Release My Mounts", "petKeyBoth": "Release Both", diff --git a/common/script/index.coffee b/common/script/index.coffee index 922c38aa65..00de9ed4d7 100644 --- a/common/script/index.coffee +++ b/common/script/index.coffee @@ -675,7 +675,7 @@ api.wrap = (user, main=true) -> # Generate pet display name variable potionText = if content.hatchingPotions[potion] then content.hatchingPotions[potion].text() else potion eggText = if content.eggs[egg] then content.eggs[egg].text() else egg - petDisplayName = i18n.t('petName', { + petDisplayName = i18n.t('petName', { potion: potionText egg: eggText }) @@ -752,10 +752,11 @@ api.wrap = (user, main=true) -> ga?.event('purchase', key).send() releasePets: (req, cb) -> - if user.balance < 1 + if user.balance < 1 and not user.achievements.triadBingo return cb? {code:401,message: i18n.t('notEnoughGems', req.language)} else - user.balance-- + if not user.achievements.triadBingo + user.balance -= 1 for pet of content.pets user.items.pets[pet] = 0 if not user.achievements.beastMasterCount @@ -765,10 +766,11 @@ api.wrap = (user, main=true) -> cb? null, user releaseMounts: (req, cb) -> - if user.balance < 1 + if user.balance < 1 and not user.achievements.triadBingo return cb? {code:401,message: i18n.t('notEnoughGems', req.language)} else - user.balance -= 1 + if not user.achievements.triadBingo + user.balance -= 1 user.items.currentMount = "" for mount of content.pets user.items.mounts[mount] = null @@ -778,11 +780,12 @@ api.wrap = (user, main=true) -> cb? null, user releaseBoth: (req, cb) -> - if user.balance < 1.5 + if user.balance < 1.5 and not user.achievements.triadBingo return cb? {code:401,message: i18n.t('notEnoughGems', req.language)} else giveTriadBingo = true - user.balance -= 1.5 + if not user.achievements.triadBingo + user.balance -= 1.5 user.items.currentMount = "" user.items.currentPet = "" for animal of content.pets diff --git a/website/views/options/inventory/inventory.jade b/website/views/options/inventory/inventory.jade index a5a5d599c9..004c294da8 100644 --- a/website/views/options/inventory/inventory.jade +++ b/website/views/options/inventory/inventory.jade @@ -238,7 +238,7 @@ script(type='text/ng-template', id='partials/options.inventory.drops.html') span.Pet_Currency_Gem1x.inline-gems div(ng-show='petCount >= 90 || mountCount >= 90') button.customize-option(popover=env.t('petKeyPop'), popover-title=env.t('petKeyName'), popover-trigger='mouseenter', popover-placement='top', popover-append-to-body='true', ng-click='openModal("pet-key", {size:"lg"})', class='pet_key') - p + p(ng-show='!user.achievements.triadBingo') | 4  span.Pet_Currency_Gem1x.inline-gems div(ng-if='user.purchased.plan.customerId', ng-class='::{transparent:(Shared.planGemLimits.convCap + User.user.purchased.plan.consecutive.gemCapExtra - User.user.purchased.plan.gemsBought) < 1}') diff --git a/website/views/shared/modals/drops.jade b/website/views/shared/modals/drops.jade index ffba52e088..354e7995d3 100644 --- a/website/views/shared/modals/drops.jade +++ b/website/views/shared/modals/drops.jade @@ -1,4 +1,4 @@ -script(type='text/ng-template', id='modals/dropsEnabled.html') +script(type='text/ng-template', id='modals/dropsEnabled.html') .modal-header h4=env.t('dropsEnabled') .modal-body @@ -16,36 +16,41 @@ script(type='text/ng-template', id='modals/dropsEnabled.html') script(type='text/ng-template', id='modals/pet-key.html') .modal-header - // Checks if user has 90 pets and 90 mounts. If so, displays "Beast Master/Mount Master". + // Checks if user has 90 pets and 90 mounts. If so, displays "Beast Master/Mount Master". // Else if user has 90 pets, displays "Beast Master". Else, displays "Mount Master" - var masterTitle='{{petCount >= 90 && mountCount >= 90 ? env.t("beastMountMasterName") : petCount >= 90 ? env.t("beastMasterName") : env.t("mountMasterName")}}' h4=env.t('petKeyBegin', {title: masterTitle}) .modal-body - +gemButton + div(ng-if='!user.achievements.triadBingo') + +gemButton figure .npc_matt p=env.t('petKeyInfo') br p=env.t('petKeyInfo2') br - p=env.t('petKeyInfo3') + p(ng-if='user.achievements.triadBingo')=env.t('petKeyInfo4') + p(ng-if='!user.achievements.triadBingo')=env.t('petKeyInfo3') .modal-footer button.btn.btn-default(ng-click='$close()')=env.t('petKeyNeverMind') - span(ng-if='user.balance < 1') + span(ng-if='user.balance < 1 && !user.achievements.triadBingo') a.btn.btn-success(ng-click='openModal("buyGems")')=env.t('buyMoreGems') span.gem-cost=env.t('notEnoughGems') - span(ng-if='user.balance >= 1 && petCount >= 90', ng-controller='SettingsCtrl') + span(ng-if='(user.balance >= 1 || user.achievements.triadBingo) && petCount >= 90', ng-controller='SettingsCtrl') a.btn.btn-danger(ng-click='$close(); releasePets()') =env.t('petKeyPets') - | : 4  - span.Pet_Currency_Gem1x.inline-gems - span(ng-if='user.balance >= 1 && mountCount >= 90', ng-controller='SettingsCtrl') + span(ng-if='!user.achievements.triadBingo') + | : 4  + span.Pet_Currency_Gem1x.inline-gems + span(ng-if='(user.balance >= 1 || user.achievements.triadBingo) && mountCount >= 90', ng-controller='SettingsCtrl') a.btn.btn-danger(ng-click='$close(); releaseMounts()') =env.t('petKeyMounts') - | : 4  - span.Pet_Currency_Gem1x.inline-gems - span(ng-if='user.balance >= 1.5 && petCount >= 90 && mountCount >= 90', ng-controller='SettingsCtrl') + span(ng-if='!user.achievements.triadBingo') + | : 4  + span.Pet_Currency_Gem1x.inline-gems + span(ng-if='(user.balance >= 1.5 || user.achievements.triadBingo) && petCount >= 90 && mountCount >= 90', ng-controller='SettingsCtrl') a.btn.btn-danger(ng-click='$close(); releaseBoth()') =env.t('petKeyBoth') - | : 6  - span.Pet_Currency_Gem1x.inline-gems + span(ng-if='!user.achievements.triadBingo') + | : 6  + span.Pet_Currency_Gem1x.inline-gems