mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
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:
1 parent
e9097a9a4f
commit
22fb7f0fa5
16 files changed
+589
-207
No files matched your search
@@ -181,6 +181,13 @@ const ADDED_STRINGS = {
|
||||
9000004: "Crystal Palace (concept)",
|
||||
// the buddy game the client's files call "fourGem"; no string says so.
|
||||
9000005: "Four Gems",
|
||||
// a shop's title when its room gives it none (lib/world.js SHOP_KIND_TITLES)
|
||||
9000010: "Clothing Shop",
|
||||
9000011: "Den Shop",
|
||||
9000012: "Den Rooms",
|
||||
9000013: "Shop",
|
||||
9000014: "Exchange",
|
||||
9000015: "Diamond Shop",
|
||||
};
|
||||
|
||||
// the game under this server's name. its text says "Animal Jam", "Animal
|
||||
|
||||
+10
-3
@@ -51,10 +51,15 @@ const INBOX_FULL = -1;
|
||||
const NOT_ACCEPTING = -2;
|
||||
const FAILED = 0;
|
||||
|
||||
// who may send to a player (ECardInbox's settings popup).
|
||||
// who may send to a player, as kept (account.ecardPrivacy).
|
||||
const FROM_EVERYONE = 0;
|
||||
const FROM_BUDDIES = 1;
|
||||
const FROM_NOBODY = 2;
|
||||
// ECardInbox's settings popup sends the place of the option picked, and its
|
||||
// artwork has Nobody first and Everyone last: the other way round from the
|
||||
// above. turned over both ways between the two (buddies is in the middle).
|
||||
const SETTING_COUNT = 3;
|
||||
const turnedOver = value => SETTING_COUNT - 1 - value;
|
||||
|
||||
const LIST_CARDS = 10;
|
||||
const LIST_STAMPS = 44;
|
||||
@@ -345,7 +350,7 @@ module.exports = ({findOnline, blocks}) => {
|
||||
|
||||
// [setting] -> eCardIsolationHandler: [success]
|
||||
ei(session, roomId, [setting]) {
|
||||
const value = Number(setting);
|
||||
const value = turnedOver(Number(setting));
|
||||
const valid = [FROM_EVERYONE, FROM_BUDDIES, FROM_NOBODY].includes(value);
|
||||
if (valid) {
|
||||
session.account.ecardPrivacy = value;
|
||||
@@ -374,5 +379,7 @@ module.exports = ({findOnline, blocks}) => {
|
||||
return card ? senderOf(card) : null;
|
||||
};
|
||||
|
||||
return {handlers, list, unread, redemptions, sendFromHq, noteFromHq, secretSender, SECRET_NAME: "Secret Valentine"};
|
||||
// the setting as the inbox's settings popup shows it (above)
|
||||
const privacyShown = account => turnedOver(account.ecardPrivacy || FROM_EVERYONE);
|
||||
return {handlers, list, unread, redemptions, privacyShown, sendFromHq, noteFromHq, secretSender, SECRET_NAME: "Secret Valentine"};
|
||||
};
|
||||
+7
-3
@@ -14,8 +14,9 @@ const defpacks = require("./defpacks.js");
|
||||
// then AMF3), so reading it here costs no extra download once anyone has
|
||||
// been in the room.
|
||||
|
||||
// what the room editor left in files nobody named.
|
||||
const UNNAMED = "Display Name";
|
||||
// what the room editor left in files nobody named ("default": the museum's
|
||||
// theatre).
|
||||
const UNNAMED = ["display name", "default"];
|
||||
// rooms whose file has no name and whose path does not spell it either.
|
||||
const NAMES = new Map([
|
||||
["jamaa_township.room_diamonds", "Diamond Shop"],
|
||||
@@ -24,6 +25,9 @@ const NAMES = new Map([
|
||||
["aussie.room_main", "Kimbara Outback"],
|
||||
["aussie.room_aushop", "Outback Imports"],
|
||||
["aussie.room_hos", "Medical Center"],
|
||||
["appondale.room_museumtheater", "Museum Theater"],
|
||||
["crystal_sands.room_tiertheater", "Tierney's Theater"],
|
||||
["lost_temple_of_zios.bb_theater", "Temple Theater"],
|
||||
]);
|
||||
const VOLUME_SHOP = 12; // ActorVolume.type: clicking it opens generic list `typeDefId`
|
||||
|
||||
@@ -37,7 +41,7 @@ const parse = body => {
|
||||
const settings = (room.actors.ActorSettings || [])[0] || {};
|
||||
const volumes = room.actors.ActorVolume || [];
|
||||
return {
|
||||
name: typeof settings.name === "string" && settings.name.trim() !== UNNAMED ? settings.name.trim() : "",
|
||||
name: typeof settings.name === "string" && !UNNAMED.includes(settings.name.trim().toLowerCase()) ? settings.name.trim() : "",
|
||||
shops: new Set(volumes.filter(volume => Number(volume.type) === VOLUME_SHOP).map(volume => Number(volume.typeDefId))),
|
||||
};
|
||||
};
|
||||
|
||||
+28
-5
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user