more checks on the item.klass, also added the specialClass checks (#10859)

This commit is contained in:
negue
2018-11-22 14:35:34 +01:00
committed by Matteo Pagliazzi
parent a2b38ffb02
commit e2c5b9058b
2 changed files with 13 additions and 1 deletions

View File

@@ -27,8 +27,11 @@ export class BuyMarketGearOperation extends AbstractGoldItemOperation {
canUserPurchase (user, item) {
super.canUserPurchase(user, item);
const checkKlass = item.klass && !['special', 'armoire', user.stats.class].includes(item.klass);
const checkSpecialClass = item.klass === 'special' && item.specialClass && item.specialClass !== user.stats.class;
// check for different class gear
if (item.klass !== 'special' && item.klass !== user.stats.class) {
if (checkKlass || checkSpecialClass) {
throw new NotAuthorized(this.i18n('cannotBuyItem'));
}
}