AzurLaneAutoScript icon indicating copy to clipboard operation
AzurLaneAutoScript copied to clipboard

TW服的緊急委託畫面無法關閉

Open Zorachristine opened this issue 6 years ago • 18 comments

我是用CN服設定來跑TW服的,最初在進入地圖時及戰鬥結束收穫道具時會發生畫面卡住的情形, 後來發現是圖片判讀的問題,我自行置換後就解決了。

但是出現緊急委託時,我按照同樣的方式操作,卻仍無法解決問題。 1603534328449.zip 我的操作方式,是將自行製作的圖片與"assets/handler/GET_MISSION"置換, 我認為是我置換的圖片不對,但找不到其他與緊急委託相關的圖片, 希望你們能教我如何解決,謝謝。

Zorachristine avatar Oct 25 '20 12:10 Zorachristine

there is a small difference in this asset, maybe there are others?

if many assets are different, the right way would be to implement support for TW separately, but for that we would need a maintainer to update the assets when necessary.

Also, here you can find how create a new asset: https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/development

JustShinobi avatar Oct 25 '20 15:10 JustShinobi

你能发一下你制作的 GET_ITEMS.png 吗? Can you send the GET_ITEMS.png you make?

LmeSzinc avatar Oct 25 '20 16:10 LmeSzinc

there is a small difference in this asset, maybe there are others?

if many assets are different, the right way would be to implement support for TW separately, but for that we would need a maintainer to update the assets when necessary.

Also, here you can find how create a new asset: https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/development

I think this is not the real reason, handle_urgent_commission uses offset=True, which can handle the random movement of buttons. Code in module/handler/info_handler.py:

    def handle_urgent_commission(self, save_get_items=None):
        """
        Args:
            save_get_items (bool):

        Returns:
            bool:
        """
        if save_get_items is None:
            save_get_items = self.config.ENABLE_SAVE_GET_ITEMS

        appear = self.appear(GET_MISSION, offset=True, interval=2)
        if appear:
            logger.info('Get urgent commission')
            if save_get_items:
                self.handle_info_bar()
                self.device.save_screenshot('get_mission')
            self.device.click(GET_MISSION)
        return appear

LmeSzinc avatar Oct 25 '20 16:10 LmeSzinc

我將我做的覆蓋圖檔都打包上傳了。

cover.zip

  1. GET_ITEMS.png 原檔有3種形式,我只找到其中2種。

2.reward 1603679948675.zip 1603681677843.zip

在上傳前我才想起每日任務及委託的執行也有問題, 目前替換了COMMISSION_ADVICE.png及COMMISSION_START.png仍無法解決。

Zorachristine avatar Oct 26 '20 03:10 Zorachristine

测试了一下, 识别没有问题, 测试代码如下:

import module.config.server as server
server.server = 'cn'

from module.ui.ui import UI
from module.handler.assets import *
from module.config.config import AzurLaneConfig
from PIL import Image

az = UI(AzurLaneConfig('alas'))
file = ''  # 本地文件路径
image = Image.open(file).convert('RGB')
az.device.image = image
self = az

print(self.appear(GET_MISSION, offset=True))

检查一下替换文件之后有没有运行 python -m dev_tools.button_extract

参照 https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/development 中 "如何添加一个按钮" 一节

运行./dev_tools下的button_extract.py button_extract.py会自动提取按钮的属性, 免去了人工输入的烦恼 python -m dev_tools.button_extract

LmeSzinc avatar Oct 26 '20 03:10 LmeSzinc

另外, 你可以将 ./assets/cn 复制为 ./assets/tw, 把TW的图片覆盖进去, 提交一个 PR. 然后我这边可以为 TW 增加一个入口.

LmeSzinc avatar Oct 26 '20 04:10 LmeSzinc

added support to Taiwan server on Dev branch, on dev_tools.bat there a option to button_extract

JustShinobi avatar Oct 26 '20 18:10 JustShinobi

感謝增加了TW Server, 目前會碰到無法進入緊急委託的問題, 疑似是COMMISSION_URGENT判讀的問題。 1603870906785.zip

我參照cn及jp的方式作圖,並執行了python -m dev_tools.button_extract, 問題仍無法解決。 commission_U.zip

另外我按照wiki的方式試著增加繁體中文, 但在一開始calldictionary.py時就出了問題, server language.zip

Zorachristine avatar Oct 29 '20 04:10 Zorachristine

目前會碰到無法進入緊急委託的問題, 疑似是COMMISSION_URGENT判讀的問題。 我參照cn及jp的方式作圖,並執行了python -m dev_tools.button_extract, 問題仍無法解決。

把 COMMISSION_DAILY 和 COMMISSION_URGENT 都替换了试试看

另外我按照wiki的方式試著增加繁體中文, 但在一開始call dictionary.py時就出了問題,

有两处的名称需要统一: dictionary.py 里是 啟用掉落記錄, argparser_tw.py 里是 啟用掉落紀錄 dictionary.py 里是 心情回復3, argparser_tw.py 里是 e3.add_argument('--心情回復3', default=default('--心情回复3'),

LmeSzinc avatar Oct 29 '20 08:10 LmeSzinc

上述問題已解決,非常感謝。

這次是有關活動圖的問題(問題很多非常抱歉), 我參照wiki用./dev_tools/map_extractor.py做了箱庭療法的活動圖, 目前測試D3部分碰到了2種狀況:

  1. | WARNING | Enemy detection template not found: Siren_shengdiyage
  2. | ERROR | Vanish point and distant point too close

有關1.的狀況,我參考了cn及en服過往的內容, 試著增加了MAP_SIREN_COUNT = 3及複製戰鬥邏輯,結果一樣。

2.的狀況是使用原檔時,碰過一次的狀況, 我為此更改了‵MAP.camera_data‵及‵MAP.camera_data_spawn_point‵,但效果不確定。

event_20201022_tw_test.zip

Zorachristine avatar Oct 29 '20 15:10 Zorachristine

  1. 需要添加模板图片,详见 https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/4.1.-Detection-objects 中的"添加识别动态敌人的 GIF 模板图片" 一节
  2. 把 log 和截图发来看看

LmeSzinc avatar Oct 29 '20 18:10 LmeSzinc

  1. 需要添加模板图片,详见 https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/4.1.-Detection-objects 中的"添加识别动态敌人的 GIF 模板图片" 一节

image 這應該是沒有連上模擬器?我有將emulator_test.py裡的adb port改為我使用的並成功連上 但截圖功能仍連不上模擬器

  1. 把 log 和截图发来看看

1603978346985.zip

Zorachristine avatar Oct 30 '20 11:10 Zorachristine

  1. 和模拟器连接无关, 需要把 relative_crop.py 里面的文件路径修改为自己的
# Folder to save temp images
folder = './screenshots/temp/'
# Put Screenshot here
file = './screenshots/TEMPLATE_AMBUSH_EVADE_FAILED.png'
  1. 把这个粘贴到活动图每一章的第一关的地图文件里面的 Config 类, 在试试看
    INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
        'height': (150, 255 - 12),
        'width': (0.9, 10),
        'prominence': 10,
        'distance': 35,
    }
    EDGE_LINES_FIND_PEAKS_PARAMETERS = {
        'height': (255 - 12, 255),
        'prominence': 10,
        'distance': 50,
        'width': (0, 7),
        'wlen': 1000
    }

LmeSzinc avatar Oct 30 '20 12:10 LmeSzinc

  1. 和模拟器连接无关, 需要把 relative_crop.py 里面的文件路径修改为自己的
# Folder to save temp images
folder = './screenshots/temp/'
# Put Screenshot here
file = './screenshots/TEMPLATE_AMBUSH_EVADE_FAILED.png'

我根據你的建議,自己弄了個資料夾存放並更改路徑,但仍然報同樣的錯。 file = './screenshots/TEMPLATE_AMBUSH_EVADE_FAILED.png' 這個應該是出錯才會生成的圖片吧?但程式卻一直說找不到此檔, 找不到還未生成的檔案不是應該的嗎?我被搞混了。

抱歉,再勞煩你費心了

Zorachristine avatar Oct 31 '20 03:10 Zorachristine

那里应该是空的, 需要手动填写, 之前不小心 commit 进去了.

LmeSzinc avatar Oct 31 '20 07:10 LmeSzinc

此次是有關委託的部分,委託設定是預設未更動, 應該是文字判讀的問題,bot完成委託後未繼續進行新委託,掃描完日常及緊急委託後回到主畫面,又繼續進入委託畫面, 成了死循環。 因為未報錯,所以沒有截圖,僅上傳程式執行log 2020-11-01_alas.txt 2020-10-31_alas.txt

另外此次除錯後,我想將這次修正的檔案直接打包上傳於此串, 勞煩開發人員們視情況決定是否更新。

Zorachristine avatar Nov 01 '20 05:11 Zorachristine

是因为现在用的 OCR 模型不包含繁体字. 如果你能提供游戏内的字体 ( 可以截图然后找在线网站识别 ) 以及常用的繁体中文的字体, 我可以训练模型, 不过需要比较长的时间. 也可以像日服一样使用 tesseract, 不过需要安装额外的软件.

提交一个 PR 比较好, 直接传文件不利于后期维护

LmeSzinc avatar Nov 01 '20 06:11 LmeSzinc

字體是思源黑體及思源宋體,其中委託部分使用是思源黑體(連結內含兩種字體): https://github.com/adobe-fonts/source-han-serif/archive/1.001R.zip 常用字體應該為微軟的新細明體、標楷體,或可使用全字庫的正宋體、正楷體: https://data.gov.tw/dataset/5961

要用何種方式更新繁體字,端看開發人員們選擇便可,委託部分的功能目前我並無迫切需求,謝謝你。

Zorachristine avatar Nov 01 '20 09:11 Zorachristine