mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-01-08 12:47:32 +08:00
Fix: Redirect stage names like "B-1" to be foolproof
This commit is contained in:
parent
48e4c78a43
commit
bfdf6e4179
@ -2,7 +2,6 @@ import copy
|
||||
import importlib
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
|
||||
from module.campaign.campaign_base import CampaignBase
|
||||
from module.campaign.campaign_event import CampaignEvent
|
||||
@ -164,7 +163,6 @@ class CampaignRun(CampaignEvent):
|
||||
Returns:
|
||||
str, str: name, folder
|
||||
"""
|
||||
name = re.sub('[ \t\n]', '', str(name)).lower()
|
||||
name = to_map_file_name(name)
|
||||
# For GemsFarming, auto choose events or main chapters
|
||||
if self.config.task.command == 'GemsFarming':
|
||||
|
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import re
|
||||
|
||||
from module.base.timer import Timer
|
||||
from module.base.utils import color_bar_percentage
|
||||
@ -51,7 +52,14 @@ def to_map_input_name(name: str) -> str:
|
||||
campaign_7_2 -> 7-2
|
||||
d3 -> D3
|
||||
"""
|
||||
name = name.upper()
|
||||
name = str(name).upper()
|
||||
# Remove whitespaces
|
||||
name = re.sub('[ \t\n]', '', name).lower()
|
||||
# B-1 -> B1
|
||||
res = re.match(r'([a-zA-Z])+[- ]+(\d+)', name)
|
||||
if res:
|
||||
name = f'{res.group(1)}{res.group(2)}'
|
||||
# campaign_7_2 -> 7-2
|
||||
name = name.replace('CAMPAIGN_', '').replace('_', '-')
|
||||
return name
|
||||
|
||||
@ -64,7 +72,14 @@ def to_map_file_name(name: str) -> str:
|
||||
campaign_7_2 -> campaign_7_2
|
||||
D3 -> d3
|
||||
"""
|
||||
name = name.lower()
|
||||
name = str(name).lower()
|
||||
# Remove whitespaces
|
||||
name = re.sub('[ \t\n]', '', name).lower()
|
||||
# B-1 -> B1
|
||||
res = re.match(r'([a-zA-Z])+[- ]+(\d+)', name)
|
||||
if res:
|
||||
name = f'{res.group(1)}{res.group(2)}'
|
||||
# 7-2 to campaign_7_2
|
||||
if name and name[0].isdigit():
|
||||
name = 'campaign_' + name.replace('-', '_')
|
||||
return name
|
||||
|
Loading…
Reference in New Issue
Block a user