mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
fix: eggs, pets, minigames, themes, HQ facts and more
- egg stands sell an egg again; a bought egg hatches and is named at once - pets whose bits name no pet the game has no longer stop loading - the adopt-a-pet gift path opens with nothing adopted yet - Spider Zapper and Wind Rider start with their players: spiders can be shot, and Wind Rider is played; Spider Zapper's waves are answered - Phantom's Treasure can be left from its title screen and level choice - the Touch Pool's fact window always closes - the last key in Return of the Phantoms lies where it can be reached - the Alpha HQ's bios and relics open and close - a land animal in water (and a sea one on land) is drawn when it stands - a seasonal theme's room has today's shops in it (lib/themerooms.js) - the Forgotten Archive sells its own stock, not unfinished pieces - custom items whose def is gone stay out of trade lists - the captcha is always shown, and tried again when it fails - builds 85
This commit is contained in:
1 parent
c7efda7030
commit
4355994253
19 files changed
+4891
-28
No files matched your search
@@ -537,9 +537,12 @@ module.exports = {
|
||||
for (const number of [2, 3, 4]) {
|
||||
set(q, `cork_${number}${pick("abc")}`, 1, 1, 0);
|
||||
}
|
||||
for (const number of [1, 2, 3, 4]) {
|
||||
// the last key's other places lie off where an animal can walk:
|
||||
// players had to jump to it. it lies where the recording had it.
|
||||
for (const number of [1, 2, 3]) {
|
||||
set(q, `bunny_key_${number}${pick("abcdef")}`, 1, 1, 0);
|
||||
}
|
||||
set(q, "bunny_key_4c", 1, 1, 0);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
+15
-1
@@ -307,7 +307,21 @@ class Amf3Writer {
|
||||
this.value(element);
|
||||
}
|
||||
}
|
||||
else if (typeof value === "object" && !Buffer.isBuffer(value)) {
|
||||
else if (value instanceof Date) {
|
||||
// A date (a room file's timestamps): its milliseconds, written in place.
|
||||
this.byte(0x08);
|
||||
this.u29(1);
|
||||
this.room(8);
|
||||
this.pos = this.buf.writeDoubleBE(value.getTime(), this.pos);
|
||||
}
|
||||
else if (Buffer.isBuffer(value)) {
|
||||
// A ByteArray (a room file's pictures and shapes).
|
||||
this.byte(0x0c);
|
||||
this.u29((value.length << 1) | 1);
|
||||
this.room(value.length);
|
||||
this.pos += value.copy(this.buf, this.pos);
|
||||
}
|
||||
else if (typeof value === "object") {
|
||||
// A dynamic object of no class, with its traits written in place.
|
||||
this.byte(0x0a);
|
||||
this.byte(0x0b);
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@
|
||||
{"id": 4, "swf": "Pachinko", "title": "Gem Ball", "type": 1, "vars": [16,17,0], "icon": 4295, "card": 58},
|
||||
{"id": 5, "swf": "MiniGame_Memory", "title": "Double Up", "type": 1, "vars": [6,7,0], "icon": 4291, "card": 61},
|
||||
{"id": 6, "swf": "MoatMadness", "title": "Overflow", "type": 1, "vars": [8,9,9], "icon": 4300, "card": 59},
|
||||
{"id": 10, "swf": "ParachuteGlider", "title": "Wind Rider", "type": 1, "vars": [12,13,0], "start": "seed", "icon": 4311, "card": 65},
|
||||
{"id": 10, "swf": "ParachuteGlider", "title": "Wind Rider", "type": 1, "vars": [12,13,0], "start": "seedAndCrosshairs", "icon": 4311, "card": 65},
|
||||
{"id": 11, "swf": "Trivia", "title": "Temple of Trivia", "type": 1, "vars": [10,11,0], "icon": 4309, "card": 64, "ready": false},
|
||||
{"id": 12, "swf": "RiverRace", "title": "River Race", "type": 1, "vars": [22,23,0], "start": "seed", "card": 62},
|
||||
{"id": 13, "swf": "PhantomFighter", "title": "Phantom Fighter", "type": 1, "vars": [14,15,0], "icon": 4312, "card": 60},
|
||||
{"id": 14, "swf": "SpiderShooter", "title": "Spider Zapper", "type": 1, "vars": [18,19,0], "start": "seed", "icon": 4305, "card": 63},
|
||||
{"id": 14, "swf": "SpiderShooter", "title": "Spider Zapper", "type": 1, "vars": [18,19,0], "start": "seedAndCrosshairs", "icon": 4305, "card": 63},
|
||||
{"id": 15, "swf": "MicroPopcorn", "title": "Popcorn Machine", "type": 0},
|
||||
{"id": 16, "swf": "MicroCrane", "title": "The Claw", "type": 0},
|
||||
{"id": 17, "swf": "MicroSmoothie", "title": "Smoothie Machine", "type": 0},
|
||||
|
||||
+6
-2
@@ -28,6 +28,7 @@ const extraMusic = require("./extramusic.js");
|
||||
const customMusic = require("./custommusic.js");
|
||||
const itemControl = require("./itemcontrol.js");
|
||||
const masterpieces = require("./masterpieces.js");
|
||||
const themeRooms = require("./themerooms.js");
|
||||
const panel = require("./panel.js");
|
||||
const totp = require("./totp.js");
|
||||
const world = require("./world.js");
|
||||
@@ -1191,8 +1192,11 @@ const handle = async (req, res) => {
|
||||
// or from the current one when the room did not exist yet back then.
|
||||
const themed = THEMED_ROOM.exec(relPath);
|
||||
const mayFetch = () => from.local || cacheMisses.allow(from.key);
|
||||
const body = (themed && Object.values(config.themes).some(theme => theme.build === Number(themed[2])) && await cdn.get(`${themed[2]}/roomDefs/${themed[3]}`, mayFetch))
|
||||
|| await cdn.get(themed ? `${themed[1]}/roomDefs/${themed[3]}` : relPath, mayFetch);
|
||||
const currentPath = themed ? `${themed[1]}/roomDefs/${themed[3]}` : relPath;
|
||||
const oldBody = themed && themed[2] !== themed[1] && Object.values(config.themes).some(theme => theme.build === Number(themed[2]))
|
||||
&& await cdn.get(`${themed[2]}/roomDefs/${themed[3]}`, mayFetch);
|
||||
// its shops and other spots as today's room has them (lib/themerooms.js)
|
||||
const body = oldBody ? await themeRooms.fix(relPath, oldBody, () => cdn.get(currentPath, mayFetch)) : await cdn.get(currentPath, mayFetch);
|
||||
if (!body) {
|
||||
// one the CDN does not have is asked for again and again (the same few
|
||||
// hundred, by every client that meets them): its client may keep the
|
||||
|
||||
@@ -88,7 +88,16 @@ const START = {
|
||||
// which player is its own by the id (GemBreakerPlayer.init), and only
|
||||
// that one aims and shoots.
|
||||
seedAndPlayers: game => [serial(), game.players.length, ...game.players.flatMap(player => [player.id, 0])],
|
||||
// Spider Zapper and Wind Rider (SpiderShooterPlayer.init,
|
||||
// ParachuteGliderPlayer.init): each player's sfs id and where it starts.
|
||||
// given only the seed they had no players, none of them their own:
|
||||
// nothing could be shot, and nobody glided.
|
||||
seedAndCrosshairs: game => [serial(), game.players.length,
|
||||
...game.players.flatMap((player, at) => [player.id, CROSSHAIR_X + at * CROSSHAIR_GAP, CROSSHAIR_Y])],
|
||||
};
|
||||
const CROSSHAIR_X = 400;
|
||||
const CROSSHAIR_GAP = 100;
|
||||
const CROSSHAIR_Y = 300;
|
||||
|
||||
// the room games several players play together: "Multiplayer" on the
|
||||
// game's waiting list (MinigameManager.setupWaitListPopup), for players in
|
||||
@@ -601,6 +610,18 @@ module.exports = ({tell, leaveRoom, findOnline, blocks, watchers}) => {
|
||||
},
|
||||
// the touch pool: the same again, with six prizes; which one is in the
|
||||
// first number.
|
||||
// Spider Zapper, after each wave: "wave" [1 if the player shot enough,
|
||||
// else 0] -> "wavesuccess" (the next wave) or "wavefail" (the end), and
|
||||
// "waveend" [spiders shot] -> "waveend" [spiders shot] (its results).
|
||||
// they went unanswered and the game waited after the first wave.
|
||||
SpiderShooter: {
|
||||
wave(session, game, [passed], reply) {
|
||||
reply(passed === "1" ? "wavesuccess" : "wavefail");
|
||||
},
|
||||
waveend(session, game, [shot], reply) {
|
||||
reply("waveend", /^\d{1,4}$/.test(String(shot)) ? Number(shot) : 0);
|
||||
},
|
||||
},
|
||||
TouchPool: {
|
||||
ts(session, game, params, reply) {
|
||||
session.prizeSerial = serial();
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
|
||||
const zlib = require("zlib");
|
||||
const amf3 = require("./amf3.js");
|
||||
|
||||
// a room file of a seasonal theme comes from an older build (lib/http.js,
|
||||
// roomAsSeenBy in lib/world.js), and so do its clickable spots: a shop there
|
||||
// names the generic list it had then, which today's lists may have as
|
||||
// something else or as nothing, so one theme's shops worked and another's
|
||||
// did not. each spot the room has today too (by its name) is given today's
|
||||
// list, kind and message; what only the old room has stays as it was.
|
||||
|
||||
// the volume fields that say what a click does (RoomManagerWorld: type 1 a
|
||||
// minigame by typeDefId, 7 a message, 12 a generic list)
|
||||
const ACTION_FIELDS = ["type", "typeDefId", "message"];
|
||||
const MAX_KEPT = 40; // rooms remembered, made once each (files of up to a few MB)
|
||||
|
||||
const kept = new Map(); // old file's path -> the file with today's spots, or null for "as it was"
|
||||
|
||||
const volumes = room => (room && room.actors && Array.isArray(room.actors.ActorVolume) ? room.actors.ActorVolume : []);
|
||||
|
||||
const withTodaysSpots = (oldBody, currentBody) => {
|
||||
const old = amf3.decode(zlib.inflateSync(oldBody));
|
||||
const today = new Map(volumes(amf3.decode(zlib.inflateSync(currentBody))).filter(volume => volume && volume.name).map(volume => [volume.name, volume]));
|
||||
let changed = false;
|
||||
for (const volume of volumes(old)) {
|
||||
const now = volume && today.get(volume.name);
|
||||
if (now && ACTION_FIELDS.some(field => volume[field] !== now[field])) {
|
||||
for (const field of ACTION_FIELDS) {
|
||||
if (now[field] === undefined) {
|
||||
delete volume[field];
|
||||
}
|
||||
else {
|
||||
volume[field] = now[field];
|
||||
}
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
return changed ? zlib.deflateSync(amf3.encode(old)) : oldBody;
|
||||
};
|
||||
|
||||
// `oldBody` with today's spots, `current` giving today's file (or null);
|
||||
// the old one as it was when that cannot be had or read.
|
||||
const fix = async (key, oldBody, current) => {
|
||||
if (kept.has(key)) {
|
||||
return kept.get(key) || oldBody;
|
||||
}
|
||||
let body = oldBody;
|
||||
try {
|
||||
const currentBody = await current();
|
||||
if (currentBody) {
|
||||
body = withTodaysSpots(oldBody, currentBody);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.log(`[themes] ${key}: ${err.message}`);
|
||||
body = oldBody;
|
||||
}
|
||||
if (kept.size >= MAX_KEPT) {
|
||||
kept.delete(kept.keys().next().value);
|
||||
}
|
||||
kept.set(key, body === oldBody ? null : body);
|
||||
return body;
|
||||
};
|
||||
|
||||
module.exports = {fix};
|
||||
+8
-3
@@ -53,8 +53,11 @@ module.exports = ({findOnline, blocks, showTrading}) => {
|
||||
// createdTs, lBits, uBits, eBits, name, personality, toy, food)...]
|
||||
const sendTradeList = (to, account) => {
|
||||
const listed = type => account.tradeList.filter(entry => entry.type === type).map(entry => entry.inv);
|
||||
const clothing = account.items.filter(item => listed(TYPE_CLOTHING).includes(item.inv));
|
||||
const denItems = account.denItems.filter(item => listed(TYPE_DEN_ITEM).includes(item.inv) && masterpieces.itemApproved(item));
|
||||
// one whose def is gone (a custom item deleted) is left out: the client
|
||||
// cannot make an item of it, and the list stopped there.
|
||||
const clothing = account.items.filter(item => listed(TYPE_CLOTHING).includes(item.inv) && defpacks.itemDef(item.def));
|
||||
const denItems = account.denItems.filter(item => listed(TYPE_DEN_ITEM).includes(item.inv) && masterpieces.itemApproved(item)
|
||||
&& defpacks.denItemDef(item.def));
|
||||
const pets = account.pets.filter(pet => listed(TYPE_PET).includes(pet.inv));
|
||||
to.sendXt("tl", -1, account.username,
|
||||
clothing.length, ...clothing.flatMap(item => [item.def, item.inv, item.color]),
|
||||
@@ -71,8 +74,10 @@ module.exports = ({findOnline, blocks, showTrading}) => {
|
||||
(type === TYPE_CLOTHING ? account.items : type === TYPE_DEN_ITEM ? account.denItems : type === TYPE_PET ? account.pets : []);
|
||||
|
||||
// A masterpiece still waiting for review is nobody's to trade.
|
||||
// nor one whose def is gone.
|
||||
const find = (account, type, inv) => collectionOf(account, type)
|
||||
.find(entry => entry.inv === inv && (type !== TYPE_DEN_ITEM || masterpieces.itemApproved(entry)));
|
||||
.find(entry => entry.inv === inv && (type !== TYPE_DEN_ITEM || masterpieces.itemApproved(entry))
|
||||
&& (type === TYPE_CLOTHING ? Boolean(defpacks.itemDef(entry.def)) : type === TYPE_DEN_ITEM ? Boolean(defpacks.denItemDef(entry.def)) : true));
|
||||
|
||||
// the field layouts differ between the offer the owner is shown (no
|
||||
// inventory ids for clothing and den items) and the completed trade.
|
||||
|
||||
+13
-2
@@ -156,6 +156,9 @@ const DIAMOND_ANIMAL_AND_PET_LISTS = [166, 214, 293];
|
||||
// the Diamond Shop's two den displays ("one" and "two" in its room file).
|
||||
// taken for the dens sold for diamonds: nothing else in the room is.
|
||||
const DIAMOND_DEN_LIST = 196;
|
||||
// the egg the egg stands sell (pet.EggPetGuiManager, list 624): one at
|
||||
// random of these, the diamond shop's eggs. empty, the stand threw.
|
||||
const DIAMOND_EGG_LIST = 624;
|
||||
const LANG_ENG = 0;
|
||||
const IDLE_ANIM_LAND = 14;
|
||||
const IDLE_ANIM_OCEAN = 29;
|
||||
@@ -591,8 +594,10 @@ const sortStock = () => {
|
||||
// two out-of-the-way shops keep what was never in one: the shop in the
|
||||
// Chamber of Knowledge's base (reached from a hidden spot on the world map)
|
||||
// has the den items, the one in the Zios archives the clothing. see
|
||||
// oddDenItemIds in lib/defpacks.js.
|
||||
const ODDITY_SHOPS = new Map([[396, () => defpacks.oddDenItemIds()], [666, () => defpacks.oddClothingIds()]]);
|
||||
// oddDenItemIds in lib/defpacks.js. of the clothing only the Founder's Hat
|
||||
// (oddClothingIds' first): the rest, nameless pieces never finished, made the
|
||||
// Forgotten Archive a heap of broken items.
|
||||
const ODDITY_SHOPS = new Map([[396, () => defpacks.oddDenItemIds()], [666, () => defpacks.oddClothingIds().slice(0, 1)]]);
|
||||
// the items staff have made (lib/customitems.js) are sold there too, first.
|
||||
const CUSTOM_ITEM_SHOPS = new Map([[396, "den"], [666, "clothing"]]);
|
||||
const ticketStock = kind => sortStock()[kind];
|
||||
@@ -931,6 +936,12 @@ const handlers = {
|
||||
const real = shopStock.list(listId, type);
|
||||
entries = [...new Set([...defpacks.customShopIds(CUSTOM_ITEM_SHOPS.get(Number(listId))), ...(real ? real.entries : []), ...ODDITY_SHOPS.get(Number(listId))()])];
|
||||
}
|
||||
else if (Number(listId) === DIAMOND_EGG_LIST) {
|
||||
entries = defpacks.diamondIds().filter(id => {
|
||||
const def = defpacks.diamondDef(id);
|
||||
return def.type === DIAMOND_TYPES.pet && (defpacks.petDef(Number(def.refId)) || {}).isEgg === "1";
|
||||
});
|
||||
}
|
||||
else if (Number(listId) === DIAMOND_DEN_LIST) {
|
||||
entries = defpacks.diamondIds().filter(id => {
|
||||
const def = defpacks.diamondDef(id);
|
||||
|
||||
Reference in new issue
Block a user