Files
DarkflameServer/dDashboardServer/routes/LiveWorld.h
Aaron Kimbrell 2d1ef0e370 feat: web dashboard and playground work
The NexusDashboard-parity dashboard (dDashboardServer) and everything built on it on the experimental branch:
accounts, characters, properties and moderation tools, permissions shared with in-game slash commands, economy
reports, World 3D and property 3D views with client scenery, scheduled events (features, vanity changes, live
events, announcements, restarts), vanity files and events, the CDClient browser, the message inspector with saved
captures, chat filter tools, community challenges, live ops, the AI moderator helper, and the server-side changes
they need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 09:33:10 -05:00

42 lines
1.5 KiB
C++

#pragma once
#include <cstdint>
#include <optional>
#include <string>
#include <vector>
#include "json.hpp"
struct PlayerPositions;
struct HTTPContext;
/**
* What is happening in the game right now, as seen by the dashboard: where players are (for the world map), plus
* server-wide announcements and scheduled restarts.
*/
namespace LiveWorld {
void RegisterRoutes();
// A world server reported its players' positions
void HandlePlayerPositions(const PlayerPositions& positions);
// Main loop: push positions to watching browsers, send restart warnings, restart when it is time
void Update();
// Everyone online as the world servers last reported them: [{id, name, zone, instance, clone, x, y, z}]
nlohmann::json OnlinePlayers();
// Show an announcement in game, everywhere or only in the given zones; false when master isn't connected
bool Announce(const std::string& title, const std::string& message, const std::vector<uint32_t>& zones = {});
/**
* Schedule a restart in `minutes` (1 to 1440) with in-game warnings, audited as `actor`. One already scheduled is
* replaced when `replace`, or kept with an error. The error, if it wasn't scheduled
*/
std::optional<std::string> ScheduleRestart(int64_t minutes, const std::string& reason, const HTTPContext& actor, bool replace);
// Scheduled restart for the status sent to every dashboard ({} when none)
// The scheduled restart ({} when none); the staff member's name only with withStaffName
nlohmann::json RestartStatus(bool withStaffName = false);
}