mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
feat(account): web item giver with colour pickers, den variants, tints and previews
/account/items, linked from the account page and using its sign-in, gives items to the account signed in: - clothing: the item's own colours, or four colours of your own as a picker, #RRGGBB, or AJ's numbers (palette places, or the whole item's colour id signed or unsigned), converted as you type; hex colours not in the palette become an exact custom colour - den items: the variants their art has (lib/den-variants.json, made by tools/den-variants.sh) and a whole-item tint with a strength, kept in the item's version above the variant and drawn by DenItemHelper (build 83) - a preview of each: clothing icons coloured on the page as the game colours them, den items played by Ruffle in a sandboxed frame through public/item-preview.swf (tools/preview-host) a give with a custom colour id that does not exist is refused.
This commit is contained in:
1 parent
44af83f1c5
commit
7cfef493fa
18 files changed
+1958
-7
No files matched your search
@@ -172,7 +172,8 @@ module.exports = {
|
||||
// 49 and 50: its link to a colour picker.
|
||||
// 61: the Owner, Moderator, Developer and Verified name tag badges seen by everyone.
|
||||
// 62: "Custom pictures" in the settings menu, to hide players' item pictures.
|
||||
buildVersion: env.AJ_BUILD_VERSION || "82",
|
||||
// 83: den items tinted (the tint in their version, DenItemHelper.applyTint).
|
||||
buildVersion: env.AJ_BUILD_VERSION || "83",
|
||||
// what the official CDN is asked for; not ours to change.
|
||||
upstreamBuildVersion: "3",
|
||||
|
||||
|
||||
+139
-3
@@ -2,6 +2,8 @@
|
||||
|
||||
const accounts = require("./accounts.js");
|
||||
const bans = require("./bans.js");
|
||||
const cdn = require("./cdn.js");
|
||||
const colours = require("./colours.js");
|
||||
const captcha = require("./captcha.js");
|
||||
const defpacks = require("./defpacks.js");
|
||||
const devices = require("./devices.js");
|
||||
@@ -10,6 +12,7 @@ const roles = require("./roles.js");
|
||||
const dens = require("./dens.js");
|
||||
const itemControl = require("./itemcontrol.js");
|
||||
const customItems = require("./customitems.js");
|
||||
const itemArt = require("./itemart.js");
|
||||
const limits = require("./limits.js");
|
||||
const world = require("./world.js");
|
||||
const {addClothing, sendClothingAdded, isUint} = require("./player.js");
|
||||
@@ -71,6 +74,24 @@ const search = (params, favourites = null, seesLocked = false, askerId = null) =
|
||||
};
|
||||
};
|
||||
|
||||
// the variants each den item's art has (tools/den-variants.sh):
|
||||
// {versions: [...], colours?: [[hex, ...] per variant]}, or null.
|
||||
let denVariants = null;
|
||||
const variantsOf = id => {
|
||||
if (!denVariants) {
|
||||
try {
|
||||
denVariants = require("./den-variants.json");
|
||||
}
|
||||
catch (err) {
|
||||
denVariants = {};
|
||||
}
|
||||
}
|
||||
return denVariants[Number(id)] || null;
|
||||
};
|
||||
const SPECIAL_MANNEQUIN = "4";
|
||||
const MAX_TINT_SLOT = 0x7FFFFF; // what fits above a den item's variant (8 bits) in its version, kept positive
|
||||
const MAX_PRESETS = 40;
|
||||
|
||||
// one to four "#RRGGBB", spaces or commas between. the # is wanted: six
|
||||
// digits alone are a colour id
|
||||
const HEX_COLOURS = /^#[0-9a-f]{6}([\s,]+#[0-9a-f]{6}){0,3}$/i;
|
||||
@@ -89,6 +110,7 @@ const give = (body, seesLocked = false) => {
|
||||
return {status: 403, body: {error: "That item is locked out of the item finder."}};
|
||||
}
|
||||
const session = world.findOnline(account.username);
|
||||
const given = {}; // what the item was given as: its colour, or its version
|
||||
if (body.kind === "clothing") {
|
||||
const def = defpacks.itemDef(body.id);
|
||||
const colors = def ? String(def.colors).split(",") : [];
|
||||
@@ -119,6 +141,9 @@ const give = (body, seesLocked = false) => {
|
||||
if (custom && !isUint(custom)) {
|
||||
return {status: 400, body: {error: "Colour: an id, or #RRGGBB"}};
|
||||
}
|
||||
if (custom && !colours.known(Number(custom))) {
|
||||
return {status: 400, body: {error: "No such custom colour"}};
|
||||
}
|
||||
const color = custom || colors[Number(body.colorIndex) || 0];
|
||||
if (!def || !defpacks.clothingIds().includes(Number(def.id)) || color === undefined) {
|
||||
return {status: 400, body: {error: "No such clothing item or colour"}};
|
||||
@@ -127,6 +152,7 @@ const give = (body, seesLocked = false) => {
|
||||
if (!item) {
|
||||
return {status: 409, body: {error: "That inventory is full"}};
|
||||
}
|
||||
given.color = Number(color);
|
||||
accounts.save(account);
|
||||
if (session) {
|
||||
sendClothingAdded(session, item);
|
||||
@@ -136,12 +162,48 @@ const give = (body, seesLocked = false) => {
|
||||
if (!defpacks.denItemIds().includes(Number(body.id))) {
|
||||
return {status: 400, body: {error: "No such den item"}};
|
||||
}
|
||||
if (!dens.giveDenItem(account, body.id)) {
|
||||
// `version`: one of the variants its art has (above), 0 by default.
|
||||
// `tint` ("#RRGGBB") and `tintStrength` (1-100, 100 by default): the
|
||||
// whole item in shades of that colour, which the patched client draws
|
||||
// (DenItemHelper.applyTint). the tint is a custom colour entry
|
||||
// (lib/colours.js, [rgb, strength, 0, 0]), and 1 + its number goes in
|
||||
// the version above the variant's 8 bits, so it goes wherever the item
|
||||
// goes: dens, trades, gifts.
|
||||
const variants = variantsOf(body.id);
|
||||
const variant = body.version === undefined || body.version === "" ? 0 : Number(body.version);
|
||||
if (!Number.isInteger(variant) || (variant !== 0 && !(variants && variants.versions.includes(variant)))) {
|
||||
return {status: 400, body: {error: "That item has no such variant"}};
|
||||
}
|
||||
let version = variant;
|
||||
const tint = typeof body.tint === "string" ? body.tint.trim() : "";
|
||||
if (tint) {
|
||||
const strength = body.tintStrength === undefined || body.tintStrength === "" ? 100 : Number(body.tintStrength);
|
||||
if (!/^#[0-9a-f]{6}$/i.test(tint) || !Number.isInteger(strength) || strength < 1 || strength > 100) {
|
||||
return {status: 400, body: {error: "Tint: #RRGGBB, strength 1 to 100"}};
|
||||
}
|
||||
if ((defpacks.denItemDef(body.id) || {}).specialType === SPECIAL_MANNEQUIN) {
|
||||
return {status: 400, body: {error: "Mannequins cannot be tinted"}};
|
||||
}
|
||||
const entry = world.makeColour(account, [parseInt(tint.slice(1), 16), strength, 0, 0], session);
|
||||
if (!entry) {
|
||||
return {status: 400, body: {error: "Bad colour"}};
|
||||
}
|
||||
if (entry.full) {
|
||||
return {status: 429, body: {error: "No more new colours today. Colours made before can still be used."}};
|
||||
}
|
||||
const slot = entry.id - colours.CUSTOM_BASE + 1;
|
||||
if (slot > MAX_TINT_SLOT) {
|
||||
return {status: 503, body: {error: "No more tints can be made"}};
|
||||
}
|
||||
version |= slot << 8;
|
||||
}
|
||||
if (!dens.giveDenItem(account, body.id, version)) {
|
||||
return {status: 409, body: {error: "That inventory is full"}};
|
||||
}
|
||||
if (session) {
|
||||
dens.sendDenItems(session);
|
||||
}
|
||||
given.version = version;
|
||||
}
|
||||
else {
|
||||
return {status: 400, body: {error: "Unknown item kind"}};
|
||||
@@ -152,7 +214,81 @@ const give = (body, seesLocked = false) => {
|
||||
const kept = Object.entries(account.finderGiven).sort((one, other) => other[1].at - one[1].at).slice(0, MAX_FAVOURITES);
|
||||
account.finderGiven = Object.fromEntries(kept);
|
||||
accounts.save(account);
|
||||
return {status: 200, body: {ok: true, online: Boolean(session)}};
|
||||
return {status: 200, body: {ok: true, online: Boolean(session), ...given}};
|
||||
};
|
||||
|
||||
// the game's 256 colours (the CDN's paletteData; PaletteHelper.setGamePalette),
|
||||
// as "rrggbb", once read. null while the file cannot be had.
|
||||
let palette = null;
|
||||
const loadPalette = async () => {
|
||||
if (!palette) {
|
||||
const file = await cdn.get(cdn.hashedPath("paletteData"));
|
||||
if (file && file.length >= 4 && file.readInt32BE(0) === 1024) {
|
||||
palette = Array.from({length: 256}, (unused, index) => (file.readUInt32BE(4 + index * 4) & 0xFFFFFF).toString(16).padStart(6, "0"));
|
||||
}
|
||||
}
|
||||
return palette;
|
||||
};
|
||||
// a packed colour's four, as "rrggbb" (a custom colour's own, or the
|
||||
// palette's at each of its four bytes, colour 1 the top one).
|
||||
const coloursOf = id => {
|
||||
const custom = colours.rgbsOf(id);
|
||||
if (custom) {
|
||||
return custom.map(rgb => rgb.toString(16).padStart(6, "0"));
|
||||
}
|
||||
return palette ? [24, 16, 8, 0].map(shift => palette[(id >>> shift) & 0xFF]) : null;
|
||||
};
|
||||
|
||||
// the web item giver (/account/items, lib/manage.js): a search as the
|
||||
// in-game one, with what each item may be given as: a clothing item's own
|
||||
// colours, a den item's variants and whether it takes a tint.
|
||||
const searchFor = async (account, params) => {
|
||||
await loadPalette();
|
||||
const found = search(params, account.finderGiven, roles.can(account, "items.create"), account.id);
|
||||
return {...found, results: found.results.map(result => {
|
||||
// a custom item's own picture, which the game shows in place of its art
|
||||
const custom = customItems.get(result.kind, result.id);
|
||||
const entry = {...result, art: custom ? itemArt.urlOf(custom, "/account/api/itemart") : null};
|
||||
if (entry.kind === "clothing") {
|
||||
const def = defpacks.itemDef(entry.id);
|
||||
const ids = def ? String(def.colors).split(",").map(Number).filter(Number.isInteger).slice(0, MAX_PRESETS) : [];
|
||||
return {...entry, presets: ids.map(id => ({id: id >>> 0, colours: coloursOf(id >>> 0)}))};
|
||||
}
|
||||
const variants = variantsOf(entry.id);
|
||||
return {...entry, variants: variants ? variants.versions : [], variantColours: variants && variants.colours ? variants.colours : null,
|
||||
tintable: (defpacks.denItemDef(entry.id) || {}).specialType !== SPECIAL_MANNEQUIN};
|
||||
})};
|
||||
};
|
||||
|
||||
// ... and its colour boxes, which turn colours to the game's numbers and
|
||||
// back as they are typed: with `id`, a custom colour's four ("rrggbb"); with
|
||||
// `rgbs` (four "rrggbb", commas between), the custom colour already made of
|
||||
// those four, or null (Give would make it); with neither, the game's 256.
|
||||
const colourLookup = async params => {
|
||||
if (params.has("id")) {
|
||||
const text = params.get("id");
|
||||
const id = /^-?\d{1,10}$/.test(text) && Number(text) >= -0x80000000 && Number(text) <= 0xFFFFFFFF ? Number(text) >>> 0 : null;
|
||||
const rgbs = id === null ? null : colours.rgbsOf(id);
|
||||
return rgbs ? {status: 200, body: {id, colours: rgbs.map(rgb => rgb.toString(16).padStart(6, "0"))}}
|
||||
: {status: 404, body: {error: "No such custom colour"}};
|
||||
}
|
||||
if (params.has("rgbs")) {
|
||||
const rgbs = params.get("rgbs").split(",").map(hex => (/^[0-9a-f]{6}$/i.test(hex) ? parseInt(hex, 16) : NaN));
|
||||
const entry = colours.allocate(rgbs, false);
|
||||
if (!entry) {
|
||||
return {status: 400, body: {error: "Four colours: rrggbb,rrggbb,rrggbb,rrggbb"}};
|
||||
}
|
||||
return {status: 200, body: {id: entry.full ? null : entry.id}};
|
||||
}
|
||||
return {status: 200, body: {palette: await loadPalette()}};
|
||||
};
|
||||
|
||||
// ... and its Give, for the account signed in on that page.
|
||||
const giveAs = (account, body) => {
|
||||
if (!givesPerMinute.allow(account.id)) {
|
||||
return {status: 429, body: {error: "Too many at once. Try again in a minute."}};
|
||||
}
|
||||
return give({...body, username: account.username}, roles.can(account, "items.create"));
|
||||
};
|
||||
|
||||
const FORBIDDEN = {status: 403, body: {error: "forbidden"}};
|
||||
@@ -296,4 +432,4 @@ const handle = async (route, params, body, from) => {
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {handle, search};
|
||||
module.exports = {handle, search, searchFor, colourLookup, giveAs};
|
||||
+4
-1
@@ -71,4 +71,7 @@ const chunks = (size = 200) => {
|
||||
// the custom range), or an entry of the table?
|
||||
const known = id => id < CUSTOM_BASE || id > MAX_ID || entries.has(id);
|
||||
|
||||
module.exports = {load, allocate, chunks, known, count: () => entries.size};
|
||||
// the four RGB values of an entry, or null.
|
||||
const rgbsOf = id => entries.get(id) || null;
|
||||
|
||||
module.exports = {CUSTOM_BASE, load, allocate, chunks, known, rgbsOf, count: () => entries.size};
|
||||
@@ -0,0 +1 @@
|
||||
{"1":{"versions":[0,1,2,3,4,5,6,7],"colours":[["56c3d8","1078ff","4acaff","4876ba"],["8f48ff","3d00a7","5e1dff","5d0089"],["ff99f0","e150ff","ff6bf7","ff3dba"],["ac0912","ea004f","c40000","a10000"],["ff732b","dd3c4d","ff742d","e84138"],["f3ff86","d0ee19","e6ff3b","dfff05"],["63ff66","007917","23b700","035000"],["63565d","201219","551f4c","2f151f"]]},"9":{"versions":[0,1]},"13":{"versions":[0,1,2,3]},"19":{"versions":[0,1,2,3,4,5,6,7,8,9],"colours":[["7cbbff","2388ff","b9fffc","6bc1ff"],["be5bff","9348ff","42195b","ac43ff"],["e689c2","e45dad","fbfbfb","ea65c4"],["c8a0cd","cc434c","887e8e","ff4b4b"],["efcd34","e57712","ffffff","7bfff2"],["fff81a","fff81a","835c40","ff6bb3"],["4cbf00","43910b","ade53b","57de00"],["9e9e9e","5c5c7f","727c72","ffbf15"],["9e1616","3a3a3a","0f0f0f","ff1d1d"],["644b18","503000","e0b61f","7b4100"]]},"21":{"versions":[0,1,2]},"27":{"versions":[0,1,2,3]},"36":{"versions":[0,1,2,3,4,5,6,7,8,9],"colours":[["2b5eff","ffd646","56b8ff","b7ecff"],["ee58ff","5e0096","ffcf84","e3bcff"],["ff50d8","fbfbfb","ffbc1d","ffffef"],["ff3418","050505","ff9e53","ffffff"],["ff7323","ffa640","ffe42d","c7fcff"],["f8ff12","150f00","f3ff1a","050500"],["4caf00","adff3b","fff87e","c4ffe2"],["969696","ffdb5b","e0e5ff","809ca2"],["3d3d3d","830004","fafafa","0d0d0d"],["644b18","2b0c00","b9ab00","314800"]]},"37":{"versions":[0,1,3,4,5,6,7],"colours":[["a1daff","7bbfe8","b7eaff","4893ff"],["ceafff","a550ff","5d00b7","9c50ff"],["ff9999","990000","e95353","e11515"],["ffca94","f4a500","d07200","e37d48"],["dbe700","ecd743","ffff02","fff20a"],["afffa4","0a9100","75ff5e","30ff0d"],["727272","909090","f6f6f6","dedede"]]},"45":{"versions":[0,1,2,3,4,5,6,7]},"48":{"versions":[0,1,2,3,4,5,6,7]},"49":{"versions":[0,1,2,3,4,5,6,7]},"53":{"versions":[0,1,2,3,4,5,6,7]},"54":{"versions":[0,1,2,3,4,5,6,7]},"56":{"versions":[0,1,2,3,4,5,6,7,8,9],"colours":[["3e89d0","0d3673","b17400"],["9361ff","42195b","ff8ce4"],["f771a8","ff33a9","ffffff"],["d24743","ae3d59","434343"],["cf6227","e78100","ffe63d"],["ffea30","ff6d1a","bc7900"],["bde745","ff9400","dfaa00"],["969696","525252","ffffff"],["303030","f1f1f1","7d7d7d"],["91602d","ffe463","acb43e"]]},"83":{"versions":[0,1,2,3,4,5,6,7,8,9],"colours":[["c7f3ff","408aff","6bdaff"],["c976ff","5e0096","dcd4ff"],["ff89f3","ff4cac","f5d7ff"],["e43437","ffffff","ffffff"],["fd7500","ffcd63","fffbea"],["ffff3d","150f00","e2fff4"],["4caf00","adff3b","ffffff"],["969696","6b7c6b","dedede"],["212121","6b4496","030303"],["713700","ffffff","fffff2"]]},"91":{"versions":[0,1,2,3,4,5,6,7,8,9],"colours":[["3d5977","c47821","bc8000","ab6412"],["906fa5","705091","af8957","56486c"],["e5768c","f1f1da","e9b3c7","e2c1ce"],["bd483e","373736","7f5437","30312e"],["c37138","3a3539","c75524","474446"],["b46d00","ffe042","787878","525252"],["6b7e48","433422","a16951","58462c"],["8ca0a6","7b8f90","cc9d5d","dcdaa6"],["434342","4b4641","2b3331","212121"],["8a6341","78502a","dbab64","c3b39a"]]},"131":{"versions":[0,1,2,3,4,5]},"147":{"versions":[0,1,2,3,4,5,6,7],"colours":[["7bb8f7","fffedc","dcfcff","ffffff"],["9b4eff","ffeff5","eacaff","aa69ff"],["ff9efa","f33de9","ffd2fb","ca00c4"],["d20000","636363","e62525","616161"],["ef8454","e0ffdf","efe4ce","ffffff"],["fff802","af6f2b","faff58","1ecf00"],["3dc43d","7b7800","35ee45","31cc00"],["505050","ffffff","686868","494949"]]},"152":{"versions":[0,1,2,3,4,5,6,7],"colours":[["7bb8f7","ade0e6","e0db00"],["af37d7","3b0038","f0e579"],["e825e1","ff99f7","cfcfcf"],["d20000","ffacac","eddc6b"],["ff732b","ffda76","cecece"],["ede80a","a2a700","d1d1d1"],["3dc43d","afffa4","ffd938"],["484848","757575","fffaa4"]]},"226":{"versions":[0,1,2,3,4,5,6,7],"colours":[["060043","c4dbff","0015b4","3548ff"],["f5f5f5","42195b","8d00f2","ae74eb"],["ff71e3","ffeaf1","d400c9","ff3dba"],["ac0912","fffee7","fbffa7","ea0000"],["ede3a0","d8822e","fbdf9e","be4e33"],["fff812","639ac6","949400","dfd300"],["fffbca","008903","faffbc","008e3e"],["ffffff","505050","ffffff","343434"]]},"295":{"versions":[0,1,2,3,4,5,6,7],"colours":[["3458dd","4696ff"],["9a47d8","b875ff"],["ff8193","ffc4c6"],["ff2d2d","ff9c9c"],["f57a00","ffd47b"],["e7e700","ffffbb"],["05af00","daffa3"],["7d7d7d","d5d5d5"]]},"348":{"versions":[0,1,2,3,4,5,6,7,8,9],"colours":[["4589ff","fffbac","4086ff","7bc744"],["a640ff","fff986","6300c2","cbe26a"],["ffffff","00b999","ff35e5","bc910e"],["01000a","ff3333","bf0000","ffffff"],["ff7a00","d6d6af","ffffff","3a5000"],["fff800","73e3e0","f7f000","b1ea8c"],["4caf00","adff3b","7dd700","c4ffe2"],["727272","bebebe","e0e5ff","a6a6a6"],["404040","3d3d3d","828282","5e0000"],["644b18","d6c72b","664d00","506a16"]]},"350":{"versions":[0,1,2,3,4,5,6,7,8,9],"colours":[["48c5ff","ffff18","5bff35","0dff1e"],["a846ff","ff650d","ffff33","43f1ff"],["ff73d9","ff30c2","ffffff","00f2eb"],["ff2d2d","828282","ffe925","fdea00"],["e76a00","35f700","ffed10","fff930"],["ffff00","4bfaff","23f700","13ff02"],["76ff20","21ea00","ff7210","ffff02"],["ffffff","cfecff","0affff","fff928"],["717171","3c3c3c","00fdf6","02fff2"],["92663a","ffcfLine truncated
|
||||
@@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
|
||||
// pictures of items for the web item giver (public/items.html), from the
|
||||
// game's own files on the CDN:
|
||||
//
|
||||
// - clothing: the icon the game shows in a closet (item.SimpleIcon), a
|
||||
// paletted bitmap the page colours itself as the game does
|
||||
// (LayerBitmap.paintFrame), so any four colours show without asking again.
|
||||
// - den items: their art, a SWF, which public/item-preview.html plays with
|
||||
// Ruffle through public/item-preview.swf (tools/preview-host).
|
||||
//
|
||||
// both are the same for everyone, so no sign-in is asked for them.
|
||||
|
||||
const zlib = require("zlib");
|
||||
const amf3 = require("./amf3.js");
|
||||
const cdn = require("./cdn.js");
|
||||
const customItems = require("./customitems.js");
|
||||
const defpacks = require("./defpacks.js");
|
||||
|
||||
const ICON_AVATAR = 1; // the avatar every closet icon is drawn for (Item.makeSmallIcon)
|
||||
const ICON_LARGE = 25; // SimpleIcon.AN_ICON_L
|
||||
const ICON_SMALL = 26; // SimpleIcon.AN_ICON_S
|
||||
const IMAGE_VERSION = 0x7080900; // what ImageServerURL accepts
|
||||
|
||||
// DenItem.getIconId: which of an item's pictures the den shows, by its sort category.
|
||||
const iconId = sortCat => ([0, 99, 6, 5].includes(sortCat) ? 1 : sortCat === 1 ? 2 : [2, 3, 4].includes(sortCat) ? 3 : sortCat + 1);
|
||||
|
||||
// a custom item is drawn as the game's item it was made from.
|
||||
const baseIdOf = (kind, id) => {
|
||||
const entry = customItems.get(kind, id);
|
||||
return entry ? entry.base : Number(id);
|
||||
};
|
||||
|
||||
// a clothing item's closet icon, large if there is one: {w, h, b} with b the
|
||||
// first frame's run-length bytes, base64 (LayerBitmap.paintFrame reads them).
|
||||
// null when it has none.
|
||||
const clothingIcon = async id => {
|
||||
const def = defpacks.itemDef(id);
|
||||
if (!def || !Number.isInteger(Number(def.layerDefId))) {
|
||||
return null;
|
||||
}
|
||||
for (const size of [ICON_LARGE, ICON_SMALL]) {
|
||||
const file = await cdn.get(cdn.hashedPath(`imageArrays/${((ICON_AVATAR << 24) | (size << 16) | Number(def.layerDefId)) >>> 0}`));
|
||||
try {
|
||||
const image = file && amf3.decode(zlib.inflateSync(file));
|
||||
const frame = image && image.v === IMAGE_VERSION && Array.isArray(image.f) && image.f[0];
|
||||
if (frame && Buffer.isBuffer(frame.b) && frame.w > 0 && frame.h > 0) {
|
||||
return {w: frame.w, h: frame.h, b: frame.b.toString("base64")};
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// not an icon this can read: the next size, or none.
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
// a den item's art as the SWF it holds, or null.
|
||||
const denArt = async id => {
|
||||
const def = defpacks.denItemDef(id);
|
||||
const baseId = baseIdOf("den", id);
|
||||
const baseDef = defpacks.denItemDef(baseId);
|
||||
if (!def || !baseDef) {
|
||||
return null;
|
||||
}
|
||||
const file = await cdn.get(cdn.hashedPath(`items/${((baseId << 16) | iconId(Number(baseDef.sortCat))) >>> 0}`));
|
||||
try {
|
||||
const wrapped = file && amf3.decode(file);
|
||||
return wrapped && wrapped.ba ? Buffer.from(wrapped.ba) : null;
|
||||
}
|
||||
catch (err) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {clothingIcon, denArt};
|
||||
@@ -26,6 +26,8 @@ const recoveryMail = require("./recoverymail.js");
|
||||
const world = require("./world.js");
|
||||
const chatStyles = require("./chatstyles.js");
|
||||
const roles = require("./roles.js");
|
||||
const admin = require("./admin.js");
|
||||
const itemPreview = require("./itempreview.js");
|
||||
|
||||
// the account page at /account: what a player can do about their own
|
||||
// account from a browser. they sign in with the game's username and
|
||||
@@ -566,6 +568,16 @@ const PAGE_HEADERS = {
|
||||
+ "form-action 'none'; frame-ancestors 'none'; base-uri 'none'"),
|
||||
};
|
||||
|
||||
// the web item giver shows den items in frames of public/item-preview.html,
|
||||
// which plays them with Ruffle (a Flash player, from jsDelivr).
|
||||
const ITEMS_PAGE_POLICY = "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; font-src 'self'; "
|
||||
+ "frame-src 'self'; form-action 'none'; frame-ancestors 'none'; base-uri 'none'";
|
||||
const RUFFLE = "https://cdn.jsdelivr.net/npm/@ruffle-rs/[email protected]/";
|
||||
const PREVIEW_POLICY = `default-src 'none'; script-src 'unsafe-inline' 'wasm-unsafe-eval' ${RUFFLE}; connect-src 'self' ${RUFFLE}; `
|
||||
+ "style-src 'unsafe-inline'; img-src 'self' data: blob:; media-src 'self' data: blob:; worker-src blob:; "
|
||||
+ "form-action 'none'; frame-ancestors 'self'; base-uri 'none'; sandbox allow-scripts";
|
||||
const artFetches = limits.limiter(600, 600000); // item pictures for the web item giver, per address in ten minutes
|
||||
|
||||
// A request that changes something must come from this server's own page.
|
||||
const sameOrigin = limits.originAllowed;
|
||||
|
||||
@@ -581,6 +593,41 @@ const handle = async (req, res, url, from, web) => {
|
||||
web.send(res, 200, captcha.withScriptVersion(await fs.promises.readFile(path.join(config.publicDir, "account.html"))), "text/html; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
// the item giver on the web (public/items.html), with this page's sign-in.
|
||||
if (route === "GET /account/items") {
|
||||
res.setHeader("Content-Security-Policy", ITEMS_PAGE_POLICY);
|
||||
web.send(res, 200, await fs.promises.readFile(path.join(config.publicDir, "items.html")), "text/html; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
// its den item previews (lib/itempreview.js): a page of their own in a
|
||||
// frame, sandboxed, as they run a Flash player from elsewhere (Ruffle).
|
||||
if (route === "GET /account/item-preview") {
|
||||
res.setHeader("Content-Security-Policy", PREVIEW_POLICY);
|
||||
res.setHeader("X-Frame-Options", "SAMEORIGIN");
|
||||
web.send(res, 200, await fs.promises.readFile(path.join(config.publicDir, "item-preview.html")), "text/html; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
const art = /^GET \/account\/(item-preview\.swf|art\/(clothing|den)\/(\d{1,9}))$/.exec(route);
|
||||
if (art) {
|
||||
// fetched from the preview's sandbox, which has no origin of its own
|
||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
if (art[1] === "item-preview.swf") {
|
||||
web.send(res, 200, await fs.promises.readFile(path.join(config.publicDir, "item-preview.swf")), "application/x-shockwave-flash");
|
||||
return;
|
||||
}
|
||||
if (!artFetches.allow(from.address)) {
|
||||
reply(429, {error: "Too many at once. Try again in a minute."});
|
||||
return;
|
||||
}
|
||||
const found = art[2] === "den" ? await itemPreview.denArt(Number(art[3])) : await itemPreview.clothingIcon(Number(art[3]));
|
||||
if (!found) {
|
||||
reply(404, {error: "No picture."});
|
||||
return;
|
||||
}
|
||||
res.setHeader("Cache-Control", "public, max-age=3600");
|
||||
web.send(res, 200, found, art[2] === "den" ? "application/x-shockwave-flash" : "application/json");
|
||||
return;
|
||||
}
|
||||
if (route === "GET /account/recover") {
|
||||
web.send(res, 200, captcha.withScriptVersion(await fs.promises.readFile(path.join(config.publicDir, "recover.html"))), "text/html; charset=utf-8");
|
||||
return;
|
||||
@@ -854,6 +901,28 @@ const handle = async (req, res, url, from, web) => {
|
||||
case "GET /account/api/me":
|
||||
reply(200, profile(account, from));
|
||||
return;
|
||||
// the item giver (above, and lib/admin.js): for the account signed in
|
||||
// here only, as the in-game one is for the one playing; not while banned.
|
||||
case "GET /account/api/giver":
|
||||
case "GET /account/api/colour":
|
||||
case "POST /account/api/give": {
|
||||
if (banFor(account, from) || account.nameRejected) {
|
||||
reply(403, {error: "Not now."});
|
||||
return;
|
||||
}
|
||||
if (route === "GET /account/api/colour") {
|
||||
const result = await admin.colourLookup(url.searchParams);
|
||||
reply(result.status, result.body);
|
||||
return;
|
||||
}
|
||||
if (req.method === "GET") {
|
||||
reply(200, await admin.searchFor(account, url.searchParams));
|
||||
return;
|
||||
}
|
||||
const result = admin.giveAs(account, body);
|
||||
reply(result.status, result.body);
|
||||
return;
|
||||
}
|
||||
// for the trade offer form: what the player could give, and what
|
||||
// another player has up for trade.
|
||||
case "GET /account/api/tradable": {
|
||||
|
||||
@@ -94,6 +94,8 @@
|
||||
transition: background 0.12s, border-color 0.12s, color 0.12s;
|
||||
}
|
||||
button:hover { background: var(--raised); border-color: #555; }
|
||||
a.button { border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px 8px; white-space: nowrap; text-decoration: none; }
|
||||
a.button:hover { background: var(--raised); border-color: #555; }
|
||||
button:disabled { opacity: 0.45; cursor: default; }
|
||||
button:focus-visible, a:focus-visible, input[type="checkbox"]:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
|
||||
button.primary { font-weight: 700; color: #000; background: var(--text); border-color: var(--text); }
|
||||
@@ -225,6 +227,7 @@
|
||||
<header>
|
||||
<img class="mark" src="/logo.png" alt="">
|
||||
<h1 id="title"></h1>
|
||||
<a class="button" id="item-giver" href="/account/items">Item giver</a>
|
||||
<button id="sign-out" type="button">Sign out</button>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Item preview</title>
|
||||
<style>
|
||||
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #1a1a1a; }
|
||||
ruffle-player, ruffle-object, ruffle-embed { display: block; width: 100%; height: 100%; }
|
||||
</style>
|
||||
<script>
|
||||
// ruffle's own settings: no menus, overlays or sound.
|
||||
window.RufflePlayer = {config: {
|
||||
publicPath: "https://cdn.jsdelivr.net/npm/@ruffle-rs/[email protected]/",
|
||||
polyfills: false,
|
||||
autoplay: "on",
|
||||
unmuteOverlay: "hidden",
|
||||
splashScreen: false,
|
||||
contextMenu: "off",
|
||||
letterbox: "off",
|
||||
backgroundColor: "#1A1A1A", // the giver page's
|
||||
volume: 0,
|
||||
openUrlMode: "deny",
|
||||
allowScriptAccess: false,
|
||||
showSwfDownload: false,
|
||||
warnOnUnsupportedContent: false,
|
||||
logLevel: "error",
|
||||
}};
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@ruffle-rs/[email protected]/ruffle.js" integrity="sha256-JgNqlFZwiN+z3oinWejtEKTOoHspUArzbzRe70JCAJg=" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
// one den item for the web item giver (public/items.html), in a frame of
|
||||
// its own: #id=&v=&tint=rrggbb&s=, as Give would give it. its art plays
|
||||
// in public/item-preview.swf (tools/preview-host), which sets the
|
||||
// variant and tint as a den does. served sandboxed (lib/manage.js): this
|
||||
// page has no origin, so no sign-in, of its own.
|
||||
let player = null;
|
||||
|
||||
const show = () => {
|
||||
const wanted = new URLSearchParams(location.hash.slice(1));
|
||||
const id = /^\d{1,9}$/.test(wanted.get("id") || "") ? wanted.get("id") : null;
|
||||
if (player) {
|
||||
player.remove();
|
||||
player = null;
|
||||
}
|
||||
if (!id || !window.RufflePlayer || !window.RufflePlayer.newest) {
|
||||
return;
|
||||
}
|
||||
player = window.RufflePlayer.newest().createPlayer();
|
||||
document.body.append(player);
|
||||
const parameters = {art: new URL(`/account/art/den/${id}`, location.href).href, version: String(Number(wanted.get("v")) || 0)};
|
||||
if (/^[0-9a-f]{6}$/i.test(wanted.get("tint") || "")) {
|
||||
parameters.tint = wanted.get("tint");
|
||||
parameters.strength = String(Number(wanted.get("s")) || 100);
|
||||
}
|
||||
const movie = {url: new URL("/account/item-preview.swf", location.href).href, parameters};
|
||||
(player.ruffle ? player.ruffle().load(movie) : player.load(movie)).catch(() => {});
|
||||
};
|
||||
|
||||
window.addEventListener("hashchange", show);
|
||||
show();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
@@ -0,0 +1,786 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Item giver</title>
|
||||
<link rel="icon" type="image/png" href="/logo-square.png">
|
||||
<style>
|
||||
/* the account page's look (public/account.html): black and white, in
|
||||
the game's own text font. the only colours are the items' own. */
|
||||
@font-face { font-family: "DigitalDelivery"; font-weight: 400; src: url("/fonts/CCDigitalDelivery-Regular.otf") format("opentype"); }
|
||||
@font-face { font-family: "DigitalDelivery"; font-weight: 700; src: url("/fonts/CCDigitalDelivery-Bold.otf") format("opentype"); }
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
--bg: #000;
|
||||
--panel: #0d0d0d;
|
||||
--raised: #1a1a1a;
|
||||
--line: #2e2e2e;
|
||||
--text: #fff;
|
||||
--muted: #8c8c8c;
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
[hidden] { display: none !important; }
|
||||
::selection { background: #fff; color: #000; }
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 32px 16px 48px;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font: 15px/1.4 "DigitalDelivery", system-ui, "Segoe UI", sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
a { color: inherit; text-underline-offset: 3px; }
|
||||
h1 { margin: 0; font-size: 26px; font-weight: 700; flex: 1; }
|
||||
h2 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
|
||||
h3 { margin: 16px 0 8px; font-size: 14px; font-weight: 700; }
|
||||
p { margin: 0 0 12px; color: var(--muted); }
|
||||
.wrap { max-width: 760px; margin: 0 auto; }
|
||||
header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
|
||||
header img { width: 40px; height: 40px; }
|
||||
section {
|
||||
padding: 20px;
|
||||
margin-bottom: 16px;
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 18px;
|
||||
}
|
||||
input, select {
|
||||
font: inherit;
|
||||
color: var(--text);
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 14px;
|
||||
padding: 9px 14px 10px;
|
||||
}
|
||||
input:hover, select:hover { border-color: #555; }
|
||||
input:focus, select:focus { outline: none; border-color: var(--text); }
|
||||
input:disabled { opacity: 0.4; }
|
||||
button, a.button {
|
||||
font: inherit;
|
||||
color: var(--text);
|
||||
background: none;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 999px;
|
||||
padding: 7px 16px 8px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
text-decoration: none;
|
||||
}
|
||||
button:hover, a.button:hover { background: var(--raised); border-color: #555; }
|
||||
button:disabled { opacity: 0.45; cursor: default; }
|
||||
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
|
||||
button.primary { font-weight: 700; color: #000; background: var(--text); border-color: var(--text); }
|
||||
button.primary:hover { background: #d9d9d9; border-color: #d9d9d9; }
|
||||
button[aria-pressed="true"] { border-color: var(--text); background: var(--raised); }
|
||||
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
|
||||
#search-row input { flex: 1; min-width: 180px; }
|
||||
.status { min-height: 20px; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
|
||||
.status.bad { color: var(--text); }
|
||||
.status.bad::before { content: "! "; font-weight: 700; }
|
||||
#results { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
|
||||
#results button {
|
||||
display: flex; width: 100%; gap: 10px; align-items: baseline;
|
||||
border-radius: 14px; padding: 9px 14px 10px; text-align: left; white-space: normal;
|
||||
}
|
||||
#results .name { flex: 1; overflow-wrap: anywhere; }
|
||||
.meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
|
||||
.swatches { display: inline-flex; gap: 3px; vertical-align: middle; }
|
||||
.swatch { width: 16px; height: 16px; border-radius: 5px; border: 1px solid rgba(255, 255, 255, 0.25); }
|
||||
#presets, #variants { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
#presets button, #variants button { padding: 6px 10px 7px; border-radius: 12px; }
|
||||
.slot { display: grid; grid-template-columns: 74px 44px 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
|
||||
.slot span { color: var(--muted); font-size: 13px; }
|
||||
.colour-slot { grid-template-columns: 74px 44px minmax(0, 160px) 96px; }
|
||||
input.aj { width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
|
||||
#whole-row { margin-top: 4px; }
|
||||
#whole-row > span:first-child { width: 74px; color: var(--muted); font-size: 13px; }
|
||||
#whole { width: 190px; }
|
||||
#whole-note { white-space: normal; }
|
||||
input[type="color"] { width: 44px; height: 38px; padding: 3px; border-radius: 10px; cursor: pointer; }
|
||||
input.hex { width: 100%; max-width: 160px; font-variant-numeric: tabular-nums; text-transform: lowercase; }
|
||||
input[type="range"] { flex: 1; padding: 0; border: none; accent-color: #fff; }
|
||||
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
|
||||
#give-row { margin-top: 16px; }
|
||||
#item-head { display: flex; gap: 16px; align-items: center; }
|
||||
#item-head > div:first-child { flex: 1; min-width: 0; }
|
||||
#preview {
|
||||
position: relative; flex: none; width: 160px; height: 160px;
|
||||
display: grid; place-items: center;
|
||||
background: var(--raised); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
|
||||
}
|
||||
#preview canvas, #preview img { max-width: 144px; max-height: 144px; }
|
||||
#preview iframe { width: 100%; height: 100%; border: 0; }
|
||||
#preview-note { position: absolute; inset: auto 8px 6px; font-size: 11px; text-align: center; color: var(--muted); }
|
||||
@media (max-width: 480px) {
|
||||
.slot { grid-template-columns: 64px 44px 1fr; }
|
||||
.colour-slot { grid-template-columns: 64px 44px minmax(0, 1fr) 56px; }
|
||||
.colour-slot span { white-space: nowrap; }
|
||||
#whole-row > span:first-child { width: auto; }
|
||||
#whole { width: 100%; }
|
||||
#item-head { flex-direction: column-reverse; align-items: flex-start; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
<header>
|
||||
<img src="/logo.png" alt="">
|
||||
<h1>Item giver</h1>
|
||||
<a class="button" href="/account">Your account</a>
|
||||
</header>
|
||||
|
||||
<section id="gate" hidden>
|
||||
<h2 id="gate-title">Sign in first</h2>
|
||||
<p id="gate-text">The item giver uses your account page's sign-in.</p>
|
||||
<a class="button" href="/account">Go to your account page</a>
|
||||
</section>
|
||||
|
||||
<section id="finder" hidden>
|
||||
<p id="who"></p>
|
||||
<div class="row" id="search-row">
|
||||
<input id="query" type="search" placeholder="Name or id" maxlength="60" autocomplete="off" spellcheck="false" aria-label="Search items">
|
||||
<select id="kind" aria-label="Kind of item">
|
||||
<option value="all">Everything</option>
|
||||
<option value="clothing">Clothing</option>
|
||||
<option value="den">Den items</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="status" id="search-status" role="status"></p>
|
||||
<ul id="results"></ul>
|
||||
</section>
|
||||
|
||||
<section id="detail" hidden>
|
||||
<div id="item-head">
|
||||
<div>
|
||||
<h2 id="item-name"></h2>
|
||||
<p class="meta" id="item-meta"></p>
|
||||
</div>
|
||||
<div id="preview" aria-label="How it looks">
|
||||
<canvas id="preview-icon" hidden></canvas>
|
||||
<img id="preview-art" alt="" hidden>
|
||||
<iframe id="preview-den" title="How it looks" sandbox="allow-scripts" hidden></iframe>
|
||||
<span id="preview-note"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="clothing-part">
|
||||
<h3>The item's own colours</h3>
|
||||
<div id="presets"></div>
|
||||
<h3>Your own colours</h3>
|
||||
<div id="slots"></div>
|
||||
<div class="row" id="whole-row">
|
||||
<span>Whole item</span>
|
||||
<input class="aj" id="whole" inputmode="numeric" maxlength="11" spellcheck="false" autocomplete="off" placeholder="AJ colour" aria-label="The whole item's colour as the game writes it">
|
||||
<span class="meta" id="whole-note"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="den-part">
|
||||
<h3>Variant</h3>
|
||||
<div id="variants"></div>
|
||||
<p id="no-variants" hidden>This item has no other variants.</p>
|
||||
<h3>Tint</h3>
|
||||
<p id="tint-off" hidden>Mannequins cannot be tinted.</p>
|
||||
<div id="tint-on">
|
||||
<label class="check"><input id="tint" type="checkbox"> The whole item in shades of a colour</label>
|
||||
<div class="slot" style="margin-top:10px">
|
||||
<span>Colour</span>
|
||||
<input type="color" id="tint-picker" value="#4ab3f4" aria-label="Tint colour">
|
||||
<input class="hex" id="tint-hex" value="#4ab3f4" maxlength="7" spellcheck="false" aria-label="Tint colour as #RRGGBB">
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="meta">Strength</span>
|
||||
<input type="range" id="tint-strength" min="1" max="100" value="70" aria-label="Tint strength">
|
||||
<span class="meta" id="tint-strength-text">70%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" id="give-row">
|
||||
<button class="primary" id="give" type="button">Give</button>
|
||||
<span class="meta" id="give-what"></span>
|
||||
</div>
|
||||
<p class="status" id="give-status" role="status"></p>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
// the item giver on the web (lib/admin.js searchFor and giveAs, by way
|
||||
// of lib/manage.js), signed in as on the account page: items go to that
|
||||
// account, as the in-game giver's go to the one playing.
|
||||
const $ = id => document.getElementById(id);
|
||||
const KINDS = {clothing: "Clothing", den: "Den item"};
|
||||
|
||||
let chosen = null; // the result picked
|
||||
let preset = 0; // the item's own colour picked, or null for the slots' own
|
||||
let variant = 0;
|
||||
|
||||
const setStatus = (id, text, bad = false) => {
|
||||
$(id).textContent = text;
|
||||
$(id).classList.toggle("bad", bad);
|
||||
};
|
||||
|
||||
const api = async (path, body) => {
|
||||
try {
|
||||
const response = await fetch(`/account/api/${path}`, body === undefined ? {} : {
|
||||
method: "POST",
|
||||
headers: {"Content-Type": "application/json"},
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
return {ok: response.ok, status: response.status, data: await response.json().catch(() => ({}))};
|
||||
}
|
||||
catch (err) {
|
||||
return {ok: false, status: 0, data: {error: "The server did not answer."}};
|
||||
}
|
||||
};
|
||||
|
||||
// "#abc", "abc", "#aabbcc" or "aabbcc" as "#aabbcc"; null for anything else.
|
||||
const readHex = text => {
|
||||
const match = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(String(text).trim());
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
const digits = match[1].length === 3 ? match[1].replace(/./g, digit => digit + digit) : match[1];
|
||||
return `#${digits.toLowerCase()}`;
|
||||
};
|
||||
|
||||
const swatches = colours => {
|
||||
const box = document.createElement("span");
|
||||
box.className = "swatches";
|
||||
for (const colour of colours) {
|
||||
const swatch = document.createElement("span");
|
||||
swatch.className = "swatch";
|
||||
swatch.style.background = `#${colour}`;
|
||||
box.append(swatch);
|
||||
}
|
||||
return box;
|
||||
};
|
||||
|
||||
// a colour picker and a #RRGGBB box that follow each other; `onChange`
|
||||
// is told of each colour taken.
|
||||
const pairUp = (picker, box, onChange) => {
|
||||
picker.addEventListener("input", () => {
|
||||
box.value = picker.value;
|
||||
onChange();
|
||||
});
|
||||
box.addEventListener("input", () => {
|
||||
const hex = readHex(box.value);
|
||||
box.setCustomValidity(hex ? "" : "#RRGGBB");
|
||||
if (hex) {
|
||||
picker.value = hex;
|
||||
onChange();
|
||||
}
|
||||
});
|
||||
box.addEventListener("change", () => {
|
||||
const hex = readHex(box.value);
|
||||
box.value = hex || picker.value;
|
||||
box.setCustomValidity("");
|
||||
});
|
||||
};
|
||||
|
||||
// the game's way of writing colours: one number for the whole item, its
|
||||
// four colours' places in the game's palette of 256, colour 1 the top
|
||||
// byte; written unsigned, or signed as lists of the game's colours often
|
||||
// have them. top byte 0xFD: a custom colour, four RGB values of the
|
||||
// server's own (lib/colours.js), not palette places.
|
||||
let palette = null; // the game's 256 colours, "#rrggbb", once the server says
|
||||
let customId = null; // the custom colour the four make, when one is known
|
||||
const CUSTOM_TOP = 0xFD;
|
||||
const isCustom = value => value >>> 24 === CUSTOM_TOP;
|
||||
const readWhole = text => {
|
||||
const value = /^-?\d{1,10}$/.test(String(text).trim()) ? Number(String(text).trim()) : NaN;
|
||||
return value >= -0x80000000 && value <= 0xFFFFFFFF ? value >>> 0 : null;
|
||||
};
|
||||
// one colour's place, 0 to 255; -128 to -1 are 128 to 255 written signed
|
||||
const readIndex = text => {
|
||||
const value = /^-?\d{1,3}$/.test(String(text).trim()) ? Number(String(text).trim()) : NaN;
|
||||
return value >= -128 && value <= 255 ? (value + 256) % 256 : null;
|
||||
};
|
||||
const pack = indexes => indexes.reduce((value, index) => value * 256 + index, 0);
|
||||
|
||||
// a slot set: its colour, and its place in the palette or null. `from`
|
||||
// is the box typed in, left as typed.
|
||||
const setSlot = (slot, hex, index, from = null) => {
|
||||
slot.index = index;
|
||||
if (from !== "hex") {
|
||||
slot.picker.value = hex;
|
||||
slot.box.value = hex;
|
||||
}
|
||||
if (from !== "aj") {
|
||||
slot.aj.value = index === null ? "" : String(index);
|
||||
slot.aj.setCustomValidity("");
|
||||
}
|
||||
slot.aj.placeholder = index === null && palette ? "custom" : "AJ";
|
||||
};
|
||||
|
||||
// what Give gives: a colour id, or null for a custom colour still to make.
|
||||
const wholeValue = () => {
|
||||
if (preset !== null && chosen && chosen.presets[preset]) {
|
||||
return chosen.presets[preset].id;
|
||||
}
|
||||
if (customId !== null) {
|
||||
return customId;
|
||||
}
|
||||
return slots.every(slot => slot.index !== null) ? pack(slots.map(slot => slot.index)) : null;
|
||||
};
|
||||
|
||||
let lookupTimer = null;
|
||||
const showWhole = () => {
|
||||
const value = wholeValue();
|
||||
if (document.activeElement !== $("whole")) {
|
||||
$("whole").value = value === null ? "" : String(value);
|
||||
$("whole").setCustomValidity("");
|
||||
}
|
||||
$("whole-note").textContent = value === null ? "A new custom colour, made when you give it."
|
||||
: `${value} unsigned · ${value | 0} signed${isCustom(value) ? " · a custom colour" : ""}`;
|
||||
// four colours not all the palette's: a custom colour they make already?
|
||||
clearTimeout(lookupTimer);
|
||||
if (value === null) {
|
||||
const asked = slots.map(slot => slot.picker.value.slice(1)).join(",");
|
||||
lookupTimer = setTimeout(async () => {
|
||||
const result = await api(`colour?rgbs=${asked}`);
|
||||
if (result.ok && result.data.id !== null && preset === null && customId === null
|
||||
&& slots.map(slot => slot.picker.value.slice(1)).join(",") === asked) {
|
||||
customId = result.data.id;
|
||||
showWhole();
|
||||
showChoice();
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
};
|
||||
|
||||
// a whole item's colour taken: from the whole box (`from`) or one of the item's own.
|
||||
const applyWhole = async (value, from = null, own = null) => {
|
||||
if (isCustom(value)) {
|
||||
const colours = own || await api(`colour?id=${value}`).then(result => (result.ok ? result.data.colours : null));
|
||||
if (!colours) {
|
||||
$("whole-note").textContent = "No such custom colour.";
|
||||
return;
|
||||
}
|
||||
if (from === "whole" && readWhole($("whole").value) !== value) {
|
||||
return; // typed on since
|
||||
}
|
||||
colours.forEach((colour, index) => setSlot(slots[index], `#${colour}`, null));
|
||||
customId = value;
|
||||
}
|
||||
else {
|
||||
[24, 16, 8, 0].forEach((shift, index) => {
|
||||
const place = value >>> shift & 255;
|
||||
setSlot(slots[index], palette ? palette[place] : own ? `#${own[index]}` : slots[index].picker.value, place);
|
||||
});
|
||||
customId = null;
|
||||
}
|
||||
showChoice();
|
||||
};
|
||||
|
||||
const slots = [];
|
||||
for (let slot = 0; slot < 4; slot++) {
|
||||
const row = document.createElement("div");
|
||||
row.className = "slot colour-slot";
|
||||
const name = document.createElement("span");
|
||||
name.textContent = `Colour ${slot + 1}`;
|
||||
const picker = document.createElement("input");
|
||||
picker.type = "color";
|
||||
picker.value = "#ffffff";
|
||||
picker.setAttribute("aria-label", `Colour ${slot + 1}`);
|
||||
const box = document.createElement("input");
|
||||
box.className = "hex";
|
||||
box.maxLength = 7;
|
||||
box.spellcheck = false;
|
||||
box.value = "#ffffff";
|
||||
box.setAttribute("aria-label", `Colour ${slot + 1} as #RRGGBB`);
|
||||
const aj = document.createElement("input");
|
||||
aj.className = "aj";
|
||||
aj.inputMode = "numeric";
|
||||
aj.maxLength = 4;
|
||||
aj.spellcheck = false;
|
||||
aj.autocomplete = "off";
|
||||
aj.placeholder = "AJ";
|
||||
aj.title = "Its place in the game's palette: 0 to 255 (-128 to -1 written signed)";
|
||||
aj.setAttribute("aria-label", `Colour ${slot + 1} as the game writes it, 0 to 255`);
|
||||
const own = {picker, box, aj, index: null};
|
||||
pairUp(picker, box, () => {
|
||||
const place = palette ? palette.indexOf(picker.value) : -1;
|
||||
setSlot(own, picker.value, place < 0 ? null : place, "hex");
|
||||
preset = null;
|
||||
customId = null;
|
||||
showChoice();
|
||||
});
|
||||
aj.addEventListener("input", () => {
|
||||
const place = readIndex(aj.value);
|
||||
aj.setCustomValidity(place === null || !palette ? "0 to 255" : "");
|
||||
if (place !== null && palette) {
|
||||
setSlot(own, palette[place], place, "aj");
|
||||
preset = null;
|
||||
customId = null;
|
||||
showChoice();
|
||||
}
|
||||
});
|
||||
aj.addEventListener("change", () => setSlot(own, own.picker.value, own.index));
|
||||
row.append(name, picker, box, aj);
|
||||
$("slots").append(row);
|
||||
slots.push(own);
|
||||
}
|
||||
$("whole").addEventListener("input", () => {
|
||||
const value = readWhole($("whole").value);
|
||||
$("whole").setCustomValidity(value === null ? "A colour id, signed or not" : "");
|
||||
if (value !== null) {
|
||||
preset = null;
|
||||
applyWhole(value, "whole");
|
||||
}
|
||||
else if ($("whole").value.trim()) {
|
||||
$("whole-note").textContent = "A whole number: -2147483648 to 4294967295.";
|
||||
}
|
||||
});
|
||||
$("whole").addEventListener("change", showChoice);
|
||||
pairUp($("tint-picker"), $("tint-hex"), () => {
|
||||
$("tint").checked = true;
|
||||
showChoice();
|
||||
});
|
||||
$("tint").addEventListener("change", showChoice);
|
||||
$("tint-strength").addEventListener("input", () => {
|
||||
$("tint-strength-text").textContent = `${$("tint-strength").value}%`;
|
||||
$("tint").checked = true;
|
||||
showChoice();
|
||||
});
|
||||
|
||||
// the item as it would be given (lib/itempreview.js). clothing: its
|
||||
// closet icon, coloured here as the game colours it
|
||||
// (PaletteHelper.BuildAnimalPalette, LayerBitmap.paintFrame). den items:
|
||||
// their art played in a frame of public/item-preview.html. a custom
|
||||
// item with a picture of its own: that picture.
|
||||
const icons = new Map(); // clothing id: its icon, {w, h, bytes}, or null
|
||||
const rgbOf = hex => parseInt(hex.slice(1), 16);
|
||||
const gradient = (palette, rgb, start, count) => {
|
||||
let [red, green, blue] = [rgb >> 16 & 255, rgb >> 8 & 255, rgb & 255];
|
||||
const [stepRed, stepGreen, stepBlue] = [red, green, blue].map(value => Math.floor(value / (count + 2)));
|
||||
for (let at = start + count - 1, left = count; left > 0; left--, at--) {
|
||||
[255, 192, 128, 64].forEach((alpha, shade) => {
|
||||
palette[at + 25 * shade] = [red, green, blue, alpha];
|
||||
});
|
||||
red -= stepRed;
|
||||
green -= stepGreen;
|
||||
blue -= stepBlue;
|
||||
}
|
||||
};
|
||||
const mix = (one, other) => [16, 8, 0].reduce((sum, shift) => sum | (((one >> shift & 255) + (other >> shift & 255)) >> 1) << shift, 0);
|
||||
const paletteOf = ([one, two, three, four]) => {
|
||||
const palette = [];
|
||||
[[one, 1, 3], [two, 4, 3], [three, 7, 3], [four, 10, 3], [mix(one, two), 13, 2], [mix(two, three), 15, 2],
|
||||
[mix(one, three), 17, 2], [mix(one, four), 19, 2], [mix(two, four), 21, 2], [mix(three, four), 23, 2]]
|
||||
.forEach(([rgb, start, count]) => gradient(palette, rgb, start, count));
|
||||
return palette;
|
||||
};
|
||||
const paintIcon = (icon, colours) => {
|
||||
const canvas = $("preview-icon");
|
||||
canvas.width = icon.w;
|
||||
canvas.height = icon.h;
|
||||
const context = canvas.getContext("2d");
|
||||
const image = context.createImageData(icon.w, icon.h);
|
||||
const palette = paletteOf(colours.map(rgbOf));
|
||||
const bytes = icon.bytes;
|
||||
let [x, y, at] = [0, 0, 0];
|
||||
while (at < bytes.length) {
|
||||
let index = bytes[at++];
|
||||
let run = 1;
|
||||
if (index & 0x80) {
|
||||
index &= 0x7F;
|
||||
run = bytes[at++] + 1;
|
||||
}
|
||||
if (index === 0) {
|
||||
x += run;
|
||||
if (x >= icon.w) {
|
||||
const over = x - icon.w;
|
||||
x = over % icon.w;
|
||||
y += Math.floor(over / icon.w) + 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const colour = palette[index];
|
||||
for (; run > 0; run--) {
|
||||
if (colour && y < icon.h) {
|
||||
image.data.set(colour, (y * icon.w + x) * 4);
|
||||
}
|
||||
if (++x === icon.w) {
|
||||
x = 0;
|
||||
y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
context.putImageData(image, 0, 0);
|
||||
};
|
||||
|
||||
let previewShown = null; // what the preview shows, to change only what changed
|
||||
let denTimer = null;
|
||||
const showPreview = () => {
|
||||
const entry = chosen;
|
||||
const note = text => {
|
||||
$("preview-note").textContent = text;
|
||||
};
|
||||
const only = id => {
|
||||
for (const one of ["preview-icon", "preview-art", "preview-den"]) {
|
||||
$(one).hidden = one !== id;
|
||||
}
|
||||
};
|
||||
if (entry.art) {
|
||||
if (previewShown !== entry.art) {
|
||||
previewShown = entry.art;
|
||||
only("preview-art");
|
||||
note("");
|
||||
$("preview-art").src = entry.art;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (entry.kind === "clothing") {
|
||||
const colours = slots.map(slot => slot.picker.value);
|
||||
const icon = icons.get(entry.id);
|
||||
if (icon === undefined) {
|
||||
only(null);
|
||||
note("Loading…");
|
||||
icons.set(entry.id, false);
|
||||
fetch(`/account/art/clothing/${entry.id}`).then(response => (response.ok ? response.json() : null)).catch(() => null).then(found => {
|
||||
icons.set(entry.id, found ? {w: found.w, h: found.h, bytes: Uint8Array.from(atob(found.b), letter => letter.charCodeAt(0))} : null);
|
||||
if (chosen === entry) {
|
||||
showPreview();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (icon) {
|
||||
only("preview-icon");
|
||||
note("");
|
||||
paintIcon(icon, colours);
|
||||
}
|
||||
else if (icon === null) {
|
||||
only(null);
|
||||
note("No picture");
|
||||
}
|
||||
previewShown = null;
|
||||
return;
|
||||
}
|
||||
const wanted = new URLSearchParams({id: entry.id, v: variant});
|
||||
if (entry.tintable && $("tint").checked) {
|
||||
wanted.set("tint", $("tint-picker").value.slice(1));
|
||||
wanted.set("s", $("tint-strength").value);
|
||||
}
|
||||
const address = `/account/item-preview#${wanted}`;
|
||||
if (previewShown === address) {
|
||||
return;
|
||||
}
|
||||
previewShown = address;
|
||||
only("preview-den");
|
||||
note("");
|
||||
// a new player each time: a slider dragged waits for it to stop
|
||||
clearTimeout(denTimer);
|
||||
denTimer = setTimeout(() => {
|
||||
$("preview-den").src = address;
|
||||
}, $("preview-den").src ? 250 : 0);
|
||||
};
|
||||
|
||||
// what Give would give, said beside it.
|
||||
function showChoice() {
|
||||
for (const [index, button] of [...$("presets").children].entries()) {
|
||||
button.setAttribute("aria-pressed", String(index === preset));
|
||||
}
|
||||
for (const button of $("variants").children) {
|
||||
button.setAttribute("aria-pressed", String(Number(button.dataset.variant) === variant));
|
||||
}
|
||||
if (!chosen) {
|
||||
return;
|
||||
}
|
||||
showPreview();
|
||||
if (chosen.kind === "clothing") {
|
||||
showWhole();
|
||||
const value = wholeValue();
|
||||
$("give-what").textContent = preset !== null ? `Its own colour ${preset + 1} (${value})`
|
||||
: value !== null ? `Colour ${value}` : `A new colour of ${slots.map(slot => slot.picker.value).join(" ")}`;
|
||||
}
|
||||
else {
|
||||
const parts = [chosen.variants.length ? `Variant ${chosen.variants.indexOf(variant) + 1}` : "As it is"];
|
||||
if (chosen.tintable && $("tint").checked) {
|
||||
parts.push(`tinted ${$("tint-picker").value} at ${$("tint-strength").value}%`);
|
||||
}
|
||||
$("give-what").textContent = parts.join(", ");
|
||||
}
|
||||
}
|
||||
|
||||
const choosePreset = index => {
|
||||
preset = index;
|
||||
applyWhole(chosen.presets[index].id, null, chosen.presets[index].colours);
|
||||
};
|
||||
|
||||
const choose = entry => {
|
||||
chosen = entry;
|
||||
$("detail").hidden = false;
|
||||
$("item-name").textContent = entry.name;
|
||||
$("item-meta").textContent = `${KINDS[entry.kind]} · id ${entry.id}${entry.cost ? ` · ${entry.cost} gems in shops` : ""}`;
|
||||
$("clothing-part").hidden = entry.kind !== "clothing";
|
||||
$("den-part").hidden = entry.kind !== "den";
|
||||
setStatus("give-status", "");
|
||||
if (entry.kind === "clothing") {
|
||||
$("presets").textContent = "";
|
||||
entry.presets.forEach((option, index) => {
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
button.title = `Colour ${index + 1} (${option.id})`;
|
||||
button.append(option.colours ? swatches(option.colours) : String(index + 1));
|
||||
button.addEventListener("click", () => choosePreset(index));
|
||||
$("presets").append(button);
|
||||
});
|
||||
if (entry.presets.length) {
|
||||
choosePreset(0);
|
||||
}
|
||||
else {
|
||||
preset = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$("variants").textContent = "";
|
||||
variant = entry.variants.length ? entry.variants[0] : 0;
|
||||
entry.variants.forEach((version, index) => {
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
button.dataset.variant = String(version);
|
||||
button.title = `Variant ${index + 1}`;
|
||||
button.append(entry.variantColours ? swatches(entry.variantColours[index]) : String(index + 1));
|
||||
button.addEventListener("click", () => {
|
||||
variant = version;
|
||||
showChoice();
|
||||
});
|
||||
$("variants").append(button);
|
||||
});
|
||||
$("no-variants").hidden = entry.variants.length > 0;
|
||||
$("tint-on").hidden = !entry.tintable;
|
||||
$("tint-off").hidden = entry.tintable;
|
||||
$("tint").checked = false;
|
||||
}
|
||||
showChoice();
|
||||
$("detail").scrollIntoView({behavior: "smooth", block: "nearest"});
|
||||
};
|
||||
|
||||
const showResults = found => {
|
||||
const list = $("results");
|
||||
list.textContent = "";
|
||||
for (const entry of found.results) {
|
||||
const row = document.createElement("li");
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
const name = document.createElement("span");
|
||||
name.className = "name";
|
||||
name.textContent = entry.name;
|
||||
const meta = document.createElement("span");
|
||||
meta.className = "meta";
|
||||
meta.textContent = `${KINDS[entry.kind]} · ${entry.id}`;
|
||||
button.append(name, meta);
|
||||
button.addEventListener("click", () => choose(entry));
|
||||
row.append(button);
|
||||
list.append(row);
|
||||
}
|
||||
setStatus("search-status", found.total === 0 ? "Nothing found." : found.total > found.results.length
|
||||
? `${found.total} found; the first ${found.results.length} shown. Type more to narrow it down.` : `${found.total} found.`);
|
||||
};
|
||||
|
||||
const showGate = (title, text) => {
|
||||
$("gate").hidden = false;
|
||||
$("finder").hidden = true;
|
||||
$("detail").hidden = true;
|
||||
$("gate-title").textContent = title;
|
||||
$("gate-text").textContent = text;
|
||||
};
|
||||
|
||||
let asked = 0;
|
||||
const search = async () => {
|
||||
const mine = ++asked;
|
||||
const result = await api(`giver?q=${encodeURIComponent($("query").value.trim())}&kind=${encodeURIComponent($("kind").value)}`);
|
||||
if (mine !== asked) {
|
||||
return;
|
||||
}
|
||||
if (result.status === 401) {
|
||||
showGate("Sign in first", "The item giver uses your account page's sign-in.");
|
||||
}
|
||||
else if (result.status === 403) {
|
||||
showGate("Not now", "The item giver is not open to this account at the moment. Your account page says why.");
|
||||
}
|
||||
else if (!result.ok) {
|
||||
setStatus("search-status", result.data.error || "That did not work.", true);
|
||||
}
|
||||
else {
|
||||
$("gate").hidden = true;
|
||||
$("finder").hidden = false;
|
||||
showResults(result.data);
|
||||
}
|
||||
};
|
||||
|
||||
let typing = null;
|
||||
$("query").addEventListener("input", () => {
|
||||
clearTimeout(typing);
|
||||
typing = setTimeout(search, 250);
|
||||
});
|
||||
$("kind").addEventListener("change", search);
|
||||
|
||||
$("give").addEventListener("click", async () => {
|
||||
if (!chosen) {
|
||||
return;
|
||||
}
|
||||
const body = {kind: chosen.kind, id: chosen.id};
|
||||
if (chosen.kind === "clothing") {
|
||||
const value = wholeValue();
|
||||
if (preset !== null) {
|
||||
body.colorIndex = preset;
|
||||
}
|
||||
else if (value !== null) {
|
||||
body.color = String(value);
|
||||
}
|
||||
else {
|
||||
body.color = slots.map(slot => slot.picker.value).join(" ");
|
||||
}
|
||||
}
|
||||
else {
|
||||
body.version = variant;
|
||||
if (chosen.tintable && $("tint").checked) {
|
||||
body.tint = $("tint-picker").value;
|
||||
body.tintStrength = Number($("tint-strength").value);
|
||||
}
|
||||
}
|
||||
$("give").disabled = true;
|
||||
const result = await api("give", body);
|
||||
$("give").disabled = false;
|
||||
if (result.status === 401) {
|
||||
showGate("Sign in again", "Your account page's sign-in ended.");
|
||||
return;
|
||||
}
|
||||
if (!result.ok) {
|
||||
setStatus("give-status", result.data.error || "That did not work.", true);
|
||||
return;
|
||||
}
|
||||
const as = result.data.color !== undefined ? ` Its colour in the game: ${result.data.color}.` : result.data.version ? ` Its version in the game: ${result.data.version}.` : "";
|
||||
setStatus("give-status", `${chosen.name}: given. ${result.data.online ? "It is in your inventory in the game now." : "It is in your inventory next time you play."}${as}`);
|
||||
});
|
||||
|
||||
api("colour").then(result => {
|
||||
if (result.ok && result.data.palette) {
|
||||
palette = result.data.palette.map(colour => `#${colour}`);
|
||||
for (const slot of slots) {
|
||||
const place = palette.indexOf(slot.picker.value);
|
||||
setSlot(slot, slot.picker.value, slot.index !== null ? slot.index : place < 0 ? null : place);
|
||||
}
|
||||
showChoice();
|
||||
}
|
||||
else {
|
||||
for (const slot of slots) {
|
||||
slot.aj.disabled = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
api("me").then(result => {
|
||||
if (result.ok) {
|
||||
$("who").textContent = `Items go to ${result.data.username}.`;
|
||||
}
|
||||
});
|
||||
search();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,6 +3,7 @@ package loader
|
||||
import Enums.DenItemDef;
|
||||
import avatar.AvatarManager;
|
||||
import avatar.MannequinData;
|
||||
import com.sbi.graphics.PaletteHelper;
|
||||
import com.sbi.loader.FileServerEvent;
|
||||
import den.DenItem;
|
||||
import den.DenStateItem;
|
||||
@@ -13,6 +14,7 @@ package loader
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.filters.ColorMatrixFilter;
|
||||
import pet.PetItem;
|
||||
import pet.PetManager;
|
||||
|
||||
@@ -467,7 +469,7 @@ package loader
|
||||
{
|
||||
_version = getVersions()[0];
|
||||
}
|
||||
_loader.content["setVersion"](param1);
|
||||
_loader.content["setVersion"](artVersion(param1));
|
||||
}
|
||||
else if(_loader.content.hasOwnProperty("pet"))
|
||||
{
|
||||
@@ -483,6 +485,50 @@ package loader
|
||||
}
|
||||
}
|
||||
}
|
||||
applyTint();
|
||||
}
|
||||
|
||||
// a den item's version (the server's lib/admin.js): the art's own
|
||||
// variant in the low 8 bits, and above them 1 + the number of a custom
|
||||
// colour entry (PaletteHelper.customColors, [rgb, strength 1-100, 0,
|
||||
// 0]) the whole item is tinted with. the art is only ever given its
|
||||
// variant.
|
||||
private static const CUSTOM_BASE:uint = 0xFD000000;
|
||||
|
||||
private function artVersion(param1:int) : int
|
||||
{
|
||||
return param1 < 0 ? param1 : param1 & 0xFF;
|
||||
}
|
||||
|
||||
private function applyTint() : void
|
||||
{
|
||||
if(!_loader || !_loader.content || _loader.content.hasOwnProperty("pet"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc1_:int = _version > 0 ? _version >> 8 & 0x7FFFFF : 0;
|
||||
var _loc2_:Array = _loc1_ > 0 ? PaletteHelper.customColors[uint(CUSTOM_BASE + _loc1_ - 1)] : null;
|
||||
_loader.filters = _loc2_ != null ? [new ColorMatrixFilter(tintMatrix(uint(_loc2_[0]),Math.min(100,Math.max(1,_loc2_[1])) / 100))] : [];
|
||||
}
|
||||
|
||||
// the item in shades of `param1`, `param2` of the way (0-1): each
|
||||
// pixel's brightness, times the colour (made as bright as white would
|
||||
// be, up to twice), mixed with the pixel as it was.
|
||||
private static function tintMatrix(param1:uint, param2:Number) : Array
|
||||
{
|
||||
var _loc3_:Array = [(param1 >> 16 & 0xFF) / 255,(param1 >> 8 & 0xFF) / 255,(param1 & 0xFF) / 255];
|
||||
var _loc4_:Number = 0.299 * _loc3_[0] + 0.587 * _loc3_[1] + 0.114 * _loc3_[2];
|
||||
var _loc5_:Number = Math.min(2,1 / Math.max(0.001,_loc4_));
|
||||
var _loc6_:Array = [];
|
||||
var _loc7_:int = 0;
|
||||
while(_loc7_ < 3)
|
||||
{
|
||||
var _loc8_:Number = _loc3_[_loc7_] * _loc5_ * param2;
|
||||
_loc6_.push(0.299 * _loc8_ + (_loc7_ == 0 ? 1 - param2 : 0),0.587 * _loc8_ + (_loc7_ == 1 ? 1 - param2 : 0),0.114 * _loc8_ + (_loc7_ == 2 ? 1 - param2 : 0),0,0);
|
||||
_loc7_++;
|
||||
}
|
||||
_loc6_.push(0,0,0,1,0);
|
||||
return _loc6_;
|
||||
}
|
||||
|
||||
public function rebuildMannequinView() : void
|
||||
@@ -567,7 +613,7 @@ package loader
|
||||
}
|
||||
if(_loader.content.hasOwnProperty("setVersion") && _version >= 0)
|
||||
{
|
||||
MovieClip(_loader.content).setVersion(_version);
|
||||
MovieClip(_loader.content).setVersion(artVersion(_version));
|
||||
}
|
||||
else if(_loader.content.hasOwnProperty("pet"))
|
||||
{
|
||||
@@ -582,6 +628,7 @@ package loader
|
||||
}
|
||||
}
|
||||
}
|
||||
applyTint();
|
||||
if(MovieClip(_loader.content).isMoveToDisabled)
|
||||
{
|
||||
_loader.name = "moveToDisabled";
|
||||
|
||||
Binary file not shown.
@@ -99,6 +99,54 @@ const run = async () => {
|
||||
// the start is used up with the sign-in
|
||||
assert.strictEqual((await mine("client-ticket", {token: annToken, nonce: browser.nonce})).status, 400);
|
||||
|
||||
// --- the item giver on the web (/account/items): signed in as on this page
|
||||
assert.match(await (await fetch(`${BASE}/account/items`)).text(), /Item giver/);
|
||||
// (an account of its own: the others' inventories are counted further down)
|
||||
assert.strictEqual((await register("Cleo", 5)).status, 200);
|
||||
const cleo = (await mine("login", {username: "Cleo", password: "KettlePass01"})).cookie;
|
||||
assert.strictEqual((await mine("giver?q=top%20hat")).status, 401);
|
||||
const hats = (await mine("giver?q=top%20hat&kind=clothing", undefined, cleo)).data;
|
||||
const hat = hats.results.find(entry => entry.id === 21);
|
||||
assert.ok(hat.presets.length > 1 && hat.presets[0].colours.every(colour => /^[0-9a-f]{6}$/.test(colour)));
|
||||
const ownColour = await mine("give", {kind: "clothing", id: 21, colorIndex: 1}, cleo);
|
||||
assert.deepStrictEqual([ownColour.status, ownColour.data.color], [200, hat.presets[1].id]);
|
||||
// four colours of one's own: a custom colour (lib/colours.js), the same one for the same four
|
||||
const hexColours = await mine("give", {kind: "clothing", id: 21, color: "#ff0000 #00ff00 #0000ff #ffffff"}, cleo);
|
||||
assert.strictEqual(hexColours.status, 200);
|
||||
assert.ok(hexColours.data.color >= 0xFD000000 && hexColours.data.color <= 0xFDFFFFFF);
|
||||
assert.strictEqual((await mine("give", {kind: "clothing", id: 21, color: "#ff0000 #00ff00 #0000ff #ffffff"}, cleo)).data.color, hexColours.data.color);
|
||||
// the page's colour boxes: the palette, a custom colour's four, the custom colour four make
|
||||
assert.strictEqual((await mine("colour", undefined, cleo)).data.palette.length, 256);
|
||||
assert.deepStrictEqual((await mine(`colour?id=${hexColours.data.color | 0}`, undefined, cleo)).data.colours, ["ff0000", "00ff00", "0000ff", "ffffff"]);
|
||||
assert.strictEqual((await mine("colour?rgbs=ff0000,00ff00,0000ff,ffffff", undefined, cleo)).data.id, hexColours.data.color);
|
||||
assert.strictEqual((await mine("colour?rgbs=123456,00ff00,0000ff,ffffff", undefined, cleo)).data.id, null);
|
||||
assert.strictEqual((await mine("colour?id=4261412863", undefined, cleo)).status, 404);
|
||||
// a colour as the game writes it, signed or not; a custom one only if it is made
|
||||
assert.strictEqual((await mine("give", {kind: "clothing", id: 21, color: "-16777216"}, cleo)).data.color, 0xFF000000);
|
||||
assert.strictEqual((await mine("give", {kind: "clothing", id: 21, color: "4261412863"}, cleo)).status, 400);
|
||||
// a den item's variants (lib/den-variants.json) and a tint: 1 + the tint's colour entry above the variant's 8 bits
|
||||
const chair = (await mine("giver?q=1&kind=den", undefined, cleo)).data.results.find(entry => entry.id === 1);
|
||||
assert.deepStrictEqual([chair.variants, chair.variantColours.length, chair.tintable], [[0, 1, 2, 3, 4, 5, 6, 7], 8, true]);
|
||||
assert.deepStrictEqual((await mine("give", {kind: "den", id: 1, version: 5}, cleo)).data.version, 5);
|
||||
assert.strictEqual((await mine("give", {kind: "den", id: 1, version: 9}, cleo)).status, 400);
|
||||
assert.strictEqual((await mine("give", {kind: "den", id: 1, tint: "red"}, cleo)).status, 400);
|
||||
assert.strictEqual((await mine("give", {kind: "den", id: 1, tint: "#ff8800", tintStrength: 0}, cleo)).status, 400);
|
||||
const tinted = await mine("give", {kind: "den", id: 1, version: 3, tint: "#ff8800", tintStrength: 60}, cleo);
|
||||
assert.strictEqual(tinted.status, 200);
|
||||
assert.strictEqual(tinted.data.version & 0xFF, 3);
|
||||
assert.ok(tinted.data.version >> 8 >= 1);
|
||||
// only from this server's own pages
|
||||
assert.strictEqual((await mine("give", {kind: "den", id: 1}, cleo, {Origin: "http://evil.example"})).status, 403);
|
||||
// its previews (lib/itempreview.js), the same for anyone: a clothing icon to colour, a den item's SWF
|
||||
const icon = await (await fetch(`${BASE}/account/art/clothing/21`)).json();
|
||||
assert.ok(icon.w > 0 && icon.h > 0 && Buffer.from(icon.b, "base64").length > 0);
|
||||
const denArt = await fetch(`${BASE}/account/art/den/1`);
|
||||
assert.strictEqual(denArt.headers.get("access-control-allow-origin"), "*");
|
||||
assert.match(Buffer.from(await denArt.arrayBuffer()).subarray(0, 3).toString(), /^[CFZ]WS$/);
|
||||
assert.strictEqual((await fetch(`${BASE}/account/art/den/999999`)).status, 404);
|
||||
assert.match((await fetch(`${BASE}/account/item-preview`)).headers.get("content-security-policy"), /sandbox allow-scripts$/);
|
||||
assert.match(Buffer.from(await (await fetch(`${BASE}/account/item-preview.swf`)).arrayBuffer()).subarray(0, 3).toString(), /^[CFZ]WS$/);
|
||||
|
||||
// --- parts of the game switched off
|
||||
const {client: a, roomId} = await arrive("Ann", "KettlePass01");
|
||||
const {client: b} = await arrive("Ben", "KettlePass01");
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
"use strict";
|
||||
|
||||
// the variants (colours) each den item's art has, into lib/den-variants.json,
|
||||
// which the item giver offers (lib/admin.js). the art says so itself, in
|
||||
// ActionScript: getVersions() returns them, and setVersion(n) shows one.
|
||||
// the server cannot run that, so tools/den-variants.sh reads it once:
|
||||
//
|
||||
// node tools/den-variants.js fetch <folder> every den item's art, as SWFs
|
||||
// (ffdec decompiles <folder>/swf into <folder>/out)
|
||||
// node tools/den-variants.js index <folder> reads <folder>/out
|
||||
//
|
||||
// most items with variants draw each as a frame of their own; some colour
|
||||
// parts of themselves from a table instead (colArray, one row of RGB values
|
||||
// per variant), and for those the table's colours are kept too, as a
|
||||
// preview. items with no variants are left out.
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const amf3 = require("../lib/amf3.js");
|
||||
const cdn = require("../lib/cdn.js");
|
||||
const defpacks = require("../lib/defpacks.js");
|
||||
|
||||
const OUT = path.join(__dirname, "..", "lib", "den-variants.json");
|
||||
const AT_ONCE = 16;
|
||||
const MAX_VARIANTS = 64;
|
||||
const PREVIEW_COLOURS = 4;
|
||||
|
||||
// DenItem.getIconId: which of an item's pictures the den shows, by its sort category.
|
||||
const iconId = sortCat => ([0, 99, 6, 5].includes(sortCat) ? 1 : sortCat === 1 ? 2 : [2, 3, 4].includes(sortCat) ? 3 : sortCat + 1);
|
||||
|
||||
const fetchAll = async folder => {
|
||||
await defpacks.init();
|
||||
fs.mkdirSync(path.join(folder, "swf"), {recursive: true});
|
||||
const ids = defpacks.denItemIds();
|
||||
let next = 0;
|
||||
let written = 0;
|
||||
const work = async () => {
|
||||
while (next < ids.length) {
|
||||
const id = ids[next++];
|
||||
const def = defpacks.denItemDef(id);
|
||||
const file = await cdn.get(cdn.hashedPath(`items/${((id << 16) | iconId(Number(def.sortCat))) >>> 0}`));
|
||||
try {
|
||||
const wrapped = file && amf3.decode(file);
|
||||
if (wrapped && wrapped.ba) {
|
||||
fs.writeFileSync(path.join(folder, "swf", `${id}.swf`), Buffer.from(wrapped.ba));
|
||||
written++;
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// not art this can read: left out.
|
||||
}
|
||||
}
|
||||
};
|
||||
await Promise.all(Array.from({length: AT_ONCE}, work));
|
||||
console.log(`${written} of ${ids.length} den items' art written`);
|
||||
};
|
||||
|
||||
const hex = ([r, g, b]) => ((r << 16) | (g << 8) | b).toString(16).padStart(6, "0");
|
||||
|
||||
// one item's decompiled scripts: its variants, and the colour table's first
|
||||
// colours for each when it has one.
|
||||
const readItem = scripts => {
|
||||
let versions = null;
|
||||
for (const text of scripts) {
|
||||
const literal = /function getVersions\(\)\s*:\s*Array\s*\{\s*return \[([\d,\s]*)\];/.exec(text);
|
||||
if (literal) {
|
||||
const list = literal[1].split(",").map(value => Number(value.trim())).filter(Number.isInteger);
|
||||
if (!versions || list.length > versions.length) {
|
||||
versions = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!versions || versions.length < 2) {
|
||||
return null;
|
||||
}
|
||||
const entry = {versions: versions.slice(0, MAX_VARIANTS)};
|
||||
const rows = {};
|
||||
for (const text of scripts) {
|
||||
for (const match of text.matchAll(/colArray\[(\d+)\] = (\[\[[\d,\s[\]]*\]\]);/g)) {
|
||||
try {
|
||||
rows[match[1]] = JSON.parse(match[2]).slice(0, PREVIEW_COLOURS).map(hex);
|
||||
}
|
||||
catch (err) {
|
||||
// not a plain table
|
||||
}
|
||||
}
|
||||
}
|
||||
if (entry.versions.every(version => rows[version])) {
|
||||
entry.colours = entry.versions.map(version => rows[version]);
|
||||
}
|
||||
return entry;
|
||||
};
|
||||
|
||||
const scriptsIn = folder => {
|
||||
const found = [];
|
||||
const walk = dir => {
|
||||
for (const name of fs.readdirSync(dir, {withFileTypes: true})) {
|
||||
const full = path.join(dir, name.name);
|
||||
if (name.isDirectory()) {
|
||||
walk(full);
|
||||
}
|
||||
else if (name.name.endsWith(".as")) {
|
||||
found.push(fs.readFileSync(full, "utf8"));
|
||||
}
|
||||
}
|
||||
};
|
||||
walk(folder);
|
||||
return found;
|
||||
};
|
||||
|
||||
const index = folder => {
|
||||
const out = path.join(folder, "out");
|
||||
const result = {};
|
||||
for (const name of fs.readdirSync(out)) {
|
||||
const id = /^(\d+)\.swf$/.exec(name);
|
||||
const entry = id && readItem(scriptsIn(path.join(out, name)));
|
||||
if (entry) {
|
||||
result[id[1]] = entry;
|
||||
}
|
||||
}
|
||||
const sorted = Object.fromEntries(Object.entries(result).sort((a, b) => Number(a[0]) - Number(b[0])));
|
||||
fs.writeFileSync(OUT, `${JSON.stringify(sorted)}\n`);
|
||||
console.log(`${Object.keys(sorted).length} den items with variants, ${Object.values(sorted).filter(entry => entry.colours).length} with colour previews: ${OUT}`);
|
||||
};
|
||||
|
||||
const [command, folder] = process.argv.slice(2);
|
||||
if (command === "fetch" && folder) {
|
||||
fetchAll(folder).then(() => process.exit(0), err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
else if (command === "index" && folder) {
|
||||
index(folder);
|
||||
}
|
||||
else {
|
||||
console.error("node tools/den-variants.js fetch|index <folder>");
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# rebuilds lib/den-variants.json: every den item's art fetched (into cache/
|
||||
# too), decompiled by JPEXS (tools/ffdec, needs Java) and read for its
|
||||
# variants. see tools/den-variants.js.
|
||||
#
|
||||
# tools/den-variants.sh [work folder] (default: a new temporary one)
|
||||
set -e
|
||||
cd "$(dirname "$(readlink -f "$0")")/.."
|
||||
work=${1:-$(mktemp -d)}
|
||||
node tools/den-variants.js fetch "$work"
|
||||
java -jar tools/ffdec/ffdec-cli.jar -export script "$work/out" "$work/swf" > "$work/ffdec.log" 2>&1
|
||||
node tools/den-variants.js index "$work"
|
||||
@@ -0,0 +1,93 @@
|
||||
package
|
||||
{
|
||||
import flash.display.Loader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.filters.ColorMatrixFilter;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.net.URLRequest;
|
||||
import flash.system.ApplicationDomain;
|
||||
import flash.system.LoaderContext;
|
||||
|
||||
// the web item giver's den item preview (public/item-preview.html): one
|
||||
// den item's art, as a den shows it. flashvars: art (its address),
|
||||
// version (the variant) and tint ("rrggbb") with strength (1 to 100), as
|
||||
// DenItemHelper gives them.
|
||||
public class PreviewHost extends MovieClip
|
||||
{
|
||||
private static const MARGIN:Number = 10;
|
||||
|
||||
private var _loader:Loader;
|
||||
|
||||
public function PreviewHost()
|
||||
{
|
||||
super();
|
||||
stage.scaleMode = "noScale";
|
||||
stage.align = "TL";
|
||||
_loader = new Loader();
|
||||
_loader.contentLoaderInfo.addEventListener("complete",onLoaded);
|
||||
_loader.contentLoaderInfo.addEventListener("ioError",onFailed);
|
||||
addChild(_loader);
|
||||
var _loc1_:String = loaderInfo.parameters.art;
|
||||
if(_loc1_)
|
||||
{
|
||||
_loader.load(new URLRequest(_loc1_),new LoaderContext(false,new ApplicationDomain()));
|
||||
}
|
||||
}
|
||||
|
||||
private function onLoaded(param1:Event) : void
|
||||
{
|
||||
var _loc2_:Object = _loader.content;
|
||||
var _loc3_:int = int(loaderInfo.parameters.version);
|
||||
if(_loc2_.hasOwnProperty("setVersion"))
|
||||
{
|
||||
_loc2_.setVersion(_loc3_);
|
||||
}
|
||||
var _loc4_:String = loaderInfo.parameters.tint;
|
||||
if(_loc4_)
|
||||
{
|
||||
_loader.filters = [new ColorMatrixFilter(tintMatrix(uint(parseInt(_loc4_,16)),Math.max(1,Math.min(100,Number(loaderInfo.parameters.strength) || 100)) / 100))];
|
||||
}
|
||||
addEventListener("enterFrame",fit);
|
||||
}
|
||||
|
||||
private function onFailed(param1:IOErrorEvent) : void
|
||||
{
|
||||
}
|
||||
|
||||
// fitted to the stage, centred: kept on as an item may grow as it plays.
|
||||
private function fit(param1:Event) : void
|
||||
{
|
||||
_loader.scaleX = _loader.scaleY = 1;
|
||||
_loader.x = _loader.y = 0;
|
||||
var _loc2_:Rectangle = _loader.getBounds(this);
|
||||
if(_loc2_.width <= 0 || _loc2_.height <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc3_:Number = Math.min((stage.stageWidth - MARGIN * 2) / _loc2_.width,(stage.stageHeight - MARGIN * 2) / _loc2_.height);
|
||||
_loader.scaleX = _loader.scaleY = _loc3_;
|
||||
_loader.x = (stage.stageWidth - _loc2_.width * _loc3_) / 2 - _loc2_.x * _loc3_;
|
||||
_loader.y = (stage.stageHeight - _loc2_.height * _loc3_) / 2 - _loc2_.y * _loc3_;
|
||||
}
|
||||
|
||||
// DenItemHelper.tintMatrix's
|
||||
private static function tintMatrix(param1:uint, param2:Number) : Array
|
||||
{
|
||||
var _loc3_:Array = [(param1 >> 16 & 0xFF) / 255,(param1 >> 8 & 0xFF) / 255,(param1 & 0xFF) / 255];
|
||||
var _loc4_:Number = 0.299 * _loc3_[0] + 0.587 * _loc3_[1] + 0.114 * _loc3_[2];
|
||||
var _loc5_:Number = Math.min(2,1 / Math.max(0.001,_loc4_));
|
||||
var _loc6_:Array = [];
|
||||
var _loc7_:int = 0;
|
||||
while(_loc7_ < 3)
|
||||
{
|
||||
var _loc8_:Number = _loc3_[_loc7_] * _loc5_ * param2;
|
||||
_loc6_.push(0.299 * _loc8_ + (_loc7_ == 0 ? 1 - param2 : 0),0.587 * _loc8_ + (_loc7_ == 1 ? 1 - param2 : 0),0.114 * _loc8_ + (_loc7_ == 2 ? 1 - param2 : 0),0,0);
|
||||
_loc7_++;
|
||||
}
|
||||
_loc6_.push(0,0,0,1,0);
|
||||
return _loc6_;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,450 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!--
|
||||
WARNING: The structure of this XML is not final.
|
||||
In later versions of FFDec it can be changed.
|
||||
Make sure you use compatible reader/writer based on _xmlExportMajor/_xmlExportMinor keys.
|
||||
--><swf _xmlExportMajor="2" _xmlExportMinor="2" _generator="JPEXS Free Flash Decompiler v.26.3.0" type="SWF" charset="UTF-8" compression="ZLIB" encrypted="false" frameCount="1" frameRate="24.0" gfx="false" hasEndTag="true" version="10">
|
||||
<displayRect type="RECT" Xmax="4000" Xmin="0" Ymax="4000" Ymin="0" nbits="13"/>
|
||||
<tags>
|
||||
<item type="FileAttributesTag" actionScript3="true" forceWriteAsLong="false" hasMetadata="false" noCrossDomainCache="false" reservedA="false" reservedB="0" swfRelativeUrls="false" useDirectBlit="false" useGPU="false" useNetwork="true"/>
|
||||
<item type="SetBackgroundColorTag" forceWriteAsLong="false">
|
||||
<backgroundColor type="RGB" blue="255" green="255" red="255"/>
|
||||
</item>
|
||||
<item type="DoABC2Tag" flags="1" forceWriteAsLong="true" name="">
|
||||
<abc type="ABC">
|
||||
<version type="ABCVersion" major="46" minor="16"/>
|
||||
<constants type="AVM2ConstantPool">
|
||||
<constant_int>
|
||||
<item isNull="true"/>
|
||||
<item>4</item>
|
||||
</constant_int>
|
||||
<constant_uint/>
|
||||
<constant_double>
|
||||
<item isNull="true"/>
|
||||
<item>0.299</item>
|
||||
<item>0.587</item>
|
||||
<item>0.114</item>
|
||||
<item>0.001</item>
|
||||
</constant_double>
|
||||
<constant_decimal/>
|
||||
<constant_float/>
|
||||
<constant_float4/>
|
||||
<constant_string>
|
||||
<item isNull="true"/>
|
||||
<item/>
|
||||
<item>Array</item>
|
||||
<item>void</item>
|
||||
<item>flash.display</item>
|
||||
<item>MovieClip</item>
|
||||
<item>setVersion</item>
|
||||
<item>http://adobe.com/AS3/2006/builtin</item>
|
||||
<item>flash.events</item>
|
||||
<item>flash.filters</item>
|
||||
<item>flash.geom</item>
|
||||
<item>flash.net</item>
|
||||
<item>flash.system</item>
|
||||
<item>flash.display:MovieClip</item>
|
||||
<item>flash.display:Sprite</item>
|
||||
<item>flash.display:DisplayObjectContainer</item>
|
||||
<item>flash.display:InteractiveObject</item>
|
||||
<item>flash.display:DisplayObject</item>
|
||||
<item>flash.events:EventDispatcher</item>
|
||||
<item>Object</item>
|
||||
<item>EventDispatcher</item>
|
||||
<item>DisplayObject</item>
|
||||
<item>InteractiveObject</item>
|
||||
<item>DisplayObjectContainer</item>
|
||||
<item>Sprite</item>
|
||||
<item>PreviewHost</item>
|
||||
<item>_loader</item>
|
||||
<item>onLoaded</item>
|
||||
<item>onFailed</item>
|
||||
<item>fit</item>
|
||||
<item>MARGIN</item>
|
||||
<item>tintMatrix</item>
|
||||
<item>Loader</item>
|
||||
<item>PreviewHost/private/onLoaded</item>
|
||||
<item>Event</item>
|
||||
<item>PreviewHost/private/onFailed</item>
|
||||
<item>IOErrorEvent</item>
|
||||
<item>PreviewHost/private/fit</item>
|
||||
<item>loaderInfo</item>
|
||||
<item>uint</item>
|
||||
<item>parseInt</item>
|
||||
<item>Math</item>
|
||||
<item>Number</item>
|
||||
<item>addEventListener</item>
|
||||
<item>content</item>
|
||||
<item>parameters</item>
|
||||
<item>version</item>
|
||||
<item>hasOwnProperty</item>
|
||||
<item>tint</item>
|
||||
<item>filters</item>
|
||||
<item>ColorMatrixFilter</item>
|
||||
<item>max</item>
|
||||
<item>min</item>
|
||||
<item>strength</item>
|
||||
<item>enterFrame</item>
|
||||
<item>param1</item>
|
||||
<item>_loc2_</item>
|
||||
<item>_loc3_</item>
|
||||
<item>_loc4_</item>
|
||||
<item>stage</item>
|
||||
<item>scaleX</item>
|
||||
<item>scaleY</item>
|
||||
<item>x</item>
|
||||
<item>y</item>
|
||||
<item>Rectangle</item>
|
||||
<item>getBounds</item>
|
||||
<item>width</item>
|
||||
<item>height</item>
|
||||
<item>stageWidth</item>
|
||||
<item>stageHeight</item>
|
||||
<item>PreviewHost/private/tintMatrix</item>
|
||||
<item>push</item>
|
||||
<item>param2</item>
|
||||
<item>_loc5_</item>
|
||||
<item>_loc6_</item>
|
||||
<item>_loc7_</item>
|
||||
<item>_loc8_</item>
|
||||
<item>PreviewHost/PreviewHost</item>
|
||||
<item>addChild</item>
|
||||
<item>scaleMode</item>
|
||||
<item>noScale</item>
|
||||
<item>align</item>
|
||||
<item>TL</item>
|
||||
<item>contentLoaderInfo</item>
|
||||
<item>complete</item>
|
||||
<item>ioError</item>
|
||||
<item>art</item>
|
||||
<item>load</item>
|
||||
<item>URLRequest</item>
|
||||
<item>LoaderContext</item>
|
||||
<item>ApplicationDomain</item>
|
||||
<item>_loc1_</item>
|
||||
<item>PreviewUnused</item>
|
||||
<item>PreviewHost.as$0</item>
|
||||
</constant_string>
|
||||
<constant_namespace>
|
||||
<item isNull="true"/>
|
||||
<item type="Namespace" kind="22" name_index="1"/>
|
||||
<item type="Namespace" kind="22" name_index="4"/>
|
||||
<item type="Namespace" kind="8" name_index="7"/>
|
||||
<item type="Namespace" kind="22" name_index="8"/>
|
||||
<item type="Namespace" kind="22" name_index="9"/>
|
||||
<item type="Namespace" kind="22" name_index="10"/>
|
||||
<item type="Namespace" kind="22" name_index="11"/>
|
||||
<item type="Namespace" kind="22" name_index="12"/>
|
||||
<item type="Namespace" kind="26" name_index="13"/>
|
||||
<item type="Namespace" kind="26" name_index="14"/>
|
||||
<item type="Namespace" kind="26" name_index="15"/>
|
||||
<item type="Namespace" kind="26" name_index="16"/>
|
||||
<item type="Namespace" kind="26" name_index="17"/>
|
||||
<item type="Namespace" kind="26" name_index="18"/>
|
||||
<item type="Namespace" kind="23" name_index="1"/>
|
||||
<item type="Namespace" kind="5" name_index="25"/>
|
||||
<item type="Namespace" kind="24" name_index="25"/>
|
||||
<item type="Namespace" kind="26" name_index="25"/>
|
||||
<item type="Namespace" kind="24" name_index="92"/>
|
||||
<item type="Namespace" kind="5" name_index="93"/>
|
||||
</constant_namespace>
|
||||
<constant_namespace_set>
|
||||
<item isNull="true"/>
|
||||
<item type="NamespaceSet">
|
||||
<namespaces>
|
||||
<item>1</item>
|
||||
</namespaces>
|
||||
</item>
|
||||
<item type="NamespaceSet">
|
||||
<namespaces>
|
||||
<item>1</item>
|
||||
<item>3</item>
|
||||
<item>15</item>
|
||||
<item>9</item>
|
||||
<item>10</item>
|
||||
<item>11</item>
|
||||
<item>12</item>
|
||||
<item>13</item>
|
||||
<item>14</item>
|
||||
<item>16</item>
|
||||
<item>17</item>
|
||||
<item>18</item>
|
||||
<item>20</item>
|
||||
</namespaces>
|
||||
</item>
|
||||
</constant_namespace_set>
|
||||
<constant_multiname>
|
||||
<item isNull="true"/>
|
||||
<item type="Multiname" kind="7" name_index="2" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="3" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="5" namespace_index="2" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="19" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="20" namespace_index="4" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="21" namespace_index="2" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="22" namespace_index="2" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="23" namespace_index="2" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="24" namespace_index="2" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="25" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="26" namespace_index="16" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="27" namespace_index="16" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="28" namespace_index="16" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="29" namespace_index="16" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="30" namespace_index="16" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="31" namespace_index="16" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="32" namespace_index="2" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="34" namespace_index="4" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="36" namespace_index="4" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="38" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="39" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="40" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="41" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="42" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="43" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="44" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="45" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="47" namespace_index="3" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="49" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="50" namespace_index="5" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="51" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="52" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="59" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="60" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="61" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="62" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="63" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="64" namespace_index="6" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="65" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="66" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="67" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="68" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="69" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="71" namespace_index="3" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="78" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="79" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="81" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="83" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="87" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="88" namespace_index="7" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="89" namespace_index="8" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="90" namespace_index="8" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="7" name_index="92" namespace_index="1" namespace_set_index="0" qname_index="0"/>
|
||||
<item type="Multiname" kind="9" name_index="92" namespace_index="0" namespace_set_index="1" qname_index="0"/>
|
||||
<item type="Multiname" kind="9" name_index="46" namespace_index="0" namespace_set_index="2" qname_index="0"/>
|
||||
<item type="Multiname" kind="9" name_index="6" namespace_index="0" namespace_set_index="2" qname_index="0"/>
|
||||
<item type="Multiname" kind="9" name_index="48" namespace_index="0" namespace_set_index="2" qname_index="0"/>
|
||||
<item type="Multiname" kind="9" name_index="53" namespace_index="0" namespace_set_index="2" qname_index="0"/>
|
||||
<item type="Multiname" kind="27" name_index="0" namespace_index="0" namespace_set_index="2" qname_index="0"/>
|
||||
<item type="Multiname" kind="9" name_index="86" namespace_index="0" namespace_set_index="2" qname_index="0"/>
|
||||
</constant_multiname>
|
||||
</constants>
|
||||
<method_info>
|
||||
<item type="MethodInfo" flags="0" name_index="1" ret_type="0">
|
||||
<param_types/>
|
||||
<optional/>
|
||||
<paramNames/>
|
||||
</item>
|
||||
<item type="MethodInfo" flags="0" name_index="33" ret_type="2">
|
||||
<param_types>
|
||||
<item>18</item>
|
||||
</param_types>
|
||||
<optional/>
|
||||
<paramNames>
|
||||
<item>0</item>
|
||||
</paramNames>
|
||||
</item>
|
||||
<item type="MethodInfo" flags="0" name_index="35" ret_type="2">
|
||||
<param_types>
|
||||
<item>19</item>
|
||||
</param_types>
|
||||
<optional/>
|
||||
<paramNames>
|
||||
<item>0</item>
|
||||
</paramNames>
|
||||
</item>
|
||||
<item type="MethodInfo" flags="0" name_index="37" ret_type="2">
|
||||
<param_types>
|
||||
<item>18</item>
|
||||
</param_types>
|
||||
<optional/>
|
||||
<paramNames>
|
||||
<item>0</item>
|
||||
</paramNames>
|
||||
</item>
|
||||
<item type="MethodInfo" flags="0" name_index="70" ret_type="1">
|
||||
<param_types>
|
||||
<item>21</item>
|
||||
<item>24</item>
|
||||
</param_types>
|
||||
<optional/>
|
||||
<paramNames>
|
||||
<item>0</item>
|
||||
<item>0</item>
|
||||
</paramNames>
|
||||
</item>
|
||||
<item type="MethodInfo" flags="0" name_index="77" ret_type="0">
|
||||
<param_types/>
|
||||
<optional/>
|
||||
<paramNames/>
|
||||
</item>
|
||||
<item type="MethodInfo" flags="0" name_index="1" ret_type="0">
|
||||
<param_types/>
|
||||
<optional/>
|
||||
<paramNames/>
|
||||
</item>
|
||||
<item type="MethodInfo" flags="0" name_index="1" ret_type="0">
|
||||
<param_types/>
|
||||
<optional/>
|
||||
<paramNames/>
|
||||
</item>
|
||||
<item type="MethodInfo" flags="0" name_index="0" ret_type="0">
|
||||
<param_types/>
|
||||
<optional/>
|
||||
<paramNames/>
|
||||
</item>
|
||||
<item type="MethodInfo" flags="0" name_index="1" ret_type="0">
|
||||
<param_types/>
|
||||
<optional/>
|
||||
<paramNames/>
|
||||
</item>
|
||||
</method_info>
|
||||
<metadata_info/>
|
||||
<instance_info>
|
||||
<item type="InstanceInfo" flags="9" iinit_index="5" name_index="10" protectedNS="17" super_index="3">
|
||||
<interfaces/>
|
||||
<instance_traits type="Traits">
|
||||
<traits>
|
||||
<item type="TraitSlotConst" bytes="0b00001100" deleted="false" fileOffset="1461" kindFlags="0" kindType="0" name_index="11" slot_id="0" type_index="17" value_index="0" value_kind="0">
|
||||
<metadata/>
|
||||
</item>
|
||||
<item type="TraitMethodGetterSetter" bytes="0c010001" deleted="false" disp_id="0" fileOffset="1466" kindFlags="0" kindType="1" method_info="1" name_index="12">
|
||||
<metadata/>
|
||||
</item>
|
||||
<item type="TraitMethodGetterSetter" bytes="0d010002" deleted="false" disp_id="0" fileOffset="1470" kindFlags="0" kindType="1" method_info="2" name_index="13">
|
||||
<metadata/>
|
||||
</item>
|
||||
<item type="TraitMethodGetterSetter" bytes="0e010003" deleted="false" disp_id="0" fileOffset="1474" kindFlags="0" kindType="1" method_info="3" name_index="14">
|
||||
<metadata/>
|
||||
</item>
|
||||
</traits>
|
||||
</instance_traits>
|
||||
</item>
|
||||
<item type="InstanceInfo" flags="9" iinit_index="8" name_index="53" protectedNS="19" super_index="4">
|
||||
<interfaces/>
|
||||
<instance_traits type="Traits">
|
||||
<traits/>
|
||||
</instance_traits>
|
||||
</item>
|
||||
</instance_info>
|
||||
<class_info>
|
||||
<item type="ClassInfo" cinit_index="6">
|
||||
<static_traits type="Traits">
|
||||
<traits>
|
||||
<item type="TraitSlotConst" bytes="0f0601180103" deleted="false" fileOffset="1487" kindFlags="0" kindType="6" name_index="15" slot_id="1" type_index="24" value_index="1" value_kind="3">
|
||||
<metadata/>
|
||||
</item>
|
||||
<item type="TraitMethodGetterSetter" bytes="10110304" deleted="false" disp_id="3" fileOffset="1493" kindFlags="1" kindType="1" method_info="4" name_index="16">
|
||||
<metadata/>
|
||||
</item>
|
||||
</traits>
|
||||
</static_traits>
|
||||
</item>
|
||||
<item type="ClassInfo" cinit_index="9">
|
||||
<static_traits type="Traits">
|
||||
<traits/>
|
||||
</static_traits>
|
||||
</item>
|
||||
</class_info>
|
||||
<script_info>
|
||||
<item type="ScriptInfo" init_index="0">
|
||||
<traits type="Traits">
|
||||
<traits>
|
||||
<item type="TraitClass" bytes="0a040100" class_info="0" deleted="false" fileOffset="1502" kindFlags="0" kindType="4" name_index="10" slot_id="1">
|
||||
<metadata/>
|
||||
</item>
|
||||
</traits>
|
||||
</traits>
|
||||
</item>
|
||||
<item type="ScriptInfo" init_index="7">
|
||||
<traits type="Traits">
|
||||
<traits>
|
||||
<item type="TraitClass" bytes="35040101" class_info="1" deleted="false" fileOffset="1508" kindFlags="0" kindType="4" name_index="53" slot_id="1">
|
||||
<metadata/>
|
||||
</item>
|
||||
</traits>
|
||||
</traits>
|
||||
</item>
|
||||
</script_info>
|
||||
<bodies>
|
||||
<item type="MethodBody" codeBytes="d0306500600430600530600630600730600830600930600330600358001d1d1d1d1d1d1d680a47" init_scope_depth="1" max_regs="1" max_scope_depth="9" max_stack="2" method_info="0">
|
||||
<exceptions/>
|
||||
<traits type="Traits">
|
||||
<traits/>
|
||||
</traits>
|
||||
</item>
|
||||
<item type="MethodBody" codeBytes="d030ef01370000ef01380129ef0139022aef013a032f600b661a8004d66014661b66377373d7d22c06461c0112050000d2d34f38016014661b66398563046204123d0000600b5d1e5d105d16620424104616027460172401601724646014661b663a75752a761104000029246475462002461f022464a34610024a1e015601611d5d192c36600e4f190247" init_scope_depth="10" max_regs="5" max_scope_depth="11" max_stack="10" method_info="1">
|
||||
<exceptions/>
|
||||
<traits type="Traits">
|
||||
<traits/>
|
||||
</traits>
|
||||
</item>
|
||||
<item type="MethodBody" codeBytes="d030ef0137000047" init_scope_depth="10" max_regs="2" max_scope_depth="11" max_stack="1" method_info="2">
|
||||
<exceptions/>
|
||||
<traits type="Traits">
|
||||
<traits/>
|
||||
</traits>
|
||||
</item>
|
||||
<item type="MethodBody" codeBytes="d030ef01370000ef01380140ef01390245600b600b24012a63046123620408046122600b600b24002a63046125620408046124600bd04627018026d6d266282400ae2a1107000029d266292400ae120100004760176021662a600f2402a2a1d26628a36021662b600f2402a2a1d26629a346200275d7600b600bd32a63046123620408046122600b6021662ad26628d3a2a12402a3d26624d3a2a16124600b6021662bd26629d3a2a12402a3d26625d3a2a1612547" init_scope_depth="10" max_regs="5" max_scope_depth="11" max_stack="5" method_info="3">
|
||||
<exceptions/>
|
||||
<traits type="Traits">
|
||||
<traits/>
|
||||
</traits>
|
||||
</item>
|
||||
<item type="MethodBody" codeBytes="d030ef01370000ef01480100ef0139024eef013a034fef01490450ef014a0551ef014b0652ef014c0755d12410a625ff01a825ff01a3d12408a625ff01a825ff01a3d125ff01a825ff01a356038001d72f01d32400663ba22f02d32401663ba2a02f03d32402663ba2a075630460172402240160172f046204461f02a346200275630556008001630624007363071061000009d36207663b6205a2d2a275630862062f016208a262072400140800002401d2a1100200002400a02f026208a262072401140800002401d2a1100200002400a02f036208a262072402140800002401d2a1100200002400a0240024004f2c05c207620724031597ffff6206240024002400240124004f2c05620648" init_scope_depth="9" max_regs="9" max_scope_depth="10" max_stack="6" method_info="4">
|
||||
<exceptions/>
|
||||
<traits type="Traits">
|
||||
<traits/>
|
||||
</traits>
|
||||
</item>
|
||||
<item type="MethodBody" codeBytes="d030ef015b0020d0490060212c50612e60212c52612f5e0b5d114a1100610b600b66302c54600c4f1902600b66302c55600d4f19025d2d600b4f2d016014661b663c85d5d112160000600b5d32d14a32015d33275d344a34004a33024f310247" init_scope_depth="10" max_regs="2" max_scope_depth="11" max_stack="5" method_info="5">
|
||||
<exceptions/>
|
||||
<traits type="Traits">
|
||||
<traits/>
|
||||
</traits>
|
||||
</item>
|
||||
<item type="MethodBody" codeBytes="d0305e0f2404680f47" init_scope_depth="9" max_regs="1" max_scope_depth="10" max_stack="2" method_info="6">
|
||||
<exceptions/>
|
||||
<traits type="Traits">
|
||||
<traits/>
|
||||
</traits>
|
||||
</item>
|
||||
<item type="MethodBody" codeBytes="d0305d36600430600458011d683547" init_scope_depth="1" max_regs="1" max_scope_depth="3" max_stack="2" method_info="7">
|
||||
<exceptions/>
|
||||
<traits type="Traits">
|
||||
<traits/>
|
||||
</traits>
|
||||
</item>
|
||||
<item type="MethodBody" codeBytes="d030d0490047" init_scope_depth="4" max_regs="1" max_scope_depth="5" max_stack="1" method_info="8">
|
||||
<exceptions/>
|
||||
<traits type="Traits">
|
||||
<traits/>
|
||||
</traits>
|
||||
</item>
|
||||
<item type="MethodBody" codeBytes="d03047" init_scope_depth="3" max_regs="1" max_scope_depth="4" max_stack="1" method_info="9">
|
||||
<exceptions/>
|
||||
<traits type="Traits">
|
||||
<traits/>
|
||||
</traits>
|
||||
</item>
|
||||
</bodies>
|
||||
</abc>
|
||||
</item>
|
||||
<item type="SymbolClassTag" forceWriteAsLong="true">
|
||||
<tags>
|
||||
<item>0</item>
|
||||
</tags>
|
||||
<names>
|
||||
<item>PreviewHost</item>
|
||||
</names>
|
||||
</item>
|
||||
<item type="ShowFrameTag" forceWriteAsLong="false"/>
|
||||
</tags>
|
||||
</swf>
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# rebuilds public/item-preview.swf, the web item giver's den item preview
|
||||
# (public/item-preview.html plays it with Ruffle): PreviewHost.as compiled by
|
||||
# JPEXS (tools/ffdec, needs Java) into base.xml, a SWF of one frame holding
|
||||
# only code. JPEXS can only compile a class over one already there, so
|
||||
# base.xml has a PreviewHost (and an empty PreviewUnused, left from making it).
|
||||
#
|
||||
# tools/preview-host/build.sh [output.swf] (default: public/item-preview.swf)
|
||||
set -e
|
||||
cd "$(dirname "$(readlink -f "$0")")/../.."
|
||||
out=${1:-public/item-preview.swf}
|
||||
work=$(mktemp -d)
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
ffdec="java -jar tools/ffdec/ffdec-cli.jar"
|
||||
mkdir "$work/src"
|
||||
cp tools/preview-host/PreviewHost.as "$work/src/"
|
||||
$ffdec -xml2swf tools/preview-host/base.xml "$work/base.swf" > "$work/log" 2>&1
|
||||
$ffdec -importScript "$work/base.swf" "$work/host.swf" "$work/src" >> "$work/log" 2>&1
|
||||
$ffdec -abcclean "$work/host.swf" "$out" >> "$work/log" 2>&1 || { cat "$work/log"; exit 1; }
|
||||
echo "$out: $(wc -c < "$out") bytes"
|
||||
Reference in new issue
Block a user