mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-18 19:33:33 +08:00
Fix: Oil might be 0 when buying supply packs (#1535)
This commit is contained in:
@@ -56,6 +56,23 @@ class SupplyPack(UI):
|
|||||||
logger.info(f'Supply pack buy finished, executed={executed}')
|
logger.info(f'Supply pack buy finished, executed={executed}')
|
||||||
return executed
|
return executed
|
||||||
|
|
||||||
|
def get_oil(self):
|
||||||
|
"""
|
||||||
|
Returns:
|
||||||
|
int: Oil amount
|
||||||
|
"""
|
||||||
|
timeout = Timer(1, count=3).start()
|
||||||
|
while 1:
|
||||||
|
oil = OCR_OIL.ocr(self.device.image)
|
||||||
|
if timeout.reached():
|
||||||
|
logger.warning('Get oil timeout')
|
||||||
|
return oil
|
||||||
|
if oil > 0:
|
||||||
|
return oil
|
||||||
|
else:
|
||||||
|
self.device.screenshot()
|
||||||
|
continue
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
Pages:
|
Pages:
|
||||||
@@ -64,8 +81,7 @@ class SupplyPack(UI):
|
|||||||
"""
|
"""
|
||||||
self.ui_ensure(page_supply_pack)
|
self.ui_ensure(page_supply_pack)
|
||||||
|
|
||||||
oil = OCR_OIL.ocr(self.device.image)
|
if self.get_oil() < 21000:
|
||||||
if oil <= 21000:
|
|
||||||
self.supply_pack_buy(FREE_SUPPLY_PACK)
|
self.supply_pack_buy(FREE_SUPPLY_PACK)
|
||||||
else:
|
else:
|
||||||
logger.info('Oil > 21000, unable to buy free weekly supply pack')
|
logger.info('Oil > 21000, unable to buy free weekly supply pack')
|
||||||
|
|||||||
Reference in New Issue
Block a user