From 5db79c8f43306342a6d2552c8248eaa87314c997 Mon Sep 17 00:00:00 2001 From: idinium96 Date: Fri, 31 Jul 2020 20:09:56 +0800 Subject: [PATCH] much better --- src/classes/MyHandler.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index 307fdc039..27297a790 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -1035,13 +1035,14 @@ export = class MyHandler extends Handler { if (wrongAboutOffer.length !== 0) { const reasons = wrongAboutOffer.map(wrong => wrong.reason); const uniqueReasons = reasons.filter(reason => reasons.includes(reason)); - const moreThanOnly = - (process.env.DISABLE_GIVE_PRICE_TO_INVALID_ITEMS === 'false' || - process.env.DISABLE_ACCEPT_OVERSTOCKED_OVERPAY === 'false') && - exchange.our.value < exchange.their.value; - const moreThanOrEqualTo = - process.env.DISABLE_GIVE_PRICE_TO_INVALID_ITEMS === 'true' && - exchange.our.value <= exchange.their.value; + + const acceptingCondition = + process.env.DISABLE_GIVE_PRICE_TO_INVALID_ITEMS === 'false' || + process.env.DISABLE_ACCEPT_OVERSTOCKED_OVERPAY === 'false' + ? exchange.our.value < exchange.their.value + : process.env.DISABLE_GIVE_PRICE_TO_INVALID_ITEMS === 'true' + ? exchange.our.value <= exchange.their.value + : false; // TO DO: Counter offer? // @@ -1066,7 +1067,7 @@ export = class MyHandler extends Handler { uniqueReasons.includes('🟫DUPED_ITEMS') || uniqueReasons.includes('🟪DUPE_CHECK_FAILED') ) && - (moreThanOnly || moreThanOrEqualTo) && + acceptingCondition && exchange.our.value !== 0 ) { this.isAcceptedWithInvalidItemsOrOverstocked = true;