mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 15:49:25 +08:00
opt: make enhancing ships steps independent to reduce frequency of crack calls
This commit is contained in:
@@ -9,6 +9,9 @@ from module.ocr.ocr import DigitCounter
|
||||
from module.retire.assets import *
|
||||
from module.retire.dock import CARD_GRIDS, Dock
|
||||
|
||||
from module.luahook.crack import do_crack_op_on_func
|
||||
from module.luahook.op import CrackOp
|
||||
|
||||
VALID_SHIP_TYPES = ['dd', 'ss', 'cl', 'ca', 'bb', 'cv', 'repair', 'others']
|
||||
if server.server != 'jp':
|
||||
OCR_DOCK_AMOUNT = DigitCounter(
|
||||
@@ -245,6 +248,24 @@ class Enhancement(Dock):
|
||||
|
||||
return state, ship_count
|
||||
|
||||
@do_crack_op_on_func(
|
||||
before_call=[CrackOp.DisableGlobalShipProperties,CrackOp.DisableGGFactor],
|
||||
after_call=[CrackOp.EnableGlobalShipProperties,CrackOp.EnableGGFactor],
|
||||
)
|
||||
def _enhance_ships(self, total):
|
||||
_ = total
|
||||
current_count = self.config.Enhance_CheckPerCategory
|
||||
while 1:
|
||||
choose_result, current_count = self._enhance_choose(
|
||||
ship_count=current_count)
|
||||
if not choose_result:
|
||||
break
|
||||
_ += 10
|
||||
if _ >= self._retire_amount:
|
||||
break
|
||||
self.ui_back(DOCK_CHECK)
|
||||
return _
|
||||
|
||||
def enhance_ships(self, favourite=None):
|
||||
"""
|
||||
Enhance target ships by specified order
|
||||
@@ -307,16 +328,7 @@ class Enhancement(Dock):
|
||||
logger.hr(f'Dock Empty by ship type {ship_type}')
|
||||
continue
|
||||
|
||||
current_count = self.config.Enhance_CheckPerCategory
|
||||
while 1:
|
||||
choose_result, current_count = self._enhance_choose(
|
||||
ship_count=current_count)
|
||||
if not choose_result:
|
||||
break
|
||||
total += 10
|
||||
if total >= self._retire_amount:
|
||||
break
|
||||
self.ui_back(DOCK_CHECK)
|
||||
total = self._enhance_ships(total)
|
||||
|
||||
self._enhance_quit()
|
||||
return total
|
||||
|
||||
Reference in New Issue
Block a user