diff --git a/lib/pets.js b/lib/pets.js index 113e0a4..7e75fea 100644 --- a/lib/pets.js +++ b/lib/pets.js @@ -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)) { diff --git a/test/qol.js b/test/qol.js index 1eba684..e79a7c5 100644 --- a/test/qol.js +++ b/test/qol.js @@ -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");