GithubHelp home page GithubHelp logo

meowcolm024 / fgo-automata Goto Github PK

View Code? Open in Web Editor NEW
119.0 119.0 34.0 1.86 MB

一个FGO脚本和API フェイトグランドオーダー自動化

Home Page: https://meowcolm024.github.io/FGO-Automata/

License: MIT License

Python 81.72% Batchfile 18.28%
bot fate fate-grand-order fgo opencv-python python

fgo-automata's Introduction

Hi = ̄ω ̄=

両儀式は最高だ!

trophy

fgo-automata's People

Contributors

dependabot[bot] avatar meowcolm024 avatar tsuasahi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fgo-automata's Issues

选择地图后选人报错

Traceback (most recent call last):
File "ceshi.py", line 4, in
fgo.quick_start(advance=True)
File "C:\youxi\FGO-Automata-dev\core\Automata.py", line 433, in quick_start
self.select_checkpoint()
File "C:\youxi\FGO-Automata-dev\core\Automata.py", line 221, in select_checkpoint
if util.standby(self.aquire_screenshot(), crds.IMAGE["no_ap"]):
File "C:\youxi\FGO-Automata-dev\core\util.py", line 58, in standby
res = cv2.matchTemplate(img, template, cv2.TM_CCOEFF_NORMED)
cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-k8sx3e60\opencv\modules\imgproc\src\templmatch.cpp:588: error: (-215:Assertion failed) corr.rows <= img.rows + templ.rows - 1 && corr.cols <= img.cols + templ.cols - 1 in function 'cv::crossCorr'
您好,下了新的仓库,选择地图后进入选助战界面报错了

適配非國服FGO問題

Language:

  • 中文

如果我把assets資料夾內的圖片改成日/美/台服的對應圖片的話,這樣是不是就能無痛適配非國服的FGO了Orz

报错了

G:\FGO-Automata-master>python.exe name.py
Traceback (most recent call last):
File "G:\FGO-Automata-master\name.py", line 1, in
from core.Automata import Automata
File "G:\FGO-Automata-master\core\Automata.py", line 3, in
from core import util, crds
File "G:\FGO-Automata-master\core\util.py", line 2, in
from cv2 import cv2
ImportError: Bindings generation error. Submodule name should always start with a parent module name. Parent name: cv2.cv2. Submodule name: cv2

使用Mumu模拟器第一个技能可能出现按不到的情况和adb问题的解决

Mumu模拟器在手动设置为1920x1080分辨率的情况下第一个从者的一技能可能会出现按不到的情况,尝试将crds.py中servant1的首个技能横坐标从100设置为140后可解决。另外Mumu模拟器自带了adb,如果使用chocolate安装的adb会出现冲突,解决办法是将Mumu模拟器中自带的adb复制一份到根目录下,并修改源码中adb命令设置。
QQ截图20211221234440
QQ截图20211221235005
QQ截图20211221235301

一些建議想討論

想問下,可以跟你要個QQ號或是信箱或是discord or 其他聯絡方式嗎?
主要有些建議直接可以說明比較方便
PS:因為我懶癌發作不想再重看code修改後發起pull request
或是你可以加我
Discord:(´_ゝ`)#9487
如果不方便在這邊直接公開聯繫方式的話可以寄信到我信箱:[email protected]

I have a good idea

I think this tool is using adb to control the mobile phone,which means the PC should be connected to the real phone or use the simulator. I have a Raspberry Pi,I think it can replace the PC. Do you have suggestions about this idea? Or I misunderstand the usage of the repo?

更新助战列表 报错

脚本开了高级助战
情况大概是第一次选助战时选不到的话会自动按更新列表
但是第二次还是识别不了助战就直接报错了 (看脚本应该default是刷新3遍吧?

未命名

自動補充AP失敗

Language:

  • English
  • 中文

Please describe the issue specifically. It's recommended to attach the output log and the screenshot.
请具体描述您遇到的问题。建议附上输出记录和截图。
吃蘋果的時候報錯了,其他功能正常
Screenshot 2021-08-12 035446

有目标的技能选择的问题

您好 是不是两次选择目标技能的等待时间太短了 连续执行两次选择目标技能会停住 中间插一个不选择目标技能会跳过它执行两次选择目标技能

QQ截图20200919095039

QQ截图20200919095212
先进行两次选择目标技能 只能进行一次 第二次完全不点击技能 没有任何后续操作 不进入下一回合 也不跳过执行

QQ截图20200919095913
可以执行衣服的目标选择 然后执行没有目标技能 执行一次选择目标技能 然后停住

QQ截图20200919100411
QQ截图20200919100406
执行选择目标技能1 会跳过执行未选择目标技能 执行选择目标技能2 然后再次停住

Bugs in demon.py

sc = f"bb = Automata(\"Automata(assets/{ckp}.png\", \"assets/{spt}.png\", ({sft_x}, {sft_y}))" # class name: bb

Should be:

sc = f"bb = Automata(\"assets/{ckp}.png\", \"assets/{spt}.png\", ({sft_x}, {sft_y}))"

初始出星会影响使用

如果带的礼装有出星,有可能会吞掉开始的技能,比如此次国服泳装活动
推测有额外buff也会有类似问题
另外更新助战之后滑动寻找助战太快了,还没加载出来就滑过了
感谢大佬

夜神模拟器的神奇bug

Traceback (most recent call last):
File "12-31.py", line 5, in
fgo.quick_start(advance=True)
File "E:\Butter\FGO-Automata\FGO-Automata-0.7.1\core\Automata.py", line 451, in quick_start
self.select_checkpoint()
File "E:\Butter\FGO-Automata\FGO-Automata-0.7.1\core\Automata.py", line 220, in select_checkpoint
self.wait(self.checkpoint)
File "E:\Butter\FGO-Automata\FGO-Automata-0.7.1\core\Automata.py", line 499, in wait
while not util.standby(util.get_sh(self.shifts), pic):
File "E:\Butter\FGO-Automata\FGO-Automata-0.7.1\core\util.py", line 49, in get_sh
screenshot()
File "E:\Butter\FGO-Automata\FGO-Automata-0.7.1\core\util.py", line 32, in screenshot
os.system('adb shell screencap -p /sdcard/sh.png')
KeyboardInterrupt
或者不是bug是我电脑问题?

A bug in Scripter.py

When I select Servant skill with a target by REPL, the REPL will select a target and return

Traceback (most recent call last):
File "REPL.py", line 7, in
repl.main_loop()
File "C:\fakepath\FGO-Automata\core\Scripter.py", line 141, in main_loop
print(self.itp.evaluate(cmd.replace(' ', '')))
File "C:\fakepath\FGO-Automata\core\Scripter.py", line 62, in evaluate
return self._eval(cmd)
File "C:\fakepath\FGO-Automata\core\Scripter.py", line 103, in _eval
return ('Servant skill: ' + out)
TypeError: can only concatenate str (not "list") to str

I try changing line 103 in Scripter.py
from return ('Servant skill: ' + out) to return ('Servant skill: ' + str(out)) ,
then it seem to run well.

A little tiny question: The program keeps capturing the screen but couldn't reach next motion.

Language:

  • 中文

问题概述:运行程序后,一直在截取游戏屏幕,但是无法继续执行任务

运行代码(自创py文件:chentu.py)

模拟器已经到达选择关卡的界面(即可以看到自由本名字、奖励的页面)

C:\Users\79261>cd /d D:\FGO-Automata-master

D:\FGO-Automata-master>adb connect 127.0.0.1:21503
connected to 127.0.0.1:21503

D:\FGO-Automata-master>python chentu.py
/sdcard/sh.png: 1 file pulled. 6.2 MB/s (2417720 bytes in 0.374s)
/sdcard/sh.png: 1 file pulled. 5.9 MB/s (2421372 bytes in 0.394s)
/sdcard/sh.png: 1 file pulled. 6.7 MB/s (2424910 bytes in 0.346s)
/sdcard/sh.png: 1 file pulled. 5.9 MB/s (2420982 bytes in 0.393s)
/sdcard/sh.png: 1 file pulled. 6.3 MB/s (2420126 bytes in 0.366s)

运行代码(example.py)

模拟器已经到达选择关卡的界面(即可以看到狗粮本名字、奖励的页面)

C:\Users\79261>adb connect 127.0.0.1:21503
connected to 127.0.0.1:21503

C:\Users\79261>cd /d D:\FGO-Automata-master

D:\FGO-Automata-master>python example.py
/sdcard/sh.png: 1 file pulled. 3.7 MB/s (2513660 bytes in 0.653s)
/sdcard/sh.png: 1 file pulled. 5.8 MB/s (2567608 bytes in 0.422s)
/sdcard/sh.png: 1 file pulled. 5.1 MB/s (2489003 bytes in 0.469s)
/sdcard/sh.png: 1 file pulled. 3.9 MB/s (2487221 bytes in 0.602s)

其他信息:

  • python版本:3.8.2

  • Package版本

Package               Version
--------------------- --------
configparser          5.0.0
cycler                0.10.0
kiwisolver            1.2.0
matplotlib            3.2.1
numpy                 1.18.5
opencv-contrib-python 4.2.0.34
opencv-python         4.2.0.34
Pillow                7.1.2
pip                   20.1.1
playsound             1.2.2
pyparsing             2.4.7
PyQt5                 5.15.0
PyQt5-sip             12.8.0
pytesseract           0.3.4
python-dateutil       2.8.1
setuptools            41.2.0
six                   1.15.0
you-get               0.4.1432
  • Tesseract:

https://github.com/UB-Mannheim/tesseract/wiki下载,64位,默认安装,已加入环境变量

  • adb
    Android Debug Bridge version 1.0.41
    Version 29.0.5-5949299
    Installed as D:\adb\adb.exe

  • 模拟器
    逍遥模拟器 7.2.1 版
    分辨率:1920*1080,DPI288
    端口:127.0.0.1:21503

  • py程序文件
    用config.bat创建
    代码如下

from core.Automata import Automata 
# start  
fgo = Automata("assets/chentu.png", "assets/cba.png", sft=(0, 0)) 
fgo.quick_start(advance=True) 
# battle1 
fgo.select_servant_skill(1, 2) 
fgo.select_servant_skill(2) 
fgo.select_servant_skill(3, 2) 
fgo.select_servant_skill(7, 2) 
fgo.select_master_skill(3, 1, 1) 
fgo.select_master_skill(1) 
fgo.select_cards([7]) 
# battle2 
fgo.select_servant_skill(3) 
fgo.select_servant_skill(9, 2) 
fgo.select_servant_skill(6) 
fgo.select_cards([7]) 
# battle3 
fgo.select_servant_skill(1, 2) 
fgo.select_servant_skill(2) 
fgo.select_servant_skill(8) 
fgo.select_cards([7]) 
#finish 
fgo.finish_battle() 

助战、关卡图片:按照模板截取

另外,在试用williamgateszhao大佬的脚本时,也出现了类似的问题(一直截屏,但是不会继续执行)

连接Mumu模拟器时报错

Language:

  • English
  • 中文

Please describe the issue specifically. It's recommended to attach the output log and the screenshot.
请具体描述您遇到的问题。建议附上输出记录和截图。

每次运行脚本之前连接的模拟器就会断开连接 但是在真机上可以运行。使用mumu模拟器 分辨率是1920*1080 DPI 480
以下为报错

`(venvp) E:\Programme\Python\FGO-Automata-master>adb devices & python Qp.py & adb devices
List of devices attached
127.0.0.1:7555 device

  • daemon not running; starting now at tcp:5037
  • daemon started successfully
    error: no devices/emulators found
    Traceback (most recent call last):
    File "Qp.py", line 1, in
    from core import util, crds
    File "E:\Programme\Python\FGO-Automata-master\core\util.py", line 78, in
    def standby(images=get_sh((0, 0)), tmp: str = None, threshold: float = 0.85) -> bool:
    File "E:\Programme\Python\FGO-Automata-master\core\util.py", line 58, in get_sh
    img = screencap()
    File "E:\Programme\Python\FGO-Automata-master\core\util.py", line 71, in screencap
    image_bytes, dtype='uint8'), cv2.IMREAD_COLOR)
    cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-iw3y3ir8\opencv\modules\imgcodecs\src\loadsave.cpp:753: error: (-215:Assertion failed) !buf.empty() in function 'cv::imdecode_'

List of devices attached

`

util imdecode error

image
如果改成subporcess的方式的話貌似在import util的時候就會去把它執行過一次,而這時如果沒有adb開啟並連接的話會導致imdecode那邊出現錯誤
解決辦法看是要在util最上面加個判斷句,判斷如果沒有開啟adb的時候就開啟
而我的解決方法是把adb包成一個class然後在第一次開啟程式的時候就會先進行重啟

Low accuray recognizing battle id

First, great project, thanks!
But I found some problems when using automatic battle, the source of these problems are usually caused by failure to interpret battle id, and I tried adding grayscale/binary conversion to solve the problem, now it works well.

for core.util get_battle_id function:
Replace

    text = image_to_string(
        region, config='--psm 7 --oem 3 -c tessedit_char_whitelist=/1234')

to

    THRESHOLD = 200
    BINARY_TABLE=[0 if i < THRESHOLD else 1 for i in range(256)]
    text = image_to_string(
        region.convert('L').point(BINARY_TABLE, '1'), config='--psm 7 --oem 3 -c tessedit_char_whitelist=/1234')

无法进行`连续战斗`

脚本结束一次运行

after-battle related
def finish_battle(self):
while not util.standby(util.get_sh(self.shifts), "assets/item.png"):
xs = util.get_crd(util.get_sh(self.shifts), "assets/close.png")
if len(xs) != 0:
self.tap(xs[0])
self.tap((660, 840), 40, 1)
time.sleep(0.9)
time.sleep(0.9)
x = util.get_crd(util.get_sh(self.shifts), "assets/item.png")
self.tap(x[0])
print("[INFO] Battle Finished.")

FLAWED

def is_finished(self) -> bool:
time.sleep(0.5)
return util.standby(util.get_sh(self.shifts), "assets/finish.png", 0.5)
程序在点击finish.png(下一项)的时候,就默认完成了一次执行。然后就会停留在close.png(关闭),再次出战 的界面上,必须手动点关闭才能进行下一次

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.