From 0053dd67bde09e1b7c8b61a8efa2f7fe4d07d7b4 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Fri, 2 Jan 2015 13:20:25 -0600 Subject: [PATCH] Adjusted translation key text, added a new one for releasing both. Added releaseBoth function --- locales/en/pets.json | 3 ++- script/index.coffee | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/locales/en/pets.json b/locales/en/pets.json index dd1c81e4d3..24829ff8ac 100644 --- a/locales/en/pets.json +++ b/locales/en/pets.json @@ -52,7 +52,8 @@ "petKeyInfo2": "The Key to the Kennels resets all of your non-quest pets back to as if you'd never found them. Once you've used it, you'll be able to stack the Beastmaster achievement, showing off how many times you've been able to best the RNG.", "petKeyInfo3": "There are two sets of Keys: you can either just release your pets for four gems or your pets and mounts for eight gems. If you're still working towards getting all of the mounts, you may not want to give them their freedom yet!", "petKeyPets": "Release My Pets", - "petKeyMounts": "Release Both Please", + "petKeyMounts": "Release My Mounts", + "petKeyBoth": "Release Both", "petKeyNeverMind": "Not Yet", "gemsEach": "gems each" } diff --git a/script/index.coffee b/script/index.coffee index b602262893..de2828cff7 100644 --- a/script/index.coffee +++ b/script/index.coffee @@ -760,6 +760,23 @@ api.wrap = (user, main=true) -> user.achievements.mountMasterCount++ cb? null, user + releaseBoth: (req, cb) -> + if user.balance < 1.5 + return cb? {code:401,message: i18n.t('notEnoughGems', req.language)} + else + user.balance -= 1 + user.items.currentMount = "" + for animal of content.pets + user.items.pets[animal] = 0 + delete user.items.mounts[animal] + if not user.achievements.beastMasterCount + user.achievements.beastMasterCount = 0 + user.achievements.beastMasterCount++ + if not user.achievements.mountMasterCount + user.achievements.mountMasterCount = 0 + user.achievements.mountMasterCount++ + cb? null, user + # buy is for gear, purchase is for gem-purchaseables (i know, I know...) buy: (req, cb) -> {key} = req.params