Skip to content

Commit

Permalink
Add option to enable/disable mark as favorite (#334)
Browse files Browse the repository at this point in the history
Co-authored-by: chrisoro <[email protected]>
  • Loading branch information
geocine and chrisoro authored Jul 9, 2024
1 parent 8a43626 commit f12f1a3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ The config folder in `C:/Users/<WINDOWS_USER>/.d4lf` contains:
| handle_rares | - `filter`: Filter them based on your profiles <br>- `ignore`: Ignores all rares, vision mode shows them as blue and auto mode never junks or favorites them <br>- `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<br/>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. <br>- `favorites`: Move favorites only <br>- `junk`: Move junk only <br>- `non_favorites`: Only items not marked as favorite <br>- `everything`: Move everything |
| move_to_inv_item_type<br/>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. <br>- `favorites`: Move favorites only <br>- `junk`: Move junk only <br>- `unmarked`: Only items not marked as favorite or junk <br>- `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 |
Expand Down
10 changes: 7 additions & 3 deletions src/config/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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 '
Expand Down
2 changes: 1 addition & 1 deletion src/loot_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/loot_mover.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f12f1a3

Please sign in to comment.