feat(manager): multi-realm character database routing, RA dispatch & extended bot manager UI

This commit is contained in:
Дмитрий committed 2026-11-16 00:16:51 +05:00
1 parent ca2514c790
commit e4edb7cbdd
5 files changed
+203 -92

No files matched your search

+24 -8
View File
@@ -572,17 +572,33 @@ export const api = {
rollbackUpdate: (id: string, txn: string) => invoke<UpdateTxn>("rollback_update", { id, txn }),
retryUpdateValidation: (id: string, txn: string) => invoke<UpdateTxn>("retry_update_validation", { id, txn }),
population: (id: string, realm?: RealmMode) => invoke<Population | null>("get_population", { id, realm: realm ?? null }),
stopSpawning: (id: string) => invoke<{ count: number }>("companions_stop_spawning", { id }),
takeOffline: (id: string) => invoke<{ count: number }>("companions_take_offline", { id }),
despawnSome: (id: string, count: number) => invoke<{ count: number }>("companions_despawn_some", { id, count }),
deleteAllCompanions: (id: string) => invoke<{ count: number }>("companions_delete_all", { id }),
loginAllCompanions: (id: string) => invoke<string>("companions_login_all", { id }),
spawnBotFleet: (id: string, race: number, level: number) => invoke<string>("companions_spawn_fleet", { id, race, level }),
stopSpawning: (id: string, realm?: RealmMode) => invoke<{ count: number }>("companions_stop_spawning", { id, realm: realm ?? null }),
takeOffline: (id: string, realm?: RealmMode) => invoke<{ count: number }>("companions_take_offline", { id, realm: realm ?? null }),
despawnSome: (id: string, count: number, realm?: RealmMode) => invoke<{ count: number }>("companions_despawn_some", { id, count, realm: realm ?? null }),
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 }),
performance: (id: string) => invoke<Performance | null>("get_performance", { id }),
companionSizes: () => invoke<CompanionSizes>("companion_sizes"),
addCompanions: (id: string, count: number, realm?: RealmMode) =>
invoke<{ spawned: string | null; created: number | null; baseline: number | null }>("add_companions", { id, count, realm: realm ?? null }),
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,
}),
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 }),
clientInfo: (id: string) => invoke<ClientInfo | null>("client_info", { id }),
+48 -22
View File
@@ -55,8 +55,9 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
const activeServerRealm = profiles?.active ?? "coa";
const isViewingActiveRealm = selectedRealm === activeServerRealm;
const isRealmOperational = isViewingActiveRealm || running;
const maxLevelForRealm = selectedRealm === "reborn" ? 60 : 80;
const maxLevelForRealm = 60;
// Load realm profiles
const loadProfiles = async () => {
@@ -158,12 +159,27 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
setNote(null);
try {
if (spawnMode === "fleet") {
// Fleet spawn: race 1 (Human) or 2 (Orc)
const race = 1;
const out = await api.spawnBotFleet(serverId, race, targetLevel);
const out = await api.spawnBotFleet(serverId, race, targetLevel, selectedRealm);
setNote(out || `Spawned level ${targetLevel} fleet`);
} else {
const r = await api.addCompanions(serverId, count, selectedRealm);
const classNum = selectedClass !== "all" ? parseInt(selectedClass, 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() });
}
@@ -186,7 +202,7 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
// Bring offline bots online
const handleLoginAll = () =>
act(async () => {
const out = await api.loginAllCompanions(serverId);
const out = await api.loginAllCompanions(serverId, selectedRealm);
await fetchPopulation();
return out || "All available offline bots queued for login.";
});
@@ -194,7 +210,7 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
// Stop queued creations
const stopCreating = () =>
act(async () => {
const r = await api.stopSpawning(serverId);
const r = await api.stopSpawning(serverId, selectedRealm);
setJob(null);
await fetchPopulation();
return t("comp.stopped", { n: r.count });
@@ -204,7 +220,7 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
const takeOffline = () => {
if (!window.confirm(t("comp.offlineConfirm"))) return;
void act(async () => {
const r = await api.takeOffline(serverId);
const r = await api.takeOffline(serverId, selectedRealm);
setJob(null);
await fetchPopulation();
return t("comp.offlineDone2", { n: r.count });
@@ -216,7 +232,7 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
const dnValid = Number.isInteger(dn) && dn >= 1 && dn <= 5000;
const despawnSome = () =>
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 });
});
@@ -225,7 +241,7 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
const deleteAll = () => {
if (!window.confirm(t("comp.deleteConfirm", { n: pop?.bots_total ?? 0 }))) return;
void act(async () => {
await api.deleteAllCompanions(serverId);
await api.deleteAllCompanions(serverId, selectedRealm);
setJob(null);
await fetchPopulation();
return t("comp.deleteDone");
@@ -514,17 +530,27 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
<option value="all">All Realm Classes</option>
{selectedRealm === "coa" && (
<>
<option value="12">Guardian</option>
<option value="13">Starcaller</option>
<option value="14">Demon Hunter</option>
<option value="15">Necromancer</option>
<option value="16">Monk</option>
<option value="17">Pyromancer</option>
<option value="18">Chronomancer</option>
<option value="19">Cultist</option>
<option value="20">Runemaster</option>
<option value="21">Primalist</option>
<option value="22">Tinker</option>
<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" && (
@@ -605,7 +631,7 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
<div className="flex flex-wrap items-center gap-3 pt-2">
<Button
variant="primary"
disabled={busy || !valid || job !== null || !isViewingActiveRealm}
disabled={busy || !valid || job !== null || !isRealmOperational}
onClick={() => void handleSpawn()}
>
{busy && <Loader2 className="h-4 w-4 animate-spin mr-2" />}
@@ -617,7 +643,7 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
{running && pop && pop.bots_total > pop.bots_online && (
<Button
variant="secondary"
disabled={busy || job !== null || !isViewingActiveRealm}
disabled={busy || job !== null || !isRealmOperational}
onClick={() => void handleLoginAll()}
title="Bring all created bots online"
>