Skip to content

Commit

Permalink
Merge pull request #395 from EightyDollars/dev_shawn
Browse files Browse the repository at this point in the history
feat:忽略支援机械以及当稀有标签仅一种选项直接进行选择
  • Loading branch information
ZhaoZuohong authored Nov 16, 2023
2 parents 924a4cf + 0032fe7 commit ff337f2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
13 changes: 7 additions & 6 deletions arknights_mower/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,13 @@ def simulate():

if sleep_time > 540:
# 刷新时间以鹰历为准
if base_scheduler.daily_mission != (datetime.now() - timedelta(hours=4)).date():
if base_scheduler.report_plan_solver():
base_scheduler.daily_mission = (datetime.now() - timedelta(hours=4)).date()
if base_scheduler.skland_config["skland_enable"] == 1:
base_scheduler.skland_plan_solover()
base_scheduler.mail_plan_solver()
if base_scheduler.daily_report:
base_scheduler.daily_report = base_scheduler.report_plan_solver()
if base_scheduler.daily_skland and base_scheduler.skland_config['skland_enable']:
base_scheduler.daily_report = base_scheduler.skland_plan_solover()
if base_scheduler.daily_mail:
base_scheduler.daily_report = base_scheduler.mail_plan_solver()

if base_scheduler.recruit_config['recruit_enable'] == 1:
base_scheduler.recruit_plan_solver()
if base_scheduler.maa_config["maa_enable"] == 1:
Expand Down
4 changes: 4 additions & 0 deletions arknights_mower/solvers/base_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def __init__(self, device: Device = None, recog: Recognizer = None) -> None:
self.skland_config = {}
self.recruit_time = None
self.daily_mission = False
self.daily_report = False
self.daily_skland = False
self.daily_mail = False
self.check_mail_enable = True
self.report_enable = True

Expand Down Expand Up @@ -2273,6 +2276,7 @@ def recruit_plan_solver(self):
def mail_plan_solver(self):
if self.check_mail_enable:
mail()
return True

def report_plan_solver(self):
if self.report_enable:
Expand Down
15 changes: 10 additions & 5 deletions arknights_mower/solvers/recruit.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __init__(self, device: Device = None, recog: Recognizer = None) -> None:
self.enough_lmb = True
self.digitReader = DigitReader()
self.recruit_order = [6, 5, 1, 4, 3, 2]
self.recruit_index = 2

def run(self, priority: list[str] = None, send_message_config={}, recruit_config={}):
"""
Expand Down Expand Up @@ -83,7 +84,7 @@ def run(self, priority: list[str] = None, send_message_config={}, recruit_config
agent = []
for item in self.agent_choose[pos]['result']:
agent.append(item['name'])
logger.info("第{}个位置:[" + ",".join(self.agent_choose[pos]['tags']) + "]:{}".format(pos, ",".join(agent)))
logger.info("{}:[".format(pos) + ",".join(self.agent_choose[pos]['tags']) + "]:{}".format(",".join(agent)))
if self.agent_choose or self.result_agent:
self.send_message(recruit_template.render(recruit_results=self.agent_choose,
recruit_get_agent=self.result_agent,
Expand All @@ -110,6 +111,10 @@ def add_recruit_param(self, recruit_config):
"permit_target": recruit_config['permit_target']
}

if not self.recruit_config['recruit_robot']:
self.recruit_order = [6, 5, 4, 3, 2, 1]
self.recruit_index = 1

def transition(self) -> bool:
if self.scene() == Scene.INDEX:
self.tap_themed_element('index_recruit')
Expand Down Expand Up @@ -237,13 +242,14 @@ def recruit_tags(self):
# 计算招募标签组合结果
recruit_cal_result = self.recruit_cal(tags)
recruit_result_level = recruit_cal_result[0][1][0]['star']
if len(recruit_cal_result) >= 1 and self.recruit_order.index(recruit_result_level) <= 2:
if self.recruit_order.index(recruit_result_level) <= self.recruit_index:
self.send_message(recruit_rarity.render(recruit_results=recruit_cal_result, title_text="稀有tag通知"),
"出稀有标签辣",
"html")
logger.info('稀有tag,发送邮件')
self.back()
return
if len(recruit_cal_result) > 1:
self.back()
return

if recruit_cal_result[0][1][0]['star'] == 3:
# refresh
Expand Down Expand Up @@ -359,7 +365,6 @@ def recruit_result(self):

def recruit_cal(self, tags: list[str]):
logger.debug(f"选择标签{tags}")
self.recruit_order = [6, 5, 1, 4, 3, 2]
index_dict = {k: i for i, k in enumerate(self.recruit_order)}

combined_agent = {}
Expand Down
9 changes: 5 additions & 4 deletions arknights_mower/solvers/skland.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ def start(self):
logger.info(
f'{i.get("nickName")}获得了{res["name"]}×{j.get("count") or 1}')
if len(self.reward) > 0:
self.record_log()
return self.record_log()
return False

def save_param(self, cred_resp):
self.header['cred'] = cred_resp['cred']
Expand Down Expand Up @@ -196,6 +197,7 @@ def record_log(self):
for item in self.reward:
res_df = pd.DataFrame(item, index=[date_str])
res_df.to_csv(self.record_path, mode='a', header=False, encoding='gbk')
return True
except:
pass

Expand All @@ -204,7 +206,7 @@ def has_record(self, phone: str):
if os.path.exists(self.record_path) is False:
logger.debug("无森空岛记录")
return False
df = pd.read_csv(self.record_path, header=None, encoding='gbk',on_bad_lines='skip')
df = pd.read_csv(self.record_path, header=None, encoding='gbk', on_bad_lines='skip')
for item in df.iloc:
if item[0] == datetime.datetime.now().strftime("%Y/%m/%d"):
if item[1].astype(str) == phone:
Expand All @@ -224,9 +226,8 @@ def test_connect(self):
self.save_param(self.get_cred_by_token(self.log(item)))
for i in self.get_binding_list():
if i['uid']:
res.append("{}连接成功".format(i['nickName']+"({})".format(i['channelName'])))
res.append("{}连接成功".format(i['nickName'] + "({})".format(i['channelName'])))
except:
res.append("{}无法连接".format(item['account']))

return res

0 comments on commit ff337f2

Please sign in to comment.