Fix: reassign object for user.items.hatchingPotions to trigger change in vue view

This commit is contained in:
Xaz16
2019-12-15 22:09:07 +03:00
parent 8b780eaf0d
commit 0f755ab80d
3 changed files with 125 additions and 31 deletions

View File

@@ -120,8 +120,14 @@ export default function randomDrop (user, options, req = {}, analytics) {
randomVal(pickBy(content.hatchingPotions, (v, k) => acceptableDrops.indexOf(k) >= 0)),
);
user.items.hatchingPotions[drop.key] = user.items.hatchingPotions[drop.key] || 0;
user.items.hatchingPotions[drop.key] += 1;
user.items.hatchingPotions = {
...user.items.hatchingPotions,
[drop.key]: user.items.hatchingPotions[drop.key] || 0,
};
user.items.hatchingPotions = {
...user.items.hatchingPotions,
[drop.key]: drop.key + 1,
};
if (user.markModified) user.markModified('items.hatchingPotions');
drop.type = 'HatchingPotion';