mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-19 03:25:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88747c8da1 | ||
|
|
925a81f4f2 | ||
|
|
df1901ea90 | ||
|
|
569d5fffc4 | ||
|
|
af5a9717d4 | ||
|
|
bf2fffcffa |
No files matched your search
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: fixed
|
||||
audience: admins
|
||||
title: Internet sharing restores the LAN address after server restarts
|
||||
---
|
||||
Friends on the local network receive the server's LAN address and network mask while internet players keep using its public address.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: added
|
||||
audience: admins
|
||||
title: Configure profession and defense skill gains in server settings
|
||||
---
|
||||
Advanced rate settings now include prospecting and milling skill gains, plus the points gained from crafting, defense and gathering.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: added
|
||||
audience: admins
|
||||
title: Control portable characters and keep Manager running in the system tray
|
||||
---
|
||||
Realm access settings can enable portable characters. Closing the window keeps Manager in the tray, with commands to reopen or exit. Offline realm messages explain why players cannot connect.
|
||||
@@ -1034,6 +1034,31 @@ Spellbook.New = 5
|
||||
assert!(v.drift_keys.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn skill_controls_persist_and_reject_invalid_gains() {
|
||||
let (_d, root, meta) = fixture();
|
||||
let changes = BTreeMap::from([
|
||||
("SkillChance.Prospecting".into(), json!(true)),
|
||||
("SkillChance.Milling".into(), json!(true)),
|
||||
("SkillGain.Crafting".into(), json!(3)),
|
||||
("SkillGain.Defense".into(), json!(4)),
|
||||
("SkillGain.Gathering".into(), json!(5)),
|
||||
]);
|
||||
let report = save(&root, &meta, Scope::Server, &changes).unwrap();
|
||||
assert_eq!(report.changed.len(), 5);
|
||||
assert_eq!(report.restart, Some(Restart::World));
|
||||
for path in ["Settings/worldserver.conf.template", "Core/configs/worldserver.conf"] {
|
||||
let conf = load_conf(&root.join(path)).unwrap();
|
||||
for (key, expected) in [("SkillChance.Prospecting", "1"), ("SkillChance.Milling", "1"), ("SkillGain.Crafting", "3"), ("SkillGain.Defense", "4"), ("SkillGain.Gathering", "5")] {
|
||||
assert_eq!(conf.get(key), Some(expected));
|
||||
}
|
||||
assert_eq!(conf.get("Unknown.Custom"), Some("\"keep me\""));
|
||||
}
|
||||
for value in [json!(-1), json!(1.5), json!(451)] {
|
||||
assert!(save(&root, &meta, Scope::Server, &BTreeMap::from([("SkillGain.Crafting".into(), value)])).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn creature_rates_save_independently_in_template_and_active_config() {
|
||||
let (_d, root, meta) = fixture();
|
||||
|
||||
@@ -163,10 +163,52 @@ pub fn set_open(root: &Path, meta: &Path, open: bool) -> Result<bool> {
|
||||
|
||||
/// Make the realm list advertise `host` to remote clients (the launcher resets it to 127.0.0.1 at every start, so this
|
||||
/// runs after each start).
|
||||
pub fn apply_realm_address(root: &Path, host: &str) -> Result<()> {
|
||||
fn realm_address_sql(
|
||||
host: &str,
|
||||
local: Option<(std::net::Ipv4Addr, std::net::Ipv4Addr)>,
|
||||
where_realms: &str,
|
||||
) -> Result<String> {
|
||||
if !host_ok(host) {
|
||||
return Err(Error::Invalid("That address is not valid.".into()));
|
||||
}
|
||||
let local = local
|
||||
.map(|(address, mask)| format!(",localAddress='{address}',localSubnetMask='{mask}'"))
|
||||
.unwrap_or_default();
|
||||
Ok(format!(
|
||||
"UPDATE acore_auth.realmlist SET address='{host}'{local} WHERE {where_realms};"
|
||||
))
|
||||
}
|
||||
|
||||
pub fn apply_realm_address(root: &Path, settings: &Settings) -> Result<()> {
|
||||
let host = settings.host.as_deref().unwrap_or("127.0.0.1");
|
||||
let local = match settings.mode {
|
||||
Mode::Direct | Mode::Lan => {
|
||||
let address = if settings.mode == Mode::Lan {
|
||||
host.to_owned()
|
||||
} else {
|
||||
crate::net::resolve_lan_host(
|
||||
settings.lan_address_override.as_deref(),
|
||||
crate::net::lan_ip(),
|
||||
)?
|
||||
};
|
||||
let address = crate::net::validate_lan_address(&address)?;
|
||||
let mask = if_addrs::get_if_addrs()?
|
||||
.into_iter()
|
||||
.find_map(|interface| match interface.addr {
|
||||
if_addrs::IfAddr::V4(v4) if v4.ip == address => Some(v4.netmask),
|
||||
_ => None,
|
||||
})
|
||||
.ok_or_else(|| {
|
||||
Error::Invalid("The selected local network address is not connected.".into())
|
||||
})?;
|
||||
Some((address, mask))
|
||||
}
|
||||
Mode::Local => Some((
|
||||
std::net::Ipv4Addr::LOCALHOST,
|
||||
std::net::Ipv4Addr::new(255, 0, 0, 0),
|
||||
)),
|
||||
Mode::Private => None,
|
||||
};
|
||||
let db = Db::from_repack(root, Account::Admin)?;
|
||||
let realm = crate::realms::state(root)?.active.realm_id();
|
||||
let where_realms = if crate::realms::state(root)?.simultaneous {
|
||||
@@ -174,9 +216,7 @@ pub fn apply_realm_address(root: &Path, host: &str) -> Result<()> {
|
||||
} else {
|
||||
format!("id={realm}")
|
||||
};
|
||||
db.query(&format!(
|
||||
"UPDATE acore_auth.realmlist SET address='{host}' WHERE {where_realms};"
|
||||
))?;
|
||||
db.query(&realm_address_sql(host, local, &where_realms)?)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -194,9 +234,9 @@ pub fn ensure_bind(root: &Path, meta: &Path) -> Result<bool> {
|
||||
/// After every server start: put the chosen address back into the realm list (the launcher resets it to 127.0.0.1).
|
||||
pub fn reapply(root: &Path, meta: &Path) -> Result<()> {
|
||||
let s = load(meta);
|
||||
match (s.mode, s.host) {
|
||||
match (s.mode, &s.host) {
|
||||
(Mode::Local, _) | (_, None) => Ok(()),
|
||||
(_, Some(host)) => apply_realm_address(root, &host),
|
||||
(_, Some(_)) => apply_realm_address(root, &s),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,6 +430,25 @@ CoA.AllowRemoteClients = 0
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn realm_addresses_restore_lan_without_replacing_public_host() {
|
||||
let sql = realm_address_sql(
|
||||
"203.0.113.9",
|
||||
Some((
|
||||
"192.168.50.7".parse().unwrap(),
|
||||
"255.255.254.0".parse().unwrap(),
|
||||
)),
|
||||
"id IN (1,2)",
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(sql, "UPDATE acore_auth.realmlist SET address='203.0.113.9',localAddress='192.168.50.7',localSubnetMask='255.255.254.0' WHERE id IN (1,2);");
|
||||
assert_eq!(
|
||||
realm_address_sql("100.64.1.2", None, "id=1").unwrap(),
|
||||
"UPDATE acore_auth.realmlist SET address='100.64.1.2' WHERE id=1;"
|
||||
);
|
||||
assert!(realm_address_sql("bad'host", None, "id=1").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn old_settings_load_without_migrating_effective_host_to_override() {
|
||||
let s: Settings = serde_json::from_str(r#"{"mode":"lan","host":"192.168.1.50"}"#).unwrap();
|
||||
|
||||
@@ -445,6 +445,17 @@
|
||||
"max": 3600000,
|
||||
"unit": "ms"
|
||||
},
|
||||
{
|
||||
"key": "PortableSession.Enable",
|
||||
"type": "bool",
|
||||
"category": "characters",
|
||||
"title": "Portable characters",
|
||||
"description": "Allow players to play on this realm with portable characters saved in their Manager.",
|
||||
"default": true,
|
||||
"advanced": false,
|
||||
"restartRequired": "world",
|
||||
"dangerous": false
|
||||
},
|
||||
{
|
||||
"key": "CharactersPerAccount",
|
||||
"type": "int",
|
||||
@@ -1025,6 +1036,67 @@
|
||||
"advanced": false,
|
||||
"restartRequired": "world",
|
||||
"dangerous": false
|
||||
},
|
||||
{
|
||||
"key": "SkillChance.Prospecting",
|
||||
"type": "bool",
|
||||
"category": "rates",
|
||||
"title": "Prospecting skill gains",
|
||||
"description": "Allow prospecting to increase the profession skill.",
|
||||
"default": false,
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": false
|
||||
},
|
||||
{
|
||||
"key": "SkillChance.Milling",
|
||||
"type": "bool",
|
||||
"category": "rates",
|
||||
"title": "Milling skill gains",
|
||||
"description": "Allow milling to increase the profession skill.",
|
||||
"default": false,
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": false
|
||||
},
|
||||
{
|
||||
"key": "SkillGain.Crafting",
|
||||
"type": "int",
|
||||
"category": "rates",
|
||||
"title": "Crafting skill gain",
|
||||
"description": "Skill points awarded by a successful crafting skill increase.",
|
||||
"default": 1,
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": false,
|
||||
"min": 0,
|
||||
"max": 450
|
||||
},
|
||||
{
|
||||
"key": "SkillGain.Defense",
|
||||
"type": "int",
|
||||
"category": "rates",
|
||||
"title": "Defense skill gain",
|
||||
"description": "Skill points awarded by a successful defense skill increase.",
|
||||
"default": 1,
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": false,
|
||||
"min": 0,
|
||||
"max": 450
|
||||
},
|
||||
{
|
||||
"key": "SkillGain.Gathering",
|
||||
"type": "int",
|
||||
"category": "rates",
|
||||
"title": "Gathering skill gain",
|
||||
"description": "Skill points awarded by a successful gathering skill increase.",
|
||||
"default": 1,
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": false,
|
||||
"min": 0,
|
||||
"max": 450
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -12,7 +12,7 @@ crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri = { version = "2", features = ["tray-icon"] }
|
||||
tauri-plugin-dialog = "2"
|
||||
tauri-plugin-updater = "2"
|
||||
tauri-plugin-process = "2"
|
||||
|
||||
+71
-4
@@ -2571,7 +2571,7 @@ async fn friends_enable(
|
||||
friends::save(&meta, &settings)?;
|
||||
let running = coa_core::process::observe(&root, &ports).world.state == coa_core::process::ServiceState::Running;
|
||||
if running {
|
||||
friends::apply_realm_address(&root, &host)?;
|
||||
friends::apply_realm_address(&root, &settings)?;
|
||||
}
|
||||
Ok(FriendsResult { host, restart_required: changed && running, note })
|
||||
})
|
||||
@@ -2729,6 +2729,8 @@ async fn console_command(
|
||||
.await
|
||||
}
|
||||
|
||||
static QUIT_REQUESTED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
|
||||
|
||||
pub fn run() {
|
||||
let dir = data_dir();
|
||||
let _ = coa_core::logging::init(&dir.join("logs").join("manager.log"));
|
||||
@@ -2881,11 +2883,75 @@ pub fn run() {
|
||||
control_cmds::join_characters,
|
||||
control_cmds::join_claim
|
||||
])
|
||||
.on_window_event(|window, event| {
|
||||
if let tauri::WindowEvent::CloseRequested { api, .. } = event {
|
||||
api.prevent_close();
|
||||
let _ = window.hide();
|
||||
}
|
||||
})
|
||||
.setup(|app| {
|
||||
#[cfg(desktop)]
|
||||
{
|
||||
use tauri::menu::{Menu, MenuItem};
|
||||
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
|
||||
use tauri::Manager;
|
||||
|
||||
let show = MenuItem::with_id(app, "show", "Open CoA Server Manager", true, None::<&str>)?;
|
||||
let quit = MenuItem::with_id(app, "quit", "Exit", true, None::<&str>)?;
|
||||
let menu = Menu::with_items(app, &[&show, &quit])?;
|
||||
|
||||
let mut builder = TrayIconBuilder::new()
|
||||
.tooltip("CoA Server Manager")
|
||||
.menu(&menu)
|
||||
.show_menu_on_left_click(false)
|
||||
.on_menu_event(|app, event| match event.id.as_ref() {
|
||||
"show" => {
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.show();
|
||||
let _ = window.unminimize();
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
}
|
||||
"quit" => {
|
||||
QUIT_REQUESTED.store(true, std::sync::atomic::Ordering::SeqCst);
|
||||
app.exit(0);
|
||||
}
|
||||
_ => {}
|
||||
})
|
||||
.on_tray_icon_event(|tray, event| {
|
||||
if let TrayIconEvent::Click {
|
||||
button: MouseButton::Left,
|
||||
button_state: MouseButtonState::Up,
|
||||
..
|
||||
} = event
|
||||
{
|
||||
let app = tray.app_handle();
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.show();
|
||||
let _ = window.unminimize();
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if let Some(icon) = app.default_window_icon() {
|
||||
builder = builder.icon(icon.clone());
|
||||
}
|
||||
|
||||
builder.build(app)?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.build(tauri::generate_context!())
|
||||
.expect("error while building CoA Server Manager")
|
||||
.run(|app, event| {
|
||||
// the Host loop stops with the application: what it is doing is finished first, the stores keep every session
|
||||
if let tauri::RunEvent::Exit = event {
|
||||
.run(|app, event| match event {
|
||||
tauri::RunEvent::ExitRequested { api, .. } => {
|
||||
if !QUIT_REQUESTED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||
api.prevent_exit();
|
||||
}
|
||||
}
|
||||
tauri::RunEvent::Exit => {
|
||||
// the Host loop stops with the application: what it is doing is finished first, the stores keep every session
|
||||
if let Some(rt) = app.state::<AppState>().portable.clone() {
|
||||
rt.shutdown();
|
||||
}
|
||||
@@ -2896,6 +2962,7 @@ pub fn run() {
|
||||
rt.shutdown();
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1006,7 +1006,7 @@ const en = {
|
||||
"portable.note.blocked_ruleset": "This character is for another kind of realm.",
|
||||
"portable.note.blocked_format": "This realm reads another version of the character format. Update the Manager or the realm.",
|
||||
"portable.note.blocked_online_import": "This realm cannot take characters while it runs. Update the realm.",
|
||||
"portable.note.blocked_sessions": "This realm cannot follow a game session. Ask its owner to enable portable play.",
|
||||
"portable.note.blocked_sessions": "This realm cannot follow a game session. The server or host's Server Manager is offline, or portable play is not enabled.",
|
||||
"portable.note.blocked_client_data": "The game data the Manager sees is not the data the realm loaded.",
|
||||
"portable.note.blocked_progression": "The realm’s level cap is not known yet or cannot be handled. Start the realm and try again.",
|
||||
"portable.note.realm_offline": "The realm cannot be reached.",
|
||||
@@ -1101,6 +1101,8 @@ const en = {
|
||||
"browse.noCharacter": "You have no portable character yet. Make one portable on the Characters page to see whether it can play here.",
|
||||
"browse.canPlay": "Can play",
|
||||
"browse.cannotPlay": "Cannot play here",
|
||||
"browse.realmOffline": "Offline",
|
||||
"browse.offlineWarning": "The server is currently offline. Joining with a portable character will become available once the host starts the server.",
|
||||
"browse.play": "Play",
|
||||
"browse.playSoon": "Joining arrives with the account support of the next step.",
|
||||
"registry.title": "Public listing",
|
||||
@@ -1121,6 +1123,7 @@ const en = {
|
||||
"registry.state.starting": "Starting to publish…",
|
||||
"registry.state.waiting_for_realm": "Waiting for the realm to be ready…",
|
||||
"registry.state.realm_stopped": "The realm is not running; it is listed as offline.",
|
||||
"registry.realmStoppedHint": "The realm is currently stopped. Start the server so players can join and track character sessions.",
|
||||
"registry.state.online": "Published and online.",
|
||||
"registry.state.retrying": "The Registry could not be reached; trying again. Your realm is not affected.",
|
||||
"registry.state.rejected": "The Registry refused this realm. Publishing is stopped.",
|
||||
@@ -1180,6 +1183,8 @@ const en = {
|
||||
"join.err.unavailable": "The server could not do that right now.",
|
||||
"access.title": "Joining players",
|
||||
"access.text": "How players who find this realm in the list get in.",
|
||||
"access.portableEnabled": "Allow portable characters (portable play)",
|
||||
"access.portableEnabledHint": "Allows players with Manager-saved characters to play on this realm (PortableSession.Enable).",
|
||||
"access.existingOnly": "Do not create accounts for new players",
|
||||
"access.existingOnlyHint": "Players can only link an account they already have on this realm.",
|
||||
"access.route": "Address players connect to",
|
||||
|
||||
@@ -988,7 +988,7 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"portable.note.blocked_ruleset": "Этот персонаж — для реалма другого типа.",
|
||||
"portable.note.blocked_format": "Реалм читает другую версию формата персонажа. Обновите Менеджер или реалм.",
|
||||
"portable.note.blocked_online_import": "Этот реалм не принимает персонажей, пока работает. Обновите реалм.",
|
||||
"portable.note.blocked_sessions": "Этот реалм не может следить за игровой сессией. Попросите владельца включить переносимую игру.",
|
||||
"portable.note.blocked_sessions": "Этот реалм не может следить за игровой сессией. Сервер или Server Manager хоста выключен, либо в ядре не включена переносимая игра.",
|
||||
"portable.note.blocked_client_data": "Игровые данные, которые видит Менеджер, не те, что загрузил реалм.",
|
||||
"portable.note.blocked_progression": "Предел уровня реалма пока неизвестен или не поддерживается. Запустите реалм и попробуйте снова.",
|
||||
"portable.note.realm_offline": "Реалм недоступен.",
|
||||
@@ -1083,6 +1083,8 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"browse.noCharacter": "У вас пока нет переносимого персонажа. Сделайте его переносимым на странице «Персонажи», чтобы увидеть, сможет ли он играть здесь.",
|
||||
"browse.canPlay": "Можно играть",
|
||||
"browse.cannotPlay": "Здесь играть нельзя",
|
||||
"browse.realmOffline": "Оффлайн",
|
||||
"browse.offlineWarning": "Сервер сейчас не запущен хостом. Игра переносимым персонажем станет доступна, когда владелец включит сервер.",
|
||||
"browse.play": "Играть",
|
||||
"browse.playSoon": "Вход на сервер появится вместе с поддержкой аккаунтов на следующем шаге.",
|
||||
"registry.title": "Публичный список",
|
||||
@@ -1103,6 +1105,7 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"registry.state.starting": "Начинаю публикацию…",
|
||||
"registry.state.waiting_for_realm": "Жду, пока реалм будет готов…",
|
||||
"registry.state.realm_stopped": "Реалм не запущен; в списке он отмечен как недоступный.",
|
||||
"registry.realmStoppedHint": "Сервер сейчас выключен. Запустите реалм, чтобы игроки могли подключаться и отслеживать сессии персонажей.",
|
||||
"registry.state.online": "Опубликован и доступен.",
|
||||
"registry.state.retrying": "Реестр недоступен, пробую снова. На ваш реалм это не влияет.",
|
||||
"registry.state.rejected": "Реестр отклонил этот реалм. Публикация остановлена.",
|
||||
@@ -1162,6 +1165,8 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"join.err.unavailable": "Сервер сейчас не смог этого сделать.",
|
||||
"access.title": "Вход игроков",
|
||||
"access.text": "Как попадают на этот мир игроки, нашедшие его в списке.",
|
||||
"access.portableEnabled": "Разрешить вход переносимым персонажам (переносимая игра)",
|
||||
"access.portableEnabledHint": "Позволяет игрокам с сохранёнными в Менеджере персонажами играть на этом сервере (PortableSession.Enable).",
|
||||
"access.existingOnly": "Не создавать аккаунты для новых игроков",
|
||||
"access.existingOnlyHint": "Игроки смогут только привязать аккаунт, который у них уже есть на этом мире.",
|
||||
"access.route": "Адрес для подключения игроков",
|
||||
|
||||
@@ -31,6 +31,11 @@
|
||||
"copper": "Kupfer"
|
||||
},
|
||||
"settings": {
|
||||
"SkillChance.Prospecting": {"t": "Fertigkeitszuwachs beim Sondieren", "d": "Sondieren darf die Berufsfertigkeit erhöhen."},
|
||||
"SkillChance.Milling": {"t": "Fertigkeitszuwachs beim Mahlen", "d": "Mahlen darf die Berufsfertigkeit erhöhen."},
|
||||
"SkillGain.Crafting": {"t": "Fertigkeitszuwachs beim Herstellen", "d": "Fertigkeitspunkte pro erfolgreicher Steigerung beim Herstellen."},
|
||||
"SkillGain.Defense": {"t": "Zuwachs der Verteidigungsfertigkeit", "d": "Fertigkeitspunkte pro erfolgreicher Steigerung der Verteidigung."},
|
||||
"SkillGain.Gathering": {"t": "Fertigkeitszuwachs beim Sammeln", "d": "Fertigkeitspunkte pro erfolgreicher Steigerung beim Sammeln."},
|
||||
"CoaBots.RandomSpawn.DefaultCount": {
|
||||
"t": "Bots pro Erstellungsbefehl",
|
||||
"d": "Wie viele Bots der Erstellungsbefehl anlegt, wenn du keine Zahl angibst."
|
||||
@@ -375,6 +380,10 @@
|
||||
"t": "Autospeicher-Intervall",
|
||||
"d": "Wie oft Spielercharaktere gespeichert werden, solange sie online sind."
|
||||
},
|
||||
"PortableSession.Enable": {
|
||||
"t": "Portable Charaktere (portables Spiel)",
|
||||
"d": "Erlaubt Spielern, mit ihren im Manager gespeicherten portablen Charakteren auf diesem Realm zu spielen."
|
||||
},
|
||||
"CharactersPerAccount": {
|
||||
"t": "Charaktere pro Konto",
|
||||
"d": "Maximale Zahl an Charakteren, die ein Konto über alle Realms hat."
|
||||
|
||||
@@ -31,6 +31,11 @@
|
||||
"copper": "cobre"
|
||||
},
|
||||
"settings": {
|
||||
"SkillChance.Prospecting": {"t": "Mejora de habilidad al prospectar", "d": "Permitir que prospectar aumente la habilidad de profesión."},
|
||||
"SkillChance.Milling": {"t": "Mejora de habilidad al moler", "d": "Permitir que moler aumente la habilidad de profesión."},
|
||||
"SkillGain.Crafting": {"t": "Puntos de habilidad al fabricar", "d": "Puntos otorgados por una mejora de habilidad al fabricar."},
|
||||
"SkillGain.Defense": {"t": "Puntos de habilidad de defensa", "d": "Puntos otorgados por una mejora de habilidad de defensa."},
|
||||
"SkillGain.Gathering": {"t": "Puntos de habilidad al recolectar", "d": "Puntos otorgados por una mejora de habilidad al recolectar."},
|
||||
"CoaBots.RandomSpawn.DefaultCount": {
|
||||
"t": "Bots creados por comando",
|
||||
"d": "Cuántos bots crea el comando de creación cuando no indicas un número."
|
||||
@@ -375,6 +380,10 @@
|
||||
"t": "Intervalo de autoguardado",
|
||||
"d": "Con qué frecuencia se guardan los personajes de los jugadores mientras están conectados."
|
||||
},
|
||||
"PortableSession.Enable": {
|
||||
"t": "Personajes portátiles (juego portátil)",
|
||||
"d": "Permite a los jugadores jugar en este reino con personajes portátiles guardados en su Manager."
|
||||
},
|
||||
"CharactersPerAccount": {
|
||||
"t": "Personajes por cuenta",
|
||||
"d": "Máximo de personajes que puede tener una cuenta entre todos los reinos."
|
||||
|
||||
@@ -31,6 +31,11 @@
|
||||
"copper": "cuivre"
|
||||
},
|
||||
"settings": {
|
||||
"SkillChance.Prospecting": {"t": "Progression avec la prospection", "d": "Permettre à la prospection d’améliorer la compétence de métier."},
|
||||
"SkillChance.Milling": {"t": "Progression avec la mouture", "d": "Permettre à la mouture d’améliorer la compétence de métier."},
|
||||
"SkillGain.Crafting": {"t": "Gain de compétence en fabrication", "d": "Points accordés lors d’une progression réussie en fabrication."},
|
||||
"SkillGain.Defense": {"t": "Gain de compétence en défense", "d": "Points accordés lors d’une progression réussie en défense."},
|
||||
"SkillGain.Gathering": {"t": "Gain de compétence en récolte", "d": "Points accordés lors d’une progression réussie en récolte."},
|
||||
"CoaBots.RandomSpawn.DefaultCount": {
|
||||
"t": "Bots créés par commande",
|
||||
"d": "Nombre de bots que la commande de création crée quand vous n’indiquez pas de nombre."
|
||||
@@ -375,6 +380,10 @@
|
||||
"t": "Intervalle de sauvegarde automatique",
|
||||
"d": "Fréquence de sauvegarde des personnages des joueurs pendant qu’ils sont en ligne."
|
||||
},
|
||||
"PortableSession.Enable": {
|
||||
"t": "Personnages portables (jeu portable)",
|
||||
"d": "Permet aux joueurs de jouer sur ce royaume avec des personnages portables enregistrés dans leur Manager."
|
||||
},
|
||||
"CharactersPerAccount": {
|
||||
"t": "Personnages par compte",
|
||||
"d": "Nombre maximal de personnages qu’un compte peut avoir sur tous les royaumes."
|
||||
|
||||
@@ -31,6 +31,11 @@
|
||||
"copper": "меди"
|
||||
},
|
||||
"settings": {
|
||||
"SkillChance.Prospecting": {"t": "Рост навыка при просеивании", "d": "Разрешить повышение навыка профессии при просеивании."},
|
||||
"SkillChance.Milling": {"t": "Рост навыка при измельчении", "d": "Разрешить повышение навыка профессии при измельчении."},
|
||||
"SkillGain.Crafting": {"t": "Прирост ремесленного навыка", "d": "Число очков за успешное повышение ремесленного навыка."},
|
||||
"SkillGain.Defense": {"t": "Прирост навыка защиты", "d": "Число очков за успешное повышение навыка защиты."},
|
||||
"SkillGain.Gathering": {"t": "Прирост навыка сбора", "d": "Число очков за успешное повышение навыка сбора."},
|
||||
"CoaBots.RandomSpawn.DefaultCount": {
|
||||
"t": "Ботов за одну команду создания",
|
||||
"d": "Сколько ботов создаёт команда создания, если вы не указали число."
|
||||
@@ -375,6 +380,10 @@
|
||||
"t": "Интервал автосохранения",
|
||||
"d": "Как часто персонажи игроков сохраняются, пока они в сети."
|
||||
},
|
||||
"PortableSession.Enable": {
|
||||
"t": "Переносимые персонажи (переносимая игра)",
|
||||
"d": "Разрешает игрокам заходить на этот сервер переносимыми персонажами, сохранёнными в их Менеджере."
|
||||
},
|
||||
"CharactersPerAccount": {
|
||||
"t": "Персонажей на учётную запись",
|
||||
"d": "Наибольшее число персонажей на учётной записи во всех мирах."
|
||||
|
||||
@@ -31,6 +31,11 @@
|
||||
"copper": "铜币"
|
||||
},
|
||||
"settings": {
|
||||
"SkillChance.Prospecting": {"t": "选矿技能提升", "d": "允许通过选矿提升专业技能。"},
|
||||
"SkillChance.Milling": {"t": "研磨技能提升", "d": "允许通过研磨提升专业技能。"},
|
||||
"SkillGain.Crafting": {"t": "制造技能提升点数", "d": "制造成功触发技能提升时获得的点数。"},
|
||||
"SkillGain.Defense": {"t": "防御技能提升点数", "d": "防御成功触发技能提升时获得的点数。"},
|
||||
"SkillGain.Gathering": {"t": "采集技能提升点数", "d": "采集成功触发技能提升时获得的点数。"},
|
||||
"CoaBots.RandomSpawn.DefaultCount": {
|
||||
"t": "单次生成命令创建数量",
|
||||
"d": "当生成命令未指定数量时,默认创建的机器人数量。"
|
||||
@@ -375,6 +380,10 @@
|
||||
"t": "角色数据自动保存间隔",
|
||||
"d": "在线玩家角色数据写入数据库的时间间隔。"
|
||||
},
|
||||
"PortableSession.Enable": {
|
||||
"t": "便携式角色(跨服漫游)",
|
||||
"d": "允许玩家使用保存在管理器中的便携式角色进入此服务器进行游玩。"
|
||||
},
|
||||
"CharactersPerAccount": {
|
||||
"t": "每个账号最大角色数",
|
||||
"d": "单个账号在所有服务器可创建的角色总数上限。"
|
||||
|
||||
@@ -117,6 +117,7 @@ function Drawer({ summary, catalog, onClose }: { summary: RealmSummary; catalog:
|
||||
<h2 className="truncate text-lg font-semibold" data-testid="drawer-title">{summary.display_name}</h2>
|
||||
<p className="mt-0.5 text-sm text-muted"><Mode ruleset={summary.ruleset} /> · {t("browse.cap")} {summary.level_cap ?? "—"}</p>
|
||||
<p className="text-sm"><Online p={summary.population} />{summary.population.capacity !== null && <span className="text-muted"> · {t("browse.capacity", { n: summary.population.capacity })}</span>}</p>
|
||||
{!summary.online && <span className="mt-1 inline-block rounded bg-bad/15 px-2 py-0.5 text-xs font-medium text-bad">{t("browse.realmOffline")}</span>}
|
||||
</div>
|
||||
<button onClick={onClose} aria-label={t("portable.close")} className="cursor-pointer text-muted hover:text-ink"><X className="h-5 w-5" /></button>
|
||||
</div>
|
||||
@@ -180,6 +181,7 @@ function Drawer({ summary, catalog, onClose }: { summary: RealmSummary; catalog:
|
||||
<p className="font-medium">{blocked ? t("browse.cannotPlay") : t("browse.canPlay")}</p>
|
||||
{pre.projection && <Projection from={pre.projection[0]} to={pre.projection[1]} cap={summary.level_cap} />}
|
||||
<Notes notes={pre.notes} />
|
||||
{!summary.online && <p className="mt-2 border-t border-line/40 pt-2 text-xs text-warn">{t("browse.offlineWarning")}</p>}
|
||||
</div>}
|
||||
</>}
|
||||
</section>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useT, type Key } from "@/i18n";
|
||||
import { asUiError } from "@/lib/api";
|
||||
import { asUiError, api } from "@/lib/api";
|
||||
import { realmRegistry, useRegistryStatus } from "@/lib/registry";
|
||||
import { asControlError, control, type ControlStatus } from "@/lib/control";
|
||||
|
||||
@@ -25,12 +25,25 @@ export function PublishCard({ serverId, serverName }: { serverId: string; server
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [allowPortable, setAllowPortable] = useState(false);
|
||||
const [existingOnly, setExistingOnly] = useState(false);
|
||||
const [portableEnabled, setPortableEnabled] = useState(true);
|
||||
const [route, setRoute] = useState("");
|
||||
const [accessSaved, setAccessSaved] = useState(false);
|
||||
const [ctl, setCtl] = useState<ControlStatus | null>(null);
|
||||
const host = ctl?.hosting.find((h) => h.local_id === localId);
|
||||
const link = host?.link;
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
void api.allSettings(serverId).then((items) => {
|
||||
if (!active) return;
|
||||
const item = items.find((i) => i.key === "PortableSession.Enable");
|
||||
if (item) {
|
||||
setPortableEnabled(item.value === "1" || item.value.toLowerCase() === "true");
|
||||
}
|
||||
}).catch(() => {});
|
||||
return () => { active = false; };
|
||||
}, [serverId]);
|
||||
|
||||
useEffect(() => {
|
||||
const load = () => void control.status().then(setCtl).catch(() => {});
|
||||
load();
|
||||
@@ -41,7 +54,21 @@ export function PublishCard({ serverId, serverName }: { serverId: string; server
|
||||
|
||||
async function saveAccess() {
|
||||
setBusy(true); setError(null); setAccessSaved(false);
|
||||
try { await control.setAccess(localId, existingOnly, allowPortable, route.trim() === "" ? null : route.trim()); await refresh(); setAccessSaved(true); } catch (e) { setError(asControlError(e).message); } finally { setBusy(false); }
|
||||
try {
|
||||
await Promise.all([
|
||||
control.setAccess(localId, existingOnly, allowPortable, route.trim() === "" ? null : route.trim()),
|
||||
api.allSettingsSave(serverId, {
|
||||
"PortableSession.Enable": portableEnabled ? "1" : "0",
|
||||
...(portableEnabled ? { "CharacterDatabase.WorkerThreads": "1" } : {}),
|
||||
}),
|
||||
]);
|
||||
await refresh();
|
||||
setAccessSaved(true);
|
||||
} catch (e) {
|
||||
setError(asControlError(e).message);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -85,6 +112,7 @@ export function PublishCard({ serverId, serverName }: { serverId: string; server
|
||||
{mine && (published || mine.state === "unpublishing") && <div className="mt-4 rounded-md border border-line p-3 text-sm" role="status">
|
||||
<p className={cn("font-medium", tone)} data-state={mine.state}>{t(`registry.state.${mine.state}` as Key)}</p>
|
||||
<p className="mt-1 text-xs text-muted">{mine.display_name}{mine.metadata_revision ? ` · ${t("registry.revision", { n: mine.metadata_revision })}` : ""}</p>
|
||||
{mine.state === "realm_stopped" && <p className="mt-2 text-xs text-warn">{t("registry.realmStoppedHint")}</p>}
|
||||
{mine.last_error && <p className="mt-1 text-xs text-warn">{mine.last_error}</p>}
|
||||
{mine.state === "retrying" && mine.retry_in_secs !== null && <p className="mt-1 text-xs text-muted">{t("registry.retryIn", { s: mine.retry_in_secs })}</p>}
|
||||
<div className="mt-3 flex gap-2">
|
||||
@@ -95,6 +123,7 @@ export function PublishCard({ serverId, serverName }: { serverId: string; server
|
||||
{mine && (published || mine.state === "unpublishing") && <div className="mt-4 rounded-md border border-line p-3 text-sm" data-testid="access-options">
|
||||
<p className="font-medium">{t("access.title")}</p>
|
||||
<p className="mt-1 text-xs text-muted">{t("access.text")}</p>
|
||||
<label className="mt-3 flex items-start gap-2"><input type="checkbox" checked={portableEnabled} onChange={(e) => setPortableEnabled(e.target.checked)} className="mt-1" data-testid="portable-enabled" /><span>{t("access.portableEnabled")}<span className="block text-xs text-muted">{t("access.portableEnabledHint")}</span></span></label>
|
||||
<label className="mt-3 flex items-start gap-2"><input type="checkbox" checked={existingOnly} onChange={(e) => setExistingOnly(e.target.checked)} className="mt-1" data-testid="existing-only" /><span>{t("access.existingOnly")}<span className="block text-xs text-muted">{t("access.existingOnlyHint")}</span></span></label>
|
||||
<label className="mt-3 flex items-start gap-2"><input type="checkbox" checked={allowPortable} onChange={(e) => setAllowPortable(e.target.checked)} className="mt-1" data-testid="allow-portable" /><span>{t("access.allowPortable")}<span className="block text-xs text-muted">{t("access.allowPortableHint")}</span></span></label>
|
||||
<label htmlFor="access-route" className="mt-3 block font-medium">{t("access.route")}</label>
|
||||
|
||||
Reference in new issue
Block a user