mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-18 19:25:56 +00:00
Custom races hold their V2 parts; the addon list shows every addon
- Subclasses/Hero Races and the /dev menu are parts of Custom Races (catalog part_of, hidden from the grid): their switch and settings sit inside the Custom Races settings. - The companion bots addon (CoABotUI) moves from the client facts into the addon list, with install/update from the server package; the /dev menu addon of the V2 patch is listed as installed by the patch, without its own buttons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
05630ec9eb
commit
2fd42f2acd
15 files changed
+125
-21
No files matched your search
@@ -4,4 +4,4 @@ type: added
|
||||
audience: admins
|
||||
title: Switches for the Custom Races V2 subclasses, Hero Races and the /dev menu
|
||||
---
|
||||
Modules now has Subclasses and Hero Races (turn off subclasses, the Thin Twins or the Two-Headed Ogre, two players per character) and Dev Menu (the GM /dev editor). Servers without them show them as not part of the server.
|
||||
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.
|
||||
@@ -76,6 +76,8 @@ pub struct AddonView {
|
||||
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>> {
|
||||
@@ -128,11 +130,42 @@ pub fn list(client: &Path) -> Result<Vec<AddonView>> {
|
||||
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();
|
||||
@@ -364,6 +397,8 @@ mod tests {
|
||||
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));
|
||||
|
||||
@@ -48,6 +48,10 @@ pub struct Entry {
|
||||
/// Not shown on the Modules page; its settings are offered elsewhere (a server setting card).
|
||||
#[serde(default)]
|
||||
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 {
|
||||
@@ -111,6 +115,7 @@ pub struct ModuleView {
|
||||
pub page: Option<String>,
|
||||
pub hidden: bool,
|
||||
pub compatibility: String,
|
||||
pub part_of: Option<String>,
|
||||
}
|
||||
|
||||
pub fn list(root: &Path) -> Vec<ModuleView> {
|
||||
@@ -256,6 +261,7 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec<ModuleView> {
|
||||
icon: e.icon,
|
||||
page: e.page,
|
||||
hidden: e.hidden,
|
||||
part_of: e.part_of,
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
@@ -734,6 +740,7 @@ mod tests {
|
||||
icon: String::new(),
|
||||
page: None,
|
||||
hidden: false,
|
||||
part_of: None,
|
||||
};
|
||||
vec![
|
||||
one(
|
||||
@@ -1379,6 +1386,7 @@ mod tests {
|
||||
icon: String::new(),
|
||||
page: None,
|
||||
hidden: false,
|
||||
part_of: None,
|
||||
};
|
||||
let cat = vec![compat];
|
||||
let v = list_in(&cat, &root).remove(0);
|
||||
|
||||
@@ -182,7 +182,9 @@
|
||||
"status": "early",
|
||||
"icon": "races",
|
||||
"enable_key": "Subclass.Enable",
|
||||
"default_on": true
|
||||
"default_on": true,
|
||||
"part_of": "custom-races",
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"id": "dev-menu",
|
||||
@@ -201,7 +203,9 @@
|
||||
"status": "early",
|
||||
"icon": "sparkles",
|
||||
"enable_key": "DevMenu.Enable",
|
||||
"default_on": true
|
||||
"default_on": true,
|
||||
"part_of": "custom-races",
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"id": "time-is-time",
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ export {};
|
||||
if(cmd==="pending_update") return null;
|
||||
if(cmd==="plugin:app|version") return "0.8.2";
|
||||
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"]:[]}));}
|
||||
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==="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}));}
|
||||
@@ -91,7 +91,7 @@ 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_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==="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: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==="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||{});
|
||||
|
||||
@@ -788,6 +788,9 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
"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}",
|
||||
|
||||
@@ -72,6 +72,9 @@ const en = {
|
||||
"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}",
|
||||
|
||||
@@ -788,6 +788,9 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
"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}",
|
||||
|
||||
@@ -788,6 +788,9 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
"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}",
|
||||
|
||||
@@ -75,6 +75,9 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"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}",
|
||||
|
||||
@@ -73,6 +73,9 @@ const zh = {
|
||||
"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}",
|
||||
|
||||
+2
-1
@@ -58,7 +58,7 @@ export interface StatusView {
|
||||
}
|
||||
|
||||
export type RealmMode = "coa" | "wildcard" | "reborn";
|
||||
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[] }
|
||||
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 }
|
||||
@@ -236,6 +236,7 @@ export interface ModuleView {
|
||||
/** not shown on the Modules page */
|
||||
hidden: boolean;
|
||||
compatibility?: "compatible" | "experimental" | "unsupported" | "requires-squid";
|
||||
part_of?: string | null;
|
||||
}
|
||||
|
||||
export interface ModuleSetting {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { ExternalLink, Loader2 } from "lucide-react";
|
||||
import { api, asUiError, type AddonView } from "@/lib/api";
|
||||
import { api, asUiError, type AddonView, type ClientInfo } from "@/lib/api";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useI18n } from "@/i18n";
|
||||
|
||||
@@ -9,7 +9,7 @@ function megabytes(bytes: number): string {
|
||||
}
|
||||
|
||||
/** 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 }: { serverId: string }) {
|
||||
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);
|
||||
@@ -28,28 +28,49 @@ export function AddonCatalog({ serverId }: { serverId: string }) {
|
||||
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 })} · {megabytes(a.size)} MB</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>}
|
||||
<div className="mt-2 flex gap-2">
|
||||
{!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>
|
||||
</div>}
|
||||
</li>)}
|
||||
</ul>
|
||||
{error && <p className="mt-2 text-sm text-bad" role="alert">{error}</p>}
|
||||
|
||||
@@ -86,19 +86,11 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
|
||||
: t("client.versionUntracked")}
|
||||
{status?.update_available && <span className="ml-2 text-warn">{t("client.updateAvailable")}</span>}
|
||||
</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>
|
||||
<dd>{t("client.leftAsIs", { n: info.other_addons })}</dd>
|
||||
</dl>
|
||||
<ClientGraphics key={info.path} serverId={serverId} />
|
||||
<AddonCatalog key={"addons-" + info.path} serverId={serverId} />
|
||||
<AddonCatalog key={"addons-" + info.path} serverId={serverId} companions={remote ? null : info.addon} onCompanionsInstalled={() => void refresh()} />
|
||||
{!remote && (
|
||||
<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]" />
|
||||
|
||||
@@ -87,6 +87,7 @@ export function ModulesPage({ serverId, onChanged, onRegisterGuard }: { serverId
|
||||
const { t, locale } = useI18n();
|
||||
const human = useHuman();
|
||||
const [modules, setModules] = useState<ModuleView[] | null>(null);
|
||||
const [parts, setParts] = useState<ModuleView[]>([]);
|
||||
const [open, setOpen] = useState<string | null>(null);
|
||||
const [error, setError] = useState<UiError | null>(null);
|
||||
const toggleLock = useRef(false);
|
||||
@@ -119,7 +120,9 @@ export function ModulesPage({ serverId, onChanged, onRegisterGuard }: { serverId
|
||||
|
||||
const load = useCallback(async () => {
|
||||
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();
|
||||
} catch (e) {
|
||||
setError(asUiError(e));
|
||||
@@ -328,6 +331,28 @@ export function ModulesPage({ serverId, onChanged, onRegisterGuard }: { serverId
|
||||
{selected.id === "custom-races" && <RaceAvailabilitySettings serverId={serverId}
|
||||
blocked={racesInstalling || toggling !== null} onSaved={() => setChanged(true)}
|
||||
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>
|
||||
)}
|
||||
</Fragment>
|
||||
|
||||
Reference in new issue
Block a user