Themes: 28 variants (14 light + 14 dark) with grid-based switcher Maps: Leaflet.js smooth zoom/pan, marker clustering, search, owner labels Experimental: RMQ queue/exchange explorer, publish, message inspector, safety gate Security: timing-safe login, rate limiter, token env-var, session timeout, Erlang injection fix Fixes: logout, auto-login removed, table-header theme, default dark theme, ConfigMap name
1536 lines
89 KiB
HTML
1536 lines
89 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Experimental - Dune Awakening Dashboard{% endblock %}
|
|
{% block content %}
|
|
|
|
<div id="exp-gate" class="exp-gate">
|
|
<div class="exp-gate-box">
|
|
<div class="exp-gate-icon">⚠</div>
|
|
<h2>Experimental Features — Proceed with Caution</h2>
|
|
<p>This area contains <strong>untested, experimental tools</strong> that interact directly with your game server's internal systems (RabbitMQ, PostgreSQL, Battlegroup Director).</p>
|
|
<p>These tools <strong>can corrupt data, crash servers, or delete characters</strong>. Do not report bugs about this page. Always snapshot or backup your server first.</p>
|
|
<div class="exp-gate-actions">
|
|
<button onclick="denyExperimental()" class="exp-gate-btn deny">Take Me Back to Safety</button>
|
|
<button onclick="acceptExperimental()" class="exp-gate-btn accept">I Understand the Risks — Proceed</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="exp-content" style="display:none;">
|
|
|
|
<div class="page-header">
|
|
<h1>Experimental</h1>
|
|
<p>Experimental tools discovered through server research</p>
|
|
</div>
|
|
|
|
<div class="experimental-warning">
|
|
<div class="experimental-warning-title">⚠ DANGER — EXPERIMENTAL FEATURES</div>
|
|
<div class="experimental-warning-body">
|
|
<p>This page contains <strong>experimental and potentially destructive</strong> tools that interact directly with your game server's internal systems (RabbitMQ, PostgreSQL, Battlegroup Director).</p>
|
|
<p><strong>These tools can corrupt your database, crash game servers, delete player data, or render your cluster inoperable.</strong></p>
|
|
<ul>
|
|
<li><strong>DO NOT report bugs</strong> found on this page — these features are untested and in active research.</li>
|
|
<li><strong>USE AT YOUR OWN RISK.</strong> The dashboard authors are not responsible for any damage caused.</li>
|
|
<li><strong>SNAPSHOT OR BACKUP YOUR SERVER</strong> before using ANY tool on this page.</li>
|
|
<li>If you don't understand what a button does, <strong>DO NOT CLICK IT.</strong></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">In-Game Broadcast</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:16px;">
|
|
Send a broadcast notification to all connected players. Uses RabbitMQ <code>heartbeats</code> exchange.
|
|
</p>
|
|
<div id="broadcast-status" class="error-banner" style="display:none;"></div>
|
|
<form id="broadcast-form" onsubmit="return sendBroadcast(event)">
|
|
<div style="margin-bottom:12px;">
|
|
<label style="display:block;margin-bottom:4px;font-size:13px;color:var(--text);">Title</label>
|
|
<input type="text" id="broadcast-title" value="Server Notice"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="margin-bottom:12px;">
|
|
<label style="display:block;margin-bottom:4px;font-size:13px;color:var(--text);">Message</label>
|
|
<textarea id="broadcast-message" rows="3"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;resize:vertical;"></textarea>
|
|
</div>
|
|
<div style="margin-bottom:16px;">
|
|
<label style="display:block;margin-bottom:4px;font-size:13px;color:var(--text);">Duration (seconds)</label>
|
|
<input type="number" id="broadcast-duration" value="30" min="5" max="300"
|
|
style="width:120px;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<button type="submit" id="broadcast-btn"
|
|
style="padding:10px 24px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:14px;">
|
|
Send Broadcast
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px;">
|
|
|
|
<div class="card">
|
|
<div class="card-header">Search Players</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Search characters by name.</p>
|
|
<div id="search-status" class="error-banner" style="display:none;"></div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<input type="text" id="search-term" placeholder="Character name..."
|
|
style="flex:1;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<button onclick="searchPlayers()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Search</button>
|
|
</div>
|
|
<div id="search-results" style="font-size:13px;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">Online Players</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Currently online or recently disconnected players.</p>
|
|
<div id="online-status" class="error-banner" style="display:none;"></div>
|
|
<button onclick="loadOnlinePlayers()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;margin-bottom:8px;">Refresh</button>
|
|
<div id="online-results" style="font-size:13px;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px;">
|
|
|
|
<div class="card">
|
|
<div class="card-header">Adjust Currency</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Add or remove virtual currency from a player.</p>
|
|
<div id="currency-status" class="error-banner" style="display:none;"></div>
|
|
<div style="margin-bottom:8px;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Player Controller ID</label>
|
|
<input type="number" id="currency-pid" placeholder="e.g. 81"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Currency ID</label>
|
|
<select id="currency-cid"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<option value="0">Solari Credits</option>
|
|
<option value="1">House Script</option>
|
|
<option value="2">Spice</option>
|
|
</select>
|
|
</div>
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Delta</label>
|
|
<input type="number" id="currency-delta" value="1000"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
</div>
|
|
<div style="display:flex;gap:8px;">
|
|
<button onclick="adjustCurrency()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Apply</button>
|
|
<button onclick="viewCurrency()"
|
|
style="padding:8px 16px;background:var(--bg-hover);color:var(--text);border:1px solid var(--border);border-radius:4px;cursor:pointer;">View Balances</button>
|
|
</div>
|
|
<div id="currency-view" style="margin-top:8px;font-size:12px;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">Change Faction</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Change a player's faction allegiance.</p>
|
|
<div id="faction-status" class="error-banner" style="display:none;"></div>
|
|
<div style="margin-bottom:8px;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Player ID</label>
|
|
<input type="number" id="faction-pid" placeholder="e.g. 81"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="margin-bottom:8px;">
|
|
<label style="font-size:12px;color:var(--text-muted);">New Faction</label>
|
|
<select id="faction-id"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<option value="1">Atreides</option>
|
|
<option value="2">Harkonnen</option>
|
|
<option value="3">Fremen</option>
|
|
<option value="4">Corrino</option>
|
|
</select>
|
|
</div>
|
|
<button onclick="changeFaction()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Change</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">Teleport Player</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Teleport an offline player to a partition.</p>
|
|
<div id="teleport-status" class="error-banner" style="display:none;"></div>
|
|
<div style="margin-bottom:8px;">
|
|
<label style="font-size:12px;color:var(--text-muted);">FLS ID (username)</label>
|
|
<input type="text" id="teleport-flsid" placeholder="e.g. fau_lil_pump"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Partition ID</label>
|
|
<input type="number" id="teleport-pid" placeholder="e.g. 5"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">X</label>
|
|
<input type="number" step="any" id="teleport-x" placeholder="0"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Y</label>
|
|
<input type="number" step="any" id="teleport-y" placeholder="0"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Z</label>
|
|
<input type="number" step="any" id="teleport-z" placeholder="0"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
</div>
|
|
<div style="display:flex;gap:8px;">
|
|
<button onclick="teleportPlayer()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Teleport</button>
|
|
<button onclick="loadPartitions()"
|
|
style="padding:8px 16px;background:var(--bg-hover);color:var(--text);border:1px solid var(--border);border-radius:4px;cursor:pointer;">List Partitions</button>
|
|
</div>
|
|
<div id="teleport-view" style="margin-top:8px;font-size:12px;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px;">
|
|
|
|
<div class="card">
|
|
<div class="card-header">Faction Reputation</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">View or set faction reputation.</p>
|
|
<div id="rep-status" class="error-banner" style="display:none;"></div>
|
|
<div style="margin-bottom:8px;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Actor ID</label>
|
|
<input type="number" id="rep-actor" placeholder="e.g. 81"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Faction</label>
|
|
<select id="rep-faction"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<option value="1">Atreides</option>
|
|
<option value="2">Harkonnen</option>
|
|
<option value="3">Fremen</option>
|
|
<option value="4">Corrino</option>
|
|
</select>
|
|
</div>
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Amount</label>
|
|
<input type="number" id="rep-amount" value="0"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
</div>
|
|
<div style="display:flex;gap:8px;">
|
|
<button onclick="getReputation()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">View</button>
|
|
<button onclick="setReputation()"
|
|
style="padding:8px 16px;background:var(--bg-hover);color:var(--text);border:1px solid var(--border);border-radius:4px;cursor:pointer;">Set</button>
|
|
</div>
|
|
<div id="rep-view" style="margin-top:8px;font-size:12px;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">Player Stats / Health</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">View player health, spice exposure, and other stats from actor properties.</p>
|
|
<div id="stats-status" class="error-banner" style="display:none;"></div>
|
|
<div style="margin-bottom:8px;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Player Controller ID</label>
|
|
<input type="number" id="stats-pcid" placeholder="e.g. 81"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<button onclick="loadPlayerStats()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Load</button>
|
|
<div id="stats-output" style="margin-top:8px;font-size:12px;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">Inventory Lookup</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">View player inventory by account ID.</p>
|
|
<div id="inv-status" class="error-banner" style="display:none;"></div>
|
|
<div style="margin-bottom:8px;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Account ID</label>
|
|
<input type="number" id="inv-account" placeholder="e.g. 55"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<button onclick="loadInventory()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Load</button>
|
|
<div id="inv-output" style="margin-top:8px;font-size:12px;max-height:300px;overflow:auto;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px;">
|
|
|
|
<div class="card">
|
|
<div class="card-header">Player Tags</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Read or update player tags. Comma-separated lists.</p>
|
|
<div id="tags-status" class="error-banner" style="display:none;"></div>
|
|
<div style="margin-bottom:8px;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Account ID</label>
|
|
<input type="number" id="tags-account" placeholder="e.g. 55"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Add Tags</label>
|
|
<input type="text" id="tags-add" placeholder="vip,alpha,mod"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Remove Tags</label>
|
|
<input type="text" id="tags-remove" placeholder="beta,test"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
</div>
|
|
<div style="display:flex;gap:8px;">
|
|
<button onclick="viewTags()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">View</button>
|
|
<button onclick="updateTags()"
|
|
style="padding:8px 16px;background:var(--bg-hover);color:var(--text);border:1px solid var(--border);border-radius:4px;cursor:pointer;">Update</button>
|
|
</div>
|
|
<div id="tags-view" style="margin-top:8px;font-size:12px;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">Flag Cheater</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Flag a player as cheater.</p>
|
|
<div id="cheater-status" class="error-banner" style="display:none;"></div>
|
|
<div style="margin-bottom:8px;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Account ID</label>
|
|
<input type="number" id="cheater-account" placeholder="e.g. 55"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="margin-bottom:8px;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Cheat Type</label>
|
|
<select id="cheater-type"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<option value="manual">Manual</option>
|
|
<option value="automated">Automated</option>
|
|
<option value="speed_hack">Speed Hack</option>
|
|
<option value="duplication">Duplication</option>
|
|
</select>
|
|
</div>
|
|
<button onclick="flagCheater()"
|
|
style="padding:8px 16px;background:#e74c3c;color:#fff;border:none;border-radius:4px;cursor:pointer;">Flag as Cheater</button>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px;">
|
|
|
|
<div class="card">
|
|
<div class="card-header">Guild Tools</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">List guilds, view details, disband, kick members.</p>
|
|
<div id="guild-status" class="error-banner" style="display:none;"></div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Guild ID</label>
|
|
<input type="number" id="guild-id" placeholder="e.g. 1"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Player ID to kick</label>
|
|
<input type="number" id="guild-kick-player" placeholder="e.g. 81"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
</div>
|
|
<div style="display:flex;gap:8px;flex-wrap:wrap;">
|
|
<button onclick="listGuilds()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">List All</button>
|
|
<button onclick="viewGuild()"
|
|
style="padding:8px 16px;background:var(--bg-hover);color:var(--text);border:1px solid var(--border);border-radius:4px;cursor:pointer;">View Guild</button>
|
|
<button onclick="disbandGuild()"
|
|
style="padding:8px 16px;background:#e74c3c;color:#fff;border:none;border-radius:4px;cursor:pointer;">Disband</button>
|
|
<button onclick="kickGuildMember()"
|
|
style="padding:8px 16px;background:#e67e22;color:#fff;border:none;border-radius:4px;cursor:pointer;">Kick Member</button>
|
|
</div>
|
|
<div id="guild-view" style="margin-top:8px;font-size:12px;max-height:300px;overflow:auto;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">Player Vehicles</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">View vehicles owned by a player.</p>
|
|
<div id="veh-status" class="error-banner" style="display:none;"></div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Player ID</label>
|
|
<input type="number" id="veh-player" placeholder="e.g. 81"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Account ID</label>
|
|
<input type="number" id="veh-account" placeholder="e.g. 55"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
</div>
|
|
<button onclick="loadVehicles()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Load</button>
|
|
<div id="veh-output" style="margin-top:8px;font-size:12px;max-height:300px;overflow:auto;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px;">
|
|
|
|
<div class="card">
|
|
<div class="card-header">Character Management</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Rename, delete, force demo state.</p>
|
|
<div id="char-status" class="error-banner" style="display:none;"></div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Account ID</label>
|
|
<input type="number" id="char-account" placeholder="55"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">New Name</label>
|
|
<input type="text" id="char-newname" placeholder="New name"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
</div>
|
|
<div style="display:flex;gap:8px;flex-wrap:wrap;margin-bottom:8px;">
|
|
<button onclick="setCharacterName()" style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Rename</button>
|
|
<button onclick="deleteCharacter()" style="padding:8px 16px;background:#e74c3c;color:#fff;border:none;border-radius:4px;cursor:pointer;">Delete Char</button>
|
|
<button onclick="deleteAccount()" style="padding:8px 16px;background:#c0392b;color:#fff;border:none;border-radius:4px;cursor:pointer;">Delete Account</button>
|
|
</div>
|
|
<div style="display:flex;gap:8px;">
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">User ID (for demo)</label>
|
|
<input type="text" id="char-userid" placeholder="FLS ID"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="flex:1;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Demo State</label>
|
|
<select id="char-demo"
|
|
style="width:100%;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<option value="none">None</option>
|
|
<option value="in_demo">In Demo</option>
|
|
<option value="demo_expired">Demo Expired</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div style="margin-top:24px;">
|
|
<h2 style="margin-bottom:16px;">RabbitMQ Explorer</h2>
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:16px;">
|
|
Inspect the RMQ clusters. Both Admin (port 30325) and Game (port 32716) instances via SSH tunnel.
|
|
</p>
|
|
</div>
|
|
|
|
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;">
|
|
|
|
<div class="card">
|
|
<div class="card-header">RMQ Overview</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Cluster health, node info, message stats.</p>
|
|
<div id="rmq-overview-status" class="error-banner" style="display:none;"></div>
|
|
<button onclick="loadRmqOverview()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;margin-bottom:8px;">Refresh</button>
|
|
<pre id="rmq-overview-data" style="max-height:300px;overflow:auto;font-size:11px;background:var(--bg-hover);padding:10px;border-radius:4px;white-space:pre-wrap;word-break:break-all;"></pre>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">RMQ Queues</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">All queues with consumer counts and message depths.</p>
|
|
<div id="rmq-queues-status" class="error-banner" style="display:none;"></div>
|
|
<button onclick="loadRmqQueues()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;margin-bottom:8px;">Refresh</button>
|
|
<div id="rmq-queues-data" style="max-height:300px;overflow:auto;font-size:11px;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">RMQ Exchanges</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">All exchanges with type, durability, and message stats.</p>
|
|
<div id="rmq-exchanges-status" class="error-banner" style="display:none;"></div>
|
|
<button onclick="loadRmqExchanges()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;margin-bottom:8px;">Refresh</button>
|
|
<div id="rmq-exchanges-data" style="max-height:300px;overflow:auto;font-size:11px;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">Message Inspector</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Peek at messages in any queue without consuming them.</p>
|
|
<div id="rmq-peek-status" class="error-banner" style="display:none;"></div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<input type="text" id="rmq-peek-queue" placeholder="Queue name..."
|
|
style="flex:1;padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;">
|
|
<input type="number" id="rmq-peek-count" value="5" min="1" max="20"
|
|
style="width:60px;padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;">
|
|
<button onclick="peekRmqMessages()"
|
|
style="padding:6px 14px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:12px;">Peek</button>
|
|
</div>
|
|
<pre id="rmq-peek-data" style="max-height:300px;overflow:auto;font-size:11px;background:var(--bg-hover);padding:10px;border-radius:4px;white-space:pre-wrap;word-break:break-all;"></pre>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card" style="grid-column:1 / -1;">
|
|
<div class="card-header">Publish Test Message</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">
|
|
Publish a test message to any exchange. <strong>Note:</strong> HTTP API sets user_id to dashboard_admin, which the game server may reject for RPC commands. Use the Erlang eval broadcast for in-game commands.
|
|
</p>
|
|
<div id="rmq-publish-status" class="error-banner" style="display:none;"></div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;flex-wrap:wrap;">
|
|
<select id="rmq-publish-side" style="padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;">
|
|
<option value="admin">Admin (30325)</option>
|
|
<option value="game">Game (32716)</option>
|
|
</select>
|
|
<input type="text" id="rmq-publish-exchange" placeholder="Exchange name..."
|
|
style="flex:1;min-width:150px;padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;">
|
|
<input type="text" id="rmq-publish-routing" placeholder="Routing key..."
|
|
style="flex:1;min-width:150px;padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;">
|
|
<button onclick="publishRmqMessage()"
|
|
style="padding:6px 14px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:12px;">Publish</button>
|
|
</div>
|
|
<textarea id="rmq-publish-message" rows="4" placeholder='{"key": "value"}'
|
|
style="width:100%;padding:8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;font-family:monospace;resize:vertical;"></textarea>
|
|
<pre id="rmq-publish-data" style="max-height:200px;overflow:auto;font-size:11px;background:var(--bg-hover);padding:10px;border-radius:4px;margin-top:8px;white-space:pre-wrap;word-break:break-all;"></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">Journey & Specialization</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Manage story nodes and specialization tracks.</p>
|
|
<div id="journey-status" class="error-banner" style="display:none;"></div>
|
|
<div style="margin-bottom:8px;">
|
|
<label style="font-size:12px;color:var(--text-muted);">Account ID / Player ID</label>
|
|
<div style="display:flex;gap:8px;">
|
|
<input type="number" id="journey-account" placeholder="Account ID"
|
|
style="flex:1;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<input type="text" id="journey-nodes" placeholder="Node IDs (comma)"
|
|
style="flex:2;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
</div>
|
|
<div style="display:flex;gap:8px;margin-bottom:12px;">
|
|
<button onclick="journeyAction('complete')" style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Complete</button>
|
|
<button onclick="journeyAction('reveal')" style="padding:8px 16px;background:var(--bg-hover);color:var(--text);border:1px solid var(--border);border-radius:4px;cursor:pointer;">Reveal</button>
|
|
<button onclick="journeyAction('reset')" style="padding:8px 16px;background:#e67e22;color:#fff;border:none;border-radius:4px;cursor:pointer;">Reset</button>
|
|
</div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<input type="number" id="spec-player" placeholder="Player ID"
|
|
style="flex:1;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<select id="spec-track"
|
|
style="flex:1;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<option value="combat">Combat</option>
|
|
<option value="crafting">Crafting</option>
|
|
<option value="survival">Survival</option>
|
|
<option value="stealth">Stealth</option>
|
|
</select>
|
|
<input type="number" id="spec-xp" placeholder="XP" value="0"
|
|
style="flex:1;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<input type="number" id="spec-level" placeholder="Level" value="1"
|
|
style="flex:1;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
</div>
|
|
<div style="display:flex;gap:8px;">
|
|
<button onclick="setSpecialization()" style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Set Spec</button>
|
|
<button onclick="resetSpecialization()" style="padding:8px 16px;background:#e67e22;color:#fff;border:none;border-radius:4px;cursor:pointer;">Reset Spec</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px;">
|
|
|
|
<div class="card">
|
|
<div class="card-header">Economy & Spice Fields</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Vendor stock, tax invoices, spice field control.</p>
|
|
<div id="econ-status" class="error-banner" style="display:none;"></div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<input type="number" id="econ-player" placeholder="Player ID"
|
|
style="flex:1;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<button onclick="cleanVendorStock()" style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Reset Vendor Stock</button>
|
|
<button onclick="viewTaxInvoices()" style="padding:8px 16px;background:var(--bg-hover);color:var(--text);border:1px solid var(--border);border-radius:4px;cursor:pointer;">View Tax</button>
|
|
</div>
|
|
<div id="tax-output" style="font-size:11px;margin-bottom:8px;max-height:150px;overflow:auto;"></div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<input type="text" id="spice-map" placeholder="Map name"
|
|
style="flex:1;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<input type="number" id="spice-dim" placeholder="Dim" value="0"
|
|
style="flex:1;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<button onclick="resetSpice()" style="padding:8px 16px;background:#e67e22;color:#fff;border:none;border-radius:4px;cursor:pointer;">Reset Spice</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">Server Tools</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Force players offline, cleanup orphans, manage permissions.</p>
|
|
<div id="server-status" class="error-banner" style="display:none;"></div>
|
|
<div style="display:flex;gap:8px;flex-wrap:wrap;">
|
|
<button onclick="setPlayersOffline()" style="padding:8px 16px;background:#e67e22;color:#fff;border:none;border-radius:4px;cursor:pointer;">Set All Offline</button>
|
|
<button onclick="cleanupOrphans()" style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Cleanup Orphans</button>
|
|
</div>
|
|
<div style="margin-top:8px;display:flex;gap:8px;">
|
|
<input type="number" id="perm-actor" placeholder="Actor ID"
|
|
style="flex:1;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<button onclick="viewPermissions()" style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">View Perms</button>
|
|
</div>
|
|
<div id="perm-output" style="margin-top:8px;font-size:11px;max-height:200px;overflow:auto;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div style="margin-top:20px;">
|
|
|
|
<div class="card">
|
|
<div class="card-header">Battlegroup Info</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Full battlegroup status from BGD API.</p>
|
|
<div id="bg-status" class="error-banner" style="display:none;"></div>
|
|
<button onclick="loadBattlegroup()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;margin-bottom:8px;">Load</button>
|
|
<pre id="bg-output" style="font-size:11px;max-height:400px;overflow:auto;background:var(--bg-hover);padding:12px;border-radius:4px;"></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div style="margin-top:20px;">
|
|
|
|
<div class="card">
|
|
<div class="card-header">Function Explorer — All 517 DB Functions</div>
|
|
<div class="card-body">
|
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">
|
|
Browse and execute any PostgreSQL function in the <code>dune</code> schema. Type to filter. Click a function to see its definition and enter parameters.
|
|
</p>
|
|
<div id="fx-status" class="error-banner" style="display:none;"></div>
|
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
|
<input type="text" id="fx-filter" placeholder="Type to filter functions..." oninput="filterFunctions()"
|
|
style="flex:1;padding:8px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:13px;">
|
|
<button onclick="loadFunctions()"
|
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Load All</button>
|
|
</div>
|
|
<div style="display:flex;gap:20px;">
|
|
<div id="fx-list" style="flex:1;max-height:400px;overflow:auto;font-size:11px;background:var(--bg-hover);padding:8px;border-radius:4px;font-family:monospace;"></div>
|
|
<div id="fx-detail" style="flex:1.5;max-height:400px;overflow:auto;font-size:12px;">
|
|
<p style="color:var(--text-muted);">Select a function from the list to see details and execute it.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<style>
|
|
.error-banner { padding: 10px 14px; border-radius: 4px; margin-bottom: 12px; font-size: 13px; }
|
|
.error-banner.success { background: #1a3a2a; border: 1px solid #2ecc71; color: #2ecc71; display: block; }
|
|
.error-banner.error { background: #3a1a1a; border: 1px solid #e74c3c; color: #e74c3c; display: block; }
|
|
.experimental-warning { background: rgba(220,38,38,0.12); border: 2px solid rgba(220,38,38,0.6); border-left: 6px solid #dc2626; border-radius: 8px; padding: 18px 22px; margin-bottom: 24px; }
|
|
.experimental-warning-title { font-size: 16px; font-weight: 700; color: #ef4444; margin-bottom: 12px; }
|
|
.experimental-warning-body p { margin: 0 0 10px; font-size: 13px; color: var(--text); line-height: 1.6; }
|
|
.experimental-warning-body ul { margin: 8px 0 0; padding-left: 20px; font-size: 13px; color: var(--text); line-height: 1.8; }
|
|
.experimental-warning-body li { margin-bottom: 4px; }
|
|
.exp-gate { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 9999; display: flex; align-items: center; justify-content: center; }
|
|
.exp-gate-box { background: #1a1a1e; border: 2px solid #dc2626; border-radius: 12px; max-width: 560px; width: 90%; padding: 32px; text-align: center; color: #e0e0e0; }
|
|
.exp-gate-icon { font-size: 48px; color: #ef4444; margin-bottom: 16px; }
|
|
.exp-gate-box h2 { font-size: 18px; color: #ef4444; margin: 0 0 16px; }
|
|
.exp-gate-box p { font-size: 13px; line-height: 1.6; margin: 0 0 12px; color: #c0c0c0; }
|
|
.exp-gate-actions { display: flex; gap: 12px; margin-top: 20px; justify-content: center; flex-wrap: wrap; }
|
|
.exp-gate-btn { padding: 12px 24px; border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
|
|
.exp-gate-btn.accept { background: #dc2626; color: #fff; }
|
|
.exp-gate-btn.accept:hover { background: #b91c1c; }
|
|
.exp-gate-btn.deny { background: #374151; color: #d0d0d0; }
|
|
.exp-gate-btn.deny:hover { background: #4b5563; }
|
|
code { background: var(--bg-hover); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
|
|
.result-table { width:100%; border-collapse:collapse; font-size:12px; margin-top:8px; }
|
|
.result-table th { text-align:left; padding:6px 8px; background:var(--bg-hover); border-bottom:2px solid var(--border); }
|
|
.result-table td { padding:6px 8px; border-bottom:1px solid var(--border); }
|
|
.result-table tr:hover { background:var(--bg-hover); }
|
|
</style>
|
|
|
|
<script>
|
|
// ── Broadcast ──────────────────────────────────────────────────────
|
|
async function sendBroadcast(event) {
|
|
event.preventDefault();
|
|
const btn = document.getElementById('broadcast-btn');
|
|
const status = document.getElementById('broadcast-status');
|
|
const title = document.getElementById('broadcast-title').value.trim();
|
|
const message = document.getElementById('broadcast-message').value.trim();
|
|
const duration = parseInt(document.getElementById('broadcast-duration').value) || 30;
|
|
if (!title || !message) { showError(status, 'Title and message are required.'); return false; }
|
|
btn.disabled = true; btn.textContent = 'Sending...'; hideStatus(status);
|
|
try {
|
|
const resp = await csrfFetch('/api/admin-experimental/broadcast', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ title, message, duration })
|
|
});
|
|
const data = await resp.json();
|
|
data.success ? showSuccess(status, 'Broadcast sent!') : showError(status, data.output || data.error);
|
|
} catch(e) { showError(status, e.message); }
|
|
finally { btn.disabled = false; btn.textContent = 'Send Broadcast'; }
|
|
return false;
|
|
}
|
|
|
|
// ── Search Players ──────────────────────────────────────────────────
|
|
async function searchPlayers() {
|
|
const term = document.getElementById('search-term').value.trim();
|
|
const status = document.getElementById('search-status');
|
|
const results = document.getElementById('search-results');
|
|
if (!term) { showError(status, 'Enter a search term.'); return; }
|
|
hideStatus(status); results.innerHTML = 'Searching...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/search-players', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ term })
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); results.innerHTML = ''; return; }
|
|
if (!d.players || d.players.length === 0) { results.innerHTML = 'No players found.'; return; }
|
|
let html = '<table class="result-table"><tr><th>ID</th><th>User (FLS)</th><th>Name</th></tr>';
|
|
for (const p of d.players) {
|
|
html += `<tr><td>${p.id||''}</td><td>${esc(p.user||'')}</td><td>${esc(p.character_name||'')}</td></tr>`;
|
|
}
|
|
html += '</table>';
|
|
results.innerHTML = html;
|
|
} catch(e) { showError(status, e.message); results.innerHTML = ''; }
|
|
}
|
|
|
|
// ── Online Players ──────────────────────────────────────────────────
|
|
async function loadOnlinePlayers() {
|
|
const status = document.getElementById('online-status');
|
|
const results = document.getElementById('online-results');
|
|
hideStatus(status); results.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/online-players');
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); results.innerHTML = ''; return; }
|
|
if (!d.players || d.players.length === 0) { results.innerHTML = 'No players online.'; return; }
|
|
let html = '<table class="result-table"><tr><th>PCID</th><th>Name</th><th>Status</th><th>Last Activity</th></tr>';
|
|
for (const p of d.players) {
|
|
html += `<tr><td>${p.player_controller_id||''}</td><td>${esc(p.character_name||'')}</td><td>${esc(p.online_status||'')}</td><td>${esc(p.last_avatar_activity||'')}</td></tr>`;
|
|
}
|
|
html += '</table>';
|
|
results.innerHTML = html;
|
|
} catch(e) { showError(status, e.message); results.innerHTML = ''; }
|
|
}
|
|
|
|
// ── Adjust Currency ─────────────────────────────────────────────────
|
|
async function adjustCurrency() {
|
|
const pid = document.getElementById('currency-pid').value.trim();
|
|
const cid = document.getElementById('currency-cid').value;
|
|
const delta = document.getElementById('currency-delta').value.trim();
|
|
const status = document.getElementById('currency-status');
|
|
if (!pid || !delta) { showError(status, 'Fill all fields.'); return; }
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/adjust-currency', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ player_controller_id: parseInt(pid), currency_id: parseInt(cid), delta: parseInt(delta) })
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
async function viewCurrency() {
|
|
const pid = document.getElementById('currency-pid').value.trim();
|
|
const status = document.getElementById('currency-status');
|
|
const view = document.getElementById('currency-view');
|
|
if (!pid) { showError(status, 'Enter Player Controller ID.'); return; }
|
|
hideStatus(status); view.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/currency-balances', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ player_controller_id: parseInt(pid) })
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); view.innerHTML = ''; return; }
|
|
if (!d.balances || d.balances.length === 0) { view.innerHTML = 'No currency records.'; return; }
|
|
let html = '<table class="result-table"><tr><th>Currency ID</th><th>Balance</th></tr>';
|
|
for (const b of d.balances) {
|
|
html += `<tr><td>${b.currency_id}</td><td>${b.balance}</td></tr>`;
|
|
}
|
|
html += '</table>';
|
|
view.innerHTML = html;
|
|
} catch(e) { showError(status, e.message); view.innerHTML = ''; }
|
|
}
|
|
|
|
// ── Change Faction ─────────────────────────────────────────────────
|
|
async function changeFaction() {
|
|
const pid = document.getElementById('faction-pid').value.trim();
|
|
const fid = document.getElementById('faction-id').value;
|
|
const status = document.getElementById('faction-status');
|
|
if (!pid) { showError(status, 'Enter Player ID.'); return; }
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/change-faction', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ player_id: parseInt(pid), faction_id: parseInt(fid) })
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
// ── Teleport Player ─────────────────────────────────────────────────
|
|
async function teleportPlayer() {
|
|
const flsid = document.getElementById('teleport-flsid').value.trim();
|
|
const pid = document.getElementById('teleport-pid').value.trim();
|
|
const x = document.getElementById('teleport-x').value.trim();
|
|
const y = document.getElementById('teleport-y').value.trim();
|
|
const z = document.getElementById('teleport-z').value.trim();
|
|
const status = document.getElementById('teleport-status');
|
|
const view = document.getElementById('teleport-view');
|
|
if (!flsid || !pid) { showError(status, 'FLS ID and Partition ID required.'); return; }
|
|
hideStatus(status); view.innerHTML = 'Teleporting...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/teleport', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ fls_id: flsid, partition_id: parseInt(pid), x: parseFloat(x) || 0, y: parseFloat(y) || 0, z: parseFloat(z) || 0 })
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
view.innerHTML = '';
|
|
} catch(e) { showError(status, e.message); view.innerHTML = ''; }
|
|
}
|
|
|
|
async function loadPartitions() {
|
|
const status = document.getElementById('teleport-status');
|
|
const view = document.getElementById('teleport-view');
|
|
hideStatus(status); view.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/partitions');
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); view.innerHTML = ''; return; }
|
|
if (!d.partitions || d.partitions.length === 0) { view.innerHTML = 'No partitions found.'; return; }
|
|
let html = '<table class="result-table"><tr><th>ID</th><th>Map</th><th>Dim</th><th>Label</th></tr>';
|
|
for (const p of d.partitions) {
|
|
html += `<tr><td>${p.id}</td><td>${esc(p.map)}</td><td>${p.dimension_index}</td><td>${esc(p.label || '')}</td></tr>`;
|
|
}
|
|
html += '</table>';
|
|
view.innerHTML = html;
|
|
} catch(e) { showError(status, e.message); view.innerHTML = ''; }
|
|
}
|
|
|
|
// ── Faction Reputation ──────────────────────────────────────────────
|
|
async function getReputation() {
|
|
const actor = document.getElementById('rep-actor').value.trim();
|
|
const status = document.getElementById('rep-status');
|
|
const view = document.getElementById('rep-view');
|
|
if (!actor) { showError(status, 'Enter Actor ID.'); return; }
|
|
hideStatus(status); view.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/faction-reputation', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ actor_id: parseInt(actor) })
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); view.innerHTML = ''; return; }
|
|
if (!d.reputation || d.reputation.length === 0) { view.innerHTML = 'No reputation data.'; return; }
|
|
view.innerHTML = `<table class="result-table"><tr><th>Faction ID</th><th>Reputation</th></tr>${d.reputation.map(r => `<tr><td>${r.faction_id||r.out_faction_id||''}</td><td>${r.reputation_amount||r.out_reputation_amount||''}</td></tr>`).join('')}</table>`;
|
|
} catch(e) { showError(status, e.message); view.innerHTML = ''; }
|
|
}
|
|
|
|
async function setReputation() {
|
|
const actor = document.getElementById('rep-actor').value.trim();
|
|
const faction = document.getElementById('rep-faction').value;
|
|
const amount = document.getElementById('rep-amount').value.trim();
|
|
const status = document.getElementById('rep-status');
|
|
if (!actor || !amount) { showError(status, 'Fill all fields.'); return; }
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/faction-reputation', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ actor_id: parseInt(actor), set: true, faction_id: parseInt(faction), amount: parseInt(amount) })
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
// ── Inventory Lookup ────────────────────────────────────────────────
|
|
async function loadInventory() {
|
|
const account = document.getElementById('inv-account').value.trim();
|
|
const status = document.getElementById('inv-status');
|
|
const output = document.getElementById('inv-output');
|
|
if (!account) { showError(status, 'Enter Account ID.'); return; }
|
|
hideStatus(status); output.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/inventory', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ account_id: parseInt(account) })
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); output.innerHTML = ''; return; }
|
|
let html = '';
|
|
if (d.pawn && d.pawn.length) {
|
|
html += '<strong>Pawn Info:</strong><table class="result-table"><tr><th>Pawn ID</th><th>Class</th><th>Map</th></tr>';
|
|
for (const p of d.pawn) html += `<tr><td>${p.id||''}</td><td>${esc(p.class||'')}</td><td>${esc(p.map||'')}</td></tr>`;
|
|
html += '</table>';
|
|
}
|
|
if (d.inventory && d.inventory.length) {
|
|
html += '<strong>Inventory (' + d.inventory.length + ' items):</strong><div style="max-height:200px;overflow:auto;"><table class="result-table"><tr><th>Item ID</th><th>Template ID</th><th>Count</th></tr>';
|
|
for (const item of d.inventory.slice(0, 50)) {
|
|
html += `<tr><td>${item.item_id||item.id||''}</td><td>${esc(item.template_id||'')}</td><td>${item.count||item.quantity||''}</td></tr>`;
|
|
}
|
|
if (d.inventory.length > 50) html += `<tr><td colspan="3">... ${d.inventory.length - 50} more items</td></tr>`;
|
|
html += '</table></div>';
|
|
} else {
|
|
html += '<p>No inventory data.</p>';
|
|
}
|
|
output.innerHTML = html || 'No data.';
|
|
} catch(e) { showError(status, e.message); output.innerHTML = ''; }
|
|
}
|
|
|
|
// ── Guild Tools ─────────────────────────────────────────────────────
|
|
async function listGuilds() {
|
|
const status = document.getElementById('guild-status');
|
|
const view = document.getElementById('guild-view');
|
|
hideStatus(status); view.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/guilds');
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); view.innerHTML = ''; return; }
|
|
if (!d.guilds || d.guilds.length === 0) { view.innerHTML = 'No guilds.'; return; }
|
|
let html = '<table class="result-table"><tr><th>ID</th><th>Name</th><th>Members</th></tr>';
|
|
for (const g of d.guilds) {
|
|
html += `<tr><td>${g.id||g.guild_id||''}</td><td>${esc(g.name||g.guild_name||'')}</td><td>${g.member_count||''}</td></tr>`;
|
|
}
|
|
html += '</table>';
|
|
view.innerHTML = html;
|
|
} catch(e) { showError(status, e.message); view.innerHTML = ''; }
|
|
}
|
|
|
|
async function viewGuild() {
|
|
const id = document.getElementById('guild-id').value.trim();
|
|
const status = document.getElementById('guild-status');
|
|
const view = document.getElementById('guild-view');
|
|
if (!id) { showError(status, 'Enter Guild ID.'); return; }
|
|
hideStatus(status); view.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/guild-data', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ guild_id: parseInt(id) })
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); view.innerHTML = ''; return; }
|
|
view.innerHTML = '<pre style="font-size:11px;">' + esc(JSON.stringify(d.guild, null, 2)) + '</pre>';
|
|
} catch(e) { showError(status, e.message); view.innerHTML = ''; }
|
|
}
|
|
|
|
async function disbandGuild() {
|
|
const id = document.getElementById('guild-id').value.trim();
|
|
const status = document.getElementById('guild-status');
|
|
if (!id || !confirm('Really disband guild ' + id + '?')) return;
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/disband-guild', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ guild_id: parseInt(id) })
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
if (d.success) listGuilds();
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
async function kickGuildMember() {
|
|
const guild = document.getElementById('guild-id').value.trim();
|
|
const player = document.getElementById('guild-kick-player').value.trim();
|
|
const status = document.getElementById('guild-status');
|
|
if (!guild || !player) { showError(status, 'Enter Guild ID and Player ID.'); return; }
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/remove-guild-member', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ guild_id: parseInt(guild), player_id: parseInt(player) })
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
// ── Player Tags ─────────────────────────────────────────────────────
|
|
async function viewTags() {
|
|
const account = document.getElementById('tags-account').value.trim();
|
|
const status = document.getElementById('tags-status');
|
|
const view = document.getElementById('tags-view');
|
|
if (!account) { showError(status, 'Enter Account ID.'); return; }
|
|
hideStatus(status); view.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/player-tags', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ account_id: parseInt(account) })
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); view.innerHTML = ''; return; }
|
|
view.innerHTML = '<pre style="font-size:11px;">' + esc(JSON.stringify(d.tags, null, 2)) + '</pre>';
|
|
} catch(e) { showError(status, e.message); view.innerHTML = ''; }
|
|
}
|
|
|
|
async function updateTags() {
|
|
const account = document.getElementById('tags-account').value.trim();
|
|
const add = document.getElementById('tags-add').value.trim().split(',').map(s => s.trim()).filter(Boolean);
|
|
const remove = document.getElementById('tags-remove').value.trim().split(',').map(s => s.trim()).filter(Boolean);
|
|
const status = document.getElementById('tags-status');
|
|
if (!account) { showError(status, 'Enter Account ID.'); return; }
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/player-tags', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ account_id: parseInt(account), tags_to_add: add, tags_to_remove: remove })
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
async function flagCheater() {
|
|
const account = document.getElementById('cheater-account').value.trim();
|
|
const type = document.getElementById('cheater-type').value;
|
|
const status = document.getElementById('cheater-status');
|
|
if (!account) { showError(status, 'Enter Account ID.'); return; }
|
|
if (!confirm('Flag account ' + account + ' as ' + type + ' cheater?')) return;
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/flag-cheater', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ account_id: parseInt(account), cheat_type: type })
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
// ── Player Vehicles ─────────────────────────────────────────────────
|
|
async function loadVehicles() {
|
|
const player = document.getElementById('veh-player').value.trim();
|
|
const account = document.getElementById('veh-account').value.trim();
|
|
const status = document.getElementById('veh-status');
|
|
const output = document.getElementById('veh-output');
|
|
if (!player || !account) { showError(status, 'Enter both Player ID and Account ID.'); return; }
|
|
hideStatus(status); output.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/player-vehicles', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ player_id: parseInt(player), account_id: parseInt(account) })
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); output.innerHTML = ''; return; }
|
|
if (!d.vehicles || d.vehicles.length === 0) { output.innerHTML = 'No vehicles found.'; return; }
|
|
let html = '<table class="result-table"><tr><th>Vehicle ID</th><th>Data</th></tr>';
|
|
for (const v of d.vehicles) {
|
|
html += `<tr><td>${v.vehicle_id||v.id||''}</td><td><pre style="font-size:10px;margin:0;">${esc(JSON.stringify(v, null, 2).slice(0,500))}</pre></td></tr>`;
|
|
}
|
|
html += '</table>';
|
|
output.innerHTML = html;
|
|
} catch(e) { showError(status, e.message); output.innerHTML = ''; }
|
|
}
|
|
|
|
// ── Player Stats ──────────────────────────────────────────────────
|
|
async function loadPlayerStats() {
|
|
const pcid = document.getElementById('stats-pcid').value.trim();
|
|
const status = document.getElementById('stats-status');
|
|
const output = document.getElementById('stats-output');
|
|
if (!pcid) { showError(status, 'Enter Player Controller ID.'); return; }
|
|
hideStatus(status); output.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/player-stats', {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ player_controller_id: parseInt(pcid) })
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); output.innerHTML = ''; return; }
|
|
if (!d.stats) { output.innerHTML = 'No stats found.'; return; }
|
|
const s = d.stats;
|
|
let html = `<table class="result-table">
|
|
<tr><th>Stat</th><th>Value</th></tr>
|
|
<tr><td>Health</td><td>${s.health ? s.health.current + ' / ' + s.health.max : 'N/A'}</td></tr>
|
|
<tr><td>Eyes of Ibad</td><td>${s.eyes_of_ibad != null ? s.eyes_of_ibad : 'N/A'}</td></tr>
|
|
<tr><td>Heatstroke</td><td>${s.heatstroke != null ? s.heatstroke : 'N/A'}</td></tr>
|
|
<tr><td>Driving</td><td>${s.is_driving != null ? s.is_driving : 'N/A'}</td></tr>
|
|
<tr><td>Spice Exposure Level</td><td>${s.spice_exposure_level != null ? s.spice_exposure_level : 'N/A'}</td></tr>
|
|
<tr><td>Daily Reward Charges</td><td>${s.daily_reward_charges != null ? s.daily_reward_charges : 'N/A'}</td></tr>
|
|
<tr><td>Last Viewed Term</td><td>${s.last_viewed_term != null ? s.last_viewed_term : 'N/A'}</td></tr>
|
|
</table>`;
|
|
output.innerHTML = html;
|
|
} catch(e) { showError(status, e.message); output.innerHTML = ''; }
|
|
}
|
|
|
|
// ── Character Management ──────────────────────────────────────────
|
|
async function setCharacterName() {
|
|
const account = document.getElementById('char-account').value.trim();
|
|
const name = document.getElementById('char-newname').value.trim();
|
|
const status = document.getElementById('char-status');
|
|
if (!account || !name) { showError(status, 'Enter Account ID and new name.'); return; }
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/set-character-name', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({account_id: parseInt(account), name})
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
async function deleteCharacter() {
|
|
const account = document.getElementById('char-account').value.trim();
|
|
const status = document.getElementById('char-status');
|
|
if (!account || !confirm('Delete character for account ' + account + '?')) return;
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/delete-character', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({actor_id: parseInt(account)})
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
async function deleteAccount() {
|
|
const user = document.getElementById('char-userid').value.trim();
|
|
const status = document.getElementById('char-status');
|
|
if (!user || !confirm('DELETE account ' + user + '? This cannot be undone!')) return;
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/delete-account', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({user_id: user, reason: 'admin'})
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
async function setDemoState() {
|
|
const user = document.getElementById('char-userid').value.trim();
|
|
const state = document.getElementById('char-demo').value;
|
|
const status = document.getElementById('char-status');
|
|
if (!user) { showError(status, 'Enter User ID.'); return; }
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/set-demo-state', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({user_id: user, demo_state: state})
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
// ── Journey ────────────────────────────────────────────────────────
|
|
async function journeyAction(action) {
|
|
const account = document.getElementById('journey-account').value.trim();
|
|
const nodes = document.getElementById('journey-nodes').value.trim().split(',').map(s=>s.trim()).filter(Boolean);
|
|
const status = document.getElementById('journey-status');
|
|
if (!account || !nodes.length) { showError(status, 'Enter Account ID and at least one Node ID.'); return; }
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/journey', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({account_id: parseInt(account), node_ids: nodes, action})
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
async function setSpecialization() {
|
|
const player = document.getElementById('spec-player').value.trim();
|
|
const track = document.getElementById('spec-track').value;
|
|
const xp = document.getElementById('spec-xp').value.trim();
|
|
const level = document.getElementById('spec-level').value.trim();
|
|
const status = document.getElementById('journey-status');
|
|
if (!player) { showError(status, 'Enter Player ID.'); return; }
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/specialization', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({player_id: parseInt(player), track_type: track, xp: parseInt(xp), level: parseInt(level)})
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
async function resetSpecialization() {
|
|
const player = document.getElementById('spec-player').value.trim();
|
|
const status = document.getElementById('journey-status');
|
|
if (!player) { showError(status, 'Enter Player ID.'); return; }
|
|
if (!confirm('Reset all specialization tracks for player ' + player + '?')) return;
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/specialization', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({player_id: parseInt(player), reset: true})
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
// ── Economy ────────────────────────────────────────────────────────
|
|
async function cleanVendorStock() {
|
|
const player = document.getElementById('econ-player').value.trim();
|
|
const status = document.getElementById('econ-status');
|
|
if (!player) { showError(status, 'Enter Player ID.'); return; }
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/clean-vendor-stock', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({player_id: parseInt(player)})
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
async function viewTaxInvoices() {
|
|
const player = document.getElementById('econ-player').value.trim();
|
|
const status = document.getElementById('econ-status');
|
|
const output = document.getElementById('tax-output');
|
|
if (!player) { showError(status, 'Enter Player ID.'); return; }
|
|
hideStatus(status); output.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/tax-invoices', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({player_id: parseInt(player)})
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); output.innerHTML = ''; return; }
|
|
output.innerHTML = '<pre style="font-size:10px;margin:0;">' + esc(JSON.stringify(d.invoices, null, 2)) + '</pre>';
|
|
} catch(e) { showError(status, e.message); output.innerHTML = ''; }
|
|
}
|
|
|
|
async function resetSpice() {
|
|
const map = document.getElementById('spice-map').value.trim();
|
|
const dim = document.getElementById('spice-dim').value.trim();
|
|
const status = document.getElementById('econ-status');
|
|
if (!map) { showError(status, 'Enter Map name.'); return; }
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/spice', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({action: 'reset', map_name: map, dimension_index: parseInt(dim)})
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
// ── Server Tools ───────────────────────────────────────────────────
|
|
async function setPlayersOffline() {
|
|
const status = document.getElementById('server-status');
|
|
if (!confirm('Set all players offline on active servers?')) return;
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/server-tools', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({action: 'set_offline', server_ids: ['all']})
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
async function cleanupOrphans() {
|
|
const status = document.getElementById('server-status');
|
|
if (!confirm('Clean up orphaned database entities?')) return;
|
|
hideStatus(status);
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/server-tools', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({action: 'cleanup_orphans'})
|
|
});
|
|
const d = await r.json();
|
|
d.success ? showSuccess(status, d.output) : showError(status, d.output);
|
|
} catch(e) { showError(status, e.message); }
|
|
}
|
|
|
|
async function viewPermissions() {
|
|
const actor = document.getElementById('perm-actor').value.trim();
|
|
const status = document.getElementById('server-status');
|
|
const output = document.getElementById('perm-output');
|
|
if (!actor) { showError(status, 'Enter Actor ID.'); return; }
|
|
hideStatus(status); output.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/permissions', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({actor_id: parseInt(actor)})
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); output.innerHTML = ''; return; }
|
|
output.innerHTML = '<pre style="font-size:10px;margin:0;">' + esc(JSON.stringify(d.permissions, null, 2)) + '</pre>';
|
|
} catch(e) { showError(status, e.message); output.innerHTML = ''; }
|
|
}
|
|
|
|
// ── Battlegroup Info ───────────────────────────────────────────────
|
|
async function loadBattlegroup() {
|
|
const status = document.getElementById('bg-status');
|
|
const output = document.getElementById('bg-output');
|
|
hideStatus(status); output.textContent = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/battlegroup');
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); output.textContent = ''; return; }
|
|
output.textContent = JSON.stringify(d.data, null, 2);
|
|
} catch(e) { showError(status, e.message); output.textContent = ''; }
|
|
}
|
|
|
|
// ── Function Explorer ────────────────────────────────────────────
|
|
let allFunctions = [];
|
|
|
|
async function loadFunctions() {
|
|
const status = document.getElementById('fx-status');
|
|
const list = document.getElementById('fx-list');
|
|
hideStatus(status); list.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/functions');
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); list.innerHTML = ''; return; }
|
|
allFunctions = d.functions || [];
|
|
renderFunctionList('');
|
|
} catch(e) { showError(status, e.message); list.innerHTML = ''; }
|
|
}
|
|
|
|
function filterFunctions() {
|
|
const filter = document.getElementById('fx-filter').value.trim().toLowerCase();
|
|
renderFunctionList(filter);
|
|
}
|
|
|
|
function renderFunctionList(filter) {
|
|
const list = document.getElementById('fx-list');
|
|
const filtered = filter ? allFunctions.filter(f => f.name.toLowerCase().includes(filter)) : allFunctions;
|
|
if (!filtered.length) { list.innerHTML = '<span style="color:var(--text-muted);">No functions match.</span>'; return; }
|
|
let html = '';
|
|
for (const f of filtered) {
|
|
const args = f.args || '';
|
|
const display = args.length > 50 ? args.slice(0, 47) + '...' : args;
|
|
html += `<div onclick="showFunction('${f.name}')" style="cursor:pointer;padding:3px 6px;border-radius:3px;hover:background:var(--accent);" onmouseover="this.style.background='var(--accent)'" onmouseout="this.style.background=''">${esc(f.name)}(${esc(display)})</div>`;
|
|
}
|
|
list.innerHTML = html || '<span style="color:var(--text-muted);">No functions.</span>';
|
|
}
|
|
|
|
async function showFunction(name) {
|
|
const detail = document.getElementById('fx-detail');
|
|
detail.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch(`/api/admin-experimental/functions/${name}`);
|
|
const d = await r.json();
|
|
if (!d.success) { detail.innerHTML = `<span style="color:#e74c3c;">${esc(d.error)}</span>`; return; }
|
|
const fn = d.function;
|
|
const args = (fn.args || '').split(',').map(s => s.trim()).filter(Boolean);
|
|
let html = `<strong style="font-size:14px;">${esc(fn.name)}</strong>`;
|
|
html += `<div style="margin:8px 0;padding:8px;background:var(--bg-input);border-radius:4px;font-size:11px;font-family:monospace;max-height:150px;overflow:auto;white-space:pre-wrap;">${esc(fn.definition || 'No definition available.')}</div>`;
|
|
if (args.length) {
|
|
html += '<div style="margin:8px 0;"><strong>Parameters:</strong></div>';
|
|
for (let i = 0; i < args.length; i++) {
|
|
html += `<div style="display:flex;gap:4px;margin-bottom:4px;align-items:center;">
|
|
<span style="font-size:11px;min-width:120px;color:var(--text-muted);">${esc(args[i])}</span>
|
|
<input type="text" id="fx-param-${i}" placeholder="Value" style="flex:1;padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:3px;color:var(--text);font-size:12px;">
|
|
</div>`;
|
|
}
|
|
html += `<button onclick="executeFunction('${esc(fn.name)}', ${args.length})" style="margin-top:8px;padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Execute</button>`;
|
|
} else {
|
|
html += `<button onclick="executeFunction('${esc(fn.name)}', 0)" style="margin-top:8px;padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;">Execute (no params)</button>`;
|
|
}
|
|
html += '<div id="fx-result" style="margin-top:8px;"></div>';
|
|
detail.innerHTML = html;
|
|
} catch(e) { detail.innerHTML = `<span style="color:#e74c3c;">${esc(e.message)}</span>`; }
|
|
}
|
|
|
|
async function executeFunction(name, paramCount) {
|
|
const status = document.getElementById('fx-status');
|
|
const resultDiv = document.getElementById('fx-result');
|
|
if (!resultDiv) return;
|
|
const params = [];
|
|
for (let i = 0; i < paramCount; i++) {
|
|
const el = document.getElementById(`fx-param-${i}`);
|
|
if (el) {
|
|
let val = el.value.trim();
|
|
// Try to parse numbers
|
|
if (val === 'true') val = true;
|
|
else if (val === 'false') val = false;
|
|
else if (val !== '' && !isNaN(val) && val.includes('.')) val = parseFloat(val);
|
|
else if (val !== '' && !isNaN(val)) val = parseInt(val);
|
|
params.push(val);
|
|
}
|
|
}
|
|
hideStatus(status); resultDiv.innerHTML = 'Executing...';
|
|
try {
|
|
const r = await csrfFetch(`/api/admin-experimental/functions/${name}/execute`, {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({params})
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { resultDiv.innerHTML = `<div class="error-banner error" style="display:block;">${esc(d.error)}</div>`; return; }
|
|
resultDiv.innerHTML = '<pre style="font-size:11px;background:var(--bg-input);padding:8px;border-radius:4px;max-height:300px;overflow:auto;">' + esc(JSON.stringify(d.result, null, 2)) + '</pre>';
|
|
} catch(e) { resultDiv.innerHTML = `<div class="error-banner error" style="display:block;">${esc(e.message)}</div>`; }
|
|
}
|
|
|
|
// ── RMQ Explorer ─────────────────────────────────────────────────
|
|
async function loadRmqOverview() {
|
|
const status = document.getElementById('rmq-overview-status');
|
|
const output = document.getElementById('rmq-overview-data');
|
|
hideStatus(status); output.textContent = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/rmq/overview');
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); output.textContent = ''; return; }
|
|
output.textContent = JSON.stringify(d.data, null, 2);
|
|
} catch(e) { showError(status, e.message); output.textContent = ''; }
|
|
}
|
|
|
|
async function loadRmqQueues() {
|
|
const status = document.getElementById('rmq-queues-status');
|
|
const output = document.getElementById('rmq-queues-data');
|
|
hideStatus(status); output.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/rmq/queues');
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); output.innerHTML = ''; return; }
|
|
const data = d.data || {};
|
|
let html = '';
|
|
for (const [side, queues] of Object.entries(data)) {
|
|
html += `<h4 style="margin:8px 0 4px;font-size:12px;color:var(--text)">RMQ ${side.toUpperCase()}</h4>`;
|
|
if (!queues || !queues.length) { html += '<p style="font-size:11px;color:var(--text-muted)">No queues or connection failed</p>'; continue; }
|
|
html += '<table class="result-table"><tr><th>Name</th><th>State</th><th>Ready</th><th>Consumers</th></tr>';
|
|
for (const q of queues) {
|
|
html += `<tr><td style="font-size:10px;word-break:break-all">${esc(q.name||'?')}</td>`;
|
|
html += `<td>${esc(String(q.state||''))}</td>`;
|
|
html += `<td>${q.messages_ready||0}</td><td>${q.consumers||0}</td></tr>`;
|
|
}
|
|
html += '</table>';
|
|
}
|
|
output.innerHTML = html;
|
|
} catch(e) { showError(status, e.message); output.innerHTML = ''; }
|
|
}
|
|
|
|
async function loadRmqExchanges() {
|
|
const status = document.getElementById('rmq-exchanges-status');
|
|
const output = document.getElementById('rmq-exchanges-data');
|
|
hideStatus(status); output.innerHTML = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/rmq/exchanges');
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); output.innerHTML = ''; return; }
|
|
const data = d.data || {};
|
|
let html = '';
|
|
for (const [side, exchanges] of Object.entries(data)) {
|
|
html += `<h4 style="margin:8px 0 4px;font-size:12px;color:var(--text)">RMQ ${side.toUpperCase()}</h4>`;
|
|
if (!exchanges || !exchanges.length) { html += '<p style="font-size:11px;color:var(--text-muted)">No exchanges or connection failed</p>'; continue; }
|
|
html += '<table class="result-table"><tr><th>Name</th><th>Type</th><th>Durable</th><th>Msgs</th></tr>';
|
|
for (const x of exchanges) {
|
|
html += `<tr><td style="font-size:10px;word-break:break-all">${esc(x.name||'?')}</td>`;
|
|
html += `<td>${esc(x.type||'')}</td><td>${x.durable?'Yes':'No'}</td>`;
|
|
html += `<td>${x.message_stats?.publish_in||0}</td></tr>`;
|
|
}
|
|
html += '</table>';
|
|
}
|
|
output.innerHTML = html;
|
|
} catch(e) { showError(status, e.message); output.innerHTML = ''; }
|
|
}
|
|
|
|
async function peekRmqMessages() {
|
|
const status = document.getElementById('rmq-peek-status');
|
|
const output = document.getElementById('rmq-peek-data');
|
|
const queue = document.getElementById('rmq-peek-queue').value.trim();
|
|
const count = parseInt(document.getElementById('rmq-peek-count').value) || 5;
|
|
if (!queue) { showError(status, 'Enter a queue name'); return; }
|
|
hideStatus(status); output.textContent = 'Loading...';
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/rmq/peek', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({queue, count})
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); output.textContent = ''; return; }
|
|
output.textContent = JSON.stringify(d.data, null, 2);
|
|
} catch(e) { showError(status, e.message); output.textContent = ''; }
|
|
}
|
|
|
|
async function publishRmqMessage() {
|
|
const status = document.getElementById('rmq-publish-status');
|
|
const output = document.getElementById('rmq-publish-data');
|
|
const side = document.getElementById('rmq-publish-side').value;
|
|
const exchange = document.getElementById('rmq-publish-exchange').value.trim();
|
|
const routing_key = document.getElementById('rmq-publish-routing').value.trim();
|
|
const messageStr = document.getElementById('rmq-publish-message').value.trim();
|
|
if (!exchange) { showError(status, 'Enter an exchange name'); return; }
|
|
hideStatus(status); output.textContent = 'Publishing...';
|
|
let message = messageStr;
|
|
try { message = JSON.parse(messageStr); } catch(_) {}
|
|
try {
|
|
const r = await csrfFetch('/api/admin-experimental/rmq/publish', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({exchange, routing_key, message, side})
|
|
});
|
|
const d = await r.json();
|
|
if (!d.success) { showError(status, d.error); output.textContent = ''; return; }
|
|
output.textContent = JSON.stringify(d.data, null, 2);
|
|
} catch(e) { showError(status, e.message); output.textContent = ''; }
|
|
}
|
|
|
|
// ── Helpers ─────────────────────────────────────────────────────────
|
|
function esc(s) { if (!s) return ''; return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); }
|
|
function showError(el, msg) { el.className = 'error-banner error'; el.textContent = msg; el.style.display = 'block'; }
|
|
function showSuccess(el, msg) { el.className = 'error-banner success'; el.textContent = msg; el.style.display = 'block'; }
|
|
function hideStatus(el) { el.style.display = 'none'; }
|
|
|
|
function acceptExperimental() {
|
|
document.getElementById('exp-gate').style.display = 'none';
|
|
document.getElementById('exp-content').style.display = 'block';
|
|
localStorage.setItem('exp-warning-accepted', '1');
|
|
}
|
|
|
|
function denyExperimental() {
|
|
localStorage.removeItem('exp-warning-accepted');
|
|
window.location.href = '/';
|
|
}
|
|
|
|
(function() {
|
|
if (localStorage.getItem('exp-warning-accepted') === '1') {
|
|
acceptExperimental();
|
|
}
|
|
})();
|
|
</script>
|
|
|
|
{% endblock %}
|