From f12f1a39cb2ecf169b874cfbd01e038e7a41dcb8 Mon Sep 17 00:00:00 2001 From: Aivan Monceller Date: Wed, 10 Jul 2024 00:36:09 +0800 Subject: [PATCH] Add option to enable/disable mark as favorite (#334) Co-authored-by: chrisoro <4160557+chrisoro@users.noreply.github.com> --- README.md | 3 ++- src/config/models.py | 10 +++++++--- src/loot_filter.py | 2 +- src/loot_mover.py | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8116669f..84b77b9a 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,8 @@ The config folder in `C:/Users//.d4lf` contains: | handle_rares | - `filter`: Filter them based on your profiles
- `ignore`: Ignores all rares, vision mode shows them as blue and auto mode never junks or favorites them
- `junk`: Vision mode shows them always as red, auto mode always junks rares | | run_vision_mode_on_startup | If the vision mode should automatically start when starting d4lf. Otherwise has to be started manually with the vision button or the hotkey | | check_chest_tabs | Which chest tabs will be checked and filtered for items in case chest is open when starting the filter. You need to buy all slots. Counting is done left to right. E.g. 1,2,4 will check tab 1, tab 2, tab 4 | -| move_to_inv_item_type
move_to_stash_item_type | Which types of items to move when using fast move functionality. Will only affect tabs defined in check_chest_tabs.
- `favorites`: Move favorites only
- `junk`: Move junk only
- `non_favorites`: Only items not marked as favorite
- `everything`: Move everything | +| move_to_inv_item_type
move_to_stash_item_type | Which types of items to move when using fast move functionality. Will only affect tabs defined in check_chest_tabs.
- `favorites`: Move favorites only
- `junk`: Move junk only
- `unmarked`: Only items not marked as favorite or junk
- `everything`: Move everything | +| mark_as_favorite | Whether to favorite matched items or not. Defaults to true | | minimum_overlay_font_size | The minimum font size for the vision overlay, specifically the green text that shows which filter(s) are matching. Note: For small profile names, the font may actually be larger than this size but will never go below this size. | | hidden_transparency | The overlay will become transparent after not hovering it for a while. This can be changed by specifying any value between [0, 1] with 0 being completely invisible and 1 completely visible | | browser | Which browser to use to get builds, please make sure you pick an installed browser: chrome, edge or firefox are currently supported | diff --git a/src/config/models.py b/src/config/models.py index e12ed19e..62ee732f 100644 --- a/src/config/models.py +++ b/src/config/models.py @@ -37,7 +37,7 @@ class MoveItemsType(enum.StrEnum): everything = enum.auto() favorites = enum.auto() junk = enum.auto() - non_favorites = enum.auto() + unmarked = enum.auto() class LogLevels(enum.StrEnum): @@ -252,13 +252,17 @@ class GeneralModel(_IniBaseModel): description="The minimum font size for the vision overlay, specifically the green text that shows which filter(s) are matching.", ) move_to_inv_item_type: MoveItemsType = Field( - default=MoveItemsType.non_favorites, + default=MoveItemsType.everything, description="When doing stash/inventory transfer, what types of items should be moved", ) move_to_stash_item_type: MoveItemsType = Field( - default=MoveItemsType.non_favorites, + default=MoveItemsType.everything, description="When doing stash/inventory transfer, what types of items should be moved", ) + mark_as_favorite: bool = Field( + default=True, + description="Whether to favorite matched items or not", + ) profiles: list[str] = Field( default=[], description='Which filter profiles should be run. All .yaml files with "Aspects" and ' diff --git a/src/loot_filter.py b/src/loot_filter.py index c612c94f..794c604c 100644 --- a/src/loot_filter.py +++ b/src/loot_filter.py @@ -117,7 +117,7 @@ def check_items(inv: InventoryBase, force_refresh: ItemRefreshType): if not res.keep: keyboard.send("space") time.sleep(0.13) - elif res.keep and (matched_any_affixes or item_descr.rarity == ItemRarity.Unique): + elif res.keep and (matched_any_affixes or item_descr.rarity == ItemRarity.Unique) and IniConfigLoader().general.mark_as_favorite: LOGGER.info("Mark as favorite") keyboard.send("space") time.sleep(0.17) diff --git a/src/loot_mover.py b/src/loot_mover.py index 64d04462..d6cb00f1 100644 --- a/src/loot_mover.py +++ b/src/loot_mover.py @@ -98,7 +98,7 @@ def _move_items( if ( (move_item_type == MoveItemsType.favorites and item.is_fav) or (move_item_type == MoveItemsType.junk and item.is_junk) - or (move_item_type == MoveItemsType.non_favorites and not item.is_fav) + or (move_item_type == MoveItemsType.unmarked and not item.is_fav and not item.is_junk) or move_item_type == MoveItemsType.everything ): inv.hover_item(item)