Skip to content

Commit

Permalink
Merge 16256ee into fe5beac
Browse files Browse the repository at this point in the history
  • Loading branch information
negue committed Oct 22, 2018
2 parents fe5beac + 16256ee commit 582644e
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 32 deletions.
27 changes: 0 additions & 27 deletions website/client/components/inventory/stable/index.vue
Expand Up @@ -86,25 +86,13 @@
)
petItem(
:item="item",
:itemContentClass="getPetItemClass(item)",
:popoverPosition="'top'",
:progress="item.progress",
:emptyItem="!item.isOwned()",
:showPopover="currentDraggingFood == null",
:highlightBorder="highlightPet == item.key",
@click="petClicked(item)"
)
span(slot="popoverContent")
div.hatchablePopover(v-if="item.isHatchable()")
h4.popover-content-title {{ item.name }}
div.popover-content-text(v-html="$t('haveHatchablePet', { potion: item.potionName, egg: item.eggName })")
div.potionEggGroup
div.potionEggBackground
div(:class="'Pet_HatchingPotion_'+item.potionKey")
div.potionEggBackground
div(:class="'Pet_Egg_'+item.eggKey")
div(v-else)
h4.popover-content-title {{ item.name }}
template(slot="itemBadge", slot-scope="context")
starBadge(:selected="item.key === currentPet", :show="item.isOwned()", @click="selectPet(item)")

Expand Down Expand Up @@ -710,21 +698,6 @@
return groupBy(mounts, groupKey);
},
getPetItemClass (pet) {
if (pet.isOwned()) {
return `Pet Pet-${pet.key} ${pet.eggKey}`;
}
if (pet.isHatchable()) {
return 'PixelPaw';
}
if (pet.mountOwned()) {
return `GreyedOut Pet Pet-${pet.key} ${pet.eggKey}`;
}
return 'GreyedOut PixelPaw';
},
hasDrawerTabItems (index) {
return this.drawerTabs && this.drawerTabs[index].items.length !== 0;
},
Expand Down
77 changes: 72 additions & 5 deletions website/client/components/inventory/stable/petItem.vue
Expand Up @@ -5,7 +5,10 @@ div
:class="{'item-empty': emptyItem, 'highlight': highlightBorder}",
)
slot(name="itemBadge", :item="item")
span.item-content(:class="itemContentClass")
span.item-content.hatchAgain(v-if="mountOwned && isHatchable")
span.egg(:class="eggClass")
span.potion(:class="potionClass")
span.item-content(v-else, :class="getPetItemClass()")
span.pet-progress-background(v-if="item.isAllowedToFeed() && progress > 0")
div.pet-progress-bar(v-bind:style="{width: 100 * progress/50 + '%' }")
span.item-label(v-if="label") {{ label }}
Expand All @@ -15,7 +18,17 @@ div
:triggers="showPopover ? 'hover' : ''",
:placement="popoverPosition",
)
slot(name="popoverContent", :item="item")
div.hatchablePopover(v-if="item.isHatchable()")
h4.popover-content-title {{ item.name }}
div.popover-content-text(v-html="$t('haveHatchablePet', { potion: item.potionName, egg: item.eggName })")
div.potionEggGroup
div.potionEggBackground
div(:class="potionClass")
div.potionEggBackground
div(:class="eggClass")
div(v-else)
h4.popover-content-title {{ item.name }}

</template>

<style lang="scss">
Expand All @@ -32,6 +45,29 @@ div
height: 4px;
background-color: #24cc8f;
}
.hatchAgain {
display: inline-flex;
align-items: center;
width: 94px;
height: 94px;
.egg {
position: absolute;
left: 4px;
top: 14px;
z-index: 1;
transform: scale(1.2);
}
.potion {
position: absolute;
right: 4px;
top: 14px;
transform: scale(1.2);
}
}
</style>

<script>
Expand All @@ -42,9 +78,6 @@ div
item: {
type: Object,
},
itemContentClass: {
type: String,
},
label: {
type: String,
},
Expand Down Expand Up @@ -78,6 +111,40 @@ div
click () {
this.$emit('click', {});
},
getPetItemClass () {
if (this.mountOwned && !this.isHatchable) {
return `GreyedOut Pet Pet-${this.item.key} ${this.item.eggKey}`;
}
if (this.item.isOwned()) {
return `Pet Pet-${this.item.key} ${this.item.eggKey}`;
}
if (this.isHatchable) {
return 'PixelPaw';
}
if (this.mountOwned) {
return `GreyedOut Pet Pet-${this.item.key} ${this.item.eggKey}`;
}
// Can't hatch
return 'GreyedOut PixelPaw';
},
},
computed: {
potionClass () {
return `Pet_HatchingPotion_${this.item.potionKey}`;
},
eggClass () {
return `Pet_Egg_${this.item.eggKey}`;
},
isHatchable () {
return this.item.isHatchable();
},
mountOwned () {
return this.item.mountOwned();
},
},
};
</script>

0 comments on commit 582644e

Please sign in to comment.