mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 07:39:25 +08:00
add: migrate dashboard update logic
This commit is contained in:
BIN
assets/cn/campaign/my_OCR_COIN_LIMIT.png
Normal file
BIN
assets/cn/campaign/my_OCR_COIN_LIMIT.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
@@ -149,3 +149,65 @@ class CampaignStatus(UI):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
from module.campaign.my_assets import *
|
||||
|
||||
|
||||
class CampaignStatus(CampaignStatus):
|
||||
def get_event_pt(self):
|
||||
result = super().get_event_pt()
|
||||
self.config.log_res.Pt = result
|
||||
return result
|
||||
|
||||
def _get_num(self, _button, name):
|
||||
# Update offset
|
||||
_ = self.appear(OCR_OIL_CHECK)
|
||||
|
||||
color = get_color(self.device.image, OCR_OIL_CHECK.button)
|
||||
if color_similar(color, OCR_OIL_CHECK.color):
|
||||
# Original color
|
||||
if server.server != 'jp':
|
||||
ocr = Digit(_button, name=name, letter=(247, 247, 247), threshold=128)
|
||||
else:
|
||||
ocr = Digit(_button, name=name, letter=(201, 201, 201), threshold=128)
|
||||
elif color_similar(color, (59, 59, 64)):
|
||||
# With black overlay
|
||||
ocr = Digit(_button, name=name, letter=(165, 165, 165), threshold=128)
|
||||
else:
|
||||
logger.warning(f'Unexpected OCR_OIL_CHECK color')
|
||||
ocr = Digit(_button, name=name, letter=(247, 247, 247), threshold=128)
|
||||
|
||||
return ocr.ocr(self.device.image)
|
||||
|
||||
def get_coin(self, skip_first_screenshot=True, update=False):
|
||||
"""
|
||||
Returns:
|
||||
int: Coin amount
|
||||
"""
|
||||
amount = 0
|
||||
limit = 0
|
||||
timeout = Timer(1, count=2).start()
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
if timeout.reached():
|
||||
logger.warning('Get coin timeout')
|
||||
break
|
||||
|
||||
amount = self._get_num(OCR_COIN, 'OCR_COIN')
|
||||
limit = self._get_num(my_OCR_COIN_LIMIT, 'OCR_COIN_LIMIT')
|
||||
|
||||
if amount >= 100:
|
||||
break
|
||||
self.config.log_res.Coin = {
|
||||
'Value': amount,
|
||||
'Limit': limit
|
||||
}
|
||||
if update:
|
||||
self.config.update()
|
||||
|
||||
return amount
|
||||
|
||||
@@ -13,3 +13,4 @@ my_FLEET_ENTER_HARD_1 = Button(area={'cn': (705, 158, 788, 241), 'en': (705, 158
|
||||
my_FLEET_ENTER_HARD_1_3 = Button(area={'cn': (910, 176, 994, 260), 'en': (910, 176, 994, 260), 'jp': (910, 176, 994, 260), 'tw': (910, 176, 994, 260)}, color={'cn': (47, 59, 73), 'en': (47, 59, 73), 'jp': (47, 59, 73), 'tw': (47, 59, 73)}, button={'cn': (910, 176, 994, 260), 'en': (910, 176, 994, 260), 'jp': (910, 176, 994, 260), 'tw': (910, 176, 994, 260)}, file={'cn': './assets/cn/campaign/my_FLEET_ENTER_HARD_1_3.png', 'en': './assets/cn/campaign/my_FLEET_ENTER_HARD_1_3.png', 'jp': './assets/cn/campaign/my_FLEET_ENTER_HARD_1_3.png', 'tw': './assets/cn/campaign/my_FLEET_ENTER_HARD_1_3.png'})
|
||||
my_FLEET_ENTER_HARD_2 = Button(area={'cn': (705, 291, 788, 374), 'en': (705, 291, 788, 374), 'jp': (705, 291, 788, 374), 'tw': (705, 291, 788, 374)}, color={'cn': (169, 182, 200), 'en': (169, 182, 200), 'jp': (169, 182, 200), 'tw': (169, 182, 200)}, button={'cn': (705, 291, 788, 374), 'en': (705, 291, 788, 374), 'jp': (705, 291, 788, 374), 'tw': (705, 291, 788, 374)}, file={'cn': './assets/cn/campaign/my_FLEET_ENTER_HARD_2.png', 'en': './assets/cn/campaign/my_FLEET_ENTER_HARD_2.png', 'jp': './assets/cn/campaign/my_FLEET_ENTER_HARD_2.png', 'tw': './assets/cn/campaign/my_FLEET_ENTER_HARD_2.png'})
|
||||
my_FLEET_ENTER_HARD_2_3 = Button(area={'cn': (910, 288, 996, 374), 'en': (910, 288, 996, 374), 'jp': (910, 288, 996, 374), 'tw': (910, 288, 996, 374)}, color={'cn': (52, 56, 64), 'en': (52, 56, 64), 'jp': (52, 56, 64), 'tw': (52, 56, 64)}, button={'cn': (910, 288, 996, 374), 'en': (910, 288, 996, 374), 'jp': (910, 288, 996, 374), 'tw': (910, 288, 996, 374)}, file={'cn': './assets/cn/campaign/my_FLEET_ENTER_HARD_2_3.png', 'en': './assets/cn/campaign/my_FLEET_ENTER_HARD_2_3.png', 'jp': './assets/cn/campaign/my_FLEET_ENTER_HARD_2_3.png', 'tw': './assets/cn/campaign/my_FLEET_ENTER_HARD_2_3.png'})
|
||||
my_OCR_COIN_LIMIT = Button(area={'cn': (807, 0, 944, 19), 'en': (807, 0, 944, 19), 'jp': (807, 0, 944, 19), 'tw': (807, 0, 944, 19)}, color={'cn': (206, 206, 206), 'en': (206, 206, 206), 'jp': (206, 206, 206), 'tw': (206, 206, 206)}, button={'cn': (807, 0, 944, 19), 'en': (807, 0, 944, 19), 'jp': (807, 0, 944, 19), 'tw': (807, 0, 944, 19)}, file={'cn': './assets/cn/campaign/my_OCR_COIN_LIMIT.png', 'en': './assets/cn/campaign/my_OCR_COIN_LIMIT.png', 'jp': './assets/cn/campaign/my_OCR_COIN_LIMIT.png', 'tw': './assets/cn/campaign/my_OCR_COIN_LIMIT.png'})
|
||||
|
||||
@@ -177,3 +177,10 @@ class Coalition(CoalitionCombat, CampaignEvent):
|
||||
# Scheduler
|
||||
if self.config.task_switched():
|
||||
self.config.task_stop()
|
||||
|
||||
|
||||
class Coalition(Coalition):
|
||||
def get_event_pt(self):
|
||||
pt = super().get_event_pt()
|
||||
self.config.log_res.Pt = pt
|
||||
return pt
|
||||
|
||||
@@ -794,6 +794,7 @@ class MultiSetWrapper:
|
||||
|
||||
from module.config.full_config import AzurLaneFullConfig
|
||||
from module.scheduler_watcher import AzurLaneSchedulerWatcher
|
||||
from module.log_res.log_res import LogRes
|
||||
|
||||
|
||||
class AzurLaneConfig(AzurLaneConfig):
|
||||
@@ -807,3 +808,7 @@ class AzurLaneConfig(AzurLaneConfig):
|
||||
@property
|
||||
def full_config(self):
|
||||
return AzurLaneFullConfig(self)
|
||||
|
||||
@property
|
||||
def log_res(self):
|
||||
return LogRes(self)
|
||||
|
||||
@@ -349,3 +349,16 @@ class RewardGacha(GachaUI, Retirement):
|
||||
"""
|
||||
self.gacha_run()
|
||||
self.config.task_delay(server_update=True)
|
||||
|
||||
|
||||
class RewardGacha(RewardGacha):
|
||||
def gacha_calculate(self, *args, **kwargs):
|
||||
result = super().gacha_calculate(*args, **kwargs)
|
||||
self.config.log_res.Cube = self.build_cube_count
|
||||
self.config.update()
|
||||
return result
|
||||
|
||||
def gacha_goto_pool(self, target_pool):
|
||||
self.config.log_res.Cube = self.build_cube_count
|
||||
self.config.update()
|
||||
return super().gacha_goto_pool(target_pool)
|
||||
@@ -531,3 +531,17 @@ class ActionPointHandler(UI, MapEventHandler):
|
||||
self.device.screenshot()
|
||||
|
||||
return enough
|
||||
|
||||
|
||||
class ActionPointHandler(ActionPointHandler):
|
||||
def action_point_update(self):
|
||||
ret = super().action_point_update()
|
||||
|
||||
self.config.log_res.Oil = self._action_point_box[0]
|
||||
self.config.log_res.ActionPoint = {
|
||||
'Value': self._action_point_current,
|
||||
'Total': self._action_point_total
|
||||
}
|
||||
self.config.update()
|
||||
|
||||
return ret
|
||||
|
||||
@@ -94,3 +94,15 @@ class OSStatus(UI):
|
||||
self._shop_yellow_coins = self.get_yellow_coins()
|
||||
self._shop_purple_coins = self.get_purple_coins()
|
||||
logger.info(f'Yellow coins: {self._shop_yellow_coins}, purple coins: {self._shop_purple_coins}')
|
||||
|
||||
|
||||
class OSStatus(OSStatus):
|
||||
def get_yellow_coins(self, *args, **kwargs):
|
||||
result = super().get_yellow_coins(*args, **kwargs)
|
||||
self.config.log_res.YellowCoin = result
|
||||
return result
|
||||
|
||||
def get_purple_coins(self, *args, **kwargs):
|
||||
result = super().get_purple_coins(*args, **kwargs)
|
||||
self.config.log_res.PurpleCoin = result
|
||||
return result
|
||||
|
||||
@@ -400,4 +400,10 @@ class Raid(Raid):
|
||||
def combat_preparation(self, *args, **kwargs):
|
||||
from module.gg_handler.gg_handler import GGHandler
|
||||
GGHandler(config=self.config, device=self.device).power_limit('Raid')
|
||||
super().combat_preparation(*args, **kwargs)
|
||||
super().combat_preparation(*args, **kwargs)
|
||||
|
||||
def get_event_pt(self, *args, **kwargs):
|
||||
result = super().get_event_pt(*args, **kwargs)
|
||||
if result != 0:
|
||||
self.config.log_res.Pt = result
|
||||
return result
|
||||
@@ -105,3 +105,41 @@ class ShopStatus(UI):
|
||||
"""
|
||||
amount = OCR_SHOP_VOUCHER.ocr(self.device.image)
|
||||
return amount
|
||||
|
||||
|
||||
class ShopStatus(ShopStatus):
|
||||
def status_get_gold_coins(self, *args, **kwargs):
|
||||
result = super().status_get_gold_coins(*args, **kwargs)
|
||||
self.config.log_res.Coin = result
|
||||
self.config.update()
|
||||
return result
|
||||
|
||||
def status_get_gems(self, *args, **kwargs):
|
||||
result = super().status_get_gems(*args, **kwargs)
|
||||
self.config.log_res.Gem = result
|
||||
self.config.update()
|
||||
return result
|
||||
|
||||
def status_get_medal(self, *args, **kwargs):
|
||||
result = super().status_get_medal(*args, **kwargs)
|
||||
self.config.log_res.Medal = result
|
||||
self.config.update()
|
||||
return result
|
||||
|
||||
def status_get_merit(self, *args, **kwargs):
|
||||
result = super().status_get_merit(*args, **kwargs)
|
||||
self.config.log_res.Merit = result
|
||||
self.config.update()
|
||||
return result
|
||||
|
||||
def status_get_guild_coins(self, *args, **kwargs):
|
||||
result = super().status_get_guild_coins(*args, **kwargs)
|
||||
self.config.log_res.GuildCoin = result
|
||||
self.config.update()
|
||||
return result
|
||||
|
||||
def status_get_core(self, *args, **kwargs):
|
||||
result = super().status_get_core(*args, **kwargs)
|
||||
self.config.log_res.Core = result
|
||||
self.config.update()
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user