fix: settings, chat, video spots and other bugs from the owner's list

- Jam-A-Gram privacy: the inbox's options were taken the wrong way round
- report window: no instruction text over the reason
- the museum's theatre and other unnamed rooms get names; every shop a title
- "How did you hear?" is never offered (its window soft locked the game)
- video spots with nothing to play open a "Your Video" box on the game page;
  the trade list's help plays a video; the theatre's box no longer vanishes
- emotes, actions and phrases are limited per player, as typed chat is
- phrases from the menus come in the sender's chat bubble style
- settings: WASD, blocked players and custom items as two-sided switches,
  graphics at their best by default, a switch for bubble animations, and
  Manage Account beside two-step sign-in opens the account page
- pressing a @mention in a bubble no longer walks the player there
This commit is contained in:
Burrowdev committed 2026-10-23 21:12:04 +03:00
1 parent e9097a9a4f
commit 22fb7f0fa5
16 files changed
+589 -207

No files matched your search

+28 -5
View File
@@ -129,6 +129,11 @@ const DEF_DEN_ROOM = 1040;
const DEF_CURRENCY_EXCHANGE = 1051;
const DEF_DIAMOND = 1054;
const SHOP_LIST_TYPES = [DEF_ITEM, DEF_DEN_ITEM, DEF_DEN_ROOM, DEF_COMBINED_LIST, DEF_CURRENCY_EXCHANGE, DEF_DIAMOND];
// a shop's title when its room gives it none (a shop in a land's main room,
// or one opened from elsewhere): what it sells (strings in lib/defpacks.js).
// with no title the shop window's banner was blank.
const SHOP_KIND_TITLES = new Map([[DEF_ITEM, 9000010], [DEF_DEN_ITEM, 9000011], [DEF_DEN_ROOM, 9000012],
[DEF_COMBINED_LIST, 9000013], [DEF_CURRENCY_EXCHANGE, 9000014], [DEF_DIAMOND, 9000015]]);
// diamond lists the client reads at login to learn which animals and pets
// cost diamonds. they stay empty: animals and pets are free here.
const DIAMOND_ANIMAL_AND_PET_LISTS = [166, 214, 293];
@@ -150,6 +155,9 @@ const TYPED_NAME = /^[A-Za-z0-9][A-Za-z0-9 '.-]{0,19}$/; // an animal's or pet's
const nameFiltered = name => !String(name).includes("|") && Boolean(chatFilter.broken(String(name)));
const MAX_BLOCKED = 1000; // from the account page; the game's own button has no limit
const TYPED_CHAT_TYPES = ["0", "9"];
// UserCommXtCommManager's safe chat phrase (1), emote (2), action (3),
// attachment (4), slide (6) and pet action (7)
const MOMENTARY_TYPES = ["1", "2", "3", "4", "6", "7"];
const MAX_CHAT_EXTRA = 100; // the field after a chat line's type
const MAX_USER_VARS = 2000;
const MAX_FILTER_WORDS = 100; // a player's own words for their chat filter
@@ -163,6 +171,9 @@ const LOGIN_OUTDATED = -12;
const THEME_PATH_PREFIX = "theme_"; // lib/http.js looks for this
const chatLines = limits.limiter(config.chatLinesPerWindow, config.chatWindowMs);
// emotes, actions, attachments: each goes to everyone in the room, so a
// player pressing one over and over slowed a busy room for all of them.
const roomActions = limits.limiter(config.roomActionsPerWindow, config.roomActionWindowMs);
const online = new Map(); // lowercased username -> session
const rooms = new Map(); // "path.name#shard" -> room
const gameActivityListeners = new Set();
@@ -290,7 +301,7 @@ const loginParams = session => {
playerWallSettings: account.wall.privacy,
// not 0: PlayerWallManager only opens walls for accounts with them on.
webWallStatus: 1,
eCardPrivacySettings: account.ecardPrivacy,
eCardPrivacySettings: ecards.privacyShown(account),
// not empty: with neither address set, every fifth login opens a
// "parent's email" window (GuiManager.showAjEmailBtn). accounts here
// have no email.
@@ -924,7 +935,7 @@ const handlers = {
}
// for shops the first unused field is the title's string id; left empty
// it keeps the shop window's own title (Shop.gotItemListCallback).
const title = SHOP_LIST_TYPES.includes(type) ? (session.room ? roomInfo.shopTitle(session.room.base, listId) : "") : 0;
const title = SHOP_LIST_TYPES.includes(type) ? (session.room && roomInfo.shopTitle(session.room.base, listId)) || SHOP_KIND_TITLES.get(type) : 0;
session.sendXt("gl", -1, listId, type, title, 0, 0, 0, count === undefined ? entries.length : count, ...entries);
},
@@ -1888,6 +1899,10 @@ module.exports = {
// local client deliberately does not draw it optimistically, unlike
// typed chat and normal emotes.
const attachmentEcho = fields[1] === "4";
// A phrase from the phrase menus is drawn from the echo too (the
// patched UserCommXtCommManager.sendAvatarSafeChat), so that it
// comes in the sender's chat bubble style, as typed chat does.
const phrase = fields[1] === "1";
// silenced, or chat switched off on the account page: the line
// goes nowhere.
if (echo && (moderation.isSilenced(session.account) || !accounts.featureOn(session.account, "chat"))) {
@@ -1900,6 +1915,14 @@ module.exports = {
session.sendXt("uc", session.room.id, session.id, -1, 5);
return;
}
// the momentary ones (a phrase, an emote, an action, an attachment,
// a slide, a pet's trick), past a few in a few seconds, reach
// nobody: the sender has shown their own already. what sets a
// state (a colour, see-through, a lasting emote) always goes, or
// others would be left seeing the wrong one.
if (MOMENTARY_TYPES.includes(fields[1]) && !limits.isTrustedLocal(session.address) && !roomActions.allow(session.account.id)) {
return;
}
if (echo) {
// "!help" and the like (lib/commands.js). A command's line is
// still echoed to its sender, whose chat bubble waits for it.
@@ -1945,14 +1968,14 @@ module.exports = {
// its style. Keeping message and type at their original indexes is
// what clears the local "..." bubble; carrying the style on the
// same packet prevents it being lost or applied to a later line.
const style = echo ? chatStyles.packet(session.account.chatStyle) : "";
for (const recipient of (echo || attachmentEcho) ? session.room.sessions : others(session)) {
const style = echo || phrase ? chatStyles.packet(session.account.chatStyle) : "";
for (const recipient of (echo || attachmentEcho || phrase) ? session.room.sessions : others(session)) {
if (session.invisible && recipient !== session && !roles.isActiveStaff(recipient.account)) {
continue;
}
if (recipient === session || (!blocks.has(recipient.account, session.account) && (!echo || accounts.featureOn(recipient.account, "chat")))) {
recipient.sendXt("uc", session.room.id, session.id,
...(echo && style ? [fields[0], fields[1], fields[2] || "", style] : fields));
...((echo || phrase) && style ? [fields[0], fields[1], fields[2] || "", style] : fields));
}
}
}