Skip to content

Commit

Permalink
add rare elixirs (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeon0 authored May 17, 2024
1 parent 55fe586 commit 97952c7
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/item/descr/item_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def read_item_type(
item = _find_item_power_and_type(item, concatenated_str)

non_magic_or_sigil = item.rarity != ItemRarity.Magic or item.item_type == ItemType.Sigil
power_or_type_bad = item.power is None or item.item_type is None
power_or_type_bad = (item.power is None and item.item_type not in [ItemType.Elixir]) or item.item_type is None
if non_magic_or_sigil and power_or_type_bad:
return None, concatenated_str

Expand Down
2 changes: 1 addition & 1 deletion src/item/descr/read_descr.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def read_descr(rarity: ItemRarity, img_item_descr: np.ndarray, show_warnings: bo
screenshot("failed_itempower_itemtype", img=img_item_descr)
return None

if item.item_type in [ItemType.Material, ItemType.TemperManual] or (
if item.item_type in [ItemType.Material, ItemType.TemperManual, ItemType.Elixir] or (
item.rarity in [ItemRarity.Magic, ItemRarity.Common] and item.item_type != ItemType.Sigil
):
return item
Expand Down
2 changes: 1 addition & 1 deletion src/loot_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def check_items(inv: InventoryBase):
if rarity == ItemRarity.Legendary and item_descr.item_type == ItemType.Material:
Logger.info(f"Matched: Extracted Aspect")
continue
elif rarity == ItemRarity.Magic and item_descr.item_type == ItemType.Elixir:
elif item_descr.item_type == ItemType.Elixir:
Logger.info(f"Matched: Elixir")
continue
elif item_descr.item_type == ItemType.TemperManual:
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/vision_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def vision_mode():
elif rarity == ItemRarity.Legendary and item_descr.item_type == ItemType.Material:
Logger.info(f"Matched: Extracted Aspect")
ignored_item = True
elif rarity == ItemRarity.Magic and item_descr.item_type == ItemType.Elixir:
elif item_descr.item_type == ItemType.Elixir:
Logger.info(f"Matched: Elixir")
ignored_item = True
elif item_descr.item_type == ItemType.TemperManual:
Expand Down
4 changes: 2 additions & 2 deletions src/ui/inventory_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ def get_item_slots(self, img: Optional[np.ndarray] = None) -> tuple[list[ItemSlo
fav_flag_crop = crop(hsv_img, ResManager().roi.rel_fav_flag)
mean_value_fav = cv2.mean(fav_flag_crop)[2]

res_junk = search(self.junk_template, slot_img, threshold=0.7)
res_junk = search(self.junk_template, slot_img, threshold=0.65, use_grayscale=True)

if mean_value_fav > 205:
item_slot.is_fav = True
occupied_slots.append(item_slot)
elif res_junk.success:
elif res_junk.success and mean_value_overall < 75:
item_slot.is_junk = True
occupied_slots.append(item_slot)
elif mean_value_overall > 37:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/ui/char_inventory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def test_char_inventory(img_res, input_img):
"img_res, input_img, occupied, junk, fav",
[
((1920, 1080), f"{BASE_PATH}/char_inventory_fav_junk_1080p.png", 13, 2, 7),
((1920, 1080), f"{BASE_PATH}/char_inventory_fav_junk_1080p_2.png", 31, 18, 3),
((3440, 1440), f"{BASE_PATH}/char_inv_open_1440p_wide.png", 12, 0, 0),
],
)
Expand Down

0 comments on commit 97952c7

Please sign in to comment.