mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-25 07:05:51 +00:00
* sync user if Armoire gives XP * user can level up from Armoire * remove XP amount from Armoire XP notification
This commit is contained in:
parent
0280513a00
commit
bad148148c
2 changed files with 8 additions and 3 deletions
|
|
@ -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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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'),
|
||||
|
|
|
|||
Loading…
Reference in a new issue