Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024.11.1 #710

Merged
merged 55 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
7a046f5
9/1 游戏内容更新
Sep 2, 2024
d017ab5
补充提交基建buff
fuyn101 Sep 2, 2024
88140d5
Merge pull request #674 from fuyn101/dev_shawn
Shawnsdaddy Sep 5, 2024
b3ea669
server 缓存开关
Sep 6, 2024
1ea4cb5
fix formatting
Sep 6, 2024
ca368a4
Merge pull request #673 from ArkMowers/dev_shawn
Ks-luow Sep 6, 2024
c590293
fix:截图异常导致在公招界面卡住的情况
Sep 6, 2024
2e79adc
bug fix
Sep 6, 2024
fef2baf
修bug+增加自定义菲亚阈值功能 (#676)
Anyk00 Sep 8, 2024
78a1c6a
update 基建pos防止点到吃源石 (#679)
Shawnsdaddy Sep 9, 2024
e4e8bb6
移除log任务+版本号
Sep 10, 2024
7ee164d
修复Planning 前逻辑不触发
Sep 10, 2024
6b0ad8f
修复自动启动失效
Sep 10, 2024
9b45662
减少 info log
Sep 10, 2024
2556362
移除时间hard code
Sep 10, 2024
4cae08c
update func in report.py
Sep 10, 2024
2ce656a
Add logging & update readme
Sep 11, 2024
997a6c5
优化
Sep 12, 2024
113cebc
新增非高优判定
Sep 17, 2024
139f61e
歌蕾蒂娅主班 刷新心情频率提升
Sep 17, 2024
347f564
Merge pull request #682 from ArkMowers/dev_shawn
Shawnsdaddy Sep 17, 2024
4353f99
2024.9.3 (#692)
Shawnsdaddy Sep 21, 2024
dfe5a30
不养闲人任务合并+优化ui路径+自定义副表名称+仅回满提前上班 (#693)
Anyk00 Sep 27, 2024
41f43bb
工具人数据加入缓存
Sep 27, 2024
0881f6c
修复取消名称传入后端中改错的部分 (#694)
Anyk00 Sep 27, 2024
76dac16
修复should_keep报错+改进状态转移异常处理 (#695)
Anyk00 Oct 2, 2024
de7a60d
#696 不养闲人优化
Oct 6, 2024
0bc2bee
支持输入房间
Oct 6, 2024
60df4ff
改为debug
Oct 6, 2024
29ae979
修复森空岛登录 (#698)
Anyk00 Oct 8, 2024
91b03c7
#696 优化同步拖拽
Oct 8, 2024
a3e851d
10/9 更新
Oct 9, 2024
171e10e
保存跑单截图
Oct 9, 2024
78cb477
UI BUG修复
Oct 9, 2024
74c1913
维娜·维多利亚 识别修复
Oct 9, 2024
a24e3d1
维娜·维多利亚 识别修复 v2
Oct 10, 2024
8c401f3
bug fix
Oct 17, 2024
3c970a8
702 防止重复截图
Oct 17, 2024
6e77155
fix:公招卡住 (#705)
EightyDollars Oct 28, 2024
67b29b2
log 优化,公招限时,maa导航新增timout
Oct 28, 2024
4eee2c5
游戏资源更新
Nov 1, 2024
8a5c345
适配更新
Nov 1, 2024
3ab5b49
模型更新
Nov 1, 2024
8c923fd
资源更新
Nov 1, 2024
84416d1
资源个更新+添加职介筛选
Nov 3, 2024
3ea6d23
修复仓库扫描 (#707)
Anyk00 Nov 6, 2024
54a0e81
干员名扫描范围缩小+基建TODO 只点击一次
Nov 11, 2024
12028db
arrange_confirm 手动添加阈值
Nov 12, 2024
1eb8c1e
修复 fia 任务卡死
Nov 12, 2024
eae6114
非 None 判定
Nov 12, 2024
41bb994
新增用户邮件反馈自动上传log
Nov 20, 2024
6d77ee4
移除测试代码
Nov 21, 2024
40746e0
逻辑修复
Nov 21, 2024
3f81cc2
无人机跑单截图
Nov 22, 2024
1cc3f3d
Merge branch 'main' of https://github.com/ArkMowers/arknights-mower i…
Dec 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ArknightsGameResource
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# arknights-mower

<!--
[![GitHub License](https://img.shields.io/github/license/ArkMowers/arknights-mower)](https://github.com/ArkMowers/arknights-mower/blob/master/LICENSE)
[![GitHub last commit (branch)](https://img.shields.io/github/last-commit/ArkMowers/arknights-mower/dev_shawn)](https://github.com/ArkMowers/arknights-mower/commits/dev_shawn/)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ArkMowers/arknights-mower/pyinstaller-win-shawn.yml?branch=dev_shawn&)](https://github.com/ArkMowers/arknights-mower/actions/workflows/pyinstaller-win-shawn.yml)
-->
<!--[![download](https://img.shields.io/website?url=https%3A%2F%2Fmower.zhaozuohong.vip&label=Mower%E4%B8%8B%E8%BD%BD%E7%AB%99)](https://mower.zhaozuohong.vip/)-->
<!--[![qq_guild](https://img.shields.io/badge/QQ%E9%A2%91%E9%81%93-2r118jwue4-blue)](https://pd.qq.com/s/5t91c3gx9)-->

Mower 是为长期运行设计的、开源的明日方舟脚本。

## 关于 Mower-NG
Expand Down Expand Up @@ -36,10 +28,5 @@ 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 简明教程](https://blog.zhaozuohong.vip/2024/05/10/mower-guide/tutorial/)》。
提出建议、反馈 Bug,欢迎加入 QQ群:239200680 QQ频道:ArkMower(频道号:2r118jwue4)。

提出建议、反馈 Bug 或交流基建知识,欢迎加入 QQ 频道 ArkMower(频道号:2r118jwue4)。
-->
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.11.1.1"

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

from evalidate import Expr

from arknights_mower import __version__
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
from arknights_mower.utils.email import send_message, task_template, version_template
from arknights_mower.utils.hot_update import get_listing
from arknights_mower.utils.email import send_message, task_template
from arknights_mower.utils.log import logger
from arknights_mower.utils.logic_expression import get_logic_exp
from arknights_mower.utils.operators import Operator
from arknights_mower.utils.path import get_path
from arknights_mower.utils.plan import Plan, PlanConfig, Room
from arknights_mower.utils.simulator import restart_simulator

base_scheduler = None
operators = config.operators


# 执行自动排班
def main():
def main(saved_state):
logger.info("开始运行Mower")
rapidocr.initialize_ocr()
simulate()
data = None
if saved_state != {}:
data = saved_state
simulate(data)


def initialize(
Expand All @@ -55,6 +52,7 @@ def initialize(
free_blacklist=conf.free_blacklist,
resting_threshold=conf.resting_threshold,
refresh_trading_config=config.plan.conf.refresh_trading,
refresh_drained=config.plan.conf.refresh_drained,
free_room=conf.free_room,
)
for room, obj in plan[plan["default"]].items():
Expand Down Expand Up @@ -82,6 +80,7 @@ def initialize(
free_blacklist=i["conf"]["free_blacklist"],
resting_threshold=conf.resting_threshold,
refresh_trading_config=i["conf"]["refresh_trading"],
refresh_drained=i["conf"]["refresh_drained"],
free_room=conf.free_room,
)
backup_trigger = get_logic_exp(i["trigger"]) if "trigger" in i else None
Expand Down Expand Up @@ -121,19 +120,19 @@ def initialize(
return base_scheduler


def simulate():
def simulate(saved):
"""
具体调用方法可见各个函数的参数说明
"""
logger.info(f"正在使用全局配置空间: {path.global_space}")
tasks = []
tasks = saved["tasks"] if saved else []
reconnect_max_tries = 10
reconnect_tries = 0
global base_scheduler
success = False
while not success:
try:
base_scheduler = initialize(tasks)
base_scheduler = initialize([])
success = True
except MowerExit:
return
Expand All @@ -158,20 +157,6 @@ def simulate():
if validation_msg is not None:
logger.error(validation_msg)
return
if operators != {}:
for k, v in operators.items():
if (
k in base_scheduler.op_data.operators
and not base_scheduler.op_data.operators[k].room.startswith("dorm")
):
# 只复制心情数据
base_scheduler.op_data.operators[k].mood = v.mood
base_scheduler.op_data.operators[k].time_stamp = v.time_stamp
base_scheduler.op_data.operators[k].depletion_rate = v.depletion_rate
base_scheduler.op_data.operators[k].current_room = v.current_room
base_scheduler.op_data.operators[k].current_index = v.current_index
timezone_offset = 0

if len(base_scheduler.op_data.backup_plans) > 0:
conditions = base_scheduler.op_data.generate_conditions(
len(base_scheduler.op_data.backup_plans)
Expand All @@ -184,85 +169,93 @@ def simulate():
base_scheduler.op_data.swap_plan(
[False] * len(base_scheduler.op_data.backup_plans), True
)
timezone_offset = 0
if saved:
try:
for k, v in saved["operators"].items():
if k not in base_scheduler.op_data.operators:
base_scheduler.op_data.add(Operator(k, ""))
# 只复制心情数据
base_scheduler.op_data.operators[k].mood = v.mood
base_scheduler.op_data.operators[k].time_stamp = v.time_stamp
base_scheduler.op_data.operators[k].depletion_rate = v.depletion_rate
base_scheduler.op_data.operators[k].current_room = v.current_room
base_scheduler.op_data.operators[k].current_index = v.current_index
base_scheduler.op_data.dorm = saved["dorm"]
base_scheduler.party_time = saved["party_time"]
base_scheduler.daily_visit_friend = saved["daily_visit_friend"]
base_scheduler.daily_report = saved["daily_report"]
base_scheduler.daily_skland = saved["daily_skland"]
base_scheduler.daily_mail = saved["daily_mail"]
base_scheduler.task_count = saved["task_count"]
base_scheduler.op_data.skill_upgrade_supports = saved[
"skill_upgrade_supports"
]
except Exception as ex:
logger.exception(ex)
base_scheduler.tasks = tasks
while True:
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()

if remaining_time > 540:
if config.conf.check_for_updates:
logger.info("检查版本更新")
listing = get_listing()
version = __version__.replace("+", "-")
if not any(i.name.startswith(version) for i in listing):
stable = []
testing = []
for i in listing:
name = i.name
if re.fullmatch(r"[0-9]{4}\.[0-9]{2}\.[0-9]+/", name):
stable.append(name[:-1])
elif re.fullmatch(
r"[0-9]{4}\.[0-9]{2}-[0-9a-z]{7}/", name
):
testing.append(name[:-1])
title = "Mower版本过旧,请及时更新"
logger.error(title)
body = version_template.render(
stable=stable, testing=testing, current=version
)
send_message(body, title, "WARNING")
# if config.conf.check_for_updates:
# logger.info("检查版本更新")
# listing = get_listing()
# version = __version__.replace("+", "-")
# if not any(i.name.startswith(version) for i in listing):
# stable = []
# testing = []
# for i in listing:
# name = i.name
# if re.fullmatch(r"[0-9]{4}\.[0-9]{2}\.[0-9]+/", name):
# stable.append(name[:-1])
# elif re.fullmatch(
# r"[0-9]{4}\.[0-9]{2}-[0-9a-z]{7}/", name
# ):
# testing.append(name[:-1])
# title = "Mower版本过旧,请及时更新"
# logger.error(title)
# body = version_template.render(
# stable=stable, testing=testing, current=version
# )
# send_message(body, title, "WARNING")

# 刷新时间以鹰历为准
if (
base_scheduler.sign_in
< (datetime.now() - timedelta(hours=4)).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.sign_in
# < 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 < 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 Expand Up @@ -443,29 +436,3 @@ def _is_depotscan():
except Exception as e:
logger.exception(f"程序出错--->{e}")
base_scheduler.recog.update()


def save_state(op_data, file="state.json"):
tmp_dir = get_path("@app/tmp")
if not tmp_dir.exists():
tmp_dir.mkdir()
state_file = tmp_dir / file
with open(state_file, "w") as f:
if op_data is not None:
json.dump(vars(op_data), f, default=str)


def load_state(file="state.json"):
state_file = get_path("@app/tmp") / file
if not state_file.exists():
return None
with open(state_file, "r") as f:
state = json.load(f)
operators = {k: Expr(v).eval() for k, v in state["operators"].items()}
for k, v in operators.items():
if not v.time_stamp == "None":
v.time_stamp = datetime.strptime(v.time_stamp, "%Y-%m-%d %H:%M:%S.%f")
else:
v.time_stamp = None
logger.info("基建配置已加载!")
return operators
4 changes: 4 additions & 0 deletions arknights_mower/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
# agents list in Arknights
agent_list = json.loads(Path(f"{__rootdir__}/data/agent.json").read_text("utf-8"))

agent_profession = json.loads(
Path(f"{__rootdir__}/data/agent_profession.json").read_text("utf-8")
)

# # agents base skills
# agent_base_config = json.loads(
# Path(f'{__rootdir__}/data/agent-base.json').read_text('utf-8'))
Expand Down
Loading
Loading