diff --git a/assets/cn/equipment/EMPTY_SHIP_R.png b/assets/cn/equipment/EMPTY_SHIP_R.png new file mode 100644 index 0000000000..2944f8933c Binary files /dev/null and b/assets/cn/equipment/EMPTY_SHIP_R.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_CLEAR.png b/assets/cn/equipment/EQUIPMENT_CODE_CLEAR.png new file mode 100644 index 0000000000..bfb5be42bc Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_CLEAR.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_CONFIRM.png b/assets/cn/equipment/EQUIPMENT_CODE_CONFIRM.png new file mode 100644 index 0000000000..a24705ccf8 Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_CONFIRM.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_ENTER.png b/assets/cn/equipment/EQUIPMENT_CODE_ENTER.png new file mode 100644 index 0000000000..d6602f8ea3 Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_ENTER.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_ENTRANCE.png b/assets/cn/equipment/EQUIPMENT_CODE_ENTRANCE.png new file mode 100644 index 0000000000..e298db9a2c Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_ENTRANCE.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_0.png b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_0.png new file mode 100644 index 0000000000..22c9dad1d9 Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_0.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_1.png b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_1.png new file mode 100644 index 0000000000..d60a5815a0 Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_1.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_2.png b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_2.png new file mode 100644 index 0000000000..ba0be65980 Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_2.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_3.png b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_3.png new file mode 100644 index 0000000000..f96091c6c5 Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_3.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_4.png b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_4.png new file mode 100644 index 0000000000..a9e852ab12 Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_4.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_5.png b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_5.png new file mode 100644 index 0000000000..68decb80b0 Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_5.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png new file mode 100644 index 0000000000..7eb287b244 Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_EXPORT.png b/assets/cn/equipment/EQUIPMENT_CODE_EXPORT.png new file mode 100644 index 0000000000..efd4a36a40 Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_EXPORT.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_PAGE_CHECK.png b/assets/cn/equipment/EQUIPMENT_CODE_PAGE_CHECK.png new file mode 100644 index 0000000000..35c0e0d845 Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_PAGE_CHECK.png differ diff --git a/assets/cn/equipment/EQUIPMENT_CODE_TEXTBOX.png b/assets/cn/equipment/EQUIPMENT_CODE_TEXTBOX.png new file mode 100644 index 0000000000..79fb5466d1 Binary files /dev/null and b/assets/cn/equipment/EQUIPMENT_CODE_TEXTBOX.png differ diff --git a/assets/cn/equipment/FLEET_1_BACKLINE_1.png b/assets/cn/equipment/FLEET_1_BACKLINE_1.png new file mode 100644 index 0000000000..99be07f76e Binary files /dev/null and b/assets/cn/equipment/FLEET_1_BACKLINE_1.png differ diff --git a/assets/cn/equipment/FLEET_1_BACKLINE_3.png b/assets/cn/equipment/FLEET_1_BACKLINE_3.png new file mode 100644 index 0000000000..97b2c613c1 Binary files /dev/null and b/assets/cn/equipment/FLEET_1_BACKLINE_3.png differ diff --git a/assets/cn/equipment/FLEET_1_VANGUARD_1.png b/assets/cn/equipment/FLEET_1_VANGUARD_1.png new file mode 100644 index 0000000000..dcf5357637 Binary files /dev/null and b/assets/cn/equipment/FLEET_1_VANGUARD_1.png differ diff --git a/assets/cn/equipment/FLEET_1_VANGUARD_3.png b/assets/cn/equipment/FLEET_1_VANGUARD_3.png new file mode 100644 index 0000000000..5ae208e567 Binary files /dev/null and b/assets/cn/equipment/FLEET_1_VANGUARD_3.png differ diff --git a/assets/cn/equipment/FLEET_2_BACKLINE_1.png b/assets/cn/equipment/FLEET_2_BACKLINE_1.png new file mode 100644 index 0000000000..9cf641249e Binary files /dev/null and b/assets/cn/equipment/FLEET_2_BACKLINE_1.png differ diff --git a/assets/cn/equipment/FLEET_2_BACKLINE_3.png b/assets/cn/equipment/FLEET_2_BACKLINE_3.png new file mode 100644 index 0000000000..01e7d4b590 Binary files /dev/null and b/assets/cn/equipment/FLEET_2_BACKLINE_3.png differ diff --git a/assets/cn/equipment/FLEET_2_VANGUARD_1.png b/assets/cn/equipment/FLEET_2_VANGUARD_1.png new file mode 100644 index 0000000000..340faa2582 Binary files /dev/null and b/assets/cn/equipment/FLEET_2_VANGUARD_1.png differ diff --git a/assets/cn/equipment/FLEET_2_VANGUARD_3.png b/assets/cn/equipment/FLEET_2_VANGUARD_3.png new file mode 100644 index 0000000000..4e8f91becc Binary files /dev/null and b/assets/cn/equipment/FLEET_2_VANGUARD_3.png differ diff --git a/assets/cn/retire/DOCK_UNMOUNT.png b/assets/cn/retire/DOCK_UNMOUNT.png new file mode 100644 index 0000000000..8273917876 Binary files /dev/null and b/assets/cn/retire/DOCK_UNMOUNT.png differ diff --git a/assets/en/equipment/EMPTY_SHIP_R.png b/assets/en/equipment/EMPTY_SHIP_R.png new file mode 100644 index 0000000000..2944f8933c Binary files /dev/null and b/assets/en/equipment/EMPTY_SHIP_R.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_CLEAR.png b/assets/en/equipment/EQUIPMENT_CODE_CLEAR.png new file mode 100644 index 0000000000..e404cd4790 Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_CLEAR.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_CONFIRM.png b/assets/en/equipment/EQUIPMENT_CODE_CONFIRM.png new file mode 100644 index 0000000000..20b33abf0f Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_CONFIRM.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_ENTER.png b/assets/en/equipment/EQUIPMENT_CODE_ENTER.png new file mode 100644 index 0000000000..2210ffb94a Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_ENTER.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_ENTRANCE.png b/assets/en/equipment/EQUIPMENT_CODE_ENTRANCE.png new file mode 100644 index 0000000000..fc02ec86bf Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_ENTRANCE.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_EQUIP_0.png b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_0.png new file mode 100644 index 0000000000..22c9dad1d9 Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_0.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_EQUIP_1.png b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_1.png new file mode 100644 index 0000000000..d60a5815a0 Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_1.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_EQUIP_2.png b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_2.png new file mode 100644 index 0000000000..ba0be65980 Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_2.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_EQUIP_3.png b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_3.png new file mode 100644 index 0000000000..f96091c6c5 Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_3.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_EQUIP_4.png b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_4.png new file mode 100644 index 0000000000..a9e852ab12 Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_4.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_EQUIP_5.png b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_5.png new file mode 100644 index 0000000000..68decb80b0 Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_5.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png new file mode 100644 index 0000000000..7eb287b244 Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_EXPORT.png b/assets/en/equipment/EQUIPMENT_CODE_EXPORT.png new file mode 100644 index 0000000000..58fdac3313 Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_EXPORT.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_PAGE_CHECK.png b/assets/en/equipment/EQUIPMENT_CODE_PAGE_CHECK.png new file mode 100644 index 0000000000..35c0e0d845 Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_PAGE_CHECK.png differ diff --git a/assets/en/equipment/EQUIPMENT_CODE_TEXTBOX.png b/assets/en/equipment/EQUIPMENT_CODE_TEXTBOX.png new file mode 100644 index 0000000000..dd033a9d1f Binary files /dev/null and b/assets/en/equipment/EQUIPMENT_CODE_TEXTBOX.png differ diff --git a/assets/en/equipment/FLEET_1_BACKLINE_1.png b/assets/en/equipment/FLEET_1_BACKLINE_1.png new file mode 100644 index 0000000000..99be07f76e Binary files /dev/null and b/assets/en/equipment/FLEET_1_BACKLINE_1.png differ diff --git a/assets/en/equipment/FLEET_1_BACKLINE_3.png b/assets/en/equipment/FLEET_1_BACKLINE_3.png new file mode 100644 index 0000000000..97b2c613c1 Binary files /dev/null and b/assets/en/equipment/FLEET_1_BACKLINE_3.png differ diff --git a/assets/en/equipment/FLEET_1_VANGUARD_1.png b/assets/en/equipment/FLEET_1_VANGUARD_1.png new file mode 100644 index 0000000000..dcf5357637 Binary files /dev/null and b/assets/en/equipment/FLEET_1_VANGUARD_1.png differ diff --git a/assets/en/equipment/FLEET_1_VANGUARD_3.png b/assets/en/equipment/FLEET_1_VANGUARD_3.png new file mode 100644 index 0000000000..5ae208e567 Binary files /dev/null and b/assets/en/equipment/FLEET_1_VANGUARD_3.png differ diff --git a/assets/en/equipment/FLEET_2_BACKLINE_1.png b/assets/en/equipment/FLEET_2_BACKLINE_1.png new file mode 100644 index 0000000000..9cf641249e Binary files /dev/null and b/assets/en/equipment/FLEET_2_BACKLINE_1.png differ diff --git a/assets/en/equipment/FLEET_2_BACKLINE_3.png b/assets/en/equipment/FLEET_2_BACKLINE_3.png new file mode 100644 index 0000000000..01e7d4b590 Binary files /dev/null and b/assets/en/equipment/FLEET_2_BACKLINE_3.png differ diff --git a/assets/en/equipment/FLEET_2_VANGUARD_1.png b/assets/en/equipment/FLEET_2_VANGUARD_1.png new file mode 100644 index 0000000000..340faa2582 Binary files /dev/null and b/assets/en/equipment/FLEET_2_VANGUARD_1.png differ diff --git a/assets/en/equipment/FLEET_2_VANGUARD_3.png b/assets/en/equipment/FLEET_2_VANGUARD_3.png new file mode 100644 index 0000000000..4e8f91becc Binary files /dev/null and b/assets/en/equipment/FLEET_2_VANGUARD_3.png differ diff --git a/assets/en/retire/DOCK_UNMOUNT.png b/assets/en/retire/DOCK_UNMOUNT.png new file mode 100644 index 0000000000..8273917876 Binary files /dev/null and b/assets/en/retire/DOCK_UNMOUNT.png differ diff --git a/assets/jp/equipment/EMPTY_SHIP_R.png b/assets/jp/equipment/EMPTY_SHIP_R.png new file mode 100644 index 0000000000..2944f8933c Binary files /dev/null and b/assets/jp/equipment/EMPTY_SHIP_R.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_CLEAR.png b/assets/jp/equipment/EQUIPMENT_CODE_CLEAR.png new file mode 100644 index 0000000000..d5b54d0b19 Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_CLEAR.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_CONFIRM.png b/assets/jp/equipment/EQUIPMENT_CODE_CONFIRM.png new file mode 100644 index 0000000000..5f59609cdf Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_CONFIRM.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_ENTER.png b/assets/jp/equipment/EQUIPMENT_CODE_ENTER.png new file mode 100644 index 0000000000..2574c579e1 Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_ENTER.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_ENTRANCE.png b/assets/jp/equipment/EQUIPMENT_CODE_ENTRANCE.png new file mode 100644 index 0000000000..c01694047b Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_ENTRANCE.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_0.png b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_0.png new file mode 100644 index 0000000000..22c9dad1d9 Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_0.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_1.png b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_1.png new file mode 100644 index 0000000000..d60a5815a0 Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_1.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_2.png b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_2.png new file mode 100644 index 0000000000..ba0be65980 Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_2.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_3.png b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_3.png new file mode 100644 index 0000000000..f96091c6c5 Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_3.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_4.png b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_4.png new file mode 100644 index 0000000000..a9e852ab12 Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_4.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_5.png b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_5.png new file mode 100644 index 0000000000..68decb80b0 Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_5.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png new file mode 100644 index 0000000000..7eb287b244 Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_EXPORT.png b/assets/jp/equipment/EQUIPMENT_CODE_EXPORT.png new file mode 100644 index 0000000000..daf0894047 Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_EXPORT.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_PAGE_CHECK.png b/assets/jp/equipment/EQUIPMENT_CODE_PAGE_CHECK.png new file mode 100644 index 0000000000..35c0e0d845 Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_PAGE_CHECK.png differ diff --git a/assets/jp/equipment/EQUIPMENT_CODE_TEXTBOX.png b/assets/jp/equipment/EQUIPMENT_CODE_TEXTBOX.png new file mode 100644 index 0000000000..6383d87b88 Binary files /dev/null and b/assets/jp/equipment/EQUIPMENT_CODE_TEXTBOX.png differ diff --git a/assets/jp/equipment/FLEET_1_BACKLINE_1.png b/assets/jp/equipment/FLEET_1_BACKLINE_1.png new file mode 100644 index 0000000000..99be07f76e Binary files /dev/null and b/assets/jp/equipment/FLEET_1_BACKLINE_1.png differ diff --git a/assets/jp/equipment/FLEET_1_BACKLINE_3.png b/assets/jp/equipment/FLEET_1_BACKLINE_3.png new file mode 100644 index 0000000000..97b2c613c1 Binary files /dev/null and b/assets/jp/equipment/FLEET_1_BACKLINE_3.png differ diff --git a/assets/jp/equipment/FLEET_1_VANGUARD_1.png b/assets/jp/equipment/FLEET_1_VANGUARD_1.png new file mode 100644 index 0000000000..dcf5357637 Binary files /dev/null and b/assets/jp/equipment/FLEET_1_VANGUARD_1.png differ diff --git a/assets/jp/equipment/FLEET_1_VANGUARD_3.png b/assets/jp/equipment/FLEET_1_VANGUARD_3.png new file mode 100644 index 0000000000..5ae208e567 Binary files /dev/null and b/assets/jp/equipment/FLEET_1_VANGUARD_3.png differ diff --git a/assets/jp/equipment/FLEET_2_BACKLINE_1.png b/assets/jp/equipment/FLEET_2_BACKLINE_1.png new file mode 100644 index 0000000000..9cf641249e Binary files /dev/null and b/assets/jp/equipment/FLEET_2_BACKLINE_1.png differ diff --git a/assets/jp/equipment/FLEET_2_BACKLINE_3.png b/assets/jp/equipment/FLEET_2_BACKLINE_3.png new file mode 100644 index 0000000000..01e7d4b590 Binary files /dev/null and b/assets/jp/equipment/FLEET_2_BACKLINE_3.png differ diff --git a/assets/jp/equipment/FLEET_2_VANGUARD_1.png b/assets/jp/equipment/FLEET_2_VANGUARD_1.png new file mode 100644 index 0000000000..340faa2582 Binary files /dev/null and b/assets/jp/equipment/FLEET_2_VANGUARD_1.png differ diff --git a/assets/jp/equipment/FLEET_2_VANGUARD_3.png b/assets/jp/equipment/FLEET_2_VANGUARD_3.png new file mode 100644 index 0000000000..4e8f91becc Binary files /dev/null and b/assets/jp/equipment/FLEET_2_VANGUARD_3.png differ diff --git a/assets/jp/retire/DOCK_UNMOUNT.png b/assets/jp/retire/DOCK_UNMOUNT.png new file mode 100644 index 0000000000..8273917876 Binary files /dev/null and b/assets/jp/retire/DOCK_UNMOUNT.png differ diff --git a/assets/tw/equipment/EMPTY_SHIP_R.png b/assets/tw/equipment/EMPTY_SHIP_R.png new file mode 100644 index 0000000000..2944f8933c Binary files /dev/null and b/assets/tw/equipment/EMPTY_SHIP_R.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_CLEAR.png b/assets/tw/equipment/EQUIPMENT_CODE_CLEAR.png new file mode 100644 index 0000000000..cac3a2c73a Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_CLEAR.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_CONFIRM.png b/assets/tw/equipment/EQUIPMENT_CODE_CONFIRM.png new file mode 100644 index 0000000000..70859f1046 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_CONFIRM.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_ENTER.png b/assets/tw/equipment/EQUIPMENT_CODE_ENTER.png new file mode 100644 index 0000000000..df697ef307 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_ENTER.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_ENTRANCE.png b/assets/tw/equipment/EQUIPMENT_CODE_ENTRANCE.png new file mode 100644 index 0000000000..b97c66d249 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_ENTRANCE.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_0.png b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_0.png new file mode 100644 index 0000000000..22c9dad1d9 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_0.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_1.png b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_1.png new file mode 100644 index 0000000000..d60a5815a0 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_1.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_2.png b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_2.png new file mode 100644 index 0000000000..ba0be65980 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_2.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_3.png b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_3.png new file mode 100644 index 0000000000..f96091c6c5 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_3.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_4.png b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_4.png new file mode 100644 index 0000000000..a9e852ab12 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_4.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_5.png b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_5.png new file mode 100644 index 0000000000..68decb80b0 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_5.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png new file mode 100644 index 0000000000..7eb287b244 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_EXPORT.png b/assets/tw/equipment/EQUIPMENT_CODE_EXPORT.png new file mode 100644 index 0000000000..8aa666b127 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_EXPORT.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_PAGE_CHECK.png b/assets/tw/equipment/EQUIPMENT_CODE_PAGE_CHECK.png new file mode 100644 index 0000000000..35c0e0d845 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_PAGE_CHECK.png differ diff --git a/assets/tw/equipment/EQUIPMENT_CODE_TEXTBOX.png b/assets/tw/equipment/EQUIPMENT_CODE_TEXTBOX.png new file mode 100644 index 0000000000..8a4d7eb129 Binary files /dev/null and b/assets/tw/equipment/EQUIPMENT_CODE_TEXTBOX.png differ diff --git a/assets/tw/equipment/FLEET_1_BACKLINE_1.png b/assets/tw/equipment/FLEET_1_BACKLINE_1.png new file mode 100644 index 0000000000..99be07f76e Binary files /dev/null and b/assets/tw/equipment/FLEET_1_BACKLINE_1.png differ diff --git a/assets/tw/equipment/FLEET_1_BACKLINE_3.png b/assets/tw/equipment/FLEET_1_BACKLINE_3.png new file mode 100644 index 0000000000..97b2c613c1 Binary files /dev/null and b/assets/tw/equipment/FLEET_1_BACKLINE_3.png differ diff --git a/assets/tw/equipment/FLEET_1_VANGUARD_1.png b/assets/tw/equipment/FLEET_1_VANGUARD_1.png new file mode 100644 index 0000000000..dcf5357637 Binary files /dev/null and b/assets/tw/equipment/FLEET_1_VANGUARD_1.png differ diff --git a/assets/tw/equipment/FLEET_1_VANGUARD_3.png b/assets/tw/equipment/FLEET_1_VANGUARD_3.png new file mode 100644 index 0000000000..5ae208e567 Binary files /dev/null and b/assets/tw/equipment/FLEET_1_VANGUARD_3.png differ diff --git a/assets/tw/equipment/FLEET_2_BACKLINE_1.png b/assets/tw/equipment/FLEET_2_BACKLINE_1.png new file mode 100644 index 0000000000..9cf641249e Binary files /dev/null and b/assets/tw/equipment/FLEET_2_BACKLINE_1.png differ diff --git a/assets/tw/equipment/FLEET_2_BACKLINE_3.png b/assets/tw/equipment/FLEET_2_BACKLINE_3.png new file mode 100644 index 0000000000..01e7d4b590 Binary files /dev/null and b/assets/tw/equipment/FLEET_2_BACKLINE_3.png differ diff --git a/assets/tw/equipment/FLEET_2_VANGUARD_1.png b/assets/tw/equipment/FLEET_2_VANGUARD_1.png new file mode 100644 index 0000000000..340faa2582 Binary files /dev/null and b/assets/tw/equipment/FLEET_2_VANGUARD_1.png differ diff --git a/assets/tw/equipment/FLEET_2_VANGUARD_3.png b/assets/tw/equipment/FLEET_2_VANGUARD_3.png new file mode 100644 index 0000000000..4e8f91becc Binary files /dev/null and b/assets/tw/equipment/FLEET_2_VANGUARD_3.png differ diff --git a/assets/tw/retire/DOCK_UNMOUNT.png b/assets/tw/retire/DOCK_UNMOUNT.png new file mode 100644 index 0000000000..8273917876 Binary files /dev/null and b/assets/tw/retire/DOCK_UNMOUNT.png differ diff --git a/campaign/campaign_hard/campaign_hard.py b/campaign/campaign_hard/campaign_hard.py index 95f1a72af0..0950cf4586 100644 --- a/campaign/campaign_hard/campaign_hard.py +++ b/campaign/campaign_hard/campaign_hard.py @@ -1,7 +1,6 @@ from module.base.timer import Timer from module.campaign.campaign_base import CampaignBase from module.exception import CampaignEnd -from module.hard.equipment import HardEquipment from module.logger import logger from module.map.assets import FLEET_PREPARATION, MAP_PREPARATION from module.ui.assets import CAMPAIGN_CHECK @@ -13,7 +12,7 @@ class Config: ENABLE_HP_BALANCE = False -class Campaign(CampaignBase, HardEquipment): +class Campaign(CampaignBase): # def run(self): # logger.hr(self.ENTRANCE, level=2) # self.enter_map(self.ENTRANCE, mode='hard') @@ -36,9 +35,6 @@ class Campaign(CampaignBase, HardEquipment): # except CampaignEnd: # logger.hr('Campaign end') - # def fleet_preparation(self): - # self.equipment_take_on() - def _expected_end(self, expected): return 'in_stage' @@ -60,45 +56,3 @@ def clear_boss(self): self.clear_potential_boss() return False - - def equipment_take_off_when_finished(self): - if self.config.FLEET_HARD_EQUIPMENT is None: - return False - if not self.equipment_has_take_on: - return False - - logger.info('equipment_take_off_when_finished') - campaign_timer = Timer(2) - map_timer = Timer(1) - fleet_timer = Timer(1) - - while 1: - self.device.screenshot() - - # Enter campaign - if campaign_timer.reached() and self.is_in_stage(): - self.device.click(self.ENTRANCE) - campaign_timer.reset() - continue - - # Map preparation - if map_timer.reached() and self.appear(MAP_PREPARATION, offset=(20, 20)): - self.device.click(MAP_PREPARATION) - map_timer.reset() - campaign_timer.reset() - continue - - # Fleet preparation - if fleet_timer.reached() and self.appear(FLEET_PREPARATION, offset=(20, 50)): - self.equipment_take_off() - self.ui_back(check_button=CAMPAIGN_CHECK, appear_button=FLEET_PREPARATION) - break - - # Retire - if self.handle_retirement(): - continue - - # Emotion - pass - - return True diff --git a/config/template.json b/config/template.json index 7ec2175f70..66e8337ba6 100644 --- a/config/template.json +++ b/config/template.json @@ -309,11 +309,16 @@ "ServerUpdate": "00:00" }, "GemsFarming": { + "ChangeFlagship": "ship", "CommonCV": "any", "ChangeVanguard": "ship", "CommonDD": "any", "CommissionLimit": true }, + "EquipmentCode": { + "ExportToConfig": true, + "Config": "DD: null\nbogue: null\nhermes: null\nlangley: null\nranger: null" + }, "Campaign": { "Name": "12-4", "Event": "campaign_main", @@ -343,6 +348,25 @@ "Fleet2Step": 2, "FleetOrder": "fleet1_all_fleet2_standby" }, + "Emotion": { + "Mode": "calculate_ignore", + "Fleet1Value": 119, + "Fleet1Record": "2020-01-01 00:00:00", + "Fleet1Control": "prevent_red_face", + "Fleet1Recover": "not_in_dormitory", + "Fleet1Oath": false, + "Fleet2Value": 119, + "Fleet2Record": "2020-01-01 00:00:00", + "Fleet2Control": "prevent_red_face", + "Fleet2Recover": "not_in_dormitory", + "Fleet2Oath": false + }, + "Submarine": { + "Fleet": 0, + "Mode": "do_not_use", + "AutoSearchMode": "sub_standby", + "DistanceToBoss": "use_open_ocean_support" + }, "Storage": { "Storage": {} } diff --git a/module/campaign/gems_farming.py b/module/campaign/gems_farming.py index a3a11dce2f..4b97a70f82 100644 --- a/module/campaign/gems_farming.py +++ b/module/campaign/gems_farming.py @@ -1,29 +1,32 @@ +from datetime import datetime + +import numpy as np + +from module.base.decorator import Config, cached_property +from module.base.timer import Timer from module.campaign.campaign_base import CampaignBase from module.campaign.run import CampaignRun from module.combat.assets import BATTLE_PREPARATION +from module.combat.emotion import Emotion from module.equipment.assets import * -from module.equipment.fleet_equipment import FleetEquipment -from module.exception import CampaignEnd, ScriptError +from module.equipment.equipment import Equipment +from module.exception import CampaignEnd, RequestHumanTakeover from module.handler.assets import AUTO_SEARCH_MAP_OPTION_OFF from module.logger import logger from module.map.assets import FLEET_PREPARATION, MAP_PREPARATION -from module.retire.assets import ( - DOCK_CHECK, - TEMPLATE_BOGUE, TEMPLATE_HERMES, TEMPLATE_LANGLEY, TEMPLATE_RANGER, - TEMPLATE_CASSIN_1, TEMPLATE_CASSIN_2, TEMPLATE_DOWNES_1, TEMPLATE_DOWNES_2, - TEMPLATE_AULICK, TEMPLATE_FOOTE -) - +from module.ocr.ocr import Digit +from module.retire.assets import * from module.retire.dock import Dock from module.retire.scanner import ShipScanner from module.ui.assets import BACK_ARROW from module.ui.page import page_fleet + +FLEET_INDEX = Digit(OCR_FLEET_INDEX, letter=(90, 154, 255), threshold=128, alphabet='123456') SIM_VALUE = 0.92 class GemsCampaignOverride(CampaignBase): - def handle_combat_low_emotion(self): """ Overwrite info_handler.handle_combat_low_emotion() @@ -67,142 +70,322 @@ def handle_combat_low_emotion(self): raise CampaignEnd('Emotion withdraw') -class GemsFarming(CampaignRun, FleetEquipment, Dock): +class GemsEmotion(Emotion): + def check_reduce(self, battle): + """ + Override Emotion.check_reduce to trigger stop condition when emotion is too low before battle. + """ + if not self.is_calculate: + return + + method = self.config.Fleet_FleetOrder + if method == 'fleet1_all_fleet2_standby': + battle = (battle, 0) + elif method == 'fleet1_standby_fleet2_all': + battle = (0, battle) + + battle = tuple(np.array(battle) * self.reduce_per_battle_before_entering) + logger.info(f'Expect emotion reduce: {battle}') + + self.update() + self.record() + self.show() + recovered = max([f.get_recovered(b) for f, b in zip(self.fleets, battle)]) + if recovered > datetime.now(): + self.config.GEMS_EMOTION_TRIGGERED = True + raise CampaignEnd('Emotion control') + + def wait(self, fleet_index): + """ + Override Emotion.wait to trigger stop condition when emotion is too low after battle. + """ + self.update() + self.record() + self.show() + fleet = self.fleets[fleet_index - 1] + recovered = fleet.get_recovered(expected_reduce=self.reduce_per_battle) + if recovered > datetime.now(): + self.config.GEMS_EMOTION_TRIGGERED = True + +class GemsFarming(CampaignRun, Dock): def load_campaign(self, name, folder='campaign_main'): super().load_campaign(name, folder) class GemsCampaign(GemsCampaignOverride, self.module.Campaign): - pass + @cached_property + def emotion(self): + return GemsEmotion(config=self.config) self.campaign = GemsCampaign(device=self.campaign.device, config=self.campaign.config) - self.campaign.config.override(Emotion_Mode='ignore') + if not self.change_vanguard: + self.campaign.config.override(Emotion_Mode='ignore') self.campaign.config.override(EnemyPriority_EnemyScaleBalanceWeight='S1_enemy_first') + @property + def change_flagship_equip(self): + return 'equip' in self.config.GemsFarming_ChangeFlagship + @property def change_vanguard(self): return 'ship' in self.config.GemsFarming_ChangeVanguard + @property + def change_vanguard_equip(self): + return 'equip' in self.config.GemsFarming_ChangeVanguard + + @property + def max_level(self): + if self.config.SERVER == 'cn': + return 100 + else: + return 70 + + @property + def min_emotion(self): + return (2 + self.campaign._map_battle) * self.campaign.emotion.reduce_per_battle + + _new_fleet_emotion = 0 + @property def fleet_to_attack(self): + if self.config.Fleet_FleetOrder == 'fleet1_standby_fleet2_all': + return 2 + else: + return 1 + + @property + def fleet_to_attack_index(self): if self.config.Fleet_FleetOrder == 'fleet1_standby_fleet2_all': return self.config.Fleet_Fleet2 else: return self.config.Fleet_Fleet1 - def flagship_change(self): - """ - Change flagship and flagship's equipment - If config.GemsFarming_CommonCV == 'any', only change auxiliary equipment + @Config.when(Campaign_Mode='normal') + def ui_goto_fleet(self): + self.ui_ensure(page_fleet) + self.ui_ensure_index(self.fleet_to_attack_index, + letter=FLEET_INDEX, + next_button=FLEET_NEXT, + prev_button=FLEET_PREV, + skip_first_screenshot=True) + + @Config.when(Campaign_Mode='hard') + def ui_goto_fleet(self): + if self.appear(FLEET_PREPARATION, offset=(20, 50)): + return + self.campaign.ensure_campaign_ui(self.stage, 'hard') + self.campaign.ENTRANCE.area = self.campaign.ENTRANCE.button + campaign_timer = Timer(5) + map_timer = Timer(5) + for _ in self.loop(): + if self.appear(FLEET_PREPARATION, offset=(20, 50)): + break + if map_timer.reached() \ + and self.campaign.handle_map_mode_switch('hard') \ + and self.campaign.handle_map_preparation(): + self.device.click(MAP_PREPARATION) + map_timer.reset() + campaign_timer.reset() + # Retire + if self.campaign.handle_retirement(): + continue + if campaign_timer.reached() and self.appear_then_click(self.campaign.ENTRANCE): + campaign_timer.reset() + continue - Returns: - bool: True if flagship changed. - """ - logger.hr('Change flagship', level=1) - self.fleet_enter(self.fleet_to_attack) + @property + def fleet_check_button(self): + if self.config.Campaign_Mode == 'hard': + return FLEET_PREPARATION + return page_fleet.check_button - logger.hr('Change flagship', level=2) - success = self.flagship_change_execute() + @property + def fleet_backline_1_button(self): + if self.config.Campaign_Mode == 'hard': + return globals()[f'FLEET_{self.fleet_to_attack}_BACKLINE_1'] + return FLEET_ENTER_FLAGSHIP - return success + @property + def fleet_vanguard_1_button(self): + if self.config.Campaign_Mode == 'hard': + return globals()[f'FLEET_{self.fleet_to_attack}_VANGUARD_1'] + return FLEET_ENTER + + def ui_enter_ship(self, click_button, long_click=True): + if long_click: + enter_button_map = { + FLEET_ENTER_FLAGSHIP: FLEET_DETAIL_ENTER_FLAGSHIP, + FLEET_ENTER: FLEET_DETAIL_ENTER, + } + enter_button = enter_button_map.get(click_button) + if enter_button is None: + self.ship_info_enter(click_button=click_button, long_click=True, skip_first_screenshot=False) + return + + self.ui_click(FLEET_DETAIL, appear_button=self.fleet_check_button, + check_button=FLEET_DETAIL_CHECK, skip_first_screenshot=True) + self.ship_info_enter(enter_button, long_click=False) + else: + self.ship_info_enter(click_button=click_button, check_button=DOCK_CHECK, + long_click=False, skip_first_screenshot=False) + + def ui_leave_ship(self, check_button=None): + if check_button is None: + check_button = self.fleet_check_button + if check_button == page_fleet.check_button: + self.ui_back(check_button=[FLEET_DETAIL_CHECK, page_fleet.check_button]) + self.ui_back(check_button=page_fleet.check_button) + else: + self.ui_back(check_button=check_button) - def vanguard_change(self): + def find_candidates(self, templates, scanner: ShipScanner, output=False): """ - Change vanguard and vanguard's equipment - - Returns: - bool: True if vanguard changed + Find candidates based on template matching using a scanner. """ + ships = scanner.scan(self.device.image, output=output) + if not templates: + return ships + candidates = [] + for ship in ships: + for template in templates: + if template.match(self.image_crop(ship.button, copy=False), similarity=SIM_VALUE): + candidates.append(ship) + break + return candidates - logger.hr('Change vanguard', level=1) - logger.attr('ChangeVanguard', self.config.GemsFarming_ChangeVanguard) - self.fleet_enter(self.fleet_to_attack) - - logger.hr('Change vanguard', level=2) - success = self.vanguard_change_execute() - - return success - - def _dock_reset(self): - self.dock_favourite_set(False, wait_loading=False) - self.dock_sort_method_dsc_set(wait_loading=False) - self.dock_filter_set() - - def _ship_change_confirm(self, button): - self.dock_select_one(button) - self._dock_reset() - self.dock_select_confirm(check_button=page_fleet.check_button) + def get_cv_templates(self): + """ + Get CV templates based on config.GemsFarming_CommonCV - def get_common_rarity_cv(self): + Returns: + list[Template]: CV templates + """ + if self.config.GemsFarming_CommonCV == 'any': + return [] + else: + templates = { + 'bogue': TEMPLATE_BOGUE, + 'hermes': TEMPLATE_HERMES, + 'langley': TEMPLATE_LANGLEY, + 'ranger': TEMPLATE_RANGER, + } + return [templates[self.config.GemsFarming_CommonCV]] + + def get_common_rarity_cv(self, max_level=31, min_emotion=0): """ Get a common rarity cv by config.GemsFarming_CommonCV - If config.GemsFarming_CommonCV == 'any', return a common lv1 ~ lv33 cv - - _dock_reset() needs to be called later. + If config.GemsFarming_CommonCV == 'any', return a common lv1 ~ lv31 cv by default. Returns: - Ship: + list[Ship]: Common rarity CVs that meet the level, emotion and fleet requirements. """ self.dock_favourite_set(False, wait_loading=False) - self.dock_sort_method_dsc_set(False, wait_loading=False) - self.dock_filter_set( - index='cv', rarity='common', extra='enhanceable', sort='total') + self.dock_sort_method_dsc_set(True, wait_loading=False) + self.dock_filter_set(index='cv', rarity='common', extra='enhanceable', sort='total') logger.hr('FINDING FLAGSHIP') - - scanner = ShipScanner(level=(1, 31), emotion=(10, 150), - fleet=self.fleet_to_attack, status='free') + templates = self.get_cv_templates() + scanner = ShipScanner(level=(1, max_level), emotion=(min_emotion, 150), fleet=self.fleet_to_attack_index, status='free') scanner.disable('rarity') - if self.config.GemsFarming_CommonCV == 'any': + candidates = self.find_candidates(templates, scanner, output=True) + if candidates: + return candidates - ships = scanner.scan(self.device.image) - if ships: - # Don't need to change current - return ships + scanner.set_limitation(fleet=0) + candidates = self.find_candidates(templates, scanner, output=False) + if candidates or templates == []: + return candidates - # Change to any ship - scanner.set_limitation(fleet=0) - return scanner.scan(self.device.image, output=False) + logger.info('No specific CV was found, try reversed order.') + self.dock_sort_method_dsc_set(False) + candidates = self.find_candidates(templates, scanner, output=True) + return candidates - else: - template = { - 'BOGUE': TEMPLATE_BOGUE, - 'HERMES': TEMPLATE_HERMES, - 'LANGLEY': TEMPLATE_LANGLEY, - 'RANGER': TEMPLATE_RANGER - }[f'{self.config.GemsFarming_CommonCV.upper()}'] + @Config.when(Campaign_Mode='normal') + def flagship_change_execute(self): + self.ui_enter_ship(FLEET_ENTER_FLAGSHIP, long_click=False) + candidate = self.get_common_rarity_cv(min_emotion=self.min_emotion) + if candidate: + ship = max(candidate, key=lambda s: (s.level, s.emotion)) + self._new_fleet_emotion = min(ship.emotion, self._new_fleet_emotion) if self._new_fleet_emotion else ship.emotion + self.dock_select_one(ship.button) + self.dock_reset() + self.dock_select_confirm(check_button=page_fleet.check_button) + logger.info('Change flagship success') + return True - ships = scanner.scan(self.device.image) - if ships: - # Don't need to change current - return ships + logger.info('Change flagship failed, no CV in common rarity.') + self._new_fleet_emotion = 0 + self.dock_reset() + self.ui_leave_ship() + return False - scanner.set_limitation(fleet=0) - candidates = [ship for ship in scanner.scan(self.device.image, output=False) - if template.match(self.image_crop(ship.button, copy=False), similarity=SIM_VALUE)] + @Config.when(Campaign_Mode='hard') + def flagship_change_execute(self): + unmount_button = globals()[f'FLEET_{self.fleet_to_attack}_BACKLINE_1'] + mount_button = globals()[f'FLEET_{self.fleet_to_attack}_BACKLINE_3'] + + self.ui_enter_ship(unmount_button, long_click=False) + self.ui_click(DOCK_UNMOUNT, check_button=FLEET_PREPARATION, appear_button=DOCK_CHECK, + additional=self.ensure_no_info_bar, confirm_wait=1, retry_wait=5) + + self.ui_enter_ship(mount_button, long_click=False) + candidate = self.get_common_rarity_cv(max_level=31, min_emotion=self.min_emotion) + if candidate: + ship = max(candidate, key=lambda s: (s.level, s.emotion)) + self._new_fleet_emotion = min(ship.emotion, self._new_fleet_emotion) if self._new_fleet_emotion else ship.emotion + self.dock_select_one(ship.button) + self.dock_reset() + self.dock_select_confirm(check_button=FLEET_PREPARATION) + logger.info('Change flagship success') + return True - if candidates: - # Change to specific ship - return candidates + logger.info('Change flagship failed, try using leveled and exhausted CVs.') + candidate = self.get_common_rarity_cv(max_level=self.max_level, min_emotion=0) + if candidate: + ship = min(candidate, key=lambda s: (s.level, -s.emotion)) + self._new_fleet_emotion = min(ship.emotion, self._new_fleet_emotion) if self._new_fleet_emotion else ship.emotion + self.dock_select_one(ship.button) + self.dock_reset() + self.dock_select_confirm(check_button=FLEET_PREPARATION) + return False + else: + # This should not happen in general since the ship unmounted is also a candidate, + # but just in case, we raise human takeover instead of leaving the flagship empty. + raise RequestHumanTakeover('No CV was found, please change flagship manually.') - logger.info('No specific CV was found, try reversed order.') - self.dock_sort_method_dsc_set(True) + def flagship_change(self): + """ + Change flagship and flagship's equipment - candidates = [ship for ship in scanner.scan(self.device.image) - if template.match(self.image_crop(ship.button, copy=False), similarity=SIM_VALUE)] + Returns: + bool: True if flagship changed. + """ + logger.hr('Change flagship', level=1) + logger.attr('ChangeFlagship', self.config.GemsFarming_ChangeFlagship) + self.ui_goto_fleet() + button = self.fleet_backline_1_button - return candidates + if self.change_flagship_equip: + logger.hr('Unmount flagship equipments', level=2) + self.ui_enter_ship(button, long_click=True) + self.ship_equipment_take_off() + self.ui_leave_ship() - def get_common_rarity_dd(self): - """ - Get a common rarity dd with level is 100 (70 for servers except CN) and emotion > 10 + logger.hr('Change flagship', level=2) + success = self.flagship_change_execute() - _dock_reset() needs to be called later. + if self.change_flagship_equip: + logger.hr('Mount flagship equipments', level=2) + self.ui_enter_ship(button, long_click=True) + self.ship_equipment_take_on() + self.ui_leave_ship() - Returns: - Ship: - """ + return success + + def get_dd_faction(self): if self.config.GemsFarming_CommonDD == 'any': faction = ['eagle', 'iron'] elif self.config.GemsFarming_CommonDD == 'favourite': @@ -213,137 +396,141 @@ def get_common_rarity_dd(self): faction = 'eagle' else: logger.error(f'Invalid CommonDD setting: {self.config.GemsFarming_CommonDD}') - raise ScriptError('Invalid GemsFarming_CommonDD') - - favourite = self.config.GemsFarming_CommonDD == 'favourite' - self.dock_favourite_set(favourite, wait_loading=False) - self.dock_sort_method_dsc_set(True, wait_loading=False) - self.dock_filter_set( - index='dd', rarity='common', faction=faction, extra='can_limit_break') - - logger.hr('FINDING VANGUARD') - - if self.config.SERVER in ['cn']: - max_level = 100 - else: - max_level = 70 - - scanner = ShipScanner(level=(max_level, max_level), emotion=(10, 150), - fleet=[0, self.fleet_to_attack], status='free') - scanner.disable('rarity') - - if self.config.GemsFarming_CommonDD in ['any', 'favourite', 'z20_or_z21']: - # Change to any ship - return scanner.scan(self.device.image) - - candidates = self.find_candidates(self.get_templates(self.config.GemsFarming_CommonDD), scanner) - if candidates: - # Change to specific ship - return candidates - - logger.info('No specific DD was found, try reversed order.') - self.dock_sort_method_dsc_set(False) - - # Change specific ship - candidates = self.find_candidates(self.get_templates(self.config.GemsFarming_CommonDD), scanner) - return candidates - - def find_candidates(self, template, scanner): - """ - Find candidates based on template matching using a scanner. + logger.error("Default to 'eagle' and 'iron' faction.") + faction = ['eagle', 'iron'] + return faction + def get_dd_templates(self): """ - candidates = [] - for item in template: - candidates = [ship for ship in scanner.scan(self.device.image, output=False) - if item.match(self.image_crop(ship.button, copy=False), similarity=SIM_VALUE)] - if candidates: - break - return candidates + Get DD templates based on config.GemsFarming_CommonDD - @staticmethod - def get_templates(common_dd): - """ - Returns the corresponding template list based on CommonDD + Returns: + list[Template]: DD templates """ - if common_dd == 'aulick_or_foote': + if self.config.GemsFarming_CommonDD == 'aulick_or_foote': return [ TEMPLATE_AULICK, TEMPLATE_FOOTE ] - elif common_dd == 'cassin_or_downes': + elif self.config.GemsFarming_CommonDD == 'cassin_or_downes': return [ TEMPLATE_CASSIN_1, TEMPLATE_CASSIN_2, TEMPLATE_DOWNES_1, TEMPLATE_DOWNES_2 ] else: - logger.error(f'Invalid CommonDD setting: {common_dd}') - raise ScriptError(f'Invalid CommonDD setting: {common_dd}') + return [] - def flagship_change_execute(self): + def get_common_rarity_dd(self, min_emotion=0): """ - Returns: - bool: If success. + Get a common rarity dd by config.GemsFarming_CommonDD + If config.GemsFarming_CommonDD == 'any', return a common self.max_level dd by default. - Pages: - in: page_fleet - out: page_fleet + Returns: + list[Ship]: Common rarity DDs that meet the emotion and fleet requirements. """ - for _ in self.loop(): - if self.appear(DOCK_CHECK, offset=(20, 20)): - break - if self.ui_page_appear(page_fleet, interval=5): - self.device.click(FLEET_ENTER_FLAGSHIP) - continue - # 2025.05.29 game tips that infos skin feature when you enter dock - if self.handle_game_tips(): - return True + faction = self.get_dd_faction() + self.dock_favourite_set(self.config.GemsFarming_CommonDD == 'favourite', wait_loading=False) + self.dock_sort_method_dsc_set(True, wait_loading=False) + self.dock_filter_set(index='dd', rarity='common', faction=faction, extra='can_limit_break') - ship = self.get_common_rarity_cv() - if ship: - self._ship_change_confirm(min(ship, key=lambda s: (s.level, -s.emotion)).button) + logger.hr('FINDING VANGUARD') + templates = self.get_dd_templates() + scanner = ShipScanner(level=(self.max_level, self.max_level), emotion=(min_emotion, 150), fleet=[0, self.fleet_to_attack_index], status='free') + scanner.disable('rarity') - logger.info('Change flagship success') + candidates = self.find_candidates(templates, scanner, output=True) + if candidates or templates == []: + return candidates + + logger.info('No specific DD was found, try reversed order.') + self.dock_sort_method_dsc_set(False) + candidates = self.find_candidates(templates, scanner, output=True) + return candidates + + @Config.when(Campaign_Mode='normal') + def vanguard_change_execute(self): + self.ui_enter_ship(FLEET_ENTER, long_click=False) + candidate = self.get_common_rarity_dd(min_emotion=self.min_emotion) + if candidate: + ship = max(candidate, key=lambda s: s.emotion) + self._new_fleet_emotion = min(ship.emotion, self._new_fleet_emotion) if self._new_fleet_emotion else ship.emotion + self.dock_select_one(ship.button) + self.dock_reset() + self.dock_select_confirm(check_button=page_fleet.check_button) + logger.info('Change vanguard success') return True - else: - logger.info('Change flagship failed, no CV in common rarity.') - self._dock_reset() - self.ui_back(check_button=page_fleet.check_button) - return False + logger.info('Change vanguard failed, no DD in common rarity.') + self._new_fleet_emotion = 0 + self.dock_reset() + self.ui_leave_ship() + return False + + @Config.when(Campaign_Mode='hard') def vanguard_change_execute(self): + unmount_button = globals()[f'FLEET_{self.fleet_to_attack}_VANGUARD_1'] + mount_button = globals()[f'FLEET_{self.fleet_to_attack}_VANGUARD_3'] + + self.ui_enter_ship(unmount_button, long_click=False) + self.ui_click(DOCK_UNMOUNT, check_button=FLEET_PREPARATION, appear_button=DOCK_CHECK, + additional=self.ensure_no_info_bar, confirm_wait=1, retry_wait=5) + + self.ui_enter_ship(mount_button, long_click=False) + candidate = self.get_common_rarity_dd(min_emotion=self.min_emotion) + if candidate: + ship = max(candidate, key=lambda s: s.emotion) + self._new_fleet_emotion = min(ship.emotion, self._new_fleet_emotion) if self._new_fleet_emotion else ship.emotion + self.dock_select_one(ship.button) + self.dock_reset() + self.dock_select_confirm(check_button=FLEET_PREPARATION) + logger.info('Change vanguard success') + return True + + logger.info('Change vanguard failed, try using exhausted DDs.') + candidate = self.get_common_rarity_dd(min_emotion=0) + if candidate: + ship = max(candidate, key=lambda s: s.emotion) + self._new_fleet_emotion = min(ship.emotion, self._new_fleet_emotion) if self._new_fleet_emotion else ship.emotion + self.dock_select_one(ship.button) + self.dock_reset() + self.dock_select_confirm(check_button=FLEET_PREPARATION) + return False + else: + # This should not happen in general since the ship unmounted is also a candidate, + # but just in case, we raise human takeover instead of leaving the vanguard slot empty. + raise RequestHumanTakeover('No DD was found, please change vanguard manually.') + + def vanguard_change(self): """ - Returns: - bool: If success. + Change vanguard and vanguard's equipment - Pages: - in: page_fleet - out: page_fleet + Returns: + bool: True if vanguard changed. """ - for _ in self.loop(): - if self.appear(DOCK_CHECK, offset=(20, 20)): - break - if self.ui_page_appear(page_fleet, interval=5): - self.device.click(FLEET_ENTER) - continue - # 2025.05.29 game tips that infos skin feature when you enter dock - if self.handle_game_tips(): - return True + logger.hr('Change vanguard', level=1) + logger.attr('ChangeVanguard', self.config.GemsFarming_ChangeVanguard) + self.ui_goto_fleet() + button = self.fleet_vanguard_1_button - ship = self.get_common_rarity_dd() - if ship: - self._ship_change_confirm(max(ship, key=lambda s: s.emotion).button) + if self.change_vanguard_equip: + logger.hr('Unmount vanguard equipments', level=2) + self.ui_enter_ship(button, long_click=True) + self.ship_equipment_take_off() + self.ui_leave_ship() - logger.info('Change vanguard ship success') - return True - else: - logger.info('Change vanguard ship failed, no DD in common rarity.') - self._dock_reset() - self.ui_back(check_button=page_fleet.check_button) - return False + logger.hr('Change vanguard', level=2) + success = self.vanguard_change_execute() - _trigger_lv32 = False - _trigger_emotion = False + if self.change_vanguard_equip: + logger.hr('Mount vanguard equipments', level=2) + self.ui_enter_ship(button, long_click=True) + self.ship_equipment_take_on() + self.ui_leave_ship() + + return success + + _trigger_lv32: bool = False + _trigger_emotion: bool = False def triggered_stop_condition(self, oil_check=True): # Lv32 limit @@ -352,7 +539,7 @@ def triggered_stop_condition(self, oil_check=True): logger.hr('TRIGGERED LV32 LIMIT') return True - if self.campaign.map_is_auto_search and self.campaign.config.GEMS_EMOTION_TRIGGERED: + if self.campaign.config.GEMS_EMOTION_TRIGGERED: self._trigger_emotion = True logger.hr('TRIGGERED EMOTION LIMIT') return True @@ -376,17 +563,23 @@ def run(self, name, folder='campaign_main', mode='normal', total=0): try: super().run(name=name, folder=folder, total=total) except CampaignEnd as e: - if e.args[0] == 'Emotion withdraw': + if "Emotion" in e.args[0]: self._trigger_emotion = True else: raise e # End if self._trigger_lv32 or self._trigger_emotion: + self._new_fleet_emotion = 150 success = self.flagship_change() if self.change_vanguard: success = success and self.vanguard_change() + if self.fleet_to_attack == 2: + self.campaign.config.set_record(Emotion_Fleet2Value=self._new_fleet_emotion) + else: + self.campaign.config.set_record(Emotion_Fleet1Value=self._new_fleet_emotion) + if is_limit and self.config.StopCondition_RunCount <= 0: logger.hr('Triggered stop condition: Run count') self.config.StopCondition_RunCount = 0 diff --git a/module/campaign/run.py b/module/campaign/run.py index ad3251c544..7289aa41a4 100644 --- a/module/campaign/run.py +++ b/module/campaign/run.py @@ -402,7 +402,8 @@ def run(self, name, folder='campaign_main', mode='normal', total=0): # Because event_20240725 task balancer delete self.campaign.ensure_auto_search_exit() self.campaign.ensure_campaign_ui(name=self.stage, mode=mode) else: - self.campaign.ensure_campaign_ui(name=self.stage, mode=mode) + self.campaign.ensure_campaign_ui(name=self.stage, mode=mode) + self.config.override(Campaign_Mode=self.campaign.config.Campaign_Mode) self.disable_raid_on_event() self.handle_commission_notice() diff --git a/module/config/argument/args.json b/module/config/argument/args.json index d9cc5ef904..00d3d4ac65 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -1597,6 +1597,14 @@ } }, "GemsFarming": { + "ChangeFlagship": { + "type": "select", + "value": "ship", + "option": [ + "ship", + "ship_equip" + ] + }, "CommonCV": { "type": "select", "value": "any", @@ -1613,7 +1621,8 @@ "value": "ship", "option": [ "disabled", - "ship" + "ship", + "ship_equip" ] }, "CommonDD": { @@ -1632,6 +1641,17 @@ "value": true } }, + "EquipmentCode": { + "ExportToConfig": { + "type": "checkbox", + "value": true + }, + "Config": { + "type": "textarea", + "value": "DD: null\nbogue: null\nhermes: null\nlangley: null\nranger: null", + "mode": "yaml" + } + }, "Campaign": { "Name": { "type": "input", @@ -1830,6 +1850,130 @@ "display": "display" } }, + "Emotion": { + "Mode": { + "type": "select", + "value": "calculate_ignore", + "option": [ + "calculate", + "ignore", + "calculate_ignore" + ], + "display": "hide" + }, + "Fleet1Value": { + "type": "input", + "value": 119 + }, + "Fleet1Record": { + "type": "datetime", + "value": "2020-01-01 00:00:00", + "validate": "datetime", + "display": "disabled" + }, + "Fleet1Control": { + "type": "select", + "value": "prevent_red_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" + ], + "display": "hide" + }, + "Fleet1Oath": { + "type": "checkbox", + "value": false, + "display": "hide" + }, + "Fleet2Value": { + "type": "input", + "value": 119 + }, + "Fleet2Record": { + "type": "datetime", + "value": "2020-01-01 00:00:00", + "validate": "datetime", + "display": "disabled" + }, + "Fleet2Control": { + "type": "select", + "value": "prevent_red_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" + } + }, + "Submarine": { + "Fleet": { + "type": "select", + "value": 0, + "option": [ + 0, + 1, + 2 + ] + }, + "Mode": { + "type": "select", + "value": "do_not_use", + "option": [ + "do_not_use", + "hunt_only" + ], + "display": "display" + }, + "AutoSearchMode": { + "type": "select", + "value": "sub_standby", + "option": [ + "sub_standby", + "sub_auto_call" + ], + "display": "hide" + }, + "DistanceToBoss": { + "type": "select", + "value": "use_open_ocean_support", + "option": [ + "to_boss_position", + "1_grid_to_boss", + "2_grid_to_boss", + "use_open_ocean_support" + ], + "display": "hide" + } + }, "Storage": { "Storage": { "type": "storage", diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 77fc24e659..c4e543cf8d 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -265,16 +265,25 @@ C124LargeLeveling: value: 3 option: [ 3, 4, 5 ] GemsFarming: + ChangeFlagship: + value: ship + option: [ ship, ship_equip ] CommonCV: value: any option: [ any, langley, bogue, ranger, hermes ] ChangeVanguard: value: ship - option: [ disabled, ship ] + option: [ disabled, ship, ship_equip ] CommonDD: value: any option: [ any, favourite, aulick_or_foote , cassin_or_downes, z20_or_z21 ] CommissionLimit: true +EquipmentCode: + ExportToConfig: true + Config: + type: textarea + mode: yaml + value: |- # ==================== Event ==================== diff --git a/module/config/argument/default.yaml b/module/config/argument/default.yaml index 1721c59690..402bde98d3 100644 --- a/module/config/argument/default.yaml +++ b/module/config/argument/default.yaml @@ -6,6 +6,15 @@ # ==================== Farm ==================== +GemsFarming: + EquipmentCode: + Config: |- + DD: null + bogue: null + hermes: null + langley: null + ranger: null + # ==================== Event ==================== EventA: diff --git a/module/config/argument/override.yaml b/module/config/argument/override.yaml index 70c88aca19..6d21227159 100644 --- a/module/config/argument/override.yaml +++ b/module/config/argument/override.yaml @@ -46,6 +46,21 @@ GemsFarming: display: display value: fleet1_all_fleet2_standby option: [ fleet1_all_fleet2_standby, fleet1_standby_fleet2_all ] + Emotion: + Mode: calculate_ignore + Fleet1Control: prevent_red_face + Fleet1Recover: not_in_dormitory + Fleet1Oath: false + Fleet2Control: prevent_red_face + Fleet2Recover: not_in_dormitory + Fleet2Oath: false + Submarine: + Mode: + display: display + value: do_not_use + option: [ do_not_use, hunt_only ] + AutoSearchMode: sub_standby + DistanceToBoss: use_open_ocean_support # ==================== Event ==================== diff --git a/module/config/argument/task.yaml b/module/config/argument/task.yaml index c6f20bb00d..65839eb908 100644 --- a/module/config/argument/task.yaml +++ b/module/config/argument/task.yaml @@ -58,9 +58,12 @@ Farm: GemsFarming: - Scheduler - GemsFarming + - EquipmentCode - Campaign - StopCondition - Fleet + - Emotion + - Submarine # ==================== Event ==================== diff --git a/module/config/config_generated.py b/module/config/config_generated.py index e698e9877a..79225d51e5 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -148,11 +148,16 @@ class GeneratedConfig: C124LargeLeveling_PickupAmmo = 3 # 3, 4, 5 # Group `GemsFarming` + GemsFarming_ChangeFlagship = 'ship' # ship, ship_equip GemsFarming_CommonCV = 'any' # any, langley, bogue, ranger, hermes - GemsFarming_ChangeVanguard = 'ship' # disabled, ship + GemsFarming_ChangeVanguard = 'ship' # disabled, ship, ship_equip GemsFarming_CommonDD = 'any' # any, favourite, aulick_or_foote, cassin_or_downes, z20_or_z21 GemsFarming_CommissionLimit = True + # Group `EquipmentCode` + EquipmentCode_ExportToConfig = True + EquipmentCode_Config = None + # Group `EventGeneral` EventGeneral_PtLimit = 0 EventGeneral_TimeLimit = datetime.datetime(2020, 1, 1, 0, 0) diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 681204ff5f..6e9369fb96 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -1189,6 +1189,12 @@ "name": "Commission Farming Settings", "help": "Warning: This task allows players to get a small amount of gems, but not an efficient way to farm.\nPlayers who have recently started Azur Lane are easily superstitious about 0LB and low oil consumption, while being ignorant about character leveling.\nRunning this function will only make you feel fulfilled however in reality your account will not actually progress very much.\nThe main purpose of this task is to get extra cubes for players with a formed lineup. Please rationally treat gems as a by-product.\n\nFleet 1 is expected to consist of 1 0LB CV/CVL and 1 0LB Vanguard, Fleet 2 is expected to consist of support ships such as New Jersey or Shinano to provide external battle assistance.\nFor information about the drop mechanism/rate of urgent commissions, you can refer to (in Chinese Simplified)" }, + "ChangeFlagship": { + "name": "Change Flagship", + "help": "Change flagship if flagship level >= 32 or either flagship or vanguard are emotion exhausted. If you choose not to change, your fleet will ignore the low emotion warning and continue combat.\nSwitch out to new common CV/CVL whose level is in range of 1 to 31, after current has reached level 32+. Meanwhile, abandoned flagships will be retired. Any common CV/CVL whose level is 2+ will be regarded as targets. Do confirm that your own ships which is not a target has been locked\n\nThe flagship's equipment is replaced when being switched out by first recording the current setup\nOnly populated equipment slots will be replaced. If the CV/CVL preference has been configured, all 5 slots will be populated otherwise only the auxiliary slots will be populated.", + "ship": "Change Ship", + "ship_equip": "Change Ship + Gears" + }, "CommonCV": { "name": "Flagship Common CV/CVL Preference", "help": "", @@ -1202,7 +1208,8 @@ "name": "Change Vanguard", "help": "Change vanguard if flagship or vanguard are emotion exhausted. If you choose not to change, your fleet will ignore the low emotion warning and continue combat.\nSwitch out to new level 100(70) common vanguard from eagle or ironblood after current flagship has reached level 32+ (Only CN players'0 limit break ship can reach level 100)\n\nThe vanguard's equipment is replaced when being switched out by first recording the current setup. Only populated equipment slots will be replaced.", "disabled": "Don't Change", - "ship": "Change Ship" + "ship": "Change Ship", + "ship_equip": "Change Ship + Gears" }, "CommonDD": { "name": "Flagship Common DD Preference", @@ -1218,6 +1225,20 @@ "help": "When running 7x24, prevent having a lot of urgent commissions and not being able to complete daily commissions. It is recommended to select only short-terms and high-yields in the commission filter" } }, + "EquipmentCode": { + "_info": { + "name": "Gear Code", + "help": "" + }, + "ExportToConfig": { + "name": "Export to config", + "help": "Only exports if corresponding key has no value. Delete specific row to trigger later update." + }, + "Config": { + "name": "Gear code config", + "help": "Format is yaml" + } + }, "EventGeneral": { "_info": { "name": "Event General Settings", diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index db515ad108..6d2cb06fb1 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -1189,6 +1189,12 @@ "name": "GemsFarming._info.name", "help": "GemsFarming._info.help" }, + "ChangeFlagship": { + "name": "GemsFarming.ChangeFlagship.name", + "help": "GemsFarming.ChangeFlagship.help", + "ship": "ship", + "ship_equip": "ship_equip" + }, "CommonCV": { "name": "GemsFarming.CommonCV.name", "help": "GemsFarming.CommonCV.help", @@ -1202,7 +1208,8 @@ "name": "GemsFarming.ChangeVanguard.name", "help": "GemsFarming.ChangeVanguard.help", "disabled": "disabled", - "ship": "ship" + "ship": "ship", + "ship_equip": "ship_equip" }, "CommonDD": { "name": "GemsFarming.CommonDD.name", @@ -1218,6 +1225,20 @@ "help": "GemsFarming.CommissionLimit.help" } }, + "EquipmentCode": { + "_info": { + "name": "EquipmentCode._info.name", + "help": "EquipmentCode._info.help" + }, + "ExportToConfig": { + "name": "EquipmentCode.ExportToConfig.name", + "help": "EquipmentCode.ExportToConfig.help" + }, + "Config": { + "name": "EquipmentCode.Config.name", + "help": "EquipmentCode.Config.help" + } + }, "EventGeneral": { "_info": { "name": "EventGeneral._info.name", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 07bac69f12..ea160e62ae 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -1189,6 +1189,12 @@ "name": "刷紧急委托", "help": "警告: 这个功能可以让玩家获取少量的钻石,但不是一个能高效获取钻石的方法\n玩碧蓝航线不久的玩家, 很容易迷信零破和低耗等, 而忽视了角色养成\n运行这个功能只会让你自己感觉很充实, 而你的帐号实际零提升\n这个功能的主要用途,是让阵容成型的玩家获取额外的魔方,请理性地把钻石当作副产物\n\n这个功能将在旗舰32级之后更换旗舰\n关于紧急委托刷新机制, 可阅读 https://bbs.nga.cn/read.php?tid=27134956\n委托油耗比: A3 > A1 > 2-4 > 2-1, 有活动图时建议选活动图, 2-1会拣问号有更多物资\n一队会完成所有的战斗, 前排应当为百级零破驱逐带输出装, 后排应该为33级及以下白皮零破航母\n二队应提供跨队支援(跨队弹幕、跨队辅助)" }, + "ChangeFlagship": { + "name": "更换旗舰", + "help": "当旗舰等级>=32或红脸时更换旗舰\n寻找等级在1-31之间的白皮航母,同时会在退役时选择更换下来的旗舰。所有等级大于1级的白皮航母均会被视为退役目标,请务必锁定不是目标的船。换船时更换旗舰装备,这通过记录之前的装备完成。\n\n换装备只会更换正在装备中的栏位,即使是白装也会更换。如果指定了旗舰,则会更换全部5个装备,未指定旗舰只会更换设备。", + "ship": "更换舰船", + "ship_equip": "更换舰船 + 装备" + }, "CommonCV": { "name": "指定旗舰航母", "help": "", @@ -1202,7 +1208,8 @@ "name": "更换前排", "help": "当前排红脸时更换前排,选择不更换则会强制红脸出击\n换前排通过找一艘心情不低于10、等级100的白鹰或铁血的白皮驱逐完成,所以尽量保证有足够多的驱逐。国服以外则为等级70的白鹰白船驱逐。\n\n换装备只会更换正在装备中的栏位,即使是白装也会更换。前排会更换全部5个装备。", "disabled": "不更换", - "ship": "更换舰船" + "ship": "更换舰船", + "ship_equip": "更换舰船 + 装备" }, "CommonDD": { "name": "指定前排", @@ -1218,6 +1225,20 @@ "help": "在7x24运行时防止紧急委托数量过多做不完每日委托,建议在委托过滤器仅选择短时长高收益委托" } }, + "EquipmentCode": { + "_info": { + "name": "装备码", + "help": "" + }, + "ExportToConfig": { + "name": "导出配置", + "help": "若原本对应字段有值则不会更新,请通过删除配置中对应字段来触发更新" + }, + "Config": { + "name": "具体配置", + "help": "格式为yaml" + } + }, "EventGeneral": { "_info": { "name": "活动通用设置", diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index 51f8d664a0..e3b8ca464f 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -1189,6 +1189,12 @@ "name": "刷緊急委託", "help": "警告:這個功能可以讓玩家獲取少量的鑽石,但不是一個能高效獲取鑽石的方法\n玩碧藍航線不久的玩家,很容易迷信零破和低耗等,而忽視了角色養成\n執行這個功能只會讓你自己感覺很充實,而你的帳號實際零提升\n這個功能的主要用途,是讓陣容成型的玩家獲取額外的魔方,請理性地把鑽石當作副產物\n\n這個功能將在旗艦32級之後更換旗艦\n關於緊急委託刷新機制,可閱讀 https://bbs.nga.cn/read.php?tid=27134956\n委託油耗比: A3 > A1 > 2-4 > 2-1,有活動圖時建議選活動圖,2-1會撿問號有更多物資\n一隊會完成所有的戰鬥,前排應當為百級零破驅逐帶輸出裝,後排應該為33級及以下白船零破航母\n二隊應提供跨隊支援(跨隊彈幕、跨隊輔助)" }, + "ChangeFlagship": { + "name": "更換旗艦", + "help": "當旗艦等級>=32或紅臉時更換旗艦\n尋找等級在1-31之間的白皮航母,同時會在退役時選擇更換下來的旗艦。所有等級大於1級的白船航母均會被視為退役目標,請務必鎖定不是目標的船。換船時更換旗艦裝備,這通過記錄之前的裝備完成。\n\n換裝備只會更換正在裝備中的欄位,即使是白裝也會更換。如果指定了旗艦,則會更換全部5個裝備,未指定旗艦隻會更換設備。", + "ship": "更換艦船", + "ship_equip": "更換艦船 + 裝備" + }, "CommonCV": { "name": "指定旗艦航母", "help": "", @@ -1202,7 +1208,8 @@ "name": "更換前排", "help": "當前排紅臉時更換前排,選擇不更換則會強制紅臉出擊\n換前排通過找一艘心情不低於10、等級70的白鷹或鐵血的白船驅逐完成,所以盡量保證有足夠多的驅逐。國服則為等級100的白鷹白船驅逐。\n\n換裝備只會更換正在裝備中的欄位,即使是白裝也會更換。前排會更換全部5個裝備。", "disabled": "不更换", - "ship": "更換艦船" + "ship": "更換艦船", + "ship_equip": "更換艦船 + 裝備" }, "CommonDD": { "name": "指定前排", @@ -1218,6 +1225,20 @@ "help": "在7x24運行時防止緊急委託數量過多做不完每日委託,建議在委託過濾器僅選擇短時長高收益委託" } }, + "EquipmentCode": { + "_info": { + "name": "裝備碼", + "help": "" + }, + "ExportToConfig": { + "name": "導出配置", + "help": "若原本對應欄位有值則不會更新,請透過刪除配置中對應欄位來觸發更新" + }, + "Config": { + "name": "具體配置", + "help": "格式為yaml" + } + }, "EventGeneral": { "_info": { "name": "活動通用設定", diff --git a/module/daily/daily.py b/module/daily/daily.py index 6d8f3c03d7..f9b86c336a 100644 --- a/module/daily/daily.py +++ b/module/daily/daily.py @@ -5,7 +5,6 @@ from module.combat.assets import BATTLE_PREPARATION from module.combat.combat import Combat from module.daily.assets import * -from module.daily.equipment import DailyEquipment from module.logger import logger from module.ocr.ocr import Digit from module.ui.assets import BACK_ARROW, DAILY_CHECK @@ -19,7 +18,7 @@ OCR_DAILY_FLEET_INDEX = Digit(OCR_DAILY_FLEET_INDEX, letter=(90, 154, 255), threshold=128, alphabet='123456') -class Daily(Combat, DailyEquipment): +class Daily(Combat): daily_current: int daily_checked: list emergency_module_development = False @@ -337,9 +336,7 @@ def run(self): in: Any page out: page_daily """ - # self.equipment_take_on() self.daily_run() - # self.equipment_take_off() # Cannot stay in page_daily, because order is disordered. self.config.task_delay(server_update=True) diff --git a/module/daily/equipment.py b/module/daily/equipment.py deleted file mode 100644 index 6e11bd08b3..0000000000 --- a/module/daily/equipment.py +++ /dev/null @@ -1,38 +0,0 @@ -from module.equipment.fleet_equipment import FleetEquipment -from module.logger import logger - - -class DailyEquipment(FleetEquipment): - - def fleet_enter(self, fleet=None): - fleet = self.config.FLEET_DAILY - if isinstance(fleet, list): - logger.info(f'Multiple daily fleets are set, change equipment only for the first one. fleet: {fleet}') - fleet = fleet[0] - super().fleet_enter(fleet) - - def equipment_take_on(self): - if self.config.FLEET_DAILY_EQUIPMENT is None: - return False - if self.equipment_has_take_on: - return False - - self.fleet_enter() - self.fleet_equipment_take_on_preset(preset_record=self.config.FLEET_DAILY_EQUIPMENT) - self.ui_back(self.is_in_main) - self.equipment_has_take_on = True - self.device.sleep(1) - return True - - def equipment_take_off(self): - if self.config.FLEET_DAILY_EQUIPMENT is None: - return False - if not self.equipment_has_take_on: - return False - - self.fleet_enter() - self.fleet_equipment_take_off() - self.ui_back(self.is_in_main) - self.equipment_has_take_on = False - self.device.sleep(1) - return True diff --git a/module/equipment/assets.py b/module/equipment/assets.py index 64f619f253..e63bb7cb7f 100644 --- a/module/equipment/assets.py +++ b/module/equipment/assets.py @@ -4,7 +4,22 @@ # This file was automatically generated by dev_tools/button_extract.py. # Don't modify it manually. +EMPTY_SHIP_R = Button(area={'cn': (192, 359, 268, 435), 'en': (192, 359, 268, 435), 'jp': (192, 359, 268, 435), 'tw': (192, 359, 268, 435)}, color={'cn': (144, 144, 144), 'en': (144, 144, 144), 'jp': (144, 144, 144), 'tw': (144, 144, 144)}, button={'cn': (192, 359, 268, 435), 'en': (192, 359, 268, 435), 'jp': (192, 359, 268, 435), 'tw': (192, 359, 268, 435)}, file={'cn': './assets/cn/equipment/EMPTY_SHIP_R.png', 'en': './assets/en/equipment/EMPTY_SHIP_R.png', 'jp': './assets/jp/equipment/EMPTY_SHIP_R.png', 'tw': './assets/tw/equipment/EMPTY_SHIP_R.png'}) EQUIPMENT_CLOSE = Button(area={'cn': (1139, 87, 1231, 111), 'en': (1139, 86, 1232, 113), 'jp': (1139, 87, 1232, 112), 'tw': (1138, 88, 1232, 112)}, color={'cn': (215, 149, 69), 'en': (212, 147, 66), 'jp': (216, 150, 71), 'tw': (215, 151, 72)}, button={'cn': (1139, 87, 1231, 111), 'en': (1139, 86, 1232, 113), 'jp': (1139, 87, 1232, 112), 'tw': (1138, 88, 1232, 112)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CLOSE.png', 'en': './assets/en/equipment/EQUIPMENT_CLOSE.png', 'jp': './assets/jp/equipment/EQUIPMENT_CLOSE.png', 'tw': './assets/tw/equipment/EQUIPMENT_CLOSE.png'}) +EQUIPMENT_CODE_CLEAR = Button(area={'cn': (999, 477, 1121, 519), 'en': (1000, 472, 1120, 512), 'jp': (1000, 478, 1120, 518), 'tw': (1000, 478, 1120, 518)}, color={'cn': (142, 146, 151), 'en': (135, 141, 145), 'jp': (134, 139, 144), 'tw': (142, 146, 151)}, button={'cn': (999, 477, 1121, 519), 'en': (1000, 472, 1120, 512), 'jp': (1000, 478, 1120, 518), 'tw': (1000, 478, 1120, 518)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_CLEAR.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_CLEAR.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_CLEAR.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_CLEAR.png'}) +EQUIPMENT_CODE_CONFIRM = Button(area={'cn': (999, 544, 1122, 586), 'en': (1000, 544, 1121, 584), 'jp': (1000, 545, 1121, 585), 'tw': (1000, 545, 1121, 585)}, color={'cn': (81, 137, 202), 'en': (94, 148, 207), 'jp': (95, 147, 205), 'tw': (81, 137, 202)}, button={'cn': (999, 544, 1122, 586), 'en': (1000, 544, 1121, 584), 'jp': (1000, 545, 1121, 585), 'tw': (1000, 545, 1121, 585)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_CONFIRM.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_CONFIRM.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_CONFIRM.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_CONFIRM.png'}) +EQUIPMENT_CODE_ENTER = Button(area={'cn': (875, 667, 1004, 707), 'en': (876, 669, 1003, 706), 'jp': (876, 669, 1003, 706), 'tw': (876, 669, 1003, 706)}, color={'cn': (80, 129, 188), 'en': (81, 132, 192), 'jp': (81, 129, 189), 'tw': (82, 132, 191)}, button={'cn': (875, 667, 1004, 707), 'en': (876, 669, 1003, 706), 'jp': (876, 669, 1003, 706), 'tw': (876, 669, 1003, 706)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_ENTER.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_ENTER.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_ENTER.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_ENTER.png'}) +EQUIPMENT_CODE_ENTRANCE = Button(area={'cn': (936, 88, 1028, 111), 'en': (936, 89, 1028, 111), 'jp': (937, 88, 1028, 111), 'tw': (936, 89, 1028, 111)}, color={'cn': (94, 148, 208), 'en': (85, 143, 210), 'jp': (93, 148, 208), 'tw': (98, 152, 213)}, button={'cn': (936, 88, 1028, 111), 'en': (936, 89, 1028, 111), 'jp': (937, 88, 1028, 111), 'tw': (936, 89, 1028, 111)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_ENTRANCE.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_ENTRANCE.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_ENTRANCE.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_ENTRANCE.png'}) +EQUIPMENT_CODE_EQUIP_0 = Button(area={'cn': (324, 356, 407, 439), 'en': (324, 356, 407, 439), 'jp': (324, 356, 407, 439), 'tw': (324, 356, 407, 439)}, color={'cn': (44, 65, 88), 'en': (44, 65, 88), 'jp': (44, 65, 88), 'tw': (44, 65, 88)}, button={'cn': (324, 356, 407, 439), 'en': (324, 356, 407, 439), 'jp': (324, 356, 407, 439), 'tw': (324, 356, 407, 439)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_EQUIP_0.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_EQUIP_0.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_EQUIP_0.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_EQUIP_0.png'}) +EQUIPMENT_CODE_EQUIP_1 = Button(area={'cn': (424, 356, 507, 439), 'en': (424, 356, 507, 439), 'jp': (424, 356, 507, 439), 'tw': (424, 356, 507, 439)}, color={'cn': (43, 65, 88), 'en': (43, 65, 88), 'jp': (43, 65, 88), 'tw': (43, 65, 88)}, button={'cn': (424, 356, 507, 439), 'en': (424, 356, 507, 439), 'jp': (424, 356, 507, 439), 'tw': (424, 356, 507, 439)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_EQUIP_1.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_EQUIP_1.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_EQUIP_1.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_EQUIP_1.png'}) +EQUIPMENT_CODE_EQUIP_2 = Button(area={'cn': (524, 356, 607, 439), 'en': (524, 356, 607, 439), 'jp': (524, 356, 607, 439), 'tw': (524, 356, 607, 439)}, color={'cn': (43, 66, 89), 'en': (43, 66, 89), 'jp': (43, 66, 89), 'tw': (43, 66, 89)}, button={'cn': (524, 356, 607, 439), 'en': (524, 356, 607, 439), 'jp': (524, 356, 607, 439), 'tw': (524, 356, 607, 439)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_EQUIP_2.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_EQUIP_2.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_EQUIP_2.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_EQUIP_2.png'}) +EQUIPMENT_CODE_EQUIP_3 = Button(area={'cn': (624, 356, 707, 439), 'en': (624, 356, 707, 439), 'jp': (624, 356, 707, 439), 'tw': (624, 356, 707, 439)}, color={'cn': (40, 62, 87), 'en': (40, 62, 87), 'jp': (40, 62, 87), 'tw': (40, 62, 87)}, button={'cn': (624, 356, 707, 439), 'en': (624, 356, 707, 439), 'jp': (624, 356, 707, 439), 'tw': (624, 356, 707, 439)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_EQUIP_3.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_EQUIP_3.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_EQUIP_3.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_EQUIP_3.png'}) +EQUIPMENT_CODE_EQUIP_4 = Button(area={'cn': (724, 356, 807, 439), 'en': (724, 356, 807, 439), 'jp': (724, 356, 807, 439), 'tw': (724, 356, 807, 439)}, color={'cn': (40, 63, 87), 'en': (40, 63, 87), 'jp': (40, 63, 87), 'tw': (40, 63, 87)}, button={'cn': (724, 356, 807, 439), 'en': (724, 356, 807, 439), 'jp': (724, 356, 807, 439), 'tw': (724, 356, 807, 439)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_EQUIP_4.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_EQUIP_4.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_EQUIP_4.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_EQUIP_4.png'}) +EQUIPMENT_CODE_EQUIP_5 = Button(area={'cn': (823, 355, 916, 440), 'en': (823, 355, 916, 440), 'jp': (823, 355, 916, 440), 'tw': (823, 355, 916, 440)}, color={'cn': (55, 79, 104), 'en': (55, 79, 104), 'jp': (55, 79, 104), 'tw': (55, 79, 104)}, button={'cn': (823, 355, 916, 440), 'en': (823, 355, 916, 440), 'jp': (823, 355, 916, 440), 'tw': (823, 355, 916, 440)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_EQUIP_5.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_EQUIP_5.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_EQUIP_5.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_EQUIP_5.png'}) +EQUIPMENT_CODE_EQUIP_5_LOCKED = Button(area={'cn': (823, 355, 916, 440), 'en': (823, 355, 916, 440), 'jp': (823, 355, 916, 440), 'tw': (823, 355, 916, 440)}, color={'cn': (65, 84, 107), 'en': (65, 84, 107), 'jp': (65, 84, 107), 'tw': (65, 84, 107)}, button={'cn': (823, 355, 916, 440), 'en': (823, 355, 916, 440), 'jp': (823, 355, 916, 440), 'tw': (823, 355, 916, 440)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_EQUIP_5_LOCKED.png'}) +EQUIPMENT_CODE_EXPORT = Button(area={'cn': (1000, 200, 1121, 241), 'en': (1000, 200, 1121, 241), 'jp': (1000, 200, 1121, 241), 'tw': (1000, 200, 1121, 241)}, color={'cn': (81, 138, 203), 'en': (88, 144, 206), 'jp': (92, 145, 205), 'tw': (85, 140, 204)}, button={'cn': (1000, 200, 1121, 241), 'en': (1000, 200, 1121, 241), 'jp': (1000, 200, 1121, 241), 'tw': (1000, 200, 1121, 241)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_EXPORT.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_EXPORT.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_EXPORT.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_EXPORT.png'}) +EQUIPMENT_CODE_PAGE_CHECK = Button(area={'cn': (1000, 113, 1050, 160), 'en': (1000, 113, 1050, 160), 'jp': (1000, 113, 1050, 160), 'tw': (1000, 113, 1050, 160)}, color={'cn': (102, 122, 154), 'en': (102, 122, 154), 'jp': (102, 122, 154), 'tw': (102, 122, 154)}, button={'cn': (1000, 113, 1050, 160), 'en': (1000, 113, 1050, 160), 'jp': (1000, 113, 1050, 160), 'tw': (1000, 113, 1050, 160)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_PAGE_CHECK.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_PAGE_CHECK.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_PAGE_CHECK.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_PAGE_CHECK.png'}) +EQUIPMENT_CODE_TEXTBOX = Button(area={'cn': (446, 668, 834, 706), 'en': (444, 667, 836, 707), 'jp': (444, 667, 836, 707), 'tw': (444, 667, 836, 707)}, color={'cn': (45, 47, 60), 'en': (47, 50, 62), 'jp': (48, 51, 63), 'tw': (45, 48, 60)}, button={'cn': (446, 668, 834, 706), 'en': (444, 667, 836, 707), 'jp': (444, 667, 836, 707), 'tw': (444, 667, 836, 707)}, file={'cn': './assets/cn/equipment/EQUIPMENT_CODE_TEXTBOX.png', 'en': './assets/en/equipment/EQUIPMENT_CODE_TEXTBOX.png', 'jp': './assets/jp/equipment/EQUIPMENT_CODE_TEXTBOX.png', 'tw': './assets/tw/equipment/EQUIPMENT_CODE_TEXTBOX.png'}) EQUIPMENT_OPEN = Button(area={'cn': (1166, 91, 1203, 110), 'en': (1162, 92, 1211, 107), 'jp': (1167, 91, 1202, 110), 'tw': (1165, 91, 1203, 110)}, color={'cn': (128, 178, 223), 'en': (102, 157, 212), 'jp': (133, 181, 225), 'tw': (132, 180, 222)}, button={'cn': (1166, 91, 1203, 110), 'en': (1162, 92, 1211, 107), 'jp': (1167, 91, 1202, 110), 'tw': (1165, 91, 1203, 110)}, file={'cn': './assets/cn/equipment/EQUIPMENT_OPEN.png', 'en': './assets/en/equipment/EQUIPMENT_OPEN.png', 'jp': './assets/jp/equipment/EQUIPMENT_OPEN.png', 'tw': './assets/tw/equipment/EQUIPMENT_OPEN.png'}) EQUIPMENT_SCROLL_BOTTOM = Button(area={'cn': (1256, 575, 1264, 583), 'en': (1256, 575, 1264, 583), 'jp': (1256, 575, 1264, 583), 'tw': (1256, 575, 1264, 583)}, color={'cn': (244, 209, 66), 'en': (244, 209, 66), 'jp': (244, 209, 66), 'tw': (244, 209, 66)}, button={'cn': (1256, 575, 1264, 583), 'en': (1256, 575, 1264, 583), 'jp': (1256, 575, 1264, 583), 'tw': (1256, 575, 1264, 583)}, file={'cn': './assets/cn/equipment/EQUIPMENT_SCROLL_BOTTOM.png', 'en': './assets/en/equipment/EQUIPMENT_SCROLL_BOTTOM.png', 'jp': './assets/jp/equipment/EQUIPMENT_SCROLL_BOTTOM.png', 'tw': './assets/tw/equipment/EQUIPMENT_SCROLL_BOTTOM.png'}) EQUIPPING_OFF = Button(area={'cn': (25, 565, 60, 589), 'en': (30, 585, 59, 605), 'jp': (25, 565, 60, 589), 'tw': (25, 565, 60, 589)}, color={'cn': (94, 101, 104), 'en': (65, 70, 96), 'jp': (94, 101, 104), 'tw': (94, 101, 104)}, button={'cn': (25, 565, 60, 589), 'en': (30, 585, 59, 605), 'jp': (25, 565, 60, 589), 'tw': (25, 565, 60, 589)}, file={'cn': './assets/cn/equipment/EQUIPPING_OFF.png', 'en': './assets/en/equipment/EQUIPPING_OFF.png', 'jp': './assets/jp/equipment/EQUIPPING_OFF.png', 'tw': './assets/tw/equipment/EQUIPPING_OFF.png'}) @@ -21,6 +36,14 @@ EQUIP_TAKE_ON_2 = Button(area={'cn': (866, 511, 950, 604), 'en': (866, 511, 950, 604), 'jp': (866, 511, 950, 604), 'tw': (866, 511, 950, 604)}, color={'cn': (117, 118, 127), 'en': (117, 118, 127), 'jp': (117, 118, 127), 'tw': (117, 118, 127)}, button={'cn': (866, 511, 950, 604), 'en': (866, 511, 950, 604), 'jp': (866, 511, 950, 604), 'tw': (866, 511, 950, 604)}, file={'cn': './assets/cn/equipment/EQUIP_TAKE_ON_2.png', 'en': './assets/en/equipment/EQUIP_TAKE_ON_2.png', 'jp': './assets/jp/equipment/EQUIP_TAKE_ON_2.png', 'tw': './assets/tw/equipment/EQUIP_TAKE_ON_2.png'}) EQUIP_TAKE_ON_3 = Button(area={'cn': (129, 252, 213, 345), 'en': (129, 252, 213, 345), 'jp': (129, 252, 213, 345), 'tw': (129, 252, 213, 345)}, color={'cn': (105, 108, 115), 'en': (105, 108, 115), 'jp': (105, 108, 115), 'tw': (105, 108, 115)}, button={'cn': (129, 252, 213, 345), 'en': (129, 252, 213, 345), 'jp': (129, 252, 213, 345), 'tw': (129, 252, 213, 345)}, file={'cn': './assets/cn/equipment/EQUIP_TAKE_ON_3.png', 'en': './assets/en/equipment/EQUIP_TAKE_ON_3.png', 'jp': './assets/jp/equipment/EQUIP_TAKE_ON_3.png', 'tw': './assets/tw/equipment/EQUIP_TAKE_ON_3.png'}) EQUIP_TAKE_ON_4 = Button(area={'cn': (128, 432, 212, 525), 'en': (128, 432, 212, 525), 'jp': (128, 432, 212, 525), 'tw': (128, 432, 212, 525)}, color={'cn': (109, 111, 120), 'en': (109, 111, 120), 'jp': (109, 111, 120), 'tw': (109, 111, 120)}, button={'cn': (128, 432, 212, 525), 'en': (128, 432, 212, 525), 'jp': (128, 432, 212, 525), 'tw': (128, 432, 212, 525)}, file={'cn': './assets/cn/equipment/EQUIP_TAKE_ON_4.png', 'en': './assets/en/equipment/EQUIP_TAKE_ON_4.png', 'jp': './assets/jp/equipment/EQUIP_TAKE_ON_4.png', 'tw': './assets/tw/equipment/EQUIP_TAKE_ON_4.png'}) +FLEET_1_BACKLINE_1 = Button(area={'cn': (412, 195, 456, 239), 'en': (412, 195, 456, 239), 'jp': (412, 195, 456, 239), 'tw': (412, 195, 456, 239)}, color={'cn': (76, 67, 66), 'en': (76, 67, 66), 'jp': (76, 67, 66), 'tw': (76, 67, 66)}, button={'cn': (412, 195, 456, 239), 'en': (412, 195, 456, 239), 'jp': (412, 195, 456, 239), 'tw': (412, 195, 456, 239)}, file={'cn': './assets/cn/equipment/FLEET_1_BACKLINE_1.png', 'en': './assets/en/equipment/FLEET_1_BACKLINE_1.png', 'jp': './assets/jp/equipment/FLEET_1_BACKLINE_1.png', 'tw': './assets/tw/equipment/FLEET_1_BACKLINE_1.png'}) +FLEET_1_BACKLINE_3 = Button(area={'cn': (616, 195, 659, 238), 'en': (616, 195, 659, 238), 'jp': (616, 195, 659, 238), 'tw': (616, 195, 659, 238)}, color={'cn': (62, 62, 67), 'en': (62, 62, 67), 'jp': (62, 62, 67), 'tw': (62, 62, 67)}, button={'cn': (616, 195, 659, 238), 'en': (616, 195, 659, 238), 'jp': (616, 195, 659, 238), 'tw': (616, 195, 659, 238)}, file={'cn': './assets/cn/equipment/FLEET_1_BACKLINE_3.png', 'en': './assets/en/equipment/FLEET_1_BACKLINE_3.png', 'jp': './assets/jp/equipment/FLEET_1_BACKLINE_3.png', 'tw': './assets/tw/equipment/FLEET_1_BACKLINE_3.png'}) +FLEET_1_VANGUARD_1 = Button(area={'cn': (728, 195, 770, 237), 'en': (728, 195, 770, 237), 'jp': (728, 195, 770, 237), 'tw': (728, 195, 770, 237)}, color={'cn': (54, 57, 63), 'en': (54, 57, 63), 'jp': (54, 57, 63), 'tw': (54, 57, 63)}, button={'cn': (728, 195, 770, 237), 'en': (728, 195, 770, 237), 'jp': (728, 195, 770, 237), 'tw': (728, 195, 770, 237)}, file={'cn': './assets/cn/equipment/FLEET_1_VANGUARD_1.png', 'en': './assets/en/equipment/FLEET_1_VANGUARD_1.png', 'jp': './assets/jp/equipment/FLEET_1_VANGUARD_1.png', 'tw': './assets/tw/equipment/FLEET_1_VANGUARD_1.png'}) +FLEET_1_VANGUARD_3 = Button(area={'cn': (932, 195, 974, 237), 'en': (932, 195, 974, 237), 'jp': (932, 195, 974, 237), 'tw': (932, 195, 974, 237)}, color={'cn': (53, 55, 62), 'en': (53, 55, 62), 'jp': (53, 55, 62), 'tw': (53, 55, 62)}, button={'cn': (932, 195, 974, 237), 'en': (932, 195, 974, 237), 'jp': (932, 195, 974, 237), 'tw': (932, 195, 974, 237)}, file={'cn': './assets/cn/equipment/FLEET_1_VANGUARD_3.png', 'en': './assets/en/equipment/FLEET_1_VANGUARD_3.png', 'jp': './assets/jp/equipment/FLEET_1_VANGUARD_3.png', 'tw': './assets/tw/equipment/FLEET_1_VANGUARD_3.png'}) +FLEET_2_BACKLINE_1 = Button(area={'cn': (412, 309, 455, 352), 'en': (412, 309, 455, 352), 'jp': (412, 309, 455, 352), 'tw': (412, 309, 455, 352)}, color={'cn': (73, 64, 63), 'en': (73, 64, 63), 'jp': (73, 64, 63), 'tw': (73, 64, 63)}, button={'cn': (412, 309, 455, 352), 'en': (412, 309, 455, 352), 'jp': (412, 309, 455, 352), 'tw': (412, 309, 455, 352)}, file={'cn': './assets/cn/equipment/FLEET_2_BACKLINE_1.png', 'en': './assets/en/equipment/FLEET_2_BACKLINE_1.png', 'jp': './assets/jp/equipment/FLEET_2_BACKLINE_1.png', 'tw': './assets/tw/equipment/FLEET_2_BACKLINE_1.png'}) +FLEET_2_BACKLINE_3 = Button(area={'cn': (616, 309, 659, 352), 'en': (616, 309, 659, 352), 'jp': (616, 309, 659, 352), 'tw': (616, 309, 659, 352)}, color={'cn': (51, 52, 57), 'en': (51, 52, 57), 'jp': (51, 52, 57), 'tw': (51, 52, 57)}, button={'cn': (616, 309, 659, 352), 'en': (616, 309, 659, 352), 'jp': (616, 309, 659, 352), 'tw': (616, 309, 659, 352)}, file={'cn': './assets/cn/equipment/FLEET_2_BACKLINE_3.png', 'en': './assets/en/equipment/FLEET_2_BACKLINE_3.png', 'jp': './assets/jp/equipment/FLEET_2_BACKLINE_3.png', 'tw': './assets/tw/equipment/FLEET_2_BACKLINE_3.png'}) +FLEET_2_VANGUARD_1 = Button(area={'cn': (729, 310, 770, 351), 'en': (729, 310, 770, 351), 'jp': (729, 310, 770, 351), 'tw': (729, 310, 770, 351)}, color={'cn': (52, 54, 61), 'en': (52, 54, 61), 'jp': (52, 54, 61), 'tw': (52, 54, 61)}, button={'cn': (729, 310, 770, 351), 'en': (729, 310, 770, 351), 'jp': (729, 310, 770, 351), 'tw': (729, 310, 770, 351)}, file={'cn': './assets/cn/equipment/FLEET_2_VANGUARD_1.png', 'en': './assets/en/equipment/FLEET_2_VANGUARD_1.png', 'jp': './assets/jp/equipment/FLEET_2_VANGUARD_1.png', 'tw': './assets/tw/equipment/FLEET_2_VANGUARD_1.png'}) +FLEET_2_VANGUARD_3 = Button(area={'cn': (932, 309, 974, 351), 'en': (932, 309, 974, 351), 'jp': (932, 309, 974, 351), 'tw': (932, 309, 974, 351)}, color={'cn': (51, 54, 62), 'en': (51, 54, 62), 'jp': (51, 54, 62), 'tw': (51, 54, 62)}, button={'cn': (932, 309, 974, 351), 'en': (932, 309, 974, 351), 'jp': (932, 309, 974, 351), 'tw': (932, 309, 974, 351)}, file={'cn': './assets/cn/equipment/FLEET_2_VANGUARD_3.png', 'en': './assets/en/equipment/FLEET_2_VANGUARD_3.png', 'jp': './assets/jp/equipment/FLEET_2_VANGUARD_3.png', 'tw': './assets/tw/equipment/FLEET_2_VANGUARD_3.png'}) FLEET_DETAIL = Button(area={'cn': (906, 644, 1008, 699), 'en': (906, 644, 1008, 699), 'jp': (906, 644, 1008, 699), 'tw': (906, 644, 1008, 699)}, color={'cn': (166, 170, 188), 'en': (166, 170, 188), 'jp': (166, 170, 188), 'tw': (166, 170, 188)}, button={'cn': (906, 644, 1008, 699), 'en': (906, 644, 1008, 699), 'jp': (906, 644, 1008, 699), 'tw': (906, 644, 1008, 699)}, file={'cn': './assets/cn/equipment/FLEET_DETAIL.png', 'en': './assets/en/equipment/FLEET_DETAIL.png', 'jp': './assets/jp/equipment/FLEET_DETAIL.png', 'tw': './assets/tw/equipment/FLEET_DETAIL.png'}) FLEET_DETAIL_CHECK = Button(area={'cn': (915, 647, 980, 679), 'en': (915, 649, 980, 677), 'jp': (915, 647, 979, 679), 'tw': (915, 647, 980, 680)}, color={'cn': (234, 195, 154), 'en': (236, 200, 160), 'jp': (234, 195, 154), 'tw': (237, 196, 154)}, button={'cn': (915, 647, 980, 679), 'en': (915, 649, 980, 677), 'jp': (915, 647, 979, 679), 'tw': (915, 647, 980, 680)}, file={'cn': './assets/cn/equipment/FLEET_DETAIL_CHECK.png', 'en': './assets/en/equipment/FLEET_DETAIL_CHECK.png', 'jp': './assets/jp/equipment/FLEET_DETAIL_CHECK.png', 'tw': './assets/tw/equipment/FLEET_DETAIL_CHECK.png'}) FLEET_DETAIL_ENTER = Button(area={'cn': (729, 314, 802, 438), 'en': (729, 314, 802, 438), 'jp': (729, 314, 802, 438), 'tw': (729, 314, 802, 438)}, color={'cn': (154, 149, 147), 'en': (154, 149, 147), 'jp': (154, 149, 147), 'tw': (154, 149, 147)}, button={'cn': (729, 314, 802, 438), 'en': (729, 314, 802, 438), 'jp': (729, 314, 802, 438), 'tw': (729, 314, 802, 438)}, file={'cn': './assets/cn/equipment/FLEET_DETAIL_ENTER.png', 'en': './assets/en/equipment/FLEET_DETAIL_ENTER.png', 'jp': './assets/jp/equipment/FLEET_DETAIL_ENTER.png', 'tw': './assets/tw/equipment/FLEET_DETAIL_ENTER.png'}) diff --git a/module/equipment/equipment.py b/module/equipment/equipment.py index 9b45de34e4..a015a13534 100644 --- a/module/equipment/equipment.py +++ b/module/equipment/equipment.py @@ -2,9 +2,9 @@ from module.base.decorator import cached_property from module.base.timer import Timer from module.equipment.assets import * +from module.equipment.equipment_code import EquipmentCodeHandler from module.logger import logger from module.retire.assets import DOCK_CHECK, EQUIP_CONFIRM as RETIRE_EQUIP_CONFIRM -from module.storage.storage import StorageHandler from module.ui.assets import BACK_ARROW from module.ui.navbar import Navbar @@ -14,7 +14,7 @@ EQUIPMENT_OPEN.match = EQUIPMENT_OPEN.match_luma -class Equipment(StorageHandler): +class Equipment(EquipmentCodeHandler): equipment_has_take_on = False def _ship_view_swipe(self, distance, check_button=EQUIPMENT_OPEN): @@ -159,121 +159,127 @@ def ship_side_navbar_ensure(self, upper=None, bottom=None): return True return False - def ship_equipment_take_off(self, skip_first_screenshot=True): - logger.info('Equipment take off') - bar_timer = Timer(5) - off_timer = Timer(5) - confirm_timer = Timer(5) - - while 1: - if skip_first_screenshot: - skip_first_screenshot = False - else: - self.device.screenshot() - - # End - # if self.handle_info_bar(): - # break - if off_timer.started() and self.info_bar_count(): - break - - if self.handle_storage_full(): - continue - - if confirm_timer.reached() and self.handle_popup_confirm('EQUIPMENT_TAKE_OFF'): - confirm_timer.reset() - off_timer.reset() - bar_timer.reset() - continue - - if off_timer.reached(): - if not self.info_bar_count() and self.appear_then_click(EQUIP_OFF, offset=(20, 20)): - off_timer.reset() - bar_timer.reset() - continue - - if bar_timer.reached(): - if self.appear(EQUIPMENT_OPEN, offset=(20, 20)) and not self.appear(EQUIP_OFF, offset=(20, 20)): - self.device.click(EQUIPMENT_OPEN) - bar_timer.reset() - continue - - logger.info('Equipment take off ended') - - def fleet_equipment_take_off(self, enter, long_click, out): - """ - Args: - enter (Button): Button to edit equipment. - long_click (bool): How to click enter - out (Button): Button to confirm exit success. - """ - logger.hr('Equipment take off') - self.ship_info_enter(enter, long_click=long_click) - - while True: - self.ship_equipment_take_off() - self.ui_click(EQUIPMENT_CLOSE, check_button=EQUIPMENT_OPEN, skip_first_screenshot=True) - if not self.ship_view_next(): - break - - self.ui_back(out) - self.equipment_has_take_on = False - - def ship_equipment_take_on_preset(self, index, skip_first_screenshot=True): - logger.info('Equipment take on preset') - bar_timer = Timer(5) - on_timer = Timer(5) - - while 1: - if skip_first_screenshot: - skip_first_screenshot = False - else: - self.device.screenshot() - - # End - # if self.handle_info_bar(): - # break - if on_timer.started() and self.info_bar_count(): - break - - if bar_timer.reached() and not self.appear(EQUIP_1, offset=10): - self.device.click(EQUIPMENT_OPEN) - # self.device.sleep(0.3) - bar_timer.reset() - continue - - if on_timer.reached() and self.appear(EQUIP_1, offset=10) and not self.info_bar_count(): - if index == 1: - self.device.click(EQUIP_1) - elif index == 2: - self.device.click(EQUIP_2) - elif index == 3: - self.device.click(EQUIP_3) - - on_timer.reset() - bar_timer.reset() - continue - - logger.info('Equipment take on ended') - - def fleet_equipment_take_on_preset(self, preset_record, enter, long_click, out): - """ - Args: - preset_record (list[int]): list of equipment record. [3, 1, 1, 1, 1, 1] - enter (Button): Button to edit equipment. - long_click (bool): How to click enter - out (Button): Button to confirm exit success. - """ - logger.hr('Equipment take on') - self.ship_info_enter(enter, long_click=long_click) - - for index in '9'.join([str(x) for x in preset_record if x > 0]): - index = int(index) - if index == 9: - self.ship_view_next() - else: - self.ship_equipment_take_on_preset(index=index) - self.ui_click(EQUIPMENT_CLOSE, check_button=EQUIPMENT_OPEN, skip_first_screenshot=True) - - self.ui_back(out) - self.equipment_has_take_on = True + def ship_equipment_take_off(self, name=None): + self.code_clear(name=name) + + def ship_equipment_take_on(self, name=None): + self.code_apply(name=name) + + # def ship_equipment_take_off(self, skip_first_screenshot=True): + # logger.info('Equipment take off') + # bar_timer = Timer(5) + # off_timer = Timer(5) + # confirm_timer = Timer(5) + + # while 1: + # if skip_first_screenshot: + # skip_first_screenshot = False + # else: + # self.device.screenshot() + + # # End + # # if self.handle_info_bar(): + # # break + # if off_timer.started() and self.info_bar_count(): + # break + + # if self.handle_storage_full(): + # continue + + # if confirm_timer.reached() and self.handle_popup_confirm('EQUIPMENT_TAKE_OFF'): + # confirm_timer.reset() + # off_timer.reset() + # bar_timer.reset() + # continue + + # if off_timer.reached(): + # if not self.info_bar_count() and self.appear_then_click(EQUIP_OFF, offset=(20, 20)): + # off_timer.reset() + # bar_timer.reset() + # continue + + # if bar_timer.reached(): + # if self.appear(EQUIPMENT_OPEN, offset=(20, 20)) and not self.appear(EQUIP_OFF, offset=(20, 20)): + # self.device.click(EQUIPMENT_OPEN) + # bar_timer.reset() + # continue + + # logger.info('Equipment take off ended') + + # def fleet_equipment_take_off(self, enter, long_click, out): + # """ + # Args: + # enter (Button): Button to edit equipment. + # long_click (bool): How to click enter + # out (Button): Button to confirm exit success. + # """ + # logger.hr('Equipment take off') + # self.ship_info_enter(enter, long_click=long_click) + + # while True: + # self.ship_equipment_take_off() + # self.ui_click(EQUIPMENT_CLOSE, check_button=EQUIPMENT_OPEN, skip_first_screenshot=True) + # if not self.ship_view_next(): + # break + + # self.ui_back(out) + # self.equipment_has_take_on = False + + # def ship_equipment_take_on_preset(self, index, skip_first_screenshot=True): + # logger.info('Equipment take on preset') + # bar_timer = Timer(5) + # on_timer = Timer(5) + + # while 1: + # if skip_first_screenshot: + # skip_first_screenshot = False + # else: + # self.device.screenshot() + + # # End + # # if self.handle_info_bar(): + # # break + # if on_timer.started() and self.info_bar_count(): + # break + + # if bar_timer.reached() and not self.appear(EQUIP_1, offset=10): + # self.device.click(EQUIPMENT_OPEN) + # # self.device.sleep(0.3) + # bar_timer.reset() + # continue + + # if on_timer.reached() and self.appear(EQUIP_1, offset=10) and not self.info_bar_count(): + # if index == 1: + # self.device.click(EQUIP_1) + # elif index == 2: + # self.device.click(EQUIP_2) + # elif index == 3: + # self.device.click(EQUIP_3) + + # on_timer.reset() + # bar_timer.reset() + # continue + + # logger.info('Equipment take on ended') + + # def fleet_equipment_take_on_preset(self, preset_record, enter, long_click, out): + # """ + # Args: + # preset_record (list[int]): list of equipment record. [3, 1, 1, 1, 1, 1] + # enter (Button): Button to edit equipment. + # long_click (bool): How to click enter + # out (Button): Button to confirm exit success. + # """ + # logger.hr('Equipment take on') + # self.ship_info_enter(enter, long_click=long_click) + + # for index in '9'.join([str(x) for x in preset_record if x > 0]): + # index = int(index) + # if index == 9: + # self.ship_view_next() + # else: + # self.ship_equipment_take_on_preset(index=index) + # self.ui_click(EQUIPMENT_CLOSE, check_button=EQUIPMENT_OPEN, skip_first_screenshot=True) + + # self.ui_back(out) + # self.equipment_has_take_on = True diff --git a/module/equipment/equipment_code.py b/module/equipment/equipment_code.py new file mode 100644 index 0000000000..b3f61d9ba9 --- /dev/null +++ b/module/equipment/equipment_code.py @@ -0,0 +1,197 @@ +import yaml + +from module.equipment.assets import * +from module.logger import logger +from module.retire.assets import TEMPLATE_BOGUE, TEMPLATE_HERMES, TEMPLATE_RANGER, TEMPLATE_LANGLEY +from module.storage.assets import EQUIPMENT_FULL +from module.storage.storage import StorageHandler + +EMPTY_CODE = "MC8wLzAvMC8wXDA=" +EQUIPMENT_PREVIEW = list([ + EQUIPMENT_CODE_EQUIP_0, + EQUIPMENT_CODE_EQUIP_1, + EQUIPMENT_CODE_EQUIP_2, + EQUIPMENT_CODE_EQUIP_3, + EQUIPMENT_CODE_EQUIP_4, + EQUIPMENT_CODE_EQUIP_5, +]) + +class EquipmentCodeHandler(StorageHandler): + last_code: str = None + + def get_code(self, name): + try: + config = {} + for item in yaml.safe_load_all(self.config.EquipmentCode_Config): + config.update(item) + except Exception: + logger.error("Fail to load equipment code config") + return None + try: + name: str = config.pop(name) + return name + except Exception: + logger.error(f"Config does not contain equipment code for {name}") + return None + + def set_code(self, name, code): + config = {} + try: + for item in yaml.safe_load_all(self.config.EquipmentCode_Config): + config.update(item) + except Exception: + pass + try: + config.update({name: code}) + config_yaml = yaml.safe_dump(config) + self.config.EquipmentCode_Config = config_yaml + except Exception: + logger.error("Fail to set equipment code config") + + def current_ship(self): + """ + Currently, only supports common CV recognization + + Pages: + in: equipment_code + """ + for _ in self.loop(): + if not self.appear(EMPTY_SHIP_R): + break + if TEMPLATE_BOGUE.match(self.device.image, scaling=1.46): # image has rotation + return 'bogue' + elif TEMPLATE_HERMES.match(self.device.image, scaling=124 / 89): + return 'hermes' + elif TEMPLATE_RANGER.match(self.device.image, scaling=4 / 3): + return 'ranger' + elif TEMPLATE_LANGLEY.match(self.device.image, scaling=25 / 21): + return 'langley' + else: + return 'DD' + + def _code_enter(self): + """ + Pages: + in: ship_detail + out: equipment_code + """ + for _ in self.loop(): + if self.appear(EQUIPMENT_CODE_PAGE_CHECK, offset=(5, 5)): + break + + if self.appear_then_click(EQUIPMENT_CODE_ENTRANCE, offset=(5, 5)): + continue + + def _code_exit(self): + """ + Pages: + in: equipment_code + out: ship_detail + """ + self.ui_back(check_button=EQUIPMENT_CODE_ENTRANCE) + + def is_code_preview_loaded(self): + if self.appear(EQUIPMENT_CODE_EQUIP_5_LOCKED, offset=(5, 5)): + max_index = 5 + else: + max_index = 6 + for index in range(max_index): + if not self.appear(EQUIPMENT_PREVIEW[index], offset=(5, 5)): + return True + + return False + + def _code_preview_clear(self): + for _ in self.loop(timeout=2): + if not self.is_code_preview_loaded(): + return True + + if self.appear_then_click(EQUIPMENT_CODE_CLEAR, offset=(5, 5)): + continue + else: + return False + + def _code_input(self, code): + logger.info(f"Code input: {code}") + d = self.device.u2 + for _ in self.loop(timeout=10): + _, shown = d.current_ime() + if shown: + break + self.device.click(EQUIPMENT_CODE_TEXTBOX) + else: + logger.warning("Equipment code load failed") + return False + d.send_keys(text=code, clear=True) + d.send_action(code="done") + self.device.sleep((0.3, 0.5)) + for _ in self.loop(timeout=10, skip_first=False): + _, shown = d.current_ime() + if shown: + continue + if self.is_code_preview_loaded(): + return True + if self.appear_then_click(EQUIPMENT_CODE_ENTER, offset=(5, 5), interval=3): + continue + else: + logger.warning("Equipment code load failed") + return False + + def _code_confirm(self): + logger.info("Code apply") + for _ in self.loop(timeout=10): + if self.appear(EQUIPMENT_CODE_ENTRANCE, offset=(5, 5)): + return True + if self.appear(EQUIPMENT_FULL, offset=(30, 30)): + return False + if self.handle_popup_confirm("EQUIPMENT_CODE"): + continue + if self.appear_then_click(EQUIPMENT_CODE_CONFIRM, offset=(5, 5), interval=3): + continue + else: + return False + + def _code_apply(self, code=None): + for _ in range(5): + self._code_preview_clear() + if code is not None and code != EMPTY_CODE: + success = self._code_input(code) + if not success: + continue + success = self._code_confirm() + if success: + logger.info("Equipment code apply complete.") + return True + else: + self.handle_storage_full() + else: + return False + + def _code_export(self): + self.handle_info_bar() + d = self.device.u2 + for _ in self.loop(timeout=10): + if self.info_bar_count(): + break + if self.appear_then_click(EQUIPMENT_CODE_EXPORT, offset=(5, 5), interval=3): + continue + code = d.clipboard + return code + + def code_clear(self, name=None): + self._code_enter() + if name is None: + name = self.current_ship() + if self.config.EquipmentCode_ExportToConfig and self.get_code(name=name) is None: + self.last_code = self._code_export() + self.set_code(name=name, code=self.last_code) + self._code_apply(code=None) + + def code_apply(self, name=None): + self._code_enter() + if name is None: + name = self.current_ship() + code = self.get_code(name=name) + if code is None: + code = self.last_code + self._code_apply(code=code) \ No newline at end of file diff --git a/module/equipment/fleet_equipment.py b/module/equipment/fleet_equipment.py deleted file mode 100644 index f2a568e209..0000000000 --- a/module/equipment/fleet_equipment.py +++ /dev/null @@ -1,37 +0,0 @@ -from module.equipment.assets import * -from module.equipment.equipment_change import EquipmentChange -from module.ocr.ocr import Digit -from module.ui.assets import FLEET_CHECK -from module.ui.page import page_fleet - -OCR_FLEET_INDEX = Digit(OCR_FLEET_INDEX, letter=(90, 154, 255), threshold=128, alphabet='123456') - - -class FleetEquipment(EquipmentChange): - def fleet_enter(self, fleet): - self.ui_ensure(page_fleet) - self.ui_ensure_index(fleet, letter=OCR_FLEET_INDEX, - next_button=FLEET_NEXT, prev_button=FLEET_PREV, skip_first_screenshot=True) - - def fleet_equipment_take_on_preset(self, preset_record, enter=FLEET_DETAIL_ENTER_FLAGSHIP, - long_click=False, out=FLEET_DETAIL_CHECK): - self.ui_click(FLEET_DETAIL, appear_button=page_fleet.check_button, - check_button=FLEET_DETAIL_CHECK, skip_first_screenshot=True) - super().fleet_equipment_take_on_preset(preset_record=preset_record, enter=FLEET_DETAIL_ENTER_FLAGSHIP, - long_click=False, out=FLEET_DETAIL_CHECK) - self.ui_back(FLEET_CHECK) - - def fleet_equipment_take_off(self, enter=FLEET_DETAIL_ENTER_FLAGSHIP, long_click=False, out=FLEET_DETAIL_CHECK): - self.ui_click(FLEET_DETAIL, appear_button=page_fleet.check_button, - check_button=FLEET_DETAIL_CHECK, skip_first_screenshot=True) - super().fleet_equipment_take_off(enter=enter, long_click=long_click, out=out) - self.ui_back(FLEET_CHECK) - - def fleet_enter_ship(self, button): - self.ui_click(FLEET_DETAIL, appear_button=page_fleet.check_button, - check_button=FLEET_DETAIL_CHECK, skip_first_screenshot=True) - self.ship_info_enter(button, long_click=False) - - def fleet_back(self): - self.ui_back(FLEET_DETAIL_CHECK) - self.ui_back(FLEET_CHECK) diff --git a/module/exercise/combat.py b/module/exercise/combat.py index bdfbed9fa0..0ee2c916f4 100644 --- a/module/exercise/combat.py +++ b/module/exercise/combat.py @@ -1,12 +1,11 @@ from module.combat.combat import * from module.exercise.assets import * -from module.exercise.equipment import ExerciseEquipment from module.exercise.hp_daemon import HpDaemon from module.exercise.opponent import OPPONENT, OpponentChoose from module.ui.assets import EXERCISE_CHECK -class ExerciseCombat(HpDaemon, OpponentChoose, ExerciseEquipment, Combat): +class ExerciseCombat(HpDaemon, OpponentChoose, Combat): def _in_exercise(self): return self.appear(EXERCISE_CHECK, offset=(20, 20)) @@ -191,23 +190,3 @@ def _combat(self, opponent): self._preparation_quit() return False - - def equipment_take_off_when_finished(self): - if self.config.EXERCISE_FLEET_EQUIPMENT is None: - return False - if not self.equipment_has_take_on: - return False - - self._choose_opponent(0) - self.equipment_take_off() - self._preparation_quit() - - def equipment_take_on(self): - if self.config.EXERCISE_FLEET_EQUIPMENT is None: - return False - if self.equipment_has_take_on: - return False - - self._choose_opponent(0) - super().equipment_take_on() - self._preparation_quit() diff --git a/module/exercise/equipment.py b/module/exercise/equipment.py deleted file mode 100644 index 4d66b26e6d..0000000000 --- a/module/exercise/equipment.py +++ /dev/null @@ -1,43 +0,0 @@ -from module.base.timer import Timer -from module.combat.assets import BATTLE_PREPARATION -from module.equipment.equipment_change import EquipmentChange -from module.exercise.assets import * - - -class ExerciseEquipment(EquipmentChange): - def _active_edit(self): - timer = Timer(5) - while 1: - self.device.screenshot() - - if timer.reached() and self.appear_then_click(EQUIP_EDIT_INACTIVE): - timer.reset() - - # End - if self.appear(EQUIP_EDIT_ACTIVE): - self.device.sleep((0.2, 0.3)) - break - - def _inactive_edit(self): - timer = Timer(5) - while 1: - self.device.screenshot() - - if timer.reached() and self.appear_then_click(EQUIP_EDIT_ACTIVE): - timer.reset() - - # End - if self.appear(EQUIP_EDIT_INACTIVE): - self.device.sleep((0.2, 0.3)) - break - - def equipment_take_on(self): - self._active_edit() - self.fleet_equipment_take_on_preset(preset_record=self.config.EXERCISE_FLEET_EQUIPMENT, enter=EQUIP_ENTER, - long_click=True, out=BATTLE_PREPARATION) - self._inactive_edit() - - def equipment_take_off(self): - self._active_edit() - self.fleet_equipment_take_off(enter=EQUIP_ENTER, long_click=True, out=BATTLE_PREPARATION) - self._inactive_edit() diff --git a/module/hard/equipment.py b/module/hard/equipment.py deleted file mode 100644 index 59fbc7d812..0000000000 --- a/module/hard/equipment.py +++ /dev/null @@ -1,27 +0,0 @@ -from module.equipment.equipment_change import EquipmentChange -from module.hard.assets import * -from module.map.assets import * - - -class HardEquipment(EquipmentChange): - - def equipment_take_on(self): - if self.config.FLEET_HARD_EQUIPMENT is None: - return False - if self.equipment_has_take_on: - return False - - enter = EQUIP_ENTER_1 if self.config.Hard_HardFleet == 1 else EQUIP_ENTER_2 - self.fleet_equipment_take_on_preset(preset_record=self.config.FLEET_HARD_EQUIPMENT, enter=enter, - long_click=True, out=FLEET_PREPARATION) - return True - - def equipment_take_off(self): - if self.config.FLEET_HARD_EQUIPMENT is None: - return False - if not self.equipment_has_take_on: - return False - - enter = EQUIP_ENTER_1 if self.config.Hard_HardFleet == 1 else EQUIP_ENTER_2 - self.fleet_equipment_take_off(enter=enter, long_click=True, out=FLEET_PREPARATION) - return True diff --git a/module/retire/assets.py b/module/retire/assets.py index 14f97b06f9..633c14b1d3 100644 --- a/module/retire/assets.py +++ b/module/retire/assets.py @@ -14,6 +14,7 @@ DOCK_FIRST_NPC = Button(area={'cn': (96, 111, 123, 123), 'en': (96, 111, 123, 123), 'jp': (96, 111, 123, 123), 'tw': (96, 111, 123, 123)}, color={'cn': (184, 150, 150), 'en': (184, 150, 150), 'jp': (184, 150, 150), 'tw': (184, 150, 150)}, button={'cn': (96, 111, 123, 123), 'en': (96, 111, 123, 123), 'jp': (96, 111, 123, 123), 'tw': (96, 111, 123, 123)}, file={'cn': './assets/cn/retire/DOCK_FIRST_NPC.png', 'en': './assets/cn/retire/DOCK_FIRST_NPC.png', 'jp': './assets/cn/retire/DOCK_FIRST_NPC.png', 'tw': './assets/cn/retire/DOCK_FIRST_NPC.png'}) DOCK_SCROLL = Button(area={'cn': (1239, 76, 1248, 641), 'en': (1239, 76, 1248, 641), 'jp': (1237, 78, 1250, 628), 'tw': (1239, 76, 1248, 641)}, color={'cn': (47, 46, 37), 'en': (47, 46, 37), 'jp': (180, 156, 66), 'tw': (47, 46, 37)}, button={'cn': (1239, 76, 1248, 641), 'en': (1239, 76, 1248, 641), 'jp': (1237, 78, 1250, 628), 'tw': (1239, 76, 1248, 641)}, file={'cn': './assets/cn/retire/DOCK_SCROLL.png', 'en': './assets/en/retire/DOCK_SCROLL.png', 'jp': './assets/jp/retire/DOCK_SCROLL.png', 'tw': './assets/tw/retire/DOCK_SCROLL.png'}) DOCK_SELECTED = Button(area={'cn': (582, 662, 647, 685), 'en': (597, 658, 655, 691), 'jp': (603, 662, 655, 685), 'tw': (582, 662, 647, 685)}, color={'cn': (75, 75, 83), 'en': (64, 62, 73), 'jp': (84, 83, 92), 'tw': (75, 75, 83)}, button={'cn': (582, 662, 647, 685), 'en': (597, 658, 655, 691), 'jp': (603, 662, 655, 685), 'tw': (582, 662, 647, 685)}, file={'cn': './assets/cn/retire/DOCK_SELECTED.png', 'en': './assets/en/retire/DOCK_SELECTED.png', 'jp': './assets/jp/retire/DOCK_SELECTED.png', 'tw': './assets/tw/retire/DOCK_SELECTED.png'}) +DOCK_UNMOUNT = Button(area={'cn': (161, 141, 225, 216), 'en': (161, 141, 225, 216), 'jp': (161, 141, 225, 216), 'tw': (161, 141, 225, 216)}, color={'cn': (111, 111, 112), 'en': (111, 111, 112), 'jp': (111, 111, 112), 'tw': (111, 111, 112)}, button={'cn': (161, 141, 225, 216), 'en': (161, 141, 225, 216), 'jp': (161, 141, 225, 216), 'tw': (161, 141, 225, 216)}, file={'cn': './assets/cn/retire/DOCK_UNMOUNT.png', 'en': './assets/en/retire/DOCK_UNMOUNT.png', 'jp': './assets/jp/retire/DOCK_UNMOUNT.png', 'tw': './assets/tw/retire/DOCK_UNMOUNT.png'}) EMPTY_ENHANCE_SLOT_PLUS = Button(area={'cn': (737, 402, 773, 437), 'en': (747, 402, 782, 437), 'jp': (737, 402, 773, 437), 'tw': (747, 401, 782, 437)}, color={'cn': (46, 46, 46), 'en': (38, 38, 38), 'jp': (46, 46, 46), 'tw': (43, 43, 43)}, button={'cn': (737, 402, 773, 437), 'en': (747, 402, 782, 437), 'jp': (737, 402, 773, 437), 'tw': (747, 401, 782, 437)}, file={'cn': './assets/cn/retire/EMPTY_ENHANCE_SLOT_PLUS.png', 'en': './assets/en/retire/EMPTY_ENHANCE_SLOT_PLUS.png', 'jp': './assets/jp/retire/EMPTY_ENHANCE_SLOT_PLUS.png', 'tw': './assets/tw/retire/EMPTY_ENHANCE_SLOT_PLUS.png'}) ENHANCE_CONFIRM = Button(area={'cn': (1126, 602, 1256, 645), 'en': (1226, 605, 1262, 641), 'jp': (1126, 601, 1257, 646), 'tw': (1215, 606, 1253, 641)}, color={'cn': (203, 149, 81), 'en': (212, 167, 100), 'jp': (189, 139, 78), 'tw': (216, 169, 99)}, button={'cn': (1126, 602, 1256, 645), 'en': (1226, 605, 1262, 641), 'jp': (1126, 601, 1257, 646), 'tw': (1215, 606, 1253, 641)}, file={'cn': './assets/cn/retire/ENHANCE_CONFIRM.png', 'en': './assets/en/retire/ENHANCE_CONFIRM.png', 'jp': './assets/jp/retire/ENHANCE_CONFIRM.png', 'tw': './assets/tw/retire/ENHANCE_CONFIRM.png'}) ENHANCE_FILLED = Button(area={'cn': (728, 440, 781, 454), 'en': (728, 440, 781, 454), 'jp': (722, 387, 789, 400), 'tw': (728, 440, 781, 454)}, color={'cn': (156, 138, 127), 'en': (156, 138, 127), 'jp': (146, 153, 211), 'tw': (156, 138, 127)}, button={'cn': (728, 440, 781, 454), 'en': (728, 440, 781, 454), 'jp': (722, 387, 789, 400), 'tw': (728, 440, 781, 454)}, file={'cn': './assets/cn/retire/ENHANCE_FILLED.png', 'en': './assets/en/retire/ENHANCE_FILLED.png', 'jp': './assets/jp/retire/ENHANCE_FILLED.png', 'tw': './assets/tw/retire/ENHANCE_FILLED.png'}) diff --git a/module/retire/dock.py b/module/retire/dock.py index 58aebdf6a4..f1e797deba 100644 --- a/module/retire/dock.py +++ b/module/retire/dock.py @@ -205,6 +205,11 @@ def dock_filter_set( self.dock_filter.set(sort=sort, index=index, faction=faction, rarity=rarity, extra=extra) self.dock_filter_confirm(wait_loading=wait_loading) + def dock_reset(self): + self.dock_favourite_set(False, wait_loading=False) + self.dock_sort_method_dsc_set(False, wait_loading=False) + self.dock_filter_set() + def dock_select_one(self, button, skip_first_screenshot=True): """ Args: