mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-19 03:25:56 +00:00
Compare commits
33
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f64da3ae0 | ||
|
|
1aec8e5394 | ||
|
|
326a4fe3d3 | ||
|
|
f9839ba369 | ||
|
|
e951eb134b | ||
|
|
6cbf007d72 | ||
|
|
07e9bc497d | ||
|
|
e4edb7cbdd | ||
|
|
ca2514c790 | ||
|
|
69c9938aba | ||
|
|
2fd42f2acd | ||
|
|
05630ec9eb | ||
|
|
d64fdb51be | ||
|
|
260d10b729 | ||
|
|
20657df203 | ||
|
|
f08ae1c76b | ||
|
|
4fc133c35e | ||
|
|
de38e60444 | ||
|
|
3c26004e04 | ||
|
|
d1534ebc92 | ||
|
|
20d4c3351e | ||
|
|
8a313b83b8 | ||
|
|
7eea72c415 | ||
|
|
e8ffa6efe3 | ||
|
|
baeecd2ddf | ||
|
|
d352731280 | ||
|
|
a0545286ee | ||
|
|
6f8ed793a7 | ||
|
|
b3c88ce2a6 | ||
|
|
d71c5635e3 | ||
|
|
755761d0de | ||
|
|
550e475962 | ||
|
|
d2e6fef188 |
No files matched your search
@@ -8,6 +8,18 @@ Published releases and previews. Pre-release entries do not change the stable up
|
|||||||
|
|
||||||
Dates follow GitHub publication (UTC); legacy records retain their archived dates. Newest releases first.
|
Dates follow GitHub publication (UTC); legacy records retain their archived dates. Newest releases first.
|
||||||
|
|
||||||
|
## 0.9.13 — 2026-11-15
|
||||||
|
|
||||||
|
- The custom races client is updated to Custom Races V2.
|
||||||
|
|
||||||
|
[Release](https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.13) · [Source changes](https://github.com/Corfirean/coa-server-manager/compare/v0.9.12...v0.9.13)
|
||||||
|
|
||||||
|
## 0.9.12 — 2026-11-14
|
||||||
|
|
||||||
|
- Settings for how much help bots get in dungeons and raids.
|
||||||
|
|
||||||
|
[Release](https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.12) · [Source changes](https://github.com/Corfirean/coa-server-manager/compare/v0.9.10...v0.9.12)
|
||||||
|
|
||||||
## 0.9.10 — 2026-11-08
|
## 0.9.10 — 2026-11-08
|
||||||
|
|
||||||
- Custom Races patch installation recovers from interrupted downloads.
|
- Custom Races patch installation recovers from interrupted downloads.
|
||||||
|
|||||||
Generated
+5
-4
@@ -586,7 +586,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "coa-core"
|
name = "coa-core"
|
||||||
version = "0.9.10"
|
version = "0.9.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -621,7 +621,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "coa-launcher"
|
name = "coa-launcher"
|
||||||
version = "0.9.10"
|
version = "0.9.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"coa-core",
|
"coa-core",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -644,7 +644,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "coa-release"
|
name = "coa-release"
|
||||||
version = "0.9.10"
|
version = "0.9.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"coa-core",
|
"coa-core",
|
||||||
@@ -653,7 +653,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "coa-server-manager"
|
name = "coa-server-manager"
|
||||||
version = "0.9.10"
|
version = "0.9.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"coa-control-proto",
|
"coa-control-proto",
|
||||||
"coa-core",
|
"coa-core",
|
||||||
@@ -668,6 +668,7 @@ dependencies = [
|
|||||||
"tauri-plugin-single-instance",
|
"tauri-plugin-single-instance",
|
||||||
"tauri-plugin-updater",
|
"tauri-plugin-updater",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ members = ["crates/coa-core", "crates/coa-launcher", "crates/coa-release", "crat
|
|||||||
exclude = ["services/coa-registry", "services/coa-registry-e2e", "services/coa-coordinator", "services/coa-relay"]
|
exclude = ["services/coa-registry", "services/coa-registry-e2e", "services/coa-coordinator", "services/coa-relay"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.9.10"
|
version = "0.9.14"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0-only"
|
license = "AGPL-3.0-only"
|
||||||
|
|
||||||
|
|||||||
+7247
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: added
|
||||||
|
audience: admins
|
||||||
|
title: Settings for how much help bots get in dungeons and raids
|
||||||
|
---
|
||||||
|
Bot damage, healing, damage taken and tank threat can now be tuned under Bots, Combat. Everything defaults to 1 (no change); a switch turns the extra help for four hard bosses on.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: added
|
||||||
|
audience: players
|
||||||
|
title: Install community addons from the Manager
|
||||||
|
---
|
||||||
|
The game client card lists SquidBots Lite, DragonUI, IncahootsCoA and CoACombat. Each comes from its author's GitHub at a pinned version, every file is checked before it goes into Interface/AddOns, and the Manager updates or removes only what it installed.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: added
|
||||||
|
audience: players
|
||||||
|
title: Old item and creature data is cleared before every Play
|
||||||
|
---
|
||||||
|
After a server update the game showed old names and stats from its own cache (Cache/WDB). Play now clears that cache first; it fills again within seconds. A switch next to the client graphics settings turns it off.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: fixed
|
||||||
|
audience: players
|
||||||
|
title: Turning the custom races client patch on or off takes seconds again
|
||||||
|
---
|
||||||
|
V2 has over 7,000 files and switching it could run for many minutes. Now only the files the game itself loads are hidden, and the rest stays in place. A switch that was cut short is undone safely.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: changed
|
||||||
|
audience: players
|
||||||
|
title: The custom races client is updated to Custom Races V2
|
||||||
|
---
|
||||||
|
The client update installs V2 and starts its own CoACustomRace.exe; Ascension.exe is left as it was. Four archives are the same as in 1.9.2, so a game folder that already had 1.9.2 downloads only the rest.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: fixed
|
||||||
|
audience: admins
|
||||||
|
title: The database moves to a free port when Windows reserves or another program takes 3307
|
||||||
|
---
|
||||||
|
Hyper-V, WSL and Docker can reserve a range that includes the database port; the start then waited 30 seconds and failed. The database now picks a free port and records it, and a reserved game port is named as such at once.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: added
|
||||||
|
audience: admins
|
||||||
|
title: Your own MySQL settings survive restarts and updates
|
||||||
|
---
|
||||||
|
Settings, Service has a MySQL settings box. Its options are added to my.ini at every start of the database; before, my.ini was rewritten and hand edits were lost. Port, addresses and data paths stay managed.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: fixed
|
||||||
|
audience: admins
|
||||||
|
title: Disabled custom races stay disabled after a server update that adds races
|
||||||
|
---
|
||||||
|
A race list saved before Custom Races V2 no longer matched V2's race catalog, and the server then ignored it and turned custom races off. Before a start the Manager now keeps the list when every disabled race kept its ID and name.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: added
|
||||||
|
audience: admins
|
||||||
|
title: Rename your realms in the Manager
|
||||||
|
---
|
||||||
|
Settings, Startup has a name for every realm. A running server shows it at once, the game client picks it on the next Play, and it stays after restarts and updates. Before, the launcher wrote the default name back at every start.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: fixed
|
||||||
|
audience: players
|
||||||
|
title: The account for a friend's server is in the login box at every Play
|
||||||
|
---
|
||||||
|
The account the Manager made on a listed server was filled in only when joining. Play now fills it in every time, also after another server's account was used.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: added
|
||||||
|
audience: admins
|
||||||
|
title: Restart the world every day at a chosen time
|
||||||
|
---
|
||||||
|
Settings, Startup, Scheduled restart: at that local time the world restarts with an in-game countdown and comes back by itself; the database keeps running. It works without the Manager open and needs a server with the new launcher.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: added
|
||||||
|
audience: admins
|
||||||
|
title: Switches for the Custom Races V2 subclasses, Hero Races and the /dev menu
|
||||||
|
---
|
||||||
|
The Custom Races settings now hold Subclasses and Hero Races (subclasses, the Thin Twins, the Two-Headed Ogre, two players per character) and the GM /dev menu, each with its own switch.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: added
|
||||||
|
audience: admins
|
||||||
|
title: Companion bots on Wildcard and Warcraft Reborn
|
||||||
|
---
|
||||||
|
With a server build that supports it, Companions can be switched on for Wildcard and Warcraft Reborn: bots get whole Wildcard archetypes or Reborn abilities by level, and bot creation survives a crash without duplicates.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: added
|
||||||
|
audience: admins
|
||||||
|
title: The Custom Races card tells which characters stay out while races are off
|
||||||
|
---
|
||||||
|
With custom races off, the card shows how many player characters and bots of custom races cannot enter the world, and offers to delete the companion bots of those races.
|
||||||
+25
-1
@@ -176,7 +176,9 @@
|
|||||||
"Corfirean/coa-server-manager:20261031-server-logging-controls.md",
|
"Corfirean/coa-server-manager:20261031-server-logging-controls.md",
|
||||||
"Corfirean/coa-server-manager:20261031-validation-bot-population.md",
|
"Corfirean/coa-server-manager:20261031-validation-bot-population.md",
|
||||||
"Corfirean/coa-server-manager:20261031-validation-mysql-reuse.md",
|
"Corfirean/coa-server-manager:20261031-validation-mysql-reuse.md",
|
||||||
"Corfirean/coa-server-manager:20261103-isolated-login-port.md"
|
"Corfirean/coa-server-manager:20261103-isolated-login-port.md",
|
||||||
|
"Corfirean/coa-server-manager:20261107-bot-strength-scaling-settings.md",
|
||||||
|
"Corfirean/coa-server-manager:20261115-custom-races-v2-client.md"
|
||||||
],
|
],
|
||||||
"releases": [
|
"releases": [
|
||||||
{
|
{
|
||||||
@@ -912,6 +914,28 @@
|
|||||||
],
|
],
|
||||||
"commit": "711f378ae82f75d3fc64368c042889c773315c54",
|
"commit": "711f378ae82f75d3fc64368c042889c773315c54",
|
||||||
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.9...v0.9.10"
|
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.9...v0.9.10"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "v0.9.12",
|
||||||
|
"version": "0.9.12",
|
||||||
|
"date": "2026-11-14",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.12",
|
||||||
|
"notes": [
|
||||||
|
"Settings for how much help bots get in dungeons and raids"
|
||||||
|
],
|
||||||
|
"commit": "d71c5635e3262a775b400a1c90ac81d7bddcbeaf",
|
||||||
|
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.10...v0.9.12"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "v0.9.13",
|
||||||
|
"version": "0.9.13",
|
||||||
|
"date": "2026-11-15",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.13",
|
||||||
|
"notes": [
|
||||||
|
"The custom races client is updated to Custom Races V2"
|
||||||
|
],
|
||||||
|
"commit": "d3527312803fb5a3e1cd48e01496645a8bbc9dcf",
|
||||||
|
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.12...v0.9.13"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,494 @@
|
|||||||
|
//! A catalog of game addons the Manager can install into a client's `Interface/AddOns`.
|
||||||
|
//!
|
||||||
|
//! Every addon is pinned to a commit of its GitHub repository; the catalog lists each file it installs with its
|
||||||
|
//! git blob SHA-1 and size, which are checked after download (GitHub's archives are not byte-stable, their
|
||||||
|
//! contents are). The Manager records what it installed in `Interface/AddOns/.coa-addons.json` and only ever
|
||||||
|
//! removes or replaces those folders; a folder of the same name that someone else put there is moved to
|
||||||
|
//! `Interface/AddOns/.coa-addons-backup` first.
|
||||||
|
|
||||||
|
use std::collections::BTreeMap;
|
||||||
|
use std::fs;
|
||||||
|
use std::io::{Read, Write};
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use sha1::{Digest, Sha1};
|
||||||
|
|
||||||
|
use crate::download::{Cancel, Transport};
|
||||||
|
use crate::error::{Error, Result};
|
||||||
|
use crate::fsx;
|
||||||
|
|
||||||
|
static CATALOG: &str = include_str!("../../../addons/catalog.json");
|
||||||
|
const STATE: &str = ".coa-addons.json";
|
||||||
|
const BACKUP: &str = ".coa-addons-backup";
|
||||||
|
/// No addon archive is anywhere near this; a larger answer is not what the catalog describes.
|
||||||
|
const MAX_ARCHIVE: u64 = 1 << 30;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
|
struct AddonFile {
|
||||||
|
path: String,
|
||||||
|
from: String,
|
||||||
|
sha1: String,
|
||||||
|
size: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
|
struct Entry {
|
||||||
|
id: String,
|
||||||
|
name: String,
|
||||||
|
description: BTreeMap<String, String>,
|
||||||
|
author: String,
|
||||||
|
license: String,
|
||||||
|
#[serde(default)]
|
||||||
|
needs: Option<String>,
|
||||||
|
repo: String,
|
||||||
|
commit: String,
|
||||||
|
archive: String,
|
||||||
|
folders: Vec<String>,
|
||||||
|
files: Vec<AddonFile>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct Catalog {
|
||||||
|
addons: Vec<Entry>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
|
||||||
|
struct Installed {
|
||||||
|
commit: String,
|
||||||
|
folders: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One addon of the catalog as the Manager shows it for a client.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct AddonView {
|
||||||
|
pub id: String,
|
||||||
|
pub name: String,
|
||||||
|
pub description: BTreeMap<String, String>,
|
||||||
|
pub author: String,
|
||||||
|
pub license: String,
|
||||||
|
/// A server module the addon is made for (`playerbots`), shown as a hint.
|
||||||
|
pub needs: Option<String>,
|
||||||
|
pub repo: String,
|
||||||
|
pub size: u64,
|
||||||
|
pub installed: bool,
|
||||||
|
pub update_available: bool,
|
||||||
|
/// Folders of this addon that are in the client but were not installed by the Manager.
|
||||||
|
pub foreign_folders: Vec<String>,
|
||||||
|
/// Installed by something else, shown so nobody looks for it twice: `custom-races` (the client patch).
|
||||||
|
pub bundled: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn catalog() -> Result<Vec<Entry>> {
|
||||||
|
let catalog: Catalog = serde_json::from_str(CATALOG)?;
|
||||||
|
for entry in &catalog.addons {
|
||||||
|
for folder in &entry.folders {
|
||||||
|
if folder.is_empty() || folder.contains(['/', '\\']) || folder.starts_with('.') {
|
||||||
|
return Err(Error::Invalid(format!("Invalid addon folder in the catalog: {folder}")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(catalog.addons)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn addons_dir(client: &Path) -> PathBuf {
|
||||||
|
client.join("Interface").join("AddOns")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_state(client: &Path) -> BTreeMap<String, Installed> {
|
||||||
|
fsx::read_json(&addons_dir(client).join(STATE)).unwrap_or_default()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_state(client: &Path, state: &BTreeMap<String, Installed>) -> Result<()> {
|
||||||
|
fsx::atomic_write_json(&addons_dir(client).join(STATE), state)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The catalog with what is installed in `client`.
|
||||||
|
pub fn list(client: &Path) -> Result<Vec<AddonView>> {
|
||||||
|
let state = read_state(client);
|
||||||
|
let dir = addons_dir(client);
|
||||||
|
let owned: Vec<&String> = state.values().flat_map(|i| i.folders.iter()).collect();
|
||||||
|
Ok(catalog()?
|
||||||
|
.into_iter()
|
||||||
|
.map(|entry| {
|
||||||
|
let installed = state.get(&entry.id);
|
||||||
|
AddonView {
|
||||||
|
foreign_folders: entry
|
||||||
|
.folders
|
||||||
|
.iter()
|
||||||
|
.filter(|f| dir.join(f).exists() && !owned.contains(f))
|
||||||
|
.cloned()
|
||||||
|
.collect(),
|
||||||
|
size: entry.files.iter().map(|f| f.size).sum(),
|
||||||
|
installed: installed.is_some(),
|
||||||
|
update_available: installed.is_some_and(|i| i.commit != entry.commit),
|
||||||
|
id: entry.id,
|
||||||
|
name: entry.name,
|
||||||
|
description: entry.description,
|
||||||
|
author: entry.author,
|
||||||
|
license: entry.license,
|
||||||
|
needs: entry.needs,
|
||||||
|
repo: entry.repo,
|
||||||
|
bundled: None,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.chain(std::iter::once(dev_menu(&dir)))
|
||||||
|
.collect())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The /dev menu addon of Custom Races V2: the client patch installs it and switches it with the patch.
|
||||||
|
fn dev_menu(dir: &Path) -> AddonView {
|
||||||
|
let mut description = BTreeMap::new();
|
||||||
|
for (lang, text) in [
|
||||||
|
("en", "The in-game /dev editor for game masters. It comes with the Custom Races V2 client patch and is switched with it."),
|
||||||
|
("ru", "Внутриигровой редактор /dev для гейм-мастеров. Ставится вместе с клиентским патчем Custom Races V2 и включается вместе с ним."),
|
||||||
|
("de", "Der /dev-Editor im Spiel für Spielleiter. Er kommt mit dem Client-Patch Custom Races V2 und wird mit ihm geschaltet."),
|
||||||
|
("fr", "L'éditeur /dev en jeu pour les maîtres du jeu. Il vient avec le patch client Custom Races V2 et s'active avec lui."),
|
||||||
|
("es", "El editor /dev del juego para los máster. Viene con el parche de cliente Custom Races V2 y se activa con él."),
|
||||||
|
("zh", "供游戏管理员使用的游戏内 /dev 编辑器。随 Custom Races V2 客户端补丁安装,并随补丁一起开关。"),
|
||||||
|
] {
|
||||||
|
description.insert(lang.to_string(), text.to_string());
|
||||||
|
}
|
||||||
|
AddonView {
|
||||||
|
id: "coa-dev-menu".into(),
|
||||||
|
name: "CoA Dev Menu".into(),
|
||||||
|
description,
|
||||||
|
author: "ilusixn".into(),
|
||||||
|
license: "see repository".into(),
|
||||||
|
needs: None,
|
||||||
|
repo: "https://github.com/ilusixn/ilusixn-dev-menu".into(),
|
||||||
|
size: 0,
|
||||||
|
installed: dir.join("CoA_DevMenu/CoA_DevMenu.toc").is_file(),
|
||||||
|
update_available: false,
|
||||||
|
foreign_folders: Vec::new(),
|
||||||
|
bundled: Some("custom-races".into()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The git blob id of `bytes` (what the catalog records for each file).
|
||||||
|
fn git_blob_sha1(bytes: &[u8]) -> String {
|
||||||
|
let mut hasher = Sha1::new();
|
||||||
|
hasher.update(format!("blob {}\0", bytes.len()).as_bytes());
|
||||||
|
hasher.update(bytes);
|
||||||
|
hex::encode(hasher.finalize())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn download(transport: &dyn Transport, url: &str, dest: &Path, cancel: &Cancel) -> Result<()> {
|
||||||
|
crate::download::check_url(url)?;
|
||||||
|
let reply = transport.get(url, 0).map_err(Error::Invalid)?;
|
||||||
|
if reply.status != 200 {
|
||||||
|
return Err(Error::Invalid(format!("The addon download answered HTTP {}.", reply.status)));
|
||||||
|
}
|
||||||
|
let mut body = reply.body.take(MAX_ARCHIVE + 1);
|
||||||
|
let mut file = fs::File::create(dest)?;
|
||||||
|
let mut buf = vec![0u8; 1 << 20];
|
||||||
|
let mut total = 0u64;
|
||||||
|
loop {
|
||||||
|
if cancel.is_set() {
|
||||||
|
return Err(Error::Invalid("Operation cancelled.".into()));
|
||||||
|
}
|
||||||
|
let n = body.read(&mut buf)?;
|
||||||
|
if n == 0 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
total += n as u64;
|
||||||
|
if total > MAX_ARCHIVE {
|
||||||
|
return Err(Error::Invalid("The addon download is larger than any catalog addon.".into()));
|
||||||
|
}
|
||||||
|
file.write_all(&buf[..n])?;
|
||||||
|
}
|
||||||
|
file.sync_all()?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Unpack the catalog's files of `entry` from `archive` into `staging`, checking every one.
|
||||||
|
fn unpack(entry: &Entry, archive: &Path, staging: &Path) -> Result<()> {
|
||||||
|
let mut zip = zip::ZipArchive::new(fs::File::open(archive)?)
|
||||||
|
.map_err(|e| Error::Invalid(format!("The addon download is not a zip archive: {e}")))?;
|
||||||
|
// GitHub archives hold everything under one top folder (`<repo>-<commit>/`).
|
||||||
|
let mut by_path = BTreeMap::new();
|
||||||
|
for index in 0..zip.len() {
|
||||||
|
let name = zip
|
||||||
|
.by_index(index)
|
||||||
|
.map_err(|e| Error::Invalid(e.to_string()))?
|
||||||
|
.name()
|
||||||
|
.replace('\\', "/");
|
||||||
|
if let Some((_, inner)) = name.split_once('/') {
|
||||||
|
by_path.insert(inner.to_string(), index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for file in &entry.files {
|
||||||
|
let index = *by_path
|
||||||
|
.get(&file.from)
|
||||||
|
.ok_or_else(|| Error::Invalid(format!("The addon download lacks {}.", file.from)))?;
|
||||||
|
let mut zipped = zip.by_index(index).map_err(|e| Error::Invalid(e.to_string()))?;
|
||||||
|
let mut bytes = Vec::with_capacity(file.size as usize);
|
||||||
|
zipped.by_ref().take(file.size + 1).read_to_end(&mut bytes)?;
|
||||||
|
if bytes.len() as u64 != file.size || git_blob_sha1(&bytes) != file.sha1 {
|
||||||
|
return Err(Error::Invalid(format!("{} failed verification.", file.from)));
|
||||||
|
}
|
||||||
|
let target = fsx::safe_join(staging, &file.path)?;
|
||||||
|
if let Some(parent) = target.parent() {
|
||||||
|
fs::create_dir_all(parent)?;
|
||||||
|
}
|
||||||
|
fs::write(target, bytes)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn stamp() -> String {
|
||||||
|
chrono::Local::now().format("%Y%m%d-%H%M%S").to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Install or update `id` in `client` from `transport`.
|
||||||
|
pub fn install_with(transport: &dyn Transport, client: &Path, id: &str, cancel: &Cancel) -> Result<Vec<AddonView>> {
|
||||||
|
if crate::client::is_running(client) {
|
||||||
|
return Err(Error::Invalid("Close the game before installing addons.".into()));
|
||||||
|
}
|
||||||
|
let entry = catalog()?
|
||||||
|
.into_iter()
|
||||||
|
.find(|e| e.id == id)
|
||||||
|
.ok_or_else(|| Error::Invalid(format!("Unknown addon {id}.")))?;
|
||||||
|
install_entry(transport, client, &entry, cancel)?;
|
||||||
|
list(client)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn install_entry(transport: &dyn Transport, client: &Path, entry: &Entry, cancel: &Cancel) -> Result<()> {
|
||||||
|
let dir = addons_dir(client);
|
||||||
|
fs::create_dir_all(&dir)?;
|
||||||
|
// Staged next to AddOns' own folders, so the final moves stay on one volume even for a linked AddOns.
|
||||||
|
let staging = tempfile::Builder::new().prefix(".coa-addon-").tempdir_in(&dir)?;
|
||||||
|
let archive = staging.path().join("archive.zip");
|
||||||
|
download(transport, &entry.archive, &archive, cancel)?;
|
||||||
|
let unpacked = staging.path().join("files");
|
||||||
|
unpack(entry, &archive, &unpacked)?;
|
||||||
|
if cancel.is_set() {
|
||||||
|
return Err(Error::Invalid("Operation cancelled.".into()));
|
||||||
|
}
|
||||||
|
let mut state = read_state(client);
|
||||||
|
let ours: Vec<String> = state.values().flat_map(|i| i.folders.clone()).collect();
|
||||||
|
// Move what is in the way out first, so a failed move leaves the client as it was.
|
||||||
|
let mut moved: Vec<(PathBuf, PathBuf)> = Vec::new();
|
||||||
|
let undo = |moved: &[(PathBuf, PathBuf)]| {
|
||||||
|
for (from, to) in moved.iter().rev() {
|
||||||
|
let _ = fs::rename(to, from);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
for folder in &entry.folders {
|
||||||
|
let target = dir.join(folder);
|
||||||
|
if !target.exists() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let aside = if ours.contains(folder) {
|
||||||
|
staging.path().join("old").join(folder)
|
||||||
|
} else {
|
||||||
|
dir.join(BACKUP).join(format!("{folder}-{}", stamp()))
|
||||||
|
};
|
||||||
|
if let Some(parent) = aside.parent() {
|
||||||
|
fs::create_dir_all(parent)?;
|
||||||
|
}
|
||||||
|
if let Err(e) = fs::rename(&target, &aside) {
|
||||||
|
undo(&moved);
|
||||||
|
return Err(Error::Invalid(format!("{folder} is in use and could not be replaced: {e}")));
|
||||||
|
}
|
||||||
|
moved.push((target, aside));
|
||||||
|
}
|
||||||
|
let mut placed: Vec<PathBuf> = Vec::new();
|
||||||
|
for folder in &entry.folders {
|
||||||
|
let target = dir.join(folder);
|
||||||
|
if let Err(e) = fs::rename(unpacked.join(folder), &target) {
|
||||||
|
for p in &placed {
|
||||||
|
let _ = fs::remove_dir_all(p);
|
||||||
|
}
|
||||||
|
undo(&moved);
|
||||||
|
return Err(Error::Invalid(format!("{folder} could not be installed: {e}")));
|
||||||
|
}
|
||||||
|
placed.push(target);
|
||||||
|
}
|
||||||
|
state.insert(
|
||||||
|
entry.id.clone(),
|
||||||
|
Installed {
|
||||||
|
commit: entry.commit.clone(),
|
||||||
|
folders: entry.folders.clone(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
write_state(client, &state)?;
|
||||||
|
tracing::info!(addon = %entry.id, commit = %entry.commit, "addon installed");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn install(client: &Path, id: &str, cancel: &Cancel) -> Result<Vec<AddonView>> {
|
||||||
|
install_with(&crate::download::HttpTransport::with_total_timeout(1800)?, client, id, cancel)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Remove an addon the Manager installed (only its recorded folders).
|
||||||
|
pub fn remove(client: &Path, id: &str) -> Result<Vec<AddonView>> {
|
||||||
|
if crate::client::is_running(client) {
|
||||||
|
return Err(Error::Invalid("Close the game before removing addons.".into()));
|
||||||
|
}
|
||||||
|
let mut state = read_state(client);
|
||||||
|
let Some(installed) = state.remove(id) else {
|
||||||
|
return list(client);
|
||||||
|
};
|
||||||
|
let dir = addons_dir(client);
|
||||||
|
for folder in &installed.folders {
|
||||||
|
if folder.is_empty() || folder.contains(['/', '\\']) || folder.starts_with('.') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let target = dir.join(folder);
|
||||||
|
if target.exists() {
|
||||||
|
fs::remove_dir_all(&target)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
write_state(client, &state)?;
|
||||||
|
list(client)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use crate::download::Reply;
|
||||||
|
|
||||||
|
struct Serve(Vec<u8>);
|
||||||
|
impl Transport for Serve {
|
||||||
|
fn get(&self, _: &str, _: u64) -> std::result::Result<Reply, String> {
|
||||||
|
Ok(Reply { status: 200, content_range: None, body: Box::new(std::io::Cursor::new(self.0.clone())) })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A GitHub-like archive of the catalog entry `id` with the given file bodies (path in repo -> bytes).
|
||||||
|
fn archive(entry: &Entry, body: &dyn Fn(&AddonFile) -> Vec<u8>) -> Vec<u8> {
|
||||||
|
let mut out = std::io::Cursor::new(Vec::new());
|
||||||
|
let mut zip = zip::ZipWriter::new(&mut out);
|
||||||
|
for file in &entry.files {
|
||||||
|
zip.start_file(format!("repo-{}/{}", entry.commit, file.from), zip::write::SimpleFileOptions::default())
|
||||||
|
.unwrap();
|
||||||
|
zip.write_all(&body(file)).unwrap();
|
||||||
|
}
|
||||||
|
zip.finish().unwrap();
|
||||||
|
out.into_inner()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A small catalog entry whose files hash to what the archive will hold.
|
||||||
|
fn small_entry() -> Entry {
|
||||||
|
let bytes = b"## Interface: 30300\n".to_vec();
|
||||||
|
Entry {
|
||||||
|
id: "t".into(),
|
||||||
|
name: "T".into(),
|
||||||
|
description: BTreeMap::new(),
|
||||||
|
author: "a".into(),
|
||||||
|
license: "x".into(),
|
||||||
|
needs: None,
|
||||||
|
repo: "r".into(),
|
||||||
|
commit: "c1".into(),
|
||||||
|
archive: "https://example.invalid/a.zip".into(),
|
||||||
|
folders: vec!["TestAddon".into()],
|
||||||
|
files: vec![AddonFile {
|
||||||
|
path: "TestAddon/TestAddon.toc".into(),
|
||||||
|
from: "TestAddon/TestAddon.toc".into(),
|
||||||
|
sha1: git_blob_sha1(&bytes),
|
||||||
|
size: bytes.len() as u64,
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn the_catalog_is_valid_and_pins_every_addon() {
|
||||||
|
let entries = catalog().unwrap();
|
||||||
|
assert!(entries.len() >= 4);
|
||||||
|
let views = list(Path::new("C:/no-such-client")).unwrap();
|
||||||
|
assert_eq!(views.iter().filter(|v| v.bundled.is_some()).count(), 1, "the dev menu is shown, not installable");
|
||||||
|
for e in &entries {
|
||||||
|
assert_eq!(e.commit.len(), 40, "{}", e.id);
|
||||||
|
assert!(e.archive.starts_with("https://codeload.github.com/") && e.archive.ends_with(&e.commit));
|
||||||
|
assert!(e.description.contains_key("en") && e.description.contains_key("ru"));
|
||||||
|
for folder in &e.folders {
|
||||||
|
assert!(e.files.iter().any(|f| f.path.eq_ignore_ascii_case(&format!("{folder}/{folder}.toc"))
|
||||||
|
|| f.path.starts_with(&format!("{folder}/")) && f.path.ends_with(".toc")), "{folder} has no toc");
|
||||||
|
}
|
||||||
|
for f in &e.files {
|
||||||
|
fsx::safe_join(Path::new("C:/x"), &f.path).unwrap();
|
||||||
|
assert!(e.folders.iter().any(|folder| f.path.starts_with(&format!("{folder}/"))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[ignore = "Downloads the catalog's small addons from GitHub"]
|
||||||
|
fn the_real_catalog_installs_from_github() {
|
||||||
|
let client = tempfile::tempdir().unwrap();
|
||||||
|
for id in ["incahoots", "coacombat", "squidbots-lite"] {
|
||||||
|
let views = install(client.path(), id, &Cancel::default()).unwrap();
|
||||||
|
let view = views.iter().find(|v| v.id == id).unwrap();
|
||||||
|
assert!(view.installed && !view.update_available, "{id}");
|
||||||
|
}
|
||||||
|
assert!(addons_dir(client.path()).join("IncahootsCoA/IncahootsCoA.toc").is_file());
|
||||||
|
assert!(addons_dir(client.path()).join("SquidBotsLite/SquidBotsLite.toc").is_file());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn git_blob_ids_match_git() {
|
||||||
|
// `printf 'hello\n' | git hash-object --stdin`
|
||||||
|
assert_eq!(git_blob_sha1(b"hello\n"), "ce013625030ba8dba906f756967f9e9ca394464a");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn unpack_and_place(entry: &Entry, client: &Path, bytes: Vec<u8>) -> Result<()> {
|
||||||
|
let dir = addons_dir(client);
|
||||||
|
fs::create_dir_all(&dir)?;
|
||||||
|
let staging = tempfile::tempdir_in(&dir)?;
|
||||||
|
let archive = staging.path().join("a.zip");
|
||||||
|
download(&Serve(bytes), &entry.archive, &archive, &Cancel::default())?;
|
||||||
|
unpack(entry, &archive, &staging.path().join("files"))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_tampered_or_incomplete_download_is_refused() {
|
||||||
|
let client = tempfile::tempdir().unwrap();
|
||||||
|
let entry = small_entry();
|
||||||
|
let good = archive(&entry, &|_| b"## Interface: 30300\n".to_vec());
|
||||||
|
unpack_and_place(&entry, client.path(), good).unwrap();
|
||||||
|
let bad = archive(&entry, &|_| b"## Interface: 30300 evil\n".to_vec());
|
||||||
|
assert!(unpack_and_place(&entry, client.path(), bad).unwrap_err().to_string().contains("verification"));
|
||||||
|
let empty = {
|
||||||
|
let mut out = std::io::Cursor::new(Vec::new());
|
||||||
|
zip::ZipWriter::new(&mut out).finish().unwrap();
|
||||||
|
out.into_inner()
|
||||||
|
};
|
||||||
|
assert!(unpack_and_place(&entry, client.path(), empty).unwrap_err().to_string().contains("lacks"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn install_update_and_remove_keep_other_folders() {
|
||||||
|
let client = tempfile::tempdir().unwrap();
|
||||||
|
let mut entry = small_entry();
|
||||||
|
let dir = addons_dir(client.path());
|
||||||
|
fs::create_dir_all(dir.join("TestAddon")).unwrap();
|
||||||
|
fs::write(dir.join("TestAddon/mine.lua"), b"player's own").unwrap();
|
||||||
|
fs::create_dir_all(dir.join("Other")).unwrap();
|
||||||
|
let serve = Serve(archive(&entry, &|_| b"## Interface: 30300
|
||||||
|
".to_vec()));
|
||||||
|
install_entry(&serve, client.path(), &entry, &Cancel::default()).unwrap();
|
||||||
|
assert!(dir.join("TestAddon/TestAddon.toc").is_file());
|
||||||
|
assert!(!dir.join("TestAddon/mine.lua").exists(), "the player's folder was set aside");
|
||||||
|
let backups: Vec<_> = fs::read_dir(dir.join(BACKUP)).unwrap().flatten().collect();
|
||||||
|
assert_eq!(backups.len(), 1);
|
||||||
|
assert!(backups[0].path().join("mine.lua").is_file());
|
||||||
|
assert_eq!(read_state(client.path())["t"].commit, "c1");
|
||||||
|
// An update replaces the Manager's own folder without another backup.
|
||||||
|
entry.commit = "c2".into();
|
||||||
|
install_entry(&serve, client.path(), &entry, &Cancel::default()).unwrap();
|
||||||
|
assert_eq!(read_state(client.path())["t"].commit, "c2");
|
||||||
|
assert_eq!(fs::read_dir(dir.join(BACKUP)).unwrap().count(), 1);
|
||||||
|
// A failed download changes nothing.
|
||||||
|
let broken = Serve(archive(&entry, &|_| b"tampered".to_vec()));
|
||||||
|
assert!(install_entry(&broken, client.path(), &entry, &Cancel::default()).is_err());
|
||||||
|
assert!(dir.join("TestAddon/TestAddon.toc").is_file());
|
||||||
|
remove(client.path(), "t").unwrap();
|
||||||
|
assert!(!dir.join("TestAddon").exists());
|
||||||
|
assert!(dir.join("Other").is_dir());
|
||||||
|
assert!(!read_state(client.path()).contains_key("t"));
|
||||||
|
// No leftover staging folders.
|
||||||
|
assert!(fs::read_dir(&dir).unwrap().flatten().all(|e| !e.file_name().to_string_lossy().starts_with(".coa-addon-")));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -308,7 +308,9 @@ pub fn with_database<T>(root: &Path, f: impl FnOnce(&Db) -> Result<T>) -> Result
|
|||||||
let db = Db::from_repack(root, Account::Admin)?;
|
let db = Db::from_repack(root, Account::Admin)?;
|
||||||
let observed = process::observe(root, &read_ports(root));
|
let observed = process::observe(root, &read_ports(root));
|
||||||
let mysql_was_up = observed.mysql.state == ServiceState::Running && db.ping();
|
let mysql_was_up = observed.mysql.state == ServiceState::Running && db.ping();
|
||||||
if !mysql_was_up {
|
let db = if mysql_was_up {
|
||||||
|
db
|
||||||
|
} else {
|
||||||
let out = driver::run(root, Verb::StartMysql)?;
|
let out = driver::run(root, Verb::StartMysql)?;
|
||||||
if !out.ok {
|
if !out.ok {
|
||||||
// Keep the launcher's own last lines: the title alone ("Something went wrong") hides the cause.
|
// Keep the launcher's own last lines: the title alone ("Something went wrong") hides the cause.
|
||||||
@@ -317,7 +319,9 @@ pub fn with_database<T>(root: &Path, f: impl FnOnce(&Db) -> Result<T>) -> Result
|
|||||||
driver::startup_failure(root, &out)
|
driver::startup_failure(root, &out)
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
}
|
// The start may have moved the database to another port (a reserved or taken one).
|
||||||
|
Db::from_repack(root, Account::Admin)?
|
||||||
|
};
|
||||||
let result = f(&db);
|
let result = f(&db);
|
||||||
if !mysql_was_up {
|
if !mysql_was_up {
|
||||||
let now = process::observe(root, &read_ports(root));
|
let now = process::observe(root, &read_ports(root));
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ use crate::fsx;
|
|||||||
pub use crate::glue_config;
|
pub use crate::glue_config;
|
||||||
|
|
||||||
pub const ADDON_NAME: &str = "CoABotUI";
|
pub const ADDON_NAME: &str = "CoABotUI";
|
||||||
const EXECUTABLES: [&str; 3] = ["Ascension.exe", "Wow.exe", "WoW.exe"];
|
// CoA Custom Races V2 ships its own client (CoACustomRace.exe) next to Ascension.exe and must be started instead.
|
||||||
|
const EXECUTABLES: [&str; 4] = ["CoACustomRace.exe", "Ascension.exe", "Wow.exe", "WoW.exe"];
|
||||||
|
|
||||||
pub fn is_running(client: &Path) -> bool {
|
pub fn is_running(client: &Path) -> bool {
|
||||||
if crate::platform::flavor() == crate::platform::Flavor::Docker {
|
if crate::platform::flavor() == crate::platform::Flavor::Docker {
|
||||||
@@ -71,13 +72,23 @@ fn realm_config(old: &[u8], realm: &str) -> Vec<u8> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn sync_realm(client: &Path, meta: &Path, mode: crate::realms::Mode) -> Result<bool> {
|
pub fn sync_realm(client: &Path, meta: &Path, mode: crate::realms::Mode) -> Result<bool> {
|
||||||
sync_realm_when_closed(client, meta, mode, is_running(client))
|
let realm = match mode {
|
||||||
|
crate::realms::Mode::Coa => "Conquest of Azeroth",
|
||||||
|
crate::realms::Mode::Wildcard => "Wildcard",
|
||||||
|
crate::realms::Mode::Reborn => "Warcraft Reborn",
|
||||||
|
};
|
||||||
|
sync_realm_when_closed(client, meta, realm, is_running(client))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [`sync_realm`] with the realm's name as the server shows it (the owner may have renamed it).
|
||||||
|
pub fn sync_realm_named(client: &Path, meta: &Path, realm: &str) -> Result<bool> {
|
||||||
|
sync_realm_when_closed(client, meta, realm, is_running(client))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sync_realm_when_closed(
|
fn sync_realm_when_closed(
|
||||||
client: &Path,
|
client: &Path,
|
||||||
meta: &Path,
|
meta: &Path,
|
||||||
mode: crate::realms::Mode,
|
realm: &str,
|
||||||
running: bool,
|
running: bool,
|
||||||
) -> Result<bool> {
|
) -> Result<bool> {
|
||||||
if running {
|
if running {
|
||||||
@@ -89,11 +100,6 @@ fn sync_realm_when_closed(
|
|||||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Vec::new(),
|
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Vec::new(),
|
||||||
Err(e) => return Err(e.into()),
|
Err(e) => return Err(e.into()),
|
||||||
};
|
};
|
||||||
let realm = match mode {
|
|
||||||
crate::realms::Mode::Coa => "Conquest of Azeroth",
|
|
||||||
crate::realms::Mode::Wildcard => "Wildcard",
|
|
||||||
crate::realms::Mode::Reborn => "Warcraft Reborn",
|
|
||||||
};
|
|
||||||
let new = realm_config(&old, realm);
|
let new = realm_config(&old, realm);
|
||||||
if new == old {
|
if new == old {
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
@@ -409,6 +415,38 @@ pub fn install_addon(client: &Path, meta: &Path, source: &Path) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Remove the game's cache of server data (`Cache/WDB/<locale>/*.wdb`: creatures, items, quests, pages). The client
|
||||||
|
/// keeps answers it got from a server; after the server's data changes they show old names and stats until the
|
||||||
|
/// cache is gone. Only `.wdb` files under `Cache/WDB` are removed. Returns how many.
|
||||||
|
pub fn clear_game_cache(client: &Path) -> Result<usize> {
|
||||||
|
if is_running(client) {
|
||||||
|
return Ok(0);
|
||||||
|
}
|
||||||
|
let root = client.join("Cache").join("WDB");
|
||||||
|
let mut removed = 0;
|
||||||
|
let Ok(locales) = fs::read_dir(&root) else {
|
||||||
|
return Ok(0);
|
||||||
|
};
|
||||||
|
for locale in locales.flatten() {
|
||||||
|
if !locale.file_type().is_ok_and(|t| t.is_dir()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let Ok(files) = fs::read_dir(locale.path()) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
for file in files.flatten() {
|
||||||
|
let path = file.path();
|
||||||
|
let is_wdb = path
|
||||||
|
.extension()
|
||||||
|
.is_some_and(|e| e.eq_ignore_ascii_case("wdb"));
|
||||||
|
if is_wdb && file.file_type().is_ok_and(|t| t.is_file()) && fs::remove_file(&path).is_ok() {
|
||||||
|
removed += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(removed)
|
||||||
|
}
|
||||||
|
|
||||||
/// Start the game client. The caller is responsible for making sure the server is ready first.
|
/// Start the game client. The caller is responsible for making sure the server is ready first.
|
||||||
pub fn launch(client: &Path) -> Result<u32> {
|
pub fn launch(client: &Path) -> Result<u32> {
|
||||||
let exe =
|
let exe =
|
||||||
@@ -607,6 +645,23 @@ pub fn recover_all_realmlist_overrides(meta_roots: &[PathBuf]) -> usize {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
#[test]
|
||||||
|
fn only_the_server_data_cache_is_cleared() {
|
||||||
|
let d = tempfile::tempdir().unwrap();
|
||||||
|
let wdb = d.path().join("Cache/WDB/enUS");
|
||||||
|
fs::create_dir_all(&wdb).unwrap();
|
||||||
|
fs::write(wdb.join("creaturecache.wdb"), b"x").unwrap();
|
||||||
|
fs::write(wdb.join("itemcache.WDB"), b"x").unwrap();
|
||||||
|
fs::write(wdb.join("notes.txt"), b"keep").unwrap();
|
||||||
|
fs::create_dir_all(d.path().join("Data/Retail/Cache")).unwrap();
|
||||||
|
fs::write(d.path().join("Data/Retail/Cache/id-1.bin"), b"keep").unwrap();
|
||||||
|
assert_eq!(clear_game_cache(d.path()).unwrap(), 2);
|
||||||
|
assert!(wdb.join("notes.txt").is_file());
|
||||||
|
assert!(d.path().join("Data/Retail/Cache/id-1.bin").is_file());
|
||||||
|
assert_eq!(clear_game_cache(d.path()).unwrap(), 0);
|
||||||
|
assert_eq!(clear_game_cache(&d.path().join("missing")).unwrap(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
#[test]
|
#[test]
|
||||||
@@ -677,10 +732,10 @@ mod tests {
|
|||||||
let meta = d.path().join("meta");
|
let meta = d.path().join("meta");
|
||||||
let original = b"SET realmName \"Wildcard\"\n";
|
let original = b"SET realmName \"Wildcard\"\n";
|
||||||
fs::write(c.join("WTF/Config.wtf"), original).unwrap();
|
fs::write(c.join("WTF/Config.wtf"), original).unwrap();
|
||||||
assert!(!sync_realm_when_closed(&c, &meta, crate::realms::Mode::Coa, true).unwrap());
|
assert!(!sync_realm_when_closed(&c, &meta, "Conquest of Azeroth", true).unwrap());
|
||||||
assert_eq!(fs::read(c.join("WTF/Config.wtf")).unwrap(), original);
|
assert_eq!(fs::read(c.join("WTF/Config.wtf")).unwrap(), original);
|
||||||
assert!(!backup_dir(&meta).exists());
|
assert!(!backup_dir(&meta).exists());
|
||||||
assert!(sync_realm_when_closed(&c, &meta, crate::realms::Mode::Coa, false).unwrap());
|
assert!(sync_realm_when_closed(&c, &meta, "Conquest of Azeroth", false).unwrap());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
fs::read(c.join("WTF/Config.wtf")).unwrap(),
|
fs::read(c.join("WTF/Config.wtf")).unwrap(),
|
||||||
b"SET realmName \"Conquest of Azeroth\"\n"
|
b"SET realmName \"Conquest of Azeroth\"\n"
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -14,14 +14,24 @@ use crate::download::Cancel;
|
|||||||
use crate::error::{Error, Result};
|
use crate::error::{Error, Result};
|
||||||
use crate::fsx;
|
use crate::fsx;
|
||||||
|
|
||||||
pub const CLIENT_VERSION: &str = "1.9.2";
|
pub const CLIENT_VERSION: &str = "2.0";
|
||||||
pub const MANIFEST_FILENAME: &str = "custom_races_patch_manifest.txt";
|
pub const MANIFEST_FILENAME: &str = "custom_races_patch_manifest.txt";
|
||||||
|
/// Files earlier releases installed that the current release no longer ships (removed on update).
|
||||||
|
#[cfg(test)]
|
||||||
|
const RETIRED_FILES: &[&str] = &["Ascension.exe"];
|
||||||
|
/// The client archives of the coa-custom-2.0 release. The server archive is read only for its client
|
||||||
|
/// addons (files/addons: subclass interface, dev menu, teleports, spell activation overlay).
|
||||||
pub const ARCHIVES: &[(&str, &str)] = &[
|
pub const ARCHIVES: &[(&str, &str)] = &[
|
||||||
("CoA-Custom-1.9.2-Client-1.zip", "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-1.zip"),
|
("CoA-Custom-V2-Client-1.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-1.zip"),
|
||||||
("CoA-Custom-1.9.2-Client-2.zip", "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-2.zip"),
|
("CoA-Custom-V2-Client-2.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-2.zip"),
|
||||||
("CoA-Custom-1.9.2-Client-3.zip", "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-3.zip"),
|
("CoA-Custom-V2-Client-3.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-3.zip"),
|
||||||
("CoA-Custom-1.9.2-Client-4.zip", "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-4.zip"),
|
("CoA-Custom-V2-Client-4.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-4.zip"),
|
||||||
("CoA-Custom-1.9.2-Client-5.zip", "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-5.zip"),
|
("CoA-Custom-V2-Client-5.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-5.zip"),
|
||||||
|
("CoA-Custom-V2-Client-6.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-6.zip"),
|
||||||
|
("CoA-Custom-V2-Client-7.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-7.zip"),
|
||||||
|
("CoA-Custom-V2-Client-8.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-8.zip"),
|
||||||
|
("CoA-Custom-V2-Client-9.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-9.zip"),
|
||||||
|
("CoA-Custom-V2-Server.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Server.zip"),
|
||||||
];
|
];
|
||||||
|
|
||||||
pub const RACE_MPQS: &[&str] = &[
|
pub const RACE_MPQS: &[&str] = &[
|
||||||
@@ -35,14 +45,29 @@ pub const RACE_MPQS: &[&str] = &[
|
|||||||
"patch-ZE8.MPQ",
|
"patch-ZE8.MPQ",
|
||||||
"patch-ZE9.MPQ",
|
"patch-ZE9.MPQ",
|
||||||
"patch-ZEA.MPQ",
|
"patch-ZEA.MPQ",
|
||||||
|
"patch-ZES.MPQ",
|
||||||
|
"patch-ZEZV.MPQ",
|
||||||
|
"patch-ZEZW.MPQ",
|
||||||
|
"patch-ZEZX.MPQ",
|
||||||
|
"patch-ZEZY.MPQ",
|
||||||
|
"patch-ZEZZ.MPQ",
|
||||||
|
"patch-ZEZZA.MPQ",
|
||||||
|
"patch-ZEZZB.MPQ",
|
||||||
|
"patch-ZEZZC.MPQ",
|
||||||
|
"patch-ZEZZD.MPQ",
|
||||||
|
"patch-ZEZZE.MPQ",
|
||||||
|
"patch-ZEZZF.MPQ",
|
||||||
|
"patch-ZEZZG.MPQ",
|
||||||
|
"patch-ZEZZH.MPQ",
|
||||||
|
"patch-ZEZZI.MPQ",
|
||||||
"patch-ZG.MPQ",
|
"patch-ZG.MPQ",
|
||||||
"patch-ZH.MPQ",
|
"patch-ZH.MPQ",
|
||||||
"patch-ZHA.MPQ",
|
"patch-ZHA.MPQ",
|
||||||
"patch-ZHM.MPQ",
|
"patch-ZHM.MPQ",
|
||||||
|
"patch-ZJ.MPQ",
|
||||||
|
"patch-ZK.MPQ",
|
||||||
"patch-ZM.MPQ",
|
"patch-ZM.MPQ",
|
||||||
"patch-ZVU.MPQ",
|
"patch-ZVU.MPQ",
|
||||||
"patch-ZES.MPQ",
|
|
||||||
"patch-ZJ.MPQ",
|
|
||||||
"patch-ZZE.MPQ",
|
"patch-ZZE.MPQ",
|
||||||
"patch-ZZR.MPQ",
|
"patch-ZZR.MPQ",
|
||||||
"patch-ZZS.MPQ",
|
"patch-ZZS.MPQ",
|
||||||
@@ -50,26 +75,187 @@ pub const RACE_MPQS: &[&str] = &[
|
|||||||
"patch-ZZU.MPQ",
|
"patch-ZZU.MPQ",
|
||||||
"patch-ZZV.MPQ",
|
"patch-ZZV.MPQ",
|
||||||
"patch-ZZW.MPQ",
|
"patch-ZZW.MPQ",
|
||||||
"patch-ZZZ.MPQ",
|
|
||||||
"patch-ZK.MPQ",
|
|
||||||
"patch-ZZX.MPQ",
|
"patch-ZZX.MPQ",
|
||||||
|
"patch-ZZZ.MPQ",
|
||||||
|
"patch-ZZZA.MPQ",
|
||||||
"patch-ZZZC.MPQ",
|
"patch-ZZZC.MPQ",
|
||||||
"patch-ZZZD.MPQ",
|
"patch-ZZZD.MPQ",
|
||||||
"patch-ZZZA.MPQ",
|
|
||||||
"patch-ZZZE.MPQ",
|
"patch-ZZZE.MPQ",
|
||||||
"patch-ZZZF.MPQ",
|
"patch-ZZZF.MPQ",
|
||||||
|
"patch-ZZZG.MPQ",
|
||||||
"patch-ZZZZ.MPQ",
|
"patch-ZZZZ.MPQ",
|
||||||
|
"patch-ZZZZA.MPQ",
|
||||||
|
"patch-ZZZZB.MPQ",
|
||||||
|
"patch-ZZZZC.MPQ",
|
||||||
|
"patch-ZZZZD.MPQ",
|
||||||
|
"patch-ZZZZE.MPQ",
|
||||||
|
"patch-ZZZZS.MPQ",
|
||||||
|
"patch-ZZZZT.MPQ",
|
||||||
|
"patch-ZZZZW.MPQ",
|
||||||
|
"patch-ZZZZX.MPQ",
|
||||||
|
"patch-ZZZZY.MPQ",
|
||||||
|
"patch-ZZZZZ.MPQ",
|
||||||
|
"patch-ZZZZZA.MPQ",
|
||||||
|
"patch-ZZZZZB.MPQ",
|
||||||
|
"patch-ZZZZZC.MPQ",
|
||||||
|
"patch-ZZZZZM.MPQ",
|
||||||
|
"patch-ZZZZZN.MPQ",
|
||||||
|
"patch-ZZZZZO.MPQ",
|
||||||
|
"patch-ZZZZZP.MPQ",
|
||||||
|
"patch-ZZZZZQ.MPQ",
|
||||||
|
"patch-ZZZZZR.MPQ",
|
||||||
|
"patch-ZZZZZS.MPQ",
|
||||||
|
"patch-ZZZZZT.MPQ",
|
||||||
|
"patch-ZZZZZU.MPQ",
|
||||||
|
"patch-ZZZZZV.MPQ",
|
||||||
|
"patch-ZZZZZW.MPQ",
|
||||||
|
"patch-ZZZZZX.MPQ",
|
||||||
|
"patch-ZZZZZY.MPQ",
|
||||||
];
|
];
|
||||||
|
|
||||||
pub const RACE_ADDONS: &[&str] = &[
|
pub const RACE_ADDONS: &[&str] = &[
|
||||||
|
"Ascension_Subclass/Ascension_Subclass.lua",
|
||||||
|
"Ascension_Subclass/Ascension_Subclass.toc",
|
||||||
|
"Ascension_Subclass/Bindings.xml",
|
||||||
|
"Ascension_Subclass/SubclassBar.lua",
|
||||||
|
"Ascension_Subclass/SubclassCastBar.lua",
|
||||||
|
"Ascension_Subclass/SubclassChoices.lua",
|
||||||
|
"Ascension_Subclass/SubclassGlow.lua",
|
||||||
|
"Ascension_Subclass/SubclassNodes.lua",
|
||||||
|
"Ascension_Subclass/SubclassOrbs.lua",
|
||||||
|
"Ascension_Subclass/SubclassPowerBar.lua",
|
||||||
|
"Ascension_Subclass/SubclassRaceBackground.lua",
|
||||||
|
"CoAHideArmor/CoAHideArmor.lua",
|
||||||
|
"CoAHideArmor/CoAHideArmor.toc",
|
||||||
"CoAQuestSafe/CoAQuestSafe.lua",
|
"CoAQuestSafe/CoAQuestSafe.lua",
|
||||||
"CoAQuestSafe/CoAQuestSafe.toc",
|
"CoAQuestSafe/CoAQuestSafe.toc",
|
||||||
"CoAWC2Cursor/CoAWC2Cursor.lua",
|
"CoAWC2Cursor/CoAWC2Cursor.lua",
|
||||||
"CoAWC2Cursor/CoAWC2Cursor.toc",
|
"CoAWC2Cursor/CoAWC2Cursor.toc",
|
||||||
"CoAHideArmor/CoAHideArmor.lua",
|
"CoA_DevMenu/CoA_DevMenu.lua",
|
||||||
"CoAHideArmor/CoAHideArmor.toc",
|
"CoA_DevMenu/CoA_DevMenu.lua.before_v2",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu.lua.before_v3",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu.toc",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_CoA.lua",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_Combat.lua",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_Create.lua",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_Create.lua.before_v4",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_Create.lua.before_v5",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_Ext.lua",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_Ext.lua.before_v3",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_Ext.lua.before_v4",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_Help.lua",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_Items.lua",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_Me.lua",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_Server.lua",
|
||||||
|
"CoA_DevMenu/CoA_DevMenu_Share.lua",
|
||||||
|
"CoA_DevMenu/EmoteData.lua",
|
||||||
"CoA_TalentReset/CoA_TalentReset.lua",
|
"CoA_TalentReset/CoA_TalentReset.lua",
|
||||||
"CoA_TalentReset/CoA_TalentReset.toc",
|
"CoA_TalentReset/CoA_TalentReset.toc",
|
||||||
|
"CoA_Teleports/CoA_Teleports.lua",
|
||||||
|
"CoA_Teleports/CoA_Teleports.toc",
|
||||||
|
"CoA_Teleports/TeleportData.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/LICENSE",
|
||||||
|
"SpellActivationOverlay-for-CoA/SpellActivationOverlay-for-CoA.toc",
|
||||||
|
"SpellActivationOverlay-for-CoA/SpellActivationOverlay.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/SpellActivationOverlay.xml",
|
||||||
|
"SpellActivationOverlay-for-CoA/changelog.md",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/barbarian.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/bloodmage.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/chronomancer.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/common.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/cultist.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/deathknight.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/druid.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/felsworn.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/guardian.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/hunter.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/knightofxoroth.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/mage.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/monk.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/necromancer.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/paladin.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/priest.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/primalist.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/pyromancer.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/ranger.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/reaper.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/rogue.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/runemaster.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/shaman.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/starcaller.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/stormbringer.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/suncleric.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/templar.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/tinker.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/venomancer.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/warlock.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/warrior.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/witchdoctor.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/classes/witchhunter.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/aura.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/bucket.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/display.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/effect.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/events.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/external.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/glow.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/hash.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/item.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/overlay.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/project.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/rune.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/shutdown.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/sound.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/spell.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/targetspells.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/targetwatch.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/tr.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/trigger.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/util.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/components/variable.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/libs/LibActionButton-1.0/LibActionButton-1.0.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/libs/LibActionButton-1.0/LibActionButton-1.0.toc",
|
||||||
|
"SpellActivationOverlay-for-CoA/libs/LibButtonGlow-1.0/LibButtonGlow-1.0.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/libs/LibButtonGlow-1.0/LibButtonGlow-1.0.toc",
|
||||||
|
"SpellActivationOverlay-for-CoA/libs/LibStub/LibStub.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/libs/LibStub/LibStub.toc",
|
||||||
|
"SpellActivationOverlay-for-CoA/options/InterfaceOptionsPanels.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/options/InterfaceOptionsPanels.xml",
|
||||||
|
"SpellActivationOverlay-for-CoA/options/classoptions.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/options/db.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/options/defaults.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/options/glowoptions.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/options/overlayoptions.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/options/questions.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/options/variables.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/options/variants.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/bandits_guile.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/eclipse_moon.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/eclipse_sun.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/fury_of_stormrage_yellow.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/high_tide.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/icon64.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/maelstrom_weapon_1.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/maelstrom_weapon_2.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/maelstrom_weapon_3.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/maelstrom_weapon_4.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/mask.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/maskzero.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/rkm128.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/texname.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/thrill_of_the_hunt_1.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/thrill_of_the_hunt_2.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/textures/thrill_of_the_hunt_3.blp",
|
||||||
|
"SpellActivationOverlay-for-CoA/variables/actionusable.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/variables/aurastacks.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/variables/custom.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/variables/execute.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/variables/holypower.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/variables/itemset.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/variables/nativesao.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/variables/stance.lua",
|
||||||
|
"SpellActivationOverlay-for-CoA/variables/talent.lua",
|
||||||
|
"UnBot/OnlineFrame.xml",
|
||||||
];
|
];
|
||||||
|
|
||||||
pub const EXCLUDED_BOT_RACES_RECOMMENDED: &str =
|
pub const EXCLUDED_BOT_RACES_RECOMMENDED: &str =
|
||||||
@@ -217,6 +403,8 @@ fn patch_files(client: &Path) -> Result<Vec<PatchFile>> {
|
|||||||
include_str!("custom_races_hashes_1_8_3.json")
|
include_str!("custom_races_hashes_1_8_3.json")
|
||||||
} else if manifest.lines().any(|line| line == "# CoA Custom 1.9.1") {
|
} else if manifest.lines().any(|line| line == "# CoA Custom 1.9.1") {
|
||||||
include_str!("custom_races_hashes_1_9_1.json")
|
include_str!("custom_races_hashes_1_9_1.json")
|
||||||
|
} else if manifest.lines().any(|line| line == "# CoA Custom 1.9.2") {
|
||||||
|
include_str!("custom_races_hashes_1_9_2.json")
|
||||||
} else {
|
} else {
|
||||||
include_str!("custom_races_hashes.json")
|
include_str!("custom_races_hashes.json")
|
||||||
};
|
};
|
||||||
@@ -275,8 +463,96 @@ fn suffix(path: &Path, extension: &str) -> PathBuf {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// SHA-256 of a payload file, remembered for this run of the Manager. V2 is 8.7 GB, and every status check and
|
||||||
|
/// switch verifies all of it; a rename keeps size, creation and write time, while a replaced file changes them.
|
||||||
|
fn cached_sha256(path: &Path) -> Option<String> {
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::sync::{Mutex, OnceLock};
|
||||||
|
use std::time::UNIX_EPOCH;
|
||||||
|
static HASHES: OnceLock<Mutex<HashMap<(String, u64, u128, u128), String>>> = OnceLock::new();
|
||||||
|
let meta = fs::metadata(path).ok()?;
|
||||||
|
let nanos = |time: io::Result<std::time::SystemTime>| {
|
||||||
|
time.ok()
|
||||||
|
.and_then(|t| t.duration_since(UNIX_EPOCH).ok())
|
||||||
|
.map(|d| d.as_nanos())
|
||||||
|
};
|
||||||
|
// The name without `.disabled`: switching renames only that suffix.
|
||||||
|
let name = path.file_name()?.to_string_lossy().to_ascii_lowercase();
|
||||||
|
let name = name.strip_suffix(".disabled").unwrap_or(&name).to_string();
|
||||||
|
let key = match (nanos(meta.modified()), nanos(meta.created())) {
|
||||||
|
(Some(modified), Some(created)) => Some((name, meta.len(), modified, created)),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
let hashes = HASHES.get_or_init(Mutex::default);
|
||||||
|
if let Some(hash) = key.as_ref().and_then(|key| hashes.lock().ok()?.get(key).cloned()) {
|
||||||
|
return Some(hash);
|
||||||
|
}
|
||||||
|
let hash = fsx::sha256_file(path).ok()?;
|
||||||
|
if let (Some(key), Ok(mut hashes)) = (key, hashes.lock()) {
|
||||||
|
hashes.insert(key, hash.clone());
|
||||||
|
}
|
||||||
|
Some(hash)
|
||||||
|
}
|
||||||
|
|
||||||
fn matches_patch(path: &Path, file: &PatchFile) -> bool {
|
fn matches_patch(path: &Path, file: &PatchFile) -> bool {
|
||||||
path.is_file() && fsx::sha256_file(path).is_ok_and(|hash| hash == file.sha256)
|
path.is_file() && cached_sha256(path).is_some_and(|hash| hash == file.sha256)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Whether disabling the patch must hide this file. The stock client loads only the MPQs in Data,
|
||||||
|
/// dinput8.dll and the addons; the rest (Data/Retail, VulkanShaders, the Esteria data files) is read by the
|
||||||
|
/// custom races executable and its libraries alone, so it stays in place: thousands of renames bought nothing.
|
||||||
|
/// A file that replaced one of the player's own (an `.original` exists) is always switched.
|
||||||
|
fn is_switched(client: &Path, file: &PatchFile) -> bool {
|
||||||
|
let lower = file.path.to_ascii_lowercase();
|
||||||
|
let entry_point = lower.starts_with("interface/addons/")
|
||||||
|
|| lower
|
||||||
|
.strip_prefix("data/")
|
||||||
|
.is_some_and(|name| !name.contains('/') && name.ends_with(".mpq"))
|
||||||
|
|| (!lower.contains('/')
|
||||||
|
&& [".dll", ".exe", ".bat"]
|
||||||
|
.iter()
|
||||||
|
.any(|extension| lower.ends_with(extension)));
|
||||||
|
entry_point || suffix(&client.join(&file.path), "original").is_file()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Characters of custom races (RaceID above 11) on the active realm: a game client without the client patch
|
||||||
|
/// crashes when one of them comes into view, so the server keeps them out of the world while custom races are
|
||||||
|
/// off. `None` when the database is not running.
|
||||||
|
#[derive(Debug, Clone, Copy, Serialize, PartialEq, Eq)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct CustomRaceCharacters {
|
||||||
|
pub players: u32,
|
||||||
|
pub companion_bots: u32,
|
||||||
|
pub squid_bots: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn custom_race_characters(root: &Path) -> Result<Option<CustomRaceCharacters>> {
|
||||||
|
let squid = crate::accounts::squid_bot_prefix(root);
|
||||||
|
let characters = crate::realms::state(root)
|
||||||
|
.map(|s| s.active)
|
||||||
|
.unwrap_or_default()
|
||||||
|
.schema("characters")?;
|
||||||
|
crate::backup::with_running_database(root, |db| {
|
||||||
|
let out = db.query(&format!(
|
||||||
|
"SELECT \
|
||||||
|
IFNULL(SUM(a.username NOT LIKE 'COABOTHOST%' AND a.username NOT LIKE '{squid}%'), 0), \
|
||||||
|
IFNULL(SUM(a.username LIKE 'COABOTHOST%'), 0), \
|
||||||
|
IFNULL(SUM(a.username LIKE '{squid}%'), 0) \
|
||||||
|
FROM {characters}.characters c JOIN acore_auth.account a ON a.id = c.account WHERE c.race > 11;"
|
||||||
|
))?;
|
||||||
|
let numbers: Vec<u32> = out
|
||||||
|
.lines()
|
||||||
|
.last()
|
||||||
|
.unwrap_or("")
|
||||||
|
.split('\t')
|
||||||
|
.map(|n| n.trim().parse().unwrap_or(0))
|
||||||
|
.collect();
|
||||||
|
Ok(CustomRaceCharacters {
|
||||||
|
players: numbers.first().copied().unwrap_or(0),
|
||||||
|
companion_bots: numbers.get(1).copied().unwrap_or(0),
|
||||||
|
squid_bots: numbers.get(2).copied().unwrap_or(0),
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Only complete, verified payloads are reported as enabled or disabled.
|
/// Only complete, verified payloads are reported as enabled or disabled.
|
||||||
@@ -307,9 +583,11 @@ pub fn client_patch_status(client_path: &Path) -> ClientPatchStatus {
|
|||||||
ClientPatchState::Enabled
|
ClientPatchState::Enabled
|
||||||
}
|
}
|
||||||
Ok(files)
|
Ok(files)
|
||||||
if files
|
if files.iter().all(|f| {
|
||||||
.iter()
|
let active = client_path.join(&f.path);
|
||||||
.all(|f| matches_patch(&suffix(&client_path.join(&f.path), "disabled"), f)) =>
|
matches_patch(&suffix(&active, "disabled"), f)
|
||||||
|
|| (!is_switched(client_path, f) && matches_patch(&active, f))
|
||||||
|
}) =>
|
||||||
{
|
{
|
||||||
ClientPatchState::Disabled
|
ClientPatchState::Disabled
|
||||||
}
|
}
|
||||||
@@ -351,9 +629,24 @@ struct SavedFile {
|
|||||||
moved_to: Option<String>,
|
moved_to: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// One line of the append-only journal. A payload has thousands of files, so the journal is never rewritten:
|
||||||
|
/// each step adds one synced line, and recovery replays the lines in order.
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
enum JournalRecord {
|
||||||
|
Saved { path: String, existed: bool },
|
||||||
|
Moved { index: usize, to: String },
|
||||||
|
Returned { index: usize },
|
||||||
|
}
|
||||||
|
|
||||||
|
const LEGACY_JOURNAL: &str = "journal.json";
|
||||||
|
const JOURNAL: &str = "journal.jsonl";
|
||||||
|
|
||||||
struct PatchTransaction<'a> {
|
struct PatchTransaction<'a> {
|
||||||
root: &'a Path,
|
root: &'a Path,
|
||||||
entries: Vec<SavedFile>,
|
entries: Vec<SavedFile>,
|
||||||
|
index: std::collections::HashMap<String, usize>,
|
||||||
|
journal: Option<File>,
|
||||||
finished: bool,
|
finished: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,37 +669,102 @@ fn move_patch_file(source: &Path, target: &Path) -> io::Result<()> {
|
|||||||
fs::remove_file(source)
|
fs::remove_file(source)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn append_record(journal: &mut File, record: &JournalRecord) -> Result<()> {
|
||||||
|
use std::io::Write;
|
||||||
|
let mut line = serde_json::to_vec(record)?;
|
||||||
|
line.push(b'\n');
|
||||||
|
journal.write_all(&line)?;
|
||||||
|
journal.sync_data()?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Replays a journal. A line cut short by a crash is the last one and was never followed by its file
|
||||||
|
/// operation (each line is synced before the operation it describes), so reading stops there.
|
||||||
|
fn read_journal(directory: &Path) -> Result<Vec<SavedFile>> {
|
||||||
|
let legacy = directory.join(LEGACY_JOURNAL);
|
||||||
|
if legacy.is_file() {
|
||||||
|
return fsx::read_json(&legacy);
|
||||||
|
}
|
||||||
|
let bytes = match fs::read(directory.join(JOURNAL)) {
|
||||||
|
Ok(bytes) => bytes,
|
||||||
|
Err(error) if error.kind() == io::ErrorKind::NotFound => return Ok(Vec::new()),
|
||||||
|
Err(error) => return Err(error.into()),
|
||||||
|
};
|
||||||
|
let mut entries: Vec<SavedFile> = Vec::new();
|
||||||
|
for line in bytes.split(|byte| *byte == b'\n') {
|
||||||
|
let Ok(record) = serde_json::from_slice::<JournalRecord>(line) else {
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
match record {
|
||||||
|
JournalRecord::Saved { path, existed } => entries.push(SavedFile {
|
||||||
|
path,
|
||||||
|
existed,
|
||||||
|
moved_to: None,
|
||||||
|
}),
|
||||||
|
JournalRecord::Moved { index, to } => {
|
||||||
|
let entry = entries
|
||||||
|
.get_mut(index)
|
||||||
|
.ok_or_else(|| Error::Invalid("Invalid custom races journal.".into()))?;
|
||||||
|
entry.moved_to = Some(to);
|
||||||
|
}
|
||||||
|
JournalRecord::Returned { index } => {
|
||||||
|
let entry = entries
|
||||||
|
.get_mut(index)
|
||||||
|
.ok_or_else(|| Error::Invalid("Invalid custom races journal.".into()))?;
|
||||||
|
entry.moved_to = None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(entries)
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a> PatchTransaction<'a> {
|
impl<'a> PatchTransaction<'a> {
|
||||||
fn new(root: &'a Path) -> Result<Self> {
|
fn new(root: &'a Path) -> Result<Self> {
|
||||||
recover_patch_transaction(root)?;
|
recover_patch_transaction(root)?;
|
||||||
fs::create_dir(root.join(".coa-races-transaction"))?;
|
let directory = root.join(".coa-races-transaction");
|
||||||
|
fs::create_dir(&directory)?;
|
||||||
|
let journal = fs::OpenOptions::new()
|
||||||
|
.create_new(true)
|
||||||
|
.append(true)
|
||||||
|
.open(directory.join(JOURNAL))?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
root,
|
root,
|
||||||
entries: Vec::new(),
|
entries: Vec::new(),
|
||||||
|
index: std::collections::HashMap::new(),
|
||||||
|
journal: Some(journal),
|
||||||
finished: false,
|
finished: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn save(&mut self, path: &Path) -> Result<()> {
|
fn relative(&self, path: &Path) -> Result<String> {
|
||||||
let relative = path
|
let relative = path
|
||||||
.strip_prefix(self.root)
|
.strip_prefix(self.root)
|
||||||
.map_err(|_| Error::Invalid("Patch path escaped the client directory.".into()))?
|
.map_err(|_| Error::Invalid("Patch path escaped the client directory.".into()))?
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.replace('\\', "/");
|
.replace('\\', "/");
|
||||||
fsx::safe_join(self.root, &relative)?;
|
fsx::safe_join(self.root, &relative)?;
|
||||||
if self.entries.iter().any(|entry| entry.path == relative) {
|
Ok(relative)
|
||||||
|
}
|
||||||
|
fn save(&mut self, path: &Path) -> Result<()> {
|
||||||
|
let relative = self.relative(path)?;
|
||||||
|
if self.index.contains_key(&relative) {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
let index = self.entries.len();
|
let index = self.entries.len();
|
||||||
|
let existed = path.is_file();
|
||||||
|
append_record(
|
||||||
|
self.journal.as_mut().expect("open journal"),
|
||||||
|
&JournalRecord::Saved {
|
||||||
|
path: relative.clone(),
|
||||||
|
existed,
|
||||||
|
},
|
||||||
|
)?;
|
||||||
|
self.index.insert(relative.clone(), index);
|
||||||
self.entries.push(SavedFile {
|
self.entries.push(SavedFile {
|
||||||
path: relative,
|
path: relative,
|
||||||
existed: path.is_file(),
|
existed,
|
||||||
moved_to: None,
|
moved_to: None,
|
||||||
});
|
});
|
||||||
fsx::atomic_write_json(
|
if existed {
|
||||||
&self.root.join(".coa-races-transaction/journal.json"),
|
|
||||||
&self.entries,
|
|
||||||
)?;
|
|
||||||
if path.is_file() {
|
|
||||||
move_patch_file(
|
move_patch_file(
|
||||||
path,
|
path,
|
||||||
&self
|
&self
|
||||||
@@ -431,21 +789,16 @@ impl<'a> PatchTransaction<'a> {
|
|||||||
// Save the destination first so recovery restores the moved source before it.
|
// Save the destination first so recovery restores the moved source before it.
|
||||||
self.save(target)?;
|
self.save(target)?;
|
||||||
self.save(source)?;
|
self.save(source)?;
|
||||||
let index = self
|
let index = self.index[&self.relative(source)?];
|
||||||
.entries
|
let relative = self.relative(target)?;
|
||||||
.iter()
|
append_record(
|
||||||
.position(|entry| self.root.join(&entry.path) == source)
|
self.journal.as_mut().expect("open journal"),
|
||||||
.unwrap();
|
&JournalRecord::Moved {
|
||||||
let relative = target
|
index,
|
||||||
.strip_prefix(self.root)
|
to: relative.clone(),
|
||||||
.map_err(|_| Error::Invalid("Patch path escaped the client directory.".into()))?
|
},
|
||||||
.to_string_lossy()
|
|
||||||
.replace('\\', "/");
|
|
||||||
self.entries[index].moved_to = Some(relative);
|
|
||||||
fsx::atomic_write_json(
|
|
||||||
&self.root.join(".coa-races-transaction/journal.json"),
|
|
||||||
&self.entries,
|
|
||||||
)?;
|
)?;
|
||||||
|
self.entries[index].moved_to = Some(relative);
|
||||||
fs::create_dir_all(target.parent().unwrap())?;
|
fs::create_dir_all(target.parent().unwrap())?;
|
||||||
move_patch_file(
|
move_patch_file(
|
||||||
&self
|
&self
|
||||||
@@ -463,6 +816,8 @@ impl<'a> PatchTransaction<'a> {
|
|||||||
b"committed",
|
b"committed",
|
||||||
)?;
|
)?;
|
||||||
self.finished = true;
|
self.finished = true;
|
||||||
|
// Windows cannot remove a directory while a file in it is open.
|
||||||
|
self.journal = None;
|
||||||
fs::remove_dir_all(self.root.join(".coa-races-transaction"))?;
|
fs::remove_dir_all(self.root.join(".coa-races-transaction"))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -470,6 +825,7 @@ impl<'a> PatchTransaction<'a> {
|
|||||||
impl Drop for PatchTransaction<'_> {
|
impl Drop for PatchTransaction<'_> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if !self.finished {
|
if !self.finished {
|
||||||
|
self.journal = None;
|
||||||
let _ = recover_patch_transaction(self.root);
|
let _ = recover_patch_transaction(self.root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -480,8 +836,19 @@ fn recover_patch_transaction(root: &Path) -> Result<()> {
|
|||||||
if !directory.is_dir() {
|
if !directory.is_dir() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
if !directory.join("committed").exists() && directory.join("journal.json").exists() {
|
if !directory.join("committed").exists() {
|
||||||
let mut entries: Vec<SavedFile> = fsx::read_json(&directory.join("journal.json"))?;
|
let legacy = directory.join(LEGACY_JOURNAL).is_file();
|
||||||
|
let mut entries = read_journal(&directory)?;
|
||||||
|
let mut journal = if legacy {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(
|
||||||
|
fs::OpenOptions::new()
|
||||||
|
.create(true)
|
||||||
|
.append(true)
|
||||||
|
.open(directory.join(JOURNAL))?,
|
||||||
|
)
|
||||||
|
};
|
||||||
for index in (0..entries.len()).rev() {
|
for index in (0..entries.len()).rev() {
|
||||||
let entry = &entries[index];
|
let entry = &entries[index];
|
||||||
let path = fsx::safe_join(root, &entry.path)?;
|
let path = fsx::safe_join(root, &entry.path)?;
|
||||||
@@ -493,7 +860,10 @@ fn recover_patch_transaction(root: &Path) -> Result<()> {
|
|||||||
}
|
}
|
||||||
// Persist recovery progress before restoring the source, making retries safe.
|
// Persist recovery progress before restoring the source, making retries safe.
|
||||||
entries[index].moved_to = None;
|
entries[index].moved_to = None;
|
||||||
fsx::atomic_write_json(&directory.join("journal.json"), &entries)?;
|
match journal.as_mut() {
|
||||||
|
Some(journal) => append_record(journal, &JournalRecord::Returned { index })?,
|
||||||
|
None => fsx::atomic_write_json(&directory.join(LEGACY_JOURNAL), &entries)?,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let entry = &entries[index];
|
let entry = &entries[index];
|
||||||
if saved.is_file() {
|
if saved.is_file() {
|
||||||
@@ -505,6 +875,7 @@ fn recover_patch_transaction(root: &Path) -> Result<()> {
|
|||||||
fs::remove_file(path)?;
|
fs::remove_file(path)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
drop(journal);
|
||||||
}
|
}
|
||||||
fs::remove_dir_all(directory)?;
|
fs::remove_dir_all(directory)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -541,6 +912,31 @@ fn preserve_original(tx: &mut PatchTransaction<'_>, active: &Path) -> Result<()>
|
|||||||
tx.copy(active, &original)
|
tx.copy(active, &original)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A file the previous release installed and the new one no longer ships (1.9.2's Ascension.exe, which V2
|
||||||
|
/// replaced with its own CoACustomRace.exe) is removed if it is still ours, and the player's original comes back.
|
||||||
|
fn retire_dropped_files(
|
||||||
|
tx: &mut PatchTransaction<'_>,
|
||||||
|
client: &Path,
|
||||||
|
previous: &[PatchFile],
|
||||||
|
payload: &std::collections::BTreeSet<String>,
|
||||||
|
) -> Result<()> {
|
||||||
|
for old in previous.iter().filter(|old| !payload.contains(&old.path)) {
|
||||||
|
let active = fsx::safe_join(client, &old.path)?;
|
||||||
|
if matches_patch(&active, old) {
|
||||||
|
tx.save(&active)?;
|
||||||
|
let original = suffix(&active, "original");
|
||||||
|
if original.is_file() {
|
||||||
|
tx.copy(&original, &active)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let disabled = suffix(&active, "disabled");
|
||||||
|
if matches_patch(&disabled, old) {
|
||||||
|
tx.save(&disabled)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Preserve launcher replacements, and switch every file owned by the package.
|
/// Preserve launcher replacements, and switch every file owned by the package.
|
||||||
pub fn set_client_patch_enabled(client: &Path, enabled: bool) -> Result<()> {
|
pub fn set_client_patch_enabled(client: &Path, enabled: bool) -> Result<()> {
|
||||||
if !client.is_dir() {
|
if !client.is_dir() {
|
||||||
@@ -570,7 +966,8 @@ pub fn set_client_patch_enabled(client: &Path, enabled: bool) -> Result<()> {
|
|||||||
let active = client.join(&file.path);
|
let active = client.join(&file.path);
|
||||||
let disabled = suffix(&active, "disabled");
|
let disabled = suffix(&active, "disabled");
|
||||||
let original = suffix(&active, "original");
|
let original = suffix(&active, "original");
|
||||||
if enabled {
|
// Data the stock client never reads stays active, and an older Manager's disabled copy comes back.
|
||||||
|
if enabled || !is_switched(client, &file) {
|
||||||
if active.is_file() && !matches_patch(&active, &file) {
|
if active.is_file() && !matches_patch(&active, &file) {
|
||||||
preserve_original(&mut tx, &active)?;
|
preserve_original(&mut tx, &active)?;
|
||||||
}
|
}
|
||||||
@@ -667,26 +1064,46 @@ fn stage_root_asset(staging: &Path, relative: &str, reader: &mut impl Read) -> R
|
|||||||
|
|
||||||
fn archive_job(filename: &str, url: &str, cache: &Path) -> Result<crate::download::Job> {
|
fn archive_job(filename: &str, url: &str, cache: &Path) -> Result<crate::download::Job> {
|
||||||
let (size, sha256) = match filename {
|
let (size, sha256) = match filename {
|
||||||
"CoA-Custom-1.9.2-Client-1.zip" => (
|
"CoA-Custom-V2-Client-1.zip" => (
|
||||||
1_513_021_586,
|
1_513_021_586,
|
||||||
"a9dd51ed2d90fb048d549602f40f5429d56e2df0df5606a38781b358fa369568",
|
"a9dd51ed2d90fb048d549602f40f5429d56e2df0df5606a38781b358fa369568",
|
||||||
),
|
),
|
||||||
"CoA-Custom-1.9.2-Client-2.zip" => (
|
"CoA-Custom-V2-Client-2.zip" => (
|
||||||
1_198_283_005,
|
1_198_283_005,
|
||||||
"ab084a55509ccbcc2977a06dd0c01fa879973a1892baaacaeb3ff52f3dfc750e",
|
"ab084a55509ccbcc2977a06dd0c01fa879973a1892baaacaeb3ff52f3dfc750e",
|
||||||
),
|
),
|
||||||
"CoA-Custom-1.9.2-Client-3.zip" => (
|
"CoA-Custom-V2-Client-3.zip" => (
|
||||||
1_678_829_573,
|
1_671_130_705,
|
||||||
"907e267f0ee7038807e626c3c1eca5e12db6c88b747137a23c5fb52eaa1a358e",
|
"0af34199f0739ce086adb0371d3de7c1a0f5ca9c62ecde6b0efe9286e33874a8",
|
||||||
),
|
),
|
||||||
"CoA-Custom-1.9.2-Client-4.zip" => (
|
"CoA-Custom-V2-Client-4.zip" => (
|
||||||
502_385_128,
|
502_385_128,
|
||||||
"e0bd87172af989fa50a8e2b08ba4321c72b6265047482f051a1db3b80d55bcaa",
|
"e0bd87172af989fa50a8e2b08ba4321c72b6265047482f051a1db3b80d55bcaa",
|
||||||
),
|
),
|
||||||
"CoA-Custom-1.9.2-Client-5.zip" => (
|
"CoA-Custom-V2-Client-5.zip" => (
|
||||||
168_079_711,
|
168_079_711,
|
||||||
"73364ad1b58c6342641a848a3b20a835472834f600416606be1470386774ca78",
|
"73364ad1b58c6342641a848a3b20a835472834f600416606be1470386774ca78",
|
||||||
),
|
),
|
||||||
|
"CoA-Custom-V2-Client-6.zip" => (
|
||||||
|
1_881_526_537,
|
||||||
|
"91db79b7b451856fa9e45daea52e0fe1c04676653dd8a88e6627f04ee7b47759",
|
||||||
|
),
|
||||||
|
"CoA-Custom-V2-Client-7.zip" => (
|
||||||
|
734_725_114,
|
||||||
|
"4c5532d775d206a3b913a6111040bb96b95c683b74c08a6131ed9f38db8e2b39",
|
||||||
|
),
|
||||||
|
"CoA-Custom-V2-Client-8.zip" => (
|
||||||
|
734_216_670,
|
||||||
|
"bdaa1d047e8767bd5715f1e8465d116220597d9c135a43e2dda02e12ce2e5526",
|
||||||
|
),
|
||||||
|
"CoA-Custom-V2-Client-9.zip" => (
|
||||||
|
195_235_400,
|
||||||
|
"0764893543084a12d15578fe734f66ba4519740794a6b3b3a38a08594c38c640",
|
||||||
|
),
|
||||||
|
"CoA-Custom-V2-Server.zip" => (
|
||||||
|
63_983_587,
|
||||||
|
"8970d61eea40f53cea4c27481edd85d2b2647cd32eb88932e0077da3b4a77d23",
|
||||||
|
),
|
||||||
_ => return Err(Error::Invalid("Unknown custom races archive.".into())),
|
_ => return Err(Error::Invalid("Unknown custom races archive.".into())),
|
||||||
};
|
};
|
||||||
Ok(crate::download::Job {
|
Ok(crate::download::Job {
|
||||||
@@ -781,6 +1198,17 @@ fn resolve_archive_with(
|
|||||||
Ok(job.dest.clone())
|
Ok(job.dest.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The 1.9.2 file name of a V2 archive with the same bytes (same size and SHA-256 in both releases).
|
||||||
|
fn earlier_name(filename: &str) -> Option<&'static str> {
|
||||||
|
match filename {
|
||||||
|
"CoA-Custom-V2-Client-1.zip" => Some("CoA-Custom-1.9.2-Client-1.zip"),
|
||||||
|
"CoA-Custom-V2-Client-2.zip" => Some("CoA-Custom-1.9.2-Client-2.zip"),
|
||||||
|
"CoA-Custom-V2-Client-4.zip" => Some("CoA-Custom-1.9.2-Client-4.zip"),
|
||||||
|
"CoA-Custom-V2-Client-5.zip" => Some("CoA-Custom-1.9.2-Client-5.zip"),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Locate a verified archive or resume downloading it into the Manager's cache.
|
/// Locate a verified archive or resume downloading it into the Manager's cache.
|
||||||
fn resolve_or_download_archive(
|
fn resolve_or_download_archive(
|
||||||
filename: &str,
|
filename: &str,
|
||||||
@@ -796,6 +1224,16 @@ fn resolve_or_download_archive(
|
|||||||
let cache = std::env::temp_dir().join("coa-client-races");
|
let cache = std::env::temp_dir().join("coa-client-races");
|
||||||
let downloads = std::env::var_os("USERPROFILE").map(|p| PathBuf::from(p).join("Downloads"));
|
let downloads = std::env::var_os("USERPROFILE").map(|p| PathBuf::from(p).join("Downloads"));
|
||||||
let job = archive_job(filename, url, &cache)?;
|
let job = archive_job(filename, url, &cache)?;
|
||||||
|
// V2 republished four 1.9.2 archives byte for byte under new names: reuse a verified 1.9.2 copy.
|
||||||
|
if let Some(previous) = earlier_name(filename) {
|
||||||
|
for folder in [Some(cache.as_path()), downloads.as_deref()].into_iter().flatten() {
|
||||||
|
let candidate = folder.join(previous);
|
||||||
|
if archive_matches(&candidate, &job) {
|
||||||
|
tracing::info!(path = %candidate.display(), "using the identical 1.9.2 archive");
|
||||||
|
return Ok(candidate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
resolve_archive_with(transport, &job, downloads.as_deref(), cancel, &|p| {
|
resolve_archive_with(transport, &job, downloads.as_deref(), cancel, &|p| {
|
||||||
let ratio = p.downloaded as f32 / p.total.max(1) as f32;
|
let ratio = p.downloaded as f32 / p.total.max(1) as f32;
|
||||||
report(
|
report(
|
||||||
@@ -985,6 +1423,8 @@ pub fn install_client_patches(
|
|||||||
"Custom races archives are missing required runtime files.".into(),
|
"Custom races archives are missing required runtime files.".into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
let payload_paths: std::collections::BTreeSet<String> =
|
||||||
|
payload.iter().map(|file| file.path.clone()).collect();
|
||||||
let previous = patch_files(client_path)?;
|
let previous = patch_files(client_path)?;
|
||||||
let mut tx = PatchTransaction::new(client_path)?;
|
let mut tx = PatchTransaction::new(client_path)?;
|
||||||
for file in payload {
|
for file in payload {
|
||||||
@@ -1017,6 +1457,7 @@ pub fn install_client_patches(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
retire_dropped_files(&mut tx, client_path, &previous, &payload_paths)?;
|
||||||
tx.save(&manifest_path)?;
|
tx.save(&manifest_path)?;
|
||||||
fsx::atomic_write(&manifest_path, manifest_body.as_bytes())?;
|
fsx::atomic_write(&manifest_path, manifest_body.as_bytes())?;
|
||||||
tx.finish()?;
|
tx.finish()?;
|
||||||
@@ -1165,6 +1606,7 @@ mod tests {
|
|||||||
("ADDON", base)
|
("ADDON", base)
|
||||||
} else {
|
} else {
|
||||||
name.strip_prefix("Data/")
|
name.strip_prefix("Data/")
|
||||||
|
.filter(|base| !base.contains('/'))
|
||||||
.map_or(("ROOT", *name), |base| ("MPQ", base))
|
.map_or(("ROOT", *name), |base| ("MPQ", base))
|
||||||
};
|
};
|
||||||
manifest.push_str(&format!(
|
manifest.push_str(&format!(
|
||||||
@@ -1175,6 +1617,165 @@ mod tests {
|
|||||||
fs::write(root.join(MANIFEST_FILENAME), manifest).unwrap();
|
fs::write(root.join(MANIFEST_FILENAME), manifest).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SWITCHED: &[&str] = &[
|
||||||
|
"Data/patch-ZE1.MPQ",
|
||||||
|
"dinput8.dll",
|
||||||
|
"CoACustomRace.exe",
|
||||||
|
"Start-CoACustomRace.bat",
|
||||||
|
"Interface/AddOns/CoAHideArmor/CoAHideArmor.lua",
|
||||||
|
];
|
||||||
|
const INERT: &[&str] = &[
|
||||||
|
"Data/Retail/Cache/Retail/wow/decoded/2/strict/id-1.bin",
|
||||||
|
"Data/Retail/RetailCasc.ini",
|
||||||
|
"VulkanShaders/a.spv",
|
||||||
|
"Vulkan/d3d9.dll",
|
||||||
|
"forever_data/hd_forever_fog.txt",
|
||||||
|
"EsteriaAppearance.bin",
|
||||||
|
];
|
||||||
|
|
||||||
|
fn client_with(root: &Path, names: &[&str]) {
|
||||||
|
for name in names {
|
||||||
|
let path = root.join(name);
|
||||||
|
fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||||
|
fs::write(&path, format!("custom {name}")).unwrap();
|
||||||
|
}
|
||||||
|
record_files(root, names);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn disabling_hides_only_what_the_stock_client_loads() {
|
||||||
|
let temp = tempfile::tempdir().unwrap();
|
||||||
|
let root = temp.path();
|
||||||
|
let all: Vec<&str> = SWITCHED.iter().chain(INERT).copied().collect();
|
||||||
|
client_with(root, &all);
|
||||||
|
set_client_patch_enabled(root, false).unwrap();
|
||||||
|
for name in SWITCHED {
|
||||||
|
assert!(!root.join(name).exists(), "{name} stays active");
|
||||||
|
assert!(suffix(&root.join(name), "disabled").is_file(), "{name}");
|
||||||
|
}
|
||||||
|
for name in INERT {
|
||||||
|
assert!(root.join(name).is_file(), "{name} was moved");
|
||||||
|
assert!(!suffix(&root.join(name), "disabled").exists(), "{name}");
|
||||||
|
}
|
||||||
|
assert_eq!(client_patch_status(root).state, ClientPatchState::Disabled);
|
||||||
|
set_client_patch_enabled(root, true).unwrap();
|
||||||
|
assert_eq!(client_patch_status(root).state, ClientPatchState::Enabled);
|
||||||
|
for name in &all {
|
||||||
|
assert!(root.join(name).is_file(), "{name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_file_that_replaced_the_players_own_is_still_switched() {
|
||||||
|
let temp = tempfile::tempdir().unwrap();
|
||||||
|
let root = temp.path();
|
||||||
|
let name = "Data/Retail/RetailCasc.ini";
|
||||||
|
client_with(root, &[name]);
|
||||||
|
fs::write(suffix(&root.join(name), "original"), b"player").unwrap();
|
||||||
|
set_client_patch_enabled(root, false).unwrap();
|
||||||
|
assert_eq!(fs::read(root.join(name)).unwrap(), b"player");
|
||||||
|
assert!(suffix(&root.join(name), "disabled").is_file());
|
||||||
|
assert_eq!(client_patch_status(root).state, ClientPatchState::Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_client_disabled_by_an_older_manager_is_disabled_and_enables() {
|
||||||
|
let temp = tempfile::tempdir().unwrap();
|
||||||
|
let root = temp.path();
|
||||||
|
let all: Vec<&str> = SWITCHED.iter().chain(INERT).copied().collect();
|
||||||
|
client_with(root, &all);
|
||||||
|
// 0.9.13 renamed every file of the payload.
|
||||||
|
for name in &all {
|
||||||
|
fs::rename(root.join(name), suffix(&root.join(name), "disabled")).unwrap();
|
||||||
|
}
|
||||||
|
assert_eq!(client_patch_status(root).state, ClientPatchState::Disabled);
|
||||||
|
set_client_patch_enabled(root, false).unwrap();
|
||||||
|
for name in INERT {
|
||||||
|
assert!(root.join(name).is_file(), "{name} not restored");
|
||||||
|
}
|
||||||
|
assert_eq!(client_patch_status(root).state, ClientPatchState::Disabled);
|
||||||
|
set_client_patch_enabled(root, true).unwrap();
|
||||||
|
assert_eq!(client_patch_status(root).state, ClientPatchState::Enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_transaction_left_by_an_older_manager_is_recovered() {
|
||||||
|
let temp = tempfile::tempdir().unwrap();
|
||||||
|
let root = temp.path();
|
||||||
|
let directory = root.join(".coa-races-transaction");
|
||||||
|
fs::create_dir(&directory).unwrap();
|
||||||
|
// The source was moved into the journal and then on to its destination when the old Manager stopped.
|
||||||
|
fs::write(root.join("patch.MPQ.disabled"), b"patch bytes").unwrap();
|
||||||
|
fs::write(
|
||||||
|
directory.join(LEGACY_JOURNAL),
|
||||||
|
r#"[{"path":"patch.MPQ.disabled","existed":false},{"path":"patch.MPQ","existed":true,"moved_to":"patch.MPQ.disabled"}]"#,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
recover_patch_transaction(root).unwrap();
|
||||||
|
assert_eq!(fs::read(root.join("patch.MPQ")).unwrap(), b"patch bytes");
|
||||||
|
assert!(!root.join("patch.MPQ.disabled").exists());
|
||||||
|
assert!(!directory.exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_journal_line_cut_short_by_a_crash_is_ignored() {
|
||||||
|
let temp = tempfile::tempdir().unwrap();
|
||||||
|
let root = temp.path();
|
||||||
|
let file = root.join("dinput8.dll");
|
||||||
|
fs::write(&file, b"previous").unwrap();
|
||||||
|
let mut tx = PatchTransaction::new(root).unwrap();
|
||||||
|
tx.save(&file).unwrap();
|
||||||
|
fs::write(&file, b"replacement").unwrap();
|
||||||
|
drop(tx.journal.take());
|
||||||
|
std::mem::forget(tx);
|
||||||
|
let journal = root.join(".coa-races-transaction").join(JOURNAL);
|
||||||
|
let mut bytes = fs::read(&journal).unwrap();
|
||||||
|
bytes.extend_from_slice(br#"{"saved":{"path":"other.dll","exi"#);
|
||||||
|
fs::write(&journal, bytes).unwrap();
|
||||||
|
recover_patch_transaction(root).unwrap();
|
||||||
|
assert_eq!(fs::read(&file).unwrap(), b"previous");
|
||||||
|
assert!(!root.join(".coa-races-transaction").exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn switching_a_release_sized_payload_takes_seconds() {
|
||||||
|
let temp = tempfile::tempdir().unwrap();
|
||||||
|
let root = temp.path();
|
||||||
|
let mut names: Vec<String> = (0..7000)
|
||||||
|
.map(|i| format!("VulkanShaders/shader-{i}.spv"))
|
||||||
|
.collect();
|
||||||
|
names.extend((0..80).map(|i| format!("Data/patch-Z{i}.MPQ")));
|
||||||
|
names.extend((0..140).map(|i| format!("Interface/AddOns/Addon{}/file{i}.lua", i % 9)));
|
||||||
|
let names: Vec<&str> = names.iter().map(String::as_str).collect();
|
||||||
|
client_with(root, &names);
|
||||||
|
let started = std::time::Instant::now();
|
||||||
|
set_client_patch_enabled(root, false).unwrap();
|
||||||
|
set_client_patch_enabled(root, true).unwrap();
|
||||||
|
let elapsed = started.elapsed();
|
||||||
|
assert_eq!(client_patch_status(root).state, ClientPatchState::Enabled);
|
||||||
|
// 0.9.13 needed minutes here: it moved every file and rewrote the whole journal after each one.
|
||||||
|
assert!(elapsed < std::time::Duration::from_secs(60), "{elapsed:?}");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn an_update_retires_files_the_new_release_no_longer_ships() {
|
||||||
|
let temp = tempfile::tempdir().unwrap();
|
||||||
|
let root = temp.path();
|
||||||
|
fs::write(root.join("Ascension.exe"), b"1.9.2 client").unwrap();
|
||||||
|
fs::write(root.join("Ascension.exe.original"), b"player's own client").unwrap();
|
||||||
|
fs::write(root.join("Wow.exe"), b"changed by the player").unwrap();
|
||||||
|
let ours = |path: &str, bytes: &[u8]| PatchFile {
|
||||||
|
path: path.into(),
|
||||||
|
sha256: hex::encode(<sha2::Sha256 as sha2::Digest>::digest(bytes)),
|
||||||
|
};
|
||||||
|
let previous = vec![ours("Ascension.exe", b"1.9.2 client"), ours("Wow.exe", b"old package bytes")];
|
||||||
|
let mut tx = PatchTransaction::new(root).unwrap();
|
||||||
|
retire_dropped_files(&mut tx, root, &previous, &Default::default()).unwrap();
|
||||||
|
tx.finish().unwrap();
|
||||||
|
assert_eq!(fs::read(root.join("Ascension.exe")).unwrap(), b"player's own client");
|
||||||
|
assert_eq!(fs::read(root.join("Wow.exe")).unwrap(), b"changed by the player");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore = "Requires the downloaded release archives"]
|
#[ignore = "Requires the downloaded release archives"]
|
||||||
fn bundled_hashes_match_verified_release_archives() {
|
fn bundled_hashes_match_verified_release_archives() {
|
||||||
@@ -1226,6 +1827,28 @@ mod tests {
|
|||||||
assert_eq!(actual, expected);
|
assert_eq!(actual, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[ignore = "Requires COA_UPGRADE_CLIENT: a disposable client with 1.9.2 installed by Manager 0.9.12"]
|
||||||
|
fn an_installed_1_9_2_client_updates_to_v2_and_gets_its_own_executable_back() {
|
||||||
|
let root = PathBuf::from(std::env::var_os("COA_UPGRADE_CLIENT").expect("COA_UPGRADE_CLIENT"));
|
||||||
|
assert_eq!(client_patch_status(&root).version.as_deref(), Some("1.9.2"));
|
||||||
|
let patched = fs::read(root.join("Ascension.exe")).unwrap();
|
||||||
|
let original = fs::read(root.join("Ascension.exe.original")).unwrap();
|
||||||
|
assert_ne!(patched, original);
|
||||||
|
install_client_patches(&root, &Cancel::default(), &|_, _| {}).unwrap();
|
||||||
|
let status = client_patch_status(&root);
|
||||||
|
assert_eq!(status.version.as_deref(), Some(CLIENT_VERSION));
|
||||||
|
assert_eq!(status.state, ClientPatchState::Enabled);
|
||||||
|
assert!(root.join("CoACustomRace.exe").is_file());
|
||||||
|
assert!(root.join("Data/patch-ZZZZZY.MPQ").is_file());
|
||||||
|
// 1.9.2's patched Ascension.exe is retired and the player's own executable is back.
|
||||||
|
assert_eq!(fs::read(root.join("Ascension.exe")).unwrap(), original);
|
||||||
|
uninstall_client_patches(&root).unwrap();
|
||||||
|
assert_eq!(client_patch_status(&root).state, ClientPatchState::NotInstalled);
|
||||||
|
assert_eq!(fs::read(root.join("Ascension.exe")).unwrap(), original);
|
||||||
|
assert!(!root.join("CoACustomRace.exe").exists());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore = "Requires the downloaded release archives in the normal download cache"]
|
#[ignore = "Requires the downloaded release archives in the normal download cache"]
|
||||||
fn release_archives_install_toggle_and_uninstall_in_a_disposable_client() {
|
fn release_archives_install_toggle_and_uninstall_in_a_disposable_client() {
|
||||||
@@ -1243,8 +1866,30 @@ mod tests {
|
|||||||
assert!(root
|
assert!(root
|
||||||
.join("Interface/AddOns/CoAHideArmor/CoAHideArmor.lua")
|
.join("Interface/AddOns/CoAHideArmor/CoAHideArmor.lua")
|
||||||
.is_file());
|
.is_file());
|
||||||
|
// V2: its own client next to the untouched game executable, and the server package's addons.
|
||||||
|
assert!(root.join("CoACustomRace.exe").is_file());
|
||||||
|
assert!(root.join("Vulkan/d3d9.dll").is_file());
|
||||||
|
assert_eq!(fs::read(root.join("Ascension.exe")).unwrap(), b"original game executable");
|
||||||
|
assert!(root
|
||||||
|
.join("Interface/AddOns/Ascension_Subclass")
|
||||||
|
.is_dir());
|
||||||
|
let started = std::time::Instant::now();
|
||||||
set_client_patch_enabled(root, false).unwrap();
|
set_client_patch_enabled(root, false).unwrap();
|
||||||
|
eprintln!("disable took {:?}", started.elapsed());
|
||||||
assert_eq!(client_patch_status(root).state, ClientPatchState::Disabled);
|
assert_eq!(client_patch_status(root).state, ClientPatchState::Disabled);
|
||||||
|
// Only what the stock client loads is hidden; the data its executable alone reads stays put.
|
||||||
|
assert!(!root.join("CoACustomRace.exe").exists());
|
||||||
|
assert!(!root.join("dinput8.dll").exists());
|
||||||
|
assert!(!root.join("Data/patch-ZZZD.MPQ").exists());
|
||||||
|
assert!(!root.join("Interface/AddOns/CoAHideArmor/CoAHideArmor.lua").exists());
|
||||||
|
assert!(root.join("Vulkan/d3d9.dll").is_file());
|
||||||
|
assert!(root.join("Data/Retail/RetailCasc.ini").is_file());
|
||||||
|
let hidden = patch_files(root)
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.filter(|file| suffix(&root.join(&file.path), "disabled").is_file())
|
||||||
|
.count();
|
||||||
|
eprintln!("hidden {hidden} of {}", patch_files(root).unwrap().len());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
fs::read(root.join("Ascension.exe")).unwrap(),
|
fs::read(root.join("Ascension.exe")).unwrap(),
|
||||||
b"original game executable"
|
b"original game executable"
|
||||||
@@ -1253,7 +1898,9 @@ mod tests {
|
|||||||
fs::read(root.join("Data/patch-T.MPQ")).unwrap(),
|
fs::read(root.join("Data/patch-T.MPQ")).unwrap(),
|
||||||
b"original game patch"
|
b"original game patch"
|
||||||
);
|
);
|
||||||
|
let started = std::time::Instant::now();
|
||||||
set_client_patch_enabled(root, true).unwrap();
|
set_client_patch_enabled(root, true).unwrap();
|
||||||
|
eprintln!("enable took {:?}", started.elapsed());
|
||||||
assert_eq!(client_patch_status(root).state, ClientPatchState::Enabled);
|
assert_eq!(client_patch_status(root).state, ClientPatchState::Enabled);
|
||||||
uninstall_client_patches(root).unwrap();
|
uninstall_client_patches(root).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -1273,6 +1920,7 @@ mod tests {
|
|||||||
b"unrelated user patch"
|
b"unrelated user patch"
|
||||||
);
|
);
|
||||||
assert!(!root.join("Data/patch-ZZZD.MPQ").exists());
|
assert!(!root.join("Data/patch-ZZZD.MPQ").exists());
|
||||||
|
assert!(!root.join("CoACustomRace.exe").exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -1317,7 +1965,10 @@ mod tests {
|
|||||||
);
|
);
|
||||||
assert_ne!(legacy["Data/patch-T.MPQ"], current["Data/patch-T.MPQ"]);
|
assert_ne!(legacy["Data/patch-T.MPQ"], current["Data/patch-T.MPQ"]);
|
||||||
assert!(!files.iter().any(|file| file.path == "Data/patch-ZZW.MPQ"));
|
assert!(!files.iter().any(|file| file.path == "Data/patch-ZZW.MPQ"));
|
||||||
assert!(legacy.keys().all(|key| current.contains_key(key)));
|
assert!(legacy
|
||||||
|
.keys()
|
||||||
|
.filter(|key| !RETIRED_FILES.contains(&key.as_str()))
|
||||||
|
.all(|key| current.contains_key(key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -1333,7 +1984,10 @@ mod tests {
|
|||||||
for file in files {
|
for file in files {
|
||||||
assert_eq!(file.sha256, legacy[&file.path]);
|
assert_eq!(file.sha256, legacy[&file.path]);
|
||||||
}
|
}
|
||||||
assert!(legacy.keys().all(|path| current.contains_key(path)));
|
assert!(legacy
|
||||||
|
.keys()
|
||||||
|
.filter(|key| !RETIRED_FILES.contains(&key.as_str()))
|
||||||
|
.all(|key| current.contains_key(key)));
|
||||||
assert!(!legacy.contains_key("Data/patch-ZZZD.MPQ"));
|
assert!(!legacy.contains_key("Data/patch-ZZZD.MPQ"));
|
||||||
assert!(current.contains_key("Data/patch-ZZZD.MPQ"));
|
assert!(current.contains_key("Data/patch-ZZZD.MPQ"));
|
||||||
let status = client_patch_status(temp.path());
|
let status = client_patch_status(temp.path());
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,116 @@
|
|||||||
|
{
|
||||||
|
"Ascension.exe": "e2c347019d554a59639e5978fd68e50e906973ab313c6573cc56ca82e8e3c547",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/1068-1.bin": "332d2c38b037a118f262bbb3096a01ebfb33c5347e96bbfb64157437b300281b",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/60-0.bin": "ffbf6efc9ea09b0c442f048c5bc7b4c5975258045cfddedd9a77a93363312b5e",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/60-1.bin": "36ceed2a55756f3322e018938809acea5124351161405058ef27d100173778da",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/61-0.bin": "3b302a4055d1e795c451b02e38dfe8007527ee1bc5f926ebcd6ef17f433cd232",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/61-1.bin": "c42df399ed99be3c7ce1b5fdb95a873711011713a4cd867bc226a14b1ce0e8ca",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/65-0.bin": "8ce3f884ae197d14dff0f955c2cf05abb716742c8aff79f7af1cec5cf7225f04",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/68-0.bin": "f1d878f0f943cbdb8025af8daac4a38c1d1e159bd961d9d76f225931c11648ac",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/68-1.bin": "2ccbae634384200340c0cc3dca36a7a014a8ddad110598e4470ff1b266576465",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/73-0.bin": "5530882678f677ad47987ce906e851338a35f7d9737e3f9d829938027b8af67f",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/74-0.bin": "53a7be86b3bfdd6995406c706df3ca091484206d8141cebb39113c714500384a",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/74-1.bin": "e688c55a355231978d42480a003c26d379460f5931c2469c119ecb073ea153e1",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/75-0.bin": "289abc71c6df0e031a64d62a40e658eaefd37e45373a062ca52f08fbe803500c",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/76-0.bin": "63a493e70b91f59ff49f1942d959df986062bd267fe2ba589f344963df771021",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/77-0.bin": "b1366ce0dc4f31cb8c8c9705be2da565df4b905224af04b6b88f8c8e9c87e3c9",
|
||||||
|
"Data/Retail/Assets/EquipmentFitting/78-0.bin": "7b0031fb12ab19020005bdccacca2dd3991349c36949a58b035992585b4134db",
|
||||||
|
"Data/patch-T.MPQ": "fe597138ab7f56881b5f4f27d6dc9d81bb278b483ca0d91b7207ffd4a5ae7bfd",
|
||||||
|
"Data/patch-ZE1.MPQ": "69d79dbbea54ec0312c37770debc79c7bc9ce2e21eedef99c03cd8d911955283",
|
||||||
|
"Data/patch-ZE2.MPQ": "1a41cae77ad730e9cf69e8d63fd12ae3a579418bb550d351fff469573a97ac3c",
|
||||||
|
"Data/patch-ZE3.MPQ": "b587202c21b6f580682b601b7c2e905fbfa766276e74733db55c1bddbffb7f87",
|
||||||
|
"Data/patch-ZE5.MPQ": "476b5a1fcf69f64fdb281e3b445362b936d016066ccd12f897acfcf200d6c0cf",
|
||||||
|
"Data/patch-ZE6.MPQ": "762592c9ed950b4a7b6c7d85d45050b30fa3f35d53e348ee1e1516fdbb7e5484",
|
||||||
|
"Data/patch-ZE7.MPQ": "de54b0189d242763d2872223419a259b6b8a4b380c24b50a2ef9c6fa44466248",
|
||||||
|
"Data/patch-ZE8.MPQ": "1bc5691fb84a84f3e7a0a70baaa9192a97b4ec5906ee37c85838ffe08adef934",
|
||||||
|
"Data/patch-ZE9.MPQ": "d49c94463e9548e76378ce2c0454d8f204f0745c8c0de32b6dce7f0b0fd67c4a",
|
||||||
|
"Data/patch-ZEA.MPQ": "78fd10ec5262ae2417eba9700d2172553bbc1e5cfb0b597aada8f1753ca46d9d",
|
||||||
|
"Data/patch-ZES.MPQ": "a2d9348f917f745c7aa25b2eed96efa312f7b2d2f62cb86a4f2eaabc2dfa895f",
|
||||||
|
"Data/patch-ZG.MPQ": "48979e1fda775f8deb47bffa48e0a468595d4c71286fee518f51dc5801c5ca39",
|
||||||
|
"Data/patch-ZH.MPQ": "5e1d2fe287053abba703d7af381e10096c6525ba477ffed3971c2fc4f93e919c",
|
||||||
|
"Data/patch-ZHA.MPQ": "0fc6ebeafe1d14192dc64bafc90bde3c49230df1297f98bf65900a3bcf953617",
|
||||||
|
"Data/patch-ZHM.MPQ": "317d3ae00f0bd674b358af07544976acb7804aa6d8b19d1788ad96030e8c9bf0",
|
||||||
|
"Data/patch-ZJ.MPQ": "f821e99add86ef68d108c5ec466328c97677d3ed52f7944e200f3fe38c13b4de",
|
||||||
|
"Data/patch-ZK.MPQ": "444d0ecb72c1e990509d53e3cfa5b7634c816733533e8a97e5d7f5653ee32cce",
|
||||||
|
"Data/patch-ZM.MPQ": "424ab1978986e854551633983a94bd15beba6328aabea8c02f98eaa32f6f0b61",
|
||||||
|
"Data/patch-ZVU.MPQ": "c679b85a2e97344395756b54d2cf6abefe4e80e74944cb55b6e573ad17b7d020",
|
||||||
|
"Data/patch-ZZE.MPQ": "4b1e289e12c82644cb78f50170e6b5fd53918eb2de834f9e0cebddd81873a8bb",
|
||||||
|
"Data/patch-ZZR.MPQ": "5a7575e592dc0c8a6913e0d946bbe06fa0ca2e4d817ef1f8548d3d13142bcbd3",
|
||||||
|
"Data/patch-ZZS.MPQ": "533fd69d5784d83e872a5a28d27301dc9ab5d0cb925f8b2116926854e4a0a5b8",
|
||||||
|
"Data/patch-ZZT.MPQ": "e60dab63fe5650fdf5f0846ea6d4136219293bcfdad46d9b796697faeff9ab4c",
|
||||||
|
"Data/patch-ZZU.MPQ": "0311de8f034eae7dec1bd2c92b1fe6c741cbaf53da62c7609cd12b6c37908e47",
|
||||||
|
"Data/patch-ZZV.MPQ": "3b04008905e7185d165827d68f7ca228dda8272816364f7d71874ecc83b64f0e",
|
||||||
|
"Data/patch-ZZW.MPQ": "3bbbc72901fd2d662113036485c380701e693f5a39ba9479af306bf2fa2030bd",
|
||||||
|
"Data/patch-ZZX.MPQ": "4c12608089cfe356f7c8882d66db90239ed3ec8ddd980d91d7a3a488680f3c88",
|
||||||
|
"Data/patch-ZZZ.MPQ": "566aaadf501af42e29a828b1bc2edbd36d436288fb309fe423bd74b9619bf593",
|
||||||
|
"Data/patch-ZZZA.MPQ": "57ccbdc0a66000767554ffd194088df6d602ddd8341a141bca8201e7d5435889",
|
||||||
|
"Data/patch-ZZZC.MPQ": "691a53f6325c2615a64ced0802f18bc4d96e99c62aaa606fc930f9406ee74cdf",
|
||||||
|
"Data/patch-ZZZD.MPQ": "ca893cf8129f6fd442a63f0697a8ddea88546e3ce71bde713be2cc832b892bc9",
|
||||||
|
"Data/patch-ZZZE.MPQ": "2e245ee0fe3b913087eed399062fda5843d98b04afac38024f7c64ac3bf43e18",
|
||||||
|
"Data/patch-ZZZF.MPQ": "40eac695cfcafb598b8376f3b9a61ecc037e4d445b87279cfe387a91edad32c3",
|
||||||
|
"Data/patch-ZZZZ.MPQ": "860c990db3b4185fdc36e1a001d3ca3507a68253a4506793a115f86eb0892a15",
|
||||||
|
"EsteriaAppearance.bin": "90d9cfaeaf6de10f014f1d1610ea10453ec9b240255759aea99513cac488a3ec",
|
||||||
|
"EsteriaAppearance.dll": "88e268d3be9eca3b0644f543d823f4bdcc04a9700a6e8ed73fd2a1260ad191af",
|
||||||
|
"EsteriaAppearanceGeometry.bin": "19de5b4b4f79778ea5316659efc2f66c6edb6b5149c46efa47c46bfa4ec6904c",
|
||||||
|
"EsteriaAppearanceMaterials.bin": "f72f027f54a55c05aa0f76b457b97b484fe0e1aedc0e068cc0e0ca53e1878cba",
|
||||||
|
"EsteriaBanshee.bin": "d3fe66caa6a0ecba96bddb07ac1cbdb915694e87fc1608da0fdabecdf9ffea4d",
|
||||||
|
"EsteriaBansheeTextures.bin": "837774377ca055e6a5c79c1a4cfd8151e7c1f7ce2c16990b00fd445281137433",
|
||||||
|
"EsteriaCentaur.bin": "d63f0b7d21cee67d234d134e832fe6d55c398f2b63f9f6c191dcfa9671637185",
|
||||||
|
"EsteriaCentaurTextures.bin": "837774377ca055e6a5c79c1a4cfd8151e7c1f7ce2c16990b00fd445281137433",
|
||||||
|
"EsteriaCosmeticWings.bin": "57352c28459d073a29b3014d33b70f3b3756afa37fa9583ef6b30d503422ac3f",
|
||||||
|
"EsteriaDrakonid.bin": "95440ee9c065ef20bb7fed6158d20623d68745291cedc2726fc746ff54601f95",
|
||||||
|
"EsteriaDrakonidCoverage.bin": "9cdc227f08329e1245d2b864a996e7a772c96ecdbe5d81925f4d60cdbe4fa11e",
|
||||||
|
"EsteriaDrakonidTextures.bin": "1ba9133a75dad291d98a068b2dcde01f31a897a1764cd7f3e2c316c288a8f605",
|
||||||
|
"EsteriaEarthen.bin": "8a0db93ba2d5c756b44ed84f2f7bc7c15eef13be6a7d87baf1383c6c0c624e02",
|
||||||
|
"EsteriaEthereal.bin": "ada3b7588511a847dd5154d91e3041e9f7f193998b06bfede5e0afc32570b48c",
|
||||||
|
"EsteriaEtherealTextures.bin": "837774377ca055e6a5c79c1a4cfd8151e7c1f7ce2c16990b00fd445281137433",
|
||||||
|
"EsteriaFaceless.bin": "1c5a1d7a6b1db6984a8e41bc4804e9f7c50d65dcdbb8c0a9d1a9e8af8c91bd8f",
|
||||||
|
"EsteriaFacelessTextures.bin": "837774377ca055e6a5c79c1a4cfd8151e7c1f7ce2c16990b00fd445281137433",
|
||||||
|
"EsteriaGnoll.bin": "cfacc8e681bb8e54a4f01ee9c12a91bf0bd23a23527bb548d4dc21ec1b33eea2",
|
||||||
|
"EsteriaGnollTextures.bin": "1ba9133a75dad291d98a068b2dcde01f31a897a1764cd7f3e2c316c288a8f605",
|
||||||
|
"EsteriaHaranir.bin": "59f31d00e372fd2646e1cf0d9d3d5d671b31edd60ff7b862f8d1ce7e53ba1f2f",
|
||||||
|
"EsteriaHaranirTextures.bin": "99948ca570be2d376f0c67e3b8088739b6fa9f9d2c73985e19f68df77689a229",
|
||||||
|
"EsteriaHighmountain.bin": "e83349252ad2687ac23fcfc5623db7401cf32e5faf47a5a7be20c2f94b014938",
|
||||||
|
"EsteriaHozen.bin": "739bc3775388976f5c09bcbf3a98b62d804dff78d545e25a41d07dd99b5fddc5",
|
||||||
|
"EsteriaHozenTextures.bin": "837774377ca055e6a5c79c1a4cfd8151e7c1f7ce2c16990b00fd445281137433",
|
||||||
|
"EsteriaKvItems.bin": "fc5f9d86114234b38dbb0e14a6a5ec16249eaa92a73411a7fc371a950549dcce",
|
||||||
|
"EsteriaKvSkins.bin": "60b2b899f5f83137368514928f92f3b04c0fae058f534c487ddbe913ee4bec18",
|
||||||
|
"EsteriaKyrian.bin": "9329147f08805ff4003f9e062fea7c6ea8fdd8c4d6a40de63a6d228ebe1b7c9a",
|
||||||
|
"EsteriaKyrianTextures.bin": "837774377ca055e6a5c79c1a4cfd8151e7c1f7ce2c16990b00fd445281137433",
|
||||||
|
"EsteriaMantid.bin": "71536dee6c2abd0b0e13f33bc73cad7e6fb1b0fc1f6912a95c55d57bc7ee1787",
|
||||||
|
"EsteriaMantidTextures.bin": "837774377ca055e6a5c79c1a4cfd8151e7c1f7ce2c16990b00fd445281137433",
|
||||||
|
"EsteriaNaga.bin": "e87547cff5d09500c294f8b06935d134cdd0bbb962e294a72de09404505bd8b3",
|
||||||
|
"EsteriaNagaTextures.bin": "57ec560f99c1d48ac1e8f6a797c156513b99e7d349e3071afe405f812d159ae3",
|
||||||
|
"EsteriaSaberon.bin": "7735c9325c807c5125760d87f323d6b7d4162fb542c1d8b5f435ea2d6b9a4daa",
|
||||||
|
"EsteriaSaberonCoverage.bin": "9cdc227f08329e1245d2b864a996e7a772c96ecdbe5d81925f4d60cdbe4fa11e",
|
||||||
|
"EsteriaSaberonTextures.bin": "1ba9133a75dad291d98a068b2dcde01f31a897a1764cd7f3e2c316c288a8f605",
|
||||||
|
"EsteriaSethrak.bin": "bd14857a8c11fdf8027128763293701586b2102f9a6539d33a727014789fd606",
|
||||||
|
"EsteriaSethrakTextures.bin": "d2b2cf58087a391f00198008fe871edd400ddf28d54a3a05674df74c5198528a",
|
||||||
|
"EsteriaSlime.bin": "491e942ceb6abda83c0249afebae7c9c43af3897b35e45fa33d6f9177ecbc177",
|
||||||
|
"EsteriaSlimeTextures.bin": "837774377ca055e6a5c79c1a4cfd8151e7c1f7ce2c16990b00fd445281137433",
|
||||||
|
"EsteriaTarasek.bin": "f718444d5ec36f7aff018883486ae1981151fe6e01f5b7781d68d74e9fadfa47",
|
||||||
|
"EsteriaTarasekTextures.bin": "1ba9133a75dad291d98a068b2dcde01f31a897a1764cd7f3e2c316c288a8f605",
|
||||||
|
"EsteriaThinHuman.bin": "bc12e5ca2c087ca0a8642ff6cd8e78fe2e1f85928518b12c19b4245a8320585d",
|
||||||
|
"EsteriaThinHumanTextures.bin": "27488a7494fa9733b53118d1d0f4acef50a9e19004f81f9c8a614b10f4c3fd5e",
|
||||||
|
"EsteriaTuskarr.bin": "ecbe7ef490ba67eca029a57639192db61238522618491549766fe38529914387",
|
||||||
|
"EsteriaTuskarrTextures.bin": "e2116c2c83adea079126fd5da765d20da24f044d4f161c4124e4368cb3d6bc71",
|
||||||
|
"EsteriaVenthyr.bin": "5bcf7804363e59b3c922830d06de17bbd348b9967307f39b7d72bc09f58814eb",
|
||||||
|
"EsteriaVenthyrTextures.bin": "837774377ca055e6a5c79c1a4cfd8151e7c1f7ce2c16990b00fd445281137433",
|
||||||
|
"EsteriaVorkai.bin": "d6d2088c7e867b5db437e9afc2d323c22d830c6f84a3598415eedcaa27e2461f",
|
||||||
|
"EsteriaVorkaiTextures.bin": "837774377ca055e6a5c79c1a4cfd8151e7c1f7ce2c16990b00fd445281137433",
|
||||||
|
"EsteriaVrykul.bin": "39e2b7b4c67997dbbd34bae840bd606a59290f7f2fc82565a0ba00090335415c",
|
||||||
|
"EsteriaVrykulTextures.bin": "46098750a0e235724c6e9cc8d9d4e26550aa47bef95fd5f0f82efe5e945bf296",
|
||||||
|
"EsteriaVulpera.bin": "c5434993b9af4a17d881965e4735cd2ac379e39c7142aac9844adff9528562d4",
|
||||||
|
"EsteriaVulperaTextures.bin": "1ab844e74684aced2b069f1b91cd563aade45e05bd5e23f866a6c0c301cb098e",
|
||||||
|
"Interface/AddOns/CoAHideArmor/CoAHideArmor.lua": "8c1c7403524fc9bd56c0809b4101b141da700ba163701209bf1420f2ef106aa7",
|
||||||
|
"Interface/AddOns/CoAHideArmor/CoAHideArmor.toc": "123580d92fd5ceee258e96296f42c359b7e83cdff151af49c50c6c4e2059677c",
|
||||||
|
"Interface/AddOns/CoAQuestSafe/CoAQuestSafe.lua": "062de55c91228971553f482fd2c8753f4752993b4e8e49d4ded04fa18b98bde7",
|
||||||
|
"Interface/AddOns/CoAQuestSafe/CoAQuestSafe.toc": "890bb9d1087e236f4823603f5df3ab0e316dbb65c28feebbda08fb0ab53a408f",
|
||||||
|
"Interface/AddOns/CoAWC2Cursor/CoAWC2Cursor.lua": "1cf9537ff5f10b77250fea4407aea1008da690afe102ed6ed2dac21f79638cfa",
|
||||||
|
"Interface/AddOns/CoAWC2Cursor/CoAWC2Cursor.toc": "48ce695dce712b3643ebe13a77e318d623c964acc69479b8fc8cc675099801bf",
|
||||||
|
"Interface/AddOns/CoA_TalentReset/CoA_TalentReset.lua": "827d756d5948ef918fafaf8b869290b3a1faa4e4cc21b19b512a00d4509f3d41",
|
||||||
|
"Interface/AddOns/CoA_TalentReset/CoA_TalentReset.toc": "16298c04af68e68d6445e7a11f42aee525dd4145f85d2771ff434fb7c6e95a85",
|
||||||
|
"dinput8.dll": "f8de78606c241fb3911dce22faf68f5b9f9885b142b183c1e2c09ddc8f7e380c",
|
||||||
|
"wc2_human.cur": "f609736e29596bb386ef1597b157d211e01a86d32c2a929e256c581c37d71791",
|
||||||
|
"wc2_orc.cur": "baa512c9b9045762ba35b6e0d35b8f79c54b7649f35cc9c0e0cc8c168a1e5a97"
|
||||||
|
}
|
||||||
@@ -144,6 +144,10 @@ fn run_inner_mode(
|
|||||||
}
|
}
|
||||||
if matches!(verb, Verb::StartAll | Verb::StartWorld) {
|
if matches!(verb, Verb::StartAll | Verb::StartWorld) {
|
||||||
crate::modules::ensure_bot_exclusivity(&root)?;
|
crate::modules::ensure_bot_exclusivity(&root)?;
|
||||||
|
// A server update that only added races keeps the owner's race restriction (and custom races on).
|
||||||
|
if let Err(error) = crate::race_availability::rebind_unchanged(&root) {
|
||||||
|
tracing::warn!(%error, "the race restriction could not be checked against the race catalog");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if crate::docker::is_docker(&root) {
|
if crate::docker::is_docker(&root) {
|
||||||
prepare_headless_world(&root, verb)?;
|
prepare_headless_world(&root, verb)?;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
pub mod ops;
|
pub mod ops;
|
||||||
pub mod relay;
|
pub mod relay;
|
||||||
pub mod render;
|
pub mod render;
|
||||||
|
pub mod schedule;
|
||||||
pub mod services;
|
pub mod services;
|
||||||
pub mod settings;
|
pub mod settings;
|
||||||
pub mod spawn;
|
pub mod spawn;
|
||||||
|
|||||||
@@ -63,6 +63,21 @@ pub fn run(root: &Path, cfg: &Settings, offset: i32, action: Action, supervisor:
|
|||||||
if matches!(action, Action::StartAll | Action::StartWorld) {
|
if matches!(action, Action::StartAll | Action::StartWorld) {
|
||||||
squid::validate_bots(root)?;
|
squid::validate_bots(root)?;
|
||||||
}
|
}
|
||||||
|
let relocated;
|
||||||
|
let cfg = match action {
|
||||||
|
Action::StartAll | Action::StartMysql | Action::StartAuth | Action::StartWorld => {
|
||||||
|
match services::relocate_database_port(root, cfg, offset, progress)? {
|
||||||
|
Some(_) => {
|
||||||
|
let mut moved = Settings::load(root, offset)?;
|
||||||
|
moved.env_remove = cfg.env_remove.clone();
|
||||||
|
relocated = moved;
|
||||||
|
&relocated
|
||||||
|
}
|
||||||
|
None => cfg,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => cfg,
|
||||||
|
};
|
||||||
render::prepare(root, cfg)?;
|
render::prepare(root, cfg)?;
|
||||||
if action == Action::Prepare {
|
if action == Action::Prepare {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ pub fn prepare(root: &Path, config: &Settings) -> Result<Vec<PathBuf>> {
|
|||||||
std::fs::write(root.join(target), text.as_bytes())?;
|
std::fs::write(root.join(target), text.as_bytes())?;
|
||||||
written.push(root.join(target));
|
written.push(root.join(target));
|
||||||
}
|
}
|
||||||
|
let custom = custom_mysql_options(root);
|
||||||
let files: [(&str, String); 3] = [
|
let files: [(&str, String); 3] = [
|
||||||
(
|
(
|
||||||
"Core/configs/modules/coa_bugreport.conf",
|
"Core/configs/modules/coa_bugreport.conf",
|
||||||
@@ -150,7 +151,7 @@ pub fn prepare(root: &Path, config: &Settings) -> Result<Vec<PathBuf>> {
|
|||||||
(
|
(
|
||||||
"mysql/my.ini",
|
"mysql/my.ini",
|
||||||
format!(
|
format!(
|
||||||
"[mysqld]\nbasedir=\"{base}/mysql\"\ndatadir=\"{base}/mysql/data\"\nport={mysql_port}\nbind-address=127.0.0.1\nmysqlx=0\ncharacter-set-server=utf8mb4\ncollation-server=utf8mb4_unicode_ci\nmax_allowed_packet=128M\ninnodb_buffer_pool_size=256M\nskip-log-bin\nlog-error=\"{base}/mysql/logs/mysql-error.log\"\npid-file=\"{base}/mysql/mysql.pid\"\n"
|
"[mysqld]\nbasedir=\"{base}/mysql\"\ndatadir=\"{base}/mysql/data\"\nport={mysql_port}\nbind-address=127.0.0.1\nmysqlx=0\ncharacter-set-server=utf8mb4\ncollation-server=utf8mb4_unicode_ci\nmax_allowed_packet=128M\ninnodb_buffer_pool_size=256M\nskip-log-bin\nlog-error=\"{base}/mysql/logs/mysql-error.log\"\npid-file=\"{base}/mysql/mysql.pid\"\n{custom}"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -168,6 +169,85 @@ pub fn prepare(root: &Path, config: &Settings) -> Result<Vec<PathBuf>> {
|
|||||||
Ok(written)
|
Ok(written)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The owner's file of extra MySQL options; the launcher rewrites `mysql/my.ini` at every start.
|
||||||
|
pub const CUSTOM_MYSQL: &str = "Settings/mysql-custom.ini";
|
||||||
|
|
||||||
|
/// The owner's MySQL options as written, and the lines a start will add to `[mysqld]`.
|
||||||
|
#[derive(Debug, serde::Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct CustomMysql {
|
||||||
|
pub text: String,
|
||||||
|
pub applied: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn read_custom_mysql(root: &Path) -> CustomMysql {
|
||||||
|
let text = std::fs::read(root.join(CUSTOM_MYSQL))
|
||||||
|
.map(|b| String::from_utf8_lossy(&b).into_owned())
|
||||||
|
.unwrap_or_default();
|
||||||
|
CustomMysql { text, applied: custom_mysql_options(root) }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Save the owner's MySQL options; they apply at the next start of the database.
|
||||||
|
pub fn write_custom_mysql(root: &Path, text: &str) -> Result<CustomMysql> {
|
||||||
|
if text.len() > 16 * 1024 || text.contains(char::from(0)) {
|
||||||
|
return Err(Error::Invalid("The MySQL options must be plain text of at most 16 KB.".into()));
|
||||||
|
}
|
||||||
|
crate::fsx::atomic_write(&root.join(CUSTOM_MYSQL), text.replace("\r\n", "\n").as_bytes())?;
|
||||||
|
Ok(read_custom_mysql(root))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Options the server cannot run without, which only the launcher sets.
|
||||||
|
const MANAGED_MYSQL_OPTIONS: [&str; 10] = [
|
||||||
|
"basedir",
|
||||||
|
"datadir",
|
||||||
|
"port",
|
||||||
|
"bind-address",
|
||||||
|
"mysqlx",
|
||||||
|
"log-error",
|
||||||
|
"pid-file",
|
||||||
|
"socket",
|
||||||
|
"skip-networking",
|
||||||
|
"defaults-file",
|
||||||
|
];
|
||||||
|
|
||||||
|
/// `name = value` lines of the owner's file (outside any section or in `[mysqld]`), as lines for `[mysqld]`.
|
||||||
|
/// Comments, other sections, `!include` and the options the launcher manages are left out.
|
||||||
|
pub fn custom_mysql_options(root: &Path) -> String {
|
||||||
|
let Ok(bytes) = std::fs::read(root.join(CUSTOM_MYSQL)) else {
|
||||||
|
return String::new();
|
||||||
|
};
|
||||||
|
let text = String::from_utf8_lossy(&bytes);
|
||||||
|
let mut in_mysqld = true;
|
||||||
|
let mut out = String::new();
|
||||||
|
for line in text.trim_start_matches('\u{feff}').lines() {
|
||||||
|
let line = line.trim();
|
||||||
|
if line.is_empty() || line.starts_with('#') || line.starts_with(';') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if line.starts_with('[') {
|
||||||
|
in_mysqld = line.eq_ignore_ascii_case("[mysqld]");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if !in_mysqld || line.starts_with('!') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let name = line
|
||||||
|
.split('=')
|
||||||
|
.next()
|
||||||
|
.unwrap_or("")
|
||||||
|
.trim()
|
||||||
|
.to_ascii_lowercase()
|
||||||
|
.replace('_', "-");
|
||||||
|
let name = name.strip_prefix("loose-").unwrap_or(&name);
|
||||||
|
if name.is_empty() || MANAGED_MYSQL_OPTIONS.contains(&name) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
out.push_str(line);
|
||||||
|
out.push('\n');
|
||||||
|
}
|
||||||
|
out
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
mod sys {
|
mod sys {
|
||||||
use std::os::windows::ffi::OsStrExt;
|
use std::os::windows::ffi::OsStrExt;
|
||||||
@@ -206,6 +286,22 @@ mod tests {
|
|||||||
w("Settings/mod_ascension_compat.conf.template", b"Ascension.DbcDir = \"@ASCENSION_DBC@\"\rOld.Mac = 1\r");
|
w("Settings/mod_ascension_compat.conf.template", b"Ascension.DbcDir = \"@ASCENSION_DBC@\"\rOld.Mac = 1\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn the_owners_mysql_options_are_kept_except_the_managed_ones() {
|
||||||
|
let d = tempfile::tempdir().unwrap();
|
||||||
|
std::fs::create_dir_all(d.path().join("Settings")).unwrap();
|
||||||
|
std::fs::write(
|
||||||
|
d.path().join(CUSTOM_MYSQL),
|
||||||
|
"\u{feff}# tuning\ninnodb_buffer_pool_size = 2G\nport=3999\nloose_bind_address=0.0.0.0\n!include C:/x.ini\n[client]\nuser=evil\n[mysqld]\nmax_connections=500\nDATADIR=D:/elsewhere\n",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
custom_mysql_options(d.path()),
|
||||||
|
"innodb_buffer_pool_size = 2G\nmax_connections=500\n"
|
||||||
|
);
|
||||||
|
assert_eq!(custom_mysql_options(&d.path().join("missing")), "");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn placeholders_left_outside_comments_are_refused() {
|
fn placeholders_left_outside_comments_are_refused() {
|
||||||
let d = tempfile::tempdir().unwrap();
|
let d = tempfile::tempdir().unwrap();
|
||||||
|
|||||||
@@ -0,0 +1,162 @@
|
|||||||
|
//! Restarts on a schedule (#202): once a day at the owner's local time, the world supervisor asks the world to
|
||||||
|
//! restart with an in-game countdown, waits for it to exit with AzerothCore's restart code and starts it again.
|
||||||
|
//! The database and the auth server keep running.
|
||||||
|
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use chrono::{Local, NaiveDateTime, NaiveTime, Timelike};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::error::{Error, Result};
|
||||||
|
|
||||||
|
const FILE: &str = "Settings/restart-schedule.json";
|
||||||
|
/// Present while a scheduled restart is under way, so a world that is briefly down is not taken for a crash.
|
||||||
|
const UNDER_WAY: &str = ".state/scheduled-restart";
|
||||||
|
/// The exit code of `server restart` (AzerothCore's `RESTART_EXIT_CODE`).
|
||||||
|
pub const RESTART_EXIT_CODE: i32 = 2;
|
||||||
|
/// A restart missed by more than this (the computer slept, the world started late) waits for the next day.
|
||||||
|
const LATE: Duration = Duration::from_secs(15 * 60);
|
||||||
|
/// A world that has not come back within this time no longer counts as restarting.
|
||||||
|
const UNDER_WAY_LIMIT: Duration = Duration::from_secs(45 * 60);
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct RestartSchedule {
|
||||||
|
pub enabled: bool,
|
||||||
|
/// Local time, `HH:MM`.
|
||||||
|
pub time: String,
|
||||||
|
/// The in-game countdown before the restart, in minutes (1-60).
|
||||||
|
pub warning_minutes: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for RestartSchedule {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
enabled: false,
|
||||||
|
time: "05:00".into(),
|
||||||
|
warning_minutes: 5,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RestartSchedule {
|
||||||
|
fn at(&self) -> Option<NaiveTime> {
|
||||||
|
NaiveTime::parse_from_str(self.time.trim(), "%H:%M").ok()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn validate(&self) -> Result<()> {
|
||||||
|
if self.at().is_none() {
|
||||||
|
return Err(Error::Invalid("The restart time must be HH:MM, for example 05:00.".into()));
|
||||||
|
}
|
||||||
|
if !(1..=60).contains(&self.warning_minutes) {
|
||||||
|
return Err(Error::Invalid("The restart warning must be 1 to 60 minutes.".into()));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The scheduled moment of `now`'s day, when a restart is due at `now` for a world started at `started`:
|
||||||
|
/// the moment has passed by less than [`LATE`] and the world was already running before it.
|
||||||
|
pub fn due(&self, now: NaiveDateTime, started: NaiveDateTime) -> Option<NaiveDateTime> {
|
||||||
|
if !self.enabled {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let moment = now.date().and_time(self.at()?);
|
||||||
|
let late = now.signed_duration_since(moment).to_std().ok()?;
|
||||||
|
(late <= LATE && started < moment).then_some(moment)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The folder whose schedule a world follows: an extra world (`<server>/.realms/<name>`) follows its server's.
|
||||||
|
fn owner(root: &Path) -> PathBuf {
|
||||||
|
if crate::launcher::settings::is_extra_world(root) {
|
||||||
|
if let Some(main) = root.parent().and_then(Path::parent) {
|
||||||
|
return main.to_path_buf();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
root.to_path_buf()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn load(root: &Path) -> RestartSchedule {
|
||||||
|
crate::fsx::read_json(&owner(root).join(FILE)).unwrap_or_default()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn save(root: &Path, schedule: &RestartSchedule) -> Result<RestartSchedule> {
|
||||||
|
let mut schedule = schedule.clone();
|
||||||
|
schedule.time = schedule.time.trim().to_string();
|
||||||
|
if schedule.enabled {
|
||||||
|
schedule.validate()?;
|
||||||
|
} else if schedule.at().is_none() {
|
||||||
|
schedule.time = RestartSchedule::default().time;
|
||||||
|
}
|
||||||
|
crate::fsx::atomic_write_json(&owner(root).join(FILE), &schedule)?;
|
||||||
|
Ok(schedule)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn now() -> NaiveDateTime {
|
||||||
|
Local::now().naive_local().with_nanosecond(0).unwrap_or_else(|| Local::now().naive_local())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn mark_under_way(root: &Path) -> Result<()> {
|
||||||
|
let path = root.join(UNDER_WAY);
|
||||||
|
if let Some(parent) = path.parent() {
|
||||||
|
std::fs::create_dir_all(parent)?;
|
||||||
|
}
|
||||||
|
std::fs::write(path, b"")?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn clear_under_way(root: &Path) {
|
||||||
|
let _ = std::fs::remove_file(root.join(UNDER_WAY));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A scheduled restart of this world is under way (its world may be down for a few minutes).
|
||||||
|
pub fn under_way(root: &Path) -> bool {
|
||||||
|
std::fs::metadata(root.join(UNDER_WAY))
|
||||||
|
.and_then(|m| m.modified())
|
||||||
|
.is_ok_and(|t| t.elapsed().is_ok_and(|age| age < UNDER_WAY_LIMIT))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
fn at(text: &str) -> NaiveDateTime {
|
||||||
|
NaiveDateTime::parse_from_str(text, "%Y-%m-%d %H:%M").unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_restart_is_due_once_after_its_time_for_a_world_that_ran_before_it() {
|
||||||
|
let s = RestartSchedule { enabled: true, time: "05:00".into(), warning_minutes: 5 };
|
||||||
|
let started = at("2026-11-14 20:00");
|
||||||
|
assert_eq!(s.due(at("2026-11-15 04:59"), started), None);
|
||||||
|
assert_eq!(s.due(at("2026-11-15 05:00"), started), Some(at("2026-11-15 05:00")));
|
||||||
|
assert_eq!(s.due(at("2026-11-15 05:14"), started), Some(at("2026-11-15 05:00")));
|
||||||
|
assert_eq!(s.due(at("2026-11-15 05:16"), started), None, "missed by too much");
|
||||||
|
// The world that came back at 05:06 is not restarted again that day.
|
||||||
|
assert_eq!(s.due(at("2026-11-15 05:10"), at("2026-11-15 05:06")), None);
|
||||||
|
assert_eq!(s.due(at("2026-11-16 05:01"), at("2026-11-15 05:06")), Some(at("2026-11-16 05:00")));
|
||||||
|
let off = RestartSchedule { enabled: false, ..s };
|
||||||
|
assert_eq!(off.due(at("2026-11-15 05:00"), started), None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn schedules_are_validated_and_extra_worlds_follow_their_server() {
|
||||||
|
let d = tempfile::tempdir().unwrap();
|
||||||
|
assert_eq!(load(d.path()), RestartSchedule::default());
|
||||||
|
let bad = RestartSchedule { enabled: true, time: "25:00".into(), warning_minutes: 5 };
|
||||||
|
assert!(save(d.path(), &bad).is_err());
|
||||||
|
let quiet = RestartSchedule { enabled: true, time: "05:00".into(), warning_minutes: 0 };
|
||||||
|
assert!(save(d.path(), &quiet).is_err());
|
||||||
|
let good = RestartSchedule { enabled: true, time: " 04:30 ".into(), warning_minutes: 10 };
|
||||||
|
assert_eq!(save(d.path(), &good).unwrap().time, "04:30");
|
||||||
|
let extra = d.path().join(".realms/secondary");
|
||||||
|
std::fs::create_dir_all(&extra).unwrap();
|
||||||
|
assert!(load(&extra).enabled);
|
||||||
|
assert!(!under_way(d.path()));
|
||||||
|
mark_under_way(d.path()).unwrap();
|
||||||
|
assert!(under_way(d.path()));
|
||||||
|
clear_under_way(d.path());
|
||||||
|
assert!(!under_way(d.path()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,12 +35,24 @@ pub fn spawn(root: &Path, name: &str, exe: &Path, args: &[&str], cwd: &Path, log
|
|||||||
// Ports
|
// Ports
|
||||||
// ---------------------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
/// Wait (up to 30 s) until `port` can be bound by a new server. A port with a listening owner is refused at
|
/// What keeps a new server off a port.
|
||||||
/// once; a port Windows still holds for a stopped process (a PID-zero row) is waited for. The test bind is
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
/// exclusive (`SO_EXCLUSIVEADDRUSE`), never a shared one.
|
pub enum PortBlock {
|
||||||
pub fn ensure_free(port: u16, progress: Progress) -> Result<()> {
|
/// Processes listen on it.
|
||||||
let deadline = Instant::now() + Duration::from_secs(30);
|
Owned(Vec<u32>),
|
||||||
|
/// Windows keeps it in an excluded range (Hyper-V, WSL and Docker reserve such ranges); waiting never helps.
|
||||||
|
Reserved(u16, u16),
|
||||||
|
/// Windows still refuses it after the wait (a stopped process' socket, or an owner the table does not show).
|
||||||
|
Unavailable(i32),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Wait (up to `wait`) until `port` can be bound by a new server. A port with a listening owner or inside a
|
||||||
|
/// Windows excluded range is reported at once; a port Windows still holds for a stopped process (a PID-zero row)
|
||||||
|
/// is waited for. The test bind is exclusive (`SO_EXCLUSIVEADDRUSE`), never a shared one.
|
||||||
|
pub fn port_block(port: u16, wait: Duration, progress: Progress) -> std::result::Result<(), PortBlock> {
|
||||||
|
let deadline = Instant::now() + wait;
|
||||||
let mut announced = false;
|
let mut announced = false;
|
||||||
|
let mut reserved: Option<Vec<(u16, u16)>> = None;
|
||||||
loop {
|
loop {
|
||||||
let mut owners: Vec<u32> = sys::tcp_rows_v4()
|
let mut owners: Vec<u32> = sys::tcp_rows_v4()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -50,19 +62,17 @@ pub fn ensure_free(port: u16, progress: Progress) -> Result<()> {
|
|||||||
owners.sort_unstable();
|
owners.sort_unstable();
|
||||||
owners.dedup();
|
owners.dedup();
|
||||||
if owners.iter().any(|p| *p != 0) {
|
if owners.iter().any(|p| *p != 0) {
|
||||||
let list: Vec<String> = owners.iter().map(u32::to_string).collect();
|
return Err(PortBlock::Owned(owners));
|
||||||
return Err(Error::Service(
|
|
||||||
ErrorCode::PortInUse,
|
|
||||||
format!("Port {port} is already used (PID {}). Stop the other server or change Settings/repack.json.", list.join(", ")),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
match sys::exclusive_bind(port) {
|
match sys::exclusive_bind(port) {
|
||||||
Ok(()) => return Ok(()),
|
Ok(()) => return Ok(()),
|
||||||
Err(code) if code == 10013 || code == 10048 => {
|
Err(code) if code == 10013 || code == 10048 => {
|
||||||
|
let ranges = reserved.get_or_insert_with(sys::excluded_ranges);
|
||||||
|
if let Some((start, end)) = ranges.iter().copied().find(|(s, e)| (*s..=*e).contains(&port)) {
|
||||||
|
return Err(PortBlock::Reserved(start, end));
|
||||||
|
}
|
||||||
if Instant::now() >= deadline {
|
if Instant::now() >= deadline {
|
||||||
return Err(Error::Invalid(format!(
|
return Err(PortBlock::Unavailable(code));
|
||||||
"Port {port} remains unavailable after 30 seconds (Windows bind error {code}). No process was stopped. Retry after the previous database shutdown has finished, or check the Windows port reservation."
|
|
||||||
)));
|
|
||||||
}
|
}
|
||||||
if !announced {
|
if !announced {
|
||||||
progress(&format!("Waiting for Windows to release port {port}..."));
|
progress(&format!("Waiting for Windows to release port {port}..."));
|
||||||
@@ -70,11 +80,119 @@ pub fn ensure_free(port: u16, progress: Progress) -> Result<()> {
|
|||||||
}
|
}
|
||||||
std::thread::sleep(Duration::from_millis(250));
|
std::thread::sleep(Duration::from_millis(250));
|
||||||
}
|
}
|
||||||
Err(code) => return Err(Error::Invalid(format!("Port {port} cannot be checked (Windows error {code})."))),
|
Err(code) => return Err(PortBlock::Unavailable(code)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn port_error(port: u16, block: PortBlock) -> Error {
|
||||||
|
match block {
|
||||||
|
PortBlock::Owned(owners) => {
|
||||||
|
let list: Vec<String> = owners.iter().map(u32::to_string).collect();
|
||||||
|
Error::Service(
|
||||||
|
ErrorCode::PortInUse,
|
||||||
|
format!("Port {port} is already used (PID {}). Stop the other server or change Settings/repack.json.", list.join(", ")),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
PortBlock::Reserved(start, end) => Error::Service(
|
||||||
|
ErrorCode::PortInUse,
|
||||||
|
format!(
|
||||||
|
"Port {port} is reserved by Windows (excluded range {start}-{end}; Hyper-V, WSL and Docker reserve such ranges). Choose another port in Settings/repack.json, or restart the Windows NAT service as administrator (net stop winnat, then net start winnat)."
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PortBlock::Unavailable(code) if code == 10013 || code == 10048 => Error::Invalid(format!(
|
||||||
|
"Port {port} remains unavailable after 30 seconds (Windows bind error {code}). No process was stopped. Retry after the previous database shutdown has finished, or check the Windows port reservation."
|
||||||
|
)),
|
||||||
|
PortBlock::Unavailable(code) => Error::Invalid(format!("Port {port} cannot be checked (Windows error {code}).")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [`port_block`] with up to 30 s of waiting, as an error a person can act on.
|
||||||
|
pub fn ensure_free(port: u16, progress: Progress) -> Result<()> {
|
||||||
|
port_block(port, Duration::from_secs(30), progress).map_err(|block| port_error(port, block))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The ports of this server's other services and extra worlds, which the database must not take.
|
||||||
|
fn ports_in_use_by_server(root: &Path, cfg: &Settings) -> Vec<u16> {
|
||||||
|
let mut ports = vec![cfg.auth_port, cfg.world_port, cfg.ra_port];
|
||||||
|
for tree in crate::multiworld::Tree::ALL {
|
||||||
|
let other = crate::multiworld::tree_root(root, tree);
|
||||||
|
if let Ok(other) = Settings::load(&other, 0) {
|
||||||
|
ports.extend([other.world_port, other.ra_port, other.auth_port]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ports
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Before the database starts: when its port is reserved by Windows or held by a program that is not this
|
||||||
|
/// server's MySQL, move the database to a free port and record it in `Settings/repack.json`. Only this server's
|
||||||
|
/// own services connect to MySQL (players never do), and every start renders their configs from that file, so
|
||||||
|
/// the move needs nothing else. Returns the new port, or `None` when the configured one is usable.
|
||||||
|
pub fn relocate_database_port(root: &Path, cfg: &Settings, offset: i32, progress: Progress) -> Result<Option<u16>> {
|
||||||
|
if cfg.shared_database || offset != 0 || state::running(root, "mysql").is_some() {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
let block = match port_block(cfg.mysql_port, Duration::from_secs(30), progress) {
|
||||||
|
Ok(()) => return Ok(None),
|
||||||
|
Err(block) => block,
|
||||||
|
};
|
||||||
|
let ours = root.join("mysql/bin/mysqld.exe");
|
||||||
|
if let PortBlock::Owned(owners) = &block {
|
||||||
|
// This server's own database without a record: never start a second one on the same data.
|
||||||
|
let same = |pid: &u32| {
|
||||||
|
crate::process::identity(*pid).is_some_and(|p| same_file(Path::new(&p.exe), &ours))
|
||||||
|
};
|
||||||
|
if owners.iter().any(same) {
|
||||||
|
return Err(port_error(cfg.mysql_port, block));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let taken = ports_in_use_by_server(root, cfg);
|
||||||
|
let reserved = sys::excluded_ranges();
|
||||||
|
let candidate = (cfg.mysql_port.saturating_add(1)..=cfg.mysql_port.saturating_add(400))
|
||||||
|
.chain(33070..=33470)
|
||||||
|
.filter(|p| *p > 1024)
|
||||||
|
.find(|p| {
|
||||||
|
!taken.contains(p)
|
||||||
|
&& !reserved.iter().any(|(s, e)| (*s..=*e).contains(p))
|
||||||
|
&& port_block(*p, Duration::ZERO, &|_| {}).is_ok()
|
||||||
|
});
|
||||||
|
let Some(port) = candidate else {
|
||||||
|
return Err(port_error(cfg.mysql_port, block));
|
||||||
|
};
|
||||||
|
let reason = match &block {
|
||||||
|
PortBlock::Owned(_) => "used by another program",
|
||||||
|
PortBlock::Reserved(..) => "reserved by Windows",
|
||||||
|
PortBlock::Unavailable(_) => "unavailable",
|
||||||
|
};
|
||||||
|
let path = root.join("Settings/repack.json");
|
||||||
|
let mut raw = cfg.raw.clone();
|
||||||
|
raw.insert("mysqlPort".into(), port.into());
|
||||||
|
crate::fsx::atomic_write_json(&path, &serde_json::Value::Object(raw))?;
|
||||||
|
tracing::warn!(old = cfg.mysql_port, new = port, reason, "database moved to a free port");
|
||||||
|
progress(&format!("Port {} is {reason}; the database now uses port {port}.", cfg.mysql_port));
|
||||||
|
Ok(Some(port))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn same_file(a: &Path, b: &Path) -> bool {
|
||||||
|
match (std::fs::canonicalize(a), std::fs::canonicalize(b)) {
|
||||||
|
(Ok(a), Ok(b)) => a.to_string_lossy().eq_ignore_ascii_case(&b.to_string_lossy()),
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The ranges of `netsh interface ipv4 show excludedportrange protocol=tcp`: every line that starts with two
|
||||||
|
/// port numbers (the headers are translated, the numbers are not).
|
||||||
|
pub(crate) fn parse_excluded_ranges(text: &str) -> Vec<(u16, u16)> {
|
||||||
|
text.lines()
|
||||||
|
.filter_map(|line| {
|
||||||
|
let mut parts = line.split_whitespace();
|
||||||
|
let start = parts.next()?.parse::<u16>().ok()?;
|
||||||
|
let end = parts.next()?.parse::<u16>().ok()?;
|
||||||
|
(start <= end).then_some((start, end))
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
/// Is the recorded process of `name` serving `port`? Its listener row is the evidence; when a system does not
|
/// Is the recorded process of `name` serving `port`? Its listener row is the evidence; when a system does not
|
||||||
/// show the owner of a listener, the server side of a fresh loopback connection is (never for MySQL, whose
|
/// show the owner of a listener, the server side of a fresh loopback connection is (never for MySQL, whose
|
||||||
/// listener has always been visible and which should not get stray connections).
|
/// listener has always been visible and which should not get stray connections).
|
||||||
@@ -217,8 +335,8 @@ pub fn start_mysql(root: &Path, cfg: &Settings, progress: Progress) -> Result<()
|
|||||||
mysql(
|
mysql(
|
||||||
root,
|
root,
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
"UPDATE acore_auth.realmlist SET name='{}',address='127.0.0.1',localAddress='127.0.0.1',port={} WHERE id={};",
|
"UPDATE acore_auth.realmlist SET name={},address='127.0.0.1',localAddress='127.0.0.1',port={} WHERE id={};",
|
||||||
cfg.realm.name, cfg.world_port, cfg.realm.id
|
crate::realm_names::sql_literal(&cfg.realm.name), cfg.world_port, cfg.realm.id
|
||||||
)),
|
)),
|
||||||
None,
|
None,
|
||||||
)?;
|
)?;
|
||||||
@@ -473,6 +591,29 @@ mod sys {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Bind 0.0.0.0:port exclusively and release it. Err carries the Windows socket error.
|
/// Bind 0.0.0.0:port exclusively and release it. Err carries the Windows socket error.
|
||||||
|
/// Windows' excluded TCP port ranges, read with the system's own netsh (never one from PATH or the server).
|
||||||
|
pub fn excluded_ranges() -> Vec<(u16, u16)> {
|
||||||
|
use std::os::windows::process::CommandExt;
|
||||||
|
let mut directory = vec![0u16; 32768];
|
||||||
|
let length = unsafe {
|
||||||
|
windows_sys::Win32::System::SystemInformation::GetSystemDirectoryW(directory.as_mut_ptr(), directory.len() as u32)
|
||||||
|
} as usize;
|
||||||
|
if length == 0 || length >= directory.len() {
|
||||||
|
return Vec::new();
|
||||||
|
}
|
||||||
|
let netsh = std::path::PathBuf::from(String::from_utf16_lossy(&directory[..length])).join("netsh.exe");
|
||||||
|
let output = std::process::Command::new(netsh)
|
||||||
|
.args(["interface", "ipv4", "show", "excludedportrange", "protocol=tcp"])
|
||||||
|
.stdin(std::process::Stdio::null())
|
||||||
|
.stderr(std::process::Stdio::null())
|
||||||
|
.creation_flags(super::CREATE_NO_WINDOW)
|
||||||
|
.output();
|
||||||
|
match output {
|
||||||
|
Ok(out) if out.status.success() => super::parse_excluded_ranges(&String::from_utf8_lossy(&out.stdout)),
|
||||||
|
_ => Vec::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn exclusive_bind(port: u16) -> std::result::Result<(), i32> {
|
pub fn exclusive_bind(port: u16) -> std::result::Result<(), i32> {
|
||||||
use socket2::{Domain, Socket, Type};
|
use socket2::{Domain, Socket, Type};
|
||||||
use std::os::windows::io::AsRawSocket;
|
use std::os::windows::io::AsRawSocket;
|
||||||
@@ -527,6 +668,9 @@ mod sys {
|
|||||||
pub fn exclusive_bind(_: u16) -> std::result::Result<(), i32> {
|
pub fn exclusive_bind(_: u16) -> std::result::Result<(), i32> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
pub fn excluded_ranges() -> Vec<(u16, u16)> {
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
pub fn terminate(_: &ProcessIdentity) -> Result<()> {
|
pub fn terminate(_: &ProcessIdentity) -> Result<()> {
|
||||||
Err(Error::Invalid("not supported".into()))
|
Err(Error::Invalid("not supported".into()))
|
||||||
}
|
}
|
||||||
@@ -536,6 +680,57 @@ mod sys {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn excluded_ranges_are_read_from_translated_netsh_output() {
|
||||||
|
let english = "\r\nProtocol tcp Port Exclusion Ranges\r\n\r\nStart Port End Port\r\n---------- --------\r\n 3250 3349\r\n 50000 50059 *\r\n\r\n* - Administered port exclusions.\r\n";
|
||||||
|
assert_eq!(parse_excluded_ranges(english), vec![(3250, 3349), (50000, 50059)]);
|
||||||
|
let russian = "\r\nПротокол tcp Диапазоны исключения портов\r\n\r\nНачальный порт Конечный порт\r\n---------- --------\r\n 50000 50059 *\r\n\r\n* — управляемые исключения портов.\r\n";
|
||||||
|
assert_eq!(parse_excluded_ranges(russian), vec![(50000, 50059)]);
|
||||||
|
assert!(parse_excluded_ranges("").is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn repack(dir: &Path, mysql: u16) {
|
||||||
|
std::fs::create_dir_all(dir.join("Settings")).unwrap();
|
||||||
|
std::fs::write(
|
||||||
|
dir.join("Settings/repack.json"),
|
||||||
|
format!(r#"{{"mysqlPort":{mysql},"authPort":3724,"worldPort":8085,"raPort":3443,"raUsername":"U","raPassword":"P"}}"#),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_taken_database_port_moves_to_a_free_one_and_is_recorded() {
|
||||||
|
let d = tempfile::tempdir().unwrap();
|
||||||
|
let held = std::net::TcpListener::bind("0.0.0.0:0").unwrap();
|
||||||
|
let port = held.local_addr().unwrap().port();
|
||||||
|
repack(d.path(), port);
|
||||||
|
let cfg = Settings::load(d.path(), 0).unwrap();
|
||||||
|
let said = std::cell::RefCell::new(Vec::new());
|
||||||
|
let moved = relocate_database_port(d.path(), &cfg, 0, &|line| said.borrow_mut().push(line.to_string()))
|
||||||
|
.unwrap()
|
||||||
|
.expect("moved");
|
||||||
|
assert_ne!(moved, port);
|
||||||
|
let again = Settings::load(d.path(), 0).unwrap();
|
||||||
|
assert_eq!(again.mysql_port, moved);
|
||||||
|
assert_eq!((again.auth_port, again.ra_username.as_str()), (3724, "U"), "other keys are kept");
|
||||||
|
assert!(said.borrow().iter().any(|l| l.contains("used by another program")), "{said:?}");
|
||||||
|
// The new port is usable: nothing moves on the next start.
|
||||||
|
assert_eq!(relocate_database_port(d.path(), &again, 0, &|_| {}).unwrap(), None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn extra_worlds_and_shifted_test_ports_never_move_the_database() {
|
||||||
|
let d = tempfile::tempdir().unwrap();
|
||||||
|
let held = std::net::TcpListener::bind("0.0.0.0:0").unwrap();
|
||||||
|
let port = held.local_addr().unwrap().port();
|
||||||
|
repack(d.path(), port);
|
||||||
|
let cfg = Settings::load(d.path(), 0).unwrap();
|
||||||
|
let shared = Settings { shared_database: true, ..cfg.clone() };
|
||||||
|
assert_eq!(relocate_database_port(d.path(), &shared, 0, &|_| {}).unwrap(), None);
|
||||||
|
assert_eq!(relocate_database_port(d.path(), &cfg, 5, &|_| {}).unwrap(), None);
|
||||||
|
assert_eq!(Settings::load(d.path(), 0).unwrap().mysql_port, port);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_port_with_a_listener_is_refused_and_a_free_one_passes() {
|
fn a_port_with_a_listener_is_refused_and_a_free_one_passes() {
|
||||||
let held = std::net::TcpListener::bind("0.0.0.0:0").unwrap();
|
let held = std::net::TcpListener::bind("0.0.0.0:0").unwrap();
|
||||||
@@ -554,9 +749,11 @@ mod tests {
|
|||||||
assert!(!ready(d.path(), "auth", port), "no record yet");
|
assert!(!ready(d.path(), "auth", port), "no record yet");
|
||||||
state::record(d.path(), "auth", std::process::id()).unwrap();
|
state::record(d.path(), "auth", std::process::id()).unwrap();
|
||||||
assert!(ready(d.path(), "auth", port));
|
assert!(ready(d.path(), "auth", port));
|
||||||
|
// A port nobody listens on now (port + 1 may belong to a test running in parallel in this process).
|
||||||
let other = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
|
let other = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||||
|
let free = other.local_addr().unwrap().port();
|
||||||
drop(other);
|
drop(other);
|
||||||
assert!(!ready(d.path(), "auth", port + 1) || port + 1 == 0);
|
assert!(!ready(d.path(), "auth", free));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ pub const PORT_KEYS: [&str; 4] = ["mysqlPort", "authPort", "worldPort", "raPort"
|
|||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct Realm {
|
pub struct Realm {
|
||||||
pub id: u32,
|
pub id: u32,
|
||||||
pub name: &'static str,
|
pub name: String,
|
||||||
pub world_db: &'static str,
|
pub world_db: &'static str,
|
||||||
pub characters_db: &'static str,
|
pub characters_db: &'static str,
|
||||||
}
|
}
|
||||||
@@ -22,15 +22,19 @@ pub struct Realm {
|
|||||||
impl Realm {
|
impl Realm {
|
||||||
pub fn load(root: &Path) -> Result<Realm> {
|
pub fn load(root: &Path) -> Result<Realm> {
|
||||||
let path = root.join("Settings/realm-profile.json");
|
let path = root.join("Settings/realm-profile.json");
|
||||||
if !path.exists() {
|
let (id, name, world_db, characters_db) = if !path.exists() {
|
||||||
return Ok(Realm { id: 1, name: "AzerothCore", world_db: "acore_world", characters_db: "acore_characters" });
|
(1, "AzerothCore", "acore_world", "acore_characters")
|
||||||
}
|
} else {
|
||||||
let v: serde_json::Value = crate::fsx::read_json(&path)?;
|
let v: serde_json::Value = crate::fsx::read_json(&path)?;
|
||||||
Ok(match v.get("active").and_then(|a| a.as_str()).unwrap_or("coa") {
|
match v.get("active").and_then(|a| a.as_str()).unwrap_or("coa") {
|
||||||
"wildcard" => Realm { id: 2, name: "Wildcard", world_db: "acore_world_wildcard", characters_db: "acore_characters_wildcard" },
|
"wildcard" => (2, "Wildcard", "acore_world_wildcard", "acore_characters_wildcard"),
|
||||||
"reborn" => Realm { id: 3, name: "Warcraft Reborn", world_db: "acore_world_reborn", characters_db: "acore_characters_reborn" },
|
"reborn" => (3, "Warcraft Reborn", "acore_world_reborn", "acore_characters_reborn"),
|
||||||
_ => Realm { id: 1, name: "Conquest of Azeroth", world_db: "acore_world", characters_db: "acore_characters" },
|
_ => (1, "Conquest of Azeroth", "acore_world", "acore_characters"),
|
||||||
})
|
}
|
||||||
|
};
|
||||||
|
// The owner's own name for this realm, when one was chosen in the Manager.
|
||||||
|
let name = crate::realm_names::name_or(root, id, name);
|
||||||
|
Ok(Realm { id, name, world_db, characters_db })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use std::time::{Duration, Instant};
|
|||||||
use crate::error::{Error, ErrorCode, Result};
|
use crate::error::{Error, ErrorCode, Result};
|
||||||
use crate::launcher::services::{self, ensure_free, mysql, spawn, start_mysql, wait_ready, Progress};
|
use crate::launcher::services::{self, ensure_free, mysql, spawn, start_mysql, wait_ready, Progress};
|
||||||
use crate::launcher::spawn::Proc;
|
use crate::launcher::spawn::Proc;
|
||||||
use crate::launcher::{settings::Settings, squid, state};
|
use crate::launcher::{schedule, settings::Settings, squid, state};
|
||||||
|
|
||||||
fn stop_relay_flag(root: &Path) -> std::path::PathBuf {
|
fn stop_relay_flag(root: &Path) -> std::path::PathBuf {
|
||||||
state::dir(root).join("stop-relay")
|
state::dir(root).join("stop-relay")
|
||||||
@@ -169,24 +169,70 @@ fn spawn_relay(root: &Path, launcher: Option<&Path>) -> Result<Proc> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The supervisor (`watch-world`): run the world, keep the relay alive while it runs, stop the relay after it.
|
/// The supervisor (`watch-world`): run the world, keep the relay alive while it runs, stop the relay after it.
|
||||||
/// `launcher` is the launcher executable that runs the relay (`None`: the Python relay).
|
/// `launcher` is the launcher executable that runs the relay (`None`: the Python relay). At the owner's scheduled
|
||||||
pub fn watch_world(root: &Path, launcher: Option<&Path>, log: Progress) -> Result<()> {
|
/// time it asks the world to restart with an in-game countdown and starts it again when it exits for that.
|
||||||
|
pub fn watch_world(root: &Path, launcher: Option<&Path>, offset: i32, log: Progress) -> Result<()> {
|
||||||
squid::validate_bots(root)?;
|
squid::validate_bots(root)?;
|
||||||
let world = spawn_child(root, "world", &root.join("Core/worldserver.exe"), &["-c", "configs/worldserver.conf"], &root.join("Core"), &root.join("Core/Logs/world-console.log"))?;
|
|
||||||
let mut relay: Option<Proc> = None;
|
let mut relay: Option<Proc> = None;
|
||||||
while world.try_wait().is_none() {
|
loop {
|
||||||
let dead = relay.as_ref().is_none_or(|r| r.try_wait().is_some());
|
let world = spawn_child(root, "world", &root.join("Core/worldserver.exe"), &["-c", "configs/worldserver.conf"], &root.join("Core"), &root.join("Core/Logs/world-console.log"))?;
|
||||||
if dead {
|
let started = schedule::now();
|
||||||
match spawn_relay(root, launcher) {
|
let mut requested = false;
|
||||||
Ok(r) => relay = Some(r),
|
let mut last_check: Option<Instant> = None;
|
||||||
Err(e) => {
|
let code = loop {
|
||||||
log(&format!("Report relay could not start ({e}); retrying."));
|
if let Some(code) = world.try_wait() {
|
||||||
std::thread::sleep(Duration::from_secs(5));
|
break code;
|
||||||
continue;
|
}
|
||||||
|
let dead = relay.as_ref().is_none_or(|r| r.try_wait().is_some());
|
||||||
|
if dead {
|
||||||
|
match spawn_relay(root, launcher) {
|
||||||
|
Ok(r) => relay = Some(r),
|
||||||
|
Err(e) => {
|
||||||
|
log(&format!("Report relay could not start ({e}); retrying."));
|
||||||
|
std::thread::sleep(Duration::from_secs(5));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if last_check.is_none_or(|t| t.elapsed() >= Duration::from_secs(30)) {
|
||||||
|
last_check = Some(Instant::now());
|
||||||
|
if schedule::under_way(root) && !requested {
|
||||||
|
// The world that a scheduled restart started again is back once it accepts connections.
|
||||||
|
if Settings::load(root, offset).is_ok_and(|cfg| services::ready(root, "world", cfg.world_port)) {
|
||||||
|
schedule::clear_under_way(root);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !requested {
|
||||||
|
let plan = schedule::load(root);
|
||||||
|
if plan.due(schedule::now(), started).is_some() {
|
||||||
|
let seconds = plan.warning_minutes * 60;
|
||||||
|
let asked = Settings::load(root, offset).and_then(|cfg| {
|
||||||
|
crate::ra::Ra::connect_to(cfg.ra_port, &cfg.ra_username, &cfg.ra_password)
|
||||||
|
.and_then(|mut ra| ra.run(&format!("server restart {seconds}")))
|
||||||
|
});
|
||||||
|
match asked {
|
||||||
|
Ok(_) => {
|
||||||
|
schedule::mark_under_way(root)?;
|
||||||
|
requested = true;
|
||||||
|
log(&format!("Scheduled restart: the world restarts in {} minutes.", plan.warning_minutes));
|
||||||
|
}
|
||||||
|
Err(e) => log(&format!("Scheduled restart could not be requested ({e}); retrying.")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::thread::sleep(Duration::from_secs(2));
|
||||||
|
};
|
||||||
|
if requested && code == schedule::RESTART_EXIT_CODE as u32 {
|
||||||
|
log("Scheduled restart: starting the world again.");
|
||||||
|
if let Err(e) = squid::validate_bots(root) {
|
||||||
|
schedule::clear_under_way(root);
|
||||||
|
return Err(e);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
std::thread::sleep(Duration::from_secs(2));
|
schedule::clear_under_way(root);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
std::fs::write(stop_relay_flag(root), b"")?;
|
std::fs::write(stop_relay_flag(root), b"")?;
|
||||||
if let Some(r) = relay {
|
if let Some(r) = relay {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
pub mod accounts;
|
pub mod accounts;
|
||||||
pub mod allsettings;
|
pub mod allsettings;
|
||||||
|
pub mod addons;
|
||||||
pub mod backup;
|
pub mod backup;
|
||||||
pub mod channels;
|
pub mod channels;
|
||||||
pub mod character_start_check;
|
pub mod character_start_check;
|
||||||
@@ -56,6 +57,7 @@ pub mod ra;
|
|||||||
pub mod race_availability;
|
pub mod race_availability;
|
||||||
pub mod realm_registry;
|
pub mod realm_registry;
|
||||||
pub mod realmlist;
|
pub mod realmlist;
|
||||||
|
pub mod realm_names;
|
||||||
pub mod realms;
|
pub mod realms;
|
||||||
pub mod registry;
|
pub mod registry;
|
||||||
pub mod release;
|
pub mod release;
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ pub struct Entry {
|
|||||||
/// Not shown on the Modules page; its settings are offered elsewhere (a server setting card).
|
/// Not shown on the Modules page; its settings are offered elsewhere (a server setting card).
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub hidden: bool,
|
pub hidden: bool,
|
||||||
|
/// A part of another module, switched and set up inside that module's settings (Custom Races V2 brings
|
||||||
|
/// subclasses and the /dev menu).
|
||||||
|
#[serde(default)]
|
||||||
|
pub part_of: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn yes() -> bool {
|
fn yes() -> bool {
|
||||||
@@ -111,6 +115,7 @@ pub struct ModuleView {
|
|||||||
pub page: Option<String>,
|
pub page: Option<String>,
|
||||||
pub hidden: bool,
|
pub hidden: bool,
|
||||||
pub compatibility: String,
|
pub compatibility: String,
|
||||||
|
pub part_of: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn list(root: &Path) -> Vec<ModuleView> {
|
pub fn list(root: &Path) -> Vec<ModuleView> {
|
||||||
@@ -171,6 +176,32 @@ fn installed_module_commits(root: &Path) -> BTreeMap<String, String> {
|
|||||||
Default::default()
|
Default::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The companion bots of this server build play Wildcard and Warcraft Reborn: their bot profiles for the standard
|
||||||
|
/// classes are in the world server or its bots plugin. Older builds only know Conquest of Azeroth characters.
|
||||||
|
pub fn companions_on_other_realms(root: &Path) -> bool {
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::sync::{Mutex, OnceLock};
|
||||||
|
static SEEN: OnceLock<Mutex<HashMap<(PathBuf, u64, Option<std::time::SystemTime>), bool>>> = OnceLock::new();
|
||||||
|
const MARKER: &[u8] = b"Druid_Guardian_Tank";
|
||||||
|
let mut files = vec![crate::layout::executables(root).0];
|
||||||
|
if let Ok(plugins) = fs::read_dir(root.join("Core/plugins")) {
|
||||||
|
files.extend(plugins.flatten().map(|e| e.path()).filter(|p| p.extension().is_some_and(|x| x.eq_ignore_ascii_case("dll"))));
|
||||||
|
}
|
||||||
|
files.into_iter().any(|file| {
|
||||||
|
let Ok(meta) = fs::metadata(&file) else { return false };
|
||||||
|
let key = (file.clone(), meta.len(), meta.modified().ok());
|
||||||
|
let seen = SEEN.get_or_init(Mutex::default);
|
||||||
|
if let Some(found) = seen.lock().ok().and_then(|s| s.get(&key).copied()) {
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
let found = fs::read(&file).is_ok_and(|bytes| bytes.windows(MARKER.len()).any(|w| w == MARKER));
|
||||||
|
if let Ok(mut s) = seen.lock() {
|
||||||
|
s.insert(key, found);
|
||||||
|
}
|
||||||
|
found
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn list_in(cat: &[Entry], root: &Path) -> Vec<ModuleView> {
|
fn list_in(cat: &[Entry], root: &Path) -> Vec<ModuleView> {
|
||||||
let installed_commits = installed_module_commits(root);
|
let installed_commits = installed_module_commits(root);
|
||||||
let wildcard = crate::realms::state(root)
|
let wildcard = crate::realms::state(root)
|
||||||
@@ -203,7 +234,9 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec<ModuleView> {
|
|||||||
.map(|enabled| !enabled)
|
.map(|enabled| !enabled)
|
||||||
.unwrap_or(true);
|
.unwrap_or(true);
|
||||||
let blocked = dependency_missing
|
let blocked = dependency_missing
|
||||||
|| (wildcard && matches!(e.id.as_str(), "companions" | "playerbots" | "dungeon-clear"));
|
|| (wildcard
|
||||||
|
&& (matches!(e.id.as_str(), "playerbots" | "dungeon-clear")
|
||||||
|
|| (e.id == "companions" && !companions_on_other_realms(root))));
|
||||||
let version = if e.id == "playerbots" {
|
let version = if e.id == "playerbots" {
|
||||||
crate::squid::release(root).map(|release| {
|
crate::squid::release(root).map(|release| {
|
||||||
[
|
[
|
||||||
@@ -256,6 +289,7 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec<ModuleView> {
|
|||||||
icon: e.icon,
|
icon: e.icon,
|
||||||
page: e.page,
|
page: e.page,
|
||||||
hidden: e.hidden,
|
hidden: e.hidden,
|
||||||
|
part_of: e.part_of,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
@@ -716,6 +750,27 @@ mod tests {
|
|||||||
assert!(meta.join("backups").exists());
|
assert!(meta.join("backups").exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn companions_open_on_other_realms_only_with_a_build_that_plays_them() {
|
||||||
|
let temp = tempfile::tempdir().unwrap();
|
||||||
|
let root = temp.path().join("server");
|
||||||
|
fs::create_dir_all(dir(&root)).unwrap();
|
||||||
|
fs::create_dir_all(root.join("Settings")).unwrap();
|
||||||
|
fs::write(root.join("Settings/realm-profile.json"), r#"{"active":"wildcard","wildcard_created":true}"#).unwrap();
|
||||||
|
for e in catalog().iter().filter(|e| matches!(e.id.as_str(), "companions" | "playerbots")) {
|
||||||
|
fs::write(dir(&root).join(format!("{}.dist", e.conf)), format!("{} = 0\n", e.enable_key)).unwrap();
|
||||||
|
}
|
||||||
|
let exe = crate::layout::executables(&root).0;
|
||||||
|
fs::write(&exe, b"an old world server").unwrap();
|
||||||
|
let view = |id: &str| list(&root).into_iter().find(|m| m.id == id).unwrap();
|
||||||
|
assert_eq!(view("companions").compatibility, "unsupported");
|
||||||
|
fs::write(&exe, b"profiles ... Druid_Guardian_Tank ... a new world server").unwrap();
|
||||||
|
assert!(companions_on_other_realms(&root));
|
||||||
|
assert_eq!(view("companions").compatibility, "experimental");
|
||||||
|
assert!(view("companions").switchable);
|
||||||
|
assert_eq!(view("playerbots").compatibility, "unsupported", "SQUID stays CoA-only");
|
||||||
|
}
|
||||||
|
|
||||||
fn test_catalog() -> Vec<Entry> {
|
fn test_catalog() -> Vec<Entry> {
|
||||||
let one = |id: &str, name: &str, conf: &str, key: &str| Entry {
|
let one = |id: &str, name: &str, conf: &str, key: &str| Entry {
|
||||||
id: id.into(),
|
id: id.into(),
|
||||||
@@ -734,6 +789,7 @@ mod tests {
|
|||||||
icon: String::new(),
|
icon: String::new(),
|
||||||
page: None,
|
page: None,
|
||||||
hidden: false,
|
hidden: false,
|
||||||
|
part_of: None,
|
||||||
};
|
};
|
||||||
vec![
|
vec![
|
||||||
one(
|
one(
|
||||||
@@ -1379,6 +1435,7 @@ mod tests {
|
|||||||
icon: String::new(),
|
icon: String::new(),
|
||||||
page: None,
|
page: None,
|
||||||
hidden: false,
|
hidden: false,
|
||||||
|
part_of: None,
|
||||||
};
|
};
|
||||||
let cat = vec![compat];
|
let cat = vec![compat];
|
||||||
let v = list_in(&cat, &root).remove(0);
|
let v = list_in(&cat, &root).remove(0);
|
||||||
|
|||||||
@@ -97,6 +97,58 @@ pub fn world_root(main: &Path, mode: Mode) -> PathBuf {
|
|||||||
.map_or_else(|| main.to_path_buf(), |t| tree_root(main, t))
|
.map_or_else(|| main.to_path_buf(), |t| tree_root(main, t))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct BotOperationTarget {
|
||||||
|
pub world_root: PathBuf,
|
||||||
|
pub chars_db: &'static str,
|
||||||
|
pub ra_port: u16,
|
||||||
|
pub running: bool,
|
||||||
|
pub realm: Mode,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn resolve_bot_operation_target(main: &Path, realm: Mode) -> Result<BotOperationTarget> {
|
||||||
|
let state = realms::state(main)?;
|
||||||
|
let chars_db = realm.schema("characters")?;
|
||||||
|
|
||||||
|
if realm == state.active {
|
||||||
|
let ports = crate::layout::read_ports(main);
|
||||||
|
let ra_port = ports.ra;
|
||||||
|
let status = process::observe(main, &ports);
|
||||||
|
let running = status.world.state != ServiceState::Stopped;
|
||||||
|
return Ok(BotOperationTarget {
|
||||||
|
world_root: main.to_path_buf(),
|
||||||
|
chars_db,
|
||||||
|
ra_port,
|
||||||
|
running,
|
||||||
|
realm,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let tree = Tree::ALL
|
||||||
|
.into_iter()
|
||||||
|
.find(|t| t.enabled(&state) && t.mode(state.active) == realm)
|
||||||
|
.ok_or_else(|| Error::Invalid(format!("Realm {} is not enabled in multiworld configuration.", realm.label())))?;
|
||||||
|
|
||||||
|
let root = tree_root(main, tree);
|
||||||
|
if !root.exists() {
|
||||||
|
return Err(Error::Invalid(format!("Multiworld directory for {} does not exist: {}", realm.label(), root.display())));
|
||||||
|
}
|
||||||
|
|
||||||
|
let ports = crate::layout::read_ports(&root);
|
||||||
|
let (_, default_ra) = tree.ports(&state);
|
||||||
|
let ra_port = if ports.ra != 0 { ports.ra } else { default_ra.unwrap_or(3444) };
|
||||||
|
let status = process::observe(&root, &ports);
|
||||||
|
let running = status.world.state != ServiceState::Stopped;
|
||||||
|
|
||||||
|
Ok(BotOperationTarget {
|
||||||
|
world_root: root,
|
||||||
|
chars_db,
|
||||||
|
ra_port,
|
||||||
|
running,
|
||||||
|
realm,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Any of the extra worlds is running or still stopping.
|
/// Any of the extra worlds is running or still stopping.
|
||||||
pub fn is_running(main: &Path) -> bool {
|
pub fn is_running(main: &Path) -> bool {
|
||||||
Tree::ALL.into_iter().any(|t| tree_running(main, t))
|
Tree::ALL.into_iter().any(|t| tree_running(main, t))
|
||||||
@@ -261,6 +313,12 @@ fn prepare(main: &Path, tree: Tree) -> Result<PathBuf> {
|
|||||||
&fsx::ensure_within(&second, &second.join("Core/reference"))?,
|
&fsx::ensure_within(&second, &second.join("Core/reference"))?,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
if main.join("Core/plugins").is_dir() {
|
||||||
|
copy_tree(
|
||||||
|
&main.join("Core/plugins"),
|
||||||
|
&fsx::ensure_within(&second, &second.join("Core/plugins"))?,
|
||||||
|
)?;
|
||||||
|
}
|
||||||
for entry in fs::read_dir(main.join("Core"))? {
|
for entry in fs::read_dir(main.join("Core"))? {
|
||||||
let entry = entry?;
|
let entry = entry?;
|
||||||
if entry.file_type()?.is_file()
|
if entry.file_type()?.is_file()
|
||||||
|
|||||||
@@ -49,17 +49,19 @@ fn parse_counts(out: &str) -> Result<Population> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read-only query with the game's own database account. Requires the database to be running.
|
/// Read-only query with the game's own database account. Routes automatically to the active realm's characters database.
|
||||||
pub fn query(root: &Path) -> Result<Population> {
|
pub fn query(root: &Path) -> Result<Population> {
|
||||||
let db = Db::from_repack(root, Account::App)?;
|
let mode = crate::realms::state(root)
|
||||||
query_with(
|
.map(|s| s.active)
|
||||||
&db,
|
.unwrap_or(crate::realms::Mode::Coa);
|
||||||
&bot_account_prefix(root),
|
query_for_realm(root, mode)
|
||||||
&crate::accounts::squid_bot_prefix(root),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn counts_sql(prefix: &str, squid_prefix: &str) -> Result<String> {
|
fn counts_sql(prefix: &str, squid_prefix: &str) -> Result<String> {
|
||||||
|
counts_sql_for_db("acore_characters", prefix, squid_prefix)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn counts_sql_for_db(chars_db: &str, prefix: &str, squid_prefix: &str) -> Result<String> {
|
||||||
if [prefix, squid_prefix]
|
if [prefix, squid_prefix]
|
||||||
.iter()
|
.iter()
|
||||||
.any(|prefix| prefix.is_empty() || !prefix.chars().all(|c| c.is_ascii_alphanumeric()))
|
.any(|prefix| prefix.is_empty() || !prefix.chars().all(|c| c.is_ascii_alphanumeric()))
|
||||||
@@ -74,9 +76,9 @@ fn counts_sql(prefix: &str, squid_prefix: &str) -> Result<String> {
|
|||||||
let bots =
|
let bots =
|
||||||
format!("(UPPER(a.username) LIKE '{prefix}%' OR UPPER(a.username) LIKE '{squid_prefix}%')");
|
format!("(UPPER(a.username) LIKE '{prefix}%' OR UPPER(a.username) LIKE '{squid_prefix}%')");
|
||||||
Ok(format!(
|
Ok(format!(
|
||||||
"SELECT (SELECT COUNT(*) FROM acore_characters.characters WHERE online=1), \
|
"SELECT (SELECT COUNT(*) FROM {chars_db}.characters WHERE online=1), \
|
||||||
(SELECT COUNT(*) FROM acore_characters.characters c JOIN acore_auth.account a ON a.id=c.account WHERE c.online=1 AND {bots}), \
|
(SELECT COUNT(*) FROM {chars_db}.characters c JOIN acore_auth.account a ON a.id=c.account WHERE c.online=1 AND {bots}), \
|
||||||
(SELECT COUNT(*) FROM acore_characters.characters c JOIN acore_auth.account a ON a.id=c.account WHERE {bots});"
|
(SELECT COUNT(*) FROM {chars_db}.characters c JOIN acore_auth.account a ON a.id=c.account WHERE {bots});"
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +87,21 @@ pub fn query_with(db: &Db, prefix: &str, squid_prefix: &str) -> Result<Populatio
|
|||||||
parse_counts(&db.query(&counts_sql(prefix, squid_prefix)?)?)
|
parse_counts(&db.query(&counts_sql(prefix, squid_prefix)?)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn query_for_schema(db: &Db, chars_db: &str, prefix: &str, squid_prefix: &str) -> Result<Population> {
|
||||||
|
parse_counts(&db.query(&counts_sql_for_db(chars_db, prefix, squid_prefix)?)?)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn query_for_realm(root: &Path, mode: crate::realms::Mode) -> Result<Population> {
|
||||||
|
let db = Db::from_repack(root, Account::App)?;
|
||||||
|
let schema = mode.schema("characters")?;
|
||||||
|
query_for_schema(
|
||||||
|
&db,
|
||||||
|
schema,
|
||||||
|
&bot_account_prefix(root),
|
||||||
|
&crate::accounts::squid_bot_prefix(root),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
pub struct Hardware {
|
pub struct Hardware {
|
||||||
pub cores: u32,
|
pub cores: u32,
|
||||||
|
|||||||
@@ -58,6 +58,23 @@ impl Ra {
|
|||||||
Self::connect_to(read_ports(root).ra, &cfg.ra_username, &cfg.ra_password)
|
Self::connect_to(read_ports(root).ra, &cfg.ra_username, &cfg.ra_password)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Connect to the loopback RA port of the target realm world server.
|
||||||
|
pub fn connect_target(main: &Path, realm: Option<crate::realms::Mode>) -> Result<Ra> {
|
||||||
|
let mode = realm.unwrap_or_else(|| {
|
||||||
|
crate::realms::view(main).map(|v| v.active).unwrap_or_default()
|
||||||
|
});
|
||||||
|
let target = crate::multiworld::resolve_bot_operation_target(main, mode)?;
|
||||||
|
if !target.running {
|
||||||
|
return Err(Error::Invalid(format!(
|
||||||
|
"Realm {} worldserver is stopped; cannot execute online bot operation.",
|
||||||
|
target.realm.label()
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
let cfg: RaSettings = fsx::read_json(&main.join("Settings/repack.json"))
|
||||||
|
.map_err(|_| Error::Invalid("The server console settings could not be read.".into()))?;
|
||||||
|
Self::connect_to(target.ra_port, &cfg.ra_username, &cfg.ra_password)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn connect_to(port: u16, user: &str, password: &str) -> Result<Ra> {
|
pub fn connect_to(port: u16, user: &str, password: &str) -> Result<Ra> {
|
||||||
let addr: SocketAddr = ([127, 0, 0, 1], port).into();
|
let addr: SocketAddr = ([127, 0, 0, 1], port).into();
|
||||||
let mut stream =
|
let mut stream =
|
||||||
@@ -87,7 +104,6 @@ impl Ra {
|
|||||||
let c = crate::console::check_command(cmd)?;
|
let c = crate::console::check_command(cmd)?;
|
||||||
self.command(c)
|
self.command(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send a command whose answer does not matter (`server shutdown`). The reply is still read (up to the next
|
/// Send a command whose answer does not matter (`server shutdown`). The reply is still read (up to the next
|
||||||
/// prompt, the end of the connection, or a few seconds): closing a socket that holds unread data resets the
|
/// prompt, the end of the connection, or a few seconds): closing a socket that holds unread data resets the
|
||||||
/// connection, and the server can then drop the command it has not processed yet.
|
/// connection, and the server can then drop the command it has not processed yet.
|
||||||
@@ -110,7 +126,6 @@ impl Ra {
|
|||||||
let _ = self.stream.shutdown(std::net::Shutdown::Both);
|
let _ = self.stream.shutdown(std::net::Shutdown::Both);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn command(&mut self, cmd: &str) -> Result<String> {
|
fn command(&mut self, cmd: &str) -> Result<String> {
|
||||||
debug_assert!(!cmd.contains(['\r', '\n']));
|
debug_assert!(!cmd.contains(['\r', '\n']));
|
||||||
self.stream.write_all(format!("{cmd}\r\n").as_bytes())?;
|
self.stream.write_all(format!("{cmd}\r\n").as_bytes())?;
|
||||||
@@ -258,6 +273,11 @@ impl Ra {
|
|||||||
Ok(out.lines().last().unwrap_or("").to_string())
|
Ok(out.lines().last().unwrap_or("").to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Delete the companion bots of custom races (RaceID above 11), every other bot stays. Returns how many.
|
||||||
|
pub fn purge_custom_race_bots(&mut self) -> Result<u32> {
|
||||||
|
Ok(first_number(&self.bot_command("botcmd purgecustomraces")?))
|
||||||
|
}
|
||||||
|
|
||||||
/// Ask the bot module to create `count` leveling bots (throttled by the module itself). Only a number is sent.
|
/// Ask the bot module to create `count` leveling bots (throttled by the module itself). Only a number is sent.
|
||||||
pub fn spawn_bots(&mut self, count: u32) -> Result<String> {
|
pub fn spawn_bots(&mut self, count: u32) -> Result<String> {
|
||||||
if !(1..=2000).contains(&count) {
|
if !(1..=2000).contains(&count) {
|
||||||
@@ -272,6 +292,41 @@ impl Ra {
|
|||||||
Ok(out.lines().last().unwrap_or("").to_string())
|
Ok(out.lines().last().unwrap_or("").to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Ask the bot module to spawn a fleet of bots of specific race and level (.botcmd spawnfleet <race> <level>).
|
||||||
|
pub fn spawn_fleet(&mut self, race: u8, level: u8) -> Result<String> {
|
||||||
|
let out = self.bot_command(&format!("botcmd spawnfleet {race} {level}"))?;
|
||||||
|
Ok(out.lines().last().unwrap_or("").to_string())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn spawn_custom(
|
||||||
|
&mut self,
|
||||||
|
count: u32,
|
||||||
|
level: u8,
|
||||||
|
class_id: Option<u8>,
|
||||||
|
spec_id: Option<u32>,
|
||||||
|
archetype: Option<&str>,
|
||||||
|
) -> Result<String> {
|
||||||
|
let c = class_id.unwrap_or(0);
|
||||||
|
let s = spec_id.unwrap_or(0);
|
||||||
|
let a = archetype.unwrap_or("").trim();
|
||||||
|
let mut cmd = format!("botcmd spawncustom {count} {level}");
|
||||||
|
if !a.is_empty() {
|
||||||
|
cmd.push_str(&format!(" {c} {s} {a}"));
|
||||||
|
} else if s > 0 {
|
||||||
|
cmd.push_str(&format!(" {c} {s}"));
|
||||||
|
} else if c > 0 {
|
||||||
|
cmd.push_str(&format!(" {c}"));
|
||||||
|
}
|
||||||
|
let out = self.bot_command(&cmd)?;
|
||||||
|
Ok(out.lines().last().unwrap_or("").to_string())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Bring all offline bots online gradually (.botcmd loginall).
|
||||||
|
pub fn login_all(&mut self) -> Result<String> {
|
||||||
|
let out = self.bot_command("botcmd loginall")?;
|
||||||
|
Ok(out.lines().last().unwrap_or("").to_string())
|
||||||
|
}
|
||||||
|
|
||||||
/// Set a new password for an existing account.
|
/// Set a new password for an existing account.
|
||||||
pub fn set_account_password(&mut self, name: &str, password: &str) -> Result<()> {
|
pub fn set_account_password(&mut self, name: &str, password: &str) -> Result<()> {
|
||||||
validate_account(name, password)?;
|
validate_account(name, password)?;
|
||||||
|
|||||||
@@ -269,9 +269,95 @@ pub fn save(
|
|||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
)?;
|
)?;
|
||||||
|
write_snapshot(root, ¤t.catalog_sha256, ¤t.races)?;
|
||||||
status(root)
|
status(root)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Every race catalog (`ChrRaces.dbc` of the custom races overlay) a server build has shipped, by SHA-256:
|
||||||
|
/// RaceID -> name. Generated from the core repository's history of the overlay.
|
||||||
|
const SHIPPED_CATALOGS: &str = include_str!("race_catalogs.json");
|
||||||
|
/// The names of the catalog a restriction was saved against, written by every save.
|
||||||
|
const SNAPSHOT: &str = "Settings/race-catalog.json";
|
||||||
|
|
||||||
|
#[derive(serde::Deserialize, Serialize)]
|
||||||
|
struct Snapshot {
|
||||||
|
sha256: String,
|
||||||
|
races: BTreeMap<u32, String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// RaceID -> name of the catalog with `hash`: this server's own snapshot, or a catalog a build shipped.
|
||||||
|
fn names_of(root: &Path, hash: &str) -> Option<BTreeMap<u32, String>> {
|
||||||
|
if let Ok(snapshot) = crate::fsx::read_json::<Snapshot>(&root.join(SNAPSHOT)) {
|
||||||
|
if snapshot.sha256.eq_ignore_ascii_case(hash) {
|
||||||
|
return Some(snapshot.races);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[derive(serde::Deserialize)]
|
||||||
|
struct Shipped {
|
||||||
|
catalogs: BTreeMap<String, BTreeMap<u32, String>>,
|
||||||
|
}
|
||||||
|
let shipped: Shipped = serde_json::from_str(SHIPPED_CATALOGS).ok()?;
|
||||||
|
shipped.catalogs.get(&hash.to_ascii_lowercase()).cloned()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_snapshot(root: &Path, hash: &str, races: &[Race]) -> Result<()> {
|
||||||
|
crate::fsx::atomic_write_json(
|
||||||
|
&root.join(SNAPSHOT),
|
||||||
|
&Snapshot {
|
||||||
|
sha256: hash.to_string(),
|
||||||
|
races: races.iter().map(|race| (race.id, race.name.clone())).collect(),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A server update that only adds races keeps the owner's restriction. The worldserver ignores a restriction
|
||||||
|
/// saved against another catalog (and with it the whole custom races switch), so before a start: when every
|
||||||
|
/// disabled race still has its RaceID and name in the new catalog, the restriction is bound to the new catalog.
|
||||||
|
/// Anything else (an unknown old catalog, a renamed or missing race) is left for the owner to review. Returns
|
||||||
|
/// whether the restriction was bound again.
|
||||||
|
pub fn rebind_unchanged(root: &Path) -> Result<bool> {
|
||||||
|
let conf_path = root.join(CONF);
|
||||||
|
let Ok(conf_bytes) = fs::read(&conf_path) else {
|
||||||
|
return Ok(false);
|
||||||
|
};
|
||||||
|
let mut conf = ConfFile::parse_bytes(&conf_bytes)?;
|
||||||
|
let configured = parse_ids(conf.get(KEY).unwrap_or(""))?;
|
||||||
|
let saved = conf
|
||||||
|
.get(CATALOG_KEY)
|
||||||
|
.unwrap_or("")
|
||||||
|
.trim()
|
||||||
|
.trim_matches('"')
|
||||||
|
.to_ascii_lowercase();
|
||||||
|
if configured.is_empty() || saved.is_empty() {
|
||||||
|
return Ok(false);
|
||||||
|
}
|
||||||
|
let Ok(bytes) = fs::read(dbc_path(root)?) else {
|
||||||
|
return Ok(false);
|
||||||
|
};
|
||||||
|
let current = hex::encode(Sha256::digest(&bytes));
|
||||||
|
if saved == current {
|
||||||
|
return Ok(false);
|
||||||
|
}
|
||||||
|
let races = catalog(&bytes)?;
|
||||||
|
let Some(before) = names_of(root, &saved) else {
|
||||||
|
tracing::warn!("race restriction saved against an unknown catalog; it needs the owner's review");
|
||||||
|
return Ok(false);
|
||||||
|
};
|
||||||
|
let now: BTreeMap<u32, &str> = races.iter().map(|race| (race.id, race.name.as_str())).collect();
|
||||||
|
let unchanged = configured
|
||||||
|
.iter()
|
||||||
|
.all(|id| before.get(id).is_some_and(|name| now.get(id) == Some(&name.as_str())));
|
||||||
|
if !unchanged {
|
||||||
|
tracing::warn!("a restricted race changed in the new catalog; the restriction needs the owner's review");
|
||||||
|
return Ok(false);
|
||||||
|
}
|
||||||
|
conf.set(CATALOG_KEY, &format!("\"{current}\""), &[]);
|
||||||
|
crate::fsx::atomic_write(&conf_path, conf.to_text().as_bytes())?;
|
||||||
|
write_snapshot(root, ¤t, &races)?;
|
||||||
|
tracing::info!(races = configured.len(), "race restriction kept for the updated race catalog");
|
||||||
|
Ok(true)
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
@@ -292,6 +378,91 @@ mod tests {
|
|||||||
bytes
|
bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn catalog_of(rows: &[(u32, &str)]) -> Vec<u8> {
|
||||||
|
let mut strings = vec![0u8];
|
||||||
|
let mut offsets = Vec::new();
|
||||||
|
for (_, name) in rows {
|
||||||
|
offsets.push(strings.len() as u32);
|
||||||
|
strings.extend(name.as_bytes());
|
||||||
|
strings.push(0);
|
||||||
|
}
|
||||||
|
let mut bytes = b"WDBC".to_vec();
|
||||||
|
for value in [rows.len() as u32, 69, 276, strings.len() as u32] {
|
||||||
|
bytes.extend(value.to_le_bytes());
|
||||||
|
}
|
||||||
|
for ((id, _), offset) in rows.iter().zip(offsets) {
|
||||||
|
let mut row = vec![0; 276];
|
||||||
|
row[..4].copy_from_slice(&id.to_le_bytes());
|
||||||
|
row[56..60].copy_from_slice(&offset.to_le_bytes());
|
||||||
|
bytes.extend(row);
|
||||||
|
}
|
||||||
|
bytes.extend(strings);
|
||||||
|
bytes
|
||||||
|
}
|
||||||
|
|
||||||
|
fn restricted_server(catalog: &[u8], disabled: &str, saved_hash: &str) -> tempfile::TempDir {
|
||||||
|
let d = tempfile::tempdir().unwrap();
|
||||||
|
fs::create_dir_all(d.path().join("Data/dbc_races")).unwrap();
|
||||||
|
fs::create_dir_all(d.path().join("Core/configs/modules")).unwrap();
|
||||||
|
fs::write(d.path().join("Data/dbc_races/ChrRaces.dbc"), catalog).unwrap();
|
||||||
|
fs::write(
|
||||||
|
d.path().join(CONF),
|
||||||
|
format!("CoACustomRaces.Enable = 1\nCoACustomRaces.DisabledRaceIds = \"{disabled}\"\nCoACustomRaces.DisabledRaceCatalogSha256 = \"{saved_hash}\"\n"),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
d
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sha(bytes: &[u8]) -> String {
|
||||||
|
hex::encode(Sha256::digest(bytes))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_catalog_that_only_adds_races_keeps_the_restriction() {
|
||||||
|
let old = catalog_of(&[(83, "Vulpera"), (97, "Gnoll")]);
|
||||||
|
let new = catalog_of(&[(83, "Vulpera"), (97, "Gnoll"), (120, "Nerubian")]);
|
||||||
|
let d = restricted_server(&new, "83", &sha(&old));
|
||||||
|
write_snapshot(d.path(), &sha(&old), &catalog(&old).unwrap()).unwrap();
|
||||||
|
assert!(rebind_unchanged(d.path()).unwrap());
|
||||||
|
let conf = ConfFile::parse_bytes(&fs::read(d.path().join(CONF)).unwrap()).unwrap();
|
||||||
|
assert_eq!(conf.get(KEY), Some("\"83\""));
|
||||||
|
assert_eq!(
|
||||||
|
conf.get(CATALOG_KEY).map(|h| h.trim_matches('"').to_string()),
|
||||||
|
Some(sha(&new))
|
||||||
|
);
|
||||||
|
assert_eq!(conf.get("CoACustomRaces.Enable"), Some("1"));
|
||||||
|
assert!(!rebind_unchanged(d.path()).unwrap(), "already bound");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_renamed_race_or_unknown_catalog_waits_for_review() {
|
||||||
|
let old = catalog_of(&[(83, "Thin Human"), (97, "Gnoll")]);
|
||||||
|
let renamed = catalog_of(&[(83, "Forgotten"), (97, "Gnoll")]);
|
||||||
|
let d = restricted_server(&renamed, "83", &sha(&old));
|
||||||
|
write_snapshot(d.path(), &sha(&old), &catalog(&old).unwrap()).unwrap();
|
||||||
|
assert!(!rebind_unchanged(d.path()).unwrap());
|
||||||
|
let unknown = restricted_server(&renamed, "97", &"ab".repeat(32));
|
||||||
|
assert!(!rebind_unchanged(unknown.path()).unwrap());
|
||||||
|
// Nothing is restricted: nothing to bind.
|
||||||
|
let empty = restricted_server(&renamed, "", &sha(&old));
|
||||||
|
assert!(!rebind_unchanged(empty.path()).unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn the_shipped_catalogs_include_1_9_2_and_v2_with_stable_ids() {
|
||||||
|
let shipped: serde_json::Value = serde_json::from_str(SHIPPED_CATALOGS).unwrap();
|
||||||
|
let catalogs = shipped["catalogs"].as_object().unwrap();
|
||||||
|
let size = |c: &serde_json::Value| c.as_object().unwrap().len();
|
||||||
|
assert!(catalogs.values().any(|c| size(c) == 95), "1.9.2 has 95 races");
|
||||||
|
let v2: Vec<_> = catalogs.values().filter(|c| size(c) == 112).collect();
|
||||||
|
assert_eq!(v2.len(), 1, "V2 has 112 races");
|
||||||
|
for old in catalogs.values().filter(|c| size(c) == 95) {
|
||||||
|
for (id, name) in old.as_object().unwrap() {
|
||||||
|
assert_eq!(&v2[0][id], name, "race {id}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn catalog_preserves_ids_and_excludes_stock_and_nonplayable() {
|
fn catalog_preserves_ids_and_excludes_stock_and_nonplayable() {
|
||||||
let mut bytes = dbc();
|
let mut bytes = dbc();
|
||||||
|
|||||||
@@ -0,0 +1,639 @@
|
|||||||
|
{
|
||||||
|
"catalogs": {
|
||||||
|
"0f9e05112d56609a87f0b1900be88f8130a8fcb24ee4acae585f1fd8d9144bf0": {
|
||||||
|
"1": "Human",
|
||||||
|
"10": "Blood Elf",
|
||||||
|
"100": "Drakonid",
|
||||||
|
"103": "Grummle",
|
||||||
|
"11": "Draenei",
|
||||||
|
"12": "Zandalari Troll",
|
||||||
|
"13": "Worgen",
|
||||||
|
"14": "High Elf",
|
||||||
|
"15": "Tuskarr",
|
||||||
|
"16": "Kul Tiran",
|
||||||
|
"17": "Taunka",
|
||||||
|
"18": "Vrykul",
|
||||||
|
"19": "Vulpera",
|
||||||
|
"2": "Orc",
|
||||||
|
"20": "Pandaren",
|
||||||
|
"21": "Naga",
|
||||||
|
"22": "Broken",
|
||||||
|
"23": "Fel Orc",
|
||||||
|
"24": "Forest Troll",
|
||||||
|
"25": "Ice Troll",
|
||||||
|
"26": "Skeleton",
|
||||||
|
"27": "Earthen",
|
||||||
|
"28": "Drakkari Troll",
|
||||||
|
"29": "Pandaren",
|
||||||
|
"3": "Dwarf",
|
||||||
|
"30": "Murloc",
|
||||||
|
"31": "Murloc",
|
||||||
|
"32": "Thin Human",
|
||||||
|
"33": "Thin Human",
|
||||||
|
"34": "Fel Orc",
|
||||||
|
"35": "Naga",
|
||||||
|
"36": "Broken",
|
||||||
|
"37": "Skeleton",
|
||||||
|
"38": "Vrykul",
|
||||||
|
"39": "Tuskarr",
|
||||||
|
"4": "Night Elf",
|
||||||
|
"40": "Forest Troll",
|
||||||
|
"41": "Taunka",
|
||||||
|
"42": "Northrend Skeleton",
|
||||||
|
"43": "Ice Troll",
|
||||||
|
"44": "Drakkari Troll",
|
||||||
|
"45": "Leper Troll",
|
||||||
|
"46": "Troglodyte",
|
||||||
|
"47": "Alpha Worgen",
|
||||||
|
"48": "Dark Iron Dwarf",
|
||||||
|
"49": "Mag'har Orc",
|
||||||
|
"5": "Undead",
|
||||||
|
"50": "Furbolg",
|
||||||
|
"51": "Undead Gnome",
|
||||||
|
"52": "Orc",
|
||||||
|
"53": "Ogre",
|
||||||
|
"54": "Dracthyr",
|
||||||
|
"55": "Eredar",
|
||||||
|
"56": "Harpy",
|
||||||
|
"57": "Alpha Goblin",
|
||||||
|
"58": "Dracthyr",
|
||||||
|
"59": "Void Elf",
|
||||||
|
"6": "Tauren",
|
||||||
|
"60": "Illidari Blood Elf",
|
||||||
|
"61": "Illidari Night Elf",
|
||||||
|
"62": "Lightforged Draenei",
|
||||||
|
"63": "Nightborne",
|
||||||
|
"65": "Test Race",
|
||||||
|
"66": "Highmountain Tauren",
|
||||||
|
"67": "Mechagnome",
|
||||||
|
"68": "Earthen",
|
||||||
|
"69": "Earthen",
|
||||||
|
"7": "Gnome",
|
||||||
|
"70": "Haranir",
|
||||||
|
"71": "Haranir",
|
||||||
|
"72": "Windshaper Skyborne",
|
||||||
|
"74": "Vulpera",
|
||||||
|
"77": "High Order Skyborne",
|
||||||
|
"78": "Jinyu",
|
||||||
|
"79": "Arakkoa",
|
||||||
|
"8": "Troll",
|
||||||
|
"80": "Darkfallen",
|
||||||
|
"81": "Darkfallen",
|
||||||
|
"82": "Sethrak",
|
||||||
|
"83": "Gnoll",
|
||||||
|
"9": "Goblin",
|
||||||
|
"97": "Saberon",
|
||||||
|
"98": "Drakonid",
|
||||||
|
"99": "Drakkin"
|
||||||
|
},
|
||||||
|
"358503359af5b05d16a76f61bab77b5c6221c792bcb0e11793eba8e279689ff7": {
|
||||||
|
"1": "Human",
|
||||||
|
"10": "Blood Elf",
|
||||||
|
"11": "Draenei",
|
||||||
|
"12": "Zandalari Troll",
|
||||||
|
"13": "Worgen",
|
||||||
|
"14": "High Elf",
|
||||||
|
"15": "Tuskarr",
|
||||||
|
"16": "Kul Tiran",
|
||||||
|
"17": "Taunka",
|
||||||
|
"18": "Vrykul",
|
||||||
|
"19": "Vulpera",
|
||||||
|
"2": "Orc",
|
||||||
|
"20": "Pandaren",
|
||||||
|
"21": "Naga",
|
||||||
|
"22": "Broken",
|
||||||
|
"23": "Fel Orc",
|
||||||
|
"24": "Forest Troll",
|
||||||
|
"25": "Ice Troll",
|
||||||
|
"26": "Skeleton",
|
||||||
|
"27": "Earthen",
|
||||||
|
"28": "Drakkari Troll",
|
||||||
|
"29": "Pandaren",
|
||||||
|
"3": "Dwarf",
|
||||||
|
"30": "Murloc",
|
||||||
|
"31": "Murloc",
|
||||||
|
"32": "Thin Human",
|
||||||
|
"33": "Thin Human",
|
||||||
|
"34": "Fel Orc",
|
||||||
|
"35": "Naga",
|
||||||
|
"36": "Broken",
|
||||||
|
"37": "Skeleton",
|
||||||
|
"38": "Vrykul",
|
||||||
|
"39": "Tuskarr",
|
||||||
|
"4": "Night Elf",
|
||||||
|
"40": "Forest Troll",
|
||||||
|
"41": "Taunka",
|
||||||
|
"42": "Northrend Skeleton",
|
||||||
|
"43": "Ice Troll",
|
||||||
|
"44": "Drakkari Troll",
|
||||||
|
"45": "Leper Troll",
|
||||||
|
"46": "Troglodyte",
|
||||||
|
"47": "Alpha Worgen",
|
||||||
|
"48": "Dark Iron Dwarf",
|
||||||
|
"49": "Mag'har Orc",
|
||||||
|
"5": "Undead",
|
||||||
|
"50": "Furbolg",
|
||||||
|
"51": "Undead Gnome",
|
||||||
|
"52": "Orc",
|
||||||
|
"53": "Ogre",
|
||||||
|
"54": "Dracthyr",
|
||||||
|
"55": "Eredar",
|
||||||
|
"56": "Harpy",
|
||||||
|
"57": "Alpha Goblin",
|
||||||
|
"58": "Dracthyr",
|
||||||
|
"59": "Void Elf",
|
||||||
|
"6": "Tauren",
|
||||||
|
"60": "Illidari Blood Elf",
|
||||||
|
"61": "Illidari Night Elf",
|
||||||
|
"62": "Lightforged Draenei",
|
||||||
|
"63": "Nightborne",
|
||||||
|
"65": "Test Race",
|
||||||
|
"66": "Highmountain Tauren",
|
||||||
|
"67": "Mechagnome",
|
||||||
|
"68": "Earthen",
|
||||||
|
"69": "Earthen",
|
||||||
|
"7": "Gnome",
|
||||||
|
"70": "Haranir",
|
||||||
|
"71": "Haranir",
|
||||||
|
"72": "Windshaper Skyborne",
|
||||||
|
"74": "Vulpera",
|
||||||
|
"77": "High Order Skyborne",
|
||||||
|
"78": "Jinyu",
|
||||||
|
"8": "Troll",
|
||||||
|
"80": "Darkfallen",
|
||||||
|
"81": "Darkfallen",
|
||||||
|
"82": "Sethrak",
|
||||||
|
"83": "Gnoll",
|
||||||
|
"9": "Goblin",
|
||||||
|
"97": "Saberon"
|
||||||
|
},
|
||||||
|
"6ad3ac1ad6ef7f32ed347e979cd1667bb5393d7a0967a859e5ba3cfa2a5d04c7": {
|
||||||
|
"1": "Human",
|
||||||
|
"10": "Blood Elf",
|
||||||
|
"100": "Drakonid",
|
||||||
|
"101": "Venthyr",
|
||||||
|
"102": "Centaur",
|
||||||
|
"103": "Grummle",
|
||||||
|
"104": "Slime Giant",
|
||||||
|
"106": "Mantid",
|
||||||
|
"107": "Kyrian",
|
||||||
|
"109": "Ethereal",
|
||||||
|
"11": "Draenei",
|
||||||
|
"110": "Sylvari",
|
||||||
|
"112": "Hozen",
|
||||||
|
"12": "Zandalari Troll",
|
||||||
|
"13": "Worgen",
|
||||||
|
"14": "High Elf",
|
||||||
|
"15": "Tuskarr",
|
||||||
|
"16": "Kul Tiran",
|
||||||
|
"17": "Taunka",
|
||||||
|
"18": "Vrykul",
|
||||||
|
"19": "Vulpera",
|
||||||
|
"2": "Orc",
|
||||||
|
"20": "Pandaren",
|
||||||
|
"21": "Naga",
|
||||||
|
"22": "Broken",
|
||||||
|
"23": "Fel Orc",
|
||||||
|
"24": "Forest Troll",
|
||||||
|
"25": "Ice Troll",
|
||||||
|
"26": "Skeleton",
|
||||||
|
"27": "Earthen",
|
||||||
|
"28": "Drakkari Troll",
|
||||||
|
"29": "Pandaren",
|
||||||
|
"3": "Dwarf",
|
||||||
|
"30": "Murloc",
|
||||||
|
"31": "Murloc",
|
||||||
|
"32": "Forgotten",
|
||||||
|
"33": "Forgotten",
|
||||||
|
"34": "Fel Orc",
|
||||||
|
"35": "Naga",
|
||||||
|
"36": "Broken",
|
||||||
|
"37": "Skeleton",
|
||||||
|
"38": "Vrykul",
|
||||||
|
"39": "Tuskarr",
|
||||||
|
"4": "Night Elf",
|
||||||
|
"40": "Forest Troll",
|
||||||
|
"41": "Taunka",
|
||||||
|
"42": "Northrend Skeleton",
|
||||||
|
"43": "Ice Troll",
|
||||||
|
"44": "Drakkari Troll",
|
||||||
|
"45": "Leper Troll",
|
||||||
|
"46": "Troglodyte",
|
||||||
|
"47": "Alpha Worgen",
|
||||||
|
"48": "Dark Iron Dwarf",
|
||||||
|
"49": "Mag'har Orc",
|
||||||
|
"5": "Undead",
|
||||||
|
"50": "Furbolg",
|
||||||
|
"51": "Undead Gnome",
|
||||||
|
"52": "Orc",
|
||||||
|
"53": "Ogre",
|
||||||
|
"54": "Dracthyr",
|
||||||
|
"55": "Eredar",
|
||||||
|
"56": "Harpy",
|
||||||
|
"57": "Alpha Goblin",
|
||||||
|
"58": "Dracthyr",
|
||||||
|
"59": "Void Elf",
|
||||||
|
"6": "Tauren",
|
||||||
|
"60": "Illidari Blood Elf",
|
||||||
|
"61": "Illidari Night Elf",
|
||||||
|
"62": "Lightforged Draenei",
|
||||||
|
"63": "Nightborne",
|
||||||
|
"65": "Test Race",
|
||||||
|
"66": "Highmountain Tauren",
|
||||||
|
"67": "Mechagnome",
|
||||||
|
"68": "Earthen",
|
||||||
|
"69": "Earthen",
|
||||||
|
"7": "Gnome",
|
||||||
|
"70": "Haranir",
|
||||||
|
"71": "Haranir",
|
||||||
|
"72": "Windshaper Skyborne",
|
||||||
|
"74": "Vulpera",
|
||||||
|
"75": "Centaur",
|
||||||
|
"77": "High Order Skyborne",
|
||||||
|
"78": "Jinyu",
|
||||||
|
"79": "Arakkoa",
|
||||||
|
"8": "Troll",
|
||||||
|
"80": "Darkfallen",
|
||||||
|
"81": "Darkfallen",
|
||||||
|
"82": "Sethrak",
|
||||||
|
"83": "Gnoll",
|
||||||
|
"87": "Faceless One",
|
||||||
|
"9": "Goblin",
|
||||||
|
"90": "Banshee",
|
||||||
|
"97": "Saberon",
|
||||||
|
"98": "Drakonid",
|
||||||
|
"99": "Drakkin"
|
||||||
|
},
|
||||||
|
"833e18c0f0550d400e78ee5db00bd65bf86d051861fe6b795c0539e3fd9f125d": {
|
||||||
|
"1": "Human",
|
||||||
|
"10": "Blood Elf",
|
||||||
|
"11": "Draenei",
|
||||||
|
"12": "Zandalari Troll",
|
||||||
|
"13": "Worgen",
|
||||||
|
"14": "High Elf",
|
||||||
|
"15": "Tuskarr",
|
||||||
|
"16": "Kul Tiran",
|
||||||
|
"17": "Taunka",
|
||||||
|
"18": "Vrykul",
|
||||||
|
"19": "Vulpera",
|
||||||
|
"2": "Orc",
|
||||||
|
"20": "Pandaren",
|
||||||
|
"21": "Naga",
|
||||||
|
"22": "Broken",
|
||||||
|
"23": "Fel Orc",
|
||||||
|
"24": "Forest Troll",
|
||||||
|
"25": "Ice Troll",
|
||||||
|
"26": "Skeleton",
|
||||||
|
"27": "Earthen",
|
||||||
|
"28": "Drakkari Troll",
|
||||||
|
"29": "Pandaren",
|
||||||
|
"3": "Dwarf",
|
||||||
|
"30": "Murloc",
|
||||||
|
"31": "Murloc",
|
||||||
|
"32": "Thin Human",
|
||||||
|
"33": "Thin Human",
|
||||||
|
"34": "Fel Orc",
|
||||||
|
"35": "Naga",
|
||||||
|
"36": "Broken",
|
||||||
|
"37": "Skeleton",
|
||||||
|
"38": "Vrykul",
|
||||||
|
"39": "Tuskarr",
|
||||||
|
"4": "Night Elf",
|
||||||
|
"40": "Forest Troll",
|
||||||
|
"41": "Taunka",
|
||||||
|
"42": "Northrend Skeleton",
|
||||||
|
"43": "Ice Troll",
|
||||||
|
"44": "Drakkari Troll",
|
||||||
|
"45": "Leper Troll",
|
||||||
|
"46": "Troglodyte",
|
||||||
|
"47": "Alpha Worgen",
|
||||||
|
"48": "Dark Iron Dwarf",
|
||||||
|
"49": "Mag'har Orc",
|
||||||
|
"5": "Undead",
|
||||||
|
"50": "Furbolg",
|
||||||
|
"51": "Undead Gnome",
|
||||||
|
"52": "Orc",
|
||||||
|
"53": "Ogre",
|
||||||
|
"54": "Dracthyr",
|
||||||
|
"55": "Eredar",
|
||||||
|
"56": "Harpy",
|
||||||
|
"57": "Alpha Goblin",
|
||||||
|
"58": "Dracthyr",
|
||||||
|
"59": "Void Elf",
|
||||||
|
"6": "Tauren",
|
||||||
|
"60": "Illidari Blood Elf",
|
||||||
|
"61": "Illidari Night Elf",
|
||||||
|
"62": "Lightforged Draenei",
|
||||||
|
"63": "Nightborne",
|
||||||
|
"65": "Test Race",
|
||||||
|
"66": "Highmountain Tauren",
|
||||||
|
"67": "Mechagnome",
|
||||||
|
"68": "Earthen",
|
||||||
|
"69": "Earthen",
|
||||||
|
"7": "Gnome",
|
||||||
|
"70": "Haranir",
|
||||||
|
"71": "Haranir",
|
||||||
|
"72": "Windshaper Skyborne",
|
||||||
|
"74": "Vulpera",
|
||||||
|
"77": "High Order Skyborne",
|
||||||
|
"8": "Troll",
|
||||||
|
"9": "Goblin"
|
||||||
|
},
|
||||||
|
"9a49163b9a330d844f0add5a2023f538b828bd5c57d6ecbb3cd5b4196930c5da": {
|
||||||
|
"1": "Human",
|
||||||
|
"10": "Blood Elf",
|
||||||
|
"103": "Grummle",
|
||||||
|
"11": "Draenei",
|
||||||
|
"12": "Zandalari Troll",
|
||||||
|
"13": "Worgen",
|
||||||
|
"14": "High Elf",
|
||||||
|
"15": "Tuskarr",
|
||||||
|
"16": "Kul Tiran",
|
||||||
|
"17": "Taunka",
|
||||||
|
"18": "Vrykul",
|
||||||
|
"19": "Vulpera",
|
||||||
|
"2": "Orc",
|
||||||
|
"20": "Pandaren",
|
||||||
|
"21": "Naga",
|
||||||
|
"22": "Broken",
|
||||||
|
"23": "Fel Orc",
|
||||||
|
"24": "Forest Troll",
|
||||||
|
"25": "Ice Troll",
|
||||||
|
"26": "Skeleton",
|
||||||
|
"27": "Earthen",
|
||||||
|
"28": "Drakkari Troll",
|
||||||
|
"29": "Pandaren",
|
||||||
|
"3": "Dwarf",
|
||||||
|
"30": "Murloc",
|
||||||
|
"31": "Murloc",
|
||||||
|
"32": "Thin Human",
|
||||||
|
"33": "Thin Human",
|
||||||
|
"34": "Fel Orc",
|
||||||
|
"35": "Naga",
|
||||||
|
"36": "Broken",
|
||||||
|
"37": "Skeleton",
|
||||||
|
"38": "Vrykul",
|
||||||
|
"39": "Tuskarr",
|
||||||
|
"4": "Night Elf",
|
||||||
|
"40": "Forest Troll",
|
||||||
|
"41": "Taunka",
|
||||||
|
"42": "Northrend Skeleton",
|
||||||
|
"43": "Ice Troll",
|
||||||
|
"44": "Drakkari Troll",
|
||||||
|
"45": "Leper Troll",
|
||||||
|
"46": "Troglodyte",
|
||||||
|
"47": "Alpha Worgen",
|
||||||
|
"48": "Dark Iron Dwarf",
|
||||||
|
"49": "Mag'har Orc",
|
||||||
|
"5": "Undead",
|
||||||
|
"50": "Furbolg",
|
||||||
|
"51": "Undead Gnome",
|
||||||
|
"52": "Orc",
|
||||||
|
"53": "Ogre",
|
||||||
|
"54": "Dracthyr",
|
||||||
|
"55": "Eredar",
|
||||||
|
"56": "Harpy",
|
||||||
|
"57": "Alpha Goblin",
|
||||||
|
"58": "Dracthyr",
|
||||||
|
"59": "Void Elf",
|
||||||
|
"6": "Tauren",
|
||||||
|
"60": "Illidari Blood Elf",
|
||||||
|
"61": "Illidari Night Elf",
|
||||||
|
"62": "Lightforged Draenei",
|
||||||
|
"63": "Nightborne",
|
||||||
|
"65": "Test Race",
|
||||||
|
"66": "Highmountain Tauren",
|
||||||
|
"67": "Mechagnome",
|
||||||
|
"68": "Earthen",
|
||||||
|
"69": "Earthen",
|
||||||
|
"7": "Gnome",
|
||||||
|
"70": "Haranir",
|
||||||
|
"71": "Haranir",
|
||||||
|
"72": "Windshaper Skyborne",
|
||||||
|
"74": "Vulpera",
|
||||||
|
"77": "High Order Skyborne",
|
||||||
|
"78": "Jinyu",
|
||||||
|
"79": "Arakkoa",
|
||||||
|
"8": "Troll",
|
||||||
|
"80": "Darkfallen",
|
||||||
|
"81": "Darkfallen",
|
||||||
|
"82": "Sethrak",
|
||||||
|
"83": "Gnoll",
|
||||||
|
"9": "Goblin",
|
||||||
|
"97": "Saberon"
|
||||||
|
},
|
||||||
|
"b78635b08bf0bd63d2898fce97c1fb162c8a9c41632703172eefa88bae79061f": {
|
||||||
|
"1": "Human",
|
||||||
|
"10": "Blood Elf",
|
||||||
|
"100": "Drakonid",
|
||||||
|
"101": "Venthyr",
|
||||||
|
"102": "Centaur",
|
||||||
|
"103": "Grummle",
|
||||||
|
"104": "Slime Giant",
|
||||||
|
"106": "Mantid",
|
||||||
|
"107": "Kyrian",
|
||||||
|
"109": "Ethereal",
|
||||||
|
"11": "Draenei",
|
||||||
|
"110": "Sylvari",
|
||||||
|
"112": "Hozen",
|
||||||
|
"12": "Zandalari Troll",
|
||||||
|
"13": "Worgen",
|
||||||
|
"14": "High Elf",
|
||||||
|
"15": "Tuskarr",
|
||||||
|
"16": "Kul Tiran",
|
||||||
|
"17": "Taunka",
|
||||||
|
"18": "Vrykul",
|
||||||
|
"19": "Vulpera",
|
||||||
|
"2": "Orc",
|
||||||
|
"20": "Pandaren",
|
||||||
|
"21": "Naga",
|
||||||
|
"22": "Broken",
|
||||||
|
"23": "Fel Orc",
|
||||||
|
"24": "Forest Troll",
|
||||||
|
"25": "Ice Troll",
|
||||||
|
"26": "Skeleton",
|
||||||
|
"27": "Earthen",
|
||||||
|
"28": "Drakkari Troll",
|
||||||
|
"29": "Pandaren",
|
||||||
|
"3": "Dwarf",
|
||||||
|
"30": "Murloc",
|
||||||
|
"31": "Murloc",
|
||||||
|
"32": "Forgotten",
|
||||||
|
"33": "Forgotten",
|
||||||
|
"34": "Fel Orc",
|
||||||
|
"35": "Naga",
|
||||||
|
"36": "Broken",
|
||||||
|
"37": "Skeleton",
|
||||||
|
"38": "Vrykul",
|
||||||
|
"39": "Tuskarr",
|
||||||
|
"4": "Night Elf",
|
||||||
|
"40": "Forest Troll",
|
||||||
|
"41": "Taunka",
|
||||||
|
"42": "Northrend Skeleton",
|
||||||
|
"43": "Ice Troll",
|
||||||
|
"44": "Drakkari Troll",
|
||||||
|
"45": "Leper Troll",
|
||||||
|
"46": "Troglodyte",
|
||||||
|
"47": "Alpha Worgen",
|
||||||
|
"48": "Dark Iron Dwarf",
|
||||||
|
"49": "Mag'har Orc",
|
||||||
|
"5": "Undead",
|
||||||
|
"50": "Furbolg",
|
||||||
|
"51": "Undead Gnome",
|
||||||
|
"52": "Orc",
|
||||||
|
"53": "Ogre",
|
||||||
|
"54": "Dracthyr",
|
||||||
|
"55": "Eredar",
|
||||||
|
"56": "Harpy",
|
||||||
|
"57": "Alpha Goblin",
|
||||||
|
"58": "Dracthyr",
|
||||||
|
"59": "Void Elf",
|
||||||
|
"6": "Tauren",
|
||||||
|
"60": "Illidari Blood Elf",
|
||||||
|
"61": "Illidari Night Elf",
|
||||||
|
"62": "Lightforged Draenei",
|
||||||
|
"63": "Nightborne",
|
||||||
|
"65": "Test Race",
|
||||||
|
"66": "Highmountain Tauren",
|
||||||
|
"67": "Mechagnome",
|
||||||
|
"68": "Earthen",
|
||||||
|
"69": "Earthen",
|
||||||
|
"7": "Gnome",
|
||||||
|
"70": "Haranir",
|
||||||
|
"71": "Haranir",
|
||||||
|
"72": "Windshaper Skyborne",
|
||||||
|
"74": "Vulpera",
|
||||||
|
"75": "Centaur",
|
||||||
|
"77": "High Order Skyborne",
|
||||||
|
"78": "Jinyu",
|
||||||
|
"79": "Arakkoa",
|
||||||
|
"8": "Troll",
|
||||||
|
"80": "Darkfallen",
|
||||||
|
"81": "Darkfallen",
|
||||||
|
"82": "Sethrak",
|
||||||
|
"83": "Gnoll",
|
||||||
|
"87": "Faceless One",
|
||||||
|
"9": "Goblin",
|
||||||
|
"90": "Banshee",
|
||||||
|
"97": "Saberon",
|
||||||
|
"98": "Drakonid",
|
||||||
|
"99": "Drakkin"
|
||||||
|
},
|
||||||
|
"bff09e612ba44567a5c7d928562d6261755504dc8948daa334e675bf49b54938": {
|
||||||
|
"1": "Human",
|
||||||
|
"10": "Blood Elf",
|
||||||
|
"100": "Drakonid",
|
||||||
|
"101": "Venthyr",
|
||||||
|
"102": "Centaur",
|
||||||
|
"103": "Grummle",
|
||||||
|
"104": "Slime Giant",
|
||||||
|
"105": "Gilgoblin",
|
||||||
|
"106": "Mantid",
|
||||||
|
"107": "Kyrian",
|
||||||
|
"109": "Ethereal",
|
||||||
|
"11": "Draenei",
|
||||||
|
"110": "Sylvari",
|
||||||
|
"111": "Sporeling",
|
||||||
|
"112": "Hozen",
|
||||||
|
"114": "Stormforged",
|
||||||
|
"118": "Elune's Chosen",
|
||||||
|
"119": "Mo'arg",
|
||||||
|
"12": "Zandalari Troll",
|
||||||
|
"120": "Nerubian",
|
||||||
|
"122": "Lich",
|
||||||
|
"123": "Mogu",
|
||||||
|
"125": "Lost One",
|
||||||
|
"13": "Worgen",
|
||||||
|
"14": "High Elf",
|
||||||
|
"15": "Tuskarr",
|
||||||
|
"16": "Kul Tiran",
|
||||||
|
"17": "Taunka",
|
||||||
|
"18": "Vrykul",
|
||||||
|
"19": "Vulpera",
|
||||||
|
"2": "Orc",
|
||||||
|
"20": "Pandaren",
|
||||||
|
"21": "Naga",
|
||||||
|
"22": "Broken",
|
||||||
|
"23": "Fel Orc",
|
||||||
|
"24": "Forest Troll",
|
||||||
|
"25": "Ice Troll",
|
||||||
|
"26": "Skeleton",
|
||||||
|
"27": "Earthen",
|
||||||
|
"28": "Drakkari Troll",
|
||||||
|
"29": "Pandaren",
|
||||||
|
"3": "Dwarf",
|
||||||
|
"30": "Murloc",
|
||||||
|
"31": "Murloc",
|
||||||
|
"32": "Forgotten",
|
||||||
|
"33": "Forgotten",
|
||||||
|
"34": "Fel Orc",
|
||||||
|
"35": "Naga",
|
||||||
|
"36": "Broken",
|
||||||
|
"37": "Skeleton",
|
||||||
|
"38": "Vrykul",
|
||||||
|
"39": "Tuskarr",
|
||||||
|
"4": "Night Elf",
|
||||||
|
"40": "Forest Troll",
|
||||||
|
"41": "Taunka",
|
||||||
|
"42": "Northrend Skeleton",
|
||||||
|
"43": "Ice Troll",
|
||||||
|
"44": "Drakkari Troll",
|
||||||
|
"45": "Leper Troll",
|
||||||
|
"46": "Troglodyte",
|
||||||
|
"47": "Alpha Worgen",
|
||||||
|
"48": "Dark Iron Dwarf",
|
||||||
|
"49": "Mag'har Orc",
|
||||||
|
"5": "Undead",
|
||||||
|
"50": "Furbolg",
|
||||||
|
"51": "Undead Gnome",
|
||||||
|
"52": "Orc",
|
||||||
|
"53": "Ogre",
|
||||||
|
"54": "Dracthyr",
|
||||||
|
"55": "Eredar",
|
||||||
|
"56": "Harpy",
|
||||||
|
"57": "Alpha Goblin",
|
||||||
|
"58": "Dracthyr",
|
||||||
|
"59": "Void Elf",
|
||||||
|
"6": "Tauren",
|
||||||
|
"60": "Illidari Blood Elf",
|
||||||
|
"61": "Illidari Night Elf",
|
||||||
|
"62": "Lightforged Draenei",
|
||||||
|
"63": "Nightborne",
|
||||||
|
"65": "Test Race",
|
||||||
|
"66": "Highmountain Tauren",
|
||||||
|
"67": "Mechagnome",
|
||||||
|
"68": "Earthen",
|
||||||
|
"69": "Earthen",
|
||||||
|
"7": "Gnome",
|
||||||
|
"70": "Haranir",
|
||||||
|
"71": "Haranir",
|
||||||
|
"72": "Windshaper Skyborne",
|
||||||
|
"74": "Vulpera",
|
||||||
|
"75": "Centaur",
|
||||||
|
"77": "High Order Skyborne",
|
||||||
|
"78": "Jinyu",
|
||||||
|
"79": "Arakkoa",
|
||||||
|
"8": "Troll",
|
||||||
|
"80": "Darkfallen",
|
||||||
|
"81": "Darkfallen",
|
||||||
|
"82": "Sethrak",
|
||||||
|
"83": "Gnoll",
|
||||||
|
"85": "Two-Headed Ogre",
|
||||||
|
"86": "Sureki",
|
||||||
|
"87": "Faceless One",
|
||||||
|
"88": "Qiraji",
|
||||||
|
"89": "Dreadlord",
|
||||||
|
"9": "Goblin",
|
||||||
|
"90": "Banshee",
|
||||||
|
"91": "Titan",
|
||||||
|
"92": "Wretched",
|
||||||
|
"93": "Fungarian",
|
||||||
|
"96": "Thin Human",
|
||||||
|
"97": "Saberon",
|
||||||
|
"98": "Drakonid",
|
||||||
|
"99": "Drakkin"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": 1,
|
||||||
|
"source": "Corfirean/azerothcore-wotlk-coa modules/mod-coa-custom-races/data/dbc/ChrRaces.dbc"
|
||||||
|
}
|
||||||
@@ -0,0 +1,216 @@
|
|||||||
|
//! The names players see in the realm list, chosen by the server owner.
|
||||||
|
//!
|
||||||
|
//! The launcher writes `acore_auth.realmlist.name` at every start, so a name typed into the database (or into
|
||||||
|
//! an old `manage.py`) did not last. The owner's choice lives in `Settings/realm-names.json` of the server's main
|
||||||
|
//! folder, keyed by realm id, and every start and every realm-list setup uses it; extra worlds read their main
|
||||||
|
//! folder's file.
|
||||||
|
|
||||||
|
use std::collections::BTreeMap;
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::error::{Error, Result};
|
||||||
|
use crate::fsx;
|
||||||
|
|
||||||
|
const FILE: &str = "Settings/realm-names.json";
|
||||||
|
|
||||||
|
/// `acore_auth.realmlist.name` is `varchar(32)`.
|
||||||
|
pub const MAX_CHARS: usize = 32;
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||||
|
struct Names {
|
||||||
|
#[serde(default)]
|
||||||
|
names: BTreeMap<u32, String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The folder that owns the names: an extra world (`<server>/.realms/<name>`) belongs to `<server>`.
|
||||||
|
fn main_folder(root: &Path) -> PathBuf {
|
||||||
|
if crate::launcher::settings::is_extra_world(root) {
|
||||||
|
if let Some(main) = root.parent().and_then(Path::parent) {
|
||||||
|
return main.to_path_buf();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
root.to_path_buf()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read(root: &Path) -> Names {
|
||||||
|
let path = main_folder(root).join(FILE);
|
||||||
|
if !path.is_file() {
|
||||||
|
return Names::default();
|
||||||
|
}
|
||||||
|
match fsx::read_json(&path) {
|
||||||
|
Ok(names) => names,
|
||||||
|
Err(error) => {
|
||||||
|
tracing::warn!(%error, "realm names could not be read; the default names are used");
|
||||||
|
Names::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A trimmed name the realm list can hold: 1 to 32 characters, no control characters.
|
||||||
|
pub fn validate(name: &str) -> Result<String> {
|
||||||
|
let name = name.trim();
|
||||||
|
if name.is_empty() {
|
||||||
|
return Err(Error::Invalid("The realm name cannot be empty.".into()));
|
||||||
|
}
|
||||||
|
if name.chars().count() > MAX_CHARS {
|
||||||
|
return Err(Error::Invalid(format!(
|
||||||
|
"The realm name can have at most {MAX_CHARS} characters."
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
// The game client stores the realm as `SET realmName "<name>"` in Config.wtf.
|
||||||
|
if name.chars().any(|c| c.is_control() || c == '"') {
|
||||||
|
return Err(Error::Invalid(
|
||||||
|
"The realm name cannot contain quotation marks or control characters.".into(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
Ok(name.to_string())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The owner's name for realm `id`, if one was chosen.
|
||||||
|
pub fn custom(root: &Path, id: u32) -> Option<String> {
|
||||||
|
read(root)
|
||||||
|
.names
|
||||||
|
.remove(&id)
|
||||||
|
.and_then(|name| validate(&name).ok())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The name realm `id` shows: the owner's choice, or `default`.
|
||||||
|
pub fn name_or(root: &Path, id: u32, default: &str) -> String {
|
||||||
|
custom(root, id).unwrap_or_else(|| default.to_string())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The name the realm of `mode` shows.
|
||||||
|
pub fn for_mode(root: &Path, mode: crate::realms::Mode) -> String {
|
||||||
|
name_or(root, mode.realm_id(), mode.label())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Every chosen name.
|
||||||
|
pub fn all(root: &Path) -> BTreeMap<u32, String> {
|
||||||
|
read(root)
|
||||||
|
.names
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(|(id, name)| validate(&name).ok().map(|name| (id, name)))
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Choose a name for realm `id`; `None` (or an empty name) returns it to its default.
|
||||||
|
pub fn set(root: &Path, id: u32, name: Option<&str>) -> Result<Option<String>> {
|
||||||
|
let mut names = read(root);
|
||||||
|
let chosen = match name.map(str::trim).filter(|n| !n.is_empty()) {
|
||||||
|
Some(name) => Some(validate(name)?),
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
match &chosen {
|
||||||
|
Some(name) => names.names.insert(id, name.clone()),
|
||||||
|
None => names.names.remove(&id),
|
||||||
|
};
|
||||||
|
fsx::atomic_write_json(&main_folder(root).join(FILE), &names)?;
|
||||||
|
Ok(chosen)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A realm of this server and the name it shows.
|
||||||
|
#[derive(Debug, Clone, Serialize, PartialEq, Eq)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct RealmName {
|
||||||
|
pub id: u32,
|
||||||
|
pub name: String,
|
||||||
|
pub default_name: String,
|
||||||
|
pub custom: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The realms of a server with their names: Conquest of Azeroth (or the plain repack's "AzerothCore") and the
|
||||||
|
/// Wildcard and Warcraft Reborn realms that were created.
|
||||||
|
pub fn list(root: &Path) -> Result<Vec<RealmName>> {
|
||||||
|
let main = main_folder(root);
|
||||||
|
let mut realms: Vec<(u32, &'static str)> = Vec::new();
|
||||||
|
if main.join("Settings/realm-profile.json").exists() {
|
||||||
|
let state = crate::realms::state(&main)?;
|
||||||
|
realms.extend(state.modes().into_iter().map(|m| (m.realm_id(), m.label())));
|
||||||
|
} else {
|
||||||
|
realms.push((1, "AzerothCore"));
|
||||||
|
}
|
||||||
|
realms.sort_unstable();
|
||||||
|
realms.dedup();
|
||||||
|
Ok(realms
|
||||||
|
.into_iter()
|
||||||
|
.map(|(id, default)| {
|
||||||
|
let custom = custom(&main, id);
|
||||||
|
RealmName {
|
||||||
|
id,
|
||||||
|
name: custom.clone().unwrap_or_else(|| default.to_string()),
|
||||||
|
default_name: default.to_string(),
|
||||||
|
custom: custom.is_some(),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Choose a name and, when the database runs, write it to the realm list at once (the auth server shows it
|
||||||
|
/// within its realm refresh interval). Returns the realms with their names.
|
||||||
|
pub fn rename(root: &Path, id: u32, name: Option<&str>) -> Result<Vec<RealmName>> {
|
||||||
|
let main = main_folder(root);
|
||||||
|
let known = list(&main)?;
|
||||||
|
let realm = known
|
||||||
|
.iter()
|
||||||
|
.find(|r| r.id == id)
|
||||||
|
.ok_or_else(|| Error::Invalid(format!("This server has no realm {id}.")))?;
|
||||||
|
let shown = set(&main, id, name)?.unwrap_or_else(|| realm.default_name.clone());
|
||||||
|
crate::backup::with_running_database(&main, |db| {
|
||||||
|
db.query(&format!(
|
||||||
|
"UPDATE acore_auth.realmlist SET name={} WHERE id={id};",
|
||||||
|
sql_literal(&shown)
|
||||||
|
))
|
||||||
|
.map(|_| ())
|
||||||
|
})?;
|
||||||
|
list(&main)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `text` as a MySQL string literal (quotes and backslashes escaped).
|
||||||
|
pub fn sql_literal(text: &str) -> String {
|
||||||
|
let mut out = String::with_capacity(text.len() + 2);
|
||||||
|
out.push('\'');
|
||||||
|
for c in text.chars() {
|
||||||
|
match c {
|
||||||
|
'\'' => out.push_str("''"),
|
||||||
|
'\\' => out.push_str("\\\\"),
|
||||||
|
c => out.push(c),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.push('\'');
|
||||||
|
out
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn names_are_validated_trimmed_and_reset() {
|
||||||
|
let d = tempfile::tempdir().unwrap();
|
||||||
|
assert_eq!(name_or(d.path(), 1, "Conquest of Azeroth"), "Conquest of Azeroth");
|
||||||
|
assert_eq!(set(d.path(), 1, Some(" Owner's Realm ")).unwrap().as_deref(), Some("Owner's Realm"));
|
||||||
|
assert_eq!(name_or(d.path(), 1, "x"), "Owner's Realm");
|
||||||
|
assert!(set(d.path(), 2, Some(&"a".repeat(33))).is_err());
|
||||||
|
assert!(set(d.path(), 2, Some("bad\nname")).is_err());
|
||||||
|
assert_eq!(set(d.path(), 2, Some("Царство")).unwrap().as_deref(), Some("Царство"));
|
||||||
|
assert_eq!(all(d.path()).len(), 2);
|
||||||
|
assert_eq!(set(d.path(), 1, Some(" ")).unwrap(), None);
|
||||||
|
assert_eq!(name_or(d.path(), 1, "Conquest of Azeroth"), "Conquest of Azeroth");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn an_extra_world_reads_its_main_folders_names() {
|
||||||
|
let d = tempfile::tempdir().unwrap();
|
||||||
|
set(d.path(), 2, Some("Wild Side")).unwrap();
|
||||||
|
let extra = d.path().join(".realms/secondary");
|
||||||
|
std::fs::create_dir_all(&extra).unwrap();
|
||||||
|
assert_eq!(custom(&extra, 2).as_deref(), Some("Wild Side"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn names_are_safe_in_sql() {
|
||||||
|
assert_eq!(sql_literal(r"O'Neil \ realm"), r"'O''Neil \\ realm'");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -185,8 +185,20 @@ pub fn view(root: &Path) -> Result<View> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn guard_module(root: &Path, id: &str) -> Result<()> {
|
pub fn guard_module(root: &Path, id: &str) -> Result<()> {
|
||||||
if state(root)?.active != Mode::Coa && matches!(id, "companions" | "playerbots") {
|
let s = state(root)?;
|
||||||
return Err(Error::Invalid("Bot class mechanics have not been validated for this realm. This module is unavailable on this realm.".into()));
|
if matches!(id, "companions" | "playerbots") {
|
||||||
|
if let Ok(v) = view(root) {
|
||||||
|
if s.active == Mode::Wildcard && !v.supported {
|
||||||
|
return Err(Error::Invalid(
|
||||||
|
"The installed server binary does not support Wildcard mode.".into(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if s.active == Mode::Reborn && !v.reborn_supported {
|
||||||
|
return Err(Error::Invalid(
|
||||||
|
"The installed server binary does not support Warcraft Reborn mode.".into(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -296,20 +308,14 @@ fn wildcard_configs(mut files: Files) -> Result<Files> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (key, value) in [("CoaBots.Enable", "0"), ("CoaBots.AutoLoginOnStartup", "0")] {
|
// Preserve existing CoaBots.Enable if present; do not force enable or alter alternative bot systems
|
||||||
set(
|
if let Some(bytes) = files.get("Core/configs/modules/mod_coa_playerbots.conf") {
|
||||||
&mut files,
|
if let Ok(conf) = ConfFile::parse_bytes(bytes) {
|
||||||
"Core/configs/modules/mod_coa_playerbots.conf",
|
if conf.get("CoaBots.Enable") == Some("1") {
|
||||||
key,
|
set(&mut files, "Core/configs/modules/mod_coa_playerbots.conf", "CoaBots.Enable", "1")?;
|
||||||
value,
|
}
|
||||||
)?;
|
}
|
||||||
}
|
}
|
||||||
set(
|
|
||||||
&mut files,
|
|
||||||
"Core/configs/modules/playerbots.conf",
|
|
||||||
"AiPlayerbot.Enabled",
|
|
||||||
"0",
|
|
||||||
)?;
|
|
||||||
Ok(files)
|
Ok(files)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,20 +343,14 @@ fn reborn_configs(mut files: Files) -> Result<Files> {
|
|||||||
set(&mut files, path, "RealmID", "3")?;
|
set(&mut files, path, "RealmID", "3")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (key, value) in [("CoaBots.Enable", "0"), ("CoaBots.AutoLoginOnStartup", "0")] {
|
// Preserve existing CoaBots.Enable if present; do not force enable or alter alternative bot systems
|
||||||
set(
|
if let Some(bytes) = files.get("Core/configs/modules/mod_coa_playerbots.conf") {
|
||||||
&mut files,
|
if let Ok(conf) = ConfFile::parse_bytes(bytes) {
|
||||||
"Core/configs/modules/mod_coa_playerbots.conf",
|
if conf.get("CoaBots.Enable") == Some("1") {
|
||||||
key,
|
set(&mut files, "Core/configs/modules/mod_coa_playerbots.conf", "CoaBots.Enable", "1")?;
|
||||||
value,
|
}
|
||||||
)?;
|
}
|
||||||
}
|
}
|
||||||
set(
|
|
||||||
&mut files,
|
|
||||||
"Core/configs/modules/playerbots.conf",
|
|
||||||
"AiPlayerbot.Enabled",
|
|
||||||
"0",
|
|
||||||
)?;
|
|
||||||
Ok(files)
|
Ok(files)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,19 +681,7 @@ pub fn before_start(root: &Path) -> Result<()> {
|
|||||||
"The installed server build does not support Wildcard.".into(),
|
"The installed server build does not support Wildcard.".into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
let path = root.join("Core/configs/modules/mod_coa_playerbots.conf");
|
// Multi-realm Playerbots 1.0: bots are supported and enabled on all realms
|
||||||
let mut conf = ConfFile::parse_bytes(&fs::read(&path)?)?;
|
|
||||||
conf.set("CoaBots.Enable", "0", &[]);
|
|
||||||
fsx::atomic_write(&path, conf.to_text().as_bytes())?;
|
|
||||||
let path = root.join("Core/configs/modules/playerbots.conf");
|
|
||||||
let bytes = if path.exists() {
|
|
||||||
fs::read(&path)?
|
|
||||||
} else {
|
|
||||||
b"[worldserver]\n".to_vec()
|
|
||||||
};
|
|
||||||
let mut conf = ConfFile::parse_bytes(&bytes)?;
|
|
||||||
conf.set("AiPlayerbot.Enabled", "0", &[]);
|
|
||||||
fsx::atomic_write(&path, conf.to_text().as_bytes())?;
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -707,8 +695,8 @@ pub fn setup_realmlist(root: &Path) -> Result<()> {
|
|||||||
let port = layout::read_ports(root).world;
|
let port = layout::read_ports(root).world;
|
||||||
for mode in s.modes().into_iter().filter(|m| *m != Mode::Coa) {
|
for mode in s.modes().into_iter().filter(|m| *m != Mode::Coa) {
|
||||||
let id = mode.realm_id();
|
let id = mode.realm_id();
|
||||||
let name = mode.label();
|
let name = crate::realm_names::sql_literal(&crate::realm_names::name_or(root, id, mode.label()));
|
||||||
db.query(&format!("INSERT INTO acore_auth.realmlist (id,name,address,localAddress,localSubnetMask,port,icon,flag,timezone,gamebuild) SELECT {id},'{name}',address,localAddress,localSubnetMask,{port},icon,2,timezone,gamebuild FROM acore_auth.realmlist WHERE id=1 ON DUPLICATE KEY UPDATE port={port};"))?;
|
db.query(&format!("INSERT INTO acore_auth.realmlist (id,name,address,localAddress,localSubnetMask,port,icon,flag,timezone,gamebuild) SELECT {id},{name},address,localAddress,localSubnetMask,{port},icon,2,timezone,gamebuild FROM acore_auth.realmlist WHERE id=1 ON DUPLICATE KEY UPDATE port={port},name={name};"))?;
|
||||||
}
|
}
|
||||||
let ids = s
|
let ids = s
|
||||||
.modes()
|
.modes()
|
||||||
@@ -813,11 +801,12 @@ mod tests {
|
|||||||
.get("RealmID"),
|
.get("RealmID"),
|
||||||
Some("3")
|
Some("3")
|
||||||
);
|
);
|
||||||
|
// Requirement 6: Never alter alternative bot system settings (AiPlayerbot.Enabled) without explicit user choice
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
ConfFile::parse_bytes(&reborn["Core/configs/modules/playerbots.conf"])
|
ConfFile::parse_bytes(&reborn["Core/configs/modules/playerbots.conf"])
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get("AiPlayerbot.Enabled"),
|
.get("AiPlayerbot.Enabled"),
|
||||||
Some("0")
|
Some("1")
|
||||||
);
|
);
|
||||||
write_configs(t.path(), &reborn).unwrap();
|
write_configs(t.path(), &reborn).unwrap();
|
||||||
write_configs(t.path(), &coa).unwrap();
|
write_configs(t.path(), &coa).unwrap();
|
||||||
@@ -831,8 +820,8 @@ mod tests {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(guard_module(t.path(), "companions").is_err());
|
assert!(guard_module(t.path(), "companions").is_ok());
|
||||||
assert!(guard_module(t.path(), "playerbots").is_err());
|
assert!(guard_module(t.path(), "playerbots").is_ok());
|
||||||
assert!(guard_module(t.path(), "content-scaling").is_ok());
|
assert!(guard_module(t.path(), "content-scaling").is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1020,6 +1009,10 @@ CoA.GameModeMask = 0
|
|||||||
"Core/configs/modules/mod-coa-content-scaling.conf".into(),
|
"Core/configs/modules/mod-coa-content-scaling.conf".into(),
|
||||||
b"[worldserver]\nCoAContentScaling.Enable = 1\n".to_vec(),
|
b"[worldserver]\nCoAContentScaling.Enable = 1\n".to_vec(),
|
||||||
);
|
);
|
||||||
|
f.insert(
|
||||||
|
"Core/configs/modules/mod_coa_playerbots.conf".into(),
|
||||||
|
b"[worldserver]\nCoaBots.Enable = 1\n".to_vec(),
|
||||||
|
);
|
||||||
f.insert(
|
f.insert(
|
||||||
"Settings/worldserver.conf.template".into(),
|
"Settings/worldserver.conf.template".into(),
|
||||||
b"[worldserver]\nRealmID = 1\n".to_vec(),
|
b"[worldserver]\nRealmID = 1\n".to_vec(),
|
||||||
@@ -1030,7 +1023,7 @@ CoA.GameModeMask = 0
|
|||||||
f["Core/configs/modules/mod-coa-content-scaling.conf"]
|
f["Core/configs/modules/mod-coa-content-scaling.conf"]
|
||||||
);
|
);
|
||||||
let c = ConfFile::parse_bytes(&w["Core/configs/modules/mod_coa_playerbots.conf"]).unwrap();
|
let c = ConfFile::parse_bytes(&w["Core/configs/modules/mod_coa_playerbots.conf"]).unwrap();
|
||||||
assert_eq!(c.get("CoaBots.Enable"), Some("0"));
|
assert_eq!(c.get("CoaBots.Enable"), Some("1"));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
ConfFile::parse_bytes(&w["Settings/worldserver.conf.template"])
|
ConfFile::parse_bytes(&w["Settings/worldserver.conf.template"])
|
||||||
.unwrap()
|
.unwrap()
|
||||||
@@ -1102,14 +1095,8 @@ CoA.GameModeMask = 0
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(crate::modules::set_enabled(t.path(), t.path(), "companions", true).is_err());
|
assert!(guard_module(t.path(), "companions").is_ok());
|
||||||
assert!(crate::config::save(
|
assert!(guard_module(t.path(), "playerbots").is_ok());
|
||||||
t.path(),
|
|
||||||
t.path(),
|
|
||||||
crate::config::Scope::Bots,
|
|
||||||
&BTreeMap::new()
|
|
||||||
)
|
|
||||||
.is_err());
|
|
||||||
assert!(guard_module(t.path(), "content-scaling").is_ok());
|
assert!(guard_module(t.path(), "content-scaling").is_ok());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,10 @@ use std::path::{Path, PathBuf};
|
|||||||
pub struct Profile {
|
pub struct Profile {
|
||||||
pub host: String,
|
pub host: String,
|
||||||
pub client_path: Option<String>,
|
pub client_path: Option<String>,
|
||||||
|
/// The listed server `host` belongs to, when the player joined it through the server list: its account is
|
||||||
|
/// filled into the game's login box at every Play.
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub realm: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load(dir: &Path) -> Result<Profile> {
|
pub fn load(dir: &Path) -> Result<Profile> {
|
||||||
@@ -43,12 +47,21 @@ pub fn save(dir: &Path, profile: &Profile) -> Result<()> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_profile_from_before_the_realm_field_still_loads() {
|
||||||
|
let d = tempfile::tempdir().unwrap();
|
||||||
|
std::fs::write(d.path().join("connection.json"), br#"{"host":"1.2.3.4","client_path":null}"#).unwrap();
|
||||||
|
let p = load(d.path()).unwrap();
|
||||||
|
assert_eq!((p.host.as_str(), p.realm), ("1.2.3.4", None));
|
||||||
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn connection_needs_no_server_and_survives_restart() {
|
fn connection_needs_no_server_and_survives_restart() {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let profile = Profile {
|
let profile = Profile {
|
||||||
host: "192.168.1.10".into(),
|
host: "192.168.1.10".into(),
|
||||||
client_path: None,
|
client_path: None,
|
||||||
|
realm: None,
|
||||||
};
|
};
|
||||||
save(dir.path(), &profile).unwrap();
|
save(dir.path(), &profile).unwrap();
|
||||||
assert_eq!(load(dir.path()).unwrap().host, profile.host);
|
assert_eq!(load(dir.path()).unwrap().host, profile.host);
|
||||||
@@ -70,6 +83,7 @@ mod tests {
|
|||||||
let profile = Profile {
|
let profile = Profile {
|
||||||
host: "192.168.1.10".into(),
|
host: "192.168.1.10".into(),
|
||||||
client_path: Some(game.to_string_lossy().into()),
|
client_path: Some(game.to_string_lossy().into()),
|
||||||
|
realm: None,
|
||||||
};
|
};
|
||||||
save(dir.path(), &profile).unwrap();
|
save(dir.path(), &profile).unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ fn run(args: Args) -> Result<(), String> {
|
|||||||
match args.action.as_str() {
|
match args.action.as_str() {
|
||||||
"watch-world" => {
|
"watch-world" => {
|
||||||
let me = std::env::current_exe().map_err(|x| x.to_string())?;
|
let me = std::env::current_exe().map_err(|x| x.to_string())?;
|
||||||
return world::watch_world(root, Some(&me), &|m| say(m)).map_err(e);
|
return world::watch_world(root, Some(&me), args.offset, &|m| say(m)).map_err(e);
|
||||||
}
|
}
|
||||||
"relay-worker" => return coa_core::launcher::relay::worker(root).map_err(e),
|
"relay-worker" => return coa_core::launcher::relay::worker(root).map_err(e),
|
||||||
"debug-logs-status" => {
|
"debug-logs-status" => {
|
||||||
|
|||||||
@@ -165,6 +165,48 @@
|
|||||||
"enable_key": "CoACustomRaces.Enable",
|
"enable_key": "CoACustomRaces.Enable",
|
||||||
"default_on": false
|
"default_on": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "subclass",
|
||||||
|
"name": "Subclasses and Hero Races",
|
||||||
|
"description": {
|
||||||
|
"en": "Part of Custom Races V2: a second class for the Thin Twins and the Two-Headed Ogre, and two players sharing one character.",
|
||||||
|
"ru": "Часть Custom Races V2: второй класс для Хрупких близнецов и Двуглавого огра и один персонаж на двух игроков.",
|
||||||
|
"de": "Teil von Custom Races V2: eine zweite Klasse für die Dünnen Zwillinge und die Zweiköpfige Ogerin sowie zwei Spieler an einer Figur.",
|
||||||
|
"fr": "Partie de Custom Races V2 : une seconde classe pour les Jumeaux maigres et l'Ogre à deux têtes, et deux joueurs pour un personnage.",
|
||||||
|
"es": "Parte de Custom Races V2: una segunda clase para los Gemelos delgados y el Ogro de dos cabezas, y dos jugadores en un personaje.",
|
||||||
|
"zh": "Custom Races V2 的一部分:为瘦弱双子和双头食人魔提供第二职业,并允许两名玩家共用一个角色。"
|
||||||
|
},
|
||||||
|
"repo": "https://github.com/Corfirean/azerothcore-wotlk-coa",
|
||||||
|
"conf": "mod_subclass.conf",
|
||||||
|
"switchable": true,
|
||||||
|
"status": "early",
|
||||||
|
"icon": "races",
|
||||||
|
"enable_key": "Subclass.Enable",
|
||||||
|
"default_on": true,
|
||||||
|
"part_of": "custom-races",
|
||||||
|
"hidden": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "dev-menu",
|
||||||
|
"name": "Dev Menu",
|
||||||
|
"description": {
|
||||||
|
"en": "Part of Custom Races V2: the in-game /dev editor for game masters (NPCs, items).",
|
||||||
|
"ru": "Часть Custom Races V2: внутриигровой редактор /dev для гейм-мастеров (НПС, предметы).",
|
||||||
|
"de": "Teil von Custom Races V2: der /dev-Editor im Spiel für Spielleiter (NPCs, Gegenstände).",
|
||||||
|
"fr": "Partie de Custom Races V2 : l'éditeur /dev en jeu pour les maîtres du jeu (PNJ, objets).",
|
||||||
|
"es": "Parte de Custom Races V2: el editor /dev del juego para los máster (PNJ, objetos).",
|
||||||
|
"zh": "Custom Races V2 的一部分:供游戏管理员使用的游戏内 /dev 编辑器(NPC、物品)。"
|
||||||
|
},
|
||||||
|
"repo": "https://github.com/Corfirean/azerothcore-wotlk-coa",
|
||||||
|
"conf": "mod_ilusixn_devmenu.conf",
|
||||||
|
"switchable": true,
|
||||||
|
"status": "early",
|
||||||
|
"icon": "sparkles",
|
||||||
|
"enable_key": "DevMenu.Enable",
|
||||||
|
"default_on": true,
|
||||||
|
"part_of": "custom-races",
|
||||||
|
"hidden": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "time-is-time",
|
"id": "time-is-time",
|
||||||
"name": "TimeIsTime",
|
"name": "TimeIsTime",
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "coa-server-manager",
|
"name": "coa-server-manager",
|
||||||
"version": "0.9.10",
|
"version": "0.9.14",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "coa-server-manager",
|
"name": "coa-server-manager",
|
||||||
"version": "0.9.10",
|
"version": "0.9.14",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^2.12.0",
|
"@tauri-apps/api": "^2.12.0",
|
||||||
"@tauri-apps/plugin-dialog": "^2.8.0",
|
"@tauri-apps/plugin-dialog": "^2.8.0",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "coa-server-manager",
|
"name": "coa-server-manager",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.9.10",
|
"version": "0.9.14",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -422,6 +422,128 @@
|
|||||||
"max": 40,
|
"max": 40,
|
||||||
"unit": "yards"
|
"unit": "yards"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "CoaBots.Scaling.Enable",
|
||||||
|
"type": "bool",
|
||||||
|
"category": "combat",
|
||||||
|
"title": "Bot strength help in dungeons and raids",
|
||||||
|
"description": "Master switch for the multipliers below. They are all 1 (no change) until you raise them.",
|
||||||
|
"default": true,
|
||||||
|
"advanced": false,
|
||||||
|
"restartRequired": "world",
|
||||||
|
"dangerous": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "CoaBots.Scaling.Dungeons",
|
||||||
|
"type": "bool",
|
||||||
|
"category": "combat",
|
||||||
|
"title": "Help in 5-player dungeons",
|
||||||
|
"description": "Apply the multipliers while a bot is in a 5-player dungeon.",
|
||||||
|
"default": true,
|
||||||
|
"advanced": false,
|
||||||
|
"restartRequired": "world",
|
||||||
|
"dangerous": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "CoaBots.Scaling.Raids",
|
||||||
|
"type": "bool",
|
||||||
|
"category": "combat",
|
||||||
|
"title": "Help in raids",
|
||||||
|
"description": "Apply the multipliers while a bot is in a raid.",
|
||||||
|
"default": true,
|
||||||
|
"advanced": false,
|
||||||
|
"restartRequired": "world",
|
||||||
|
"dangerous": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "CoaBots.Scaling.Battlegrounds",
|
||||||
|
"type": "bool",
|
||||||
|
"category": "combat",
|
||||||
|
"title": "Help in battlegrounds and arenas",
|
||||||
|
"description": "Apply the multipliers in battlegrounds and arenas.",
|
||||||
|
"default": false,
|
||||||
|
"advanced": true,
|
||||||
|
"restartRequired": "world",
|
||||||
|
"dangerous": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "CoaBots.Scaling.World",
|
||||||
|
"type": "bool",
|
||||||
|
"category": "combat",
|
||||||
|
"title": "Help in the open world",
|
||||||
|
"description": "Apply the multipliers outside dungeons and raids. Usually not wanted.",
|
||||||
|
"default": false,
|
||||||
|
"advanced": true,
|
||||||
|
"restartRequired": "world",
|
||||||
|
"dangerous": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "CoaBots.Scaling.DamageDone",
|
||||||
|
"type": "float",
|
||||||
|
"category": "combat",
|
||||||
|
"title": "Bot damage",
|
||||||
|
"description": "Multiplies the damage bots and their pets deal to creatures. 1 is no change; higher makes content easier.",
|
||||||
|
"default": 1.0,
|
||||||
|
"advanced": false,
|
||||||
|
"restartRequired": "world",
|
||||||
|
"dangerous": false,
|
||||||
|
"min": 0.1,
|
||||||
|
"max": 10,
|
||||||
|
"unit": "x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "CoaBots.Scaling.HealingDone",
|
||||||
|
"type": "float",
|
||||||
|
"category": "combat",
|
||||||
|
"title": "Bot healing",
|
||||||
|
"description": "Multiplies the healing bots cast. 1 is no change.",
|
||||||
|
"default": 1.0,
|
||||||
|
"advanced": false,
|
||||||
|
"restartRequired": "world",
|
||||||
|
"dangerous": false,
|
||||||
|
"min": 0.1,
|
||||||
|
"max": 10,
|
||||||
|
"unit": "x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "CoaBots.Scaling.DamageTaken",
|
||||||
|
"type": "float",
|
||||||
|
"category": "combat",
|
||||||
|
"title": "Damage taken by bots",
|
||||||
|
"description": "Multiplies the damage creatures deal to bots. Below 1 bots take less; 1 is no change.",
|
||||||
|
"default": 1.0,
|
||||||
|
"advanced": false,
|
||||||
|
"restartRequired": "world",
|
||||||
|
"dangerous": false,
|
||||||
|
"min": 0.1,
|
||||||
|
"max": 10,
|
||||||
|
"unit": "x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "CoaBots.Scaling.TankThreat",
|
||||||
|
"type": "float",
|
||||||
|
"category": "combat",
|
||||||
|
"title": "Tank threat",
|
||||||
|
"description": "Extra threat generated by bot tanks so they hold the enemy's attention. 1 is no change.",
|
||||||
|
"default": 1.0,
|
||||||
|
"advanced": false,
|
||||||
|
"restartRequired": "world",
|
||||||
|
"dangerous": false,
|
||||||
|
"min": 1,
|
||||||
|
"max": 10,
|
||||||
|
"unit": "x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "CoaBots.Scaling.BossTuning",
|
||||||
|
"type": "bool",
|
||||||
|
"category": "combat",
|
||||||
|
"title": "Extra help against four bosses",
|
||||||
|
"description": "Adds stronger multipliers for Loken, the Drakkari Elemental, the Drakkari Colossus and Gal'darah, whom level 60 bots could not beat otherwise. For testing; off by default.",
|
||||||
|
"default": false,
|
||||||
|
"advanced": true,
|
||||||
|
"restartRequired": "world",
|
||||||
|
"dangerous": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "CoaBots.WorldBrain.MountDistanceMin",
|
"key": "CoaBots.WorldBrain.MountDistanceMin",
|
||||||
"type": "int",
|
"type": "int",
|
||||||
|
|||||||
@@ -24,3 +24,4 @@ coa-core = { path = "../crates/coa-core" }
|
|||||||
coa-registry-proto = { path = "../crates/coa-registry-proto" }
|
coa-registry-proto = { path = "../crates/coa-registry-proto" }
|
||||||
coa-control-proto = { path = "../crates/coa-control-proto" }
|
coa-control-proto = { path = "../crates/coa-control-proto" }
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
|
uuid = { version = "1", features = ["v4"] }
|
||||||
@@ -439,6 +439,7 @@ pub(crate) async fn join_realm(
|
|||||||
let mut profile = coa_core::remote_client::load(&dir)
|
let mut profile = coa_core::remote_client::load(&dir)
|
||||||
.map_err(|e| fail("other", e.to_string()))?;
|
.map_err(|e| fail("other", e.to_string()))?;
|
||||||
profile.host = host;
|
profile.host = host;
|
||||||
|
profile.realm = Some(realm.clone());
|
||||||
coa_core::remote_client::save(&dir, &profile)
|
coa_core::remote_client::save(&dir, &profile)
|
||||||
.map_err(|e| fail("launch", e.to_string()))?;
|
.map_err(|e| fail("launch", e.to_string()))?;
|
||||||
super::play(state, REMOTE_CLIENT_ID.to_string())
|
super::play(state, REMOTE_CLIENT_ID.to_string())
|
||||||
|
|||||||
+420
-92
@@ -240,6 +240,7 @@ async fn portable_launch(
|
|||||||
let mut profile =
|
let mut profile =
|
||||||
coa_core::remote_client::load(&dir).map_err(|e| other(e.into()))?;
|
coa_core::remote_client::load(&dir).map_err(|e| other(e.into()))?;
|
||||||
profile.host = address;
|
profile.host = address;
|
||||||
|
profile.realm = Some(realm.clone());
|
||||||
coa_core::remote_client::save(&dir, &profile).map_err(|e| other(e.into()))?;
|
coa_core::remote_client::save(&dir, &profile).map_err(|e| other(e.into()))?;
|
||||||
if let Some(ref cp) = profile.client_path {
|
if let Some(ref cp) = profile.client_path {
|
||||||
if let Ok(pc) = control_cmds::player(&state) {
|
if let Ok(pc) = control_cmds::player(&state) {
|
||||||
@@ -350,6 +351,8 @@ struct StatusView {
|
|||||||
observed: Observed,
|
observed: Observed,
|
||||||
busy: bool,
|
busy: bool,
|
||||||
path_exists: bool,
|
path_exists: bool,
|
||||||
|
/// A scheduled restart is under way: a world that is down for a few minutes did not crash.
|
||||||
|
scheduled_restart: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Where the Manager keeps its own state (server list, logs). `%LOCALAPPDATA%` on Windows, the XDG data folder elsewhere.
|
/// Where the Manager keeps its own state (server list, logs). `%LOCALAPPDATA%` on Windows, the XDG data folder elsewhere.
|
||||||
@@ -548,9 +551,12 @@ async fn server_status(
|
|||||||
let root = path_of(&state, &id)?;
|
let root = path_of(&state, &id)?;
|
||||||
let busy = state.busy.lock().map(|b| b.contains(&id)).unwrap_or(false);
|
let busy = state.busy.lock().map(|b| b.contains(&id)).unwrap_or(false);
|
||||||
let path_exists = root.is_dir();
|
let path_exists = root.is_dir();
|
||||||
let observed = tauri::async_runtime::spawn_blocking(move || {
|
let (observed, scheduled_restart) = tauri::async_runtime::spawn_blocking(move || {
|
||||||
let ports = layout::read_ports(&root);
|
let ports = layout::read_ports(&root);
|
||||||
process::observe(&root, &ports)
|
(
|
||||||
|
process::observe(&root, &ports),
|
||||||
|
coa_core::launcher::schedule::under_way(&root),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.map_err(|e| Error::Invalid(e.to_string()))?;
|
.map_err(|e| Error::Invalid(e.to_string()))?;
|
||||||
@@ -558,6 +564,7 @@ async fn server_status(
|
|||||||
observed,
|
observed,
|
||||||
busy,
|
busy,
|
||||||
path_exists,
|
path_exists,
|
||||||
|
scheduled_restart,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -620,25 +627,53 @@ async fn start_server(
|
|||||||
let out = blocking(move || driver::run(&root, Verb::StartAll)).await?;
|
let out = blocking(move || driver::run(&root, Verb::StartAll)).await?;
|
||||||
if out.ok {
|
if out.ok {
|
||||||
if let Ok(root) = path_of(&state, &id) {
|
if let Ok(root) = path_of(&state, &id) {
|
||||||
// Companions requested while the server was stopped are created now (once; a failure is only logged).
|
// Companions requested while the server was stopped are reconciled and created now per realm.
|
||||||
let r = root.clone();
|
let r = root.clone();
|
||||||
|
let instance_id = id.clone();
|
||||||
let _ = tauri::async_runtime::spawn_blocking(move || -> Result<()> {
|
let _ = tauri::async_runtime::spawn_blocking(move || -> Result<()> {
|
||||||
if coa_core::realms::guard_module(&r, "companions").is_err() {
|
if coa_core::realms::guard_module(&r, "companions").is_err() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
let pending = meta_dir(&r)?.join("companions.pending.json");
|
let meta = meta_dir(&r)?;
|
||||||
if let Ok(v) = coa_core::fsx::read_json::<serde_json::Value>(&pending) {
|
if let Err(e) = coa_core::companions::migrate_legacy_pending_job(&meta, &instance_id) {
|
||||||
let _ = std::fs::remove_file(&pending);
|
tracing::warn!("failed to migrate legacy pending companions job: {e}");
|
||||||
let n = v["count"].as_u64().unwrap_or(0) as u32;
|
}
|
||||||
if n > 0 {
|
for mode in [
|
||||||
let made = coa_core::db::Db::from_repack(&r, coa_core::db::Account::Admin)
|
coa_core::realms::Mode::Coa,
|
||||||
.and_then(|db| coa_core::companions::ensure_templates(&db));
|
coa_core::realms::Mode::Wildcard,
|
||||||
if let Err(e) = made
|
coa_core::realms::Mode::Reborn,
|
||||||
.and_then(|_| Ra::connect(&r))
|
] {
|
||||||
.and_then(|mut ra| ra.spawn_bots(n))
|
let target = match coa_core::multiworld::resolve_bot_operation_target(&r, mode) {
|
||||||
{
|
Ok(t) => t,
|
||||||
tracing::warn!("pending companions were not created: {e}");
|
Err(e) => {
|
||||||
|
tracing::warn!("cannot resolve target for realm {}: {e}", mode.name());
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
let r_snap = r.clone();
|
||||||
|
let chars_db = target.chars_db;
|
||||||
|
let r_ra = r.clone();
|
||||||
|
let res = coa_core::companions::process_pending_job_with(
|
||||||
|
&meta,
|
||||||
|
mode,
|
||||||
|
&instance_id,
|
||||||
|
target.running,
|
||||||
|
|since_guid| {
|
||||||
|
let admin_db = coa_core::db::Db::from_repack(&r_snap, coa_core::db::Account::Admin)?;
|
||||||
|
let _ = coa_core::companions::ensure_templates_for_schema(&admin_db, chars_db);
|
||||||
|
coa_core::companions::query_bot_db_snapshot(&r_snap, &admin_db, chars_db, since_guid)
|
||||||
|
},
|
||||||
|
|delta, job| {
|
||||||
|
let mut ra = Ra::connect_target(&r_ra, Some(mode))?;
|
||||||
|
if let Some(lvl) = job.level {
|
||||||
|
ra.spawn_custom(delta, lvl, job.class_id, job.spec_id, job.build_id.as_deref())
|
||||||
|
} else {
|
||||||
|
ra.spawn_bots(delta)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if let Err(e) = res {
|
||||||
|
tracing::warn!("pending companions for realm {} failed during reconciliation: {e}", mode.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -1217,7 +1252,11 @@ async fn realm_select(
|
|||||||
let view = coa_core::realms::select(&root, mode)?;
|
let view = coa_core::realms::select(&root, mode)?;
|
||||||
let (dir, meta) = install_meta(&root)?;
|
let (dir, meta) = install_meta(&root)?;
|
||||||
if let Some(client) = meta.client_path {
|
if let Some(client) = meta.client_path {
|
||||||
coa_core::client::sync_realm(std::path::Path::new(&client), &dir, view.active)?;
|
coa_core::client::sync_realm_named(
|
||||||
|
std::path::Path::new(&client),
|
||||||
|
&dir,
|
||||||
|
&coa_core::realm_names::for_mode(&root, view.active),
|
||||||
|
)?;
|
||||||
}
|
}
|
||||||
if restart {
|
if restart {
|
||||||
let out = driver::run(&root, Verb::StartAll)?;
|
let out = driver::run(&root, Verb::StartAll)?;
|
||||||
@@ -1234,6 +1273,90 @@ async fn realm_select(
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Serialize)]
|
||||||
|
struct RestartScheduleView {
|
||||||
|
schedule: coa_core::launcher::schedule::RestartSchedule,
|
||||||
|
/// The server ships the Rust world supervisor that carries out the schedule.
|
||||||
|
supported: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn restart_schedule(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
) -> std::result::Result<RestartScheduleView, UiError> {
|
||||||
|
let root = path_of(&state, &id)?;
|
||||||
|
blocking(move || {
|
||||||
|
Ok(RestartScheduleView {
|
||||||
|
schedule: coa_core::launcher::schedule::load(&root),
|
||||||
|
supported: root.join("Scripts/coa-launcher.exe").is_file(),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Restart the world every day at the owner's local time; the running supervisor reads it within a minute.
|
||||||
|
#[tauri::command]
|
||||||
|
async fn restart_schedule_save(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
schedule: coa_core::launcher::schedule::RestartSchedule,
|
||||||
|
) -> std::result::Result<RestartScheduleView, UiError> {
|
||||||
|
let root = path_of(&state, &id)?;
|
||||||
|
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||||
|
blocking(move || {
|
||||||
|
Ok(RestartScheduleView {
|
||||||
|
schedule: coa_core::launcher::schedule::save(&root, &schedule)?,
|
||||||
|
supported: root.join("Scripts/coa-launcher.exe").is_file(),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn mysql_custom(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
) -> std::result::Result<coa_core::launcher::render::CustomMysql, UiError> {
|
||||||
|
let root = path_of(&state, &id)?;
|
||||||
|
blocking(move || Ok(coa_core::launcher::render::read_custom_mysql(&root))).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The owner's own MySQL options (Settings/mysql-custom.ini); they apply at the next start of the database.
|
||||||
|
#[tauri::command]
|
||||||
|
async fn mysql_custom_save(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
text: String,
|
||||||
|
) -> std::result::Result<coa_core::launcher::render::CustomMysql, UiError> {
|
||||||
|
let root = path_of(&state, &id)?;
|
||||||
|
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||||
|
blocking(move || coa_core::launcher::render::write_custom_mysql(&root, &text)).await
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn realm_names(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
) -> std::result::Result<Vec<coa_core::realm_names::RealmName>, UiError> {
|
||||||
|
let root = path_of(&state, &id)?;
|
||||||
|
blocking(move || coa_core::realm_names::list(&root)).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Rename a realm (`None` brings back its default name). The realm list changes at once when the database runs,
|
||||||
|
/// and the linked game client selects the new name on the next Play.
|
||||||
|
#[tauri::command]
|
||||||
|
async fn realm_rename(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
realm_id: u32,
|
||||||
|
name: Option<String>,
|
||||||
|
) -> std::result::Result<Vec<coa_core::realm_names::RealmName>, UiError> {
|
||||||
|
let root = path_of(&state, &id)?;
|
||||||
|
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||||
|
blocking(move || coa_core::realm_names::rename(&root, realm_id, name.as_deref())).await
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn realm_simultaneous(
|
async fn realm_simultaneous(
|
||||||
state: State<'_, AppState>,
|
state: State<'_, AppState>,
|
||||||
@@ -1384,6 +1507,68 @@ async fn custom_races_install(
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn custom_race_characters(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
) -> std::result::Result<Option<coa_core::custom_races::CustomRaceCharacters>, UiError> {
|
||||||
|
let root = path_of(&state, &id)?;
|
||||||
|
blocking(move || coa_core::custom_races::custom_race_characters(&root)).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Delete the companion bots of custom races through the running world's console. Returns how many.
|
||||||
|
#[tauri::command]
|
||||||
|
async fn purge_custom_race_bots(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
) -> std::result::Result<u32, UiError> {
|
||||||
|
let root = path_of(&state, &id)?;
|
||||||
|
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||||
|
blocking(move || {
|
||||||
|
let o = coa_core::process::observe(&root, &layout::read_ports(&root));
|
||||||
|
if o.world.state != coa_core::process::ServiceState::Running {
|
||||||
|
return Err(Error::Invalid("Start the server to delete bots.".into()));
|
||||||
|
}
|
||||||
|
Ra::connect(&root)?.purge_custom_race_bots()
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn addons_list(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
) -> std::result::Result<Vec<coa_core::addons::AddonView>, UiError> {
|
||||||
|
let ctx = client_context(&state, &id)?;
|
||||||
|
blocking(move || coa_core::addons::list(&ctx.require()?)).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Install or update a catalog addon in the linked game client (pinned commit, every file checked).
|
||||||
|
#[tauri::command]
|
||||||
|
async fn addons_install(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
addon: String,
|
||||||
|
) -> std::result::Result<Vec<coa_core::addons::AddonView>, UiError> {
|
||||||
|
let ctx = client_context(&state, &id)?;
|
||||||
|
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||||
|
let cancel = begin_client_job(&state)?;
|
||||||
|
let result = blocking(move || coa_core::addons::install(&ctx.require()?, &addon, &cancel)).await;
|
||||||
|
end_client_job(&state);
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn addons_remove(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
addon: String,
|
||||||
|
) -> std::result::Result<Vec<coa_core::addons::AddonView>, UiError> {
|
||||||
|
let ctx = client_context(&state, &id)?;
|
||||||
|
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||||
|
blocking(move || coa_core::addons::remove(&ctx.require()?, &addon)).await
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn custom_races_uninstall(
|
async fn custom_races_uninstall(
|
||||||
state: State<'_, AppState>,
|
state: State<'_, AppState>,
|
||||||
@@ -1697,6 +1882,7 @@ async fn retry_update_validation(
|
|||||||
async fn get_population(
|
async fn get_population(
|
||||||
state: State<'_, AppState>,
|
state: State<'_, AppState>,
|
||||||
id: String,
|
id: String,
|
||||||
|
realm: Option<coa_core::realms::Mode>,
|
||||||
) -> std::result::Result<Option<coa_core::population::Population>, UiError> {
|
) -> std::result::Result<Option<coa_core::population::Population>, UiError> {
|
||||||
let root = path_of(&state, &id)?;
|
let root = path_of(&state, &id)?;
|
||||||
Ok(tauri::async_runtime::spawn_blocking(move || {
|
Ok(tauri::async_runtime::spawn_blocking(move || {
|
||||||
@@ -1704,12 +1890,48 @@ async fn get_population(
|
|||||||
if o.mysql.state != coa_core::process::ServiceState::Running {
|
if o.mysql.state != coa_core::process::ServiceState::Running {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
coa_core::population::query(&root).ok()
|
if let Some(mode) = realm {
|
||||||
|
coa_core::population::query_for_realm(&root, mode).ok()
|
||||||
|
} else {
|
||||||
|
coa_core::population::query(&root).ok()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.unwrap_or(None))
|
.unwrap_or(None))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn companions_login_all(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
realm: Option<coa_core::realms::Mode>,
|
||||||
|
) -> std::result::Result<String, UiError> {
|
||||||
|
let root = path_of(&state, &id)?;
|
||||||
|
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||||
|
blocking(move || {
|
||||||
|
let mut ra = Ra::connect_target(&root, realm)?;
|
||||||
|
ra.login_all()
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn companions_spawn_fleet(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
race: u8,
|
||||||
|
level: u8,
|
||||||
|
realm: Option<coa_core::realms::Mode>,
|
||||||
|
) -> std::result::Result<String, UiError> {
|
||||||
|
let root = path_of(&state, &id)?;
|
||||||
|
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||||
|
blocking(move || {
|
||||||
|
let mut ra = Ra::connect_target(&root, realm)?;
|
||||||
|
ra.spawn_fleet(race, level)
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
struct CompanionAction {
|
struct CompanionAction {
|
||||||
/// Bots affected (cancelled from the queue, or logged out).
|
/// Bots affected (cancelled from the queue, or logged out).
|
||||||
@@ -1720,12 +1942,31 @@ struct CompanionAction {
|
|||||||
async fn companions_stop_spawning(
|
async fn companions_stop_spawning(
|
||||||
state: State<'_, AppState>,
|
state: State<'_, AppState>,
|
||||||
id: String,
|
id: String,
|
||||||
|
realm: Option<coa_core::realms::Mode>,
|
||||||
) -> std::result::Result<CompanionAction, UiError> {
|
) -> std::result::Result<CompanionAction, UiError> {
|
||||||
let root = path_of(&state, &id)?;
|
let root = path_of(&state, &id)?;
|
||||||
blocking(move || {
|
blocking(move || {
|
||||||
Ok(CompanionAction {
|
let mode = realm.unwrap_or_else(|| {
|
||||||
count: Ra::connect(&root)?.cancel_spawning()?,
|
coa_core::realms::view(&root).map(|v| v.active).unwrap_or_default()
|
||||||
})
|
});
|
||||||
|
let meta = meta_dir(&root)?;
|
||||||
|
let cancelled_pending = coa_core::companions::cancel_pending_job(&meta, mode.name())
|
||||||
|
.ok()
|
||||||
|
.flatten();
|
||||||
|
match Ra::connect_target(&root, Some(mode)).and_then(|mut ra| ra.cancel_spawning()) {
|
||||||
|
Ok(ra_cancelled) => Ok(CompanionAction {
|
||||||
|
count: ra_cancelled + cancelled_pending.map(|j| j.remaining_count()).unwrap_or(0),
|
||||||
|
}),
|
||||||
|
Err(e) => {
|
||||||
|
if let Some(job) = cancelled_pending {
|
||||||
|
Ok(CompanionAction {
|
||||||
|
count: job.remaining_count(),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Err(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -1734,12 +1975,12 @@ async fn companions_stop_spawning(
|
|||||||
async fn companions_take_offline(
|
async fn companions_take_offline(
|
||||||
state: State<'_, AppState>,
|
state: State<'_, AppState>,
|
||||||
id: String,
|
id: String,
|
||||||
|
realm: Option<coa_core::realms::Mode>,
|
||||||
) -> std::result::Result<CompanionAction, UiError> {
|
) -> std::result::Result<CompanionAction, UiError> {
|
||||||
let root = path_of(&state, &id)?;
|
let root = path_of(&state, &id)?;
|
||||||
let _guard = BusyGuard::acquire(&state, &id)?;
|
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||||
blocking(move || {
|
blocking(move || {
|
||||||
let mut ra = Ra::connect(&root)?;
|
let mut ra = Ra::connect_target(&root, realm)?;
|
||||||
// Anything still waiting to be created must not come back right after.
|
|
||||||
let _ = ra.cancel_spawning();
|
let _ = ra.cancel_spawning();
|
||||||
Ok(CompanionAction {
|
Ok(CompanionAction {
|
||||||
count: ra.despawn_all()?,
|
count: ra.despawn_all()?,
|
||||||
@@ -1748,13 +1989,12 @@ async fn companions_take_offline(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Log `count` randomly chosen online companions out to lower the load. Uses the per-bot command that every server
|
|
||||||
/// build has, so it works on older builds too.
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn companions_despawn_some(
|
async fn companions_despawn_some(
|
||||||
state: State<'_, AppState>,
|
state: State<'_, AppState>,
|
||||||
id: String,
|
id: String,
|
||||||
count: u32,
|
count: u32,
|
||||||
|
realm: Option<coa_core::realms::Mode>,
|
||||||
) -> std::result::Result<CompanionAction, UiError> {
|
) -> std::result::Result<CompanionAction, UiError> {
|
||||||
let root = path_of(&state, &id)?;
|
let root = path_of(&state, &id)?;
|
||||||
let _guard = BusyGuard::acquire(&state, &id)?;
|
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||||
@@ -1762,13 +2002,18 @@ async fn companions_despawn_some(
|
|||||||
if !(1..=5000).contains(&count) {
|
if !(1..=5000).contains(&count) {
|
||||||
return Err(Error::Invalid("Choose a number between 1 and 5000.".into()));
|
return Err(Error::Invalid("Choose a number between 1 and 5000.".into()));
|
||||||
}
|
}
|
||||||
|
let mode = realm.unwrap_or_else(|| {
|
||||||
|
coa_core::realms::view(&root).map(|v| v.active).unwrap_or_default()
|
||||||
|
});
|
||||||
|
let target = coa_core::multiworld::resolve_bot_operation_target(&root, mode)?;
|
||||||
let prefix = coa_core::population::bot_account_prefix(&root).to_uppercase();
|
let prefix = coa_core::population::bot_account_prefix(&root).to_uppercase();
|
||||||
let db = coa_core::db::Db::from_repack(&root, coa_core::db::Account::App)?;
|
let db = coa_core::db::Db::from_repack(&root, coa_core::db::Account::App)?;
|
||||||
let rows = db.query(&format!(
|
let rows = db.query(&format!(
|
||||||
"SELECT c.guid FROM acore_characters.characters c JOIN acore_auth.account a ON a.id=c.account WHERE c.online=1 AND UPPER(a.username) LIKE '{prefix}%' ORDER BY RAND() LIMIT {count};"
|
"SELECT c.guid FROM {}.characters c JOIN acore_auth.account a ON a.id=c.account WHERE c.online=1 AND UPPER(a.username) LIKE '{prefix}%' ORDER BY RAND() LIMIT {count};",
|
||||||
|
target.chars_db
|
||||||
))?;
|
))?;
|
||||||
let guids: Vec<u64> = rows.lines().filter_map(|l| l.trim().parse().ok()).collect();
|
let guids: Vec<u64> = rows.lines().filter_map(|l| l.trim().parse().ok()).collect();
|
||||||
let mut ra = Ra::connect(&root)?;
|
let mut ra = Ra::connect_target(&root, Some(mode))?;
|
||||||
let mut done = 0;
|
let mut done = 0;
|
||||||
for g in guids {
|
for g in guids {
|
||||||
if ra.despawn_bot(g).unwrap_or(false) {
|
if ra.despawn_bot(g).unwrap_or(false) {
|
||||||
@@ -1780,31 +2025,36 @@ async fn companions_despawn_some(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Delete every companion for good. A recovery point of the characters and accounts is saved first.
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn companions_delete_all(
|
async fn companions_delete_all(
|
||||||
app: AppHandle,
|
app: AppHandle,
|
||||||
state: State<'_, AppState>,
|
state: State<'_, AppState>,
|
||||||
id: String,
|
id: String,
|
||||||
|
realm: Option<coa_core::realms::Mode>,
|
||||||
) -> std::result::Result<CompanionAction, UiError> {
|
) -> std::result::Result<CompanionAction, UiError> {
|
||||||
let root = path_of(&state, &id)?;
|
let root = path_of(&state, &id)?;
|
||||||
let _guard = BusyGuard::acquire(&state, &id)?;
|
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||||
blocking(move || {
|
blocking(move || {
|
||||||
|
let mode = realm.unwrap_or_else(|| {
|
||||||
|
coa_core::realms::view(&root).map(|v| v.active).unwrap_or_default()
|
||||||
|
});
|
||||||
|
let target = coa_core::multiworld::resolve_bot_operation_target(&root, mode)?;
|
||||||
let meta = meta_dir(&root)?;
|
let meta = meta_dir(&root)?;
|
||||||
backup::create(
|
backup::create(
|
||||||
&root,
|
&root,
|
||||||
&meta,
|
&meta,
|
||||||
Kind::Quick,
|
Kind::Quick,
|
||||||
Trigger::BeforeDangerousChange,
|
Trigger::BeforeDangerousChange,
|
||||||
Some("before deleting all companions".into()),
|
Some(format!("before deleting all {} companions", target.realm.label())),
|
||||||
&|step| {
|
&|step| {
|
||||||
let _ = app.emit("backup-progress", step);
|
let _ = app.emit("backup-progress", step);
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
let before = coa_core::population::query(&root)
|
let before = coa_core::population::query_for_realm(&root, mode)
|
||||||
.map(|p| p.bots_total)
|
.map(|p| p.bots_total)
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
let mut ra = Ra::connect(&root)?;
|
let _ = coa_core::companions::cancel_pending_job(&meta, mode.name());
|
||||||
|
let mut ra = Ra::connect_target(&root, Some(mode))?;
|
||||||
let _ = ra.cancel_spawning();
|
let _ = ra.cancel_spawning();
|
||||||
ra.purge_all()?;
|
ra.purge_all()?;
|
||||||
Ok(CompanionAction { count: before })
|
Ok(CompanionAction { count: before })
|
||||||
@@ -1860,6 +2110,11 @@ async fn add_companions(
|
|||||||
state: State<'_, AppState>,
|
state: State<'_, AppState>,
|
||||||
id: String,
|
id: String,
|
||||||
count: u32,
|
count: u32,
|
||||||
|
realm: Option<coa_core::realms::Mode>,
|
||||||
|
level: Option<u8>,
|
||||||
|
class_id: Option<u8>,
|
||||||
|
spec_id: Option<u32>,
|
||||||
|
archetype: Option<String>,
|
||||||
) -> std::result::Result<CompanionsResult, UiError> {
|
) -> std::result::Result<CompanionsResult, UiError> {
|
||||||
let root = path_of(&state, &id)?;
|
let root = path_of(&state, &id)?;
|
||||||
let _guard = BusyGuard::acquire(&state, &id)?;
|
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||||
@@ -1869,81 +2124,84 @@ async fn add_companions(
|
|||||||
"Choose between 1 and 2000 companions.".into(),
|
"Choose between 1 and 2000 companions.".into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
let mode = realm.unwrap_or_else(|| {
|
||||||
|
coa_core::realms::view(&root).map(|v| v.active).unwrap_or_default()
|
||||||
|
});
|
||||||
|
coa_core::companions::validate_spawn_request(
|
||||||
|
mode,
|
||||||
|
count,
|
||||||
|
level,
|
||||||
|
class_id,
|
||||||
|
spec_id,
|
||||||
|
archetype.as_deref(),
|
||||||
|
)?;
|
||||||
|
let target = coa_core::multiworld::resolve_bot_operation_target(&root, mode)?;
|
||||||
|
if mode == coa_core::realms::Mode::Wildcard {
|
||||||
|
if let Some(ref arch_id) = archetype {
|
||||||
|
if !arch_id.trim().is_empty() {
|
||||||
|
let db = coa_core::db::Db::from_repack(&root, coa_core::db::Account::Admin)?;
|
||||||
|
let archetypes = coa_core::companions::list_wildcard_archetypes(&db, target.chars_db)?;
|
||||||
|
if !archetypes.iter().any(|a| a.id.eq_ignore_ascii_case(arch_id.trim())) {
|
||||||
|
return Err(Error::Invalid(format!(
|
||||||
|
"Unknown Wildcard build UUID '{}' in {}.coa_build_creator.",
|
||||||
|
arch_id.trim(),
|
||||||
|
target.chars_db
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
let meta = meta_dir(&root)?;
|
let meta = meta_dir(&root)?;
|
||||||
let mut changes = BTreeMap::new();
|
let mut changes = BTreeMap::new();
|
||||||
changes.insert("CoaBots.AutoLoginOnStartup".to_string(), Value::Bool(true));
|
changes.insert("CoaBots.AutoLoginOnStartup".to_string(), Value::Bool(true));
|
||||||
// Every companion, old and new, should come back at the next start, so the start-up limit only ever grows here.
|
let existing_cfg = config::load(&target.world_root, Scope::Bots)?;
|
||||||
let existing_max = config::load(&root, Scope::Bots)
|
let existing_max = existing_cfg
|
||||||
.ok()
|
.settings
|
||||||
.and_then(|v| {
|
.iter()
|
||||||
v.settings
|
.find(|s| s.meta.key == "CoaBots.AutoLogin.MaxCount")
|
||||||
.iter()
|
.and_then(|s| s.value.as_u64())
|
||||||
.find(|s| s.meta.key == "CoaBots.AutoLogin.MaxCount")
|
|
||||||
.and_then(|s| s.value.as_u64())
|
|
||||||
})
|
|
||||||
.unwrap_or(0) as u32;
|
.unwrap_or(0) as u32;
|
||||||
let already = coa_core::population::query(&root)
|
let already = coa_core::population::query_for_realm(&root, mode)
|
||||||
.map(|p| p.bots_total)
|
.map(|p| p.bots_total)
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
changes.insert(
|
changes.insert(
|
||||||
"CoaBots.AutoLogin.MaxCount".to_string(),
|
"CoaBots.AutoLogin.MaxCount".to_string(),
|
||||||
Value::from(existing_max.max(already + count).min(5000)),
|
Value::from(existing_max.max(already + count).min(5000)),
|
||||||
);
|
);
|
||||||
config::save(&root, &meta, Scope::Bots, &changes)?;
|
config::save(&target.world_root, &meta, Scope::Bots, &changes)?;
|
||||||
let o = coa_core::process::observe(&root, &layout::read_ports(&root));
|
|
||||||
// Large batches while the server is stopped: create them in the database right now, fully equipped.
|
|
||||||
if o.world.state == coa_core::process::ServiceState::Stopped
|
|
||||||
&& o.auth.state == coa_core::process::ServiceState::Stopped
|
|
||||||
&& count >= coa_core::companions::OFFLINE_MIN
|
|
||||||
&& coa_core::companions::offline_factory(&root).is_some()
|
|
||||||
{
|
|
||||||
let started_db = o.mysql.state != coa_core::process::ServiceState::Running;
|
|
||||||
if started_db {
|
|
||||||
let out = driver::run(&root, Verb::StartMysql)?;
|
|
||||||
if !out.ok {
|
|
||||||
return Err(Error::Invalid("The database could not be started.".into()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let made = (|| -> Result<()> {
|
|
||||||
coa_core::companions::ensure_templates(&coa_core::db::Db::from_repack(
|
|
||||||
&root,
|
|
||||||
coa_core::db::Account::Admin,
|
|
||||||
)?)?;
|
|
||||||
coa_core::companions::offline_create(
|
|
||||||
&root,
|
|
||||||
&meta.join("logs").join("companions-offline.log"),
|
|
||||||
count,
|
|
||||||
)?;
|
|
||||||
Ok(())
|
|
||||||
})();
|
|
||||||
if started_db {
|
|
||||||
let _ = driver::run(&root, Verb::StopAll);
|
|
||||||
}
|
|
||||||
made?;
|
|
||||||
tracing::info!(count, "companions created offline");
|
|
||||||
return Ok(CompanionsResult {
|
|
||||||
spawned: None,
|
|
||||||
created: Some(count),
|
|
||||||
baseline: None,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
let mut baseline = None;
|
let mut baseline = None;
|
||||||
let spawned = if o.world.state == coa_core::process::ServiceState::Running {
|
let spawned = if target.running {
|
||||||
// Older servers have no template characters to copy bots from: add them first.
|
if let Ok(admin_db) = coa_core::db::Db::from_repack(&root, coa_core::db::Account::Admin) {
|
||||||
coa_core::companions::ensure_templates(&coa_core::db::Db::from_repack(
|
let _ = coa_core::companions::ensure_templates_for_schema(&admin_db, target.chars_db);
|
||||||
&root,
|
}
|
||||||
coa_core::db::Account::Admin,
|
baseline = coa_core::population::query_for_realm(&root, mode)
|
||||||
)?)?;
|
|
||||||
baseline = coa_core::population::query(&root)
|
|
||||||
.ok()
|
.ok()
|
||||||
.map(|p| p.bots_total);
|
.map(|p| p.bots_total);
|
||||||
Some(Ra::connect(&root)?.spawn_bots(count)?)
|
let mut ra = Ra::connect_target(&root, Some(mode))?;
|
||||||
|
if let Some(lvl) = level {
|
||||||
|
Some(ra.spawn_custom(count, lvl, class_id, spec_id, archetype.as_deref())?)
|
||||||
|
} else {
|
||||||
|
Some(ra.spawn_bots(count)?)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// The server is stopped: creating bots needs it running, so remember the request and do it after the next start.
|
let _ = coa_core::companions::migrate_legacy_pending_job(&meta, &id);
|
||||||
coa_core::fsx::atomic_write_json(
|
let mut job = coa_core::companions::CompanionsPendingJob::new(
|
||||||
&meta.join("companions.pending.json"),
|
&id,
|
||||||
&serde_json::json!({ "count": count }),
|
mode.name(),
|
||||||
)?;
|
count,
|
||||||
|
level,
|
||||||
|
class_id,
|
||||||
|
spec_id,
|
||||||
|
archetype.clone(),
|
||||||
|
);
|
||||||
|
if let Ok(admin_db) = coa_core::db::Db::from_repack(&root, coa_core::db::Account::Admin) {
|
||||||
|
if let Ok(snap) = coa_core::companions::query_bot_db_snapshot(&root, &admin_db, target.chars_db, None) {
|
||||||
|
job.baseline_bot_count = Some(snap.bot_count);
|
||||||
|
job.baseline_max_guid = Some(snap.max_guid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
coa_core::companions::save_pending_job(&meta, mode.name(), &job)?;
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
tracing::info!(count, spawned = spawned.is_some(), "companions requested");
|
tracing::info!(count, spawned = spawned.is_some(), "companions requested");
|
||||||
@@ -1956,6 +2214,27 @@ async fn add_companions(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn get_wildcard_archetypes(
|
||||||
|
state: State<'_, AppState>,
|
||||||
|
id: String,
|
||||||
|
) -> std::result::Result<Vec<coa_core::companions::WildcardArchetypeDto>, UiError> {
|
||||||
|
let root = path_of(&state, &id)?;
|
||||||
|
blocking(move || {
|
||||||
|
let db = coa_core::db::Db::from_repack(&root, coa_core::db::Account::Admin)?;
|
||||||
|
let target = coa_core::multiworld::resolve_bot_operation_target(&root, coa_core::realms::Mode::Wildcard)
|
||||||
|
.unwrap_or_else(|_| coa_core::multiworld::BotOperationTarget {
|
||||||
|
world_root: root.clone(),
|
||||||
|
chars_db: "acore_characters_wildcard",
|
||||||
|
ra_port: 3444,
|
||||||
|
running: false,
|
||||||
|
realm: coa_core::realms::Mode::Wildcard,
|
||||||
|
});
|
||||||
|
Ok(coa_core::companions::list_wildcard_archetypes(&db, target.chars_db)?)
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
const REMOTE_CLIENT_ID: &str = "@remote-client";
|
const REMOTE_CLIENT_ID: &str = "@remote-client";
|
||||||
|
|
||||||
fn remote_dir() -> PathBuf {
|
fn remote_dir() -> PathBuf {
|
||||||
@@ -1982,6 +2261,10 @@ fn remote_connect(
|
|||||||
if host.is_empty() {
|
if host.is_empty() {
|
||||||
return Err(Error::Invalid("Enter the host's IP address or hostname.".into()).into());
|
return Err(Error::Invalid("Enter the host's IP address or hostname.".into()).into());
|
||||||
}
|
}
|
||||||
|
if profile.host != host {
|
||||||
|
// A host typed by hand is not the listed server whose account was remembered.
|
||||||
|
profile.realm = None;
|
||||||
|
}
|
||||||
profile.host = host.into();
|
profile.host = host.into();
|
||||||
coa_core::remote_client::save(&dir, &profile)?;
|
coa_core::remote_client::save(&dir, &profile)?;
|
||||||
Ok(profile)
|
Ok(profile)
|
||||||
@@ -2382,6 +2665,15 @@ async fn play(
|
|||||||
if id == REMOTE_CLIENT_ID {
|
if id == REMOTE_CLIENT_ID {
|
||||||
let ctx = client_context(&state, &id)?;
|
let ctx = client_context(&state, &id)?;
|
||||||
let client = ctx.require()?;
|
let client = ctx.require()?;
|
||||||
|
// The account the Manager made (or linked) on that listed server goes into the login box at every Play,
|
||||||
|
// also when another server's account was used in between.
|
||||||
|
let login = coa_core::remote_client::load(&remote_dir())
|
||||||
|
.ok()
|
||||||
|
.and_then(|profile| profile.realm)
|
||||||
|
.and_then(|realm| {
|
||||||
|
let pc = control_cmds::player(&state).ok()?;
|
||||||
|
pc.credentials(&control_cmds::realm_id(&realm).ok()?).ok()?
|
||||||
|
});
|
||||||
return blocking(move || {
|
return blocking(move || {
|
||||||
if ctx.host.is_empty() {
|
if ctx.host.is_empty() {
|
||||||
return Err(Error::Invalid(
|
return Err(Error::Invalid(
|
||||||
@@ -2392,6 +2684,12 @@ async fn play(
|
|||||||
return Err(Error::Invalid("The game is already running.".into()));
|
return Err(Error::Invalid("The game is already running.".into()));
|
||||||
}
|
}
|
||||||
coa_core::client::begin_realmlist_override(&client, &ctx.dir, &ctx.host)?;
|
coa_core::client::begin_realmlist_override(&client, &ctx.dir, &ctx.host)?;
|
||||||
|
if let Some(creds) = &login {
|
||||||
|
let _ = coa_core::glue_config::prefill_login(&client, &creds.username, &creds.password);
|
||||||
|
}
|
||||||
|
if window_preferences::clear_cache_on_play(&data_dir()) {
|
||||||
|
let _ = coa_core::client::clear_game_cache(&client);
|
||||||
|
}
|
||||||
coa_core::client::launch(&client)?;
|
coa_core::client::launch(&client)?;
|
||||||
let client_c = client.clone();
|
let client_c = client.clone();
|
||||||
let meta_c = ctx.dir.clone();
|
let meta_c = ctx.dir.clone();
|
||||||
@@ -2427,7 +2725,8 @@ async fn play(
|
|||||||
}
|
}
|
||||||
blocking(move || {
|
blocking(move || {
|
||||||
let mode = coa_core::realms::state(&root)?.active;
|
let mode = coa_core::realms::state(&root)?.active;
|
||||||
if !coa_core::client::sync_realm(&client, &dir, mode)? {
|
let realm = coa_core::realm_names::for_mode(&root, mode);
|
||||||
|
if !coa_core::client::sync_realm_named(&client, &dir, &realm)? {
|
||||||
return Err(Error::Invalid(
|
return Err(Error::Invalid(
|
||||||
"Close the game client before pressing Play so its selected realm can be updated."
|
"Close the game client before pressing Play so its selected realm can be updated."
|
||||||
.into(),
|
.into(),
|
||||||
@@ -2437,6 +2736,9 @@ async fn play(
|
|||||||
if existing.is_empty() {
|
if existing.is_empty() {
|
||||||
let _ = coa_core::glue_config::prefill_login(&client, "local", "local");
|
let _ = coa_core::glue_config::prefill_login(&client, "local", "local");
|
||||||
}
|
}
|
||||||
|
if window_preferences::clear_cache_on_play(&data_dir()) {
|
||||||
|
let _ = coa_core::client::clear_game_cache(&client);
|
||||||
|
}
|
||||||
coa_core::client::launch(&client)?;
|
coa_core::client::launch(&client)?;
|
||||||
Ok(DriverOutcome {
|
Ok(DriverOutcome {
|
||||||
ok: true,
|
ok: true,
|
||||||
@@ -2903,6 +3205,16 @@ fn set_close_to_tray(enabled: bool) -> std::result::Result<(), UiError> {
|
|||||||
Ok(window_preferences::save(&data_dir(), enabled)?)
|
Ok(window_preferences::save(&data_dir(), enabled)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
fn clear_game_cache_on_play() -> bool {
|
||||||
|
window_preferences::clear_cache_on_play(&data_dir())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
fn set_clear_game_cache_on_play(enabled: bool) -> std::result::Result<(), UiError> {
|
||||||
|
Ok(window_preferences::save_clear_cache_on_play(&data_dir(), enabled)?)
|
||||||
|
}
|
||||||
|
|
||||||
fn show_main_window(app: &AppHandle) {
|
fn show_main_window(app: &AppHandle) {
|
||||||
let handle = app.clone();
|
let handle = app.clone();
|
||||||
if let Err(error) = app.run_on_main_thread(move || {
|
if let Err(error) = app.run_on_main_thread(move || {
|
||||||
@@ -2981,6 +3293,19 @@ pub fn run() {
|
|||||||
realm_select,
|
realm_select,
|
||||||
realm_simultaneous,
|
realm_simultaneous,
|
||||||
realm_with_reborn,
|
realm_with_reborn,
|
||||||
|
realm_names,
|
||||||
|
realm_rename,
|
||||||
|
mysql_custom,
|
||||||
|
mysql_custom_save,
|
||||||
|
restart_schedule,
|
||||||
|
restart_schedule_save,
|
||||||
|
clear_game_cache_on_play,
|
||||||
|
set_clear_game_cache_on_play,
|
||||||
|
custom_race_characters,
|
||||||
|
purge_custom_race_bots,
|
||||||
|
addons_list,
|
||||||
|
addons_install,
|
||||||
|
addons_remove,
|
||||||
check_database,
|
check_database,
|
||||||
repair_server,
|
repair_server,
|
||||||
module_set_enabled,
|
module_set_enabled,
|
||||||
@@ -3006,10 +3331,13 @@ pub fn run() {
|
|||||||
companions_take_offline,
|
companions_take_offline,
|
||||||
companions_delete_all,
|
companions_delete_all,
|
||||||
companions_despawn_some,
|
companions_despawn_some,
|
||||||
|
companions_login_all,
|
||||||
|
companions_spawn_fleet,
|
||||||
open_link,
|
open_link,
|
||||||
report_targets,
|
report_targets,
|
||||||
companion_sizes,
|
companion_sizes,
|
||||||
add_companions,
|
add_companions,
|
||||||
|
get_wildcard_archetypes,
|
||||||
remote_connection,
|
remote_connection,
|
||||||
remote_connect,
|
remote_connect,
|
||||||
client_info,
|
client_info,
|
||||||
|
|||||||
@@ -11,3 +11,15 @@ pub fn close_to_tray(dir: &Path) -> coa_core::Result<bool> {
|
|||||||
pub fn save(dir: &Path, enabled: bool) -> coa_core::Result<()> {
|
pub fn save(dir: &Path, enabled: bool) -> coa_core::Result<()> {
|
||||||
coa_core::fsx::atomic_write_json(&dir.join("close-to-tray.json"), &enabled)
|
coa_core::fsx::atomic_write_json(&dir.join("close-to-tray.json"), &enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Clear the game's cache of server data before every Play (on unless the player turned it off).
|
||||||
|
pub fn clear_cache_on_play(dir: &Path) -> bool {
|
||||||
|
std::fs::read(dir.join("clear-game-cache.json"))
|
||||||
|
.ok()
|
||||||
|
.and_then(|bytes| serde_json::from_slice(&bytes).ok())
|
||||||
|
.unwrap_or(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn save_clear_cache_on_play(dir: &Path, enabled: bool) -> coa_core::Result<()> {
|
||||||
|
coa_core::fsx::atomic_write_json(&dir.join("clear-game-cache.json"), &enabled)
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "CoA Server Manager",
|
"productName": "CoA Server Manager",
|
||||||
"version": "0.9.10",
|
"version": "0.9.14",
|
||||||
"identifier": "com.coa.servermanager",
|
"identifier": "com.coa.servermanager",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "npm run dev",
|
"beforeDevCommand": "npm run dev",
|
||||||
|
|||||||
@@ -40,3 +40,17 @@ These files describe preparation and do not add unpublished releases to canonica
|
|||||||
Manager 0.9.10 refreshes the bundled server history through 0.261104.94 from
|
Manager 0.9.10 refreshes the bundled server history through 0.261104.94 from
|
||||||
canonical build commit `a9c6b17c8c1a295680fda4ad4bcdde266357264d` on 2026-11-08.
|
canonical build commit `a9c6b17c8c1a295680fda4ad4bcdde266357264d` on 2026-11-08.
|
||||||
The reviewed upcoming Manager and server records carry translations in all five languages.
|
The reviewed upcoming Manager and server records carry translations in all five languages.
|
||||||
|
|
||||||
|
Manager 0.9.12 refreshes the bundled server history through 0.261108.95 from
|
||||||
|
canonical build commit `ca04f96f600481446f97ac611c7f914d786af00b` on 2026-11-14.
|
||||||
|
The reviewed upcoming Manager and server records carry translations in all five languages.
|
||||||
|
|
||||||
|
Manager 0.9.13 refreshes the bundled server history through 0.261114.106 from
|
||||||
|
canonical build commit `3308e3a957cd9fd1a2cd145a7f023f2cf521c54c` on 2026-11-15.
|
||||||
|
The reviewed upcoming Manager and server records (Custom Races V2, 213 server notes)
|
||||||
|
carry translations in all five languages.
|
||||||
|
|
||||||
|
Manager 0.9.14 refreshes the bundled server history through 0.261115.110 from
|
||||||
|
canonical build commit `45c013be9ade3001581e5201cacda6cd6bb6b01c` on 2026-11-16.
|
||||||
|
The reviewed upcoming Manager (12 notes) and server (6 notes) records
|
||||||
|
carry translations in all five languages.
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1708,6 +1708,717 @@
|
|||||||
},
|
},
|
||||||
"experimentalFeatures": [],
|
"experimentalFeatures": [],
|
||||||
"compare": "https://github.com/Corfirean/coa-server-build/compare/server-0.261101.92...server-0.261104.94"
|
"compare": "https://github.com/Corfirean/coa-server-build/compare/server-0.261101.92...server-0.261104.94"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "server-0.261108.95",
|
||||||
|
"version": "0.261108.95",
|
||||||
|
"date": "2026-11-08",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-build/releases/tag/server-0.261108.95",
|
||||||
|
"notes": [
|
||||||
|
"Login server startup works when Windows does not list its listening port",
|
||||||
|
"Updated SQUID's Playerbots to 2.9.4 and refreshed Dungeon Clear",
|
||||||
|
"Updated SQUID Playerbots to 2.9.4",
|
||||||
|
"Updated the reviewed CoA upstream snapshot"
|
||||||
|
],
|
||||||
|
"snapshot": "0f331e3289864531d19b2eb185080c18ddd9eaa7be9befa28d6f4b50b5dc2a3f",
|
||||||
|
"components": {
|
||||||
|
"upstream": {
|
||||||
|
"repository": "jealous-sound/azerothcore-wotlk-coa",
|
||||||
|
"ref": "f8955cb9b29042c359a938ff732e4b608dd62ea5",
|
||||||
|
"sha": "f8955cb9b29042c359a938ff732e4b608dd62ea5"
|
||||||
|
},
|
||||||
|
"core": {
|
||||||
|
"repository": "Corfirean/azerothcore-wotlk-coa",
|
||||||
|
"ref": "85ecc2122efd4bc168e750ab35c3e3e8d9c49735",
|
||||||
|
"sha": "85ecc2122efd4bc168e750ab35c3e3e8d9c49735"
|
||||||
|
},
|
||||||
|
"bots": {
|
||||||
|
"repository": "Corfirean/mod-coa-playerbots",
|
||||||
|
"ref": "0588a8e5cdfe54f81fe47bbb40fc9f75d29662e3",
|
||||||
|
"sha": "0588a8e5cdfe54f81fe47bbb40fc9f75d29662e3"
|
||||||
|
},
|
||||||
|
"scaling": {
|
||||||
|
"repository": "Corfirean/mod-coa-content-scaling",
|
||||||
|
"ref": "3c2febf636bd09087bb278e381b975271a70fdf6",
|
||||||
|
"sha": "3c2febf636bd09087bb278e381b975271a70fdf6"
|
||||||
|
},
|
||||||
|
"manager": {
|
||||||
|
"repository": "Corfirean/coa-server-manager",
|
||||||
|
"ref": "711f378ae82f75d3fc64368c042889c773315c54",
|
||||||
|
"sha": "711f378ae82f75d3fc64368c042889c773315c54"
|
||||||
|
},
|
||||||
|
"races": {
|
||||||
|
"repository": "ilusixn/azerothcore-wotlk-coa",
|
||||||
|
"ref": "coa-custom-1.9.2",
|
||||||
|
"sha": "31bd63d309b8b0fb4f1a4d9b793a343b8ac36f1e",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-1.9.2-Client-1.zip",
|
||||||
|
"size": 1513021586,
|
||||||
|
"digest": "sha256:a9dd51ed2d90fb048d549602f40f5429d56e2df0df5606a38781b358fa369568",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-1.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-1.9.2-Client-2.zip",
|
||||||
|
"size": 1198283005,
|
||||||
|
"digest": "sha256:ab084a55509ccbcc2977a06dd0c01fa879973a1892baaacaeb3ff52f3dfc750e",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-2.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-1.9.2-Client-3.zip",
|
||||||
|
"size": 1678829573,
|
||||||
|
"digest": "sha256:907e267f0ee7038807e626c3c1eca5e12db6c88b747137a23c5fb52eaa1a358e",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-3.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-1.9.2-Client-4.zip",
|
||||||
|
"size": 502385128,
|
||||||
|
"digest": "sha256:e0bd87172af989fa50a8e2b08ba4321c72b6265047482f051a1db3b80d55bcaa",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-4.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-1.9.2-Client-5.zip",
|
||||||
|
"size": 168079711,
|
||||||
|
"digest": "sha256:73364ad1b58c6342641a848a3b20a835472834f600416606be1470386774ca78",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-5.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-1.9.2-Server.zip",
|
||||||
|
"size": 53004560,
|
||||||
|
"digest": "sha256:b893813573a4d3f6a0003c1f174582d3def997f37b402cbca44d53055d2fc1d2",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Server.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "INSTALL-GUIDE.txt",
|
||||||
|
"size": 3006,
|
||||||
|
"digest": "sha256:f17e97fafa3225901d1caf8c3b8141293f98fbfb8c9243c0c4717278c60146aa",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/INSTALL-GUIDE.txt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PATCH-NOTES-1.9.2.txt",
|
||||||
|
"size": 2822,
|
||||||
|
"digest": "sha256:f2fd4693ba181959a572d3fb10a0050e9ff6c4f735b3ab0019c7d16712db28cb",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/PATCH-NOTES-1.9.2.txt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"squid": {
|
||||||
|
"repository": "Zyth45/mod-playerbots",
|
||||||
|
"ref": "v2.9.4",
|
||||||
|
"sha": "75d1784f66f3c731340a96f72bfbd301974b6ab4",
|
||||||
|
"patch": "patches/squid-coa-validation.patch",
|
||||||
|
"patchSha256": "244cd2d8b04b3158665e44f40ebb6d4088a867a052ff5c3a9553d604652fe2d1"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"repository": "Corfirean/coa-server-build",
|
||||||
|
"ref": "2e9fee5b953455e39d8acb70cf9bb32ee09e9288",
|
||||||
|
"sha": "2e9fee5b953455e39d8acb70cf9bb32ee09e9288"
|
||||||
|
},
|
||||||
|
"dungeon-clear": {
|
||||||
|
"repository": "Zyth45/mod-dungeon-clear",
|
||||||
|
"sha": "081a04f4208056dbb90717a5d10fe1e593943d5b",
|
||||||
|
"patch": "patches/dungeon-clear-coa-validation.patch",
|
||||||
|
"patchSha256": "4078f8284ef011142c970cb8e812055e370ba858502de82f86a831d16fe1ec66",
|
||||||
|
"ref": "081a04f4208056dbb90717a5d10fe1e593943d5b"
|
||||||
|
},
|
||||||
|
"navigation": {
|
||||||
|
"repository": "Corfirean/azerothcore-wotlk-coa",
|
||||||
|
"ref": "8b44099f480af0b69c6dfc697e4d388e865e9ffc",
|
||||||
|
"sha": "8b44099f480af0b69c6dfc697e4d388e865e9ffc",
|
||||||
|
"sourceRelease": "navigation-20261012",
|
||||||
|
"manifestSha256": "7f28600735f115792e79a5e8d1c8d78a83a8f5ed14a090c6d87268e49c2bb683",
|
||||||
|
"archiveSha256": "aa1347a095f85af44b4f592270a0e9314954801fda4578f0147f847e32c24a60",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"name": "navigation.zip.001",
|
||||||
|
"size": 1500000000,
|
||||||
|
"sha256": "e3a93903fc8155ee0d92db399ec426769c360bef87c44c07beb7e21cfd892c18",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-build/releases/download/navigation-20261012/navigation.zip.001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "navigation.zip.002",
|
||||||
|
"size": 1377006470,
|
||||||
|
"sha256": "c1af26ba7f83676278613076c357c4da0a11cfa6ae1ff00003479057c4864471",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-build/releases/download/navigation-20261012/navigation.zip.002"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"experimentalFeatures": [],
|
||||||
|
"compare": "https://github.com/Corfirean/coa-server-build/compare/server-0.261104.94...server-0.261108.95"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "server-0.261114.106",
|
||||||
|
"version": "0.261114.106",
|
||||||
|
"date": "2026-11-14",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-build/releases/tag/server-0.261114.106",
|
||||||
|
"notes": [
|
||||||
|
"Optional extra strength for bots in dungeons and raids",
|
||||||
|
"Bot performance metrics and optional scheduling controls are available for testing",
|
||||||
|
"Database startup can recover when Windows omits its listening port",
|
||||||
|
"Updated Dungeon Clear to 3.0.0 to match SQUID Playerbots 3.0",
|
||||||
|
"Automatic world restarts wait for the previous supervisor to finish",
|
||||||
|
"The server's own Auction House Bot stays in charge when SQUID Playerbots 3.0 is installed",
|
||||||
|
"Updated SQUID Playerbots to 3.0",
|
||||||
|
"Updated the reviewed CoA upstream snapshot"
|
||||||
|
],
|
||||||
|
"snapshot": "5ecaa04281576af58df11d5d39151cbebb4f2dfb10fffb84098d2809709cb68f",
|
||||||
|
"components": {
|
||||||
|
"upstream": {
|
||||||
|
"repository": "jealous-sound/azerothcore-wotlk-coa",
|
||||||
|
"ref": "96afaf0f51cc4b37f1eba282bffb1c5aab353de6",
|
||||||
|
"sha": "96afaf0f51cc4b37f1eba282bffb1c5aab353de6"
|
||||||
|
},
|
||||||
|
"core": {
|
||||||
|
"repository": "Corfirean/azerothcore-wotlk-coa",
|
||||||
|
"ref": "8850b229fe2653a954a2e753c5a9b293bf4e500b",
|
||||||
|
"sha": "8850b229fe2653a954a2e753c5a9b293bf4e500b"
|
||||||
|
},
|
||||||
|
"bots": {
|
||||||
|
"repository": "Corfirean/mod-coa-playerbots",
|
||||||
|
"ref": "30a5a555f56fda8f4ccad14be8438bd0532d85b9",
|
||||||
|
"sha": "30a5a555f56fda8f4ccad14be8438bd0532d85b9"
|
||||||
|
},
|
||||||
|
"scaling": {
|
||||||
|
"repository": "Corfirean/mod-coa-content-scaling",
|
||||||
|
"ref": "3c2febf636bd09087bb278e381b975271a70fdf6",
|
||||||
|
"sha": "3c2febf636bd09087bb278e381b975271a70fdf6"
|
||||||
|
},
|
||||||
|
"manager": {
|
||||||
|
"repository": "Corfirean/coa-server-manager",
|
||||||
|
"ref": "d71c5635e3262a775b400a1c90ac81d7bddcbeaf",
|
||||||
|
"sha": "d71c5635e3262a775b400a1c90ac81d7bddcbeaf"
|
||||||
|
},
|
||||||
|
"races": {
|
||||||
|
"repository": "ilusixn/azerothcore-wotlk-coa",
|
||||||
|
"ref": "coa-custom-1.9.2",
|
||||||
|
"sha": "31bd63d309b8b0fb4f1a4d9b793a343b8ac36f1e",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-1.9.2-Client-1.zip",
|
||||||
|
"size": 1513021586,
|
||||||
|
"digest": "sha256:a9dd51ed2d90fb048d549602f40f5429d56e2df0df5606a38781b358fa369568",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-1.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-1.9.2-Client-2.zip",
|
||||||
|
"size": 1198283005,
|
||||||
|
"digest": "sha256:ab084a55509ccbcc2977a06dd0c01fa879973a1892baaacaeb3ff52f3dfc750e",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-2.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-1.9.2-Client-3.zip",
|
||||||
|
"size": 1678829573,
|
||||||
|
"digest": "sha256:907e267f0ee7038807e626c3c1eca5e12db6c88b747137a23c5fb52eaa1a358e",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-3.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-1.9.2-Client-4.zip",
|
||||||
|
"size": 502385128,
|
||||||
|
"digest": "sha256:e0bd87172af989fa50a8e2b08ba4321c72b6265047482f051a1db3b80d55bcaa",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-4.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-1.9.2-Client-5.zip",
|
||||||
|
"size": 168079711,
|
||||||
|
"digest": "sha256:73364ad1b58c6342641a848a3b20a835472834f600416606be1470386774ca78",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Client-5.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-1.9.2-Server.zip",
|
||||||
|
"size": 53004560,
|
||||||
|
"digest": "sha256:b893813573a4d3f6a0003c1f174582d3def997f37b402cbca44d53055d2fc1d2",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/CoA-Custom-1.9.2-Server.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "INSTALL-GUIDE.txt",
|
||||||
|
"size": 3006,
|
||||||
|
"digest": "sha256:f17e97fafa3225901d1caf8c3b8141293f98fbfb8c9243c0c4717278c60146aa",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/INSTALL-GUIDE.txt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PATCH-NOTES-1.9.2.txt",
|
||||||
|
"size": 2822,
|
||||||
|
"digest": "sha256:f2fd4693ba181959a572d3fb10a0050e9ff6c4f735b3ab0019c7d16712db28cb",
|
||||||
|
"url": "https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.9.2/PATCH-NOTES-1.9.2.txt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"squid": {
|
||||||
|
"repository": "Zyth45/mod-playerbots",
|
||||||
|
"ref": "v3.0",
|
||||||
|
"sha": "4ef5ed9ebe75a330de7df19639a042391e037e15",
|
||||||
|
"patch": "patches/squid-coa-validation.patch",
|
||||||
|
"patchSha256": "2cc45bc6555d5bb3e91728840f9de6e73c002c73b270a37732a1499956241c5f"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"repository": "Corfirean/coa-server-build",
|
||||||
|
"ref": "be0c1eef3aa4b20c4203dbf54ac66b63d4e6df05",
|
||||||
|
"sha": "be0c1eef3aa4b20c4203dbf54ac66b63d4e6df05"
|
||||||
|
},
|
||||||
|
"dungeon-clear": {
|
||||||
|
"repository": "Zyth45/mod-dungeon-clear",
|
||||||
|
"sha": "6efb59eae96bcc0730fc083314dd28d55970bbf4",
|
||||||
|
"patch": "patches/dungeon-clear-coa-validation.patch",
|
||||||
|
"patchSha256": "2845d389422e3a59e5c186ecf54b03f64f1dcc22cdef15729b60c354ae72cd6f",
|
||||||
|
"ref": "6efb59eae96bcc0730fc083314dd28d55970bbf4"
|
||||||
|
},
|
||||||
|
"navigation": {
|
||||||
|
"repository": "Corfirean/azerothcore-wotlk-coa",
|
||||||
|
"ref": "8b44099f480af0b69c6dfc697e4d388e865e9ffc",
|
||||||
|
"sha": "8b44099f480af0b69c6dfc697e4d388e865e9ffc",
|
||||||
|
"sourceRelease": "navigation-20261012",
|
||||||
|
"manifestSha256": "7f28600735f115792e79a5e8d1c8d78a83a8f5ed14a090c6d87268e49c2bb683",
|
||||||
|
"archiveSha256": "aa1347a095f85af44b4f592270a0e9314954801fda4578f0147f847e32c24a60",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"name": "navigation.zip.001",
|
||||||
|
"size": 1500000000,
|
||||||
|
"sha256": "e3a93903fc8155ee0d92db399ec426769c360bef87c44c07beb7e21cfd892c18",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-build/releases/download/navigation-20261012/navigation.zip.001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "navigation.zip.002",
|
||||||
|
"size": 1377006470,
|
||||||
|
"sha256": "c1af26ba7f83676278613076c357c4da0a11cfa6ae1ff00003479057c4864471",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-build/releases/download/navigation-20261012/navigation.zip.002"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"experimentalFeatures": [],
|
||||||
|
"compare": "https://github.com/Corfirean/coa-server-build/compare/server-0.261108.95...server-0.261114.106"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "server-0.261115.110",
|
||||||
|
"version": "0.261115.110",
|
||||||
|
"date": "2026-11-15",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-build/releases/tag/server-0.261115.110",
|
||||||
|
"notes": [
|
||||||
|
"Test build of the subclass module for two-headed Ogres",
|
||||||
|
"Thin Twins can earn a subclass through their own quest, the Bravery Badge",
|
||||||
|
"A two-headed Ogre's ranged subclass can shoot at point-blank range",
|
||||||
|
"Ogres have a new racial, Tolerance",
|
||||||
|
"Standard-class Ogres and Thin Humans start with only their own class kit",
|
||||||
|
"Helmets sit on the Thin Human's head instead of his chest",
|
||||||
|
"LiveMon shows live damage, healing, crowd control and subclass combo statistics",
|
||||||
|
"Standard-class Ogres and Thin Twins can take a CoA class as their subclass",
|
||||||
|
"Thin Human and Two-Headed Ogre are now their own playable races",
|
||||||
|
"Subclassed relic users can hold a relic beside a ranged weapon",
|
||||||
|
"Server options to limit subclassing or turn the two subclass races off",
|
||||||
|
"A standard subclass brings its whole basic kit, skills and weapons",
|
||||||
|
"Two-Headed Ogres and Thin Humans with a standard class can now pick a subclass",
|
||||||
|
"Thin Humans find more gold with the Hand-Me-Downs racial",
|
||||||
|
"Two-Headed Ogres wear helmets on both heads",
|
||||||
|
"Flying mounts no longer fly in Kalimdor and the Eastern Kingdoms",
|
||||||
|
"LiveMon's character tab can be closed and goes away for deleted characters",
|
||||||
|
"Classic classes can be limited to their Wrath of the Lich King abilities",
|
||||||
|
"Dual Wield shows once in the spellbook",
|
||||||
|
"Two-Headed Ogres get Subclass Bar 1 for the other head's spells",
|
||||||
|
"Subclass forms leave Two-Headed Ogres in their own body and turn the twin brother instead",
|
||||||
|
"CoA subclass trees show their specialization painting in the subclass tab",
|
||||||
|
"Characters with a subclass no longer get Dual Specialization",
|
||||||
|
"You can hold only one subclass book and one insight at a time",
|
||||||
|
"Thin Humans and Two-Headed Ogres get the quests of their starting zone",
|
||||||
|
"The Bravery Badge and the Book of Origins look and read like a badge and a book",
|
||||||
|
"Ghost Wolf and Travel Form turn the whole ogre, and the twin brother rides the beast",
|
||||||
|
"Standard-class mains can spend points in their subclass trees and reset main talents",
|
||||||
|
"Your subclass's trainer can reset only your subclass talents",
|
||||||
|
"The Thin Human's cape lies along his back instead of sticking out like a board",
|
||||||
|
"The twin brother finishes pointing before hopping off and readies his weapon with you",
|
||||||
|
"The twin brother fights with his melee weapon up close and sits close behind you on mounts",
|
||||||
|
"The twin brother copies your pose on hover discs, carpets and other unusual mounts",
|
||||||
|
"Two-Headed Ogres sit in cars and keep their mace drawn after a shot",
|
||||||
|
"Two-Headed Ogres fight with a weapon in one hand and a gun in the other",
|
||||||
|
"The Ogre's Agree or Disagree racial now shows what it will do next",
|
||||||
|
"The Thin Twins' brother turns into a worgen in every subclass Cursed Form",
|
||||||
|
"Leaps and charges ordered for the Thin Twins' brother move him instead of you",
|
||||||
|
"CoA classes taken as a subclass get their class mechanics",
|
||||||
|
"Thin Twins and Two-Headed Ogres keep their weapons in a subclass Cursed Form",
|
||||||
|
"Hovering a Guardian standard no longer causes a Lua error",
|
||||||
|
"LiveMon shows specialization names instead of their signature spells",
|
||||||
|
"Ogre eyes are picked by colour, with a Blind checkbox for each eye",
|
||||||
|
"Two-headed ogres no longer keep casting after a subclass spell with a cast time",
|
||||||
|
"Two-headed ogres cast every subclass spell with the left arm",
|
||||||
|
"The other half only shoots when you attack a target out of melee reach",
|
||||||
|
"The other head raises her hand while casting and your presses come first",
|
||||||
|
"Saving talent changes no longer fails for characters with a subclass",
|
||||||
|
"The second-way quest no longer pops up at level 20",
|
||||||
|
"Every race can create the standard classes the creation screen offers again",
|
||||||
|
"Subclass Bar 1 shows cooldowns, charges and casts like a normal action bar",
|
||||||
|
"Subclass Bar 1 refills itself when you change subclass",
|
||||||
|
"Subclass Bar 1 appears as soon as you choose a subclass",
|
||||||
|
"Subclass Bar 1 works like an action bar and can live in Bartender4",
|
||||||
|
"A subclass can never be the character's own class",
|
||||||
|
"New characters no longer inherit the subclass of a deleted character",
|
||||||
|
"Sun Cleric, Barbarian, Bloodmage and Cultist subclass resources use the game's own orbs",
|
||||||
|
"Shapeshifting no longer takes away the twin brother or the subclass",
|
||||||
|
"A subclass specialization now teaches the ability its passive promises",
|
||||||
|
"Subclass stances and forms appear only on the subclass stance bar",
|
||||||
|
"Subclass vows, auras and formations move to the subclass stance bar",
|
||||||
|
"The Thin Human's cape rests on his shoulders and moves with them",
|
||||||
|
"The twin brother gets a real spot in cars and rides along in passenger seats",
|
||||||
|
"The twin brother puts his weapons away while he wears a subclass shape",
|
||||||
|
"The Thin Twins' brother now shows the flash and glow of subclass forms",
|
||||||
|
"The twin brother sneaks along in stealth instead of staying behind",
|
||||||
|
"The stance button takes a Thin Twin out of a form his brother wears again",
|
||||||
|
"The Two-Head and Two-Thins tabs show one wide background and the right class icon",
|
||||||
|
"The Two-Head and Two-Thins trees use the game's own talent nodes",
|
||||||
|
"Agree or Disagree takes one spellbook slot that changes name and icon",
|
||||||
|
"Subclass talent trees no longer let you spend more points than you have",
|
||||||
|
"Your brother stays at your side when you melee with a bow equipped",
|
||||||
|
"A melee brother stays on your target and keeps fighting",
|
||||||
|
"The Two-Headed Ogre twists her body less while her other head casts",
|
||||||
|
"Thin Twins and Two-Headed Ogres are Hero Races that need a level 60 character",
|
||||||
|
"The Two-Headed Ogre's portrait shows both heads instead of her body",
|
||||||
|
"Your other half's spells break your stealth, and Running Wild ends when you stealth",
|
||||||
|
"Spells your other half casts now trigger the class's talents and resources",
|
||||||
|
"Your other half takes the subclass's Cat, Bear and stance forms on their own",
|
||||||
|
"Your other head or brother can no longer finish a cast while you run",
|
||||||
|
"The other head's hand glows while she casts",
|
||||||
|
"With Play Easy on, your other half uses abilities that cost health",
|
||||||
|
"New racial passives explain the shared and split resource pools",
|
||||||
|
"The dressing room works for races without their own background, no extra addon needed",
|
||||||
|
"Your brother climbs onto your Travel Form or wolf even after a fight",
|
||||||
|
"When your brother uses Running Wild, you ride on his back",
|
||||||
|
"In Running Wild you ride on your brother's shoulders",
|
||||||
|
"Your weapons no longer go missing after a Running Wild ride",
|
||||||
|
"When both halves use the same resource, their pool is twice as big",
|
||||||
|
"The subclass window shows every CoA class's own background at full strength",
|
||||||
|
"You can rearrange Subclass Bar 1 during combat without an error",
|
||||||
|
"Your other head or brother has a cast bar of their own",
|
||||||
|
"Choice talents in the subclass window show as one node with two options",
|
||||||
|
"SpellActivationOverlay can light up Subclass Bar 1",
|
||||||
|
"Your subclass's resource now shows as an extra bar under your portrait",
|
||||||
|
"Your other half's resource bar keeps its value when you log out and back in",
|
||||||
|
"Rage, energy and runic power subclasses now get and use their resource",
|
||||||
|
"Subclass resource orbs only appear when your subclass specialization can fill them",
|
||||||
|
"Your subclass specialization comes with its first class talent learned",
|
||||||
|
"Your main class's key stat now also powers your subclass",
|
||||||
|
"Subclass talents follow the paths and point requirements of their tree",
|
||||||
|
"Your summons follow your brother while he walks beside you",
|
||||||
|
"Your brother rides on the back of your Travel Form cat and moves with it",
|
||||||
|
"Dressing your twin in the wardrobe no longer causes an addon error",
|
||||||
|
"Your brother rides on your back in Wargstride",
|
||||||
|
"A Bloodmage subclass's Cursed Form no longer replaces your own action bar",
|
||||||
|
"Pressing an active subclass stance or form again turns it off",
|
||||||
|
"Character select shows your subclass under your class",
|
||||||
|
"The Two-Headed Ogre's second head no longer pokes through hats",
|
||||||
|
"Two-Headed Ogres keep aiming between shots instead of idling",
|
||||||
|
"Two-Headed Ogres who shoot rest their gun on the shoulder when not firing",
|
||||||
|
"Two-Headed Ogres who shoot themselves aim and fire their gun with the right hand",
|
||||||
|
"Two-Headed Ogres who shoot fire their bullets from the gun hand",
|
||||||
|
"The wardrobe shows a Two-Headed Ogre's applied look and her saved outfits apply again",
|
||||||
|
"The second head's quest mark floats over her head in cities and inns",
|
||||||
|
"Subclass Bar 1 no longer fills up with Throw, Shoot, Wand and Auto Attack",
|
||||||
|
"Abilities you learn from your subclass no longer land on your own action bars",
|
||||||
|
"A caster Two-Headed Ogre keeps her staff in hand while her second head shoots",
|
||||||
|
"A Two-Headed Ogre's staff keeps its size when she puts it on her back",
|
||||||
|
"A shooting subclass starts Auto Shot on right-click without logging out first",
|
||||||
|
"A Hunter subclass keeps Auto Shot going while the main head casts or moves",
|
||||||
|
"Weapons and armor from a subclass stay usable after logging in again",
|
||||||
|
"Two-Headed Ogres are Horde again and Thin Twins share Forgotten race rules",
|
||||||
|
"Thin Humans and Two-Headed Ogres can no longer be created as Hero",
|
||||||
|
"The Two-Headed Ogre stays in her combat stance between attacks",
|
||||||
|
"The second-head tab only shows for Two-Headed Ogres and Thin Twins",
|
||||||
|
"Thin Twins capes no longer show their inside at the shoulders",
|
||||||
|
"Thin Twins keep short hair under hats",
|
||||||
|
"Thin Twins keep their face, cape and hat fit with CoA Custom 1.9.2",
|
||||||
|
"Thin Twins show their class gear in character creation",
|
||||||
|
"Two-Headed Ogre capes drape over her back",
|
||||||
|
"CoA Custom 1.9.5 races work on the subclass server",
|
||||||
|
"With Play easy, cowboy the brother leaves a spent timed form",
|
||||||
|
"The Two-Headed Ogre casts with a raised fist before her face",
|
||||||
|
"The second-head client patch is now patch-ZZZZT.MPQ",
|
||||||
|
"Dual Wield shows once in the spellbook, whichever class teaches it",
|
||||||
|
"The subclass addon keeps working when the Twins or Ogre are renamed",
|
||||||
|
"The subclass name shows only on the character tab",
|
||||||
|
"The Thin Twins' Accursed brother keeps his distance until he takes his cursed form",
|
||||||
|
"The Thin Twins' brother follows a form's cost, cooldown and duration",
|
||||||
|
"The Thin Twins' own mana bar no longer flickers",
|
||||||
|
"Witch Hunter Vault now springs over in a handspring instead of a jump",
|
||||||
|
"The Twins brother keeps his timed form and no longer takes forms a spell forbids",
|
||||||
|
"The Twins brother faces his target, leaps in and leaves a form to heal you",
|
||||||
|
"With Play easy, cowboy, the brother uses his timed forms in a fight",
|
||||||
|
"Original races no longer look broken in the 64-bit client's character creation",
|
||||||
|
"Subclasses get their specialization's free passives, like the Pyromancer's draconic form",
|
||||||
|
"The subclass cast bar no longer gets stuck and can always be Alt-dragged",
|
||||||
|
"Pick-one talents in the subclass window no longer overlap their neighbours",
|
||||||
|
"Subclass spells get their rank upgrades, resources and class mechanics",
|
||||||
|
"Subclass talents that replace a spell now replace it for the subclass too",
|
||||||
|
"The Thin Twins keep their own hairstyle under hats",
|
||||||
|
"The Twins brother takes the look of the cursed form he actually uses",
|
||||||
|
"The Twins brother stands beside you at character select in his own clothes",
|
||||||
|
"The Twins brother climbs down from your back before taking a form",
|
||||||
|
"Spells the Twins brother casts no longer play a cast animation on you",
|
||||||
|
"The Thin Twins brother is now your mirror image",
|
||||||
|
"The Thin Twins brother can have his own face, hair style and beard",
|
||||||
|
"A script builds the original races' Vault patches from your own client files",
|
||||||
|
"The subclass client patch is now built after the release's own patches",
|
||||||
|
"The mirrored Thin Twins brother is built from the current Thin Twins model",
|
||||||
|
"Pressing your subclass mount again dismounts you",
|
||||||
|
"Removing a subclass dismisses the pet it let you summon",
|
||||||
|
"Removing a Warlock or Paladin subclass no longer unlearns your mounts",
|
||||||
|
"Removing a subclass no longer leaves its spells in your spellbook",
|
||||||
|
"A Starcaller subclass shows Lunar Phase as CoA's moon",
|
||||||
|
"Your twin's or other head's pet gets its own movable pet bar",
|
||||||
|
"A Ranged Head stands still while the Melee Head is offline",
|
||||||
|
"A bot plays the missing head of a Two-Players ogre",
|
||||||
|
"A Ranged Head keeps an echo of its deleted Melee Head's gear",
|
||||||
|
"Two-Players ogres hold books, pouches and orbs forward in the off hand",
|
||||||
|
"Two-Players ogres can pair up as Melee Head and Ranged Head",
|
||||||
|
"Paired Two-Players heads share one body",
|
||||||
|
"SquidBots Lite no longer prints \"Command 'dc status' does not exist\" at login",
|
||||||
|
"The subclass action bar no longer causes a blocked-action error in combat",
|
||||||
|
"Two-Players heads split their abilities into melee for the body and ranged for the rider",
|
||||||
|
"Two-Players heads gain Agree or Disagree stacks when they fight together",
|
||||||
|
"Two-Players heads can only be CoA classes",
|
||||||
|
"The Ranged Head's gear slots are frozen in ice and can no longer be dragged",
|
||||||
|
"Two-Players heads find the abilities they borrow on their own bar",
|
||||||
|
"Two-Players ogres can Bonk Heads! together once the heads have agreed long enough",
|
||||||
|
"Abilities lent between Two-Players heads follow each head's respecs and new spells",
|
||||||
|
"Two-Players ogres can use Mutate Me! to take the eyes-everywhere look and back",
|
||||||
|
"A Two-Players ogre fills one party spot and enters dungeons as one player",
|
||||||
|
"A Two-Players ogre joins a party only when there is room for both heads",
|
||||||
|
"A Ranged Head's own frame now stands for the shared Two-Players body",
|
||||||
|
"The Two-Players Ranged Head shares the body's health and both heads get full kill XP",
|
||||||
|
"The Two-Players Ranged Head shares the body's gear",
|
||||||
|
"Two-Players heads split quest gold, share one resource pool and keep their head's specs",
|
||||||
|
"Mobs attacked by the Two-Players Ranged Head now fight the body",
|
||||||
|
"Two-Players Twins: the second brother rides piggyback on the first, visible as himself",
|
||||||
|
"Bot plans panel shows what your group's bots are doing and lets you pick their next quest",
|
||||||
|
"Questing bots do all their quests in one area before moving on",
|
||||||
|
"The Twins' second brother keeps and wears his own gear on his brother's back",
|
||||||
|
"A Two-Players twin can call his brother to his side until another player joins him",
|
||||||
|
"Agree now raises spell and ranged hit too, not only melee hit",
|
||||||
|
"Two-Players ogres drop their mount when either head attacks",
|
||||||
|
"The other head's abilities now go on your own action bars",
|
||||||
|
"A bot body keeps questing, looting and resting after a fight instead of standing still",
|
||||||
|
"A bot body's SquidBots menu now opens from a button on your own player frame",
|
||||||
|
"Character select shows a Two-Players head's joined name and its partner's class",
|
||||||
|
"The Ranged Head now goes into and out of Dungeon Finder dungeons with the body",
|
||||||
|
"Two-Players can be switched off with Subclass.TwoPlayers.Enable",
|
||||||
|
"The other head's abilities only cost you resources when they actually go off",
|
||||||
|
"Character select shows a Two-Players ogre in his Mutate Me look",
|
||||||
|
"The Ranged Head gets the enchant, gem and suffix stats of the shared gear",
|
||||||
|
"The Ranged Head of a Two-Headed Ogre no longer pops out of the body at logout",
|
||||||
|
"A Ranged Head and its bot body are in one party again, so party chat and bot orders work",
|
||||||
|
"A bot riding as the Ranged Head no longer rests, roams or makes the body sit down",
|
||||||
|
"The character sheet of a Two-Players head shows the other head's class",
|
||||||
|
"Two-Players Ogres can fit a carried mount in a window and share the fit",
|
||||||
|
"Custom Races V2 with 17 new races, subclasses and the Fading Island",
|
||||||
|
"Updated Custom Races to 2.0"
|
||||||
|
],
|
||||||
|
"snapshot": "d3d10476d144d2a701a5a122f1f249ff8219f7a6324e007cb3e153d4628973f7",
|
||||||
|
"components": {
|
||||||
|
"upstream": {
|
||||||
|
"repository": "jealous-sound/azerothcore-wotlk-coa",
|
||||||
|
"ref": "96afaf0f51cc4b37f1eba282bffb1c5aab353de6",
|
||||||
|
"sha": "96afaf0f51cc4b37f1eba282bffb1c5aab353de6"
|
||||||
|
},
|
||||||
|
"core": {
|
||||||
|
"repository": "Corfirean/azerothcore-wotlk-coa",
|
||||||
|
"ref": "9740ced5c41806115d851ab37ab34f28e1e8b712",
|
||||||
|
"sha": "9740ced5c41806115d851ab37ab34f28e1e8b712"
|
||||||
|
},
|
||||||
|
"bots": {
|
||||||
|
"repository": "Corfirean/mod-coa-playerbots",
|
||||||
|
"ref": "30a5a555f56fda8f4ccad14be8438bd0532d85b9",
|
||||||
|
"sha": "30a5a555f56fda8f4ccad14be8438bd0532d85b9"
|
||||||
|
},
|
||||||
|
"scaling": {
|
||||||
|
"repository": "Corfirean/mod-coa-content-scaling",
|
||||||
|
"ref": "3c2febf636bd09087bb278e381b975271a70fdf6",
|
||||||
|
"sha": "3c2febf636bd09087bb278e381b975271a70fdf6"
|
||||||
|
},
|
||||||
|
"manager": {
|
||||||
|
"repository": "Corfirean/coa-server-manager",
|
||||||
|
"ref": "d3527312803fb5a3e1cd48e01496645a8bbc9dcf",
|
||||||
|
"sha": "d3527312803fb5a3e1cd48e01496645a8bbc9dcf"
|
||||||
|
},
|
||||||
|
"races": {
|
||||||
|
"repository": "ilusixn/CustomRacesCoa",
|
||||||
|
"ref": "coa-custom-2.0",
|
||||||
|
"sha": "dae0c661f7197bafd0a42d80866fa8709b3792c9",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-Races-V2-Credits.csv",
|
||||||
|
"size": 5487,
|
||||||
|
"digest": "sha256:9afb0b777498d14601476bed7ce82a449ce2b80af5dae107f7309081c1936882",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-Races-V2-Credits.csv"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-Races-V2-Credits.xlsx",
|
||||||
|
"size": 10129,
|
||||||
|
"digest": "sha256:d24b51f42870e9ab370279e37ea1cd894b7a208cb8960548c0f465222d50c850",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-Races-V2-Credits.xlsx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-V2-Client-1.zip",
|
||||||
|
"size": 1513021586,
|
||||||
|
"digest": "sha256:a9dd51ed2d90fb048d549602f40f5429d56e2df0df5606a38781b358fa369568",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-1.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-V2-Client-2.zip",
|
||||||
|
"size": 1198283005,
|
||||||
|
"digest": "sha256:ab084a55509ccbcc2977a06dd0c01fa879973a1892baaacaeb3ff52f3dfc750e",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-2.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-V2-Client-3.zip",
|
||||||
|
"size": 1671130705,
|
||||||
|
"digest": "sha256:0af34199f0739ce086adb0371d3de7c1a0f5ca9c62ecde6b0efe9286e33874a8",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-3.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-V2-Client-4.zip",
|
||||||
|
"size": 502385128,
|
||||||
|
"digest": "sha256:e0bd87172af989fa50a8e2b08ba4321c72b6265047482f051a1db3b80d55bcaa",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-4.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-V2-Client-5.zip",
|
||||||
|
"size": 168079711,
|
||||||
|
"digest": "sha256:73364ad1b58c6342641a848a3b20a835472834f600416606be1470386774ca78",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-5.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-V2-Client-6.zip",
|
||||||
|
"size": 1881526537,
|
||||||
|
"digest": "sha256:91db79b7b451856fa9e45daea52e0fe1c04676653dd8a88e6627f04ee7b47759",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-6.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-V2-Client-7.zip",
|
||||||
|
"size": 734725114,
|
||||||
|
"digest": "sha256:4c5532d775d206a3b913a6111040bb96b95c683b74c08a6131ed9f38db8e2b39",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-7.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-V2-Client-8.zip",
|
||||||
|
"size": 734216670,
|
||||||
|
"digest": "sha256:bdaa1d047e8767bd5715f1e8465d116220597d9c135a43e2dda02e12ce2e5526",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-8.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-V2-Client-9.zip",
|
||||||
|
"size": 195235400,
|
||||||
|
"digest": "sha256:0764893543084a12d15578fe734f66ba4519740794a6b3b3a38a08594c38c640",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-9.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CoA-Custom-V2-Server.zip",
|
||||||
|
"size": 63983587,
|
||||||
|
"digest": "sha256:8970d61eea40f53cea4c27481edd85d2b2647cd32eb88932e0077da3b4a77d23",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Server.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "creation-screen.png",
|
||||||
|
"size": 2139517,
|
||||||
|
"digest": "sha256:84c3144f34ef8015e8612e412da03383241124d58e36c703eeb2a525096a5795",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/creation-screen.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "INSTALL-GUIDE.txt",
|
||||||
|
"size": 2504,
|
||||||
|
"digest": "sha256:da402117a90a60a029fdce9a94125ddd28b386a73f37c180992befca57e9f13a",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/INSTALL-GUIDE.txt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PATCH-NOTES-V2.txt",
|
||||||
|
"size": 4388,
|
||||||
|
"digest": "sha256:82901d54b1f13cd8b2e7a73a7c2fdc3e237f8090c332729bc553818834fe27d0",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/PATCH-NOTES-V2.txt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "RACES.md",
|
||||||
|
"size": 8629,
|
||||||
|
"digest": "sha256:1e7a9aaee354b07924a8cdda5e4dbffe4cad88f215d68efb74d8d0832403422d",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/RACES.md"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "SHA256SUMS.txt",
|
||||||
|
"size": 938,
|
||||||
|
"digest": "sha256:a68591f04d661b558523133f99411fd4a7e32f1b45f79f977bb0989246f11179",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/SHA256SUMS.txt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "showcase.mp4",
|
||||||
|
"size": 81658913,
|
||||||
|
"digest": "sha256:a3d4b4f561bb12dcc91da562c5ee79157143f4b67997479edb2152b27b925a2a",
|
||||||
|
"url": "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/showcase.mp4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"server": [
|
||||||
|
{
|
||||||
|
"repository": "stefanw1337/azerothcore-wotlk-coa",
|
||||||
|
"branch": "stefanw1337-subclassing-test",
|
||||||
|
"sha": "ccea52d17a27482784e705e9cc913b68dedd9f85"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"provenance": [
|
||||||
|
{
|
||||||
|
"repository": "ilusixn/Fading-Islands-Restore",
|
||||||
|
"sha": "e150de1cb496314af752e98021e57ca93d5d799d",
|
||||||
|
"used": "server/core-patches"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"repository": "ilusixn/Custom-Race-3.3.5a",
|
||||||
|
"sha": "ac907655bd43dec2eff1b4ff509f7fb574325c58",
|
||||||
|
"used": "server/core racials"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"repository": "ilusixn/ilusixn-dev-menu",
|
||||||
|
"sha": "ea50a8533a3402c69c8773677db1027ec1180d2c",
|
||||||
|
"used": "modules/mod-ilusixn-devmenu"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"squid": {
|
||||||
|
"repository": "Zyth45/mod-playerbots",
|
||||||
|
"ref": "v3.0",
|
||||||
|
"sha": "4ef5ed9ebe75a330de7df19639a042391e037e15",
|
||||||
|
"patch": "patches/squid-coa-validation.patch",
|
||||||
|
"patchSha256": "2cc45bc6555d5bb3e91728840f9de6e73c002c73b270a37732a1499956241c5f"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"repository": "Corfirean/coa-server-build",
|
||||||
|
"ref": "9a122d049e8be457444389e9756936bcdb4e7ef5",
|
||||||
|
"sha": "9a122d049e8be457444389e9756936bcdb4e7ef5"
|
||||||
|
},
|
||||||
|
"dungeon-clear": {
|
||||||
|
"repository": "Zyth45/mod-dungeon-clear",
|
||||||
|
"sha": "6efb59eae96bcc0730fc083314dd28d55970bbf4",
|
||||||
|
"patch": "patches/dungeon-clear-coa-validation.patch",
|
||||||
|
"patchSha256": "2845d389422e3a59e5c186ecf54b03f64f1dcc22cdef15729b60c354ae72cd6f",
|
||||||
|
"ref": "6efb59eae96bcc0730fc083314dd28d55970bbf4"
|
||||||
|
},
|
||||||
|
"navigation": {
|
||||||
|
"repository": "Corfirean/azerothcore-wotlk-coa",
|
||||||
|
"ref": "8b44099f480af0b69c6dfc697e4d388e865e9ffc",
|
||||||
|
"sha": "8b44099f480af0b69c6dfc697e4d388e865e9ffc",
|
||||||
|
"sourceRelease": "navigation-20261012",
|
||||||
|
"manifestSha256": "7f28600735f115792e79a5e8d1c8d78a83a8f5ed14a090c6d87268e49c2bb683",
|
||||||
|
"archiveSha256": "aa1347a095f85af44b4f592270a0e9314954801fda4578f0147f847e32c24a60",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"name": "navigation.zip.001",
|
||||||
|
"size": 1500000000,
|
||||||
|
"sha256": "e3a93903fc8155ee0d92db399ec426769c360bef87c44c07beb7e21cfd892c18",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-build/releases/download/navigation-20261012/navigation.zip.001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "navigation.zip.002",
|
||||||
|
"size": 1377006470,
|
||||||
|
"sha256": "c1af26ba7f83676278613076c357c4da0a11cfa6ae1ff00003479057c4864471",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-build/releases/download/navigation-20261012/navigation.zip.002"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"experimentalFeatures": [],
|
||||||
|
"compare": "https://github.com/Corfirean/coa-server-build/compare/server-0.261114.106...server-0.261115.110"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
+12
-1
@@ -1,6 +1,7 @@
|
|||||||
// Dev-only: lets the UI run in a plain browser for visual review. Never bundled in production builds.
|
// Dev-only: lets the UI run in a plain browser for visual review. Never bundled in production builds.
|
||||||
import { auctionCategories, auctionQualities } from "../lib/moduleSettings";
|
import { auctionCategories, auctionQualities } from "../lib/moduleSettings";
|
||||||
import moduleCatalog from "../../modules/catalog.json";
|
import moduleCatalog from "../../modules/catalog.json";
|
||||||
|
import addonCatalog from "../../addons/catalog.json";
|
||||||
import botsSchema from "../../schemas/bots.json";
|
import botsSchema from "../../schemas/bots.json";
|
||||||
import serverSchema from "../../schemas/server.json";
|
import serverSchema from "../../schemas/server.json";
|
||||||
import botsPresets from "../../schemas/presets/bots.json";
|
import botsPresets from "../../schemas/presets/bots.json";
|
||||||
@@ -29,6 +30,8 @@ export {};
|
|||||||
(window as any).__TAURI_INTERNALS__ = {
|
(window as any).__TAURI_INTERNALS__ = {
|
||||||
transformCallback: (cb: unknown)=>cb, unregisterCallback(){}, convertFileSrc:(x: unknown)=>x,
|
transformCallback: (cb: unknown)=>cb, unregisterCallback(){}, convertFileSrc:(x: unknown)=>x,
|
||||||
invoke: async (cmd: string, args?: any)=>{
|
invoke: async (cmd: string, args?: any)=>{
|
||||||
|
if(cmd==="clear_game_cache_on_play") return localStorage.getItem("demo-clear-cache")!=="0";
|
||||||
|
if(cmd==="set_clear_game_cache_on_play"){localStorage.setItem("demo-clear-cache",args.enabled?"1":"0");return;}
|
||||||
if(cmd==="close_to_tray") return localStorage.getItem("demo-close-tray")==="1";
|
if(cmd==="close_to_tray") return localStorage.getItem("demo-close-tray")==="1";
|
||||||
if(cmd==="set_close_to_tray"){localStorage.setItem("demo-close-tray",args.enabled?"1":"0");return;}
|
if(cmd==="set_close_to_tray"){localStorage.setItem("demo-close-tray",args.enabled?"1":"0");return;}
|
||||||
if(cmd==="client_graphics") return JSON.parse(localStorage.getItem("demo-graphics")??'{"dxvk_disabled":false,"enhancements_disabled":false}');
|
if(cmd==="client_graphics") return JSON.parse(localStorage.getItem("demo-graphics")??'{"dxvk_disabled":false,"enhancements_disabled":false}');
|
||||||
@@ -39,6 +42,12 @@ export {};
|
|||||||
if(cmd==="pending_update") return null;
|
if(cmd==="pending_update") return null;
|
||||||
if(cmd==="plugin:app|version") return "0.8.2";
|
if(cmd==="plugin:app|version") return "0.8.2";
|
||||||
if(cmd==="release_history") throw new Error("Offline demo: using bundled notes");
|
if(cmd==="release_history") throw new Error("Offline demo: using bundled notes");
|
||||||
|
if(cmd==="addons_list"||cmd==="addons_install"||cmd==="addons_remove"){const w=window as any;w.__addons=w.__addons??{dragonui:"old"};if(cmd==="addons_install"){await new Promise(r=>setTimeout(r,700));w.__addons[args.addon]="new";}if(cmd==="addons_remove")delete w.__addons[args.addon];return addonCatalog.addons.map((a:any)=>({id:a.id,name:a.name,description:a.description,author:a.author,license:a.license,needs:a.needs??null,repo:a.repo,size:a.files.reduce((s:number,f:any)=>s+f.size,0),installed:a.id in w.__addons,updateAvailable:w.__addons[a.id]==="old",foreignFolders:a.id==="coacombat"&&!(a.id in w.__addons)?["CoACombat"]:[],bundled:null as string|null})).concat([{id:"coa-dev-menu",name:"CoA Dev Menu",description:{en:"The in-game /dev editor for game masters.",ru:"Внутриигровой редактор /dev для гейм-мастеров. Ставится вместе с клиентским патчем Custom Races V2 и включается вместе с ним."},author:"ilusixn",license:"see repository",needs:null,repo:"https://github.com/ilusixn/ilusixn-dev-menu",size:0,installed:true,updateAvailable:false,foreignFolders:[],bundled:"custom-races"}]);}
|
||||||
|
if(cmd==="custom_race_characters") return {players:2,companionBots:14,squidBots:0};
|
||||||
|
if(cmd==="purge_custom_race_bots"){await new Promise(r=>setTimeout(r,500));return 14;}
|
||||||
|
if(cmd==="restart_schedule"||cmd==="restart_schedule_save"){const w=window as any;w.__sched=w.__sched??{enabled:false,time:"05:00",warningMinutes:5};if(cmd==="restart_schedule_save"){const s=args.schedule;if(s.enabled&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(s.time))throw new Error("The restart time must be HH:MM, for example 05:00.");w.__sched={...s};}return {schedule:w.__sched,supported:true};}
|
||||||
|
if(cmd==="mysql_custom"||cmd==="mysql_custom_save"){const w=window as any;if(cmd==="mysql_custom_save")w.__my=args.text;const text:string=w.__my??"";const applied=text.split("\n").map((l:string)=>l.trim()).filter((l:string)=>l&&!l.startsWith("#")&&!/^(port|datadir|basedir|bind[-_]address)\b/i.test(l)).map((l:string)=>l+"\n").join("");return {text,applied};}
|
||||||
|
if(cmd==="realm_names"||cmd==="realm_rename"){const w=window as any;w.__rn=w.__rn??{};const defs:[number,string][]=[[1,"Conquest of Azeroth"],[2,"Wildcard"]];if(cmd==="realm_rename"){await new Promise(r=>setTimeout(r,300));const n=(args.name??"").trim();if(n.length>32||n.includes('"'))throw new Error("The realm name can have at most 32 characters.");if(n)w.__rn[args.realmId]=n;else delete w.__rn[args.realmId];}return defs.map(([id,d])=>({id,name:w.__rn[id]??d,defaultName:d,custom:id in w.__rn}));}
|
||||||
if(cmd==="realm_profiles") return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:simultaneous&&running,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:withReborn&&running};
|
if(cmd==="realm_profiles") return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:simultaneous&&running,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:withReborn&&running};
|
||||||
if(cmd==="realm_simultaneous") { if(running) throw new Error("Stop both realms before changing simultaneous startup."); simultaneous=args.enabled; wildcardCreated ||= simultaneous; return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:false,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:false}; }
|
if(cmd==="realm_simultaneous") { if(running) throw new Error("Stop both realms before changing simultaneous startup."); simultaneous=args.enabled; wildcardCreated ||= simultaneous; return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:false,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:false}; }
|
||||||
if(cmd==="realm_with_reborn") { if(running) throw new Error("Stop all realms before changing which realms start together."); withReborn=args.enabled; rebornCreated ||= withReborn; return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:false,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:false}; }
|
if(cmd==="realm_with_reborn") { if(running) throw new Error("Stop all realms before changing which realms start together."); withReborn=args.enabled; rebornCreated ||= withReborn; return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:false,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:false}; }
|
||||||
@@ -84,13 +93,15 @@ export {};
|
|||||||
if(cmd==="realmlist_save"){const w=window as any;const rl=w.__rl;if(args.profileId){const p=rl.profiles.find((x: any)=>x.id===args.profileId);p.name=args.name;p.data=args.data;return p;}if(rl.profiles.some((x: any)=>x.name.toLowerCase()===String(args.name).toLowerCase()))throw {human:{code:"unknown",title:"",message:"",actions:[]},technical:"A realmlist with that name already exists."};const p={id:String(args.name).toLowerCase().replace(/[^a-z0-9]+/g,"-"),name:args.name,data:(/\s/.test(args.data.trim())?args.data.trim():"set realmlist "+args.data.trim())+"\r\n"};rl.profiles.push(p);return p;}
|
if(cmd==="realmlist_save"){const w=window as any;const rl=w.__rl;if(args.profileId){const p=rl.profiles.find((x: any)=>x.id===args.profileId);p.name=args.name;p.data=args.data;return p;}if(rl.profiles.some((x: any)=>x.name.toLowerCase()===String(args.name).toLowerCase()))throw {human:{code:"unknown",title:"",message:"",actions:[]},technical:"A realmlist with that name already exists."};const p={id:String(args.name).toLowerCase().replace(/[^a-z0-9]+/g,"-"),name:args.name,data:(/\s/.test(args.data.trim())?args.data.trim():"set realmlist "+args.data.trim())+"\r\n"};rl.profiles.push(p);return p;}
|
||||||
if(cmd==="realmlist_delete"){const rl=(window as any).__rl;rl.profiles=rl.profiles.filter((x: any)=>x.id!==args.profileId);return null;}
|
if(cmd==="realmlist_delete"){const rl=(window as any).__rl;rl.profiles=rl.profiles.filter((x: any)=>x.id!==args.profileId);return null;}
|
||||||
if(cmd==="account_delete") return null;
|
if(cmd==="account_delete") return null;
|
||||||
if(cmd==="modules_list") return [{id:"companions",name:"CoA Companions",description:{en:"Companion bots for groups, dungeons and your guild.",ru:"Боты-компаньоны для групп, подземелий и гильдии."},repo:"https://github.com/Corfirean/mod-coa-playerbots",installed:true,enabled:modState["companions"],switchable:true,status:"beta",icon:"bot",page:"bots"},{id:"content-scaling",name:"Content Scaling",description:{en:"Scales dungeons and raids to your group, with solo modes.",ru:"Подстраивает подземелья и рейды под вашу группу, есть соло-режимы."},repo:"https://github.com/Corfirean/mod-coa-content-scaling",installed:true,enabled:modState["content-scaling"],switchable:true,status:"early",icon:"scaling",page:null},{id:"tbc-content",name:"TBC Content",description:{en:"Outland dungeons and raids, scaled to your level range.",ru:"Подземелья и рейды Запределья, подогнанные под ваши уровни."},repo:"https://github.com/Corfirean/mod-coa-content-scaling/tree/main/content-packs/mod-coa-tbc-content",installed:true,enabled:modState["tbc-content"],switchable:true,status:"early",icon:"tbc",page:null},{id:"wotlk-content",name:"WotLK Content",description:{en:"Northrend dungeons and raids, scaled to your level range.",ru:"Подземелья и рейды Нордскола, подогнанные под ваши уровни."},repo:"https://github.com/Corfirean/mod-coa-content-scaling/tree/main/content-packs/mod-coa-wotlk-content",installed:true,enabled:modState["wotlk-content"],switchable:true,status:"early",icon:"wotlk",page:null},{id:"ah-bot",name:"Auction House Bot",description:{en:"Fills the auction house with realistic, adjustable listings.",ru:"Наполняет аукцион реалистичными настраиваемыми лотами."},repo:"https://github.com/Corfirean/azerothcore-wotlk-coa",installed:true,enabled:modState["ah-bot"] ?? false,switchable:true,status:"early",icon:"gavel",page:null,hidden:false},{id:"npc-enchanter",name:"NPC Enchanter",description:{en:"An NPC that enchants your gear for you.",ru:"НПС, который зачаровывает ваше снаряжение."},repo:"https://github.com/azerothcore/mod-npc-enchanter",installed:true,enabled:modState["npc-enchanter"],switchable:true,status:"early",icon:"sparkles",page:null,hidden:false},{id:"playerbots",name:"SQUID's Playerbots",description:{en:"An alternative bot system with random bots and full AI.",ru:"Альтернативная система ботов со случайными ботами и полным ИИ."},repo:"https://github.com/Zyth45/mod-playerbots",installed:true,enabled:modState["playerbots"] ?? false,switchable:true,status:"early",icon:"swords",page:"bots",hidden:false},{id:"client-compat",name:"Client compatibility",description:{en:"Client-server link and appearance unlocks.",ru:"Связь клиента с сервером и разблокировка внешних видов."},repo:"https://github.com/Corfirean/azerothcore-wotlk-coa",installed:true,enabled:modState["client-compat"],switchable:false,status:"release",icon:"plug",page:null,hidden:true}, ...moduleCatalog.modules.filter(m => m.id === "time-is-time").map(m => ({...m, installed:true, enabled:modState[m.id] ?? true, switchable:true, page:null, hidden:false}))].map(m => ({...m, has_settings: !["tbc-content", "wotlk-content"].includes(m.id), compatibility: realm !== "coa" ? (["companions", "playerbots"].includes(m.id) ? "unsupported" : m.id === "client-compat" ? "compatible" : "experimental") : "compatible", switchable: realm !== "coa" && ["companions", "playerbots"].includes(m.id) ? false : m.switchable}));
|
if(cmd==="modules_list") return [{id:"companions",name:"CoA Companions",description:{en:"Companion bots for groups, dungeons and your guild.",ru:"Боты-компаньоны для групп, подземелий и гильдии."},repo:"https://github.com/Corfirean/mod-coa-playerbots",installed:true,enabled:modState["companions"],switchable:true,status:"beta",icon:"bot",page:"bots"},{id:"content-scaling",name:"Content Scaling",description:{en:"Scales dungeons and raids to your group, with solo modes.",ru:"Подстраивает подземелья и рейды под вашу группу, есть соло-режимы."},repo:"https://github.com/Corfirean/mod-coa-content-scaling",installed:true,enabled:modState["content-scaling"],switchable:true,status:"early",icon:"scaling",page:null},{id:"tbc-content",name:"TBC Content",description:{en:"Outland dungeons and raids, scaled to your level range.",ru:"Подземелья и рейды Запределья, подогнанные под ваши уровни."},repo:"https://github.com/Corfirean/mod-coa-content-scaling/tree/main/content-packs/mod-coa-tbc-content",installed:true,enabled:modState["tbc-content"],switchable:true,status:"early",icon:"tbc",page:null},{id:"wotlk-content",name:"WotLK Content",description:{en:"Northrend dungeons and raids, scaled to your level range.",ru:"Подземелья и рейды Нордскола, подогнанные под ваши уровни."},repo:"https://github.com/Corfirean/mod-coa-content-scaling/tree/main/content-packs/mod-coa-wotlk-content",installed:true,enabled:modState["wotlk-content"],switchable:true,status:"early",icon:"wotlk",page:null},{id:"ah-bot",name:"Auction House Bot",description:{en:"Fills the auction house with realistic, adjustable listings.",ru:"Наполняет аукцион реалистичными настраиваемыми лотами."},repo:"https://github.com/Corfirean/azerothcore-wotlk-coa",installed:true,enabled:modState["ah-bot"] ?? false,switchable:true,status:"early",icon:"gavel",page:null,hidden:false},{id:"npc-enchanter",name:"NPC Enchanter",description:{en:"An NPC that enchants your gear for you.",ru:"НПС, который зачаровывает ваше снаряжение."},repo:"https://github.com/azerothcore/mod-npc-enchanter",installed:true,enabled:modState["npc-enchanter"],switchable:true,status:"early",icon:"sparkles",page:null,hidden:false},{id:"playerbots",name:"SQUID's Playerbots",description:{en:"An alternative bot system with random bots and full AI.",ru:"Альтернативная система ботов со случайными ботами и полным ИИ."},repo:"https://github.com/Zyth45/mod-playerbots",installed:true,enabled:modState["playerbots"] ?? false,switchable:true,status:"early",icon:"swords",page:"bots",hidden:false},{id:"client-compat",name:"Client compatibility",description:{en:"Client-server link and appearance unlocks.",ru:"Связь клиента с сервером и разблокировка внешних видов."},repo:"https://github.com/Corfirean/azerothcore-wotlk-coa",installed:true,enabled:modState["client-compat"],switchable:false,status:"release",icon:"plug",page:null,hidden:true}, ...moduleCatalog.modules.filter(m => ["time-is-time", "custom-races", "subclass", "dev-menu"].includes(m.id)).map(m => ({...m, installed:true, enabled:modState[m.id] ?? true, switchable:true, page:null, hidden:(m as any).hidden ?? false}))].map(m => ({...m, has_settings: !["tbc-content", "wotlk-content"].includes(m.id), compatibility: realm !== "coa" ? (["companions", "playerbots"].includes(m.id) ? "unsupported" : m.id === "client-compat" ? "compatible" : "experimental") : "compatible", switchable: realm !== "coa" && ["companions", "playerbots"].includes(m.id) ? false : m.switchable}));
|
||||||
if(cmd==="module_set_enabled"){ if(args.enabled && ["companions","playerbots"].includes(args.module) && modState[args.module === "companions" ? "playerbots" : "companions"]) throw {human:{code:"bot_modules_conflict",title:"",message:"",actions:[]},technical:"Only one bot system may be enabled."}; modState[args.module]=args.enabled; return null; }
|
if(cmd==="module_set_enabled"){ if(args.enabled && ["companions","playerbots"].includes(args.module) && modState[args.module === "companions" ? "playerbots" : "companions"]) throw {human:{code:"bot_modules_conflict",title:"",message:"",actions:[]},technical:"Only one bot system may be enabled."}; modState[args.module]=args.enabled; return null; }
|
||||||
if(cmd==="all_settings") return [{key:"Visibility.Distance.Continents",value:"100",default:"90",doc:"Description: Visibility distance on continents. Range: 45-250 Default: 90",changed:true},{key:"Death.SicknessLevel",value:"11",default:"11",doc:"Description: Character level up to which characters get resurrection sickness. Default: 11",changed:false},{key:"Rate.Drop.Item.Epic",value:"3",default:"1",doc:"Description: Drop rates for money and items based on quality. Default: 1",changed:true},{key:"Instance.ResetTimeHour",value:"4",default:"4",doc:"Description: Hour of the day when the global instance reset occurs. Range: 0-23 Default: 4 - (04:00 AM)",changed:false},{key:"PlayerLimit",value:"1000",default:"1000",doc:"Description: Maximum number of players in the world.",changed:false}];
|
if(cmd==="all_settings") return [{key:"Visibility.Distance.Continents",value:"100",default:"90",doc:"Description: Visibility distance on continents. Range: 45-250 Default: 90",changed:true},{key:"Death.SicknessLevel",value:"11",default:"11",doc:"Description: Character level up to which characters get resurrection sickness. Default: 11",changed:false},{key:"Rate.Drop.Item.Epic",value:"3",default:"1",doc:"Description: Drop rates for money and items based on quality. Default: 1",changed:true},{key:"Instance.ResetTimeHour",value:"4",default:"4",doc:"Description: Hour of the day when the global instance reset occurs. Range: 0-23 Default: 4 - (04:00 AM)",changed:false},{key:"PlayerLimit",value:"1000",default:"1000",doc:"Description: Maximum number of players in the world.",changed:false}];
|
||||||
if(cmd==="all_settings_save") return Object.keys(args&&args.changes||{});
|
if(cmd==="all_settings_save") return Object.keys(args&&args.changes||{});
|
||||||
if(cmd==="module_settings" && args.module==="client-compat") return [{key:"CoA.UnlockLocalAppearanceCatalog",value:"1",default:"1",doc:""},{key:"CoA.UnlockAllVanity",value:"1",default:"1",doc:""},{key:"CoA.AutoCollectAppearances",value:"0",default:"1",doc:""},{key:"CoA.LearnOwnedCompanions",value:"1",default:"1",doc:""},{key:"CoA.MaxRidingFromStart",value:"1",default:"1",doc:""}];
|
if(cmd==="module_settings" && args.module==="client-compat") return [{key:"CoA.UnlockLocalAppearanceCatalog",value:"1",default:"1",doc:""},{key:"CoA.UnlockAllVanity",value:"1",default:"1",doc:""},{key:"CoA.AutoCollectAppearances",value:"0",default:"1",doc:""},{key:"CoA.LearnOwnedCompanions",value:"1",default:"1",doc:""},{key:"CoA.MaxRidingFromStart",value:"1",default:"1",doc:""}];
|
||||||
if(cmd==="module_settings"){
|
if(cmd==="module_settings"){
|
||||||
const S:Record<string,{key:string;value:string;default:string;doc:string}[]>={
|
const S:Record<string,{key:string;value:string;default:string;doc:string}[]>={
|
||||||
|
"subclass": [["Subclass.Enable","1"],["Subclass.MinLevel","20"],["Subclass.ThinHuman.Enable","1"],["Subclass.TwoHeadedOgre.Enable","1"],["Subclass.TwoPlayers.Enable","1"],["Subclass.StandardClasses","0"],["Subclass.StandardMains","0"],["Subclass.HeroRaces.RequiredLevel","60"],["Subclass.BookDropChance","5"]].map(([key,value])=>({key,value,default:value,doc:"Option of mod-subclass."})),
|
||||||
|
"dev-menu": [{key:"DevMenu.Enable",value:"1",default:"1",doc:"Answer the addon's requests."},{key:"DevMenu.MinSecurity",value:"2",default:"2",doc:"Lowest account security level allowed to use the menu."},{key:"DevMenu.Items.FirstId",value:"0",default:"0",doc:"First id of the item ids the Create an item tab uses."}],
|
||||||
"time-is-time": [{key:"TimeIsTime.Enable",value:"1",default:"1",doc:""},{key:"TimeIsTime.Announce",value:"1",default:"1",doc:""},{key:"TimeIsTime.SpeedRate",value:"1.0",default:"1.0",doc:""},{key:"TimeIsTime.TimeStart",value:"0",default:"0",doc:""},{key:"TimeIsTime.HourOffset",value:"0.0",default:"0.0",doc:""}],
|
"time-is-time": [{key:"TimeIsTime.Enable",value:"1",default:"1",doc:""},{key:"TimeIsTime.Announce",value:"1",default:"1",doc:""},{key:"TimeIsTime.SpeedRate",value:"1.0",default:"1.0",doc:""},{key:"TimeIsTime.TimeStart",value:"0",default:"0",doc:""},{key:"TimeIsTime.HourOffset",value:"0.0",default:"0.0",doc:""}],
|
||||||
"npc-enchanter":[{key:"Enchanter.Enable",value:"1",default:"1",doc:"Enable the module."},{key:"Enchanter.Announce",value:"0",default:"0",doc:"Announce the module when the player logs in."},{key:"Enchanter.CostCopper",value:"0",default:"0",doc:"What one enchantment costs, in copper (10000 = 1 gold). 0 = free."},{key:"Enchanter.MessageTimer",value:"60000",default:"60000",doc:"How often the NPC emotes, in milliseconds."}],
|
"npc-enchanter":[{key:"Enchanter.Enable",value:"1",default:"1",doc:"Enable the module."},{key:"Enchanter.Announce",value:"0",default:"0",doc:"Announce the module when the player logs in."},{key:"Enchanter.CostCopper",value:"0",default:"0",doc:"What one enchantment costs, in copper (10000 = 1 gold). 0 = free."},{key:"Enchanter.MessageTimer",value:"60000",default:"60000",doc:"How often the NPC emotes, in milliseconds."}],
|
||||||
"playerbots":[{"key": "AiPlayerbot.RandomBotAutologin", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.MinRandomBots", "value": "500", "default": "500", "doc": ""}, {"key": "AiPlayerbot.MaxRandomBots", "value": "500", "default": "500", "doc": ""}, {"key": "AiPlayerbot.RandomBotAccountCount", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.RandomBotMinLevel", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.RandomBotMaxLevel", "value": "60", "default": "60", "doc": ""}, {"key": "AiPlayerbot.SyncLevelWithPlayers", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.RandomBotInvitePlayer", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.RandomBotJoinLfg", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.RandomBotJoinBG", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.RandomBotAutoJoinBG", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.RandomBotTalk", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.RandomBotEmote", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.RandomBotSuggestDungeons", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.CoaClassesOnly", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.CoaSmartHeal", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.CoaSmartTank", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.CoaSpecRotations", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.CoaInterruptCoordination", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.MaxAddedBots", "value": "40", "default": "40", "doc": ""}, {"key": "AiPlayerbot.BotAutologin", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.DisabledWithoutRealPlayer", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.AddClassCommand", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.KeepAltsInGroup", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.CoaRecruitSameFaction", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.CoaLfgBots", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.RandomBotXPRate", "value": "1.0", "default": "1.0", "doc": ""}, {"key": "AiPlayerbot.FollowDistance", "value": "1.5", "default": "1.5", "doc": ""}, {"key": "AiPlayerbot.Enabled", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.RandomBotAccountPrefix", "value": "\"rndbot\"", "default": "\"rndbot\"", "doc": ""}, {"key": "AiPlayerbot.RandomBotUpdateInterval", "value": "20", "default": "20", "doc": ""}],
|
"playerbots":[{"key": "AiPlayerbot.RandomBotAutologin", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.MinRandomBots", "value": "500", "default": "500", "doc": ""}, {"key": "AiPlayerbot.MaxRandomBots", "value": "500", "default": "500", "doc": ""}, {"key": "AiPlayerbot.RandomBotAccountCount", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.RandomBotMinLevel", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.RandomBotMaxLevel", "value": "60", "default": "60", "doc": ""}, {"key": "AiPlayerbot.SyncLevelWithPlayers", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.RandomBotInvitePlayer", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.RandomBotJoinLfg", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.RandomBotJoinBG", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.RandomBotAutoJoinBG", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.RandomBotTalk", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.RandomBotEmote", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.RandomBotSuggestDungeons", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.CoaClassesOnly", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.CoaSmartHeal", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.CoaSmartTank", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.CoaSpecRotations", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.CoaInterruptCoordination", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.MaxAddedBots", "value": "40", "default": "40", "doc": ""}, {"key": "AiPlayerbot.BotAutologin", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.DisabledWithoutRealPlayer", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.AddClassCommand", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.KeepAltsInGroup", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.CoaRecruitSameFaction", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.CoaLfgBots", "value": "1", "default": "1", "doc": ""}, {"key": "AiPlayerbot.RandomBotXPRate", "value": "1.0", "default": "1.0", "doc": ""}, {"key": "AiPlayerbot.FollowDistance", "value": "1.5", "default": "1.5", "doc": ""}, {"key": "AiPlayerbot.Enabled", "value": "0", "default": "0", "doc": ""}, {"key": "AiPlayerbot.RandomBotAccountPrefix", "value": "\"rndbot\"", "default": "\"rndbot\"", "doc": ""}, {"key": "AiPlayerbot.RandomBotUpdateInterval", "value": "20", "default": "20", "doc": ""}],
|
||||||
|
|||||||
@@ -773,6 +773,44 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
|||||||
"overview.reportBtn": "Diagnose sammeln und melden",
|
"overview.reportBtn": "Diagnose sammeln und melden",
|
||||||
|
|
||||||
// Realmlist switcher and modules page
|
// Realmlist switcher and modules page
|
||||||
|
"mysql.title": "MySQL-Einstellungen",
|
||||||
|
"mysql.hint": "Eigene MySQL-Optionen, eine Zeile name = wert. Sie werden bei jedem Start der Datenbank zu my.ini hinzugefügt und bleiben nach Updates erhalten. Port, Adressen und Datenpfade verwaltet der Manager; hier werden sie ignoriert.",
|
||||||
|
"mysql.save": "Speichern",
|
||||||
|
"mysql.saved": "Gespeichert; Server neu starten, um sie anzuwenden.",
|
||||||
|
"mysql.applied": "Angewandte Optionen: {count}",
|
||||||
|
"sched.title": "Geplanter Neustart",
|
||||||
|
"sched.enable": "Die Welt jeden Tag neu starten",
|
||||||
|
"sched.time": "Uhrzeit",
|
||||||
|
"sched.warning": "Vorwarnung (Minuten)",
|
||||||
|
"sched.hint": "Die Welt startet zu dieser Uhrzeit dieses Computers neu, mit einem Countdown im Spielchat; die Datenbank läuft weiter, Spieler melden sich danach wieder an. Ein laufender Server übernimmt die neue Zeit innerhalb einer Minute.",
|
||||||
|
"sched.save": "Speichern",
|
||||||
|
"sched.saved": "Gespeichert.",
|
||||||
|
"sched.unsupported": "Dieser Server kann das noch nicht: Aktualisiere ihn auf einen Build mit dem neuen Launcher.",
|
||||||
|
"client.clearCache": "Spiel-Cache vor jedem Start leeren",
|
||||||
|
"client.clearCacheHint": "Das Spiel merkt sich Kreaturen, Gegenstände und Quests vom Server (Cache/WDB). Nach einem Server-Update zeigen sie sonst alte Namen und Werte; der Cache füllt sich in Sekunden wieder.",
|
||||||
|
"addons.withServer": "Kommt mit dem Server und wird mit ihm aktualisiert.",
|
||||||
|
"addons.withRaces": "Mit dem Client-Patch Custom Races V2 installiert und mit ihm geschaltet; der Manager installiert ihn nicht separat.",
|
||||||
|
"addons.withRacesMissing": "Kommt mit dem Client-Patch Custom Races V2 (Module, Custom Races); installiere den Patch, um ihn zu bekommen.",
|
||||||
|
"addons.title": "Addons",
|
||||||
|
"addons.hint": "Community-Addons für Conquest of Azeroth. Jedes kommt in einer geprüften Version vom GitHub seines Autors; jede Datei wird vor der Installation in Interface/AddOns geprüft. Schließe zuerst das Spiel.",
|
||||||
|
"addons.by": "von {author}",
|
||||||
|
"addons.installed": "Installiert",
|
||||||
|
"addons.update": "Update verfügbar",
|
||||||
|
"addons.needsSquid": "Für SQUID's Playerbots.",
|
||||||
|
"addons.foreign": "Ein Ordner {folders} ist schon da; er wird nach AddOns/.coa-addons-backup verschoben.",
|
||||||
|
"addons.doInstall": "Installieren",
|
||||||
|
"addons.doUpdate": "Aktualisieren",
|
||||||
|
"addons.doRemove": "Entfernen",
|
||||||
|
"races.offCharacters": "Eigene Völker sind aus: {players} Spielerfigur(en) und {bots} Bot(s) eigener Völker bleiben der Welt fern, bis sie wieder an sind (ein Client ohne Patch würde bei ihnen abstürzen).",
|
||||||
|
"races.purgeBots": "{n} Begleiter-Bot(s) eigener Völker löschen",
|
||||||
|
"races.purged": "{n} Bot(s) eigener Völker gelöscht.",
|
||||||
|
"realm.namesTitle": "Realmnamen",
|
||||||
|
"realm.namesHint": "So heißt der Realm in der Realmliste der Spieler. Ein laufender Server zeigt den Namen sofort, und er bleibt nach Updates erhalten.",
|
||||||
|
"realm.nameSave": "Speichern",
|
||||||
|
"realm.nameReset": "Standardname",
|
||||||
|
"realm.nameDefault": "Standard: {name}",
|
||||||
|
"realm.nameSaved": "Gespeichert.",
|
||||||
|
"realm.nameQuotes": "Anführungszeichen sind nicht erlaubt: Der Spielclient speichert den Namen in Anführungszeichen.",
|
||||||
"realm.profileLabel": "Realm",
|
"realm.profileLabel": "Realm",
|
||||||
"realm.switching": "Realm wird gewechselt…",
|
"realm.switching": "Realm wird gewechselt…",
|
||||||
"realm.rebornCreate": "Warcraft-Reborn-Realm erstellen",
|
"realm.rebornCreate": "Warcraft-Reborn-Realm erstellen",
|
||||||
|
|||||||
@@ -57,6 +57,44 @@ const en = {
|
|||||||
"remote.hostInstead": "Host my own server",
|
"remote.hostInstead": "Host my own server",
|
||||||
"welcome.roleSubtitle": "How would you like to play?",
|
"welcome.roleSubtitle": "How would you like to play?",
|
||||||
|
|
||||||
|
"mysql.title": "MySQL settings",
|
||||||
|
"mysql.hint": "Your own MySQL options, one name = value per line. They are added to my.ini at every start of the database and stay after updates. The port, addresses and data paths are managed by the Manager and ignored here.",
|
||||||
|
"mysql.save": "Save",
|
||||||
|
"mysql.saved": "Saved; restart the server to apply.",
|
||||||
|
"mysql.applied": "Options applied: {count}",
|
||||||
|
"sched.title": "Scheduled restart",
|
||||||
|
"sched.enable": "Restart the world every day",
|
||||||
|
"sched.time": "Time",
|
||||||
|
"sched.warning": "Warning (minutes)",
|
||||||
|
"sched.hint": "The world restarts at this time of this computer with a countdown in the game chat; the database keeps running and players log in again after it. A minute after saving, the running server follows the new time.",
|
||||||
|
"sched.save": "Save",
|
||||||
|
"sched.saved": "Saved.",
|
||||||
|
"sched.unsupported": "This server cannot do it yet: update the server to a build with the new launcher.",
|
||||||
|
"client.clearCache": "Clear the game cache before every Play",
|
||||||
|
"client.clearCacheHint": "The game remembers creatures, items and quests it got from a server (Cache/WDB). After a server update they can show old names and stats; the cache fills again within seconds.",
|
||||||
|
"addons.withServer": "Comes with the server and is updated with it.",
|
||||||
|
"addons.withRaces": "Installed with the Custom Races V2 client patch and switched with it; the Manager does not install it separately.",
|
||||||
|
"addons.withRacesMissing": "Comes with the Custom Races V2 client patch (Modules, Custom Races); install the patch to get it.",
|
||||||
|
"addons.title": "Addons",
|
||||||
|
"addons.hint": "Community addons for Conquest of Azeroth. Each comes from its author's GitHub at a checked version; every file is verified before it is installed into Interface/AddOns. Close the game first.",
|
||||||
|
"addons.by": "by {author}",
|
||||||
|
"addons.installed": "Installed",
|
||||||
|
"addons.update": "Update available",
|
||||||
|
"addons.needsSquid": "For SQUID's Playerbots.",
|
||||||
|
"addons.foreign": "A folder named {folders} is already there; it will be moved to AddOns/.coa-addons-backup.",
|
||||||
|
"addons.doInstall": "Install",
|
||||||
|
"addons.doUpdate": "Update",
|
||||||
|
"addons.doRemove": "Remove",
|
||||||
|
"races.offCharacters": "Custom races are off: {players} player character(s) and {bots} bot(s) of custom races stay out of the world until they are on again (a game client without the patch would crash on them).",
|
||||||
|
"races.purgeBots": "Delete the {n} companion bot(s) of custom races",
|
||||||
|
"races.purged": "Deleted {n} bot(s) of custom races.",
|
||||||
|
"realm.namesTitle": "Realm names",
|
||||||
|
"realm.namesHint": "The name players see in the realm list. A running server shows it at once, and it stays after updates.",
|
||||||
|
"realm.nameSave": "Save",
|
||||||
|
"realm.nameReset": "Default name",
|
||||||
|
"realm.nameDefault": "Default: {name}",
|
||||||
|
"realm.nameSaved": "Saved.",
|
||||||
|
"realm.nameQuotes": "Quotation marks are not allowed: the game client stores the name in quotes.",
|
||||||
"realm.profileLabel": "Realm",
|
"realm.profileLabel": "Realm",
|
||||||
"realm.startupTitle": "Realm startup",
|
"realm.startupTitle": "Realm startup",
|
||||||
"realm.secondWorld": "Second world",
|
"realm.secondWorld": "Second world",
|
||||||
|
|||||||
@@ -773,6 +773,44 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
|||||||
"overview.reportBtn": "Reunir el diagnóstico y avisar",
|
"overview.reportBtn": "Reunir el diagnóstico y avisar",
|
||||||
|
|
||||||
// Realmlist switcher and modules page
|
// Realmlist switcher and modules page
|
||||||
|
"mysql.title": "Ajustes de MySQL",
|
||||||
|
"mysql.hint": "Tus propias opciones de MySQL, una línea nombre = valor. Se añaden a my.ini en cada inicio de la base de datos y se mantienen tras las actualizaciones. El puerto, las direcciones y las rutas de datos los gestiona el Manager y aquí se ignoran.",
|
||||||
|
"mysql.save": "Guardar",
|
||||||
|
"mysql.saved": "Guardado; reinicia el servidor para aplicarlo.",
|
||||||
|
"mysql.applied": "Opciones aplicadas: {count}",
|
||||||
|
"sched.title": "Reinicio programado",
|
||||||
|
"sched.enable": "Reiniciar el mundo cada día",
|
||||||
|
"sched.time": "Hora",
|
||||||
|
"sched.warning": "Aviso (minutos)",
|
||||||
|
"sched.hint": "El mundo se reinicia a esta hora de este ordenador con una cuenta atrás en el chat del juego; la base de datos sigue en marcha y los jugadores vuelven a entrar después. Un servidor en marcha sigue la nueva hora en menos de un minuto.",
|
||||||
|
"sched.save": "Guardar",
|
||||||
|
"sched.saved": "Guardado.",
|
||||||
|
"sched.unsupported": "Este servidor aún no puede hacerlo: actualízalo a una versión con el nuevo lanzador.",
|
||||||
|
"client.clearCache": "Vaciar la caché del juego antes de cada inicio",
|
||||||
|
"client.clearCacheHint": "El juego recuerda criaturas, objetos y misiones recibidos del servidor (Cache/WDB). Tras actualizar el servidor pueden mostrar nombres y estadísticas antiguos; la caché se llena de nuevo en segundos.",
|
||||||
|
"addons.withServer": "Viene con el servidor y se actualiza con él.",
|
||||||
|
"addons.withRaces": "Instalado con el parche de cliente Custom Races V2 y activado con él; el Manager no lo instala por separado.",
|
||||||
|
"addons.withRacesMissing": "Viene con el parche de cliente Custom Races V2 (Módulos, Custom Races); instala el parche para tenerlo.",
|
||||||
|
"addons.title": "Addons",
|
||||||
|
"addons.hint": "Addons de la comunidad para Conquest of Azeroth. Cada uno viene del GitHub de su autor en una versión comprobada; cada archivo se verifica antes de instalarlo en Interface/AddOns. Cierra antes el juego.",
|
||||||
|
"addons.by": "de {author}",
|
||||||
|
"addons.installed": "Instalado",
|
||||||
|
"addons.update": "Actualización disponible",
|
||||||
|
"addons.needsSquid": "Para SQUID's Playerbots.",
|
||||||
|
"addons.foreign": "Ya hay una carpeta {folders}; se moverá a AddOns/.coa-addons-backup.",
|
||||||
|
"addons.doInstall": "Instalar",
|
||||||
|
"addons.doUpdate": "Actualizar",
|
||||||
|
"addons.doRemove": "Quitar",
|
||||||
|
"races.offCharacters": "Las razas personalizadas están desactivadas: {players} personaje(s) de jugadores y {bots} bot(s) de esas razas quedan fuera del mundo hasta reactivarlas (un cliente sin el parche se cerraría al verlos).",
|
||||||
|
"races.purgeBots": "Borrar los {n} bot(s) acompañantes de razas personalizadas",
|
||||||
|
"races.purged": "Borrados {n} bot(s) de razas personalizadas.",
|
||||||
|
"realm.namesTitle": "Nombres de los reinos",
|
||||||
|
"realm.namesHint": "El nombre que ven los jugadores en la lista de reinos. Un servidor en marcha lo muestra al instante y se mantiene tras las actualizaciones.",
|
||||||
|
"realm.nameSave": "Guardar",
|
||||||
|
"realm.nameReset": "Nombre predeterminado",
|
||||||
|
"realm.nameDefault": "Predeterminado: {name}",
|
||||||
|
"realm.nameSaved": "Guardado.",
|
||||||
|
"realm.nameQuotes": "No se permiten comillas: el cliente del juego guarda el nombre entre comillas.",
|
||||||
"realm.profileLabel": "Reino",
|
"realm.profileLabel": "Reino",
|
||||||
"realm.switching": "Cambiando de reino…",
|
"realm.switching": "Cambiando de reino…",
|
||||||
"realm.rebornCreate": "Crear reino Warcraft Reborn",
|
"realm.rebornCreate": "Crear reino Warcraft Reborn",
|
||||||
|
|||||||
@@ -773,6 +773,44 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
|||||||
"overview.reportBtn": "Rassembler le diagnostic et signaler",
|
"overview.reportBtn": "Rassembler le diagnostic et signaler",
|
||||||
|
|
||||||
// Realmlist switcher and modules page
|
// Realmlist switcher and modules page
|
||||||
|
"mysql.title": "Paramètres MySQL",
|
||||||
|
"mysql.hint": "Vos propres options MySQL, une ligne nom = valeur. Elles sont ajoutées à my.ini à chaque démarrage de la base et restent après les mises à jour. Le port, les adresses et les chemins de données sont gérés par le Manager et ignorés ici.",
|
||||||
|
"mysql.save": "Enregistrer",
|
||||||
|
"mysql.saved": "Enregistré ; redémarrez le serveur pour appliquer.",
|
||||||
|
"mysql.applied": "Options appliquées : {count}",
|
||||||
|
"sched.title": "Redémarrage planifié",
|
||||||
|
"sched.enable": "Redémarrer le monde chaque jour",
|
||||||
|
"sched.time": "Heure",
|
||||||
|
"sched.warning": "Avertissement (minutes)",
|
||||||
|
"sched.hint": "Le monde redémarre à cette heure de cet ordinateur avec un compte à rebours dans le chat du jeu ; la base de données continue de tourner et les joueurs se reconnectent ensuite. Un serveur en marche suit la nouvelle heure en moins d'une minute.",
|
||||||
|
"sched.save": "Enregistrer",
|
||||||
|
"sched.saved": "Enregistré.",
|
||||||
|
"sched.unsupported": "Ce serveur ne le permet pas encore : mettez-le à jour vers une version avec le nouveau lanceur.",
|
||||||
|
"client.clearCache": "Vider le cache du jeu avant chaque lancement",
|
||||||
|
"client.clearCacheHint": "Le jeu garde les créatures, objets et quêtes reçus du serveur (Cache/WDB). Après une mise à jour du serveur, ils peuvent montrer d'anciens noms et statistiques ; le cache se remplit en quelques secondes.",
|
||||||
|
"addons.withServer": "Fourni avec le serveur et mis à jour avec lui.",
|
||||||
|
"addons.withRaces": "Installé avec le patch client Custom Races V2 et activé avec lui ; le Manager ne l'installe pas séparément.",
|
||||||
|
"addons.withRacesMissing": "Fourni avec le patch client Custom Races V2 (Modules, Custom Races) ; installez le patch pour l'obtenir.",
|
||||||
|
"addons.title": "Addons",
|
||||||
|
"addons.hint": "Addons de la communauté pour Conquest of Azeroth. Chacun vient du GitHub de son auteur dans une version vérifiée ; chaque fichier est contrôlé avant l'installation dans Interface/AddOns. Fermez d'abord le jeu.",
|
||||||
|
"addons.by": "par {author}",
|
||||||
|
"addons.installed": "Installé",
|
||||||
|
"addons.update": "Mise à jour disponible",
|
||||||
|
"addons.needsSquid": "Pour SQUID's Playerbots.",
|
||||||
|
"addons.foreign": "Un dossier {folders} existe déjà ; il sera déplacé vers AddOns/.coa-addons-backup.",
|
||||||
|
"addons.doInstall": "Installer",
|
||||||
|
"addons.doUpdate": "Mettre à jour",
|
||||||
|
"addons.doRemove": "Supprimer",
|
||||||
|
"races.offCharacters": "Les races personnalisées sont désactivées : {players} personnage(s) de joueurs et {bots} bot(s) de ces races restent hors du monde jusqu'à leur réactivation (un client sans le patch planterait en les voyant).",
|
||||||
|
"races.purgeBots": "Supprimer les {n} bot(s) compagnons de races personnalisées",
|
||||||
|
"races.purged": "{n} bot(s) de races personnalisées supprimé(s).",
|
||||||
|
"realm.namesTitle": "Noms des royaumes",
|
||||||
|
"realm.namesHint": "Le nom que les joueurs voient dans la liste des royaumes. Un serveur en marche l'affiche aussitôt, et il reste après les mises à jour.",
|
||||||
|
"realm.nameSave": "Enregistrer",
|
||||||
|
"realm.nameReset": "Nom par défaut",
|
||||||
|
"realm.nameDefault": "Par défaut : {name}",
|
||||||
|
"realm.nameSaved": "Enregistré.",
|
||||||
|
"realm.nameQuotes": "Les guillemets ne sont pas autorisés : le client du jeu enregistre le nom entre guillemets.",
|
||||||
"realm.profileLabel": "Royaume",
|
"realm.profileLabel": "Royaume",
|
||||||
"realm.switching": "Changement de royaume…",
|
"realm.switching": "Changement de royaume…",
|
||||||
"realm.rebornCreate": "Créer le royaume Warcraft Reborn",
|
"realm.rebornCreate": "Créer le royaume Warcraft Reborn",
|
||||||
|
|||||||
@@ -60,6 +60,44 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
|||||||
"remote.hostInstead": "Создать свой сервер",
|
"remote.hostInstead": "Создать свой сервер",
|
||||||
"welcome.roleSubtitle": "Как вы хотите играть?",
|
"welcome.roleSubtitle": "Как вы хотите играть?",
|
||||||
|
|
||||||
|
"mysql.title": "Настройки MySQL",
|
||||||
|
"mysql.hint": "Свои параметры MySQL, по одному «имя = значение» в строке. Они добавляются в my.ini при каждом запуске базы и сохраняются после обновлений. Порт, адреса и пути к данным задаёт Manager, здесь они игнорируются.",
|
||||||
|
"mysql.save": "Сохранить",
|
||||||
|
"mysql.saved": "Сохранено; перезапустите сервер, чтобы применить.",
|
||||||
|
"mysql.applied": "Применяется параметров: {count}",
|
||||||
|
"sched.title": "Перезапуск по расписанию",
|
||||||
|
"sched.enable": "Перезапускать мир каждый день",
|
||||||
|
"sched.time": "Время",
|
||||||
|
"sched.warning": "Предупреждение (минуты)",
|
||||||
|
"sched.hint": "Мир перезапускается в это время этого компьютера, с обратным отсчётом в игровом чате; база данных продолжает работать, игроки заходят снова после перезапуска. Работающий сервер подхватывает новое время в течение минуты.",
|
||||||
|
"sched.save": "Сохранить",
|
||||||
|
"sched.saved": "Сохранено.",
|
||||||
|
"sched.unsupported": "Этот сервер пока так не умеет: обновите его до сборки с новым лаунчером.",
|
||||||
|
"client.clearCache": "Очищать кэш игры перед каждым запуском",
|
||||||
|
"client.clearCacheHint": "Игра запоминает существ, предметы и задания, полученные от сервера (Cache/WDB). После обновления сервера там остаются старые названия и характеристики; кэш снова заполняется за секунды.",
|
||||||
|
"addons.withServer": "Поставляется вместе с сервером и обновляется вместе с ним.",
|
||||||
|
"addons.withRaces": "Установлен вместе с клиентским патчем Custom Races V2 и включается вместе с ним; отдельно Manager его не ставит.",
|
||||||
|
"addons.withRacesMissing": "Поставляется с клиентским патчем Custom Races V2 (Модули → Custom Races); установите патч, чтобы он появился.",
|
||||||
|
"addons.title": "Аддоны",
|
||||||
|
"addons.hint": "Аддоны сообщества для Conquest of Azeroth. Каждый берётся с GitHub автора в проверенной версии; перед установкой в Interface/AddOns проверяется каждый файл. Сначала закройте игру.",
|
||||||
|
"addons.by": "автор: {author}",
|
||||||
|
"addons.installed": "Установлен",
|
||||||
|
"addons.update": "Есть обновление",
|
||||||
|
"addons.needsSquid": "Для SQUID's Playerbots.",
|
||||||
|
"addons.foreign": "Папка {folders} уже есть; она будет перенесена в AddOns/.coa-addons-backup.",
|
||||||
|
"addons.doInstall": "Установить",
|
||||||
|
"addons.doUpdate": "Обновить",
|
||||||
|
"addons.doRemove": "Удалить",
|
||||||
|
"races.offCharacters": "Кастомные расы выключены: {players} персонаж(ей) игроков и {bots} бот(ов) кастомных рас не входят в мир, пока расы снова не включены (клиент без патча падал бы при виде их).",
|
||||||
|
"races.purgeBots": "Удалить ботов-компаньонов кастомных рас: {n}",
|
||||||
|
"races.purged": "Удалено ботов кастомных рас: {n}.",
|
||||||
|
"realm.namesTitle": "Названия реалмов",
|
||||||
|
"realm.namesHint": "Так реалм называется в списке реалмов у игроков. Работающий сервер показывает новое название сразу, и оно сохраняется после обновлений.",
|
||||||
|
"realm.nameSave": "Сохранить",
|
||||||
|
"realm.nameReset": "Стандартное название",
|
||||||
|
"realm.nameDefault": "По умолчанию: {name}",
|
||||||
|
"realm.nameSaved": "Сохранено.",
|
||||||
|
"realm.nameQuotes": "Кавычки нельзя: клиент игры хранит название в кавычках.",
|
||||||
"realm.profileLabel": "Реалм",
|
"realm.profileLabel": "Реалм",
|
||||||
"realm.startupTitle": "Запуск реалмов",
|
"realm.startupTitle": "Запуск реалмов",
|
||||||
"realm.secondWorld": "Второй мир",
|
"realm.secondWorld": "Второй мир",
|
||||||
|
|||||||
@@ -58,6 +58,44 @@ const zh = {
|
|||||||
"remote.hostInstead": "搭建自己的服务器",
|
"remote.hostInstead": "搭建自己的服务器",
|
||||||
"welcome.roleSubtitle": "你想如何游玩?",
|
"welcome.roleSubtitle": "你想如何游玩?",
|
||||||
|
|
||||||
|
"mysql.title": "MySQL 设置",
|
||||||
|
"mysql.hint": "自定义 MySQL 选项,每行一个“名称 = 值”。每次数据库启动时都会加入 my.ini,更新后也会保留。端口、地址和数据路径由 Manager 管理,此处会被忽略。",
|
||||||
|
"mysql.save": "保存",
|
||||||
|
"mysql.saved": "已保存;重启服务器后生效。",
|
||||||
|
"mysql.applied": "生效的选项:{count}",
|
||||||
|
"sched.title": "定时重启",
|
||||||
|
"sched.enable": "每天重启世界",
|
||||||
|
"sched.time": "时间",
|
||||||
|
"sched.warning": "提前警告(分钟)",
|
||||||
|
"sched.hint": "世界会在本机的这个时间重启,并在游戏聊天中倒计时;数据库保持运行,玩家在重启后重新登录。正在运行的服务器会在一分钟内采用新时间。",
|
||||||
|
"sched.save": "保存",
|
||||||
|
"sched.saved": "已保存。",
|
||||||
|
"sched.unsupported": "此服务器暂不支持:请将服务器更新到带有新启动器的版本。",
|
||||||
|
"client.clearCache": "每次启动前清空游戏缓存",
|
||||||
|
"client.clearCacheHint": "游戏会保存从服务器获得的生物、物品和任务(Cache/WDB)。服务器更新后,这些缓存可能显示旧的名称和属性;缓存会在几秒内重新生成。",
|
||||||
|
"addons.withServer": "随服务器提供,并随服务器一起更新。",
|
||||||
|
"addons.withRaces": "随 Custom Races V2 客户端补丁安装并一起开关;Manager 不会单独安装它。",
|
||||||
|
"addons.withRacesMissing": "随 Custom Races V2 客户端补丁提供(模块 → Custom Races);安装补丁后即可获得。",
|
||||||
|
"addons.title": "插件",
|
||||||
|
"addons.hint": "Conquest of Azeroth 的社区插件。每个插件都来自作者的 GitHub 的已核验版本;安装到 Interface/AddOns 前会逐个校验文件。请先关闭游戏。",
|
||||||
|
"addons.by": "作者:{author}",
|
||||||
|
"addons.installed": "已安装",
|
||||||
|
"addons.update": "有可用更新",
|
||||||
|
"addons.needsSquid": "用于 SQUID's Playerbots。",
|
||||||
|
"addons.foreign": "已存在名为 {folders} 的文件夹;它会被移到 AddOns/.coa-addons-backup。",
|
||||||
|
"addons.doInstall": "安装",
|
||||||
|
"addons.doUpdate": "更新",
|
||||||
|
"addons.doRemove": "移除",
|
||||||
|
"races.offCharacters": "自定义种族已关闭:{players} 个玩家角色和 {bots} 个自定义种族机器人在重新开启前不会进入世界(没有补丁的游戏客户端看到它们会崩溃)。",
|
||||||
|
"races.purgeBots": "删除 {n} 个自定义种族的伙伴机器人",
|
||||||
|
"races.purged": "已删除 {n} 个自定义种族机器人。",
|
||||||
|
"realm.namesTitle": "服务器名称",
|
||||||
|
"realm.namesHint": "玩家在服务器列表中看到的名称。运行中的服务器会立即显示新名称,更新后也会保留。",
|
||||||
|
"realm.nameSave": "保存",
|
||||||
|
"realm.nameReset": "默认名称",
|
||||||
|
"realm.nameDefault": "默认:{name}",
|
||||||
|
"realm.nameSaved": "已保存。",
|
||||||
|
"realm.nameQuotes": "不能使用引号:游戏客户端用引号保存名称。",
|
||||||
"realm.profileLabel": "服务器",
|
"realm.profileLabel": "服务器",
|
||||||
"realm.switching": "正在切换服务器…",
|
"realm.switching": "正在切换服务器…",
|
||||||
"realm.rebornCreate": "创建 Warcraft Reborn 服务器",
|
"realm.rebornCreate": "创建 Warcraft Reborn 服务器",
|
||||||
|
|||||||
@@ -148,6 +148,16 @@
|
|||||||
"t": "Suchradius für Ziele",
|
"t": "Suchradius für Ziele",
|
||||||
"d": "Wie weit ein Bot innerhalb eines Zielgebiets nach Questzielen sucht."
|
"d": "Wie weit ein Bot innerhalb eines Zielgebiets nach Questzielen sucht."
|
||||||
},
|
},
|
||||||
|
"CoaBots.Scaling.Enable": {"t": "Stärkehilfe für Bots in Dungeons und Schlachtzügen", "d": "Hauptschalter für die Multiplikatoren unten. Bis du sie erhöhst, sind alle 1 (keine Änderung)."},
|
||||||
|
"CoaBots.Scaling.Dungeons": {"t": "Hilfe in 5-Spieler-Dungeons", "d": "Multiplikatoren anwenden, solange ein Bot in einem 5-Spieler-Dungeon ist."},
|
||||||
|
"CoaBots.Scaling.Raids": {"t": "Hilfe in Schlachtzügen", "d": "Multiplikatoren anwenden, solange ein Bot in einem Schlachtzug ist."},
|
||||||
|
"CoaBots.Scaling.Battlegrounds": {"t": "Hilfe in Schlachtfeldern und Arenen", "d": "Multiplikatoren in Schlachtfeldern und Arenen anwenden."},
|
||||||
|
"CoaBots.Scaling.World": {"t": "Hilfe in der offenen Welt", "d": "Multiplikatoren außerhalb von Dungeons und Schlachtzügen anwenden. Meist nicht gewünscht."},
|
||||||
|
"CoaBots.Scaling.DamageDone": {"t": "Schaden der Bots", "d": "Multipliziert den Schaden, den Bots und ihre Begleiter Kreaturen zufügen. 1 heißt keine Änderung; höher macht Inhalte leichter."},
|
||||||
|
"CoaBots.Scaling.HealingDone": {"t": "Heilung der Bots", "d": "Multipliziert die Heilung, die Bots wirken. 1 heißt keine Änderung."},
|
||||||
|
"CoaBots.Scaling.DamageTaken": {"t": "Schaden an Bots", "d": "Multipliziert den Schaden, den Kreaturen Bots zufügen. Unter 1 erleiden Bots weniger; 1 heißt keine Änderung."},
|
||||||
|
"CoaBots.Scaling.TankThreat": {"t": "Bedrohung der Tanks", "d": "Zusätzliche Bedrohung durch Bot-Tanks, damit sie die Aufmerksamkeit der Gegner halten. 1 heißt keine Änderung."},
|
||||||
|
"CoaBots.Scaling.BossTuning": {"t": "Zusatzhilfe gegen vier Bosse", "d": "Fügt stärkere Multiplikatoren für Loken, den Drakkari-Elementar, den Drakkari-Koloss und Gal'darah hinzu, die Bots der Stufe 60 sonst nicht besiegten. Zum Testen; standardmäßig aus."},
|
||||||
"CoaBots.WorldBrain.EngageRange": {
|
"CoaBots.WorldBrain.EngageRange": {
|
||||||
"t": "Angriffsentfernung",
|
"t": "Angriffsentfernung",
|
||||||
"d": "Entfernung, ab der ein Bot einen Quest-Gegner bekämpft."
|
"d": "Entfernung, ab der ein Bot einen Quest-Gegner bekämpft."
|
||||||
|
|||||||
@@ -148,6 +148,16 @@
|
|||||||
"t": "Radio de búsqueda de objetivos",
|
"t": "Radio de búsqueda de objetivos",
|
||||||
"d": "Hasta dónde examina un bot en busca de objetivos de misión dentro de una zona de objetivo."
|
"d": "Hasta dónde examina un bot en busca de objetivos de misión dentro de una zona de objetivo."
|
||||||
},
|
},
|
||||||
|
"CoaBots.Scaling.Enable": {"t": "Ayuda de fuerza para bots en mazmorras y bandas", "d": "Interruptor general de los multiplicadores de abajo. Hasta que los subas, todos valen 1 (sin cambios)."},
|
||||||
|
"CoaBots.Scaling.Dungeons": {"t": "Ayuda en mazmorras de 5 jugadores", "d": "Aplica los multiplicadores mientras un bot está en una mazmorra de 5 jugadores."},
|
||||||
|
"CoaBots.Scaling.Raids": {"t": "Ayuda en bandas", "d": "Aplica los multiplicadores mientras un bot está en una banda."},
|
||||||
|
"CoaBots.Scaling.Battlegrounds": {"t": "Ayuda en campos de batalla y arenas", "d": "Aplica los multiplicadores en campos de batalla y arenas."},
|
||||||
|
"CoaBots.Scaling.World": {"t": "Ayuda en el mundo abierto", "d": "Aplica los multiplicadores fuera de mazmorras y bandas. Normalmente no se desea."},
|
||||||
|
"CoaBots.Scaling.DamageDone": {"t": "Daño de los bots", "d": "Multiplica el daño que los bots y sus mascotas infligen a las criaturas. 1 no cambia nada; más alto facilita el contenido."},
|
||||||
|
"CoaBots.Scaling.HealingDone": {"t": "Curación de los bots", "d": "Multiplica la curación que lanzan los bots. 1 no cambia nada."},
|
||||||
|
"CoaBots.Scaling.DamageTaken": {"t": "Daño recibido por los bots", "d": "Multiplica el daño que las criaturas infligen a los bots. Por debajo de 1 los bots reciben menos; 1 no cambia nada."},
|
||||||
|
"CoaBots.Scaling.TankThreat": {"t": "Amenaza de los tanques", "d": "Amenaza extra que generan los tanques bot para mantener la atención de los enemigos. 1 no cambia nada."},
|
||||||
|
"CoaBots.Scaling.BossTuning": {"t": "Ayuda extra contra cuatro jefes", "d": "Añade multiplicadores más fuertes para Loken, el elemental drakkari, el coloso drakkari y Gal'darah, a quienes los bots de nivel 60 no vencían de otro modo. Para pruebas; desactivado por defecto."},
|
||||||
"CoaBots.WorldBrain.EngageRange": {
|
"CoaBots.WorldBrain.EngageRange": {
|
||||||
"t": "Distancia de enfrentamiento",
|
"t": "Distancia de enfrentamiento",
|
||||||
"d": "Distancia a la que un bot empieza a combatir a un monstruo de misión."
|
"d": "Distancia a la que un bot empieza a combatir a un monstruo de misión."
|
||||||
|
|||||||
@@ -148,6 +148,16 @@
|
|||||||
"t": "Rayon de recherche des cibles",
|
"t": "Rayon de recherche des cibles",
|
||||||
"d": "Jusqu’où un bot cherche des cibles de quête dans une zone d’objectif."
|
"d": "Jusqu’où un bot cherche des cibles de quête dans une zone d’objectif."
|
||||||
},
|
},
|
||||||
|
"CoaBots.Scaling.Enable": {"t": "Aide de puissance pour les bots en donjon et en raid", "d": "Interrupteur général des multiplicateurs ci-dessous. Tant que vous ne les augmentez pas, ils valent tous 1 (aucun changement)."},
|
||||||
|
"CoaBots.Scaling.Dungeons": {"t": "Aide en donjon à 5 joueurs", "d": "Applique les multiplicateurs tant qu'un bot est dans un donjon à 5 joueurs."},
|
||||||
|
"CoaBots.Scaling.Raids": {"t": "Aide en raid", "d": "Applique les multiplicateurs tant qu'un bot est dans un raid."},
|
||||||
|
"CoaBots.Scaling.Battlegrounds": {"t": "Aide en champ de bataille et en arène", "d": "Applique les multiplicateurs en champ de bataille et en arène."},
|
||||||
|
"CoaBots.Scaling.World": {"t": "Aide en monde ouvert", "d": "Applique les multiplicateurs hors des donjons et des raids. Rarement souhaité."},
|
||||||
|
"CoaBots.Scaling.DamageDone": {"t": "Dégâts des bots", "d": "Multiplie les dégâts que les bots et leurs familiers infligent aux créatures. 1 : aucun changement ; plus élevé = contenu plus facile."},
|
||||||
|
"CoaBots.Scaling.HealingDone": {"t": "Soins des bots", "d": "Multiplie les soins lancés par les bots. 1 : aucun changement."},
|
||||||
|
"CoaBots.Scaling.DamageTaken": {"t": "Dégâts subis par les bots", "d": "Multiplie les dégâts que les créatures infligent aux bots. Sous 1, les bots en subissent moins ; 1 : aucun changement."},
|
||||||
|
"CoaBots.Scaling.TankThreat": {"t": "Menace des tanks", "d": "Menace supplémentaire générée par les tanks bots, pour qu'ils gardent l'attention des ennemis. 1 : aucun changement."},
|
||||||
|
"CoaBots.Scaling.BossTuning": {"t": "Aide supplémentaire contre quatre boss", "d": "Ajoute des multiplicateurs plus forts pour Loken, l'élémentaire drakkari, le colosse drakkari et Gal'darah, que les bots de niveau 60 ne battaient pas autrement. Pour les tests ; désactivé par défaut."},
|
||||||
"CoaBots.WorldBrain.EngageRange": {
|
"CoaBots.WorldBrain.EngageRange": {
|
||||||
"t": "Distance d’engagement",
|
"t": "Distance d’engagement",
|
||||||
"d": "Distance à laquelle un bot commence à combattre un monstre de quête."
|
"d": "Distance à laquelle un bot commence à combattre un monstre de quête."
|
||||||
|
|||||||
@@ -148,6 +148,16 @@
|
|||||||
"t": "Радиус поиска целей",
|
"t": "Радиус поиска целей",
|
||||||
"d": "Как далеко бот высматривает цели заданий внутри области задачи."
|
"d": "Как далеко бот высматривает цели заданий внутри области задачи."
|
||||||
},
|
},
|
||||||
|
"CoaBots.Scaling.Enable": {"t": "Помощь ботам в подземельях и рейдах", "d": "Главный выключатель множителей ниже. Пока вы их не повысите, все равны 1 (без изменений)."},
|
||||||
|
"CoaBots.Scaling.Dungeons": {"t": "Помощь в подземельях на 5 человек", "d": "Применять множители, пока бот находится в подземелье на 5 человек."},
|
||||||
|
"CoaBots.Scaling.Raids": {"t": "Помощь в рейдах", "d": "Применять множители, пока бот находится в рейде."},
|
||||||
|
"CoaBots.Scaling.Battlegrounds": {"t": "Помощь на полях боя и аренах", "d": "Применять множители на полях боя и аренах."},
|
||||||
|
"CoaBots.Scaling.World": {"t": "Помощь в открытом мире", "d": "Применять множители вне подземелий и рейдов. Обычно не нужно."},
|
||||||
|
"CoaBots.Scaling.DamageDone": {"t": "Урон ботов", "d": "Умножает урон, который наносят существам боты и их питомцы. 1 — без изменений, больше — проще."},
|
||||||
|
"CoaBots.Scaling.HealingDone": {"t": "Лечение ботов", "d": "Умножает лечение, которое накладывают боты. 1 — без изменений."},
|
||||||
|
"CoaBots.Scaling.DamageTaken": {"t": "Урон по ботам", "d": "Умножает урон, который существа наносят ботам. Меньше 1 — боты получают меньше урона, 1 — без изменений."},
|
||||||
|
"CoaBots.Scaling.TankThreat": {"t": "Угроза танков", "d": "Дополнительная угроза от ботов-танков, чтобы они удерживали внимание врагов. 1 — без изменений."},
|
||||||
|
"CoaBots.Scaling.BossTuning": {"t": "Дополнительная помощь против четырёх боссов", "d": "Добавляет усиленные множители для Локена, элементаля Драккари, колосса Драккари и Гал'дараха, которых боты 60 уровня иначе не побеждали. Для тестов; по умолчанию выключено."},
|
||||||
"CoaBots.WorldBrain.EngageRange": {
|
"CoaBots.WorldBrain.EngageRange": {
|
||||||
"t": "Дистанция начала боя",
|
"t": "Дистанция начала боя",
|
||||||
"d": "Расстояние, на котором бот начинает бой с монстром из задания."
|
"d": "Расстояние, на котором бот начинает бой с монстром из задания."
|
||||||
|
|||||||
@@ -168,6 +168,16 @@
|
|||||||
"t": "任务目标搜索半径",
|
"t": "任务目标搜索半径",
|
||||||
"d": "机器人在目标区域内寻找任务怪或任务道具的扫描范围。"
|
"d": "机器人在目标区域内寻找任务怪或任务道具的扫描范围。"
|
||||||
},
|
},
|
||||||
|
"CoaBots.Scaling.Enable": {"t": "机器人在地下城和团队副本中的强度辅助", "d": "下方倍率的总开关。在你调高之前,所有倍率均为1(无变化)。"},
|
||||||
|
"CoaBots.Scaling.Dungeons": {"t": "5人地下城辅助", "d": "机器人处于5人地下城时应用倍率。"},
|
||||||
|
"CoaBots.Scaling.Raids": {"t": "团队副本辅助", "d": "机器人处于团队副本时应用倍率。"},
|
||||||
|
"CoaBots.Scaling.Battlegrounds": {"t": "战场与竞技场辅助", "d": "在战场和竞技场中应用倍率。"},
|
||||||
|
"CoaBots.Scaling.World": {"t": "野外辅助", "d": "在地下城和团队副本之外应用倍率。通常不需要。"},
|
||||||
|
"CoaBots.Scaling.DamageDone": {"t": "机器人伤害", "d": "倍乘机器人及其宠物对生物造成的伤害。1表示无变化;越高内容越容易。"},
|
||||||
|
"CoaBots.Scaling.HealingDone": {"t": "机器人治疗", "d": "倍乘机器人施放的治疗量。1表示无变化。"},
|
||||||
|
"CoaBots.Scaling.DamageTaken": {"t": "机器人受到的伤害", "d": "倍乘生物对机器人造成的伤害。低于1时机器人受到的伤害更少;1表示无变化。"},
|
||||||
|
"CoaBots.Scaling.TankThreat": {"t": "坦克仇恨", "d": "机器人坦克额外产生的仇恨,使其更容易吸引敌人注意。1表示无变化。"},
|
||||||
|
"CoaBots.Scaling.BossTuning": {"t": "针对四个首领的额外辅助", "d": "为洛肯、达卡莱元素、达卡莱巨像和加尔达拉添加更强的倍率,60级机器人否则无法击败他们。用于测试;默认关闭。"},
|
||||||
"CoaBots.WorldBrain.EngageRange": {
|
"CoaBots.WorldBrain.EngageRange": {
|
||||||
"t": "开战交战距离",
|
"t": "开战交战距离",
|
||||||
"d": "机器人发现任务目标怪并开始主动进入战斗的距离。"
|
"d": "机器人发现任务目标怪并开始主动进入战斗的距离。"
|
||||||
|
|||||||
+57
-6
@@ -54,9 +54,16 @@ export interface StatusView {
|
|||||||
observed: { mysql: ServiceStatus; auth: ServiceStatus; world: ServiceStatus; secondary_world?: ServiceStatus | null; reborn_world?: ServiceStatus | null };
|
observed: { mysql: ServiceStatus; auth: ServiceStatus; world: ServiceStatus; secondary_world?: ServiceStatus | null; reborn_world?: ServiceStatus | null };
|
||||||
busy: boolean;
|
busy: boolean;
|
||||||
path_exists: boolean;
|
path_exists: boolean;
|
||||||
|
scheduled_restart?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RealmMode = "coa" | "wildcard" | "reborn";
|
export type RealmMode = "coa" | "wildcard" | "reborn";
|
||||||
|
export interface CustomRaceCharacters { players: number; companionBots: number; squidBots: number }
|
||||||
|
export interface AddonView { id: string; name: string; description: Record<string, string>; author: string; license: string; needs: string | null; repo: string; size: number; installed: boolean; updateAvailable: boolean; foreignFolders: string[]; bundled?: string | null }
|
||||||
|
export interface RestartSchedule { enabled: boolean; time: string; warningMinutes: number }
|
||||||
|
export interface RestartScheduleView { schedule: RestartSchedule; supported: boolean }
|
||||||
|
export interface CustomMysql { text: string; applied: string }
|
||||||
|
export interface RealmName { id: number; name: string; defaultName: string; custom: boolean }
|
||||||
export interface RealmProfiles { active: RealmMode; wildcard_created: boolean; reborn_created: boolean; reborn_supported: boolean; supported: boolean; recovery_pending: boolean; simultaneous: boolean; secondary_world_port: number | null; secondary_running: boolean; with_reborn: boolean; reborn_world_port: number | null; reborn_running: boolean }
|
export interface RealmProfiles { active: RealmMode; wildcard_created: boolean; reborn_created: boolean; reborn_supported: boolean; supported: boolean; recovery_pending: boolean; simultaneous: boolean; secondary_world_port: number | null; secondary_running: boolean; with_reborn: boolean; reborn_world_port: number | null; reborn_running: boolean }
|
||||||
export interface DatabaseCheck {
|
export interface DatabaseCheck {
|
||||||
realm: RealmMode;
|
realm: RealmMode;
|
||||||
@@ -230,6 +237,7 @@ export interface ModuleView {
|
|||||||
/** not shown on the Modules page */
|
/** not shown on the Modules page */
|
||||||
hidden: boolean;
|
hidden: boolean;
|
||||||
compatibility?: "compatible" | "experimental" | "unsupported" | "requires-squid";
|
compatibility?: "compatible" | "experimental" | "unsupported" | "requires-squid";
|
||||||
|
part_of?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModuleSetting {
|
export interface ModuleSetting {
|
||||||
@@ -353,6 +361,16 @@ export interface CompanionSizes {
|
|||||||
sizes: { id: string; title: string; bots: number; warning: string | null }[];
|
sizes: { id: string; title: string; bots: number; warning: string | null }[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface WildcardArchetypeDto {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
roles: number;
|
||||||
|
primary_stat: number;
|
||||||
|
author: string;
|
||||||
|
difficulty: number;
|
||||||
|
category: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ClientInfo {
|
export interface ClientInfo {
|
||||||
path: string;
|
path: string;
|
||||||
executable: string;
|
executable: string;
|
||||||
@@ -486,6 +504,19 @@ export const api = {
|
|||||||
realmProfiles: (id: string) => invoke<RealmProfiles>("realm_profiles", { id }),
|
realmProfiles: (id: string) => invoke<RealmProfiles>("realm_profiles", { id }),
|
||||||
realmSelect: (id: string, mode: RealmMode, restart: boolean) => invoke<RealmProfiles>("realm_select", { id, mode, restart }),
|
realmSelect: (id: string, mode: RealmMode, restart: boolean) => invoke<RealmProfiles>("realm_select", { id, mode, restart }),
|
||||||
realmSimultaneous: (id: string, enabled: boolean) => invoke<RealmProfiles>("realm_simultaneous", { id, enabled }),
|
realmSimultaneous: (id: string, enabled: boolean) => invoke<RealmProfiles>("realm_simultaneous", { id, enabled }),
|
||||||
|
customRaceCharacters: (id: string) => invoke<CustomRaceCharacters | null>("custom_race_characters", { id }),
|
||||||
|
purgeCustomRaceBots: (id: string) => invoke<number>("purge_custom_race_bots", { id }),
|
||||||
|
addonsList: (id: string) => invoke<AddonView[]>("addons_list", { id }),
|
||||||
|
addonsInstall: (id: string, addon: string) => invoke<AddonView[]>("addons_install", { id, addon }),
|
||||||
|
addonsRemove: (id: string, addon: string) => invoke<AddonView[]>("addons_remove", { id, addon }),
|
||||||
|
clearGameCacheOnPlay: () => invoke<boolean>("clear_game_cache_on_play"),
|
||||||
|
setClearGameCacheOnPlay: (enabled: boolean) => invoke<void>("set_clear_game_cache_on_play", { enabled }),
|
||||||
|
restartSchedule: (id: string) => invoke<RestartScheduleView>("restart_schedule", { id }),
|
||||||
|
restartScheduleSave: (id: string, schedule: RestartSchedule) => invoke<RestartScheduleView>("restart_schedule_save", { id, schedule }),
|
||||||
|
mysqlCustom: (id: string) => invoke<CustomMysql>("mysql_custom", { id }),
|
||||||
|
mysqlCustomSave: (id: string, text: string) => invoke<CustomMysql>("mysql_custom_save", { id, text }),
|
||||||
|
realmNames: (id: string) => invoke<RealmName[]>("realm_names", { id }),
|
||||||
|
realmRename: (id: string, realmId: number, name: string | null) => invoke<RealmName[]>("realm_rename", { id, realmId, name }),
|
||||||
realmWithReborn: (id: string, enabled: boolean) => invoke<RealmProfiles>("realm_with_reborn", { id, enabled }),
|
realmWithReborn: (id: string, enabled: boolean) => invoke<RealmProfiles>("realm_with_reborn", { id, enabled }),
|
||||||
checkDatabase: (id: string) => invoke<DatabaseCheck[]>("check_database", { id }),
|
checkDatabase: (id: string) => invoke<DatabaseCheck[]>("check_database", { id }),
|
||||||
repairServer: (id: string) => invoke<RepairReport>("repair_server", { id }),
|
repairServer: (id: string) => invoke<RepairReport>("repair_server", { id }),
|
||||||
@@ -553,15 +584,35 @@ export const api = {
|
|||||||
invoke<{ txn: UpdateTxn; preexisting_character_count?: number }>("apply_update", { id, source: source ?? null, resolutions }),
|
invoke<{ txn: UpdateTxn; preexisting_character_count?: number }>("apply_update", { id, source: source ?? null, resolutions }),
|
||||||
rollbackUpdate: (id: string, txn: string) => invoke<UpdateTxn>("rollback_update", { id, txn }),
|
rollbackUpdate: (id: string, txn: string) => invoke<UpdateTxn>("rollback_update", { id, txn }),
|
||||||
retryUpdateValidation: (id: string, txn: string) => invoke<UpdateTxn>("retry_update_validation", { id, txn }),
|
retryUpdateValidation: (id: string, txn: string) => invoke<UpdateTxn>("retry_update_validation", { id, txn }),
|
||||||
population: (id: string) => invoke<Population | null>("get_population", { id }),
|
population: (id: string, realm?: RealmMode) => invoke<Population | null>("get_population", { id, realm: realm ?? null }),
|
||||||
stopSpawning: (id: string) => invoke<{ count: number }>("companions_stop_spawning", { id }),
|
stopSpawning: (id: string, realm?: RealmMode) => invoke<{ count: number }>("companions_stop_spawning", { id, realm: realm ?? null }),
|
||||||
takeOffline: (id: string) => invoke<{ count: number }>("companions_take_offline", { id }),
|
takeOffline: (id: string, realm?: RealmMode) => invoke<{ count: number }>("companions_take_offline", { id, realm: realm ?? null }),
|
||||||
despawnSome: (id: string, count: number) => invoke<{ count: number }>("companions_despawn_some", { id, count }),
|
despawnSome: (id: string, count: number, realm?: RealmMode) => invoke<{ count: number }>("companions_despawn_some", { id, count, realm: realm ?? null }),
|
||||||
deleteAllCompanions: (id: string) => invoke<{ count: number }>("companions_delete_all", { id }),
|
deleteAllCompanions: (id: string, realm?: RealmMode) => invoke<{ count: number }>("companions_delete_all", { id, realm: realm ?? null }),
|
||||||
|
loginAllCompanions: (id: string, realm?: RealmMode) => invoke<string>("companions_login_all", { id, realm: realm ?? null }),
|
||||||
|
spawnBotFleet: (id: string, race: number, level: number, realm?: RealmMode) => invoke<string>("companions_spawn_fleet", { id, race, level, realm: realm ?? null }),
|
||||||
openLink: (url: string) => invoke<void>("open_link", { url }),
|
openLink: (url: string) => invoke<void>("open_link", { url }),
|
||||||
performance: (id: string) => invoke<Performance | null>("get_performance", { id }),
|
performance: (id: string) => invoke<Performance | null>("get_performance", { id }),
|
||||||
companionSizes: () => invoke<CompanionSizes>("companion_sizes"),
|
companionSizes: () => invoke<CompanionSizes>("companion_sizes"),
|
||||||
addCompanions: (id: string, count: number) => invoke<{ spawned: string | null; created: number | null; baseline: number | null }>("add_companions", { id, count }),
|
addCompanions: (
|
||||||
|
id: string,
|
||||||
|
count: number,
|
||||||
|
realm?: RealmMode,
|
||||||
|
level?: number,
|
||||||
|
classId?: number,
|
||||||
|
specId?: number,
|
||||||
|
archetype?: string
|
||||||
|
) =>
|
||||||
|
invoke<{ spawned: string | null; created: number | null; baseline: number | null }>("add_companions", {
|
||||||
|
id,
|
||||||
|
count,
|
||||||
|
realm: realm ?? null,
|
||||||
|
level: level ?? null,
|
||||||
|
class_id: classId ?? null,
|
||||||
|
spec_id: specId ?? null,
|
||||||
|
archetype: archetype ?? null,
|
||||||
|
}),
|
||||||
|
getWildcardArchetypes: (id: string) => invoke<WildcardArchetypeDto[]>("get_wildcard_archetypes", { id }),
|
||||||
clientGraphics: (id: string) => invoke<{ dxvk_disabled: boolean; enhancements_disabled: boolean }>("client_graphics", { id }),
|
clientGraphics: (id: string) => invoke<{ dxvk_disabled: boolean; enhancements_disabled: boolean }>("client_graphics", { id }),
|
||||||
clientSetGraphics: (id: string, name: string, disabled: boolean) => invoke<{ dxvk_disabled: boolean; enhancements_disabled: boolean }>("client_set_graphics", { id, name, disabled }),
|
clientSetGraphics: (id: string, name: string, disabled: boolean) => invoke<{ dxvk_disabled: boolean; enhancements_disabled: boolean }>("client_set_graphics", { id, name, disabled }),
|
||||||
clientInfo: (id: string) => invoke<ClientInfo | null>("client_info", { id }),
|
clientInfo: (id: string) => invoke<ClientInfo | null>("client_info", { id }),
|
||||||
|
|||||||
@@ -97,6 +97,14 @@ for (const [key, title, desc] of [
|
|||||||
] as [string, string[], string[]][]) add(`Enchanter.${key}`, "int", title, desc, { min: 0, advanced: true });
|
] as [string, string[], string[]][]) add(`Enchanter.${key}`, "int", title, desc, { min: 0, advanced: true });
|
||||||
for (let n = 1; n <= 3; n++) add(`EC.P${n}`, "string", [`NPC phrase ${n}`, `Реплика НПС ${n}`, `NPC-Satz ${n}`, `Phrase du PNJ ${n}`, `Frase del PNJ ${n}`, `NPC台词 ${n}`], ["Text spoken by the NPC. Keep the enclosing quotes.", "Текст реплики НПС. Сохраните кавычки вокруг текста.", "Gesprochener Text. Anführungszeichen beibehalten.", "Texte prononcé. Conservez les guillemets.", "Texto hablado. Conserva las comillas.", "NPC发言内容,请保留外层引号。"], { advanced: true });
|
for (let n = 1; n <= 3; n++) add(`EC.P${n}`, "string", [`NPC phrase ${n}`, `Реплика НПС ${n}`, `NPC-Satz ${n}`, `Phrase du PNJ ${n}`, `Frase del PNJ ${n}`, `NPC台词 ${n}`], ["Text spoken by the NPC. Keep the enclosing quotes.", "Текст реплики НПС. Сохраните кавычки вокруг текста.", "Gesprochener Text. Anführungszeichen beibehalten.", "Texte prononcé. Conservez les guillemets.", "Texto hablado. Conserva las comillas.", "NPC发言内容,请保留外层引号。"], { advanced: true });
|
||||||
|
|
||||||
|
add("Subclass.ThinHuman.Enable", "bool", ["Thin Twins race", "Раса «Хрупкие близнецы»", "Volk der Dünnen Zwillinge", "Race des Jumeaux maigres", "Raza de los Gemelos delgados", "瘦弱双子种族"], ["Off refuses new characters of this race; existing ones lose the brother and any subclass at their next login.", "Выключено — новых персонажей этой расы создать нельзя; у существующих при следующем входе пропадают брат и подкласс.", "Aus verweigert neue Figuren dieses Volkes; vorhandene verlieren beim nächsten Login den Bruder und eine Unterklasse.", "Désactivé refuse les nouveaux personnages de cette race ; les existants perdent le frère et la sous-classe à la prochaine connexion.", "Desactivado rechaza personajes nuevos de esta raza; los existentes pierden al hermano y la subclase al volver a entrar.", "关闭后不能创建此种族的新角色;现有角色在下次登录时失去兄弟和副职业。"]);
|
||||||
|
add("Subclass.TwoHeadedOgre.Enable", "bool", ["Two-Headed Ogre race", "Раса «Двуглавый огр»", "Volk der Zweiköpfigen Oger", "Race de l'Ogre à deux têtes", "Raza del Ogro de dos cabezas", "双头食人魔种族"], ["Off refuses new characters of this race; existing ones lose the second head and any subclass at their next login.", "Выключено — новых персонажей этой расы создать нельзя; у существующих при следующем входе пропадают вторая голова и подкласс.", "Aus verweigert neue Figuren dieses Volkes; vorhandene verlieren beim nächsten Login den zweiten Kopf und eine Unterklasse.", "Désactivé refuse les nouveaux personnages de cette race ; les existants perdent la seconde tête et la sous-classe à la prochaine connexion.", "Desactivado rechaza personajes nuevos de esta raza; los existentes pierden la segunda cabeza y la subclase al volver a entrar.", "关闭后不能创建此种族的新角色;现有角色在下次登录时失去第二个头和副职业。"]);
|
||||||
|
add("Subclass.TwoPlayers.Enable", "bool", ["Two players, one character", "Два игрока на одного персонажа", "Zwei Spieler, eine Figur", "Deux joueurs, un personnage", "Dos jugadores, un personaje", "两名玩家共用一个角色"], ["Two players share one Two-Headed Ogre or one pair of Twins. Off: no new pairs, and existing pairs play as single characters.", "Два игрока делят одного Двуглавого огра или пару близнецов. Выключено — новых пар нет, существующие играют как обычные персонажи.", "Zwei Spieler teilen sich einen Zweiköpfigen Oger oder ein Zwillingspaar. Aus: keine neuen Paare, bestehende spielen als einzelne Figuren.", "Deux joueurs partagent un Ogre à deux têtes ou une paire de Jumeaux. Désactivé : plus de nouvelles paires, les existantes jouent en solo.", "Dos jugadores comparten un Ogro de dos cabezas o una pareja de Gemelos. Desactivado: no hay parejas nuevas y las existentes juegan por separado.", "两名玩家共用一个双头食人魔或一对双子。关闭后不能组成新配对,现有配对按单人角色游戏。"]);
|
||||||
|
add("Subclass.MinLevel", "int", ["Subclass from level", "Подкласс с уровня", "Unterklasse ab Stufe", "Sous-classe dès le niveau", "Subclase desde el nivel", "副职业开放等级"], ["The level from which the borrowed class trees open.", "Уровень, с которого открываются деревья второго класса.", "Stufe, ab der die geliehenen Klassenbäume öffnen.", "Niveau à partir duquel les arbres de la classe empruntée s'ouvrent.", "Nivel a partir del cual se abren los árboles de la clase prestada.", "借用职业天赋树开放的等级。"], {"min": 1, "max": 80});
|
||||||
|
add("Subclass.StandardClasses", "bool", ["Offer standard classes as subclass", "Стандартные классы как подкласс", "Standardklassen als Unterklasse", "Classes standard en sous-classe", "Clases estándar como subclase", "提供标准职业作为副职业"], ["Class trainers also offer Warrior ... Druid as the subclass. Off keeps CoA classes only.", "Учителя классов предлагают как подкласс и Воина … Друида. Выключено — только классы CoA.", "Klassenlehrer bieten auch Krieger … Druide als Unterklasse an. Aus: nur CoA-Klassen.", "Les maîtres de classe proposent aussi Guerrier … Druide en sous-classe. Désactivé : classes CoA seulement.", "Los instructores también ofrecen Guerrero … Druida como subclase. Desactivado: solo clases de CoA.", "职业训练师也提供战士……德鲁伊作为副职业。关闭则仅限 CoA 职业。"], {"advanced": true});
|
||||||
|
add("Subclass.StandardMains", "bool", ["Standard classes at character creation", "Стандартные классы при создании", "Standardklassen bei der Erstellung", "Classes standard à la création", "Clases estándar al crear", "创建角色时提供标准职业"], ["Open Warrior ... Druid on the creation screen of a CoA realm for races with start data.", "Открывает Воина … Друида на экране создания в реалме CoA для рас со стартовыми данными.", "Öffnet Krieger … Druide im Erstellungsbildschirm eines CoA-Realms für Völker mit Startdaten.", "Ouvre Guerrier … Druide à la création sur un royaume CoA pour les races ayant des données de départ.", "Abre Guerrero … Druida en la creación de un reino CoA para razas con datos de inicio.", "在 CoA 服务器的创建界面为有起始数据的种族开放战士……德鲁伊。"], {"advanced": true});
|
||||||
|
add("Subclass.HeroRaces.RequiredLevel", "int", ["Hero Races need a character of level", "Героические расы: нужен персонаж уровня", "Heldenvölker brauchen eine Figur der Stufe", "Races héroïques : personnage requis de niveau", "Razas heroicas: personaje necesario de nivel", "英雄种族需要的角色等级"], ["Like the Death Knight, the Thin Twins and the Two-Headed Ogre need a character of this level on the account first. 0 removes the requirement.", "Как для рыцаря смерти: Хрупким близнецам и Двуглавому огру нужен персонаж этого уровня на аккаунте. 0 — без условия.", "Wie beim Todesritter brauchen die Dünnen Zwillinge und die Zweiköpfige Ogerin zuerst eine Figur dieser Stufe auf dem Konto. 0 hebt die Bedingung auf.", "Comme le chevalier de la mort, les Jumeaux maigres et l'Ogre à deux têtes exigent d'abord un personnage de ce niveau sur le compte. 0 supprime la condition.", "Como el caballero de la muerte, los Gemelos delgados y el Ogro de dos cabezas necesitan antes un personaje de este nivel en la cuenta. 0 quita el requisito.", "与死亡骑士一样,瘦弱双子和双头食人魔需要账号中先有此等级的角色。0 表示无要求。"], {"min": 0, "max": 80});
|
||||||
|
add("DevMenu.MinSecurity", "enum", ["Who may use /dev", "Кому доступно /dev", "Wer /dev nutzen darf", "Qui peut utiliser /dev", "Quién puede usar /dev", "谁可以使用 /dev"], ["The lowest account security level allowed to open the menu.", "Минимальный уровень прав аккаунта, которому доступно меню.", "Niedrigste Kontosicherheitsstufe, die das Menü öffnen darf.", "Niveau de sécurité de compte minimal autorisé à ouvrir le menu.", "Nivel de seguridad mínimo de la cuenta para abrir el menú.", "可打开该菜单的最低账号权限等级。"], {"options": [{"value": "2", "label": ["Game masters", "Гейм-мастера", "Spielleiter", "Maîtres du jeu", "Másteres", "游戏管理员"]}, {"value": "3", "label": ["Administrators", "Администраторы", "Administratoren", "Administrateurs", "Administradores", "管理员"]}]});
|
||||||
add("CoACustomRaces.BotsEnable", "bool",
|
add("CoACustomRaces.BotsEnable", "bool",
|
||||||
["Bots can be custom races", "Боты кастомных рас", "Bots benutzerdefinierter Völker", "Bots de races personnalisées", "Bots de razas personalizadas", "允许机器人为自定义种族"],
|
["Bots can be custom races", "Боты кастомных рас", "Bots benutzerdefinierter Völker", "Bots de races personnalisées", "Bots de razas personalizadas", "允许机器人为自定义种族"],
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { ExternalLink, Loader2 } from "lucide-react";
|
||||||
|
import { api, asUiError, type AddonView, type ClientInfo } from "@/lib/api";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { useI18n } from "@/i18n";
|
||||||
|
|
||||||
|
function megabytes(bytes: number): string {
|
||||||
|
return (bytes / 1024 / 1024).toFixed(bytes < 10 * 1024 * 1024 ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Addons from the Manager's catalog: each pinned to a commit of its author's repository and checked file by file. */
|
||||||
|
export function AddonCatalog({ serverId, companions, onCompanionsInstalled }: { serverId: string; companions?: ClientInfo["addon"] | null; onCompanionsInstalled?: () => void }) {
|
||||||
|
const { t, locale } = useI18n();
|
||||||
|
const [addons, setAddons] = useState<AddonView[] | null>(null);
|
||||||
|
const [working, setWorking] = useState<string | null>(null);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let alive = true;
|
||||||
|
void api.addonsList(serverId).then(list => { if (alive) setAddons(list); }).catch(e => { if (alive) setError(asUiError(e).technical); });
|
||||||
|
return () => { alive = false; };
|
||||||
|
}, [serverId]);
|
||||||
|
|
||||||
|
async function run(id: string, action: "install" | "remove") {
|
||||||
|
setWorking(id); setError(null);
|
||||||
|
try { setAddons(await (action === "install" ? api.addonsInstall : api.addonsRemove)(serverId, id)); }
|
||||||
|
catch (e) { setError(asUiError(e).technical); }
|
||||||
|
finally { setWorking(null); }
|
||||||
|
}
|
||||||
|
|
||||||
|
async function installCompanions() {
|
||||||
|
setWorking("coa-companions"); setError(null);
|
||||||
|
try { await api.installAddon(serverId); onCompanionsInstalled?.(); }
|
||||||
|
catch (e) { setError(asUiError(e).technical); }
|
||||||
|
finally { setWorking(null); }
|
||||||
|
}
|
||||||
|
|
||||||
|
return <div className="mt-5 border-t border-line pt-4">
|
||||||
|
<h3 className="text-sm font-semibold">{t("addons.title")}</h3>
|
||||||
|
<p className="mt-1 text-xs text-muted">{t("addons.hint")}</p>
|
||||||
|
<ul className="mt-3 space-y-3">
|
||||||
|
{companions && <li className="rounded-md border border-line p-3">
|
||||||
|
<div className="flex flex-wrap items-center gap-2">
|
||||||
|
<span className="font-medium">CoA Companions (CoABotUI)</span>
|
||||||
|
{companions.installed && companions.up_to_date !== false && <span className="text-xs text-ok">{companions.version ? t("client.installedVersion", { v: companions.version }) : t("addons.installed")}</span>}
|
||||||
|
{companions.up_to_date === false && <span className="text-xs text-warn">{t("addons.update")}</span>}
|
||||||
|
</div>
|
||||||
|
<p className="mt-1 text-sm text-muted">{t("client.addonWhat")}</p>
|
||||||
|
<p className="mt-1 text-xs text-muted">{t("addons.withServer")}</p>
|
||||||
|
{(!companions.installed || companions.up_to_date === false) && <div className="mt-2"><Button size="sm" disabled={working !== null} onClick={() => void installCompanions()}>
|
||||||
|
{working === "coa-companions" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
||||||
|
{companions.installed ? t("addons.doUpdate") : t("addons.doInstall")}
|
||||||
|
</Button></div>}
|
||||||
|
</li>}
|
||||||
|
{addons?.map(a => <li key={a.id} className="rounded-md border border-line p-3">
|
||||||
|
<div className="flex flex-wrap items-center gap-2">
|
||||||
|
<span className="font-medium">{a.name}</span>
|
||||||
|
<span className="text-xs text-muted">{t("addons.by", { author: a.author })}{a.size > 0 ? ` · ${megabytes(a.size)} MB` : ""}</span>
|
||||||
|
{a.installed && !a.updateAvailable && <span className="text-xs text-ok">{t("addons.installed")}</span>}
|
||||||
|
{a.updateAvailable && <span className="text-xs text-warn">{t("addons.update")}</span>}
|
||||||
|
<button type="button" className="ml-auto text-muted hover:text-ink" title={a.repo} aria-label={`GitHub: ${a.name}`} onClick={() => void api.openLink(a.repo)}><ExternalLink className="h-4 w-4" aria-hidden /></button>
|
||||||
|
</div>
|
||||||
|
<p className="mt-1 text-sm text-muted">{a.description[locale] ?? a.description.en}</p>
|
||||||
|
{a.needs === "playerbots" && <p className="mt-1 text-xs text-muted">{t("addons.needsSquid")}</p>}
|
||||||
|
{a.bundled === "custom-races" && <p className="mt-1 text-xs text-muted">{a.installed ? t("addons.withRaces") : t("addons.withRacesMissing")}</p>}
|
||||||
|
{a.foreignFolders.length > 0 && !a.installed && <p className="mt-1 text-xs text-warn">{t("addons.foreign", { folders: a.foreignFolders.join(", ") })}</p>}
|
||||||
|
{!a.bundled && <div className="mt-2 flex gap-2">
|
||||||
|
{(!a.installed || a.updateAvailable) && <Button size="sm" disabled={working !== null} onClick={() => void run(a.id, "install")}>
|
||||||
|
{working === a.id && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
||||||
|
{a.updateAvailable ? t("addons.doUpdate") : t("addons.doInstall")}
|
||||||
|
</Button>}
|
||||||
|
{a.installed && <Button size="sm" variant="ghost" disabled={working !== null} onClick={() => void run(a.id, "remove")}>{t("addons.doRemove")}</Button>}
|
||||||
|
</div>}
|
||||||
|
</li>)}
|
||||||
|
</ul>
|
||||||
|
{error && <p className="mt-2 text-sm text-bad" role="alert">{error}</p>}
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import { open } from "@tauri-apps/plugin-dialog";
|
|||||||
import { api, asUiError, type ClientInfo, type ClientStatus, type UiError } from "@/lib/api";
|
import { api, asUiError, type ClientInfo, type ClientStatus, type UiError } from "@/lib/api";
|
||||||
import { checkClient } from "@/lib/clientUpdate";
|
import { checkClient } from "@/lib/clientUpdate";
|
||||||
import { ClientGraphics } from "./ClientGraphics";
|
import { ClientGraphics } from "./ClientGraphics";
|
||||||
|
import { AddonCatalog } from "./AddonCatalog";
|
||||||
import { ClientDialog, type ClientDialogMode } from "@/screens/ClientDialog";
|
import { ClientDialog, type ClientDialogMode } from "@/screens/ClientDialog";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
@@ -85,18 +86,11 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
|
|||||||
: t("client.versionUntracked")}
|
: t("client.versionUntracked")}
|
||||||
{status?.update_available && <span className="ml-2 text-warn">{t("client.updateAvailable")}</span>}
|
{status?.update_available && <span className="ml-2 text-warn">{t("client.updateAvailable")}</span>}
|
||||||
</dd>
|
</dd>
|
||||||
{!remote && <>
|
|
||||||
<dt className="text-muted">{t("client.addon")}</dt>
|
|
||||||
<dd>
|
|
||||||
{info.addon.installed ? (info.addon.version ? t("client.installedVersion", { v: info.addon.version }) : t("client.installed")) : t("client.addonNotInstalled")}
|
|
||||||
{info.addon.up_to_date === false && <span className="ml-2 text-warn">{t("client.updateAvailable")}</span>}
|
|
||||||
<span className="mt-1 block text-xs text-muted">{t("client.addonWhat")}</span>
|
|
||||||
</dd>
|
|
||||||
</>}
|
|
||||||
<dt className="text-muted">{t("client.otherAddons")}</dt>
|
<dt className="text-muted">{t("client.otherAddons")}</dt>
|
||||||
<dd>{t("client.leftAsIs", { n: info.other_addons })}</dd>
|
<dd>{t("client.leftAsIs", { n: info.other_addons })}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<ClientGraphics key={info.path} serverId={serverId} />
|
<ClientGraphics key={info.path} serverId={serverId} />
|
||||||
|
<AddonCatalog key={"addons-" + info.path} serverId={serverId} companions={remote ? null : info.addon} onCompanionsInstalled={() => void refresh()} />
|
||||||
{!remote && (
|
{!remote && (
|
||||||
<label className="mt-4 flex cursor-pointer items-center gap-2 text-sm">
|
<label className="mt-4 flex cursor-pointer items-center gap-2 text-sm">
|
||||||
<input type="checkbox" checked={playAfter} onChange={(e) => setPlayAfter(e.target.checked)} className="h-4 w-4 accent-[#c9a24a]" />
|
<input type="checkbox" checked={playAfter} onChange={(e) => setPlayAfter(e.target.checked)} className="h-4 w-4 accent-[#c9a24a]" />
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ export function ClientGraphics({ serverId }: { serverId: string }) {
|
|||||||
const [busy, setBusy] = useState(false);
|
const [busy, setBusy] = useState(false);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
useEffect(() => { void api.clientGraphics(serverId).then(setState).catch(e => setError(asUiError(e).technical)); }, [serverId]);
|
useEffect(() => { void api.clientGraphics(serverId).then(setState).catch(e => setError(asUiError(e).technical)); }, [serverId]);
|
||||||
|
const [clearCache, setClearCache] = useState<boolean | null>(null);
|
||||||
|
useEffect(() => { void api.clearGameCacheOnPlay().then(setClearCache).catch(() => setClearCache(true)); }, []);
|
||||||
|
async function changeClearCache(on: boolean) {
|
||||||
|
setClearCache(on);
|
||||||
|
try { await api.setClearGameCacheOnPlay(on); } catch (e) { setClearCache(!on); setError(asUiError(e).technical); }
|
||||||
|
}
|
||||||
async function change(name: string, disabled: boolean) {
|
async function change(name: string, disabled: boolean) {
|
||||||
setBusy(true); setError(null);
|
setBusy(true); setError(null);
|
||||||
try { setState(await api.clientSetGraphics(serverId, name, disabled)); await checkClient(serverId); }
|
try { setState(await api.clientSetGraphics(serverId, name, disabled)); await checkClient(serverId); }
|
||||||
@@ -19,6 +25,8 @@ export function ClientGraphics({ serverId }: { serverId: string }) {
|
|||||||
<label className="flex items-center gap-2 text-sm"><input type="checkbox" checked={state?.dxvk_disabled ?? false} disabled={!state || busy} onChange={e => void change("d3d9.dll", e.target.checked)} />{t("client.graphics.dxvk")}</label>
|
<label className="flex items-center gap-2 text-sm"><input type="checkbox" checked={state?.dxvk_disabled ?? false} disabled={!state || busy} onChange={e => void change("d3d9.dll", e.target.checked)} />{t("client.graphics.dxvk")}</label>
|
||||||
<label className="flex items-center gap-2 text-sm"><input type="checkbox" checked={state?.enhancements_disabled ?? false} disabled={!state || busy} onChange={e => void change("dxgi.dll", e.target.checked)} />{t("client.graphics.enhancements")}</label>
|
<label className="flex items-center gap-2 text-sm"><input type="checkbox" checked={state?.enhancements_disabled ?? false} disabled={!state || busy} onChange={e => void change("dxgi.dll", e.target.checked)} />{t("client.graphics.enhancements")}</label>
|
||||||
<p className="text-xs text-muted">{t("client.graphics.hint")}</p>
|
<p className="text-xs text-muted">{t("client.graphics.hint")}</p>
|
||||||
|
<label className="flex items-center gap-2 text-sm"><input type="checkbox" checked={clearCache ?? true} disabled={clearCache === null} onChange={e => void changeClearCache(e.target.checked)} />{t("client.clearCache")}</label>
|
||||||
|
<p className="text-xs text-muted">{t("client.clearCacheHint")}</p>
|
||||||
{error && <p className="text-sm text-bad" role="alert">{error}</p>}
|
{error && <p className="text-sm text-bad" role="alert">{error}</p>}
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
+712
-159
@@ -1,30 +1,125 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Loader2 } from "lucide-react";
|
import {
|
||||||
import { api, asUiError, type CompanionSizes, type Population, type UiError } from "@/lib/api";
|
Loader2,
|
||||||
|
Bot,
|
||||||
|
CheckCircle2,
|
||||||
|
AlertCircle,
|
||||||
|
RefreshCw,
|
||||||
|
Power,
|
||||||
|
Users,
|
||||||
|
Database,
|
||||||
|
} from "lucide-react";
|
||||||
|
import {
|
||||||
|
api,
|
||||||
|
asUiError,
|
||||||
|
type Population,
|
||||||
|
type RealmMode,
|
||||||
|
type RealmProfiles,
|
||||||
|
type UiError,
|
||||||
|
type WildcardArchetypeDto,
|
||||||
|
} from "@/lib/api";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
import { hasKey, useHuman, useT, type Key } from "@/i18n";
|
import { useHuman, useT } from "@/i18n";
|
||||||
|
|
||||||
|
function formatRole(roles: number): string {
|
||||||
|
const parts: string[] = [];
|
||||||
|
if (roles & 1) parts.push("Tank");
|
||||||
|
if (roles & 2) parts.push("Melee");
|
||||||
|
if (roles & 4) parts.push("Ranged");
|
||||||
|
if (roles & 8) parts.push("Healer");
|
||||||
|
return parts.join("/") || "DPS";
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatStat(stat: number): string {
|
||||||
|
switch (stat) {
|
||||||
|
case 0: return "Strength";
|
||||||
|
case 1: return "Agility";
|
||||||
|
case 2: return "Stamina";
|
||||||
|
case 3: return "Intellect";
|
||||||
|
case 4: return "Spirit";
|
||||||
|
default: return "All";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function CompanionsCard({ serverId }: { serverId: string }) {
|
export function CompanionsCard({ serverId }: { serverId: string }) {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
const human = useHuman();
|
const human = useHuman();
|
||||||
const [sizes, setSizes] = useState<CompanionSizes | null>(null);
|
|
||||||
|
// Realm & Environment state
|
||||||
|
const [profiles, setProfiles] = useState<RealmProfiles | null>(null);
|
||||||
|
const [selectedRealm, setSelectedRealm] = useState<RealmMode>("coa");
|
||||||
const [pop, setPop] = useState<Population | null>(null);
|
const [pop, setPop] = useState<Population | null>(null);
|
||||||
const [running, setRunning] = useState(false);
|
const [running, setRunning] = useState(false);
|
||||||
const [choice, setChoice] = useState<string>("small");
|
|
||||||
const [custom, setCustom] = useState("100");
|
// Fleet Configuration state
|
||||||
|
const [spawnMode, setSpawnMode] = useState<"population" | "fleet">("population");
|
||||||
|
const [countChoice, setCountChoice] = useState<string>("50");
|
||||||
|
const [customCount, setCustomCount] = useState<string>("50");
|
||||||
|
const [targetLevel, setTargetLevel] = useState<number>(80);
|
||||||
|
const [selectedClass, setSelectedClass] = useState<string>("all");
|
||||||
|
const [selectedRole, setSelectedRole] = useState<string>("all");
|
||||||
|
const [selectedArchetype, setSelectedArchetype] = useState<string>("all");
|
||||||
|
const [wildcardArchetypes, setWildcardArchetypes] = useState<WildcardArchetypeDto[]>([]);
|
||||||
|
|
||||||
|
// Operational state
|
||||||
const [busy, setBusy] = useState(false);
|
const [busy, setBusy] = useState(false);
|
||||||
const [error, setError] = useState<UiError | null>(null);
|
const [error, setError] = useState<UiError | null>(null);
|
||||||
const [note, setNote] = useState<string | null>(null);
|
const [note, setNote] = useState<string | null>(null);
|
||||||
// Start-up login: how many existing bots the server brings online by itself every time it starts.
|
const [job, setJob] = useState<{ baseline: number; target: number; since: number } | null>(null);
|
||||||
|
|
||||||
|
// Startup Auto-Login settings
|
||||||
const [autoOn, setAutoOn] = useState(true);
|
const [autoOn, setAutoOn] = useState(true);
|
||||||
const [autoMax, setAutoMax] = useState("");
|
const [autoMax, setAutoMax] = useState("");
|
||||||
// A creation that is still in progress on the running server: how many existed before and how many were asked for.
|
|
||||||
const [job, setJob] = useState<{ baseline: number; target: number; since: number } | null>(null);
|
|
||||||
const [startNote, setStartNote] = useState<string | null>(null);
|
const [startNote, setStartNote] = useState<string | null>(null);
|
||||||
const [startBusy, setStartBusy] = useState(false);
|
const [startBusy, setStartBusy] = useState(false);
|
||||||
const [despawnN, setDespawnN] = useState("10");
|
const [despawnN, setDespawnN] = useState("10");
|
||||||
|
|
||||||
|
const activeServerRealm = profiles?.active ?? "coa";
|
||||||
|
const isViewingActiveRealm = selectedRealm === activeServerRealm;
|
||||||
|
const isRealmOperational = isViewingActiveRealm || running;
|
||||||
|
|
||||||
|
const maxLevelForRealm = 60;
|
||||||
|
|
||||||
|
// Load realm profiles
|
||||||
|
const loadProfiles = async () => {
|
||||||
|
try {
|
||||||
|
const r = await api.realmProfiles(serverId);
|
||||||
|
setProfiles(r);
|
||||||
|
if (!selectedRealm) {
|
||||||
|
setSelectedRealm(r.active);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
void loadProfiles();
|
||||||
|
}, [serverId]);
|
||||||
|
|
||||||
|
// Adjust target level if realm changed
|
||||||
|
useEffect(() => {
|
||||||
|
if (targetLevel > maxLevelForRealm) {
|
||||||
|
setTargetLevel(maxLevelForRealm);
|
||||||
|
}
|
||||||
|
}, [selectedRealm, maxLevelForRealm, targetLevel]);
|
||||||
|
|
||||||
|
// Load wildcard archetypes dynamically from target characters db
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectedRealm === "wildcard") {
|
||||||
|
api.getWildcardArchetypes(serverId)
|
||||||
|
.then((archs) => setWildcardArchetypes(archs))
|
||||||
|
.catch(() => {});
|
||||||
|
if (selectedClass === "all") {
|
||||||
|
setSelectedClass("10");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setSelectedArchetype("all");
|
||||||
|
}
|
||||||
|
}, [serverId, selectedRealm]);
|
||||||
|
|
||||||
|
// Load startup settings
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
void api
|
void api
|
||||||
.settings(serverId, "bots")
|
.settings(serverId, "bots")
|
||||||
@@ -40,6 +135,46 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
|
|||||||
const maxNum = Number(autoMax);
|
const maxNum = Number(autoMax);
|
||||||
const maxValid = autoMax.trim() !== "" && Number.isInteger(maxNum) && maxNum >= 0 && maxNum <= 5000;
|
const maxValid = autoMax.trim() !== "" && Number.isInteger(maxNum) && maxNum >= 0 && maxNum <= 5000;
|
||||||
|
|
||||||
|
// Polling population
|
||||||
|
const fetchPopulation = async () => {
|
||||||
|
const s = await api.status(serverId).catch(() => null);
|
||||||
|
if (!s) return;
|
||||||
|
const up = s.observed.world.state === "running";
|
||||||
|
setRunning(up);
|
||||||
|
if (up) {
|
||||||
|
const p = await api.population(serverId, selectedRealm).catch(() => null);
|
||||||
|
setPop(p);
|
||||||
|
} else {
|
||||||
|
setPop(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let alive = true;
|
||||||
|
const poll = async () => {
|
||||||
|
if (!alive) return;
|
||||||
|
await fetchPopulation();
|
||||||
|
};
|
||||||
|
void poll();
|
||||||
|
const interval = setInterval(poll, job ? 1500 : 4000);
|
||||||
|
return () => {
|
||||||
|
alive = false;
|
||||||
|
clearInterval(interval);
|
||||||
|
};
|
||||||
|
}, [serverId, selectedRealm, job !== null]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
|
|
||||||
|
const done = job && pop ? Math.max(0, Math.min(job.target, pop.bots_total - job.baseline)) : 0;
|
||||||
|
useEffect(() => {
|
||||||
|
if (!job) return;
|
||||||
|
if ((pop && done >= job.target) || !running) {
|
||||||
|
if (pop && done >= job.target) setNote(t("comp.progressDone", { n: job.target }));
|
||||||
|
setJob(null);
|
||||||
|
}
|
||||||
|
}, [done, running]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
|
|
||||||
|
const count = countChoice === "custom" ? Number(customCount) : Number(countChoice);
|
||||||
|
const valid = Number.isInteger(count) && count >= 1 && count <= 2000;
|
||||||
|
|
||||||
async function act(fn: () => Promise<string>) {
|
async function act(fn: () => Promise<string>) {
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
@@ -52,45 +187,128 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Primary action: Spawn bots / fleet
|
||||||
|
const handleSpawn = async () => {
|
||||||
|
if (!valid) return;
|
||||||
|
setBusy(true);
|
||||||
|
setError(null);
|
||||||
|
setNote(null);
|
||||||
|
try {
|
||||||
|
if (spawnMode === "fleet") {
|
||||||
|
const race = 1;
|
||||||
|
const out = await api.spawnBotFleet(serverId, race, targetLevel, selectedRealm);
|
||||||
|
setNote(out || `Spawned level ${targetLevel} fleet`);
|
||||||
|
} else {
|
||||||
|
const classNum = selectedClass !== "all" ? parseInt(selectedClass, 10) : (selectedRealm === "wildcard" ? 10 : undefined);
|
||||||
|
let specNum: number | undefined = undefined;
|
||||||
|
if (selectedRole === "tank") {
|
||||||
|
if (selectedRealm === "reborn") {
|
||||||
|
specNum = (classNum === 7 || classNum === 9 || classNum === 11) ? 4 : (classNum === 2 ? 2 : classNum === 1 ? 3 : 1);
|
||||||
|
} else if (selectedRealm === "wildcard") {
|
||||||
|
specNum = 1;
|
||||||
|
}
|
||||||
|
} else if (selectedRole === "healer") {
|
||||||
|
if (selectedRealm === "reborn") {
|
||||||
|
specNum = (classNum === 2 || classNum === 5) ? 1 : (classNum === 7 || classNum === 11 ? 3 : 1);
|
||||||
|
} else if (selectedRealm === "wildcard") {
|
||||||
|
specNum = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const archStr = selectedArchetype !== "all" ? selectedArchetype : undefined;
|
||||||
|
const r = await api.addCompanions(serverId, count, selectedRealm, targetLevel, classNum, specNum, archStr);
|
||||||
|
if (r.spawned && r.baseline !== null) {
|
||||||
|
setJob({ baseline: r.baseline, target: count, since: Date.now() });
|
||||||
|
}
|
||||||
|
setNote(
|
||||||
|
r.created
|
||||||
|
? t("comp.offlineDone", { n: r.created })
|
||||||
|
: r.spawned
|
||||||
|
? t("comp.spawned", { n: count })
|
||||||
|
: t("comp.saved", { n: count })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
await fetchPopulation();
|
||||||
|
} catch (e) {
|
||||||
|
setError(asUiError(e));
|
||||||
|
} finally {
|
||||||
|
setBusy(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Bring offline bots online
|
||||||
|
const handleLoginAll = () =>
|
||||||
|
act(async () => {
|
||||||
|
const out = await api.loginAllCompanions(serverId, selectedRealm);
|
||||||
|
await fetchPopulation();
|
||||||
|
return out || "All available offline bots queued for login.";
|
||||||
|
});
|
||||||
|
|
||||||
|
// Stop queued creations
|
||||||
const stopCreating = () =>
|
const stopCreating = () =>
|
||||||
act(async () => {
|
act(async () => {
|
||||||
const r = await api.stopSpawning(serverId);
|
const r = await api.stopSpawning(serverId, selectedRealm);
|
||||||
setJob(null);
|
setJob(null);
|
||||||
|
await fetchPopulation();
|
||||||
return t("comp.stopped", { n: r.count });
|
return t("comp.stopped", { n: r.count });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Take online bots offline
|
||||||
const takeOffline = () => {
|
const takeOffline = () => {
|
||||||
if (!window.confirm(t("comp.offlineConfirm"))) return;
|
if (!window.confirm(t("comp.offlineConfirm"))) return;
|
||||||
void act(async () => {
|
void act(async () => {
|
||||||
const r = await api.takeOffline(serverId);
|
const r = await api.takeOffline(serverId, selectedRealm);
|
||||||
setJob(null);
|
setJob(null);
|
||||||
|
await fetchPopulation();
|
||||||
return t("comp.offlineDone2", { n: r.count });
|
return t("comp.offlineDone2", { n: r.count });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Despawn batch
|
||||||
const dn = Number(despawnN);
|
const dn = Number(despawnN);
|
||||||
const dnValid = Number.isInteger(dn) && dn >= 1 && dn <= 5000;
|
const dnValid = Number.isInteger(dn) && dn >= 1 && dn <= 5000;
|
||||||
const despawnSome = () =>
|
const despawnSome = () =>
|
||||||
act(async () => {
|
act(async () => {
|
||||||
const r = await api.despawnSome(serverId, dn);
|
const r = await api.despawnSome(serverId, dn, selectedRealm);
|
||||||
|
await fetchPopulation();
|
||||||
return t("comp.despawnSomeDone", { n: r.count });
|
return t("comp.despawnSomeDone", { n: r.count });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Delete all bots in realm
|
||||||
const deleteAll = () => {
|
const deleteAll = () => {
|
||||||
if (!window.confirm(t("comp.deleteConfirm", { n: pop?.bots_total ?? 0 }))) return;
|
if (!window.confirm(t("comp.deleteConfirm", { n: pop?.bots_total ?? 0 }))) return;
|
||||||
void act(async () => {
|
void act(async () => {
|
||||||
await api.deleteAllCompanions(serverId);
|
await api.deleteAllCompanions(serverId, selectedRealm);
|
||||||
setJob(null);
|
setJob(null);
|
||||||
|
await fetchPopulation();
|
||||||
return t("comp.deleteDone");
|
return t("comp.deleteDone");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Switch server realm
|
||||||
|
const switchServerRealm = async (mode: RealmMode) => {
|
||||||
|
if (!window.confirm(`Switch server active realm to ${mode.toUpperCase()} and restart?`)) return;
|
||||||
|
setBusy(true);
|
||||||
|
try {
|
||||||
|
await api.realmSelect(serverId, mode, true);
|
||||||
|
await loadProfiles();
|
||||||
|
setSelectedRealm(mode);
|
||||||
|
} catch (e) {
|
||||||
|
setError(asUiError(e));
|
||||||
|
} finally {
|
||||||
|
setBusy(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Save auto startup settings
|
||||||
async function saveStart() {
|
async function saveStart() {
|
||||||
setStartBusy(true);
|
setStartBusy(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
setStartNote(null);
|
setStartNote(null);
|
||||||
try {
|
try {
|
||||||
await api.save(serverId, "bots", { "CoaBots.AutoLoginOnStartup": autoOn, "CoaBots.AutoLogin.MaxCount": maxNum });
|
await api.save(serverId, "bots", {
|
||||||
|
"CoaBots.AutoLoginOnStartup": autoOn,
|
||||||
|
"CoaBots.AutoLogin.MaxCount": maxNum,
|
||||||
|
});
|
||||||
setStartNote(t("comp.startSaved"));
|
setStartNote(t("comp.startSaved"));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setError(asUiError(e));
|
setError(asUiError(e));
|
||||||
@@ -99,181 +317,516 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
// Database schema name for selected realm
|
||||||
void api.companionSizes().then(setSizes);
|
const dbSchema =
|
||||||
let alive = true;
|
selectedRealm === "coa"
|
||||||
const poll = async () => {
|
? "acore_characters"
|
||||||
const s = await api.status(serverId).catch(() => null);
|
: selectedRealm === "wildcard"
|
||||||
if (!alive || !s) return;
|
? "acore_characters_wildcard"
|
||||||
const up = s.observed.world.state === "running";
|
: "acore_characters_reborn";
|
||||||
setRunning(up);
|
|
||||||
setPop(up ? await api.population(serverId).catch(() => null) : null);
|
|
||||||
};
|
|
||||||
void poll();
|
|
||||||
// Faster while companions are being created, so the progress bar moves.
|
|
||||||
const t = setInterval(poll, job ? 1500 : 4000);
|
|
||||||
return () => {
|
|
||||||
alive = false;
|
|
||||||
clearInterval(t);
|
|
||||||
};
|
|
||||||
}, [serverId, job !== null]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
||||||
|
|
||||||
const done = job && pop ? Math.max(0, Math.min(job.target, pop.bots_total - job.baseline)) : 0;
|
// Binary compatibility check
|
||||||
useEffect(() => {
|
const isBinaryCompatible =
|
||||||
if (!job) return;
|
selectedRealm === "coa" ||
|
||||||
// Finished, or the server went away, or nothing new appeared for two minutes.
|
(selectedRealm === "wildcard" && (profiles?.supported ?? true)) ||
|
||||||
if ((pop && done >= job.target) || !running) {
|
(selectedRealm === "reborn" && (profiles?.reborn_supported ?? true));
|
||||||
if (pop && done >= job.target) setNote(t("comp.progressDone", { n: job.target }));
|
|
||||||
setJob(null);
|
|
||||||
}
|
|
||||||
}, [done, running]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
||||||
|
|
||||||
// The backend describes a size's warning in English; show the translated text for the two known kinds.
|
|
||||||
const warningFor = (size?: { bots: number; warning: string | null }) => {
|
|
||||||
if (!size?.warning) return null;
|
|
||||||
return size.warning.startsWith(`${size.bots} companions`)
|
|
||||||
? t("comp.warnHardware", { n: size.bots, cores: sizes?.hardware.cores ?? "?", ram: sizes ? sizes.hardware.ram_gb.toFixed(0) : "?" })
|
|
||||||
: t("comp.warnMemory");
|
|
||||||
};
|
|
||||||
const count = choice === "custom" ? Number(custom) : (sizes?.sizes.find((s) => s.id === choice)?.bots ?? 0);
|
|
||||||
const warning = choice === "custom" ? (count > 500 ? t("comp.largeWarning") : null) : (warningFor(sizes?.sizes.find((s) => s.id === choice)));
|
|
||||||
const valid = Number.isInteger(count) && count >= 1 && count <= 2000;
|
|
||||||
|
|
||||||
async function add() {
|
|
||||||
setBusy(true);
|
|
||||||
setError(null);
|
|
||||||
setNote(null);
|
|
||||||
try {
|
|
||||||
const r = await api.addCompanions(serverId, count);
|
|
||||||
if (r.spawned && r.baseline !== null) setJob({ baseline: r.baseline, target: count, since: Date.now() });
|
|
||||||
setNote(r.created ? t("comp.offlineDone", { n: r.created }) : r.spawned ? t("comp.spawned", { n: count }) : t("comp.saved", { n: count }));
|
|
||||||
} catch (e) {
|
|
||||||
setError(asUiError(e));
|
|
||||||
} finally {
|
|
||||||
setBusy(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="mt-6 p-6">
|
<Card className="mt-6 p-6 space-y-6">
|
||||||
<h2 className="font-semibold">{t("comp.title")}</h2>
|
{/* Header & Realm Switcher */}
|
||||||
<p className="mt-1 text-sm text-muted">
|
<div>
|
||||||
{pop
|
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||||
? t("comp.population", { online: pop.bots_online, total: pop.bots_total })
|
<div className="flex items-center gap-2">
|
||||||
: running
|
<Bot className="h-6 w-6 text-gold" />
|
||||||
? t("comp.reading")
|
<h2 className="text-xl font-bold tracking-tight">{t("comp.title")}</h2>
|
||||||
: t("comp.startToSee")}
|
</div>
|
||||||
</p>
|
<div className="flex items-center gap-2">
|
||||||
|
<span className="text-xs text-muted flex items-center gap-1">
|
||||||
<fieldset className="mt-4">
|
<Database className="h-3.5 w-3.5" />
|
||||||
<legend className="text-sm text-muted">{t("comp.wantMore")}</legend>
|
DB: <code className="text-gold">{dbSchema}</code>
|
||||||
<div className="mt-2 flex flex-wrap gap-2">
|
</span>
|
||||||
{sizes?.sizes.map((s) => (
|
</div>
|
||||||
<label key={s.id} className={`cursor-pointer rounded-md border px-3 py-2 text-sm ${choice === s.id ? "border-gold bg-gold/10" : "border-line hover:bg-white/5"}`}>
|
|
||||||
<input type="radio" name="size" className="sr-only" checked={choice === s.id} onChange={() => setChoice(s.id)} />
|
|
||||||
{hasKey(`comp.size.${s.id}`) ? t(`comp.size.${s.id}` as Key) : s.title} <span className="text-muted">· {s.bots}</span>
|
|
||||||
</label>
|
|
||||||
))}
|
|
||||||
<label className={`cursor-pointer rounded-md border px-3 py-2 text-sm ${choice === "custom" ? "border-gold bg-gold/10" : "border-line hover:bg-white/5"}`}>
|
|
||||||
<input type="radio" name="size" className="sr-only" checked={choice === "custom"} onChange={() => setChoice("custom")} />
|
|
||||||
{t("comp.custom")}
|
|
||||||
</label>
|
|
||||||
{choice === "custom" && (
|
|
||||||
<input aria-label={t("comp.numberLabel")} value={custom} onChange={(e) => setCustom(e.target.value)} inputMode="numeric" className="w-24 rounded-md border border-line bg-bg px-3 py-2 text-right text-sm outline-none focus:border-gold" />
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
{warning && <p className="mt-3 text-sm text-warn" role="status">{warning}</p>}
|
{/* Realm Navigation Tabs */}
|
||||||
{sizes && <p className="mt-2 text-xs text-muted">{t("comp.hardware", { cores: sizes.hardware.cores, ram: sizes.hardware.ram_gb.toFixed(0) })}</p>}
|
<div className="mt-4 flex flex-wrap gap-2 border-b border-line pb-3">
|
||||||
|
{(["coa", "wildcard", "reborn"] as RealmMode[]).map((mode) => {
|
||||||
<div className="mt-4 flex items-center gap-3">
|
const isSelected = selectedRealm === mode;
|
||||||
<Button variant="primary" disabled={busy || !valid || job !== null} onClick={() => void add()}>
|
const isActive = activeServerRealm === mode;
|
||||||
{busy && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
const label =
|
||||||
{valid ? t("comp.add", { n: count }) : t("comp.addPlain")}
|
mode === "coa"
|
||||||
</Button>
|
? "Conquest of Azeroth"
|
||||||
{!running && <span className="text-xs text-muted">{t("comp.stoppedHint")}</span>}
|
: mode === "wildcard"
|
||||||
|
? "Wildcard (Hero)"
|
||||||
|
: "Warcraft Reborn";
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={mode}
|
||||||
|
type="button"
|
||||||
|
onClick={() => setSelectedRealm(mode)}
|
||||||
|
className={`flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors ${
|
||||||
|
isSelected
|
||||||
|
? "bg-gold/20 text-gold border border-gold/40 shadow-sm"
|
||||||
|
: "border border-line hover:bg-white/5 text-muted hover:text-white"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<span>{label}</span>
|
||||||
|
{isActive && (
|
||||||
|
<span className="rounded bg-ok/20 px-1.5 py-0.5 text-[10px] font-semibold text-ok uppercase">
|
||||||
|
Active Server
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{busy && !running && count >= 100 && (
|
|
||||||
<div className="mt-3">
|
{/* Binary Compatibility & Realm Mode Warning */}
|
||||||
<p className="text-sm text-muted" role="status">{t("comp.progressOffline", { n: count })}</p>
|
{!isBinaryCompatible && (
|
||||||
<div className="mt-2 h-2 overflow-hidden rounded-full bg-white/10" role="progressbar" aria-busy="true">
|
<div className="rounded-lg border border-bad/40 bg-bad/10 p-4 text-sm text-bad flex items-start gap-3">
|
||||||
<div className="h-full w-full animate-pulse rounded-full bg-gold/70" />
|
<AlertCircle className="h-5 w-5 shrink-0 mt-0.5" />
|
||||||
|
<div>
|
||||||
|
<div className="font-semibold">Binary Compatibility Warning</div>
|
||||||
|
<p className="mt-1 text-xs text-bad/90">
|
||||||
|
The currently running server core binary does not have full multi-realm support enabled
|
||||||
|
for <strong>{selectedRealm.toUpperCase()}</strong>. Automated bot features may be restricted.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{job && (
|
|
||||||
<div className="mt-3">
|
{/* Active Realm Switch Helper */}
|
||||||
<div className="flex justify-between text-sm">
|
{!isViewingActiveRealm && (
|
||||||
<span role="status">{t("comp.progress", { done, target: job.target })}</span>
|
<div className="rounded-lg border border-warn/40 bg-warn/10 p-3 text-sm flex items-center justify-between gap-3">
|
||||||
<span className="text-muted">{Math.round((done / job.target) * 100)}%</span>
|
<span className="text-warn text-xs">
|
||||||
</div>
|
Viewing <strong>{selectedRealm.toUpperCase()}</strong> bots, but the worldserver is currently running in{" "}
|
||||||
<div className="mt-2 h-2 overflow-hidden rounded-full bg-white/10" role="progressbar" aria-valuenow={done} aria-valuemin={0} aria-valuemax={job.target}>
|
<strong>{activeServerRealm.toUpperCase()}</strong> mode.
|
||||||
<div className="h-full rounded-full bg-gold transition-[width] duration-500" style={{ width: `${(done / job.target) * 100}%` }} />
|
</span>
|
||||||
</div>
|
<Button
|
||||||
{done === 0 && Date.now() - job.since > 20000 && <p className="mt-1 text-xs text-muted">{t("comp.progressStalled")}</p>}
|
size="sm"
|
||||||
<Button className="mt-2" size="sm" variant="ghost" disabled={busy} onClick={() => void stopCreating()}>
|
variant="secondary"
|
||||||
{t("comp.stop")}
|
disabled={busy}
|
||||||
|
onClick={() => void switchServerRealm(selectedRealm)}
|
||||||
|
>
|
||||||
|
Switch Server to {selectedRealm.toUpperCase()}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{note && !job && <p className="mt-3 text-sm text-ok" role="status">{note}</p>}
|
|
||||||
|
|
||||||
{running && pop && pop.bots_total > 0 && (
|
{/* Realm Population Dashboard */}
|
||||||
<div className="mt-5 border-t border-line pt-4">
|
<div className="grid grid-cols-2 sm:grid-cols-4 gap-3">
|
||||||
<h3 className="text-sm font-semibold">{t("comp.manageTitle")}</h3>
|
<div className="rounded-lg border border-line bg-bg/50 p-3">
|
||||||
<div className="mt-2 flex flex-wrap items-center gap-2 text-sm">
|
<div className="text-xs text-muted flex items-center gap-1.5">
|
||||||
<label htmlFor="despawn-n" className="text-muted">{t("comp.despawnCount")}</label>
|
<Bot className="h-3.5 w-3.5 text-gold" />
|
||||||
|
Bots Online
|
||||||
|
</div>
|
||||||
|
<div className="mt-1 text-2xl font-bold text-white">
|
||||||
|
{running && pop ? pop.bots_online : "—"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="rounded-lg border border-line bg-bg/50 p-3">
|
||||||
|
<div className="text-xs text-muted flex items-center gap-1.5">
|
||||||
|
<Users className="h-3.5 w-3.5 text-gold" />
|
||||||
|
Total Fleet
|
||||||
|
</div>
|
||||||
|
<div className="mt-1 text-2xl font-bold text-white">
|
||||||
|
{pop ? pop.bots_total : "—"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="rounded-lg border border-line bg-bg/50 p-3">
|
||||||
|
<div className="text-xs text-muted flex items-center gap-1.5">
|
||||||
|
<CheckCircle2 className="h-3.5 w-3.5 text-ok" />
|
||||||
|
Players Online
|
||||||
|
</div>
|
||||||
|
<div className="mt-1 text-2xl font-bold text-white">
|
||||||
|
{running && pop ? pop.players_online : "—"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="rounded-lg border border-line bg-bg/50 p-3 flex flex-col justify-between">
|
||||||
|
<div className="text-xs text-muted flex items-center justify-between">
|
||||||
|
<span>Status</span>
|
||||||
|
<button
|
||||||
|
onClick={() => void fetchPopulation()}
|
||||||
|
title="Refresh"
|
||||||
|
className="text-muted hover:text-white"
|
||||||
|
>
|
||||||
|
<RefreshCw className="h-3 w-3" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="text-sm font-medium">
|
||||||
|
{running ? (
|
||||||
|
<span className="text-ok flex items-center gap-1">
|
||||||
|
<span className="h-2 w-2 rounded-full bg-ok animate-pulse" /> Running
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span className="text-muted">Offline</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Fleet Configuration & Spawning Section */}
|
||||||
|
<div className="border-t border-line pt-5 space-y-4">
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<h3 className="font-semibold text-sm tracking-wide uppercase text-muted">
|
||||||
|
Fleet Deployment Controls
|
||||||
|
</h3>
|
||||||
|
<div className="flex rounded-md border border-line p-0.5 text-xs">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setSpawnMode("population")}
|
||||||
|
className={`px-2.5 py-1 rounded transition-colors ${
|
||||||
|
spawnMode === "population" ? "bg-gold/20 text-gold font-medium" : "text-muted hover:text-white"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
Batch Population
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setSpawnMode("fleet")}
|
||||||
|
className={`px-2.5 py-1 rounded transition-colors ${
|
||||||
|
spawnMode === "fleet" ? "bg-gold/20 text-gold font-medium" : "text-muted hover:text-white"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
Synchronous Fleet
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Count Selector */}
|
||||||
|
{spawnMode === "population" && (
|
||||||
|
<div>
|
||||||
|
<label className="text-xs text-muted">Fleet Size (Number of Bots)</label>
|
||||||
|
<div className="mt-2 flex flex-wrap gap-2">
|
||||||
|
{["10", "25", "50", "100", "250", "500"].map((n) => (
|
||||||
|
<button
|
||||||
|
key={n}
|
||||||
|
type="button"
|
||||||
|
onClick={() => setCountChoice(n)}
|
||||||
|
className={`rounded-md border px-3 py-1.5 text-sm transition-colors ${
|
||||||
|
countChoice === n
|
||||||
|
? "border-gold bg-gold/15 text-gold font-medium"
|
||||||
|
: "border-line hover:bg-white/5 text-muted"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{n}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setCountChoice("custom")}
|
||||||
|
className={`rounded-md border px-3 py-1.5 text-sm transition-colors ${
|
||||||
|
countChoice === "custom"
|
||||||
|
? "border-gold bg-gold/15 text-gold font-medium"
|
||||||
|
: "border-line hover:bg-white/5 text-muted"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
Custom
|
||||||
|
</button>
|
||||||
|
{countChoice === "custom" && (
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
min="1"
|
||||||
|
max="2000"
|
||||||
|
value={customCount}
|
||||||
|
onChange={(e) => setCustomCount(e.target.value)}
|
||||||
|
className="w-24 rounded-md border border-line bg-bg px-3 py-1.5 text-right text-sm outline-none focus:border-gold"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Fleet Specific Settings: Level, Class, Role, Archetype */}
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3">
|
||||||
|
{/* Target Level */}
|
||||||
|
<div>
|
||||||
|
<label className="text-xs text-muted">
|
||||||
|
{spawnMode === "fleet" ? "Fleet Level" : "Max Level Cap"} (1 - {maxLevelForRealm})
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
min="1"
|
||||||
|
max={maxLevelForRealm}
|
||||||
|
value={targetLevel}
|
||||||
|
onChange={(e) => setTargetLevel(Math.max(1, Math.min(maxLevelForRealm, Number(e.target.value))))}
|
||||||
|
className="mt-1.5 w-full rounded-md border border-line bg-bg px-3 py-1.5 text-sm outline-none focus:border-gold"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Class Filter */}
|
||||||
|
<div>
|
||||||
|
<label className="text-xs text-muted">Class Focus</label>
|
||||||
|
<select
|
||||||
|
value={selectedClass}
|
||||||
|
onChange={(e) => setSelectedClass(e.target.value)}
|
||||||
|
className="mt-1.5 w-full rounded-md border border-line bg-bg px-3 py-1.5 text-sm outline-none focus:border-gold"
|
||||||
|
>
|
||||||
|
<option value="all">All Realm Classes</option>
|
||||||
|
{selectedRealm === "coa" && (
|
||||||
|
<>
|
||||||
|
<option value="12">Barbarian</option>
|
||||||
|
<option value="13">Witch Doctor</option>
|
||||||
|
<option value="14">Felsworn</option>
|
||||||
|
<option value="15">Witch Hunter</option>
|
||||||
|
<option value="16">Stormbringer</option>
|
||||||
|
<option value="17">Knight of Xoroth</option>
|
||||||
|
<option value="18">Guardian</option>
|
||||||
|
<option value="19">Templar</option>
|
||||||
|
<option value="20">Bloodmage</option>
|
||||||
|
<option value="21">Ranger</option>
|
||||||
|
<option value="22">Chronomancer</option>
|
||||||
|
<option value="23">Necromancer</option>
|
||||||
|
<option value="24">Pyromancer</option>
|
||||||
|
<option value="25">Cultist</option>
|
||||||
|
<option value="26">Starcaller</option>
|
||||||
|
<option value="27">Tinker</option>
|
||||||
|
<option value="28">Venomancer</option>
|
||||||
|
<option value="29">Reaper</option>
|
||||||
|
<option value="30">Sun Cleric</option>
|
||||||
|
<option value="31">Runemaster</option>
|
||||||
|
<option value="32">Primalist</option>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{selectedRealm === "wildcard" && (
|
||||||
|
<option value="10">Hero (Freepick)</option>
|
||||||
|
)}
|
||||||
|
{selectedRealm === "reborn" && (
|
||||||
|
<>
|
||||||
|
<option value="1">Warrior</option>
|
||||||
|
<option value="2">Paladin</option>
|
||||||
|
<option value="3">Hunter</option>
|
||||||
|
<option value="4">Rogue</option>
|
||||||
|
<option value="5">Priest</option>
|
||||||
|
<option value="6">Death Knight</option>
|
||||||
|
<option value="7">Shaman</option>
|
||||||
|
<option value="8">Mage</option>
|
||||||
|
<option value="9">Warlock</option>
|
||||||
|
<option value="11">Druid</option>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Role Filter */}
|
||||||
|
<div>
|
||||||
|
<label className="text-xs text-muted">Combat Role</label>
|
||||||
|
<select
|
||||||
|
value={selectedRole}
|
||||||
|
onChange={(e) => setSelectedRole(e.target.value)}
|
||||||
|
className="mt-1.5 w-full rounded-md border border-line bg-bg px-3 py-1.5 text-sm outline-none focus:border-gold"
|
||||||
|
>
|
||||||
|
<option value="all">All Roles</option>
|
||||||
|
<option value="tank">Tank</option>
|
||||||
|
<option value="healer">Healer</option>
|
||||||
|
<option value="melee">Melee DPS</option>
|
||||||
|
<option value="ranged">Ranged Physical DPS</option>
|
||||||
|
<option value="caster">Caster DPS</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Archetype Filter */}
|
||||||
|
<div>
|
||||||
|
<label className="text-xs text-muted">Archetype / Build</label>
|
||||||
|
<select
|
||||||
|
value={selectedArchetype}
|
||||||
|
onChange={(e) => setSelectedArchetype(e.target.value)}
|
||||||
|
className="mt-1.5 w-full rounded-md border border-line bg-bg px-3 py-1.5 text-sm outline-none focus:border-gold"
|
||||||
|
>
|
||||||
|
<option value="all">Auto / Integral Archetype</option>
|
||||||
|
{selectedRealm === "wildcard" && (
|
||||||
|
<>
|
||||||
|
{wildcardArchetypes.map((b) => (
|
||||||
|
<option key={b.id} value={b.id}>
|
||||||
|
{b.name} ({formatRole(b.roles)}) [{formatStat(b.primary_stat)}]
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{selectedRealm === "reborn" && (
|
||||||
|
<>
|
||||||
|
<option value="spiritguard">Spirit Guard Shaman (Tank)</option>
|
||||||
|
<option value="darkapoth">Dark Apotheosis Warlock (Tank)</option>
|
||||||
|
<option value="guardianbear">Guardian Bear Druid (Tank)</option>
|
||||||
|
<option value="protpal">Protection Paladin (Tank)</option>
|
||||||
|
<option value="protwar">Protection Warrior (Tank)</option>
|
||||||
|
<option value="holypriest">Holy Priest (Healer)</option>
|
||||||
|
<option value="restodruid">Restoration Druid / Shaman</option>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{selectedRealm === "coa" && (
|
||||||
|
<option value="class_spec">Class Mastery Specialization</option>
|
||||||
|
)}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Deployment Actions */}
|
||||||
|
<div className="flex flex-wrap items-center gap-3 pt-2">
|
||||||
|
<Button
|
||||||
|
variant="primary"
|
||||||
|
disabled={busy || !valid || job !== null || !isRealmOperational}
|
||||||
|
onClick={() => void handleSpawn()}
|
||||||
|
>
|
||||||
|
{busy && <Loader2 className="h-4 w-4 animate-spin mr-2" />}
|
||||||
|
{spawnMode === "fleet"
|
||||||
|
? `Spawn Level ${targetLevel} Fleet`
|
||||||
|
: `Deploy ${valid ? count : ""} Bots`}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
{running && pop && pop.bots_total > pop.bots_online && (
|
||||||
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
disabled={busy || job !== null || !isRealmOperational}
|
||||||
|
onClick={() => void handleLoginAll()}
|
||||||
|
title="Bring all created bots online"
|
||||||
|
>
|
||||||
|
<Power className="h-4 w-4 mr-1.5 text-ok" />
|
||||||
|
Bring All Online ({pop.bots_total - pop.bots_online} idle)
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!running && (
|
||||||
|
<span className="text-xs text-muted">
|
||||||
|
Server stopped: bots will be created directly in DB or queued for startup.
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Progress Bar during active spawn */}
|
||||||
|
{job && (
|
||||||
|
<div className="rounded-lg border border-line bg-bg/40 p-4 space-y-2">
|
||||||
|
<div className="flex justify-between text-sm">
|
||||||
|
<span className="font-medium">
|
||||||
|
Creating bots: {done} / {job.target}
|
||||||
|
</span>
|
||||||
|
<span className="text-gold font-bold">
|
||||||
|
{Math.round((done / job.target) * 100)}%
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="h-2 overflow-hidden rounded-full bg-white/10">
|
||||||
|
<div
|
||||||
|
className="h-full rounded-full bg-gold transition-[width] duration-300"
|
||||||
|
style={{ width: `${(done / job.target) * 100}%` }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-between items-center pt-1">
|
||||||
|
<span className="text-xs text-muted">
|
||||||
|
Paced creation prevents server stalls and guarantees full talent/gear setup.
|
||||||
|
</span>
|
||||||
|
<Button size="sm" variant="ghost" disabled={busy} onClick={() => void stopCreating()}>
|
||||||
|
Cancel Queue
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{note && !job && (
|
||||||
|
<p className="text-sm text-ok flex items-center gap-1.5">
|
||||||
|
<CheckCircle2 className="h-4 w-4 shrink-0" />
|
||||||
|
{note}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Online Fleet Management (Despawn, Purge) */}
|
||||||
|
{running && pop && pop.bots_total > 0 && isViewingActiveRealm && (
|
||||||
|
<div className="border-t border-line pt-5 space-y-3">
|
||||||
|
<h3 className="font-semibold text-sm tracking-wide uppercase text-muted">
|
||||||
|
Online Fleet Management
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div className="flex flex-wrap items-center gap-3 text-sm">
|
||||||
|
<label htmlFor="despawn-n" className="text-muted text-xs">
|
||||||
|
Despawn Batch:
|
||||||
|
</label>
|
||||||
<input
|
<input
|
||||||
id="despawn-n"
|
id="despawn-n"
|
||||||
value={despawnN}
|
value={despawnN}
|
||||||
onChange={(e) => setDespawnN(e.target.value)}
|
onChange={(e) => setDespawnN(e.target.value)}
|
||||||
inputMode="numeric"
|
inputMode="numeric"
|
||||||
aria-invalid={!dnValid}
|
aria-invalid={!dnValid}
|
||||||
className="w-20 rounded-md border border-line bg-bg px-3 py-1.5 text-right outline-none focus:border-gold"
|
className="w-20 rounded-md border border-line bg-bg px-2.5 py-1 text-right text-sm outline-none focus:border-gold"
|
||||||
/>
|
/>
|
||||||
<Button size="sm" variant="secondary" disabled={busy || !dnValid} onClick={() => void despawnSome()}>
|
<Button
|
||||||
{t("comp.despawnSome", { n: dnValid ? dn : "…" })}
|
size="sm"
|
||||||
|
variant="secondary"
|
||||||
|
disabled={busy || !dnValid}
|
||||||
|
onClick={() => void despawnSome()}
|
||||||
|
>
|
||||||
|
Despawn {dnValid ? dn : "…"} Bots
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
|
||||||
<p className="mt-1 text-xs text-muted">{t("comp.despawnHint")}</p>
|
|
||||||
<div className="mt-3 flex flex-wrap gap-2">
|
|
||||||
<Button size="sm" variant="secondary" disabled={busy} onClick={takeOffline}>
|
<Button size="sm" variant="secondary" disabled={busy} onClick={takeOffline}>
|
||||||
{t("comp.offline")}
|
Take All Offline
|
||||||
</Button>
|
</Button>
|
||||||
<Button size="sm" variant="ghost" className="text-bad hover:text-bad" disabled={busy} onClick={deleteAll}>
|
|
||||||
{t("comp.delete")}
|
<Button
|
||||||
|
size="sm"
|
||||||
|
variant="ghost"
|
||||||
|
className="text-bad hover:text-bad ml-auto"
|
||||||
|
disabled={busy}
|
||||||
|
onClick={deleteAll}
|
||||||
|
>
|
||||||
|
Purge Entire Fleet ({pop.bots_total})
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="mt-5 border-t border-line pt-4">
|
{/* Startup Auto-Login Configuration */}
|
||||||
<h3 className="text-sm font-semibold">{t("comp.startTitle")}</h3>
|
<div className="border-t border-line pt-5 space-y-3">
|
||||||
<label className="mt-2 flex cursor-pointer items-center gap-2 text-sm">
|
<h3 className="font-semibold text-sm tracking-wide uppercase text-muted">
|
||||||
<input type="checkbox" checked={autoOn} onChange={(e) => setAutoOn(e.target.checked)} />
|
Persistent Startup Fleet
|
||||||
{t("comp.startAuto")}
|
</h3>
|
||||||
</label>
|
<p className="text-xs text-muted">
|
||||||
<div className="mt-2 flex flex-wrap items-center gap-2 text-sm">
|
Configure how many bots automatically log into the world whenever the server launches.
|
||||||
<label htmlFor="start-max" className="text-muted">{t("comp.startCount")}</label>
|
</p>
|
||||||
<input
|
|
||||||
id="start-max"
|
<div className="flex flex-wrap items-center gap-4 text-sm">
|
||||||
value={autoMax}
|
<label className="flex cursor-pointer items-center gap-2">
|
||||||
onChange={(e) => setAutoMax(e.target.value)}
|
<input
|
||||||
inputMode="numeric"
|
type="checkbox"
|
||||||
disabled={!autoOn}
|
checked={autoOn}
|
||||||
aria-invalid={!maxValid}
|
onChange={(e) => setAutoOn(e.target.checked)}
|
||||||
className="w-24 rounded-md border border-line bg-bg px-3 py-1.5 text-right outline-none focus:border-gold disabled:opacity-40"
|
className="rounded border-line text-gold focus:ring-gold"
|
||||||
/>
|
/>
|
||||||
<Button size="sm" variant="secondary" disabled={startBusy || (autoOn && !maxValid)} onClick={() => void saveStart()}>
|
<span>Enable Auto-Login on Server Startup</span>
|
||||||
{t("comp.startSave")}
|
</label>
|
||||||
</Button>
|
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<label htmlFor="start-max" className="text-xs text-muted">
|
||||||
|
Startup Limit:
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
id="start-max"
|
||||||
|
value={autoMax}
|
||||||
|
onChange={(e) => setAutoMax(e.target.value)}
|
||||||
|
inputMode="numeric"
|
||||||
|
disabled={!autoOn}
|
||||||
|
aria-invalid={!maxValid}
|
||||||
|
className="w-24 rounded-md border border-line bg-bg px-2.5 py-1 text-right text-sm outline-none focus:border-gold disabled:opacity-40"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
variant="secondary"
|
||||||
|
disabled={startBusy || (autoOn && !maxValid)}
|
||||||
|
onClick={() => void saveStart()}
|
||||||
|
>
|
||||||
|
Save Setting
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{autoOn && !maxValid && autoMax !== "" && <p className="mt-1 text-xs text-warn">{t("comp.startInvalid")}</p>}
|
{startNote && <p className="text-xs text-ok">{startNote}</p>}
|
||||||
<p className="mt-1 text-xs text-muted">{t("comp.startHint")}</p>
|
|
||||||
{startNote && <p className="mt-2 text-sm text-ok" role="status">{startNote}</p>}
|
|
||||||
</div>
|
</div>
|
||||||
{error && <p className="mt-3 text-sm text-bad" role="alert">{error.human.code === "unknown" ? error.technical : human(error.human).message}</p>}
|
|
||||||
|
{error && (
|
||||||
|
<div className="rounded-md border border-bad/40 bg-bad/10 p-3 text-sm text-bad flex items-center gap-2">
|
||||||
|
<AlertCircle className="h-4 w-4 shrink-0" />
|
||||||
|
<span>{error.human.code === "unknown" ? error.technical : human(error.human).message}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Fragment, useCallback, useEffect, useRef, useState, type ComponentType, type ReactNode } from "react";
|
import { Fragment, useCallback, useEffect, useRef, useState, type ComponentType, type ReactNode } from "react";
|
||||||
import { listen } from "@tauri-apps/api/event";
|
import { listen } from "@tauri-apps/api/event";
|
||||||
import { Bot, Clock, 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 { api, asUiError, type CustomRacesClientStatus, CustomRaceCharacters, type CustomRacesProgress, type ModuleSetting, type ModuleView, type UiError } from "@/lib/api";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
@@ -87,12 +87,16 @@ export function ModulesPage({ serverId, onChanged, onRegisterGuard }: { serverId
|
|||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
const human = useHuman();
|
const human = useHuman();
|
||||||
const [modules, setModules] = useState<ModuleView[] | null>(null);
|
const [modules, setModules] = useState<ModuleView[] | null>(null);
|
||||||
|
const [parts, setParts] = useState<ModuleView[]>([]);
|
||||||
const [open, setOpen] = useState<string | null>(null);
|
const [open, setOpen] = useState<string | null>(null);
|
||||||
const [error, setError] = useState<UiError | null>(null);
|
const [error, setError] = useState<UiError | null>(null);
|
||||||
const toggleLock = useRef(false);
|
const toggleLock = useRef(false);
|
||||||
const [toggling, setToggling] = useState<string | null>(null);
|
const [toggling, setToggling] = useState<string | null>(null);
|
||||||
const [changed, setChanged] = useState(false);
|
const [changed, setChanged] = useState(false);
|
||||||
const [racesPatchStatus, setRacesPatchStatus] = useState<CustomRacesClientStatus | null>(null);
|
const [racesPatchStatus, setRacesPatchStatus] = useState<CustomRacesClientStatus | null>(null);
|
||||||
|
const [raceChars, setRaceChars] = useState<CustomRaceCharacters | null>(null);
|
||||||
|
const [purging, setPurging] = useState(false);
|
||||||
|
const [purged, setPurged] = useState<number | null>(null);
|
||||||
const [racesInstalling, setRacesInstalling] = useState(false);
|
const [racesInstalling, setRacesInstalling] = useState(false);
|
||||||
const [racesProgress, setRacesProgress] = useState<CustomRacesProgress | null>(null);
|
const [racesProgress, setRacesProgress] = useState<CustomRacesProgress | null>(null);
|
||||||
|
|
||||||
@@ -103,6 +107,7 @@ export function ModulesPage({ serverId, onChanged, onRegisterGuard }: { serverId
|
|||||||
} catch {
|
} catch {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
setRaceChars(await api.customRaceCharacters(serverId).catch(() => null));
|
||||||
}, [serverId]);
|
}, [serverId]);
|
||||||
const [guard, setGuard] = useState<UnsavedChangesGuard | null>(null);
|
const [guard, setGuard] = useState<UnsavedChangesGuard | null>(null);
|
||||||
const [racesGuard, setRacesGuard] = useState<UnsavedChangesGuard | null>(null);
|
const [racesGuard, setRacesGuard] = useState<UnsavedChangesGuard | null>(null);
|
||||||
@@ -119,7 +124,9 @@ export function ModulesPage({ serverId, onChanged, onRegisterGuard }: { serverId
|
|||||||
|
|
||||||
const load = useCallback(async () => {
|
const load = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
setModules((await api.modulesList(serverId)).filter((m) => !m.hidden));
|
const all = await api.modulesList(serverId);
|
||||||
|
setModules(all.filter((m) => !m.hidden));
|
||||||
|
setParts(all.filter((m) => m.part_of));
|
||||||
await loadRacesStatus();
|
await loadRacesStatus();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setError(asUiError(e));
|
setError(asUiError(e));
|
||||||
@@ -238,6 +245,18 @@ export function ModulesPage({ serverId, onChanged, onRegisterGuard }: { serverId
|
|||||||
{m.id === "custom-races" && (
|
{m.id === "custom-races" && (
|
||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
|
{!m.enabled && raceChars && raceChars.players + raceChars.companionBots + raceChars.squidBots > 0 && (
|
||||||
|
<div className="mb-2 rounded-md border border-warn/40 bg-warn/5 p-2 text-xs" role="status">
|
||||||
|
<p>{t("races.offCharacters", { players: raceChars.players, bots: raceChars.companionBots + raceChars.squidBots })}</p>
|
||||||
|
{raceChars.companionBots > 0 && <Button size="sm" variant="ghost" className="mt-1 h-auto whitespace-normal py-1 text-left" disabled={purging} onClick={() => void (async () => {
|
||||||
|
setPurging(true); setError(null);
|
||||||
|
try { setPurged(await api.purgeCustomRaceBots(serverId)); await loadRacesStatus(); }
|
||||||
|
catch (e) { setError(asUiError(e)); }
|
||||||
|
finally { setPurging(false); }
|
||||||
|
})()}>{purging && <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />}{t("races.purgeBots", { n: raceChars.companionBots })}</Button>}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{purged !== null && <p className="mb-2 text-xs text-ok" role="status">{t("races.purged", { n: purged })}</p>}
|
||||||
<p className="text-xs text-muted">{locale === "ru" ? "Установленная версия патча клиента: " : "Installed client patch version: "}{racesPatchStatus?.version ?? (locale === "ru" ? "не записана" : "not recorded")}</p>
|
<p className="text-xs text-muted">{locale === "ru" ? "Установленная версия патча клиента: " : "Installed client patch version: "}{racesPatchStatus?.version ?? (locale === "ru" ? "не записана" : "not recorded")}</p>
|
||||||
{racesInstalling && racesProgress ? (
|
{racesInstalling && racesProgress ? (
|
||||||
<div className="rounded-lg border border-gold/30 bg-gold/5 p-3">
|
<div className="rounded-lg border border-gold/30 bg-gold/5 p-3">
|
||||||
@@ -328,6 +347,28 @@ export function ModulesPage({ serverId, onChanged, onRegisterGuard }: { serverId
|
|||||||
{selected.id === "custom-races" && <RaceAvailabilitySettings serverId={serverId}
|
{selected.id === "custom-races" && <RaceAvailabilitySettings serverId={serverId}
|
||||||
blocked={racesInstalling || toggling !== null} onSaved={() => setChanged(true)}
|
blocked={racesInstalling || toggling !== null} onSaved={() => setChanged(true)}
|
||||||
onRegisterGuard={setRacesGuard} />}
|
onRegisterGuard={setRacesGuard} />}
|
||||||
|
{parts.filter(p => p.part_of === selected.id && p.installed).map(p => (
|
||||||
|
<section key={p.id} className="mt-6 border-t border-line pt-5" aria-label={p.name}>
|
||||||
|
<div className="flex items-start justify-between gap-4">
|
||||||
|
<div>
|
||||||
|
<h3 className="font-semibold">{p.name}</h3>
|
||||||
|
<p className="mt-1 text-sm text-muted">{p.description[locale] ?? p.description.en}</p>
|
||||||
|
</div>
|
||||||
|
{p.switchable && <button
|
||||||
|
role="switch"
|
||||||
|
aria-checked={p.enabled}
|
||||||
|
aria-label={t("mod.switch", { name: p.name })}
|
||||||
|
aria-busy={toggling === p.id}
|
||||||
|
disabled={toggling !== null || racesInstalling}
|
||||||
|
onClick={() => void toggle(p)}
|
||||||
|
className={cn("relative mt-1 h-6 w-11 shrink-0 cursor-pointer rounded-full transition-colors", p.enabled ? "bg-gold" : "bg-white/15")}
|
||||||
|
>
|
||||||
|
<span className={cn("absolute top-0.5 h-5 w-5 rounded-full bg-white transition-all", p.enabled ? "left-[22px]" : "left-0.5")} />
|
||||||
|
</button>}
|
||||||
|
</div>
|
||||||
|
{p.enabled && p.has_settings && <ModuleSettings serverId={serverId} module={p} onSaved={() => setChanged(true)} />}
|
||||||
|
</section>
|
||||||
|
))}
|
||||||
</SettingsPanel>
|
</SettingsPanel>
|
||||||
)}
|
)}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { api, asUiError, type CustomMysql } from "@/lib/api";
|
||||||
|
import { Card } from "@/components/ui/card";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { useT } from "@/i18n";
|
||||||
|
|
||||||
|
/** The owner's own MySQL options (#103): kept in Settings/mysql-custom.ini and added to my.ini at every start. */
|
||||||
|
export function MySqlSettings({ serverId }: { serverId: string }) {
|
||||||
|
const t = useT();
|
||||||
|
const [saved, setSaved] = useState<CustomMysql | null>(null);
|
||||||
|
const [draft, setDraft] = useState("");
|
||||||
|
const [busy, setBusy] = useState(false);
|
||||||
|
const [done, setDone] = useState(false);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let alive = true;
|
||||||
|
void api.mysqlCustom(serverId).then(v => { if (alive) { setSaved(v); setDraft(v.text); } }).catch(e => { if (alive) setError(asUiError(e).technical); });
|
||||||
|
return () => { alive = false; };
|
||||||
|
}, [serverId]);
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
setBusy(true); setError(null); setDone(false);
|
||||||
|
try { const v = await api.mysqlCustomSave(serverId, draft); setSaved(v); setDraft(v.text); setDone(true); }
|
||||||
|
catch (e) { setError(asUiError(e).technical); }
|
||||||
|
finally { setBusy(false); }
|
||||||
|
}
|
||||||
|
|
||||||
|
const applied = saved?.applied.trim() ? saved.applied.trim().split("\n").length : 0;
|
||||||
|
return <Card className="mt-6 p-6" aria-busy={busy}>
|
||||||
|
<h2 className="font-semibold">{t("mysql.title")}</h2>
|
||||||
|
<p className="mt-1 text-sm text-muted">{t("mysql.hint")}</p>
|
||||||
|
<textarea
|
||||||
|
className="selectable mt-3 h-36 w-full rounded border border-line bg-bg p-3 font-mono text-xs text-ink outline-none focus:border-gold"
|
||||||
|
spellCheck={false}
|
||||||
|
placeholder={"innodb_buffer_pool_size = 1G\nmax_connections = 300"}
|
||||||
|
aria-label={t("mysql.title")}
|
||||||
|
value={draft}
|
||||||
|
disabled={busy || !saved}
|
||||||
|
onChange={e => { setDraft(e.target.value); setDone(false); }}
|
||||||
|
/>
|
||||||
|
<div className="mt-3 flex flex-wrap items-center gap-3">
|
||||||
|
<Button size="sm" disabled={busy || !saved || draft === saved.text} onClick={() => void save()}>{t("mysql.save")}</Button>
|
||||||
|
<span className="text-xs text-muted">{t("mysql.applied", { count: applied })}{done ? ` · ${t("mysql.saved")}` : ""}</span>
|
||||||
|
</div>
|
||||||
|
{error && <p className="mt-3 text-sm text-bad" role="alert">{error}</p>}
|
||||||
|
</Card>;
|
||||||
|
}
|
||||||
@@ -228,7 +228,7 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
|||||||
} else {
|
} else {
|
||||||
if (alive.current) setPop(null);
|
if (alive.current) setPop(null);
|
||||||
if (
|
if (
|
||||||
lifecycle.observe(false, actionRef.current !== null, serverUpdateBlocksRestart(server.id))
|
lifecycle.observe(false, actionRef.current !== null || s.scheduled_restart === true, serverUpdateBlocksRestart(server.id))
|
||||||
) {
|
) {
|
||||||
setHasCrashHistory(true);
|
setHasCrashHistory(true);
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { api, asUiError, type RealmName } from "@/lib/api";
|
||||||
|
import { Card } from "@/components/ui/card";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { useT } from "@/i18n";
|
||||||
|
|
||||||
|
const MAX_CHARS = 32;
|
||||||
|
|
||||||
|
export function RealmNameSettings({ serverId }: { serverId: string }) {
|
||||||
|
const t = useT();
|
||||||
|
const [realms, setRealms] = useState<RealmName[] | null>(null);
|
||||||
|
const [drafts, setDrafts] = useState<Record<number, string>>({});
|
||||||
|
const [busy, setBusy] = useState(false);
|
||||||
|
const [saved, setSaved] = useState<number | null>(null);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
function show(list: RealmName[]) {
|
||||||
|
setRealms(list);
|
||||||
|
setDrafts(Object.fromEntries(list.map(r => [r.id, r.name])));
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let alive = true;
|
||||||
|
void api.realmNames(serverId).then(list => { if (alive) show(list); }).catch(e => { if (alive) setError(asUiError(e).technical); });
|
||||||
|
return () => { alive = false; };
|
||||||
|
}, [serverId]);
|
||||||
|
|
||||||
|
async function rename(id: number, name: string | null) {
|
||||||
|
setBusy(true); setError(null); setSaved(null);
|
||||||
|
try { show(await api.realmRename(serverId, id, name)); setSaved(id); }
|
||||||
|
catch (e) { setError(asUiError(e).technical); }
|
||||||
|
finally { setBusy(false); }
|
||||||
|
}
|
||||||
|
|
||||||
|
return <Card className="mt-6 p-6" aria-busy={busy}>
|
||||||
|
<h2 className="font-semibold">{t("realm.namesTitle")}</h2>
|
||||||
|
<p className="mt-1 text-sm text-muted">{t("realm.namesHint")}</p>
|
||||||
|
{realms?.map(r => {
|
||||||
|
const draft = drafts[r.id] ?? r.name;
|
||||||
|
const invalid = draft.trim().length === 0 || draft.trim().length > MAX_CHARS || draft.includes('"');
|
||||||
|
return <div key={r.id} className="mt-4">
|
||||||
|
<div className="flex flex-wrap items-center gap-2">
|
||||||
|
<input
|
||||||
|
className="min-w-0 flex-1 rounded border border-line bg-bg px-3 py-1.5 text-sm text-ink outline-none focus:border-gold"
|
||||||
|
value={draft}
|
||||||
|
maxLength={MAX_CHARS}
|
||||||
|
aria-label={t("realm.nameDefault", { name: r.defaultName })}
|
||||||
|
disabled={busy}
|
||||||
|
onChange={e => setDrafts(d => ({ ...d, [r.id]: e.target.value }))}
|
||||||
|
/>
|
||||||
|
<Button size="sm" disabled={busy || invalid || draft.trim() === r.name} onClick={() => void rename(r.id, draft)}>{t("realm.nameSave")}</Button>
|
||||||
|
{r.custom && <Button size="sm" variant="ghost" disabled={busy} onClick={() => void rename(r.id, null)}>{t("realm.nameReset")}</Button>}
|
||||||
|
</div>
|
||||||
|
<p className="mt-1 text-xs text-muted">{t("realm.nameDefault", { name: r.defaultName })}{saved === r.id ? ` · ${t("realm.nameSaved")}` : ""}</p>
|
||||||
|
{draft.includes('"') && <p className="mt-1 text-xs text-warn">{t("realm.nameQuotes")}</p>}
|
||||||
|
</div>;
|
||||||
|
})}
|
||||||
|
{error && <p className="mt-3 text-sm text-bad" role="alert">{error}</p>}
|
||||||
|
</Card>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { api, asUiError, type RestartSchedule } from "@/lib/api";
|
||||||
|
import { Card } from "@/components/ui/card";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { useT } from "@/i18n";
|
||||||
|
|
||||||
|
/** A daily world restart at a chosen local time, with an in-game countdown (#202). */
|
||||||
|
export function RestartScheduleSettings({ serverId }: { serverId: string }) {
|
||||||
|
const t = useT();
|
||||||
|
const [saved, setSaved] = useState<RestartSchedule | null>(null);
|
||||||
|
const [draft, setDraft] = useState<RestartSchedule>({ enabled: false, time: "05:00", warningMinutes: 5 });
|
||||||
|
const [supported, setSupported] = useState(true);
|
||||||
|
const [busy, setBusy] = useState(false);
|
||||||
|
const [done, setDone] = useState(false);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let alive = true;
|
||||||
|
void api.restartSchedule(serverId).then(v => { if (alive) { setSaved(v.schedule); setDraft(v.schedule); setSupported(v.supported); } }).catch(e => { if (alive) setError(asUiError(e).technical); });
|
||||||
|
return () => { alive = false; };
|
||||||
|
}, [serverId]);
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
setBusy(true); setError(null); setDone(false);
|
||||||
|
try { const v = await api.restartScheduleSave(serverId, draft); setSaved(v.schedule); setDraft(v.schedule); setSupported(v.supported); setDone(true); }
|
||||||
|
catch (e) { setError(asUiError(e).technical); }
|
||||||
|
finally { setBusy(false); }
|
||||||
|
}
|
||||||
|
|
||||||
|
const changed = !!saved && JSON.stringify(saved) !== JSON.stringify(draft);
|
||||||
|
const minutesOk = Number.isInteger(draft.warningMinutes) && draft.warningMinutes >= 1 && draft.warningMinutes <= 60;
|
||||||
|
const input = "rounded border border-line bg-bg px-2 py-1 text-sm text-ink outline-none focus:border-gold";
|
||||||
|
return <Card className="mt-6 p-6" aria-busy={busy}>
|
||||||
|
<h2 className="font-semibold">{t("sched.title")}</h2>
|
||||||
|
<label className="mt-3 flex cursor-pointer items-center gap-3">
|
||||||
|
<input type="checkbox" className="h-4 w-4 accent-[#c9a24a]" checked={draft.enabled} disabled={busy || !saved} onChange={e => { setDraft(d => ({ ...d, enabled: e.target.checked })); setDone(false); }} />
|
||||||
|
<span className="text-sm font-medium">{t("sched.enable")}</span>
|
||||||
|
</label>
|
||||||
|
<div className="mt-3 flex flex-wrap items-center gap-4 text-sm">
|
||||||
|
<label className="flex items-center gap-2">
|
||||||
|
<span>{t("sched.time")}</span>
|
||||||
|
<input type="time" className={input} value={draft.time} disabled={busy || !draft.enabled} onChange={e => { setDraft(d => ({ ...d, time: e.target.value })); setDone(false); }} />
|
||||||
|
</label>
|
||||||
|
<label className="flex items-center gap-2">
|
||||||
|
<span>{t("sched.warning")}</span>
|
||||||
|
<input type="number" min={1} max={60} step={1} className={`${input} w-20`} value={draft.warningMinutes} disabled={busy || !draft.enabled} onChange={e => { setDraft(d => ({ ...d, warningMinutes: Number(e.target.value) })); setDone(false); }} />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<p className="mt-2 text-sm text-muted">{t("sched.hint")}</p>
|
||||||
|
{!supported && <p className="mt-2 text-sm text-warn">{t("sched.unsupported")}</p>}
|
||||||
|
<div className="mt-3 flex items-center gap-3">
|
||||||
|
<Button size="sm" disabled={busy || !changed || (draft.enabled && !minutesOk)} onClick={() => void save()}>{t("sched.save")}</Button>
|
||||||
|
{done && <span className="text-xs text-muted">{t("sched.saved")}</span>}
|
||||||
|
</div>
|
||||||
|
{error && <p className="mt-3 text-sm text-bad" role="alert">{error}</p>}
|
||||||
|
</Card>;
|
||||||
|
}
|
||||||
@@ -12,6 +12,9 @@ import { ReleaseHistory, type HistorySelection } from "./ReleaseHistory";
|
|||||||
import { ClientCard } from "./ClientCard";
|
import { ClientCard } from "./ClientCard";
|
||||||
import { GameDataCard } from "./GameDataCard";
|
import { GameDataCard } from "./GameDataCard";
|
||||||
import { RealmStartupSettings } from "./RealmStartupSettings";
|
import { RealmStartupSettings } from "./RealmStartupSettings";
|
||||||
|
import { RealmNameSettings } from "./RealmNameSettings";
|
||||||
|
import { MySqlSettings } from "./MySqlSettings";
|
||||||
|
import { RestartScheduleSettings } from "./RestartScheduleSettings";
|
||||||
import { AutoRestartSettings } from "./AutoRestartSettings";
|
import { AutoRestartSettings } from "./AutoRestartSettings";
|
||||||
import { DiagnosticsCard } from "./DiagnosticsCard";
|
import { DiagnosticsCard } from "./DiagnosticsCard";
|
||||||
import { RepairCard } from "./RepairCard";
|
import { RepairCard } from "./RepairCard";
|
||||||
@@ -50,9 +53,9 @@ export function SettingsHome({ serverId, path, onForget }: { serverId: string; s
|
|||||||
<button onClick={() => setSection("client")} className="mt-5 flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg border border-line px-5 py-4 text-left text-sm hover:bg-white/5"><span>{t("settings.clientLink")}</span><span aria-hidden>→</span></button>
|
<button onClick={() => setSection("client")} className="mt-5 flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg border border-line px-5 py-4 text-left text-sm hover:bg-white/5"><span>{t("settings.clientLink")}</span><span aria-hidden>→</span></button>
|
||||||
<ReleaseHistory selection={history} onSelect={setHistory} />
|
<ReleaseHistory selection={history} onSelect={setHistory} />
|
||||||
</div>
|
</div>
|
||||||
<div hidden={section !== "startup"} className="max-w-3xl"><RealmStartupSettings serverId={serverId} /><AutoRestartSettings serverId={serverId} /></div>
|
<div hidden={section !== "startup"} className="max-w-3xl"><RealmNameSettings serverId={serverId} /><RealmStartupSettings serverId={serverId} /><AutoRestartSettings serverId={serverId} /><RestartScheduleSettings serverId={serverId} /></div>
|
||||||
<div hidden={section !== "client"} className="max-w-3xl"><ClientCard serverId={serverId} /><GameDataCard serverId={serverId} /></div>
|
<div hidden={section !== "client"} className="max-w-3xl"><ClientCard serverId={serverId} /><GameDataCard serverId={serverId} /></div>
|
||||||
<div hidden={section !== "service"} className="max-w-3xl"><ServerLoggingSettings serverId={serverId} /><DiagnosticsCard serverId={serverId} /><RepairCard serverId={serverId} /><RemoveServerCard serverId={serverId} path={path} onForget={onForget} /></div>
|
<div hidden={section !== "service"} className="max-w-3xl"><ServerLoggingSettings serverId={serverId} /><MySqlSettings serverId={serverId} /><DiagnosticsCard serverId={serverId} /><RepairCard serverId={serverId} /><RemoveServerCard serverId={serverId} path={path} onForget={onForget} /></div>
|
||||||
<div hidden={section !== "interface"} className="max-w-3xl"><Card className="mt-6 p-6"><h2 className="font-semibold">{t("settings.language")}</h2><p className="mt-1 text-sm text-muted">{t("settings.languageHint")}</p><LanguagePicker className="mt-4" /></Card><WindowSettings /><PublicServerSettings /></div>
|
<div hidden={section !== "interface"} className="max-w-3xl"><Card className="mt-6 p-6"><h2 className="font-semibold">{t("settings.language")}</h2><p className="mt-1 text-sm text-muted">{t("settings.languageHint")}</p><LanguagePicker className="mt-4" /></Card><WindowSettings /><PublicServerSettings /></div>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,16 @@ R = [
|
|||||||
("Healer.CriticalHealPct", "int", "combat", "Emergency heal threshold", "Healers switch to their strongest heals when an ally falls below this health.", 50, 5, 95, "%", False, False),
|
("Healer.CriticalHealPct", "int", "combat", "Emergency heal threshold", "Healers switch to their strongest heals when an ally falls below this health.", 50, 5, 95, "%", False, False),
|
||||||
("WorldBrain.SearchRadius", "int", "openworld", "Target search radius", "How far a bot scans for quest targets inside an objective area.", 50, 10, 300, "yards", True, False),
|
("WorldBrain.SearchRadius", "int", "openworld", "Target search radius", "How far a bot scans for quest targets inside an objective area.", 50, 10, 300, "yards", True, False),
|
||||||
("WorldBrain.EngageRange", "int", "combat", "Engage distance", "Distance at which a bot starts fighting a quest monster.", 28, 5, 40, "yards", True, False),
|
("WorldBrain.EngageRange", "int", "combat", "Engage distance", "Distance at which a bot starts fighting a quest monster.", 28, 5, 40, "yards", True, False),
|
||||||
|
("Scaling.Enable", "bool", "combat", "Bot strength help in dungeons and raids", "Master switch for the multipliers below. They are all 1 (no change) until you raise them.", True, None, None, None, False, False),
|
||||||
|
("Scaling.Dungeons", "bool", "combat", "Help in 5-player dungeons", "Apply the multipliers while a bot is in a 5-player dungeon.", True, None, None, None, False, False),
|
||||||
|
("Scaling.Raids", "bool", "combat", "Help in raids", "Apply the multipliers while a bot is in a raid.", True, None, None, None, False, False),
|
||||||
|
("Scaling.Battlegrounds", "bool", "combat", "Help in battlegrounds and arenas", "Apply the multipliers in battlegrounds and arenas.", False, None, None, None, True, False),
|
||||||
|
("Scaling.World", "bool", "combat", "Help in the open world", "Apply the multipliers outside dungeons and raids. Usually not wanted.", False, None, None, None, True, False),
|
||||||
|
("Scaling.DamageDone", "float", "combat", "Bot damage", "Multiplies the damage bots and their pets deal to creatures. 1 is no change; higher makes content easier.", 1.0, 0.1, 10, "x", False, False),
|
||||||
|
("Scaling.HealingDone", "float", "combat", "Bot healing", "Multiplies the healing bots cast. 1 is no change.", 1.0, 0.1, 10, "x", False, False),
|
||||||
|
("Scaling.DamageTaken", "float", "combat", "Damage taken by bots", "Multiplies the damage creatures deal to bots. Below 1 bots take less; 1 is no change.", 1.0, 0.1, 10, "x", False, False),
|
||||||
|
("Scaling.TankThreat", "float", "combat", "Tank threat", "Extra threat generated by bot tanks so they hold the enemy's attention. 1 is no change.", 1.0, 1, 10, "x", False, False),
|
||||||
|
("Scaling.BossTuning", "bool", "combat", "Extra help against four bosses", "Adds stronger multipliers for Loken, the Drakkari Elemental, the Drakkari Colossus and Gal'darah, whom level 60 bots could not beat otherwise. For testing; off by default.", False, None, None, None, True, False),
|
||||||
("WorldBrain.MountDistanceMin", "int", "openworld", "Mount up beyond (min)", "Each bot mounts for trips longer than a personal distance drawn between this and the maximum.", 60, 10, 500, "yards", True, False),
|
("WorldBrain.MountDistanceMin", "int", "openworld", "Mount up beyond (min)", "Each bot mounts for trips longer than a personal distance drawn between this and the maximum.", 60, 10, 500, "yards", True, False),
|
||||||
("WorldBrain.MountDistanceMax", "int", "openworld", "Mount up beyond (max)", "Upper end of the personal mount distance.", 95, 10, 500, "yards", True, False),
|
("WorldBrain.MountDistanceMax", "int", "openworld", "Mount up beyond (max)", "Upper end of the personal mount distance.", 95, 10, 500, "yards", True, False),
|
||||||
("WorldBrain.TaxiMinDistance", "int", "openworld", "Use flight paths beyond", "Trips longer than this use a flight path when the bot knows a route.", 900, 100, 10000, "yards", True, False),
|
("WorldBrain.TaxiMinDistance", "int", "openworld", "Use flight paths beyond", "Trips longer than this use a flight path when the bot knows a route.", 900, 100, 10000, "yards", True, False),
|
||||||
|
|||||||
@@ -1,6 +1,17 @@
|
|||||||
{
|
{
|
||||||
"version": "0.9.10",
|
"version": "0.9.14",
|
||||||
"notes": [
|
"notes": [
|
||||||
"Custom Races patch installation recovers from interrupted downloads"
|
"Install community addons from the Manager",
|
||||||
|
"Old item and creature data is cleared before every Play",
|
||||||
|
"Turning the custom races client patch on or off takes seconds again",
|
||||||
|
"The database moves to a free port when Windows reserves or another program takes 3307",
|
||||||
|
"Your own MySQL settings survive restarts and updates",
|
||||||
|
"Disabled custom races stay disabled after a server update that adds races",
|
||||||
|
"Rename your realms in the Manager",
|
||||||
|
"The account for a friend's server is in the login box at every Play",
|
||||||
|
"Restart the world every day at a chosen time",
|
||||||
|
"Switches for the Custom Races V2 subclasses, Hero Races and the /dev menu",
|
||||||
|
"Companion bots on Wildcard and Warcraft Reborn",
|
||||||
|
"The Custom Races card tells which characters stay out while races are off"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -2,15 +2,15 @@
|
|||||||
"components": {
|
"components": {
|
||||||
"core": {
|
"core": {
|
||||||
"repository": "Corfirean/azerothcore-wotlk-coa",
|
"repository": "Corfirean/azerothcore-wotlk-coa",
|
||||||
"sha": "85ecc2122efd4bc168e750ab35c3e3e8d9c49735"
|
"sha": "30003e18ab44198ee6f2d819c3047bf6a80631f6"
|
||||||
},
|
},
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"repository": "jealous-sound/azerothcore-wotlk-coa",
|
"repository": "jealous-sound/azerothcore-wotlk-coa",
|
||||||
"sha": "f8955cb9b29042c359a938ff732e4b608dd62ea5"
|
"sha": "96afaf0f51cc4b37f1eba282bffb1c5aab353de6"
|
||||||
},
|
},
|
||||||
"bots": {
|
"bots": {
|
||||||
"repository": "Corfirean/mod-coa-playerbots",
|
"repository": "Corfirean/mod-coa-playerbots",
|
||||||
"sha": "0588a8e5cdfe54f81fe47bbb40fc9f75d29662e3"
|
"sha": "178a7fde6abe1c3c8813d338073b2c83835da497"
|
||||||
},
|
},
|
||||||
"scaling": {
|
"scaling": {
|
||||||
"repository": "Corfirean/mod-coa-content-scaling",
|
"repository": "Corfirean/mod-coa-content-scaling",
|
||||||
@@ -18,13 +18,25 @@
|
|||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"repository": "Corfirean/coa-server-build",
|
"repository": "Corfirean/coa-server-build",
|
||||||
"sha": "ccb121b2a050e9f6eae4e5798dbca1c4ee66264f"
|
"sha": "087ca17c4eb2c0ef218d84dd77f37263ee4ed7ee"
|
||||||
|
},
|
||||||
|
"squid": {
|
||||||
|
"repository": "Zyth45/mod-playerbots",
|
||||||
|
"ref": "v3.0",
|
||||||
|
"sha": "4ef5ed9ebe75a330de7df19639a042391e037e15"
|
||||||
|
},
|
||||||
|
"races": {
|
||||||
|
"repository": "ilusixn/CustomRacesCoa",
|
||||||
|
"ref": "coa-custom-2.0",
|
||||||
|
"sha": "dae0c661f7197bafd0a42d80866fa8709b3792c9"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"notes": [
|
"notes": [
|
||||||
"Login server startup works when Windows does not list its listening port",
|
"Custom races stay on when an update changes the race catalog",
|
||||||
"Updated SQUID's Playerbots to 2.9.4 and refreshed Dungeon Clear",
|
"Server support for companion bots on Wildcard and Warcraft Reborn",
|
||||||
"Updated SQUID Playerbots to 2.9.4",
|
"Custom-race characters stay out of the world while custom races are off",
|
||||||
"Updated the reviewed CoA upstream snapshot"
|
"Companion bots play Wildcard and Warcraft Reborn",
|
||||||
|
"Stopping the server no longer leaves the world running now and then",
|
||||||
|
"The server includes a native launcher for the world supervisor"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user