diff --git a/crates/coa-core/src/modules.rs b/crates/coa-core/src/modules.rs index 3db45f6..1d5b8fa 100644 --- a/crates/coa-core/src/modules.rs +++ b/crates/coa-core/src/modules.rs @@ -45,6 +45,9 @@ pub struct Entry { /// A page of the Manager that only makes sense while the module is on (it is hidden while it is off). #[serde(default)] pub page: Option, + /// Not shown on the Modules page; its settings are offered elsewhere (a server setting card). + #[serde(default)] + pub hidden: bool, } fn yes() -> bool { @@ -93,6 +96,7 @@ pub struct ModuleView { pub status: String, pub icon: String, pub page: Option, + pub hidden: bool, } pub fn list(root: &Path) -> Vec { @@ -133,6 +137,7 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec { status: e.status, icon: e.icon, page: e.page, + hidden: e.hidden, } }) .collect() @@ -261,6 +266,7 @@ mod tests { status: "beta".into(), icon: String::new(), page: None, + hidden: false, }; vec![one("war-games", "War Games", "war_games.conf", "WarGames.Enable"), one("spellbook", "Spellbook", "spellbook.conf", "Spellbook.Enable")] } @@ -353,6 +359,7 @@ mod tests { status: "release".into(), icon: String::new(), page: None, + hidden: false, }; let cat = vec![compat]; let v = list_in(&cat, &root).remove(0); diff --git a/modules/catalog.json b/modules/catalog.json index 3cf59da..4c20d74 100644 --- a/modules/catalog.json +++ b/modules/catalog.json @@ -81,7 +81,8 @@ "alt_conf": "mod_ascension_compat.conf", "switchable": false, "status": "release", - "icon": "plug" + "icon": "plug", + "hidden": true } ] } diff --git a/src/dev/mock.ts b/src/dev/mock.ts index f46ea6a..6aa058e 100644 --- a/src/dev/mock.ts +++ b/src/dev/mock.ts @@ -55,10 +55,11 @@ 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:"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}]; + 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:"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}]; if(cmd==="module_set_enabled"){ modState[args.module]=args.enabled; return null; } if(cmd==="all_settings") return [{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==="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") return [{key:"WarGames.Enable",value:"1",default:"1",doc:"Turns War Games on."},{key:"WarGames.ChallengeSeconds",value:"60",default:"60",doc:"How long a challenge stays open."}]; if(cmd==="module_save_settings") return Object.keys(args.changes); if(cmd==="report_context") return {manager_version:"0.3.1",windows:"Windows 11 (build 26200)",install_kind:"new",server_version:"0.261001.10"}; diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index 2ad513b..f98f010 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -754,6 +754,18 @@ const de: Partial> = { "mod.legend": "Modulstatus", "mod.alwaysOn": "Immer an", "mod.settingsOf": "{name}: Einstellungen", + "col.title": "Aussehen und Sammlungen", + "col.intro": "Schalter für die Sammlungen und Erleichterungen des Spielclients. Sie gelten nach dem Neustart des Weltservers.", + "col.appearances": "Alle Aussehen freischalten (Transmog)", + "col.appearances.text": "Alle Aussehen stehen von Anfang an im Schrank bereit.", + "col.vanity": "Die ganze Vanity-Sammlung freischalten", + "col.vanity.text": "Jedes Vanity-Objekt gehört jedem Konto.", + "col.auto": "Aussehen automatisch sammeln", + "col.auto.text": "Erhaltene Gegenstände werden der Sammlung hinzugefügt.", + "col.companions": "Besitz an Reittieren und Begleitern lehren", + "col.companions.text": "Deine Reittiere und Begleiter werden dauerhaft gelernt.", + "col.riding": "Maximales Reiten ab dem ersten Login", + "col.riding.text": "Alle Reitstufen und Kaltwetterflug, schon auf Stufe 1.", }; export default de; diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 3e6ebaf..92063ff 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -754,6 +754,18 @@ const en = { "mod.legend": "Module status", "mod.alwaysOn": "Always on", "mod.settingsOf": "{name}: settings", + "col.title": "Appearances and collections", + "col.intro": "Switches for the collections and conveniences of the game client. They apply after the world server restarts.", + "col.appearances": "Unlock every appearance (transmog)", + "col.appearances.text": "All appearances are available in the wardrobe from the start.", + "col.vanity": "Unlock the whole vanity collection", + "col.vanity.text": "Every vanity entry is owned by every account.", + "col.auto": "Collect appearances automatically", + "col.auto.text": "Items a character obtains are added to the collection.", + "col.companions": "Teach owned mounts and companions", + "col.companions.text": "Mounts and companions you own are learned for good.", + "col.riding": "Maximum riding from the first login", + "col.riding.text": "All riding ranks and Cold Weather Flying, even at level 1.", } as const; export default en; diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 9ed2164..66b8f28 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -754,6 +754,18 @@ const es: Partial> = { "mod.legend": "Estado del módulo", "mod.alwaysOn": "Siempre activo", "mod.settingsOf": "{name}: ajustes", + "col.title": "Apariencias y colecciones", + "col.intro": "Ajustes de las colecciones y comodidades del cliente del juego. Se aplican al reiniciar el servidor del mundo.", + "col.appearances": "Desbloquear todas las apariencias (transfiguración)", + "col.appearances.text": "Todas las apariencias están disponibles desde el principio.", + "col.vanity": "Desbloquear toda la colección Vanity", + "col.vanity.text": "Cada objeto Vanity pertenece a cada cuenta.", + "col.auto": "Recoger apariencias automáticamente", + "col.auto.text": "Los objetos que obtiene un personaje se añaden a la colección.", + "col.companions": "Enseñar monturas y mascotas que posees", + "col.companions.text": "Tus monturas y mascotas se aprenden para siempre.", + "col.riding": "Equitación máxima desde el primer inicio", + "col.riding.text": "Todos los rangos de equitación y vuelo en clima frío, desde el nivel 1.", }; export default es; diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index d5383ee..1a55fc1 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -754,6 +754,18 @@ const fr: Partial> = { "mod.legend": "Statut du module", "mod.alwaysOn": "Toujours actif", "mod.settingsOf": "{name} : réglages", + "col.title": "Apparences et collections", + "col.intro": "Réglages des collections et facilités du client de jeu. Ils s'appliquent après le redémarrage du serveur de monde.", + "col.appearances": "Débloquer toutes les apparences (transmo)", + "col.appearances.text": "Toutes les apparences sont disponibles dès le départ.", + "col.vanity": "Débloquer toute la collection Vanity", + "col.vanity.text": "Chaque objet Vanity appartient à chaque compte.", + "col.auto": "Collecter les apparences automatiquement", + "col.auto.text": "Les objets obtenus sont ajoutés à la collection.", + "col.companions": "Apprendre les montures et compagnons possédés", + "col.companions.text": "Vos montures et compagnons sont appris définitivement.", + "col.riding": "Monte maximale dès la première connexion", + "col.riding.text": "Tous les rangs de monte et le vol par temps froid, dès le niveau 1.", }; export default fr; diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 538ee4f..e7c05d5 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -754,6 +754,18 @@ const ru: Partial> = { "mod.legend": "Статус модуля", "mod.alwaysOn": "Всегда включён", "mod.settingsOf": "{name}: настройки", + "col.title": "Внешние виды и коллекции", + "col.intro": "Переключатели коллекций и удобств игрового клиента. Применяются после перезапуска игрового сервера.", + "col.appearances": "Открыть все внешние виды (трансмогрификация)", + "col.appearances.text": "Все внешние виды доступны в гардеробе с самого начала.", + "col.vanity": "Открыть всю коллекцию Vanity", + "col.vanity.text": "Все предметы Vanity принадлежат каждому аккаунту.", + "col.auto": "Собирать внешние виды автоматически", + "col.auto.text": "Полученные персонажем предметы попадают в коллекцию.", + "col.companions": "Обучать имеющимся скакунам и питомцам", + "col.companions.text": "Ваши скакуны и спутники изучаются навсегда.", + "col.riding": "Максимальная верховая езда с первого входа", + "col.riding.text": "Все ранги верховой езды и полёт в холодных краях даже на 1 уровне.", }; export default ru; diff --git a/src/lib/api.ts b/src/lib/api.ts index 68d25c0..0a36b69 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -191,6 +191,8 @@ export interface ModuleView { icon: string; /** a page of the Manager that is hidden while the module is off */ page: string | null; + /** not shown on the Modules page */ + hidden: boolean; } export interface ModuleSetting { diff --git a/src/screens/CollectionsCard.tsx b/src/screens/CollectionsCard.tsx new file mode 100644 index 0000000..cb2f34b --- /dev/null +++ b/src/screens/CollectionsCard.tsx @@ -0,0 +1,83 @@ +import { useCallback, useEffect, useState } from "react"; +import { api, asUiError, type ModuleSetting, type UiError } from "@/lib/api"; +import { cn } from "@/lib/utils"; +import { Card } from "@/components/ui/card"; +import { useHuman, useT, type Key } from "@/i18n"; + +/** The collection and convenience switches of the client compatibility part (the same file holds them under either name). */ +const SWITCHES: { name: string; label: Key; text: Key }[] = [ + { name: "UnlockLocalAppearanceCatalog", label: "col.appearances", text: "col.appearances.text" }, + { name: "UnlockAllVanity", label: "col.vanity", text: "col.vanity.text" }, + { name: "AutoCollectAppearances", label: "col.auto", text: "col.auto.text" }, + { name: "LearnOwnedCompanions", label: "col.companions", text: "col.companions.text" }, + { name: "MaxRidingFromStart", label: "col.riding", text: "col.riding.text" }, +]; + +/** Appearances (transmog), vanity and a few solo conveniences: plain switches for what lives in the compatibility file. */ +export function CollectionsCard({ serverId }: { serverId: string }) { + const t = useT(); + const human = useHuman(); + const [items, setItems] = useState(null); + const [error, setError] = useState(null); + const [changed, setChanged] = useState(false); + + const load = useCallback(async () => { + try { + setItems(await api.moduleSettings(serverId, "client-compat")); + } catch { + setItems([]); // an older build without the file: nothing to offer + } + }, [serverId]); + + useEffect(() => { + void load(); + }, [load]); + + const find = (name: string) => items?.find((i) => i.key.endsWith("." + name)); + const shown = SWITCHES.filter((s) => find(s.name)); + if (!items || shown.length === 0) return null; + + async function toggle(name: string) { + const item = find(name); + if (!item) return; + setError(null); + try { + await api.moduleSaveSettings(serverId, "client-compat", { [item.key]: item.value.trim() === "1" ? "0" : "1" }); + setChanged(true); + await load(); + } catch (e) { + setError(asUiError(e)); + } + } + + return ( + +

{t("col.title")}

+

{t("col.intro")}

+
    + {shown.map((s) => { + const on = find(s.name)?.value.trim() === "1"; + return ( +
  • +
    +

    {t(s.label)}

    +

    {t(s.text)}

    +
    + +
  • + ); + })} +
+ {changed &&

{t("mod.restart")}

} + {error &&

{error.human.code === "unknown" ? error.technical : human(error.human).message}

} +
+ ); +} diff --git a/src/screens/ModulesPage.tsx b/src/screens/ModulesPage.tsx index 9ed81da..f4363dc 100644 --- a/src/screens/ModulesPage.tsx +++ b/src/screens/ModulesPage.tsx @@ -70,7 +70,7 @@ export function ModulesPage({ serverId, onChanged }: { serverId: string; onChang const load = useCallback(async () => { try { - setModules(await api.modulesList(serverId)); + setModules((await api.modulesList(serverId)).filter((m) => !m.hidden)); } catch (e) { setError(asUiError(e)); } diff --git a/src/screens/SettingsPage.tsx b/src/screens/SettingsPage.tsx index dea6032..f6222c8 100644 --- a/src/screens/SettingsPage.tsx +++ b/src/screens/SettingsPage.tsx @@ -17,6 +17,7 @@ import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; import { AllSettingsCard } from "@/screens/AllSettingsCard"; +import { CollectionsCard } from "@/screens/CollectionsCard"; import { CompanionsCard } from "@/screens/CompanionsCard"; import { useHuman, useI18n, useSchemaText, useT, type Key } from "@/i18n"; @@ -428,6 +429,7 @@ export function SettingsPage(props: { serverId: string; scope: Scope; title: str

{t("set.unknownKept", { n: view.unknown_keys })}

)} + {scope === "server" && } {scope === "server" && } {dirtyKeys.length > 0 && (