Skip to content

Commit

Permalink
Merge pull request #1088 from LmeSzinc/dev
Browse files Browse the repository at this point in the history
Fix: Bug fixes
  • Loading branch information
LmeSzinc authored May 3, 2022
2 parents 9d73809 + 0bd4467 commit 2cf2ce6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 22 deletions.
3 changes: 2 additions & 1 deletion module/campaign/os_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def opsi_meowfficer_farming(self):
self.campaign.os_meowfficer_farming()
except ActionPointLimit:
if get_os_reset_remain() > 0:
self.campaign.config.task_delay(server_update=True)
self.config.task_delay(server_update=True)
self.config.task_call('MetaReward', force_call=False)
else:
logger.info('Just less than 1 day to OpSi reset, delay 2.5 hours')
self.config.task_delay(minute=150, server_update=True)
Expand Down
9 changes: 4 additions & 5 deletions module/campaign/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,10 @@ def handle_commission_notice(self):
Pages:
in: page_campaign
"""
if deep_get(self.config.data, keys='Commission.Scheduler.Enable', default=False):
if self.campaign.commission_notice_show_at_campaign():
logger.info('Commission notice found')
self.config.task_call('Commission')
self.config.task_stop('Commission notice found')
if self.campaign.commission_notice_show_at_campaign():
logger.info('Commission notice found')
self.config.task_call('Commission', force_call=True)
self.config.task_stop('Commission notice found')

def run(self, name, folder='campaign_main', mode='normal', total=0):
"""
Expand Down
33 changes: 20 additions & 13 deletions module/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ def force_enable(tasks):
self.modified[f'{task}.Scheduler.Enable'] = True

force_enable(['Commission', 'Research', 'Reward'])
limit_next_run(['Commission', 'Reward'], limit=now + timedelta(hours=12, minutes=-1))
limit_next_run(['Research'], limit=now + timedelta(hours=24, minutes=-1))
limit_next_run(['OpsiExplore'], limit=now + timedelta(days=31, minutes=-1))
limit_next_run(self.args.keys(), limit=now + timedelta(hours=24, minutes=-1))
limit_next_run(['Commission', 'Reward'], limit=now + timedelta(hours=12, seconds=-1))
limit_next_run(['Research'], limit=now + timedelta(hours=24, seconds=-1))
limit_next_run(['OpsiExplore'], limit=now + timedelta(days=31, seconds=-1))
limit_next_run(self.args.keys(), limit=now + timedelta(hours=24, seconds=-1))

def override(self, **kwargs):
"""
Expand Down Expand Up @@ -383,7 +383,7 @@ def is_special_radar(task):
if recon_scan:
tasks = SelectedGrids(['OpsiExplore', 'OpsiObscure', 'OpsiStronghold'])
tasks = tasks.delete(tasks.filter(is_force_run)).delete(tasks.filter(is_special_radar))
delay_tasks(tasks, minutes=30)
delay_tasks(tasks, minutes=27)
if submarine_call:
tasks = SelectedGrids(['OpsiExplore', 'OpsiDaily', 'OpsiObscure', 'OpsiAbyssal', 'OpsiStronghold',
'OpsiMeowfficerFarming'])
Expand All @@ -400,7 +400,7 @@ def is_special_radar(task):

self.update()

def task_call(self, task):
def task_call(self, task, force_call=True):
"""
Call another task to run.
Expand All @@ -411,16 +411,23 @@ def task_call(self, task):
Args:
task (str): Task name to call, such as `Restart`
force_call (bool):
Returns:
bool: If called.
"""
path = f'{task}.Scheduler.NextRun'
if deep_get(self.data, keys=path, default=None) is None:
if deep_get(self.data, keys=f'{task}.Scheduler.NextRun', default=None) is None:
raise ScriptError(f'Task to call: `{task}` does not exist in user config')
else:
self.modified[path] = datetime(2021, 1, 1, 0, 0, 0)
if task == 'Restart':
# Restart is forced to enable
self.modified[f'{task}.Scheduler.Enable'] = True

if force_call or deep_get(self.data, keys=f'{task}.Scheduler.Enable', default=False):
logger.info(f'Task call: {task}')
self.modified[f'{task}.Scheduler.NextRun'] = datetime.now().replace(microsecond=0)
self.modified[f'{task}.Scheduler.Enable'] = True
self.update()
return True
else:
logger.info(f'Task call: {task} (skipped because disabled by user)')
return False

@staticmethod
def task_stop(message=''):
Expand Down
4 changes: 2 additions & 2 deletions module/config/config_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ def SERVER(self):
> Research > Commission > Tactical
> Exercise
> Dorm > Meowfficer > Guild > Gacha > SupplyPack
> Reward > BattlePass
> Reward > MetaReward > BattlePass
> ShopFrequent > ShopOnce > Shipyard > DataKey
> OpsiExplore
> OpsiDaily > OpsiShop
> OpsiAbyssal > OpsiStronghold > OpsiObscure
> Daily > Hard > OpsiAshAssist
> Sos > EventSp > EventAb > EventCd > RaidDaily > WarArchives > MaritimeEscort
> OpsiMeowfficerFarming > MetaReward
> Event > Event2 > Raid > Main > Main2 > Main3
> OpsiMeowfficerFarming
> GemsFarming
"""

Expand Down
5 changes: 4 additions & 1 deletion module/os/globe_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ def get_zone_select(self):
Returns:
list[Button]:
"""
return [select for select in ZONE_SELECT if self.appear(select, offset=self._zone_select_offset)]
# Lower threshold to 0.75
# Don't know why buy but fonts are different sometimes
return [select for select in ZONE_SELECT if
self.appear(select, offset=self._zone_select_offset, threshold=0.75)]

def is_in_zone_select(self):
"""
Expand Down

0 comments on commit 2cf2ce6

Please sign in to comment.