Skip to content

Commit

Permalink
Config adaptation (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeon0 authored Nov 7, 2023
1 parent eadfcac commit 8223688
Show file tree
Hide file tree
Showing 25 changed files with 321 additions and 240 deletions.
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@ Filter items in your inventory based on affixes, aspects and thresholds of their
- Filter by affix and thresholds of their values
- Filter by aspects and threshold of their values
- Mark everything that does not pass the filter as junk
- Supported resolutions: 1080p, 1440p, 2160p
- Detect already marked as junk and marked as favorite and ignores them
- Detect sigils, elixirs and matrial and ignores them
- Supported resolutions: 1080p, 1440p, 1440p wide, 2160p

## How to Setup

### Game Settings
- Font size can be small or medium (better tested on small) in the Gameplay Settings
- Game Language must be English
- Advanced Tooltip Information (showing min and max values) is fine. But the Compare has to be truned off
- Advanced Tooltip Information (showing min and max values) is fine. But the _Advanced Tooltip Compare_ has to be truned off

### Run
- Download the latest version (.zip) from the releases: https://github.com/aeon0/d4lf/releases
- Execute d4lf.exe and go to your D4 screen
- There is a small overlay on the center bottom with buttons:
- toggle: Make the console visiable or hide it
- toggle: Minimize/Maximize the console
- filter: Start filtering items
- scripts: In case there are any scripts attached, run them
- Alternative use the hotkeys. e.g. f11 for filtering
- All items that do not match any of your filter configs will be marked as junk.

Note: Make sure to only have items in your inventory (will ignore junk and fav marked items). But elixirs (seen as magic) or material (seen as common) will be marked as junk!

### Configs
The config folder contains:
- __filter_aspects.yaml__: Filter settings for aspects.
- __filter_affixes.yaml__: Filter settings for affixes.
- __profiles/*.yaml__: These files determine what should be filtered.
- __params.ini__: Different hotkey settings and number of chest stashes that should be looked at.
- __game.ini__: Settings regarding color thresholds and image positions. You dont need to touch this.

### params.ini
| [general] | Description |
| ----------------------- | --------------------------------------|
| profiles | A set of profiles seperated by comma. d4lf will look for these yaml files in config/profiles and in C:/Users/WINDOWS_USER/.d4lf/profiles. |
| check_chest_tabs | How many chest tabs will be checked and fitlered for items in case chest is open when starting the filter. E.g. 2 will check first two chest tabs |
| hidden_transparency | The overlay will go more transparent after not hovering it for a while. This can be any value between [0, 1] with 0 being completely invisible and 1 completely visible. Note the default "visible" transparancy is 0.89 |
| local_prefs_path | In case your prefs file is not found in the Documents there will be a warning about it. You can remove this warning by providing the correct path to your LocalPrefs.txt file |
Expand All @@ -62,7 +62,7 @@ The config folder contains:

## How to filter
### Aspects
In [config/filter_aspects.yaml](config/filter_aspects.yaml) any aspects can be added in the format of `[ASPECT_KEY, THRESHOLD, CONDITION]`. The condition can be any of `[larger, smaller]` and defaults to `larger` if no value is given.
In your profile .yaml files any aspects can be added in the format of `[ASPECT_KEY, THRESHOLD, CONDITION]`. The condition can be any of `[larger, smaller]` and defaults to `larger` if no value is given.

For example:
```yaml
Expand All @@ -75,10 +75,10 @@ Aspects:
Aspect keys are lower case and spaces are replaced by underscore. You can find the full list of keys in [assets/aspect.json](assets/aspects.json). If Aspects is empty, all legendary items will be kept.
### Affixes
Affixes have the same structure of `[AFFIX_KEY, THRESHOLD, CONDITION]` as described above and are added to [config/filter_affixes.yaml](config/filter_affixes.yaml). Additionally, it can be filtered by `itemType`, `minPower` and `minAffixCount`. See the list of affix keys in [assets/affixes.json](assets/affixes.json). Uniques are by default always kept while Magic and Common items are discarded as junk by default.
Affixes have the same structure of `[AFFIX_KEY, THRESHOLD, CONDITION]` as described above. Additionally, it can be filtered by `itemType`, `minPower` and `minAffixCount`. See the list of affix keys in [assets/affixes.json](assets/affixes.json). Uniques are by default always kept while Magic and Common items are discarded as junk by default.

```yaml
Filters:
Affixes:
# Search for armor and pants that have at least 3 affixes of the affixPool
- Armor:
itemType: [armor, pants]
Expand All @@ -92,7 +92,12 @@ Filters:
minAffixCount: 3
```

Note: If an itemType is not included in your filters, all items of this type will be discarded as junk! There is an example of a "TakeAll" filter in the filter_affixes.yaml. To keep an item type regardless of affixes and itemPower, add it there.
Note: If an itemType is not included in your filters, all items of this type will be discarded as junk! So if you want to take all items of a certain type, add it and leave minPower, affixPool and minAffixCount empty.

## Custom configs
D4LF will look for __params.ini__ and for __profiles/*.yaml__ also in C:/Users/WINDOWS_USER/.d4lf. All values in params.ini will overwrite the value from the param.ini in the D4LF folder. In the profiles folder additional custom profiles can be added and used.

This is helpful to make it easier to update to a new version as you dont need to copy around your config and profiles. In case there are breaking changes to the configuration there will be a major release. E.g. update from 2.x.x -> 3.x.x.

## Develop

Expand Down
Binary file modified assets/templates_1080p/item_descr/item_rare_top_left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/templates_2160p/item_descr/item_common_top_left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/templates_2160p/item_descr/item_magic_top_left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 2 additions & 8 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,10 @@ def clean_up():
installer_cmd = f"pyinstaller --onefile --distpath {release_dir}{key_cmd} --paths .\\src --paths {args.conda_path}\\envs\\d4lf\\Lib\\site-packages src\\{exe}"
os.system(installer_cmd)

os.system(f"cd {release_dir} && mkdir config && cd ..")
os.system(f"cd {release_dir} && cd ..")

shutil.copy("config/game_1920x1080.ini", f"{release_dir}/config/")
shutil.copy("config/game_2560x1440.ini", f"{release_dir}/config/")
shutil.copy("config/game_3440x1440.ini", f"{release_dir}/config/")
shutil.copy("config/game_3840x2160.ini", f"{release_dir}/config/")
shutil.copy("config/params.ini", f"{release_dir}/config/")
shutil.copy("config/filter_affixes.yaml", f"{release_dir}/config/")
shutil.copy("config/filter_aspects.yaml", f"{release_dir}/config/")
shutil.copy("README.md", f"{release_dir}/")
shutil.copytree("assets", f"{release_dir}/assets")
shutil.copytree("config", f"{release_dir}/config")
os.rename(f"{release_dir}/main.exe", f"{release_dir}/d4lf.exe")
clean_up()
47 changes: 0 additions & 47 deletions config/filter_aspects.yaml

This file was deleted.

1 change: 0 additions & 1 deletion config/game_1920x1080.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[colors]
; min and max hsv range (opencv format: h: [0-180], s: [0-255], v: [0, 255])
; h_min, s_min, v_min, h_max, s_max, v_max
gray_seperator=14,10,62,40,42,100
material_color=90,140,220,110,180,255
; for scripts
skill_cd=5,61,38,16,191,90
Expand Down
1 change: 0 additions & 1 deletion config/game_2560x1440.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[colors]
gray_seperator=14,10,62,40,42,100
material_color=90,140,220,110,180,255
skill_cd=5,61,38,16,191,90
cold_imbued=88,0,0,112,255,255
Expand Down
1 change: 0 additions & 1 deletion config/game_3440x1440.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[colors]
gray_seperator=14,10,62,40,42,100
material_color=90,140,220,110,180,255
skill_cd=5,61,38,16,191,90
cold_imbued=88,0,0,112,255,255
Expand Down
1 change: 0 additions & 1 deletion config/game_3840x2160.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[colors]
gray_seperator=14,10,62,40,42,100
material_color=90,140,220,110,180,255
skill_cd=5,61,38,16,191,90
cold_imbued=88,0,0,112,255,255
Expand Down
3 changes: 3 additions & 0 deletions config/params.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[general]
; Which filter profiles should be run. All .yaml files with "Aspects" and "Affixes" sections will be used from
; config/profiles/*.yaml and C:/Users/USERNAME/.d4lf/profiles/*.yaml
profiles=general,barb,druid,necro,rogue,sorc
; How many tabs should be checked for items in chest. Note: All 5 Tabs must be unlocked!
check_chest_tabs=2
; Transparancy of the overlay when not hovering it (has a 3 second dealy after hovering)
Expand Down
Empty file added config/profiles/barb.yaml
Empty file.
Empty file added config/profiles/druid.yaml
Empty file.
95 changes: 95 additions & 0 deletions config/profiles/general.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# find all aspect keys in "assets/aspects.json"
# Format is: [KEY, THRESHOLD, CONDITON]
# CONDITON can be "larger" or "smaller" and defaults to "larger"

Aspects:
- [accelerating_aspect, 25]
- [aspect_of_might, 6.0]
- [aspect_of_disobedience, 1.1]
- [aspect_of_inner_calm, 10]
- [aspect_of_retribution, 20]
- [aspect_of_the_expectant, 10]
- [edgemasters_aspect, 20]
- [rapid_aspect, 30]
- [aspect_of_shared_misery, 29]
- [ghostwalker_aspect, 25]
- [aspect_of_the_umbral, 4]
- [conceited_aspect, 25]
- [starlight_aspect, 39]


# Find all affix keys in "config/affixes.json". Resource of possible affixes: https://d4builds.gg/database/gear-affixes/

# Format is: [KEY, THRESHOLD, CONDITON]
# CONDITON can be "larger" or "smaller" and defaults to "larger"

# itemType must be any of:
# helm, chest armor, pants, gloves, boots, ring, amulet, axe, tow-handed axe,
# sword, two-handed sword, mace, two-handed mace, scythe, two-handed scythe,
# bow, bracers, crossbow, dagger, polarm, shield, stff, wand, offhand, totem

Affixes:
- Helm:
itemType: helm
minPower: 725
affixPool:
- [basic_skill_attack_speed, 6]
- [cooldown_reduction, 5]
- [maximum_life, 640]
- [total_armor, 9]
minAffixCount: 3

- Gloves:
itemType: gloves
minPower: 725
affixPool:
- [attack_speed, 7]
- [lucky_hit_chance, 7.8]
- [critical_strike_chance, 5.5]
minAffixCount: 3

- Armor:
itemType: [chest armor, pants]
minPower: 725
affixPool:
- [damage_reduction_from_close_enemies, 10]
- [damage_reduction_from_distant_enemies, 12]
- [damage_reduction, 5]
- [total_armor, 9]
- [maximum_life, 700]
- [dodge_chance_against_close_enemies, 6.5]
- [dodge_chance, 5.0]
minAffixCount: 3

- Boots:
itemType: boots
minPower: 725
affixPool:
- [movement_speed, 16]
- [dodge_chance, 5]
- [dodge_chance_against_distant_enemies, 7]
- [energy_cost_reduction, 6]
minAffixCount: 3

- Amulet:
itemType: amulet
minPower: 725
affixPool:
- [cooldown_reduction, 6]
- [damage_reduction, 6]
- [damage_reduction_from_close_enemies, 10]
- [damage_reduction_from_distant_enemies, 12]
- [total_armor, 9]
- [energy_cost_reduction, 6]
- [movement_speed]
minAffixCount: 3

- Ring:
itemType: ring
minPower: 725
affixPool:
- [critical_strike_chance, 4]
- [lucky_hit_chance, 5]
- [resource_generation, 8]
- [maximum_life, 680]
minAffixCount: 3
Empty file added config/profiles/necro.yaml
Empty file.
66 changes: 23 additions & 43 deletions config/filter_affixes.yaml → config/profiles/rogue.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# Find all affix keys in "config/affixes.json". Resource of possible affixes: https://d4builds.gg/database/gear-affixes/
Aspects:
- [aspect_of_bursting_venoms]
- [aspect_of_corruption, 40]
- [aspect_of_elusive_menace, 7]
- [aspect_of_pestilent_points, 150]
- [aspect_of_noxious_ice, 29]
- [aspect_of_repeating, 45]
- [bladedancers_aspect, 15]
- [assimilation_aspect, 10]
- [cheats_aspect, 25]
- [energizing_aspect, 9]
- [enshrouding_aspect, 4]
- [frostbitten_aspect, 25]
- [manglers_aspect, 45]
- [ravenous_aspect, 65]
- [umbrous_aspect, 59]

# Format is: [KEY, THRESHOLD, CONDITON]
# CONDITON can be "larger" or "smaller" and defaults to "larger"

# itemType must be any of:
# helm, chest armor, pants, gloves, boots, ring, amulet, axe, tow-handed axe,
# sword, two-handed sword, mace, two-handed mace, scythe, two-handed scythe,
# bow, bracers, crossbow, dagger, polarm, shield, stff, wand, offhand, totem


Filters:
# Rogue
# =====================================
Affixes:
- Helm:
itemType: helm
minPower: 725
minPower: 800
affixPool:
- [basic_skill_attack_speed, 6]
- [cooldown_reduction, 5]
Expand All @@ -25,34 +30,21 @@ Filters:
- [ranks_of_shadow_imbuement, 3]
minAffixCount: 3

- Armor:
itemType: [chest armor, pants]
minPower: 725
affixPool:
- [damage_reduction_from_close_enemies, 10]
- [damage_reduction_from_distant_enemies, 12]
- [damage_reduction, 5]
- [total_armor, 9]
- [maximum_life, 700]
- [dodge_chance_against_close_enemies, 6.5]
minAffixCount: 3

- Gloves:
itemType: gloves
minPower: 725
minPower: 800
affixPool:
- [attack_speed, 7]
- [dexterity, 38]
- [lucky_hit_chance, 7.8]
- [critical_strike_chance, 5.5]
- lucky_hit_up_to_a_chance_to_slow
- [ranks_of_twisting_blades, 3]
- [ranks_of_rapid_fire, 3]
minAffixCount: 3

- Boots:
itemType: boots
minPower: 725
minPower: 800
affixPool:
- [movement_speed, 16]
- [dexterity, 40]
Expand All @@ -65,12 +57,12 @@ Filters:
minPower: 725
affixPool:
- [cooldown_reduction, 6]
- [damage_reduction, 6.7]
- [damage_reduction, 6]
- [damage_reduction_from_close_enemies, 10]
- [damage_reduction_from_distant_enemies, 12]
- [total_armor, 9]
- [energy_cost_reduction, 6]
- [movement_speed, 14]
- [movement_speed]
- [ranks_of_all_imbuement_skills, 2]
- [ranks_of_the_exploit_passive, 2]
- [ranks_of_the_weapon_mastery_passive, 2]
Expand Down Expand Up @@ -99,7 +91,7 @@ Filters:
- [core_skill_damage, 17]
- [damage_to_close_enemies, 19]
- [vulnerable_damage, 16]
minAffixCount: 3
minAffixCount: 2

- WeaponFar:
itemType: [crossbow]
Expand All @@ -111,15 +103,3 @@ Filters:
- [damage_to_close_enemies, 37]
- [vulnerable_damage, 34]
minAffixCount: 3

# Sorc
- Focus:
itemType: [focus]
minPower: 725
affixPool:
- [cooldown_reduction, 5]
- [resource_generation, 8]
- [critical_strike_chance, 3]
- [lucky_hit_chance, 5]
- [mana_cost_reduction, 5]
minAffixCount: 3
Empty file added config/profiles/sorc.yaml
Empty file.
Loading

0 comments on commit 8223688

Please sign in to comment.