mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-01-09 05:47:30 +08:00
Add: Task Awaken
to GUI
This commit is contained in:
parent
c8bf55b4ad
commit
da81498211
4
alas.py
4
alas.py
@ -209,6 +209,10 @@ class AzurLaneAutoScript:
|
|||||||
from module.reward.reward import Reward
|
from module.reward.reward import Reward
|
||||||
Reward(config=self.config, device=self.device).run()
|
Reward(config=self.config, device=self.device).run()
|
||||||
|
|
||||||
|
def awaken(self):
|
||||||
|
from module.awaken.awaken import Awaken
|
||||||
|
Awaken(config=self.config, device=self.device).run()
|
||||||
|
|
||||||
def shop_frequent(self):
|
def shop_frequent(self):
|
||||||
from module.shop.shop_reward import RewardShop
|
from module.shop.shop_reward import RewardShop
|
||||||
RewardShop(config=self.config, device=self.device).run_frequent()
|
RewardShop(config=self.config, device=self.device).run_frequent()
|
||||||
|
@ -1338,6 +1338,22 @@
|
|||||||
"Storage": {}
|
"Storage": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Awaken": {
|
||||||
|
"Scheduler": {
|
||||||
|
"Enable": false,
|
||||||
|
"NextRun": "2020-01-01 00:00:00",
|
||||||
|
"Command": "Awaken",
|
||||||
|
"SuccessInterval": 0,
|
||||||
|
"FailureInterval": 120,
|
||||||
|
"ServerUpdate": "00:00"
|
||||||
|
},
|
||||||
|
"Awaken": {
|
||||||
|
"LevelCap": "level120"
|
||||||
|
},
|
||||||
|
"Storage": {
|
||||||
|
"Storage": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Daily": {
|
"Daily": {
|
||||||
"Scheduler": {
|
"Scheduler": {
|
||||||
"Enable": false,
|
"Enable": false,
|
||||||
|
@ -55,7 +55,7 @@ class Awaken(Dock):
|
|||||||
chip = self._get_button_state(COST_CHIP)
|
chip = self._get_button_state(COST_CHIP)
|
||||||
array = self._get_button_state(COST_ARRAY)
|
array = self._get_button_state(COST_ARRAY)
|
||||||
|
|
||||||
logger.attr('AwaikenCost', {'coin': coin, 'chip': chip, 'array': array})
|
logger.attr('AwakenCost', {'coin': coin, 'chip': chip, 'array': array})
|
||||||
|
|
||||||
def is_right_moved(button):
|
def is_right_moved(button):
|
||||||
# If COST_ARRAY is absent, COST_COIN and COST_CHIP are right moved 54px
|
# If COST_ARRAY is absent, COST_COIN and COST_CHIP are right moved 54px
|
||||||
@ -70,14 +70,14 @@ class Awaken(Dock):
|
|||||||
if coin is not None and not is_right_moved(COST_COIN) \
|
if coin is not None and not is_right_moved(COST_COIN) \
|
||||||
and chip is not None and not is_right_moved(COST_CHIP):
|
and chip is not None and not is_right_moved(COST_CHIP):
|
||||||
result = coin and chip and array
|
result = coin and chip and array
|
||||||
logger.attr('AwaikenSufficient', result)
|
logger.attr('AwakenSufficient', result)
|
||||||
return result
|
return result
|
||||||
else:
|
else:
|
||||||
# If array is not needed, coin and chip should both present and right moved
|
# If array is not needed, coin and chip should both present and right moved
|
||||||
if coin is not None and is_right_moved(COST_COIN) \
|
if coin is not None and is_right_moved(COST_COIN) \
|
||||||
and chip is not None and is_right_moved(COST_CHIP):
|
and chip is not None and is_right_moved(COST_CHIP):
|
||||||
result = coin and chip
|
result = coin and chip
|
||||||
logger.attr('AwaikenSufficient', result)
|
logger.attr('AwakenSufficient', result)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
logger.warning('Invalid awaken cost')
|
logger.warning('Invalid awaken cost')
|
||||||
@ -147,13 +147,14 @@ class Awaken(Dock):
|
|||||||
|
|
||||||
result = self._get_awaken_cost(use_array)
|
result = self._get_awaken_cost(use_array)
|
||||||
if result == 'unexpected_array':
|
if result == 'unexpected_array':
|
||||||
# Get resources time out, assume sufficient
|
# This shouldn't happen
|
||||||
self.awaken_popup_close()
|
self.awaken_popup_close()
|
||||||
return 'unexpected_array'
|
return result
|
||||||
elif result is False:
|
elif result is False:
|
||||||
logger.info('Insufficient resources to awaken')
|
logger.info('Insufficient resources to awaken')
|
||||||
return 'insufficient'
|
return 'insufficient'
|
||||||
elif result is True:
|
elif result is True:
|
||||||
|
# Sufficient resources
|
||||||
break
|
break
|
||||||
elif result == 'invalid':
|
elif result == 'invalid':
|
||||||
# Retry, and check timeout also
|
# Retry, and check timeout also
|
||||||
@ -317,17 +318,18 @@ class Awaken(Dock):
|
|||||||
use_array: True to awaken to level 125, False to 120
|
use_array: True to awaken to level 125, False to 120
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
str: 'insufficient', 'timeout'
|
str: 'insufficient', 'finish', 'timeout'
|
||||||
|
|
||||||
Pages:
|
Pages:
|
||||||
in: Any
|
in: Any
|
||||||
out: page_dock
|
out: page_dock
|
||||||
"""
|
"""
|
||||||
|
logger.hr('Awaken run', level=1)
|
||||||
self.ui_ensure(page_dock)
|
self.ui_ensure(page_dock)
|
||||||
self.dock_favourite_set(wait_loading=False)
|
self.dock_favourite_set(wait_loading=False)
|
||||||
self.dock_sort_method_dsc_set(wait_loading=False)
|
self.dock_sort_method_dsc_set(wait_loading=False)
|
||||||
if use_array:
|
if use_array:
|
||||||
extra = ['can_awaken', 'can_awaken_plus']
|
extra = ['can_awaken_plus']
|
||||||
else:
|
else:
|
||||||
extra = ['can_awaken']
|
extra = ['can_awaken']
|
||||||
self.dock_filter_set(extra=extra)
|
self.dock_filter_set(extra=extra)
|
||||||
@ -336,6 +338,7 @@ class Awaken(Dock):
|
|||||||
# page_dock
|
# page_dock
|
||||||
if self.appear(DOCK_EMPTY, offset=(20, 20)):
|
if self.appear(DOCK_EMPTY, offset=(20, 20)):
|
||||||
logger.info('awaken_run finished, no ships to awaken')
|
logger.info('awaken_run finished, no ships to awaken')
|
||||||
|
result = 'finish'
|
||||||
break
|
break
|
||||||
|
|
||||||
# page_dock -> SHIP_DETAIL_CHECK
|
# page_dock -> SHIP_DETAIL_CHECK
|
||||||
@ -351,11 +354,35 @@ class Awaken(Dock):
|
|||||||
continue
|
continue
|
||||||
if result == 'insufficient':
|
if result == 'insufficient':
|
||||||
logger.info('awaken_run finished, resources exhausted')
|
logger.info('awaken_run finished, resources exhausted')
|
||||||
return result
|
break
|
||||||
if result == 'timeout':
|
if result == 'timeout':
|
||||||
logger.info(f'awaken_run finished, result={result}')
|
logger.info(f'awaken_run finished, result={result}')
|
||||||
return result
|
break
|
||||||
raise ScriptError(f'Unexpected awaken_ship result: {result}')
|
raise ScriptError(f'Unexpected awaken_ship result: {result}')
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
if self.config.SERVER not in ['cn']:
|
||||||
|
logger.error(f'Task "Awaken" is not available on server {self.config.SERVER} yet, '
|
||||||
|
f'please contact server maintainers')
|
||||||
|
self.config.task_stop()
|
||||||
|
|
||||||
|
# Run Awakening+ first
|
||||||
|
if self.config.Awaken_LevelCap == 'level125':
|
||||||
|
# Use Cognitive Arrays
|
||||||
|
self.awaken_run(use_array=True)
|
||||||
|
# Use Cognitive Chips
|
||||||
|
self.awaken_run()
|
||||||
|
elif self.config.Awaken_LevelCap == 'level120':
|
||||||
|
# Use Cognitive Chips
|
||||||
|
self.awaken_run()
|
||||||
|
else:
|
||||||
|
raise ScriptError(f'Unknown Awaken_LevelCap={self.config.Awaken_LevelCap}')
|
||||||
|
|
||||||
|
# Reset dock filters
|
||||||
logger.hr('Awaken run exit', level=1)
|
logger.hr('Awaken run exit', level=1)
|
||||||
self.dock_filter_set()
|
self.dock_filter_set(wait_loading=False)
|
||||||
|
|
||||||
|
# Scheduler
|
||||||
|
self.config.task_delay(server_update=True)
|
||||||
|
@ -7231,6 +7231,61 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Awaken": {
|
||||||
|
"Scheduler": {
|
||||||
|
"Enable": {
|
||||||
|
"type": "checkbox",
|
||||||
|
"value": false,
|
||||||
|
"option": [
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"NextRun": {
|
||||||
|
"type": "datetime",
|
||||||
|
"value": "2020-01-01 00:00:00",
|
||||||
|
"validate": "datetime"
|
||||||
|
},
|
||||||
|
"Command": {
|
||||||
|
"type": "input",
|
||||||
|
"value": "Awaken",
|
||||||
|
"display": "hide"
|
||||||
|
},
|
||||||
|
"SuccessInterval": {
|
||||||
|
"type": "input",
|
||||||
|
"value": 0,
|
||||||
|
"display": "hide"
|
||||||
|
},
|
||||||
|
"FailureInterval": {
|
||||||
|
"type": "input",
|
||||||
|
"value": 120,
|
||||||
|
"display": "hide"
|
||||||
|
},
|
||||||
|
"ServerUpdate": {
|
||||||
|
"type": "input",
|
||||||
|
"value": "00:00",
|
||||||
|
"display": "hide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Awaken": {
|
||||||
|
"LevelCap": {
|
||||||
|
"type": "select",
|
||||||
|
"value": "level120",
|
||||||
|
"option": [
|
||||||
|
"level120",
|
||||||
|
"level125"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Storage": {
|
||||||
|
"Storage": {
|
||||||
|
"type": "storage",
|
||||||
|
"value": {},
|
||||||
|
"valuetype": "ignore",
|
||||||
|
"display": "disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Daily": {
|
"Daily": {
|
||||||
"Scheduler": {
|
"Scheduler": {
|
||||||
"Enable": {
|
"Enable": {
|
||||||
|
@ -449,6 +449,10 @@ Reward:
|
|||||||
CollectExp: true
|
CollectExp: true
|
||||||
CollectMission: true
|
CollectMission: true
|
||||||
CollectWeeklyMission: true
|
CollectWeeklyMission: true
|
||||||
|
Awaken:
|
||||||
|
LevelCap:
|
||||||
|
value: level120
|
||||||
|
option: [ level120, level125 ]
|
||||||
GeneralShop:
|
GeneralShop:
|
||||||
UseGems: false
|
UseGems: false
|
||||||
Refresh: false
|
Refresh: false
|
||||||
|
@ -54,7 +54,8 @@
|
|||||||
"Dorm",
|
"Dorm",
|
||||||
"Meowfficer",
|
"Meowfficer",
|
||||||
"Guild",
|
"Guild",
|
||||||
"Reward"
|
"Reward",
|
||||||
|
"Awaken"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"DailyMission": {
|
"DailyMission": {
|
||||||
|
@ -215,6 +215,9 @@ Reward:
|
|||||||
Reward:
|
Reward:
|
||||||
- Scheduler
|
- Scheduler
|
||||||
- Reward
|
- Reward
|
||||||
|
Awaken:
|
||||||
|
- Scheduler
|
||||||
|
- Awaken
|
||||||
|
|
||||||
# ==================== DailyMission ====================
|
# ==================== DailyMission ====================
|
||||||
|
|
||||||
|
@ -251,6 +251,9 @@ class GeneratedConfig:
|
|||||||
Reward_CollectMission = True
|
Reward_CollectMission = True
|
||||||
Reward_CollectWeeklyMission = True
|
Reward_CollectWeeklyMission = True
|
||||||
|
|
||||||
|
# Group `Awaken`
|
||||||
|
Awaken_LevelCap = 'level120' # level120, level125
|
||||||
|
|
||||||
# Group `GeneralShop`
|
# Group `GeneralShop`
|
||||||
GeneralShop_UseGems = False
|
GeneralShop_UseGems = False
|
||||||
GeneralShop_Refresh = False
|
GeneralShop_Refresh = False
|
||||||
|
@ -15,8 +15,9 @@ class ManualConfig:
|
|||||||
> Exercise
|
> Exercise
|
||||||
> Dorm > Meowfficer > Guild > Gacha
|
> Dorm > Meowfficer > Guild > Gacha
|
||||||
> Reward
|
> Reward
|
||||||
> ShopFrequent > ShopOnce > Shipyard > Freebies > Minigame
|
> ShopFrequent > ShopOnce > Shipyard > Freebies
|
||||||
> OpsiExplore
|
> OpsiExplore
|
||||||
|
> Minigame > Awaken
|
||||||
> OpsiAshBeacon
|
> OpsiAshBeacon
|
||||||
> OpsiDaily > OpsiShop > OpsiVoucher
|
> OpsiDaily > OpsiShop > OpsiVoucher
|
||||||
> OpsiAbyssal > OpsiStronghold > OpsiObscure > OpsiArchive
|
> OpsiAbyssal > OpsiStronghold > OpsiObscure > OpsiArchive
|
||||||
|
@ -146,6 +146,10 @@
|
|||||||
"name": "Reward",
|
"name": "Reward",
|
||||||
"help": ""
|
"help": ""
|
||||||
},
|
},
|
||||||
|
"Awaken": {
|
||||||
|
"name": "Awaken",
|
||||||
|
"help": ""
|
||||||
|
},
|
||||||
"Daily": {
|
"Daily": {
|
||||||
"name": "Daily",
|
"name": "Daily",
|
||||||
"help": ""
|
"help": ""
|
||||||
@ -276,7 +280,7 @@
|
|||||||
},
|
},
|
||||||
"NextRun": {
|
"NextRun": {
|
||||||
"name": "Next Run",
|
"name": "Next Run",
|
||||||
"help": "Updated automatically after completing the task to set next scheduled run, typically not manually modified\nHowever you can force immediate scheduling if you clear this text field"
|
"help": "Updated automatically after completing the task to set next scheduled run, typically not manually modified\nHowever you can force immediate scheduling if text field cleared"
|
||||||
},
|
},
|
||||||
"Command": {
|
"Command": {
|
||||||
"name": "Command",
|
"name": "Command",
|
||||||
@ -1591,6 +1595,18 @@
|
|||||||
"help": ""
|
"help": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Awaken": {
|
||||||
|
"_info": {
|
||||||
|
"name": "Cognitive Awakening Settings",
|
||||||
|
"help": "Awaken all ships in dock til cognitive chips/arrays exhausted"
|
||||||
|
},
|
||||||
|
"LevelCap": {
|
||||||
|
"name": "To Level Cap",
|
||||||
|
"help": "",
|
||||||
|
"level120": "Lv.120",
|
||||||
|
"level125": "Lv.125"
|
||||||
|
}
|
||||||
|
},
|
||||||
"GeneralShop": {
|
"GeneralShop": {
|
||||||
"_info": {
|
"_info": {
|
||||||
"name": "General Shop Settings",
|
"name": "General Shop Settings",
|
||||||
|
@ -146,6 +146,10 @@
|
|||||||
"name": "収穫",
|
"name": "収穫",
|
||||||
"help": ""
|
"help": ""
|
||||||
},
|
},
|
||||||
|
"Awaken": {
|
||||||
|
"name": "Task.Awaken.name",
|
||||||
|
"help": "Task.Awaken.help"
|
||||||
|
},
|
||||||
"Daily": {
|
"Daily": {
|
||||||
"name": "デイリー",
|
"name": "デイリー",
|
||||||
"help": ""
|
"help": ""
|
||||||
@ -1591,6 +1595,18 @@
|
|||||||
"help": "Reward.CollectWeeklyMission.help"
|
"help": "Reward.CollectWeeklyMission.help"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Awaken": {
|
||||||
|
"_info": {
|
||||||
|
"name": "Awaken._info.name",
|
||||||
|
"help": "Awaken._info.help"
|
||||||
|
},
|
||||||
|
"LevelCap": {
|
||||||
|
"name": "Awaken.LevelCap.name",
|
||||||
|
"help": "Awaken.LevelCap.help",
|
||||||
|
"level120": "level120",
|
||||||
|
"level125": "level125"
|
||||||
|
}
|
||||||
|
},
|
||||||
"GeneralShop": {
|
"GeneralShop": {
|
||||||
"_info": {
|
"_info": {
|
||||||
"name": "GeneralShop._info.name",
|
"name": "GeneralShop._info.name",
|
||||||
|
@ -146,6 +146,10 @@
|
|||||||
"name": "收获",
|
"name": "收获",
|
||||||
"help": ""
|
"help": ""
|
||||||
},
|
},
|
||||||
|
"Awaken": {
|
||||||
|
"name": "认知觉醒",
|
||||||
|
"help": ""
|
||||||
|
},
|
||||||
"Daily": {
|
"Daily": {
|
||||||
"name": "每日任务",
|
"name": "每日任务",
|
||||||
"help": ""
|
"help": ""
|
||||||
@ -1591,6 +1595,18 @@
|
|||||||
"help": ""
|
"help": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Awaken": {
|
||||||
|
"_info": {
|
||||||
|
"name": "认知觉醒",
|
||||||
|
"help": "认知觉醒船坞内所有的船直到心智单元耗尽"
|
||||||
|
},
|
||||||
|
"LevelCap": {
|
||||||
|
"name": "觉醒至等级上限",
|
||||||
|
"help": "",
|
||||||
|
"level120": "120级",
|
||||||
|
"level125": "125级"
|
||||||
|
}
|
||||||
|
},
|
||||||
"GeneralShop": {
|
"GeneralShop": {
|
||||||
"_info": {
|
"_info": {
|
||||||
"name": "军火商(通用商店)",
|
"name": "军火商(通用商店)",
|
||||||
|
@ -146,6 +146,10 @@
|
|||||||
"name": "收穫",
|
"name": "收穫",
|
||||||
"help": ""
|
"help": ""
|
||||||
},
|
},
|
||||||
|
"Awaken": {
|
||||||
|
"name": "認知覺醒",
|
||||||
|
"help": ""
|
||||||
|
},
|
||||||
"Daily": {
|
"Daily": {
|
||||||
"name": "每日任務",
|
"name": "每日任務",
|
||||||
"help": ""
|
"help": ""
|
||||||
@ -1591,6 +1595,18 @@
|
|||||||
"help": ""
|
"help": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Awaken": {
|
||||||
|
"_info": {
|
||||||
|
"name": "認知覺醒",
|
||||||
|
"help": "認知覺醒船塢內所有的船隻直到心智單元耗盡"
|
||||||
|
},
|
||||||
|
"LevelCap": {
|
||||||
|
"name": "覺醒至等級上限",
|
||||||
|
"help": "",
|
||||||
|
"level120": "120級",
|
||||||
|
"level125": "125級"
|
||||||
|
}
|
||||||
|
},
|
||||||
"GeneralShop": {
|
"GeneralShop": {
|
||||||
"_info": {
|
"_info": {
|
||||||
"name": "軍火商 (通用商店)",
|
"name": "軍火商 (通用商店)",
|
||||||
|
Loading…
Reference in New Issue
Block a user