Add: Cloud settings

This commit is contained in:
LmeSzinc 2024-01-14 23:56:06 +08:00
parent 4cd0b85539
commit 5b7b226066
16 changed files with 246 additions and 7 deletions

View File

@ -2,6 +2,7 @@
"Alas": {
"Emulator": {
"Serial": "auto",
"GameClient": "android",
"PackageName": "auto",
"GameLanguage": "auto",
"ScreenshotMethod": "scrcpy",
@ -23,6 +24,11 @@
"ScreenshotInterval": 0.2,
"CombatScreenshotInterval": 1.0,
"WhenTaskQueueEmpty": "goto_main"
},
"CloudStorage": {
"CloudRemainSeasonPass": {},
"CloudRemainPaid": {},
"CloudRemainFree": {}
}
},
"Restart": {

View File

@ -6,6 +6,14 @@
"value": "auto",
"valuetype": "str"
},
"GameClient": {
"type": "select",
"value": "android",
"option": [
"android",
"cloud_android"
]
},
"PackageName": {
"type": "select",
"value": "auto",
@ -131,6 +139,26 @@
"close_game"
]
}
},
"CloudStorage": {
"CloudRemainSeasonPass": {
"type": "stored",
"value": {},
"display": "hide",
"stored": "StoredInt"
},
"CloudRemainPaid": {
"type": "stored",
"value": {},
"display": "hide",
"stored": "StoredInt"
},
"CloudRemainFree": {
"type": "stored",
"value": {},
"display": "hide",
"stored": "StoredInt"
}
}
},
"Restart": {

View File

@ -18,6 +18,9 @@ Emulator:
Serial:
value: auto
valuetype: str
GameClient:
value: android
option: [ android, cloud_android ]
PackageName:
value: auto
option: [ auto, ]
@ -72,6 +75,13 @@ Optimization:
WhenTaskQueueEmpty:
value: goto_main
option: [ stay_there, goto_main, close_game ]
CloudStorage:
CloudRemainSeasonPass:
stored: StoredInt
CloudRemainPaid:
stored: StoredInt
CloudRemainFree:
stored: StoredInt
# ==================== Daily ====================

View File

@ -101,6 +101,42 @@
"order": 8,
"color": "#fc8f8b"
},
"CloudRemainSeasonPass": {
"name": "CloudRemainSeasonPass",
"path": "Alas.CloudStorage.CloudRemainSeasonPass",
"i18n": "CloudStorage.CloudRemainSeasonPass.name",
"stored": "StoredInt",
"attrs": {
"time": "2020-01-01 00:00:00",
"value": 0
},
"order": 0,
"color": "#777777"
},
"CloudRemainPaid": {
"name": "CloudRemainPaid",
"path": "Alas.CloudStorage.CloudRemainPaid",
"i18n": "CloudStorage.CloudRemainPaid.name",
"stored": "StoredInt",
"attrs": {
"time": "2020-01-01 00:00:00",
"value": 0
},
"order": 0,
"color": "#777777"
},
"CloudRemainFree": {
"name": "CloudRemainFree",
"path": "Alas.CloudStorage.CloudRemainFree",
"i18n": "CloudStorage.CloudRemainFree.name",
"stored": "StoredInt",
"attrs": {
"time": "2020-01-01 00:00:00",
"value": 0
},
"order": 0,
"color": "#777777"
},
"Immersifier": {
"name": "Immersifier",
"path": "Dungeon.DungeonStorage.Immersifier",

View File

@ -13,6 +13,7 @@ Alas:
- EmulatorInfo
- Error
- Optimization
- CloudStorage
Restart:
- Scheduler

View File

@ -176,6 +176,12 @@ class AzurLaneConfig(ConfigUpdater, ManualConfig, GeneratedConfig, ConfigWatcher
self.data, keys="Alas.Optimization.CloseGameDuringWait", default=False
)
@property
def is_cloud_game(self):
return deep_get(
self.data, keys="Alas.Emulator.GameClient"
) == 'cloud_android'
@cached_property
def stored(self) -> StoredGenerated:
stored = StoredGenerated()

View File

@ -17,6 +17,7 @@ class GeneratedConfig:
# Group `Emulator`
Emulator_Serial = 'auto'
Emulator_GameClient = 'android' # android, cloud_android
Emulator_PackageName = 'auto' # auto, CN-Official, CN-Bilibili, OVERSEA-America, OVERSEA-Asia, OVERSEA-Europe, OVERSEA-TWHKMO
Emulator_GameLanguage = 'auto' # auto, cn, en
Emulator_ScreenshotMethod = 'auto' # auto, ADB, ADB_nc, uiautomator2, aScreenCap, aScreenCap_nc, DroidCast, DroidCast_raw, scrcpy
@ -39,6 +40,11 @@ class GeneratedConfig:
Optimization_CombatScreenshotInterval = 1.0
Optimization_WhenTaskQueueEmpty = 'goto_main' # stay_there, goto_main, close_game
# Group `CloudStorage`
CloudStorage_CloudRemainSeasonPass = {}
CloudStorage_CloudRemainPaid = {}
CloudStorage_CloudRemainFree = {}
# Group `Dungeon`
Dungeon_Name = 'Calyx_Golden_Treasures' # Calyx_Golden_Memories, Calyx_Golden_Aether, Calyx_Golden_Treasures, Calyx_Crimson_Destruction, Calyx_Crimson_Preservation, Calyx_Crimson_The_Hunt, Calyx_Crimson_Abundance, Calyx_Crimson_Erudition, Calyx_Crimson_Harmony, Calyx_Crimson_Nihility, Stagnant_Shadow_Quanta, Stagnant_Shadow_Gust, Stagnant_Shadow_Fulmination, Stagnant_Shadow_Blaze, Stagnant_Shadow_Spike, Stagnant_Shadow_Rime, Stagnant_Shadow_Mirage, Stagnant_Shadow_Icicle, Stagnant_Shadow_Doom, Stagnant_Shadow_Puppetry, Stagnant_Shadow_Abomination, Stagnant_Shadow_Scorch, Stagnant_Shadow_Celestial, Stagnant_Shadow_Perdition, Cavern_of_Corrosion_Path_of_Gelid_Wind, Cavern_of_Corrosion_Path_of_Jabbing_Punch, Cavern_of_Corrosion_Path_of_Drifting, Cavern_of_Corrosion_Path_of_Providence, Cavern_of_Corrosion_Path_of_Holy_Hymn, Cavern_of_Corrosion_Path_of_Conflagration, Cavern_of_Corrosion_Path_of_Elixir_Seekers, Cavern_of_Corrosion_Path_of_Darkness
Dungeon_NameAtDoubleCalyx = 'Calyx_Golden_Treasures' # do_not_participate, Calyx_Golden_Memories, Calyx_Golden_Aether, Calyx_Golden_Treasures, Calyx_Crimson_Destruction, Calyx_Crimson_Preservation, Calyx_Crimson_The_Hunt, Calyx_Crimson_Abundance, Calyx_Crimson_Erudition, Calyx_Crimson_Harmony, Calyx_Crimson_Nihility

View File

@ -726,6 +726,9 @@ class ConfigUpdater:
# Store immersifier in dungeon task
if deep_get(data, keys='Rogue.RogueWorld.UseImmersifier') is True:
deep_set(data, keys='Dungeon.Scheduler.Enable', value=True)
# Cloud settings
if deep_get(data, keys='Alas.Emulator.GameClient') == 'cloud_android':
deep_set(data, keys='Alas.Emulator.PackageName', value='CN-Official')
return data
@ -773,6 +776,8 @@ class ConfigUpdater:
yield 'Rogue.RogueWorld.UseImmersifier', True
elif key == 'Rogue.RogueWorld.DoubleEvent' and value is True:
yield 'Rogue.RogueWorld.UseImmersifier', True
elif key == 'Alas.Emulator.GameClient' and value == 'cloud_android':
yield 'Alas.Emulator.PackageName', 'CN-Official'
def iter_hidden_args(self, data) -> t.Iterator[str]:
"""

View File

@ -96,6 +96,12 @@
"name": "Serial",
"help": "Common emulator Serial can be queried in the list below\nUse \"auto\" to auto-detect emulators, but if multiple emulators are running or use emulators that do not support auto-detect, \"auto\" cannot be used and serial must be filled in manually\nDefault serial for select emulators:\n- BlueStacks 127.0.0.1:5555\n- BlueStacks4 Hyper-V use \"bluestacks4-hyperv\", \"bluestacks4-hyperv-2\" for multi instance, and so on\n- BlueStacks5 Hyper-V use \"bluestacks5-hyperv\", \"bluestacks5-hyperv-1\" for multi instance, and so on\n- NoxPlayer 127.0.0.1:62001\n- NoxPlayer64bit 127.0.0.1:59865\n- MuMuPlayer/MuMuPlayer X 127.0.0.1:7555\n- MuMuPlayer12 127.0.0.1:16384\n- MemuPlayer 127.0.0.1:21503\n- LDPlayer emulator-5554 or 127.0.0.1:5555\n- WSA use \"wsa-0\" to make the game run in the background, which needs to be controlled or closed by third-party software\nIf there are multiple emulator instances running, the default is reserved for one of them and the others will use different serials to avoid conflicts\nOpen console.bat and run `adb devices` to find them or follow the emulator's official tutorial"
},
"GameClient": {
"name": "Game Client",
"help": "When using cloud, you will be automatically queued to log in. Cloud game is available in CN only",
"android": "Android client",
"cloud_android": "Cloud game android client"
},
"PackageName": {
"name": "Game Server",
"help": "Can't distinguish different regions of oversea servers, please select the server manually.",
@ -215,6 +221,24 @@
"close_game": "Close Game"
}
},
"CloudStorage": {
"_info": {
"name": "CloudStorage._info.name",
"help": "CloudStorage._info.help"
},
"CloudRemainSeasonPass": {
"name": "CloudStorage.CloudRemainSeasonPass.name",
"help": "CloudStorage.CloudRemainSeasonPass.help"
},
"CloudRemainPaid": {
"name": "CloudStorage.CloudRemainPaid.name",
"help": "CloudStorage.CloudRemainPaid.help"
},
"CloudRemainFree": {
"name": "CloudStorage.CloudRemainFree.name",
"help": "CloudStorage.CloudRemainFree.help"
}
},
"Dungeon": {
"_info": {
"name": "Dungeon Settings",

View File

@ -96,6 +96,12 @@
"name": "Serial",
"help": "Los serial de emuladores comunes pueden ser consultados aquí:\nUsa \"auto\" para detectar automáticamente el emulador, pero si hay varios ejecutando a la vez o no se puede detectar de forma automática, \"auto\" no podrá ser usado y tendrás que ajustarlo manualmente.\nSerial comunes de algunos emuladores:\n- BlueStacks 127.0.0.1:5555\n- BlueStacks4 Hyper-V usa \"bluestacks4-hyperv\", \"bluestacks4-hyperv-2\" para multi-instancia, etc...\n- BlueStacks5 Hyper-V usa \"bluestacks5-hyperv\", \"bluestacks5-hyperv-1\" para multi-instancia, etc...\n- NoxPlayer 127.0.0.1:62001\n- NoxPlayer64bit 127.0.0.1:59865\n- MuMuPlayer/MuMuPlayer X 127.0.0.1:7555\n- MuMuPlayer12 127.0.0.1:16384\n- MemuPlayer 127.0.0.1:21503\n- LDPlayer emulator-5554 or 127.0.0.1:5555\n- WSA usa \"wsa-0\" para ejecutar el juego en segundo plano, que será cerrado/controlado por software externo.\nSi hay varias instancias ejecutándose a la vez, se usará la predeterminada para la primera y las demás se reajustarán.\nAbre console.bat y ejecuta `adb devices` para encontrarlas o usa la guía oficial del emulador."
},
"GameClient": {
"name": "Cliente del juego",
"help": "Al usar la nube, automáticamente se pondrá en cola para iniciar sesión. El juego en la nube está disponible solo en CN",
"android": "Cliente Android",
"cloud_android": "Cliente de juego en la nube para Android"
},
"PackageName": {
"name": "Región del juego",
"help": "No es posible detectar regiones que no sean de China, por tanto, ajústalo manualmente si se da la situación.",
@ -215,6 +221,24 @@
"close_game": "Cerrar el juego"
}
},
"CloudStorage": {
"_info": {
"name": "CloudStorage._info.name",
"help": "CloudStorage._info.help"
},
"CloudRemainSeasonPass": {
"name": "CloudStorage.CloudRemainSeasonPass.name",
"help": "CloudStorage.CloudRemainSeasonPass.help"
},
"CloudRemainPaid": {
"name": "CloudStorage.CloudRemainPaid.name",
"help": "CloudStorage.CloudRemainPaid.help"
},
"CloudRemainFree": {
"name": "CloudStorage.CloudRemainFree.name",
"help": "CloudStorage.CloudRemainFree.help"
}
},
"Dungeon": {
"_info": {
"name": "Ajustes de Mazmorra",

View File

@ -96,6 +96,12 @@
"name": "Emulator.Serial.name",
"help": "Emulator.Serial.help"
},
"GameClient": {
"name": "Emulator.GameClient.name",
"help": "Emulator.GameClient.help",
"android": "android",
"cloud_android": "cloud_android"
},
"PackageName": {
"name": "Emulator.PackageName.name",
"help": "Emulator.PackageName.help",
@ -215,6 +221,24 @@
"close_game": "close_game"
}
},
"CloudStorage": {
"_info": {
"name": "CloudStorage._info.name",
"help": "CloudStorage._info.help"
},
"CloudRemainSeasonPass": {
"name": "CloudStorage.CloudRemainSeasonPass.name",
"help": "CloudStorage.CloudRemainSeasonPass.help"
},
"CloudRemainPaid": {
"name": "CloudStorage.CloudRemainPaid.name",
"help": "CloudStorage.CloudRemainPaid.help"
},
"CloudRemainFree": {
"name": "CloudStorage.CloudRemainFree.name",
"help": "CloudStorage.CloudRemainFree.help"
}
},
"Dungeon": {
"_info": {
"name": "Dungeon._info.name",

View File

@ -96,6 +96,12 @@
"name": "模拟器 Serial",
"help": "常见的模拟器 Serial 可以查询下方列表\n填 \"auto\" 自动检测模拟器,多个模拟器正在运行或使用不支持自动检测的模拟器时无法使用 \"auto\",必须手动填写\n\n模拟器默认 Serial\n- 蓝叠模拟器 127.0.0.1:5555\n- 蓝叠模拟器4 Hyper-v版填\"bluestacks4-hyperv\"自动连接,多开填\"bluestacks4-hyperv-2\"以此类推\n- 蓝叠模拟器5 Hyper-v版填\"bluestacks5-hyperv\"自动连接,多开填\"bluestacks5-hyperv-1\"以此类推\n- 夜神模拟器 127.0.0.1:62001\n- 夜神模拟器64位 127.0.0.1:59865\n- MuMu模拟器/MuMu模拟器X 127.0.0.1:7555\n- MuMu模拟器12 127.0.0.1:16384\n- 逍遥模拟器 127.0.0.1:21503\n- 雷电模拟器 emulator-5554 或 127.0.0.1:5555\n- WSA填\"wsa-0\"使游戏在后台运行需要使用第三方软件操控或关闭建议使用scrcpy操控\n如果你使用了模拟器的多开功能它们的 Serial 将不是默认的,可以在 console.bat 中执行 `adb devices` 查询,或根据模拟器官方的教程填写"
},
"GameClient": {
"name": "游戏客户端",
"help": "选择云游戏时,将自动排队登录,云游戏目前仅有国服",
"android": "安卓端",
"cloud_android": "云游戏安卓端"
},
"PackageName": {
"name": "游戏服务器",
"help": "无法区分国际服的不同地区,请手动选择服务器",
@ -215,6 +221,24 @@
"close_game": "关闭游戏"
}
},
"CloudStorage": {
"_info": {
"name": "",
"help": ""
},
"CloudRemainSeasonPass": {
"name": "畅玩卡剩余 X 天",
"help": ""
},
"CloudRemainPaid": {
"name": "星云币剩余 X 分钟",
"help": ""
},
"CloudRemainFree": {
"name": "免费时长剩余 X 分钟",
"help": ""
}
},
"Dungeon": {
"_info": {
"name": "每日副本设置",

View File

@ -96,6 +96,12 @@
"name": "模擬器 Serial",
"help": "常見的模擬器 Serial 可以查詢下方列表\n填 \"auto\" 自動檢測模擬器,多個模擬器正在運行或使用不支援自動檢測的模擬器時無法使用 \"auto\",必須手動填寫\n模擬器預設 Serial\n- 藍疊模擬器 127.0.0.1:5555\n- 藍疊模擬器4 Hyper-v版填\"bluestacks4-hyperv\"自動連接,多開填\"bluestacks4-hyperv-2\"以此類推\n- 藍疊模擬器5 Hyper-v版填\"bluestacks5-hyperv\"自動連接,多開填\"bluestacks5-hyperv-1\"以此類推\n- 夜神模擬器 127.0.0.1:62001\n- 夜神模擬器64位元 127.0.0.1:59865\n- MuMu模擬器/MuMu模擬器X 127.0.0.1:7555\n- MuMu模擬器12 127.0.0.1:16384\n- 逍遙模擬器 127.0.0.1:21503\n- 雷電模擬器 emulator-5554 或 127.0.0.1:5555\n- WSA填\"wsa-0\"使遊戲在後臺運行,需要使用第三方軟件操控或關閉\n如果你使用了模擬器的多開功能他們的 Serial 將不是預設的,可以在 console.bat 中執行 `adb devices` 查詢,或根據模擬器官方的教程填寫"
},
"GameClient": {
"name": "遊戲客戶端",
"help": "選擇雲端遊戲時,將自動排隊登入,雲端遊戲目前僅有國服",
"android": "安卓端",
"cloud_android": "雲端遊戲安卓端"
},
"PackageName": {
"name": "遊戲伺服器",
"help": "無法區分國際服的不同地區,請手動選擇伺服器",
@ -215,6 +221,24 @@
"close_game": "關閉遊戲"
}
},
"CloudStorage": {
"_info": {
"name": "CloudStorage._info.name",
"help": "CloudStorage._info.help"
},
"CloudRemainSeasonPass": {
"name": "CloudStorage.CloudRemainSeasonPass.name",
"help": "CloudStorage.CloudRemainSeasonPass.help"
},
"CloudRemainPaid": {
"name": "CloudStorage.CloudRemainPaid.name",
"help": "CloudStorage.CloudRemainPaid.help"
},
"CloudRemainFree": {
"name": "CloudStorage.CloudRemainFree.name",
"help": "CloudStorage.CloudRemainFree.help"
}
},
"Dungeon": {
"_info": {
"name": "每日副本設定",

View File

@ -15,6 +15,10 @@ VALID_SERVER = {
'OVERSEA-TWHKMO': 'com.HoYoverse.hkrpgoversea',
}
VALID_PACKAGE = set(list(VALID_SERVER.values()))
VALID_CLOUD_SERVER = {
'CN-Official': 'com.miHoYo.cloudgames.hkrpg',
}
VALID_CLOUD_PACKAGE = set(list(VALID_SERVER.values()))
def set_lang(lang_: str):
@ -47,18 +51,30 @@ def to_server(package_or_server: str) -> str:
return key
if key == package_or_server:
return key
for key, value in VALID_CLOUD_SERVER.items():
if value == package_or_server:
return key
if key == package_or_server:
return key
raise ValueError(f'Package invalid: {package_or_server}')
def to_package(package_or_server: str) -> str:
def to_package(package_or_server: str, is_cloud=False) -> str:
"""
Convert package/server to package.
"""
for key, value in VALID_SERVER.items():
if value == package_or_server:
return value
if key == package_or_server:
return value
if is_cloud:
for key, value in VALID_CLOUD_SERVER.items():
if value == package_or_server:
return value
if key == package_or_server:
return value
else:
for key, value in VALID_SERVER.items():
if value == package_or_server:
return value
if key == package_or_server:
return value
raise ValueError(f'Server invalid: {package_or_server}')

View File

@ -28,6 +28,9 @@ from module.config.stored.classes import (
# ``` python -m module/config/config_updater.py ```
class StoredGenerated:
CloudRemainSeasonPass = StoredInt("Alas.CloudStorage.CloudRemainSeasonPass")
CloudRemainPaid = StoredInt("Alas.CloudStorage.CloudRemainPaid")
CloudRemainFree = StoredInt("Alas.CloudStorage.CloudRemainFree")
TrailblazePower = StoredTrailblazePower("Dungeon.DungeonStorage.TrailblazePower")
Immersifier = StoredImmersifier("Dungeon.DungeonStorage.Immersifier")
DungeonDouble = StoredDungeonDouble("Dungeon.DungeonStorage.DungeonDouble")

View File

@ -100,7 +100,9 @@ class Connection(ConnectionAttr):
logger.attr('AdbDevice', self.adb)
# Package
if self.config.Emulator_PackageName == 'auto':
if self.config.is_cloud_game:
self.package = server_.to_package(self.config.Emulator_PackageName, is_cloud=True)
elif self.config.Emulator_PackageName == 'auto':
self.detect_package()
else:
self.package = server_.to_package(self.config.Emulator_PackageName)