@@ -101,74 +101,6 @@ def _handle_use_box_amount(self, amount):
101101
102102 return True
103103
104- @Config .when (SERVER = 'tw' )
105- def _storage_use_one_box (self , button , amount = 1 ):
106- """
107- Args:
108- button (Button): Box
109- amount (int):
110-
111- Returns:
112- int: amount of box used, not accurate
113-
114- Raises:
115- StorageFull:
116-
117- Pages:
118- in: MATERIAL_CHECK
119- out: MATERIAL_CHECK
120- """
121- logger .hr ('Use one box' )
122- success = False
123- used = 0
124- self .interval_clear ([
125- MATERIAL_CHECK ,
126- BOX_USE ,
127- GET_ITEMS_1 ,
128- GET_ITEMS_2 ,
129- EQUIPMENT_FULL ,
130- ])
131-
132- for _ in self .loop ():
133- # Storage full
134- if self .appear (EQUIPMENT_FULL , offset = (20 , 20 )):
135- logger .info ('Storage full' )
136- # Close popup
137- self .ui_click (MATERIAL_ENTER , check_button = self ._storage_in_material , appear_button = EQUIPMENT_FULL ,
138- retry_wait = 3 , skip_first_screenshot = True )
139- raise StorageFull
140- # End
141- if success and self ._storage_in_material ():
142- break
143-
144- if self ._storage_in_material (interval = 5 ):
145- self .device .click (button )
146- continue
147- # 75 is a magic number to distinguish `use 1` and `use 10`
148- # See https://github.com/LmeSzinc/AzurLaneAutoScript/pull/1529#issuecomment-1221315455
149- if self .appear_then_click (BOX_USE , offset = (- 75 , - 20 , 10 , 20 ), interval = 5 ):
150- used = 10
151- self .interval_reset (MATERIAL_CHECK )
152- continue
153- if self .appear_then_click (BOX_USE , offset = (- 330 , - 20 , - 75 , 20 ), interval = 5 ):
154- used = 1
155- self .interval_reset (MATERIAL_CHECK )
156- continue
157- if self .appear (GET_ITEMS_1 , offset = (5 , 5 ), interval = 5 ):
158- self .device .click (MATERIAL_ENTER )
159- self .interval_reset (MATERIAL_CHECK )
160- success = True
161- continue
162- if self .appear (GET_ITEMS_2 , offset = (5 , 5 ), interval = 5 ):
163- self .device .click (MATERIAL_ENTER )
164- self .interval_reset (MATERIAL_CHECK )
165- success = True
166- continue
167-
168- logger .info (f'Used { used } box(es)' )
169- return used
170-
171- @Config .when (SERVER = None )
172104 def _storage_use_one_box (self , button , amount = 1 ):
173105 """
174106 Args:
@@ -468,59 +400,6 @@ def _storage_disassemble_equipment_execute(self, rarity=1, amount=40):
468400 self .equipment_filter_set ()
469401 return disassembled
470402
471- @Config .when (SERVER = 'tw' )
472- def storage_disassemble_equipment (self , rarity = 1 , amount = 15 ):
473- """
474- Disassemble target amount of equipment.
475- If not having enough equipment, use boxes then disassemble.
476-
477- Args:
478- rarity (int): 1 for common, 2 for rare, 3 for elite, 4 for super_rare
479- amount (int): Expected amount to disassemble.
480- Actual amount >= expected
481-
482- Returns:
483- int: Actual amount of equipments disassembled
484-
485- Pages:
486- in: Any
487- out: page_storage, equipment, DISASSEMBLE
488- """
489- logger .hr ('Disassemble Equipment' , level = 2 )
490- self .ui_goto_storage ()
491- # No need, equipping toggle does not effect disassemble
492- # self.equipping_set()
493- # Also no need to call _wait_until_storage_stable(), filter confirm will do that
494- disassembled = 0
495- while 1 :
496- logger .attr ('Total_Disassemble' , f'{ disassembled } /{ amount } ' )
497- if disassembled >= amount :
498- logger .info ('Reached total target amount, stop' )
499- break
500-
501- self ._storage_enter_disassemble ()
502- equip = self ._storage_disassemble_equipment_execute (rarity = rarity , amount = amount )
503- disassembled += equip
504- if equip <= 0 :
505- logger .info ('No more equipment to disassemble, going to use boxes' )
506- boxes = 0
507- try :
508- self ._storage_enter_material ()
509- boxes = self ._storage_use_box_execute (rarity = rarity , amount = amount - disassembled )
510- if boxes <= 0 :
511- logger .warning ('No more boxes to use, disassemble equipment end' )
512- self .storage_has_boxes = False
513- break
514- except StorageFull :
515- if boxes <= 0 :
516- logger .warning ('Unable to use boxes because storage full, '
517- 'probably because storage is full of rare equipments or above, '
518- 'disassemble equipment end' )
519- logger .warning ('Please manually disassemble some equipments to free up storage' )
520- self .storage_has_boxes = False
521- break
522-
523- @Config .when (SERVER = None )
524403 def storage_disassemble_equipment (self , rarity = 1 , amount = 15 ):
525404 """
526405 Disassemble target amount of equipment.
0 commit comments