for locking items in market, special overrides available set. fixes #13798 (#13817)

* for locking items, special overrides available

* fix(market): allow purchase of broken item

Co-authored-by: Megan Shepherd <meg.d.shep@gmail.com>
Co-authored-by: SabreCat <sabe@habitica.com>
This commit is contained in:
Megan Searles
2022-05-13 15:11:49 -06:00
committed by GitHub
parent 1a74d2b3b0
commit 5bc544c481
2 changed files with 7 additions and 7 deletions

View File

@@ -108,12 +108,6 @@ shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) {
gear.locked = true;
}
if (Boolean(gear.specialClass) && Boolean(gear.set)) {
const currentSet = gear.set === seasonalShopConfig.pinnedSets[gear.specialClass];
gear.locked = currentSet && user.stats.class !== gear.specialClass;
}
if (gear.canOwn) {
gear.locked = !gear.canOwn(user);
}
@@ -124,6 +118,12 @@ shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) {
gear.locked = true;
}
if (Boolean(gear.specialClass) && Boolean(gear.set)) {
const currentSet = gear.set === seasonalShopConfig.pinnedSets[gear.specialClass];
gear.locked = currentSet && user.stats.class !== gear.specialClass;
}
gear.owned = itemOwned;
// @TODO: I'm not sure what the logic for locking is supposed to be

View File

@@ -28,7 +28,7 @@ export class BuyMarketGearOperation extends AbstractGoldItemOperation { // eslin
const checkSpecialClass = item.klass === 'special' && item.specialClass && item.specialClass !== user.stats.class;
// check for different class gear
if (checkKlass || checkSpecialClass) {
if ((checkKlass || checkSpecialClass) && user.items.gear.owned[item.key] !== false) {
throw new NotAuthorized(this.i18n('cannotBuyItem'));
}
}