mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 07:18:38 +00:00
fix(pets): 401 error when can't hatch a pet, not 500
This commit is contained in:
parent
d721644f15
commit
1331ff0f12
2 changed files with 10 additions and 7 deletions
15
dist/habitrpg-shared.js
vendored
15
dist/habitrpg-shared.js
vendored
|
|
@ -10702,11 +10702,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ?
|
|||
target: 'CottonCandyBlue',
|
||||
article: ''
|
||||
},
|
||||
Honey: {
|
||||
text: 'Honey',
|
||||
target: 'Golden',
|
||||
article: ''
|
||||
},
|
||||
Cake_Skeleton: {
|
||||
canBuy: false,
|
||||
text: 'Bare Bones Cake',
|
||||
|
|
@ -10767,6 +10762,11 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ?
|
|||
target: 'Red',
|
||||
article: ''
|
||||
},
|
||||
Honey: {
|
||||
text: 'Honey',
|
||||
target: 'Golden',
|
||||
article: ''
|
||||
},
|
||||
Saddle: {
|
||||
text: 'Saddle',
|
||||
value: 5,
|
||||
|
|
@ -12050,7 +12050,10 @@ var process=require("__browserify_process");(function() {
|
|||
}
|
||||
pet = "" + egg + "-" + hatchingPotion;
|
||||
if (user.items.pets[pet] && user.items.pets[pet] > 0) {
|
||||
return typeof cb === "function" ? cb("You already have that pet. Try hatching a different combination!") : void 0;
|
||||
return typeof cb === "function" ? cb({
|
||||
code: 401,
|
||||
message: "You already have that pet. Try hatching a different combination!"
|
||||
}) : void 0;
|
||||
}
|
||||
user.items.pets[pet] = 5;
|
||||
user.items.eggs[egg]--;
|
||||
|
|
|
|||
|
|
@ -643,7 +643,7 @@ api.wrap = (user, main=true) ->
|
|||
return cb?({code:404,message:"Please specify query.egg & query.hatchingPotion"}) unless egg and hatchingPotion
|
||||
return cb?({code:401,message:"You're missing either that egg or that potion"}) unless user.items.eggs[egg] > 0 and user.items.hatchingPotions[hatchingPotion] > 0
|
||||
pet = "#{egg}-#{hatchingPotion}"
|
||||
return cb?("You already have that pet. Try hatching a different combination!") if user.items.pets[pet] and user.items.pets[pet] > 0
|
||||
return cb?({code:401, message:"You already have that pet. Try hatching a different combination!"}) if user.items.pets[pet] and user.items.pets[pet] > 0
|
||||
user.items.pets[pet] = 5
|
||||
user.items.eggs[egg]--
|
||||
user.items.hatchingPotions[hatchingPotion]--
|
||||
|
|
|
|||
Loading…
Reference in a new issue