WIP(shops): fixes and Hall of Heroes update

This commit is contained in:
Sabe Jones
2024-05-16 18:49:56 -05:00
parent 4c13f3193e
commit 6e5b13668a
11 changed files with 33 additions and 58 deletions

View File

@@ -30,28 +30,6 @@
margin-bottom: 8px;
}
.item.pet-slot {
// Desktop XL (1440)
@media only screen and (min-width: 1440px){
margin-right: 1.71em;
}
// Desktop L (1280)
@media only screen and (min-width: 1280px) and (max-width: 1439px) {
margin-right: 0.43em;
}
// Desktop M (1024)
@media only screen and (min-width: 1024px) and (max-width: 1279px) {
margin-right: 0.86em;
}
// Tablets and mobile
@media only screen and (max-width: 1023px) {
margin-right: 1.71em;
}
}
.item {
position: relative;
width: 94px;

View File

@@ -83,7 +83,7 @@
position: absolute;
bottom: -14px;
margin: 0;
left: 78px;
left: 79px;
}
}
}

View File

@@ -282,20 +282,16 @@ export default {
item.modified = true;
// for non-integer items, toggle through the allowed values:
if (item.itemType === 'gear') {
// Allowed starting values are true, false, and '' (never owned)
// Allowed values to switch to are true and false
item.value = !item.value;
} else if (item.itemType === 'mounts') {
// Allowed starting values are true, null, and "never owned"
// Allowed values to switch to are true and null
if (item.value === true) {
item.value = null;
if (item.itemType === 'gear' || item.itemType === 'mounts') {
// Allowed starting values are true, false, and undefined (never owned)
if (item.value && item.value !== '') {
item.value = false;
} else if (typeof item.value === 'boolean') {
item.value = '';
} else {
item.value = true;
}
}
// @TODO add a delete option
},
},
};

View File

@@ -144,7 +144,7 @@
v-for="(group, key, index) in pets(petGroup, hideMissing, selectedSortBy, searchTextThrottled)"
v-if="index === 0 || $_openedItemRows_isToggled(petGroup.key)"
:key="key"
class="pet-row d-flex"
class="pet-row d-inline-flex"
>
<!-- eslint-enable vue/no-use-v-if-with-v-for -->
<div
@@ -177,7 +177,6 @@
</template>
</petItem>
</div>
</div>
<show-more-button
v-if="petRowCount[petGroup.key] > 1 && petGroup.key !== 'specialPets' && !(petGroup.key === 'wackyPets' && selectedSortBy !== 'sortByColor')"
:show-all="$_openedItemRows_isToggled(petGroup.key)"
@@ -185,6 +184,7 @@
@click="setShowMore(petGroup.key)"
/>
</div>
</div>
<h2>
{{ $t('mounts') }}
<span
@@ -309,15 +309,6 @@
height: 130px;
overflow: hidden;
}
.pet-row {
max-width: 100%;
flex-wrap: wrap;
.item {
margin-right: .5em;
}
}
</style>
<style lang="scss">
@@ -330,6 +321,15 @@
display: inline-block;
}
.pet-row {
max-width: 100%;
flex-wrap: wrap;
.item-wrapper {
margin-right: 24px;
}
}
.GreyedOut {
opacity: 0.3;
}

View File

@@ -138,7 +138,7 @@
position: absolute;
bottom: -14px;
margin: 0;
left: 80px;
left: 75px;
}
}
}

View File

@@ -389,7 +389,7 @@
position: absolute;
bottom: -14px;
margin: 0;
left: 70px;
left: 62px;
}
}
}

View File

@@ -305,7 +305,7 @@
position: absolute;
bottom: -14px;
margin: 0;
left: 60px;
left: 32px;
}
}

View File

@@ -379,7 +379,7 @@ export default function getItemInfo (user, type, item, officialPinnedItems, lang
case 'haircolor': {
itemInfo = {
key: item.key,
class: `icon_color_hair_bangs_${user.preferences.hair.bangs || 1}_${item.key}`,
class: `icon_hair_bangs_${user.preferences.hair.bangs || 1}_${item.key}`,
currency: 'gems',
locked: false,
notes: '',

View File

@@ -383,7 +383,7 @@ api.updateHero = {
hero.items.pets['Dragon-Hydra'] = 5;
hero.markModified('items.pets');
}
if (updateData.itemPath && updateData.itemVal && validateItemPath(updateData.itemPath)) {
if (updateData.itemPath && (updateData.itemVal || updateData.itemVal === '') && validateItemPath(updateData.itemPath)) {
// Sanitization at 5c30944 (deemed unnecessary)
_.set(hero, updateData.itemPath, castItemVal(updateData.itemPath, updateData.itemVal));
hero.markModified('items');

View File

@@ -88,7 +88,8 @@ export function castItemVal (itemPath, itemVal) {
if (itemPath.indexOf('items.mounts') === 0) {
// Mounts are true when you own them and null when you have used Keys to the Kennel
// to release them.
// They are never false but allow 'false' to be null in case of user error.
// Empty string or undefined means "unset" i.e. never owned.
if (['', 'undefined'].includes(itemVal)) return undefined;
if (itemVal === 'null' || itemVal === 'false') return null;
if (itemVal) return true; // any truthy value
return null; // any false value
@@ -96,8 +97,8 @@ export function castItemVal (itemPath, itemVal) {
if (itemPath.indexOf('items.gear.owned') === 0) {
// Gear is true when you own it and false if you previously owned it but lost it (e.g., Death)
// It is never null but allow 'null' to be false in case of user error.
if (itemVal === 'false' || itemVal === 'null') return false;
// Null, empty string, or undefined are taken to mean "unset" i.e. never owned.
if (['null', '', 'undefined'].includes(itemVal)) return undefined;
return Boolean(itemVal);
}