Skip to content

Commit 1b8cca8

Browse files
committed
‘from_ljxun’
1 parent 4a9bd4d commit 1b8cca8

File tree

17 files changed

+221
-367
lines changed

17 files changed

+221
-367
lines changed

tasks/SixRealms/assets.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@
1010
class SixRealmsAssets:
1111

1212

13+
# Image Rule Assets
14+
# 宁息
15+
I_NINGXI = RuleImage(roi_front=(646,424,30,31), roi_back=(151,88,908,513), threshold=0.65, method="Template matching", file="./tasks/SixRealms/a/ningxi.png")
16+
# 混沌
17+
I_HUNDUN = RuleImage(roi_front=(370,405,33,31), roi_back=(151,88,908,513), threshold=0.65, method="Template matching", file="./tasks/SixRealms/a/hundun.png")
18+
# 鏖战
19+
I_ZHAN = RuleImage(roi_front=(644,468,28,29), roi_back=(151,88,908,513), threshold=0.65, method="Template matching", file="./tasks/SixRealms/a/zhan.png")
20+
# 神秘
21+
I_SHENMI = RuleImage(roi_front=(901,458,36,28), roi_back=(151,88,908,513), threshold=0.65, method="Template matching", file="./tasks/SixRealms/a/shenmi.png")
22+
# 星之屿
23+
I_XING = RuleImage(roi_front=(643,466,30,27), roi_back=(151,88,908,513), threshold=0.7, method="Template matching", file="./tasks/SixRealms/a/xing.png")
24+
25+
1326
# Click Rule Assets
1427
# description
1528
C_MAIN_ANIMATE_KEEP = RuleClick(roi_front=(565,7,100,215), roi_back=(565,7,100,215), name="main_animate_keep")
@@ -42,7 +55,7 @@ class SixRealmsAssets:
4255

4356
# Click Rule Assets
4457
# 左边的
45-
C_NPC_FIRE_LEFT = RuleClick(roi_front=(423,203,153,193), roi_back=(423,203,153,193), name="npc_fire_left")
58+
C_NPC_FIRE_LEFT = RuleClick(roi_front=(423,203,53,193), roi_back=(423,203,53,193), name="npc_fire_left")
4659
# description
4760
C_NPC_FIRE_RIGHT = RuleClick(roi_front=(740,248,181,180), roi_back=(740,248,181,180), name="npc_fire_right")
4861
# 中间的精英
@@ -100,8 +113,6 @@ class SixRealmsAssets:
100113
I_ISLAND_TAG_FLAG = RuleImage(roi_front=(543,601,100,100), roi_back=(543,601,100,100), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_island_tag_flag.png")
101114
# 暂时离开六道之门
102115
I_EXIT_SIXREALMS = RuleImage(roi_front=(507.5,308,100,100), roi_back=(507.5,308,100,100), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_exit_sixrealms.png")
103-
# 选择一个式神加入征伐队伍
104-
I_SELECT_SHIKIGAMI_AND_CONFIRM = RuleImage(roi_front=(499,238,151,57), roi_back=(479,213,199,113), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_select_shikigami_and_confirm.png")
105116

106117

107118
# Ocr Rule Assets
@@ -111,6 +122,8 @@ class SixRealmsAssets:
111122
O_ISLAND_NAME = RuleOcr(roi=(88,17,148,49), area=(88,17,148,49), mode="Single", method="Default", keyword="", name="island_name")
112123
# 有多少钱
113124
O_COIN_NUM = RuleOcr(roi=(1171,23,59,31), area=(1171,23,59,31), mode="Digit", method="Default", keyword="", name="coin_num")
125+
# 六道门票
126+
O_SIXREALMS_NUMBER = RuleOcr(roi=(1151,23,59,33), area=(1151,23,59,33), mode="Digit", method="Default", keyword="", name="sixrealms_number")
114127
# Ocr-description
115128
O_SKILL_REFRESH = RuleOcr(roi=(1172,684,100,31), area=(1172,684,100,31), mode="Single", method="Default", keyword="", name="skill_refresh")
116129

@@ -142,11 +155,6 @@ class SixRealmsAssets:
142155
I_SKILL105 = RuleImage(roi_front=(178,187,80,69), roi_back=(112,149,779,151), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_skill105.png")
143156

144157

145-
# Swipe Rule Assets
146-
# 征伐队伍选择界面底部阵容上拉
147-
S_TEAM_SWIPE_UP = RuleSwipe(roi_front=(520,571,93,98), roi_back=(589,180,100,100), mode="default", name="team_swipe_up")
148-
149-
150158
# Image Rule Assets
151159
# 宁息刷新
152160
I_STORE_REFRESH = RuleImage(roi_front=(545,596,46,47), roi_back=(519,568,100,100), threshold=0.8, method="Template matching", file="./tasks/SixRealms/l101/l101_store_refresh.png")
@@ -177,6 +185,8 @@ class SixRealmsAssets:
177185
# Image Rule Assets
178186
# description
179187
I_L103_EXIT = RuleImage(roi_front=(1171,587,69,70), roi_back=(1078,538,195,180), threshold=0.8, method="Template matching", file="./tasks/SixRealms/l103/l103_exit.png")
188+
# lucky_box
189+
I_LUCKY_BOX = RuleImage(roi_front=(442,335,20,95), roi_back=(319,233,257,293), threshold=0.8, method="Template matching", file="./tasks/SixRealms/l103/lucky_box.png")
180190

181191

182192
# Image Rule Assets
@@ -188,5 +198,12 @@ class SixRealmsAssets:
188198
I_BATTLE_TEAM_UNLOCK = RuleImage(roi_front=(962,676,21,21), roi_back=(943,655,64,60), threshold=0.8, method="Template matching", file="./tasks/SixRealms/l104/l104_battle_team_unlock.png")
189199
# description
190200
I_BATTLE_TEAM_LOCK = RuleImage(roi_front=(961,675,21,23), roi_back=(949,662,48,50), threshold=0.8, method="Template matching", file="./tasks/SixRealms/l104/l104_battle_team_lock.png")
201+
# fenghuang
202+
I_FENGHUANG = RuleImage(roi_front=(582,124,412,433), roi_back=(582,124,412,433), threshold=0.8, method="Template matching", file="./tasks/SixRealms/l104/fenghuang.png")
203+
204+
205+
# Image Rule Assets
206+
# 招福达摩
207+
I_ZHAOFU = RuleImage(roi_front=(421,270,22,51), roi_back=(382,205,97,214), threshold=0.8, method="Template matching", file="./tasks/SixRealms/l105/zhaofu.png")
191208

192209

tasks/SixRealms/config.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,27 @@
55

66
from tasks.Component.config_scheduler import Scheduler
77
from tasks.Component.config_base import ConfigBase, Time
8-
from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
98

109

1110
class SixRealmsGate(BaseModel):
11+
number_enable: bool = Field(default=False, description='只打门票')
1212
# 限制时间
1313
limit_time: Time = Field(default=Time(minute=30), description='limit_time_help')
1414
# 限制次数
1515
limit_count: int = Field(default=1, description='limit_count_help')
1616

1717

18+
class SwitchSoulConfig(BaseModel):
19+
enable: bool = Field(default=False, description='auto_enable_help')
20+
# 换第一行
21+
one_switch: str = Field(default='-1,-1', description='换第一行')
22+
# 换第二行
23+
two_switch: str = Field(default='-1,-1', description='换第二行')
24+
25+
1826
class SixRealms(ConfigBase):
1927
scheduler: Scheduler = Field(default_factory=Scheduler)
20-
switch_soul_config_1: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
21-
switch_soul_config_2: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
28+
switch_soul_config: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
2229
six_realms_gate: SixRealmsGate = Field(default_factory=SixRealmsGate)
2330

2431

tasks/SixRealms/gate1/click.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[
22
{
33
"itemName": "npc_fire_left",
4-
"roiFront": "423,203,153,193",
5-
"roiBack": "423,203,153,193",
4+
"roiFront": "423,203,53,193",
5+
"roiBack": "423,203,53,193",
66
"description": "左边的"
77
},
88
{

tasks/SixRealms/gate1/image.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,5 @@
160160
"method": "Template matching",
161161
"threshold": 0.8,
162162
"description": "暂时离开六道之门"
163-
},
164-
{
165-
"itemName": "select_shikigami_and_confirm",
166-
"imageName": "gate1_select_shikigami_and_confirm.png",
167-
"roiFront": "499,238,151,57",
168-
"roiBack": "479,213,199,113",
169-
"method": "Template matching",
170-
"threshold": 0.8,
171-
"description": "选择一个式神加入征伐队伍"
172163
}
173164
]

tasks/SixRealms/gate1/ocr.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
"keyword": "",
2727
"description": "有多少钱"
2828
},
29+
{
30+
"itemName": "sixrealms_number",
31+
"roiFront": "1151,23,59,33",
32+
"roiBack": "1151,23,59,33",
33+
"mode": "Digit",
34+
"method": "Default",
35+
"keyword": "",
36+
"description": "六道门票"
37+
},
2938
{
3039
"itemName": "skill_refresh",
3140
"roiFront": "1172,684,100,31",

tasks/SixRealms/l103/image.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,14 @@
77
"method": "Template matching",
88
"threshold": 0.8,
99
"description": "description"
10+
},
11+
{
12+
"itemName": "lucky_box",
13+
"imageName": "lucky_box.png",
14+
"roiFront": "442,335,20,95",
15+
"roiBack": "319,233,257,293",
16+
"method": "Template matching",
17+
"threshold": 0.8,
18+
"description": "lucky_box"
1019
}
1120
]

tasks/SixRealms/l104/image.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,14 @@
3434
"method": "Template matching",
3535
"threshold": 0.8,
3636
"description": "description"
37+
},
38+
{
39+
"itemName": "fenghuang",
40+
"imageName": "fenghuang.png",
41+
"roiFront": "582,124,412,433",
42+
"roiBack": "582,124,412,433",
43+
"method": "Template matching",
44+
"threshold": 0.8,
45+
"description": "fenghuang"
3746
}
3847
]

tasks/SixRealms/moon_sea/l101.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,9 @@ def run_l101(self):
102102

103103
if __name__ == '__main__':
104104
from module.config.config import Config
105-
from module.device.device import Device
106105

107-
c = Config('oas1')
108-
d = Device(c)
109-
t = MoonSeaL101(c, d)
106+
c = Config('du')
107+
t = MoonSeaL101(c)
110108
t.screenshot()
111109

112110
t.run_l101()

tasks/SixRealms/moon_sea/l102.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def imitate(self):
4343
self.screenshot()
4444
if self.in_main():
4545
break
46+
if self.cnt_skill101 >= 5:
47+
if self.appear_then_click(self.I_BACK_EXIT, interval=2):
48+
continue
4649
if self.appear_then_click(self.I_IMITATE_1, interval=2.5):
4750
continue
4851
if self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=1):
@@ -69,11 +72,9 @@ def imitate(self):
6972

7073
if __name__ == '__main__':
7174
from module.config.config import Config
72-
from module.device.device import Device
7375

74-
c = Config('oas1')
75-
d = Device(c)
76-
t = MoonSeaL102(c, d)
76+
c = Config('du')
77+
t = MoonSeaL102(c)
7778
t.screenshot()
7879

7980
t.run_l102()

tasks/SixRealms/moon_sea/l103.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ class MoonSeaL103(MoonSeaSkills):
77
def run_103(self):
88
# 宝箱还是精英
99
logger.hr('Island 103')
10-
self.wait_until_appear(self.I_ISLAND_TAG_FLAG, wait_time=2)
1110
is_box: bool = self.appear(self.I_L103_EXIT)
1211
if is_box:
1312
logger.info('Access to Box')
1413
while 1:
1514
self.screenshot()
16-
if self.appear(self.I_M_STORE):
15+
if self.appear(self.I_M_STORE) or self.appear(self.I_BOSS_FIRE):
1716
logger.info('Not punched the treasure box')
1817
return
1918
if self.appear_then_click(self.I_UI_UNCHECK, interval=0.5):
@@ -37,18 +36,15 @@ def battle_l103(self):
3736
self.battle_lock_team()
3837
self.island_battle()
3938
logger.info('Island battle finished')
40-
self.select_skill(refresh=True)
4139

4240

4341

4442

4543
if __name__ == '__main__':
4644
from module.config.config import Config
47-
from module.device.device import Device
4845

49-
c = Config('oas1')
50-
d = Device(c)
51-
t = MoonSeaL103(c, d)
46+
c = Config('du')
47+
t = MoonSeaL103(c)
5248
t.screenshot()
5349

5450
t.run_103()

0 commit comments

Comments
 (0)