Enchanted Armoire immediately updates XP stat in header (fixes #11827) (#11884)

* sync user if Armoire gives XP

* user can level up from Armoire

* remove XP amount from Armoire XP notification
This commit is contained in:
agentx999 2020-02-24 13:19:48 -08:00 committed by GitHub
parent 0280513a00
commit bad148148c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -78,9 +78,8 @@ async function buyArmoire (store, params) {
// @TODO: We might need to abstract notifications to library rather than mixin
const notificationOptions = isExperience
? {
text: `+ ${item.value}`,
type: 'xp',
flavorMessage: message,
text: message,
type: 'success',
}
: {
text: message,
@ -93,6 +92,10 @@ async function buyArmoire (store, params) {
timeout: true,
...notificationOptions,
});
if (isExperience) {
await store.dispatch('user:fetch', { forceLoad: true });
}
}
}

View file

@ -10,6 +10,7 @@ import {
import randomVal, * as randomValFns from '../../libs/randomVal';
import { removeItemByPath } from '../pinnedGearUtils';
import { AbstractGoldItemOperation } from './abstractBuyOperation';
import updateStats from '../../fns/updateStats';
// TODO this is only used on the server
// move out of common?
@ -156,6 +157,7 @@ export class BuyArmoireOperation extends AbstractGoldItemOperation { // eslint-d
_experienceResult (user) {
const armoireExp = Math.floor(randomValFns.trueRandom() * 40 + 10);
user.stats.exp += armoireExp;
updateStats(user, user.stats, this.req);
return {
message: this.i18n('armoireExp'),