mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
refresh gear overview (#10971)
* refresh bought seasonal gear * just "subscribe" to the _v change instead of returning the value * subscribe in vue instead of lib
This commit is contained in:
@@ -388,7 +388,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
seasonal () {
|
seasonal () {
|
||||||
|
// vue subscriptions, don't remove
|
||||||
let backgroundUpdate = this.backgroundUpdate; // eslint-disable-line
|
let backgroundUpdate = this.backgroundUpdate; // eslint-disable-line
|
||||||
|
const myUserVersion = this.user._v; // eslint-disable-line
|
||||||
|
|
||||||
let seasonal = shops.getSeasonalShop(this.user);
|
let seasonal = shops.getSeasonalShop(this.user);
|
||||||
|
|
||||||
|
|||||||
@@ -85,30 +85,16 @@ function removePinnedGearByClass (user) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removePinnedGearAddPossibleNewOnes (user, itemPath, newItemKey) {
|
function removePinnedGearAddPossibleNewOnes (user, itemPath, newItemKey) {
|
||||||
let currentPinnedItems = selectGearToPin(user);
|
|
||||||
let removeAndAddAllItems = false;
|
|
||||||
|
|
||||||
for (let item of currentPinnedItems) {
|
|
||||||
let itemInfo = getItemInfo(user, 'marketGear', item);
|
|
||||||
|
|
||||||
if (itemInfo.path === itemPath) {
|
|
||||||
removeAndAddAllItems = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
removeItemByPath(user, itemPath);
|
removeItemByPath(user, itemPath);
|
||||||
|
|
||||||
if (removeAndAddAllItems) {
|
// an item of the users current "new" gear was bought
|
||||||
// an item of the users current "new" gear was bought
|
// remove the old pinned gear items and add the new gear back
|
||||||
// remove the old pinned gear items and add the new gear back
|
removePinnedGearByClass(user);
|
||||||
removePinnedGearByClass(user);
|
user.items.gear.owned[newItemKey] = true;
|
||||||
user.items.gear.owned[newItemKey] = true;
|
addPinnedGearByClass(user);
|
||||||
addPinnedGearByClass(user);
|
|
||||||
} else {
|
// update the version, so that vue can refresh the seasonal shop
|
||||||
// just change the new gear to owned
|
user._v++;
|
||||||
user.items.gear.owned[newItemKey] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user