lint common
This commit is contained in:
@@ -66,7 +66,7 @@ export default {
|
||||
this.achievements = achievementsLib.getAchievementsForProfile(this.user);
|
||||
},
|
||||
computed: {
|
||||
...mapState({user: 'user.data'}),
|
||||
...mapState({ user: 'user.data' }),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -238,11 +238,11 @@ import moment from 'moment';
|
||||
import filter from 'lodash/filter';
|
||||
import groupBy from 'lodash/groupBy';
|
||||
import orderBy from 'lodash/orderBy';
|
||||
import { mapState } from '@/libs/store';
|
||||
import habiticaMarkdown from 'habitica-markdown';
|
||||
import axios from 'axios';
|
||||
import { mapState } from '@/libs/store';
|
||||
import styleHelper from '@/mixins/styleHelper';
|
||||
import toggleSwitch from '@/components/ui/toggleSwitch';
|
||||
import axios from 'axios';
|
||||
|
||||
import chatMessages from '../chat/chatMessages';
|
||||
import messageIcon from '@/assets/svg/message.svg';
|
||||
@@ -259,44 +259,16 @@ import tier9 from '@/assets/svg/tier-staff.svg';
|
||||
import tierNPC from '@/assets/svg/tier-npc.svg';
|
||||
|
||||
export default {
|
||||
mixins: [styleHelper],
|
||||
components: {
|
||||
chatMessages,
|
||||
toggleSwitch,
|
||||
},
|
||||
mounted () {
|
||||
this.$root.$on('habitica::new-inbox-message', (data) => {
|
||||
this.$root.$emit('bv::show::modal', 'inbox-modal');
|
||||
|
||||
// Wait for messages to be loaded
|
||||
const unwatchLoaded = this.$watch('loaded', (loaded) => {
|
||||
if (!loaded) return;
|
||||
|
||||
const conversation = this.conversations.find(convo => {
|
||||
return convo.key === data.userIdToMessage;
|
||||
});
|
||||
if (loaded) setImmediate(() => unwatchLoaded());
|
||||
|
||||
if (conversation) {
|
||||
this.selectConversation(data.userIdToMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
this.initiatedConversation = {
|
||||
uuid: data.userIdToMessage,
|
||||
user: data.displayName,
|
||||
username: data.username,
|
||||
backer: data.backer,
|
||||
contributor: data.contributor,
|
||||
};
|
||||
|
||||
this.selectConversation(data.userIdToMessage);
|
||||
}, {immediate: true});
|
||||
});
|
||||
},
|
||||
destroyed () {
|
||||
this.$root.$off('habitica::new-inbox-message');
|
||||
filters: {
|
||||
timeAgo (value) {
|
||||
return moment(new Date(value)).fromNow();
|
||||
},
|
||||
},
|
||||
mixins: [styleHelper],
|
||||
data () {
|
||||
return {
|
||||
icons: Object.freeze({
|
||||
@@ -327,13 +299,39 @@ export default {
|
||||
updateConversionsCounter: 0,
|
||||
};
|
||||
},
|
||||
filters: {
|
||||
timeAgo (value) {
|
||||
return moment(new Date(value)).fromNow();
|
||||
},
|
||||
mounted () {
|
||||
this.$root.$on('habitica::new-inbox-message', data => {
|
||||
this.$root.$emit('bv::show::modal', 'inbox-modal');
|
||||
|
||||
// Wait for messages to be loaded
|
||||
const unwatchLoaded = this.$watch('loaded', loaded => {
|
||||
if (!loaded) return;
|
||||
|
||||
const conversation = this.conversations.find(convo => convo.key === data.userIdToMessage);
|
||||
if (loaded) setImmediate(() => unwatchLoaded());
|
||||
|
||||
if (conversation) {
|
||||
this.selectConversation(data.userIdToMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
this.initiatedConversation = {
|
||||
uuid: data.userIdToMessage,
|
||||
user: data.displayName,
|
||||
username: data.username,
|
||||
backer: data.backer,
|
||||
contributor: data.contributor,
|
||||
};
|
||||
|
||||
this.selectConversation(data.userIdToMessage);
|
||||
}, { immediate: true });
|
||||
});
|
||||
},
|
||||
destroyed () {
|
||||
this.$root.$off('habitica::new-inbox-message');
|
||||
},
|
||||
computed: {
|
||||
...mapState({user: 'user.data'}),
|
||||
...mapState({ user: 'user.data' }),
|
||||
canLoadMore () {
|
||||
return this.selectedConversation && this.selectedConversation.canLoadMore;
|
||||
},
|
||||
@@ -354,7 +352,7 @@ export default {
|
||||
}
|
||||
// Create conversation objects
|
||||
const convos = [];
|
||||
for (let key in inboxGroup) {
|
||||
for (const key in inboxGroup) {
|
||||
const recentMessage = inboxGroup[key][0];
|
||||
|
||||
const convoModel = {
|
||||
@@ -381,9 +379,7 @@ export default {
|
||||
const selectedConversation = this.messagesByConversation[selectedConversationKey];
|
||||
this.messages = selectedConversation || []; // eslint-disable-line vue/no-side-effects-in-computed-properties
|
||||
|
||||
const ordered = orderBy(this.messages, [(m) => {
|
||||
return m.timestamp;
|
||||
}], ['asc']);
|
||||
const ordered = orderBy(this.messages, [m => m.timestamp], ['asc']);
|
||||
|
||||
if (subScribeToUpdate) {
|
||||
return ordered;
|
||||
@@ -395,15 +391,11 @@ export default {
|
||||
// Vue-subscribe to changes
|
||||
const subScribeToUpdate = this.updateConversionsCounter > -1;
|
||||
|
||||
const filtered = subScribeToUpdate && !this.search ?
|
||||
this.conversations :
|
||||
filter(this.conversations, (conversation) => {
|
||||
return conversation.name.toLowerCase().indexOf(this.search.toLowerCase()) !== -1;
|
||||
});
|
||||
const filtered = subScribeToUpdate && !this.search
|
||||
? this.conversations
|
||||
: filter(this.conversations, conversation => conversation.name.toLowerCase().indexOf(this.search.toLowerCase()) !== -1);
|
||||
|
||||
const ordered = orderBy(filtered, [(o) => {
|
||||
return moment(o.date).toDate();
|
||||
}], ['desc']);
|
||||
const ordered = orderBy(filtered, [o => moment(o.date).toDate()], ['desc']);
|
||||
|
||||
return ordered;
|
||||
},
|
||||
@@ -474,9 +466,7 @@ export default {
|
||||
this.$store.dispatch('user:togglePrivateMessagesOpt');
|
||||
},
|
||||
async selectConversation (key) {
|
||||
let convoFound = this.conversations.find((conversation) => {
|
||||
return conversation.key === key;
|
||||
});
|
||||
const convoFound = this.conversations.find(conversation => conversation.key === key);
|
||||
|
||||
this.selectedConversation = convoFound || {};
|
||||
|
||||
@@ -486,7 +476,7 @@ export default {
|
||||
|
||||
Vue.nextTick(() => {
|
||||
if (!this.$refs.chatscroll) return;
|
||||
let chatscroll = this.$refs.chatscroll.$el;
|
||||
const chatscroll = this.$refs.chatscroll.$el;
|
||||
chatscroll.scrollTop = chatscroll.scrollHeight;
|
||||
});
|
||||
},
|
||||
@@ -527,7 +517,7 @@ export default {
|
||||
|
||||
Vue.nextTick(() => {
|
||||
if (!this.$refs.chatscroll) return;
|
||||
let chatscroll = this.$refs.chatscroll.$el;
|
||||
const chatscroll = this.$refs.chatscroll.$el;
|
||||
chatscroll.scrollTop = chatscroll.scrollHeight;
|
||||
});
|
||||
|
||||
@@ -556,7 +546,7 @@ export default {
|
||||
return this.icons[`tier${message.contributor.level}`];
|
||||
},
|
||||
removeTags (html) {
|
||||
let tmp = document.createElement('DIV');
|
||||
const tmp = document.createElement('DIV');
|
||||
tmp.innerHTML = html;
|
||||
return tmp.textContent || tmp.innerText || '';
|
||||
},
|
||||
@@ -586,8 +576,7 @@ export default {
|
||||
|
||||
this.messagesByConversation[this.selectedConversation.key] = this.messagesByConversation[this.selectedConversation.key] || [];
|
||||
const loadedMessagesToAdd = loadedMessages
|
||||
.filter(m => this.messagesByConversation[this.selectedConversation.key].findIndex(mI => mI.id === m.id) === -1)
|
||||
;
|
||||
.filter(m => this.messagesByConversation[this.selectedConversation.key].findIndex(mI => mI.id === m.id) === -1);
|
||||
this.messagesByConversation[this.selectedConversation.key].push(...loadedMessagesToAdd);
|
||||
|
||||
// only show the load more Button if the max count was returned
|
||||
|
||||
@@ -393,14 +393,12 @@
|
||||
import moment from 'moment';
|
||||
import axios from 'axios';
|
||||
import each from 'lodash/each';
|
||||
import { mapState } from '@/libs/store';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import { mapState } from '@/libs/store';
|
||||
|
||||
import MemberDetails from '../memberDetails';
|
||||
import markdown from '@/directives/markdown';
|
||||
import achievementsLib from '@/../../common/script/libs/achievements';
|
||||
// @TODO: EMAILS.COMMUNITY_MANAGER_EMAIL
|
||||
const COMMUNITY_MANAGER_EMAIL = 'admin@habitica.com';
|
||||
import Content from '@/../../common/script/content';
|
||||
import profileStats from './profileStats';
|
||||
|
||||
@@ -415,9 +413,10 @@ import lock from '@/assets/svg/lock.svg';
|
||||
import challenge from '@/assets/svg/challenge.svg';
|
||||
import member from '@/assets/svg/member-icon.svg';
|
||||
import staff from '@/assets/svg/tier-staff.svg';
|
||||
// @TODO: EMAILS.COMMUNITY_MANAGER_EMAIL
|
||||
const COMMUNITY_MANAGER_EMAIL = 'admin@habitica.com';
|
||||
|
||||
export default {
|
||||
props: ['userId', 'startingPage'],
|
||||
directives: {
|
||||
markdown,
|
||||
},
|
||||
@@ -425,6 +424,7 @@ export default {
|
||||
MemberDetails,
|
||||
profileStats,
|
||||
},
|
||||
props: ['userId', 'startingPage'],
|
||||
data () {
|
||||
return {
|
||||
icons: Object.freeze({
|
||||
@@ -479,7 +479,7 @@ export default {
|
||||
},
|
||||
|
||||
classText () {
|
||||
let classTexts = {
|
||||
const classTexts = {
|
||||
warrior: this.$t('warrior'),
|
||||
wizard: this.$t('mage'),
|
||||
rogue: this.$t('rogue'),
|
||||
@@ -495,9 +495,6 @@ export default {
|
||||
return this.$store.getters['members:hasClass'](this.userLoggedIn);
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.loadUser();
|
||||
},
|
||||
watch: {
|
||||
startingPage () {
|
||||
this.selectedPage = this.startingPage;
|
||||
@@ -509,6 +506,9 @@ export default {
|
||||
this.loadUser();
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.loadUser();
|
||||
},
|
||||
methods: {
|
||||
async loadUser () {
|
||||
let user = this.userLoggedIn;
|
||||
@@ -518,10 +518,10 @@ export default {
|
||||
this.hero = {};
|
||||
this.adminToolsLoaded = false;
|
||||
|
||||
let profileUserId = this.userId;
|
||||
const profileUserId = this.userId;
|
||||
|
||||
if (profileUserId && profileUserId !== this.userLoggedIn._id) {
|
||||
let response = await this.$store.dispatch('members:fetchMember', { memberId: profileUserId });
|
||||
const response = await this.$store.dispatch('members:fetchMember', { memberId: profileUserId });
|
||||
user = response.data.data;
|
||||
}
|
||||
|
||||
@@ -566,20 +566,20 @@ export default {
|
||||
// return `${this.$t('checkinProgressTitle')} ${start}/${end}`;
|
||||
},
|
||||
getIncentivesProgress () {
|
||||
let currentLoginDay = Content.loginIncentives[this.user.loginIncentives];
|
||||
const currentLoginDay = Content.loginIncentives[this.user.loginIncentives];
|
||||
if (!currentLoginDay) return 0;
|
||||
let previousRewardDay = currentLoginDay.prevRewardKey;
|
||||
let nextRewardAt = currentLoginDay.nextRewardAt;
|
||||
const previousRewardDay = currentLoginDay.prevRewardKey;
|
||||
const { nextRewardAt } = currentLoginDay;
|
||||
return (this.user.loginIncentives - previousRewardDay) / (nextRewardAt - previousRewardDay) * 100;
|
||||
},
|
||||
save () {
|
||||
let values = {};
|
||||
const values = {};
|
||||
|
||||
let edits = cloneDeep(this.editingProfile);
|
||||
const edits = cloneDeep(this.editingProfile);
|
||||
|
||||
each(edits, (value, key) => {
|
||||
// Using toString because we need to compare two arrays (websites)
|
||||
let curVal = this.user.profile[key];
|
||||
const curVal = this.user.profile[key];
|
||||
|
||||
if (!curVal || value.toString() !== curVal.toString()) {
|
||||
values[`profile.${key}`] = value;
|
||||
@@ -596,7 +596,7 @@ export default {
|
||||
axios.post(`/api/v4/user/block/${this.user._id}`);
|
||||
},
|
||||
unblockUser () {
|
||||
let index = this.userLoggedIn.inbox.blocks.indexOf(this.user._id);
|
||||
const index = this.userLoggedIn.inbox.blocks.indexOf(this.user._id);
|
||||
this.userLoggedIn.inbox.blocks.splice(index, 1);
|
||||
axios.post(`/api/v4/user/block/${this.user._id}`);
|
||||
},
|
||||
|
||||
@@ -12,39 +12,39 @@
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import profile from './profile';
|
||||
import profile from './profile';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
profile,
|
||||
export default {
|
||||
components: {
|
||||
profile,
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
userId: undefined,
|
||||
startingPage: undefined,
|
||||
path: undefined,
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
this.$root.$on('habitica:show-profile', data => {
|
||||
this.userId = data.userId;
|
||||
this.startingPage = data.startingPage || 'profile';
|
||||
this.path = data.path;
|
||||
this.$root.$emit('bv::show::modal', 'profile');
|
||||
});
|
||||
},
|
||||
destroyed () {
|
||||
this.$root.$off('habitica:show-profile');
|
||||
},
|
||||
methods: {
|
||||
onShown () {
|
||||
history.pushState('', null, this.path);
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
userId: undefined,
|
||||
startingPage: undefined,
|
||||
path: undefined,
|
||||
};
|
||||
onHidden () {
|
||||
if (this.$route.path !== window.location.pathname) {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.$root.$on('habitica:show-profile', (data) => {
|
||||
this.userId = data.userId;
|
||||
this.startingPage = data.startingPage || 'profile';
|
||||
this.path = data.path;
|
||||
this.$root.$emit('bv::show::modal', 'profile');
|
||||
});
|
||||
},
|
||||
destroyed () {
|
||||
this.$root.$off('habitica:show-profile');
|
||||
},
|
||||
methods: {
|
||||
onShown () {
|
||||
history.pushState('', null, this.path);
|
||||
},
|
||||
onHidden () {
|
||||
if (this.$route.path !== window.location.pathname) {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import profile from './profile';
|
||||
import profile from './profile';
|
||||
|
||||
export default {
|
||||
props: ['userId', 'startingPage'],
|
||||
components: {
|
||||
profile,
|
||||
},
|
||||
};
|
||||
export default {
|
||||
components: {
|
||||
profile,
|
||||
},
|
||||
props: ['userId', 'startingPage'],
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -150,205 +150,202 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import toggleSwitch from '@/components/ui/toggleSwitch';
|
||||
import attributesGrid from '@/components/inventory/equipment/attributesGrid';
|
||||
import axios from 'axios';
|
||||
import size from 'lodash/size';
|
||||
import keys from 'lodash/keys';
|
||||
import toggleSwitch from '@/components/ui/toggleSwitch';
|
||||
import attributesGrid from '@/components/inventory/equipment/attributesGrid';
|
||||
|
||||
import { mapState } from '@/libs/store';
|
||||
import Content from '@/../../common/script/content';
|
||||
import { beastMasterProgress, mountMasterProgress } from '@/../../common/script/count';
|
||||
import autoAllocate from '@/../../common/script/fns/autoAllocate';
|
||||
import allocateBulk from '@/../../common/script/ops/stats/allocateBulk';
|
||||
import statsComputed from '@/../../common/script/libs/statsComputed';
|
||||
import { mapState } from '@/libs/store';
|
||||
import Content from '@/../../common/script/content';
|
||||
import { beastMasterProgress, mountMasterProgress } from '@/../../common/script/count';
|
||||
import autoAllocate from '@/../../common/script/fns/autoAllocate';
|
||||
import allocateBulk from '@/../../common/script/ops/stats/allocateBulk';
|
||||
import statsComputed from '@/../../common/script/libs/statsComputed';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
import size from 'lodash/size';
|
||||
import keys from 'lodash/keys';
|
||||
const DROP_ANIMALS = keys(Content.pets);
|
||||
const TOTAL_NUMBER_OF_DROP_ANIMALS = DROP_ANIMALS.length;
|
||||
export default {
|
||||
components: {
|
||||
toggleSwitch,
|
||||
attributesGrid,
|
||||
},
|
||||
props: ['user', 'showAllocation'],
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
equipTypes: {
|
||||
eyewear: this.$t('eyewear'),
|
||||
head: this.$t('headgearCapitalized'),
|
||||
headAccessory: this.$t('headAccess'),
|
||||
back: this.$t('backAccess'),
|
||||
armor: this.$t('armorCapitalized'),
|
||||
body: this.$t('bodyAccess'),
|
||||
weapon: this.$t('mainHand'),
|
||||
_skip: 'skip',
|
||||
shield: this.$t('offHand'),
|
||||
},
|
||||
|
||||
const DROP_ANIMALS = keys(Content.pets);
|
||||
const TOTAL_NUMBER_OF_DROP_ANIMALS = DROP_ANIMALS.length;
|
||||
export default {
|
||||
props: ['user', 'showAllocation'],
|
||||
components: {
|
||||
toggleSwitch,
|
||||
attributesGrid,
|
||||
allocateStatsList: {
|
||||
str: { title: 'allocateStr', popover: 'strengthText', allocatepop: 'allocateStrPop' },
|
||||
int: { title: 'allocateInt', popover: 'intText', allocatepop: 'allocateIntPop' },
|
||||
con: { title: 'allocateCon', popover: 'conText', allocatepop: 'allocateConPop' },
|
||||
per: { title: 'allocatePer', popover: 'perText', allocatepop: 'allocatePerPop' },
|
||||
},
|
||||
|
||||
stats: {
|
||||
str: {
|
||||
title: 'strength',
|
||||
popover: 'strengthText',
|
||||
},
|
||||
int: {
|
||||
title: 'intelligence',
|
||||
popover: 'intText',
|
||||
},
|
||||
con: {
|
||||
title: 'constitution',
|
||||
popover: 'conText',
|
||||
},
|
||||
per: {
|
||||
title: 'perception',
|
||||
popover: 'perText',
|
||||
},
|
||||
},
|
||||
statUpdates: {
|
||||
str: 0,
|
||||
int: 0,
|
||||
con: 0,
|
||||
per: 0,
|
||||
},
|
||||
content: Content,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
flatGear: 'content.gear.flat',
|
||||
}),
|
||||
equippedItems () {
|
||||
return this.user.items.gear.equipped;
|
||||
},
|
||||
costumeItems () {
|
||||
return this.user.items.gear.costume;
|
||||
},
|
||||
statsComputed () {
|
||||
return statsComputed(this.user);
|
||||
},
|
||||
userLevel100Plus () {
|
||||
return this.user.stats.lvl >= 100;
|
||||
},
|
||||
showStatsSave () {
|
||||
return Boolean(this.user.stats.points);
|
||||
},
|
||||
pointsRemaining () {
|
||||
let { points } = this.user.stats;
|
||||
Object.values(this.statUpdates).forEach(value => {
|
||||
points -= value;
|
||||
});
|
||||
return points;
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
equipTypes: {
|
||||
eyewear: this.$t('eyewear'),
|
||||
head: this.$t('headgearCapitalized'),
|
||||
headAccessory: this.$t('headAccess'),
|
||||
back: this.$t('backAccess'),
|
||||
armor: this.$t('armorCapitalized'),
|
||||
body: this.$t('bodyAccess'),
|
||||
weapon: this.$t('mainHand'),
|
||||
_skip: 'skip',
|
||||
shield: this.$t('offHand'),
|
||||
},
|
||||
|
||||
allocateStatsList: {
|
||||
str: { title: 'allocateStr', popover: 'strengthText', allocatepop: 'allocateStrPop' },
|
||||
int: { title: 'allocateInt', popover: 'intText', allocatepop: 'allocateIntPop' },
|
||||
con: { title: 'allocateCon', popover: 'conText', allocatepop: 'allocateConPop' },
|
||||
per: { title: 'allocatePer', popover: 'perText', allocatepop: 'allocatePerPop' },
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getGearTitle (key) {
|
||||
return this.flatGear[key].text();
|
||||
},
|
||||
totalAllocatedStats (stat) {
|
||||
return this.user.stats[stat] + this.statUpdates[stat];
|
||||
},
|
||||
totalStatPoints (stat) {
|
||||
return this.statsComputed[stat] + this.statUpdates[stat];
|
||||
},
|
||||
totalCount (objectToCount) {
|
||||
const total = size(objectToCount);
|
||||
return total;
|
||||
},
|
||||
formatAnimal (animalName, type) {
|
||||
if (type === 'pet') {
|
||||
if (Content.petInfo.hasOwnProperty(animalName)) {
|
||||
return Content.petInfo[animalName].text();
|
||||
}
|
||||
return this.$t('noActivePet');
|
||||
} if (type === 'mount') {
|
||||
if (Content.mountInfo.hasOwnProperty(animalName)) {
|
||||
return Content.mountInfo[animalName].text();
|
||||
}
|
||||
return this.$t('noActiveMount');
|
||||
}
|
||||
},
|
||||
formatBackground (background) {
|
||||
const bg = Content.appearances.background;
|
||||
|
||||
stats: {
|
||||
str: {
|
||||
title: 'strength',
|
||||
popover: 'strengthText',
|
||||
},
|
||||
int: {
|
||||
title: 'intelligence',
|
||||
popover: 'intText',
|
||||
},
|
||||
con: {
|
||||
title: 'constitution',
|
||||
popover: 'conText',
|
||||
},
|
||||
per: {
|
||||
title: 'perception',
|
||||
popover: 'perText',
|
||||
},
|
||||
},
|
||||
statUpdates: {
|
||||
str: 0,
|
||||
int: 0,
|
||||
con: 0,
|
||||
per: 0,
|
||||
},
|
||||
content: Content,
|
||||
if (bg.hasOwnProperty(background)) {
|
||||
return `${bg[background].text()} (${this.$t(bg[background].set.text)})`;
|
||||
}
|
||||
|
||||
return this.$t('noBackground');
|
||||
},
|
||||
beastMasterProgress (pets) {
|
||||
const dropPetsFound = beastMasterProgress(pets);
|
||||
const display = this.formatOutOfTotalDisplay(dropPetsFound, TOTAL_NUMBER_OF_DROP_ANIMALS);
|
||||
|
||||
return display;
|
||||
},
|
||||
mountMasterProgress (mounts) {
|
||||
const dropMountsFound = mountMasterProgress(mounts);
|
||||
const display = this.formatOutOfTotalDisplay(dropMountsFound, TOTAL_NUMBER_OF_DROP_ANIMALS);
|
||||
|
||||
return display;
|
||||
},
|
||||
formatOutOfTotalDisplay (stat, totalStat) {
|
||||
const display = `${stat}/${totalStat}`;
|
||||
return display;
|
||||
},
|
||||
allocate (stat) {
|
||||
if (this.pointsRemaining === 0) return;
|
||||
this.statUpdates[stat]++;
|
||||
},
|
||||
deallocate (stat) {
|
||||
if (this.statUpdates[stat] === 0) return;
|
||||
this.statUpdates[stat]--;
|
||||
},
|
||||
async saveAttributes () {
|
||||
this.loading = true;
|
||||
|
||||
const statUpdates = {};
|
||||
['str', 'int', 'per', 'con'].forEach(stat => {
|
||||
if (this.statUpdates[stat] > 0) statUpdates[stat] = this.statUpdates[stat];
|
||||
});
|
||||
|
||||
// reset statUpdates to zero before request to avoid display errors while waiting for server
|
||||
this.statUpdates = {
|
||||
str: 0,
|
||||
int: 0,
|
||||
con: 0,
|
||||
per: 0,
|
||||
};
|
||||
|
||||
allocateBulk(this.user, { body: { stats: statUpdates } });
|
||||
|
||||
await axios.post('/api/v4/user/allocate-bulk', {
|
||||
stats: statUpdates,
|
||||
});
|
||||
|
||||
this.loading = false;
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
flatGear: 'content.gear.flat',
|
||||
}),
|
||||
equippedItems () {
|
||||
return this.user.items.gear.equipped;
|
||||
},
|
||||
costumeItems () {
|
||||
return this.user.items.gear.costume;
|
||||
},
|
||||
statsComputed () {
|
||||
return statsComputed(this.user);
|
||||
},
|
||||
userLevel100Plus () {
|
||||
return this.user.stats.lvl >= 100;
|
||||
},
|
||||
showStatsSave () {
|
||||
return Boolean(this.user.stats.points);
|
||||
},
|
||||
pointsRemaining () {
|
||||
let points = this.user.stats.points;
|
||||
Object.values(this.statUpdates).forEach(value => {
|
||||
points -= value;
|
||||
});
|
||||
return points;
|
||||
},
|
||||
|
||||
allocateNow () {
|
||||
autoAllocate(this.user);
|
||||
},
|
||||
methods: {
|
||||
getGearTitle (key) {
|
||||
return this.flatGear[key].text();
|
||||
},
|
||||
totalAllocatedStats (stat) {
|
||||
return this.user.stats[stat] + this.statUpdates[stat];
|
||||
},
|
||||
totalStatPoints (stat) {
|
||||
return this.statsComputed[stat] + this.statUpdates[stat];
|
||||
},
|
||||
totalCount (objectToCount) {
|
||||
let total = size(objectToCount);
|
||||
return total;
|
||||
},
|
||||
formatAnimal (animalName, type) {
|
||||
if (type === 'pet') {
|
||||
if (Content.petInfo.hasOwnProperty(animalName)) {
|
||||
return Content.petInfo[animalName].text();
|
||||
} else {
|
||||
return this.$t('noActivePet');
|
||||
}
|
||||
} else if (type === 'mount') {
|
||||
if (Content.mountInfo.hasOwnProperty(animalName)) {
|
||||
return Content.mountInfo[animalName].text();
|
||||
} else {
|
||||
return this.$t('noActiveMount');
|
||||
}
|
||||
}
|
||||
},
|
||||
formatBackground (background) {
|
||||
let bg = Content.appearances.background;
|
||||
setAutoAllocate () {
|
||||
const settings = {
|
||||
'preferences.automaticAllocation': Boolean(this.user.preferences.automaticAllocation),
|
||||
'preferences.allocationMode': 'taskbased',
|
||||
};
|
||||
|
||||
if (bg.hasOwnProperty(background)) {
|
||||
return `${bg[background].text()} (${this.$t(bg[background].set.text)})`;
|
||||
}
|
||||
|
||||
return this.$t('noBackground');
|
||||
},
|
||||
beastMasterProgress (pets) {
|
||||
let dropPetsFound = beastMasterProgress(pets);
|
||||
let display = this.formatOutOfTotalDisplay(dropPetsFound, TOTAL_NUMBER_OF_DROP_ANIMALS);
|
||||
|
||||
return display;
|
||||
},
|
||||
mountMasterProgress (mounts) {
|
||||
let dropMountsFound = mountMasterProgress(mounts);
|
||||
let display = this.formatOutOfTotalDisplay(dropMountsFound, TOTAL_NUMBER_OF_DROP_ANIMALS);
|
||||
|
||||
return display;
|
||||
},
|
||||
formatOutOfTotalDisplay (stat, totalStat) {
|
||||
let display = `${stat}/${totalStat}`;
|
||||
return display;
|
||||
},
|
||||
allocate (stat) {
|
||||
if (this.pointsRemaining === 0) return;
|
||||
this.statUpdates[stat]++;
|
||||
},
|
||||
deallocate (stat) {
|
||||
if (this.statUpdates[stat] === 0) return;
|
||||
this.statUpdates[stat]--;
|
||||
},
|
||||
async saveAttributes () {
|
||||
this.loading = true;
|
||||
|
||||
const statUpdates = {};
|
||||
['str', 'int', 'per', 'con'].forEach(stat => {
|
||||
if (this.statUpdates[stat] > 0) statUpdates[stat] = this.statUpdates[stat];
|
||||
});
|
||||
|
||||
// reset statUpdates to zero before request to avoid display errors while waiting for server
|
||||
this.statUpdates = {
|
||||
str: 0,
|
||||
int: 0,
|
||||
con: 0,
|
||||
per: 0,
|
||||
};
|
||||
|
||||
allocateBulk(this.user, { body: { stats: statUpdates } });
|
||||
|
||||
await axios.post('/api/v4/user/allocate-bulk', {
|
||||
stats: statUpdates,
|
||||
});
|
||||
|
||||
this.loading = false;
|
||||
},
|
||||
allocateNow () {
|
||||
autoAllocate(this.user);
|
||||
},
|
||||
setAutoAllocate () {
|
||||
let settings = {
|
||||
'preferences.automaticAllocation': Boolean(this.user.preferences.automaticAllocation),
|
||||
'preferences.allocationMode': 'taskbased',
|
||||
};
|
||||
|
||||
this.$store.dispatch('user:set', settings);
|
||||
},
|
||||
this.$store.dispatch('user:set', settings);
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -181,10 +181,10 @@ import keys from 'lodash/keys';
|
||||
import { mapState } from '@/libs/store';
|
||||
import Content from '@/../../common/script/content';
|
||||
import { beastMasterProgress, mountMasterProgress } from '@/../../common/script/count';
|
||||
import statsComputed from '@/../../common/script/libs/statsComputed';
|
||||
import statsComputed from '@/../../common/script/libs/statsComputed';
|
||||
import autoAllocate from '@/../../common/script/fns/autoAllocate';
|
||||
import changeClass from '@/../../common/script/ops/changeClass';
|
||||
import allocate from '@/../../common/script/ops/stats/allocate';
|
||||
import changeClass from '@/../../common/script/ops/changeClass';
|
||||
import allocate from '@/../../common/script/ops/stats/allocate';
|
||||
|
||||
const DROP_ANIMALS = keys(Content.pets);
|
||||
const TOTAL_NUMBER_OF_DROP_ANIMALS = DROP_ANIMALS.length;
|
||||
@@ -230,7 +230,7 @@ export default {
|
||||
return this.user.stats.lvl >= 100;
|
||||
},
|
||||
classText () {
|
||||
let classTexts = {
|
||||
const classTexts = {
|
||||
warrior: this.$t('warrior'),
|
||||
wizard: this.$t('mage'),
|
||||
rogue: this.$t('rogue'),
|
||||
@@ -248,19 +248,17 @@ export default {
|
||||
if (type === 'pet') {
|
||||
if (Content.petInfo.hasOwnProperty(animalName)) {
|
||||
return Content.petInfo[animalName].text();
|
||||
} else {
|
||||
return this.$t('noActivePet');
|
||||
}
|
||||
} else if (type === 'mount') {
|
||||
return this.$t('noActivePet');
|
||||
} if (type === 'mount') {
|
||||
if (Content.mountInfo.hasOwnProperty(animalName)) {
|
||||
return Content.mountInfo[animalName].text();
|
||||
} else {
|
||||
return this.$t('noActiveMount');
|
||||
}
|
||||
return this.$t('noActiveMount');
|
||||
}
|
||||
},
|
||||
formatBackground (background) {
|
||||
let bg = Content.appearances.background;
|
||||
const bg = Content.appearances.background;
|
||||
|
||||
if (bg.hasOwnProperty(background)) {
|
||||
return `${bg[background].text()} (${this.$t(bg[background].set.text)})`;
|
||||
@@ -268,23 +266,23 @@ export default {
|
||||
return window.env.t('noBackground');
|
||||
},
|
||||
totalCount (objectToCount) {
|
||||
let total = size(objectToCount);
|
||||
const total = size(objectToCount);
|
||||
return total;
|
||||
},
|
||||
beastMasterProgress (pets) {
|
||||
let dropPetsFound = beastMasterProgress(pets);
|
||||
let display = this.formatOutOfTotalDisplay(dropPetsFound, TOTAL_NUMBER_OF_DROP_ANIMALS);
|
||||
const dropPetsFound = beastMasterProgress(pets);
|
||||
const display = this.formatOutOfTotalDisplay(dropPetsFound, TOTAL_NUMBER_OF_DROP_ANIMALS);
|
||||
|
||||
return display;
|
||||
},
|
||||
mountMasterProgress (mounts) {
|
||||
let dropMountsFound = mountMasterProgress(mounts);
|
||||
let display = this.formatOutOfTotalDisplay(dropMountsFound, TOTAL_NUMBER_OF_DROP_ANIMALS);
|
||||
const dropMountsFound = mountMasterProgress(mounts);
|
||||
const display = this.formatOutOfTotalDisplay(dropMountsFound, TOTAL_NUMBER_OF_DROP_ANIMALS);
|
||||
|
||||
return display;
|
||||
},
|
||||
formatOutOfTotalDisplay (stat, totalStat) {
|
||||
let display = `${stat}/${totalStat}`;
|
||||
const display = `${stat}/${totalStat}`;
|
||||
return display;
|
||||
},
|
||||
changeClass () {
|
||||
|
||||
Reference in New Issue
Block a user