mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
feat: all four pattern colours, the in-game item giver again, and 18 and over
- a special animal's pattern has four colours, as its presets do: the pattern tab's 1 to 4 each have a colour table - the Item Giver opens in the game again; the Item Maker's previews keep their own colours instead of the giver's colour box - the drawn trading sign is gone - sign-up, the terms and the privacy policy say 18 and over (terms version 2026-10-24) - builds 92
This commit is contained in:
1 parent
29c0eff454
commit
8e117ff26f
12 files changed
+152
-131
No files matched your search
+9
-14
@@ -46,7 +46,7 @@ const TRADES_KEPT = 50; // per account, for its page
|
||||
const MAX_WAITING_OFFERS = 50; // offers left on one account
|
||||
const MAX_OFFERS_MADE = 20; // by one account, still waiting
|
||||
|
||||
module.exports = ({findOnline, blocks, showTrading}) => {
|
||||
module.exports = ({findOnline, blocks}) => {
|
||||
// TradeManager.onTradeListReceived: [username, clothingCount, (defId,
|
||||
// invIdx, color)..., denItemCount, (defId, invIdx, version, approved,
|
||||
// imageId, creatorDbId, creatorUuid)..., petCount, (speciesId, invIdx,
|
||||
@@ -134,6 +134,10 @@ module.exports = ({findOnline, blocks, showTrading}) => {
|
||||
return coming === 0 || collectionOf(account, type).length + coming - gives.filter(item => item.type === type).length <= max;
|
||||
});
|
||||
|
||||
const endTrade = trade => {
|
||||
trade.requester.trade = trade.owner.trade = null;
|
||||
};
|
||||
|
||||
// ends the trade `session` is part of, telling the other side with `status`.
|
||||
const abandon = (session, status) => {
|
||||
const {trade} = session;
|
||||
@@ -141,10 +145,8 @@ module.exports = ({findOnline, blocks, showTrading}) => {
|
||||
return;
|
||||
}
|
||||
const other = trade.requester === session ? trade.owner : trade.requester;
|
||||
trade.requester.trade = trade.owner.trade = null;
|
||||
endTrade(trade);
|
||||
other.sendXt("ti", -1, status, session.account.username, USERNAME_SHOWN);
|
||||
showTrading(session);
|
||||
showTrading(other);
|
||||
};
|
||||
|
||||
// moves one entry between accounts. it gets a fresh inventory id, and
|
||||
@@ -216,8 +218,6 @@ module.exports = ({findOnline, blocks, showTrading}) => {
|
||||
return;
|
||||
}
|
||||
session.trade = owner.trade = {requester: session, owner, wantedType, wanted, offered, accepted: false, confirmed: new Set()};
|
||||
showTrading(session);
|
||||
showTrading(owner);
|
||||
// TradeManager.displayTradeRequested: [0, requesterName, moderatedFlag,
|
||||
// wantedCode, wantedInvIdx, clothingCount, denCount, petCount, ...items]
|
||||
const ofType = type => offered.filter(item => item.type === type);
|
||||
@@ -259,9 +259,7 @@ module.exports = ({findOnline, blocks, showTrading}) => {
|
||||
return;
|
||||
}
|
||||
const {requester, owner, wantedType, wanted, offered} = trade;
|
||||
requester.trade = owner.trade = null;
|
||||
showTrading(requester);
|
||||
showTrading(owner);
|
||||
endTrade(trade);
|
||||
// either side may have recycled or re-traded something while deciding.
|
||||
const stillThere = collectionOf(owner.account, wantedType).includes(wanted)
|
||||
&& offered.every(item => collectionOf(requester.account, item.type).includes(item.entry))
|
||||
@@ -324,11 +322,8 @@ module.exports = ({findOnline, blocks, showTrading}) => {
|
||||
},
|
||||
|
||||
// ["1"/"0"]: busy flag while the trade window is open; nothing to
|
||||
// answer. it shows as the trading sign (lib/world.js showTrading).
|
||||
tb(session, roomId, [busy]) {
|
||||
session.tradeBusy = busy === "1";
|
||||
showTrading(session);
|
||||
},
|
||||
// answer.
|
||||
tb() {},
|
||||
|
||||
ti(session, roomId, params) {
|
||||
switch (params[0]) {
|
||||
|
||||
@@ -822,10 +822,6 @@ 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
|
||||
@@ -1477,25 +1473,8 @@ 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,
|
||||
@@ -1563,9 +1542,6 @@ 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
|
||||
@@ -1777,9 +1753,6 @@ 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;
|
||||
|
||||
Reference in new issue
Block a user