Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion module/atom/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ def coord(self) -> tuple:
else:
area = self.roi

x, y, w, h = self.area
# 原代码:x, y, w, h = self.area
# 修改原因:20260725 , 每月活动,点击挑战的时候,经常点到切换门票模式和体力模式
# OCR识别到并点击,在SINGLE模式下,识别到挑战,点击区域应该为ROI,而不是AREA
# 该地方应该是误写为self.area,本地变量area没有起作用,如果是self.area,上面几句话就白写了,没起作用
x, y, w, h = area
x = np.random.randint(x, x + w)
y = np.random.randint(y, y + h)
return x, y
Expand Down
9 changes: 6 additions & 3 deletions tasks/ActivityShikigami/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ class ActivityShikigamiAssets:
# Ocr Rule Assets
# 挑战
O_FIRE = RuleOcr(roi=(1124,599,96,50), area=(1123,570,106,100), mode="Single", method="Default", keyword="挑战", name="fire")
# 20260725 缩小体力和活动体力的检测范围,范围太大,有可能把0识别为10的情况。
# 潜在风险1,超过1000的数字可能会只识别到最后的000,还有识别0的时候,score比较低,只有0.3,不知道怎么优化。
# 潜在风险2,部分数字,遇到过300等,会识别为0,之前没截上图,待后面遇到再处理这种情况。
# 体力的数量检测
O_REMAIN_AP = RuleOcr(roi=(777,17,63,30), area=(776,16,63,30), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
# 活动体力的剩余检测
O_REMAIN_PASS = RuleOcr(roi=(599,15,50,29), area=(600,16,49,28), mode="DigitCounter", method="Default", keyword="", name="remain_pass")
O_REMAIN_AP = RuleOcr(roi=(793, 18, 44, 25), area=(793, 18, 44, 25), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
# 活动体力的剩余检测
O_REMAIN_PASS = RuleOcr(roi=(600, 18, 44, 25), area=(600, 18, 44, 25), mode="DigitCounter", method="Default", keyword="", name="remain_pass")
# 还有多少次购买体力的机会
O_REMAIN_BUY = RuleOcr(roi=(808,531,39,42), area=(808,531,39,42), mode="DigitCounter", method="Default", keyword="", name="remain_buy")
# 活动票数(没有百分比)
Expand Down
12 changes: 7 additions & 5 deletions tasks/Component/SwitchAccount/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ class SwitchAccountAssets:
# 选择服务器界面 底部角色所属服务器名 列表
O_SA_SELECT_SVR_SVR_LIST = RuleOcr(roi=(205,540,815,25), area=(205,540,815,25), mode="FULL", method="Default", keyword="", name="sa_select_svr_svr_list")
# 选择服务器界面 底部角色名 列表
O_SA_SELECT_SVR_CHARACTER_LIST = RuleOcr(roi=(205,570,815,40), area=(205,570,815,40), mode="FULL", method="Default", keyword="", name="sa_select_svr_character_list")
O_SA_SELECT_SVR_CHARACTER_LIST = RuleOcr(roi=(418,131,641,481), area=(417,135,647,482), mode="Full", method="Default", keyword="", name="sa_select_svr_character_list")
# 选择账号界面 账号列表
O_SA_ACCOUNT_ACCOUNT_LIST = RuleOcr(roi=(460,280,440,330), area=(460,280,440,330), mode="FULL", method="Default", keyword="", name="sa_account_account_list")
# 选择账号界面 已选择的账号
O_SA_ACCOUNT_ACCOUNT_SELECTED = RuleOcr(roi=(460,280,370,50), area=(460,280,370,50), mode="SINGLE", method="Default", keyword="", name="sa_account_account_selected")
# 登录界面 用户中心(区别于游戏内用户中心) 账户名
O_SA_LOGIN_FORM_USER_CENTER_ACCOUNT = RuleOcr(roi=(290,185,290,50), area=(290,185,290,50), mode="SINGLE", method="Default", keyword="", name="sa_login_form_user_center_account")
# 判断是否在 选择服务器 界面的文本特质
O_SA_CHECK_SELECT_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_select_svr")


# Swipe Rule Assets
Expand Down Expand Up @@ -77,12 +79,12 @@ class SwitchAccountAssets:
# 登录界面-选取账号界面-账号下拉菜单-已经打开标志.
I_SA_ACCOUNT_LOGIN_BTN = RuleImage(roi_front=(400,400,480,90), roi_back=(400,400,480,90), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/sa_account_login_btn.png")
# 登录界面-选择手机类型为苹果.
I_SA_LOGIN_FORM_APPLE = RuleImage(roi_front=(490,350,100,100), roi_back=(490,350,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/sa_login_form_apple.png")
I_SA_LOGIN_FORM_APPLE = RuleImage(roi_front=(508,354,100,100), roi_back=(508,355,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/res_sa_login_form_apple.png")
# 登录界面-选择手机类型为android
I_SA_LOGIN_FORM_ANDROID = RuleImage(roi_front=(690,350,100,100), roi_back=(690,350,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/sa_login_form_android.png")
I_SA_LOGIN_FORM_ANDROID = RuleImage(roi_front=(671,353,100,100), roi_back=(670,352,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/res_sa_login_form_android.png")
# 判断是否在 选择服务器 界面的标志物 角色的服务器图标还未显示时
I_SA_CHECK_SELECT_SVR_1 = RuleImage(roi_front=(240,530,120,40), roi_back=(240,530,120,40), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/sa_check_select_svr.png")
I_SA_CHECK_SELECT_SVR_1 = RuleImage(roi_front=(213,133,181,60), roi_back=(210,128,185,68), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/res_sa_check_select_svr_1.png")
# 判断是否在 选择服务器 界面的标志物 角色的服务器图标已经显示时
I_SA_CHECK_SELECT_SVR_2 = RuleImage(roi_front=(240,410,120,40), roi_back=(240,410,120,40), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/sa_check_select_svr.png")
I_SA_CHECK_SELECT_SVR_2 = RuleImage(roi_front=(209,131,184,64), roi_back=(207,127,187,70), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/res_sa_check_select_svr_2.png")


5 changes: 3 additions & 2 deletions tasks/Component/SwitchAccount/login_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def switch_character(self, characterName: str):
@rtype:
"""
logger.info("start switch_character")
self.ui_click(self.C_SA_LOGIN_FORM_SWITCH_SVR_BTN, self.I_SA_CHECK_SELECT_SVR_1)
# 改成对比是否出现 已有角色
self.ui_click(self.C_SA_LOGIN_FORM_SWITCH_SVR_BTN, self.O_SA_CHECK_SELCET_SVR)
# 展开底部角色列表,显示角色所属服务器
self.screenshot()
while (not self.appear(self.I_SA_CHECK_SELECT_SVR_2)) and self.appear(self.I_SA_CHECK_SELECT_SVR_1):
Expand Down Expand Up @@ -134,7 +135,7 @@ def switch_character(self, characterName: str):
break
logger.info(f'{characterName} not found,start swipe')
lastCharacterNameList = characterNameList
self.swipe(self.S_SA_SVR_SWIPE_LEFT)
self.swipe(self.S_SA_ACCOUNT_LIST_UP)
# 等待滑动动画完成
time.sleep(1.5)

Expand Down
15 changes: 12 additions & 3 deletions tasks/Component/SwitchAccount/ocr.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
},
{
"itemName": "sa_select_svr_character_list",
"roiFront": "205,570,815,40",
"roiBack": "205,570,815,40",
"mode": "FULL",
"roiFront": "418,131,641,481",
"roiBack": "417,135,647,482",
"mode": "Full",
"method": "Default",
"keyword": "",
"description": "选择服务器界面 底部角色名 列表"
Expand Down Expand Up @@ -52,5 +52,14 @@
"method": "Default",
"keyword": "",
"description": "登录界面 用户中心(区别于游戏内用户中心) 账户名"
},
{
"itemName": "sa_check_select_svr",
"roiFront": "252,145,97,32",
"roiBack": "248,141,102,38",
"mode": "Single",
"method": "Default",
"keyword": "已有角色",
"description": "判断是否在 选择服务器 界面的文本特质"
}
]
26 changes: 13 additions & 13 deletions tasks/Component/SwitchAccount/res/image.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"itemName": "sa_user_center_profile",
"imageName": "sa_user_center_profile.png",
"roiFront": "590,60,90,55",
"roiBack": "590,60,90,55",
"roiBack": "590,60,90,55",
"method": "Template matching",
"threshold": 0.8,
"description": "游戏内-点击头像弹出的设置界面-顶部设置字样"
Expand Down Expand Up @@ -82,36 +82,36 @@
},
{
"itemName": "sa_login_form_apple",
"imageName": "sa_login_form_apple.png",
"roiFront": "490,350,100,100",
"roiBack": "490,350,100,100",
"imageName": "res_sa_login_form_apple.png",
"roiFront": "508,354,100,100",
"roiBack": "508,355,100,100",
"method": "Template matching",
"threshold": 0.8,
"description": "登录界面-选择手机类型为苹果."
},
{
"itemName": "sa_login_form_android",
"imageName": "sa_login_form_android.png",
"roiFront": "690,350,100,100",
"roiBack": "690,350,100,100",
"imageName": "res_sa_login_form_android.png",
"roiFront": "671,353,100,100",
"roiBack": "670,352,100,100",
"method": "Template matching",
"threshold": 0.8,
"description": "登录界面-选择手机类型为android"
},
{
"itemName": "sa_check_select_svr_1",
"imageName": "sa_check_select_svr.png",
"roiFront": "240,530,120,40",
"roiBack": "240,530,120,40",
"imageName": "res_sa_check_select_svr_1.png",
"roiFront": "213,133,181,60",
"roiBack": "210,128,185,68",
"method": "Template matching",
"threshold": 0.8,
"description": "判断是否在 选择服务器 界面的标志物 角色的服务器图标还未显示时"
},
{
"itemName": "sa_check_select_svr_2",
"imageName": "sa_check_select_svr.png",
"roiFront": "240,410,120,40",
"roiBack": "240,410,120,40",
"imageName": "res_sa_check_select_svr_2.png",
"roiFront": "209,131,184,64",
"roiBack": "207,127,187,70",
"method": "Template matching",
"threshold": 0.8,
"description": "判断是否在 选择服务器 界面的标志物 角色的服务器图标已经显示时"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.