mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 01:27:51 -05:00
feat: discord linking, @tags, music and sfx sliders, required device ids
- 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.
This commit is contained in:
1 parent
1d9b70f32e
commit
33f56074a4
35 files changed
+2076
-101
No files matched your search
+47
-3
@@ -146,6 +146,11 @@ const MAX_USER_VARS = 2000;
|
||||
const MAX_FILTER_WORDS = 100; // a player's own words for their chat filter
|
||||
const MAX_FILTER_WORD = 30;
|
||||
const LOGIN_BANNED = -15; // MainFrame.MSG_ID_LOGIN_BANNED
|
||||
// MainFrame.MSG_ID_LOGIN_ACCT_MAINT: its popup (GamePlay.onWorldLogIn) shows
|
||||
// localization string 11198, which lib/defpacks.js makes the "update your
|
||||
// client" message. the official servers' account maintenance never happens
|
||||
// here.
|
||||
const LOGIN_OUTDATED = -12;
|
||||
|
||||
const THEME_PATH_PREFIX = "theme_"; // lib/http.js looks for this
|
||||
const chatLines = limits.limiter(config.chatLinesPerWindow, config.chatWindowMs);
|
||||
@@ -183,6 +188,26 @@ const sees = (viewer, subject) => (!subject.invisible || roles.isActiveStaff(vie
|
||||
const watchers = session => others(session).filter(other => sees(other, session));
|
||||
const TYPING_EVERY_MS = 2000; // "typing" passed on at most this often per player (xty)
|
||||
|
||||
// tags ("@name") in chat and on Jammer Walls (xmn): the longest player's
|
||||
// name that the text after an "@" starts with, ending where a word does
|
||||
// ("@John Smith hi" is John Smith if there is one, else John; "@Bobby" is
|
||||
// never Bob). {length, name} or null.
|
||||
const MAX_MENTION_TEXT = 40;
|
||||
const MAX_MENTIONS = 10; // per question
|
||||
const mentionLookups = limits.limiter(120, 60000); // questions a minute, per player
|
||||
const mentionOf = text => {
|
||||
for (let length = Math.min(text.length, MAX_MENTION_TEXT); length > 0; length--) {
|
||||
if (length < text.length && /[A-Za-z0-9]/.test(text[length])) {
|
||||
continue;
|
||||
}
|
||||
const name = accounts.nameOf(text.slice(0, length));
|
||||
if (name) {
|
||||
return {length, name};
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const decodeEntities = text => text
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
@@ -304,9 +329,12 @@ const login = (session, msg) => {
|
||||
loginFailed(session, LOGIN_BANNED, "Banned");
|
||||
return;
|
||||
}
|
||||
if (config.requireDevice && devices.knownFor(account).lastAt < Math.floor(Date.now() / 1000) - 90 * 86400) {
|
||||
console.log(`[world] login rejected for "${logText(account.username)}": no device ids`);
|
||||
loginFailed(session, 0, "Update the client");
|
||||
// a launcher that sent no device ids (before 1.3.0): signed in at
|
||||
// /authenticate, refused here, where the game's popup can say why.
|
||||
if (config.requireDevice && (devices.launcherOutdated(msg.cdata("pword"))
|
||||
|| devices.knownFor(account).lastAt < Math.floor(Date.now() / 1000) - 90 * 86400)) {
|
||||
console.log(`[world] login rejected for "${logText(account.username)}": client outdated (no device ids)`);
|
||||
loginFailed(session, LOGIN_OUTDATED, "Client outdated");
|
||||
return;
|
||||
}
|
||||
// its username was rejected (lib/moderation.js): a new one first, which
|
||||
@@ -912,6 +940,22 @@ const handlers = {
|
||||
}
|
||||
},
|
||||
|
||||
// the patched client's tags (AJClient.resolveMentions): xmn [id, the text
|
||||
// after each "@", ...] -> "xmn" [.., .., id, then for each text: how many
|
||||
// of its characters are a player's name (0 for none), the name as it is
|
||||
// spelled, 1 if they are online]. what a text is not a name of stays text.
|
||||
xmn(session, roomId, [id, ...texts]) {
|
||||
if (!mentionLookups.allow(session.account.id)) {
|
||||
return;
|
||||
}
|
||||
const reply = [];
|
||||
for (const text of texts.slice(0, MAX_MENTIONS)) {
|
||||
const found = mentionOf(String(text));
|
||||
reply.push(found ? found.length : 0, found ? found.name : "", found && findOnline(found.name) ? 1 : 0);
|
||||
}
|
||||
session.sendXt("xmn", -1, Number.isInteger(Number(id)) ? Number(id) : 0, ...reply);
|
||||
},
|
||||
|
||||
// the patched client's staff window: going invisible, or being seen again.
|
||||
xiv(session) {
|
||||
if (session.invisible || roles.can(session.account, "staff.invisible")) {
|
||||
|
||||
Reference in new issue
Block a user