mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 14:17:22 +01:00
* reposition FlyingPigs and Hydra * hide count-badge if 0 * fix sortBy hatchable (ignore already hatched pets) * always show animal name * featuredItems, use shopItem objects * fix egg / potion names in market * buyModals: check for price, mark it if not enough available / change buy-button opacity / show purchaseGems button * save itemRows open/collapsed state during session, refactor itemRows for some more performance * pin featured items * show bordered items in market buyModal * fix popover margins / paddings * position pinned items popovers to the left
26 lines
781 B
JavaScript
26 lines
781 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;
|
|
},
|
|
};
|
|
}
|