補齊了SOS的Enemy_filter支援;更改每日活動地圖的命名;修正了部分翻譯;將國服以外緊急委託刷鑽石的等級修正

This commit is contained in:
bookbug666 2022-07-26 00:23:21 +08:00
parent 704c27cf4d
commit 692e4d1300
25 changed files with 359 additions and 352 deletions

16
alas.py
View File

@ -225,20 +225,20 @@ class AzurLaneAutoScript:
from module.raid.daily import RaidDaily
RaidDaily(config=self.config, device=self.device).run()
def event_ab(self):
from module.event.campaign_ab import CampaignAB
CampaignAB(config=self.config, device=self.device).run()
def event_a(self):
from module.event.campaign_abcd import CampaignA
CampaignA(config=self.config, device=self.device).run()
def event_b(self):
from module.event.campaign_b import CampaignB
from module.event.campaign_abcd import CampaignB
CampaignB(config=self.config, device=self.device).run()
def event_cd(self):
from module.event.campaign_cd import CampaignCD
CampaignCD(config=self.config, device=self.device).run()
def event_c(self):
from module.event.campaign_abcd import CampaignC
CampaignC(config=self.config, device=self.device).run()
def event_d(self):
from module.event.campaign_d import CampaignD
from module.event.campaign_abcd import CampaignD
CampaignD(config=self.config, device=self.device).run()
def event_sp(self):

View File

@ -69,7 +69,13 @@ class Campaign(CampaignBase):
MAP = MAP
def battle_0(self):
if self.clear_enemy(scale=(2, 3), genre=['light', 'carrier', 'enemy', 'main']):
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=1):
return True
return self.battle_default()
def battle_2(self):
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
return True
return self.battle_default()

View File

@ -79,7 +79,13 @@ class Campaign(CampaignBase):
MAP_ENEMY_SEARCHING_OVERLAY_TRANSPARENCY_THRESHOLD = 0.65
def battle_0(self):
if self.clear_enemy(scale=(2, 3), genre=['light', 'carrier', 'enemy', 'main']):
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=1):
return True
return self.battle_default()
def battle_3(self):
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
return True
return self.battle_default()

View File

@ -73,7 +73,13 @@ class Campaign(CampaignBase):
MAP = MAP
def battle_0(self):
if self.clear_enemy(scale=(2, 3), genre=['light', 'carrier', 'enemy', 'main']):
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=1):
return True
return self.battle_default()
def battle_3(self):
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
return True
return self.battle_default()

View File

@ -75,10 +75,13 @@ class Campaign(CampaignBase):
MAP = MAP
def battle_0(self):
if self.fleet_2_push_forward():
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=1):
return True
if self.clear_enemy(scale=(2, 3), genre=['light', 'carrier', 'enemy', 'main']):
return self.battle_default()
def battle_3(self):
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
return True
return self.battle_default()

View File

@ -491,17 +491,17 @@
"EnemyScaleBalanceWeight": "default_mode"
}
},
"EventAb": {
"EventA": {
"Scheduler": {
"Enable": false,
"NextRun": "2020-01-01 00:00:00",
"Command": "EventAb",
"Command": "EventA",
"SuccessInterval": 30,
"FailureInterval": 30,
"ServerUpdate": "00:00"
},
"EventAb": {
"StageFilter": "A1 > A2 > A3 > B1 > B2 > B3",
"EventA": {
"StageFilter": "A1 > A2 > A3",
"LastStage": 0
},
"Campaign": {
@ -643,17 +643,17 @@
"EnemyScaleBalanceWeight": "default_mode"
}
},
"EventCd": {
"EventC": {
"Scheduler": {
"Enable": false,
"NextRun": "2020-01-01 00:00:00",
"Command": "EventCd",
"Command": "EventC",
"SuccessInterval": 30,
"FailureInterval": 30,
"ServerUpdate": "00:00"
},
"EventCd": {
"StageFilter": "C1 > C2 > C3 > D1 > D2 > D3",
"EventC": {
"StageFilter": "C1 > C2 > C3",
"LastStage": 0
},
"Campaign": {

View File

@ -87,9 +87,9 @@ class CampaignEvent(UI):
tasks = [
'Event',
'Event2',
'EventAb',
'EventA',
'EventB',
'EventCd',
'EventC',
'EventD',
'EventSp',
'Raid',
@ -122,9 +122,9 @@ class CampaignEvent(UI):
tasks = [
'Event',
'Event2',
'EventAb',
'EventA',
'EventB',
'EventCd',
'EventC',
'EventD',
'EventSp',
'GemsFarming',

View File

@ -197,8 +197,12 @@ class GemsFarming(CampaignRun, Dock, EquipmentChange):
# for :
# if level == 100 and emotion == 150:
# return button
button, _, _ = max(filter(lambda a: a[1] == 100, button_list), key=lambda a: a[2])
return button
if self.config.SERVER in ['cn']:
button, _, _ = max(filter(lambda a: a[1] == 100, button_list), key=lambda a: a[2])
return button
else:
button, _, _ = max(filter(lambda a: a[1] == 70, button_list), key=lambda a: a[2])
return button
def flagship_change_execute(self):
"""

View File

@ -2559,7 +2559,7 @@
}
}
},
"EventAb": {
"EventA": {
"Scheduler": {
"Enable": {
"type": "checkbox",
@ -2572,7 +2572,7 @@
},
"Command": {
"type": "hide",
"value": "EventAb"
"value": "EventA"
},
"SuccessInterval": {
"type": "hide",
@ -2587,10 +2587,10 @@
"value": "00:00"
}
},
"EventAb": {
"EventA": {
"StageFilter": {
"type": "textarea",
"value": "A1 > A2 > A3 > B1 > B2 > B3"
"value": "A1 > A2 > A3"
},
"LastStage": {
"type": "input",
@ -3395,7 +3395,7 @@
}
}
},
"EventCd": {
"EventC": {
"Scheduler": {
"Enable": {
"type": "checkbox",
@ -3408,7 +3408,7 @@
},
"Command": {
"type": "hide",
"value": "EventCd"
"value": "EventC"
},
"SuccessInterval": {
"type": "hide",
@ -3423,10 +3423,10 @@
"value": "00:00"
}
},
"EventCd": {
"EventC": {
"StageFilter": {
"type": "textarea",
"value": "C1 > C2 > C3 > D1 > D2 > D3"
"value": "C1 > C2 > C3"
},
"LastStage": {
"type": "input",

View File

@ -219,17 +219,17 @@ GemsFarming:
EventGeneral:
PtLimit: 0
TimeLimit: 2020-01-01 00:00:00
EventAb:
EventA:
StageFilter: |-
A1 > A2 > A3 > B1 > B2 > B3
A1 > A2 > A3
LastStage: 0
EventB:
StageFilter: |-
B1 > B2 > B3
LastStage: 0
EventCd:
EventC:
StageFilter: |-
C1 > C2 > C3 > D1 > D2 > D3
C1 > C2 > C3
LastStage: 0
EventD:
StageFilter: |-

View File

@ -15,9 +15,9 @@
"EventGeneral",
"Event",
"Event2",
"EventAb",
"EventA",
"EventB",
"EventCd",
"EventC",
"EventD",
"EventSp",
"Raid",

View File

@ -43,7 +43,7 @@ Event2:
Campaign:
Mode: normal
AmbushEvade: true
EventAb:
EventA:
Scheduler:
SuccessInterval: 30
FailureInterval: 30
@ -75,7 +75,7 @@ EventB:
StageIncrease: false
GetNewShip: false
ReachLevel: 0
EventCd:
EventC:
Scheduler:
SuccessInterval: 30
FailureInterval: 30

View File

@ -75,9 +75,9 @@ Event2:
- Emotion
- HpControl
- EnemyPriority
EventAb:
EventA:
- Scheduler
- EventAb
- EventA
- Campaign
- StopCondition
- Fleet
@ -95,9 +95,9 @@ EventB:
- Emotion
- HpControl
- EnemyPriority
EventCd:
EventC:
- Scheduler
- EventCd
- EventC
- Campaign
- StopCondition
- Fleet

View File

@ -147,17 +147,17 @@ class GeneratedConfig:
EventGeneral_PtLimit = 0
EventGeneral_TimeLimit = datetime.datetime(2020, 1, 1, 0, 0)
# Group `EventAb`
EventAb_StageFilter = 'A1 > A2 > A3 > B1 > B2 > B3'
EventAb_LastStage = 0
# Group `EventA`
EventA_StageFilter = 'A1 > A2 > A3'
EventA_LastStage = 0
# Group `EventB`
EventB_StageFilter = 'B1 > B2 > B3'
EventB_LastStage = 0
# Group `EventCd`
EventCd_StageFilter = 'C1 > C2 > C3 > D1 > D2 > D3'
EventCd_LastStage = 0
# Group `EventC`
EventC_StageFilter = 'C1 > C2 > C3'
EventC_LastStage = 0
# Group `EventD`
EventD_StageFilter = 'D1 > D2 > D3'

View File

@ -19,7 +19,7 @@ class ManualConfig:
> OpsiDaily > OpsiShop
> OpsiAbyssal > OpsiStronghold > OpsiObscure
> Daily > Hard > OpsiAshAssist
> Sos > EventSp > EventAb > EventB > EventCd > EventD > RaidDaily > WarArchives > MaritimeEscort
> Sos > EventSp > EventA > EventB > EventC > EventD > RaidDaily > WarArchives > MaritimeEscort
> Event > Event2 > Raid > Main > Main2 > Main3
> OpsiMeowfficerFarming
> GemsFarming

View File

@ -362,15 +362,15 @@ class ConfigGenerator:
else:
insert('Event')
insert('Event2')
insert('EventAb')
insert('EventA')
insert('EventB')
insert('EventCd')
insert('EventC')
insert('EventD')
insert('EventSp')
insert('GemsFarming')
# Remove campaign_main from event list
for task in ['Event', 'Event2', 'EventAb', 'EventB', 'EventCd', 'EventD', 'EventSp', 'Raid', 'RaidDaily', 'WarArchives']:
for task in ['Event', 'Event2', 'EventA', 'EventB', 'EventC', 'EventD', 'EventSp', 'Raid', 'RaidDaily', 'WarArchives']:
options = deep_get(self.args, keys=f'{task}.Campaign.Event.option')
options = [option for option in options if option != 'campaign_main']
deep_set(self.args, keys=f'{task}.Campaign.Event.option', value=options)
@ -487,7 +487,7 @@ class ConfigUpdater:
# Update to latest event
server = to_server(deep_get(new, 'Alas.Emulator.PackageName', 'cn'))
if not is_template:
for task in ['Event', 'Event2', 'EventAb', 'EventB', 'EventCd', 'EventD', 'EventSp', 'Raid', 'RaidDaily']:
for task in ['Event', 'Event2', 'EventA', 'EventB', 'EventC', 'EventD', 'EventSp', 'Raid', 'RaidDaily']:
deep_set(new,
keys=f'{task}.Campaign.Event',
value=deep_get(self.args, f'{task}.Campaign.Event.{server}'))

View File

@ -78,21 +78,21 @@
"name": "Event-2",
"help": ""
},
"EventAb": {
"name": "Event AB",
"EventA": {
"name": "Event A",
"help": ""
},
"EventB": {
"name": "Task.EventB.name",
"help": "Task.EventB.help"
"name": "EventB",
"help": ""
},
"EventCd": {
"name": "Event CD",
"EventC": {
"name": "EventC",
"help": ""
},
"EventD": {
"name": "Task.EventD.name",
"help": "Task.EventD.help"
"name": "EventD",
"help": ""
},
"EventSp": {
"name": "Event SP",
@ -947,7 +947,7 @@
},
"VanguardChange": {
"name": "Enable Vanguard Change",
"help": "Applies to fleet 1, switch out to new level 1 common vanguard after current has reached level 35+"
"help": "Applies to fleet 1, switch out to new level 100(70) common vanguard after current has reached level 35+\n(Only CN players'0 limit break ship can reach level 100)"
},
"VanguardEquipChange": {
"name": "Enable Vanguard Equipment Change",
@ -981,24 +981,24 @@
"help": "When the local time exceeds the given value, disable all event tasks. '2020-01-01 00:00:00' means no limit and the time will be reset once it's triggered\nThis can prevent the occurrence of forgetting to disable event tasks after the event ends"
}
},
"EventAb": {
"EventA": {
"_info": {
"name": "EventAB Settings",
"name": "EventA Settings",
"help": ""
},
"StageFilter": {
"name": "EventAB Stage Filter",
"name": "EventA Stage Filter",
"help": ""
},
"LastStage": {
"name": "Last EventAB Stage",
"name": "Last EventA Stage",
"help": "Automatically updated, skips completed levels in the filter, and resets at server reset time (00:00)"
}
},
"EventB": {
"_info": {
"name": "EventB Settings",
"help": "Low cost fleets, like 0 limit break DD+ 0 limit break CVL, often having trouble with no ammo boss fight in B2 and B3\nSelecting different fleets may help deal such situation"
"help": ""
},
"StageFilter": {
"name": "EventB Stage Filter",
@ -1009,24 +1009,24 @@
"help": "Automatically updated, skips completed levels in the filter, and resets at server reset time (00:00)"
}
},
"EventCd": {
"EventC": {
"_info": {
"name": "EventCD Settings",
"name": "EventC Settings",
"help": ""
},
"StageFilter": {
"name": "EventCD Stage Filter",
"name": "EventC Stage Filter",
"help": ""
},
"LastStage": {
"name": "Last EventCD Stage",
"name": "Last EventC Stage",
"help": "Automatically updated, skips completed levels in the filter, and resets at server reset time (00:00)"
}
},
"EventD": {
"_info": {
"name": "EventD Settings",
"help": "Due to the different ship requirements between map C and D, a separate module is created to handle it."
"help": ""
},
"StageFilter": {
"name": "EventD Stage Filter",

View File

@ -78,17 +78,17 @@
"name": "Task.Event2.name",
"help": "Task.Event2.help"
},
"EventAb": {
"name": "Task.EventAb.name",
"help": "Task.EventAb.help"
"EventA": {
"name": "Task.EventA.name",
"help": "Task.EventA.help"
},
"EventB": {
"name": "Task.EventB.name",
"help": "Task.EventB.help"
},
"EventCd": {
"name": "Task.EventCd.name",
"help": "Task.EventCd.help"
"EventC": {
"name": "Task.EventC.name",
"help": "Task.EventC.help"
},
"EventD": {
"name": "Task.EventD.name",
@ -981,18 +981,18 @@
"help": "EventGeneral.TimeLimit.help"
}
},
"EventAb": {
"EventA": {
"_info": {
"name": "EventAb._info.name",
"help": "EventAb._info.help"
"name": "EventA._info.name",
"help": "EventA._info.help"
},
"StageFilter": {
"name": "EventAb.StageFilter.name",
"help": "EventAb.StageFilter.help"
"name": "EventA.StageFilter.name",
"help": "EventA.StageFilter.help"
},
"LastStage": {
"name": "EventAb.LastStage.name",
"help": "EventAb.LastStage.help"
"name": "EventA.LastStage.name",
"help": "EventA.LastStage.help"
}
},
"EventB": {
@ -1009,18 +1009,18 @@
"help": "EventB.LastStage.help"
}
},
"EventCd": {
"EventC": {
"_info": {
"name": "EventCd._info.name",
"help": "EventCd._info.help"
"name": "EventC._info.name",
"help": "EventC._info.help"
},
"StageFilter": {
"name": "EventCd.StageFilter.name",
"help": "EventCd.StageFilter.help"
"name": "EventC.StageFilter.name",
"help": "EventC.StageFilter.help"
},
"LastStage": {
"name": "EventCd.LastStage.name",
"help": "EventCd.LastStage.help"
"name": "EventC.LastStage.name",
"help": "EventC.LastStage.help"
}
},
"EventD": {

View File

@ -78,16 +78,16 @@
"name": "活动图-2",
"help": ""
},
"EventAb": {
"name": "活动每日AB图",
"EventA": {
"name": "活动每日A图",
"help": ""
},
"EventB": {
"name": "活动每日B图",
"help": ""
},
"EventCd": {
"name": "活动每日CD图",
"EventC": {
"name": "活动每日C图",
"help": ""
},
"EventD": {
@ -947,7 +947,7 @@
},
"VanguardChange": {
"name": "更换前排",
"help": "换前排通过找一艘150心情等级100的白鹰白皮驱逐完成所以尽量保证有足够多的驱逐在后排休息。\n不启用将不更换前排"
"help": "换前排通过找一艘150心情等级100的白鹰白皮驱逐完成所以尽量保证有足够多的驱逐在后排休息。\n国服以外则为150心情等级100的白鹰白船驱逐。\n不启用将不更换前排"
},
"VanguardEquipChange": {
"name": "更换前排的装备",
@ -981,9 +981,9 @@
"help": "当本地时间超过给定数值后,禁用所有活动任务,'2020-01-01 00:00:00' 表示不限制,触发一次后时间将被重置\n设置后能防止活动结束后忘记关闭任务的事情发生"
}
},
"EventAb": {
"EventA": {
"_info": {
"name": "活动每日AB图",
"name": "活动每日A图",
"help": ""
},
"StageFilter": {
@ -998,7 +998,7 @@
"EventB": {
"_info": {
"name": "活动每日B图",
"help": "由于3油低耗队伍在B2.B3等地图会需要空弹打王容易翻车\n故制作一个从每日AB分离的单独模块来处理地图B2.B3"
"help": ""
},
"StageFilter": {
"name": "活动每日过滤器",
@ -1009,9 +1009,9 @@
"help": "自动更新的数值将跳过过滤器中已完成的关卡过0点重置"
}
},
"EventCd": {
"EventC": {
"_info": {
"name": "活动每日CD图",
"name": "活动每日C图",
"help": ""
},
"StageFilter": {
@ -1026,7 +1026,7 @@
"EventD": {
"_info": {
"name": "活动每日D图",
"help": "由于CD图锁船种的要求不同故制作一个从每日CD分离的单独模块来处理"
"help": ""
},
"StageFilter": {
"name": "活动每日过滤器",

View File

@ -78,16 +78,16 @@
"name": "活動圖-2",
"help": ""
},
"EventAb": {
"name": "活動每日AB圖",
"EventA": {
"name": "活動每日A圖",
"help": ""
},
"EventB": {
"name": "活動每日B圖",
"help": ""
},
"EventCd": {
"name": "活動每日CD圖",
"EventC": {
"name": "活動每日C圖",
"help": ""
},
"EventD": {
@ -947,7 +947,7 @@
},
"VanguardChange": {
"name": "更換前排",
"help": "換前排通過找一艘150心情等級100的白鷹白船驅逐完成所以盡量保證有足夠多的驅逐在後排休息。 \n不啟用將不更換前排"
"help": "換前排通過找一艘150心情等級100的白鷹白船驅逐完成所以盡量保證有足夠多的驅逐在後排休息。\n國服以外則為150心情等級100的白鷹白船驅逐。 \n不啟用將不更換前排"
},
"VanguardEquipChange": {
"name": "更換前排的裝備",
@ -981,9 +981,9 @@
"help": "當本地時間超過給定數值後,禁用所有活動任務,'2020-01-01 00:00:00' 表示不限制,觸發一次後時間將被重置\n設置後能防止活動結束後忘記關閉任務的事情發生"
}
},
"EventAb": {
"EventA": {
"_info": {
"name": "活動每日AB圖",
"name": "活動每日A圖",
"help": ""
},
"StageFilter": {
@ -997,8 +997,8 @@
},
"EventB": {
"_info": {
"name": "活動每日AB圖",
"help": "由於3油低耗隊伍在B2.B3等地圖會需要空彈打王容易翻車\n故製作一個從每日AB分離的單獨模塊來處理地圖B2.B3"
"name": "活動每日B圖",
"help": ""
},
"StageFilter": {
"name": "活動每日過濾器",
@ -1009,9 +1009,9 @@
"help": "自動更新的數值將跳過過濾器中已完成的地圖過0點重置"
}
},
"EventCd": {
"EventC": {
"_info": {
"name": "活動每日CD圖",
"name": "活動每日C圖",
"help": ""
},
"StageFilter": {
@ -1026,7 +1026,7 @@
"EventD": {
"_info": {
"name": "活動每日D圖",
"help": "由於CD圖鎖船種的要求不同故製作一個從每日CD分離的單獨模塊來處理"
"help": ""
},
"StageFilter": {
"name": "活動每日過濾器",

View File

@ -1,58 +0,0 @@
import os
from module.config.config import TaskEnd
from module.config.utils import get_server_last_update
from module.event.base import STAGE_FILTER, EventBase, EventStage
from module.logger import logger
class CampaignAB(EventBase):
def run(self, *args, **kwargs):
# Filter map files
stages = [EventStage(file) for file in os.listdir(f'./campaign/{self.config.Campaign_Event}')]
stages = self.convert_stages(stages)
logger.attr('Stage', [str(stage) for stage in stages])
logger.attr('StageFilter', self.config.EventAb_StageFilter)
STAGE_FILTER.load(self.config.EventAb_StageFilter)
self.convert_stages(STAGE_FILTER)
stages = [str(stage) for stage in STAGE_FILTER.apply(stages)]
logger.attr('Filter sort', ' > '.join(stages))
if not stages:
logger.warning('No stage satisfy current filter')
self.config.Scheduler_Enable = False
self.config.task_stop()
# Start from last stage
logger.info(f'LastStage {self.config.EventAb_LastStage}, recorded at {self.config.Scheduler_NextRun}')
if get_server_last_update(self.config.Scheduler_ServerUpdate) >= self.config.Scheduler_NextRun:
logger.info('LastStage outdated, reset')
self.config.EventAb_LastStage = 0
else:
last = str(self.config.EventAb_LastStage).lower()
last = self.convert_stages(last)
if last in stages:
stages = stages[stages.index(last) + 1:]
logger.attr('Filter sort', ' > '.join(stages))
else:
logger.info('Start from the beginning')
# Run
for stage in stages:
stage = str(stage)
try:
super().run(name=stage, folder=self.config.Campaign_Event, total=1)
except TaskEnd:
# Catch task switch
pass
if self.run_count > 0:
with self.config.multi_set():
self.config.EventAb_LastStage = stage
self.config.task_delay(minute=0)
else:
self.config.task_stop()
if self.config.task_switched():
self.config.task_stop()
# Scheduler
self.config.task_delay(server_update=True)

View File

@ -0,0 +1,214 @@
import os
from module.config.config import TaskEnd
from module.config.utils import get_server_last_update
from module.event.base import STAGE_FILTER, EventBase, EventStage
from module.logger import logger
class CampaignA(EventBase):
def run(self, *args, **kwargs):
# Filter map files
stages = [EventStage(file) for file in os.listdir(f'./campaign/{self.config.Campaign_Event}')]
stages = self.convert_stages(stages)
logger.attr('Stage', [str(stage) for stage in stages])
logger.attr('StageFilter', self.config.EventA_StageFilter)
STAGE_FILTER.load(self.config.EventA_StageFilter)
self.convert_stages(STAGE_FILTER)
stages = [str(stage) for stage in STAGE_FILTER.apply(stages)]
logger.attr('Filter sort', ' > '.join(stages))
if not stages:
logger.warning('No stage satisfy current filter')
self.config.Scheduler_Enable = False
self.config.task_stop()
# Start from last stage
logger.info(f'LastStage {self.config.EventA_LastStage}, recorded at {self.config.Scheduler_NextRun}')
if get_server_last_update(self.config.Scheduler_ServerUpdate) >= self.config.Scheduler_NextRun:
logger.info('LastStage outdated, reset')
self.config.EventA_LastStage = 0
else:
last = str(self.config.EventA_LastStage).lower()
last = self.convert_stages(last)
if last in stages:
stages = stages[stages.index(last) + 1:]
logger.attr('Filter sort', ' > '.join(stages))
else:
logger.info('Start from the beginning')
# Run
for stage in stages:
stage = str(stage)
try:
super().run(name=stage, folder=self.config.Campaign_Event, total=1)
except TaskEnd:
# Catch task switch
pass
if self.run_count > 0:
with self.config.multi_set():
self.config.EventA_LastStage = stage
self.config.task_delay(minute=0)
else:
self.config.task_stop()
if self.config.task_switched():
self.config.task_stop()
# Scheduler
self.config.task_delay(server_update=True)
class CampaignB(EventBase):
def run(self, *args, **kwargs):
# Filter map files
stages = [EventStage(file) for file in os.listdir(f'./campaign/{self.config.Campaign_Event}')]
stages = self.convert_stages(stages)
logger.attr('Stage', [str(stage) for stage in stages])
logger.attr('StageFilter', self.config.EventB_StageFilter)
STAGE_FILTER.load(self.config.EventB_StageFilter)
self.convert_stages(STAGE_FILTER)
stages = [str(stage) for stage in STAGE_FILTER.apply(stages)]
logger.attr('Filter sort', ' > '.join(stages))
if not stages:
logger.warning('No stage satisfy current filter')
self.config.Scheduler_Enable = False
self.config.task_stop()
# Start from last stage
logger.info(f'LastStage {self.config.EventB_LastStage}, recorded at {self.config.Scheduler_NextRun}')
if get_server_last_update(self.config.Scheduler_ServerUpdate) >= self.config.Scheduler_NextRun:
logger.info('LastStage outdated, reset')
self.config.EventB_LastStage = 0
else:
last = str(self.config.EventB_LastStage).lower()
last = self.convert_stages(last)
if last in stages:
stages = stages[stages.index(last) + 1:]
logger.attr('Filter sort', ' > '.join(stages))
else:
logger.info('Start from the beginning')
# Run
for stage in stages:
stage = str(stage)
try:
super().run(name=stage, folder=self.config.Campaign_Event, total=1)
except TaskEnd:
# Catch task switch
pass
if self.run_count > 0:
with self.config.multi_set():
self.config.EventB_LastStage = stage
self.config.task_delay(minute=0)
else:
self.config.task_stop()
if self.config.task_switched():
self.config.task_stop()
# Scheduler
self.config.task_delay(server_update=True)
class CampaignC(EventBase):
def run(self, *args, **kwargs):
# Filter map files
stages = [EventStage(file) for file in os.listdir(f'./campaign/{self.config.Campaign_Event}')]
stages = self.convert_stages(stages)
logger.attr('Stage', [str(stage) for stage in stages])
logger.attr('StageFilter', self.config.EventC_StageFilter)
STAGE_FILTER.load(self.config.EventC_StageFilter)
self.convert_stages(STAGE_FILTER)
stages = [str(stage) for stage in STAGE_FILTER.apply(stages)]
logger.attr('Filter sort', ' > '.join(stages))
if not stages:
logger.warning('No stage satisfy current filter')
self.config.Scheduler_Enable = False
self.config.task_stop()
# Start from last stage
logger.info(f'LastStage {self.config.EventC_LastStage}, recorded at {self.config.Scheduler_NextRun}')
if get_server_last_update(self.config.Scheduler_ServerUpdate) >= self.config.Scheduler_NextRun:
logger.info('LastStage outdated, reset')
self.config.EventC_LastStage = 0
else:
last = str(self.config.EventC_LastStage).lower()
last = self.convert_stages(last)
if last in stages:
stages = stages[stages.index(last) + 1:]
logger.attr('Filter sort', ' > '.join(stages))
else:
logger.info('Start from the beginning')
# Run
for stage in stages:
stage = str(stage)
try:
super().run(name=stage, folder=self.config.Campaign_Event, total=1)
except TaskEnd:
# Catch task switch
pass
if self.run_count > 0:
with self.config.multi_set():
self.config.EventC_LastStage = stage
self.config.task_delay(minute=0)
else:
self.config.task_stop()
if self.config.task_switched():
self.config.task_stop()
# Scheduler
self.config.task_delay(server_update=True)
class CampaignD(EventBase):
def run(self, *args, **kwargs):
# Filter map files
stages = [EventStage(file) for file in os.listdir(f'./campaign/{self.config.Campaign_Event}')]
stages = self.convert_stages(stages)
logger.attr('Stage', [str(stage) for stage in stages])
logger.attr('StageFilter', self.config.EventD_StageFilter)
STAGE_FILTER.load(self.config.EventD_StageFilter)
self.convert_stages(STAGE_FILTER)
stages = [str(stage) for stage in STAGE_FILTER.apply(stages)]
logger.attr('Filter sort', ' > '.join(stages))
if not stages:
logger.warning('No stage satisfy current filter')
self.config.Scheduler_Enable = False
self.config.task_stop()
# Start from last stage
logger.info(f'LastStage {self.config.EventD_LastStage}, recorded at {self.config.Scheduler_NextRun}')
if get_server_last_update(self.config.Scheduler_ServerUpdate) >= self.config.Scheduler_NextRun:
logger.info('LastStage outdated, reset')
self.config.EventD_LastStage = 0
else:
last = str(self.config.EventD_LastStage).lower()
last = self.convert_stages(last)
if last in stages:
stages = stages[stages.index(last) + 1:]
logger.attr('Filter sort', ' > '.join(stages))
else:
logger.info('Start from the beginning')
# Run
for stage in stages:
stage = str(stage)
try:
super().run(name=stage, folder=self.config.Campaign_Event, total=1)
except TaskEnd:
# Catch task switch
pass
if self.run_count > 0:
with self.config.multi_set():
self.config.EventD_LastStage = stage
self.config.task_delay(minute=0)
else:
self.config.task_stop()
if self.config.task_switched():
self.config.task_stop()
# Scheduler
self.config.task_delay(server_update=True)

View File

@ -1,58 +0,0 @@
import os
from module.config.config import TaskEnd
from module.config.utils import get_server_last_update
from module.event.base import STAGE_FILTER, EventBase, EventStage
from module.logger import logger
class CampaignB(EventBase):
def run(self, *args, **kwargs):
# Filter map files
stages = [EventStage(file) for file in os.listdir(f'./campaign/{self.config.Campaign_Event}')]
stages = self.convert_stages(stages)
logger.attr('Stage', [str(stage) for stage in stages])
logger.attr('StageFilter', self.config.EventB_StageFilter)
STAGE_FILTER.load(self.config.EventB_StageFilter)
self.convert_stages(STAGE_FILTER)
stages = [str(stage) for stage in STAGE_FILTER.apply(stages)]
logger.attr('Filter sort', ' > '.join(stages))
if not stages:
logger.warning('No stage satisfy current filter')
self.config.Scheduler_Enable = False
self.config.task_stop()
# Start from last stage
logger.info(f'LastStage {self.config.EventB_LastStage}, recorded at {self.config.Scheduler_NextRun}')
if get_server_last_update(self.config.Scheduler_ServerUpdate) >= self.config.Scheduler_NextRun:
logger.info('LastStage outdated, reset')
self.config.EventB_LastStage = 0
else:
last = str(self.config.EventB_LastStage).lower()
last = self.convert_stages(last)
if last in stages:
stages = stages[stages.index(last) + 1:]
logger.attr('Filter sort', ' > '.join(stages))
else:
logger.info('Start from the beginning')
# Run
for stage in stages:
stage = str(stage)
try:
super().run(name=stage, folder=self.config.Campaign_Event, total=1)
except TaskEnd:
# Catch task switch
pass
if self.run_count > 0:
with self.config.multi_set():
self.config.EventB_LastStage = stage
self.config.task_delay(minute=0)
else:
self.config.task_stop()
if self.config.task_switched():
self.config.task_stop()
# Scheduler
self.config.task_delay(server_update=True)

View File

@ -1,58 +0,0 @@
import os
from module.config.config import TaskEnd
from module.config.utils import get_server_last_update
from module.event.base import STAGE_FILTER, EventBase, EventStage
from module.logger import logger
class CampaignCD(EventBase):
def run(self, *args, **kwargs):
# Filter map files
stages = [EventStage(file) for file in os.listdir(f'./campaign/{self.config.Campaign_Event}')]
stages = self.convert_stages(stages)
logger.attr('Stage', [str(stage) for stage in stages])
logger.attr('StageFilter', self.config.EventCd_StageFilter)
STAGE_FILTER.load(self.config.EventCd_StageFilter)
self.convert_stages(STAGE_FILTER)
stages = [str(stage) for stage in STAGE_FILTER.apply(stages)]
logger.attr('Filter sort', ' > '.join(stages))
if not stages:
logger.warning('No stage satisfy current filter')
self.config.Scheduler_Enable = False
self.config.task_stop()
# Start from last stage
logger.info(f'LastStage {self.config.EventCd_LastStage}, recorded at {self.config.Scheduler_NextRun}')
if get_server_last_update(self.config.Scheduler_ServerUpdate) >= self.config.Scheduler_NextRun:
logger.info('LastStage outdated, reset')
self.config.EventCd_LastStage = 0
else:
last = str(self.config.EventCd_LastStage).lower()
last = self.convert_stages(last)
if last in stages:
stages = stages[stages.index(last) + 1:]
logger.attr('Filter sort', ' > '.join(stages))
else:
logger.info('Start from the beginning')
# Run
for stage in stages:
stage = str(stage)
try:
super().run(name=stage, folder=self.config.Campaign_Event, total=1)
except TaskEnd:
# Catch task switch
pass
if self.run_count > 0:
with self.config.multi_set():
self.config.EventCd_LastStage = stage
self.config.task_delay(minute=0)
else:
self.config.task_stop()
if self.config.task_switched():
self.config.task_stop()
# Scheduler
self.config.task_delay(server_update=True)

View File

@ -1,58 +0,0 @@
import os
from module.config.config import TaskEnd
from module.config.utils import get_server_last_update
from module.event.base import STAGE_FILTER, EventBase, EventStage
from module.logger import logger
class CampaignD(EventBase):
def run(self, *args, **kwargs):
# Filter map files
stages = [EventStage(file) for file in os.listdir(f'./campaign/{self.config.Campaign_Event}')]
stages = self.convert_stages(stages)
logger.attr('Stage', [str(stage) for stage in stages])
logger.attr('StageFilter', self.config.EventD_StageFilter)
STAGE_FILTER.load(self.config.EventD_StageFilter)
self.convert_stages(STAGE_FILTER)
stages = [str(stage) for stage in STAGE_FILTER.apply(stages)]
logger.attr('Filter sort', ' > '.join(stages))
if not stages:
logger.warning('No stage satisfy current filter')
self.config.Scheduler_Enable = False
self.config.task_stop()
# Start from last stage
logger.info(f'LastStage {self.config.EventD_LastStage}, recorded at {self.config.Scheduler_NextRun}')
if get_server_last_update(self.config.Scheduler_ServerUpdate) >= self.config.Scheduler_NextRun:
logger.info('LastStage outdated, reset')
self.config.EventD_LastStage = 0
else:
last = str(self.config.EventD_LastStage).lower()
last = self.convert_stages(last)
if last in stages:
stages = stages[stages.index(last) + 1:]
logger.attr('Filter sort', ' > '.join(stages))
else:
logger.info('Start from the beginning')
# Run
for stage in stages:
stage = str(stage)
try:
super().run(name=stage, folder=self.config.Campaign_Event, total=1)
except TaskEnd:
# Catch task switch
pass
if self.run_count > 0:
with self.config.multi_set():
self.config.EventD_LastStage = stage
self.config.task_delay(minute=0)
else:
self.config.task_stop()
if self.config.task_switched():
self.config.task_stop()
# Scheduler
self.config.task_delay(server_update=True)