Opt: Remove port; Add server prefix

This commit is contained in:
Horizon101011 2022-08-01 10:41:20 +08:00
parent 80488c9c71
commit 79ca99eccb
7 changed files with 174 additions and 172 deletions

View File

@ -7,6 +7,7 @@ from datetime import datetime, timedelta
import inflection
from cached_property import cached_property
from module.base.resource import del_cached_property
from module.config.config import AzurLaneConfig, TaskEnd
from module.config.config_updater import ConfigUpdater
from module.config.utils import deep_get, deep_set
@ -425,8 +426,7 @@ class AzurLaneAutoScript:
# Sometimes, config won't be updated due to blocking
# even though it has been changed
# So update it once recovered
if 'config' in self.__dict__:
del self.__dict__['config']
del_cached_property(self, 'config')
logger.info('Server or network is recovered. Restart game client')
self.run('restart')

View File

@ -286,7 +286,9 @@ class ConfigGenerator:
for server, _list in VALID_SERVER_LIST.items():
for index in range(len(_list)):
path = ['Emulator', 'ServerName', f'{server}-{index}']
deep_set(new, keys=path, value=_list[index])
prefix = server.split('_')[0].upper()
prefix = '国服' if prefix == 'CN' else prefix
deep_set(new, keys=path, value=f'[{prefix}] {_list[index]}')
# GUI i18n
for path, _ in deep_iter(self.gui, depth=2):
group, key = path

View File

@ -303,48 +303,48 @@
"name": "Server in Game Client",
"help": "Select the server where you are in the game to enable server status detection\nScript will hang up when server is being maintained or network is broken",
"disabled": "disabled",
"cn_android-0": "莱茵演习",
"cn_android-1": "巴巴罗萨",
"cn_android-2": "霸王行动",
"cn_android-3": "冰山行动",
"cn_android-4": "彩虹计划",
"cn_android-5": "发电机计划",
"cn_android-6": "瞭望台行动",
"cn_android-7": "十字路口行动",
"cn_android-8": "朱诺行动",
"cn_android-9": "杜立特空袭",
"cn_android-10": "地狱犬行动",
"cn_android-11": "开罗宣言",
"cn_android-12": "奥林匹克行动",
"cn_android-13": "小王冠行动",
"cn_android-14": "波茨坦公告",
"cn_android-15": "白色方案",
"cn_android-16": "瓦尔基里行动",
"cn_android-17": "曼哈顿计划",
"cn_android-18": "八月风暴",
"cn_android-19": "秋季旅行",
"cn_android-20": "水星行动",
"cn_android-21": "莱茵河卫兵",
"cn_ios-0": "夏威夷",
"cn_ios-1": "珊瑚海",
"cn_ios-2": "中途岛",
"cn_ios-3": "铁底湾",
"cn_ios-4": "所罗门",
"cn_ios-5": "马里亚纳",
"cn_ios-6": "莱特湾",
"cn_ios-7": "硫磺岛",
"cn_ios-8": "冲绳岛",
"cn_ios-9": "阿留申群岛",
"cn_ios-10": "马耳他",
"cn_channel-0": "皇家巡游",
"cn_channel-1": "大西洋宪章",
"cn_channel-2": "十字军行动",
"cn_channel-3": "龙骑兵行动",
"en-0": "Avrora",
"en-1": "Lexington",
"en-2": "Sandy",
"en-3": "Washington",
"en-4": "Amagi"
"cn_android-0": "[国服] 莱茵演习",
"cn_android-1": "[国服] 巴巴罗萨",
"cn_android-2": "[国服] 霸王行动",
"cn_android-3": "[国服] 冰山行动",
"cn_android-4": "[国服] 彩虹计划",
"cn_android-5": "[国服] 发电机计划",
"cn_android-6": "[国服] 瞭望台行动",
"cn_android-7": "[国服] 十字路口行动",
"cn_android-8": "[国服] 朱诺行动",
"cn_android-9": "[国服] 杜立特空袭",
"cn_android-10": "[国服] 地狱犬行动",
"cn_android-11": "[国服] 开罗宣言",
"cn_android-12": "[国服] 奥林匹克行动",
"cn_android-13": "[国服] 小王冠行动",
"cn_android-14": "[国服] 波茨坦公告",
"cn_android-15": "[国服] 白色方案",
"cn_android-16": "[国服] 瓦尔基里行动",
"cn_android-17": "[国服] 曼哈顿计划",
"cn_android-18": "[国服] 八月风暴",
"cn_android-19": "[国服] 秋季旅行",
"cn_android-20": "[国服] 水星行动",
"cn_android-21": "[国服] 莱茵河卫兵",
"cn_ios-0": "[国服] 夏威夷",
"cn_ios-1": "[国服] 珊瑚海",
"cn_ios-2": "[国服] 中途岛",
"cn_ios-3": "[国服] 铁底湾",
"cn_ios-4": "[国服] 所罗门",
"cn_ios-5": "[国服] 马里亚纳",
"cn_ios-6": "[国服] 莱特湾",
"cn_ios-7": "[国服] 硫磺岛",
"cn_ios-8": "[国服] 冲绳岛",
"cn_ios-9": "[国服] 阿留申群岛",
"cn_ios-10": "[国服] 马耳他",
"cn_channel-0": "[国服] 皇家巡游",
"cn_channel-1": "[国服] 大西洋宪章",
"cn_channel-2": "[国服] 十字军行动",
"cn_channel-3": "[国服] 龙骑兵行动",
"en-0": "[EN] Avrora",
"en-1": "[EN] Lexington",
"en-2": "[EN] Sandy",
"en-3": "[EN] Washington",
"en-4": "[EN] Amagi"
},
"ScreenshotMethod": {
"name": "Screenshot Method",

View File

@ -303,48 +303,48 @@
"name": "Emulator.ServerName.name",
"help": "Emulator.ServerName.help",
"disabled": "disabled",
"cn_android-0": "莱茵演习",
"cn_android-1": "巴巴罗萨",
"cn_android-2": "霸王行动",
"cn_android-3": "冰山行动",
"cn_android-4": "彩虹计划",
"cn_android-5": "发电机计划",
"cn_android-6": "瞭望台行动",
"cn_android-7": "十字路口行动",
"cn_android-8": "朱诺行动",
"cn_android-9": "杜立特空袭",
"cn_android-10": "地狱犬行动",
"cn_android-11": "开罗宣言",
"cn_android-12": "奥林匹克行动",
"cn_android-13": "小王冠行动",
"cn_android-14": "波茨坦公告",
"cn_android-15": "白色方案",
"cn_android-16": "瓦尔基里行动",
"cn_android-17": "曼哈顿计划",
"cn_android-18": "八月风暴",
"cn_android-19": "秋季旅行",
"cn_android-20": "水星行动",
"cn_android-21": "莱茵河卫兵",
"cn_ios-0": "夏威夷",
"cn_ios-1": "珊瑚海",
"cn_ios-2": "中途岛",
"cn_ios-3": "铁底湾",
"cn_ios-4": "所罗门",
"cn_ios-5": "马里亚纳",
"cn_ios-6": "莱特湾",
"cn_ios-7": "硫磺岛",
"cn_ios-8": "冲绳岛",
"cn_ios-9": "阿留申群岛",
"cn_ios-10": "马耳他",
"cn_channel-0": "皇家巡游",
"cn_channel-1": "大西洋宪章",
"cn_channel-2": "十字军行动",
"cn_channel-3": "龙骑兵行动",
"en-0": "Avrora",
"en-1": "Lexington",
"en-2": "Sandy",
"en-3": "Washington",
"en-4": "Amagi"
"cn_android-0": "[国服] 莱茵演习",
"cn_android-1": "[国服] 巴巴罗萨",
"cn_android-2": "[国服] 霸王行动",
"cn_android-3": "[国服] 冰山行动",
"cn_android-4": "[国服] 彩虹计划",
"cn_android-5": "[国服] 发电机计划",
"cn_android-6": "[国服] 瞭望台行动",
"cn_android-7": "[国服] 十字路口行动",
"cn_android-8": "[国服] 朱诺行动",
"cn_android-9": "[国服] 杜立特空袭",
"cn_android-10": "[国服] 地狱犬行动",
"cn_android-11": "[国服] 开罗宣言",
"cn_android-12": "[国服] 奥林匹克行动",
"cn_android-13": "[国服] 小王冠行动",
"cn_android-14": "[国服] 波茨坦公告",
"cn_android-15": "[国服] 白色方案",
"cn_android-16": "[国服] 瓦尔基里行动",
"cn_android-17": "[国服] 曼哈顿计划",
"cn_android-18": "[国服] 八月风暴",
"cn_android-19": "[国服] 秋季旅行",
"cn_android-20": "[国服] 水星行动",
"cn_android-21": "[国服] 莱茵河卫兵",
"cn_ios-0": "[国服] 夏威夷",
"cn_ios-1": "[国服] 珊瑚海",
"cn_ios-2": "[国服] 中途岛",
"cn_ios-3": "[国服] 铁底湾",
"cn_ios-4": "[国服] 所罗门",
"cn_ios-5": "[国服] 马里亚纳",
"cn_ios-6": "[国服] 莱特湾",
"cn_ios-7": "[国服] 硫磺岛",
"cn_ios-8": "[国服] 冲绳岛",
"cn_ios-9": "[国服] 阿留申群岛",
"cn_ios-10": "[国服] 马耳他",
"cn_channel-0": "[国服] 皇家巡游",
"cn_channel-1": "[国服] 大西洋宪章",
"cn_channel-2": "[国服] 十字军行动",
"cn_channel-3": "[国服] 龙骑兵行动",
"en-0": "[EN] Avrora",
"en-1": "[EN] Lexington",
"en-2": "[EN] Sandy",
"en-3": "[EN] Washington",
"en-4": "[EN] Amagi"
},
"ScreenshotMethod": {
"name": "Emulator.ScreenshotMethod.name",

View File

@ -303,48 +303,48 @@
"name": "游戏内服务器",
"help": "选择游戏内所在的服务器以启用服务器状态检测\n当服务器维护或网络不可用时挂起直到恢复",
"disabled": "disabled",
"cn_android-0": "莱茵演习",
"cn_android-1": "巴巴罗萨",
"cn_android-2": "霸王行动",
"cn_android-3": "冰山行动",
"cn_android-4": "彩虹计划",
"cn_android-5": "发电机计划",
"cn_android-6": "瞭望台行动",
"cn_android-7": "十字路口行动",
"cn_android-8": "朱诺行动",
"cn_android-9": "杜立特空袭",
"cn_android-10": "地狱犬行动",
"cn_android-11": "开罗宣言",
"cn_android-12": "奥林匹克行动",
"cn_android-13": "小王冠行动",
"cn_android-14": "波茨坦公告",
"cn_android-15": "白色方案",
"cn_android-16": "瓦尔基里行动",
"cn_android-17": "曼哈顿计划",
"cn_android-18": "八月风暴",
"cn_android-19": "秋季旅行",
"cn_android-20": "水星行动",
"cn_android-21": "莱茵河卫兵",
"cn_ios-0": "夏威夷",
"cn_ios-1": "珊瑚海",
"cn_ios-2": "中途岛",
"cn_ios-3": "铁底湾",
"cn_ios-4": "所罗门",
"cn_ios-5": "马里亚纳",
"cn_ios-6": "莱特湾",
"cn_ios-7": "硫磺岛",
"cn_ios-8": "冲绳岛",
"cn_ios-9": "阿留申群岛",
"cn_ios-10": "马耳他",
"cn_channel-0": "皇家巡游",
"cn_channel-1": "大西洋宪章",
"cn_channel-2": "十字军行动",
"cn_channel-3": "龙骑兵行动",
"en-0": "Avrora",
"en-1": "Lexington",
"en-2": "Sandy",
"en-3": "Washington",
"en-4": "Amagi"
"cn_android-0": "[国服] 莱茵演习",
"cn_android-1": "[国服] 巴巴罗萨",
"cn_android-2": "[国服] 霸王行动",
"cn_android-3": "[国服] 冰山行动",
"cn_android-4": "[国服] 彩虹计划",
"cn_android-5": "[国服] 发电机计划",
"cn_android-6": "[国服] 瞭望台行动",
"cn_android-7": "[国服] 十字路口行动",
"cn_android-8": "[国服] 朱诺行动",
"cn_android-9": "[国服] 杜立特空袭",
"cn_android-10": "[国服] 地狱犬行动",
"cn_android-11": "[国服] 开罗宣言",
"cn_android-12": "[国服] 奥林匹克行动",
"cn_android-13": "[国服] 小王冠行动",
"cn_android-14": "[国服] 波茨坦公告",
"cn_android-15": "[国服] 白色方案",
"cn_android-16": "[国服] 瓦尔基里行动",
"cn_android-17": "[国服] 曼哈顿计划",
"cn_android-18": "[国服] 八月风暴",
"cn_android-19": "[国服] 秋季旅行",
"cn_android-20": "[国服] 水星行动",
"cn_android-21": "[国服] 莱茵河卫兵",
"cn_ios-0": "[国服] 夏威夷",
"cn_ios-1": "[国服] 珊瑚海",
"cn_ios-2": "[国服] 中途岛",
"cn_ios-3": "[国服] 铁底湾",
"cn_ios-4": "[国服] 所罗门",
"cn_ios-5": "[国服] 马里亚纳",
"cn_ios-6": "[国服] 莱特湾",
"cn_ios-7": "[国服] 硫磺岛",
"cn_ios-8": "[国服] 冲绳岛",
"cn_ios-9": "[国服] 阿留申群岛",
"cn_ios-10": "[国服] 马耳他",
"cn_channel-0": "[国服] 皇家巡游",
"cn_channel-1": "[国服] 大西洋宪章",
"cn_channel-2": "[国服] 十字军行动",
"cn_channel-3": "[国服] 龙骑兵行动",
"en-0": "[EN] Avrora",
"en-1": "[EN] Lexington",
"en-2": "[EN] Sandy",
"en-3": "[EN] Washington",
"en-4": "[EN] Amagi"
},
"ScreenshotMethod": {
"name": "模拟器截图方案",

View File

@ -303,48 +303,48 @@
"name": "遊戲内伺服器",
"help": "選擇遊戲內所在的伺服器以啓用伺服器狀態檢測\n當伺服器維護或網路不可用時挂起直到恢複",
"disabled": "disabled",
"cn_android-0": "莱茵演习",
"cn_android-1": "巴巴罗萨",
"cn_android-2": "霸王行动",
"cn_android-3": "冰山行动",
"cn_android-4": "彩虹计划",
"cn_android-5": "发电机计划",
"cn_android-6": "瞭望台行动",
"cn_android-7": "十字路口行动",
"cn_android-8": "朱诺行动",
"cn_android-9": "杜立特空袭",
"cn_android-10": "地狱犬行动",
"cn_android-11": "开罗宣言",
"cn_android-12": "奥林匹克行动",
"cn_android-13": "小王冠行动",
"cn_android-14": "波茨坦公告",
"cn_android-15": "白色方案",
"cn_android-16": "瓦尔基里行动",
"cn_android-17": "曼哈顿计划",
"cn_android-18": "八月风暴",
"cn_android-19": "秋季旅行",
"cn_android-20": "水星行动",
"cn_android-21": "莱茵河卫兵",
"cn_ios-0": "夏威夷",
"cn_ios-1": "珊瑚海",
"cn_ios-2": "中途岛",
"cn_ios-3": "铁底湾",
"cn_ios-4": "所罗门",
"cn_ios-5": "马里亚纳",
"cn_ios-6": "莱特湾",
"cn_ios-7": "硫磺岛",
"cn_ios-8": "冲绳岛",
"cn_ios-9": "阿留申群岛",
"cn_ios-10": "马耳他",
"cn_channel-0": "皇家巡游",
"cn_channel-1": "大西洋宪章",
"cn_channel-2": "十字军行动",
"cn_channel-3": "龙骑兵行动",
"en-0": "Avrora",
"en-1": "Lexington",
"en-2": "Sandy",
"en-3": "Washington",
"en-4": "Amagi"
"cn_android-0": "[国服] 莱茵演习",
"cn_android-1": "[国服] 巴巴罗萨",
"cn_android-2": "[国服] 霸王行动",
"cn_android-3": "[国服] 冰山行动",
"cn_android-4": "[国服] 彩虹计划",
"cn_android-5": "[国服] 发电机计划",
"cn_android-6": "[国服] 瞭望台行动",
"cn_android-7": "[国服] 十字路口行动",
"cn_android-8": "[国服] 朱诺行动",
"cn_android-9": "[国服] 杜立特空袭",
"cn_android-10": "[国服] 地狱犬行动",
"cn_android-11": "[国服] 开罗宣言",
"cn_android-12": "[国服] 奥林匹克行动",
"cn_android-13": "[国服] 小王冠行动",
"cn_android-14": "[国服] 波茨坦公告",
"cn_android-15": "[国服] 白色方案",
"cn_android-16": "[国服] 瓦尔基里行动",
"cn_android-17": "[国服] 曼哈顿计划",
"cn_android-18": "[国服] 八月风暴",
"cn_android-19": "[国服] 秋季旅行",
"cn_android-20": "[国服] 水星行动",
"cn_android-21": "[国服] 莱茵河卫兵",
"cn_ios-0": "[国服] 夏威夷",
"cn_ios-1": "[国服] 珊瑚海",
"cn_ios-2": "[国服] 中途岛",
"cn_ios-3": "[国服] 铁底湾",
"cn_ios-4": "[国服] 所罗门",
"cn_ios-5": "[国服] 马里亚纳",
"cn_ios-6": "[国服] 莱特湾",
"cn_ios-7": "[国服] 硫磺岛",
"cn_ios-8": "[国服] 冲绳岛",
"cn_ios-9": "[国服] 阿留申群岛",
"cn_ios-10": "[国服] 马耳他",
"cn_channel-0": "[国服] 皇家巡游",
"cn_channel-1": "[国服] 大西洋宪章",
"cn_channel-2": "[国服] 十字军行动",
"cn_channel-3": "[国服] 龙骑兵行动",
"en-0": "[EN] Avrora",
"en-1": "[EN] Lexington",
"en-2": "[EN] Sandy",
"en-3": "[EN] Washington",
"en-4": "[EN] Amagi"
},
"ServerPlatform": {
"name": "伺服器平台",

View File

@ -11,7 +11,7 @@ from module.logger import logger
class ServerChecker:
def __init__(self, server: str) -> None:
self._base: str = 'http://sc.shiratama.cn:20002'
self._base: str = 'http://sc.shiratama.cn'
self._api: dict = {
'get_state': '/server/get_state', # post
'get_all_state': '/server/get_all_state', # post