Integrating with MajestatTopCore: public API_* hooks for other Oxide/Carbon plugins and the HTTP endpoints of the built-in web panel.
Public API for plugins#
Public API (for other plugins, via plugins.Find("MajestatTopCore").Call(...)):
| Hook | Returns | Description |
|---|---|---|
API_RegisterTab(Dictionary<string,object> def) |
bool | Custom leaderboard tab (id, label, sort, fame_sort, order, columns) |
API_UnregisterTab(string tabId) |
— | Removes a tab |
API_RegisterXpSource(string statKey, double xp) |
— | XP source for API_AddStat(..., addXP: true) |
API_AddStat(steamId, statKey, amount, addToFame, addXP) |
— | Adds to a statistic (and XP by threshold) |
API_GetStat(steamId, statKey, fame) |
double | A single statistic |
API_GetAllStats(steamId, fame) |
Dictionary<string,double> | All statistics (empty dictionary for an unknown player) |
API_GetLeaderboard(tabId, fame, limit) |
List<Dictionary> | Leaderboard of a tab |
API_GetTabs() / API_GetModules() |
List<Dictionary> | Tabs / registered modules |
API_RegisterModule(Dictionary) / API_UnregisterModule(name) |
bool / — | Entry in the web panel footer |
API_GetPlayerName(steamId) |
string | Last known nickname |
API_GetCombatMeta(steamId) |
Dictionary | Last kill / last death |
API_GetOnlinePlayers() |
List<Dictionary> | Online players with XP, kills and session time |
API_GetServerInfo() / API_GetXpInfo() |
Dictionary | Server info / effective XP rates |
API_GetMapData(steamId, isAdmin) / API_GetMonuments() / API_GetMapInfo() / API_GetVendingMachines() |
… | Map data |
API_GetChatHistory(limit, channel) |
List<Dictionary> | Chat history |
API_SendWebChat(nick, text, channel, steamId, isAdmin) |
— | Message to the game on behalf of the web panel |
API_GetVoteData() / API_CastVoteFor(steamId, index) / API_IsVoteActive() / API_OpenPanel(player) |
… | Map vote |
API_OpenInfoPanel(player, tab, dismiss) / API_CloseInfoPanel(player) / API_IsInfoOpen(player) / API_GetInfoData() |
… | Info panel |
API_GetPendingUpdates() / API_ReportUpdateResult(name, latest, url) |
… | Registry of available updates (web footer) |
API_GetLogLevel() / API_IsAutoReloading() |
int / bool | Log level / whether the plugin is starting up |
Hooks fired: OnMajestatChatMessage(steamId, nick, text, channel, source, isAdmin, timestamp), OnMajestatMapUpdate(object[] entities) (only with WEB enabled), OnMajestatInfoClosed(BasePlayer).
Web panel — HTTP endpoints#
The WEB module starts an HttpListener on WEB - HTTP Port (default 28020) when WEB - Mode is http or both. Every request is served by a pooled thread; SSE streams have their own threads (limit: 50 chat clients).
HTML pages
| Path | Description |
|---|---|
/ /index |
Home: leaderboards, XP INFO, Game Info, chat, map, vote |
/player/<steamId> |
Player profile (season + Fame). 404 for an unknown or malformed SteamID |
/avatar/<steamId> |
302 redirect to the Steam avatar (cached in memory) |
Steam sign-in
| Path | Description |
|---|---|
/auth/steam |
Starts OpenID sign-in (?ret= = return page) |
/auth/steam/callback |
Return from Steam; creates a session (cookie session + ?session_token=) |
/auth/logout |
Sign out |
/api/auth/me |
Signed-in user: steamId, nick, isAdmin, teamId |
The session token can be passed as the X-Session-Token header, the session cookie or the ?token= parameter (for proxies and Android).
Data (JSON)
| Path | Method | Description |
|---|---|---|
/api/server |
GET | Server info (incl. friendlyFirePvp, friendlyFirePve, friendlyFireNpc[], friendlyFireSource) |
/api/tabs |
GET | List of leaderboard tabs |
/api/top/<tab> |
GET | Season leaderboard of a tab (pvp, gather, loot, build) |
/api/top/<tab>/fame |
GET | Fame leaderboard of a tab |
/api/all |
GET | Server + every leaderboard (season and Fame) |
/api/player/<steamId> |
GET | Player statistics (season and Fame). 404 for an unknown player |
/api/xpinfo |
GET | XP table (source = local/master, FF rows as negative penalty, friendlyFire object, amounts thresholds) |
/api/gameinfo |
GET | Content of the Info panel tabs |
Chat and console
| Path | Method | Description |
|---|---|---|
/api/chat/messages |
GET | Chat history (?channel=global|team|clan|friends; team/clan only for signed-in users, filtered by team) |
/api/chat/channels |
GET | Channels available to the signed-in user (inTeam, clan, friends) |
/api/chat/team-members |
GET | Team members of the signed-in user (online/offline, leader) |
/api/chat/send |
POST | Sends a message from the web to the game ({text, channel, nick?}), limited by WEB - Chat Rate limit |
/api/chat/stream |
GET (SSE) | Live chat |
/api/console/logs |
GET | Console log — admin only |
/api/console/stream |
GET (SSE) | Live console — admin only |
Map
| Path | Method | Description |
|---|---|---|
/api/map/img |
GET | Map image (PNG from rendermap) |
/api/map/image |
GET | {has_image, page_url} — whether the image is ready + RustMaps link |
/api/map/info |
GET | worldSize, seed, name, seaMargin |
/api/map/monuments |
GET | Monuments (name, x, z, size) |
/api/map/data |
GET | Map entities. No session: nothing; signed in: events + self + team/clan/friends; admin: everyone |
/api/map/vending |
GET | Active vending machines with offers (name, x, z, items[{item, amount, cost, currency}]) |
/api/map/stream |
GET (SSE) | Live positions |
Map vote
| Path | Method | Description |
|---|---|---|
/api/vote |
GET | Vote state (maps and votes) |
/api/vote/cast |
POST | Casts a vote {index} — requires a Steam session; subject to VOTE - Who Can Vote |
/api/vote/img?index=N |
GET | Map bitmap saved on the server's disk (does not expire like a RustMaps link) |
Authorization: when WEB - API Key is not empty, every request must carry the X-Api-Key header. Chat mode: WEB - Chat Auth Mode = steam / played / readonly / open. Setting a key is recommended when the panel port is reachable from the internet — without it leaderboard and player data are open to anyone.