mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-13 05:37:00 +08:00
Add: Obscure finish in OS fully auto
This commit is contained in:
@@ -28,6 +28,22 @@ ACTION_POINTS_COST = {
|
||||
5: 30,
|
||||
6: 40,
|
||||
}
|
||||
ACTION_POINTS_COST_OBSCURE = {
|
||||
1: 10, # No obscured zones in CL1 actually
|
||||
2: 10,
|
||||
3: 20,
|
||||
4: 20,
|
||||
5: 40,
|
||||
6: 40,
|
||||
}
|
||||
ACTION_POINTS_COST_LOGGER = {
|
||||
1: 80,
|
||||
2: 80,
|
||||
3: 80, # No obscured zones under CL4 actually
|
||||
4: 80,
|
||||
5: 100,
|
||||
6: 100,
|
||||
}
|
||||
ACTION_POINTS_BUY = {
|
||||
1: 4000,
|
||||
2: 2000,
|
||||
@@ -97,13 +113,22 @@ class ActionPointHandler(UI):
|
||||
Returns:
|
||||
int: Action points that will cost.
|
||||
"""
|
||||
cost = ACTION_POINTS_COST[zone.hazard_level]
|
||||
if pinned == 'DANGEROUS':
|
||||
cost = ACTION_POINTS_COST[zone.hazard_level] * 2
|
||||
elif pinned == 'SAFE':
|
||||
cost = ACTION_POINTS_COST[zone.hazard_level]
|
||||
elif pinned == 'OBSCURE':
|
||||
cost = ACTION_POINTS_COST_OBSCURE[zone.hazard_level]
|
||||
elif pinned == 'LOGGER':
|
||||
cost = ACTION_POINTS_COST_LOGGER[zone.hazard_level]
|
||||
elif pinned == 'STRONGHOLD':
|
||||
cost = 200
|
||||
else:
|
||||
logger.warning(f'Unable to get AP cost from zone={zone}, pinned={pinned}, assume it costs 40.')
|
||||
cost = 40
|
||||
|
||||
if zone.is_port:
|
||||
cost = 0
|
||||
if pinned == 'DANGEROUS':
|
||||
cost *= 2
|
||||
if pinned == 'STRONGHOLD':
|
||||
cost = 200
|
||||
|
||||
return cost
|
||||
|
||||
|
||||
@@ -18,13 +18,17 @@ GET_MEOWFFICER_ITEMS_1 = Button(area={'cn': (558, 211, 730, 242), 'en': (550, 21
|
||||
GET_MEOWFFICER_ITEMS_2 = Button(area={'cn': (558, 140, 730, 171), 'en': (550, 140, 723, 176), 'jp': (538, 146, 731, 182), 'tw': (558, 140, 730, 171)}, color={'cn': (186, 200, 231), 'en': (165, 191, 242), 'jp': (143, 179, 249), 'tw': (186, 200, 231)}, button={'cn': (558, 140, 730, 171), 'en': (550, 140, 723, 176), 'jp': (538, 146, 731, 182), 'tw': (558, 140, 730, 171)}, file={'cn': './assets/cn/os_handler/GET_MEOWFFICER_ITEMS_2.png', 'en': './assets/en/os_handler/GET_MEOWFFICER_ITEMS_2.png', 'jp': './assets/jp/os_handler/GET_MEOWFFICER_ITEMS_2.png', 'tw': './assets/tw/os_handler/GET_MEOWFFICER_ITEMS_2.png'})
|
||||
IN_MAP = Button(area={'cn': (921, 640, 1023, 695), 'en': (921, 640, 1023, 695), 'jp': (918, 637, 1026, 698), 'tw': (936, 638, 1037, 697)}, color={'cn': (240, 194, 115), 'en': (239, 192, 110), 'jp': (236, 192, 111), 'tw': (239, 192, 111)}, button={'cn': (921, 640, 1023, 695), 'en': (921, 640, 1023, 695), 'jp': (918, 637, 1026, 698), 'tw': (936, 638, 1037, 697)}, file={'cn': './assets/cn/os_handler/IN_MAP.png', 'en': './assets/en/os_handler/IN_MAP.png', 'jp': './assets/jp/os_handler/IN_MAP.png', 'tw': './assets/tw/os_handler/IN_MAP.png'})
|
||||
MAP_ARCHIVES = Button(area={'cn': (1180, 353, 1280, 411), 'en': (1212, 353, 1280, 411), 'jp': (1180, 353, 1280, 411), 'tw': (1180, 353, 1280, 411)}, color={'cn': (134, 255, 255), 'en': (135, 255, 255), 'jp': (134, 255, 255), 'tw': (134, 255, 255)}, button={'cn': (1180, 353, 1280, 411), 'en': (1212, 353, 1280, 411), 'jp': (1180, 353, 1280, 411), 'tw': (1180, 353, 1280, 411)}, file={'cn': './assets/cn/os_handler/MAP_ARCHIVES.png', 'en': './assets/en/os_handler/MAP_ARCHIVES.png', 'jp': './assets/jp/os_handler/MAP_ARCHIVES.png', 'tw': './assets/tw/os_handler/MAP_ARCHIVES.png'})
|
||||
MAP_WORLD = Button(area={'cn': (578, 675, 702, 691), 'en': (583, 677, 691, 694), 'jp': (586, 676, 693, 694), 'tw': (583, 677, 691, 694)}, color={'cn': (83, 81, 79), 'en': (67, 85, 108), 'jp': (64, 68, 76), 'tw': (67, 85, 108)}, button={'cn': (578, 675, 702, 691), 'en': (583, 677, 691, 694), 'jp': (586, 676, 693, 694), 'tw': (583, 677, 691, 694)}, file={'cn': './assets/cn/os_handler/MAP_WORLD.png', 'en': './assets/en/os_handler/MAP_WORLD.png', 'jp': './assets/jp/os_handler/MAP_WORLD.png', 'tw': './assets/tw/os_handler/MAP_WORLD.png'})
|
||||
MAP_WORLD = Button(area={'cn': (943, 499, 1048, 512), 'en': (943, 499, 1048, 512), 'jp': (943, 499, 1048, 512), 'tw': (943, 499, 1048, 512)}, color={'cn': (71, 74, 83), 'en': (71, 74, 83), 'jp': (71, 74, 83), 'tw': (71, 74, 83)}, button={'cn': (578, 675, 702, 691), 'en': (578, 675, 702, 691), 'jp': (578, 675, 702, 691), 'tw': (578, 675, 702, 691)}, file={'cn': './assets/cn/os_handler/MAP_WORLD.png', 'en': './assets/en/os_handler/MAP_WORLD.png', 'jp': './assets/jp/os_handler/MAP_WORLD.png', 'tw': './assets/tw/os_handler/MAP_WORLD.png'})
|
||||
MISSION_CHECK = Button(area={'cn': (120, 122, 229, 148), 'en': (120, 125, 323, 147), 'jp': (119, 121, 230, 148), 'tw': (120, 122, 229, 148)}, color={'cn': (145, 153, 187), 'en': (139, 148, 184), 'jp': (131, 142, 180), 'tw': (145, 153, 187)}, button={'cn': (120, 122, 229, 148), 'en': (120, 125, 323, 147), 'jp': (119, 121, 230, 148), 'tw': (120, 122, 229, 148)}, file={'cn': './assets/cn/os_handler/MISSION_CHECK.png', 'en': './assets/en/os_handler/MISSION_CHECK.png', 'jp': './assets/jp/os_handler/MISSION_CHECK.png', 'tw': './assets/cn/os_handler/MISSION_CHECK.png'})
|
||||
MISSION_CHECKOUT = Button(area={'cn': (1026, 204, 1114, 234), 'en': (1029, 205, 1112, 232), 'jp': (1026, 204, 1114, 234), 'tw': (1026, 204, 1114, 234)}, color={'cn': (152, 153, 156), 'en': (153, 154, 158), 'jp': (157, 158, 161), 'tw': (152, 153, 156)}, button={'cn': (1026, 204, 1114, 234), 'en': (1029, 205, 1112, 232), 'jp': (1026, 204, 1114, 234), 'tw': (1026, 204, 1114, 234)}, file={'cn': './assets/cn/os_handler/MISSION_CHECKOUT.png', 'en': './assets/en/os_handler/MISSION_CHECKOUT.png', 'jp': './assets/jp/os_handler/MISSION_CHECKOUT.png', 'tw': './assets/cn/os_handler/MISSION_CHECKOUT.png'})
|
||||
MISSION_ENTER = Button(area={'cn': (767, 639, 853, 695), 'en': (767, 640, 824, 695), 'jp': (770, 644, 833, 696), 'tw': (767, 639, 853, 695)}, color={'cn': (230, 185, 113), 'en': (234, 184, 112), 'jp': (238, 195, 137), 'tw': (230, 185, 113)}, button={'cn': (767, 639, 853, 695), 'en': (767, 640, 824, 695), 'jp': (770, 644, 833, 696), 'tw': (767, 639, 853, 695)}, file={'cn': './assets/cn/os_handler/MISSION_ENTER.png', 'en': './assets/en/os_handler/MISSION_ENTER.png', 'jp': './assets/jp/os_handler/MISSION_ENTER.png', 'tw': './assets/cn/os_handler/MISSION_ENTER.png'})
|
||||
MISSION_FINISH = Button(area={'cn': (1028, 205, 1112, 232), 'en': (1029, 205, 1112, 232), 'jp': (1026, 204, 1114, 234), 'tw': (1028, 205, 1112, 232)}, color={'cn': (79, 128, 191), 'en': (84, 132, 193), 'jp': (91, 137, 196), 'tw': (79, 128, 191)}, button={'cn': (1028, 205, 1112, 232), 'en': (1029, 205, 1112, 232), 'jp': (1026, 204, 1114, 234), 'tw': (1028, 205, 1112, 232)}, file={'cn': './assets/cn/os_handler/MISSION_FINISH.png', 'en': './assets/en/os_handler/MISSION_FINISH.png', 'jp': './assets/jp/os_handler/MISSION_FINISH.png', 'tw': './assets/cn/os_handler/MISSION_FINISH.png'})
|
||||
MISSION_MAP_CHECK = Button(area={'cn': (943, 499, 1048, 512), 'en': (943, 499, 1048, 512), 'jp': (943, 499, 1048, 512), 'tw': (943, 499, 1048, 512)}, color={'cn': (71, 74, 83), 'en': (71, 74, 83), 'jp': (71, 74, 83), 'tw': (71, 74, 83)}, button={'cn': (943, 499, 1048, 512), 'en': (943, 499, 1048, 512), 'jp': (943, 499, 1048, 512), 'tw': (943, 499, 1048, 512)}, file={'cn': './assets/cn/os_handler/MISSION_MAP_CHECK.png', 'en': './assets/en/os_handler/MISSION_MAP_CHECK.png', 'jp': './assets/jp/os_handler/MISSION_MAP_CHECK.png', 'tw': './assets/tw/os_handler/MISSION_MAP_CHECK.png'})
|
||||
MISSION_QUIT = Button(area={'cn': (1086, 111, 1152, 155), 'en': (1086, 111, 1152, 155), 'jp': (1086, 111, 1152, 155), 'tw': (1086, 111, 1152, 155)}, color={'cn': (152, 38, 35), 'en': (152, 38, 35), 'jp': (152, 38, 35), 'tw': (152, 38, 35)}, button={'cn': (1086, 111, 1152, 155), 'en': (1086, 111, 1152, 155), 'jp': (1086, 111, 1152, 155), 'tw': (1086, 111, 1152, 155)}, file={'cn': './assets/cn/os_handler/MISSION_QUIT.png', 'en': './assets/en/os_handler/MISSION_QUIT.png', 'jp': './assets/jp/os_handler/MISSION_QUIT.png', 'tw': './assets/tw/os_handler/MISSION_QUIT.png'})
|
||||
ORDER_CHECK = Button(area={'cn': (106, 77, 224, 94), 'en': (106, 77, 224, 94), 'jp': (106, 77, 224, 94), 'tw': (106, 77, 224, 94)}, color={'cn': (141, 123, 71), 'en': (141, 123, 71), 'jp': (141, 123, 71), 'tw': (141, 123, 71)}, button={'cn': (106, 77, 224, 94), 'en': (106, 77, 224, 94), 'jp': (106, 77, 224, 94), 'tw': (106, 77, 224, 94)}, file={'cn': './assets/cn/os_handler/ORDER_CHECK.png', 'en': './assets/cn/os_handler/ORDER_CHECK.png', 'jp': './assets/cn/os_handler/ORDER_CHECK.png', 'tw': './assets/cn/os_handler/ORDER_CHECK.png'})
|
||||
ORDER_ENTER = Button(area={'cn': (1012, 165, 1044, 194), 'en': (1012, 165, 1044, 194), 'jp': (1012, 165, 1044, 194), 'tw': (1012, 165, 1044, 194)}, color={'cn': (95, 114, 137), 'en': (95, 114, 137), 'jp': (95, 114, 137), 'tw': (95, 114, 137)}, button={'cn': (1012, 165, 1044, 194), 'en': (1012, 165, 1044, 194), 'jp': (1012, 165, 1044, 194), 'tw': (1012, 165, 1044, 194)}, file={'cn': './assets/cn/os_handler/ORDER_ENTER.png', 'en': './assets/cn/os_handler/ORDER_ENTER.png', 'jp': './assets/cn/os_handler/ORDER_ENTER.png', 'tw': './assets/cn/os_handler/ORDER_ENTER.png'})
|
||||
ORDER_SCAN = Button(area={'cn': (920, 375, 1220, 471), 'en': (920, 375, 1220, 471), 'jp': (920, 375, 1220, 471), 'tw': (920, 375, 1220, 471)}, color={'cn': (89, 129, 195), 'en': (89, 129, 195), 'jp': (89, 129, 195), 'tw': (89, 129, 195)}, button={'cn': (920, 375, 1220, 471), 'en': (920, 375, 1220, 471), 'jp': (920, 375, 1220, 471), 'tw': (920, 375, 1220, 471)}, file={'cn': './assets/cn/os_handler/ORDER_SCAN.png', 'en': './assets/cn/os_handler/ORDER_SCAN.png', 'jp': './assets/cn/os_handler/ORDER_SCAN.png', 'tw': './assets/cn/os_handler/ORDER_SCAN.png'})
|
||||
ORDER_SUBMARINE = Button(area={'cn': (920, 502, 1220, 598), 'en': (920, 502, 1220, 598), 'jp': (920, 502, 1220, 598), 'tw': (920, 502, 1220, 598)}, color={'cn': (85, 124, 190), 'en': (85, 124, 190), 'jp': (85, 124, 190), 'tw': (85, 124, 190)}, button={'cn': (920, 502, 1220, 598), 'en': (920, 502, 1220, 598), 'jp': (920, 502, 1220, 598), 'tw': (920, 502, 1220, 598)}, file={'cn': './assets/cn/os_handler/ORDER_SUBMARINE.png', 'en': './assets/cn/os_handler/ORDER_SUBMARINE.png', 'jp': './assets/cn/os_handler/ORDER_SUBMARINE.png', 'tw': './assets/cn/os_handler/ORDER_SUBMARINE.png'})
|
||||
PORT_DOCK_CHECK = Button(area={'cn': (182, 645, 364, 697), 'en': (182, 645, 364, 696), 'jp': (178, 641, 368, 700), 'tw': (182, 645, 364, 697)}, color={'cn': (125, 179, 242), 'en': (119, 176, 241), 'jp': (117, 175, 241), 'tw': (125, 179, 242)}, button={'cn': (182, 645, 364, 697), 'en': (182, 645, 364, 696), 'jp': (178, 641, 368, 700), 'tw': (182, 645, 364, 697)}, file={'cn': './assets/cn/os_handler/PORT_DOCK_CHECK.png', 'en': './assets/en/os_handler/PORT_DOCK_CHECK.png', 'jp': './assets/jp/os_handler/PORT_DOCK_CHECK.png', 'tw': './assets/cn/os_handler/PORT_DOCK_CHECK.png'})
|
||||
PORT_ENTER = Button(area={'cn': (1148, 640, 1280, 698), 'en': (1148, 637, 1280, 699), 'jp': (1147, 637, 1280, 699), 'tw': (1148, 640, 1280, 698)}, color={'cn': (47, 55, 66), 'en': (37, 49, 64), 'jp': (45, 61, 79), 'tw': (47, 55, 66)}, button={'cn': (1148, 640, 1280, 698), 'en': (1148, 637, 1280, 699), 'jp': (1147, 637, 1280, 699), 'tw': (1148, 640, 1280, 698)}, file={'cn': './assets/cn/os_handler/PORT_ENTER.png', 'en': './assets/en/os_handler/PORT_ENTER.png', 'jp': './assets/jp/os_handler/PORT_ENTER.png', 'tw': './assets/cn/os_handler/PORT_ENTER.png'})
|
||||
PORT_GOTO_DOCK = Button(area={'cn': (1069, 640, 1260, 695), 'en': (1068, 640, 1261, 694), 'jp': (1130, 639, 1264, 697), 'tw': (1069, 640, 1260, 695)}, color={'cn': (114, 171, 236), 'en': (119, 173, 237), 'jp': (114, 180, 243), 'tw': (114, 171, 236)}, button={'cn': (1069, 640, 1260, 695), 'en': (1068, 640, 1261, 694), 'jp': (1130, 639, 1264, 697), 'tw': (1069, 640, 1260, 695)}, file={'cn': './assets/cn/os_handler/PORT_GOTO_DOCK.png', 'en': './assets/en/os_handler/PORT_GOTO_DOCK.png', 'jp': './assets/jp/os_handler/PORT_GOTO_DOCK.png', 'tw': './assets/cn/os_handler/PORT_GOTO_DOCK.png'})
|
||||
@@ -37,3 +41,10 @@ PORT_SUPPLY_CHECK = Button(area={'cn': (127, 16, 180, 41), 'en': (127, 15, 264,
|
||||
SHOP_BUY_CONFIRM = Button(area={'cn': (704, 483, 876, 540), 'en': (708, 484, 875, 538), 'jp': (704, 482, 876, 541), 'tw': (704, 483, 876, 540)}, color={'cn': (93, 142, 204), 'en': (106, 151, 207), 'jp': (91, 141, 203), 'tw': (93, 142, 204)}, button={'cn': (704, 483, 876, 540), 'en': (708, 484, 875, 538), 'jp': (704, 482, 876, 541), 'tw': (704, 483, 876, 540)}, file={'cn': './assets/cn/os_handler/SHOP_BUY_CONFIRM.png', 'en': './assets/en/os_handler/SHOP_BUY_CONFIRM.png', 'jp': './assets/jp/os_handler/SHOP_BUY_CONFIRM.png', 'tw': './assets/cn/os_handler/SHOP_BUY_CONFIRM.png'})
|
||||
SHOP_PURPLE_COINS = Button(area={'cn': (325, 110, 415, 133), 'en': (379, 106, 489, 137), 'jp': (348, 110, 415, 133), 'tw': (325, 110, 415, 133)}, color={'cn': (97, 100, 108), 'en': (102, 107, 118), 'jp': (125, 128, 140), 'tw': (97, 100, 108)}, button={'cn': (325, 110, 415, 133), 'en': (379, 106, 489, 137), 'jp': (348, 110, 415, 133), 'tw': (325, 110, 415, 133)}, file={'cn': './assets/cn/os_handler/SHOP_PURPLE_COINS.png', 'en': './assets/en/os_handler/SHOP_PURPLE_COINS.png', 'jp': './assets/jp/os_handler/SHOP_PURPLE_COINS.png', 'tw': './assets/cn/os_handler/SHOP_PURPLE_COINS.png'})
|
||||
SHOP_YELLOW_COINS = Button(area={'cn': (1038, 27, 1128, 48), 'en': (1038, 27, 1128, 48), 'jp': (1038, 27, 1128, 48), 'tw': (1038, 27, 1128, 48)}, color={'cn': (71, 74, 76), 'en': (71, 74, 76), 'jp': (71, 74, 76), 'tw': (71, 74, 76)}, button={'cn': (1038, 27, 1128, 48), 'en': (1038, 27, 1128, 48), 'jp': (1038, 27, 1128, 48), 'tw': (1038, 27, 1128, 48)}, file={'cn': './assets/cn/os_handler/SHOP_YELLOW_COINS.png', 'en': './assets/en/os_handler/SHOP_YELLOW_COINS.png', 'jp': './assets/jp/os_handler/SHOP_YELLOW_COINS.png', 'tw': './assets/tw/os_handler/SHOP_YELLOW_COINS.png'})
|
||||
STORAGE_CHECK = Button(area={'cn': (122, 15, 203, 40), 'en': (122, 15, 203, 40), 'jp': (122, 15, 203, 40), 'tw': (122, 15, 203, 40)}, color={'cn': (162, 178, 214), 'en': (162, 178, 214), 'jp': (162, 178, 214), 'tw': (162, 178, 214)}, button={'cn': (122, 15, 203, 40), 'en': (122, 15, 203, 40), 'jp': (122, 15, 203, 40), 'tw': (122, 15, 203, 40)}, file={'cn': './assets/cn/os_handler/STORAGE_CHECK.png', 'en': './assets/cn/os_handler/STORAGE_CHECK.png', 'jp': './assets/cn/os_handler/STORAGE_CHECK.png', 'tw': './assets/cn/os_handler/STORAGE_CHECK.png'})
|
||||
STORAGE_COORDINATE_CHECKOUT = Button(area={'cn': (554, 493, 726, 550), 'en': (554, 493, 726, 550), 'jp': (554, 493, 726, 550), 'tw': (554, 493, 726, 550)}, color={'cn': (92, 141, 203), 'en': (92, 141, 203), 'jp': (92, 141, 203), 'tw': (92, 141, 203)}, button={'cn': (554, 493, 726, 550), 'en': (554, 493, 726, 550), 'jp': (554, 493, 726, 550), 'tw': (554, 493, 726, 550)}, file={'cn': './assets/cn/os_handler/STORAGE_COORDINATE_CHECKOUT.png', 'en': './assets/cn/os_handler/STORAGE_COORDINATE_CHECKOUT.png', 'jp': './assets/cn/os_handler/STORAGE_COORDINATE_CHECKOUT.png', 'tw': './assets/cn/os_handler/STORAGE_COORDINATE_CHECKOUT.png'})
|
||||
STORAGE_ENTER = Button(area={'cn': (770, 636, 880, 699), 'en': (770, 636, 880, 699), 'jp': (770, 636, 880, 699), 'tw': (770, 636, 880, 699)}, color={'cn': (240, 199, 121), 'en': (240, 199, 121), 'jp': (240, 199, 121), 'tw': (240, 199, 121)}, button={'cn': (770, 636, 880, 699), 'en': (770, 636, 880, 699), 'jp': (770, 636, 880, 699), 'tw': (770, 636, 880, 699)}, file={'cn': './assets/cn/os_handler/STORAGE_ENTER.png', 'en': './assets/cn/os_handler/STORAGE_ENTER.png', 'jp': './assets/cn/os_handler/STORAGE_ENTER.png', 'tw': './assets/cn/os_handler/STORAGE_ENTER.png'})
|
||||
STORAGE_USE = Button(area={'cn': (709, 506, 769, 536), 'en': (709, 506, 769, 536), 'jp': (709, 506, 769, 536), 'tw': (709, 506, 769, 536)}, color={'cn': (161, 186, 220), 'en': (161, 186, 220), 'jp': (161, 186, 220), 'tw': (161, 186, 220)}, button={'cn': (687, 493, 860, 550), 'en': (687, 493, 860, 550), 'jp': (687, 493, 860, 550), 'tw': (687, 493, 860, 550)}, file={'cn': './assets/cn/os_handler/STORAGE_USE.png', 'en': './assets/cn/os_handler/STORAGE_USE.png', 'jp': './assets/cn/os_handler/STORAGE_USE.png', 'tw': './assets/cn/os_handler/STORAGE_USE.png'})
|
||||
STORATE_SCROLL = Button(area={'cn': (1256, 102, 1264, 589), 'en': (1256, 102, 1264, 589), 'jp': (1256, 102, 1264, 589), 'tw': (1256, 102, 1264, 589)}, color={'cn': (119, 109, 60), 'en': (119, 109, 60), 'jp': (119, 109, 60), 'tw': (119, 109, 60)}, button={'cn': (1256, 102, 1264, 589), 'en': (1256, 102, 1264, 589), 'jp': (1256, 102, 1264, 589), 'tw': (1256, 102, 1264, 589)}, file={'cn': './assets/cn/os_handler/STORATE_SCROLL.png', 'en': './assets/en/os_handler/STORATE_SCROLL.png', 'jp': './assets/jp/os_handler/STORATE_SCROLL.png', 'tw': './assets/tw/os_handler/STORATE_SCROLL.png'})
|
||||
TEMPLATE_STORAGE_LOGGER = Template(file={'cn': './assets/cn/os_handler/TEMPLATE_STORAGE_LOGGER.png', 'en': './assets/en/os_handler/TEMPLATE_STORAGE_LOGGER.png', 'jp': './assets/jp/os_handler/TEMPLATE_STORAGE_LOGGER.png', 'tw': './assets/tw/os_handler/TEMPLATE_STORAGE_LOGGER.png'})
|
||||
TEMPLATE_STORAGE_OBSCURED = Template(file={'cn': './assets/cn/os_handler/TEMPLATE_STORAGE_OBSCURED.png', 'en': './assets/en/os_handler/TEMPLATE_STORAGE_OBSCURED.png', 'jp': './assets/jp/os_handler/TEMPLATE_STORAGE_OBSCURED.png', 'tw': './assets/tw/os_handler/TEMPLATE_STORAGE_OBSCURED.png'})
|
||||
|
||||
108
module/os_handler/map_order.py
Normal file
108
module/os_handler/map_order.py
Normal file
@@ -0,0 +1,108 @@
|
||||
from module.base.timer import Timer
|
||||
from module.logger import logger
|
||||
from module.map.map_operation import MapOperation
|
||||
from module.os.globe_zone import ZoneManager
|
||||
from module.os_handler.action_point import ActionPointHandler
|
||||
from module.os_handler.assets import *
|
||||
from module.os_handler.enemy_searching import EnemySearchingHandler
|
||||
|
||||
|
||||
class MapOrderHandler(MapOperation, ActionPointHandler, EnemySearchingHandler, ZoneManager):
|
||||
def is_in_map_order(self):
|
||||
return self.appear(ORDER_CHECK, offset=(20, 20))
|
||||
|
||||
def order_enter(self):
|
||||
"""
|
||||
Pages:
|
||||
in: is_in_map
|
||||
out: is_in_map_order
|
||||
"""
|
||||
self.ui_click(ORDER_ENTER, appear_button=self.is_in_map, check_button=self.is_in_map_order,
|
||||
skip_first_screenshot=True)
|
||||
|
||||
def order_quit(self):
|
||||
"""
|
||||
Pages:
|
||||
in: is_in_map_order
|
||||
out: is_in_map
|
||||
"""
|
||||
self.ui_click(ORDER_CHECK, appear_button=self.is_in_map_order, check_button=self.is_in_map,
|
||||
skip_first_screenshot=True)
|
||||
|
||||
def order_execute(self, button, skip_first_screenshot=True):
|
||||
"""
|
||||
Args:
|
||||
button (Button): A button in navigational order page.
|
||||
skip_first_screenshot (bool):
|
||||
|
||||
Returns:
|
||||
bool: If success
|
||||
|
||||
Pages:
|
||||
in: is_in_map
|
||||
out: is_in_map
|
||||
"""
|
||||
logger.hr(button)
|
||||
self.order_enter()
|
||||
|
||||
missing_timer = Timer(1, count=3).start()
|
||||
confirm_timer = Timer(1.2, count=4)
|
||||
assume_zone = self.name_to_zone(11)
|
||||
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
# End
|
||||
if self.is_in_map():
|
||||
if confirm_timer.reached():
|
||||
return True
|
||||
else:
|
||||
confirm_timer.reset()
|
||||
|
||||
if self.is_in_map_order():
|
||||
if not self.appear(button):
|
||||
if missing_timer.reached():
|
||||
logger.info(f'Map order not available: {button}')
|
||||
self.order_quit()
|
||||
return False
|
||||
else:
|
||||
missing_timer.reset()
|
||||
|
||||
if self.appear_then_click(button, interval=3):
|
||||
continue
|
||||
if self.handle_popup_confirm(button.name):
|
||||
continue
|
||||
if self.handle_map_cat_attack():
|
||||
continue
|
||||
if self.handle_action_point(zone=assume_zone, pinned='OBSCURE'):
|
||||
continue
|
||||
|
||||
def os_order_execute(self, recon_scan=True, submarine_call=True):
|
||||
"""
|
||||
Do navigational orders.
|
||||
|
||||
Note that,
|
||||
A recon_scan needs 30min to cool down, and a submarine_call needs 60min.
|
||||
This method will force to use AP boxes.
|
||||
If an order is still in CD, it will cost extra AP.
|
||||
A recon_scan needs 10 AP at max, and a submarine_call needs 39 AP at max.
|
||||
|
||||
Args:
|
||||
recon_scan (bool): If do recon scan
|
||||
submarine_call (bool): If do submarine call
|
||||
|
||||
Pages:
|
||||
in: is_in_map
|
||||
out: is_in_map
|
||||
"""
|
||||
backup = self.config.cover(OS_ACTION_POINT_PRESERVE=0, OS_ACTION_POINT_BOX_USE=True)
|
||||
|
||||
if recon_scan:
|
||||
self.order_execute(ORDER_SCAN)
|
||||
if submarine_call:
|
||||
self.order_execute(ORDER_SUBMARINE)
|
||||
|
||||
backup.recover()
|
||||
173
module/os_handler/storage.py
Normal file
173
module/os_handler/storage.py
Normal file
@@ -0,0 +1,173 @@
|
||||
import numpy as np
|
||||
|
||||
from module.base.utils import rgb2gray
|
||||
from module.combat.assets import GET_ITEMS_1, GET_ITEMS_2
|
||||
from module.logger import logger
|
||||
from module.os.globe_operation import GlobeOperation
|
||||
from module.os.globe_zone import ZoneManager
|
||||
from module.os_handler.assets import *
|
||||
from module.ui.scroll import Scroll
|
||||
|
||||
SCROLL_STORAGE = Scroll(STORATE_SCROLL, color=(247, 211, 66))
|
||||
|
||||
|
||||
class StorageHandler(GlobeOperation, ZoneManager):
|
||||
def storage_enter(self):
|
||||
"""
|
||||
Pages:
|
||||
in: is_in_map, STORAGE_ENTER
|
||||
out: STORAGE_CHECK
|
||||
"""
|
||||
self.ui_click(STORAGE_ENTER, check_button=STORAGE_CHECK, offset=(200, 5), skip_first_screenshot=True)
|
||||
self.handle_info_bar()
|
||||
|
||||
def storage_quit(self):
|
||||
"""
|
||||
Pages:
|
||||
in: STORAGE_CHECK
|
||||
out: is_in_map
|
||||
"""
|
||||
self.ui_back(STORAGE_ENTER, offset=(200, 5), skip_first_screenshot=True)
|
||||
|
||||
def _storage_logger_use(self, button, skip_first_screenshot=True):
|
||||
"""
|
||||
Args:
|
||||
button (Button): Item
|
||||
skip_first_screenshot (bool):
|
||||
|
||||
Pages:
|
||||
in: STORAGE_CHECK
|
||||
out: STORAGE_CHECK
|
||||
"""
|
||||
success = False
|
||||
self.interval_clear(STORAGE_CHECK)
|
||||
self.interval_clear(STORAGE_USE)
|
||||
self.interval_clear(GET_ITEMS_1)
|
||||
self.interval_clear(GET_ITEMS_2)
|
||||
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
if self.appear(STORAGE_CHECK, offset=(20, 20), interval=3):
|
||||
self.device.click(button)
|
||||
continue
|
||||
if self.appear_then_click(STORAGE_USE, offset=(180, 30), interval=3):
|
||||
continue
|
||||
if self.appear_then_click(GET_ITEMS_1, interval=3):
|
||||
success = True
|
||||
continue
|
||||
if self.appear_then_click(GET_ITEMS_2, interval=3):
|
||||
success = True
|
||||
continue
|
||||
|
||||
# End
|
||||
if success and self.appear(STORAGE_CHECK, offset=(20, 20)):
|
||||
break
|
||||
|
||||
def storage_logger_use_all(self, skip_first_screenshot=True):
|
||||
"""
|
||||
Args:
|
||||
skip_first_screenshot:
|
||||
|
||||
Pages:
|
||||
in: STORAGE_CHECK
|
||||
out: STORAGE_CHECK, scroll to bottom
|
||||
"""
|
||||
logger.hr('Storage logger use all')
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
if SCROLL_STORAGE.appear(main=self):
|
||||
SCROLL_STORAGE.set_bottom(main=self, skip_first_screenshot=True)
|
||||
|
||||
image = rgb2gray(np.array(self.device.image))
|
||||
items = TEMPLATE_STORAGE_LOGGER.match_multi(image, similarity=0.5)
|
||||
logger.attr('Storage_logger', len(items))
|
||||
|
||||
if len(items):
|
||||
self._storage_logger_use(items[0])
|
||||
continue
|
||||
else:
|
||||
logger.info('All loggers in storage have been used')
|
||||
break
|
||||
|
||||
def _storage_checkout(self, button, skip_first_screenshot=True):
|
||||
"""
|
||||
Args:
|
||||
button (Button): Item
|
||||
skip_first_screenshot (bool):
|
||||
|
||||
Pages:
|
||||
in: STORAGE_CHECK
|
||||
out: is_in_map, in an obscured zone.
|
||||
"""
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
if self.appear(STORAGE_CHECK, offset=(30, 30), interval=3):
|
||||
self.device.click(button)
|
||||
if self.appear_then_click(STORAGE_COORDINATE_CHECKOUT, offset=(30, 30), interval=3):
|
||||
continue
|
||||
if self.is_zone_pinned():
|
||||
break
|
||||
|
||||
self.zone_type_select('OBSCURE')
|
||||
self.globe_enter(zone=self.name_to_zone(72))
|
||||
|
||||
def storage_checkout_obscure(self, skip_first_screenshot=True):
|
||||
"""
|
||||
Args:
|
||||
skip_first_screenshot:
|
||||
|
||||
Returns:
|
||||
bool: If checkout
|
||||
|
||||
Pages:
|
||||
in: STORAGE_CHECK
|
||||
out: is_in_map, in an obscured zone if checkout.
|
||||
is_in_map, in previous zone if no more obscured coordinates.
|
||||
"""
|
||||
logger.hr('Storage checkout obscured')
|
||||
if SCROLL_STORAGE.appear(main=self):
|
||||
SCROLL_STORAGE.set_top(main=self, skip_first_screenshot=skip_first_screenshot)
|
||||
|
||||
image = rgb2gray(np.array(self.device.image))
|
||||
items = TEMPLATE_STORAGE_OBSCURED.match_multi(image, similarity=0.75)
|
||||
logger.attr('Storage_obscured', len(items))
|
||||
|
||||
if not len(items):
|
||||
logger.info('No more obscured coordinates in storage')
|
||||
self.storage_quit()
|
||||
return False
|
||||
|
||||
self._storage_checkout(items[0])
|
||||
return True
|
||||
|
||||
def os_get_next_obscure(self, use_logger=True):
|
||||
"""
|
||||
Args:
|
||||
use_logger: If use all loggers.
|
||||
|
||||
Returns:
|
||||
bool: If checkout
|
||||
|
||||
Pages:
|
||||
in: in_map
|
||||
out: is_in_map, in an obscured zone if checkout.
|
||||
is_in_map, in previous zone if no more obscured coordinates.
|
||||
"""
|
||||
logger.hr('OS get next obscure')
|
||||
self.storage_enter()
|
||||
if use_logger:
|
||||
self.storage_logger_use_all()
|
||||
result = self.storage_checkout_obscure()
|
||||
return result
|
||||
Reference in New Issue
Block a user