diff --git a/web-next/app/[locale]/page.tsx b/web-next/app/[locale]/page.tsx index 999fb72..aa462f6 100644 --- a/web-next/app/[locale]/page.tsx +++ b/web-next/app/[locale]/page.tsx @@ -33,7 +33,8 @@ export default async function HomePage({ params }: { params: Promise<{ locale: s setRequestLocale(locale) const { noticias, status } = await getData() - const online = status ? status.online_characters : 0 + const worldStatus = status ? status.world_status : 'Offline' + const worldClass = worldStatus === 'Online' ? 'green-info' : 'red-info' const loginStatus = status ? status.status : 'Offline' const loginClass = loginStatus === 'Online' ? 'green-info' : 'red-info' @@ -56,7 +57,7 @@ export default async function HomePage({ params }: { params: Promise<{ locale: s {status?.server_name ?? '—'}{' '} {status?.expansion ?? ''} - {online} + {worldStatus} Login diff --git a/web-next/lib/home.ts b/web-next/lib/home.ts index ee01b4d..8d29b54 100644 --- a/web-next/lib/home.ts +++ b/web-next/lib/home.ts @@ -16,8 +16,12 @@ export interface ServerStatus { expansion: string online_characters: number status: 'Online' | 'Offline' + world_status: 'Online' | 'Offline' } +// Puerto del worldserver (AzerothCore) para el estado del reino. +const WORLD_PORT = 8085 + /** Etiqueta de expansión por build del cliente (incluye WoW Classic; Nova WoW = 3.4.3 = 54261). */ export function expansionFromGamebuild(gamebuild: number): string { if (gamebuild === 12340) return 'WotLK' @@ -75,12 +79,17 @@ export async function getServerStatus(): Promise { ) const s = rows[0] if (!s) return null - const [online, up] = await Promise.all([getOnlineCount(), checkServerStatus(s.address, s.port)]) + const [online, up, worldUp] = await Promise.all([ + getOnlineCount(), + checkServerStatus(s.address, s.port), + checkServerStatus(s.address, WORLD_PORT), + ]) return { server_name: s.name, address: s.address, expansion: expansionFromGamebuild(s.gamebuild), online_characters: online, status: up ? 'Online' : 'Offline', + world_status: worldUp ? 'Online' : 'Offline', } }