Merge pull request #370 from Alys/gem-cap-message-2014-11-25

make Gold=>Gem conversion cap message more accurate in terms of when to wait until - fixes https://github.com/HabitRPG/habitrpg/issues/3996
This commit is contained in:
Alice Harris 2014-11-27 14:46:23 +10:00
commit 0a4dc94474

View file

@ -697,7 +697,7 @@ api.wrap = (user, main=true) ->
{convRate,convCap} = api.planGemLimits
return cb?({code:401,message:"Must subscribe to purchase gems with GP"},req) unless user.purchased?.plan?.planId
return cb?({code:401,message:"Not enough Gold"}) unless user.stats.gp >= convRate
return cb?({code:401,message:"You've reached the Gold=>Gem conversion cap (#{convCap}) for this month. We have this to prevent abuse / farming, please wait until the beginning of next month."}) if user.purchased.plan.gemsBought >= convCap
return cb?({code:401,message:"You've reached the Gold=>Gem conversion cap (#{convCap}) for this month. We have this to prevent abuse / farming. The cap will reset within the first three days of next month."}) if user.purchased.plan.gemsBought >= convCap
user.balance += .25
user.purchased.plan.gemsBought++
user.stats.gp -= convRate