mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-07 19:35:32 +00:00
[#1977] misc fixes
This commit is contained in:
parent
2956ae0462
commit
98be57a82c
2 changed files with 21 additions and 23 deletions
29
dist/habitrpg-shared.js
vendored
29
dist/habitrpg-shared.js
vendored
|
|
@ -10964,7 +10964,7 @@ var process=require("__browserify_process");(function() {
|
|||
return task;
|
||||
},
|
||||
feed: function(req, cb) {
|
||||
var egg, evolve, food, pet, potion, userPets, _ref, _ref1, _ref2, _ref3;
|
||||
var egg, evolve, food, message, pet, potion, userPets, _ref, _ref1, _ref2, _ref3;
|
||||
_ref2 = [(_ref = req.query) != null ? _ref.pet : void 0, content.food[(_ref1 = req.query) != null ? _ref1.food : void 0]], pet = _ref2[0], food = _ref2[1];
|
||||
_ref3 = pet.split('-'), egg = _ref3[0], potion = _ref3[1];
|
||||
if (!(pet && food)) {
|
||||
|
|
@ -10977,40 +10977,34 @@ var process=require("__browserify_process");(function() {
|
|||
return cb("You already have that mount");
|
||||
}
|
||||
userPets = user.items.pets;
|
||||
message = '';
|
||||
evolve = function() {
|
||||
userPets[pet] = 0;
|
||||
user.items.mounts[pet] = true;
|
||||
if (pet === user.items.currentPet) {
|
||||
user.items.currentPet = "";
|
||||
}
|
||||
return cb({
|
||||
code: 200,
|
||||
message: "You have tamed " + egg + ", let's go for a ride!"
|
||||
}, req);
|
||||
return message = "You have tamed " + egg + ", let's go for a ride!";
|
||||
};
|
||||
if (food.name === 'Saddle') {
|
||||
evolve();
|
||||
} else {
|
||||
if (food.target === potion) {
|
||||
userPets[pet] += 5;
|
||||
cb({
|
||||
code: 200,
|
||||
message: "" + egg + " really likes the " + food.name + "!"
|
||||
}, req);
|
||||
message = "" + egg + " really likes the " + food.name + "!";
|
||||
} else {
|
||||
userPets[pet] += 2;
|
||||
cb({
|
||||
code: 200,
|
||||
message: "" + egg + " eats the " + food.name + " but doesn't seem to enjoy it."
|
||||
}, req);
|
||||
message = "" + egg + " eats the " + food.name + " but doesn't seem to enjoy it.";
|
||||
}
|
||||
if (userPets[pet] >= 50 && !user.items.mounts[pet]) {
|
||||
evolve();
|
||||
}
|
||||
}
|
||||
user.items.pets[pet] = userPets[pet];
|
||||
user.items.food[food.name]--;
|
||||
return typeof cb === "function" ? cb(null, req) : void 0;
|
||||
return cb({
|
||||
code: 200,
|
||||
message: message
|
||||
}, req);
|
||||
},
|
||||
buy: function(req, cb) {
|
||||
var item, key, _ref;
|
||||
|
|
@ -11137,7 +11131,10 @@ var process=require("__browserify_process");(function() {
|
|||
user.items.pets[pet] = 5;
|
||||
user.items.eggs[egg]--;
|
||||
user.items.hatchingPotions[hatchingPotion]--;
|
||||
return typeof cb === "function" ? cb(null, req) : void 0;
|
||||
return typeof cb === "function" ? cb({
|
||||
code: 200,
|
||||
message: "Your egg hatched! Visit your stable to equip your pet."
|
||||
}, req) : void 0;
|
||||
},
|
||||
unlock: function(req, cb) {
|
||||
var cost, fullSet, path;
|
||||
|
|
|
|||
|
|
@ -674,25 +674,26 @@ api.wrap = (user) ->
|
|||
return cb("You already have that mount") if user.items.mounts[pet] and (userPets[pet] >= 50 or food.name is 'Saddle')
|
||||
|
||||
userPets = user.items.pets
|
||||
message = ''
|
||||
evolve = ->
|
||||
userPets[pet] = 0
|
||||
user.items.mounts[pet] = true
|
||||
user.items.currentPet = "" if pet is user.items.currentPet
|
||||
cb {code:200, message:"You have tamed #{egg}, let's go for a ride!"}, req
|
||||
message = "You have tamed #{egg}, let's go for a ride!"
|
||||
|
||||
if food.name is 'Saddle'
|
||||
evolve()
|
||||
else
|
||||
if food.target is potion
|
||||
userPets[pet] += 5
|
||||
cb {code:200, message: "#{egg} really likes the #{food.name}!"}, req
|
||||
message = "#{egg} really likes the #{food.name}!"
|
||||
else
|
||||
userPets[pet] += 2
|
||||
cb {code:200, message: "#{egg} eats the #{food.name} but doesn't seem to enjoy it."}, req
|
||||
evolve() if userPets[pet] >= 50 and not user.items.mounts[pet]
|
||||
user.items.pets[pet] = userPets[pet]
|
||||
message = "#{egg} eats the #{food.name} but doesn't seem to enjoy it."
|
||||
if userPets[pet] >= 50 and !user.items.mounts[pet]
|
||||
evolve()
|
||||
user.items.food[food.name]--
|
||||
cb? null, req
|
||||
cb {code:200, message}, req
|
||||
|
||||
buy: (req, cb) ->
|
||||
{key} = req.query
|
||||
|
|
@ -765,7 +766,7 @@ api.wrap = (user) ->
|
|||
user.items.pets[pet] = 5
|
||||
user.items.eggs[egg]--
|
||||
user.items.hatchingPotions[hatchingPotion]--
|
||||
cb? null, req
|
||||
cb? {code:200, message:"Your egg hatched! Visit your stable to equip your pet."}, req
|
||||
|
||||
unlock: (req, cb) ->
|
||||
{path} = req.query
|
||||
|
|
|
|||
Loading…
Reference in a new issue