From bad148148cb362e4f65161893362aadcef329dee Mon Sep 17 00:00:00 2001 From: agentx999 Date: Mon, 24 Feb 2020 13:19:48 -0800 Subject: [PATCH] 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 --- website/client/src/store/actions/shops.js | 9 ++++++--- website/common/script/ops/buy/buyArmoire.js | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/website/client/src/store/actions/shops.js b/website/client/src/store/actions/shops.js index fea30216b8..52c2aea350 100644 --- a/website/client/src/store/actions/shops.js +++ b/website/client/src/store/actions/shops.js @@ -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 }); + } } } diff --git a/website/common/script/ops/buy/buyArmoire.js b/website/common/script/ops/buy/buyArmoire.js index fab02460d7..9a7f91e200 100644 --- a/website/common/script/ops/buy/buyArmoire.js +++ b/website/common/script/ops/buy/buyArmoire.js @@ -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'),