Fix: Wait appear animation to prevent double click

This commit is contained in:
LmeSzinc 2023-10-15 04:23:50 +08:00
parent d22efbdf53
commit 4491924dcd
10 changed files with 198 additions and 18 deletions

View File

@ -155,13 +155,15 @@ class Route(RouteBase):
# ===== End of generated waypoints ===== # ===== End of generated waypoints =====
# 1, ignore item1 # 1, ignore item1
# watch left
self.rotation_set(150)
self.clear_enemy( self.clear_enemy(
enemy1right, enemy1right,
enemy1left.straight_run(), enemy1left,
) )
# 2 # 2
self.clear_item( self.clear_item(
item2.straight_run(), item2
) )
self.clear_enemy( self.clear_enemy(
enemy2.straight_run(), enemy2.straight_run(),

View File

@ -100,7 +100,6 @@ class Route(RouteBase):
Luofu_Cloudford_F1_X281Y873 is the same as Luofu_Cloudford_F1_X283Y865 Luofu_Cloudford_F1_X281Y873 is the same as Luofu_Cloudford_F1_X283Y865
but for wrong spawn point detected but for wrong spawn point detected
""" """
self.clear_item(item)
self.clear_enemy(enemy) self.clear_enemy(enemy)
def Luofu_Cloudford_F1_X283Y865(self): def Luofu_Cloudford_F1_X283Y865(self):
@ -118,7 +117,8 @@ class Route(RouteBase):
enemy = Waypoint((282.4, 814.2)) enemy = Waypoint((282.4, 814.2))
# ===== End of generated waypoints ===== # ===== End of generated waypoints =====
self.clear_item(item) # Ignore random item
# self.clear_item(item)
self.clear_enemy(enemy) self.clear_enemy(enemy)
def Luofu_Cloudford_F1_X431Y593(self): def Luofu_Cloudford_F1_X431Y593(self):

View File

@ -5,6 +5,33 @@ from tasks.rogue.route.base import RouteBase
class Route(RouteBase): class Route(RouteBase):
def Luofu_Cloudford_F2_X425Y111(self):
"""
| Waypoint | Position | Direction | Rotation |
| ---------- | ------------------------- | --------- | -------- |
| spawn | Waypoint((425.4, 111.6)), | 190.1 | 184 |
| enemy1 | Waypoint((424.9, 203.0)), | 189.0 | 186 |
| node2left | Waypoint((426.1, 222.3)), | 193.1 | 184 |
| node2right | Waypoint((402.8, 252.8)), | 244.9 | 253 |
| enemy3 | Waypoint((320.2, 266.4)), | 282.6 | 274 |
| exit | Waypoint((320.2, 266.4)), | 282.6 | 274 |
"""
self.map_init(plane=Luofu_Cloudford, floor="F2", position=(425.4, 111.6))
self.register_domain_exit(Waypoint((320.2, 266.4)), end_rotation=274)
enemy1 = Waypoint((424.9, 203.0))
node2left = Waypoint((426.1, 222.3))
node2right = Waypoint((402.8, 252.8))
enemy3 = Waypoint((320.2, 266.4))
# ===== End of generated waypoints =====
self.clear_enemy(enemy1)
# Ignore enemy2
self.clear_enemy(
node2left,
node2right.straight_run(),
enemy3.straight_run(),
)
def Luofu_Cloudford_F2_X425Y171(self): def Luofu_Cloudford_F2_X425Y171(self):
""" """
| Waypoint | Position | Direction | Rotation | | Waypoint | Position | Direction | Rotation |

View File

@ -5,6 +5,41 @@ from tasks.rogue.route.base import RouteBase
class Route(RouteBase): class Route(RouteBase):
def Luofu_ScalegorgeWaterscape_F1_X415Y261(self):
"""
| Waypoint | Position | Direction | Rotation |
| ----------- | ------------------------- | --------- | -------- |
| spawn | Waypoint((415.4, 261.6)), | 274.2 | 274 |
| item1 | Waypoint((396.6, 270.2)), | 250.8 | 251 |
| enemy1right | Waypoint((385.0, 274.4)), | 250.7 | 248 |
| node2 | Waypoint((381.0, 281.0)), | 283.0 | 278 |
| enemy1left | Waypoint((384.2, 292.0)), | 12.7 | 186 |
| enemy2 | Waypoint((340.2, 281.8)), | 275.8 | 87 |
| enemy3 | Waypoint((283.6, 280.0)), | 282.7 | 276 |
| exit | Waypoint((278.4, 280.2)), | 274.2 | 271 |
"""
self.map_init(plane=Luofu_ScalegorgeWaterscape, floor="F1", position=(415.4, 261.6))
self.register_domain_exit(Waypoint((278.4, 280.2)), end_rotation=271)
item1 = Waypoint((396.6, 270.2))
enemy1right = Waypoint((385.0, 274.4))
node2 = Waypoint((381.0, 281.0))
enemy1left = Waypoint((384.2, 292.0))
enemy2 = Waypoint((340.2, 281.8))
enemy3 = Waypoint((283.6, 280.0))
# ===== End of generated waypoints =====
self.rotation_set(245)
self.clear_item(item1)
self.clear_enemy(
enemy1right,
enemy1left,
)
self.clear_enemy(
node2,
enemy2.straight_run(),
)
self.clear_enemy(enemy3)
def Luofu_ScalegorgeWaterscape_F1_X467Y405(self): def Luofu_ScalegorgeWaterscape_F1_X467Y405(self):
""" """
| Waypoint | Position | Direction | Rotation | | Waypoint | Position | Direction | Rotation |

View File

@ -10,16 +10,13 @@ class Route(RouteBase):
| Waypoint | Position | Direction | Rotation | | Waypoint | Position | Direction | Rotation |
| -------- | ------------------------- | --------- | -------- | | -------- | ------------------------- | --------- | -------- |
| spawn | Waypoint((167.8, 491.0)), | 96.7 | 91 | | spawn | Waypoint((167.8, 491.0)), | 96.7 | 91 |
| item | Waypoint((178.8, 468.4)), | 41.0 | 36 |
| event | Waypoint((218.7, 491.1)), | 96.7 | 94 | | event | Waypoint((218.7, 491.1)), | 96.7 | 94 |
| exit | Waypoint((216.9, 490.9)), | 190.0 | 89 | | exit | Waypoint((216.9, 490.9)), | 190.0 | 89 |
""" """
self.map_init(plane=Luofu_ArtisanshipCommission, floor="F1", position=(167.8, 491.0)) self.map_init(plane=Luofu_ArtisanshipCommission, floor="F1", position=(167.8, 491.0))
self.register_domain_exit(Waypoint((216.9, 490.9)), end_rotation=89) self.register_domain_exit(Waypoint((216.9, 490.9)), end_rotation=89)
item = Waypoint((178.8, 468.4))
event = Waypoint((218.7, 491.1)) event = Waypoint((218.7, 491.1))
self.clear_item(item)
self.clear_event(event) self.clear_event(event)
# ===== End of generated waypoints ===== # ===== End of generated waypoints =====

View File

@ -0,0 +1,39 @@
from tasks.map.control.waypoint import Waypoint
from tasks.map.keywords.plane import Luofu_ScalegorgeWaterscape
from tasks.rogue.route.base import RouteBase
class Route(RouteBase):
def Luofu_ScalegorgeWaterscape_F1_X499Y135(self):
"""
| Waypoint | Position | Direction | Rotation |
| -------- | ------------------------- | --------- | -------- |
| spawn | Waypoint((499.5, 135.3)), | 190.1 | 184 |
| event | Waypoint((942.8, 291.1)), | 193.0 | 186 |
| exit | Waypoint((499.2, 169.4)), | 187.1 | 179 |
"""
self.map_init(plane=Luofu_ScalegorgeWaterscape, floor="F1", position=(499.5, 135.3))
self.register_domain_exit(Waypoint((499.2, 169.4)), end_rotation=179)
event = Waypoint((942.8, 291.1))
self.clear_event(event)
# ===== End of generated waypoints =====
def Luofu_ScalegorgeWaterscape_F1_X714Y243(self):
"""
| Waypoint | Position | Direction | Rotation |
| -------- | ------------------------- | --------- | -------- |
| spawn | Waypoint((714.4, 243.2)), | 274.2 | 274 |
| event | Waypoint((678.9, 243.0)), | 274.2 | 274 |
| item | Waypoint((323.2, 268.8)), | 302.6 | 297 |
| exit | Waypoint((677.4, 243.2)), | 274.2 | 271 |
"""
self.map_init(plane=Luofu_ScalegorgeWaterscape, floor="F1", position=(714.4, 243.2))
self.register_domain_exit(Waypoint((677.4, 243.2)), end_rotation=271)
event = Waypoint((678.9, 243.0))
item = Waypoint((323.2, 268.8))
self.clear_item(item)
self.clear_event(event)
# ===== End of generated waypoints =====

View File

@ -0,0 +1,25 @@
from tasks.map.control.waypoint import Waypoint
from tasks.map.keywords.plane import Luofu_ScalegorgeWaterscape
from tasks.rogue.route.base import RouteBase
class Route(RouteBase):
def Luofu_ScalegorgeWaterscape_F1_X701Y321(self):
"""
| Waypoint | Position | Direction | Rotation |
| -------- | -------------------------- | --------- | -------- |
| spawn | Waypoint((701.5, 320.8)), | 274.2 | 274 |
| herta | Waypoint((673.0, 314.9)), | 300.1 | 297 |
| item | Waypoint((1418.8, 300.8)), | 315.9 | 301 |
| exit | Waypoint((953.0, 279.7)), | 263.8 | 258 |
"""
self.map_init(plane=Luofu_ScalegorgeWaterscape, floor="F1", position=(701.5, 320.8))
herta = Waypoint((673.0, 314.9))
item = Waypoint((1418.8, 300.8))
exit_ = Waypoint((953.0, 279.7))
self.clear_item(item)
self.domain_herta(herta)
self.domain_single_exit(exit_)
# ===== End of generated waypoints =====

View File

@ -670,6 +670,17 @@
], ],
"domain": "Combat" "domain": "Combat"
}, },
{
"name": "Combat_Luofu_Cloudford_F2_X425Y111",
"route": "route.rogue.Combat.Luofu_Cloudford_F2:Luofu_Cloudford_F2_X425Y111",
"plane": "Luofu_Cloudford",
"floor": "F2",
"position": [
425.4,
111.6
],
"domain": "Combat"
},
{ {
"name": "Combat_Luofu_Cloudford_F2_X425Y171", "name": "Combat_Luofu_Cloudford_F2_X425Y171",
"route": "route.rogue.Combat.Luofu_Cloudford_F2:Luofu_Cloudford_F2_X425Y171", "route": "route.rogue.Combat.Luofu_Cloudford_F2:Luofu_Cloudford_F2_X425Y171",
@ -681,6 +692,17 @@
], ],
"domain": "Combat" "domain": "Combat"
}, },
{
"name": "Combat_Luofu_ScalegorgeWaterscape_F1_X415Y261",
"route": "route.rogue.Combat.Luofu_ScalegorgeWaterscape_F1:Luofu_ScalegorgeWaterscape_F1_X415Y261",
"plane": "Luofu_ScalegorgeWaterscape",
"floor": "F1",
"position": [
415.4,
261.6
],
"domain": "Combat"
},
{ {
"name": "Combat_Luofu_ScalegorgeWaterscape_F1_X467Y405", "name": "Combat_Luofu_ScalegorgeWaterscape_F1_X467Y405",
"route": "route.rogue.Combat.Luofu_ScalegorgeWaterscape_F1:Luofu_ScalegorgeWaterscape_F1_X467Y405", "route": "route.rogue.Combat.Luofu_ScalegorgeWaterscape_F1:Luofu_ScalegorgeWaterscape_F1_X467Y405",
@ -1286,6 +1308,28 @@
], ],
"domain": "Occurrence" "domain": "Occurrence"
}, },
{
"name": "Occurrence_Luofu_ScalegorgeWaterscape_F1_X499Y135",
"route": "route.rogue.Occurrence.Luofu_ScalegorgeWaterscape_F1:Luofu_ScalegorgeWaterscape_F1_X499Y135",
"plane": "Luofu_ScalegorgeWaterscape",
"floor": "F1",
"position": [
499.5,
135.3
],
"domain": "Occurrence"
},
{
"name": "Occurrence_Luofu_ScalegorgeWaterscape_F1_X714Y243",
"route": "route.rogue.Occurrence.Luofu_ScalegorgeWaterscape_F1:Luofu_ScalegorgeWaterscape_F1_X714Y243",
"plane": "Luofu_ScalegorgeWaterscape",
"floor": "F1",
"position": [
714.4,
243.2
],
"domain": "Occurrence"
},
{ {
"name": "Occurrence_Luofu_StargazerNavalia_F2_X579Y183", "name": "Occurrence_Luofu_StargazerNavalia_F2_X579Y183",
"route": "route.rogue.Occurrence.Luofu_StargazerNavalia_F2:Luofu_StargazerNavalia_F2_X579Y183", "route": "route.rogue.Occurrence.Luofu_StargazerNavalia_F2:Luofu_StargazerNavalia_F2_X579Y183",
@ -1396,6 +1440,17 @@
], ],
"domain": "Respite" "domain": "Respite"
}, },
{
"name": "Respite_Luofu_ScalegorgeWaterscape_F1_X701Y321",
"route": "route.rogue.Respite.Luofu_ScalegorgeWaterscape_F1:Luofu_ScalegorgeWaterscape_F1_X701Y321",
"plane": "Luofu_ScalegorgeWaterscape",
"floor": "F1",
"position": [
701.5,
320.8
],
"domain": "Respite"
},
{ {
"name": "Respite_Luofu_StargazerNavalia_F2Rogue_X569Y275", "name": "Respite_Luofu_StargazerNavalia_F2Rogue_X569Y275",
"route": "route.rogue.Respite.Luofu_StargazerNavalia_F2Rogue:Luofu_StargazerNavalia_F2Rogue_X569Y275", "route": "route.rogue.Respite.Luofu_StargazerNavalia_F2Rogue:Luofu_StargazerNavalia_F2Rogue_X569Y275",

View File

@ -232,11 +232,11 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent):
logger.info('Entered another domain') logger.info('Entered another domain')
self.wait_until_minimap_stabled() self.wait_until_minimap_stabled()
break break
if self.ui_page_appear(page_rogue): if self.is_page_rogue_main():
logger.info('Rogue cleared') logger.info('Rogue cleared')
break break
if self.appear(ROGUE_REPORT, interval=2): if self.match_template_color(ROGUE_REPORT, interval=2):
logger.info(f'{ROGUE_REPORT} -> {BLESSING_CONFIRM}') logger.info(f'{ROGUE_REPORT} -> {BLESSING_CONFIRM}')
self.device.click(BLESSING_CONFIRM) self.device.click(BLESSING_CONFIRM)
continue continue

View File

@ -5,7 +5,6 @@ import numpy as np
from module.base.decorator import cached_property from module.base.decorator import cached_property
from module.logger import logger from module.logger import logger
from tasks.base.main_page import MainPage from tasks.base.main_page import MainPage
from tasks.base.page import page_rogue
from tasks.map.keywords import MapPlane from tasks.map.keywords import MapPlane
from tasks.map.keywords.plane import ( from tasks.map.keywords.plane import (
Herta_MasterControlZone, Herta_MasterControlZone,
@ -17,6 +16,7 @@ from tasks.map.keywords.plane import (
from tasks.map.minimap.minimap import Minimap from tasks.map.minimap.minimap import Minimap
from tasks.map.resource.resource import SPECIAL_PLANES from tasks.map.resource.resource import SPECIAL_PLANES
from tasks.map.route.loader import RouteLoader as RouteLoader_ from tasks.map.route.loader import RouteLoader as RouteLoader_
from tasks.rogue.bleesing.ui import RogueUI
from tasks.rogue.route.base import RouteBase from tasks.rogue.route.base import RouteBase
from tasks.rogue.route.model import RogueRouteListModel, RogueRouteModel from tasks.rogue.route.model import RogueRouteListModel, RogueRouteModel
@ -74,7 +74,7 @@ class MinimapWrapper:
return self.all_minimap[route.plane_floor] return self.all_minimap[route.plane_floor]
class RouteLoader(MinimapWrapper, RouteLoader_, MainPage): class RouteLoader(RogueUI, MinimapWrapper, RouteLoader_, MainPage):
def position_find_known(self, image) -> Optional[RogueRouteModel]: def position_find_known(self, image) -> Optional[RogueRouteModel]:
""" """
Try to find from known route spawn point Try to find from known route spawn point
@ -184,8 +184,8 @@ class RouteLoader(MinimapWrapper, RouteLoader_, MainPage):
Do a complete rogue run, no error handle yet. Do a complete rogue run, no error handle yet.
Pages: Pages:
in: page_rogue, LAUNCH_SIMULATED_UNIVERSE in: page_rogue, is_page_rogue_launch()
out: page_rogue, world selecting page out: page_rogue, is_page_rogue_main()
""" """
base = RouteBase(config=self.config, device=self.device, task=self.config.task.command) base = RouteBase(config=self.config, device=self.device, task=self.config.task.command)
count = 1 count = 1
@ -203,7 +203,7 @@ class RouteLoader(MinimapWrapper, RouteLoader_, MainPage):
continue continue
# End # End
if self.ui_page_appear(page_rogue): if self.is_page_rogue_main():
break break
count += 1 count += 1
@ -212,8 +212,8 @@ class RouteLoader(MinimapWrapper, RouteLoader_, MainPage):
if __name__ == '__main__': if __name__ == '__main__':
self = RouteLoader('src', task='Rogue') self = RouteLoader('src', task='Rogue')
# self.image_file = r'' # self.image_file = r''
# self.device.screenshot()
# self.position_find_bruteforce(self.device.image)
self.device.screenshot() self.device.screenshot()
self.rogue_run() self.position_find_bruteforce(self.device.image)
# self.device.screenshot()
# self.rogue_run()