From 736333d23d357fce10aceed896c799fe3ccb858b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Mon, 12 Oct 2026 15:24:38 +0500 Subject: [PATCH] Complete module controls and distinguish graceful server exits from crashes --- changelog.d/20261012-graceful-shutdown.md | 7 +++ changelog.d/20261012-module-options.md | 7 +++ changelog.d/20261012-scaling-options.md | 7 +++ crates/coa-core/src/custom_races.rs | 41 +++++++++++- crates/coa-core/src/modules.rs | 77 ++++++++++++++++++++--- crates/coa-core/src/process.rs | 41 +++++++++++- modules/catalog.json | 36 +++++++++++ src/lib/moduleSettings.ts | 10 ++- src/screens/ModulesPage.tsx | 3 +- src/screens/Overview.tsx | 1 + 10 files changed, 217 insertions(+), 13 deletions(-) create mode 100644 changelog.d/20261012-graceful-shutdown.md create mode 100644 changelog.d/20261012-module-options.md create mode 100644 changelog.d/20261012-scaling-options.md diff --git a/changelog.d/20261012-graceful-shutdown.md b/changelog.d/20261012-graceful-shutdown.md new file mode 100644 index 0000000..0d6f96c --- /dev/null +++ b/changelog.d/20261012-graceful-shutdown.md @@ -0,0 +1,7 @@ +--- +area: manager +type: fixed +audience: admins +title: Graceful server shutdowns no longer trigger crash recovery +--- +Automatic crash recovery requires a confirmed abnormal exit. Normal shutdowns and scheduled restarts are not counted as crashes. diff --git a/changelog.d/20261012-module-options.md b/changelog.d/20261012-module-options.md new file mode 100644 index 0000000..ab67330 --- /dev/null +++ b/changelog.d/20261012-module-options.md @@ -0,0 +1,7 @@ +--- +area: manager +type: added +audience: admins +title: Configure individual races, classic classes and the visual day and night cycle +--- +Modules now offers a custom race ID list, an independent classic class switch and TimeIsTime clock settings when supported by the installed server. diff --git a/changelog.d/20261012-scaling-options.md b/changelog.d/20261012-scaling-options.md new file mode 100644 index 0000000..7b80253 --- /dev/null +++ b/changelog.d/20261012-scaling-options.md @@ -0,0 +1,7 @@ +--- +area: manager +type: added +audience: admins +title: Select parallel or global scaling and remove item class requirements +--- +The scaling settings now offer the parallel and global progression modes and a switch for class-restricted equipment, including tier sets. diff --git a/crates/coa-core/src/custom_races.rs b/crates/coa-core/src/custom_races.rs index 915c5f3..2cedb8f 100644 --- a/crates/coa-core/src/custom_races.rs +++ b/crates/coa-core/src/custom_races.rs @@ -92,8 +92,15 @@ pub fn playerbots_conf_paths(root: &Path) -> Vec { } /// Checks whether playerbots are configured to allow custom races. -/// Returns true if AiPlayerbot.ExcludedBotRaces exists and does not exclude general custom races. +/// Prefers the module preference; older installations fall back to the bot exclusions. pub fn is_bot_custom_races_allowed(root: &Path) -> Option { + if let Ok(bytes) = fs::read(root.join("Core/configs/modules/coa_custom_races.conf")) { + if let Ok(conf) = crate::config::parser::ConfFile::parse_bytes(&bytes) { + if let Some(value) = conf.get("CoACustomRaces.BotsEnable") { + return Some(matches!(value.trim().trim_matches('"').to_ascii_lowercase().as_str(), "1" | "true" | "yes" | "on")); + } + } + } for path in playerbots_conf_paths(root) { if let Ok(bytes) = fs::read(&path) { if let Ok(conf) = crate::config::parser::ConfFile::parse_bytes(&bytes) { @@ -114,6 +121,11 @@ pub fn sync_bot_races_config(root: &Path, allow_custom_races: bool) -> Result<() } else { EXCLUDED_BOT_RACES_RECOMMENDED }; + let enabled = fs::read(root.join("Core/configs/modules/coa_custom_races.conf")).ok() + .and_then(|bytes| crate::config::parser::ConfFile::parse_bytes(&bytes).ok()) + .and_then(|conf| conf.get("CoACustomRaces.EnabledRaces").map(str::to_string)) + .unwrap_or_else(|| "*".into()); + let excluded = excluded_for_selection(excluded, if allow_custom_races { &enabled } else { "" }); for path in playerbots_conf_paths(root) { if let Ok(bytes) = fs::read(&path) { if let Ok(mut conf) = crate::config::parser::ConfFile::parse_bytes(&bytes) { @@ -133,6 +145,18 @@ pub fn sync_bot_races_config(root: &Path, allow_custom_races: bool) -> Result<() Ok(()) } +fn excluded_for_selection(base: &str, enabled: &str) -> String { + let selected = enabled.trim().trim_matches('"'); + if selected == "*" { return base.to_string(); } + let allowed: std::collections::BTreeSet = selected.split(',').filter_map(|id| id.trim().parse().ok()).collect(); + let mut excluded: std::collections::BTreeSet = base.split(',').filter_map(|id| id.parse().ok()).collect(); + for race in 1..=255u8 { + let stock = race <= 11 && race != 9; + if !stock && !allowed.contains(&race) { excluded.insert(race); } + } + excluded.into_iter().map(|id| id.to_string()).collect::>().join(",") +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub enum ClientPatchState { @@ -531,6 +555,21 @@ pub fn install_client_patches( mod tests { use super::*; + #[test] + fn bot_race_selection_preserves_stability_exclusions_and_stock_races() { + let excluded = excluded_for_selection(EXCLUDED_BOT_RACES_EXPERIMENTAL, "12,19"); + let ids: std::collections::BTreeSet = excluded.split(',').map(|id| id.parse().unwrap()).collect(); + assert!(!ids.contains(&12)); + assert!(ids.contains(&19)); + assert!(ids.contains(&14) && ids.contains(&128)); + assert!(!ids.contains(&1) && !ids.contains(&11)); + assert_eq!(excluded_for_selection(EXCLUDED_BOT_RACES_EXPERIMENTAL, "*"), EXCLUDED_BOT_RACES_EXPERIMENTAL); + let off = excluded_for_selection(EXCLUDED_BOT_RACES_RECOMMENDED, ""); + let off: std::collections::BTreeSet = off.split(',').map(|id| id.parse().unwrap()).collect(); + assert!(off.contains(&12) && off.contains(&255)); + assert!(!off.contains(&1) && !off.contains(&11)); + } + #[test] fn disabling_restores_original_client_files_and_enabling_restores_custom_files() { let temp = tempfile::tempdir().unwrap(); diff --git a/crates/coa-core/src/modules.rs b/crates/coa-core/src/modules.rs index b6d0bdd..225c0c9 100644 --- a/crates/coa-core/src/modules.rs +++ b/crates/coa-core/src/modules.rs @@ -127,7 +127,8 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec { let name = conf_name(root, &e); let conf = dir(root).join(&name); let dist = dir(root).join(format!("{name}.dist")); - let installed = conf.is_file() || dist.is_file(); + let installed = (conf.is_file() || dist.is_file()) && (e.id != "vanilla-classes" + || [&conf, &dist].iter().filter_map(|path| read(path)).any(|file| file.get(&e.enable_key).is_some())); let has_settings = installed && settings_in(cat, root, &e.id) .map(|settings| settings.iter().any(|s| s.key != e.enable_key)) .unwrap_or(false); @@ -252,6 +253,9 @@ fn set_enabled_in(cat: &[Entry], root: &Path, meta: &Path, id: &str, on: bool) - if !e.switchable || e.enable_key.is_empty() { return Err(Error::Invalid("This part cannot be switched off.".into())); } + if id == "vanilla-classes" && !list_in(cat, root).iter().any(|module| module.id == id && module.installed) { + return Err(Error::Invalid("Update the server to enable classic classes independently.".into())); + } if on && matches!(id, "companions" | "playerbots") { let other = if id == "companions" { "playerbots" } else { "companions" }; if let Some(other) = cat.iter().find(|e| e.id == other) { @@ -288,6 +292,7 @@ pub fn settings(root: &Path, id: &str) -> Result> { fn settings_in(cat: &[Entry], root: &Path, id: &str) -> Result> { let e = entry_in(cat, id)?; let name = conf_name(root, &e); + if id == "vanilla-classes" { return Ok(Vec::new()); } let conf = dir(root).join(&name); let dist = read(&dir(root).join(format!("{name}.dist"))); let active = read(&conf).or_else(|| dist.clone()).ok_or_else(|| Error::Invalid("This module is not part of this server.".into()))?; @@ -341,6 +346,28 @@ fn save_settings_in(cat: &[Entry], root: &Path, meta: &Path, id: &str, changes: for (key, value) in changes { let value = value.trim(); if let Some(field) = fields.get(key) { crate::squid::validate(field, value)?; } + if key == "CoACustomRaces.EnabledRaces" { + let selected = value.trim().trim_matches('"'); + if selected != "*" && !selected.is_empty() && selected.split(',').any(|id| { + id.parse::().map_or(true, |race| race == 0) + }) { + return Err(Error::Invalid("Race IDs must be comma-separated numbers from 1 to 255, or *.".into())); + } + } + if id == "time-is-time" { + let bounds = match key.as_str() { + "TimeIsTime.SpeedRate" => Some((0.01, 60.0)), + "TimeIsTime.HourOffset" => Some((-24.0, 24.0)), + "TimeIsTime.TimeStart" => Some((0.0, 2147483647.0)), + _ => None, + }; + if let Some((min, max)) = bounds { + let number = value.parse::().map_err(|_| Error::Invalid(format!("{key} must be a number.")))?; + if !number.is_finite() || number < min || number > max || (key == "TimeIsTime.TimeStart" && number.fract() != 0.0) { + return Err(Error::Invalid(format!("{key} must be between {min} and {max}."))); + } + } + } if e.switchable && key == &e.enable_key { return Err(Error::Invalid("Use the module switch to turn this module on or off.".into())); } @@ -369,19 +396,13 @@ fn save_settings_in(cat: &[Entry], root: &Path, meta: &Path, id: &str, changes: return Err(Error::Invalid(format!("{key} is not a setting of this module."))); } let documented_empty = dist.as_ref().and_then(|d| d.get(key)).map(str::trim) == Some(""); - if (value.is_empty() && !documented_empty) || value.len() > 500 || value.chars().any(char::is_control) { + if (value.is_empty() && !documented_empty && key != "CoACustomRaces.EnabledRaces") || value.len() > 500 || value.chars().any(char::is_control) { return Err(Error::Invalid(format!("The value of {key} must be one line of text."))); } if file.get(key).map(str::trim) != Some(value) { changed.push((key.clone(), value.to_string())); } } - if id == "custom-races" { - if let Some(bots_enable) = changes.get("CoACustomRaces.BotsEnable") { - let allow = truthy(bots_enable); - crate::custom_races::sync_bot_races_config(root, allow)?; - } - } if changed.is_empty() { return Ok(Vec::new()); } @@ -390,6 +411,11 @@ fn save_settings_in(cat: &[Entry], root: &Path, meta: &Path, id: &str, changes: file.set(k, v, &[]); } fsx::atomic_write(&conf, file.to_text().as_bytes())?; + if id == "custom-races" { + let allow = file.get("CoACustomRaces.BotsEnable").is_some_and(truthy) + && file.get("CoACustomRaces.Enable").is_some_and(truthy); + crate::custom_races::sync_bot_races_config(root, allow)?; + } Ok(changed.into_iter().map(|(k, _)| k).collect()) } @@ -397,6 +423,35 @@ fn save_settings_in(cat: &[Entry], root: &Path, meta: &Path, id: &str, changes: mod tests { use super::*; + #[test] + fn custom_race_ids_and_time_settings_are_validated_before_writing() { + let d = tempfile::tempdir().unwrap(); + let root = d.path(); + fs::create_dir_all(dir(root)).unwrap(); + fs::write(dir(root).join("coa_custom_races.conf.dist"), "CoACustomRaces.Enable = 0\nCoACustomRaces.EnabledRaces = \"*\"\n").unwrap(); + fs::write(dir(root).join("mod-time_is_time.conf.dist"), "TimeIsTime.Enable = 0\nTimeIsTime.SpeedRate = 1\nTimeIsTime.HourOffset = 0\nTimeIsTime.TimeStart = 0\n").unwrap(); + let cat = catalog(); + for value in ["12", "12,14", "*", ""] { + assert!(save_settings_in(&cat, root, root, "custom-races", &BTreeMap::from([ + ("CoACustomRaces.EnabledRaces".into(), value.into()) + ])).is_ok()); + } + for value in ["0", "256", "12,no", "12,,14"] { + assert!(save_settings_in(&cat, root, root, "custom-races", &BTreeMap::from([ + ("CoACustomRaces.EnabledRaces".into(), value.into()) + ])).is_err()); + } + for (key, value) in [("TimeIsTime.SpeedRate", "NaN"), ("TimeIsTime.SpeedRate", "0"), + ("TimeIsTime.HourOffset", "25"), ("TimeIsTime.TimeStart", "1.5")] { + assert!(save_settings_in(&cat, root, root, "time-is-time", &BTreeMap::from([ + (key.into(), value.into()) + ])).is_err()); + } + assert!(save_settings_in(&cat, root, root, "time-is-time", &BTreeMap::from([ + ("TimeIsTime.SpeedRate".into(), "60".into()) + ])).is_ok()); + } + fn test_catalog() -> Vec { let one = |id: &str, name: &str, conf: &str, key: &str| Entry { id: id.into(), @@ -729,7 +784,11 @@ mod tests { let change_off = BTreeMap::from([("CoACustomRaces.BotsEnable".into(), "0".into())]); assert_eq!(save_settings_in(&cat, &root, &meta, "custom-races", &change_off).unwrap(), ["CoACustomRaces.BotsEnable"]); let pb = fs::read_to_string(dir(&root).join("playerbots.conf")).unwrap(); - assert!(pb.contains(crate::custom_races::EXCLUDED_BOT_RACES_RECOMMENDED)); + let conf = ConfFile::parse_bytes(pb.as_bytes()).unwrap(); + let excluded: std::collections::BTreeSet = conf.get("AiPlayerbot.ExcludedBotRaces").unwrap() + .trim_matches('"').split(',').map(|id| id.parse().unwrap()).collect(); + assert!(excluded.contains(&12) && excluded.contains(&128)); + assert!(!excluded.contains(&1) && !excluded.contains(&11)); // Settings view now sees "0" let s = settings_in(&cat, &root, "custom-races").unwrap(); diff --git a/crates/coa-core/src/process.rs b/crates/coa-core/src/process.rs index 3e38392..18c8d38 100644 --- a/crates/coa-core/src/process.rs +++ b/crates/coa-core/src/process.rs @@ -68,6 +68,24 @@ pub fn read_state_record(root: &Path, name: &str) -> Option { fsx::read_json(&root.join(".state").join(format!("{name}.json"))).ok() } +#[derive(Deserialize)] +struct ProcessExit { + process: ProcessIdentity, + exit_code: i64, +} + +fn exited_state(root: &Path, name: &str, expected: &[String]) -> ServiceState { + let exit: Option = fsx::read_json(&root.join(".state").join(format!("{name}-exit.json"))).ok(); + let record = read_state_record(root, name); + match (exit, record) { + (Some(exit), Some(record)) + if exit.process.same_as(&record) + && expected.iter().any(|exe| record.exe.eq_ignore_ascii_case(exe)) + && exit.exit_code != 0 && exit.exit_code != 2 => ServiceState::Crashed, + _ => ServiceState::Stopped, + } +} + #[cfg(windows)] mod sys { use super::ProcessIdentity; @@ -304,7 +322,7 @@ fn service_with(root: &Path, name: &'static str, exe: PathBuf, alternatives: &[P (None, Some(o)) => { (ServiceState::Stopped, false, Some(PortConflict { port, pid: o, exe: identity(o).map(|i| i.exe) })) } - (None, None) => (ServiceState::Stopped, false, None), + (None, None) => (exited_state(root, name, &expected), false, None), }; ServiceStatus { name, @@ -400,4 +418,25 @@ mod tests { assert_eq!(o.world.state, ServiceState::Stopped); assert!(o.world.pid.is_none()); } + + #[test] + fn only_matching_abnormal_exits_are_crashes() { + let dir = tempfile::tempdir().unwrap(); + let state = dir.path().join(".state"); + std::fs::create_dir_all(&state).unwrap(); + let record = ProcessIdentity { pid: 42, created: 123, exe: "C:\\server\\worldserver.exe".into() }; + let expected = vec![record.exe.clone()]; + std::fs::write(state.join("world.json"), serde_json::to_vec(&record).unwrap()).unwrap(); + for (code, want) in [(0i64, ServiceState::Stopped), (2, ServiceState::Stopped), (1, ServiceState::Crashed), + (3221225477, ServiceState::Crashed)] { + std::fs::write(state.join("world-exit.json"), serde_json::to_vec(&serde_json::json!({ + "process": record, "exit_code": code + })).unwrap()).unwrap(); + assert_eq!(exited_state(dir.path(), "world", &expected), want); + } + let newer = ProcessIdentity { created: 124, ..record }; + std::fs::write(state.join("world.json"), serde_json::to_vec(&newer).unwrap()).unwrap(); + assert_eq!(exited_state(dir.path(), "world", &expected), ServiceState::Stopped); + assert_eq!(exited_state(dir.path(), "world", &["C:\\other.exe".into()]), ServiceState::Stopped); + } } diff --git a/modules/catalog.json b/modules/catalog.json index 4a1bfd7..5e757ac 100644 --- a/modules/catalog.json +++ b/modules/catalog.json @@ -1,6 +1,42 @@ { "schema": 1, "modules": [ + { + "id": "vanilla-classes", + "name": "Classic classes", + "description": { + "en": "Enable the stock client class-page switch without custom race assets. Offers nine classic classes through the client development flag.", + "ru": "Кнопка смены классов штатного клиента без дополнительных рас. Девять классических классов через клиентский флаг разработки.", + "de": "Aktiviert die klassischen Klassen ohne zusätzliche Völkerdateien.", + "fr": "Active les classes classiques sans les fichiers de races supplémentaires.", + "es": "Activa las clases clásicas sin archivos de razas adicionales." + }, + "repo": "https://github.com/Corfirean/azerothcore-wotlk-coa", + "conf": "coa.conf", + "enable_key": "CoA.VanillaClasses.Enable", + "switchable": true, + "default_on": false, + "status": "beta", + "icon": "swords" + }, + { + "id": "time-is-time", + "name": "TimeIsTime", + "description": { + "en": "Adjust the visual day and night cycle without changing server timers.", + "ru": "Настройка визуального цикла дня и ночи без изменения серверных таймеров.", + "de": "Passt den sichtbaren Tag-Nacht-Zyklus an, ohne Serverzeiten zu ändern.", + "fr": "Ajuste le cycle visuel jour-nuit sans modifier les minuteries du serveur.", + "es": "Ajusta el ciclo visual día-noche sin cambiar los temporizadores del servidor." + }, + "repo": "https://github.com/dunjeon/mod-TimeIsTime", + "conf": "mod-time_is_time.conf", + "enable_key": "TimeIsTime.Enable", + "switchable": true, + "default_on": false, + "status": "beta", + "icon": "clock" + }, { "id": "companions", "name": "CoA Companions", diff --git a/src/lib/moduleSettings.ts b/src/lib/moduleSettings.ts index 78e5117..8b77990 100644 --- a/src/lib/moduleSettings.ts +++ b/src/lib/moduleSettings.ts @@ -14,6 +14,11 @@ const text = (values: string[], locale: Locale) => values[locales.indexOf(locale type Entry = { key: string; type: string; title: string[]; description: string[]; min?: number; max?: number; advanced?: boolean; options?: { value: string; label: string[] }[] }; export const moduleSettingDefinitions: Entry[] = []; const fields = moduleSettingDefinitions; +add("CoACustomRaces.EnabledRaces", "string", ["Enabled race IDs", "ID разрешённых рас"], ["Comma-separated race IDs; * allows all installed custom races. Stock races always remain available. Requires the custom race module.", "ID рас через запятую; * разрешает все установленные дополнительные расы. Стандартные расы остаются доступны. Требуется включённый модуль рас."]); +add("TimeIsTime.Announce", "bool", ["Announce on login", "Сообщение при входе"], ["Show a module notice when a character logs in.", "Показывать сообщение о модуле при входе персонажа."]); +add("TimeIsTime.SpeedRate", "float", ["Day/night speed", "Скорость смены дня и ночи"], ["1 follows real time; 60 gives one game day every 24 minutes. Changes only the client visual clock.", "1 — реальное время; 60 — игровые сутки за 24 минуты. Меняет только визуальное время клиента."], { min: 0.01, max: 60 }); +add("TimeIsTime.HourOffset", "float", ["Hour offset", "Смещение часов"], ["Offset applied to the visual client clock, in hours.", "Смещение визуальных часов клиента в часах."], { min: -24, max: 24 }); +add("TimeIsTime.TimeStart", "int", ["Starting time", "Начальное время"], ["Unix timestamp used at every login; 0 uses the server clock.", "Unix-время при каждом входе; 0 использует часы сервера."], { min: 0, max: 2147483647 }); function add(key: string, type: string, title: string[], description: string[], extra: Partial = {}) { fields.push({ key, type, title, description, ...extra }); } @@ -69,8 +74,11 @@ add(scaling + "LFG.DefaultChallengeSize", "int", ["Challenge group size", "Ра add(scaling + "GroupScaling.LockOnEncounterStart", "bool", ["Lock scaling during combat", "Фиксировать скейлинг на время боя", "Skalierung im Kampf sperren", "Figer l’adaptation en combat", "Fijar ajuste durante combate", "战斗期间锁定缩放"], ["Joining or leaving during a boss fight does not change its scaling.", "Вход и выход игроков во время боя с боссом не меняют скейлинг.", "Beitreten oder Verlassen während eines Bosskampfs ändert die Skalierung nicht.", "Les arrivées et départs pendant un boss ne changent pas l’adaptation.", "Entrar o salir durante un jefe no cambia el ajuste.", "首领战期间玩家进出不会改变缩放。"], { advanced: true }); add(scaling + "Progression.Mode", "enum", ["Progression boundaries", "Границы прогрессии", "Fortschrittsgrenzen", "Limites de progression", "Límites de progresión", "进度边界"], ["Automatic boundaries follow the level cap and enabled expansions. Custom uses the levels below.", "Автоматические границы зависят от максимального уровня и включённых дополнений. Ручные используют уровни ниже.", "Automatisch folgt der Maximalstufe und Erweiterungen. Benutzerdefiniert nutzt die folgenden Stufen.", "Automatique suit le niveau maximal et les extensions. Manuel utilise les niveaux ci-dessous.", "Automático sigue el nivel máximo y las expansiones. Manual usa los niveles siguientes.", "自动边界按等级上限和启用的资料片计算,自定义使用以下等级。"], { advanced: true, options: [ { value: "Auto", label: ["Automatic", "Автоматически", "Automatisch", "Automatique", "Automático", "自动"] }, + { value: "Parallel", label: ["Parallel: Classic 1–60, TBC/WotLK 45–60", "Параллельно: классика 1–60, БК/ЛК 45–60", "Parallel: Classic 1–60, TBC/WotLK 45–60", "Parallèle : Classic 1–60, TBC/WotLK 45–60", "Paralelo: Classic 1–60, TBC/WotLK 45–60", "并行:经典1–60,TBC/WotLK45–60"] }, + { value: "Global", label: ["Global: all eras 1–60", "Всё содержимое 1–60", "Alle Erweiterungen 1–60", "Toutes les extensions 1–60", "Todas las expansiones 1–60", "全部资料片1–60"] }, { value: "Custom", label: ["Custom", "Вручную", "Benutzerdefiniert", "Manuel", "Manual", "自定义"] }, ] }); +add(scaling + "Items.RemoveClassRestrictions", "bool", ["Remove item class requirements", "Убрать классовые ограничения предметов"], ["Allow all classes to equip class-restricted items, including tier sets. Requires a world server restart.", "Разрешает всем классам надевать предметы с классовыми ограничениями, включая комплекты T10. Требуется перезапуск игрового сервера."]); for (const era of ["Classic", "Tbc"]) add(scaling + `Progression.${era}End`, "int", [`${era} last level`, `Последний уровень ${era}`, `${era}-Endstufe`, `Dernier niveau ${era}`, `Último nivel ${era}`, `${era} 最高等级`], ["Used in custom progression. 0 chooses automatically.", "Для ручной прогрессии. 0 — автоматически.", "Für benutzerdefinierten Fortschritt. 0 wählt automatisch.", "Pour la progression manuelle. 0 choisit automatiquement.", "Para progresión manual. 0 elige automáticamente.", "用于自定义进度,0为自动。"], { min: 0, max: 80, advanced: true }); add(scaling + "Debug", "bool", ["Detailed scaling logs", "Подробные логи скейлинга", "Ausführliche Skalierungsprotokolle", "Journaux détaillés", "Registros detallados", "详细缩放日志"], ["Log scaling calculations for troubleshooting.", "Записывает расчёты скейлинга для диагностики.", "Protokolliert Berechnungen zur Fehleranalyse.", "Enregistre les calculs pour le diagnostic.", "Registra cálculos para diagnóstico.", "记录缩放计算以排查问题。"], { advanced: true }); @@ -203,6 +211,6 @@ export function canonicalModuleValue(key: string, value: string): string { const v = value.trim().replace(/^"|"$/g, ""); if (key === scaling + "SoloAssist.Mode") return ({ "0": "None", "1": "Light", "2": "Full", none: "None", light: "Light", full: "Full" } as Record)[v.toLowerCase()] ?? v; if (key === scaling + "LFG.DefaultMode") return ({ "0": "Matchmaking", "1": "BotFill", "2": "CurrentParty", matchmaking: "Matchmaking", botfill: "BotFill", currentparty: "CurrentParty" } as Record)[v.toLowerCase()] ?? v; - if (key === scaling + "Progression.Mode") return v.toLowerCase() === "auto" ? "Auto" : v.toLowerCase() === "custom" ? "Custom" : v; + if (key === scaling + "Progression.Mode") return ({ auto: "Auto", custom: "Custom", parallel: "Parallel", global: "Global" } as Record)[v.toLowerCase()] ?? v; return v; } diff --git a/src/screens/ModulesPage.tsx b/src/screens/ModulesPage.tsx index 5843dbd..f9e0fff 100644 --- a/src/screens/ModulesPage.tsx +++ b/src/screens/ModulesPage.tsx @@ -1,6 +1,6 @@ import { Fragment, useCallback, useEffect, useRef, useState, type ComponentType, type ReactNode } from "react"; import { listen } from "@tauri-apps/api/event"; -import { Bot, Flame, Gavel, Loader2, Plug, Puzzle, Scaling, Settings2, Snowflake, Sparkles, Swords, Users, type LucideProps } from "lucide-react"; +import { Bot, Clock, Flame, Gavel, Loader2, Plug, Puzzle, Scaling, Settings2, Snowflake, Sparkles, Swords, Users, type LucideProps } from "lucide-react"; import { api, asUiError, type CustomRacesClientStatus, type CustomRacesProgress, type ModuleSetting, type ModuleView, type UiError } from "@/lib/api"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; @@ -21,6 +21,7 @@ function GithubMark(props: { className?: string }) { /** Icon and colours of a module's square tile, by the name the catalog gives it. */ const TILES: Record; from: string; to: string }> = { + clock: { icon: Clock, from: "from-amber-500", to: "to-indigo-700" }, bot: { icon: Bot, from: "from-emerald-500", to: "to-teal-700" }, scaling: { icon: Scaling, from: "from-violet-500", to: "to-indigo-700" }, plug: { icon: Plug, from: "from-amber-500", to: "to-orange-700" }, diff --git a/src/screens/Overview.tsx b/src/screens/Overview.tsx index 58175c7..aa135d4 100644 --- a/src/screens/Overview.tsx +++ b/src/screens/Overview.tsx @@ -196,6 +196,7 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o if (alive.current) setPop(null); if ( wasWorldRunningRef.current && + s.observed.world.state === "crashed" && !userStoppedRef.current && actionRef.current === null ) {