From 8a436269784bdd40c20992de12f99d514a6142a7 Mon Sep 17 00:00:00 2001 From: chrisoro <4160557+chrisoro@users.noreply.github.com> Date: Mon, 1 Jul 2024 20:55:05 +0200 Subject: [PATCH] Fixed incorrect marking if matched affix is also inherent (#336) --- README.md | 4 ++++ src/__init__.py | 2 +- src/item/filter.py | 8 ++++---- src/scripts/vision_mode.py | 7 ++----- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d03daca0..8116669f 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,10 @@ feature request or issue reports join the [discord](https://discord.gg/YyzaPhAN6 - Formats like `[ dexterity, 33 ]` are still completely valid. The importer creates affix fields which look like `{name: dexterity, value: 33}`. These are identical and either format can be used interchangeably. We recommend starting all new builds through the importer, so examples show the format the importer uses. +- Mouse control isn't possible + - Due to your local windows settings, the tool might not be able to control the mouse. Just run the tool as admin + and it should work. If you don't want to run it as admin, you can disable the mouse control in the params.ini + by setting `vision_mode_only` to `true`. ### Configs diff --git a/src/__init__.py b/src/__init__.py index 066b2a48..011eb862 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -2,4 +2,4 @@ TP = concurrent.futures.ThreadPoolExecutor() -__version__ = "5.6.2" +__version__ = "5.6.3" diff --git a/src/item/filter.py b/src/item/filter.py index 96bb38e6..2eb4b194 100644 --- a/src/item/filter.py +++ b/src/item/filter.py @@ -34,7 +34,7 @@ @dataclass class _MatchedFilter: profile: str - matched_affixes: list[str] = field(default_factory=list) + matched_affixes: list[Affix] = field(default_factory=list) did_match_aspect: bool = False @@ -108,7 +108,7 @@ def _check_affixes(self, item: Item) -> _FilterResult: if not matched_inherents: continue all_matches = matched_affixes + matched_inherents - LOGGER.info(f"Matched {profile_name}.Affixes.{filter_name}: {all_matches}") + LOGGER.info(f"Matched {profile_name}.Affixes.{filter_name}: {[x.name for x in all_matches]}") res.keep = True res.matched.append(_MatchedFilter(f"{profile_name}.{filter_name}", all_matches)) return res @@ -195,7 +195,7 @@ def _did_files_change(self) -> bool: return True return any(os.path.getmtime(file_path) > self.last_loaded for file_path in self.all_file_pathes) - def _match_affixes_count(self, expected_affixes: list[AffixFilterCountModel], item_affixes: list[Affix]) -> list[str]: + def _match_affixes_count(self, expected_affixes: list[AffixFilterCountModel], item_affixes: list[Affix]) -> list[Affix]: result = [] for count_group in expected_affixes: greater_affix_count = 0 @@ -203,7 +203,7 @@ def _match_affixes_count(self, expected_affixes: list[AffixFilterCountModel], it for affix in count_group.count: matched_item_affix = next((a for a in item_affixes if a.name == affix.name), None) if matched_item_affix is not None and self._match_item_aspect_or_affix(affix, matched_item_affix): - group_res.append(affix.name) + group_res.append(matched_item_affix) if matched_item_affix.type == AffixType.greater: greater_affix_count += 1 if count_group.minCount <= len(group_res) <= count_group.maxCount and greater_affix_count >= count_group.minGreaterAffixCount: diff --git a/src/scripts/vision_mode.py b/src/scripts/vision_mode.py index 4d60e8a9..7c1bb6e5 100644 --- a/src/scripts/vision_mode.py +++ b/src/scripts/vision_mode.py @@ -12,7 +12,6 @@ from src.config.loader import IniConfigLoader from src.config.models import HandleRaresType from src.config.ui import ResManager -from src.item.data.affix import AffixType from src.item.data.item_type import ItemType from src.item.data.rarity import ItemRarity from src.item.descr.read_descr import read_descr @@ -264,10 +263,8 @@ def vision_mode(): # Show matched bullets if item_descr is not None and len(res.matched) > 0: bullet_width = thick * 3 - all_affixes = item_descr.affixes + item_descr.inherent - non_tempered_affixes = [affix for affix in all_affixes if affix.type != AffixType.tempered] - for affix in non_tempered_affixes: - if affix.loc is not None and any(a == affix.name for a in res.matched[0].matched_affixes): + for affix in res.matched[0].matched_affixes: + if affix.loc is not None: draw_rect(canvas, bullet_width, affix, off, "#23fc5d") if item_descr.aspect is not None and any(m.did_match_aspect for m in res.matched):