mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
multiple market fixes (#9468)
* show `selectMemberModal` to send a card, even if the user doesn't have a party yet * market - prevent filter reset on pinning items * hide buy amount for gear, backgrounds, mystery_set, card, rebirth_orb, fortify, armoire - fix mystery set preview in timetravelers * purchase confirmation on gem / hourglass purchases * fix lint
This commit is contained in:
@@ -333,21 +333,19 @@ export default {
|
|||||||
},
|
},
|
||||||
customPurchase (item) {
|
customPurchase (item) {
|
||||||
if (item.purchaseType === 'card') {
|
if (item.purchaseType === 'card') {
|
||||||
if (this.user.party._id) {
|
this.selectedSpellToBuy = item;
|
||||||
this.selectedSpellToBuy = item;
|
|
||||||
|
|
||||||
this.$root.$emit('bv::hide::modal', 'buy-modal');
|
this.$root.$emit('bv::hide::modal', 'buy-modal');
|
||||||
this.$root.$emit('bv::show::modal', 'select-member-modal');
|
this.$root.$emit('bv::show::modal', 'select-member-modal');
|
||||||
} else {
|
|
||||||
this.error(this.$t('errorNotInParty'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async memberSelected (member) {
|
async memberSelected (member) {
|
||||||
this.$store.dispatch('user:castSpell', {key: this.selectedSpellToBuy.key, targetId: member.id});
|
this.$store.dispatch('user:castSpell', {key: this.selectedSpellToBuy.key, targetId: member.id});
|
||||||
this.selectedSpellToBuy = null;
|
this.selectedSpellToBuy = null;
|
||||||
|
|
||||||
this.$store.dispatch('party:getMembers', {forceLoad: true});
|
if (this.user.party._id) {
|
||||||
|
this.$store.dispatch('party:getMembers', {forceLoad: true});
|
||||||
|
}
|
||||||
|
|
||||||
this.$root.$emit('bv::hide::modal', 'select-member-modal');
|
this.$root.$emit('bv::hide::modal', 'select-member-modal');
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ import removeIcon from 'assets/members/remove.svg';
|
|||||||
import messageIcon from 'assets/members/message.svg';
|
import messageIcon from 'assets/members/message.svg';
|
||||||
import starIcon from 'assets/members/star.svg';
|
import starIcon from 'assets/members/star.svg';
|
||||||
|
|
||||||
|
import { mapState } from 'client/libs/store';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['group', 'hideBadge', 'item'],
|
props: ['group', 'hideBadge', 'item'],
|
||||||
components: {
|
components: {
|
||||||
@@ -129,6 +131,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState({user: 'user.data'}),
|
||||||
sortedMembers () {
|
sortedMembers () {
|
||||||
let sortedMembers = this.members;
|
let sortedMembers = this.members;
|
||||||
if (!this.sortOption) return sortedMembers;
|
if (!this.sortOption) return sortedMembers;
|
||||||
@@ -173,6 +176,10 @@ export default {
|
|||||||
if (this.$store.state.memberModalOptions.viewingMembers.length > 0) {
|
if (this.$store.state.memberModalOptions.viewingMembers.length > 0) {
|
||||||
this.members = this.$store.state.viewingMembers;
|
this.members = this.$store.state.viewingMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.members.length === 0 && !this.groupId) {
|
||||||
|
this.members = [this.user];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
close () {
|
close () {
|
||||||
this.$root.$emit('bv::hide::modal', 'select-member-modal');
|
this.$root.$emit('bv::hide::modal', 'select-member-modal');
|
||||||
|
|||||||
@@ -42,10 +42,10 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
.purchase-amount(:class="{'notEnough': !this.enoughCurrency(getPriceClass(), item.value * selectedAmountToBuy)}")
|
.purchase-amount(:class="{'notEnough': !this.enoughCurrency(getPriceClass(), item.value * selectedAmountToBuy)}")
|
||||||
.how-many-to-buy(v-if='["fortify", "gear"].indexOf(item.purchaseType) === -1')
|
.how-many-to-buy(v-if='showAmountToBuy(item)')
|
||||||
strong {{ $t('howManyToBuy') }}
|
strong {{ $t('howManyToBuy') }}
|
||||||
div(v-if='item.purchaseType !== "gear"')
|
div(v-if='showAmountToBuy(item)')
|
||||||
.box(v-if='["fortify", "gear"].indexOf(item.purchaseType) === -1')
|
.box
|
||||||
input(type='number', min='0', v-model='selectedAmountToBuy')
|
input(type='number', min='0', v-model='selectedAmountToBuy')
|
||||||
span.svg-icon.inline.icon-32(aria-hidden="true", v-html="icons[getPriceClass()]")
|
span.svg-icon.inline.icon-32(aria-hidden="true", v-html="icons[getPriceClass()]")
|
||||||
span.value(:class="getPriceClass()") {{ item.value }}
|
span.value(:class="getPriceClass()") {{ item.value }}
|
||||||
@@ -285,6 +285,11 @@
|
|||||||
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
|
const hideAmountSelectionForPurchaseTypes = [
|
||||||
|
'gear', 'backgrounds', 'mystery_set', 'card',
|
||||||
|
'rebirth_orb', 'fortify', 'armoire',
|
||||||
|
];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [currencyMixin, notifications, spellsMixin, buyMixin],
|
mixins: [currencyMixin, notifications, spellsMixin, buyMixin],
|
||||||
components: {
|
components: {
|
||||||
@@ -363,6 +368,16 @@
|
|||||||
this.$emit('change', $event);
|
this.$emit('change', $event);
|
||||||
},
|
},
|
||||||
buyItem () {
|
buyItem () {
|
||||||
|
if (this.item.currency === 'gems' &&
|
||||||
|
!confirm(this.$t('purchaseFor', { cost: this.item.value }))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.item.currency === 'hourglasses' &&
|
||||||
|
!confirm(this.$t('purchaseForHourglasses', { cost: this.item.value }))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.item.cast) {
|
if (this.item.cast) {
|
||||||
this.castStart(this.item);
|
this.castStart(this.item);
|
||||||
} else if (this.genericPurchase) {
|
} else if (this.genericPurchase) {
|
||||||
@@ -403,6 +418,13 @@
|
|||||||
return 'gold';
|
return 'gold';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
showAmountToBuy (item) {
|
||||||
|
if (hideAmountSelectionForPurchaseTypes.includes(item.purchaseType)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
getAvatarOverrides (item) {
|
getAvatarOverrides (item) {
|
||||||
switch (item.purchaseType) {
|
switch (item.purchaseType) {
|
||||||
case 'gear':
|
case 'gear':
|
||||||
|
|||||||
@@ -506,9 +506,11 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
categories.map((category) => {
|
categories.map((category) => {
|
||||||
this.$set(this.viewOptions, category.identifier, {
|
if (!this.viewOptions[category.identifier]) {
|
||||||
selected: true,
|
this.$set(this.viewOptions, category.identifier, {
|
||||||
});
|
selected: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return categories;
|
return categories;
|
||||||
|
|||||||
@@ -333,7 +333,7 @@
|
|||||||
currency: 'hourglasses',
|
currency: 'hourglasses',
|
||||||
key: c.identifier,
|
key: c.identifier,
|
||||||
class: `shop_set_mystery_${c.identifier}`,
|
class: `shop_set_mystery_${c.identifier}`,
|
||||||
purchaseType: 'set_mystery',
|
purchaseType: 'mystery_set',
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -163,6 +163,7 @@
|
|||||||
"dieText": "You've lost a Level, all your Gold, and a random piece of Equipment. Arise, Habiteer, and try again! Curb those negative Habits, be vigilant in completion of Dailies, and hold death at arm's length with a Health Potion if you falter!",
|
"dieText": "You've lost a Level, all your Gold, and a random piece of Equipment. Arise, Habiteer, and try again! Curb those negative Habits, be vigilant in completion of Dailies, and hold death at arm's length with a Health Potion if you falter!",
|
||||||
"sureReset": "Are you sure? This will reset your character's class and allocated points (you'll get them all back to re-allocate), and costs 3 Gems.",
|
"sureReset": "Are you sure? This will reset your character's class and allocated points (you'll get them all back to re-allocate), and costs 3 Gems.",
|
||||||
"purchaseFor": "Purchase for <%= cost %> Gems?",
|
"purchaseFor": "Purchase for <%= cost %> Gems?",
|
||||||
|
"purchaseForHourglasses": "Purchase for <%= cost %> Hourglasses?",
|
||||||
"notEnoughMana": "Not enough mana.",
|
"notEnoughMana": "Not enough mana.",
|
||||||
"invalidTarget": "You can't cast a skill on that.",
|
"invalidTarget": "You can't cast a skill on that.",
|
||||||
"youCast": "You cast <%= spell %>.",
|
"youCast": "You cast <%= spell %>.",
|
||||||
|
|||||||
Reference in New Issue
Block a user