mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 17:57:01 +08:00
docs: add links to some parts
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
- 在[MAA官网](https://maa.plus/)下载Linux动态库并解压
|
||||
- 进入`./MAA-v{版本号}-linux-x{框架}/Python/`目录下打开`sample.py`文件
|
||||
- 找到`# 请自行配置 adb 环境变量,或修改为 adb 可执行程序的路径`一栏根据系统情况填写
|
||||
- 配置adb:找到[if asst.connect('adb.exe', '127.0.0.1:5555'):](https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/722f0ddd4765715199a5dc90ea1bec2940322344/src/Python/sample.py#L48)一栏根据系统情况填写
|
||||
- 如果模拟器使用`avd`自带`adb`,可以直接在`adb.exe`一栏填写`adb`路径(一般在`~/Android/Sdk/platform-tools/`里面可以找到,例如`if asst.connect("/home/user1/Android/Sdk/platform-tools/adb", "模拟器的adb地址"):`)
|
||||
- 如果使用其他模拟器须先下载`adb`:`sudo apt install adb`后填写路径或全局变量直接写`"adb"`即可
|
||||
- adb地址的获取:可以直接使用adb工具:`adb路径 devices`
|
||||
@@ -14,141 +14,14 @@
|
||||
- `emulator-5555 device`
|
||||
- `emulator-5555`就是模拟器的adb地址,填入`127.0.0.1:5555`,如`if asst.connect("/home/user1/Android/Sdk/platform-tools/adb", "emulator-5555"):`
|
||||
- 这时候可以测试下,`$ python3 sample.py`,如果返回`连接成功`则基本完成了
|
||||
- 移动到下面`# 任务及参数请参考 docs/集成文档.md`一栏根据需要和`3.x集成文档`部分修改
|
||||
- 这里给出示范样例
|
||||
|
||||
```python3
|
||||
import json
|
||||
import pathlib
|
||||
import time
|
||||
|
||||
from asst.asst import Asst
|
||||
from asst.utils import Message, Version, InstanceOptionType
|
||||
from asst.updater import Updater
|
||||
from asst.emulator import Bluestacks
|
||||
|
||||
|
||||
@Asst.CallBackType
|
||||
def my_callback(msg, details, arg):
|
||||
m = Message(msg)
|
||||
d = json.loads(details.decode("utf-8"))
|
||||
|
||||
print(m, d, arg)
|
||||
def infrast(mode=0, plan_index="主班", filename="/home/user1/snap/MAA/自定义基建.json"):
|
||||
asst.append_task("Infrast", {
|
||||
"mode": mode,
|
||||
"facility": [
|
||||
"Mfg", "Trade", "Control", "Power", "Reception", "Office", "Dorm"
|
||||
],
|
||||
"drones": "Money",
|
||||
"filename": filename,
|
||||
"plan_index": plan_index
|
||||
})
|
||||
def visit():
|
||||
asst.append_task("Visit")
|
||||
def mall():
|
||||
asst.append_task("Mall", {
|
||||
"shopping": True,
|
||||
"buy_first": ["赤金", "招聘许可", "龙门币", "固源岩"],
|
||||
"blacklist": ["家具", "碳", "碳素", "碳素组", "加急许可"],
|
||||
})
|
||||
def recruit():
|
||||
asst.append_task("Recruit", {
|
||||
"refresh": True,
|
||||
"select": [4, 5],
|
||||
"confirm": [4, 5],
|
||||
"times": 4
|
||||
})
|
||||
def fight(stage='', medicine=0):
|
||||
asst.append_task("Fight", {
|
||||
"stage": stage,
|
||||
"medicine": medicine,
|
||||
"report_to_penguin": True,
|
||||
# "penguin_id": "1234567"
|
||||
})
|
||||
def roguelike(theme="Mizuki", squad="以人为本", roles="取长补短", core_char="百炼嘉维尔"):
|
||||
asst.append_task("Roguelike", {
|
||||
"theme": theme, # Phantom
|
||||
"squad": squad,
|
||||
"roles": roles,
|
||||
"core_char": core_char,
|
||||
})
|
||||
def award():
|
||||
asst.append_task("Award")
|
||||
def copilot():
|
||||
asst.append_task("Copilot", {
|
||||
"filename": "./GA-EX8-raid.json",
|
||||
"formation": False
|
||||
})
|
||||
|
||||
def tasks():
|
||||
infrast(mode=10000, plan_index="主班")
|
||||
#visit()
|
||||
#mall()
|
||||
recruit()
|
||||
#fight(medicine=0, stage="1-7") # stage="1-7", if null then return previous stage.
|
||||
#roguelike() # theme="Mizuki", squad="以人为本", roles="取长补短", core_char="百炼嘉维尔"
|
||||
#award()
|
||||
|
||||
#copilot()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# 请设置为存放 dll 文件及资源的路径
|
||||
path = pathlib.Path(__file__).parent.parent
|
||||
|
||||
# 设置更新器的路径和目标版本并更新
|
||||
#Updater(path, Version.Stable).update()
|
||||
|
||||
# 外服需要再额外传入增量资源路径,例如
|
||||
# incremental_path=path / "resource" / "global" / "YoStarEN"
|
||||
Asst.load(path=path)
|
||||
|
||||
# 若需要获取详细执行信息,请传入 callback 参数
|
||||
# 例如 asst = Asst(callback=my_callback)
|
||||
asst = Asst()
|
||||
|
||||
# 设置额外配置
|
||||
# 触控方案配置
|
||||
asst.set_instance_option(InstanceOptionType.touch_type, "maatouch")
|
||||
# 暂停下干员
|
||||
# asst.set_instance_option(InstanceOptionType.deployment_with_pause, "1")
|
||||
|
||||
# 启动模拟器。例如启动蓝叠模拟器的多开Pie64_1,并等待30s
|
||||
# Bluestacks.launch_emulator_win(r"C:\Program Files\BlueStacks_nxt\HD-Player.exe", 30, "Pie64_1")
|
||||
|
||||
# 获取Hyper-v蓝叠的adb port
|
||||
# port = Bluestacks.get_hyperv_port(r"C:\ProgramData\BlueStacks_nxt\bluestacks.conf", "Pie64_1")
|
||||
|
||||
# 请自行配置 adb 环境变量,或修改为 adb 可执行程序的路径
|
||||
if asst.connect("/home/user1/Android/Sdk/platform-tools/adb", "emulator-5554"):
|
||||
print("连接成功")
|
||||
else:
|
||||
print("连接失败")
|
||||
exit()
|
||||
|
||||
# 任务及参数请参考 docs/集成文档.md
|
||||
|
||||
asst.append_task("StartUp")
|
||||
|
||||
tasks()
|
||||
|
||||
#asst.append_task("Custom", {"task_names": ["AwardBegin"]})
|
||||
|
||||
asst.start()
|
||||
|
||||
while asst.running():
|
||||
time.sleep(0)
|
||||
```
|
||||
|
||||
以上样例我只需要根据需求在`task()`函数内进行修改即可
|
||||
- 自定义任务:[# 任务及参数请参考 docs/集成文档.md](https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/722f0ddd4765715199a5dc90ea1bec2940322344/src/Python/sample.py#L54)一栏根据需要和[3.x集成文档](https://maa.plus/docs/3.1-%E9%9B%86%E6%88%90%E6%96%87%E6%A1%A3.html)部分修改
|
||||
|
||||
## 模拟器支持
|
||||
|
||||
### ✅ [AVD](https://developer.android.com/studio/run/managing-avds)
|
||||
|
||||
- 必选配置:16:9的屏幕分辨率,且分辨率需大于720p
|
||||
- 推荐配置:x86_64的框架(R - 30 - x86_64 Android 11.0)配合MAA的linux x64动态库
|
||||
- 推荐配置:x86_64的框架(R - 30 - x86_64 - Android 11.0)配合MAA的linux x64动态库
|
||||
|
||||
### ⚠️ [Genymotion](https://www.genymotion.com/)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user