Skip to content

Commit

Permalink
V5.6.0 (#291)
Browse files Browse the repository at this point in the history
Co-authored-by: CJ Shrader <cjshrader@gmail.com>
  • Loading branch information
chrisoro and cjshrader authored Jun 16, 2024
1 parent 3af885d commit 907f5d5
Show file tree
Hide file tree
Showing 42 changed files with 1,063 additions and 699 deletions.
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ d4lf_*
dist/
generated/
htmlcov/
info_screenshots/
item_error_screenshots/
log/
loot_screenshots/
logs/
main.build/
main.dist/
main.onefile-build/
pickit_screenshots/
playground.py
stats/
utils/live-view/
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ feature request or issue reports join the [discord](https://discord.gg/YyzaPhAN6
- The tool does not play well with HDR as it makes everything super bright
- The advanced item comparison feature might cause incorrect classifications

### Run
### Quick start guide

- Download the latest version (.zip) from the releases: https://github.com/aeon0/d4lf/releases
- Download and extract the latest version (.zip) from the releases: https://github.com/aeon0/d4lf/releases
- Generate a profile, either manually by looking at the examples below or by importing using the GUI in the downloaded folder.
- Place the profile in the .d4lf/profiles folder in your Windows user directory and use the GUI Config tab to configure the profiles field to include your profile.
- Execute d4lf.exe and go to your D4 screen
- There is a small overlay on the center bottom with buttons:
- max/min: Show or hide the console output
Expand All @@ -39,7 +41,7 @@ feature request or issue reports join the [discord](https://discord.gg/YyzaPhAN6
The config folder contains:

- __profiles/*.yaml__: These files determine what should be filtered
- __params.ini__: Different hotkey settings and number of chest stashes that should be looked at
- __params.ini__: Different hotkey settings and number of chest stashes that should be looked at. Management of this file should be done through the GUI.

### params.ini

Expand Down Expand Up @@ -73,7 +75,14 @@ The config folder contains:

### GUI

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

Current functionality:
- Import builds from maxroll/d4builds/mobalytics
- Create profiles based off of searches for diablo.trade
- Complete management of your params.ini through the Config tab

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

## How to filter / Profiles

Expand Down
1 change: 0 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def clean_up():
def copy_additional_resources(release_dir: Path):
shutil.copy("README.md", release_dir)
shutil.copytree("assets", release_dir / "assets")
shutil.copytree("config", release_dir / "config")


def create_batch_for_gui(release_dir: Path, exe_name: str):
Expand Down
38 changes: 0 additions & 38 deletions config/params.ini

This file was deleted.

89 changes: 0 additions & 89 deletions config/profiles/example.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mouse
mss
natsort
numpy
opencv-python==4.9.0.80
opencv-python==4.10.0.82
pre-commit
psutil
pydantic
Expand Down
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.5.9"
__version__ = "5.6.0beta1"
12 changes: 7 additions & 5 deletions src/cam.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import threading
import time

Expand All @@ -6,8 +7,9 @@
import numpy as np

from src.config.ui import ResManager
from src.logger import Logger
from src.utils.misc import convert_args_to_numpy, wait
from src.utils.misc import convert_args_to_numpy

LOGGER = logging.getLogger(__name__)

mss.windows.CAPTUREBLT = 0
cached_img_lock = threading.Lock()
Expand Down Expand Up @@ -41,7 +43,7 @@ def update_window_pos(self, offset_x: int, offset_y: int, width: int, height: in
return
self.res_key = f"{width}x{height}"
self.res_p = f"{height}p"
Logger.info(f"Found Window Res: {self.res_key}")
LOGGER.info(f"Found Window Res: {self.res_key}")

self.window_roi["top"] = offset_y
self.window_roi["left"] = offset_x
Expand All @@ -52,7 +54,7 @@ def update_window_pos(self, offset_x: int, offset_y: int, width: int, height: in
self.window_offset_set = True
ResManager().set_resolution(self.res_key)
if self.window_roi["width"] / self.window_roi["height"] < 16 / 10:
Logger.warning("Aspect ratio is too narrow, please use a wider window. At least 16/10")
LOGGER.warning("Aspect ratio is too narrow, please use a wider window. At least 16/10")

def is_offset_set(self):
return self.window_offset_set
Expand All @@ -65,7 +67,7 @@ def grab(self, force_new: bool = False) -> np.ndarray:
if not self.is_offset_set():
print("Wait for window detection")
while not self.window_offset_set:
wait(0.05)
time.sleep(0.05)
print("Found window, continue grabbing")
with cached_img_lock:
self.last_grab = time.perf_counter()
Expand Down
8 changes: 6 additions & 2 deletions src/config/helper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""New config loading and verification using pydantic. For now, both will exist in parallel hence _new."""

import threading

import keyboard


Expand All @@ -16,10 +18,12 @@ def validate_hotkey(k: str) -> str:

def singleton(cls):
instances = {}
lock = threading.Lock()

def get_instance(*args, **kwargs):
if cls not in instances:
instances[cls] = cls(*args, **kwargs)
with lock:
if cls not in instances:
instances[cls] = cls(*args, **kwargs)
return instances[cls]

return get_instance
Expand Down
Loading

0 comments on commit 907f5d5

Please sign in to comment.