mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 01:27:51 -05:00
feat(world): expand events, rewards, and den behavior
Add owner/developer room-effect controls and chat shortcuts, staff movement that bypasses full or locked destinations, in-game moderation entry points, theatre video synchronization, and shared room effects. Restore game and trade popups, reliably award refreshments and game rewards, support pet play outside parties, correct den placement categories, improve den item persistence, and refresh custom-item and masterpiece behavior. Harden room, party, pet, minigame, and item state handling with matching feature and restored-system regression coverage.
This commit is contained in:
1 parent
7dee29010a
commit
5c9b2e0066
11 files changed
+389
-29
No files matched your search
@@ -63,6 +63,10 @@ const CARNIVAL_COST = 5; // gems a go
|
||||
const MAX_TICKETS_PER_GO = 300;
|
||||
const CURRENCY_TICKETS = 1;
|
||||
const INVASION_COST = 10; // gems a go, as the machine's own screen says
|
||||
const SMOOTHIE_COLOURS = new Set(["purple", "orange", "red", "yellow"]);
|
||||
// The game's attachment state is client-defined (for example, the cocoa
|
||||
// recipe). It is not an item id and must never become protocol markup.
|
||||
const attachmentExtra = value => String(value ?? "").replace(/[\r\n%,]/g, "").slice(0, 128);
|
||||
|
||||
const awardsPerMinute = limits.limiter(120, 60000);
|
||||
const invitesPerMinute = limits.limiter(20, 60000);
|
||||
@@ -204,6 +208,23 @@ module.exports = ({tell, leaveRoom, findOnline, blocks, watchers}) => {
|
||||
}
|
||||
};
|
||||
|
||||
// Food-machine games reward a short-lived avatar attachment. Replying
|
||||
// with "_a" is important: MinigameManager turns it into the same local
|
||||
// attachment action used by den objects, which then sends the normal
|
||||
// user-communication packet to the room. Sending that packet ourselves
|
||||
// skips the local state and leaves the player with nothing visible.
|
||||
const grantAttachment = (session, game, reply, emoticonDefId, extra = "") => {
|
||||
if (game.attachmentGranted) {
|
||||
return;
|
||||
}
|
||||
const state = attachmentExtra(extra);
|
||||
if (!defpacks.emoticonMediaId(emoticonDefId)) {
|
||||
return;
|
||||
}
|
||||
game.attachmentGranted = true;
|
||||
reply("_a", emoticonDefId, state);
|
||||
};
|
||||
|
||||
// takes the player out of the game they are in, if any, and out of an
|
||||
// invitation.
|
||||
const leave = session => {
|
||||
@@ -450,6 +471,45 @@ module.exports = ({tell, leaveRoom, findOnline, blocks, watchers}) => {
|
||||
// what a game asks of the server while it runs, by game class and then by
|
||||
// the message's first word. `reply` answers the asker as an "mm".
|
||||
const MESSAGES = {
|
||||
// These machines do not give an inventory item. They award temporary
|
||||
// Holdable Icons: popcorn (emoticon 1), smoothies (2), and hot cocoa
|
||||
// (5). The final field carries the selected visual state.
|
||||
MicroPopcorn: {
|
||||
_a(session, game, [kind], reply) {
|
||||
if (kind === "1") {
|
||||
grantAttachment(session, game, reply, 1);
|
||||
}
|
||||
},
|
||||
},
|
||||
MicroSmoothie: {
|
||||
_a(session, game, [kind, colour], reply) {
|
||||
const selected = String(colour || "").toLowerCase();
|
||||
if (kind === "2" && SMOOTHIE_COLOURS.has(selected)) {
|
||||
grantAttachment(session, game, reply, 2, selected);
|
||||
}
|
||||
},
|
||||
},
|
||||
MicroHotCocoa: {
|
||||
_a(session, game, [kind, cocoaInfo], reply) {
|
||||
if (kind === "5") {
|
||||
grantAttachment(session, game, reply, 5, cocoaInfo);
|
||||
}
|
||||
},
|
||||
},
|
||||
CottonCandy: {
|
||||
_a(session, game, [kind, emoticonInfo], reply) {
|
||||
if (kind === "30") {
|
||||
grantAttachment(session, game, reply, 30, emoticonInfo);
|
||||
}
|
||||
},
|
||||
},
|
||||
BradyChemistrySet: {
|
||||
_a(session, game, [kind, emoticonInfo], reply) {
|
||||
if (kind === "6") {
|
||||
grantAttachment(session, game, reply, 6, emoticonInfo);
|
||||
}
|
||||
},
|
||||
},
|
||||
// the claw machines: "cp" pays for a go and learns whether the claw
|
||||
// will hold and what on ([won, isDenItem, defId, ?, version]; anything
|
||||
// but 1 or 0 for `won` means "not enough gems"); "cd" keeps (1) or
|
||||
|
||||
Reference in new issue
Block a user