From ca7eab7d86400bd8feadf9e76f736f927658825e Mon Sep 17 00:00:00 2001 From: idinium96 Date: Thu, 16 Jul 2020 10:17:00 +0800 Subject: [PATCH] fix Autokeys not buying keys when refs >= maxRef --- README.md | 34 +++++++++++++++++----------------- src/classes/MyHandler.ts | 10 ++++------ 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 5477f223c..77cea2b40 100644 --- a/README.md +++ b/README.md @@ -92,23 +92,23 @@ If you want to use this feature, you must use [ecosystem.template.json](https:// This feature when enabled, your bot will automatically buy or sell keys based on your bot pure availability and your settings on this feature. You'll need to set your minimum/maximum keys and minimum/maximum refined metals in your ecosystem.json - more explaination can be found [here](https://github.com/idinium96/tf2autobot#your-bot-settings) starting on `ENABLE_AUTO_SELL_AND_BUY_KEYS` until `MAXIMUM_REFINED_TO_STOP_SELL_KEYS`. ``` -.____________________________________________________________. ._______________________________. -| **Buying Keys** | **Selling Keys** | | **Banking Keys** | -| *************** | **************** | | **************** | -| <—————————————○ | ○——————————————> | | ○——————————————> | -| Keys -----|--------|-----> | Keys -----|--------|-----> | | Keys -----|--------|-----> | -| ○—————> | <————○ | | ○————————○ | -| Refs -----|--------|-----> | Refs -----|--------|-----> | | Refs -----|--------|-----> | -| min max | min max | | min max | -|_____________________________|______________________________| |______________________________.| - | **Disabled** | | **Disabled** | - | ************ | | ************ | - | <····●········●·····> | | <————● | - | Keys -----|--------|-----> | | Keys -----|--------|-----> | - | ●————————●·····> | | <—————————————● | - | Refs -----|--------|-----> | | Refs -----|--------|-----> | - | min max | | min max | - |_____________________________| |_______________________________| +.____________________________________________________________. ._______________________________. +| **Buying Keys** | **Selling Keys** | | **Banking Keys** | +| *************** | **************** | | **************** | +| <———————————○ | ○————————————> | | ○————————————> | +| Keys -----|--------|-----> | Keys -----|--------|-----> | | Keys -----|--------|-----> |_______________________________. +| ○———> | <——○ | | ○————————○ | **Disabled** | +| Refs -----|--------|-----> | Refs -----|--------|-----> | | Refs -----|--------|-----> | ************ | +| min max | min max | | min max | <——● | +|_____________________________|______________________________| |______________________________.| Keys -----|--------|-----> | + | **Disabled** | | **Buying when more ref** | <———————————● | + | ************ | | ************ | Refs -----|--------|-----> | + | <——●————————●···> | | <——● | min max | + | Keys -----|--------|-----> | | Keys -----|--------|-----> |_______________________________| + | ●————————●···> | | ○————————————> | + | Refs -----|--------|-----> | | Refs -----|--------|-----> | + | min max | | min max | + |_____________________________| |_______________________________| ``` Some screenshots: diff --git a/src/classes/MyHandler.ts b/src/classes/MyHandler.ts index 5e34aa73d..6e5846e65 100644 --- a/src/classes/MyHandler.ts +++ b/src/classes/MyHandler.ts @@ -1394,13 +1394,11 @@ export = class MyHandler extends Handler { * (currKeys ≤ minKeys OR minKeys ≤ currKeys ≤ maxKeys OR currKeys ≥ maxKeys) */ const isRemoveAutoKeys = - (((currReftoScrap >= userMinReftoScrap && currReftoScrap <= userMaxReftoScrap) || - currReftoScrap >= userMaxReftoScrap) && - (currKeys <= userMinKeys || - (currKeys >= userMinKeys && currKeys <= userMaxKeys) || - currKeys >= userMaxKeys)) !== false; + (currReftoScrap >= userMaxReftoScrap && currKeys >= userMaxKeys) || + (currReftoScrap >= userMinReftoScrap && currReftoScrap <= userMaxReftoScrap && currKeys <= userMaxKeys) !== + false; /* - // <·····●····························●·····> \ + // <——————————————————————————————————●·····> \ // Keys --------|----------------------------|----------> ⟩ AND // ●————————————————————————————●·····> / // Refs --------|----------------------------|---------->