diff --git a/tasks/Component/GeneralBattle/GeneralBattle_greed_ghost.png b/tasks/Component/GeneralBattle/GeneralBattle_greed_ghost.png new file mode 100644 index 00000000..e484d134 Binary files /dev/null and b/tasks/Component/GeneralBattle/GeneralBattle_greed_ghost.png differ diff --git a/tasks/Component/GeneralBattle/GeneralBattle_win.png b/tasks/Component/GeneralBattle/GeneralBattle_win.png new file mode 100644 index 00000000..063ca601 Binary files /dev/null and b/tasks/Component/GeneralBattle/GeneralBattle_win.png differ diff --git a/tasks/Component/GeneralBattle/assets.py b/tasks/Component/GeneralBattle/assets.py index 6ba7386c..a09a464f 100644 --- a/tasks/Component/GeneralBattle/assets.py +++ b/tasks/Component/GeneralBattle/assets.py @@ -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 diff --git a/tasks/Component/GeneralBattle/click.json b/tasks/Component/GeneralBattle/gb/click.json similarity index 100% rename from tasks/Component/GeneralBattle/click.json rename to tasks/Component/GeneralBattle/gb/click.json diff --git a/tasks/Component/GeneralBattle/gb/gb_buff.png b/tasks/Component/GeneralBattle/gb/gb_buff.png new file mode 100644 index 00000000..fa9e7985 Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_buff.png differ diff --git a/tasks/Component/GeneralBattle/gb/gb_exit.png b/tasks/Component/GeneralBattle/gb/gb_exit.png new file mode 100644 index 00000000..d431d615 Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_exit.png differ diff --git a/tasks/Component/GeneralBattle/gb/gb_exit_ensure.png b/tasks/Component/GeneralBattle/gb/gb_exit_ensure.png new file mode 100644 index 00000000..baac7f92 Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_exit_ensure.png differ diff --git a/tasks/Component/GeneralBattle/gb/gb_false.png b/tasks/Component/GeneralBattle/gb/gb_false.png new file mode 100644 index 00000000..b50b68a7 Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_false.png differ diff --git a/tasks/Component/GeneralBattle/gb/gb_greed_ghost.png b/tasks/Component/GeneralBattle/gb/gb_greed_ghost.png new file mode 100644 index 00000000..e484d134 Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_greed_ghost.png differ diff --git a/tasks/Component/GeneralBattle/gb/gb_local.png b/tasks/Component/GeneralBattle/gb/gb_local.png new file mode 100644 index 00000000..141355e4 Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_local.png differ diff --git a/tasks/Component/GeneralBattle/gb/gb_prepare_dark.png b/tasks/Component/GeneralBattle/gb/gb_prepare_dark.png new file mode 100644 index 00000000..23fc7664 Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_prepare_dark.png differ diff --git a/tasks/Component/GeneralBattle/gb/gb_prepare_highlight.png b/tasks/Component/GeneralBattle/gb/gb_prepare_highlight.png new file mode 100644 index 00000000..af094dc7 Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_prepare_highlight.png differ diff --git a/tasks/Component/GeneralBattle/gb/gb_preset.png b/tasks/Component/GeneralBattle/gb/gb_preset.png new file mode 100644 index 00000000..594bed4a Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_preset.png differ diff --git a/tasks/Component/GeneralBattle/gb/gb_preset_ensure.png b/tasks/Component/GeneralBattle/gb/gb_preset_ensure.png new file mode 100644 index 00000000..6d09bc5d Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_preset_ensure.png differ diff --git a/tasks/Component/GeneralBattle/gb/gb_reward.png b/tasks/Component/GeneralBattle/gb/gb_reward.png new file mode 100644 index 00000000..06236fcd Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_reward.png differ diff --git a/tasks/Component/GeneralBattle/gb/gb_statistics.png b/tasks/Component/GeneralBattle/gb/gb_statistics.png new file mode 100644 index 00000000..e5ab3380 Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_statistics.png differ diff --git a/tasks/Component/GeneralBattle/gb/gb_win.png b/tasks/Component/GeneralBattle/gb/gb_win.png new file mode 100644 index 00000000..063ca601 Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/gb_win.png differ diff --git a/tasks/Component/GeneralBattle/image.json b/tasks/Component/GeneralBattle/gb/image.json similarity index 82% rename from tasks/Component/GeneralBattle/image.json rename to tasks/Component/GeneralBattle/gb/image.json index 1ddcf535..352f080d 100644 --- a/tasks/Component/GeneralBattle/image.json +++ b/tasks/Component/GeneralBattle/gb/image.json @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", diff --git a/tasks/Component/GeneralBattle/gb/img_supplement.json b/tasks/Component/GeneralBattle/gb/img_supplement.json new file mode 100644 index 00000000..277992bf --- /dev/null +++ b/tasks/Component/GeneralBattle/gb/img_supplement.json @@ -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" + } +] \ No newline at end of file diff --git a/tasks/Component/GeneralBattle/gb/res_win.png b/tasks/Component/GeneralBattle/gb/res_win.png new file mode 100644 index 00000000..360d0bae Binary files /dev/null and b/tasks/Component/GeneralBattle/gb/res_win.png differ diff --git a/tasks/Component/GeneralBattle/swipe.json b/tasks/Component/GeneralBattle/gb/swipe.json similarity index 100% rename from tasks/Component/GeneralBattle/swipe.json rename to tasks/Component/GeneralBattle/gb/swipe.json diff --git a/tasks/Component/GeneralBattle/general_battle.py b/tasks/Component/GeneralBattle/general_battle.py index ff41905e..e13e123e 100644 --- a/tasks/Component/GeneralBattle/general_battle.py +++ b/tasks/Component/GeneralBattle/general_battle.py @@ -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) diff --git a/tasks/Component/GeneralInvite/assets.py b/tasks/Component/GeneralInvite/assets.py index c2d44c19..d5c96f95 100644 --- a/tasks/Component/GeneralInvite/assets.py +++ b/tasks/Component/GeneralInvite/assets.py @@ -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 diff --git a/tasks/Component/GeneralInvite/general_invite.py b/tasks/Component/GeneralInvite/general_invite.py index 4fd0b89b..80ec4dd1 100644 --- a/tasks/Component/GeneralInvite/general_invite.py +++ b/tasks/Component/GeneralInvite/general_invite.py @@ -36,6 +36,7 @@ class RoomType(str, Enum): class GeneralInvite(BaseTask, GeneralInviteAssets): timer_invite = None timer_wait = None + timer_emoji = None # 等待期间如果没有操作的话,可能会导致长时间无响应报错 """ 这个类就三个api @@ -47,6 +48,8 @@ class GeneralInvite(BaseTask, GeneralInviteAssets): def run_invite(self, config: InviteConfig, is_first: bool = False) -> bool: """ 队长!!身份。。。在组件界面邀请好友( 如果开启is_first) 等待队员进入开启挑战 + 请注意,返回的时候成功时是进入战斗了!!! + 如果是失败,那就是没有队友进入,然后会退出房间的界面 :param config: :param is_first: 如果是第一次开房间的那就要邀请队员,其他情况等待队员进入 :return: @@ -61,6 +64,10 @@ def run_invite(self, config: InviteConfig, is_first: bool = False) -> bool: self.timer_invite.start() self.ensure_room_type(config.invite_number) self.invite_friends(config) + else: + self.timer_invite = None + self.timer_emoji = Timer(20) + self.timer_emoji.start() wait_second = config.wait_time.second + config.wait_time.minute * 60 self.timer_wait = Timer(wait_second) self.timer_wait.start() @@ -78,6 +85,11 @@ def run_invite(self, config: InviteConfig, is_first: bool = False) -> bool: logger.warning('Timeout, now is no room') return False + if self.timer_emoji and self.timer_emoji.reached(): + self.timer_emoji.reset() + self.appear_then_click(self.I_GI_EMOJI_1) + self.appear_then_click(self.I_GI_EMOJI_2) + # 如果这个房间最多只容纳两个人(意思是只可以邀请一个人),且已经邀请一个人了,那就开启挑战 if self.room_type == RoomType.NORMAL_2 and not self.appear(self.I_ADD_2): @@ -162,6 +174,40 @@ def ensure_enter(self) -> bool: if self.appear(self.I_MATCHING): return False + # 判断是否在房间里面 + def is_in_room(self) -> bool: + """ + 判断是否在房间里面 + :return: + """ + self.screenshot() + if self.appear(self.I_GI_EMOJI_1): + return True + if self.appear(self.I_GI_EMOJI_2): + return True + if self.appear(self.I_MATCHING): + return False + return False + + def exit_room(self) -> bool: + """ + 退出房间 + :return: + """ + if not self.is_in_room(): + return False + logger.info('Exit room') + while 1: + self.screenshot() + if not self.is_in_room(): + break + if self.appear_then_click(self.I_GI_SURE, interval=0.5): + continue + if self.appear_then_click(self.I_BACK_YELLOW, interval=0.5): + continue + return True + + @cached_property def room_type(self) -> RoomType: """ @@ -448,7 +494,7 @@ def invite_again(self, default_invite: bool=True) -> bool: # 判断是否进入界面 while 1: self.screenshot() - if self.appear(self.I_SURE): + if self.appear(self.I_GI_SURE): break # 如果勾选了默认邀请 if default_invite: @@ -472,11 +518,43 @@ def invite_again(self, default_invite: bool=True) -> bool: logger.info('Click invite ensure') while 1: self.screenshot() - if not self.appear(self.I_SURE): + if not self.appear(self.I_GI_SURE): break - if self.appear_then_click(self.I_SURE): + if self.appear_then_click(self.I_GI_SURE): continue + def check_and_invite(self, default_invite: bool=True) -> bool: + """ + 队长战斗后 邀请队友 + :param default_invite: + :return: + """ + if not self.appear(self.I_GI_SURE): + return False + + if default_invite: + # 有可能是挑战失败的 + if self.appear(self.I_I_DEFAULT) or self.appear(self.I_I_NO_DEFAULT): + logger.info('Click default invite') + while 1: + self.screenshot() + if self.appear(self.I_I_DEFAULT): + break + if self.appear_then_click(self.I_I_NO_DEFAULT, interval=1): + continue + # 点击确认 + while 1: + self.screenshot() + if not self.appear(self.I_GI_SURE): + break + if self.appear_then_click(self.I_GI_SURE, interval=1): + continue + + return True + + + + def accept_invite(self) -> bool: """ 队员接受邀请, 保持在庭院界面 @@ -484,7 +562,7 @@ def accept_invite(self) -> bool: """ while 1: self.screenshot() - if self.appear(self.I_BUFF): + if self.appear(self.I_GI_BUFF): break if self.appear_then_click(self.I_I_ACCEPT_DEFAULT, interval=1): continue @@ -499,5 +577,8 @@ def accept_invite(self) -> bool: c = Config('oas1') d = Device(c) t = GeneralInvite(c, d) - # t.invite_friend('城凉文月', FindMode.RECENT_FRIEND) - t.run_invite(c.orochi.invite_config, is_first=True) + + # t.run_invite(c.orochi.invite_config, is_first=True) + t.screenshot() + print(t.check_and_invite(True)) + diff --git a/tasks/Component/GeneralInvite/gi/gi_cancel.png b/tasks/Component/GeneralInvite/gi/gi_cancel.png index 9db4b791..c49e3726 100644 Binary files a/tasks/Component/GeneralInvite/gi/gi_cancel.png and b/tasks/Component/GeneralInvite/gi/gi_cancel.png differ diff --git a/tasks/Component/GeneralInvite/gi/gi_gi_emoji_1.png b/tasks/Component/GeneralInvite/gi/gi_gi_emoji_1.png new file mode 100644 index 00000000..3cb885cb Binary files /dev/null and b/tasks/Component/GeneralInvite/gi/gi_gi_emoji_1.png differ diff --git a/tasks/Component/GeneralInvite/gi/gi_gi_emoji_2.png b/tasks/Component/GeneralInvite/gi/gi_gi_emoji_2.png new file mode 100644 index 00000000..7ea647c2 Binary files /dev/null and b/tasks/Component/GeneralInvite/gi/gi_gi_emoji_2.png differ diff --git a/tasks/Component/GeneralInvite/gi/gi_gi_sure.png b/tasks/Component/GeneralInvite/gi/gi_gi_sure.png new file mode 100644 index 00000000..a7a04e7f Binary files /dev/null and b/tasks/Component/GeneralInvite/gi/gi_gi_sure.png differ diff --git a/tasks/Component/GeneralInvite/gi/gi_sure.png b/tasks/Component/GeneralInvite/gi/gi_sure.png index 72377ab2..a82cab08 100644 Binary files a/tasks/Component/GeneralInvite/gi/gi_sure.png and b/tasks/Component/GeneralInvite/gi/gi_sure.png differ diff --git a/tasks/Component/GeneralInvite/gi/image.json b/tasks/Component/GeneralInvite/gi/image.json index 6d1d94f0..9b74c409 100644 --- a/tasks/Component/GeneralInvite/gi/image.json +++ b/tasks/Component/GeneralInvite/gi/image.json @@ -297,26 +297,26 @@ "description": "勾选 默认邀请" }, { - "itemName": "cancel", - "imageName": "gi_cancel.png", - "roiFront": "435,404,171,65", - "roiBack": "435,404,171,65", + "itemName": "gi_cancel", + "imageName": "gi_gi_cancel.png", + "roiFront": "438,407,171,55", + "roiBack": "438,407,171,55", "method": "Template matching", "threshold": 0.8, "description": "description" }, { - "itemName": "sure", - "imageName": "gi_sure.png", - "roiFront": "668,401,175,60", - "roiBack": "668,401,175,60", + "itemName": "gi_sure", + "imageName": "gi_gi_sure.png", + "roiFront": "670,402,175,60", + "roiBack": "670,402,175,60", "method": "Template matching", "threshold": 0.8, "description": "队长邀请 确定" }, { - "itemName": "buff", - "imageName": "gi_buff.png", + "itemName": "gi_buff", + "imageName": "gi_gi_buff.png", "roiFront": "794,38,46,42", "roiBack": "794,38,46,42", "method": "Template matching", diff --git a/tasks/Component/GeneralInvite/gi/member.json b/tasks/Component/GeneralInvite/gi/member.json new file mode 100644 index 00000000..1da165d1 --- /dev/null +++ b/tasks/Component/GeneralInvite/gi/member.json @@ -0,0 +1,20 @@ +[ + { + "itemName": "gi_emoji_1", + "imageName": "gi_gi_emoji_1.png", + "roiFront": "25,538,50,56", + "roiBack": "25,538,50,56", + "method": "Template matching", + "threshold": 0.8, + "description": "description" + }, + { + "itemName": "gi_emoji_2", + "imageName": "gi_gi_emoji_2.png", + "roiFront": "21,632,53,64", + "roiBack": "21,632,53,64", + "method": "Template matching", + "threshold": 0.8, + "description": "description" + } +] \ No newline at end of file diff --git a/tasks/Component/GeneralRoom/assets.py b/tasks/Component/GeneralRoom/assets.py index 91cb74ca..21d6b601 100644 --- a/tasks/Component/GeneralRoom/assets.py +++ b/tasks/Component/GeneralRoom/assets.py @@ -25,5 +25,9 @@ class GeneralRoomAssets: I_ENSURE_PRIVATE_FALSE_2 = RuleImage(roi_front=(400,408,36,38), roi_back=(400,408,36,38), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_ensure_private_false_2.png") # description I_CREATE_ENSURE_2 = RuleImage(roi_front=(552,489,42,55), roi_back=(552,489,42,55), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_create_ensure_2.png") + # description + I_GR_MATCHING_NEW = RuleImage(roi_front=(1204,102,42,121), roi_back=(1204,102,42,121), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png") + # description + I_GR_BACK_YELLOW = RuleImage(roi_front=(19,13,53,53), roi_back=(19,13,53,53), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_back_yellow.png") diff --git a/tasks/Component/GeneralRoom/general_room.py b/tasks/Component/GeneralRoom/general_room.py index 610316b9..56c6824e 100644 --- a/tasks/Component/GeneralRoom/general_room.py +++ b/tasks/Component/GeneralRoom/general_room.py @@ -74,3 +74,16 @@ def create_ensure(self) -> bool: if not self.appear(target): return True + def exit_team(self) -> bool: + """ + 在组队界面 退出组队的界面, 返回到庭院或者是你一开始进入的入口 + :return: + """ + if self.appear(self.I_GR_MATCHING_NEW): + logger.info('Exit team ui') + while 1: + self.screenshot() + if not self.appear(self.I_GR_MATCHING_NEW): + return True + if self.appear_then_click(self.I_GR_BACK_YELLOW, interval=0.5): + continue diff --git a/tasks/Component/GeneralRoom/gr/gr_gr_back_yellow.png b/tasks/Component/GeneralRoom/gr/gr_gr_back_yellow.png new file mode 100644 index 00000000..fe317e13 Binary files /dev/null and b/tasks/Component/GeneralRoom/gr/gr_gr_back_yellow.png differ diff --git a/tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png b/tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png new file mode 100644 index 00000000..fb256b5d Binary files /dev/null and b/tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png differ diff --git a/tasks/Component/GeneralRoom/gr/image.json b/tasks/Component/GeneralRoom/gr/image.json index cba6404a..8809fbd7 100644 --- a/tasks/Component/GeneralRoom/gr/image.json +++ b/tasks/Component/GeneralRoom/gr/image.json @@ -61,5 +61,23 @@ "method": "Template matching", "threshold": 0.8, "description": "description" + }, + { + "itemName": "gr_matching_new", + "imageName": "gr_gr_matching_new.png", + "roiFront": "1204,102,42,121", + "roiBack": "1204,102,42,121", + "method": "Template matching", + "threshold": 0.8, + "description": "description" + }, + { + "itemName": "gr_back_yellow", + "imageName": "gr_gr_back_yellow.png", + "roiFront": "19,13,53,53", + "roiBack": "19,13,53,53", + "method": "Template matching", + "threshold": 0.8, + "description": "description" } ] \ No newline at end of file diff --git a/tasks/GameUi/assets.py b/tasks/GameUi/assets.py index 571c1a6c..dd42a6ea 100644 --- a/tasks/GameUi/assets.py +++ b/tasks/GameUi/assets.py @@ -69,7 +69,7 @@ class GameUiAssets: # description I_MAIN_GOTO_TOWN = RuleImage(roi_front=(706,249,61,57), roi_back=(200,120,951,298), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_goto_town.png") # description - I_CHECK_TOWN = RuleImage(roi_front=(1034,94,100,100), roi_back=(1034,94,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_town.png") + I_CHECK_TOWN = RuleImage(roi_front=(1026,106,68,82), roi_back=(765,98,402,96), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_town.png") # description I_TOWN_GOTO_MAIN = RuleImage(roi_front=(1017,231,78,73), roi_back=(302,216,868,127), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_town_goto_main.png") # description diff --git a/tasks/GameUi/game_ui.py b/tasks/GameUi/game_ui.py index e1c453b6..10634eb3 100644 --- a/tasks/GameUi/game_ui.py +++ b/tasks/GameUi/game_ui.py @@ -177,8 +177,6 @@ def ui_goto(self, destination, confirm_wait=0, skip_first_screenshot=True): logger.hr(f"UI goto {destination}") - for page in visited: - logger.info(f"visited: {page}") confirm_timer = Timer(confirm_wait, count=int(confirm_wait // 0.5)).start() while 1: if skip_first_screenshot: diff --git a/tasks/GameUi/page/page_check_town.png b/tasks/GameUi/page/page_check_town.png index 29789b52..134d4e15 100644 Binary files a/tasks/GameUi/page/page_check_town.png and b/tasks/GameUi/page/page_check_town.png differ diff --git a/tasks/GameUi/page/page_img_2.json b/tasks/GameUi/page/page_img_2.json index 909302aa..abfcbff4 100644 --- a/tasks/GameUi/page/page_img_2.json +++ b/tasks/GameUi/page/page_img_2.json @@ -11,8 +11,8 @@ { "itemName": "check_town", "imageName": "page_check_town.png", - "roiFront": "1034,94,100,100", - "roiBack": "1034,94,100,100", + "roiFront": "1026,106,68,82", + "roiBack": "765,98,402,96", "method": "Template matching", "threshold": 0.8, "description": "description" diff --git a/tasks/Orochi/assets.py b/tasks/Orochi/assets.py index 7067f2c2..9fc39585 100644 --- a/tasks/Orochi/assets.py +++ b/tasks/Orochi/assets.py @@ -10,6 +10,23 @@ class OrochiAssets: + # Image Rule Assets + # 八级大蛇进入 + I_OROCHI = RuleImage(roi_front=(55,104,295,406), roi_back=(55,104,295,406), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_orochi.png") + # 组队 + I_FORM_TEAM = RuleImage(roi_front=(937,591,100,100), roi_back=(937,591,100,100), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_form_team.png") + # description + I_OROCHI_LOCK = RuleImage(roi_front=(558,562,31,33), roi_back=(558,562,31,33), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_lock.png") + # description + I_OROCHI_UNLOCK = RuleImage(roi_front=(560,564,26,29), roi_back=(560,564,26,29), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_unlock.png") + # 点击挑战 + I_OROCHI_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/Orochi/o/o_fire.png") + # 式神录 + I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_shi_records.png") + # description + I_OROCHI_MATCHING = RuleImage(roi_front=(1205,106,44,114), roi_back=(1205,106,44,114), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_matching.png") + + # List Rule Assets # 这个是御魂界面选择不同层数的 L_LAYER_LIST = RuleList(folder="./tasks/Orochi/res", direction="vertical", mode="ocr", roi_back=(276,130,52,500), size=(45, 88), diff --git a/tasks/Orochi/o/image.json b/tasks/Orochi/o/image.json new file mode 100644 index 00000000..c33c4868 --- /dev/null +++ b/tasks/Orochi/o/image.json @@ -0,0 +1,65 @@ +[ + { + "itemName": "orochi", + "imageName": "o_orochi.png", + "roiFront": "55,104,295,406", + "roiBack": "55,104,295,406", + "method": "Template matching", + "threshold": 0.8, + "description": "八级大蛇进入" + }, + { + "itemName": "form_team", + "imageName": "o_form_team.png", + "roiFront": "937,591,100,100", + "roiBack": "937,591,100,100", + "method": "Template matching", + "threshold": 0.8, + "description": "组队" + }, + { + "itemName": "orochi_lock", + "imageName": "o_lock.png", + "roiFront": "558,562,31,33", + "roiBack": "558,562,31,33", + "method": "Template matching", + "threshold": 0.8, + "description": "description" + }, + { + "itemName": "orochi_unlock", + "imageName": "o_unlock.png", + "roiFront": "560,564,26,29", + "roiBack": "560,564,26,29", + "method": "Template matching", + "threshold": 0.8, + "description": "description" + }, + { + "itemName": "orochi_fire", + "imageName": "o_fire.png", + "roiFront": "1095,577,131,124", + "roiBack": "1095,577,131,124", + "method": "Template matching", + "threshold": 0.6, + "description": "点击挑战" + }, + { + "itemName": "shi_records", + "imageName": "o_shi_records.png", + "roiFront": "821,638,48,45", + "roiBack": "821,638,48,45", + "method": "Template matching", + "threshold": 0.8, + "description": "式神录" + }, + { + "itemName": "orochi_matching", + "imageName": "o_matching.png", + "roiFront": "1205,106,44,114", + "roiBack": "1205,106,44,114", + "method": "Template matching", + "threshold": 0.8, + "description": "description" + } +] \ No newline at end of file diff --git a/tasks/Orochi/o/o_fire.png b/tasks/Orochi/o/o_fire.png new file mode 100644 index 00000000..7a8af7c4 Binary files /dev/null and b/tasks/Orochi/o/o_fire.png differ diff --git a/tasks/Orochi/o/o_form_team.png b/tasks/Orochi/o/o_form_team.png new file mode 100644 index 00000000..70359e80 Binary files /dev/null and b/tasks/Orochi/o/o_form_team.png differ diff --git a/tasks/Orochi/o/o_lock.png b/tasks/Orochi/o/o_lock.png new file mode 100644 index 00000000..5bb07b9d Binary files /dev/null and b/tasks/Orochi/o/o_lock.png differ diff --git a/tasks/Orochi/o/o_matching.png b/tasks/Orochi/o/o_matching.png new file mode 100644 index 00000000..c62a1ec1 Binary files /dev/null and b/tasks/Orochi/o/o_matching.png differ diff --git a/tasks/Orochi/o/o_orochi.png b/tasks/Orochi/o/o_orochi.png new file mode 100644 index 00000000..b12f7c9b Binary files /dev/null and b/tasks/Orochi/o/o_orochi.png differ diff --git a/tasks/Orochi/o/o_shi_records.png b/tasks/Orochi/o/o_shi_records.png new file mode 100644 index 00000000..11a50289 Binary files /dev/null and b/tasks/Orochi/o/o_shi_records.png differ diff --git a/tasks/Orochi/o/o_unlock.png b/tasks/Orochi/o/o_unlock.png new file mode 100644 index 00000000..f8699ce1 Binary files /dev/null and b/tasks/Orochi/o/o_unlock.png differ diff --git a/tasks/Orochi/script_task.py b/tasks/Orochi/script_task.py index 9b8bbf09..0b473a72 100644 --- a/tasks/Orochi/script_task.py +++ b/tasks/Orochi/script_task.py @@ -1,7 +1,7 @@ # This Python file uses the following encoding: utf-8 # @author runhey # github https://github.com/runhey - +from datetime import time, datetime, timedelta from tasks.base_task import BaseTask from tasks.Component.GeneralBattle.general_battle import GeneralBattle @@ -9,6 +9,7 @@ from tasks.Component.GeneralBuff.general_buff import GeneralBuff from tasks.Component.GeneralRoom.general_room import GeneralRoom from tasks.GameUi.game_ui import GameUi +from tasks.GameUi.page import page_main, page_soul_zones from tasks.Orochi.assets import OrochiAssets from tasks.Orochi.config import Orochi, UserStatus from module.logger import logger @@ -16,19 +17,50 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, OrochiAssets): def run(self) -> bool: + + limit_count = self.config.orochi.orochi_config.limit_count + limit_time = self.config.orochi.orochi_config.limit_time + self.current_count = 0 + self.limit_count: int = limit_count + self.limit_time: timedelta = timedelta(hours=limit_time.hour, minutes=limit_time.minute, seconds=limit_time.second) + + self.ui_get_current_page() + self.ui_goto(page_main) config: Orochi = self.config.orochi if config.orochi_config.soul_buff_enable: self.open_buff() self.soul(is_open=True) self.close_buff() + success = True match config.orochi_config.user_status: - case UserStatus.LEADER: self.run_leader() + case UserStatus.LEADER: success = self.run_leader() case UserStatus.MEMBER: self.run_member() case UserStatus.ALONE: self.run_alone() case UserStatus.WILD: self.run_wild() case _: logger.error('Unknown user status') + # 记得关掉 + if config.orochi_config.soul_buff_enable: + self.open_buff() + self.soul(is_open=False) + self.close_buff() + # 下一次运行时间 + if success: + self.set_next_run('Orochi', finish=True, success=True) + else: + self.set_next_run('Orochi', finish=False, success=False) + + + + def orochi_enter(self) -> bool: + logger.info('Enter orochi') + while True: + self.screenshot() + if self.appear(self.I_FORM_TEAM): + return True + if self.appear_then_click(self.I_OROCHI, interval=1): + continue def check_layer(self, layer: str) -> bool: """ @@ -40,15 +72,170 @@ def check_layer(self, layer: str) -> bool: self.device.click(x=pos[0], y=pos[1]) return True + def check_lock(self, lock: bool = True) -> bool: + """ + 检查是否锁定阵容, 要求在八岐大蛇界面 + :param lock: + :return: + """ + logger.info('Check lock: %s', lock) + if lock: + while 1: + self.screenshot() + if self.appear(self.I_OROCHI_LOCK): + return True + if self.appear_then_click(self.I_OROCHI_UNLOCK, interval=1): + continue + else: + while 1: + self.screenshot() + if self.appear(self.I_OROCHI_UNLOCK): + return True + if self.appear_then_click(self.I_OROCHI_LOCK, interval=1): + continue + + + + + + + + + + + + + + + + def run_leader(self): - pass + logger.info('Start run leader') + self.ui_get_current_page() + self.ui_goto(page_soul_zones) + self.orochi_enter() + layer = self.config.orochi.orochi_config.layer[0] + self.check_layer(layer) + self.check_lock(self.config.orochi.general_battle_config.lock_team_enable) + + # 创建队伍 + logger.info('Create team') + while 1: + self.screenshot() + if self.appear(self.I_OROCHI_MATCHING): + break + if self.appear_then_click(self.I_FORM_TEAM, interval=1): + continue + # 创建房间 + self.create_room() + self.ensure_private() + self.create_ensure() + + # 邀请队友 + success = True + is_first = True + # 这个时候我已经进入房间了哦 + while 1: + # 无论胜利与否, 都会出现是否邀请一次队友 + # 区别在于,失败的话不会出现那个勾选默认邀请的框 + if self.check_and_invite(self.config.orochi.invite_config.default_invite): + continue + + # 如果在探索界面或者是出现在组队界面, 那就是可能房间死了 + # 要结束任务 + if self.appear(self.I_MATCHING) or self.appear(self.I_CHECK_EXPLORATION): + break + if self.current_count >= self.limit_count: + if self.is_in_room(): + logger.info('Orochi count limit out') + break + if datetime.now() - self.start_time >= self.limit_time: + if self.is_in_room(): + logger.info('Orochi time limit out') + break + + + # 如果没有进入房间那就不需要后面的邀请 + if not self.is_in_room(): + continue + + # 点击挑战 + if not is_first: + if self.run_invite(config=self.config.orochi.invite_config): + self.run_general_battle(config=self.config.orochi.general_battle_config) + else: + # 邀请失败,退出任务 + logger.warning('Invite failed and exit this orochi task') + success = False + break + + # 第一次会邀请队友 + if is_first: + if not self.run_invite(config=self.config.orochi.invite_config, is_first=True): + logger.warning('Invite failed and exit this orochi task') + success = False + break + else: + is_first = False + self.run_general_battle(config=self.config.orochi.general_battle_config) + + # 当结束或者是失败退出循环的时候只有两个UI的可能,在房间或者是在组队界面 + # 如果在房间就退出 + if self.exit_room(): + pass + # 如果在组队界面就退出 + if self.exit_team(): + pass + + self.ui_get_current_page() + self.ui_goto(page_main) + + if not success: + return False + return True def run_member(self): pass def run_alone(self): - pass + logger.info('Start run alone') + self.ui_get_current_page() + self.ui_goto(page_soul_zones) + self.orochi_enter() + layer = self.config.orochi.orochi_config.layer[0] + self.check_layer(layer) + self.check_lock(self.config.orochi.general_battle_config.lock_team_enable) + + while 1: + if self.current_count >= self.limit_count: + logger.info('Orochi count limit out') + break + if datetime.now() - self.start_time >= self.limit_time: + logger.info('Orochi time limit out') + break + + # 点击挑战 + while 1: + self.screenshot() + if not self.appear(self.I_OROCHI_FIRE): + self.run_general_battle(config=self.config.orochi.general_battle_config) + break + if self.appear_then_click(self.I_OROCHI_FIRE, interval=1): + continue + + # 回去 + while 1: + self.screenshot() + if not self.appear(self.I_FORM_TEAM): + break + if self.appear_then_click(self.I_BACK_BL, interval=1): + continue + + self.ui_current = page_soul_zones + self.ui_goto(page_main) + + def run_wild(self): logger.error('Wild mode is not implemented') @@ -65,7 +252,8 @@ def run_wild(self): c = Config('oas1') d = Device(c) t = ScriptTask(c, d) - t.check_layer('陆') + + t.run()