mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
Compare commits
7
Commits
a8ab031616
...
6645bf66b3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6645bf66b3 | ||
|
|
43ae95fbca | ||
|
|
34db374527 | ||
|
|
3256135df3 | ||
|
|
9efb2558fc | ||
|
|
9720d309fa | ||
|
|
64eab1f8ad |
No files matched your search
@@ -3,12 +3,14 @@
|
||||
"ajcontent.akamaized.net",
|
||||
"burrow.moe",
|
||||
"cdn.jsdelivr.net",
|
||||
"discord.com",
|
||||
"challenges.cloudflare.com",
|
||||
"discord.com",
|
||||
"play.burrow.moe",
|
||||
"player.vimeo.com",
|
||||
"vision.googleapis.com",
|
||||
"www.cloudflare.com",
|
||||
"www.w3.org"
|
||||
"www.w3.org",
|
||||
"www.youtube-nocookie.com"
|
||||
],
|
||||
"swf": [
|
||||
"academy.animaljam.com",
|
||||
|
||||
@@ -168,7 +168,7 @@ 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 || "78",
|
||||
buildVersion: env.AJ_BUILD_VERSION || "82",
|
||||
// what the official CDN is asked for; not ours to change.
|
||||
upstreamBuildVersion: "3",
|
||||
|
||||
@@ -201,7 +201,7 @@ module.exports = {
|
||||
// are written into both pages. the emails and the host's country are
|
||||
// placeholders until set; the operator is, at the owner's word, said to
|
||||
// be in the EU without a name or a country.
|
||||
termsVersion: "2026-10-17",
|
||||
termsVersion: "2026-10-21",
|
||||
legalEmail: env.AJ_LEGAL_EMAIL || "[email protected]",
|
||||
adminEmail: env.AJ_ADMIN_EMAIL || "[email protected]",
|
||||
operator: env.AJ_OPERATOR || "an individual based in the European Union",
|
||||
|
||||
+3
-1
@@ -1104,7 +1104,9 @@ const handle = async (req, res) => {
|
||||
// not to be put in a frame of anyone's; the client shows it in a view of its own.
|
||||
res.setHeader("X-Frame-Options", "DENY");
|
||||
res.setHeader("Referrer-Policy", "no-referrer");
|
||||
send(res, 200, await fs.promises.readFile(path.join(config.publicDir, "game.html")), MIME[".html"]);
|
||||
// the admin's switch for the theatre browser (lib/panel.js), for the page to read
|
||||
send(res, 200, String(await fs.promises.readFile(path.join(config.publicDir, "game.html")))
|
||||
.replace("<html>", panel.theatreBrowserOn() ? '<html data-theatre-browser="on">' : "<html>"), MIME[".html"]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -896,10 +896,10 @@ const handle = async (req, res, url, from, web) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// a painting judged: for the roles that judge what players make, and
|
||||
// never their own or one by staff of their rank or above.
|
||||
// a painting judged: for the roles that judge paintings, and never
|
||||
// their own or one by staff of their rank or above.
|
||||
case "POST /mod/api/masterpiece": {
|
||||
if (!may("items.approve")) {
|
||||
if (!may("masterpieces.approve")) {
|
||||
return;
|
||||
}
|
||||
const id = String(body.id || "");
|
||||
|
||||
+14
-1
@@ -285,6 +285,12 @@ const ROOM_GROUP_NOTES = {
|
||||
adventures: "adventure maps; nothing in them moves",
|
||||
};
|
||||
|
||||
// the theatre's browser (experimental; the server's game.html and client
|
||||
// 1.3.3): off unless the admin turns it on. what players see in it never
|
||||
// reaches the server; this only says whether the game offers it.
|
||||
const THEATRE_BROWSER_SETTING = "theatreBrowser";
|
||||
const theatreBrowserOn = () => accounts.setting(THEATRE_BROWSER_SETTING) === "on";
|
||||
|
||||
const debugState = () => ({
|
||||
players: world.players().map(player => player.username).sort((a, b) => a.localeCompare(b)),
|
||||
rooms: defpacks.roomPaths().map(roomPath => {
|
||||
@@ -292,6 +298,7 @@ const debugState = () => ({
|
||||
return {path: roomPath, group, note: ROOM_NOTES[roomPath] || ROOM_GROUP_NOTES[group] || ""};
|
||||
}).sort((a, b) => a.path.localeCompare(b.path)),
|
||||
everythingOnSale: sales.everythingOnSale(),
|
||||
theatreBrowser: theatreBrowserOn(),
|
||||
});
|
||||
|
||||
const debugAct = body => {
|
||||
@@ -309,6 +316,12 @@ const debugAct = body => {
|
||||
? "Sale dates are off: every item shows, for players who start the game from now on."
|
||||
: "Sale dates are back on, for players who start the game from now on."};
|
||||
}
|
||||
if (body.action === "theatreBrowser") {
|
||||
accounts.setSetting(THEATRE_BROWSER_SETTING, body.on === true ? "on" : "off");
|
||||
return {ok: body.on === true
|
||||
? "The theatre browser is on, for players on client 1.3.3 or newer once their game page loads again."
|
||||
: "The theatre browser is off, once players' game pages load again."};
|
||||
}
|
||||
return {error: "Unknown debug action."};
|
||||
};
|
||||
|
||||
@@ -1160,4 +1173,4 @@ const handle = async (req, res, url, from, web) => {
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {load, handle, signedIn, PASSWORD_SETTING};
|
||||
module.exports = {load, handle, signedIn, theatreBrowserOn, PASSWORD_SETTING};
|
||||
+33
-2
@@ -29,6 +29,7 @@ const PERMISSIONS = {
|
||||
"player.names": "reject or accept a name, answer requests for a new one, clear a bio, remove a player's Jammer Wall posts",
|
||||
"address.ban": "ban the address a player last signed in from, or the computers they use, and lift those bans",
|
||||
"items.approve": "approve or turn away the items and pictures players make, when the admin has asked for that",
|
||||
"masterpieces.approve": "approve or remove the paintings players frame as masterpieces (the Masterpieces page)",
|
||||
"items.restrict": "stop a clothing item from being worn by selected animal types",
|
||||
"items.create": "make new items from the game's art, change and delete them, lock items out of the item finder and take items from players (!item, !lock, !unlock, !locked, !take)",
|
||||
"room.effects": "run temporary room-wide size and colour effects (!roomfx)",
|
||||
@@ -38,7 +39,7 @@ const PERMISSIONS = {
|
||||
};
|
||||
|
||||
const HELPER = ["server.view", "player.view", "staff.list", "player.warn", "player.goto", "chat.silence"];
|
||||
const MODERATOR = [...HELPER, "player.kick", "player.summon", "staff.invisible", "player.ban", "player.names", "address.ban", "items.approve", "items.restrict", "theater.control", "staff.log"];
|
||||
const MODERATOR = [...HELPER, "player.kick", "player.summon", "staff.invisible", "player.ban", "player.names", "address.ban", "items.approve", "masterpieces.approve", "items.restrict", "theater.control", "staff.log"];
|
||||
const ADMIN = [...MODERATOR, "server.announce", "items.create", "room.effects", "music.upload"];
|
||||
// a developer makes things, and moderates nobody.
|
||||
const DEVELOPER = ["server.view", "staff.list", "items.create", "room.effects", "theater.control"];
|
||||
@@ -119,6 +120,36 @@ const setRolePermissions = (role, list) => {
|
||||
return true;
|
||||
};
|
||||
|
||||
// masterpieces.approve was split from items.approve (2026-10-21), which
|
||||
// judged paintings before. once: a role list the admin changed, and a staff
|
||||
// member's own grants and denies, that held items.approve hold this too.
|
||||
const SPLIT_SETTING = "permissionSplitMasterpieces";
|
||||
const load = () => {
|
||||
if (accounts.setting(SPLIT_SETTING)) {
|
||||
return;
|
||||
}
|
||||
const withSplit = list => (Array.isArray(list) && list.includes("items.approve") && !list.includes("masterpieces.approve")
|
||||
? [...list, "masterpieces.approve"] : list);
|
||||
const changed = {...overrides()};
|
||||
for (const role of Object.keys(changed)) {
|
||||
changed[role] = withSplit(changed[role]);
|
||||
}
|
||||
accounts.setSetting(ROLE_SETTING, JSON.stringify(changed));
|
||||
roleOverrides = changed;
|
||||
for (const account of accounts.all()) {
|
||||
if (account.permGrants || account.permDenies) {
|
||||
const grants = withSplit(account.permGrants);
|
||||
const denies = withSplit(account.permDenies);
|
||||
if (grants !== account.permGrants || denies !== account.permDenies) {
|
||||
if (grants) account.permGrants = grants;
|
||||
if (denies) account.permDenies = denies;
|
||||
accounts.save(account);
|
||||
}
|
||||
}
|
||||
}
|
||||
accounts.setSetting(SPLIT_SETTING, "1");
|
||||
};
|
||||
|
||||
const permissionsOf = account => {
|
||||
const role = roleOf(account);
|
||||
if (!role) {
|
||||
@@ -170,5 +201,5 @@ const setRole = (account, role) => {
|
||||
return true;
|
||||
};
|
||||
|
||||
module.exports = {PERMISSIONS, ROLES, roleOf, rankOf, isActiveStaff, permissionsOf, rolePermissions, roleChanged, setRolePermissions,
|
||||
module.exports = {load, PERMISSIONS, ROLES, roleOf, rankOf, isActiveStaff, permissionsOf, rolePermissions, roleChanged, setRolePermissions,
|
||||
setAccountPermissions, can, outranks, setRole};
|
||||
+20
-1
@@ -144,6 +144,9 @@ const MAX_PATH_POINTS = 12;
|
||||
// created that avatar.
|
||||
const ACTION_NAME = /^:[A-Za-z][A-Za-z0-9]*:$/;
|
||||
const TYPED_NAME = /^[A-Za-z0-9][A-Za-z0-9 '.-]{0,19}$/; // an animal's or pet's name typed by its owner
|
||||
// a typed name the server's filter (lib/chat-filter.txt) stops. the game's
|
||||
// own names are word ids ("123|456"), which it never does.
|
||||
const nameFiltered = name => !String(name).includes("|") && Boolean(chatFilter.broken(String(name)));
|
||||
const MAX_BLOCKED = 1000; // from the account page; the game's own button has no limit
|
||||
const TYPED_CHAT_TYPES = ["0", "9"];
|
||||
const MAX_CHAT_EXTRA = 100; // the field after a chat line's type
|
||||
@@ -381,6 +384,17 @@ const login = (session, msg) => {
|
||||
existing.close();
|
||||
leaveWorld(existing);
|
||||
}
|
||||
// a name typed before the filter covered names, or one a newer rule
|
||||
// catches: the animal takes the username, the pet is "Pet".
|
||||
const filteredNames = [...account.avatars.filter(avatar => nameFiltered(avatar.name)),
|
||||
...account.pets.filter(pet => nameFiltered(pet.name))];
|
||||
if (filteredNames.length) {
|
||||
for (const thing of filteredNames) {
|
||||
console.log(`[filter] ${logText(account.username)}'s name "${logText(thing.name)}" cleared`);
|
||||
thing.name = account.avatars.includes(thing) ? account.username : "Pet";
|
||||
}
|
||||
accounts.save(account);
|
||||
}
|
||||
session.account = account;
|
||||
accounts.hold(account);
|
||||
account.numLogins++;
|
||||
@@ -1073,7 +1087,12 @@ const handlers = {
|
||||
const thing = kind === "a" ? account.avatars.find(avatar => avatar.perUserAvId === Number(id))
|
||||
: kind === "p" ? account.pets.find(pet => pet.inv === Number(id)) : null;
|
||||
// typed words others read: not while silenced.
|
||||
const ok = Boolean(thing) && TYPED_NAME.test(wanted) && !moderation.isSilenced(account);
|
||||
const filtered = Boolean(thing) && TYPED_NAME.test(wanted) && nameFiltered(wanted);
|
||||
const ok = Boolean(thing) && TYPED_NAME.test(wanted) && !filtered && !moderation.isSilenced(account);
|
||||
if (filtered) {
|
||||
console.log(`[filter] ${logText(session.name)} named ${kind === "a" ? "an animal" : "a pet"}: "${logText(wanted)}" (${logText(chatFilter.broken(wanted))})`);
|
||||
chatFilter.warn(session);
|
||||
}
|
||||
if (ok) {
|
||||
thing.name = wanted;
|
||||
accounts.save(account);
|
||||
|
||||
@@ -1091,6 +1091,12 @@
|
||||
<label class="check"><input id="debug-onsale" type="checkbox"> Everything on sale</label>
|
||||
<p class="status" id="debug-sale-status" role="status"></p>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Theatre browser (experimental)</h2>
|
||||
<label class="check"><input id="debug-theatre-browser" type="checkbox"> Players may open a web browser on the theatre screen</label>
|
||||
<p class="hint">For each player alone, on desktop client 1.3.3 or newer; nothing they see reaches the server. The client's browser is an old Chrome, so a bad site could harm a player's computer.</p>
|
||||
<p class="status" id="debug-browser-status" role="status"></p>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2609,6 +2615,7 @@
|
||||
$("debug-player").value = player;
|
||||
}
|
||||
$("debug-onsale").checked = data.everythingOnSale;
|
||||
$("debug-theatre-browser").checked = data.theatreBrowser;
|
||||
if (debugRooms.length !== data.rooms.length) {
|
||||
debugRooms = data.rooms;
|
||||
renderDebugRooms();
|
||||
@@ -2621,6 +2628,10 @@
|
||||
setStatus($("debug-status"), result.data.ok || result.data.error || "That did not work.", !result.ok);
|
||||
});
|
||||
$("debug-room").addEventListener("dblclick", () => $("debug-go").click());
|
||||
$("debug-theatre-browser").addEventListener("change", async () => {
|
||||
const result = await api("debug", {action: "theatreBrowser", on: $("debug-theatre-browser").checked});
|
||||
setStatus($("debug-browser-status"), result.data.ok || result.data.error || "That did not work.", !result.ok);
|
||||
});
|
||||
$("debug-onsale").addEventListener("change", async () => {
|
||||
const result = await api("debug", {action: "everythingOnSale", on: $("debug-onsale").checked});
|
||||
setStatus($("debug-sale-status"), result.data.ok || result.data.error || "That did not work.", !result.ok);
|
||||
|
||||
+244
-17
@@ -32,6 +32,11 @@
|
||||
#theatre[hidden], #theatre [hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
/* no ring around a button that was clicked (the desktop client's
|
||||
Chromium 87 still draws one); the keyboard's still shows */
|
||||
#theatre button:focus:not(:focus-visible) {
|
||||
outline: none;
|
||||
}
|
||||
/* the game draws over it just now (ajTheatreScreen) */
|
||||
#theatre .covered {
|
||||
visibility: hidden;
|
||||
@@ -55,8 +60,12 @@
|
||||
display: block;
|
||||
}
|
||||
/* in the game's own colours: cream panels, brown edges, a green "go" */
|
||||
#own-video-open {
|
||||
#theatre-pills {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
gap: calc(8 * var(--px));
|
||||
}
|
||||
.theatre-pill {
|
||||
pointer-events: auto;
|
||||
font: 700 calc(13 * var(--px)) / 1 "DigitalDelivery", Arial, sans-serif;
|
||||
color: #6d4330;
|
||||
@@ -68,14 +77,75 @@
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#own-video-open:hover {
|
||||
.theatre-pill:hover {
|
||||
background: linear-gradient(#fffef5, #fff0be);
|
||||
}
|
||||
#own-video-open:active {
|
||||
.theatre-pill:active {
|
||||
transform: translateY(calc(2 * var(--px)));
|
||||
box-shadow: none;
|
||||
}
|
||||
#own-video-box {
|
||||
/* the theatre browser's bar (experimental; the desktop client draws
|
||||
the page itself, over the screen) */
|
||||
#browser-bar {
|
||||
position: absolute;
|
||||
pointer-events: auto;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: calc(5 * var(--px));
|
||||
height: calc(30 * var(--px));
|
||||
padding: 0 calc(5 * var(--px));
|
||||
background: #fff2c4;
|
||||
border: calc(2 * var(--px)) solid #7f6744;
|
||||
border-radius: 999px;
|
||||
box-shadow: 0 calc(2 * var(--px)) 0 #7f6744;
|
||||
}
|
||||
.aj-round {
|
||||
flex: none;
|
||||
width: calc(22 * var(--px));
|
||||
height: calc(22 * var(--px));
|
||||
padding: 0;
|
||||
font: 700 calc(12 * var(--px)) / 1 Arial, sans-serif;
|
||||
color: #6d4330;
|
||||
background: linear-gradient(#fffbe6, #ffe39a);
|
||||
border: calc(2 * var(--px)) solid #7f6744;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
}
|
||||
.aj-round:hover {
|
||||
background: linear-gradient(#fffef5, #fff0be);
|
||||
}
|
||||
.aj-round:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: default;
|
||||
}
|
||||
#browser-address {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: calc(20 * var(--px));
|
||||
box-sizing: border-box;
|
||||
font: 400 calc(12 * var(--px)) / 1 Arial, Helvetica, sans-serif;
|
||||
color: #3d2716;
|
||||
background: #fff;
|
||||
border: calc(2 * var(--px)) solid #c9a86a;
|
||||
border-radius: 999px;
|
||||
padding: 0 calc(9 * var(--px));
|
||||
outline: none;
|
||||
}
|
||||
#browser-address:focus {
|
||||
border-color: #7f6744;
|
||||
}
|
||||
#browser-bar .aj-button {
|
||||
min-width: 0;
|
||||
font-size: calc(12 * var(--px));
|
||||
padding: calc(4 * var(--px)) calc(11 * var(--px));
|
||||
}
|
||||
#browser-close {
|
||||
background: radial-gradient(circle at 50% 35%, #ff7a5c, #c8321a 70%);
|
||||
border-color: #8e2b16;
|
||||
color: #fff;
|
||||
}
|
||||
.aj-box {
|
||||
position: absolute;
|
||||
pointer-events: auto;
|
||||
box-sizing: border-box;
|
||||
@@ -88,7 +158,7 @@
|
||||
border-radius: calc(18 * var(--px));
|
||||
box-shadow: inset 0 0 0 calc(2 * var(--px)) #ffe39a, 0 calc(4 * var(--px)) 0 rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
#own-video-box h2 {
|
||||
.aj-box h2 {
|
||||
margin: 0 calc(24 * var(--px)) calc(10 * var(--px)) 0;
|
||||
font-size: calc(20 * var(--px));
|
||||
font-weight: 700;
|
||||
@@ -96,7 +166,7 @@
|
||||
letter-spacing: 0.02em;
|
||||
text-shadow: 0 0 calc(2 * var(--px)) #6d4330, calc(1.5 * var(--px)) calc(1.5 * var(--px)) 0 #6d4330, calc(-1.5 * var(--px)) calc(1.5 * var(--px)) 0 #6d4330, calc(1.5 * var(--px)) calc(-1.5 * var(--px)) 0 #6d4330, calc(-1.5 * var(--px)) calc(-1.5 * var(--px)) 0 #6d4330;
|
||||
}
|
||||
#own-video-url {
|
||||
.aj-box input {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
font: 400 calc(13 * var(--px)) / 1.2 Arial, Helvetica, sans-serif;
|
||||
@@ -108,10 +178,10 @@
|
||||
box-shadow: inset 0 calc(2 * var(--px)) calc(3 * var(--px)) rgba(109, 67, 48, 0.25);
|
||||
outline: none;
|
||||
}
|
||||
#own-video-url:focus {
|
||||
.aj-box input:focus {
|
||||
border-color: #7f6744;
|
||||
}
|
||||
#own-video-url::placeholder {
|
||||
.aj-box input::placeholder {
|
||||
color: #a88f6a;
|
||||
}
|
||||
.own-video-buttons {
|
||||
@@ -149,7 +219,7 @@
|
||||
.aj-button.stop:hover {
|
||||
background: linear-gradient(#ffab7c, #e05634);
|
||||
}
|
||||
#own-video-close {
|
||||
.aj-box-close {
|
||||
position: absolute;
|
||||
top: calc(-10 * var(--px));
|
||||
right: calc(-10 * var(--px));
|
||||
@@ -164,10 +234,10 @@
|
||||
box-shadow: 0 0 0 calc(2 * var(--px)) #7f6744, 0 calc(2 * var(--px)) 0 calc(2 * var(--px)) rgba(0, 0, 0, 0.3);
|
||||
cursor: pointer;
|
||||
}
|
||||
#own-video-close:hover {
|
||||
.aj-box-close:hover {
|
||||
background: radial-gradient(circle at 50% 35%, #ff8f74, #d93d22 70%);
|
||||
}
|
||||
#own-video-said {
|
||||
.aj-box-said {
|
||||
min-height: calc(15 * var(--px));
|
||||
margin: calc(8 * var(--px)) 0 0;
|
||||
font: 400 calc(12 * var(--px)) / 1.25 Arial, Helvetica, sans-serif;
|
||||
@@ -179,16 +249,27 @@
|
||||
<div id="theatre" hidden>
|
||||
<iframe id="theatre-video" class="theatre-screen" title="Theatre video" allow="autoplay; encrypted-media" referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
<div id="own-video" class="theatre-screen" hidden></div>
|
||||
<button type="button" id="own-video-open">▶ Your Video</button>
|
||||
<form id="own-video-box" hidden>
|
||||
<div id="theatre-pills">
|
||||
<button type="button" id="own-video-open" class="theatre-pill">▶ Your Video</button>
|
||||
<button type="button" id="browser-open" class="theatre-pill" hidden title="Experimental: a web browser on the screen, for you alone">🌐 Browser</button>
|
||||
</div>
|
||||
<form id="browser-bar" hidden>
|
||||
<button type="button" id="browser-back" class="aj-round" aria-label="Back" disabled>◀</button>
|
||||
<button type="button" id="browser-forward" class="aj-round" aria-label="Forward" disabled>▶</button>
|
||||
<button type="button" id="browser-reload" class="aj-round" aria-label="Reload">↻</button>
|
||||
<input id="browser-address" type="text" placeholder="Search or type an address" autocomplete="off" spellcheck="false" aria-label="Address">
|
||||
<button type="submit" class="aj-button go">Go</button>
|
||||
<button type="button" id="browser-close" class="aj-round" aria-label="Close the browser">×</button>
|
||||
</form>
|
||||
<form id="own-video-box" class="aj-box" hidden>
|
||||
<h2>Your Video</h2>
|
||||
<button type="button" id="own-video-close" aria-label="Close">×</button>
|
||||
<button type="button" id="own-video-close" class="aj-box-close" aria-label="Close">×</button>
|
||||
<input id="own-video-url" type="url" placeholder="Paste a link: YouTube, Vimeo, .mp4, .webm, .mp3" autocomplete="off" spellcheck="false" aria-label="Video link">
|
||||
<div class="own-video-buttons">
|
||||
<button type="submit" class="aj-button go">Play</button>
|
||||
<button type="button" id="own-video-stop" class="aj-button stop">Stop</button>
|
||||
</div>
|
||||
<p id="own-video-said" role="status"></p>
|
||||
<p id="own-video-said" class="aj-box-said" role="status"></p>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
@@ -296,6 +377,7 @@
|
||||
theatreCover = theatreScreen && parts.length === 3 ? coverRects(Number(parts[1]), parts[2].split(",")) : [];
|
||||
placeTheatre();
|
||||
ownVideo.inTheatre(theatreScreen !== null);
|
||||
browserPage.inTheatre(theatreScreen !== null);
|
||||
}
|
||||
|
||||
// the covered cells as rectangles: runs along each row, and a run
|
||||
@@ -385,12 +467,22 @@
|
||||
// the button under the screen's left corner, or inside it when the
|
||||
// stage ends first; the box over the middle of the screen.
|
||||
const below = y + h + 8 + BUTTON_ROOM <= STAGE_H;
|
||||
place(document.getElementById("own-video-open"), x + 4, below ? y + h + 8 : y + h - BUTTON_ROOM);
|
||||
const barY = below ? y + h + 8 : y + h - BUTTON_ROOM;
|
||||
place(document.getElementById("theatre-pills"), x + 4, barY);
|
||||
const bar = document.getElementById("browser-bar");
|
||||
place(bar, x, barY);
|
||||
bar.style.width = `${w * scale}px`;
|
||||
place(document.getElementById("own-video-box"), x + (w - BOX_W) / 2, Math.max(4, y + (h - BOX_H) / 2));
|
||||
const clip = coverClip(scale);
|
||||
theatreVideo.style.clipPath = clip;
|
||||
document.getElementById("own-video").style.clipPath = clip;
|
||||
for (const id of ["own-video-open", "own-video-box"]) {
|
||||
// the browser is drawn by the desktop client: told where, in this
|
||||
// page's pixels, and above the bar when the bar is on the screen.
|
||||
browserPage.place({
|
||||
x: theatre.offsetLeft + x * scale, y: theatre.offsetTop + y * scale,
|
||||
w: w * scale, h: (below ? h : h - BUTTON_ROOM) * scale, clip,
|
||||
});
|
||||
for (const id of ["theatre-pills", "own-video-box", "browser-bar"]) {
|
||||
const element = document.getElementById(id);
|
||||
element.classList.toggle("covered", underCover(element, scale));
|
||||
}
|
||||
@@ -409,12 +501,14 @@
|
||||
theatreVideo.removeAttribute("src");
|
||||
theatreVideo.classList.remove("visible");
|
||||
ownVideo.roomVideo(false);
|
||||
browserPage.roomVideo(false);
|
||||
return;
|
||||
}
|
||||
theatreVideo.src = `https://www.youtube-nocookie.com/embed/${id}?autoplay=1&rel=0&modestbranding=1`;
|
||||
theatreVideo.classList.add("visible");
|
||||
// what staff play for the room comes first; the player's own waits.
|
||||
ownVideo.roomVideo(true);
|
||||
browserPage.roomVideo(true);
|
||||
}
|
||||
|
||||
// a video of the player's own choosing on the theatre screen, seen by
|
||||
@@ -517,6 +611,7 @@
|
||||
return;
|
||||
}
|
||||
stop();
|
||||
browserPage.close();
|
||||
if (found.frame) {
|
||||
playing = document.createElement("iframe");
|
||||
playing.title = "Your video";
|
||||
@@ -588,6 +683,11 @@
|
||||
});
|
||||
|
||||
return {
|
||||
// the browser takes the screen: the player's own video and its box go.
|
||||
giveWay() {
|
||||
stop();
|
||||
close();
|
||||
},
|
||||
// in a theatre or not; out of one, the video is gone.
|
||||
inTheatre(yes) {
|
||||
if (yes === here) {
|
||||
@@ -610,6 +710,133 @@
|
||||
};
|
||||
})();
|
||||
|
||||
// the theatre's browser (experimental): a web page on the screen, for
|
||||
// the player alone, when the admin has turned it on (the server marks
|
||||
// this page so: lib/panel.js). the desktop client (1.3.3) draws it in a
|
||||
// webview of its own over this page, which says where, what the game
|
||||
// draws over it, and where to go. nothing of it goes to the server; the page it shows sees nothing
|
||||
// of the game, nor this page of it but its address.
|
||||
const browserPage = (() => {
|
||||
const $ = id => document.getElementById(id);
|
||||
const opener = $("browser-open");
|
||||
const bar = $("browser-bar");
|
||||
const address = $("browser-address");
|
||||
const pills = $("theatre-pills");
|
||||
const START = "https://duckduckgo.com/";
|
||||
const serverAllows = document.documentElement.dataset.theatreBrowser === "on";
|
||||
let allowed = false; // and the client can
|
||||
let open = false;
|
||||
let roomPlaying = false;
|
||||
let where = null; // the last place told, without `shown`
|
||||
let told = "";
|
||||
|
||||
const tell = message => window.ipc.sendToHost("browser", message);
|
||||
const placeMessage = () => ({...where, shown: open && theatreScreen !== null && !roomPlaying});
|
||||
const sendPlace = () => {
|
||||
if (!open || !where) {
|
||||
return;
|
||||
}
|
||||
const message = placeMessage();
|
||||
const text = JSON.stringify(message);
|
||||
if (text !== told) {
|
||||
told = text;
|
||||
tell({action: "place", where: message});
|
||||
}
|
||||
};
|
||||
|
||||
// what was typed: an address (with or without https://), else a search.
|
||||
const addressFor = text => {
|
||||
const typed = String(text || "").trim();
|
||||
if (/^https?:\/\//i.test(typed)) {
|
||||
return typed;
|
||||
}
|
||||
if (/^[^\s/]+\.[a-z]{2,}(?:[/:?#]\S*)?$/i.test(typed)) {
|
||||
return `https://${typed}`;
|
||||
}
|
||||
return `https://duckduckgo.com/?q=${encodeURIComponent(typed)}`;
|
||||
};
|
||||
|
||||
const show = () => {
|
||||
opener.hidden = !allowed;
|
||||
pills.hidden = open;
|
||||
bar.hidden = !open;
|
||||
};
|
||||
|
||||
const close = () => {
|
||||
if (!open) {
|
||||
return;
|
||||
}
|
||||
open = false;
|
||||
told = "";
|
||||
tell({action: "close"});
|
||||
show();
|
||||
};
|
||||
|
||||
opener.addEventListener("click", () => {
|
||||
ownVideo.giveWay();
|
||||
open = true;
|
||||
show();
|
||||
placeTheatre();
|
||||
tell({action: "go", url: START, where: placeMessage()});
|
||||
address.value = "";
|
||||
address.focus();
|
||||
});
|
||||
$("browser-close").addEventListener("click", close);
|
||||
$("browser-back").addEventListener("click", () => tell({action: "back"}));
|
||||
$("browser-forward").addEventListener("click", () => tell({action: "forward"}));
|
||||
$("browser-reload").addEventListener("click", () => tell({action: "reload"}));
|
||||
bar.addEventListener("submit", event => {
|
||||
event.preventDefault();
|
||||
if (address.value.trim()) {
|
||||
tell({action: "go", url: addressFor(address.value)});
|
||||
address.blur();
|
||||
}
|
||||
});
|
||||
address.addEventListener("keydown", event => {
|
||||
if (event.key === "Escape") {
|
||||
address.blur();
|
||||
}
|
||||
});
|
||||
|
||||
// the desktop client says it can; an older one never does.
|
||||
window.ipc.on("browserSupported", (event, on) => {
|
||||
allowed = serverAllows && on === true;
|
||||
if (!allowed) {
|
||||
close();
|
||||
}
|
||||
show();
|
||||
});
|
||||
// where the browser is now, for the bar
|
||||
window.ipc.on("browserState", (event, state) => {
|
||||
if (!open || !state || typeof state !== "object") {
|
||||
return;
|
||||
}
|
||||
if (document.activeElement !== address) {
|
||||
address.value = String(state.url || "") === "about:blank" ? "" : String(state.url || "");
|
||||
}
|
||||
$("browser-back").disabled = state.back !== true;
|
||||
$("browser-forward").disabled = state.forward !== true;
|
||||
});
|
||||
|
||||
return {
|
||||
close,
|
||||
// from placeTheatre: {x, y, w, h, clip} in this page's pixels
|
||||
place(next) {
|
||||
where = next;
|
||||
sendPlace();
|
||||
},
|
||||
roomVideo(on) {
|
||||
roomPlaying = on;
|
||||
sendPlace();
|
||||
},
|
||||
inTheatre(yes) {
|
||||
if (!yes) {
|
||||
close();
|
||||
}
|
||||
},
|
||||
};
|
||||
})();
|
||||
|
||||
// The native theatre sign calls this through ExternalInterface. The
|
||||
// SWF performs its own permission check before showing the controls.
|
||||
function ajOpenTheatreControl() {
|
||||
|
||||
+3
-3
@@ -2057,8 +2057,8 @@
|
||||
// card, their name opens it)
|
||||
const paintingButtons = (painting, withPlayer) => {
|
||||
const buttons = el("div", undefined, "buttons");
|
||||
// judging paintings is for the roles that judge what players make
|
||||
if (permissions.has("items.approve")) {
|
||||
// judging paintings is for the roles that may (masterpieces.approve)
|
||||
if (permissions.has("masterpieces.approve")) {
|
||||
buttons.append(...(painting.status === "waiting" ? [button("Approve", () => judge(painting, true), "primary")] : []),
|
||||
button("Reject", () => judge(painting, false), "danger"));
|
||||
}
|
||||
@@ -3136,7 +3136,7 @@
|
||||
sub.hidden = !allowed.has(sub.dataset.needs);
|
||||
}
|
||||
// a role that does not judge paintings has approved none of them
|
||||
$("recent-mine").closest("label").hidden = !allowed.has("items.approve");
|
||||
$("recent-mine").closest("label").hidden = !allowed.has("masterpieces.approve");
|
||||
// the pages the role may see; the first of them when the one open is not.
|
||||
const pages = [...document.querySelectorAll("nav button")];
|
||||
for (const page of pages) {
|
||||
|
||||
+1
-1
@@ -242,7 +242,7 @@
|
||||
|
||||
<section>
|
||||
<h2>7. Children</h2>
|
||||
<p>Burrow is for people aged 13 and over, or the higher age at which the law of your country lets you agree to the use of your data on your own (up to 16 in parts of Europe). We do not knowingly collect data from anyone younger and we do not offer parental consent. If we learn that an account belongs to someone under that age we delete it. Parents and guardians can ask for this at {{legalEmail}}.</p>
|
||||
<p>Burrow is for people aged 16 and over. We do not knowingly collect data from anyone younger and we do not offer parental consent. If we learn that an account belongs to someone under that age we delete it. Parents and guardians can ask for this at {{legalEmail}}.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
@@ -203,7 +203,7 @@
|
||||
<label for="email">Recovery email <span class="hint">Used only to recover your password or 2FA</span></label>
|
||||
<input id="email" name="email" type="email" autocomplete="email" maxlength="254" required>
|
||||
<label class="agree"><input id="agreed" name="agreed" type="checkbox" required>
|
||||
<span>I am 13 or older, and old enough in my country to agree to this myself. I agree to the <a href="/terms" target="_blank" rel="noopener">Terms of Service</a> and the <a href="/privacy" target="_blank" rel="noopener">Privacy Policy</a>.</span></label>
|
||||
<span>I am 16 or older, and old enough in my country to agree to this myself. I agree to the <a href="/terms" target="_blank" rel="noopener">Terms of Service</a> and the <a href="/privacy" target="_blank" rel="noopener">Privacy Policy</a>.</span></label>
|
||||
<div class="captcha" id="captcha"></div>
|
||||
<button class="primary" id="submit" type="submit">Create account</button>
|
||||
</form>
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@
|
||||
<section>
|
||||
<h2>2. Who may play</h2>
|
||||
<ul>
|
||||
<li>You must be at least 13 years old.</li>
|
||||
<li>You must be at least 16 years old.</li>
|
||||
<li>If the law where you live sets a higher age for agreeing to the use of your personal data on your own (up to 16 in parts of Europe), you must be at least that age.</li>
|
||||
<li>Burrow is not directed at children and has no way to collect a parent's consent. If you are under the age above, do not create an account.</li>
|
||||
</ul>
|
||||
|
||||
@@ -8,6 +8,7 @@ const bans = require("./lib/bans.js");
|
||||
const devices = require("./lib/devices.js");
|
||||
const discord = require("./lib/discord.js");
|
||||
const discordBot = require("./lib/discordbot.js");
|
||||
const roles = require("./lib/roles.js");
|
||||
const chatlog = require("./lib/chatlog.js");
|
||||
const modlog = require("./lib/modlog.js");
|
||||
const retention = require("./lib/retention.js");
|
||||
@@ -54,6 +55,7 @@ const main = async () => {
|
||||
masterpieces.load();
|
||||
retention.load();
|
||||
stats.load(() => world.players().length);
|
||||
roles.load();
|
||||
panel.load();
|
||||
await http.start();
|
||||
await sfs.start(world);
|
||||
|
||||
+154
-37
@@ -46,6 +46,8 @@ package
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormat;
|
||||
import flash.events.UncaughtErrorEvent;
|
||||
import flash.filters.DropShadowFilter;
|
||||
import flash.filters.GlowFilter;
|
||||
import flash.external.ExternalInterface;
|
||||
import flash.system.Capabilities;
|
||||
import flash.system.LoaderContext;
|
||||
@@ -1103,54 +1105,127 @@ package
|
||||
{
|
||||
buildTheatreControl();
|
||||
}
|
||||
placeTheatreBox();
|
||||
_theatreControl.visible = true;
|
||||
setChildIndex(_theatreControl,numChildren - 1);
|
||||
gMainFrame.stage.focus = _theatreInput;
|
||||
_theatreInput.setSelection(0,_theatreInput.length);
|
||||
}
|
||||
|
||||
// the Room Video box over the middle of the theatre's screen, as the
|
||||
// page's Your Video box sits (game.html), or the stage's middle
|
||||
private function placeTheatreBox() : void
|
||||
{
|
||||
var _loc1_:DisplayObject = _theatreControl.getChildByName("box");
|
||||
var _loc2_:Object = RoomManagerWorld.instance != null ? RoomManagerWorld.instance.theaterWindow : null;
|
||||
var _loc3_:DisplayObject = _loc2_ != null && _loc2_.hasOwnProperty("videoLayer") ? _loc2_.videoLayer as DisplayObject : null;
|
||||
var _loc4_:Point = null;
|
||||
var _loc5_:Point = null;
|
||||
_loc1_.x = int((900 - THEATRE_BOX_W) * 0.5);
|
||||
_loc1_.y = int((550 - THEATRE_BOX_H) * 0.5);
|
||||
try
|
||||
{
|
||||
if(_loc3_ != null && shownOnStage(_loc3_))
|
||||
{
|
||||
_loc4_ = _theatreControl.globalToLocal(_loc3_.localToGlobal(new Point(0,0)));
|
||||
_loc5_ = _theatreControl.globalToLocal(_loc3_.localToGlobal(new Point(THEATRE_SCREEN_W,THEATRE_SCREEN_H)));
|
||||
_loc1_.x = int(_loc4_.x + (_loc5_.x - _loc4_.x - THEATRE_BOX_W) * 0.5);
|
||||
_loc1_.y = int(Math.max(4,_loc4_.y + (_loc5_.y - _loc4_.y - THEATRE_BOX_H) * 0.5));
|
||||
}
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// the staff's Room Video box, drawn as the page's Your Video box
|
||||
// (game.html .aj-box): a cream panel with a brown edge, a white title
|
||||
// outlined in brown, a white link box, green and red pill buttons and
|
||||
// a red round close button. behind it the whole stage, unseen, so a
|
||||
// click past it does nothing in the room.
|
||||
private static const THEATRE_BOX_W:int = 360;
|
||||
private static const THEATRE_BOX_H:int = 150;
|
||||
|
||||
private function buildTheatreControl() : void
|
||||
{
|
||||
_theatreControl = new Sprite();
|
||||
_theatreControl.graphics.beginFill(0,0.55);
|
||||
_theatreControl.graphics.beginFill(0,0);
|
||||
_theatreControl.graphics.drawRect(0,0,900,550);
|
||||
_theatreControl.graphics.endFill();
|
||||
var _loc1_:Sprite = new Sprite();
|
||||
_loc1_.x = 225;
|
||||
_loc1_.y = 170;
|
||||
_loc1_.graphics.lineStyle(2,0x7B4D24);
|
||||
_loc1_.graphics.beginFill(0x27221D);
|
||||
_loc1_.graphics.drawRoundRect(0,0,450,210,22,22);
|
||||
_loc1_.name = "box";
|
||||
_loc1_.graphics.beginFill(0,0.35);
|
||||
_loc1_.graphics.drawRoundRect(0,4,THEATRE_BOX_W,THEATRE_BOX_H,36,36);
|
||||
_loc1_.graphics.endFill();
|
||||
_loc1_.graphics.lineStyle(4,0x7F6744);
|
||||
_loc1_.graphics.beginFill(0xFFF2C4);
|
||||
_loc1_.graphics.drawRoundRect(0,0,THEATRE_BOX_W,THEATRE_BOX_H,36,36);
|
||||
_loc1_.graphics.endFill();
|
||||
_loc1_.graphics.lineStyle(2,0xFFE39A);
|
||||
_loc1_.graphics.drawRoundRect(3,3,THEATRE_BOX_W - 6,THEATRE_BOX_H - 6,30,30);
|
||||
_theatreControl.addChild(_loc1_);
|
||||
theatreCloseButton(_loc1_);
|
||||
var _loc2_:TextField = modText("THEATRE VIDEO",22,0xFFFFFF);
|
||||
_loc2_.x = 24;
|
||||
_loc2_.y = 22;
|
||||
var _loc2_:TextField = modText("Room Video",20,0xFFFFFF);
|
||||
_loc2_.filters = [new GlowFilter(0x6D4330,1,4,4,12)];
|
||||
_loc2_.x = 16;
|
||||
_loc2_.y = 12;
|
||||
_loc1_.addChild(_loc2_);
|
||||
var _loc3_:TextField = modText("Paste a YouTube link. Everyone in this theatre will see it.",12,0xD5C5AE,false);
|
||||
_loc3_.x = 24;
|
||||
_loc3_.y = 58;
|
||||
var _loc3_:TextField = modText("Everyone in this theatre sees it.",12,0x8A6A45,false);
|
||||
_loc3_.x = 17;
|
||||
_loc3_.y = 41;
|
||||
_loc1_.addChild(_loc3_);
|
||||
var _loc4_:Sprite = new Sprite();
|
||||
_loc4_.x = 24;
|
||||
_loc4_.y = 94;
|
||||
_loc4_.graphics.lineStyle(1,0x7B4D24);
|
||||
_loc4_.graphics.beginFill(0x111111);
|
||||
_loc4_.graphics.drawRoundRect(0,0,402,34,10,10);
|
||||
_loc4_.x = 16;
|
||||
_loc4_.y = 62;
|
||||
_loc4_.graphics.lineStyle(2,0xC9A86A);
|
||||
_loc4_.graphics.beginFill(0xFFFFFF);
|
||||
_loc4_.graphics.drawRoundRect(0,0,THEATRE_BOX_W - 32,30,18,18);
|
||||
_loc4_.graphics.endFill();
|
||||
_loc1_.addChild(_loc4_);
|
||||
var _loc5_:TextField = new TextField();
|
||||
_loc5_.selectable = false;
|
||||
_loc5_.mouseEnabled = false;
|
||||
_loc5_.defaultTextFormat = new TextFormat("Arial",13,0xA88F6A);
|
||||
_loc5_.text = "Paste a YouTube link";
|
||||
_loc5_.x = 9;
|
||||
_loc5_.y = 6;
|
||||
_loc5_.width = THEATRE_BOX_W - 50;
|
||||
_loc5_.height = 20;
|
||||
_loc4_.addChild(_loc5_);
|
||||
_theatreInput = new TextField();
|
||||
_theatreInput.type = "input";
|
||||
_theatreInput.embedFonts = hasGameFont();
|
||||
_theatreInput.defaultTextFormat = new TextFormat("CCDigitalDelivery",13,0xFFFFFF,false);
|
||||
_theatreInput.defaultTextFormat = new TextFormat("Arial",13,0x3D2716);
|
||||
_theatreInput.maxChars = 200;
|
||||
_theatreInput.x = 10;
|
||||
_theatreInput.y = 7;
|
||||
_theatreInput.width = 382;
|
||||
_theatreInput.height = 22;
|
||||
_theatreInput.x = 9;
|
||||
_theatreInput.y = 6;
|
||||
_theatreInput.width = THEATRE_BOX_W - 50;
|
||||
_theatreInput.height = 20;
|
||||
_loc4_.addChild(_theatreInput);
|
||||
theatreControlButton(_loc1_,"play","Play for room",24,150,186,0x357A45);
|
||||
theatreControlButton(_loc1_,"stop","Stop video",240,150,186,0x8E3D3D);
|
||||
_theatreInput.addEventListener("change",function(param1:Event):void
|
||||
{
|
||||
_loc5_.visible = _theatreInput.length == 0;
|
||||
});
|
||||
_theatreInput.addEventListener("keyDown",onTheatreKey,false,0,true);
|
||||
theatreControlButton(_loc1_,"play","Play for room",55,104,150,0xA6E05A,0x4FA52F,0x2F7420);
|
||||
theatreControlButton(_loc1_,"stop","Stop",215,104,90,0xF59A6A,0xD4482A,0x8E2B16);
|
||||
var _loc6_:Sprite = new Sprite();
|
||||
_loc6_.buttonMode = true;
|
||||
_loc6_.useHandCursor = true;
|
||||
_loc6_.graphics.beginFill(0x7F6744);
|
||||
_loc6_.graphics.drawCircle(0,0,17);
|
||||
_loc6_.graphics.beginFill(0xFFFFFF);
|
||||
_loc6_.graphics.drawCircle(0,0,15);
|
||||
_loc6_.graphics.beginFill(0xD9452A);
|
||||
_loc6_.graphics.drawCircle(0,0,12);
|
||||
_loc6_.graphics.endFill();
|
||||
_loc6_.graphics.lineStyle(2.5,0xFFFFFF);
|
||||
_loc6_.graphics.moveTo(-4.5,-4.5);
|
||||
_loc6_.graphics.lineTo(4.5,4.5);
|
||||
_loc6_.graphics.moveTo(4.5,-4.5);
|
||||
_loc6_.graphics.lineTo(-4.5,4.5);
|
||||
_loc6_.x = THEATRE_BOX_W - 5;
|
||||
_loc6_.y = 5;
|
||||
_loc6_.addEventListener("mouseDown",onTheatreClose,false,0,true);
|
||||
_loc1_.addChild(_loc6_);
|
||||
_theatreControl.addEventListener("mouseDown",onFinderMouse);
|
||||
_theatreControl.addEventListener("mouseUp",onFinderMouse);
|
||||
_theatreControl.addEventListener("click",onFinderMouse);
|
||||
@@ -1158,33 +1233,68 @@ package
|
||||
addChild(_theatreControl);
|
||||
}
|
||||
|
||||
private function theatreControlButton(param1:Sprite, param2:String, param3:String, param4:Number, param5:Number, param6:Number, param7:uint) : void
|
||||
// a pill button of the page's .aj-button: a gradient from `param6` to
|
||||
// `param7` with a `param8` edge and a step of it underneath
|
||||
private function theatreControlButton(param1:Sprite, param2:String, param3:String, param4:Number, param5:Number, param6:Number, param7:uint, param8:uint, param9:uint) : void
|
||||
{
|
||||
var _loc1_:Sprite = new Sprite();
|
||||
var _loc2_:Matrix = new Matrix();
|
||||
_loc1_.name = param2;
|
||||
_loc1_.x = param4;
|
||||
_loc1_.y = param5;
|
||||
_loc1_.buttonMode = true;
|
||||
_loc1_.useHandCursor = true;
|
||||
_loc1_.mouseChildren = false;
|
||||
paintFlatButton(_loc1_,param6,param7);
|
||||
var _loc2_:TextField = modText(param3,14,0xFFFFFF);
|
||||
_loc2_.name = "label";
|
||||
_loc1_.addChild(_loc2_);
|
||||
paintFlatButton(_loc1_,param6,param7);
|
||||
_loc2_.createGradientBox(param6,32,Math.PI / 2);
|
||||
_loc1_.graphics.beginFill(param9);
|
||||
_loc1_.graphics.drawRoundRect(0,2,param6,32,32,32);
|
||||
_loc1_.graphics.endFill();
|
||||
_loc1_.graphics.lineStyle(2,param9);
|
||||
_loc1_.graphics.beginGradientFill("linear",[param7,param8],[1,1],[0,255],_loc2_);
|
||||
_loc1_.graphics.drawRoundRect(0,0,param6,32,32,32);
|
||||
_loc1_.graphics.endFill();
|
||||
_loc1_.graphics.lineStyle(2,0xFFFFFF,0.45);
|
||||
_loc1_.graphics.moveTo(14,3);
|
||||
_loc1_.graphics.lineTo(param6 - 14,3);
|
||||
var _loc3_:TextField = modText(param3,15,0xFFFFFF);
|
||||
_loc3_.filters = [new DropShadowFilter(1.5,90,0,0.45,0,0,1)];
|
||||
_loc3_.x = int((param6 - _loc3_.width) * 0.5);
|
||||
_loc3_.y = int((32 - _loc3_.height) * 0.5);
|
||||
_loc1_.addChild(_loc3_);
|
||||
_loc1_.addEventListener("mouseDown",onTheatreControl,false,0,true);
|
||||
_loc1_.addEventListener("mouseOver",onFlatHover);
|
||||
_loc1_.addEventListener("mouseOut",onFlatHover);
|
||||
param1.addChild(_loc1_);
|
||||
}
|
||||
|
||||
// Enter plays, Escape closes, as in the page's box
|
||||
private function onTheatreKey(param1:KeyboardEvent) : void
|
||||
{
|
||||
if(param1.keyCode == 13)
|
||||
{
|
||||
sendTheatreVideo("play");
|
||||
}
|
||||
else if(param1.keyCode == 27)
|
||||
{
|
||||
_theatreControl.visible = false;
|
||||
gMainFrame.stage.focus = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onTheatreControl(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
var _loc1_:String = Sprite(param1.currentTarget).name;
|
||||
if(_loc1 == "play" && _theatreInput.text.replace(/^\s+|\s+$/g,"").length == 0)
|
||||
sendTheatreVideo(Sprite(param1.currentTarget).name);
|
||||
}
|
||||
|
||||
private function sendTheatreVideo(param1:String) : void
|
||||
{
|
||||
if(param1 == "play" && _theatreInput.text.replace(/^\s+|\s+$/g,"").length == 0)
|
||||
{
|
||||
gMainFrame.stage.focus = _theatreInput;
|
||||
return;
|
||||
}
|
||||
gMainFrame.server.setXtObject_Str("xtv",[_loc1,_loc1 == "play" ? _theatreInput.text.split("%").join("") : ""]);
|
||||
gMainFrame.server.setXtObject_Str("xtv",[param1,param1 == "play" ? _theatreInput.text.split("%").join("") : ""]);
|
||||
_theatreControl.visible = false;
|
||||
gMainFrame.stage.focus = null;
|
||||
}
|
||||
@@ -2231,7 +2341,7 @@ package
|
||||
// what the player is to see of something another player wrote: the
|
||||
// text as it was, the text with stars over the filtered words, or
|
||||
// null when it is to be left out altogether.
|
||||
public static function filterText(param1:String) : String
|
||||
public static function filterText(param1:String, param2:Boolean = false) : String
|
||||
{
|
||||
var _loc2_:Array = _filterOwnEntries;
|
||||
var _loc3_:Array = [];
|
||||
@@ -2301,7 +2411,14 @@ package
|
||||
{
|
||||
return param1;
|
||||
}
|
||||
return filterMode == 1 ? null : _loc12_.join("");
|
||||
return filterMode == 1 && !param2 ? null : _loc12_.join("");
|
||||
}
|
||||
|
||||
// an animal's or a pet's typed name: a name cannot be left out, so its
|
||||
// filtered words are starred whichever the player chose.
|
||||
public static function filterName(param1:String) : String
|
||||
{
|
||||
return filterText(param1,true);
|
||||
}
|
||||
|
||||
// the same for text that has a place of its own (a Jam-A-Gram, a wall
|
||||
|
||||
@@ -2095,7 +2095,7 @@ package avatar
|
||||
_splash.showShadow(false);
|
||||
}
|
||||
_currPetName = LocalizationManager.translatePetName(param5);
|
||||
_namebar.setAvName(_currPetName);
|
||||
setPetFormName();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2152,7 +2152,7 @@ package avatar
|
||||
{
|
||||
_splash.showShadow(false);
|
||||
}
|
||||
_namebar.setAvName(_currPetName);
|
||||
setPetFormName();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2171,6 +2171,21 @@ package avatar
|
||||
return _shouldShowPetOnly;
|
||||
}
|
||||
|
||||
// the name over the pet in its form, as the settings menu's Usernames /
|
||||
// Animal Names switch says: the player's username (the default), or
|
||||
// the pet's name
|
||||
private function setPetFormName() : void
|
||||
{
|
||||
if(Utility.isSettingOn(MySettings.SETTINGS_USERNAME_BADGE))
|
||||
{
|
||||
_namebar.setAvName(_avatar,true,gMainFrame.userInfo.getUserInfoByUserName(_avatar.userName));
|
||||
}
|
||||
else
|
||||
{
|
||||
_namebar.setAvName(_currPetName ? _currPetName : _avatar.avName);
|
||||
}
|
||||
}
|
||||
|
||||
// chat balloons and emotes sit over the pet in its form, as the
|
||||
// party's do (AvatarUtility's pet offsets)
|
||||
private function placeChatBalloon() : void
|
||||
@@ -2687,7 +2702,11 @@ package avatar
|
||||
|
||||
public function updateNameBarName() : void
|
||||
{
|
||||
if(_namebar)
|
||||
if(_namebar && _shouldShowPetOnly)
|
||||
{
|
||||
setPetFormName();
|
||||
}
|
||||
else if(_namebar)
|
||||
{
|
||||
_namebar.setAvName(_avatar,Utility.isSettingOn(MySettings.SETTINGS_USERNAME_BADGE),gMainFrame.userInfo.getUserInfoByUserName(_avatar.userName));
|
||||
}
|
||||
@@ -2714,9 +2733,9 @@ package avatar
|
||||
{
|
||||
_namebar.setColorAndBadge(0);
|
||||
_namebar.setColorBadgeAndXp(0,0,_isMember);
|
||||
if(_shouldShowPetOnly && _currPetName)
|
||||
if(_shouldShowPetOnly)
|
||||
{
|
||||
_namebar.setAvName(_currPetName);
|
||||
setPetFormName();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,1000 @@
|
||||
package localization
|
||||
{
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import flash.events.Event;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormat;
|
||||
|
||||
public class LocalizationManager
|
||||
{
|
||||
|
||||
public static var LANG_ENG:int = 0;
|
||||
|
||||
public static var LANG_SPA:int = 1;
|
||||
|
||||
public static var LANG_POR:int = 2;
|
||||
|
||||
public static var LANG_FRE:int = 3;
|
||||
|
||||
public static var LANG_DE:int = 4;
|
||||
|
||||
public static var LANG_BLANK:int = 5;
|
||||
|
||||
public static var accountLanguage:int;
|
||||
|
||||
public static const ADVENTURE_CONFIRMEXIT:int = 10683;
|
||||
|
||||
public static const NEW_JAMMER_USERNAME:int = 11098;
|
||||
|
||||
public static const GEM_CAPITALIZED:int = 11114;
|
||||
|
||||
public static const GEM_EXCLAMATION:int = 11433;
|
||||
|
||||
public static const TICKET_CAPITALIZED:int = 11115;
|
||||
|
||||
public static const DIAMOND_CAPITALIZED:int = 11116;
|
||||
|
||||
public static const CRYSTAL_CAPITALIZED:int = 11104;
|
||||
|
||||
public static const GEMS_CAPITALIZED:int = 11097;
|
||||
|
||||
public static const GEMS_EXCLAMATION:int = 11432;
|
||||
|
||||
public static const TICKETS_CAPITALIZED:int = 11102;
|
||||
|
||||
public static const DIAMONDS_CAPITALIZED:int = 11103;
|
||||
|
||||
public static const CRYSTALS_CAPITALIZED:int = 11117;
|
||||
|
||||
public static const MEMBERS:int = 11376;
|
||||
|
||||
public static const UNUSABLE_PASSWORDS:int = 21913;
|
||||
|
||||
private static var _staticLocalizations:Object;
|
||||
|
||||
private static var _preferredLocalizations:Object;
|
||||
|
||||
private static var _currentLanguage:int;
|
||||
|
||||
private static var _hasLocalizations:Boolean;
|
||||
|
||||
private static var _countryCode:String;
|
||||
|
||||
public function LocalizationManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function setLocalizations(param1:Object, param2:Function) : void
|
||||
{
|
||||
_staticLocalizations = param1;
|
||||
_hasLocalizations = true;
|
||||
if(param2 != null)
|
||||
{
|
||||
param2();
|
||||
}
|
||||
}
|
||||
|
||||
public static function setPreferredLocalizations(param1:Object) : void
|
||||
{
|
||||
_preferredLocalizations = param1;
|
||||
}
|
||||
|
||||
public static function getLanguageIdForLocale(param1:String) : int
|
||||
{
|
||||
var _loc2_:String = param1;
|
||||
if(param1.indexOf("-") != -1)
|
||||
{
|
||||
_loc2_ = param1.substr(0,param1.indexOf("-"));
|
||||
}
|
||||
switch(_loc2_)
|
||||
{
|
||||
case "en":
|
||||
case "eng":
|
||||
return LANG_ENG;
|
||||
case "es":
|
||||
case "spa":
|
||||
return LANG_SPA;
|
||||
case "pt":
|
||||
case "por":
|
||||
return LANG_POR;
|
||||
case "fr":
|
||||
case "fra":
|
||||
case "fre":
|
||||
break;
|
||||
case "de":
|
||||
case "deu":
|
||||
case "ger":
|
||||
return LANG_DE;
|
||||
default:
|
||||
DebugUtility.debugTrace("WARNING - Unknown locale:" + param1 + " - returning -1");
|
||||
return -1;
|
||||
}
|
||||
return LANG_FRE;
|
||||
}
|
||||
|
||||
public static function get localeForSorting() : String
|
||||
{
|
||||
switch(_currentLanguage)
|
||||
{
|
||||
case LANG_ENG:
|
||||
return "en-US";
|
||||
case LANG_DE:
|
||||
return "de-DE@collation=phonebook";
|
||||
case LANG_FRE:
|
||||
return "fr-FR";
|
||||
case LANG_POR:
|
||||
return "pt-BR";
|
||||
case LANG_SPA:
|
||||
return "es-ES";
|
||||
default:
|
||||
return "i-default";
|
||||
}
|
||||
}
|
||||
|
||||
public static function get localeForNumberFormatting() : String
|
||||
{
|
||||
switch(_currentLanguage)
|
||||
{
|
||||
case LANG_ENG:
|
||||
return "en-US";
|
||||
case LANG_DE:
|
||||
return "de-DE";
|
||||
case LANG_FRE:
|
||||
return "fr-FR";
|
||||
case LANG_POR:
|
||||
return "pt-BR";
|
||||
case LANG_SPA:
|
||||
return "es-ES";
|
||||
default:
|
||||
return "i-default";
|
||||
}
|
||||
}
|
||||
|
||||
public static function set countryCode(param1:String) : void
|
||||
{
|
||||
_countryCode = param1;
|
||||
}
|
||||
|
||||
public static function get hasLocalizations() : Boolean
|
||||
{
|
||||
return _hasLocalizations;
|
||||
}
|
||||
|
||||
public static function set hasLocalizations(param1:Boolean) : void
|
||||
{
|
||||
_hasLocalizations = param1;
|
||||
}
|
||||
|
||||
public static function get currentLanguage() : int
|
||||
{
|
||||
return _currentLanguage;
|
||||
}
|
||||
|
||||
public static function set currentLanguage(param1:int) : void
|
||||
{
|
||||
_currentLanguage = param1;
|
||||
}
|
||||
|
||||
public static function numberOfWordsInString() : int
|
||||
{
|
||||
var _loc4_:Array = null;
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
for each(var _loc1_:String in _staticLocalizations)
|
||||
{
|
||||
_loc4_ = _loc1_.split(" ");
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc4_.length)
|
||||
{
|
||||
if(_loc4_[_loc3_] != "" && _loc4_[_loc3_] != " " && _loc4_[_loc3_] != "\n" && _loc4_[_loc3_] != "\r" && _loc4_[_loc3_] != "\r\n")
|
||||
{
|
||||
_loc2_++;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public static function onLocalizationEvent(param1:Event) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
findAllTextfields(param1.target);
|
||||
}
|
||||
|
||||
public static function translateIdOnly(param1:int) : String
|
||||
{
|
||||
if(_staticLocalizations[param1])
|
||||
{
|
||||
return _staticLocalizations[param1];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static function translatePreferredIdOnly(param1:int) : String
|
||||
{
|
||||
if(_preferredLocalizations[param1])
|
||||
{
|
||||
return _preferredLocalizations[param1];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static function translateId(param1:TextField, param2:int, param3:Boolean = false, param4:Boolean = true) : void
|
||||
{
|
||||
var _loc5_:String = translateIdOnly(param2);
|
||||
if(_loc5_ != "")
|
||||
{
|
||||
updateToFit(param1,_loc5_,param3,false,param4);
|
||||
return;
|
||||
}
|
||||
throw new Error("Error translating string with id = " + param2);
|
||||
}
|
||||
|
||||
public static function translateIdAndInsertOnly(param1:int, ... rest) : String
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
var _loc5_:String = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc4_:String = translateIdOnly(param1);
|
||||
if(_loc4_ != "" && rest.length > 0)
|
||||
{
|
||||
_loc3_ = _loc4_.split("%s");
|
||||
if(_loc3_.length - 1 != rest.length)
|
||||
{
|
||||
DebugUtility.debugTrace("Num splits does not match num args. Id = " + param1 + " Num splits in translation = " + (_loc3_.length - 1) + " and args length = " + rest.length);
|
||||
return "";
|
||||
}
|
||||
_loc5_ = "";
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc3_.length)
|
||||
{
|
||||
if(_loc6_ < rest.length)
|
||||
{
|
||||
_loc5_ += _loc3_[_loc6_] + rest[_loc6_];
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_ += _loc3_[_loc6_];
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
return _loc5_;
|
||||
}
|
||||
throw new Error("Error translating string with id = " + param1 + " and args length = " + rest.length);
|
||||
}
|
||||
|
||||
public static function translateIdAndInsert(param1:TextField, param2:int, ... rest) : void
|
||||
{
|
||||
var _loc4_:Array = null;
|
||||
var _loc6_:String = null;
|
||||
var _loc7_:int = 0;
|
||||
var _loc5_:String = translateIdOnly(param2);
|
||||
if(_loc5_ != "" && rest.length > 0)
|
||||
{
|
||||
_loc4_ = _loc5_.split("%s");
|
||||
if(_loc4_.length - 1 != rest.length)
|
||||
{
|
||||
throw new Error("Num splits does not match num args. Id = " + param2 + " Num splits in translation = " + (_loc4_.length - 1) + " and args length = " + rest.length);
|
||||
}
|
||||
_loc6_ = "";
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc4_.length)
|
||||
{
|
||||
if(_loc7_ < rest.length)
|
||||
{
|
||||
_loc6_ += _loc4_[_loc7_] + rest[_loc7_];
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc6_ += _loc4_[_loc7_];
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
updateToFit(param1,_loc6_);
|
||||
return;
|
||||
}
|
||||
throw new Error("Error translating string with id = " + param2 + " and args length = " + rest.length);
|
||||
}
|
||||
|
||||
public static function updateToFit(param1:TextField, param2:String, param3:Boolean = false, param4:Boolean = false, param5:Boolean = true, param6:Boolean = false) : void
|
||||
{
|
||||
var _loc8_:Array = null;
|
||||
var _loc34_:String = null;
|
||||
var _loc16_:String = null;
|
||||
var _loc13_:Object = null;
|
||||
var _loc40_:Number = NaN;
|
||||
var _loc24_:TextFormat = null;
|
||||
var _loc39_:Object = null;
|
||||
var _loc31_:int = 0;
|
||||
var _loc32_:Boolean = false;
|
||||
var _loc7_:Number = NaN;
|
||||
var _loc18_:Number = NaN;
|
||||
var _loc25_:int = 0;
|
||||
var _loc28_:String = null;
|
||||
var _loc14_:String = null;
|
||||
var _loc19_:Array = null;
|
||||
var _loc10_:int = 0;
|
||||
var _loc11_:int = 0;
|
||||
var _loc21_:int = 0;
|
||||
var _loc36_:int = 0;
|
||||
var _loc35_:TextField = null;
|
||||
var _loc33_:int = 0;
|
||||
var _loc15_:String = null;
|
||||
var _loc37_:String = null;
|
||||
var _loc20_:int = 0;
|
||||
var _loc22_:String = null;
|
||||
var _loc17_:int = 0;
|
||||
var _loc38_:Number = NaN;
|
||||
var _loc29_:Number = NaN;
|
||||
var _loc26_:Number = NaN;
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param4)
|
||||
{
|
||||
_loc34_ = param2.match(/<a href='.*'>/g)[0];
|
||||
_loc16_ = param2.match(/(?<=<u>).*?(?=<\/u>)/g)[0];
|
||||
param1.text = _loc16_ != null ? _loc16_ : param2;
|
||||
param1.htmlText = param2;
|
||||
}
|
||||
else if(param3)
|
||||
{
|
||||
_loc13_ = {};
|
||||
_loc13_.array = _loc8_;
|
||||
_loc13_.text = param2;
|
||||
findSpecialTagPositions(_loc13_);
|
||||
_loc8_ = _loc13_.array;
|
||||
param2 = _loc13_.text;
|
||||
param1.text = param2;
|
||||
}
|
||||
else
|
||||
{
|
||||
param1.text = param2;
|
||||
}
|
||||
var _loc9_:Boolean = param1.multiline && param2.split(/\s/g).length < 2;
|
||||
if(_loc9_)
|
||||
{
|
||||
param1.multiline = false;
|
||||
param1.wordWrap = false;
|
||||
}
|
||||
var _loc30_:TextFormat = param1.getTextFormat();
|
||||
if(param1.text.charAt(0) == "#" || param1.name == "text01_chatHistory")
|
||||
{
|
||||
param5 = false;
|
||||
}
|
||||
if(param5)
|
||||
{
|
||||
if(param1.borderColor != 0 && !param1.border)
|
||||
{
|
||||
if(param1.borderColor > 16711680)
|
||||
{
|
||||
param1.y = 0 - ((2147483647 - param1.borderColor & 0xFFFF) + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
param1.y = param1.borderColor;
|
||||
}
|
||||
if(param1.y == 1)
|
||||
{
|
||||
param1.y = 0;
|
||||
}
|
||||
}
|
||||
_loc40_ = param1.y;
|
||||
param1.borderColor = _loc40_ != 0 ? _loc40_ : _loc40_ + 1;
|
||||
}
|
||||
if(param1.backgroundColor != 16777215)
|
||||
{
|
||||
_loc30_.size = param1.backgroundColor;
|
||||
}
|
||||
else if(_loc30_.size != null)
|
||||
{
|
||||
param1.backgroundColor = uint(_loc30_.size);
|
||||
}
|
||||
param1.styleSheet = null;
|
||||
param1.setTextFormat(_loc30_);
|
||||
var _loc23_:Number = param1.rotation;
|
||||
if(_loc23_ != 0)
|
||||
{
|
||||
param1.rotation = 0;
|
||||
}
|
||||
var _loc12_:TextField = param1.parent[param1.name + "Multiline"];
|
||||
var _loc27_:Boolean = hasBrokenWord(param1,param2);
|
||||
if(param1.textWidth >= param1.width - 4 && param1.maxScrollV <= param1.scrollV || param1.textHeight > param1.height - 4 || _loc27_)
|
||||
{
|
||||
_loc7_ = param1.textHeight;
|
||||
_loc18_ = Number(_loc30_.size);
|
||||
if(!param1.multiline)
|
||||
{
|
||||
if(_loc12_)
|
||||
{
|
||||
_loc25_ = _loc18_ * 0.8;
|
||||
}
|
||||
if(param6)
|
||||
{
|
||||
_loc30_.size = _loc18_;
|
||||
param1.setTextFormat(_loc30_);
|
||||
updateToFit(param1,param2.substr(0,param2.length - 4) + "...",param3,param4,param5,param6);
|
||||
return;
|
||||
}
|
||||
while(Number(_loc30_.size) > 5 && param1.textWidth > param1.width - 4)
|
||||
{
|
||||
_loc30_.size = Number(_loc30_.size) - 1;
|
||||
param1.setTextFormat(_loc30_);
|
||||
if(_loc12_ && Number(_loc30_.size) < _loc25_)
|
||||
{
|
||||
updateToFit(_loc12_,param2,param3,param4,param5);
|
||||
param1.visible = false;
|
||||
return;
|
||||
}
|
||||
if(param3 && _loc8_ != null)
|
||||
{
|
||||
_loc31_ = 0;
|
||||
while(_loc31_ < _loc8_.length)
|
||||
{
|
||||
_loc39_ = _loc8_[_loc31_];
|
||||
_loc24_ = new TextFormat("CCDigitalDelivery",_loc39_.bold ? _loc30_.size + 2 : _loc30_.size,_loc39_.color == "" ? _loc30_.color : _loc39_.color,_loc39_.bold,null,_loc39_.underline);
|
||||
param1.setTextFormat(_loc24_,_loc39_.startIndex,_loc39_.endIndex);
|
||||
_loc31_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(param1.multiline)
|
||||
{
|
||||
param2 = param2.replace(/\r\n|\r/gm,"\n");
|
||||
while(Number(_loc30_.size) > 5 && (param1.textWidth > param1.width && !isDifference99PercentOrGreater(param1.width,param1.textWidth,_loc8_ != null) || param1.textHeight > param1.height - 4 && !isDifference99PercentOrGreater(param1.height - 4,param1.textHeight,_loc8_ != null) || _loc35_ != null && _loc35_.numLines > 1 && !isLastLetterAReturn(_loc35_.text) || _loc27_))
|
||||
{
|
||||
_loc28_ = param2;
|
||||
_loc19_ = [];
|
||||
_loc10_ = 0;
|
||||
_loc11_ = 0;
|
||||
_loc21_ = 0;
|
||||
_loc36_ = 0;
|
||||
_loc35_ = new TextField();
|
||||
_loc35_.defaultTextFormat = param1.defaultTextFormat;
|
||||
_loc35_.width = param1.width;
|
||||
_loc35_.height = param1.height;
|
||||
_loc35_.setTextFormat(_loc30_);
|
||||
_loc35_.antiAliasType = param1.antiAliasType;
|
||||
_loc35_.embedFonts = param1.embedFonts;
|
||||
_loc35_.gridFitType = param1.gridFitType;
|
||||
_loc35_.maxChars = param1.maxChars;
|
||||
_loc35_.wordWrap = param1.wordWrap;
|
||||
_loc35_.multiline = param1.multiline;
|
||||
_loc33_ = 0;
|
||||
while(_loc33_ < _loc28_.length)
|
||||
{
|
||||
_loc14_ = _loc28_.charAt(_loc33_);
|
||||
if(_loc33_ + 1 == _loc28_.length)
|
||||
{
|
||||
_loc35_.appendText(_loc14_);
|
||||
_loc35_.setTextFormat(_loc30_);
|
||||
_loc19_[_loc10_] = _loc35_.text;
|
||||
}
|
||||
else if(_loc35_.textWidth > _loc35_.width && !isDifference99PercentOrGreater(_loc35_.width,_loc35_.textWidth,_loc8_ != null) || _loc35_.textHeight > _loc35_.height - 4 && !isDifference99PercentOrGreater(_loc35_.height - 4,_loc35_.textHeight,_loc8_ != null) || _loc35_.numLines > 1 && !isLastLetterAReturn(_loc35_.text))
|
||||
{
|
||||
if(_loc14_ == " " || _loc14_ == "\n" || _loc14_ == "\r")
|
||||
{
|
||||
_loc35_.appendText(_loc14_);
|
||||
_loc19_[_loc10_] = _loc35_.text;
|
||||
_loc21_ = _loc11_ = _loc33_ + 1;
|
||||
_loc10_++;
|
||||
_loc35_.text = "";
|
||||
_loc35_.setTextFormat(_loc30_);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_loc11_ == _loc21_)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc15_ = _loc35_.text.substring(0,_loc36_);
|
||||
if(shouldAddSpace(_loc15_))
|
||||
{
|
||||
_loc19_[_loc10_] = _loc15_ + " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc19_[_loc10_] = _loc15_;
|
||||
}
|
||||
_loc11_ = _loc21_;
|
||||
_loc10_++;
|
||||
_loc35_.text = "";
|
||||
_loc35_.setTextFormat(_loc30_);
|
||||
_loc33_ = _loc21_ - 1;
|
||||
}
|
||||
}
|
||||
else if(_loc14_ == " " || _loc14_ == "-")
|
||||
{
|
||||
_loc35_.appendText(_loc14_);
|
||||
_loc21_ = _loc33_ + 1;
|
||||
_loc36_ = _loc35_.length;
|
||||
_loc35_.setTextFormat(_loc30_);
|
||||
}
|
||||
else if(_loc14_ == "\n" || _loc14_ == "\r")
|
||||
{
|
||||
_loc37_ = _loc28_.charAt(_loc33_ - 1);
|
||||
if(_loc33_ == 0 || _loc37_ == "." || _loc37_ == "!" || _loc37_ == "?" || _loc37_ == "\n" || _loc37_ == "\r")
|
||||
{
|
||||
_loc35_.appendText(_loc14_);
|
||||
_loc35_.setTextFormat(_loc30_);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc35_.appendText(" ");
|
||||
_loc35_.setTextFormat(_loc30_);
|
||||
}
|
||||
_loc21_ = _loc33_ + 1;
|
||||
_loc36_ = _loc35_.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc35_.appendText(_loc14_);
|
||||
_loc35_.setTextFormat(_loc30_);
|
||||
}
|
||||
_loc33_++;
|
||||
}
|
||||
if(param6 && _loc30_.size < _loc18_ * 0.7)
|
||||
{
|
||||
_loc20_ = _loc19_.length > 1 ? _loc19_.length - 2 : 0;
|
||||
_loc22_ = _loc19_[_loc20_];
|
||||
_loc19_[_loc20_] = _loc22_ != null ? _loc22_.substr(0,_loc22_.length - 4) + "..." : "";
|
||||
if(_loc20_ != 0)
|
||||
{
|
||||
_loc19_.pop();
|
||||
}
|
||||
_loc32_ = true;
|
||||
_loc30_.size = _loc18_;
|
||||
param1.setTextFormat(_loc30_);
|
||||
updateToFit(param1,_loc19_.join(""),param3,param4,param5,param6);
|
||||
return;
|
||||
}
|
||||
if(_loc33_ == _loc28_.length)
|
||||
{
|
||||
if(param4)
|
||||
{
|
||||
param1.text = _loc19_.join("");
|
||||
param1.htmlText = _loc34_ + "<u>" + _loc19_.join("") + "</u></a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
param1.text = _loc19_.join("");
|
||||
}
|
||||
}
|
||||
_loc30_.size = Number(_loc30_.size) - 1;
|
||||
param1.setTextFormat(_loc30_);
|
||||
if(param3 && _loc8_ != null)
|
||||
{
|
||||
_loc31_ = 0;
|
||||
while(_loc31_ < _loc8_.length)
|
||||
{
|
||||
_loc39_ = _loc8_[_loc31_];
|
||||
_loc24_ = new TextFormat("CCDigitalDelivery",_loc39_.bold ? _loc30_.size + 2 : _loc30_.size,_loc39_.color == "" ? null : _loc39_.color,_loc39_.bold,null,_loc39_.underline);
|
||||
param1.setTextFormat(_loc24_,_loc39_.startIndex,_loc39_.endIndex);
|
||||
_loc31_++;
|
||||
}
|
||||
}
|
||||
_loc27_ = hasBrokenWord(param1,param2);
|
||||
}
|
||||
}
|
||||
param1.sharpness = Number(_loc30_.size);
|
||||
if(_loc23_ != 0)
|
||||
{
|
||||
param1.rotation = _loc23_;
|
||||
}
|
||||
if(!param1.multiline && param5)
|
||||
{
|
||||
if(param1.rotation == 0)
|
||||
{
|
||||
param1.y += (_loc7_ - param1.textHeight) * 0.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc17_ = param1.rotation;
|
||||
param1.rotation = 0;
|
||||
param1.y += Math.round((_loc7_ - param1.textHeight) * 0.5);
|
||||
param1.rotation = _loc17_;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(param3 && _loc8_ != null)
|
||||
{
|
||||
_loc31_ = 0;
|
||||
while(_loc31_ < _loc8_.length)
|
||||
{
|
||||
_loc39_ = _loc8_[_loc31_];
|
||||
_loc24_ = new TextFormat("CCDigitalDelivery",_loc39_.bold ? _loc30_.size + 2 : _loc30_.size,_loc39_.color == "" ? _loc30_.color : _loc39_.color,_loc39_.bold,null,_loc39_.underline);
|
||||
param1.setTextFormat(_loc24_,_loc39_.startIndex,_loc39_.endIndex);
|
||||
_loc31_++;
|
||||
}
|
||||
}
|
||||
if(_loc12_ && param1.name != _loc12_.name)
|
||||
{
|
||||
_loc12_.visible = false;
|
||||
}
|
||||
if(_loc9_)
|
||||
{
|
||||
param1.multiline = true;
|
||||
param1.wordWrap = true;
|
||||
}
|
||||
if(param1.multiline && param5 && param1.text != "")
|
||||
{
|
||||
if(param1.parent.scaleY != 1)
|
||||
{
|
||||
_loc38_ = param1.parent.height / param1.parent.scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc38_ = param1.parent.height;
|
||||
}
|
||||
if(param1.y < 0)
|
||||
{
|
||||
_loc29_ = param1.y + _loc38_ * 0.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc29_ = param1.y;
|
||||
}
|
||||
_loc26_ = (param1.height - param1.textHeight) * 0.5;
|
||||
if(_loc29_ + param1.textHeight + _loc26_ > _loc38_)
|
||||
{
|
||||
param1.y += _loc38_ - (_loc29_ + param1.textHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
param1.y += _loc26_;
|
||||
}
|
||||
}
|
||||
if(_loc23_ != 0)
|
||||
{
|
||||
param1.rotation = _loc23_;
|
||||
}
|
||||
}
|
||||
|
||||
private static function findSpecialTagPositions(param1:Object) : void
|
||||
{
|
||||
var _loc9_:Boolean = false;
|
||||
var _loc3_:Boolean = false;
|
||||
var _loc11_:int = 0;
|
||||
var _loc13_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:Array = [];
|
||||
var _loc12_:String = param1.text;
|
||||
var _loc10_:String = "";
|
||||
var _loc2_:String = "";
|
||||
var _loc8_:Boolean = false;
|
||||
var _loc4_:Boolean = false;
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc12_.length)
|
||||
{
|
||||
if(_loc12_.charAt(_loc6_) == "<")
|
||||
{
|
||||
_loc5_++;
|
||||
_loc6_++;
|
||||
if(_loc12_.charAt(_loc6_) == "/")
|
||||
{
|
||||
_loc3_ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc9_ = true;
|
||||
}
|
||||
while(_loc12_.charAt(_loc6_) != ">")
|
||||
{
|
||||
if(_loc12_.charAt(_loc6_) == "c" && _loc12_.charAt(_loc6_ + 1) == "=")
|
||||
{
|
||||
_loc2_ += _loc12_.substring(_loc6_ + 2,_loc6_ + 10);
|
||||
_loc6_ += 10;
|
||||
_loc5_ += 10;
|
||||
}
|
||||
else if(_loc12_.charAt(_loc6_) == "u" && _loc12_.charAt(_loc6_ + 1) == "=")
|
||||
{
|
||||
_loc4_ = _loc12_.charAt(_loc6_ + 2) == "t";
|
||||
_loc6_ += 2;
|
||||
_loc5_ += 2;
|
||||
}
|
||||
else if(_loc12_.charAt(_loc6_) == "b" && _loc12_.charAt(_loc6_ + 1) == "=")
|
||||
{
|
||||
_loc8_ = _loc12_.charAt(_loc6_ + 2) == "t";
|
||||
_loc6_ += 2;
|
||||
_loc5_ += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc6_++;
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
if(_loc12_.charAt(_loc6_) == ">")
|
||||
{
|
||||
_loc5_++;
|
||||
}
|
||||
if(_loc9_)
|
||||
{
|
||||
_loc11_ = _loc6_ + 1 - _loc5_;
|
||||
_loc9_ = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc13_ = _loc6_ + 1 - _loc5_;
|
||||
_loc3_ = false;
|
||||
_loc7_.push({
|
||||
"startIndex":_loc11_,
|
||||
"endIndex":_loc13_,
|
||||
"color":_loc2_,
|
||||
"bold":_loc8_,
|
||||
"underline":_loc4_
|
||||
});
|
||||
_loc2_ = "";
|
||||
_loc8_ = false;
|
||||
_loc4_ = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc10_ += _loc12_.charAt(_loc6_);
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
param1.array = _loc7_;
|
||||
param1.text = _loc10_;
|
||||
}
|
||||
|
||||
private static function isDifference99PercentOrGreater(param1:Number, param2:Number, param3:Boolean) : Boolean
|
||||
{
|
||||
return param1 / param2 >= (param3 ? 0.999 : 0.996);
|
||||
}
|
||||
|
||||
private static function hasBrokenWord(param1:TextField, param2:String) : Boolean
|
||||
{
|
||||
var _loc4_:* = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc7_:String = null;
|
||||
var _loc6_:Number = NaN;
|
||||
var _loc3_:Number = 0;
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < param2.length)
|
||||
{
|
||||
_loc7_ = param2.charAt(_loc5_);
|
||||
_loc6_ = param1.getLineIndexOfChar(_loc5_);
|
||||
if(_loc6_ != _loc3_)
|
||||
{
|
||||
if(_loc4_ != " " && _loc4_ != "\r" && _loc4_ != "\n" && _loc4_ != "\r\n" && _loc4_ != "-")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
_loc3_ = _loc6_;
|
||||
_loc4_ = _loc7_;
|
||||
_loc5_++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static function isLastLetterAReturn(param1:String) : Boolean
|
||||
{
|
||||
var _loc2_:String = param1.substr(-1);
|
||||
if(_loc2_ == "\n" || _loc2_ == "\r")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static function shouldAddSpace(param1:String) : Boolean
|
||||
{
|
||||
var _loc2_:String = param1.substr(-1);
|
||||
if(_loc2_ == " " || _loc2_ == "\n" || _loc2_ == "\r")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static function translateLocalizedIdAndUpdateSize(param1:TextField) : void
|
||||
{
|
||||
var _loc2_:Object = translateLocalizedId(param1.text);
|
||||
if(param1.text != _loc2_.text || param1.sharpness != -1 && param1.sharpness != param1.defaultTextFormat.size)
|
||||
{
|
||||
if(_loc2_.isHtmlClick)
|
||||
{
|
||||
updateToFit(param1,"<a " + _loc2_.htmlRefText + "><u>" + _loc2_.text + "</u></a>",false,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
updateToFit(param1,_loc2_.text,_loc2_.isHtmlNormal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function translateLocalizedId(param1:String) : Object
|
||||
{
|
||||
var _loc2_:Array = null;
|
||||
var _loc3_:String = null;
|
||||
if(_staticLocalizations)
|
||||
{
|
||||
_loc2_ = param1.split("#");
|
||||
if(_loc2_.length > 1)
|
||||
{
|
||||
_loc3_ = _staticLocalizations[int(removeCarriageReturn(_loc2_[1]))] as String;
|
||||
if(_loc3_ != null && _loc3_ != "")
|
||||
{
|
||||
if(_loc2_.length == 4)
|
||||
{
|
||||
return {
|
||||
"text":_loc3_,
|
||||
"isHtmlNormal":false,
|
||||
"isHtmlClick":true,
|
||||
"htmlRefText":_loc2_[3]
|
||||
};
|
||||
}
|
||||
if(_loc2_.length == 3)
|
||||
{
|
||||
return {
|
||||
"text":_loc3_,
|
||||
"isHtmlNormal":true,
|
||||
"isHtmlClick":false
|
||||
};
|
||||
}
|
||||
return {
|
||||
"text":_loc3_,
|
||||
"isHtmlNormal":false,
|
||||
"isHtmlClick":false
|
||||
};
|
||||
}
|
||||
return {
|
||||
"text":param1,
|
||||
"isHtmlNormal":false,
|
||||
"isHtmlClick":false
|
||||
};
|
||||
}
|
||||
return {
|
||||
"text":removeCarriageReturn(param1),
|
||||
"isHtmlNormal":false,
|
||||
"isHtmlClick":false
|
||||
};
|
||||
}
|
||||
return {
|
||||
"text":removeCarriageReturn(param1),
|
||||
"isHtmlNormal":false,
|
||||
"isHtmlClick":false
|
||||
};
|
||||
}
|
||||
|
||||
private static function removeCarriageReturn(param1:String) : String
|
||||
{
|
||||
var _loc2_:String = param1.charAt(param1.length - 1);
|
||||
if(_loc2_ == "\r" || _loc2_ == "\n" || _loc2_ == "\r\n")
|
||||
{
|
||||
return param1.substr(0,param1.length - 1);
|
||||
}
|
||||
return param1;
|
||||
}
|
||||
|
||||
public static function findAllTextfields(param1:Object) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
if(param1 is TextField)
|
||||
{
|
||||
translateLocalizedIdAndUpdateSize(TextField(param1));
|
||||
return;
|
||||
}
|
||||
if(param1.hasOwnProperty("numChildren"))
|
||||
{
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < param1.numChildren)
|
||||
{
|
||||
_loc4_ = param1.getChildAt(_loc2_);
|
||||
if(_loc4_)
|
||||
{
|
||||
if(_loc4_.name == "bakedLogo")
|
||||
{
|
||||
_loc4_.gotoAndStop(currentLanguage + 1);
|
||||
}
|
||||
else if(_loc4_.name == "countryCodeTxt")
|
||||
{
|
||||
for each(var _loc3_:Object in _loc4_.currentLabels)
|
||||
{
|
||||
if(_loc3_.name.toLowerCase() == _countryCode.toLowerCase())
|
||||
{
|
||||
_loc4_.gotoAndStop(_loc3_.name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_loc4_ is TextField)
|
||||
{
|
||||
translateLocalizedIdAndUpdateSize(TextField(_loc4_));
|
||||
}
|
||||
if(_loc4_.hasOwnProperty("numChildren") && _loc4_.numChildren > 0)
|
||||
{
|
||||
findAllTextfields(_loc4_);
|
||||
}
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function translateAvatarName(param1:String) : String
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
var _loc4_:Array = null;
|
||||
var _loc5_:String = null;
|
||||
var _loc2_:Array = param1.split("|");
|
||||
if(_loc2_.length > 1)
|
||||
{
|
||||
if(isCurrLanguageReversed())
|
||||
{
|
||||
_loc3_ = LocalizationManager.translateIdOnly(_loc2_[2]).split("$");
|
||||
_loc4_ = LocalizationManager.translateIdOnly(_loc2_[1]).split("$");
|
||||
if(_loc3_.length == 1 || _loc3_[1] == "m")
|
||||
{
|
||||
_loc5_ = _loc4_[0].toLowerCase();
|
||||
}
|
||||
else if(_loc4_.length == 1)
|
||||
{
|
||||
_loc5_ = _loc4_[0].toLowerCase();
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_ = _loc4_[1].toLowerCase();
|
||||
}
|
||||
return translateIdOnly(_loc2_[0]) + " " + _loc3_[0] + _loc5_;
|
||||
}
|
||||
return translateIdOnly(_loc2_[0]) + " " + translateIdOnly(_loc2_[1]) + translateIdOnly(_loc2_[2]).toLowerCase();
|
||||
}
|
||||
// a name its owner typed (world.js xrn), not the game's word ids:
|
||||
// through the player's chat filter (AJClient.filterName)
|
||||
return AJClient.filterName(param1);
|
||||
}
|
||||
|
||||
public static function translatePetName(param1:String) : String
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
var _loc4_:Array = null;
|
||||
var _loc5_:String = null;
|
||||
var _loc2_:Array = param1.split("|");
|
||||
if(_loc2_.length > 1)
|
||||
{
|
||||
if(isCurrLanguageReversed())
|
||||
{
|
||||
_loc3_ = LocalizationManager.translateIdOnly(_loc2_[1]).split("$");
|
||||
_loc4_ = LocalizationManager.translateIdOnly(_loc2_[0]).split("$");
|
||||
if(_loc3_.length == 1 || _loc3_[1] == "m")
|
||||
{
|
||||
_loc5_ = _loc4_[0].toLowerCase();
|
||||
}
|
||||
else if(_loc4_.length == 1)
|
||||
{
|
||||
_loc5_ = _loc4_[0].toLowerCase();
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_ = _loc4_[1].toLowerCase();
|
||||
}
|
||||
return _loc3_[0] + _loc5_;
|
||||
}
|
||||
return translateIdOnly(_loc2_[0]) + translateIdOnly(_loc2_[1]).toLowerCase();
|
||||
}
|
||||
// a name its owner typed (world.js xrn), not the game's word ids:
|
||||
// through the player's chat filter (AJClient.filterName)
|
||||
return AJClient.filterName(param1);
|
||||
}
|
||||
|
||||
public static function isCurrLanguageReversed() : Boolean
|
||||
{
|
||||
if(currentLanguage == LANG_FRE || currentLanguage == LANG_POR || currentLanguage == LANG_SPA)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -65,6 +65,7 @@ set -- \
|
||||
gui.TradeManager TradeManager.as \
|
||||
avatar.AvatarView AvatarView.as \
|
||||
avatar.AvatarWorldView AvatarWorldView.as \
|
||||
localization.LocalizationManager LocalizationManager.as \
|
||||
room.RoomManagerWorld RoomManagerWorld.as \
|
||||
gskinner.motion.GTween GTween.as \
|
||||
playerWall.PostMessage PostMessage.as \
|
||||
|
||||
Reference in new issue
Block a user