2019-10-12 14:33:05 +00:00
|
|
|
<template>
|
|
|
|
|
<b-modal
|
|
|
|
|
id="choose-class"
|
|
|
|
|
size="lg"
|
|
|
|
|
:hide-header="true"
|
|
|
|
|
:hide-footer="true"
|
|
|
|
|
:no-close-on-esc="true"
|
|
|
|
|
:no-close-on-backdrop="true"
|
|
|
|
|
>
|
|
|
|
|
<div class="modal-body select-class">
|
|
|
|
|
<h1 class="header-purple text-center">
|
|
|
|
|
{{ $t('chooseClass') }}
|
2019-10-12 14:41:18 +00:00
|
|
|
</h1>
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
<br>
|
|
|
|
|
<div class="row">
|
2019-10-12 14:33:05 +00:00
|
|
|
<div
|
|
|
|
|
v-for="heroClass in classes"
|
2020-05-25 15:02:29 +00:00
|
|
|
:key="`${heroClass}-avatar`"
|
2019-10-12 14:33:05 +00:00
|
|
|
class="col-md-3"
|
|
|
|
|
>
|
|
|
|
|
<div @click="selectedClass = heroClass">
|
|
|
|
|
<avatar
|
|
|
|
|
:member="user"
|
|
|
|
|
:avatar-only="true"
|
|
|
|
|
:with-background="false"
|
|
|
|
|
:override-avatar-gear="classGear(heroClass)"
|
|
|
|
|
:hide-class-badge="true"
|
|
|
|
|
:sprites-margin="'1.8em 1.5em'"
|
|
|
|
|
:override-top-padding="'0px'"
|
|
|
|
|
:show-visual-buffs="false"
|
|
|
|
|
:class="selectionBox(selectedClass, heroClass)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-10-12 14:41:18 +00:00
|
|
|
</div>
|
|
|
|
|
<br>
|
|
|
|
|
<div
|
2019-10-12 14:33:05 +00:00
|
|
|
v-for="heroClass in classes"
|
2019-10-13 16:04:04 +00:00
|
|
|
:key="heroClass"
|
2019-10-12 14:33:05 +00:00
|
|
|
class="d-flex justify-content-center"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
v-if="selectedClass === heroClass"
|
|
|
|
|
class="d-inline-flex"
|
|
|
|
|
>
|
|
|
|
|
<div class="class-badge d-flex justify-content-center">
|
|
|
|
|
<div
|
|
|
|
|
class="svg-icon align-self-center"
|
|
|
|
|
v-html="icons[heroClass]"
|
|
|
|
|
></div>
|
2019-10-12 14:41:18 +00:00
|
|
|
</div>
|
|
|
|
|
<div
|
2019-10-12 14:33:05 +00:00
|
|
|
class="class-name"
|
|
|
|
|
:class="`${heroClass}-color`"
|
|
|
|
|
>
|
|
|
|
|
{{ $t(heroClass) }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-10-12 14:41:18 +00:00
|
|
|
</div>
|
2019-10-13 16:04:04 +00:00
|
|
|
<div
|
|
|
|
|
v-for="heroClass in classes"
|
2020-05-25 15:02:29 +00:00
|
|
|
:key="`${heroClass}-explanation`"
|
2019-10-13 16:04:04 +00:00
|
|
|
>
|
2019-10-12 14:33:05 +00:00
|
|
|
<div
|
|
|
|
|
v-if="selectedClass === heroClass"
|
|
|
|
|
class="class-explanation text-center"
|
|
|
|
|
>
|
|
|
|
|
{{ $t(`${heroClass}Text`) }}
|
|
|
|
|
</div>
|
2019-10-12 14:41:18 +00:00
|
|
|
</div>
|
|
|
|
|
<div
|
2019-10-12 14:33:05 +00:00
|
|
|
v-markdown="$t('chooseClassLearnMarkdown')"
|
|
|
|
|
class="text-center"
|
2019-10-12 14:41:18 +00:00
|
|
|
></div>
|
|
|
|
|
<div class="modal-actions text-center">
|
2019-10-12 14:33:05 +00:00
|
|
|
<button
|
|
|
|
|
v-if="!selectedClass"
|
|
|
|
|
class="btn btn-primary d-inline-block"
|
|
|
|
|
:disabled="true"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('select') }}
|
2019-10-12 14:41:18 +00:00
|
|
|
</button>
|
|
|
|
|
<button
|
2019-10-12 14:33:05 +00:00
|
|
|
v-else
|
|
|
|
|
class="btn btn-primary d-inline-block"
|
|
|
|
|
@click="clickSelectClass(selectedClass); close();"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('selectClass', {heroClass: $t(selectedClass)}) }}
|
2019-10-12 14:41:18 +00:00
|
|
|
</button>
|
|
|
|
|
<div class="opt-out-wrapper">
|
2019-10-12 14:33:05 +00:00
|
|
|
<span
|
|
|
|
|
id="classOptOutBtn"
|
|
|
|
|
class="danger"
|
|
|
|
|
@click="clickDisableClasses(); close();"
|
|
|
|
|
>{{ $t('optOutOfClasses') }}</span>
|
2019-10-12 14:41:18 +00:00
|
|
|
</div>
|
|
|
|
|
<span class="opt-out-description">{{ $t('optOutOfClassesText') }}</span>
|
2019-10-12 14:33:05 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</b-modal>
|
2017-08-01 18:52:49 +00:00
|
|
|
</template>
|
|
|
|
|
|
2017-08-22 22:59:18 +00:00
|
|
|
<style lang="scss" scoped>
|
2019-10-01 13:38:48 +00:00
|
|
|
@import '~@/assets/scss/colors.scss';
|
2017-08-22 22:59:18 +00:00
|
|
|
|
|
|
|
|
.class-badge {
|
|
|
|
|
$badge-size: 32px;
|
|
|
|
|
|
|
|
|
|
width: $badge-size;
|
|
|
|
|
height: $badge-size;
|
|
|
|
|
background: $white;
|
|
|
|
|
box-shadow: 0 2px 2px 0 rgba($black, 0.16), 0 1px 4px 0 rgba($black, 0.12);
|
|
|
|
|
border-radius: 100px;
|
|
|
|
|
|
|
|
|
|
.svg-icon {
|
|
|
|
|
width: 19px;
|
|
|
|
|
height: 19px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.class-explanation {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
margin: 1.5em auto;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-15 16:32:49 +00:00
|
|
|
#classOptOutBtn {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-22 22:59:18 +00:00
|
|
|
.class-name {
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
margin: auto 0.33333em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.danger {
|
|
|
|
|
color: $red-50;
|
|
|
|
|
margin-bottom: 0em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.header-purple {
|
|
|
|
|
color: $purple-200;
|
|
|
|
|
margin-top: 1.33333em;
|
|
|
|
|
margin-bottom: 0em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal-actions {
|
|
|
|
|
margin: 2em auto;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-15 16:32:49 +00:00
|
|
|
.opt-out-wrapper {
|
|
|
|
|
margin: 1em 0 0.5em 0;
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-22 22:59:18 +00:00
|
|
|
.selection-box {
|
|
|
|
|
width: 140px;
|
|
|
|
|
height: 148px;
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
border: solid 4px $purple-300;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.healer-color {
|
|
|
|
|
color: $yellow-10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.rogue-color {
|
|
|
|
|
color: $purple-200;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.warrior-color {
|
|
|
|
|
color: $red-50;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.wizard-color {
|
|
|
|
|
color: $blue-10;
|
2017-08-01 18:52:49 +00:00
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import Avatar from '../avatar';
|
2019-10-01 13:38:48 +00:00
|
|
|
import { mapState } from '@/libs/store';
|
|
|
|
|
import markdownDirective from '@/directives/markdown';
|
|
|
|
|
import warriorIcon from '@/assets/svg/warrior.svg';
|
|
|
|
|
import rogueIcon from '@/assets/svg/rogue.svg';
|
|
|
|
|
import healerIcon from '@/assets/svg/healer.svg';
|
|
|
|
|
import wizardIcon from '@/assets/svg/wizard.svg';
|
2017-08-01 18:52:49 +00:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
Avatar,
|
|
|
|
|
},
|
2019-10-09 18:08:36 +00:00
|
|
|
directives: {
|
|
|
|
|
markdown: markdownDirective,
|
|
|
|
|
},
|
2017-08-01 18:52:49 +00:00
|
|
|
data () {
|
|
|
|
|
return {
|
2017-08-22 22:59:18 +00:00
|
|
|
icons: Object.freeze({
|
|
|
|
|
warrior: warriorIcon,
|
|
|
|
|
rogue: rogueIcon,
|
|
|
|
|
healer: healerIcon,
|
|
|
|
|
wizard: wizardIcon,
|
|
|
|
|
}),
|
2018-03-09 20:40:53 +00:00
|
|
|
selectedClass: 'warrior',
|
2017-08-01 18:52:49 +00:00
|
|
|
};
|
|
|
|
|
},
|
2019-10-11 18:35:49 +00:00
|
|
|
computed: {
|
|
|
|
|
...mapState({
|
|
|
|
|
user: 'user.data',
|
|
|
|
|
classes: 'content.classes',
|
2020-12-10 22:53:37 +00:00
|
|
|
currentEvent: 'worldState.data.currentEvent',
|
2019-10-11 18:35:49 +00:00
|
|
|
}),
|
2020-12-10 22:53:37 +00:00
|
|
|
eventName () {
|
|
|
|
|
if (!this.currentEvent || !this.currentEvent.event || this.currentEvent.season === 'normal') return null;
|
|
|
|
|
return this.currentEvent.event.replace('NoPromo', '');
|
|
|
|
|
},
|
2019-10-11 18:35:49 +00:00
|
|
|
},
|
2017-08-01 18:52:49 +00:00
|
|
|
methods: {
|
|
|
|
|
close () {
|
2017-11-08 17:40:37 +00:00
|
|
|
this.$root.$emit('bv::hide::modal', 'choose-class');
|
2017-08-01 18:52:49 +00:00
|
|
|
},
|
2017-08-22 22:59:18 +00:00
|
|
|
clickSelectClass (heroClass) {
|
2020-08-25 16:06:39 +00:00
|
|
|
if (this.user.flags.classSelected && !window.confirm(this.$t('changeClassConfirmCost'))) return; // eslint-disable-line no-alert
|
2019-10-09 18:08:36 +00:00
|
|
|
this.$store.dispatch('user:changeClass', { query: { class: heroClass } });
|
2017-08-22 22:59:18 +00:00
|
|
|
},
|
|
|
|
|
clickDisableClasses () {
|
|
|
|
|
this.$store.dispatch('user:disableClasses');
|
|
|
|
|
},
|
|
|
|
|
classGear (heroClass) {
|
|
|
|
|
if (heroClass === 'rogue') {
|
2020-12-10 22:53:37 +00:00
|
|
|
if (this.eventName) {
|
|
|
|
|
return {
|
|
|
|
|
armor: `armor_special_${this.eventName}Rogue`,
|
|
|
|
|
head: `head_special_${this.eventName}Rogue`,
|
|
|
|
|
shield: `shield_special_${this.eventName}Rogue`,
|
|
|
|
|
weapon: `weapon_special_${this.eventName}Rogue`,
|
|
|
|
|
};
|
|
|
|
|
}
|
2017-08-22 22:59:18 +00:00
|
|
|
return {
|
2020-11-02 04:02:39 +00:00
|
|
|
armor: 'armor_rogue_5',
|
|
|
|
|
head: 'head_rogue_5',
|
|
|
|
|
shield: 'shield_rogue_6',
|
|
|
|
|
weapon: 'weapon_rogue_6',
|
2017-08-22 22:59:18 +00:00
|
|
|
};
|
2019-10-09 18:08:36 +00:00
|
|
|
} if (heroClass === 'wizard') {
|
2020-12-10 22:53:37 +00:00
|
|
|
if (this.eventName) {
|
|
|
|
|
return {
|
|
|
|
|
armor: `armor_special_${this.eventName}Mage`,
|
|
|
|
|
head: `head_special_${this.eventName}Mage`,
|
|
|
|
|
weapon: `weapon_special_${this.eventName}Mage`,
|
|
|
|
|
};
|
|
|
|
|
}
|
2017-08-22 22:59:18 +00:00
|
|
|
return {
|
2020-11-02 04:02:39 +00:00
|
|
|
armor: 'armor_wizard_5',
|
|
|
|
|
head: 'head_wizard_5',
|
|
|
|
|
weapon: 'weapon_wizard_6',
|
2017-08-22 22:59:18 +00:00
|
|
|
};
|
2019-10-09 18:08:36 +00:00
|
|
|
} if (heroClass === 'healer') {
|
2020-12-10 22:53:37 +00:00
|
|
|
if (this.eventName) {
|
|
|
|
|
return {
|
|
|
|
|
armor: `armor_special_${this.eventName}Healer`,
|
|
|
|
|
head: `head_special_${this.eventName}Healer`,
|
|
|
|
|
shield: `shield_special_${this.eventName}Healer`,
|
|
|
|
|
weapon: `weapon_special_${this.eventName}Healer`,
|
|
|
|
|
};
|
|
|
|
|
}
|
2017-08-22 22:59:18 +00:00
|
|
|
return {
|
2020-11-02 04:02:39 +00:00
|
|
|
armor: 'armor_healer_5',
|
|
|
|
|
head: 'head_healer_5',
|
|
|
|
|
shield: 'shield_healer_5',
|
|
|
|
|
weapon: 'weapon_healer_6',
|
2017-08-22 22:59:18 +00:00
|
|
|
};
|
|
|
|
|
}
|
2020-12-10 22:53:37 +00:00
|
|
|
if (this.eventName) {
|
|
|
|
|
return {
|
|
|
|
|
armor: `armor_special_${this.eventName}Warrior`,
|
|
|
|
|
head: `head_special_${this.eventName}Warrior`,
|
|
|
|
|
shield: `shield_special_${this.eventName}Warrior`,
|
|
|
|
|
weapon: `weapon_special_${this.eventName}Warrior`,
|
|
|
|
|
};
|
|
|
|
|
}
|
2019-10-09 18:08:36 +00:00
|
|
|
return {
|
2020-11-02 04:02:39 +00:00
|
|
|
armor: 'armor_warrior_5',
|
|
|
|
|
head: 'head_warrior_5',
|
|
|
|
|
shield: 'shield_warrior_5',
|
|
|
|
|
weapon: 'weapon_warrior_6',
|
2019-10-09 18:08:36 +00:00
|
|
|
};
|
2017-08-01 18:52:49 +00:00
|
|
|
},
|
2017-08-22 22:59:18 +00:00
|
|
|
selectionBox (selectedClass, heroClass) {
|
|
|
|
|
if (selectedClass === heroClass) {
|
|
|
|
|
return 'selection-box';
|
|
|
|
|
}
|
2019-10-11 18:35:49 +00:00
|
|
|
|
|
|
|
|
return null;
|
2017-08-01 18:52:49 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|