-
Notifications
You must be signed in to change notification settings - Fork 43
seals and charms #763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
seals and charms #763
Changes from 2 commits
6b1e178
04893ce
2a0b7cf
673d6dd
afbbc31
9ac225c
2e4b556
468a9f4
d63e90f
86a4de5
7eefefc
6fc38b2
cf3fec5
f4269be
79c01c9
833fd27
1e29bc9
e1caf1b
7061492
78a9491
f1596d8
29fccd0
615cd4e
e7a0067
d4ac0f8
8e5c298
cee048d
5ca8ff2
67677ed
b5484ec
f124c0c
7c753f7
dadb291
9234c0d
5fb28d1
eae9bd4
fa63dcc
9a2ca3c
9be3b3d
b0128c5
66fc742
a4c6f9e
a1383be
1736151
962e567
be73fab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| AffixFilterModel, | ||
| DynamicItemFilterModel, | ||
| GlobalUniqueModel, | ||
| NameRarityFilterModel, | ||
| ProfileModel, | ||
| SigilConditionModel, | ||
| SigilFilterModel, | ||
|
|
@@ -67,6 +68,8 @@ class Filter: | |
| aspect_upgrade_filters = {} | ||
| paragon_filters = {} | ||
| global_unique_filters = {} | ||
| seal_filters = {} | ||
| charm_filters = {} | ||
| sigil_filters = {} | ||
| tribute_filters = {} | ||
|
|
||
|
|
@@ -236,31 +239,52 @@ def _check_sigil(self, item: Item) -> FilterResult: | |
| res.matched.append(MatchedFilter(f"{profile_name}")) | ||
| return res | ||
|
|
||
| def _check_tribute(self, item: Item) -> FilterResult: | ||
| def _check_name_rarity_filters( | ||
| self, | ||
| item: Item, | ||
| item_filters: dict[str, list[NameRarityFilterModel | TributeFilterModel]], | ||
| section_name: str, | ||
| mythic_name: str, | ||
| ) -> FilterResult: | ||
| res = FilterResult(keep=False, matched=[]) | ||
| if not self.tribute_filters.items(): | ||
| LOGGER.info(f"{item.original_name} -- Matched Tributes") | ||
| if not item_filters.items(): | ||
| LOGGER.info(f"{item.original_name} -- Matched {section_name}") | ||
|
cjshrader marked this conversation as resolved.
Outdated
|
||
| res.keep = True | ||
| res.matched.append(MatchedFilter("Tributes not filtered")) | ||
| res.matched.append(MatchedFilter(f"{section_name} not filtered")) | ||
|
|
||
| if item.rarity == ItemRarity.Mythic: | ||
| LOGGER.info(f"{item.original_name} -- Matched mythic tribute, always kept") | ||
| LOGGER.info(f"{item.original_name} -- Matched mythic {section_name.lower()}, always kept") | ||
|
cjshrader marked this conversation as resolved.
Outdated
|
||
| res.keep = True | ||
| res.matched.append(MatchedFilter("Mythic Tribute")) | ||
| res.matched.append(MatchedFilter(mythic_name)) | ||
|
|
||
| for profile_name, profile_filter in self.tribute_filters.items(): | ||
| for profile_name, profile_filter in item_filters.items(): | ||
| for filter_item in profile_filter: | ||
| if filter_item.name and not item.name.startswith(filter_item.name): | ||
| if filter_item.name and not (item.name or "").startswith(filter_item.name): | ||
| continue | ||
|
|
||
| if filter_item.rarities and item.rarity not in filter_item.rarities: | ||
| continue | ||
|
|
||
| LOGGER.info(f"{item.original_name} -- Matched {profile_name}.Tributes") | ||
| LOGGER.info(f"{item.original_name} -- Matched {profile_name}.{section_name}") | ||
| res.keep = True | ||
| res.matched.append(MatchedFilter(f"{profile_name}")) | ||
| return res | ||
|
|
||
| def _check_tribute(self, item: Item) -> FilterResult: | ||
|
cjshrader marked this conversation as resolved.
|
||
| return self._check_name_rarity_filters( | ||
| item=item, item_filters=self.tribute_filters, section_name="Tributes", mythic_name="Mythic Tribute" | ||
| ) | ||
|
|
||
| def _check_seal(self, item: Item) -> FilterResult: | ||
| return self._check_name_rarity_filters( | ||
| item=item, item_filters=self.seal_filters, section_name="Seals", mythic_name="Mythic Seal" | ||
| ) | ||
|
|
||
| def _check_charm(self, item: Item) -> FilterResult: | ||
| return self._check_name_rarity_filters( | ||
| item=item, item_filters=self.charm_filters, section_name="Charms", mythic_name="Mythic Charm" | ||
| ) | ||
|
|
||
| def _check_global_unique_filter(self, item: Item) -> FilterResult: | ||
| res = FilterResult(keep=False, matched=[]) | ||
|
|
||
|
|
@@ -479,6 +503,8 @@ def load_files(self): | |
| self.affix_filters: dict[str, list[DynamicItemFilterModel]] = {} | ||
| self.aspect_upgrade_filters: dict[str, list[str]] = {} | ||
| self.paragon_filters: dict[str, object] = {} | ||
| self.seal_filters: dict[str, list[NameRarityFilterModel]] = {} | ||
| self.charm_filters: dict[str, list[NameRarityFilterModel]] = {} | ||
| self.sigil_filters: dict[str, SigilFilterModel] = {} | ||
| self.tribute_filters: dict[str, list[TributeFilterModel]] = {} | ||
| self.global_unique_filters: dict[str, list[GlobalUniqueModel]] = {} | ||
|
|
@@ -539,6 +565,12 @@ def load_files(self): | |
| if data.aspect_upgrades: | ||
| self.aspect_upgrade_filters[data.name] = data.aspect_upgrades | ||
| sections.append(ASPECT_UPGRADES_LABEL) | ||
| if data.seals: | ||
| self.seal_filters[data.name] = data.seals | ||
| sections.append("Seals") | ||
| if data.charms: | ||
| self.charm_filters[data.name] = data.charms | ||
| sections.append("Charms") | ||
| if data.sigils and (data.sigils.blacklist or data.sigils.whitelist): | ||
| self.sigil_filters[data.name] = data.sigils | ||
| sections.append("Sigils") | ||
|
|
@@ -575,6 +607,12 @@ def should_keep(self, item: Item) -> FilterResult: | |
| if item.item_type == ItemType.Tribute: | ||
| return self._check_tribute(item) | ||
|
|
||
| if item.item_type == ItemType.HoradricSeal: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. L674/682: 🔵 nit: dispatches on raw
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not correct. is_sigil checks across two types. We need different handling per type. The better example is if item.item_type == ItemType.Tribute which is exactly what we're mirroring here. |
||
| return self._check_seal(item) | ||
|
|
||
| if item.item_type == ItemType.Charm: | ||
| return self._check_charm(item) | ||
|
|
||
| if item.item_type is None or item.power is None: | ||
| return res | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.