mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
fix: trading, machine rewards and claw prizes from the owner's list
- a completed trade no longer plays the failure sound over the success one - a sign over players who are trading, seen by everyone in the room - every item added to a trade list is shown; lists keep up to 200 items - the drink, popcorn and cotton candy machines always hand over what they made (the game sent nothing when it was like the last one it gave), the smoothie machine even when the game it is was not noted down, and the server takes a game's message for a moment after it is left - claw machine, Phantom Invasion and Sky High prizes are the game's own items only: a custom item could be missing from the winner's game
This commit is contained in:
1 parent
22fb7f0fa5
commit
6c273554d7
12 files changed
+2791
-11
No files matched your search
+30
-1
@@ -794,6 +794,10 @@ const handlers = {
|
||||
other.sendXt("au", session.room.id, 1, session.id, count, ...coords, teleport);
|
||||
}
|
||||
}
|
||||
// a trade going on when they came in: the sign over them again
|
||||
if (firstUpdate) {
|
||||
showTrading(session);
|
||||
}
|
||||
},
|
||||
|
||||
// GenericListXtCommManager.handleNewData: [listId, entryType, 4 unused
|
||||
@@ -1343,8 +1347,25 @@ const staffMove = (whoName, toName) => {
|
||||
return {ok: true, room: shown};
|
||||
};
|
||||
|
||||
// trading: a sign over the animal of a player in a trade, or with the trade
|
||||
// window open, in everyone else's game (the patched AvatarWorldView.
|
||||
// setTrading): "xtr" [.., .., sfsId, 1 | 0], told as it changes, and to
|
||||
// whoever comes into the room (enterRoom).
|
||||
const isTrading = session => Boolean(session.trade || session.tradeBusy);
|
||||
const showTrading = session => {
|
||||
const on = isTrading(session) && Boolean(session.room);
|
||||
if (Boolean(session.tradingShown) === on) {
|
||||
return;
|
||||
}
|
||||
session.tradingShown = on;
|
||||
for (const other of watchers(session)) {
|
||||
other.sendXt("xtr", -1, session.id, on ? 1 : 0);
|
||||
}
|
||||
};
|
||||
|
||||
const context = {
|
||||
others: watchers,
|
||||
showTrading,
|
||||
watchers,
|
||||
findOnline,
|
||||
findBySfsId,
|
||||
@@ -1398,6 +1419,9 @@ const leaveRoom = session => {
|
||||
session.room = null;
|
||||
session.pos = null;
|
||||
delete session.activeAction;
|
||||
// the sign goes with the animal; it comes back in the next room if the
|
||||
// trade goes on there (showTrading)
|
||||
session.tradingShown = false;
|
||||
minigames.roomLeft(session);
|
||||
for (const other of room.sessions) {
|
||||
// AvatarManager.avatarRemoveResponse
|
||||
@@ -1607,6 +1631,9 @@ const enterRoom = (session, name, base, displayName, shardId, props = {}) => {
|
||||
for (const other of others(session)) {
|
||||
if (other.pos && sees(session, other)) {
|
||||
sendAvatarCreate(session, other);
|
||||
if (other.tradingShown) {
|
||||
session.sendXt("xtr", -1, other.id, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return room;
|
||||
@@ -1837,7 +1864,9 @@ module.exports = {
|
||||
// embedded SWF labels outgoing user messages with the minigame's
|
||||
// temporary sub-room id. Accept that id as well so its attachment
|
||||
// reward can make the normal round trip back to the avatar.
|
||||
if (session.room && (session.room.id === msg.roomId || (session.game && session.game.roomId === Number(msg.roomId)))) {
|
||||
const fromGame = (session.game && session.game.roomId === Number(msg.roomId))
|
||||
|| (session.lastGame && session.lastGame.roomId === Number(msg.roomId) && Date.now() < session.lastGame.until);
|
||||
if (session.room && (session.room.id === msg.roomId || fromGame)) {
|
||||
// at most text, type and one extra field, and no essays.
|
||||
const fields = decodeEntities(msg.cdata("txt") || "").split("%").slice(0, 3);
|
||||
if (fields[0].length > config.maxChatLength || (fields[2] || "").length > MAX_CHAT_EXTRA) {
|
||||
|
||||
Reference in new issue
Block a user