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:
Burrowdev committed 2026-10-24 01:57:49 +03:00
1 parent c7efda7030
commit 4355994253
19 files changed
+4891 -28

No files matched your search

+1 -1
View File
@@ -174,7 +174,7 @@ module.exports = {
// 62: "Custom pictures" in the settings menu, to hide players' item pictures.
// 83: den items tinted (the tint in their version, DenItemHelper.applyTint).
// 84: fixes from the owner's list of bugs (bugs.txt, 2026-10-23).
buildVersion: env.AJ_BUILD_VERSION || "84",
buildVersion: env.AJ_BUILD_VERSION || "85",
// what the official CDN is asked for; not ours to change.
upstreamBuildVersion: "3",
+4 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
+21
View File
@@ -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();
+67
View File
@@ -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
View File
@@ -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
View File
@@ -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);
+37 -9
View File
@@ -41,12 +41,15 @@ window.captcha = (() => {
return loading;
};
// `options`: {appearance} ("interaction-only" by default: seen only when
// cloudflare wants a click), {onAnswer(token)}.
// `options`: {appearance} ("always" by default: hidden till cloudflare
// wanted a click, it was taken for one that never showed), {onAnswer(token)}.
const MAX_RETRIES = 2; // a widget that errs is started again this often first
const mount = (element, action, options = {}) => {
let widget = null;
let answer = null; // a token, "" when none could be had, null while waiting
let waiting = [];
let retries = 0;
let starting = false;
const settle = value => {
answer = value;
if (value && options.onAnswer) {
@@ -57,22 +60,38 @@ window.captcha = (() => {
}
waiting = [];
};
if (siteKey) {
const start = () => {
if (!siteKey || starting || widget !== null) {
return;
}
starting = true;
load().then(turnstile => {
starting = false;
try {
widget = turnstile.render(element, {
sitekey: siteKey,
action,
theme: "dark",
appearance: options.appearance || "interaction-only",
callback: settle,
appearance: options.appearance || "always",
callback: value => {
retries = 0;
settle(value);
},
"expired-callback": () => {
answer = null;
},
// its code is cloudflare's (110200: this site's name is not on the widget)
// its code is cloudflare's (110200: this site's name is not on
// the widget). many pass with a second go: it is had first.
"error-callback": code => {
console.log(`captcha error ${code}`);
if (retries < MAX_RETRIES) {
retries++;
answer = null;
setTimeout(() => window.turnstile.reset(widget), 1000 * retries);
return true;
}
settle("");
return true;
},
});
}
@@ -80,20 +99,29 @@ window.captcha = (() => {
console.log(`captcha could not start: ${err.message}`);
settle("");
}
}, () => settle(""));
}
}, () => {
starting = false;
settle("");
});
};
start();
return {
on: Boolean(siteKey),
answer: () => {
if (!siteKey) {
return Promise.resolve(undefined);
}
// one that could not load is tried again when an answer is wanted
if (answer === "" && widget === null) {
answer = null;
start();
}
return answer !== null ? Promise.resolve(answer) : new Promise(resolve => waiting.push(resolve));
},
// (a widget that never loaded keeps its "" so nothing waits on it)
reset: () => {
if (widget !== null) {
answer = null;
retries = 0;
window.turnstile.reset(widget);
}
},
+19 -4
View File
@@ -826,7 +826,22 @@ package avatar
public function getBaseIdle() : int
{
return _roomType == 1 ? 32 : 14;
return drawnSwimming() ? 32 : 14;
}
// whether the animal is drawn with its swimming animations: the
// room's kind when it has art for both, else the one it has. a land
// animal in water (or a sea one on land) asked for art it has none of,
// and stood invisible until it did something it had art for.
private function drawnSwimming() : Boolean
{
var _loc1_:Boolean = _avatar == null || Utility.isLand(_avatar.enviroTypeFlag);
var _loc2_:Boolean = _avatar == null || Utility.isOcean(_avatar.enviroTypeFlag);
if(_loc1_ == _loc2_)
{
return _roomType == 1;
}
return _loc2_;
}
public function setPath(param1:Array) : void
@@ -2679,7 +2694,7 @@ package avatar
_lastMoveAngle = _loc7_;
var _loc8_:Object = convertToIdle(_lastMoveAngle);
_lastIdleAnim = _loc8_.anim;
if(_roomType == 1)
if(drawnSwimming())
{
_lastIdleAnim = getBaseIdle();
}
@@ -2746,7 +2761,7 @@ package avatar
_loc9_ = 14;
}
}
if(_roomType == 1)
if(drawnSwimming())
{
_loc9_ = 29;
}
@@ -2839,7 +2854,7 @@ package avatar
public function preload(param1:Function) : void
{
var _loc2_:Array = [];
if(_roomType == 1)
if(drawnSwimming())
{
_loc2_.push(29);
_loc2_.push(32);
+15 -3
View File
@@ -702,11 +702,17 @@ package gui
{
_loc2_.txt.text = "";
}
if(_loc2_.title != null)
// the Alpha HQ's bios have no title (string 0), and an id with no
// string throws: the popup stayed on screen with nothing able to
// close it. none is left as it is.
if(_loc2_.title != null && param1.title > 0)
{
LocalizationManager.translateId(_loc2_.title.txt,param1.title);
}
LocalizationManager.translateId(_loc2_.txt,param1.description);
if(param1.description > 0)
{
LocalizationManager.translateId(_loc2_.txt,param1.description);
}
if(param1.media && param1.media != 0)
{
_loc3_ = new MediaHelper();
@@ -724,7 +730,13 @@ package gui
}
}
_loc2_.addEventListener("mouseDown",factMouseDownHandler,false,0,true);
if(_loc2_.nextBtn)
// one fact on its own (not one of a list) has no next or previous
if(_loc2_.nextBtn && (_genericFactDefIndexList == null || isNaN(param1.index)))
{
_loc2_.nextBtn.visible = false;
_loc2_.prevBtn.visible = false;
}
else if(_loc2_.nextBtn)
{
_loc2_.nextBtn.addEventListener("mouseDown",factNextPrevBtnHandler,false,0,true);
_loc2_.prevBtn.addEventListener("mouseDown",factNextPrevBtnHandler,false,0,true);
+487
View File
@@ -0,0 +1,487 @@
package pet
{
import flash.display.MovieClip;
import flash.display.Sprite;
import loader.MediaHelper;
import localization.LocalizationManager;
public class PetBase extends Sprite
{
public static const DEF_ID_CAT:int = 1;
public static const DEF_ID_FROG:int = 2;
public static const DEF_ID_DUCK:int = 3;
public static const DEF_ID_DOG:int = 4;
public static const DEF_ID_BFLY:int = 5;
public static const DEF_ID_HAMS:int = 6;
public static const DEF_ID_BAT:int = 7;
public static const DEF_ID_SEAHORSE:int = 8;
public static const DEF_ID_ANGLER:int = 9;
public static const DEF_ID_REINDEER:int = 10;
public static const DEF_ID_SNAKE:int = 11;
public static const DEF_ID_JELLYFISH:int = 12;
public static const DEF_ID_BUNNY:int = 13;
public static const DEF_ID_HUMMINGBIRD:int = 14;
public static const DEF_ID_TURTLE:int = 15;
public static const DEF_ID_MONKEY:int = 16;
public static const DEF_ID_TARANTUAL:int = 17;
public static const DEF_ID_FOX:int = 18;
public static const DEF_ID_OWL:int = 19;
public static const DEF_ID_TIGER:int = 20;
public static const DEF_ID_ARCTIC_WOLF:int = 21;
public static const DEF_ID_RACCOON:int = 22;
public static const DEF_ID_JOEY:int = 23;
public static const DEF_ID_EAGLET:int = 24;
public static const DEF_ID_CHEETAH:int = 25;
public static const DEF_ID_RHINO:int = 26;
public static const DEF_ID_GIRAFFE:int = 27;
public static const DEF_ID_SUGAR_GLIDER:int = 28;
public static const DEF_ID_LION_CUB:int = 29;
public static const DEF_ID_PANDA:int = 30;
public static const DEF_ID_POLAR_BEAR_CUB:int = 31;
public static const DEF_ID_GECKO:int = 32;
public static const DEF_ID_PONY:int = 34;
public static const DEF_ID_PIGLET:int = 35;
public static const DEF_ID_FERRET:int = 36;
public static const DEF_ID_ELEPHANT:int = 37;
public static const DEF_ID_ARMADILLO:int = 38;
public static const DEF_ID_PEACOCK:int = 39;
public static const DEF_ID_BEE:int = 40;
public static const DEF_ID_ROOSTER:int = 41;
public static const DEF_ID_SKUNK:int = 42;
public static const DEF_ID_TURKEY:int = 43;
public static const DEF_ID_PENGUIN:int = 44;
public static const DEF_ID_SNOW_LEOPARD:int = 45;
public static const DEF_ID_MANITS:int = 46;
public static const DEF_ID_LADYBUG:int = 47;
public static const DEF_ID_CRICKET:int = 48;
public static const DEF_ID_SQUIRREL:int = 49;
public static const DEF_ID_MOUSE:int = 50;
public static const DEF_ID_FIREFLY:int = 51;
public static const DEF_ID_LEMUR:int = 52;
public static const DEF_ID_HIPPO:int = 53;
public static const DEF_ID_GOAT:int = 54;
public static const DEF_ID_MEERKAT:int = 55;
public static const DEF_ID_GOLDEN_BUNNY:int = 56;
public static const DEF_ID_PHANTOM:int = 57;
public static const DEF_ID_SEAL:int = 58;
public static const DEF_ID_OTTER:int = 59;
public static const DEF_ID_PHANTOM_RARE:int = 60;
public static const DEF_ID_GROUND_HOG:int = 61;
public static const DEF_ID_LLAMA:int = 62;
public static const DEF_ID_ARCTIC_FOX:int = 63;
public static const DEF_ID_HYENA:int = 64;
public static const DEF_ID_SLOTH:int = 65;
public static const DEF_ID_DOVE:int = 66;
public static const DEF_ID_CHICK:int = 67;
public static const DEF_ID_GOLDEN_ARMADILLO:int = 68;
public static const DEF_ID_FALCON:int = 69;
public static const DEF_ID_CROCODILE:int = 70;
public static const DEF_ID_PLATYPUS:int = 71;
public static const DEF_ID_PHANTOM_JW:int = 72;
public static const DEF_ID_GOLDEN_PONY:int = 73;
public static const DEF_ID_SHARK:int = 74;
public static const DEF_ID_DOLPHIN:int = 75;
public static const DEF_ID_ECHIDNA:int = 76;
public static const DEF_ID_KOALA:int = 77;
public static const DEF_ID_LYNX:int = 80;
public static const DEF_ID_OCTOPUS:int = 81;
public static const DEF_ID_FENNEC_FOX_JW:int = 82;
public static const DEF_ID_HEDGEHOG:int = 83;
public static const DEF_ID_SCORPION:int = 84;
public static const DEF_ID_CROW:int = 85;
public static const DEF_ID_MOOSE:int = 86;
public static const DEF_ID_POODLE:int = 87;
public static const DEF_ID_LOVEBUNNY:int = 88;
public static const DEF_ID_SABERTOOTH:int = 89;
public static const DEF_ID_DIREWOLF:int = 90;
public static const DEF_ID_DODO:int = 91;
public static const DEF_ID_FANTASY_PEACOCK:int = 92;
public static const DEF_ID_MILLIPEDE:int = 93;
public static const DEF_ID_MOTH:int = 94;
public static const DEF_ID_VULTURE:int = 95;
public static const DEF_ID_COYOTE:int = 96;
public static const DEF_ID_MEAGYNS:int = 97;
public static const DEF_ID_FALCON2:int = 98;
public static const DEF_ID_LOVE_BUG:int = 99;
public static const DEF_ID_FLYING_PIG:int = 100;
public static const DEF_ID_SPARROW:int = 101;
public static const DEF_ID_FENNEC_FOX:int = 102;
public static const DEF_ID_CARDINAL:int = 103;
public static const DEF_ID_FRILLED_LIZARD:int = 104;
public static const DEF_ID_DRAGONFLY:int = 105;
public static const DEF_ID_MAGENTA_SEAL:int = 106;
public static const DEF_ID_PANGOLIN:int = 107;
public static const DEF_ID_CAMEL:int = 108;
public static const DEF_ID_SNAIL:int = 109;
public static const DEF_ID_GALACTIC_FIREFLY:int = 110;
public static const DEF_ID_CATERPILLAR:int = 111;
public static const DEF_ID_LAMB:int = 112;
public static const DEF_ID_GOLDEN_REINDEER:int = 113;
public static const DEF_ID_HIGHLANDCOW:int = 114;
public static const DEF_ID_NIGHTHAWK:int = 115;
public static const DEF_ID_FRANKENKITTEN:int = 116;
public static const TYPE_LAND_GROUND:int = 0;
public static const TYPE_LAND_AIR:int = 1;
public static const TYPE_OCEAN_GROUND:int = 2;
public static const TYPE_OCEAN_AIR:int = 3;
public static const TYPE_AMPHIB_GROUND:int = 4;
public static const TYPE_AMPHIB_AIR:int = 5;
protected var _petDef:PetDef;
protected var _lBits:uint;
protected var _uBits:uint;
protected var _eBits:uint;
protected var _traitDefId:uint;
protected var _toyDefId:uint;
protected var _foodDefId:uint;
protected var _content:MovieClip;
protected var _createdTs:Number;
private var _mediaHelper:MediaHelper;
private var _onPetLoadedCallback:Function;
public function PetBase(param1:Number, param2:uint, param3:uint, param4:uint, param5:uint, param6:uint, param7:uint, param8:Function)
{
super();
_createdTs = param1;
_lBits = param2;
_uBits = param3;
_eBits = param4;
_traitDefId = param5;
_toyDefId = param6;
_foodDefId = param7;
_onPetLoadedCallback = param8;
_petDef = PetManager.getPetDef(param2 & 0xFF);
// bits naming no pet the game has: the first pet, rather than
// a pet that never loads and stops what was drawing it
if(_petDef == null)
{
_petDef = PetManager.getPetDef(1);
}
_mediaHelper = new MediaHelper();
_mediaHelper.init(mediaIdForDefId(_petDef.defId),onMediaLoaded,true);
}
public function destroy() : void
{
}
public function getPetTitleName() : String
{
return LocalizationManager.translateIdOnly(_petDef.titleStrId);
}
public function isGround() : Boolean
{
if(_petDef.isEgg && !PetManager.hasHatched(_createdTs))
{
return true;
}
return PetManager.isGround(_petDef.type);
}
public function isEggAndHasNotHatched() : Boolean
{
if(_petDef.isEgg)
{
return PetManager.hasHatched(_createdTs) == false;
}
return false;
}
public function isEgg() : Boolean
{
return _petDef.isEgg;
}
public function getType() : int
{
return _petDef.type;
}
public function getDefID() : int
{
return _petDef.defId;
}
public function canGoInOcean() : Boolean
{
if(_petDef.type == 2 || _petDef.type == 3 || _petDef.type == 4 || _petDef.type == 5)
{
return true;
}
return false;
}
public function canGoOnLand() : Boolean
{
if(_petDef.type == 0 || _petDef.type == 1 || _petDef.type == 4 || _petDef.type == 5)
{
return true;
}
return false;
}
public function getLBits() : uint
{
return _lBits;
}
public function getUBits() : uint
{
return _uBits;
}
public function getEBits() : uint
{
return _eBits;
}
public function getContent() : MovieClip
{
return _content;
}
public function getCreatedTs() : Number
{
return _createdTs;
}
public function colorMyItem(param1:int, param2:MovieClip, param3:int, param4:int, param5:int, param6:int, param7:int, param8:int) : void
{
if(_content)
{
_content.colorMe(param1,param2,param3,param4,param5,param6,param7,param8);
}
}
public function updateAllBits(param1:uint, param2:uint, param3:uint) : void
{
if(_content)
{
_lBits = param1;
_uBits = param2;
_eBits = param3;
PetManager.setPetState(_content,_lBits,_uBits,_eBits);
}
}
public function updateUBits(param1:uint) : void
{
_uBits = param1;
PetManager.setPetState(_content,_lBits,_uBits,_eBits);
}
public function animatePet(param1:Boolean) : void
{
if(_content && "willItAnimate" in _content.pet)
{
_content.pet.willItAnimate(param1);
}
}
protected function setSparkle(param1:int) : void
{
if(_content)
{
_content.pet.setSparkle(param1);
}
}
private function onMediaLoaded(param1:MovieClip) : void
{
var _loc2_:int = 0;
if(param1)
{
_content = param1;
this.addChild(_content);
_mediaHelper.destroy();
delete _content.mediaHelper;
delete _content.passback;
PetManager.setPetState(_content,_lBits,_uBits,_eBits);
if(_onPetLoadedCallback != null)
{
_onPetLoadedCallback(_content);
}
_content.pet.setAnim(0);
if(_petDef.isEgg)
{
if(_content.pet.hasOwnProperty("setEggDayInt"))
{
_loc2_ = _createdTs > 0 ? Math.floor((Utility.getInitialEpochTime() - _createdTs) / 86400) : 0;
_content.pet.setEggDayInt(_loc2_);
}
}
}
}
private function mediaIdForDefId(param1:int) : int
{
var _loc2_:PetDef = PetManager.getPetDef(param1);
if(_loc2_)
{
return _loc2_.mediaRefId;
}
return -1;
}
public function get personalityDefId() : uint
{
return _traitDefId;
}
public function set personalityDefId(param1:uint) : void
{
_traitDefId = param1;
}
public function get favoriteToyDefId() : uint
{
return _toyDefId;
}
public function set favoriteToyDefId(param1:uint) : void
{
_toyDefId = param1;
}
public function get favoriteFoodDefId() : uint
{
return _foodDefId;
}
public function set favoriteFoodDefId(param1:uint) : void
{
_foodDefId = param1;
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+178
View File
@@ -0,0 +1,178 @@
package adoptAPet
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import gui.DarkenManager;
import gui.GuiManager;
import loader.MediaHelper;
public class TierPathPopup
{
private const POPUP_MEDIA_ID:int = 7208;
private var _tierPopup:MovieClip;
private var _mediaHelper:MediaHelper;
private var _closeCallback:Function;
public function TierPathPopup(param1:Function)
{
super();
DarkenManager.showLoadingSpiral(true);
_closeCallback = param1;
_mediaHelper = new MediaHelper();
_mediaHelper.init(7208,onPopupLoaded);
}
public function destroy() : void
{
removeEventListeners();
DarkenManager.unDarken(_tierPopup);
GuiManager.guiLayer.removeChild(_tierPopup);
_closeCallback = null;
_tierPopup = null;
}
private function onPopupLoaded(param1:MovieClip) : void
{
DarkenManager.showLoadingSpiral(false);
_tierPopup = MovieClip(param1.getChildAt(0));
_tierPopup.x = 900 / 2;
_tierPopup.y = 550 / 2;
// a fault laying out the path left the window unshown, its
// checklist waiting under it: it is shown either way now
try
{
setupPathAndDots();
}
catch(e:Error)
{
GlobalErrorCatch.reportToServer("adopt a pet gift path: " + e + "\n" + e.getStackTrace());
}
addEventListeners();
GuiManager.guiLayer.addChild(_tierPopup);
DarkenManager.darken(_tierPopup);
}
private function setupPathAndDots() : void
{
var _loc4_:int = 0;
var _loc3_:MovieClip = null;
var _loc8_:MovieClip = null;
var _loc1_:MovieClip = null;
var _loc7_:MovieClip = null;
var _loc10_:Boolean = false;
var _loc2_:Boolean = false;
var _loc5_:int = int(AdoptAPetManager.TIERED_GIFT_COUNTS[AdoptAPetManager.TIERED_GIFT_COUNTS.length - 1]);
var _loc9_:int = AdoptAPetManager.numTieredGiftCount;
var _loc6_:Boolean = false;
// frames count from 1: none adopted yet is the first
_tierPopup.pinkPath.gotoAndStop(Math.max(1,Math.min(_loc9_,_tierPopup.pinkPath.totalFrames)));
_loc4_ = 1;
while(_loc4_ <= _loc5_)
{
_loc3_ = _tierPopup["dot_" + _loc4_];
_loc8_ = _tierPopup["threshold" + _loc4_];
if(_loc4_ <= _loc9_)
{
_loc2_ = true;
}
if(_loc3_ != null)
{
_loc7_ = _loc3_;
if(_loc2_)
{
_loc10_ = false;
_loc2_ = false;
_loc1_ = _loc3_;
_loc3_.num.text = _loc4_;
_loc3_.star.visible = true;
if(_loc7_ != null)
{
_loc7_.num.visible = false;
if(_loc7_.num.text != "1")
{
_loc7_.star.visible = false;
}
else
{
_loc7_.star.visible = false;
}
}
}
else
{
_loc3_.num.visible = false;
_loc3_.star.visible = false;
}
}
else if(_loc8_ != null)
{
if(_loc4_ <= _loc9_)
{
_loc10_ = true;
_loc8_.gotoAndStop("open");
}
else
{
if(!_loc6_)
{
_loc8_.gotoAndStop("next");
_loc6_ = true;
}
else
{
_loc8_.gotoAndStop("future");
}
_loc8_.numTxt.text = _loc4_;
}
}
else if(!_loc10_)
{
_loc2_ = false;
}
_loc4_++;
}
if(_loc1_ != null)
{
if(_loc10_)
{
_loc1_.num.visible = false;
_loc1_.star.visible = false;
}
else
{
_loc1_.num.visible = true;
_loc1_.star.visible = true;
_loc1_.num.text = _loc9_;
}
}
}
private function addEventListeners() : void
{
_tierPopup.bx.addEventListener("mouseDown",onCloseBtn,false,0,true);
}
private function removeEventListeners() : void
{
_tierPopup.bx.removeEventListener("mouseDown",onCloseBtn);
}
private function onCloseBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_closeCallback != null)
{
_closeCallback();
}
else
{
destroy();
}
}
}
}
+1404
View File
File diff suppressed because it is too large. Load diff
BIN
View File
Binary file not shown.
+5
View File
@@ -101,6 +101,11 @@ set -- \
gameRedemption.CodeRedemptionPopup CodeRedemptionPopup.as \
playerWall.PlayerWallXtCommManager PlayerWallXtCommManager.as \
playerWall.PlayerWallGui PlayerWallGui.as \
pet.PetManager PetManager.as \
adoptAPet.TierPathPopup TierPathPopup.as \
pet.PetBase PetBase.as \
game.touchPool.TouchPool TouchPool.as \
game.phantomsTreasure.PhantomsTreasure PhantomsTreasure.as \
game.microSmoothie.MicroSmoothie MicroSmoothie.as \
room.DenItemHolder ../tools/decompiled/room/DenItemHolder.as
# not in the game: added before the replace (game.ArtStudioKit is Strawberry