Skip to content

Commit

Permalink
自动格式化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Anyk00 committed Sep 7, 2024
1 parent a7d6f8e commit 975354e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 26 deletions.
27 changes: 12 additions & 15 deletions arknights_mower/solvers/base_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(self, device: Device = None, recog: Recognizer = None) -> None:
self.credit_fight = None
self.task_count = 0
self.refresh_connecting = False
#self.recruit_time = None
# self.recruit_time = None
self.last_clue = None
self.sleeping = False
self.operators = {}
Expand Down Expand Up @@ -143,7 +143,7 @@ def run(self) -> None:
self.free_clue = None
if self.credit_fight is not None and self.credit_fight != get_server_weekday():
self.credit_fight = None
#logger.debug(self.credit_fight)
# logger.debug(self.credit_fight)
self.todo_task = False
self.collect_notification = False
self.planned = False
Expand Down Expand Up @@ -3149,7 +3149,6 @@ def log_maa(msg, details, arg):
# logger.info(f"开始扫描仓库(MAA)")
# process_itemlist(d)


def initialize_maa(self):
config.stop_maa.clear()
conf = config.conf
Expand Down Expand Up @@ -3228,23 +3227,21 @@ def append_maa_task(self, type):
"penguin_id": "",
"DrGrandet": False,
"server": "CN",
"expiring_medicine": 999
if use_medicine
else 0,
"expiring_medicine": 999 if use_medicine else 0,
},
)
self.stages.append(stage)
elif type == "Mall":
conf=config.conf
conf = config.conf
self.MAA.append_task(
"Mall",
{
"shopping": True,
"buy_first": conf.maa_mall_buy.split(","),
"blacklist": conf.maa_mall_blacklist.split(","),
"credit_fight": conf.maa_credit_fight
and "" not in self.stages
and self.credit_fight is None,
and "" not in self.stages
and self.credit_fight is None,
"force_shopping_if_credit_full": conf.maa_mall_ignore_blacklist_when_full,
},
)
Expand All @@ -3263,8 +3260,8 @@ def append_maa_task(self, type):
"refresh": True,
"select": [3, 4],
"confirm": maa_recruit_confirm,
"times": 4
}
"times": 4,
},
)

def maa_plan_solver(self, tasks="All", one_time=False):
Expand Down Expand Up @@ -3299,7 +3296,7 @@ def maa_plan_solver(self, tasks="All", one_time=False):
self.append_maa_task(maa_task)
self.MAA.start()
stop_time = None
'''plan_today = conf.maa_weekly_plan[get_server_weekday()]
"""plan_today = conf.maa_weekly_plan[get_server_weekday()]
stage_today = plan_today.stage
nav_solver = NavigationSolver(self.device, self.recog)
ope_solver = OperationSolver(self.device, self.recog)
Expand Down Expand Up @@ -3327,7 +3324,7 @@ def maa_plan_solver(self, tasks="All", one_time=False):
self.last_execution["maa"] = datetime.now()
send_message("刷理智结束")
else:
send_message("理智没有刷完")'''
send_message("理智没有刷完")"""

if one_time:
stop_time = datetime.now() + timedelta(minutes=5)
Expand All @@ -3344,8 +3341,8 @@ def maa_plan_solver(self, tasks="All", one_time=False):
hard_stop = True
# 5分钟之前就停止
elif (
not one_time
and (self.tasks[0].time - datetime.now()).total_seconds() < 300
not one_time
and (self.tasks[0].time - datetime.now()).total_seconds() < 300
):
self.MAA.stop()
hard_stop = True
Expand Down
10 changes: 5 additions & 5 deletions arknights_mower/solvers/recruit.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(self, device: Device = None, recog: Recognizer = None) -> None:
def run(self):
self.add_recruit_param()
super().run()
#logger.info(self.result_agent)
# logger.info(self.result_agent)
return self.recruit_permission

if self.agent_choose:
Expand All @@ -96,20 +96,20 @@ def run(self):
"公招汇总通知",
"INFO",
)
#return self.agent_choose, self.result_agent
# return self.agent_choose, self.result_agent

def transition(self) -> bool:
if self.scene() == Scene.RECRUIT_MAIN:
if self.recruit_index > 4:
return True
if self.find("recruit/ticket"):
self.ticket_number = self.get_ticket_number()
self.recruit_index=5
'''if self.ticket_number == 0:
self.recruit_index = 5
"""if self.ticket_number == 0:
self.recruit_index = self.recruit_index + 1
logger.debug(f"{self.recruit_index} 张招募券")
return
self.tap(pos)'''
self.tap(pos)"""
logger.info(f"{self.ticket_number}张招募券,结束检测")
if self.ticket_number > config.conf.recruitment_permit:
self.recruit_permission = True
Expand Down
6 changes: 3 additions & 3 deletions arknights_mower/utils/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def scene_graph_navigation(self, scene: int):
logger.error(f"{SceneComment[scene]}不在场景图中")
return

error_count=0
error_count = 0

while (current := self.scene()) != scene:
if current in self.waiting_scene:
Expand Down Expand Up @@ -469,7 +469,7 @@ def scene_graph_navigation(self, scene: int):
raise
except Exception as e:
logger.exception(f"场景转移异常:{e}")
'''restart_simulator()
"""restart_simulator()
self.device.client.check_server_alive()
Session().connect(config.conf.adb)
if config.conf.droidcast.enable:
Expand All @@ -478,7 +478,7 @@ def scene_graph_navigation(self, scene: int):
self.device.control.scrcpy = Scrcpy(self.device.client)
self.check_current_focus()
return False
return True'''
return True"""
if error_count <= 5:
self.sleep()
continue
Expand Down
18 changes: 15 additions & 3 deletions arknights_mower/utils/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,13 @@ def init_mood_limit(self):
self.set_mood_limit(TOTTER, upper_limit=24, lower_limit=20)

for name in self.operators:
if self.operators[name].rest_in_full and self.operators[name].exhaust_require is not True:
self.set_mood_limit(name, upper_limit=self.operators[name].upper_limit-0.5)
if (
self.operators[name].rest_in_full
and self.operators[name].exhaust_require is not True
):
self.set_mood_limit(
name, upper_limit=self.operators[name].upper_limit - 0.5
)

def evaluate_expression(self, expression):
try:
Expand Down Expand Up @@ -650,7 +655,14 @@ def assign_dorm(self, name):
_room = None
for i in range(self.config.max_resting_count, len(self.dorm)):
_name = self.dorm[i].name
if _name == "" or not self.operators[_name].is_high() or (self.dorm[i].time is not None and self.dorm[i].time < datetime.now()):
if (
_name == ""
or not self.operators[_name].is_high()
or (
self.dorm[i].time is not None
and self.dorm[i].time < datetime.now()
)
):
_room = self.dorm[i]
break
_room.name = name
Expand Down

0 comments on commit 975354e

Please sign in to comment.