aeon0 / d4lf

Diablo 4 Loot Filter
MIT License
154 stars 38 forks source link
diablo4 loot-filter

logo

Filter items and sigils in your inventory based on affixes, aspects and thresholds of their values. For questions, feature request or issue reports join the discord or use github issues.

sample]

Features

How to Setup

Game Settings

Quick start guide

Common problems

Configs

The config folder in C:/Users/<WINDOWS_USER>/.d4lf contains:

params.ini

[general] Description
profiles A set of profiles separated by comma. d4lf will look for these yaml files in config/profiles and in C:/Users/WINDOWS_USER/.d4lf/profiles
keep_aspects - all: Keep all legendary items
- upgrade: Keep all legendary items that upgrade your codex of power
- none: Keep no legendary items based on aspect (they are still filtered!)
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
handle_uniques How to handle uniques that do not match any filter. This property does not apply to filtered uniques. All mythics are favorited regardless of filter.
- favorite: Mark the unique as favorite and vision mode will show it as green (default)
- ignore: Do nothing with the unique and vision mode will show it as green
- junk: Mark any uniques that don't match any filters as junk and show as red in vision mode
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. You can select more than one option.
- 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
full_dump When using the import build feature, whether to use the full dump (e.g. contains all filter items) or not
[char] Description
inventory Your hotkey for opening inventory
[advanced_options] Description
move_to_inv Hotkey for moving items from stash to inventory
move_to_chest Hotkey for moving items from inventory to stash
run_scripts Hotkey to start/stop vision mode
run_filter Hotkey to start/stop filtering items
run_filter_force_refresh Hotkey to start/stop filtering items with a force refresh. All item statuses will be reset
force_refresh_only Hotkey to reset all item statuses without running a filter after
exit_key Hotkey to exit d4lf.exe
log_level Logging level. Can be any of [debug, info, warning, error, critical]
scripts Running different scripts
process_name Process name of the D4 app. Defaults to "Diablo IV.exe". In case of using some remote play this might need to be adapted
vision_mode_only If set to true, only the vision mode will be available. All functionality that clicks the screen is disabled.

GUI

Documentation is not yet finished. For now, it should be self-explanatory. Just start gui.bat in the archive.

Current functionality:

Each tab gives further instructions on how to use it and what kind of input it expects.

How to filter / Profiles

All profiles define whitelist filters. If no filter included in your profiles matches the item, it will be discarded.

Your config files will be validated on startup and will prevent the program from starting if the structure or syntax is incorrect. The error message will provide hints about the specific problem.

The following sections will explain each type of filter that you can specify in your profiles. How you define them in your YAML files is up to you; you can put all of these into just one file or have a dedicated file for each type of filter, or even split the same type of filter over multiple files. Ultimately, all profiles specified in your params.ini will be used to determine if an item should be kept. If one of the profiles wants to keep the item, it will be kept regardless of the other profiles. Similarly, if a filter is missing in all profiles (e.g., there is no Sigils section in any profile), all corresponding items (in this case, sigils) will be kept.

Affix / Aspects Filter Syntax

You have three choices on how to specify aspects or affixes of an item:

As we recommend using the importer for a base version of your build, even if you intend to then manually create your own build, the examples below will use the same format as the importer.

Examples ```yaml # Filter for attack speed - { name: attack_speed } # Filter for attack speed larger than 4 - { name: attack_speed, value: 4 } # Filter for attack speed smaller than 4 - { name: attack_speed, value: 4, comparison: smaller } # Below is the older shorthand, which is still valid to use # Filter for attack speed - attack_speed # Filter for attack speed larger than 4 - [ attack_speed, 4 ] # Filter for attack speed smaller than 4 - [ attack_speed, 4, smaller ] ```

Affixes

Affixes are defined by the top-level key Affixes. It contains a list of filters that you want to apply. Each filter has a name and can filter for any combination of the following:

Config Examples ```yaml Affixes: # Search for chest armor and pants that are at least item level 725 and have at least 3 affixes of the affixPool - NiceArmor: itemType: [ chest armor, pants ] minPower: 725 affixPool: - count: - { name: dexterity, value: 33 } - { name: damage_reduction, value: 5 } - { name: lucky_hit_chance, value: 3 } - { name: total_armor, value: 9 } - { name: maximum_life, value: 700 } minCount: 3 # Search for chest armor that is at least item level 925 and have at least 3 affixes of the affixPool. At least 2 of the matched affixes must be greater affixes - NiceArmor: itemType: chest armor minPower: 925 affixPool: - count: - { name: dexterity } - { name: damage_reduction } - { name: lucky_hit_chance } - { name: total_armor } - { name: maximum_life } minCount: 3 minGreaterAffixCount: 2 # Search for boots that have at least 2 of the specified affixes and either max evade charges or reduced evade cooldown as inherent affix - GreatBoots: itemType: boots minPower: 800 inherentPool: - count: - { name: maximum_evade_charges } - { name: attacks_reduce_evades_cooldown_by_seconds } minCount: 1 affixPool: - count: - { name: movement_speed, value: 16 } - { name: cold_resistance } - { name: lightning_resistance } minCount: 2 # Search for boots with movement speed and 1 resistances from a pool of all resistances. # No need to add maxCount to the resistance group since it isn't possible for an item to have more than one resistance affix - ResBoots: itemType: boots minPower: 800 affixPool: - count: - { name: movement_speed, value: 16 } - count: - { name: shadow_resistance } - { name: cold_resistance } - { name: lightning_resistance } - { name: fire_resistance } - { name: poison_resistance } minCount: 1 # Search for boots with movement speed. At least two of all item affixes must be a greater affix - GreaterAffixBoots: itemType: boots minPower: 800 minGreaterAffixCount: 2 affixPool: - count: - { name: movement_speed, value: 16 } ```

Affix names are lower case and spaces are replaced by underscore. You can find the full list of names in assets/lang/enUS/affixes.json.

Sigils

Sigils are defined by the top-level key Sigils. It contains a list of affix or location names that you want to filter for. If no Sigil filter is provided, all Sigils will be kept.

Config Examples ```yaml Sigils: minTier: 40 maxTier: 100 blacklist: # locations - endless_gates - vault_of_the_forsaken # affixes - armor_breakers - resistance_breakers ``` If you want to filter for a specific affix or location, you can also use the `whitelist` key. Even if `whitelist` is present, `blacklist` will be used to discard sigils that match any of the blacklisted affixes or locations. ```yaml # Only keep sigils for vault_of_the_forsaken without any of the affixes armor_breakers and resistance_breakers Sigils: minTier: 40 maxTier: 100 blacklist: - armor_breakers - resistance_breakers whitelist: - vault_of_the_forsaken ``` To switch that priority, you can add the `priority` key with the value `whitelist`. ```yaml # This will keep all vault of the forsaken sigils even if they have armor_breakers or resistance_breakers Sigils: minTier: 40 maxTier: 100 blacklist: - armor_breakers - resistance_breakers whitelist: - vault_of_the_forsaken priority: whitelist ``` You can also create conditional filters based on a single affix or location. ```yaml # Only keep sigils for iron_hold when it also has shadow_damage Sigils: minTier: 40 maxTier: 100 blacklist: - armor_breakers - resistance_breakers whitelist: - [ iron_hold, shadow_damage ] ```

Sigil affixes and location names are lower case and spaces are replaced by underscore. You can find the full list of names in assets/lang/enUS/sigils.json.

Uniques

Uniques are defined by the top-level key Uniques. It contains a list of parameters that you want to filter for. If no Unique filter is provided, uniques will be handled according to the handle_uniques configuration. All mythics are marked as favorite regardless of any filter or configuration.

Uniques can be filtered in two ways. First the aspect and affix for a specific unique can be filtered directly. This is how imported profiles are configured. If only aspect filtering is applied, then all other uniques will be handled according to the handle_uniques property. For aspect filtering, since uniques all have a predefined affix, you'll only need to specify the threshold that you want to apply (see examples below).

Additionally, you can filter all uniques based on a generic property like their item power or if they have greater affixes. Once a "global" filter like this is applied then all uniques will have a filter that now applies to them and handle_uniques will be ignored.

In vision mode, uniques show as .. For example myuniques.yaml with fists_of_fate aspect defined would show as myuniques.fists_of_fate. The label for the filename can be configured at the aspect level using the profileAlias flag (see examples).

Config Examples ```yaml # Take only mythic uniques Uniques: - mythic: true ``` ```yaml # Take all uniques with item power > 900 Uniques: - minPower: 900 ``` ```yaml # Take all unique pants Uniques: - itemType: pants ``` ```yaml # Take all unique chest armors and pants Uniques: - itemType: [ chest armor, pants ] ``` ```yaml # Take all unique chest armors and pants with min item power > 900 Uniques: - itemType: [ chest armor, pants ] minPower: 900 ``` ```yaml # Take all Tibault's Will pants Uniques: - aspect: { name: tibaults_will } ``` ```yaml # Take all Tibault's Will pants with at least 2 greater affixes. # Have vision mode show this as my_cool_items.tibaults_will instead of .tibaults_will Uniques: - aspect: { name: tibaults_will } minGreaterAffixCount: 2 profileAlias: my_cool_items ``` ```yaml # Take all Tibault's Will pants that have item power > 900 and dmg reduction from close > 12 as well as aspect value > 25 Uniques: - aspect: { name: tibaults_will, value: 25 } minPower: 900 affix: - { name: damage_reduction_from_close_enemies, value: 12 } ```

Unique names are lower case and spaces are replaced by underscore. You can find the full list of names in assets/lang/enUS/uniques.json.

Develop

Python Setup

Conda setup:

git clone https://github.com/aeon0/d4lf
cd d4lf
conda env create -f environment.yml
conda activate d4lf
python -m src.main

Python setup (windows, linux venv activation differs):

git clone https://github.com/aeon0/d4lf
cd d4lf
python -m venv venv
venv\Scripts\activate
python -m pip install -r requirements.txt
python -m src.main

Formatting & Linting

Ruff is used for linting and auto formatting. You can run it with:

ruff format
ruff check

Setup VS Code by using the ruff extension. Also turn on "trim trailing whitespaces" is VS Code settings.

Credits