Files
habitica/website/client/libs/createAnimal.js
Keith Holliday e29c393629 Client sept 12 (#9032)
* Removed load all members from challengs

* Fixed chalenge member modal loading

* Fixed party setting

* Fixed chat showing

* Fixed armoire drops

* Ignored lint issue

* Fixed buying old armoir items

* Fixed hatching

* Fixed pending damage
2017-09-12 12:56:06 -05:00

26 lines
777 B
JavaScript

export default function createAnimal (egg, potion, type, content, userItems) {
let animalKey = `${egg.key}-${potion.key}`;
return {
key: animalKey,
class: type === 'pet' ? `Pet Pet-${animalKey}` : `Mount_Icon_${animalKey}`,
eggKey: egg.key,
eggName: egg.text,
potionKey: potion.key,
potionName: potion.text,
name: content[`${type}Info`][animalKey].text(),
isOwned () {
return userItems[`${type}s`][animalKey] > 0;
},
mountOwned () {
return userItems.mounts[this.key] > 0;
},
isAllowedToFeed () {
return type === 'pet' && this.isOwned() && !this.mountOwned();
},
isHatchable () {
return !this.isOwned() & userItems.eggs[egg.key] > 0 && userItems.hatchingPotions[potion.key] > 0;
},
};
}