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:
BurrowdevandClaude Opus 5.5 committed 2026-10-20 15:25:12 +03:00
1 parent 04b8d325ea
commit a77a1bcfb4
2 files changed
+5 -1

No files matched your search

+2 -1
View File
@@ -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)) {