mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-09-28 06:45:03 +00:00
Add: Support rogue specific planes
This commit is contained in:
parent
80429efe72
commit
0e55bb58e2
@ -121,7 +121,7 @@ class RouteDetect:
|
||||
|
||||
@cached_property
|
||||
def detector(self):
|
||||
from tasks.map.minimap.brute_force import MinimapWrapper
|
||||
from tasks.rogue.route.loader import MinimapWrapper
|
||||
return MinimapWrapper()
|
||||
|
||||
def get_minimap(self, route: RogueWaypointModel):
|
||||
|
@ -12,8 +12,14 @@ from tasks.map.minimap.utils import create_circular_mask
|
||||
from tasks.map.resource.const import ResourceConst
|
||||
from tasks.map.keywords import KEYWORDS_MAP_PLANE, MapPlane
|
||||
|
||||
SPECIAL_PLANES = [
|
||||
('Luofu_StargazerNavalia', 'F2Rogue')
|
||||
]
|
||||
|
||||
|
||||
class MapResource(ResourceConst):
|
||||
is_special_plane: bool
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
@ -51,8 +57,13 @@ class MapResource(ResourceConst):
|
||||
plane (MapPlane, str): Such as Jarilo_AdministrativeDistrict
|
||||
floor (str):
|
||||
"""
|
||||
self.plane = MapPlane.find(plane)
|
||||
self.floor = self.plane.convert_to_floor_name(floor)
|
||||
self.plane: MapPlane = MapPlane.find(plane)
|
||||
if (self.plane.name, floor) in SPECIAL_PLANES:
|
||||
self.floor = floor
|
||||
self.is_special_plane = True
|
||||
else:
|
||||
self.floor = self.plane.convert_to_floor_name(floor)
|
||||
self.is_special_plane = False
|
||||
|
||||
del_cached_property(self, 'assets_file_basename')
|
||||
del_cached_property(self, 'assets_floor')
|
||||
|
@ -12,6 +12,7 @@ from tasks.map.keywords.plane import (
|
||||
Luofu_ExaltingSanctum
|
||||
)
|
||||
from tasks.map.minimap.minimap import Minimap
|
||||
from tasks.map.resource.resource import SPECIAL_PLANES
|
||||
from tasks.map.route.loader import RouteLoader as RouteLoader_
|
||||
from tasks.rogue.route.base import RouteBase
|
||||
from tasks.rogue.route.model import RogueRouteListModel, RogueRouteModel
|
||||
@ -24,7 +25,7 @@ def model_from_json(model, file: str):
|
||||
return data
|
||||
|
||||
|
||||
class RouteLoader(RouteLoader_, MainPage):
|
||||
class MinimapWrapper:
|
||||
@cached_property
|
||||
def all_minimap(self) -> dict[(str, str), Minimap]:
|
||||
"""
|
||||
@ -50,6 +51,12 @@ class RouteLoader(RouteLoader_, MainPage):
|
||||
minimap = Minimap()
|
||||
minimap.set_plane(plane=plane, floor=floor)
|
||||
maps[f'{plane.name}_{floor}'] = minimap
|
||||
|
||||
for plane, floor in SPECIAL_PLANES:
|
||||
minimap = Minimap()
|
||||
minimap.set_plane(plane=plane, floor=floor)
|
||||
maps[f'{plane}_{floor}'] = minimap
|
||||
|
||||
return maps
|
||||
|
||||
@cached_property
|
||||
@ -59,6 +66,8 @@ class RouteLoader(RouteLoader_, MainPage):
|
||||
def get_minimap(self, route: RogueRouteModel):
|
||||
return self.all_minimap[route.plane_floor]
|
||||
|
||||
|
||||
class RouteLoader(MinimapWrapper, RouteLoader_, MainPage):
|
||||
def position_find_known(self, image) -> Optional[RogueRouteModel]:
|
||||
"""
|
||||
Try to find from known route spawn point
|
||||
@ -107,6 +116,9 @@ class RouteLoader(RouteLoader_, MainPage):
|
||||
"""
|
||||
logger.warning('position_find_bruteforce, this may take a while')
|
||||
for name, minimap in self.all_minimap.items():
|
||||
if minimap.is_special_plane:
|
||||
continue
|
||||
|
||||
minimap.init_position((0, 0), show_log=False)
|
||||
try:
|
||||
minimap.update_position(image)
|
||||
|
Loading…
Reference in New Issue
Block a user