Compare commits
6 commits
6915825ace
...
afd815b7f2
Author | SHA1 | Date | |
---|---|---|---|
afd815b7f2 | |||
2215286119 | |||
ca5001a376 | |||
9a325a6f0e | |||
35d9cd1431 | |||
c7425274b3 |
12 changed files with 67 additions and 38 deletions
BIN
mower/resources/operation/+.png
(Stored with Git LFS)
Normal file
BIN
mower/resources/operation/+.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
mower/resources/operation/x3.png
(Stored with Git LFS)
Normal file
BIN
mower/resources/operation/x3.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
mower/resources/operation/x4.png
(Stored with Git LFS)
Normal file
BIN
mower/resources/operation/x4.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
mower/resources/x1.png
(Stored with Git LFS)
BIN
mower/resources/x1.png
(Stored with Git LFS)
Binary file not shown.
|
@ -1726,7 +1726,7 @@ class BaseSchedulerSolver(BaseSolver, BaseMixin):
|
|||
if accelerate:
|
||||
drone_count = get_drone(config.recog.gray)
|
||||
logger.info(f"当前无人机数量为:{drone_count}")
|
||||
if drone_count < config.conf.drone_count_limit or drone_count > 200:
|
||||
if drone_count < config.conf.drone_count_limit:
|
||||
logger.info(f"无人机数量小于{config.conf.drone_count_limit}->停止")
|
||||
return
|
||||
logger.info("制造站加速")
|
||||
|
@ -1761,11 +1761,7 @@ class BaseSchedulerSolver(BaseSolver, BaseMixin):
|
|||
if not_customize:
|
||||
drone_count = get_drone(config.recog.gray)
|
||||
logger.info(f"当前无人机数量为:{drone_count}")
|
||||
# 200 为识别错误
|
||||
if (
|
||||
drone_count < config.conf.drone_count_limit
|
||||
or drone_count == 201
|
||||
):
|
||||
if drone_count < config.conf.drone_count_limit:
|
||||
logger.info(
|
||||
f"无人机数量小于{config.conf.drone_count_limit}->停止"
|
||||
)
|
||||
|
@ -2130,7 +2126,7 @@ class BaseSchedulerSolver(BaseSolver, BaseMixin):
|
|||
self.ctap((config.recog.w * 0.82, config.recog.h * 0.2))
|
||||
self.sleep(1)
|
||||
error_count += 1
|
||||
plan[room] = self.move_free_to_end(plan[room])
|
||||
plan[room] = self.dedup_move_free_to_end(plan[room])
|
||||
logger.info(plan[room])
|
||||
self.choose_agent(plan[room], room, new_plan)
|
||||
read_time_index = []
|
||||
|
@ -2181,11 +2177,17 @@ class BaseSchedulerSolver(BaseSolver, BaseMixin):
|
|||
self.scene_graph_navigation(Scene.INFRA_MAIN)
|
||||
return new_plan
|
||||
|
||||
def move_free_to_end(self, input_list):
|
||||
free_count = input_list.count("Free")
|
||||
filtered_list = [elem for elem in input_list if elem != "Free"]
|
||||
filtered_list.extend(["Free"] * free_count)
|
||||
return filtered_list
|
||||
def dedup_move_free_to_end(self, input_list):
|
||||
result = []
|
||||
for operator in input_list:
|
||||
if operator == "Free":
|
||||
continue
|
||||
if operator in result:
|
||||
continue
|
||||
result.append(operator)
|
||||
result += ["Free"] * (len(input_list) - len(result))
|
||||
logger.debug(f"{input_list} -> {result}")
|
||||
return result
|
||||
|
||||
def agent_arrange(self, plan: tp.BasePlan, get_time=False):
|
||||
logger.info("基建:排班")
|
||||
|
@ -2246,11 +2248,7 @@ class BaseSchedulerSolver(BaseSolver, BaseMixin):
|
|||
):
|
||||
drone_count = get_drone(config.recog.gray)
|
||||
logger.info(f"当前无人机数量为:{drone_count}")
|
||||
# 200 为识别错误
|
||||
if (
|
||||
drone_count >= config.conf.drone_count_limit
|
||||
and drone_count != 201
|
||||
):
|
||||
if drone_count >= config.conf.drone_count_limit:
|
||||
DroneSolver().run(room, all_in=True, cur_count=drone_count)
|
||||
if config.conf.run_order_buffer_time > 0:
|
||||
while self.find("bill_accelerate") is not None:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from datetime import datetime, timedelta
|
||||
from typing import Optional
|
||||
|
||||
import cv2
|
||||
|
||||
|
@ -59,13 +58,9 @@ class OperationSolver(BaseSolver):
|
|||
|
||||
self.drop_list: list[dict[str, int]] = [] # 掉落列表
|
||||
self.drop_recog_complete = False # 本轮作战识别是否完成
|
||||
return super().run()
|
||||
|
||||
def number(self, scope: tp.Scope, height: Optional[int] = None):
|
||||
rect_limits = [{"w": 5, "h": 5, "char": ""}]
|
||||
return config.recog.num.number_int(
|
||||
"secret_front", scope, height, rect_limits=rect_limits
|
||||
)
|
||||
self.auto_repeat = True # 更改连战次数
|
||||
return super().run()
|
||||
|
||||
def drop_recog(self):
|
||||
result = []
|
||||
|
@ -134,22 +129,41 @@ class OperationSolver(BaseSolver):
|
|||
def ope_start(self):
|
||||
self.operation_start_time = datetime.now()
|
||||
self.drop_recog_complete = False
|
||||
self.auto_repeat = True
|
||||
self.ctap("ope_start", 3)
|
||||
|
||||
def repeat_scope(self) -> tuple[int, tp.Scope]:
|
||||
"""选择不用吃药的最高连战次数
|
||||
|
||||
Returns:
|
||||
tuple[int, tp.Scope]: 连战次数和点击区域
|
||||
"""
|
||||
y = 291
|
||||
for i in range(6, 0, -1):
|
||||
scope = (1445, y), (1555, y + 90)
|
||||
y += 93
|
||||
if i > 1 and self.find("operation/+", scope=scope):
|
||||
continue
|
||||
return i, scope
|
||||
|
||||
def transition(self):
|
||||
if (scene := self.scene()) == Scene.OPERATOR_BEFORE:
|
||||
if self.check_timeout():
|
||||
return True
|
||||
if self.animation():
|
||||
return
|
||||
if config.recog.gray[907][1600] < 127: # 代理指挥
|
||||
self.ctap((1776, 908), 3)
|
||||
if config.recog.gray[907][1600] < 127:
|
||||
if self.ctap((1776, 908), 3):
|
||||
logger.info("启用代理指挥")
|
||||
return
|
||||
if self.number(((1520, 890), (1545, 930)), 28) > 1:
|
||||
if pos := self.find("x1"):
|
||||
self.ctap(pos, 3)
|
||||
else:
|
||||
self.ctap((1500, 910), 3)
|
||||
if self.find("operation/x3") or self.find("operation/x4"):
|
||||
repeat_times, pos = self.repeat_scope()
|
||||
if self.ctap(pos, 3):
|
||||
logger.info(f"选择连战次数:{repeat_times}次")
|
||||
self.auto_repeat = False
|
||||
return
|
||||
if self.auto_repeat:
|
||||
self.ctap((1501, 891), 3)
|
||||
return
|
||||
self.ope_start()
|
||||
elif scene == Scene.OPERATOR_SELECT:
|
||||
|
|
|
@ -40,7 +40,7 @@ def calculate(tags: set[str]) -> tuple[int, tuple[str], set[str]]:
|
|||
tags (set[str]): 词条
|
||||
|
||||
Returns:
|
||||
tuple[tuple[int, int], tuple[str], set[str]]: 结果星级、词条组合、结果
|
||||
tuple[tuple[int], tuple[str], set[str]]: 结果星级、词条组合、结果
|
||||
"""
|
||||
groups = {i: [] for i in range(1, 7)}
|
||||
tag_mapping: dict[str, str] = {}
|
||||
|
|
|
@ -47,11 +47,14 @@ def retry_adb(func):
|
|||
|
||||
class ADB:
|
||||
def __init__(self) -> None:
|
||||
self.adb_bin = config.conf.maa_adb_path
|
||||
self._adb_client = None # 用于存储 AdbClient 实例
|
||||
self._adb_device = None # 用于存储 AdbDevice 实例
|
||||
self.check_server_status()
|
||||
|
||||
@property
|
||||
def adb_bin(self):
|
||||
return config.conf.maa_adb_path
|
||||
|
||||
def get_adb_client(self) -> AdbClient:
|
||||
"""
|
||||
Returns an AdbClient instance.
|
||||
|
|
|
@ -819,6 +819,7 @@ class Recognizer:
|
|||
return None
|
||||
|
||||
res_img = loadres(res, True)
|
||||
logger.debug(f"feature matching: {res=} {scope=}")
|
||||
score, scope = self.matcher.match(res_img, draw, scope)
|
||||
return scope if score >= threshold else None
|
||||
|
||||
|
|
|
@ -107,6 +107,8 @@ color = {
|
|||
"ope_recover_originite_on": (1514, 124),
|
||||
"ope_recover_potion_on": (1046, 127),
|
||||
"open_recruitment": (192, 143),
|
||||
"operation/x3": (1477, 601),
|
||||
"operation/x4": (1478, 509),
|
||||
"operator/filter_hide": (1831, 48),
|
||||
"operator/filter_show": (1823, 46),
|
||||
"operator/trust": (38, 600),
|
||||
|
@ -210,6 +212,7 @@ color = {
|
|||
"sign_in/shop/max": (1566, 617),
|
||||
"sign_in/shop/price_black": (1238, 279),
|
||||
"sign_in/shop/price_white": (1258, 237),
|
||||
"sign_in/special_access/banner": (367, 258),
|
||||
"sign_in/spring_festival/collect": (781, 953),
|
||||
"sign_in/spring_festival/receive": (834, 859),
|
||||
"skip": (1803, 32),
|
||||
|
@ -245,7 +248,6 @@ color = {
|
|||
"sss/switch_to_ex": (1255, 942),
|
||||
"sss/switch_to_normal": (1255, 934),
|
||||
"start_story": (1392, 623),
|
||||
"x1": (1477, 784),
|
||||
}
|
||||
|
||||
template_matching = {
|
||||
|
@ -386,6 +388,7 @@ template_matching = {
|
|||
"ope_plan": (1278, 24),
|
||||
"ope_select_start_empty": ((0, 0), (400, 400)),
|
||||
"ope_start": ((1685, 961), (1847, 1028)),
|
||||
"operation/+": None,
|
||||
"order_ready": (500, 664),
|
||||
"order_switching_notice": (604, 900),
|
||||
"product/先锋双芯片": ((1635, 445), (1730, 520)),
|
||||
|
|
|
@ -273,6 +273,8 @@ def check_dorm_ordering(tasks, op_data):
|
|||
for k, v in other_plan.items():
|
||||
del tasks[0].plan[k]
|
||||
extra_plan[k] = v
|
||||
for k, v in extra_plan.items():
|
||||
extra_plan[k] = [item for item in v if item != ""]
|
||||
logger.info("新增排序任务任务")
|
||||
task = SchedulerTask(
|
||||
task_plan=extra_plan,
|
||||
|
|
|
@ -323,6 +323,9 @@ Res = Literal[
|
|||
"ope_select_start_empty",
|
||||
"ope_start",
|
||||
"open_recruitment",
|
||||
"operation/+",
|
||||
"operation/x3",
|
||||
"operation/x4",
|
||||
"operator/CASTER",
|
||||
"operator/MEDIC",
|
||||
"operator/PIONEER",
|
||||
|
@ -729,5 +732,4 @@ Res = Literal[
|
|||
"user",
|
||||
"user_on",
|
||||
"visit_limit",
|
||||
"x1",
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue