mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-15 06:09:27 +08:00
# Conflicts: # module/campaign/campaign_event.py # module/campaign/os_run.py # module/coalition/coalition.py # module/config/argument/args.json # module/config/argument/menu.json # module/config/argument/task.yaml # module/config/i18n/en-US.json # module/config/i18n/ja-JP.json # module/os/operation_siren.py # module/os_handler/mission.py # module/webui/app.py
86 lines
4.9 KiB
Python
86 lines
4.9 KiB
Python
from module.config.utils import get_os_reset_remain
|
|
from module.config.deep import deep_get
|
|
from module.logger import logger
|
|
from module.os.map import OSMap
|
|
from module.ui.page import page_os
|
|
|
|
|
|
class OpsiHazard1Leveling(OSMap):
|
|
def os_hazard1_leveling(self):
|
|
logger.hr('OS hazard 1 leveling', level=1)
|
|
# Without these enabled, CL1 gains 0 profits
|
|
self.config.override(
|
|
OpsiGeneral_DoRandomMapEvent=True,
|
|
OpsiGeneral_AkashiShopFilter='ActionPoint',
|
|
)
|
|
IsDisableOpsiMeowfficerFarming = deep_get(self.config.data, "SomethingSpecial.TurnOffForcedOnSettings.OpsiMeowfficerFarmingFromOpsiHazard1Leveling")
|
|
if not IsDisableOpsiMeowfficerFarming:
|
|
if not self.config.is_task_enabled('OpsiMeowfficerFarming'):
|
|
self.config.cross_set(keys='OpsiMeowfficerFarming.Scheduler.Enable', value=True)
|
|
else:
|
|
logger.warning(f"Disable OpsiMeowfficerFarming that is set from OpsiHazard1Leveling : {IsDisableOpsiMeowfficerFarming}")
|
|
while 1:
|
|
# Limited action point preserve of hazard 1 to 200
|
|
self.config.OS_ACTION_POINT_PRESERVE = 200
|
|
if self.config.is_task_enabled('OpsiAshBeacon') \
|
|
and not self._ash_fully_collected \
|
|
and self.config.OpsiAshBeacon_EnsureFullyCollected:
|
|
logger.info('Ash beacon not fully collected, ignore action point limit temporarily')
|
|
self.config.OS_ACTION_POINT_PRESERVE = 0
|
|
logger.attr('OS_ACTION_POINT_PRESERVE', self.config.OS_ACTION_POINT_PRESERVE)
|
|
|
|
IsDisableOpsiHazard1LevelingYellowCoinLimit = deep_get(self.config.data, "SomethingSpecial.TurnOffForcedOnSettings.OpsiHazard1LevelingYellowCoinLimit")
|
|
if not IsDisableOpsiHazard1LevelingYellowCoinLimit:
|
|
if self.get_yellow_coins() < self.config.OS_NORMAL_YELLOW_COINS_PRESERVE:
|
|
logger.info(f'Reach the limit of yellow coins, preserve={self.config.OS_NORMAL_YELLOW_COINS_PRESERVE}')
|
|
with self.config.multi_set():
|
|
self.config.task_delay(server_update=True)
|
|
if not self.is_in_opsi_explore():
|
|
self.config.task_call('OpsiMeowfficerFarming')
|
|
self.config.task_stop()
|
|
else:
|
|
logger.warning(f"Disable OpsiHazard1Leveling yellow coin limit : {IsDisableOpsiHazard1LevelingYellowCoinLimit}")
|
|
|
|
self.get_current_zone()
|
|
|
|
# Preset action point to 70
|
|
# When running CL1 oil is for running CL1, not meowfficer farming
|
|
keep_current_ap = True
|
|
if self.config.OpsiGeneral_BuyActionPointLimit > 0:
|
|
keep_current_ap = False
|
|
self.action_point_set(cost=70, keep_current_ap=keep_current_ap, check_rest_ap=True)
|
|
preserve = deep_get(self.config.data, "OpsiMeowfficerFarming.OpsiMeowfficerFarming.ActionPointPreserve", 1000)
|
|
ap_preserve = min(self.get_action_point_limit(), max(preserve, 1000, key=int), 10000, key=int)
|
|
cd = self.nearest_task_cooling_down
|
|
if self._action_point_total >= (ap_preserve + 1200) \
|
|
and not IsDisableOpsiMeowfficerFarming \
|
|
and not self.is_in_opsi_explore() \
|
|
and cd is None:
|
|
with self.config.multi_set():
|
|
logger.info(f'Action points is more than {ap_preserve + 1200}')
|
|
if get_os_reset_remain() > 5 \
|
|
or get_os_reset_remain() <= 5 and not IsDisableOpsiHazard1LevelingYellowCoinLimit \
|
|
and self.get_yellow_coins() < self.config.OS_NORMAL_YELLOW_COINS_PRESERVE + 10000:
|
|
self.config.task_call('OpsiMeowfficerFarming')
|
|
self.config.task_call('OpsiAbyssal')
|
|
self.config.task_call('OpsiStronghold')
|
|
self.config.task_call('OpsiObscure')
|
|
self.config.task_stop()
|
|
|
|
if self.config.OpsiHazard1Leveling_TargetZone != 0:
|
|
zone = self.config.OpsiHazard1Leveling_TargetZone
|
|
else:
|
|
zone = 22
|
|
logger.hr(f'OS hazard 1 leveling, zone_id={zone}', level=1)
|
|
if self.zone.zone_id != zone or not self.is_zone_name_hidden:
|
|
self.globe_goto(self.name_to_zone(zone), types='SAFE', refresh=True)
|
|
self.fleet_set(self.config.OpsiFleet_Fleet)
|
|
self.run_strategic_search()
|
|
|
|
self.handle_after_auto_search()
|
|
if deep_get(self.config.data, "ResearchFarmingSetting.OpsiHazard1ResearchFarming.Enable", False):
|
|
from module.research_farming.farming import ResearchFarming
|
|
ResearchFarming(config=self.config, device=self.device).CheckResearchShipExperience()
|
|
self.ui_goto(page_os)
|
|
self.config.check_task_switch()
|