mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
[WIP] multiple fixes (#8916)
* change quest banner backgrond * itemRows in inventory * use itemRows in inventory/items - showLess/showMore as default labels - extend white space if theres no button available * hide popover if dragging is active - show dragging info on first click (without to move) * use itemRows in inventory/stable * fix some strings * highlight currently dragging item in inventory/items - auto attach info on click - z-index * fix shopItem label color * fix floating npcs in banner * hatched-pet-dialog in items / stable * change all ctx to context
This commit is contained in:
25
website/client/libs/createAnimal.js
Normal file
25
website/client/libs/createAnimal.js
Normal file
@@ -0,0 +1,25 @@
|
||||
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 userItems.eggs[egg.key] > 0 && userItems.hatchingPotions[potion.key] > 0;
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user