mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
fix(pets): name a hatched egg without throwing
"pn" (EggPetHatchedPopup) saved `account`, which that handler never
defined since aa455f5: a ReferenceError after the name was set in
memory, so no reply went out and the game's loading spiral never ended,
and the name was not saved, so the popup came back at every login.
"account is not defined" at lib/pets.js in prod's log several times an
hour since 10-17.
qol.js names the egg it buys and waits for the answer.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
04b8d325ea
commit
a77a1bcfb4
2 files changed
+5
-1
No files matched your search
+2
-1
@@ -215,7 +215,8 @@ module.exports = ({others, findOnline, petFields}) => {
|
||||
// EggPetHatchedPopup: [petInvIdx, nameId1, nameId2] names a pet hatched
|
||||
// from an egg. PetManager.onPetEggNameResponse: [success, invIdx, name].
|
||||
pn(session, roomId, [invIdx, name1, name2]) {
|
||||
const pet = ownPet(session.account, invIdx);
|
||||
const {account} = session;
|
||||
const pet = ownPet(account, invIdx);
|
||||
const def = pet && defpacks.petDef(pet.lBits & 0xFF);
|
||||
if (!pet || ![name1, name2].every(isUint) || pet.name || !def || def.isEgg !== "1"
|
||||
|| pet.createdAt + SECONDS_TO_HATCH > Math.floor(Date.now() / 1000)) {
|
||||
|
||||
@@ -180,6 +180,9 @@ const run = async () => {
|
||||
const made = await a.untilXt("pc");
|
||||
assert.strictEqual(made[2], "1");
|
||||
assert.ok(Number(made[10]) <= Date.now() / 1000 - 259200);
|
||||
// ... and named from the hatched popup (EggPetHatchedPopup waits for this answer)
|
||||
a.xt("pn", roomId, made[5], 15386, 15428);
|
||||
assert.deepStrictEqual((await a.untilXt("pn")).slice(2), ["1", made[5], "15386|15428"]);
|
||||
|
||||
// --- she starts in the township as ever, in a look picked at random if she asked for one
|
||||
say(a, roomId, "!theme random on");
|
||||
|
||||
Reference in new issue
Block a user