mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
fix: eco items, wall, photo booth, chat emoji, den fixes
- the eco den items work: the Eco Shop sells the real eco items, solar panels and wind turbines placed in the den in use earn eco credits, lamps switch on while there is power for them, and the eco score earns the three eco plaques; a first look gives an account its first credits - the item giver row opens the web item giver - a painting that cannot be shown is the Burrow logo, not a wait for good - Jammer Central's buttons work; What's New shows the newest Jamaa Journal - the Jammer Wall opens even while the HUD is checking the player's own; a photo of an animal wearing nothing is kept; a wall photo of an animal the game does not know no longer stops the wall - the photo booth's paid picture is answered - emoji no longer push the line off centre; "\" keeps an emote or a ":name:" as typed; a repeated line with emoji is sent as it was said - the emoji button hides with the HUD, not a moment after - the join date on a player's card stays in its corner - den items whose def is gone no longer garble the den and the inventory; custom pictures in a den no longer stop walking - the den editor's switch and recycle buttons are always there - the den inventory scrolls to an eleventh item
This commit is contained in:
1 parent
7de41ceed5
commit
c7efda7030
20 files changed
+6959
-1901
No files matched your search
@@ -387,6 +387,11 @@ module.exports = {
|
||||
chatWindowMs: 3000, // ... in this long
|
||||
roomActionsPerWindow: 6, // emotes, actions and the like one player may send a room ...
|
||||
roomActionWindowMs: 3000, // ... in this long (the rest reach nobody)
|
||||
// eco den items (lib/eco.js): credits an hour for each point of eco power
|
||||
// placed in a den, and what an account is given the first time it looks
|
||||
// (an Eco Solar Panel's price)
|
||||
ecoCreditsPerPointHour: 1,
|
||||
ecoStartCredits: 1500,
|
||||
maxBytesPerTenSeconds: 512 * 1024, // per game socket; saving a full den is about 40 KB
|
||||
// custom colours (lib/colours.js). every one ever made is sent to every
|
||||
// player at every login and is never taken out again, so there is an end
|
||||
|
||||
+11
-3
@@ -44,8 +44,9 @@ const DEF_WORLD_ITEMS = 1064;
|
||||
const DEF_NPC = 1025;
|
||||
const DEF_NAMEBAR_BADGE = 1049;
|
||||
const DEF_EMOTICON = 1036;
|
||||
const DEF_NEWSPAPER = 1065; // the Jamaa Journal's pages (newspaper.NewspaperManager)
|
||||
|
||||
const OFFERED_SPECIAL_TYPES = ["0", "4"]; // den items: plain, mannequin
|
||||
const OFFERED_SPECIAL_TYPES = ["0", "4", "6", "7"]; // den items: plain, mannequin, eco producer and consumer (lib/eco.js)
|
||||
const DEN_ITEM_MASTERPIECE = 2725;
|
||||
|
||||
const packs = new Map();
|
||||
@@ -487,6 +488,7 @@ let npcDefs = new Map(); // the characters of the adventures, see lib/disguises.
|
||||
// An avatar attachment is named by its emoticon definition id on the wire,
|
||||
// while AvatarWorldView needs the media id stored by that definition.
|
||||
let emoticonMediaIds = new Map();
|
||||
let journalPages = []; // the Jamaa Journal's pages: {id, page (media id), start (seconds)}
|
||||
|
||||
// A pack whose feature can be done without: missing (offline and never
|
||||
// cached) just leaves that feature empty.
|
||||
@@ -516,8 +518,9 @@ const init = async () => {
|
||||
petIds = [...petDefs.keys()];
|
||||
denItemDefs = new Map((await load(DEF_DEN_ITEM)).map(def => [Number(def.id), def]));
|
||||
// special types carry extra state (a den portal's destination, a shop's
|
||||
// stock, ...). of those only mannequins (4) are modelled, in lib/dens.js,
|
||||
// so plain den items and mannequins are what is offered.
|
||||
// stock, ...). of those mannequins (4) are modelled, in lib/dens.js, and
|
||||
// the eco items (6, 7) in lib/eco.js, so those and plain den items are
|
||||
// what is offered.
|
||||
// the Masterpiece item is a painting's frame, made in the Art Studio and
|
||||
// nowhere else (lib/masterpieces.js).
|
||||
denItemIds = [...denItemDefs].filter(([id, def]) => OFFERED_SPECIAL_TYPES.includes(def.specialType) && id !== DEN_ITEM_MASTERPIECE).map(([id]) => id);
|
||||
@@ -554,6 +557,8 @@ const init = async () => {
|
||||
petToyDefs = await loadOptional(DEF_PET_TOY);
|
||||
npcDefs = new Map((await loadOptional(DEF_NPC)).map(def => [Number(def.id), def]));
|
||||
emoticonMediaIds = new Map((await loadOptional(DEF_EMOTICON)).map(def => [Number(def.id), Number(def.mediaRef)]));
|
||||
journalPages = (await loadOptional(DEF_NEWSPAPER)).map(def => ({id: Number(def.id), page: Number(def.pageMediaRefId),
|
||||
start: Number(def.availabilityStartTime) || 0})).filter(page => page.page > 0);
|
||||
partyDefs = new Map((await loadOptional(DEF_PARTY)).map(def => {
|
||||
const room = roomPathsById.get(Number(def.roomDefId));
|
||||
return [Number(def.id), {
|
||||
@@ -665,6 +670,9 @@ module.exports = {
|
||||
badgeIds: () => badgeIds,
|
||||
npcDef: id => npcDefs.get(Number(id)),
|
||||
emoticonMediaId: id => emoticonMediaIds.get(Number(id)) || 0,
|
||||
// the media ids of the newest Jamaa Journal pages out by `now` (seconds), newest first
|
||||
newestJournalPages: (count, now = Date.now() / 1000) => journalPages.filter(page => page.start <= now)
|
||||
.sort((one, other) => other.start - one.start || other.id - one.id).slice(0, count).map(page => page.page),
|
||||
oddDenItemIds: () => oddDenItemIds,
|
||||
// den items that exist to be given by id and are in no shop.
|
||||
unsoldDenItemIds: () => extraMusic.ids,
|
||||
|
||||
+14
-4
@@ -8,6 +8,7 @@ const defpacks = require("./defpacks.js");
|
||||
const wearRules = require("./wearrules.js");
|
||||
const epicDens = require("./epicdens.js");
|
||||
const masterpieces = require("./masterpieces.js");
|
||||
const eco = require("./eco.js");
|
||||
const {CURRENCIES, MAX_DEN_ITEMS, hasRoom, activeAvatar, resolvePurchase, isUint} = require("./player.js");
|
||||
|
||||
// den items: owning, placing and recycling furniture (client side:
|
||||
@@ -119,9 +120,14 @@ const petsInDen = account => account.pets.filter(pet => pet.inDen && pet.inDen.d
|
||||
// it is not placed there. the three after "approved" are a masterpiece's
|
||||
// (lib/masterpieces.js); one not approved yet the client keeps out of dens,
|
||||
// trades and the recycler.
|
||||
// an item whose def is gone (a custom item deleted) is left out of both: the
|
||||
// client skipped it without reading all its fields, and read every item after
|
||||
// it wrong, placed ones as not placed and the den's floor and wallpaper lost.
|
||||
const known = item => Boolean(defpacks.denItemDef(item.def));
|
||||
|
||||
const sendDenItems = session => {
|
||||
const {account} = session;
|
||||
const {denItems} = account;
|
||||
const denItems = account.denItems.filter(known);
|
||||
const pets = petsInDen(account);
|
||||
session.sendXt("di", -1, account.activeDen, denItems.length, pets.length,
|
||||
...denItems.flatMap(item => {
|
||||
@@ -134,13 +140,13 @@ const sendDenItems = session => {
|
||||
|
||||
// DenXtCommManager.denStateResponse: [itemCount, petCount, forceReload,
|
||||
// (invIdx, defId, placed, x, y, version, flipped, userNameLink, imageId,
|
||||
// creatorDbId, creatorUuid, [mannequin], ?)..., (invIdx, lBits, uBits, eBits,
|
||||
// creatorDbId, creatorUuid, [mannequin], eco state)..., (invIdx, lBits, uBits, eBits,
|
||||
// category, x, y, flipped, createdTs, personality, toy, food, name)...].
|
||||
// forceReload makes the client finish a pending room change, so it is set
|
||||
// when the den has just been entered.
|
||||
const sendDenState = (session, room, forceReload = true) => {
|
||||
const owner = room.denOwner;
|
||||
const placed = itemsInDen(owner).filter(item => masterpieces.itemApproved(item));
|
||||
const placed = itemsInDen(owner).filter(item => known(item) && masterpieces.itemApproved(item));
|
||||
const pets = petsInDen(owner);
|
||||
session.sendXt("ds", room.id, placed.length, pets.length, forceReload ? 1 : 0,
|
||||
...placed.flatMap(item => {
|
||||
@@ -149,7 +155,7 @@ const sendDenState = (session, room, forceReload = true) => {
|
||||
// object as category 1 made wall/floor items enter the wrong display
|
||||
// layer when a den was reloaded or another player visited.
|
||||
return [item.inv, item.def, spot.cat || 1, spot.x, spot.y, item.version, spot.flip, "", ...masterpieces.itemFields(item),
|
||||
...mannequinShownFields(owner, item), 0];
|
||||
...mannequinShownFields(owner, item), eco.consumerState(owner, item)];
|
||||
}),
|
||||
...pets.flatMap(pet => [pet.inv, pet.lBits, pet.uBits, pet.eBits, PET_CATEGORY, pet.inDen.x, pet.inDen.y, pet.inDen.flip,
|
||||
pet.createdAt, pet.personality || 0, pet.toy || 0, pet.food || 0, pet.name]));
|
||||
@@ -380,6 +386,10 @@ const handlers = ({others, findOnline}) => {
|
||||
session.sendXt("dss", -1);
|
||||
return;
|
||||
}
|
||||
// the eco credits earned at the den's rate until now (lib/eco.js)
|
||||
if (account.eco) {
|
||||
eco.accrue(account);
|
||||
}
|
||||
const applied = [];
|
||||
const byInv = new Map(account.denItems.map(candidate => [candidate.inv, candidate]));
|
||||
const mannequins = account.denItems.filter(candidate => candidate.mannequin);
|
||||
|
||||
+227
@@ -0,0 +1,227 @@
|
||||
"use strict";
|
||||
|
||||
const accounts = require("./accounts.js");
|
||||
const achievements = require("./achievements.js");
|
||||
const config = require("../config.js");
|
||||
const defpacks = require("./defpacks.js");
|
||||
|
||||
// the eco den items: producers (special type 6, the Eco Solar Panel and
|
||||
// Eco Wind Turbine) and consumers (7, the eco lamps and fan), sold for eco
|
||||
// credits in the Eco Shop (list 778). client side: gui.EcoScorePopup (a
|
||||
// producer clicked), gui.EcoPointsPopup (a consumer clicked),
|
||||
// DenItemHolder.updateConsumers. the official server's rules were never
|
||||
// recorded; these are this server's:
|
||||
//
|
||||
// - a den's generation is the eco power of the producers placed in its
|
||||
// owner's den in use; consumers switched on take theirs from it, in
|
||||
// inventory order, and one that no longer fits is "offline" (state 2)
|
||||
// until there is power for it again. its switch stays on.
|
||||
// - generation turns into credits, config.ecoCreditsPerPointHour a point
|
||||
// an hour, waiting to be collected ("Get Your Credits") up to the
|
||||
// meter's full 240. an account's first look (an eco window, or the
|
||||
// Eco Shop) gets it config.ecoStartCredits, enough for its first producer.
|
||||
// - the eco score (generation less use) earns the three eco plaques, one
|
||||
// at a time, through user var 465 (a bit each).
|
||||
|
||||
const SPECIAL_PRODUCER = "6";
|
||||
const SPECIAL_CONSUMER = "7";
|
||||
const WIND_TURBINE = 4541;
|
||||
const SOLAR_PANEL = 4540;
|
||||
const CURRENCY_ECO = 11;
|
||||
const ECO_SHOP_LIST = 778;
|
||||
const MAX_WAITING = 240; // EcoScorePopup.updateCreditProgressMeter: the meter is full at 240
|
||||
const USER_VAR_REWARDS = 465;
|
||||
const REWARDS = [
|
||||
{bit: 0, score: 5, def: 4611}, // Wood Eco Plaque
|
||||
{bit: 1, score: 15, def: 4610}, // Silver Eco Plaque
|
||||
{bit: 2, score: 30, def: 4609}, // Gold Eco Plaque
|
||||
];
|
||||
const HOUR_MS = 3600000;
|
||||
|
||||
const OFF = 0;
|
||||
const ON = 1;
|
||||
const OFFLINE = 2;
|
||||
|
||||
const special = item => {
|
||||
const def = defpacks.denItemDef(item.def);
|
||||
return def ? String(def.specialType) : "";
|
||||
};
|
||||
const power = item => Number((defpacks.denItemDef(item.def) || {}).ecoPower) || 0;
|
||||
const placedInUse = account => account.denItems.filter(item => item.spots && item.spots[account.activeDen]);
|
||||
|
||||
// the den in use as the eco windows see it: {generation, consumption,
|
||||
// turbines, panels, consumers: [item], states: Map(inv -> 0 off, 1 on, 2 offline)}
|
||||
const stateOf = account => {
|
||||
const placed = placedInUse(account);
|
||||
const producers = placed.filter(item => special(item) === SPECIAL_PRODUCER);
|
||||
const consumers = placed.filter(item => special(item) === SPECIAL_CONSUMER).sort((one, other) => one.inv - other.inv);
|
||||
const generation = producers.reduce((sum, item) => sum + power(item), 0);
|
||||
let consumption = 0;
|
||||
const states = new Map();
|
||||
for (const item of consumers) {
|
||||
if (!item.ecoOn) {
|
||||
states.set(item.inv, OFF);
|
||||
}
|
||||
else if (consumption + power(item) <= generation) {
|
||||
consumption += power(item);
|
||||
states.set(item.inv, ON);
|
||||
}
|
||||
else {
|
||||
states.set(item.inv, OFFLINE);
|
||||
}
|
||||
}
|
||||
return {
|
||||
generation,
|
||||
consumption,
|
||||
turbines: producers.filter(item => item.def === WIND_TURBINE).length,
|
||||
panels: producers.filter(item => item.def === SOLAR_PANEL).length,
|
||||
consumers,
|
||||
states,
|
||||
};
|
||||
};
|
||||
|
||||
// a den item's eco field in the den's state (DenStateItem's last): 0 for
|
||||
// all but consumers
|
||||
const consumerState = (account, item) => (special(item) === SPECIAL_CONSUMER ? stateOf(account).states.get(item.inv) || OFF : OFF);
|
||||
|
||||
const perHour = generation => generation * (Number(config.ecoCreditsPerPointHour) || 0);
|
||||
|
||||
// brings the waiting credits up to now, at the rate the den has now. the
|
||||
// caller saves.
|
||||
const accrue = account => {
|
||||
const now = Date.now();
|
||||
if (!account.eco) {
|
||||
account.eco = {waiting: 0, at: now};
|
||||
const start = Math.max(0, Math.floor(Number(config.ecoStartCredits) || 0));
|
||||
account.currency.ecoCredits = (account.currency.ecoCredits || 0) + start;
|
||||
return;
|
||||
}
|
||||
const rate = perHour(stateOf(account).generation);
|
||||
const hours = Math.max(0, now - account.eco.at) / HOUR_MS;
|
||||
account.eco.waiting = Math.min(MAX_WAITING, (Number(account.eco.waiting) || 0) + rate * hours);
|
||||
account.eco.at = now;
|
||||
};
|
||||
|
||||
// seconds until one more whole credit waits, 0 when none will
|
||||
const secondsToNext = account => {
|
||||
const rate = perHour(stateOf(account).generation);
|
||||
if (rate <= 0 || account.eco.waiting >= MAX_WAITING) {
|
||||
return 0;
|
||||
}
|
||||
const short = 1 - (account.eco.waiting % 1);
|
||||
return Math.max(1, Math.ceil(short / rate * 3600));
|
||||
};
|
||||
|
||||
const nextReward = account => {
|
||||
const bits = Number(account.userVars[USER_VAR_REWARDS]) || 0;
|
||||
return REWARDS.find(reward => !(bits & (1 << reward.bit))) || null;
|
||||
};
|
||||
|
||||
module.exports = ({others, ecards}) => {
|
||||
const sendCredits = session => session.sendXt("cu", -1, CURRENCY_ECO, session.account.currency.ecoCredits || 0, 0);
|
||||
|
||||
// the consumers' states to the owner and, when they are in it, everyone
|
||||
// else in the den: DenXtCommManager.denEcoConsumerResponse [consumption,
|
||||
// generation, count, (invIdx, state)...].
|
||||
const sendConsumers = session => {
|
||||
const {account} = session;
|
||||
const state = stateOf(account);
|
||||
const fields = [state.consumption, state.generation, state.consumers.length,
|
||||
...state.consumers.flatMap(item => [item.inv, state.states.get(item.inv)])];
|
||||
session.sendXt("dEc", -1, ...fields);
|
||||
if (session.room && session.room.denOwner === account) {
|
||||
for (const other of others(session)) {
|
||||
other.sendXt("dEc", -1, ...fields);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handlers = {
|
||||
// requestDenEcoCreditRefresh -> EcoStateResponse: [turbines, panels,
|
||||
// consumers, generation, consumption, score required, next reward bit,
|
||||
// credits waiting, seconds to the next].
|
||||
dEf(session) {
|
||||
const {account} = session;
|
||||
const firstLook = !account.eco;
|
||||
accrue(account);
|
||||
accounts.save(account);
|
||||
if (firstLook) {
|
||||
sendCredits(session);
|
||||
}
|
||||
const state = stateOf(account);
|
||||
const reward = nextReward(account);
|
||||
session.sendXt("dEf", -1, state.turbines, state.panels, state.consumers.length, state.generation, state.consumption,
|
||||
reward ? reward.score : REWARDS[REWARDS.length - 1].score, reward ? reward.bit : -1,
|
||||
Math.floor(account.eco.waiting), secondsToNext(account));
|
||||
},
|
||||
|
||||
// requestDenEcoCreditRedeem: the waiting credits collected -> [success,
|
||||
// seconds to the next].
|
||||
dEr(session) {
|
||||
const {account} = session;
|
||||
accrue(account);
|
||||
const credits = Math.floor(account.eco.waiting);
|
||||
if (credits < 1) {
|
||||
accounts.save(account);
|
||||
session.sendXt("dEr", -1, 0, secondsToNext(account));
|
||||
return;
|
||||
}
|
||||
account.eco.waiting -= credits;
|
||||
account.currency.ecoCredits = (account.currency.ecoCredits || 0) + credits;
|
||||
achievements.currencyChanged(account, "ecoCredits", credits);
|
||||
accounts.save(account);
|
||||
sendCredits(session);
|
||||
session.sendXt("dEr", -1, 1, secondsToNext(account));
|
||||
},
|
||||
|
||||
// requestDenEcoConsumer: [invIdx, "1" on | "0" off]
|
||||
dEc(session, roomId, [invIdx, on]) {
|
||||
const {account} = session;
|
||||
const item = account.denItems.find(candidate => candidate.inv === Number(invIdx));
|
||||
if (item && special(item) === SPECIAL_CONSUMER) {
|
||||
accrue(account);
|
||||
item.ecoOn = on === "1";
|
||||
accounts.save(account);
|
||||
}
|
||||
sendConsumers(session);
|
||||
},
|
||||
};
|
||||
|
||||
// user var 465, set by the eco score window's gift: the value is the bit
|
||||
// of the reward asked for. given when it is the next one and the score is
|
||||
// there; the plaque comes as a gift from HQ. true when the var was this.
|
||||
const userVar = (session, id, bit) => {
|
||||
if (Number(id) !== USER_VAR_REWARDS) {
|
||||
return false;
|
||||
}
|
||||
const {account} = session;
|
||||
const reward = nextReward(account);
|
||||
const state = stateOf(account);
|
||||
if (reward && reward.bit === Number(bit) && state.generation - state.consumption >= reward.score
|
||||
&& !ecards.sendFromHq(account, "Eco Reward", {kind: "den", id: reward.def})) {
|
||||
account.userVars[USER_VAR_REWARDS] = (Number(account.userVars[USER_VAR_REWARDS]) || 0) | (1 << reward.bit);
|
||||
accounts.save(account);
|
||||
}
|
||||
if (account.userVars[USER_VAR_REWARDS] === undefined) {
|
||||
account.userVars[USER_VAR_REWARDS] = 0;
|
||||
}
|
||||
achievements.sendVar(session, USER_VAR_REWARDS);
|
||||
return true;
|
||||
};
|
||||
|
||||
// the Eco Shop opened: an account that never had eco credits is given
|
||||
// its first, to buy its first producer with.
|
||||
const shopOpened = session => {
|
||||
if (!session.account.eco) {
|
||||
accrue(session.account);
|
||||
accounts.save(session.account);
|
||||
sendCredits(session);
|
||||
}
|
||||
};
|
||||
|
||||
return {handlers, userVar, shopOpened, SHOP_LIST: ECO_SHOP_LIST};
|
||||
};
|
||||
|
||||
module.exports.accrue = accrue;
|
||||
module.exports.consumerState = consumerState;
|
||||
module.exports.SPECIAL_TYPES = [SPECIAL_PRODUCER, SPECIAL_CONSUMER];
|
||||
+9
-1
@@ -1145,7 +1145,15 @@ const handle = async (req, res) => {
|
||||
return session ? limits.key(session.address) : null;
|
||||
};
|
||||
const picture = masterpieces.mayView(painting[1], from.key, playingFrom) || from.local ? masterpieces.image(painting[1]) : null;
|
||||
send(res, picture ? 200 : 404, picture || "Not found", picture ? MIME[".jpg"] : "text/plain");
|
||||
if (picture) {
|
||||
send(res, 200, picture, MIME[".jpg"]);
|
||||
return;
|
||||
}
|
||||
// one that cannot be shown (waiting to be looked at, seen from an
|
||||
// address not its maker's game's, or its file gone) is the Burrow logo:
|
||||
// given nothing, the game waited for it for good, behind its spinner.
|
||||
res.setHeader("Cache-Control", "no-store");
|
||||
send(res, 200, await fs.promises.readFile(path.join(config.publicDir, "logo-square.png")), MIME[".png"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ const MAX_RECYCLED_AT_ONCE = 500;
|
||||
const MAX_USED_AT_ONCE = 200; // pieces put on or taken off in one message
|
||||
const RECYCLE_FRACTION = 0.3; // matches recyclePercentage sent at login
|
||||
const CURRENCY_GEMS = 0; // ItemXtCommManager.currencyUpdateResponse's currency type
|
||||
const PHOTO_GEMS = 50; // what the photo booth says a picture costs (string 14789)
|
||||
|
||||
module.exports = ({others, sendItemList}) => {
|
||||
// ItemXtCommManager.itemBuyResponse: [status, shopId, newAmount, currencyType]
|
||||
@@ -160,6 +161,25 @@ module.exports = ({others, sendItemList}) => {
|
||||
session.sendXt("cd", -1, 1);
|
||||
},
|
||||
|
||||
// the photo booth's picture (gui.PhotoBooth), PHOTO_GEMS gems. "apc"
|
||||
// asks first: [gems after, or -1 for too few]; "apb", once the player
|
||||
// keeps the picture, pays: [gem total]. neither was answered, and the
|
||||
// booth waited behind its spinner for good.
|
||||
apc(session) {
|
||||
const gems = session.account.currency.gems || 0;
|
||||
session.sendXt("apc", -1, gems >= PHOTO_GEMS ? gems - PHOTO_GEMS : -1);
|
||||
},
|
||||
|
||||
apb(session) {
|
||||
const {account} = session;
|
||||
if ((account.currency.gems || 0) >= PHOTO_GEMS) {
|
||||
account.currency.gems -= PHOTO_GEMS;
|
||||
achievements.currencyChanged(account, "gems", -PHOTO_GEMS);
|
||||
accounts.save(account);
|
||||
}
|
||||
session.sendXt("apb", -1, account.currency.gems || 0);
|
||||
},
|
||||
|
||||
// ItemXtCommManager.requestItemRecycle: [invIdx, ...]. the reply
|
||||
// (itemRecycleResponse) is [count, newGemTotal, ...recycledInvIdx], and
|
||||
// the recycling window then waits, behind its spinner, for the item
|
||||
|
||||
+3
-2
@@ -77,10 +77,11 @@ const whole = value => (Number.isInteger(Number(value)) ? Number(value) : 0);
|
||||
// the photo booth picture ("pb", PlayerWallGui): one level deeper than the
|
||||
// rest, {avatar: {id, color1.., eyes, pattern}, bgid, pet: {ts, lbits, ..} |
|
||||
// null, items: [{id, color}, ..]}. it was turned away as too deep, and the
|
||||
// owner's whole change with it: the photo never stayed.
|
||||
// owner's whole change with it: the photo never stayed. an animal wearing
|
||||
// nothing has no items list at all (null), which was turned away too.
|
||||
const MAX_PHOTO_ITEMS = 30;
|
||||
const photoParam = value => value === null || (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length <= 6
|
||||
&& Object.entries(value).every(([key, part]) => (key === "items" ? Array.isArray(part) && part.length <= MAX_PHOTO_ITEMS && part.every(flat)
|
||||
&& Object.entries(value).every(([key, part]) => (key === "items" ? part === null || (Array.isArray(part) && part.length <= MAX_PHOTO_ITEMS && part.every(flat))
|
||||
: key === "avatar" || key === "pet" ? part === null || flat(part) : scalar(part))));
|
||||
|
||||
module.exports = ({blocks, findOnline}) => {
|
||||
|
||||
+23
-2
@@ -28,6 +28,7 @@ const buddyModule = require("./buddies.js");
|
||||
const dens = require("./dens.js");
|
||||
const disguises = require("./disguises.js");
|
||||
const ecardModule = require("./ecards.js");
|
||||
const ecoModule = require("./eco.js");
|
||||
const epicDens = require("./epicdens.js");
|
||||
const itemHandlers = require("./items.js");
|
||||
const minigameModule = require("./minigames.js");
|
||||
@@ -51,6 +52,8 @@ const {CURRENCIES, DIAMOND_TYPES, activeAvatar, avatarById, activePet, equippedB
|
||||
|
||||
const GENERIC_LIST_AVATARS = 64;
|
||||
const GENERIC_LIST_NEWSPAPER = 627;
|
||||
const GENERIC_LIST_WHATS_NEW = 369;
|
||||
const WHATS_NEW_PAGES = 6;
|
||||
// the worlds' names (ServerSelector.getShardName): localization ids, the
|
||||
// game's own river names, world N being the Nth.
|
||||
const GENERIC_LIST_WORLD_NAMES = 16;
|
||||
@@ -143,6 +146,8 @@ const SHOP_LIST_TYPES = [DEF_ITEM, DEF_DEN_ITEM, DEF_DEN_ROOM, DEF_COMBINED_LIST
|
||||
// a shop's title when its room gives it none (a shop in a land's main room,
|
||||
// or one opened from elsewhere): what it sells (strings in lib/defpacks.js).
|
||||
// with no title the shop window's banner was blank.
|
||||
// shops opened from a window rather than a room, by their list: the Eco Shop.
|
||||
const SHOP_LIST_TITLES = new Map([[778, 35727]]);
|
||||
const SHOP_KIND_TITLES = new Map([[DEF_ITEM, 9000010], [DEF_DEN_ITEM, 9000011], [DEF_DEN_ROOM, 9000012],
|
||||
[DEF_COMBINED_LIST, 9000013], [DEF_CURRENCY_EXCHANGE, 9000014], [DEF_DIAMOND, 9000015]]);
|
||||
// diamond lists the client reads at login to learn which animals and pets
|
||||
@@ -854,6 +859,9 @@ const handlers = {
|
||||
}
|
||||
let entries = [];
|
||||
let count;
|
||||
if (Number(listId) === eco.SHOP_LIST) {
|
||||
eco.shopOpened(session);
|
||||
}
|
||||
if (Number(listId) === GENERIC_LIST_AVATARS) {
|
||||
entries = defpacks.avatarTypes();
|
||||
}
|
||||
@@ -955,6 +963,13 @@ const handlers = {
|
||||
count = defpacks.petIds().length;
|
||||
entries = defpacks.petIds().flatMap(id => [id, 1]);
|
||||
}
|
||||
// Jammer Central's "What's New" pictures (gui.BulletinBoard, list 369):
|
||||
// the newest pages of the Jamaa Journal. empty, the window waited on
|
||||
// its spinner.
|
||||
if (Number(listId) === GENERIC_LIST_WHATS_NEW && (count === undefined ? entries.length : count) === 0) {
|
||||
entries = defpacks.newestJournalPages(WHATS_NEW_PAGES).flatMap(id => [id, 0]);
|
||||
count = entries.length / 2;
|
||||
}
|
||||
// what the official server answered, where this one has nothing of its
|
||||
// own (lib/official-lists.json, from recordings of the official game:
|
||||
// the Journey Book's facts and pictures among them)
|
||||
@@ -967,7 +982,8 @@ const handlers = {
|
||||
}
|
||||
// for shops the first unused field is the title's string id; left empty
|
||||
// it keeps the shop window's own title (Shop.gotItemListCallback).
|
||||
const title = SHOP_LIST_TYPES.includes(type) ? (session.room && roomInfo.shopTitle(session.room.base, listId)) || SHOP_KIND_TITLES.get(type) : 0;
|
||||
const title = SHOP_LIST_TYPES.includes(type)
|
||||
? (session.room && roomInfo.shopTitle(session.room.base, listId)) || SHOP_LIST_TITLES.get(Number(listId)) || SHOP_KIND_TITLES.get(type) : 0;
|
||||
session.sendXt("gl", -1, listId, type, title, 0, 0, 0, count === undefined ? entries.length : count, ...entries);
|
||||
},
|
||||
|
||||
@@ -989,6 +1005,10 @@ const handlers = {
|
||||
if (vars[id] === undefined && Object.keys(vars).length >= MAX_USER_VARS) {
|
||||
return;
|
||||
}
|
||||
// the eco plaques (lib/eco.js) are given, not set
|
||||
if (eco.userVar(session, id, value)) {
|
||||
return;
|
||||
}
|
||||
if (Number(id) === USER_VAR_HIDE_BLOCKED) {
|
||||
setHideBlocked(session, Number(value) === 1);
|
||||
}
|
||||
@@ -1497,6 +1517,7 @@ const pets = petModule(context);
|
||||
const parties = partyModule(context);
|
||||
const ecards = ecardModule(context);
|
||||
const walls = wallModule(context);
|
||||
const eco = ecoModule({others, ecards});
|
||||
const commands = commandModule(context);
|
||||
const minigames = minigameModule(context);
|
||||
const adventures = adventureModule(context);
|
||||
@@ -1506,7 +1527,7 @@ const trades = tradeHandlers(context);
|
||||
achievements.setFinder(findOnline);
|
||||
Object.assign(handlers, avatarHandlers(context), itemHandlers(context), pets.handlers, dens.handlers({...context, others}),
|
||||
buddies.handlers, moderation.handlers, trades.handlers, achievements.handlers, adopt.handlers, worldItems.handlers,
|
||||
parties.handlers, ecards.handlers, walls.handlers, minigames.handlers, adventures.handlers, stubHandlers,
|
||||
parties.handlers, ecards.handlers, eco.handlers, walls.handlers, minigames.handlers, adventures.handlers, stubHandlers,
|
||||
playerItems.handlers({itemsTaken: (...args) => itemsTaken(...args)}));
|
||||
|
||||
// a den's owner, wherever they are, is told how many are in it: the HUD's
|
||||
|
||||
+16
-9
@@ -539,7 +539,14 @@ package
|
||||
}
|
||||
else
|
||||
{
|
||||
_toolsInstance.showItemFinder(true);
|
||||
// the item giver is the web one now (the account page's
|
||||
// /account/items, signed in as there), opened in the browser:
|
||||
// the one in the game is retired. it shared its colour box
|
||||
// with the Item Maker, whose colours turned up in it.
|
||||
if(ExternalInterface.available)
|
||||
{
|
||||
ExternalInterface.call("ajOpenPage",gMainFrame.clientInfo.websiteURL + "account/items");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(e:Error)
|
||||
@@ -3513,7 +3520,6 @@ package
|
||||
|
||||
private var _emojiCaret:int = -1;
|
||||
|
||||
private var _emojiTimer:Timer;
|
||||
|
||||
// the characters of code points in hex ("1f468-200d-1f469")
|
||||
public static function charsOfHex(param1:String) : String
|
||||
@@ -3555,7 +3561,8 @@ package
|
||||
|
||||
// a line about to be sent: each ":name:" of an emoji above becomes it,
|
||||
// but not the game's own emote codes (":happy:", ":joy:"), which the
|
||||
// bubble shows as the game's.
|
||||
// bubble shows as the game's, nor one after a "\" ("\:fire:"), which
|
||||
// the bubble shows as typed (ChatBalloon.inlineEmotes).
|
||||
public static function emojiShortcodes(param1:String) : String
|
||||
{
|
||||
if(param1.indexOf(":") == -1)
|
||||
@@ -3563,13 +3570,13 @@ package
|
||||
return param1;
|
||||
}
|
||||
emojiTable();
|
||||
return param1.replace(/:([a-z0-9_]{1,30}):/g,function(param1:String, param2:String, ... rest):String
|
||||
return param1.replace(/(\\?):([a-z0-9_]{1,30}):/g,function(param1:String, param2:String, param3:String, ... rest):String
|
||||
{
|
||||
if(EmoticonUtility.doesStringMatchAnEmote(param1) || _emojiByName[param2] == null)
|
||||
if(param2 != "" || EmoticonUtility.doesStringMatchAnEmote(":" + param3 + ":") || _emojiByName[param3] == null)
|
||||
{
|
||||
return param1;
|
||||
}
|
||||
return _emojiByName[param2];
|
||||
return _emojiByName[param3];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4115,9 +4122,9 @@ package
|
||||
|
||||
private function startEmojiButton() : void
|
||||
{
|
||||
_emojiTimer = new Timer(500);
|
||||
_emojiTimer.addEventListener("timer",placeEmojiButton);
|
||||
_emojiTimer.start();
|
||||
// every frame: on a timer it went a moment after the HUD did, when
|
||||
// a window opened over it
|
||||
gMainFrame.stage.addEventListener("enterFrame",placeEmojiButton,false,0,true);
|
||||
gMainFrame.stage.addEventListener("mouseDown",onEmojiStageDown,false,0,true);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,11 @@ package buddy
|
||||
|
||||
private var _joinLabel:Sprite;
|
||||
|
||||
// the animal's box as the card's art has it, measured before an animal
|
||||
// is put in it: measured with one in, a tall animal (or the one still
|
||||
// there from the card's last opening) put the label up on the name
|
||||
private var _charBoxRect:Rectangle;
|
||||
|
||||
private var _badgeRow:Sprite;
|
||||
|
||||
private var _discordIcon:Sprite;
|
||||
@@ -829,6 +834,7 @@ package buddy
|
||||
_bioMediaHelper = new MediaHelper();
|
||||
_bioMediaHelper.init(BIO_TAB_MEDIA_ID,onBioTabLoaded);
|
||||
charBox = _buddyCardMC.charBox;
|
||||
_charBoxRect = charBox.getBounds(_buddyCardMC);
|
||||
userNameTxt = _buddyCardMC.userName_txt;
|
||||
avatarNameTxt = _buddyCardMC.avatarNameTxt;
|
||||
shamanTag = _buddyCardMC.shamanTag;
|
||||
@@ -993,7 +999,7 @@ package buddy
|
||||
}
|
||||
_joinLabel = AJClient.makePill(_loc3_,9067051,6044183,false,11);
|
||||
_joinLabel.mouseEnabled = false;
|
||||
_loc2_ = charBox.getBounds(_buddyCardMC);
|
||||
_loc2_ = _charBoxRect != null ? _charBoxRect : charBox.getBounds(_buddyCardMC);
|
||||
_joinLabel.x = int(_loc2_.right - _joinLabel.width - 8);
|
||||
_joinLabel.y = int(_loc2_.top + 8);
|
||||
_buddyCardMC.addChild(_joinLabel);
|
||||
|
||||
+24
-6
@@ -73,8 +73,9 @@ package gui
|
||||
private var _emoteBGOffsetFunc:Function;
|
||||
|
||||
// emotes drawn inside a line of chat, small, where they were typed: an
|
||||
// emote's code standing as a word of its own ("hi :) there", ":fever:"),
|
||||
// or anywhere after a "\" ("yay\:)"). and emoji (typed with Windows'
|
||||
// emote's code standing as a word of its own ("hi :) there", ":fever:").
|
||||
// a "\" before one keeps it as typed ("\:)" shows ":)"), as it does a
|
||||
// ":name:" of an emoji (AJClient.emojiShortcodes). and emoji (typed with Windows'
|
||||
// emoji panel, say), which the game's font has none of: each is drawn
|
||||
// as a picture of it, from the server (/emoji/<code points>.png,
|
||||
// Twemoji's). each is {at, clip}: where its gap starts in the text shown.
|
||||
@@ -82,6 +83,11 @@ package gui
|
||||
// artwork to this measured slot with a one-pixel gutter on each side,
|
||||
// so consecutive emoji neither overlap nor touch surrounding text.
|
||||
private static const INLINE_GAP:String = " ";
|
||||
|
||||
// after each gap: a gap ending the text was trailing spaces, which a
|
||||
// centred line leaves out, so the text sat off centre and its last
|
||||
// emoji past it. this is no space, and has no width.
|
||||
private static const INLINE_END:String = "\u200B";
|
||||
|
||||
private static const LONGEST_EMOTE_CODE:int = 16;
|
||||
|
||||
@@ -579,7 +585,7 @@ package gui
|
||||
"at":_loc2_.length,
|
||||
"clip":emojiClip(param1.substr(_loc3_,_loc8_))
|
||||
});
|
||||
_loc2_ += INLINE_GAP;
|
||||
_loc2_ += INLINE_GAP + INLINE_END;
|
||||
_loc3_ += _loc8_;
|
||||
continue;
|
||||
}
|
||||
@@ -594,14 +600,26 @@ package gui
|
||||
"at":_loc2_.length,
|
||||
"clip":emojiClipNamed(_loc9_[1])
|
||||
});
|
||||
_loc2_ += INLINE_GAP;
|
||||
_loc2_ += INLINE_GAP + INLINE_END;
|
||||
_loc3_ += String(_loc9_[0]).length;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(param1.charAt(_loc3_) == "\\")
|
||||
{
|
||||
// "\" and an emote's code, or ":name:": that, as typed
|
||||
_loc5_ = emoteCodeAt(param1,_loc3_ + 1,false);
|
||||
var _loc10_:Array = /^:[a-z0-9_]{1,30}:/.exec(param1.substr(_loc3_ + 1,32));
|
||||
if(_loc5_ == null && _loc10_ != null)
|
||||
{
|
||||
_loc5_ = _loc10_[0];
|
||||
}
|
||||
if(_loc5_ != null)
|
||||
{
|
||||
_loc2_ += _loc5_;
|
||||
_loc3_ += 1 + _loc5_.length;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if(_loc3_ == 0 || param1.charAt(_loc3_ - 1) == " ")
|
||||
{
|
||||
@@ -616,8 +634,8 @@ package gui
|
||||
"at":_loc2_.length,
|
||||
"clip":_loc7_
|
||||
});
|
||||
_loc2_ += INLINE_GAP;
|
||||
_loc3_ += (param1.charAt(_loc3_) == "\\" ? 1 : 0) + _loc5_.length;
|
||||
_loc2_ += INLINE_GAP + INLINE_END;
|
||||
_loc3_ += _loc5_.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+16
-2
@@ -15,6 +15,7 @@ package gui
|
||||
import flash.text.StyleSheet;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormat;
|
||||
import flash.utils.getTimer;
|
||||
import flash.ui.Mouse;
|
||||
import gui.itemWindows.ItemWindowTextNode;
|
||||
import localization.LocalizationManager;
|
||||
@@ -50,6 +51,13 @@ package gui
|
||||
|
||||
private var _chatRepeatArray:Array;
|
||||
|
||||
// a repeat list line (emoji as names) -> {line: as it was said, with
|
||||
// its emoji, at: getTimer() then}. the names were sent instead, and the
|
||||
// server says nothing to a line said again within REPEAT_MS (lib/chatspam.js)
|
||||
private var _chatRepeatSaid:Object = {};
|
||||
|
||||
private static const REPEAT_MS:int = 20000;
|
||||
|
||||
private var _hasSetupChatRepeatBtn:Boolean;
|
||||
|
||||
private var _isOverChatText:Boolean;
|
||||
@@ -288,6 +296,7 @@ package gui
|
||||
|
||||
public function addMessage(param1:String, param2:String, param3:String, param4:String) : void
|
||||
{
|
||||
var said:String = param4;
|
||||
// emoji as their names here: this list has no pictures (AJClient.emojiAsNames)
|
||||
param4 = AJClient.emojiAsNames(param4);
|
||||
var _loc5_:Boolean = false;
|
||||
@@ -298,6 +307,10 @@ package gui
|
||||
addLine("<a href=\"event:" + plain(param2) + "\">" + plain(Utility.isSettingOn(MySettings.SETTINGS_USERNAME_BADGE) ? param3 : param1) + ": " + "</a>",param4,"\n");
|
||||
if(_chatRepeatWindow && AvatarManager.playerAvatar && param2.toLowerCase() == AvatarManager.playerAvatar.userName.toLowerCase())
|
||||
{
|
||||
_chatRepeatSaid[param4] = {
|
||||
"line":said,
|
||||
"at":getTimer()
|
||||
};
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _chatRepeatArray.length)
|
||||
{
|
||||
@@ -991,9 +1004,10 @@ package gui
|
||||
|
||||
private function onRepeatChatSelected(param1:MouseEvent) : void
|
||||
{
|
||||
if(!AvatarManager.playerAvatarWorldView.isSameMessage(param1.currentTarget.text))
|
||||
var _loc2_:Object = _chatRepeatSaid[param1.currentTarget.text];
|
||||
if(!AvatarManager.playerAvatarWorldView.isSameMessage(param1.currentTarget.text) && !(_loc2_ && getTimer() - _loc2_.at < REPEAT_MS))
|
||||
{
|
||||
sendMsgCallback(null,param1.currentTarget.text);
|
||||
sendMsgCallback(null,_loc2_ ? _loc2_.line : param1.currentTarget.text);
|
||||
SBTracker.trackPageview("/game/play/popup/repeatChat/#repeat",-1,1);
|
||||
}
|
||||
else
|
||||
|
||||
+9
-14
@@ -235,14 +235,8 @@ package gui
|
||||
|
||||
public function updateSwitchRecycleBtnVisibility() : void
|
||||
{
|
||||
if(!_denEditor.switchDenBtn.visible)
|
||||
{
|
||||
if(gMainFrame.userInfo.numLogins >= 2 || gMainFrame.userInfo.userVarCache.getUserVarValueById(3) > 1)
|
||||
{
|
||||
_denEditor.switchDenBtn.visible = true;
|
||||
_denEditor.recycleBtn.visible = true;
|
||||
}
|
||||
}
|
||||
_denEditor.switchDenBtn.visible = true;
|
||||
_denEditor.recycleBtn.visible = true;
|
||||
}
|
||||
|
||||
public function clearItemWindows() : void
|
||||
@@ -433,11 +427,11 @@ package gui
|
||||
{
|
||||
_denEditor.petBtnDn.visible = false;
|
||||
}
|
||||
if(gMainFrame.userInfo.numLogins < 2 && gMainFrame.userInfo.userVarCache.getUserVarValueById(3) <= 1)
|
||||
{
|
||||
_denEditor.switchDenBtn.visible = false;
|
||||
_denEditor.recycleBtn.visible = false;
|
||||
}
|
||||
// the switch den and recycle buttons are not kept from a new
|
||||
// player any more: the game hid them before a second login (or a
|
||||
// den tutorial var), and players found them gone
|
||||
_denEditor.switchDenBtn.visible = true;
|
||||
_denEditor.recycleBtn.visible = true;
|
||||
_denEditor.denAudioPopup.visible = false;
|
||||
_denEditor.itemBlock.glowCont.glow.visible = false;
|
||||
_denEditor.lockBtn.denLock.initToolTip(_guiLayer,LocalizationManager.translateIdOnly(14639),900 * 0.5,105);
|
||||
@@ -690,7 +684,8 @@ package gui
|
||||
{
|
||||
_denEditor.itemBlock.itemBlock.addChild(_itemWindow);
|
||||
}
|
||||
if(_numItems <= 10 + 1)
|
||||
// ten to a page: with eleven the last could not be scrolled to
|
||||
if(_numItems <= 10)
|
||||
{
|
||||
_denEditor.lArrowBtn.activateGrayState(true);
|
||||
_denEditor.rArrowBtn.activateGrayState(true);
|
||||
|
||||
@@ -391,12 +391,19 @@ package den
|
||||
}
|
||||
_loc26_ = int(param1[_loc23_++]);
|
||||
_loc18_.init(_loc28_,_loc31_,_loc32_,_loc24_,0,null,_loc14_,_loc33_,"",_loc17_,_loc30_,_loc4_,_loc26_);
|
||||
_loc6_.setDenItem(_loc21_,_loc18_);
|
||||
// pushed, not set at its place: one skipped left a hole, and
|
||||
// the inventory's windows scrolled over an empty one
|
||||
_loc6_.pushDenItem(_loc18_);
|
||||
if(_loc18_.minigameDefId > 0 && !MinigameManager.minigameInfoCache.getMinigameInfo(_loc18_.minigameDefId))
|
||||
{
|
||||
_loc20_.push(_loc18_.minigameDefId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// its last field (the den shop's), read past as above
|
||||
_loc23_++;
|
||||
}
|
||||
_loc21_++;
|
||||
}
|
||||
_loc6_.getCoreArray().sortOn("invIdx",0x10 | 2);
|
||||
@@ -846,6 +853,11 @@ package den
|
||||
_loc19_ = getDenItemDef(_loc27_);
|
||||
if(!_loc19_)
|
||||
{
|
||||
// the rest of its fields, read past: left there, every item
|
||||
// after it was read from the wrong place (lib/dens.js
|
||||
// sendDenState: placed, x, y, version, flip, link, image,
|
||||
// creator id, creator uuid, eco state)
|
||||
_loc20_ += 10;
|
||||
_loc9_.setDenStateItem(_loc21_,new DenStateItem(0,_loc38_,0,0,0,0,0,0,0,0,0,0,0,0,0,"",0,"",0,0,"","",-1,"",false,null,0,0,null,null,2));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -160,9 +160,10 @@ package gui
|
||||
}
|
||||
var _loc4_:Array = [{
|
||||
"type":TOGGLE_TYPE_JOIN,
|
||||
// the web item giver (AJClient.openTool), in the browser
|
||||
"frame":"itemFinder",
|
||||
"iconFrame":"redeemCode",
|
||||
"labelLabel":"Item Giver",
|
||||
"labelLabel":"Item Giver (web)",
|
||||
"btnLabel":"Open"
|
||||
},{
|
||||
// a player's own items (AJClient's Item Maker)
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,853 @@
|
||||
package playerWall
|
||||
{
|
||||
import buddy.BuddyManager;
|
||||
import collection.IntItemCollection;
|
||||
import com.sbi.client.SFEvent;
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import flash.events.ErrorEvent;
|
||||
import flash.events.Event;
|
||||
import flash.net.URLLoader;
|
||||
import flash.net.URLRequest;
|
||||
import flash.net.URLRequestHeader;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class PlayerWallXtCommManager
|
||||
{
|
||||
|
||||
private static var _requestor:URLLoader;
|
||||
|
||||
private static var _deleteResponseCallback:Function;
|
||||
|
||||
private static var _getResponseCallback:Function;
|
||||
|
||||
private static var _putResponseCallback:Function;
|
||||
|
||||
private static var _setSettingsResponseCallback:Function;
|
||||
|
||||
private static var _getSettingsResponseCallback:Function;
|
||||
|
||||
private static var _setParametersResponseCallback:Function;
|
||||
|
||||
private static var _blockedMessagesCallback:Function;
|
||||
|
||||
private static var _setBlockedMessageCallback:Function;
|
||||
|
||||
private static var _wallTokenCallback:Function;
|
||||
|
||||
private static var _checkResponseCallback:Function;
|
||||
|
||||
private static var _sendClearAllMessagesCallback:Function;
|
||||
|
||||
private static var _sendMasterpieceCallback:Function;
|
||||
|
||||
private static var _setCounterIncrementResponseCallback:Function;
|
||||
|
||||
private static var _sendAcknowledgeNotificationCallback:Function;
|
||||
|
||||
private static var _wallTokenPassback:Object;
|
||||
|
||||
private static var _setSettingsId:int;
|
||||
|
||||
private static var _currentRequestUsername:String;
|
||||
|
||||
private static var _messageToPost:PostMessage;
|
||||
|
||||
private static var _currMessageuuid:String;
|
||||
|
||||
private static var _setWallParameters:Object;
|
||||
|
||||
private static var _messageToBeBlocked:String;
|
||||
|
||||
private static var _wallTokenShouldShowFailure:Boolean;
|
||||
|
||||
private static var _masterpieceInvIdsToRemove:IntItemCollection;
|
||||
|
||||
private static var _setCounterIncrementWallOwner:String;
|
||||
|
||||
private static var _sendAcknowledgeMessages:Array;
|
||||
|
||||
private static var _isProcessingRequest:Boolean;
|
||||
|
||||
private static var _currCommand:String;
|
||||
|
||||
private static var _tokenFailures:int;
|
||||
|
||||
private static var _isFromHudTimer:Boolean;
|
||||
|
||||
// requests made while one was on its way, each with what its reply is
|
||||
// read with ({request, state}), and that of the one on its way
|
||||
private static var _waitingRequests:Array = [];
|
||||
|
||||
private static var _sentRequestState:Object;
|
||||
|
||||
public function PlayerWallXtCommManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init() : void
|
||||
{
|
||||
_requestor = new URLLoader();
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
}
|
||||
|
||||
public static function sendWallTokenRequest(param1:String, param2:Function = null, param3:Object = null, param4:Boolean = true, param5:Boolean = false) : void
|
||||
{
|
||||
if(_tokenFailures < 2)
|
||||
{
|
||||
if(param5)
|
||||
{
|
||||
_tokenFailures = _tokenFailures + 1;
|
||||
}
|
||||
PlayerWallManager.setForWaitingOnWallResponse(true);
|
||||
_wallTokenCallback = param2;
|
||||
_wallTokenPassback = param3;
|
||||
_wallTokenShouldShowFailure = param4;
|
||||
gMainFrame.server.setXtObject_Str("wt",[param1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerWallManager.closeOpenPlayerWallDueToTokenFailures();
|
||||
_tokenFailures = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendSetWallSettingsRequest(param1:int, param2:Function) : void
|
||||
{
|
||||
_setSettingsResponseCallback = param2;
|
||||
_setSettingsId = param1;
|
||||
gMainFrame.server.setXtObject_Str("wss",[param1]);
|
||||
}
|
||||
|
||||
public static function sendGetWallSettingsRequest(param1:String, param2:Function) : void
|
||||
{
|
||||
_getSettingsResponseCallback = param2;
|
||||
gMainFrame.server.setXtObject_Str("wsg",[param1]);
|
||||
}
|
||||
|
||||
public static function sendSetWallParametersRequest(param1:Object, param2:Object, param3:Function) : void
|
||||
{
|
||||
_setParametersResponseCallback = param3;
|
||||
_setWallParameters = param1;
|
||||
gMainFrame.server.setXtObject_Str("wps",[JSON.stringify(param2)]);
|
||||
}
|
||||
|
||||
public static function sendSetWallCounterIncrementRequest(param1:String, param2:Function) : void
|
||||
{
|
||||
_setCounterIncrementResponseCallback = param2;
|
||||
_setCounterIncrementWallOwner = param1;
|
||||
gMainFrame.server.setXtObject_Str("wci",[param1]);
|
||||
}
|
||||
|
||||
public static function handleXtReply(param1:SFEvent) : void
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
if(!param1.status)
|
||||
{
|
||||
DebugUtility.debugTrace("ERROR: PlayerWallXtCommManager handleXtReply was called with bad evt.status:" + param1.status);
|
||||
return;
|
||||
}
|
||||
var _loc2_:Array = param1.obj;
|
||||
switch(_loc2_[0])
|
||||
{
|
||||
case "wt":
|
||||
PlayerWallManager.handleTokenResponse(_loc2_,_wallTokenShouldShowFailure);
|
||||
if(_wallTokenCallback != null)
|
||||
{
|
||||
if(_wallTokenPassback != null)
|
||||
{
|
||||
if(_wallTokenPassback.hasOwnProperty("data"))
|
||||
{
|
||||
_loc3_ = _wallTokenPassback.data;
|
||||
switch(int(_loc3_.length) - 1)
|
||||
{
|
||||
case 0:
|
||||
_wallTokenCallback(_loc3_[0],_loc2_[2] == "1");
|
||||
break;
|
||||
case 1:
|
||||
_wallTokenCallback(_loc3_[0],_loc3_[1],_loc2_[2] == "1");
|
||||
break;
|
||||
case 2:
|
||||
_wallTokenCallback(_loc3_[0],_loc3_[1],_loc3_[2],_loc2_[2] == "1");
|
||||
break;
|
||||
case 3:
|
||||
_wallTokenCallback(_loc3_[0],_loc3_[1],_loc3_[2],_loc3_[3],_loc2_[2] == "1");
|
||||
break;
|
||||
case 4:
|
||||
_wallTokenCallback(_loc3_[0],_loc3_[1],_loc3_[2],_loc3_[3],_loc3_[4],_loc2_[2] == "1");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_wallTokenCallback(_wallTokenPassback,_loc2_[2] == "1");
|
||||
}
|
||||
_wallTokenPassback = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_wallTokenCallback(_loc2_[2] == "1");
|
||||
}
|
||||
_wallTokenCallback = null;
|
||||
}
|
||||
break;
|
||||
case "wss":
|
||||
PlayerWallManager.onPrivacyResponse(_loc2_[2] == "1",_setSettingsId);
|
||||
if(_setSettingsResponseCallback != null)
|
||||
{
|
||||
_setSettingsResponseCallback(_loc2_[2] == "1",_setSettingsId);
|
||||
_setSettingsResponseCallback = null;
|
||||
}
|
||||
break;
|
||||
case "wsg":
|
||||
if(_getSettingsResponseCallback != null)
|
||||
{
|
||||
_getSettingsResponseCallback(_loc2_[2]);
|
||||
_getSettingsResponseCallback = null;
|
||||
}
|
||||
break;
|
||||
case "wps":
|
||||
setParametersResponse(_loc2_);
|
||||
break;
|
||||
case "wci":
|
||||
PlayerWallManager.onWallCountIncrementResponse(_loc2_[2] == "1",_setCounterIncrementWallOwner);
|
||||
if(_setCounterIncrementResponseCallback != null)
|
||||
{
|
||||
_setCounterIncrementResponseCallback(_loc2_[2]);
|
||||
_setCounterIncrementResponseCallback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendCheckPlayerWall(param1:String, param2:Function, param3:Boolean = false, param4:Boolean = true) : void
|
||||
{
|
||||
var _loc5_:Object = PlayerWallManager.tokenMap[param1.toLowerCase()];
|
||||
var _loc6_:String = null;
|
||||
if(_loc5_)
|
||||
{
|
||||
_loc6_ = _loc5_.token;
|
||||
}
|
||||
_currentRequestUsername = param1;
|
||||
_checkResponseCallback = param2;
|
||||
_isFromHudTimer = param3;
|
||||
if(_loc6_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"CHK",
|
||||
"t":_loc6_
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(param1,sendCheckPlayerWall,{"data":[param1,param2,param3]},!param3,!param4);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendPutToPlayerWall(param1:String, param2:PostMessage, param3:Object, param4:Function, param5:Boolean = true) : void
|
||||
{
|
||||
var _loc6_:Object = null;
|
||||
var _loc7_:Object = PlayerWallManager.tokenMap[param1.toLowerCase()];
|
||||
var _loc8_:String = null;
|
||||
if(_loc7_)
|
||||
{
|
||||
_loc8_ = _loc7_.token;
|
||||
}
|
||||
_messageToPost = param2;
|
||||
_currentRequestUsername = param1;
|
||||
_putResponseCallback = param4;
|
||||
if(_loc8_)
|
||||
{
|
||||
_loc6_ = {
|
||||
"cmd":"PUT",
|
||||
"t":_loc8_,
|
||||
"sid":param2.senderDbId,
|
||||
"s":param2.patternId,
|
||||
"c":param2.colorId,
|
||||
"m":param2.message,
|
||||
"ai":param2.avtDefId,
|
||||
"ac":param2.avtColors,
|
||||
"ae":param2.avtEyeDefId,
|
||||
"ap":param2.avtPatternDefId,
|
||||
"aci":param2.avtCustomId,
|
||||
"l":param2.localizationId,
|
||||
"p":param3
|
||||
};
|
||||
if(param2.parentMessageId != null && param2.parentMessageId.length > 0)
|
||||
{
|
||||
_loc6_.pp = param2.parentMessageId;
|
||||
}
|
||||
sendServiceRequest(_loc6_);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(param1,sendPutToPlayerWall,{"data":[param1,param4,param2,param3]},true,!param5);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendDeleteFromPlayerWall(param1:String, param2:String, param3:Function, param4:Boolean = true) : void
|
||||
{
|
||||
var _loc5_:Object = PlayerWallManager.tokenMap[param1.toLowerCase()];
|
||||
var _loc6_:String = null;
|
||||
if(_loc5_)
|
||||
{
|
||||
_loc6_ = _loc5_.token;
|
||||
}
|
||||
_currentRequestUsername = param1;
|
||||
_currMessageuuid = param2;
|
||||
_deleteResponseCallback = param3;
|
||||
if(_loc6_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"DEL",
|
||||
"t":_loc6_,
|
||||
"x":param2
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(param1,sendDeleteFromPlayerWall,{"data":[param1,param3,param2]},true,!param4);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendGetFromPlayerWall(param1:String, param2:Function, param3:Boolean = false, param4:Boolean = true) : void
|
||||
{
|
||||
var _loc5_:Object = PlayerWallManager.tokenMap[param1.toLowerCase()];
|
||||
var _loc6_:String = null;
|
||||
if(_loc5_)
|
||||
{
|
||||
_loc6_ = _loc5_.token;
|
||||
}
|
||||
_currentRequestUsername = param1;
|
||||
_getResponseCallback = param2;
|
||||
_isFromHudTimer = param3;
|
||||
if(_loc6_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"GET",
|
||||
"t":_loc6_
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(param1,sendGetFromPlayerWall,{"data":[param1,param2,param3]},true,!param4);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendGetBlockedMessages(param1:Function, param2:Boolean = true) : void
|
||||
{
|
||||
_blockedMessagesCallback = param1;
|
||||
var _loc3_:Object = PlayerWallManager.tokenMap[gMainFrame.userInfo.myUserName.toLowerCase()];
|
||||
var _loc4_:String = null;
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc4_ = _loc3_.token;
|
||||
}
|
||||
_currentRequestUsername = gMainFrame.userInfo.myUserName;
|
||||
if(_loc4_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"GMB",
|
||||
"t":_loc4_
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(_currentRequestUsername,sendGetBlockedMessages,{"callback":param1},true,!param2);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendSetBlockedMessage(param1:String, param2:Function, param3:Boolean = true) : void
|
||||
{
|
||||
_setBlockedMessageCallback = param2;
|
||||
_messageToBeBlocked = param1;
|
||||
var _loc4_:Object = PlayerWallManager.tokenMap[gMainFrame.userInfo.myUserName.toLowerCase()];
|
||||
var _loc5_:String = null;
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = _loc4_.token;
|
||||
}
|
||||
_currentRequestUsername = gMainFrame.userInfo.myUserName;
|
||||
if(_loc5_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"AMB",
|
||||
"t":_loc5_,
|
||||
"x":param1
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(_currentRequestUsername,sendSetBlockedMessage,{"data":[param2,param1]},true,!param3);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendClearAllMessages(param1:Function, param2:Boolean = true) : void
|
||||
{
|
||||
_sendClearAllMessagesCallback = param1;
|
||||
var _loc3_:Object = PlayerWallManager.tokenMap[gMainFrame.userInfo.myUserName.toLowerCase()];
|
||||
var _loc4_:String = null;
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc4_ = _loc3_.token;
|
||||
}
|
||||
_currentRequestUsername = gMainFrame.userInfo.myUserName;
|
||||
if(_loc4_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"CLW",
|
||||
"t":_loc4_
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(_currentRequestUsername,sendClearAllMessages,{"callback":param1},true,!param2);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendRemoveMasterpiece(param1:IntItemCollection, param2:Function, param3:Boolean = true) : void
|
||||
{
|
||||
_masterpieceInvIdsToRemove = param1;
|
||||
_sendMasterpieceCallback = param2;
|
||||
var _loc4_:Object = PlayerWallManager.tokenMap[gMainFrame.userInfo.myUserName.toLowerCase()];
|
||||
var _loc5_:String = null;
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = _loc4_.token;
|
||||
}
|
||||
_currentRequestUsername = gMainFrame.userInfo.myUserName;
|
||||
if(_loc5_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"RMP",
|
||||
"t":_loc5_,
|
||||
"mp":param1.getCoreArray()
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(_currentRequestUsername,sendRemoveMasterpiece,{"data":[param2,param1]},true,!param3);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendAcknowledgeNotificationRequest(param1:Array, param2:Function, param3:Boolean = true) : void
|
||||
{
|
||||
var _loc4_:Object = PlayerWallManager.tokenMap[gMainFrame.userInfo.myUserName.toLowerCase()];
|
||||
var _loc5_:String = null;
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = _loc4_.token;
|
||||
}
|
||||
_sendAcknowledgeNotificationCallback = param2;
|
||||
_currentRequestUsername = gMainFrame.userInfo.myUserName;
|
||||
_sendAcknowledgeMessages = param1;
|
||||
if(_loc5_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"ACK",
|
||||
"t":_loc5_,
|
||||
"x":param1
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(_currentRequestUsername,sendAcknowledgeNotificationRequest,{"data":[param2,param1]},true,!param3);
|
||||
}
|
||||
}
|
||||
|
||||
public static function ContinueCommandAfterTokenRequest(param1:Object, param2:Boolean) : void
|
||||
{
|
||||
var _loc3_:String = null;
|
||||
var _loc4_:String = null;
|
||||
if(param1 && param2)
|
||||
{
|
||||
_loc3_ = param1.cmd;
|
||||
_loc4_ = param1.username;
|
||||
switch(_loc3_)
|
||||
{
|
||||
case "CHK":
|
||||
sendCheckPlayerWall(_loc4_,param1.callback,param1.isFromHudTimer,param2);
|
||||
break;
|
||||
case "PUT":
|
||||
sendPutToPlayerWall(_loc4_,param1.msgToPost,param1.wallParameters,param1.callback,param2);
|
||||
break;
|
||||
case "DEL":
|
||||
sendDeleteFromPlayerWall(_loc4_,param1.messageuuid,param1.callback,param2);
|
||||
break;
|
||||
case "GET":
|
||||
sendGetFromPlayerWall(_loc4_,param1.callback,param1.isFromHudTimer,param2);
|
||||
break;
|
||||
case "GMP":
|
||||
sendGetBlockedMessages(param1.callback,param2);
|
||||
break;
|
||||
case "AMB":
|
||||
sendSetBlockedMessage(param1.messageToBeBlocked,param1.callback,param2);
|
||||
break;
|
||||
case "CLW":
|
||||
sendClearAllMessages(param1.callback,param2);
|
||||
break;
|
||||
case "RMP":
|
||||
sendRemoveMasterpiece(param1.invIdToRemove,param1.callback,param2);
|
||||
break;
|
||||
case "ACK":
|
||||
sendAcknowledgeNotificationRequest(param1.messageId,param1.callback,param2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerWallManager.closeOpenPlayerWallDueToTokenFailures();
|
||||
}
|
||||
}
|
||||
|
||||
private static function checkResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onCheckResponse(_loc2_,param1,_currentRequestUsername,_isFromHudTimer);
|
||||
if(_checkResponseCallback != null)
|
||||
{
|
||||
_checkResponseCallback(_loc2_,param1);
|
||||
}
|
||||
}
|
||||
|
||||
private static function deleteResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
if(_deleteResponseCallback != null)
|
||||
{
|
||||
_deleteResponseCallback(_loc2_,_currMessageuuid,param1.e);
|
||||
_deleteResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function addResponse(param1:Object) : void
|
||||
{
|
||||
var _loc4_:Boolean = param1 != null ? Boolean(param1.PUT.s) : false;
|
||||
var _loc2_:int = int(param1.PUT.cs != null ? param1.PUT.cs : 0);
|
||||
var _loc3_:int = int(param1.PUT.tag != null ? param1.PUT.tag : 0);
|
||||
if(_loc4_)
|
||||
{
|
||||
_messageToPost.msgId = param1.x;
|
||||
_messageToPost.postTime = param1.t;
|
||||
getResponse(param1.GET);
|
||||
}
|
||||
if(_putResponseCallback != null)
|
||||
{
|
||||
_putResponseCallback(_loc4_,_messageToPost,_loc2_,_loc3_,param1.PUT.e);
|
||||
_putResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getResponse(param1:Object) : void
|
||||
{
|
||||
var _loc11_:Object = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc12_:String = null;
|
||||
var _loc10_:Boolean = false;
|
||||
var _loc2_:Array = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc13_:Array = null;
|
||||
var _loc8_:Object = null;
|
||||
var _loc7_:int = 0;
|
||||
var _loc3_:Vector.<PostMessage> = new Vector.<PostMessage>();
|
||||
var _loc9_:Vector.<PostMessage> = new Vector.<PostMessage>();
|
||||
var _loc14_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
if(_loc14_)
|
||||
{
|
||||
_loc2_ = param1.r;
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc2_.length)
|
||||
{
|
||||
_loc11_ = _loc2_[_loc6_];
|
||||
if(_loc11_)
|
||||
{
|
||||
_loc12_ = _loc11_.um == 1 ? _loc11_.un : LocalizationManager.translateIdOnly(11098);
|
||||
_loc10_ = _loc11_.u == gMainFrame.userInfo.myUUID ? true : BuddyManager.isBuddy(_loc11_.un);
|
||||
_loc3_.push(new PostMessage(_loc11_.x,_loc11_.m,_loc11_.uid,_loc11_.un,_loc12_,_loc11_.s,_loc11_.c,_loc11_.t,_loc10_,_loc11_.ai,_loc11_.ac,_loc11_.ae,_loc11_.ap,_loc11_.l,_loc11_.aci,_loc11_.pp,"",false));
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_++;
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
_loc13_ = param1.n;
|
||||
if(_loc13_ != null && _loc13_.length > 0)
|
||||
{
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc13_.length)
|
||||
{
|
||||
_loc8_ = _loc13_[_loc7_];
|
||||
if(_loc8_ != null)
|
||||
{
|
||||
_loc12_ = _loc8_.um == 1 ? _loc8_.un : LocalizationManager.translateIdOnly(11098);
|
||||
_loc10_ = _loc8_.un == gMainFrame.userInfo.myUserName ? true : BuddyManager.isBuddy(_loc8_.un);
|
||||
_loc9_.push(new PostMessage(_loc8_.x,_loc8_.m,0,_loc8_.un,_loc12_,0,_loc8_.c,_loc8_.t,_loc10_,_loc8_.ai,_loc8_.ac,_loc8_.ae,_loc8_.ap,_loc8_.l,_loc8_.aci,_loc8_.pp,_loc8_.u,_loc8_.read));
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
_loc9_.sort(orderTimestamp);
|
||||
}
|
||||
PlayerWallManager.updateTimestamp(_currentRequestUsername,param1.t);
|
||||
_loc3_.sort(orderTimestamp);
|
||||
}
|
||||
PlayerWallManager.onGetResponse(_loc14_,_loc3_,_loc9_,param1.p,_isFromHudTimer,_currentRequestUsername,param1.e,_getResponseCallback);
|
||||
if(_getResponseCallback != null)
|
||||
{
|
||||
_getResponseCallback(_loc14_);
|
||||
_getResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function setSettingsResponse(param1:Array) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onPrivacyResponse(_loc2_,_setSettingsId);
|
||||
if(_setSettingsResponseCallback != null)
|
||||
{
|
||||
_setSettingsResponseCallback(_loc2_,_setSettingsId);
|
||||
_setSettingsResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function setParametersResponse(param1:Array) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1[2] == "1";
|
||||
PlayerWallManager.onParametersResponse(_loc2_,_setWallParameters);
|
||||
if(_setParametersResponseCallback != null)
|
||||
{
|
||||
_setParametersResponseCallback(_loc2_,_setWallParameters);
|
||||
_setParametersResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function getBlockedMessagesResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onBlockedMessagesResponse(_loc2_,param1);
|
||||
if(_blockedMessagesCallback != null)
|
||||
{
|
||||
_blockedMessagesCallback(_loc2_,param1);
|
||||
_blockedMessagesCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function setBlockedMessageResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onSetBlockedMessageResponse(_loc2_,_messageToBeBlocked);
|
||||
if(_setBlockedMessageCallback != null)
|
||||
{
|
||||
_setBlockedMessageCallback(_loc2_,_messageToBeBlocked);
|
||||
_setBlockedMessageCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function sendClearAllMessagesResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onSendClearAllMessagesResponse(_loc2_);
|
||||
if(_sendClearAllMessagesCallback != null)
|
||||
{
|
||||
_sendClearAllMessagesCallback(_loc2_);
|
||||
_sendClearAllMessagesCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function sendRemoveMasterpieceResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onSendRemoveMasterpieceResponse(_loc2_,_masterpieceInvIdsToRemove);
|
||||
if(_sendMasterpieceCallback != null)
|
||||
{
|
||||
_sendMasterpieceCallback(_loc2_,_masterpieceInvIdsToRemove);
|
||||
_sendMasterpieceCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function sendAcknowledgeNotificationResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onSendAcknowledgeNotificationResponse(_loc2_,_sendAcknowledgeMessages);
|
||||
if(_sendAcknowledgeNotificationCallback != null)
|
||||
{
|
||||
_sendAcknowledgeNotificationCallback(_loc2_,_sendAcknowledgeMessages,param1.e);
|
||||
_sendAcknowledgeNotificationCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
// what a reply is read with: its caller sets these before asking
|
||||
private static function requestState() : Object
|
||||
{
|
||||
return {
|
||||
"del":_deleteResponseCallback,
|
||||
"get":_getResponseCallback,
|
||||
"put":_putResponseCallback,
|
||||
"blocked":_blockedMessagesCallback,
|
||||
"block":_setBlockedMessageCallback,
|
||||
"check":_checkResponseCallback,
|
||||
"clear":_sendClearAllMessagesCallback,
|
||||
"masterpiece":_sendMasterpieceCallback,
|
||||
"ack":_sendAcknowledgeNotificationCallback,
|
||||
"username":_currentRequestUsername,
|
||||
"message":_messageToPost,
|
||||
"uuid":_currMessageuuid,
|
||||
"toBlock":_messageToBeBlocked,
|
||||
"masterpieces":_masterpieceInvIdsToRemove,
|
||||
"ackMessages":_sendAcknowledgeMessages,
|
||||
"hud":_isFromHudTimer
|
||||
};
|
||||
}
|
||||
|
||||
private static function setRequestState(param1:Object) : void
|
||||
{
|
||||
_deleteResponseCallback = param1.del;
|
||||
_getResponseCallback = param1.get;
|
||||
_putResponseCallback = param1.put;
|
||||
_blockedMessagesCallback = param1.blocked;
|
||||
_setBlockedMessageCallback = param1.block;
|
||||
_checkResponseCallback = param1.check;
|
||||
_sendClearAllMessagesCallback = param1.clear;
|
||||
_sendMasterpieceCallback = param1.masterpiece;
|
||||
_sendAcknowledgeNotificationCallback = param1.ack;
|
||||
_currentRequestUsername = param1.username;
|
||||
_messageToPost = param1.message;
|
||||
_currMessageuuid = param1.uuid;
|
||||
_messageToBeBlocked = param1.toBlock;
|
||||
_masterpieceInvIdsToRemove = param1.masterpieces;
|
||||
_sendAcknowledgeMessages = param1.ackMessages;
|
||||
_isFromHudTimer = param1.hud;
|
||||
}
|
||||
|
||||
// the next request that waited, once none is on its way (a reply's
|
||||
// handler may have sent one of its own)
|
||||
private static function sendWaitingRequest() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
if(!_isProcessingRequest && _waitingRequests.length > 0)
|
||||
{
|
||||
_loc1_ = _waitingRequests.shift();
|
||||
setRequestState(_loc1_.state);
|
||||
sendServiceRequest(_loc1_.request);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendServiceRequest(... rest) : void
|
||||
{
|
||||
var _loc3_:URLRequestHeader = null;
|
||||
var _loc4_:String = null;
|
||||
var _loc2_:URLRequest = null;
|
||||
// one made while another was on its way was dropped: a wall
|
||||
// opened while the HUD's timer was checking the player's own did
|
||||
// not open. it waits for its turn now, and the one on its way gets
|
||||
// back what its reply is read with.
|
||||
if(_isProcessingRequest)
|
||||
{
|
||||
_waitingRequests.push({
|
||||
"request":rest[0],
|
||||
"state":requestState()
|
||||
});
|
||||
if(_sentRequestState)
|
||||
{
|
||||
setRequestState(_sentRequestState);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_isProcessingRequest = true;
|
||||
_sentRequestState = requestState();
|
||||
_currCommand = rest[0].cmd;
|
||||
_loc3_ = new URLRequestHeader("Content-type","application/json");
|
||||
_loc4_ = JSON.stringify(rest[0]);
|
||||
_loc2_ = new URLRequest(gMainFrame.clientInfo.playerWallHost);
|
||||
_loc2_.method = "POST";
|
||||
_loc2_.requestHeaders.push(_loc3_);
|
||||
_loc2_.data = _loc4_;
|
||||
_requestor = new URLLoader();
|
||||
_requestor.addEventListener("complete",httpRequestComplete);
|
||||
_requestor.addEventListener("ioError",httpRequestError);
|
||||
_requestor.addEventListener("securityError",httpRequestError);
|
||||
_requestor.load(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function httpRequestComplete(param1:Event) : void
|
||||
{
|
||||
_isProcessingRequest = false;
|
||||
var _loc2_:Object = param1.target.data != "" ? JSON.parse(param1.target.data) : null;
|
||||
if(_loc2_ != null)
|
||||
{
|
||||
if("s" in _loc2_)
|
||||
{
|
||||
if(_loc2_.s == true)
|
||||
{
|
||||
_tokenFailures = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch(_currCommand)
|
||||
{
|
||||
case "CHK":
|
||||
checkResponse(_loc2_);
|
||||
break;
|
||||
case "PUT":
|
||||
addResponse(_loc2_);
|
||||
if(_loc2_.PUT.s == true)
|
||||
{
|
||||
_tokenFailures = 0;
|
||||
}
|
||||
break;
|
||||
case "DEL":
|
||||
deleteResponse(_loc2_);
|
||||
break;
|
||||
case "GET":
|
||||
getResponse(_loc2_);
|
||||
break;
|
||||
case "GMB":
|
||||
getBlockedMessagesResponse(_loc2_);
|
||||
break;
|
||||
case "AMB":
|
||||
setBlockedMessageResponse(_loc2_);
|
||||
break;
|
||||
case "CLW":
|
||||
sendClearAllMessagesResponse(_loc2_);
|
||||
break;
|
||||
case "RMP":
|
||||
sendRemoveMasterpieceResponse(_loc2_);
|
||||
break;
|
||||
case "ACK":
|
||||
sendAcknowledgeNotificationResponse(_loc2_);
|
||||
}
|
||||
sendWaitingRequest();
|
||||
}
|
||||
|
||||
private static function httpRequestError(param1:ErrorEvent) : void
|
||||
{
|
||||
_isProcessingRequest = false;
|
||||
if(GuiManager.mainHud.playerWall)
|
||||
{
|
||||
GuiManager.mainHud.playerWall.activateLoadingState(false);
|
||||
}
|
||||
BuddyManager.setPlayerWallLoading(false);
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
sendWaitingRequest();
|
||||
}
|
||||
|
||||
private static function orderTimestamp(param1:PostMessage, param2:PostMessage) : int
|
||||
{
|
||||
if(param1.postTime < param2.postTime)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if(param1.postTime > param2.postTime)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -99,6 +99,8 @@ set -- \
|
||||
game.MinigameManager MinigameManager.as \
|
||||
gui.FeedbackManager FeedbackManager.as \
|
||||
gameRedemption.CodeRedemptionPopup CodeRedemptionPopup.as \
|
||||
playerWall.PlayerWallXtCommManager PlayerWallXtCommManager.as \
|
||||
playerWall.PlayerWallGui PlayerWallGui.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
|
||||
|
||||
+1860
-1855
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user