mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-05 13:33:00 +00:00
parent
6bdb695616
commit
6b625a60ab
1 changed files with 12 additions and 10 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import buyOp from 'common/script/ops/buy';
|
import buyOp from 'common/script/ops/buy';
|
||||||
|
import content from 'common/script/content/index';
|
||||||
import purchaseOp from 'common/script/ops/purchaseWithSpell';
|
import purchaseOp from 'common/script/ops/purchaseWithSpell';
|
||||||
import hourglassPurchaseOp from 'common/script/ops/hourglassPurchase';
|
import hourglassPurchaseOp from 'common/script/ops/hourglassPurchase';
|
||||||
import sellOp from 'common/script/ops/sell';
|
import sellOp from 'common/script/ops/sell';
|
||||||
|
|
@ -38,21 +39,14 @@ export function buyQuestItem (store, params) {
|
||||||
|
|
||||||
async function buyArmoire (store, params) {
|
async function buyArmoire (store, params) {
|
||||||
const quantity = params.quantity || 1;
|
const quantity = params.quantity || 1;
|
||||||
|
let armoire = content.armoire;
|
||||||
|
|
||||||
let buyResult = buyOp(store.state.user.data, {
|
// We need the server result because Armoire has random item in the result
|
||||||
params: {
|
|
||||||
key: 'armoire',
|
|
||||||
},
|
|
||||||
type: 'armoire',
|
|
||||||
quantity,
|
|
||||||
});
|
|
||||||
|
|
||||||
// We need the server result because armoir has random item in the result
|
|
||||||
let result = await axios.post('/api/v3/user/buy/armoire', {
|
let result = await axios.post('/api/v3/user/buy/armoire', {
|
||||||
type: 'armoire',
|
type: 'armoire',
|
||||||
quantity,
|
quantity,
|
||||||
});
|
});
|
||||||
buyResult = result.data.data;
|
let buyResult = result.data.data;
|
||||||
|
|
||||||
if (buyResult) {
|
if (buyResult) {
|
||||||
const resData = buyResult;
|
const resData = buyResult;
|
||||||
|
|
@ -65,6 +59,14 @@ async function buyArmoire (store, params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: We might need to abstract notifications to library rather than mixin
|
// @TODO: We might need to abstract notifications to library rather than mixin
|
||||||
|
store.dispatch('snackbars:add', {
|
||||||
|
title: '',
|
||||||
|
text: `- ${armoire.value}`,
|
||||||
|
type: 'gp',
|
||||||
|
icon: '',
|
||||||
|
sign: '-',
|
||||||
|
timeout: true,
|
||||||
|
});
|
||||||
store.dispatch('snackbars:add', {
|
store.dispatch('snackbars:add', {
|
||||||
title: '',
|
title: '',
|
||||||
text: isExperience ? item.value : item.dropText,
|
text: isExperience ? item.value : item.dropText,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue