mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-13 17:52:22 +00:00
API rejects spell cast if not enough mana
Fix #3493 “API does not validate if user has enough mana”
This commit is contained in:
parent
b2ef756443
commit
6b7925b227
1 changed files with 1 additions and 0 deletions
|
|
@ -302,6 +302,7 @@ api.cast = function(req, res, next) {
|
|||
var klass = shared.content.spells.special[req.params.spell] ? 'special' : user.stats.class
|
||||
var spell = shared.content.spells[klass][req.params.spell];
|
||||
if (!spell) return res.json(404, {err: 'Spell "' + req.params.spell + '" not found.'});
|
||||
if (spell.mana > user.stats.mp) return res.json(400, {err: 'Not enough mana to cast spell'});
|
||||
|
||||
var done = function(){
|
||||
var err = arguments[0];
|
||||
|
|
|
|||
Loading…
Reference in a new issue