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

feat: 合并支线,暂时删除小地图寻路 #670

Merged
merged 29 commits into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a6c72f7
Merge pull request #1 from Night-stars-1/main-beta
Night-stars-1 Jun 10, 2023
fca335e
Update upload-to-release.yml
Night-stars-1 Jun 10, 2023
3877b57
Update upload-to-release.yml
Night-stars-1 Jun 10, 2023
a6319aa
Update upload-to-release.yml
Night-stars-1 Jun 10, 2023
d845c0b
deploy
Night-stars-1 Jul 19, 2023
9113438
chore: 优化性能
Night-stars-1 Jul 20, 2023
b4ca834
chore: 从releases更新脚本
Night-stars-1 Jul 20, 2023
1774895
delpoy
Night-stars-1 Jul 20, 2023
c5b85de
fix: 修复一些bug
Night-stars-1 Jul 20, 2023
94f075c
chore: 提交仓库源配置
Night-stars-1 Jul 20, 2023
8b192fa
chore: 添加仓库来源设置
Night-stars-1 Jul 20, 2023
19b3757
deploy
Night-stars-1 Jul 20, 2023
846ce26
Merge branch 'main' into main-beta
Night-stars-1 Jul 20, 2023
b373451
Update upload-to-release.yml
Night-stars-1 Jul 20, 2023
177af26
chore: 脚本更新添加代理
Night-stars-1 Jul 20, 2023
8c3288a
Merge branch 'main-beta' of https://github.com/Night-stars-1/StarRail…
Night-stars-1 Jul 20, 2023
5dfa5a3
deploy
Night-stars-1 Jul 20, 2023
b26951e
chore: 选择地图增加返回
Night-stars-1 Jul 20, 2023
9dc14ab
fix: 下载地址错误
Night-stars-1 Jul 21, 2023
d197b6c
Update release.yml
Night-stars-1 Jul 21, 2023
f4c9b53
chore: 更改图片文件夹
Night-stars-1 Jul 21, 2023
36c342e
Merge branch 'main-beta' of https://github.com/Night-stars-1/StarRail…
Night-stars-1 Jul 21, 2023
180db35
chore: 更新图片文件夹名称
Night-stars-1 Jul 21, 2023
b8fa22e
chore: 检测更新适配脚本
Night-stars-1 Jul 21, 2023
e044b4a
chore
Night-stars-1 Jul 21, 2023
a2c5d3c
chore: 更改配置设置顺序
Night-stars-1 Jul 21, 2023
700afc5
chore
Night-stars-1 Jul 21, 2023
7f18868
chore
Night-stars-1 Jul 21, 2023
7e6cb2f
chore: 开始运行时写入所有配置项
Night-stars-1 Jul 22, 2023
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
1 change: 1 addition & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ changelog:
- title: Fixs
labels:
- fix
- bug
- title: Feats
labels:
- feat
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ jobs:
- name: Automerge
uses: 'pascalgn/automerge-action@v0.15.6'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
GITHUB_TOKEN: '${{ secrets.SRA_TOKEN }}'
MERGE_LABELS: ''
2 changes: 1 addition & 1 deletion .github/workflows/upload-to-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
repo_token: "${{ secrets.SRA_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "预构建版本"
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,16 @@ venv.bak/
# custom
logs/
map/
maps/
map_data/
temp/
picture/
tmp/
plugins/
StarRailAssistant_backup/
test.py
map_list.json
LICENSE
temp_list.json
picture_list.json
version.json
screencast.png
screencast1.png
Expand Down
72 changes: 41 additions & 31 deletions Honkai_Star_Rail.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from get_width import get_width
from utils.log import log, fight_log
from utils.config import read_json_file, modify_json_file, add_key_value, read_maps, CONFIG_FILE_NAME, _
from utils.config import read_json_file, load_all_config_data, modify_json_file, add_key_value, read_maps, CONFIG_FILE_NAME, _
from utils.simulated_universe import Simulated_Universe
from utils.update_file import update_file
from utils.commission import Commission
Expand Down Expand Up @@ -51,9 +51,9 @@ def __init__(self) -> None:
'skip_verify': False,
'type': "star",
'version': "main",
'url_zip': "https://github.com/Starry-Wind/StarRailAssistant/archive/refs/heads/main.zip",
'url_zip': f"https://github.com/{sra_config_obj.github_source}/StarRailAssistant/archive/refs/heads/main.zip",
'unzip_path': ".",
'keep_folder': ['.git', 'logs', 'temp', 'map', 'tmp', 'venv'],
'keep_folder': ['.git', 'logs', 'picture', 'map', 'tmp', 'venv'],
'keep_file': ['config.json', 'version.json', 'star_list.json', 'README_CHT.md', 'README.md'],
'zip_path': "StarRailAssistant-main/",
'name': _("脚本"),
Expand All @@ -63,7 +63,7 @@ def __init__(self) -> None:
'skip_verify': False,
'type': "map",
'version': "map",
'url_zip': "https://raw.githubusercontent.com/Starry-Wind/StarRailAssistant/map/map.zip",
'url_zip': f"https://raw.githubusercontent.com/{sra_config_obj.github_source}/StarRailAssistant/map/map.zip",
'unzip_path': "map",
'keep_folder': [],
'keep_file': [],
Expand All @@ -73,10 +73,10 @@ def __init__(self) -> None:
},
_("图片"):{
'skip_verify': False,
'type': "temp",
'type': "picture",
'version': "map",
'url_zip': "https://raw.githubusercontent.com/Starry-Wind/StarRailAssistant/map/temp.zip",
'unzip_path': "temp",
'url_zip': f"https://raw.githubusercontent.com/{sra_config_obj.github_source}/StarRailAssistant/map/picture.zip",
'unzip_path': "picture",
'keep_folder': [],
'keep_file': [],
'zip_path': "map/",
Expand Down Expand Up @@ -125,19 +125,27 @@ def load_plugin(self):

def choose_map(self, option:str=_('大世界')):
if option == _("大世界"):
title_ = _("请选择起始星球:")
options_map = {_("空间站「黑塔」"): "1", _("雅利洛-VI"): "2", _("仙舟「罗浮」"): "3"}
option_ = questionary.select(title_, list(options_map.keys())).ask()
main_map = options_map.get(option_)
title_ = _("请选择起始地图:")
__, map_list_map = read_maps()
options_map = map_list_map.get(main_map)
if not options_map:
return None, _("你没下载地图,拿什么选?")
keys = list(options_map.keys())
values = list(options_map.values())
option_ = questionary.select(title_, values).ask()
side_map = keys[values.index(option_)]
def select_word():
title_ = _("请选择起始星球:")
options_map = {_("空间站「黑塔」"): "1", _("雅利洛-VI"): "2", _("仙舟「罗浮」"): "3"}
option_ = questionary.select(title_, list(options_map.keys())).ask()
main_map = options_map.get(option_)
return select_map(main_map)
def select_map(main_map):
title_ = _("请选择起始地图:")
__, map_list_map = read_maps()
options_map = map_list_map.get(main_map)
if not options_map:
return None, _("你没下载地图,拿什么选?")
keys = list(options_map.keys())
values = list(options_map.values())+[_("返回上一级")]
option_ = questionary.select(title_, values).ask()
if option_ == _("返回上一级"):
return select_word()
else:
side_map = keys[values.index(option_)]
return main_map, side_map
main_map, side_map = select_word()
return f"{main_map}-{side_map}", None
elif option == _("模拟宇宙"):
title_ = _("请选择第几宇宙:")
Expand All @@ -163,15 +171,15 @@ def choose_map(self, option:str=_('大世界')):

def set_config(self, start = True):
global game_title
if not read_json_file(CONFIG_FILE_NAME, False).get('start') or not start:
if not sra_config_obj.start or not start:
title = "请选择你游戏的运行语言:"
options = {
"简体中文": "zh_CN",
"繁體中文": "zh_TC",
"English": "EN"
}
option = questionary.select(title, options).ask()
modify_json_file(CONFIG_FILE_NAME, "language", options[option])
sra_config_obj.language = options[option]
import utils.config
importlib.reload(utils.config)
_ = utils.config._
Expand All @@ -194,7 +202,7 @@ def set_config(self, start = True):
url_ms.append(options[index]+f" {ms}ms")
url_ms = [i.replace(" "," "*(len(max(url_ms, key=len))-len(i))) if len(i) < len(max(url_ms, key=len)) else i for i in url_ms]
option = options[url_ms.index(questionary.select(title, url_ms).ask())]
modify_json_file(CONFIG_FILE_NAME, "github_proxy", option)
sra_config_obj.github_proxy = option
title = _("请选择下载代理地址:(不使用代理选空白选项)")
options = ['https://ghproxy.com/', 'https://ghproxy.net/', 'raw.fgit.ml', '']
url_ms = []
Expand All @@ -214,25 +222,29 @@ def set_config(self, start = True):
url_ms.append(options[index]+f" {ms}ms")
url_ms = [i.replace(" "," "*(len(max(url_ms, key=len))-len(i))) if len(i) < len(max(url_ms, key=len)) else i for i in url_ms]
option = options[url_ms.index(questionary.select(title, url_ms).ask())]
modify_json_file(CONFIG_FILE_NAME, "rawgithub_proxy", option)
sra_config_obj.rawgithub_proxy = option
title = _("请选择你的仓库来源:")
options = ["Starry-Wind", "Night-stars-1"]
option = questionary.select(title, options).ask()
sra_config_obj.github_source = option
while True:
if read_json_file(CONFIG_FILE_NAME, False).get('temp_version') == "0" or read_json_file(CONFIG_FILE_NAME, False).get('map_version') == "0":
if sra_config_obj.picture_version == "0" or sra_config_obj.map_version == "0":
sra.up_data()
else:
break
title = _("你游戏里开启了连续自动战斗吗?:")
options = [_('没打开'), _('打开了'), _('这是什么')]
option = questionary.select(title, options).ask()
modify_json_file(CONFIG_FILE_NAME, "auto_battle_persistence", options.index(option))
modify_json_file(CONFIG_FILE_NAME, "start", True)
sra_config_obj.auto_battle_persistence = options.index(option)
sra_config_obj.start = True
raise Exception(_("请重新运行"))

def up_data(self):
import utils.config
importlib.reload(utils.config)
_ = utils.config._
# asyncio.run(check_file(ghproxy, "map"))
# asyncio.run(check_file(ghproxy, "temp"))
# asyncio.run(check_file(ghproxy, "picture"))

title = _("请选择更新项目")
options = list(self.updata_dict.keys())+[_("全部更新")]
Expand Down Expand Up @@ -264,7 +276,6 @@ def main(self, option:str=_('大世界'),start: str=None,role_list: str=None):
time.sleep(0.5)
get_width(game_title)
#map_instance.calculated.CONFIG = read_json_file(CONFIG_FILE_NAME)
import pyautogui # 缩放纠正
log.info(_("开始运行,请勿移动鼠标和键盘"))
log.info(_("若脚本运行无反应,请使用管理员权限运行"))
if option == _("大世界"):
Expand All @@ -284,15 +295,14 @@ def main(self, option:str=_('大世界'),start: str=None,role_list: str=None):
time.sleep(0.5)
get_width(game_title)
#map_instance.calculated.CONFIG = read_json_file(CONFIG_FILE_NAME)
import pyautogui # 缩放纠正
log.info(_("开始运行,请勿移动鼠标和键盘"))
log.info(_("若脚本运行无反应,请使用管理员权限运行"))
self.option_dict[option]()

if __name__ == "__main__":
join_time = read_json_file(CONFIG_FILE_NAME).get("join_time", {})
if type(join_time) == dict:
modify_json_file(CONFIG_FILE_NAME, "join_time", 9)
sra_config_obj.join_time = 9
sra = SRA()
try:
sra.set_config() # 无config直接更新时初始化config文件
Expand Down
51 changes: 8 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[简体中文](README.md) | [繁体中文](README_CHT.md) | [English](README_EN.md) | [文档](https://sra.stysqy.top)

<img alt="LOGO" src="../../blob/map/temp/love!.png" style="border-radius:50%">
<img alt="LOGO" src="../../blob/map/picture/love!.png" style="border-radius:50%">

<h1 align="center">

Expand All @@ -19,15 +19,8 @@
[![GitHub License](https://img.shields.io/github/license/Starry-Wind/StarRailAssistant?style=flat-square)](https://github.com/Starry-Wind/StarRailAssistant/blob/main/LICENSE)
</div>

*****该脚本仍然处于测试阶段,可能会出现奇奇怪怪的BUG*****

***寻路撞墙?走的路径不对?嫌弃路线太慢?现在beta-2.7新增加地图录制功能***<br>
***你现在可以使用tool目录下的record_v7.2.py自行录制地图路径,包你走到满意 XD***

找到BUG了?代码问题想吐槽?欢迎加入 技术 & 吹水群:[QQ 群1(可能满了)](https://qm.qq.com/cgi-bin/qm/qr?k=xdCO46fHlVcY7D2L7elXzqcxL3nyTGnW&jump_from=webapi&authKey=uWZooQ2szv+nG/re7luCKn8LW1KibSb0vvi0FycA45Mglm5AGM1GP2iJ+SiWmDwg)|[QQ 群2](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=ShfX_OHrFCHG6fuvXhq7W-oJ4omo0p-_&authKey=7VuSrSVbfqP6bj3%2BBJdI4NwLRrYtUEYOJp2JiT8%2BJnRDhv9sWpJ%2FHjSh5iiY8T4c&noverify=0&group_code=618070253)|[QQ频道](https://pd.qq.com/s/e910fud13)|[Telegram Group](https://t.me/+yeQEhnuT9O41NDM1)<br>

~~该脚本当前版本仅支持 缩放150%,屏幕分辨率2560x1440,现在在大改动中,尽快解决屏幕旋转适配问题~~

## 免责声明

本软件是一个外部工具旨在自动化崩坏星轨的游戏玩法。它被设计成仅通过现有用户界面与游戏交互,并遵守相关法律法规。该软件包旨在提供简化和用户通过功能与游戏交互,并且它不打算以任何方式破坏游戏平衡或提供任何不公平的优势。该软件包不会以任何方式修改任何游戏文件或游戏代码。
Expand All @@ -43,55 +36,27 @@ This software is open source, free of charge and for learning and exchange purpo

## 使用说明

1. 安装[Python 3.11](https://www.python.org/downloads/release/python-3113/) (其他版本安装依赖项时会有很多问题)
1. 输入`pip install -r requirements.txt`安装依赖
2. 如果您是第一次运行脚本,还请选择:检测更新-全部更新~
3. 下载最新版[星穹铁道小助手](https://github.com/Starry-Wind/StarRailAssistant/releases/latest)
4. 解压文件,并进入文件夹
5. 复制文件夹路径
6. 右键开始菜单,选择`终端管理员`,输入`cd 刚刚复制的路径`
7. 输入`pip config set global.index-url https://mirrors.aliyun.com/pypi/simple`设置国内pip源
8. 输入`pip install -r requirements.txt`安装依赖
9. 输入`Python Honkai_Star_Rail.py`运行星穹铁道小助手
10. 使用模拟器请使用1280\*720p分辨率,默认为夜神模拟器,其他模拟器使用请先连接上adb(模拟器卡顿可能会吞操作)
11. 跑图过程中出问题了不想跑了想返回主菜单了可以用Ctrl+C并默念<font color= #E2027F>爱门</font>
- [使用说明](https://sra.stysqy.top/guide/)

## 配置文件说明

```json
{
"real_width": 0, (实际宽度)
"auto_battle_persistence": 0, (游戏内是否开启自动自动,填1则为开启)
"real_height": 0, (实际长度)
"github_proxy": "", (github代理)
"rawgithub_proxy": "", (github代理)
"webhook_url": "",
"start": true, (是否第一次运行脚本)
"temp_version": "20230515205738",
"star_version": "20230515220742",
"level": "INFO",
"adb": "127.0.0.1:62001",(62001为adb端口)
"adb_path": "temp\\adb\\adb",(adb文件路径)
"proxies": "",
"move_excursion": 0(移动偏移)
}
```
- [配置文件说明](https://sra.stysqy.top/config/)

## 脚本录制 感谢[@AlisaCat](https://github.com/AlisaCat-S)

1. WASD移动,X是进战斗,鼠标左键是打障碍物,F键是交互,禁止用鼠标移动视角,只能使用方向键左右来移动视角(脚本运行后方向键左右会映射鼠标移动),录制期间能且只能按动键盘上的一个有效按键(也就是不能同时按下多键),脚本只会录制按键按下时间和移动的视角,不会录制停顿的时间(可以慢慢一个键一个键录制,保证录制准确性),录制完成后F9停止录制并保存。
2. 完成后将会生成output(时间).json文件,请把他重命名替换成你要更改的地图json,并且将传送点截图重命名并保存到temp即可使用 (就可以申请到map分支提交,或者交给管理提交)
2. 完成后将会生成output(时间).json文件,请把他重命名替换成你要更改的地图json,并且将传送点截图重命名并保存到picture即可使用 (就可以申请到map分支提交,或者交给管理提交)
3. 地图json中的空白填写示例:
```json
{
"name": "乌拉乌拉-1", (地图json名为1-1_1.json)
"author": "Starry-Wind", (作者名,第二作者不能覆盖第一作者名称)
"start": [ (开局传送地图识别图片,并将鼠标移动至图片中间并按下按键)
{"map": 1}, (按下m键打开地图)
{"temp\\orientation_1.jpg": 1.5}, (识别到orientation_1.jpg图片后,将鼠标移动至图片中间并按下按键)
{"temp\\map_1.jpg": 2}, (具体图片自己看,一般为该区域名"乌拉乌拉"的地图文字)
{"temp\\map_1_point_1.jpg": 1.5}, (第一个传送点的图片)
{"temp\\transfer.jpg": 1.5} ("传送"字的图片)
{"picture\\orientation_1.jpg": 1.5}, (识别到orientation_1.jpg图片后,将鼠标移动至图片中间并按下按键)
{"picture\\map_1.jpg": 2}, (具体图片自己看,一般为该区域名"乌拉乌拉"的地图文字)
{"picture\\map_1_point_1.jpg": 1.5}, (第一个传送点的图片)
{"picture\\transfer.jpg": 1.5} ("传送"字的图片)
]
}
```
Expand Down
Loading