diff --git a/alas.py b/alas.py index b63953474..29f729d55 100644 --- a/alas.py +++ b/alas.py @@ -931,6 +931,11 @@ class AzurLaneAutoScript(AzurLaneAutoScript): from module.shop_event.shop_event import EventShop EventShop(config=self.config, device=self.device).run() + @disable_all_crack + def raid_scuttle(self): + from module.raid.scuttle import RaidScuttleRun + RaidScuttleRun(config=self.config, device=self.device).run() + def hook_op(self): op = self.config.full_config.HookOp_HookOp_Operation if op == "detect": diff --git a/assets/cn/raid/my_RAID_FLEET_FLAGSHIP.png b/assets/cn/raid/my_RAID_FLEET_FLAGSHIP.png new file mode 100644 index 000000000..e52b21328 Binary files /dev/null and b/assets/cn/raid/my_RAID_FLEET_FLAGSHIP.png differ diff --git a/assets/cn/raid/my_RAID_FLEET_VANGUARD.png b/assets/cn/raid/my_RAID_FLEET_VANGUARD.png new file mode 100644 index 000000000..ca40b01a3 Binary files /dev/null and b/assets/cn/raid/my_RAID_FLEET_VANGUARD.png differ diff --git a/config/template.json b/config/template.json index 834a99dba..c3d859d2f 100644 --- a/config/template.json +++ b/config/template.json @@ -1288,6 +1288,74 @@ "Storage": {} } }, + "RaidScuttle": { + "Scheduler": { + "Enable": false, + "NextRun": "2020-01-01 00:00:00", + "Command": "RaidScuttle", + "SuccessInterval": 0, + "FailureInterval": 120, + "ServerUpdate": "00:00" + }, + "RaidScuttle": { + "Sacrifice": "vanguard" + }, + "Raid": { + "Mode": "hard", + "UseTicket": false + }, + "Campaign": { + "Name": "dynamic", + "Event": "campaign_main", + "Mode": "normal", + "UseClearMode": true, + "UseFleetLock": true, + "UseAutoSearch": false, + "Use2xBook": false, + "AmbushEvade": true + }, + "StopCondition": { + "OilLimit": 1000, + "RunCount": 0, + "MapAchievement": "non_stop", + "StageIncrease": false, + "GetNewShip": false, + "ReachLevel": 0 + }, + "Fleet": { + "Fleet1": 1, + "Fleet1Formation": "double_line", + "Fleet1Mode": "combat_manual", + "Fleet1Step": 3, + "Fleet2": 2, + "Fleet2Formation": "double_line", + "Fleet2Mode": "combat_auto", + "Fleet2Step": 3, + "FleetOrder": "fleet1_all_fleet2_standby" + }, + "Submarine": { + "Fleet": 0, + "Mode": "do_not_use", + "AutoSearchMode": "sub_standby", + "DistanceToBoss": "2_grid_to_boss" + }, + "Emotion": { + "Mode": "calculate", + "Fleet1Value": 119, + "Fleet1Record": "2020-01-01 00:00:00", + "Fleet1Control": "prevent_yellow_face", + "Fleet1Recover": "not_in_dormitory", + "Fleet1Oath": false, + "Fleet2Value": 119, + "Fleet2Record": "2020-01-01 00:00:00", + "Fleet2Control": "prevent_yellow_face", + "Fleet2Recover": "not_in_dormitory", + "Fleet2Oath": false + }, + "Storage": { + "Storage": {} + } + }, "Hospital": { "Scheduler": { "Enable": false, diff --git a/module/config/argument/args.json b/module/config/argument/args.json index 1e2c57495..1cadb9876 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -8884,6 +8884,450 @@ } } }, + "RaidScuttle": { + "Scheduler": { + "Enable": { + "type": "checkbox", + "value": false, + "option": [ + true, + false + ] + }, + "NextRun": { + "type": "datetime", + "value": "2020-01-01 00:00:00", + "validate": "datetime" + }, + "Command": { + "type": "input", + "value": "RaidScuttle", + "display": "hide" + }, + "SuccessInterval": { + "type": "input", + "value": 0, + "display": "hide" + }, + "FailureInterval": { + "type": "input", + "value": 120, + "display": "hide" + }, + "ServerUpdate": { + "type": "input", + "value": "00:00", + "display": "hide" + } + }, + "RaidScuttle": { + "Sacrifice": { + "type": "select", + "value": "vanguard", + "option": [ + "vanguard", + "flagship" + ] + } + }, + "Raid": { + "Mode": { + "type": "select", + "value": "hard", + "option": [ + "easy", + "normal", + "hard", + "ex" + ] + }, + "UseTicket": { + "type": "checkbox", + "value": false + } + }, + "Campaign": { + "Name": { + "type": "input", + "value": "dynamic", + "display": "hide" + }, + "Event": { + "type": "state", + "value": "campaign_main", + "option": [ + "raid_20200624", + "raid_20210708", + "raid_20220127", + "raid_20220630", + "raid_20221027", + "raid_20230118", + "raid_20230629", + "raid_20240130", + "raid_20240328", + "raid_20250116", + "raid_20260212" + ], + "option_cn": [ + "raid_20260212", + "raid_20240328", + "raid_20250116", + "raid_20240130", + "raid_20230629", + "raid_20230118", + "raid_20221027", + "raid_20220630", + "raid_20220127", + "raid_20210708", + "raid_20200624" + ], + "option_en": [ + "raid_20260212", + "raid_20240328", + "raid_20250116", + "raid_20240130", + "raid_20230629", + "raid_20230118", + "raid_20221027", + "raid_20220630", + "raid_20220127", + "raid_20210708", + "raid_20200624" + ], + "option_jp": [ + "raid_20260212", + "raid_20240328", + "raid_20250116", + "raid_20240130", + "raid_20230629", + "raid_20230118", + "raid_20221027", + "raid_20220630", + "raid_20220127", + "raid_20210708", + "raid_20200624" + ], + "option_tw": [ + "raid_20260212", + "raid_20250116", + "raid_20240130", + "raid_20240328", + "raid_20230629", + "raid_20230118", + "raid_20221027", + "raid_20220630", + "raid_20220127", + "raid_20210708", + "raid_20200624" + ] + }, + "Mode": { + "type": "select", + "value": "normal", + "option": [ + "normal", + "hard" + ], + "display": "hide" + }, + "UseClearMode": { + "type": "checkbox", + "value": true, + "display": "hide" + }, + "UseFleetLock": { + "type": "checkbox", + "value": true, + "display": "hide" + }, + "UseAutoSearch": { + "type": "checkbox", + "value": false, + "display": "hide" + }, + "Use2xBook": { + "type": "checkbox", + "value": false, + "display": "hide" + }, + "AmbushEvade": { + "type": "checkbox", + "value": true, + "display": "hide" + } + }, + "StopCondition": { + "OilLimit": { + "type": "input", + "value": 1000 + }, + "RunCount": { + "type": "input", + "value": 0 + }, + "MapAchievement": { + "type": "select", + "value": "non_stop", + "option": [ + "non_stop", + "100_percent_clear", + "map_3_stars", + "threat_safe", + "threat_safe_without_3_stars" + ], + "display": "hide" + }, + "StageIncrease": { + "type": "checkbox", + "value": false, + "display": "hide" + }, + "GetNewShip": { + "type": "checkbox", + "value": false, + "display": "hide" + }, + "ReachLevel": { + "type": "input", + "value": 0, + "display": "hide" + } + }, + "Fleet": { + "Fleet1": { + "type": "select", + "value": 1, + "option": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "display": "hide" + }, + "Fleet1Formation": { + "type": "select", + "value": "double_line", + "option": [ + "line_ahead", + "double_line", + "diamond" + ], + "display": "hide" + }, + "Fleet1Mode": { + "type": "select", + "value": "combat_manual", + "option": [ + "combat_manual", + "stand_still_in_the_middle", + "hide_in_bottom_left", + "hide_in_upper_left" + ], + "display": "display" + }, + "Fleet1Step": { + "type": "select", + "value": 3, + "option": [ + 2, + 3, + 4, + 5 + ], + "display": "hide" + }, + "Fleet2": { + "type": "select", + "value": 2, + "option": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "display": "hide" + }, + "Fleet2Formation": { + "type": "select", + "value": "double_line", + "option": [ + "line_ahead", + "double_line", + "diamond" + ], + "display": "hide" + }, + "Fleet2Mode": { + "type": "select", + "value": "combat_auto", + "option": [ + "combat_auto", + "combat_manual", + "stand_still_in_the_middle", + "hide_in_bottom_left" + ], + "display": "hide" + }, + "Fleet2Step": { + "type": "select", + "value": 3, + "option": [ + 2, + 3, + 4, + 5 + ], + "display": "hide" + }, + "FleetOrder": { + "type": "select", + "value": "fleet1_all_fleet2_standby", + "option": [ + "fleet1_mob_fleet2_boss", + "fleet1_boss_fleet2_mob", + "fleet1_all_fleet2_standby", + "fleet1_standby_fleet2_all" + ], + "display": "hide" + } + }, + "Submarine": { + "Fleet": { + "type": "select", + "value": 0, + "option": [ + 0, + 1, + 2 + ] + }, + "Mode": { + "type": "select", + "value": "do_not_use", + "option": [ + "do_not_use", + "every_combat" + ], + "display": "display" + }, + "AutoSearchMode": { + "type": "select", + "value": "sub_standby", + "option": [ + "sub_standby", + "sub_auto_call" + ], + "display": "hide" + }, + "DistanceToBoss": { + "type": "select", + "value": "2_grid_to_boss", + "option": [ + "to_boss_position", + "1_grid_to_boss", + "2_grid_to_boss", + "use_open_ocean_support" + ], + "display": "hide" + } + }, + "Emotion": { + "Mode": { + "type": "select", + "value": "calculate", + "option": [ + "calculate", + "ignore", + "calculate_ignore" + ] + }, + "Fleet1Value": { + "type": "input", + "value": 119 + }, + "Fleet1Record": { + "type": "datetime", + "value": "2020-01-01 00:00:00", + "validate": "datetime", + "display": "disabled" + }, + "Fleet1Control": { + "type": "select", + "value": "prevent_yellow_face", + "option": [ + "keep_exp_bonus", + "prevent_green_face", + "prevent_yellow_face", + "prevent_red_face" + ], + "display": "hide" + }, + "Fleet1Recover": { + "type": "select", + "value": "not_in_dormitory", + "option": [ + "not_in_dormitory", + "dormitory_floor_1", + "dormitory_floor_2" + ] + }, + "Fleet1Oath": { + "type": "checkbox", + "value": false + }, + "Fleet2Value": { + "type": "input", + "value": 119, + "display": "hide" + }, + "Fleet2Record": { + "type": "datetime", + "value": "2020-01-01 00:00:00", + "validate": "datetime", + "display": "hide" + }, + "Fleet2Control": { + "type": "select", + "value": "prevent_yellow_face", + "option": [ + "keep_exp_bonus", + "prevent_green_face", + "prevent_yellow_face", + "prevent_red_face" + ], + "display": "hide" + }, + "Fleet2Recover": { + "type": "select", + "value": "not_in_dormitory", + "option": [ + "not_in_dormitory", + "dormitory_floor_1", + "dormitory_floor_2" + ], + "display": "hide" + }, + "Fleet2Oath": { + "type": "checkbox", + "value": false, + "display": "hide" + } + }, + "Storage": { + "Storage": { + "type": "storage", + "value": {}, + "valuetype": "ignore", + "display": "disabled" + } + } + }, "Hospital": { "Scheduler": { "Enable": { diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 5addab57e..b6f5ba974 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -1051,4 +1051,11 @@ EventShop: > DR > PR > AugmentCore > AugmentEnhanceT2 > AugmentChangeT2 > AugmentChangeT1 > CatT2 > CatT1 > PlateGeneralT3 > PlateT3 > BoxT4 - > ShipSSR \ No newline at end of file + > ShipSSR + +# ==================== RaidScuttle ====================== + +RaidScuttle: + Sacrifice: + value: vanguard + option: [ vanguard, flagship ] \ No newline at end of file diff --git a/module/config/argument/menu.json b/module/config/argument/menu.json index 2cf2cd49f..14874a5a1 100644 --- a/module/config/argument/menu.json +++ b/module/config/argument/menu.json @@ -42,6 +42,7 @@ "Event5", "Event6", "Raid", + "RaidScuttle", "Hospital", "Coalition", "MaritimeEscort", diff --git a/module/config/argument/override.yaml b/module/config/argument/override.yaml index bb7f67b1d..cb933a952 100644 --- a/module/config/argument/override.yaml +++ b/module/config/argument/override.yaml @@ -483,4 +483,50 @@ EventShop: Scheduler: SuccessInterval: 30 FailureInterval: 30 - ServerUpdate: 00:00 \ No newline at end of file + ServerUpdate: 00:00 + +# ==================== RaidScuttle ====================== + +RaidScuttle: + Campaign: + Name: dynamic + Event: + type: state + Mode: normal + UseClearMode: true + UseFleetLock: true + UseAutoSearch: false + Use2xBook: false + AmbushEvade: true + StopCondition: + MapAchievement: non_stop + StageIncrease: false + GetNewShip: false + ReachLevel: 0 + Fleet: + Fleet1: 1 + Fleet1Formation: double_line + Fleet1Mode: + display: display + value: combat_manual + option: [ combat_manual, stand_still_in_the_middle, hide_in_bottom_left, hide_in_upper_left ] + Fleet1Step: 3 + Fleet2: 2 + Fleet2Formation: double_line + Fleet2Mode: combat_auto + Fleet2Step: 3 + FleetOrder: fleet1_all_fleet2_standby + Submarine: + Mode: + display: display + value: do_not_use + option: [ do_not_use, every_combat ] + AutoSearchMode: sub_standby + DistanceToBoss: 2_grid_to_boss + Emotion: + Fleet1Control: prevent_yellow_face + Fleet2Value: 119 + Fleet2Record: 2020-01-01 00:00:00 + Fleet2Control: prevent_yellow_face + Fleet2Recover: not_in_dormitory + Fleet2Oath: false \ No newline at end of file diff --git a/module/config/argument/task.yaml b/module/config/argument/task.yaml index c29122b15..436bff931 100644 --- a/module/config/argument/task.yaml +++ b/module/config/argument/task.yaml @@ -183,6 +183,15 @@ Event: - Campaign - StopCondition - Emotion + RaidScuttle: + - Scheduler + - RaidScuttle + - Raid + - Campaign + - StopCondition + - Fleet + - Submarine + - Emotion Hospital: - Scheduler - Hospital diff --git a/module/config/config_generated.py b/module/config/config_generated.py index 3f0dca93b..bbeade53a 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -669,5 +669,8 @@ class GeneratedConfig: EventShop_PresetFilter = 'all' # all, custom EventShop_CustomFilter = 'EquipUR > EquipSSR > Cube > GachaTicket\n> Array > Chip > CatT3 \n> Meta > SkinBox\n> Oil > Coin > Medal > ExpBookT1 > FoodT1\n> DR > PR\n> AugmentCore > AugmentEnhanceT2 > AugmentChangeT2 > AugmentChangeT1\n> CatT2 > CatT1 > PlateGeneralT3 > PlateT3 > BoxT4\n> ShipSSR' + # Group `RaidScuttle` + RaidScuttle_Sacrifice = 'vanguard' # vanguard, flagship + # Group `Storage` Storage_Storage = {} diff --git a/module/config/config_manual.py b/module/config/config_manual.py index 0c94b7a63..6c1cac79c 100644 --- a/module/config/config_manual.py +++ b/module/config/config_manual.py @@ -399,7 +399,7 @@ class ManualConfig(ManualConfig): > Sos > EventSp > EventA > EventB > EventC > EventD > RaidDaily > CoalitionSp > WarArchives > MaritimeEscort > Event > Event2 > Event3 > Event4 > Event5 > Event6 - > Raid > Hospital > Coalition + > Raid > RaidScuttle > Hospital > Coalition > Main > Main2 > Main3 > Main4 > Main5 > Main6 > OpsiMeowfficerFarming > GemsFarming diff --git a/module/config/config_updater.py b/module/config/config_updater.py index 4759541d2..8ad4372fa 100644 --- a/module/config/config_updater.py +++ b/module/config/config_updater.py @@ -898,6 +898,7 @@ class FullGeneratedConfig: MAINS += ['Main4', 'Main5', 'Main6'] EVENTS += ['Event3', 'Event4', 'Event5', 'Event6'] +RAIDS += ['RaidScuttle'] class ConfigGenerator(ConfigGenerator): diff --git a/module/config/full_config_generated.py b/module/config/full_config_generated.py index c8de1b84a..3cd3745aa 100644 --- a/module/config/full_config_generated.py +++ b/module/config/full_config_generated.py @@ -964,6 +964,56 @@ class FullGeneratedConfig: Raid_Emotion_Fleet2Oath = None Raid_Storage_Storage = None + # Task `RaidScuttle` + RaidScuttle_Scheduler_Enable = None + RaidScuttle_Scheduler_NextRun = None + RaidScuttle_Scheduler_Command = None + RaidScuttle_Scheduler_SuccessInterval = None + RaidScuttle_Scheduler_FailureInterval = None + RaidScuttle_Scheduler_ServerUpdate = None + RaidScuttle_RaidScuttle_Sacrifice = None + RaidScuttle_Raid_Mode = None + RaidScuttle_Raid_UseTicket = None + RaidScuttle_Campaign_Name = None + RaidScuttle_Campaign_Event = None + RaidScuttle_Campaign_Mode = None + RaidScuttle_Campaign_UseClearMode = None + RaidScuttle_Campaign_UseFleetLock = None + RaidScuttle_Campaign_UseAutoSearch = None + RaidScuttle_Campaign_Use2xBook = None + RaidScuttle_Campaign_AmbushEvade = None + RaidScuttle_StopCondition_OilLimit = None + RaidScuttle_StopCondition_RunCount = None + RaidScuttle_StopCondition_MapAchievement = None + RaidScuttle_StopCondition_StageIncrease = None + RaidScuttle_StopCondition_GetNewShip = None + RaidScuttle_StopCondition_ReachLevel = None + RaidScuttle_Fleet_Fleet1 = None + RaidScuttle_Fleet_Fleet1Formation = None + RaidScuttle_Fleet_Fleet1Mode = None + RaidScuttle_Fleet_Fleet1Step = None + RaidScuttle_Fleet_Fleet2 = None + RaidScuttle_Fleet_Fleet2Formation = None + RaidScuttle_Fleet_Fleet2Mode = None + RaidScuttle_Fleet_Fleet2Step = None + RaidScuttle_Fleet_FleetOrder = None + RaidScuttle_Submarine_Fleet = None + RaidScuttle_Submarine_Mode = None + RaidScuttle_Submarine_AutoSearchMode = None + RaidScuttle_Submarine_DistanceToBoss = None + RaidScuttle_Emotion_Mode = None + RaidScuttle_Emotion_Fleet1Value = None + RaidScuttle_Emotion_Fleet1Record = None + RaidScuttle_Emotion_Fleet1Control = None + RaidScuttle_Emotion_Fleet1Recover = None + RaidScuttle_Emotion_Fleet1Oath = None + RaidScuttle_Emotion_Fleet2Value = None + RaidScuttle_Emotion_Fleet2Record = None + RaidScuttle_Emotion_Fleet2Control = None + RaidScuttle_Emotion_Fleet2Recover = None + RaidScuttle_Emotion_Fleet2Oath = None + RaidScuttle_Storage_Storage = None + # Task `Hospital` Hospital_Scheduler_Enable = None Hospital_Scheduler_NextRun = None diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 9c9b8ace8..b102d01a4 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -122,6 +122,10 @@ "name": "Raid", "help": "" }, + "RaidScuttle": { + "name": "Task.RaidScuttle.name", + "help": "Task.RaidScuttle.help" + }, "Hospital": { "name": "Valley Hospital", "help": "" @@ -3602,6 +3606,18 @@ "help": "To use your own filter, set \"Event Shop Filter\" to \"Custom\". All options have been defined at " } }, + "RaidScuttle": { + "_info": { + "name": "RaidScuttle._info.name", + "help": "RaidScuttle._info.help" + }, + "Sacrifice": { + "name": "RaidScuttle.Sacrifice.name", + "help": "RaidScuttle.Sacrifice.help", + "vanguard": "vanguard", + "flagship": "flagship" + } + }, "Storage": { "_info": { "name": "Task status", diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index eb516aa77..fb8bdcf53 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -122,6 +122,10 @@ "name": "Raid", "help": "" }, + "RaidScuttle": { + "name": "Task.RaidScuttle.name", + "help": "Task.RaidScuttle.help" + }, "Hospital": { "name": "病院探訪", "help": "" @@ -3602,6 +3606,18 @@ "help": "EventShop.CustomFilter.help" } }, + "RaidScuttle": { + "_info": { + "name": "RaidScuttle._info.name", + "help": "RaidScuttle._info.help" + }, + "Sacrifice": { + "name": "RaidScuttle.Sacrifice.name", + "help": "RaidScuttle.Sacrifice.help", + "vanguard": "vanguard", + "flagship": "flagship" + } + }, "Storage": { "_info": { "name": "Storage._info.name", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 8f4e2911e..9c09eeebe 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -122,6 +122,10 @@ "name": "共斗活动", "help": "" }, + "RaidScuttle": { + "name": "共斗沉船", + "help": "" + }, "Hospital": { "name": "深谷来信", "help": "" @@ -3602,6 +3606,18 @@ "help": "使用自定义过滤器需将“活动商店过滤器”设置为“自定义”,并阅读 https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/filter_string_cn" } }, + "RaidScuttle": { + "_info": { + "name": "共斗沉船", + "help": "" + }, + "Sacrifice": { + "name": "牺牲船位置", + "help": "", + "vanguard": "前排", + "flagship": "旗舰" + } + }, "Storage": { "_info": { "name": "任务状态", diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index 3a3d4654f..e21832c8e 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -122,6 +122,10 @@ "name": "共鬥活動", "help": "" }, + "RaidScuttle": { + "name": "Task.RaidScuttle.name", + "help": "Task.RaidScuttle.help" + }, "Hospital": { "name": "深谷来信", "help": "" @@ -3602,6 +3606,18 @@ "help": "使用自定義過濾器需將 \"活動商店過濾器\" 設定為 \"自定義過濾器\",並閱讀 https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/filter_string_cn" } }, + "RaidScuttle": { + "_info": { + "name": "RaidScuttle._info.name", + "help": "RaidScuttle._info.help" + }, + "Sacrifice": { + "name": "RaidScuttle.Sacrifice.name", + "help": "RaidScuttle.Sacrifice.help", + "vanguard": "vanguard", + "flagship": "flagship" + } + }, "Storage": { "_info": { "name": "任務狀態", diff --git a/module/raid/my_assets.py b/module/raid/my_assets.py new file mode 100644 index 000000000..2e01b4295 --- /dev/null +++ b/module/raid/my_assets.py @@ -0,0 +1,8 @@ +from module.base.button import Button +from module.base.template import Template + +# This file was automatically generated by dev_tools/button_extract.py. +# Don't modify it manually. + +my_RAID_FLEET_FLAGSHIP = Button(area={'cn': (402, 168, 462, 228), 'en': (402, 168, 462, 228), 'jp': (402, 168, 462, 228), 'tw': (402, 168, 462, 228)}, color={'cn': (73, 61, 55), 'en': (73, 61, 55), 'jp': (73, 61, 55), 'tw': (73, 61, 55)}, button={'cn': (402, 168, 462, 228), 'en': (402, 168, 462, 228), 'jp': (402, 168, 462, 228), 'tw': (402, 168, 462, 228)}, file={'cn': './assets/cn/raid/my_RAID_FLEET_FLAGSHIP.png', 'en': './assets/cn/raid/my_RAID_FLEET_FLAGSHIP.png', 'jp': './assets/cn/raid/my_RAID_FLEET_FLAGSHIP.png', 'tw': './assets/cn/raid/my_RAID_FLEET_FLAGSHIP.png'}) +my_RAID_FLEET_VANGUARD = Button(area={'cn': (718, 168, 778, 228), 'en': (718, 168, 778, 228), 'jp': (718, 168, 778, 228), 'tw': (718, 168, 778, 228)}, color={'cn': (51, 50, 54), 'en': (51, 50, 54), 'jp': (51, 50, 54), 'tw': (51, 50, 54)}, button={'cn': (718, 168, 778, 228), 'en': (718, 168, 778, 228), 'jp': (718, 168, 778, 228), 'tw': (718, 168, 778, 228)}, file={'cn': './assets/cn/raid/my_RAID_FLEET_VANGUARD.png', 'en': './assets/cn/raid/my_RAID_FLEET_VANGUARD.png', 'jp': './assets/cn/raid/my_RAID_FLEET_VANGUARD.png', 'tw': './assets/cn/raid/my_RAID_FLEET_VANGUARD.png'}) diff --git a/module/raid/scuttle.py b/module/raid/scuttle.py new file mode 100644 index 000000000..df4fffe91 --- /dev/null +++ b/module/raid/scuttle.py @@ -0,0 +1,249 @@ +from module.combat.assets import OPTS_INFO_D, BATTLE_STATUS_D, EXP_INFO_D, BATTLE_STATUS_C, EXP_INFO_C +from module.exception import ScriptError, CampaignEnd +from module.logger import logger +from module.raid.assets import RAID_FLEET_PREPARATION +from module.raid.my_assets import * +from module.raid.combat import RaidCombat +from module.raid.raid import raid_entrance +from module.raid.run import RaidRun +from module.retire.assets import DOCK_CHECK +from module.retire.dock import Dock +from module.retire.scanner import ShipScanner +from module.ui.page import page_raid, page_rpg_stage + + +class RaidScuttleCombat(RaidCombat): + triggered_normal_end = False + + def handle_battle_status(self, drop=None): + """ + Args: + drop (DropImage): + + Returns: + bool: + """ + if self.is_combat_executing(): + return False + if self.appear(BATTLE_STATUS_D, interval=self.battle_status_click_interval): + if drop: + drop.handle_add(self) + else: + self.device.sleep((0.25, 0.5)) + self.device.click(BATTLE_STATUS_D) + return True + if self.appear(OPTS_INFO_D, interval=self.battle_status_click_interval): + if drop: + drop.handle_add(self) + else: + self.device.sleep((0.25, 0.5)) + self.device.click(OPTS_INFO_D) + return True + if super().handle_battle_status(drop=drop): + logger.warning("Triggered normal end") + self.triggered_normal_end = True + return True + + return False + + def handle_exp_info(self): + """ + Returns: + bool: + """ + if self.is_combat_executing(): + return False + if self.appear_then_click(EXP_INFO_D): + self.device.sleep((0.25, 0.5)) + return True + if super().handle_exp_info(): + return True + + return False + + def handle_combat_weapon_release(self): + return False + + +class RaidScuttleRun(RaidRun, RaidScuttleCombat, Dock): + @property + def manual_mode(self): + return self.config.Fleet_Fleet1Mode + + @property + def change_vanguard(self): + return 'vanguard' in self.config.RaidScuttle_Sacrifice + + @property + def change_flagship(self): + return 'flagship' in self.config.RaidScuttle_Sacrifice + + def triggered_stop_condition(self, oil_check=False, pt_check=False, coin_check=False): + if self.triggered_normal_end: + return True + if super().triggered_stop_condition(oil_check, pt_check, coin_check): + return True + + return False + + def raid_enter_preparation(self, mode, raid, skip_first_screenshot=True): + """ + Args: + mode: + raid: + skip_first_screenshot: + + Pages: + in: page_raid + out: BATTLE_PREPARATION + """ + # UI ensure + self.device.stuck_record_clear() + self.device.click_record_clear() + if not self.is_raid_rpg(): + self.ui_ensure(page_raid) + else: + self.ui_ensure(page_rpg_stage) + self.raid_rpg_swipe() + entrance = raid_entrance(raid=raid, mode=mode) + while 1: + if skip_first_screenshot: + skip_first_screenshot = False + else: + self.device.screenshot() + + if self.appear(entrance, offset=(10, 10), interval=5): + self.device.click(entrance) + continue + + # End + if self.appear_then_click(RAID_FLEET_PREPARATION, offset=(20, 20), interval=5): + break + + def combat_auto_reset(self): + pass + + def raid_execute_once(self, mode, raid): + """ + Args: + mode: + raid: + + Returns: + in: page_raid + out: page_raid + """ + logger.hr('Raid Execute') + self.config.override( + Campaign_Name=f'{raid}_{mode}', + Campaign_UseAutoSearch=False, + Fleet_FleetOrder='fleet1_all_fleet2_standby' + ) + + if mode == 'ex': + backup = self.config.temporary( + Submarine_Fleet=1, + Submarine_Mode='every_combat' + ) + + self.emotion.check_reduce(1) + + self.raid_enter(mode=mode, raid=raid) + self.combat(balance_hp=False, auto_mode=self.manual_mode, expected_end=self.raid_expected_end) + + if mode == 'ex': + backup.recover() + + logger.hr('Raid End') + + def get_common_rarity_ship(self, index='all'): + self.dock_favourite_set(False, wait_loading=False) + self.dock_sort_method_dsc_set(False, wait_loading=False) + self.dock_filter_set( + index=index, rarity='common', extra='enhanceable', sort='total' + ) + + logger.hr('FINDING SHIP') + + scanner = ShipScanner(level=(1, 31), fleet=0, status='free') + scanner.disable('rarity') + + return scanner.scan(self.device.image) + + def vanguard_change(self): + logger.hr('Change vanguard', level=2) + for _ in self.loop(): + if self.appear(DOCK_CHECK, offset=(20, 20)): + break + if self.appear(RAID_FLEET_PREPARATION, offset=(20, 20)): + self.device.click(my_RAID_FLEET_VANGUARD) + continue + + ship = self.get_common_rarity_ship(index='vanguard') + if ship: + self._ship_change_confirm(min(ship, key=lambda s: (s.level, -s.emotion)).button) + logger.info('Change vanguard success') + return True + else: + logger.info('Change vanguard failed, no vanguard in common rarity.') + self._dock_reset() + self.ui_back(check_button=RAID_FLEET_PREPARATION) + return False + + def flagship_change(self): + logger.hr('Change flagship', level=2) + for _ in self.loop(): + if self.appear(DOCK_CHECK, offset=(20, 20)): + break + if self.appear(RAID_FLEET_PREPARATION, offset=(20, 20)): + self.device.click(my_RAID_FLEET_FLAGSHIP) + continue + + ship = self.get_common_rarity_ship(index='main') + if ship: + self._ship_change_confirm(min(ship, key=lambda s: (s.level, -s.emotion)).button) + logger.info('Change flagship success') + return True + else: + logger.info('Change flagship failed, no flagship in common rarity.') + self._dock_reset() + self.ui_back(check_button=RAID_FLEET_PREPARATION) + return False + + def run(self, name='', mode='', total=0): + """ + Args: + name (str): Raid name, such as 'raid_20200624' + mode (str): Raid mode, such as 'hard', 'normal', 'easy' + total (int): Total run count + """ + name = name if name else self.config.Campaign_Event + mode = mode if mode else self.config.Raid_Mode + if not name or not mode: + raise ScriptError(f'RaidRun arguments unfilled. name={name}, mode={mode}') + + while 1: + super().run(name=name, mode=mode, total=total) + + # End + if self.triggered_normal_end: + self.raid_enter_preparation(mode=mode, raid=name, skip_first_screenshot=False) + success = True + if self.change_vanguard: + success = self.vanguard_change() + if self.change_flagship: + success = success and self.flagship_change() + + self.enter_map_cancel(skip_first_screenshot=False) + self.triggered_normal_end = False + + # Scheduler + if self.config.task_switched(): + self.campaign.ensure_auto_search_exit() + self.config.task_stop() + elif not success: + self.campaign.ensure_auto_search_exit() + self.config.task_delay(minute=30) + self.config.task_stop() + else: + break