Skip to content

Commit

Permalink
Merge branch 'ArkMowers:dev_shawn' into dev_shawn
Browse files Browse the repository at this point in the history
  • Loading branch information
Anyk00 authored Sep 12, 2024
2 parents 62e0934 + 997a6c5 commit da6926e
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 53 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![qq_guild](https://img.shields.io/badge/QQ%E9%A2%91%E9%81%93-2r118jwue4-blue)](https://pd.qq.com/s/5t91c3gx9)

Mower 是为长期运行设计的、开源的明日方舟脚本。
Mower 致力于为用户提供最佳服务,全天候 24\*7 托管支持,旨在让用户彻底解放双手,忘记《明日方舟》,并且帮助用户获取游戏内最多资源。

## 功能介绍

Expand All @@ -26,8 +27,12 @@ Mower 是为长期运行设计的、开源的明日方舟脚本。

## 下载与安装

Mower 支持 Windows、macOS 与 Linux 平台。Windows 用户推荐从 [mower 下载站](https://mower.zhaozuohong.vip/)下载运行;macOS 与 Linux 用户请参考《[从源码运行 arknights-mower](https://blog.zhaozuohong.vip/2023/08/02/run-arknights-mower-from-source/)
Mower 支持 Windows、macOS 与 Linux 平台。Windows 用户推荐从 QQ 群(239200680) 下载运行

初次使用,建议阅读[Mower 简明教程](https://blog.zhaozuohong.vip/2024/05/10/mower-guide/tutorial/)
初次使用,建议阅读 官方群内公告

提出建议、反馈 Bug 或交流基建知识,欢迎加入 QQ 频道 ArkMower(频道号:2r118jwue4)。
提出建议、反馈 Bug,欢迎加入 QQ 频道 ArkMower(频道号:2r118jwue4)。

## 关于 Mower-NG

Mower-NG 为前贡献者非正常 fork 的独立项目,EE0000 已经退出 Mower 开发组,其在网上的个人言论不代表 Mower/ Mower 开发组立场。请广大网友谨慎甄别。
2 changes: 1 addition & 1 deletion arknights_mower/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
from pathlib import Path

__version__ = "2024.08"
__version__ = "2024.9.2"

if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
__rootdir__ = Path(sys._MEIPASS).joinpath("arknights_mower").resolve()
Expand Down
39 changes: 11 additions & 28 deletions arknights_mower/__main__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import os
from datetime import datetime, timedelta
from datetime import datetime

from arknights_mower.solvers.base_schedule import BaseSchedulerSolver
from arknights_mower.solvers.reclamation_algorithm import ReclamationAlgorithm
from arknights_mower.solvers.secret_front import SecretFront
from arknights_mower.utils import config, path, rapidocr
from arknights_mower.utils.csleep import MowerExit
from arknights_mower.utils.datetime import format_time
from arknights_mower.utils.datetime import format_time, get_server_time
from arknights_mower.utils.depot import 创建csv, 创建json
from arknights_mower.utils.device.adb_client.session import Session
from arknights_mower.utils.device.scrcpy import Scrcpy
Expand Down Expand Up @@ -188,7 +188,6 @@ def simulate(saved):
try:
if len(base_scheduler.tasks) > 0:
(base_scheduler.tasks.sort(key=lambda x: x.time, reverse=False))
logger.info("||".join([str(t) for t in base_scheduler.tasks]))
remaining_time = (
base_scheduler.tasks[0].time - datetime.now()
).total_seconds()
Expand Down Expand Up @@ -219,50 +218,34 @@ def simulate(saved):
# 刷新时间以鹰历为准
# if (
# base_scheduler.sign_in
# < (datetime.now() - timedelta(hours=4)).date()
# < get_server_time().date()
# ):
# if base_scheduler.sign_in_plan_solver():
# base_scheduler.sign_in = (
# datetime.now() - timedelta(hours=4)
# ).date()

if (
base_scheduler.daily_visit_friend
< (datetime.now() - timedelta(hours=4)).date()
):
if base_scheduler.daily_visit_friend < get_server_time().date():
if base_scheduler.visit_friend_plan_solver():
base_scheduler.daily_visit_friend = (
datetime.now() - timedelta(hours=4)
).date()
base_scheduler.daily_visit_friend = get_server_time().date()

if (
base_scheduler.daily_report
< (datetime.now() - timedelta(hours=4)).date()
):
if base_scheduler.daily_report < get_server_time().date():
if base_scheduler.report_plan_solver():
base_scheduler.daily_report = (
datetime.now() - timedelta(hours=4)
).date()
base_scheduler.daily_report = get_server_time().date()

if (
config.conf.skland_enable
and base_scheduler.daily_skland
< (datetime.now() - timedelta(hours=4)).date()
and base_scheduler.daily_skland < get_server_time().date()
):
if base_scheduler.skland_plan_solover():
base_scheduler.daily_skland = (
datetime.now() - timedelta(hours=4)
).date()
base_scheduler.daily_skland = get_server_time().date()

if (
config.conf.check_mail_enable
and base_scheduler.daily_mail
< (datetime.now() - timedelta(hours=8)).date()
and base_scheduler.daily_mail < get_server_time().date()
):
if base_scheduler.mail_plan_solver():
base_scheduler.daily_mail = (
datetime.now() - timedelta(hours=8)
).date()
base_scheduler.daily_mail = get_server_time().date()

if config.conf.recruit_enable:
base_scheduler.recruit_plan_solver()
Expand Down
21 changes: 13 additions & 8 deletions arknights_mower/solvers/base_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def run(self) -> None:
if len(self.tasks) > 0:
# 找到时间最近的一次单个任务
self.task = self.tasks[0]
logger.debug(f"当前任务: {str(self.task)}")
else:
self.task = None
if self.task is not None and datetime.now() < self.task.time:
Expand All @@ -141,7 +142,6 @@ 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)
self.todo_task = False
self.collect_notification = False
self.planned = False
Expand Down Expand Up @@ -654,14 +654,12 @@ def infra_main(self):
self.refresh_connecting = False
self.agent_arrange(self.task.plan, get_time)
if get_time:
self.backup_plan_solver(PlanTriggerTiming.BEFORE_PLANNING)
if (
self.find_next_task(datetime.now() + timedelta(seconds=15))
is None
if not self.backup_plan_solver(
PlanTriggerTiming.BEFORE_PLANNING
):
self.plan_metadata()
else:
logger.info("检测到15秒内有额外任务,跳过plan")
logger.info("检测到排班表切换,跳过plan")
if TaskTypes.RE_ORDER == self.task.type:
self.skip()
# 如果任务名称包含干员名,则为动态生成的
Expand Down Expand Up @@ -1451,10 +1449,10 @@ def backup_plan_solver(self, timing=None):
if timing is None:
timing = PlanTriggerTiming.END
try:
new_task = False
if self.op_data.backup_plans:
con = copy.deepcopy(self.op_data.plan_condition)
current_con = self.op_data.plan_condition
new_task = False
for idx, bp in enumerate(self.op_data.backup_plans):
func = str(bp.trigger)
logger.debug(func)
Expand All @@ -1481,10 +1479,12 @@ def backup_plan_solver(self, timing=None):
self.op_data.swap_plan(con, refresh=True)
if not new_task:
self.tasks.append(SchedulerTask(task_plan={}))
return new_task
except MowerExit:
raise
except Exception as e:
logger.exception(e)
return False

def rearrange_resting_priority(self, group):
operators = self.op_data.groups[group]
Expand Down Expand Up @@ -1547,10 +1547,15 @@ def get_resting_plan(self, agents, exist_replacement, plan, high_free, low_free)
# 对于252可能需要进行额外判定,由于 low_free 性质等同于 high_free
success = True
if high_free - _high >= 0 and low_free - _low >= 0:
logger.debug(f"计算排班:{agents}")
for agent in agents:
if not success:
break
x = self.op_data.operators[agent]
if x.room not in base_room_list:
logger.debug(f"干员房间出错:{agent}")
success = False
break
if self.op_data.get_dorm_by_name(x.name)[0] is not None:
# 如果干员已经被安排了
success = False
Expand Down Expand Up @@ -2433,7 +2438,7 @@ def choose_agent(
right_swipe = 0
retry_count = 0
selected = []
logger.info(f"上次进入房间为:{self.last_room},本次房间为:{room}")
logger.debug(f"上次进入房间为:{self.last_room},本次房间为:{room}")
self.detail_filter()
if self.detect_arrange_order()[0] == "信赖值":
self.switch_arrange_order("工作状态")
Expand Down
6 changes: 2 additions & 4 deletions arknights_mower/solvers/report.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import datetime
import os

import cv2
import pandas as pd

from arknights_mower.models import noto_sans
from arknights_mower.utils.datetime import get_server_time
from arknights_mower.utils.device.device import Device
from arknights_mower.utils.digit_reader import DigitReader
from arknights_mower.utils.email import report_template, send_message
Expand Down Expand Up @@ -35,9 +35,7 @@ def __init__(
self.record_path = get_path("@app/tmp/report.csv")
self.low_range_gray = (100, 100, 100)
self.high_range_gray = (255, 255, 255)
self.date = (
(datetime.datetime.now() - datetime.timedelta(hours=4)).date().__str__()
)
self.date = get_server_time().date().__str__()
self.digitReader = DigitReader()
self.report_res = {
"作战录像": None,
Expand Down
4 changes: 4 additions & 0 deletions arknights_mower/utils/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def get_server_weekday():
return datetime.now(pytz.timezone("Asia/Dubai")).weekday()


def get_server_time():
return datetime.now(pytz.timezone("Asia/Dubai"))


# newbing说用这个来定义休息时间省事
def format_time(seconds):
if seconds < 0: # 权宜之计 配合刷生息演算
Expand Down
2 changes: 1 addition & 1 deletion arknights_mower/utils/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def tap_index_element(
):
pos = {
"friend": (544, 862), # 好友
"infrastructure": (1545, 948), # 基建
"infrastructure": (1410, 870), # 基建
"mission": (1201, 904), # 任务
"recruit": (1507, 774), # 公开招募
"shop": (1251, 727), # 采购中心
Expand Down
2 changes: 1 addition & 1 deletion ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ const axios = inject('axios')
function start() {
running.value = true
log_lines.value = []
axios.get(`${import.meta.env.VITE_HTTP_URL}/start`)
axios.get(`${import.meta.env.VITE_HTTP_URL}/start/0`)
}
function actions_on_resize() {
Expand Down
44 changes: 37 additions & 7 deletions ui/src/pages/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ const scene_name = {
LOGIN_MAIN_NOENTRY: '登录页面(无按钮入口)',
OPERATOR_ONGOING: '代理作战'
}
const onSelectionChange = (newValue) => {
if (newValue === '夜神') {
simulator.value.index = '-1'
} else {
simulator.value.index = '0'
}
}
</script>

<template>
Expand Down Expand Up @@ -188,7 +196,11 @@ const scene_name = {
</n-radio-group>
</n-form-item>
<n-form-item label="模拟器">
<n-select v-model:value="simulator.name" :options="simulator_types" />
<n-select
v-model:value="simulator.name"
:options="simulator_types"
@update:value="onSelectionChange"
/>
</n-form-item>
<n-form-item v-if="simulator.name">
<template #label>
Expand Down Expand Up @@ -568,15 +580,27 @@ const scene_name = {
</n-form>
</n-card>
</div>
<div><SKLand /></div>
<div><Depotswitch /></div>
<div><DailyMission /></div>
<div><email /></div>
<div>
<SKLand />
</div>
<div>
<Depotswitch />
</div>
<div>
<DailyMission />
</div>
<div>
<email />
</div>
</div>

<div class="grid-right">
<div><clue /></div>
<div><Recruit /></div>
<div>
<clue />
</div>
<div>
<Recruit />
</div>
<div><maa-weekly /></div>
<div><maa-weekly-new /></div>
<div><maa-basic /></div>
Expand Down Expand Up @@ -613,6 +637,7 @@ const scene_name = {
&:nth-child(1) {
width: 130px;
}
&:nth-child(3) {
padding-left: 12px;
width: 120px;
Expand Down Expand Up @@ -689,18 +714,21 @@ h4 {
width: 100%;
max-width: 600px;
}
.grid-left {
display: grid;
row-gap: 10px;
grid-template-columns: 100%;
}
.grid-right {
display: grid;
row-gap: 10px;
grid-template-columns: 100%;
margin-top: 10px;
}
}
/*双栏 大于1400的内容 */
@media (min-width: 1400px) {
.grid-two {
Expand All @@ -709,12 +737,14 @@ h4 {
align-items: flex-start;
gap: 5px;
}
.grid-left {
display: grid;
gap: 5px;
grid-template-columns: 100%;
max-width: 600px;
}
.grid-right {
display: grid;
gap: 5px;
Expand Down

0 comments on commit da6926e

Please sign in to comment.