Skip to content

Commit

Permalink
some special items, reorganize
Browse files Browse the repository at this point in the history
  • Loading branch information
paglias committed May 22, 2017
1 parent 9e7a877 commit 7bb0d86
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
1 change: 0 additions & 1 deletion website/client/assets/scss/badge.scss
Expand Up @@ -17,7 +17,6 @@
}

.badge-item {
cursor: pointer;
position: absolute;
top: -9px;
}
Expand Down
8 changes: 4 additions & 4 deletions website/client/components/inventory/equipment/index.vue
Expand Up @@ -75,7 +75,7 @@
template(slot="popoverContent", scope="ctx")
equipmentAttributesPopover(:item="ctx.item")
template(slot="itemBadge", scope="ctx")
equipmentBadge(
starBadge(
:selected="true",
:show="!costume || user.preferences.costume",
@click="equip(ctx.item)",
Expand All @@ -100,7 +100,7 @@
:key="item.key",
)
template(slot="itemBadge", scope="ctx")
equipmentBadge(
starBadge(
:selected="activeItems[ctx.item.type] === ctx.item.key",
:show="!costume || user.preferences.costume",
@click="equip(ctx.item)",
Expand Down Expand Up @@ -134,7 +134,7 @@ import toggleSwitch from 'client/components/ui/toggleSwitch';
import Item from 'client/components/inventory/item';
import EquipmentAttributesPopover from 'client/components/inventory/equipment/attributesPopover';
import EquipmentBadge from 'client/components/inventory/equipment/badge';
import StarBadge from 'client/components/inventory/starBadge';
import Drawer from 'client/components/inventory/drawer';
import i18n from 'common/script/i18n';
Expand All @@ -144,7 +144,7 @@ export default {
components: {
Item,
EquipmentAttributesPopover,
EquipmentBadge,
StarBadge,
Drawer,
bDropdown,
bDropdownItem,
Expand Down
6 changes: 0 additions & 6 deletions website/client/components/inventory/item.vue
Expand Up @@ -18,12 +18,6 @@ b-popover(
slot(name="itemBadge", :item="item")
span.item-content(:class="itemContentClass")
span.item-label(v-if="label") {{ label }}
div(v-else)
.item-wrapper
.item.item-empty
.item-content
span.item-label(v-if="label") {{ label }}

</template>

<script>
Expand Down
16 changes: 10 additions & 6 deletions website/client/components/inventory/items/index.vue
Expand Up @@ -40,7 +40,7 @@
v-if="group.open || index < itemsPerLine",
:item="item",
:key="item.key",
:itemContentClass="`Pet_${group.classPrefix}_${item.key}`"
:itemContentClass="`${group.classPrefix}${item.key}`"
:selected="true",
)
template(slot="popoverContent", scope="ctx")
Expand Down Expand Up @@ -69,17 +69,21 @@ import bDropdown from 'bootstrap-vue/lib/components/dropdown';
import bDropdownItem from 'bootstrap-vue/lib/components/dropdown-item';
import Item from 'client/components/inventory/item';
const allowedSpecialItems = ['snowball', 'spookySparkles', 'shinySeed', 'seafoam'];
const groups = [
['eggs', 'Egg'],
['hatchingPotions', 'HatchingPotion'],
['food', 'Food'],
].map(([group, classPrefix]) => {
['eggs', 'Pet_Egg_'],
['hatchingPotions', 'Pet_HatchingPotion_'],
['food', 'Pet_Food_'],
['special', 'inventory_special_', allowedSpecialItems],
].map(([group, classPrefix, allowedItems]) => {
return {
key: group,
quantity: 0,
selected: true,
open: false,
classPrefix,
allowedItems,
};
});
Expand Down Expand Up @@ -119,7 +123,7 @@ export default {
const contentItems = this.content[groupKey];
each(this.user.items[groupKey], (itemQuantity, itemKey) => {
if (itemQuantity > 0) {
if (itemQuantity > 0 && (!group.allowedItems || group.allowedItems.indexOf(itemKey) !== -1)) {
const item = contentItems[itemKey];
const isSearched = !searchText || item.text().toLowerCase().indexOf(searchText) !== -1;
Expand Down
Expand Up @@ -10,6 +10,7 @@ span.badge.badge-pill.badge-item.badge-star(
@import '~client/assets/scss/colors.scss';
.badge-star {
cursor: pointer;
display: none;
left: -9px;
color: $gray-400;
Expand Down

0 comments on commit 7bb0d86

Please sign in to comment.