mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +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) {
|
||||
if (item.purchaseType === 'card') {
|
||||
if (this.user.party._id) {
|
||||
this.selectedSpellToBuy = item;
|
||||
|
||||
this.$root.$emit('bv::hide::modal', 'buy-modal');
|
||||
this.$root.$emit('bv::show::modal', 'select-member-modal');
|
||||
} else {
|
||||
this.error(this.$t('errorNotInParty'));
|
||||
}
|
||||
}
|
||||
},
|
||||
async memberSelected (member) {
|
||||
this.$store.dispatch('user:castSpell', {key: this.selectedSpellToBuy.key, targetId: member.id});
|
||||
this.selectedSpellToBuy = null;
|
||||
|
||||
if (this.user.party._id) {
|
||||
this.$store.dispatch('party:getMembers', {forceLoad: true});
|
||||
}
|
||||
|
||||
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 starIcon from 'assets/members/star.svg';
|
||||
|
||||
import { mapState } from 'client/libs/store';
|
||||
|
||||
export default {
|
||||
props: ['group', 'hideBadge', 'item'],
|
||||
components: {
|
||||
@@ -129,6 +131,7 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({user: 'user.data'}),
|
||||
sortedMembers () {
|
||||
let sortedMembers = this.members;
|
||||
if (!this.sortOption) return sortedMembers;
|
||||
@@ -173,6 +176,10 @@ export default {
|
||||
if (this.$store.state.memberModalOptions.viewingMembers.length > 0) {
|
||||
this.members = this.$store.state.viewingMembers;
|
||||
}
|
||||
|
||||
if (this.members.length === 0 && !this.groupId) {
|
||||
this.members = [this.user];
|
||||
}
|
||||
},
|
||||
close () {
|
||||
this.$root.$emit('bv::hide::modal', 'select-member-modal');
|
||||
|
||||
@@ -42,10 +42,10 @@
|
||||
)
|
||||
|
||||
.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') }}
|
||||
div(v-if='item.purchaseType !== "gear"')
|
||||
.box(v-if='["fortify", "gear"].indexOf(item.purchaseType) === -1')
|
||||
div(v-if='showAmountToBuy(item)')
|
||||
.box
|
||||
input(type='number', min='0', v-model='selectedAmountToBuy')
|
||||
span.svg-icon.inline.icon-32(aria-hidden="true", v-html="icons[getPriceClass()]")
|
||||
span.value(:class="getPriceClass()") {{ item.value }}
|
||||
@@ -285,6 +285,11 @@
|
||||
|
||||
import moment from 'moment';
|
||||
|
||||
const hideAmountSelectionForPurchaseTypes = [
|
||||
'gear', 'backgrounds', 'mystery_set', 'card',
|
||||
'rebirth_orb', 'fortify', 'armoire',
|
||||
];
|
||||
|
||||
export default {
|
||||
mixins: [currencyMixin, notifications, spellsMixin, buyMixin],
|
||||
components: {
|
||||
@@ -363,6 +368,16 @@
|
||||
this.$emit('change', $event);
|
||||
},
|
||||
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) {
|
||||
this.castStart(this.item);
|
||||
} else if (this.genericPurchase) {
|
||||
@@ -403,6 +418,13 @@
|
||||
return 'gold';
|
||||
}
|
||||
},
|
||||
showAmountToBuy (item) {
|
||||
if (hideAmountSelectionForPurchaseTypes.includes(item.purchaseType)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
getAvatarOverrides (item) {
|
||||
switch (item.purchaseType) {
|
||||
case 'gear':
|
||||
|
||||
@@ -506,9 +506,11 @@ export default {
|
||||
}
|
||||
|
||||
categories.map((category) => {
|
||||
if (!this.viewOptions[category.identifier]) {
|
||||
this.$set(this.viewOptions, category.identifier, {
|
||||
selected: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return categories;
|
||||
|
||||
@@ -333,7 +333,7 @@
|
||||
currency: 'hourglasses',
|
||||
key: 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!",
|
||||
"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?",
|
||||
"purchaseForHourglasses": "Purchase for <%= cost %> Hourglasses?",
|
||||
"notEnoughMana": "Not enough mana.",
|
||||
"invalidTarget": "You can't cast a skill on that.",
|
||||
"youCast": "You cast <%= spell %>.",
|
||||
|
||||
Reference in New Issue
Block a user