Fix NPC highlighted action btn (#175)
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
BIN
assets/npc/action_btn/resurrect_blue.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
BIN
assets/npc/action_btn/trade_blue.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
BIN
assets/npc/action_btn/trade_repair_blue.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
@@ -25,7 +25,10 @@ class NpcManager:
|
||||
"name_tag_white": color_filter(self._template_finder.get_template("QUAL_NAME_TAG_WHITE"), self._config.colors["white"])[1],
|
||||
"name_tag_gold": color_filter(self._template_finder.get_template("QUAL_NAME_TAG_GOLD"), self._config.colors["gold"])[1],
|
||||
"action_btns": {
|
||||
"resurrect": color_filter(self._template_finder.get_template("QUAL_RESURRECT_BTN"), self._config.colors["white"])[1]
|
||||
"resurrect": {
|
||||
"white": color_filter(self._template_finder.get_template("RESURRECT"), self._config.colors["white"])[1],
|
||||
"blue": color_filter(self._template_finder.get_template("RESURRECT_BLUE"), self._config.colors["blue"])[1],
|
||||
}
|
||||
},
|
||||
"template_group": ["QUAL_FRONT", "QUAL_SIDE", "QUAL_BACK", "QUAL_45", "QUAL_45_2", "QUAL_45_3"]
|
||||
},
|
||||
@@ -33,7 +36,10 @@ class NpcManager:
|
||||
"name_tag_white": color_filter(self._template_finder.get_template("MALAH_NAME_TAG_WHITE"), self._config.colors["white"])[1],
|
||||
"name_tag_gold": color_filter(self._template_finder.get_template("MALAH_NAME_TAG_GOLD"), self._config.colors["gold"])[1],
|
||||
"action_btns": {
|
||||
"trade": color_filter(self._template_finder.get_template("MALAH_TRADE_BTN"), self._config.colors["white"])[1]
|
||||
"trade": {
|
||||
"white": color_filter(self._template_finder.get_template("TRADE"), self._config.colors["white"])[1],
|
||||
"blue": color_filter(self._template_finder.get_template("TRADE_BLUE"), self._config.colors["blue"])[1],
|
||||
}
|
||||
},
|
||||
"template_group": ["MALAH_FRONT", "MALAH_BACK", "MALAH_45", "MALAH_SIDE", "MALAH_SIDE_2"]
|
||||
},
|
||||
@@ -41,7 +47,10 @@ class NpcManager:
|
||||
"name_tag_white": color_filter(self._template_finder.get_template("LARZUK_NAME_TAG_WHITE"), self._config.colors["white"])[1],
|
||||
"name_tag_gold": color_filter(self._template_finder.get_template("LARZUK_NAME_TAG_GOLD"), self._config.colors["gold"])[1],
|
||||
"action_btns": {
|
||||
"trade_repair": color_filter(self._template_finder.get_template("LARZUK_TRADE_REPAIR_BTN"), self._config.colors["white"])[1]
|
||||
"trade_repair": {
|
||||
"white": color_filter(self._template_finder.get_template("TRADE_REPAIR"), self._config.colors["white"])[1],
|
||||
"blue": color_filter(self._template_finder.get_template("TRADE_REPAIR_BLUE"), self._config.colors["blue"])[1],
|
||||
}
|
||||
},
|
||||
"template_group": ["LARZUK_FRONT", "LARZUK_BACK", "LARZUK_SIDE", "LARZUK_SIDE_2", "LARZUK_SIDE_3"]
|
||||
},
|
||||
@@ -49,7 +58,10 @@ class NpcManager:
|
||||
"name_tag_white": color_filter(self._template_finder.get_template("ANYA_NAME_TAG_WHITE"), self._config.colors["white"])[1],
|
||||
"name_tag_gold": color_filter(self._template_finder.get_template("ANYA_NAME_TAG_GOLD"), self._config.colors["gold"])[1],
|
||||
"action_btns": {
|
||||
"trade": color_filter(self._template_finder.get_template("ANYA_TRADE_BTN"), self._config.colors["white"])[1]
|
||||
"trade": {
|
||||
"white": color_filter(self._template_finder.get_template("TRADE"), self._config.colors["white"])[1],
|
||||
"blue": color_filter(self._template_finder.get_template("TRADE_BLUE"), self._config.colors["blue"])[1],
|
||||
}
|
||||
},
|
||||
"template_group": ["ANYA_FRONT", "ANYA_BACK", "ANYA_SIDE"]
|
||||
}
|
||||
@@ -70,7 +82,7 @@ class NpcManager:
|
||||
res_g = self._template_finder.search(self._npcs[npc_key]["name_tag_gold"], filtered_inp_g, 0.9, roi=roi).valid
|
||||
if res_w:
|
||||
mouse.click(button="left")
|
||||
wait(1.4, 1.7)
|
||||
wait(0.7, 1.0)
|
||||
_, filtered_inp = color_filter(self._screen.grab(), self._config.colors["gold"])
|
||||
res = self._template_finder.search(self._npcs[npc_key]["name_tag_gold"], filtered_inp, 0.9, roi=roi).valid
|
||||
if res:
|
||||
@@ -80,12 +92,21 @@ class NpcManager:
|
||||
return False
|
||||
|
||||
def press_npc_btn(self, npc_key: Npc, action_btn_key: str):
|
||||
_, filtered_inp = color_filter(self._screen.grab(), self._config.colors["white"])
|
||||
img = self._screen.grab()
|
||||
_, filtered_inp_w = color_filter(img, self._config.colors["white"])
|
||||
res = self._template_finder.search(
|
||||
self._npcs[npc_key]["action_btns"][action_btn_key],
|
||||
filtered_inp, 0.85, roi=self._config.ui_roi["cut_skill_bar"],
|
||||
self._npcs[npc_key]["action_btns"][action_btn_key]["white"],
|
||||
filtered_inp_w, 0.85, roi=self._config.ui_roi["cut_skill_bar"],
|
||||
normalize_monitor=True
|
||||
)
|
||||
if not res.valid and "blue" in self._npcs[npc_key]["action_btns"][action_btn_key]:
|
||||
# search for highlighted / blue action btn
|
||||
_, filtered_inp_b = color_filter(img, self._config.colors["blue"])
|
||||
res = self._template_finder.search(
|
||||
self._npcs[npc_key]["action_btns"][action_btn_key]["blue"],
|
||||
filtered_inp_b, 0.85, roi=self._config.ui_roi["cut_skill_bar"],
|
||||
normalize_monitor=True
|
||||
)
|
||||
if res.valid:
|
||||
mouse.move(*res.position, randomize=3, delay_factor=[1.0, 1.5])
|
||||
wait(0.2, 0.4)
|
||||
|
||||
@@ -105,6 +105,13 @@ class TemplateFinder:
|
||||
"FULL_REJUV_POTION": [load_template(f"assets/templates/full_rejuv_potion.png", 1.0), 1.0],
|
||||
"REJUV_POTION": [load_template(f"assets/templates/rejuv_potion.png", 1.0), 1.0],
|
||||
"WINDOW_INGAME_OFFSET_REFERENCE":[load_template(f"assets/templates/window_ingame_offset_reference.png", 1.0), 1.0],
|
||||
# NPC: Action buttons
|
||||
"TRADE": [load_template(f"assets/npc/action_btn/trade.png", 1.0), 1.0],
|
||||
"TRADE_BLUE": [load_template(f"assets/npc/action_btn/trade_blue.png", 1.0), 1.0],
|
||||
"RESURRECT": [load_template(f"assets/npc/action_btn/resurrect.png", 1.0), 1.0],
|
||||
"RESURRECT_BLUE": [load_template(f"assets/npc/action_btn/resurrect_blue.png", 1.0), 1.0],
|
||||
"TRADE_REPAIR": [load_template(f"assets/npc/action_btn/trade_repair.png", 1.0), 1.0],
|
||||
"TRADE_REPAIR_BLUE": [load_template(f"assets/npc/action_btn/trade_repair_blue.png", 1.0), 1.0],
|
||||
# NPC: Qual-Kehk
|
||||
"QUAL_FRONT": [load_template(f"assets/npc/qual_kehk/qual_front.png", 1.0), 1.0],
|
||||
"QUAL_SIDE": [load_template(f"assets/npc/qual_kehk/qual_side.png", 1.0), 1.0],
|
||||
@@ -114,7 +121,6 @@ class TemplateFinder:
|
||||
"QUAL_45_3": [load_template(f"assets/npc/qual_kehk/qual_45_3.png", 1.0), 1.0],
|
||||
"QUAL_NAME_TAG_WHITE": [load_template(f"assets/npc/qual_kehk/qual_kehk_white.png", 1.0), 1.0],
|
||||
"QUAL_NAME_TAG_GOLD": [load_template(f"assets/npc/qual_kehk/qual_kehk_gold.png", 1.0), 1.0],
|
||||
"QUAL_RESURRECT_BTN": [load_template(f"assets/npc/qual_kehk/resurrect_btn.png", 1.0), 1.0],
|
||||
# NPC: Malah
|
||||
"MALAH_FRONT": [load_template(f"assets/npc/malah/malah_front.png", 1.0), 1.0],
|
||||
"MALAH_BACK": [load_template(f"assets/npc/malah/malah_BACK.png", 1.0), 1.0],
|
||||
@@ -123,7 +129,6 @@ class TemplateFinder:
|
||||
"MALAH_SIDE_2": [load_template(f"assets/npc/malah/malah_side_2.png", 1.0), 1.0],
|
||||
"MALAH_NAME_TAG_WHITE": [load_template(f"assets/npc/malah/malah_white.png", 1.0), 1.0],
|
||||
"MALAH_NAME_TAG_GOLD": [load_template(f"assets/npc/malah/malah_gold.png", 1.0), 1.0],
|
||||
"MALAH_TRADE_BTN": [load_template(f"assets/npc/malah/trade_btn.png", 1.0), 1.0],
|
||||
# NPC: Larzuk
|
||||
"LARZUK_FRONT": [load_template(f"assets/npc/larzuk/larzuk_front.png", 1.0), 1.0],
|
||||
"LARZUK_BACK": [load_template(f"assets/npc/larzuk/larzuk_back.png", 1.0), 1.0],
|
||||
@@ -132,14 +137,12 @@ class TemplateFinder:
|
||||
"LARZUK_SIDE_3": [load_template(f"assets/npc/larzuk/larzuk_side_3.png", 1.0), 1.0],
|
||||
"LARZUK_NAME_TAG_WHITE": [load_template(f"assets/npc/larzuk/larzuk_white.png", 1.0), 1.0],
|
||||
"LARZUK_NAME_TAG_GOLD": [load_template(f"assets/npc/larzuk/larzuk_gold.png", 1.0), 1.0],
|
||||
"LARZUK_TRADE_REPAIR_BTN": [load_template(f"assets/npc/larzuk/trade_repair_btn.png", 1.0), 1.0],
|
||||
# NPC: Anya
|
||||
"ANYA_FRONT": [load_template(f"assets/npc/anya/anya_front.png", 1.0), 1.0],
|
||||
"ANYA_BACK": [load_template(f"assets/npc/anya/anya_back.png", 1.0), 1.0],
|
||||
"ANYA_SIDE": [load_template(f"assets/npc/anya/anya_side.png", 1.0), 1.0],
|
||||
"ANYA_NAME_TAG_GOLD": [load_template(f"assets/npc/anya/anya_gold.png", 1.0), 1.0],
|
||||
"ANYA_NAME_TAG_WHITE": [load_template(f"assets/npc/anya/anya_white.png", 1.0), 1.0],
|
||||
"ANYA_TRADE_BTN": [load_template(f"assets/npc/anya/trade_btn.png", 1.0), 1.0],
|
||||
}
|
||||
|
||||
def get_template(self, key):
|
||||
|
||||