diff --git a/dist/habitrpg-shared.js b/dist/habitrpg-shared.js index 3d6afa74e9..74cb6fc97d 100644 --- a/dist/habitrpg-shared.js +++ b/dist/habitrpg-shared.js @@ -15062,10 +15062,13 @@ api.wrap = function(user, main) { return typeof cb === "function" ? cb(null, _.pick(user, $w('items stats'))) : void 0; }, purchase: function(req, cb, ga) { - var convCap, convRate, item, key, type, _ref, _ref1, _ref2; + var convCap, convRate, item, key, type, _base, _ref, _ref1, _ref2; _ref = req.params, type = _ref.type, key = _ref.key; if (type === 'gems' && key === 'gem') { convRate = api.planGemLimits.convRate; + if ((_base = user.purchased.plan.consecutive).gemCapExtra == null) { + _base.gemCapExtra = 0; + } convCap = api.planGemLimits + user.purchased.plan.consecutive.gemCapExtra; if (!((_ref1 = user.purchased) != null ? (_ref2 = _ref1.plan) != null ? _ref2.planId : void 0 : void 0)) { return typeof cb === "function" ? cb({ diff --git a/script/index.coffee b/script/index.coffee index c6386868aa..59670c3a83 100644 --- a/script/index.coffee +++ b/script/index.coffee @@ -695,6 +695,7 @@ api.wrap = (user, main=true) -> if type is 'gems' and key is 'gem' {convRate} = api.planGemLimits + user.purchased.plan.consecutive.gemCapExtra ?= 0 #fixme this necessary? convCap = api.planGemLimits + user.purchased.plan.consecutive.gemCapExtra 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