Skip to content

Commit

Permalink
perf(tasks): save ocochi, can alone and leader
Browse files Browse the repository at this point in the history
  • Loading branch information
runhey committed Jul 4, 2023
1 parent ebf89c1 commit 6e0a6fc
Show file tree
Hide file tree
Showing 50 changed files with 512 additions and 73 deletions.
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.
41 changes: 23 additions & 18 deletions tasks/Component/GeneralBattle/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,41 +51,46 @@ class GeneralBattleAssets:

# Image Rule Assets
# 奖励,就是那个魂
I_REWARD = RuleImage(roi_front=(547,518,172,96), roi_back=(547,518,172,96), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_reward.png")
I_REWARD = RuleImage(roi_front=(547,518,172,96), roi_back=(547,518,172,96), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_reward.png")
# 预设的小图标
I_PRESET = RuleImage(roi_front=(32,650,47,45), roi_back=(32,650,47,45), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_preset.png")
I_PRESET = RuleImage(roi_front=(32,650,47,45), roi_back=(32,650,47,45), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_preset.png")
# 准备
I_PREPARE_HIGHLIGHT = RuleImage(roi_front=(1128,536,100,100), roi_back=(1128,536,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_prepare_highlight.png")
I_PREPARE_HIGHLIGHT = RuleImage(roi_front=(1128,536,100,100), roi_back=(1128,536,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_prepare_highlight.png")
# 战斗胜利
I_WIN = RuleImage(roi_front=(427,135,100,100), roi_back=(427,135,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_win.png")
I_WIN = RuleImage(roi_front=(425,141,100,100), roi_back=(296,41,414,216), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_win.png")
# 准备但是界面还未加载这个时候是黑色的
I_PREPARE_DARK = RuleImage(roi_front=(1131,538,100,100), roi_back=(1131,538,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_prepare_dark.png")
I_PREPARE_DARK = RuleImage(roi_front=(1131,538,100,100), roi_back=(1131,538,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_prepare_dark.png")
# 失败
I_FALSE = RuleImage(roi_front=(413,124,100,100), roi_back=(413,124,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_false.png")
I_FALSE = RuleImage(roi_front=(413,124,100,100), roi_back=(413,124,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_false.png")
# 确认预设的队伍
I_PRESET_ENSURE = RuleImage(roi_front=(354,641,141,50), roi_back=(354,641,141,50), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_preset_ensure.png")
I_PRESET_ENSURE = RuleImage(roi_front=(354,641,141,50), roi_back=(354,641,141,50), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_preset_ensure.png")
# 选择buff
I_BUFF = RuleImage(roi_front=(113,653,44,62), roi_back=(113,653,44,62), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff.png")
I_BUFF = RuleImage(roi_front=(113,653,44,62), roi_back=(113,653,44,62), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_buff.png")
# 觉醒加成
I_BUFF_AWAKEN = RuleImage(roi_front=(373,126,383,53), roi_back=(373,126,383,53), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff_awaken.png")
I_BUFF_AWAKEN = RuleImage(roi_front=(373,126,383,53), roi_back=(373,126,383,53), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_buff_awaken.png")
# 御魂加成
I_BUFF_SOUL = RuleImage(roi_front=(377,192,371,56), roi_back=(377,192,371,56), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff_soul.png")
I_BUFF_SOUL = RuleImage(roi_front=(377,192,371,56), roi_back=(377,192,371,56), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_buff_soul.png")
# 金币加成50
I_BUFF_GOLD_50 = RuleImage(roi_front=(375,259,373,56), roi_back=(375,259,373,56), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff_gold_50.png")
I_BUFF_GOLD_50 = RuleImage(roi_front=(375,259,373,56), roi_back=(375,259,373,56), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_buff_gold_50.png")
# 金币加成100
I_BUFF_GOLD_100 = RuleImage(roi_front=(371,329,389,54), roi_back=(371,329,389,54), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff_gold_100.png")
I_BUFF_GOLD_100 = RuleImage(roi_front=(371,329,389,54), roi_back=(371,329,389,54), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_buff_gold_100.png")
# 经验加成50
I_BUFF_EXP_50 = RuleImage(roi_front=(378,400,370,50), roi_back=(378,400,370,50), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff_exp_50.png")
I_BUFF_EXP_50 = RuleImage(roi_front=(378,400,370,50), roi_back=(378,400,370,50), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_buff_exp_50.png")
# 经验加成100
I_BUFF_EXP_100 = RuleImage(roi_front=(372,463,386,50), roi_back=(372,463,386,50), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff_exp_100.png")
I_BUFF_EXP_100 = RuleImage(roi_front=(372,463,386,50), roi_back=(372,463,386,50), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_buff_exp_100.png")
# 左下角的位置指针
I_LOCAL = RuleImage(roi_front=(25,563,30,34), roi_back=(25,563,30,34), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_local.png")
I_LOCAL = RuleImage(roi_front=(25,563,30,34), roi_back=(25,563,30,34), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_local.png")
# description
I_STATISTICS = RuleImage(roi_front=(61,644,33,28), roi_back=(61,644,33,28), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_statistics.png")
I_STATISTICS = RuleImage(roi_front=(61,644,33,28), roi_back=(61,644,33,28), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_statistics.png")
# 左上角的退出
I_EXIT = RuleImage(roi_front=(14,12,43,41), roi_back=(14,12,43,41), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_exit.png")
I_EXIT = RuleImage(roi_front=(14,12,43,41), roi_back=(14,12,43,41), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_exit.png")
# 退出确认
I_EXIT_ENSURE = RuleImage(roi_front=(674,388,135,63), roi_back=(674,388,135,63), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_exit_ensure.png")
I_EXIT_ENSURE = RuleImage(roi_front=(674,388,135,63), roi_back=(674,388,135,63), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_exit_ensure.png")


# Image Rule Assets
# description
I_GREED_GHOST = RuleImage(roi_front=(49,29,56,65), roi_back=(49,29,56,65), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_greed_ghost.png")


# Swipe Rule Assets
Expand Down
File renamed without changes.
Binary file added tasks/Component/GeneralBattle/gb/gb_buff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tasks/Component/GeneralBattle/gb/gb_exit.png
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.
Binary file added tasks/Component/GeneralBattle/gb/gb_false.png
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.
Binary file added tasks/Component/GeneralBattle/gb/gb_local.png
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.
Binary file added tasks/Component/GeneralBattle/gb/gb_preset.png
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.
Binary file added tasks/Component/GeneralBattle/gb/gb_reward.png
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.
Binary file added tasks/Component/GeneralBattle/gb/gb_win.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"itemName": "reward",
"imageName": "res_reward.png",
"imageName": "gb_reward.png",
"roiFront": "547,518,172,96",
"roiBack": "547,518,172,96",
"method": "Template matching",
Expand All @@ -10,7 +10,7 @@
},
{
"itemName": "preset",
"imageName": "res_preset.png",
"imageName": "gb_preset.png",
"roiFront": "32,650,47,45",
"roiBack": "32,650,47,45",
"method": "Template matching",
Expand All @@ -19,7 +19,7 @@
},
{
"itemName": "prepare_highlight",
"imageName": "res_prepare_highlight.png",
"imageName": "gb_prepare_highlight.png",
"roiFront": "1128,536,100,100",
"roiBack": "1128,536,100,100",
"method": "Template matching",
Expand All @@ -28,16 +28,16 @@
},
{
"itemName": "win",
"imageName": "res_win.png",
"roiFront": "427,135,100,100",
"roiBack": "427,135,100,100",
"imageName": "gb_win.png",
"roiFront": "425,141,100,100",
"roiBack": "296,41,414,216",
"method": "Template matching",
"threshold": 0.8,
"description": "战斗胜利"
},
{
"itemName": "prepare_dark",
"imageName": "res_prepare_dark.png",
"imageName": "gb_prepare_dark.png",
"roiFront": "1131,538,100,100",
"roiBack": "1131,538,100,100",
"method": "Template matching",
Expand All @@ -46,7 +46,7 @@
},
{
"itemName": "false",
"imageName": "res_false.png",
"imageName": "gb_false.png",
"roiFront": "413,124,100,100",
"roiBack": "413,124,100,100",
"method": "Template matching",
Expand All @@ -55,7 +55,7 @@
},
{
"itemName": "preset_ensure",
"imageName": "res_preset_ensure.png",
"imageName": "gb_preset_ensure.png",
"roiFront": "354,641,141,50",
"roiBack": "354,641,141,50",
"method": "Template matching",
Expand All @@ -64,7 +64,7 @@
},
{
"itemName": "buff",
"imageName": "res_buff.png",
"imageName": "gb_buff.png",
"roiFront": "113,653,44,62",
"roiBack": "113,653,44,62",
"method": "Template matching",
Expand All @@ -73,7 +73,7 @@
},
{
"itemName": "buff_awaken",
"imageName": "res_buff_awaken.png",
"imageName": "gb_buff_awaken.png",
"roiFront": "373,126,383,53",
"roiBack": "373,126,383,53",
"method": "Template matching",
Expand All @@ -82,7 +82,7 @@
},
{
"itemName": "buff_soul",
"imageName": "res_buff_soul.png",
"imageName": "gb_buff_soul.png",
"roiFront": "377,192,371,56",
"roiBack": "377,192,371,56",
"method": "Template matching",
Expand All @@ -91,7 +91,7 @@
},
{
"itemName": "buff_gold_50",
"imageName": "res_buff_gold_50.png",
"imageName": "gb_buff_gold_50.png",
"roiFront": "375,259,373,56",
"roiBack": "375,259,373,56",
"method": "Template matching",
Expand All @@ -100,7 +100,7 @@
},
{
"itemName": "buff_gold_100",
"imageName": "res_buff_gold_100.png",
"imageName": "gb_buff_gold_100.png",
"roiFront": "371,329,389,54",
"roiBack": "371,329,389,54",
"method": "Template matching",
Expand All @@ -109,7 +109,7 @@
},
{
"itemName": "buff_exp_50",
"imageName": "res_buff_exp_50.png",
"imageName": "gb_buff_exp_50.png",
"roiFront": "378,400,370,50",
"roiBack": "378,400,370,50",
"method": "Template matching",
Expand All @@ -118,7 +118,7 @@
},
{
"itemName": "buff_exp_100",
"imageName": "res_buff_exp_100.png",
"imageName": "gb_buff_exp_100.png",
"roiFront": "372,463,386,50",
"roiBack": "372,463,386,50",
"method": "Template matching",
Expand All @@ -127,7 +127,7 @@
},
{
"itemName": "local",
"imageName": "res_local.png",
"imageName": "gb_local.png",
"roiFront": "25,563,30,34",
"roiBack": "25,563,30,34",
"method": "Template matching",
Expand All @@ -136,7 +136,7 @@
},
{
"itemName": "statistics",
"imageName": "res_statistics.png",
"imageName": "gb_statistics.png",
"roiFront": "61,644,33,28",
"roiBack": "61,644,33,28",
"method": "Template matching",
Expand All @@ -145,7 +145,7 @@
},
{
"itemName": "exit",
"imageName": "res_exit.png",
"imageName": "gb_exit.png",
"roiFront": "14,12,43,41",
"roiBack": "14,12,43,41",
"method": "Template matching",
Expand All @@ -154,7 +154,7 @@
},
{
"itemName": "exit_ensure",
"imageName": "res_exit_ensure.png",
"imageName": "gb_exit_ensure.png",
"roiFront": "674,388,135,63",
"roiBack": "674,388,135,63",
"method": "Template matching",
Expand Down
11 changes: 11 additions & 0 deletions tasks/Component/GeneralBattle/gb/img_supplement.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"itemName": "greed_ghost",
"imageName": "gb_greed_ghost.png",
"roiFront": "49,29,56,65",
"roiBack": "49,29,56,65",
"method": "Template matching",
"threshold": 0.8,
"description": "description"
}
]
Binary file added tasks/Component/GeneralBattle/gb/res_win.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
24 changes: 18 additions & 6 deletions tasks/Component/GeneralBattle/general_battle.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,24 @@ def run_general_battle(self, config: dict=None) -> bool:
logger.info("Green is enable")
x, y = None, None
match config.green_mark:
case GreenMarkType.GREEN_LEFT1: x, y = self.C_GREEN_LEFT_1.coord()
case GreenMarkType.GREEN_LEFT2: x, y = self.C_GREEN_LEFT_2.coord()
case GreenMarkType.GREEN_LEFT3: x, y = self.C_GREEN_LEFT_3.coord()
case GreenMarkType.GREEN_LEFT4: x, y = self.C_GREEN_LEFT_4.coord()
case GreenMarkType.GREEN_LEFT5: x, y = self.C_GREEN_LEFT_5.coord()
case GreenMarkType.GREEN_MAIN: x, y = self.C_GREEN_MAIN.coord()
case GreenMarkType.GREEN_LEFT1:
x, y = self.C_GREEN_LEFT_1.coord()
logger.info("Green left 1")
case GreenMarkType.GREEN_LEFT2:
x, y = self.C_GREEN_LEFT_2.coord()
logger.info("Green left 2")
case GreenMarkType.GREEN_LEFT3:
x, y = self.C_GREEN_LEFT_3.coord()
logger.info("Green left 3")
case GreenMarkType.GREEN_LEFT4:
x, y = self.C_GREEN_LEFT_4.coord()
logger.info("Green left 4")
case GreenMarkType.GREEN_LEFT5:
x, y = self.C_GREEN_LEFT_5.coord()
logger.info("Green left 5")
case GreenMarkType.GREEN_MAIN:
x, y = self.C_GREEN_MAIN.coord()
logger.info("Green main")

# 判断有无坐标的偏移
self.appear_then_click(self.I_LOCAL)
Expand Down
13 changes: 10 additions & 3 deletions tasks/Component/GeneralInvite/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,18 @@ class GeneralInviteAssets:
# 勾选 默认邀请
I_I_DEFAULT = RuleImage(roi_front=(541,342,41,39), roi_back=(541,342,41,39), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_i_default.png")
# description
I_CANCEL = RuleImage(roi_front=(435,404,171,65), roi_back=(435,404,171,65), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_cancel.png")
I_GI_CANCEL = RuleImage(roi_front=(438,407,171,55), roi_back=(438,407,171,55), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_cancel.png")
# 队长邀请 确定
I_SURE = RuleImage(roi_front=(668,401,175,60), roi_back=(668,401,175,60), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_sure.png")
I_GI_SURE = RuleImage(roi_front=(670,402,175,60), roi_back=(670,402,175,60), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_sure.png")
# 所有的组队界面都有加成
I_BUFF = RuleImage(roi_front=(794,38,46,42), roi_back=(794,38,46,42), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_buff.png")
I_GI_BUFF = RuleImage(roi_front=(794,38,46,42), roi_back=(794,38,46,42), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_buff.png")


# Image Rule Assets
# description
I_GI_EMOJI_1 = RuleImage(roi_front=(25,538,50,56), roi_back=(25,538,50,56), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_emoji_1.png")
# description
I_GI_EMOJI_2 = RuleImage(roi_front=(21,632,53,64), roi_back=(21,632,53,64), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_emoji_2.png")


# Ocr Rule Assets
Expand Down
Loading

0 comments on commit 6e0a6fc

Please sign in to comment.