release pets feature

This commit is contained in:
deilann 2014-09-29 15:11:24 -07:00
parent 2445ff33ca
commit 2054d10de2
3 changed files with 40 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -29,6 +29,7 @@
"beastAchievement": "You have earned the \"Beast Master\" Achievement for collecting all the pets!",
"beastMastName": "Beast Master",
"beastMastText": "Has found all 90 pets (insanely difficult, congratulate this user!)",
"beastMastText2": " and has released their pets a total of <%= count %> times",
"dropsEnabled": "Drops Enabled!",
"itemDrop": "An item has dropped!",
"firstDrop": "You've unlocked the Drop System! Now when you complete tasks, you have a small chance of finding an item. You just found a <strong><%= eggText %> Egg</strong>! <%= eggNotes %>",
@ -37,5 +38,15 @@
"feedPet": "Feed <%= article %><%= text %> to your <%= name %>?",
"useSaddle": "Saddle <%= pet %>?",
"petName": "<%= potion %> <%= egg %>",
"mountName": "<%= potion %> <%= mount %>"
"mountName": "<%= potion %> <%= mount %>",
"petKeyName": "Key to the Kennels",
"petKeyPop": "Let your pets roam free, release them to start their own adventure, and give yourself the thrill of Beastmaster once more!",
"petKeyBegin": "Key to the Kennels: Experience Beastmaster Once More!",
"petKeyInfo": "Love your pets enough to let them go, and have drops feel meaningful again.",
"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",
"petKeyNeverMind": "Not Yet",
"gemsEach": "gems each"
}

View file

@ -642,6 +642,34 @@ api.wrap = (user, main=true) ->
cb? null, _.pick(user,$w 'items balance')
ga?.event('purchase', key).send()
release: (req, cb) ->
if user.balance < 1
return cb? {code:401,message: i18n.t('notEnoughGems', req.language)}
else
user.balance--
for pet of content.pets
user.items.pets[pet] = 0
if not user.achievements.beastMasterCount
user.achievements.beastMasterCount = 0
user.achievements.beastMasterCount++
user.items.currentPet = ""
cb? null, user
release2: (req, cb) ->
if user.balance < 2
return cb? {code:401,message: i18n.t('notEnoughGems', req.language)}
else
user.balance -= 2
user.items.currentMount = ""
user.items.currentPet = ""
for pet of content.pets
user.items.mounts[pet] = false
user.items.pets[pet] = 0
if not user.achievements.beastMasterCount
user.achievements.beastMasterCount = 0
user.achievements.beastMasterCount++
cb? null, user
# buy is for gear, purchase is for gem-purchaseables (i know, I know...)
buy: (req, cb) ->
{key} = req.params