mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
- Discord: the account page links a player's Discord account through Discord's sign-in (lib/discord.js); only linked names are shown on cards (typed ones are cleared). A bot keeps the Server Booster badge on linked accounts that boost. The game tells the client where the player is, for the client's Discord rich presence (flashvars discordAppId). - @username tags in chat, chat balloons and wall posts: only real players' names (asked of the server, "xmn"), names with spaces too, drawn on a blue box; a click opens the player's card. - Settings: separate Music and SFX volume sliders for the old one. - Device ids required: a launcher that sends none (before 1.3.0) is told at the game's login "Your client is outdated. Update at https://burrow.moe/download". AJ_REQUIRE_DEVICE=0 turns it off. - Panels: clear a player's Jammer Wall posts; turning away masterpieces and player items asks first. - Item Giver: negative colour ids (the same colour written signed). - buildVersion 71; the client rebuilt with Snipzil's sitting fix.
133 lines
4.4 KiB
HTML
133 lines
4.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Game Client</title>
|
|
</head>
|
|
<body>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
overflow: hidden;
|
|
}
|
|
</style>
|
|
<embed id="flash-content"></embed>
|
|
<script>
|
|
"use strict";
|
|
|
|
// local stand-in for desktop.animaljam.com/gameClient/game/index.html.
|
|
// same contract with the launcher (gui/gamePreload.js) and the SWF.
|
|
|
|
const flashContent = document.getElementById("flash-content");
|
|
// only a SWF from this server may call into this page. with "always"
|
|
// any SWF the game came to load, from anywhere, could: and this page
|
|
// is handed the player's login token.
|
|
flashContent.setAttribute("allowScriptAccess", "sameDomain");
|
|
flashContent.setAttribute("wmode", "window");
|
|
flashContent.style.width = "100vw";
|
|
flashContent.style.height = "100vh";
|
|
|
|
window.ipc.on("flashVarsReady", (event, flashVars) => {
|
|
const flashVarsParams = Object.entries(flashVars)
|
|
.map(([key, val]) => `${encodeURIComponent(key)}=${encodeURIComponent(val)}`)
|
|
.join("&");
|
|
|
|
flashContent.setAttribute("FlashVars", flashVarsParams);
|
|
// the game from the address this page came from, whatever name the
|
|
// server knows itself by: "sameDomain" above goes by that.
|
|
const client = new URL(flashVars.clientURL, location.href);
|
|
flashContent.src = location.origin + client.pathname + client.search;
|
|
flashContent.style.display = "block";
|
|
});
|
|
|
|
window.ipc.on("removed", () => document.body.innerHTML = "");
|
|
|
|
// the client's top bar: the game's HUD shown or hidden (AJClient.setHudShown
|
|
// in the patched SWF).
|
|
window.ipc.on("hud", (event, shown) => {
|
|
try {
|
|
flashContent.ajHud(shown === true);
|
|
}
|
|
catch (err) {
|
|
// not this server's SWF, or the game is not up yet.
|
|
}
|
|
});
|
|
|
|
window.addEventListener("resize", resize);
|
|
|
|
// ExternalInterface functions called by the SWF.
|
|
function complete_signup(username, password) {
|
|
window.ipc.sendToHost("signupCompleted", {username, password});
|
|
}
|
|
|
|
function aj_initialized() {
|
|
// the game has read its start values; the login token among them
|
|
// need not stay in the page.
|
|
flashContent.removeAttribute("FlashVars");
|
|
window.ipc.sendToHost("initialized");
|
|
for (let i = 0; i < 50; i++) {
|
|
setTimeout(() => resize(), i * 500);
|
|
}
|
|
}
|
|
|
|
// pictures drawn in the last second, told by the patched SWF once a
|
|
// second (AJClient.onSmoothFrame), for the client's top bar.
|
|
function ajFps(count) {
|
|
window.ipc.sendToHost("fps", count);
|
|
}
|
|
|
|
// an address the SWF wants open (AJClient.finderLink): the client opens
|
|
// it in the system browser, being a webview that may open no window.
|
|
function ajOpenPage(url) {
|
|
if (/^https:\/\//.test(String(url))) {
|
|
window.ipc.sendToHost("openPage", String(url));
|
|
}
|
|
}
|
|
|
|
// where the player is, for the client's Discord rich presence
|
|
// (AJClient.presenceRoom): a short line such as "In Jamaa Township".
|
|
function ajPresence(text) {
|
|
window.ipc.sendToHost("presence", String(text).slice(0, 100));
|
|
}
|
|
|
|
function ajPrint(imageData) {
|
|
window.ipc.sendToHost("printImage", imageData);
|
|
}
|
|
|
|
function reloadSwfOrGetIP(reloadSwf, params) {
|
|
window.ipc.sendToHost("reloadGame", reloadSwf, params);
|
|
}
|
|
|
|
// moderator remote-control and analytics hooks; nothing to do locally.
|
|
function mrc() {}
|
|
function handleGAEvent() {}
|
|
function handleKey() {}
|
|
|
|
function resize() {
|
|
if (flashContent && flashContent.handleResize) {
|
|
try {
|
|
flashContent.handleResize(window.innerWidth, window.innerHeight);
|
|
}
|
|
catch (err) {
|
|
}
|
|
}
|
|
}
|
|
|
|
window.addEventListener("error", event => {
|
|
window.ipc.sendToHost("reportError", (event.error && event.error.stack) || event.message);
|
|
});
|
|
|
|
window.addEventListener("beforeunload", event => {
|
|
if (flashContent && typeof flashContent.unloadAJClient === "function") {
|
|
try {
|
|
flashContent.unloadAJClient();
|
|
}
|
|
catch (err) {
|
|
}
|
|
}
|
|
delete event["returnValue"];
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|