diff --git a/module/campaign/os_run.py b/module/campaign/os_run.py index 2fc119691..e95beef31 100644 --- a/module/campaign/os_run.py +++ b/module/campaign/os_run.py @@ -50,7 +50,7 @@ class OSCampaignRun(OSMapOperation): self.config.task_delay(server_update=True) self.config.task_call('Reward') if self.config.is_task_enabled('OpsiHazard1Leveling') \ - and self.get_yellow_coins() > self.config.OS_CL1_YELLOW_COINS_PRESERVE: + and self.get_yellow_coins() > self.yellow_coins_preserve: self.config.task_call('OpsiHazard1Leveling') else: logger.info('Just less than 1 day to OpSi reset, delay 2.5 hours') diff --git a/module/os/map.py b/module/os/map.py index 9a900aa3c..06f5d5050 100644 --- a/module/os/map.py +++ b/module/os/map.py @@ -434,7 +434,7 @@ class OSMap(OSFleet, Map, GlobeCamera, StrategicSearchHandler): Keeping enough startup AP to run CL1. """ if self.is_cl1_enabled and get_os_reset_remain() > 2 \ - and self.get_yellow_coins() > self.config.OS_CL1_YELLOW_COINS_PRESERVE: + and self.get_yellow_coins() > self.yellow_coins_preserve: logger.info('Keep 1000 AP when CL1 available') if not self.action_point_check(1000): self.config.opsi_task_delay(cl1_preserve=True) diff --git a/module/os/tasks/hazard_leveling.py b/module/os/tasks/hazard_leveling.py index 2ab1489dd..ff852f5ac 100644 --- a/module/os/tasks/hazard_leveling.py +++ b/module/os/tasks/hazard_leveling.py @@ -22,8 +22,8 @@ class OpsiHazard1Leveling(OSMap): self.config.OS_ACTION_POINT_PRESERVE = 0 logger.attr('OS_ACTION_POINT_PRESERVE', self.config.OS_ACTION_POINT_PRESERVE) - if self.get_yellow_coins() < self.config.OS_CL1_YELLOW_COINS_PRESERVE: - logger.info(f'Reach the limit of yellow coins, preserve={self.config.OS_CL1_YELLOW_COINS_PRESERVE}') + if self.get_yellow_coins() < self.yellow_coins_preserve: + logger.info(f'Reach the limit of yellow coins, preserve={self.yellow_coins_preserve}') with self.config.multi_set(): self.config.task_delay(server_update=True) if not self.is_in_opsi_explore(): diff --git a/module/os/tasks/meowfficer_farming.py b/module/os/tasks/meowfficer_farming.py index 43d629c56..295b56edf 100644 --- a/module/os/tasks/meowfficer_farming.py +++ b/module/os/tasks/meowfficer_farming.py @@ -52,7 +52,7 @@ class OpsiMeowfficerFarming(OSMap): # When not running CL1 and use oil keep_current_ap = True check_rest_ap = True - if self.is_cl1_enabled and self.get_yellow_coins() >= self.config.OS_CL1_YELLOW_COINS_PRESERVE: + if self.is_cl1_enabled and self.get_yellow_coins() >= self.yellow_coins_preserve: check_rest_ap = False if not self.is_cl1_enabled and self.config.OpsiGeneral_BuyActionPointLimit > 0: keep_current_ap = False diff --git a/module/os_handler/os_status.py b/module/os_handler/os_status.py index 8f43a40c2..92a186b86 100644 --- a/module/os_handler/os_status.py +++ b/module/os_handler/os_status.py @@ -1,6 +1,7 @@ import typing as t from datetime import datetime, timedelta +from module.base.decorator import cached_property import module.config.server as server from module.base.timer import Timer from module.config.config import Function @@ -60,6 +61,13 @@ class OSStatus(UI): tasks = SelectedGrids(self.config.pending_task + self.config.waiting_task).filter(func).sort('next_run') return tasks.first_or_none() + @cached_property + def yellow_coins_preserve(self): + if self.is_cl1_enabled: + return 100000 + else: + return 35000 + def get_yellow_coins(self) -> int: yellow_coins = 0 timeout = Timer(2, count=3).start() diff --git a/module/os_shop/shop.py b/module/os_shop/shop.py index b97f0c0d1..161aff586 100644 --- a/module/os_shop/shop.py +++ b/module/os_shop/shop.py @@ -1,4 +1,3 @@ -from module.base.decorator import cached_property from module.base.timer import Timer from module.combat.assets import GET_ITEMS_1 from module.config.utils import get_os_reset_remain @@ -265,13 +264,6 @@ class OSShop(PortShop, AkashiShop): self.os_shop_buy(select_func=self.os_shop_get_item_to_buy_in_akashi) self.ui_back(appear_button=PORT_SUPPLY_CHECK, check_button=self.is_in_map, skip_first_screenshot=True) - @cached_property - def yellow_coins_preserve(self): - if self.is_cl1_enabled: - return 100000 - else: - return 35000 - def get_currency_coins(self, item): if item.cost == 'YellowCoins': if get_os_reset_remain() == 0: