Fix: Match special route Occurrence_Herta_StorageZone_F2_X363Y166

This commit is contained in:
LmeSzinc 2023-11-14 01:10:36 +08:00
parent 2591a3aee0
commit 6dee0dd378
3 changed files with 24 additions and 29 deletions

View File

@ -5,24 +5,6 @@ from tasks.rogue.route.base import RouteBase
class Route(RouteBase):
def Herta_StorageZone_F2_X365Y167(self):
"""
| Waypoint | Position | Direction | Rotation |
| -------- | ------------------------- | --------- | -------- |
| spawn | Waypoint((363.4, 166.9)), | 274.2 | 274 |
| item | Waypoint((332.8, 172.0)), | 263.8 | 260 |
| event | Waypoint((318.9, 155.2)), | 290.1 | 285 |
| exit_ | Waypoint((314.3, 164.1)), | 276.0 | 271 |
"""
self.map_init(plane=Herta_StorageZone, floor="F2", position=(363.4, 166.9))
self.register_domain_exit(Waypoint((314.3, 164.1)), end_rotation=271)
item = Waypoint((332.8, 172.0))
event = Waypoint((318.9, 155.2))
self.clear_item(item)
self.clear_event(event)
# ===== End of generated waypoints =====
def Herta_StorageZone_F2_X363Y166(self):
"""
| Waypoint | Position | Direction | Rotation |

View File

@ -1154,17 +1154,6 @@
],
"domain": "Occurrence"
},
{
"name": "Occurrence_Herta_StorageZone_F2_X365Y167",
"route": "route.rogue.Occurrence.Herta_StorageZone_F2:Herta_StorageZone_F2_X365Y167",
"plane": "Herta_StorageZone",
"floor": "F2",
"position": [
363.4,
166.9
],
"domain": "Occurrence"
},
{
"name": "Occurrence_Herta_StorageZone_F2_X363Y166",
"route": "route.rogue.Occurrence.Herta_StorageZone_F2:Herta_StorageZone_F2_X363Y166",

View File

@ -116,6 +116,12 @@ class RouteLoader(RogueUI, MinimapWrapper, RouteLoader_, CharacterSwitch):
(r, s, p) for r, s, p in visited if np.linalg.norm(np.subtract(r.position, p)) < 5
]
logger.info(f'Best 3 nearby predictions: {[(r.name, s, p) for r, s, p in nearby[:3]]}')
# Check special
for r, s, p in nearby:
if self._position_match_special(r, s, p):
logger.info(f'Route match special: {r.name}')
return r
# Check nearby
if len(nearby) == 1:
if nearby[0][1] > 0.05:
logger.attr('RoutePredict', nearby[0][0].name)
@ -141,6 +147,24 @@ class RouteLoader(RogueUI, MinimapWrapper, RouteLoader_, CharacterSwitch):
logger.warning('Similarity too close, not enough to make a prediction')
return None
def _position_match_special(
self,
route: RogueRouteModel,
similarity: float,
position: tuple[float, float]
) -> bool:
# 2023-11-13 23:50:00.470 | INFO | Best 3 predictions: [
# ('Occurrence_Luofu_Cloudford_F1_X241Y947', 0.119, (272.6, 948.5)),
# ('Occurrence_Jarilo_GreatMine_F1_X277Y605', 0.107, (264.4, 645.0)),
# ('Occurrence_Luofu_ArtisanshipCommission_F1_X521Y63', 0.106, (569.8, 34.8))]
# 2023-11-13 23:50:00.472 | INFO | Best 3 nearby predictions: [
# ('Occurrence_Herta_SupplyZone_F2Rogue_X397Y223', 0.102, (393.2, 222.8)),
# ('Occurrence_Herta_StorageZone_F2_X365Y167', 0.094, (363.0, 166.8)),
# ('Occurrence_Herta_StorageZone_F2_X363Y166', 0.094, (363.0, 166.8))]
if route.name == 'Occurrence_Herta_StorageZone_F2_X363Y166' and similarity > 0.05:
return True
return False
def position_find_bruteforce(self, image) -> Minimap:
"""
Fallback method to find from all planes and floors