mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
* 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:
@@ -108,12 +108,6 @@ shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) {
|
|||||||
gear.locked = true;
|
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) {
|
if (gear.canOwn) {
|
||||||
gear.locked = !gear.canOwn(user);
|
gear.locked = !gear.canOwn(user);
|
||||||
}
|
}
|
||||||
@@ -124,6 +118,12 @@ shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) {
|
|||||||
gear.locked = true;
|
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;
|
gear.owned = itemOwned;
|
||||||
|
|
||||||
// @TODO: I'm not sure what the logic for locking is supposed to be
|
// @TODO: I'm not sure what the logic for locking is supposed to be
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export class BuyMarketGearOperation extends AbstractGoldItemOperation { // eslin
|
|||||||
const checkSpecialClass = item.klass === 'special' && item.specialClass && item.specialClass !== user.stats.class;
|
const checkSpecialClass = item.klass === 'special' && item.specialClass && item.specialClass !== user.stats.class;
|
||||||
|
|
||||||
// check for different class gear
|
// check for different class gear
|
||||||
if (checkKlass || checkSpecialClass) {
|
if ((checkKlass || checkSpecialClass) && user.items.gear.owned[item.key] !== false) {
|
||||||
throw new NotAuthorized(this.i18n('cannotBuyItem'));
|
throw new NotAuthorized(this.i18n('cannotBuyItem'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user