@phantomclient/plugin 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/chunks/sdk-permissions-BQlOakj9.js +429 -0
- package/dist/lib/guest.js +2509 -1576
- package/dist/lib/index.js +22 -22
- package/dist/lib/styles.css +1 -1
- package/dist/lib/vue.js +307 -222
- package/dist/runtime/chunks/sdk-permissions-DXVe00ho.js +1 -0
- package/dist/runtime/frame.html +1 -1
- package/dist/runtime/runtime.js +3 -3
- package/dist/runtime/sdk.js +1 -1
- package/dist/types/index.d.ts +10 -0
- package/dist/types/vue.d.ts +9 -0
- package/package.json +1 -1
- package/dist/lib/chunks/api-DhaU9Jsd.js +0 -1667
- package/dist/lib/chunks/sdk-permissions-CyDMa4we.js +0 -429
- package/dist/lib/chunks/sdk-permissions-DQOAag0j.js +0 -429
- package/dist/lib/chunks/state-BGYMFLti.js +0 -34
- package/dist/runtime/chunks/sdk-permissions-CDp6went.js +0 -1
|
@@ -1,1667 +0,0 @@
|
|
|
1
|
-
class u extends Error {
|
|
2
|
-
constructor(t, n, r) {
|
|
3
|
-
super(r === void 0 ? t : `${t} (at ${r})`), this.code = n, this.offset = r, this.name = "ProtocolError";
|
|
4
|
-
}
|
|
5
|
-
code;
|
|
6
|
-
offset;
|
|
7
|
-
}
|
|
8
|
-
new TextEncoder();
|
|
9
|
-
const Oe = { lt: "<", gt: ">", amp: "&", apos: "'", quot: '"' };
|
|
10
|
-
function G(e) {
|
|
11
|
-
if (!e.includes("&")) return e;
|
|
12
|
-
let t = "", n = 0;
|
|
13
|
-
for (; n < e.length; ) {
|
|
14
|
-
const r = e.indexOf("&", n);
|
|
15
|
-
if (r === -1) break;
|
|
16
|
-
const i = e.indexOf(";", r + 1);
|
|
17
|
-
t += e.slice(n, r);
|
|
18
|
-
const s = i === -1 ? null : ze(e.slice(r + 1, i));
|
|
19
|
-
s === null ? (t += "&", n = r + 1) : (t += s, n = i + 1);
|
|
20
|
-
}
|
|
21
|
-
return t + e.slice(n);
|
|
22
|
-
}
|
|
23
|
-
function ze(e) {
|
|
24
|
-
if (e.startsWith("#")) {
|
|
25
|
-
const t = e[1] === "x" || e[1] === "X", n = e.slice(t ? 2 : 1);
|
|
26
|
-
if (n.length === 0 || !(t ? Ke(n) : Ve(n))) return null;
|
|
27
|
-
const r = Number.parseInt(n, t ? 16 : 10);
|
|
28
|
-
return r <= 1114111 ? String.fromCodePoint(r) : null;
|
|
29
|
-
}
|
|
30
|
-
return Oe[e] ?? null;
|
|
31
|
-
}
|
|
32
|
-
function Ve(e) {
|
|
33
|
-
for (const t of e) if (t < "0" || t > "9") return !1;
|
|
34
|
-
return !0;
|
|
35
|
-
}
|
|
36
|
-
function Ke(e) {
|
|
37
|
-
for (const t of e.toLowerCase()) if (!(t >= "0" && t <= "9" || t >= "a" && t <= "f")) return !1;
|
|
38
|
-
return !0;
|
|
39
|
-
}
|
|
40
|
-
function V(e) {
|
|
41
|
-
let t = "";
|
|
42
|
-
for (const n of e) n === "&" ? t += "&" : n === "<" ? t += "<" : n === ">" ? t += ">" : t += n;
|
|
43
|
-
return t;
|
|
44
|
-
}
|
|
45
|
-
function ee(e, t) {
|
|
46
|
-
let n = "";
|
|
47
|
-
for (const r of e) r === "&" ? n += "&" : r === "<" ? n += "<" : r === t ? n += t === '"' ? """ : "'" : n += r;
|
|
48
|
-
return n;
|
|
49
|
-
}
|
|
50
|
-
class v {
|
|
51
|
-
constructor(t, n, r = "'", i = " ", s = ["", ""]) {
|
|
52
|
-
this.name = t, this.quote = r, this.leading = i, this.around = s, this.written = n, this.decoded = G(n);
|
|
53
|
-
}
|
|
54
|
-
name;
|
|
55
|
-
quote;
|
|
56
|
-
leading;
|
|
57
|
-
around;
|
|
58
|
-
written;
|
|
59
|
-
decoded;
|
|
60
|
-
static create(t, n, r = "'") {
|
|
61
|
-
return new v(t, ee(n, r), r);
|
|
62
|
-
}
|
|
63
|
-
get value() {
|
|
64
|
-
return this.decoded;
|
|
65
|
-
}
|
|
66
|
-
set value(t) {
|
|
67
|
-
this.decoded = t, this.written = ee(t, this.quote);
|
|
68
|
-
}
|
|
69
|
-
get raw() {
|
|
70
|
-
return this.written;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
class M {
|
|
74
|
-
type = "text";
|
|
75
|
-
written;
|
|
76
|
-
decoded;
|
|
77
|
-
constructor(t) {
|
|
78
|
-
this.written = t, this.decoded = G(t);
|
|
79
|
-
}
|
|
80
|
-
static create(t) {
|
|
81
|
-
return new M(V(t));
|
|
82
|
-
}
|
|
83
|
-
get value() {
|
|
84
|
-
return this.decoded;
|
|
85
|
-
}
|
|
86
|
-
set value(t) {
|
|
87
|
-
this.decoded = t, this.written = V(t);
|
|
88
|
-
}
|
|
89
|
-
get raw() {
|
|
90
|
-
return this.written;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
class w {
|
|
94
|
-
constructor(t) {
|
|
95
|
-
this.value = t;
|
|
96
|
-
}
|
|
97
|
-
value;
|
|
98
|
-
type = "cdata";
|
|
99
|
-
}
|
|
100
|
-
class _e {
|
|
101
|
-
constructor(t) {
|
|
102
|
-
this.value = t;
|
|
103
|
-
}
|
|
104
|
-
value;
|
|
105
|
-
type = "comment";
|
|
106
|
-
}
|
|
107
|
-
class We {
|
|
108
|
-
constructor(t, n) {
|
|
109
|
-
this.target = t, this.content = n;
|
|
110
|
-
}
|
|
111
|
-
target;
|
|
112
|
-
content;
|
|
113
|
-
type = "instruction";
|
|
114
|
-
}
|
|
115
|
-
class f {
|
|
116
|
-
constructor(t, n = {}) {
|
|
117
|
-
this.name = t, this.attributes = n.attributes ?? [], this.children = n.children ?? [], this.selfClosing = n.selfClosing ?? !1, this.trailing = n.trailing ?? "", this.closingTrailing = n.closingTrailing ?? "";
|
|
118
|
-
}
|
|
119
|
-
name;
|
|
120
|
-
type = "element";
|
|
121
|
-
attributes;
|
|
122
|
-
children;
|
|
123
|
-
selfClosing;
|
|
124
|
-
trailing;
|
|
125
|
-
closingTrailing;
|
|
126
|
-
attribute(t) {
|
|
127
|
-
var n;
|
|
128
|
-
return ((n = this.attributes.find((r) => r.name === t)) == null ? void 0 : n.value) ?? null;
|
|
129
|
-
}
|
|
130
|
-
setAttribute(t, n) {
|
|
131
|
-
const r = this.attributes.find((i) => i.name === t);
|
|
132
|
-
r ? r.value = n : this.attributes.push(v.create(t, n));
|
|
133
|
-
}
|
|
134
|
-
removeAttribute(t) {
|
|
135
|
-
const n = this.attributes.findIndex((r) => r.name === t);
|
|
136
|
-
return n === -1 ? !1 : (this.attributes.splice(n, 1), !0);
|
|
137
|
-
}
|
|
138
|
-
get elements() {
|
|
139
|
-
return this.children.filter((t) => t.type === "element");
|
|
140
|
-
}
|
|
141
|
-
child(t) {
|
|
142
|
-
return this.elements.find((n) => n.name === t) ?? null;
|
|
143
|
-
}
|
|
144
|
-
childrenNamed(t) {
|
|
145
|
-
return this.elements.filter((n) => n.name === t);
|
|
146
|
-
}
|
|
147
|
-
get textContent() {
|
|
148
|
-
return this.children.map((t) => {
|
|
149
|
-
switch (t.type) {
|
|
150
|
-
case "element":
|
|
151
|
-
return t.textContent;
|
|
152
|
-
case "text":
|
|
153
|
-
case "cdata":
|
|
154
|
-
return t.value;
|
|
155
|
-
default:
|
|
156
|
-
return "";
|
|
157
|
-
}
|
|
158
|
-
}).join("");
|
|
159
|
-
}
|
|
160
|
-
set textContent(t) {
|
|
161
|
-
const n = this.children.some((r) => r.type === "cdata");
|
|
162
|
-
this.children = [n ? new w(t) : M.create(t)], this.selfClosing = !1;
|
|
163
|
-
}
|
|
164
|
-
append(...t) {
|
|
165
|
-
this.children.push(...t), t.length > 0 && (this.selfClosing = !1);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
class Se {
|
|
169
|
-
constructor(t) {
|
|
170
|
-
this.children = t;
|
|
171
|
-
}
|
|
172
|
-
children;
|
|
173
|
-
get root() {
|
|
174
|
-
return this.children.find((t) => t.type === "element") ?? null;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
class Ge {
|
|
178
|
-
constructor(t) {
|
|
179
|
-
this.input = t;
|
|
180
|
-
}
|
|
181
|
-
input;
|
|
182
|
-
index = 0;
|
|
183
|
-
get offset() {
|
|
184
|
-
return this.index;
|
|
185
|
-
}
|
|
186
|
-
get done() {
|
|
187
|
-
return this.index >= this.input.length;
|
|
188
|
-
}
|
|
189
|
-
peek(t = 0) {
|
|
190
|
-
return this.input.charAt(this.index + t);
|
|
191
|
-
}
|
|
192
|
-
startsWith(t) {
|
|
193
|
-
return this.input.startsWith(t, this.index);
|
|
194
|
-
}
|
|
195
|
-
advance(t = 1) {
|
|
196
|
-
this.index = Math.min(this.index + t, this.input.length);
|
|
197
|
-
}
|
|
198
|
-
expect(t) {
|
|
199
|
-
this.startsWith(t) || this.fail(`Expected "${t}"`), this.index += t.length;
|
|
200
|
-
}
|
|
201
|
-
whitespace() {
|
|
202
|
-
const t = this.index;
|
|
203
|
-
for (; !this.done && Qe(this.input.charCodeAt(this.index)); ) this.index++;
|
|
204
|
-
return this.input.slice(t, this.index);
|
|
205
|
-
}
|
|
206
|
-
until(t, n) {
|
|
207
|
-
const r = this.input.indexOf(t, this.index);
|
|
208
|
-
r === -1 && this.fail(`Unterminated ${n}`);
|
|
209
|
-
const i = this.input.slice(this.index, r);
|
|
210
|
-
return this.index = r, i;
|
|
211
|
-
}
|
|
212
|
-
name() {
|
|
213
|
-
const t = this.index;
|
|
214
|
-
for ((this.done || !Ae(this.input.charCodeAt(this.index))) && this.fail("Expected a name"), this.index++; !this.done && Ze(this.input.charCodeAt(this.index)); ) this.index++;
|
|
215
|
-
return this.input.slice(t, this.index);
|
|
216
|
-
}
|
|
217
|
-
fail(t) {
|
|
218
|
-
throw new u(t, "XML_SYNTAX", this.index);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
const Xe = 32, Je = 9, He = 10, Ye = 13;
|
|
222
|
-
function Qe(e) {
|
|
223
|
-
return e === Xe || e === Je || e === He || e === Ye;
|
|
224
|
-
}
|
|
225
|
-
function Ae(e) {
|
|
226
|
-
return e >= 97 && e <= 122 || e >= 65 && e <= 90 || e === 95 || e === 58 || e > 127;
|
|
227
|
-
}
|
|
228
|
-
function Ze(e) {
|
|
229
|
-
return Ae(e) || e >= 48 && e <= 57 || e === 45 || e === 46;
|
|
230
|
-
}
|
|
231
|
-
const te = 64;
|
|
232
|
-
function De(e) {
|
|
233
|
-
const t = new Ge(e), n = Ue(t, null, 0);
|
|
234
|
-
return n.some((r) => r.type === "element") || t.fail("Expected an element"), new Se(n);
|
|
235
|
-
}
|
|
236
|
-
function Ue(e, t, n) {
|
|
237
|
-
const r = [];
|
|
238
|
-
for (; !e.done; ) {
|
|
239
|
-
if (e.startsWith("</")) return t === null && e.fail("Closing tag with nothing open"), r;
|
|
240
|
-
e.startsWith("<![CDATA[") ? (e.advance(9), r.push(new w(e.until("]]>", "CDATA section"))), e.advance(3)) : e.startsWith("<!--") ? (e.advance(4), r.push(new _e(e.until("-->", "comment"))), e.advance(3)) : e.startsWith("<?") ? r.push(tt(e)) : e.startsWith("<!") ? e.fail("Document type declarations are not supported") : e.peek() === "<" ? r.push(nt(e, n)) : r.push(et(e));
|
|
241
|
-
}
|
|
242
|
-
return t !== null && e.fail(`Unclosed element <${t}>`), r;
|
|
243
|
-
}
|
|
244
|
-
function et(e) {
|
|
245
|
-
const t = e.offset;
|
|
246
|
-
for (; !e.done && e.peek() !== "<"; ) e.advance();
|
|
247
|
-
return new M(e.input.slice(t, e.offset));
|
|
248
|
-
}
|
|
249
|
-
function tt(e) {
|
|
250
|
-
e.expect("<?");
|
|
251
|
-
const t = e.name(), n = e.until("?>", "processing instruction");
|
|
252
|
-
return e.advance(2), new We(t, n);
|
|
253
|
-
}
|
|
254
|
-
function nt(e, t) {
|
|
255
|
-
t >= te && e.fail(`Elements nested deeper than ${te}`), e.expect("<");
|
|
256
|
-
const n = e.name(), r = [];
|
|
257
|
-
for (; ; ) {
|
|
258
|
-
const i = e.whitespace();
|
|
259
|
-
if (e.startsWith("/>")) return e.advance(2), new f(n, { attributes: r, selfClosing: !0, trailing: i });
|
|
260
|
-
if (e.peek() === ">") {
|
|
261
|
-
e.advance();
|
|
262
|
-
const s = Ue(e, n, t + 1);
|
|
263
|
-
e.expect("</");
|
|
264
|
-
const o = e.name();
|
|
265
|
-
o !== n && e.fail(`Expected </${n}> but found </${o}>`);
|
|
266
|
-
const d = e.whitespace();
|
|
267
|
-
return e.expect(">"), new f(n, { attributes: r, children: s, trailing: i, closingTrailing: d });
|
|
268
|
-
}
|
|
269
|
-
e.done && e.fail(`Unterminated tag <${n}>`), i.length === 0 && e.fail("Expected whitespace before an attribute"), r.push(rt(e, i, r));
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
function rt(e, t, n) {
|
|
273
|
-
const r = e.name();
|
|
274
|
-
n.some((m) => m.name === r) && e.fail(`Attribute "${r}" given twice`);
|
|
275
|
-
const i = e.whitespace();
|
|
276
|
-
e.expect("=");
|
|
277
|
-
const s = e.whitespace(), o = e.peek();
|
|
278
|
-
o !== '"' && o !== "'" && e.fail("Expected a quoted attribute value"), e.advance();
|
|
279
|
-
const d = e.until(o, "attribute value");
|
|
280
|
-
return d.includes("<") && e.fail('"<" is not allowed in an attribute value'), e.advance(), new v(r, d, o, t, [i, s]);
|
|
281
|
-
}
|
|
282
|
-
function ne(e) {
|
|
283
|
-
return e instanceof Se ? e.children.map(K).join("") : K(e);
|
|
284
|
-
}
|
|
285
|
-
function K(e) {
|
|
286
|
-
switch (e.type) {
|
|
287
|
-
case "element":
|
|
288
|
-
return it(e);
|
|
289
|
-
case "text":
|
|
290
|
-
return e.raw;
|
|
291
|
-
case "cdata":
|
|
292
|
-
return `<![CDATA[${e.value.split("]]>").join("]]]]><![CDATA[>")}]]>`;
|
|
293
|
-
case "comment":
|
|
294
|
-
return `<!--${e.value}-->`;
|
|
295
|
-
case "instruction":
|
|
296
|
-
return `<?${e.target}${e.content}?>`;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
function it(e) {
|
|
300
|
-
const t = e.attributes.map(at).join(""), n = `<${e.name}${t}${e.trailing}`;
|
|
301
|
-
if (e.selfClosing && e.children.length === 0) return `${n}/>`;
|
|
302
|
-
const r = e.children.map(K).join("");
|
|
303
|
-
return `${n}>${r}</${e.name}${e.closingTrailing}>`;
|
|
304
|
-
}
|
|
305
|
-
function at(e) {
|
|
306
|
-
const [t, n] = e.around, { leading: r, name: i, quote: s, raw: o } = e;
|
|
307
|
-
return `${r}${i}${t}=${n}${s}${o}${s}`;
|
|
308
|
-
}
|
|
309
|
-
function st(e) {
|
|
310
|
-
const t = De(e).root;
|
|
311
|
-
if (!t || t.name !== "dataObj") throw new u("Expected a <dataObj> element", "DATA_OBJECT");
|
|
312
|
-
return Be(t, {});
|
|
313
|
-
}
|
|
314
|
-
function Be(e, t) {
|
|
315
|
-
const n = t;
|
|
316
|
-
for (const r of e.elements) if (r.name === "var") n[j(r, "n")] = ot(r);
|
|
317
|
-
else if (r.name === "obj") {
|
|
318
|
-
const i = j(r, "t");
|
|
319
|
-
if (i !== "a" && i !== "o") throw new u(`Unknown object kind "${i}"`, "DATA_OBJECT");
|
|
320
|
-
n[j(r, "o")] = Be(r, i === "a" ? [] : {});
|
|
321
|
-
}
|
|
322
|
-
return t;
|
|
323
|
-
}
|
|
324
|
-
function ot(e) {
|
|
325
|
-
const t = e.textContent;
|
|
326
|
-
switch (j(e, "t")) {
|
|
327
|
-
case "s":
|
|
328
|
-
return t;
|
|
329
|
-
case "n":
|
|
330
|
-
return Number(t);
|
|
331
|
-
case "b":
|
|
332
|
-
return t !== "0";
|
|
333
|
-
case "x":
|
|
334
|
-
return null;
|
|
335
|
-
default:
|
|
336
|
-
throw new u(`Unknown variable type "${e.attribute("t")}"`, "DATA_OBJECT");
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
function j(e, t) {
|
|
340
|
-
const n = e.attribute(t);
|
|
341
|
-
if (n === null) throw new u(`<${e.name}> is missing its "${t}" attribute`, "DATA_OBJECT");
|
|
342
|
-
return n;
|
|
343
|
-
}
|
|
344
|
-
function dt(e) {
|
|
345
|
-
return `<dataObj>${je(e)}</dataObj>`;
|
|
346
|
-
}
|
|
347
|
-
function je(e) {
|
|
348
|
-
return Object.entries(e).map(([t, n]) => n === null ? `<var n='${t}' t='x'></var>` : typeof n == "object" ? `<obj t='${Array.isArray(n) ? "a" : "o"}' o='${t}'>${je(n)}</obj>` : typeof n == "boolean" ? `<var n='${t}' t='b'>${n ? 1 : 0}</var>` : typeof n == "number" ? `<var n='${t}' t='n'>${n}</var>` : `<var n='${t}' t='s'>${V(n)}</var>`).join("");
|
|
349
|
-
}
|
|
350
|
-
class Le {
|
|
351
|
-
constructor(t, n) {
|
|
352
|
-
this.raw = t, this.direction = n;
|
|
353
|
-
}
|
|
354
|
-
raw;
|
|
355
|
-
direction;
|
|
356
|
-
wasModified = !1;
|
|
357
|
-
wasDropped = !1;
|
|
358
|
-
get modified() {
|
|
359
|
-
return this.wasModified;
|
|
360
|
-
}
|
|
361
|
-
get dropped() {
|
|
362
|
-
return this.wasDropped;
|
|
363
|
-
}
|
|
364
|
-
drop() {
|
|
365
|
-
this.wasDropped = !0;
|
|
366
|
-
}
|
|
367
|
-
encode() {
|
|
368
|
-
return this.wasModified ? this.serialize() : this.raw;
|
|
369
|
-
}
|
|
370
|
-
toString() {
|
|
371
|
-
return this.encode();
|
|
372
|
-
}
|
|
373
|
-
markModified() {
|
|
374
|
-
this.wasModified = !0;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
const re = "xt";
|
|
378
|
-
class E extends Le {
|
|
379
|
-
format = "xml";
|
|
380
|
-
document;
|
|
381
|
-
constructor(t, n) {
|
|
382
|
-
super(t, n), this.document = De(t);
|
|
383
|
-
}
|
|
384
|
-
static create(t, n, r, i, s = []) {
|
|
385
|
-
const o = new f("msg", { attributes: [v.create("t", n)], children: [new f("body", { attributes: [v.create("action", r), v.create("r", String(i))], children: [...s] })] });
|
|
386
|
-
return new E(ne(o), t);
|
|
387
|
-
}
|
|
388
|
-
get element() {
|
|
389
|
-
return this.document.root.name;
|
|
390
|
-
}
|
|
391
|
-
get type() {
|
|
392
|
-
var t;
|
|
393
|
-
return ((t = this.envelope) == null ? void 0 : t.attribute("t")) ?? null;
|
|
394
|
-
}
|
|
395
|
-
get command() {
|
|
396
|
-
var t;
|
|
397
|
-
return ((t = this.body) == null ? void 0 : t.attribute("action")) ?? null;
|
|
398
|
-
}
|
|
399
|
-
get room() {
|
|
400
|
-
const t = this.body, n = Number((t == null ? void 0 : t.attribute("r")) ?? (t == null ? void 0 : t.attribute("id")) ?? Number.NaN);
|
|
401
|
-
return Number.isInteger(n) ? n : null;
|
|
402
|
-
}
|
|
403
|
-
get signed() {
|
|
404
|
-
var t;
|
|
405
|
-
return (((t = this.envelope) == null ? void 0 : t.attribute("h")) ?? null) !== null;
|
|
406
|
-
}
|
|
407
|
-
get body() {
|
|
408
|
-
var t;
|
|
409
|
-
return ((t = this.envelope) == null ? void 0 : t.child("body")) ?? null;
|
|
410
|
-
}
|
|
411
|
-
get data() {
|
|
412
|
-
return this.type !== re || !this.body ? null : st(this.body.textContent);
|
|
413
|
-
}
|
|
414
|
-
set data(t) {
|
|
415
|
-
if (this.type !== re || !this.body) throw new u("Only an extension message carries an object", "PACKET_FORMAT");
|
|
416
|
-
this.edit((n) => {
|
|
417
|
-
const r = n.root.child("body");
|
|
418
|
-
r.children = [new w(dt(t))];
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
edit(t) {
|
|
422
|
-
if (this.signed) throw new u("This message is signed by the client; changing it would fail the server’s check", "PACKET_FORMAT");
|
|
423
|
-
t(this.document), this.markModified();
|
|
424
|
-
}
|
|
425
|
-
serialize() {
|
|
426
|
-
return ne(this.document);
|
|
427
|
-
}
|
|
428
|
-
get envelope() {
|
|
429
|
-
const t = this.document.root;
|
|
430
|
-
return (t == null ? void 0 : t.name) === "msg" ? t : null;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
const b = "%", _ = "xt";
|
|
434
|
-
class P extends Le {
|
|
435
|
-
format = "xt";
|
|
436
|
-
fields;
|
|
437
|
-
constructor(t, n) {
|
|
438
|
-
super(t, n), this.fields = ct(t, n);
|
|
439
|
-
}
|
|
440
|
-
static create(t, n, r, i = [], s = "o") {
|
|
441
|
-
return new P(ie(t, { extension: s, command: n, room: String(r), args: i.map(String) }), t);
|
|
442
|
-
}
|
|
443
|
-
get command() {
|
|
444
|
-
return this.fields.command;
|
|
445
|
-
}
|
|
446
|
-
set command(t) {
|
|
447
|
-
L(t), this.fields.command = t, this.markModified();
|
|
448
|
-
}
|
|
449
|
-
get extension() {
|
|
450
|
-
return this.fields.extension;
|
|
451
|
-
}
|
|
452
|
-
get room() {
|
|
453
|
-
const t = Number(this.fields.room);
|
|
454
|
-
return Number.isInteger(t) ? t : null;
|
|
455
|
-
}
|
|
456
|
-
set room(t) {
|
|
457
|
-
this.fields.room = String(t), this.markModified();
|
|
458
|
-
}
|
|
459
|
-
get args() {
|
|
460
|
-
return [...this.fields.args];
|
|
461
|
-
}
|
|
462
|
-
get length() {
|
|
463
|
-
return this.fields.args.length;
|
|
464
|
-
}
|
|
465
|
-
arg(t) {
|
|
466
|
-
return this.fields.args[t];
|
|
467
|
-
}
|
|
468
|
-
setArg(t, n) {
|
|
469
|
-
if (!Number.isInteger(t) || t < 0 || t > this.fields.args.length) throw new RangeError(`Argument ${t} is outside a message of ${this.length} arguments`);
|
|
470
|
-
const r = String(n);
|
|
471
|
-
L(r), this.fields.args[t] = r, this.markModified();
|
|
472
|
-
}
|
|
473
|
-
setArgs(t) {
|
|
474
|
-
const n = t.map(String);
|
|
475
|
-
n.forEach(L), this.fields.args = n, this.markModified();
|
|
476
|
-
}
|
|
477
|
-
serialize() {
|
|
478
|
-
return ie(this.direction, this.fields);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
function ct(e, t) {
|
|
482
|
-
if (e.length < 2 || !e.startsWith(b) || !e.endsWith(b)) throw new u('An extension message starts and ends with "%"', "XT_SYNTAX");
|
|
483
|
-
const n = e.slice(1, -1).split(b);
|
|
484
|
-
if (n[0] !== _) throw new u(`Expected the "xt" handler, found "${n[0]}"`, "XT_SYNTAX", 1);
|
|
485
|
-
const r = t === "toServer" ? 4 : 3;
|
|
486
|
-
if (n.length < r) throw new u(`A message to the ${t === "toServer" ? "server" : "client"} has at least ${r} fields`, "XT_SYNTAX");
|
|
487
|
-
return t === "toServer" ? { extension: n[1], command: n[2], room: n[3], args: n.slice(4) } : { extension: null, command: n[1], room: n[2], args: n.slice(3) };
|
|
488
|
-
}
|
|
489
|
-
function ie(e, t) {
|
|
490
|
-
const n = [...e === "toServer" ? [_, t.extension ?? "o", t.command, t.room] : [_, t.command, t.room], ...t.args];
|
|
491
|
-
return n.forEach(L), b + n.map((r) => r + b).join("");
|
|
492
|
-
}
|
|
493
|
-
function L(e) {
|
|
494
|
-
if (e.includes(b)) throw new u(`An extension message value cannot contain "${b}": ${e}`, "XT_VALUE");
|
|
495
|
-
}
|
|
496
|
-
class k {
|
|
497
|
-
constructor(t, n) {
|
|
498
|
-
this.values = t, this.packet = n;
|
|
499
|
-
}
|
|
500
|
-
values;
|
|
501
|
-
packet;
|
|
502
|
-
index = 0;
|
|
503
|
-
get position() {
|
|
504
|
-
return this.index;
|
|
505
|
-
}
|
|
506
|
-
get remaining() {
|
|
507
|
-
return this.values.length - this.index;
|
|
508
|
-
}
|
|
509
|
-
string(t) {
|
|
510
|
-
return this.next(t);
|
|
511
|
-
}
|
|
512
|
-
int(t) {
|
|
513
|
-
const n = this.next(t), r = Number(n);
|
|
514
|
-
return (n.trim() === "" || !Number.isInteger(r)) && this.fail(t, this.index - 1, "is not an integer", n), r;
|
|
515
|
-
}
|
|
516
|
-
number(t) {
|
|
517
|
-
const n = this.next(t), r = Number(n);
|
|
518
|
-
return (n.trim() === "" || !Number.isFinite(r)) && this.fail(t, this.index - 1, "is not a number", n), r;
|
|
519
|
-
}
|
|
520
|
-
flag(t) {
|
|
521
|
-
return this.next(t) !== "0";
|
|
522
|
-
}
|
|
523
|
-
repeat(t, n) {
|
|
524
|
-
return Array.from({ length: t }, (r, i) => n(i));
|
|
525
|
-
}
|
|
526
|
-
rest() {
|
|
527
|
-
const t = this.values.slice(this.index);
|
|
528
|
-
return this.index = this.values.length, t;
|
|
529
|
-
}
|
|
530
|
-
next(t) {
|
|
531
|
-
return this.index >= this.values.length && this.fail(t, this.index, `is missing: the message has ${this.values.length} arguments`), this.values[this.index++];
|
|
532
|
-
}
|
|
533
|
-
fail(t, n, r, i) {
|
|
534
|
-
const s = i === void 0 ? "" : ` ("${i}")`;
|
|
535
|
-
throw new u(`${this.packet}: field "${t}" (${n}) ${r}${s}`, "PACKET_FIELD");
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
class mt {
|
|
539
|
-
written = [];
|
|
540
|
-
string(t) {
|
|
541
|
-
return this.written.push(t), this;
|
|
542
|
-
}
|
|
543
|
-
int(t) {
|
|
544
|
-
if (!Number.isInteger(t)) throw new RangeError(`${t} is not an integer`);
|
|
545
|
-
return this.written.push(t), this;
|
|
546
|
-
}
|
|
547
|
-
number(t) {
|
|
548
|
-
if (!Number.isFinite(t)) throw new RangeError(`${t} is not a finite number`);
|
|
549
|
-
return this.written.push(t), this;
|
|
550
|
-
}
|
|
551
|
-
flag(t) {
|
|
552
|
-
return this.written.push(t ? "1" : "0"), this;
|
|
553
|
-
}
|
|
554
|
-
each(t, n) {
|
|
555
|
-
return t.forEach(n), this;
|
|
556
|
-
}
|
|
557
|
-
raw(t) {
|
|
558
|
-
return this.written.push(...t), this;
|
|
559
|
-
}
|
|
560
|
-
get values() {
|
|
561
|
-
return this.written;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
function a(e) {
|
|
565
|
-
const { name: t, description: n, direction: r, command: i, extension: s = "o", read: o, write: d } = e, m = (c) => c instanceof P && c.direction === r && c.command === i && (r === "toClient" || c.extension === s);
|
|
566
|
-
return { name: t, description: n, format: "xt", direction: r, command: i, matches: m, decode(c) {
|
|
567
|
-
return Ee(m(c), t, c), { ...o(new k(c.args, t)), room: c.room ?? -1 };
|
|
568
|
-
}, encode(c) {
|
|
569
|
-
const l = new mt();
|
|
570
|
-
return d(l, c), P.create(r, i, c.room, l.values, s);
|
|
571
|
-
} };
|
|
572
|
-
}
|
|
573
|
-
function q(e) {
|
|
574
|
-
const { name: t, description: n, direction: r, command: i, type: s, read: o, write: d } = e, m = (c) => c instanceof E && c.direction === r && c.type === s && c.command === i;
|
|
575
|
-
return { name: t, description: n, format: "xml", direction: r, command: i, matches: m, decode(c) {
|
|
576
|
-
return Ee(m(c), t, c), { ...o(c), room: c.room ?? -1 };
|
|
577
|
-
}, encode(c) {
|
|
578
|
-
return E.create(r, s, i, c.room, d(c));
|
|
579
|
-
} };
|
|
580
|
-
}
|
|
581
|
-
function Ee(e, t, n) {
|
|
582
|
-
if (!e) throw new TypeError(`A ${n.format} "${n.command}" message ${n.direction} is not ${t}`);
|
|
583
|
-
}
|
|
584
|
-
function ae(e) {
|
|
585
|
-
return { invId: e.int("invId"), defId: e.int("defId") };
|
|
586
|
-
}
|
|
587
|
-
function se(e, t) {
|
|
588
|
-
e.int(t.length).each(t, ({ invId: n, defId: r }) => e.int(n).int(r));
|
|
589
|
-
}
|
|
590
|
-
a({ name: "achievement.list-request", description: "The client asks for a player’s achievements.", direction: "toServer", command: "za", read: (e) => ({ userName: e.string("userName"), secondsSinceLastAsked: e.int("secondsSinceLastAsked") }), write: (e, { userName: t, secondsSinceLastAsked: n }) => e.string(t).int(n) }), a({ name: "achievement.set-user-var", description: "The client sets one of the player’s user variables.", direction: "toServer", command: "zs", read: (e) => ({ userVarId: e.int("userVarId"), value: e.int("value"), notify: e.flag("notify") }), write: (e, { userVarId: t, value: n, notify: r }) => e.int(t).int(n).int(r ? 1 : 0) }), a({ name: "achievement.user-vars-request", description: "The client asks for all of the player’s user variables.", direction: "toServer", command: "zg", read: () => ({}), write: () => {
|
|
591
|
-
} }), a({ name: "achievement.list", description: "The server gives a player’s achievements.", direction: "toClient", command: "za", read: (e) => {
|
|
592
|
-
const t = e.string("userName"), n = e.int("count");
|
|
593
|
-
return { userName: t, archived: n === -1, achievements: e.repeat(Math.max(n, 0), () => ae(e)) };
|
|
594
|
-
}, write: (e, { userName: t, archived: n, achievements: r }) => {
|
|
595
|
-
e.string(t), n ? e.int(-1) : se(e, r);
|
|
596
|
-
} }), a({ name: "achievement.user-var-changed", description: "One of the player’s user variables changed, and any achievements it earned.", direction: "toClient", command: "zs", read: (e) => ({ userVarId: e.int("userVarId"), value: e.number("value"), achievements: e.repeat(e.int("count"), () => ae(e)) }), write: (e, { userVarId: t, value: n, achievements: r }) => {
|
|
597
|
-
e.int(t).number(n), se(e, r);
|
|
598
|
-
} }), a({ name: "achievement.user-vars", description: "The server gives all of the player’s user variables.", direction: "toClient", command: "zg", read: (e) => ({ userVars: e.repeat(e.int("count"), () => ({ userVarId: e.int("userVarId"), type: e.int("type"), value: e.number("value") })) }), write: (e, { userVars: t }) => e.int(t.length).each(t, ({ userVarId: n, type: r, value: i }) => e.int(n).int(r).number(i)) }), a({ name: "adopt-a-pet.data-request", description: "The client asks for another player’s Adopt a Pet cards.", direction: "toServer", command: "pad", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "adopt-a-pet.data", description: "The server lists a player’s Adopt a Pet cards.", direction: "toClient", command: "pad", read: (e) => {
|
|
599
|
-
const t = e.flag("success");
|
|
600
|
-
return t ? { success: t, cards: e.repeat(e.int("count"), () => ({ defId: e.int("defId"), invId: e.int("invId") })) } : { success: t, cards: [] };
|
|
601
|
-
}, write: (e, { success: t, cards: n }) => {
|
|
602
|
-
e.flag(t), t && e.int(n.length).each(n, (r) => e.int(r.defId).int(r.invId));
|
|
603
|
-
} }), a({ name: "adopt-a-pet.count-request", description: "The client asks how many Adopt a Pet cards another player has.", direction: "toServer", command: "padc", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "adopt-a-pet.count", description: "The server says how many Adopt a Pet cards a player has.", direction: "toClient", command: "padc", read: (e) => ({ count: e.int("count") }), write: (e, { count: t }) => e.int(t) }), a({ name: "adopt-a-pet.seen-request", description: "The player marks Adopt a Pet cards as seen.", direction: "toServer", command: "pads", read: (e) => ({ defIds: e.repeat(e.remaining, () => e.int("defId")) }), write: (e, { defIds: t }) => e.each(t, (n) => e.int(n)) });
|
|
604
|
-
function Pe(e) {
|
|
605
|
-
return { lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), name: e.string("petName"), createdTs: e.number("createdTs"), personalityDefId: e.int("personalityDefId"), favoriteFoodDefId: e.int("favoriteFoodDefId"), favoriteToyDefId: e.int("favoriteToyDefId") };
|
|
606
|
-
}
|
|
607
|
-
function Me(e, t) {
|
|
608
|
-
e.int(t.lBits).int(t.uBits).int(t.eBits).string(t.name).number(t.createdTs).int(t.personalityDefId).int(t.favoriteFoodDefId).int(t.favoriteToyDefId);
|
|
609
|
-
}
|
|
610
|
-
a({ name: "pet.list-request", description: "The client asks for a player’s pets.", direction: "toServer", command: "pl", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "pet.list", description: "The server lists a player’s pets.", direction: "toClient", command: "pl", read: (e) => {
|
|
611
|
-
const t = e.string("found") === "1";
|
|
612
|
-
if (!t) return { found: t, userName: "", pets: [] };
|
|
613
|
-
const n = e.string("userName"), r = e.repeat(e.int("count"), () => ({ invId: e.int("invId"), createdTs: e.number("createdTs"), name: e.string("name"), lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), masteryCounter: e.int("masteryCounter"), personalityDefId: e.int("personalityDefId"), favoriteToyDefId: e.int("favoriteToyDefId"), favoriteFoodDefId: e.int("favoriteFoodDefId"), denStoreInvId: e.int("denStoreInvId") }));
|
|
614
|
-
return { found: t, userName: n, pets: r };
|
|
615
|
-
}, write: (e, { found: t, userName: n, pets: r }) => {
|
|
616
|
-
e.string(t ? "1" : "0"), t && e.string(n).int(r.length).each(r, (i) => e.int(i.invId).number(i.createdTs).string(i.name).int(i.lBits).int(i.uBits).int(i.eBits).int(i.masteryCounter).int(i.personalityDefId).int(i.favoriteToyDefId).int(i.favoriteFoodDefId).int(i.denStoreInvId));
|
|
617
|
-
} }), a({ name: "pet.switch-request", description: "The player brings out a pet, or puts theirs away.", direction: "toServer", command: "ps", read: (e) => ({ invId: e.int("invId") }), write: (e, { invId: t }) => e.int(t) }), a({ name: "pet.switched", description: "Someone brought out a pet or put theirs away.", direction: "toClient", command: "ps", read: (e) => {
|
|
618
|
-
const t = e.string("success") === "1";
|
|
619
|
-
if (!t) return { success: t, userId: -1, activePetInvId: null, pet: null };
|
|
620
|
-
const n = e.int("userId");
|
|
621
|
-
return e.remaining === 1 ? { success: t, userId: n, activePetInvId: e.int("activePetInvId"), pet: null } : { success: t, userId: n, activePetInvId: null, pet: Pe(e) };
|
|
622
|
-
}, write: (e, { success: t, userId: n, activePetInvId: r, pet: i }) => {
|
|
623
|
-
if (e.string(t ? "1" : "0"), !!t) if (e.int(n), i) Me(e, i);
|
|
624
|
-
else if (r !== null) e.int(r);
|
|
625
|
-
else throw new u("pet.switched: a success names a pet or an inventory id", "PACKET_FIELD");
|
|
626
|
-
} }), a({ name: "pet.mastery-display-request", description: "The player shows or hides a pet’s mastery badge.", direction: "toServer", command: "pm", read: (e) => ({ show: e.flag("show"), invId: e.int("invId") }), write: (e, { show: t, invId: n }) => e.flag(t).int(n) }), a({ name: "pet.mastery-displayed", description: "The server says whether a pet’s mastery badge changed.", direction: "toClient", command: "pm", read: (e) => {
|
|
627
|
-
const t = e.flag("success");
|
|
628
|
-
return t ? { success: t, invId: e.int("invId"), lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits") } : { success: t, invId: -1, lBits: 0, uBits: 0, eBits: 0 };
|
|
629
|
-
}, write: (e, { success: t, invId: n, lBits: r, uBits: i, eBits: s }) => {
|
|
630
|
-
e.flag(t), t && e.int(n).int(r).int(i).int(s);
|
|
631
|
-
} }), a({ name: "pet.egg-name-request", description: "The player names a newly hatched egg pet from two lists of predefined name parts.", direction: "toServer", command: "pn", read: (e) => ({ invId: e.int("invId"), firstNameLocId: e.int("firstNameLocId"), secondNameLocId: e.int("secondNameLocId") }), write: (e, { invId: t, firstNameLocId: n, secondNameLocId: r }) => e.int(t).int(n).int(r) }), a({ name: "pet.egg-named", description: "The server says whether an egg pet was named.", direction: "toClient", command: "pn", read: (e) => ({ success: e.flag("success"), invId: e.int("invId"), name: e.string("name") }), write: (e, { success: t, invId: n, name: r }) => e.flag(t).int(n).string(r) }), a({ name: "pet.create-request", description: "The player adopts a new pet.", direction: "toServer", command: "pc", read: (e) => ({ shopId: e.int("shopId"), lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), firstNameLocId: e.int("firstNameLocId"), secondNameLocId: e.int("secondNameLocId"), fromRedemption: e.flag("fromRedemption") }), write: (e, t) => e.int(t.shopId).int(t.lBits).int(t.uBits).int(t.eBits).int(t.firstNameLocId).int(t.secondNameLocId).flag(t.fromRedemption) }), a({ name: "pet.created", description: "The server says whether a new pet was adopted.", direction: "toClient", command: "pc", read: (e) => {
|
|
632
|
-
const t = e.flag("success");
|
|
633
|
-
if (!t) return { success: t, balance: 0, currencyType: 0, pet: null };
|
|
634
|
-
const n = e.int("balance"), r = e.int("currencyType"), i = e.int("invId"), s = e.int("lBits"), o = e.int("uBits"), d = e.int("eBits"), m = e.string("name"), c = e.number("createdTs"), l = e.int("personalityDefId"), g = e.int("favoriteToyDefId"), h = e.int("favoriteFoodDefId"), $ = e.flag("broughtOut");
|
|
635
|
-
return { success: t, balance: n, currencyType: r, pet: { invId: i, lBits: s, uBits: o, eBits: d, name: m, createdTs: c, personalityDefId: l, favoriteToyDefId: g, favoriteFoodDefId: h, broughtOut: $ } };
|
|
636
|
-
}, write: (e, t) => {
|
|
637
|
-
e.flag(t.success), !(!t.success || !t.pet) && e.int(t.balance).int(t.currencyType).int(t.pet.invId).int(t.pet.lBits).int(t.pet.uBits).int(t.pet.eBits).string(t.pet.name).number(t.pet.createdTs).int(t.pet.personalityDefId).int(t.pet.favoriteToyDefId).int(t.pet.favoriteFoodDefId).flag(t.pet.broughtOut);
|
|
638
|
-
} }), a({ name: "pet.dismiss-request", description: "The player frees one of their pets.", direction: "toServer", command: "pd", read: (e) => ({ invId: e.int("invId") }), write: (e, { invId: t }) => e.int(t) }), a({ name: "pet.dismissed", description: "The server says whether a pet was freed.", direction: "toClient", command: "pd", read: (e) => ({ success: e.string("success") === "1", invId: e.int("invId") }), write: (e, { success: t, invId: n }) => e.string(t ? "1" : "0").int(n) }), a({ name: "pet.shop-buy-request", description: "The player buys a pet they have not unlocked from a shop.", direction: "toServer", command: "pb", read: (e) => ({ shopId: e.int("shopId"), itemDefId: e.int("itemDefId"), lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), firstNameLocId: e.int("firstNameLocId"), secondNameLocId: e.int("secondNameLocId"), fromRedemption: e.flag("fromRedemption") }), write: (e, t) => e.int(t.shopId).int(t.itemDefId).int(t.lBits).int(t.uBits).int(t.eBits).int(t.firstNameLocId).int(t.secondNameLocId).flag(t.fromRedemption) }), a({ name: "pet.items-request", description: "The player changes what their pet that is out is wearing.", direction: "toServer", command: "pi", read: (e) => ({ cat9: e.int("cat9"), cat10: e.int("cat10"), cat11: e.int("cat11"), enviroType: e.int("enviroType") }), write: (e, { cat9: t, cat10: n, cat11: r, enviroType: i }) => e.int(t).int(n).int(r).int(i) }), a({ name: "pet.items-changed", description: "The server says whether the pet that is out now wears something new.", direction: "toClient", command: "pi", read: (e) => {
|
|
639
|
-
const t = e.flag("success");
|
|
640
|
-
return t ? { success: t, gems: e.int("gems"), invId: e.int("invId"), lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits") } : { success: t, gems: 0, invId: -1, lBits: 0, uBits: 0, eBits: 0 };
|
|
641
|
-
}, write: (e, { success: t, gems: n, invId: r, lBits: i, uBits: s, eBits: o }) => {
|
|
642
|
-
e.flag(t), t && e.int(n).int(r).int(i).int(s).int(o);
|
|
643
|
-
} }), a({ name: "pet.unlocked", description: "The server says which kinds of pet the account has unlocked.", direction: "toClient", command: "pu", read: (e) => ({ unlockedPets: e.string("unlockedPets") }), write: (e, { unlockedPets: t }) => e.string(t) }), a({ name: "avatar.move", description: "The player walks or is placed somewhere in the room.", direction: "toServer", command: "au", read: (e) => {
|
|
644
|
-
const t = e.int("count"), n = e.repeat(t, () => ({ x: e.int("x"), y: e.int("y") })), r = e.int("animation") >>> 0;
|
|
645
|
-
return { points: n, animation: r, immediate: e.flag("immediate") };
|
|
646
|
-
}, write: (e, { points: t, animation: n, immediate: r }) => e.int(t.length).each(t, ({ x: i, y: s }) => e.int(i).int(s)).int(n >>> 0).flag(r) }), a({ name: "avatar.moved", description: "Avatars in the room walked or were placed.", direction: "toClient", command: "au", read: (e) => ({ avatars: e.repeat(e.int("users"), () => {
|
|
647
|
-
const t = e.int("userId"), n = e.int("count"), r = e.repeat(n, () => ({ x: e.int("x"), y: e.int("y") }));
|
|
648
|
-
return { userId: t, path: r, teleport: e.flag("teleport") };
|
|
649
|
-
}) }), write: (e, { avatars: t }) => e.int(t.length).each(t, ({ userId: n, path: r, teleport: i }) => e.int(n).int(r.length).each(r, ({ x: s, y: o }) => e.int(s).int(o)).flag(i)) }), a({ name: "avatar.paint", description: "The player changes their avatar’s colours.", direction: "toServer", command: "ap", read: (e) => ({ colors: [e.int("color1"), e.int("color2"), e.int("color3")], avatarId: e.int("avatarId") }), write: (e, { colors: t, avatarId: n }) => e.int(t[0]).int(t[1]).int(t[2]).int(n) });
|
|
650
|
-
function A(e) {
|
|
651
|
-
return [e.int("color1"), e.int("color2"), e.int("color3")];
|
|
652
|
-
}
|
|
653
|
-
function D(e, t) {
|
|
654
|
-
e.int(t[0]).int(t[1]).int(t[2]);
|
|
655
|
-
}
|
|
656
|
-
function oe(e) {
|
|
657
|
-
return e !== void 0 && e.trim() !== "" && Number.isInteger(Number(e));
|
|
658
|
-
}
|
|
659
|
-
a({ name: "avatar.paint-result", description: "The server says whether the player’s colours changed.", direction: "toClient", command: "ap", read: (e) => ({ success: e.string("success") === "1", extra: e.rest() }), write: (e, { success: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), a({ name: "avatar.switch-request", description: "The player switches to another of their avatars.", direction: "toServer", command: "as", read: (e) => ({ perUserAvId: e.int("perUserAvId") }), write: (e, { perUserAvId: t }) => e.int(t) }), a({ name: "avatar.switched", description: "Someone in the room switched avatars.", direction: "toClient", command: "as", read: (e) => {
|
|
660
|
-
if (!e.flag("success")) return { success: !1, extra: e.rest() };
|
|
661
|
-
const t = e.int("userId"), n = { perUserAvId: e.int("perUserAvId"), avInvId: e.int("avInvId"), customAvId: e.int("customAvId"), avTypeId: e.int("avTypeId"), colors: A(e), avName: e.string("avName") };
|
|
662
|
-
if (e.remaining === 2) {
|
|
663
|
-
const i = { activePetInvId: e.int("activePetInvId"), questLevel: e.int("questLevel") };
|
|
664
|
-
return { success: !0, userId: t, avatar: n, player: i, other: null };
|
|
665
|
-
}
|
|
666
|
-
const r = { pet: Pe(e), questLevel: e.int("questLevel") };
|
|
667
|
-
return { success: !0, userId: t, avatar: n, player: null, other: r };
|
|
668
|
-
}, write: (e, t) => {
|
|
669
|
-
if (!t.success) {
|
|
670
|
-
e.flag(!1).raw(t.extra);
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
const { userId: n, avatar: r, player: i, other: s } = t;
|
|
674
|
-
if (e.flag(!0).int(n).int(r.perUserAvId).int(r.avInvId).int(r.customAvId).int(r.avTypeId), D(e, r.colors), e.string(r.avName), i) e.int(i.activePetInvId).int(i.questLevel);
|
|
675
|
-
else if (s) Me(e, s.pet), e.int(s.questLevel);
|
|
676
|
-
else throw new u("avatar.switched: a success has a player or an other part", "PACKET_FIELD");
|
|
677
|
-
} }), a({ name: "avatar.list-request", description: "The client asks for a player’s avatars.", direction: "toServer", command: "al", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "avatar.list", description: "The server lists a player’s avatars.", direction: "toClient", command: "al", read: (e) => {
|
|
678
|
-
const t = e.rest(), n = new k(t, "avatar.list"), r = n.string("userName"), i = Number(t[1]);
|
|
679
|
-
if (oe(t[1]) && t.length === 2 + i && t.slice(2).every((m) => oe(m))) {
|
|
680
|
-
const m = n.int("count");
|
|
681
|
-
return { own: !1, userName: r, perUserAvIds: n.repeat(m, () => n.int("perUserAvId")) };
|
|
682
|
-
}
|
|
683
|
-
const s = n.int("slotFlags") >>> 0, o = n.string("uuid"), d = n.repeat(n.int("count"), () => ({ perUserAvId: n.int("perUserAvId"), avInvId: n.int("avInvId"), avName: n.string("avName"), avTypeId: n.int("avTypeId"), customAvId: n.int("customAvId") }));
|
|
684
|
-
return { own: !0, userName: r, slotFlags: s, uuid: o, avatars: d };
|
|
685
|
-
}, write: (e, t) => {
|
|
686
|
-
if (e.string(t.userName), !t.own) {
|
|
687
|
-
e.int(t.perUserAvIds.length).each(t.perUserAvIds, (n) => e.int(n));
|
|
688
|
-
return;
|
|
689
|
-
}
|
|
690
|
-
e.int(t.slotFlags >>> 0).string(t.uuid).int(t.avatars.length).each(t.avatars, (n) => e.int(n.perUserAvId).int(n.avInvId).string(n.avName).int(n.avTypeId).int(n.customAvId));
|
|
691
|
-
} }), a({ name: "avatar.data-request", description: "The client asks for one of a player’s avatars.", direction: "toServer", command: "ad", read: (e) => ({ userName: e.string("userName"), perUserAvId: e.int("perUserAvId"), items: e.int("items") }), write: (e, { userName: t, perUserAvId: n, items: r }) => e.string(t).int(n).int(r) }), a({ name: "avatar.data", description: "The server describes one of a player’s avatars.", direction: "toClient", command: "ad", read: (e) => {
|
|
692
|
-
const t = { userName: e.string("userName"), uuid: e.string("uuid"), nameBarData: e.int("nameBarData"), enviroType: e.int("enviroType"), userNameModeratedFlag: e.int("userNameModeratedFlag"), timeLeftHostingCustomParty: e.int("timeLeftHostingCustomParty"), daysSinceLastLogin: e.int("daysSinceLastLogin"), perUserAvId: e.int("perUserAvId"), avTypeId: e.int("avTypeId"), customAvId: e.int("customAvId"), colors: A(e), avName: e.string("avName"), questLevel: e.int("questLevel") };
|
|
693
|
-
if (e.remaining === 8) {
|
|
694
|
-
const r = { avInvId: e.int("avInvId"), landPetInvId: e.int("landPetInvId"), oceanPetInvId: e.int("oceanPetInvId"), attackBase: e.int("attackBase"), attackMax: e.int("attackMax"), defenseBase: e.int("defenseBase"), defenseMax: e.int("defenseMax"), healthBase: e.int("healthBase") };
|
|
695
|
-
return { ...t, player: r, other: null };
|
|
696
|
-
}
|
|
697
|
-
const n = { lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), petName: e.string("petName") };
|
|
698
|
-
return { ...t, player: null, other: n };
|
|
699
|
-
}, write: (e, t) => {
|
|
700
|
-
e.string(t.userName).string(t.uuid).int(t.nameBarData).int(t.enviroType).int(t.userNameModeratedFlag).int(t.timeLeftHostingCustomParty).int(t.daysSinceLastLogin).int(t.perUserAvId).int(t.avTypeId).int(t.customAvId), D(e, t.colors), e.string(t.avName).int(t.questLevel);
|
|
701
|
-
const { player: n, other: r } = t;
|
|
702
|
-
if (n) e.int(n.avInvId).int(n.landPetInvId).int(n.oceanPetInvId).int(n.attackBase).int(n.attackMax).int(n.defenseBase).int(n.defenseMax).int(n.healthBase);
|
|
703
|
-
else if (r) e.int(r.lBits).int(r.uBits).int(r.eBits).string(r.petName);
|
|
704
|
-
else throw new u("avatar.data: an avatar has a player or an other part", "PACKET_FIELD");
|
|
705
|
-
} }), a({ name: "avatar.lookup-request", description: "The client looks a player up by name.", direction: "toServer", command: "ag", read: (e) => ({ userName: e.string("userName"), userLookup: e.flag("userLookup") }), write: (e, { userName: t, userLookup: n }) => e.string(t).flag(n) }), a({ name: "avatar.lookup", description: "The server describes a player looked up by name.", direction: "toClient", command: "ag", read: (e) => {
|
|
706
|
-
const t = e.string("userName"), n = e.string("uuid"), r = e.int("status");
|
|
707
|
-
if (r !== 0 && r !== 1) return { userName: t, uuid: n, status: r, avatar: null };
|
|
708
|
-
const i = { accountType: e.int("accountType"), isGuide: e.string("isGuide") === "1", daysSinceLastLogin: e.int("daysSinceLastLogin"), perUserAvId: e.int("perUserAvId"), avInvId: e.int("avInvId"), nameBarData: e.int("nameBarData"), avTypeId: e.int("avTypeId"), customAvId: e.int("customAvId"), colors: A(e), avName: e.string("avName"), eyesDefId: e.int("eyesDefId"), patternDefId: e.int("patternDefId"), questLevel: e.int("questLevel") }, s = e.int("count"), o = { userId: e.int("userId"), userNameModeratedFlag: e.int("userNameModeratedFlag"), pet: { lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), name: e.string("petName") }, items: e.repeat(s, () => ({ defId: e.int("defId"), color: e.int("color") })) };
|
|
709
|
-
return { userName: t, uuid: n, status: r, avatar: { ...i, ...o } };
|
|
710
|
-
}, write: (e, { userName: t, uuid: n, status: r, avatar: i }) => {
|
|
711
|
-
e.string(t).string(n).int(r), i && (e.int(i.accountType).string(i.isGuide ? "1" : "0").int(i.daysSinceLastLogin).int(i.perUserAvId).int(i.avInvId).int(i.nameBarData).int(i.avTypeId).int(i.customAvId), D(e, i.colors), e.string(i.avName).int(i.eyesDefId).int(i.patternDefId).int(i.questLevel).int(i.items.length).int(i.userId).int(i.userNameModeratedFlag).int(i.pet.lBits).int(i.pet.uBits).int(i.pet.eBits).string(i.pet.name).each(i.items, ({ defId: s, color: o }) => e.int(s).int(o)));
|
|
712
|
-
} }), a({ name: "avatar.joined", description: "An avatar appears in the room.", direction: "toClient", command: "ac", read: (e) => ({ userId: e.int("userId"), x: e.int("x"), y: e.int("y"), animation: e.int("animation") >>> 0, userName: e.string("userName"), uuid: e.string("uuid"), perUserAvId: e.int("perUserAvId"), avName: e.string("avName"), avTypeId: e.int("avTypeId"), customAvId: e.int("customAvId"), colors: A(e), questLevel: e.int("questLevel"), details: e.rest() }), write: (e, t) => {
|
|
713
|
-
e.int(t.userId).int(t.x).int(t.y).int(t.animation >>> 0).string(t.userName).string(t.uuid).int(t.perUserAvId).string(t.avName).int(t.avTypeId).int(t.customAvId), D(e, t.colors), e.int(t.questLevel).raw(t.details);
|
|
714
|
-
} }), a({ name: "avatar.kill-request", description: "The player deletes one of their avatars for good.", direction: "toServer", command: "ak", read: (e) => ({ perUserAvId: e.int("perUserAvId") }), write: (e, { perUserAvId: t }) => e.int(t) }), a({ name: "avatar.killed", description: "The server says whether an avatar was deleted for good.", direction: "toClient", command: "ak", read: (e) => ({ success: e.flag("success"), extra: e.int("extra") }), write: (e, { success: t, extra: n }) => e.flag(t).int(n) }), a({ name: "avatar.left", description: "An avatar leaves the room.", direction: "toClient", command: "ar", read: (e) => {
|
|
715
|
-
const t = e.int("userId");
|
|
716
|
-
if (e.remaining === 0) return { userId: t, walkOut: 0, walkTo: null, extra: [] };
|
|
717
|
-
const n = e.int("walkOut"), r = n > 0 ? { x: e.int("x"), y: e.int("y") } : null;
|
|
718
|
-
return { userId: t, walkOut: n, walkTo: r, extra: e.rest() };
|
|
719
|
-
}, write: (e, { userId: t, walkOut: n, walkTo: r, extra: i }) => {
|
|
720
|
-
e.int(t), !(n === 0 && !r && i.length === 0) && (e.int(n), n > 0 && r && e.int(r.x).int(r.y), e.raw(i));
|
|
721
|
-
} });
|
|
722
|
-
function de(e) {
|
|
723
|
-
return [e.int("nameId1"), e.int("nameId2"), e.int("nameId3")];
|
|
724
|
-
}
|
|
725
|
-
function ce(e, t) {
|
|
726
|
-
e.int(t[0]).int(t[1]).int(t[2]);
|
|
727
|
-
}
|
|
728
|
-
a({ name: "avatar.add-request", description: "The player adds a new animal to their account.", direction: "toServer", command: "aa", read: (e) => ({ nameIds: de(e), avTypeId: e.int("avTypeId"), customAvId: e.int("customAvId"), diamondDefId: e.int("diamondDefId"), shopId: e.int("shopId") }), write: (e, { nameIds: t, avTypeId: n, customAvId: r, diamondDefId: i, shopId: s }) => {
|
|
729
|
-
ce(e, t), e.int(n).int(r).int(i).int(s);
|
|
730
|
-
} }), a({ name: "avatar.added", description: "The server says whether a new animal was added to the account.", direction: "toClient", command: "aa", read: (e) => ({ status: e.int("status"), perUserAvId: e.int("perUserAvId"), avInvId: e.int("avInvId") }), write: (e, { status: t, perUserAvId: n, avInvId: r }) => e.int(t).int(n).int(r) }), a({ name: "avatar.slot-buy-request", description: "The player buys another avatar slot.", direction: "toServer", command: "ab", read: () => ({}), write: () => {
|
|
731
|
-
} }), a({ name: "avatar.slot-bought", description: "The server says whether another avatar slot was bought.", direction: "toClient", command: "ab", read: (e) => ({ success: e.flag("success") }), write: (e, { success: t }) => e.flag(t) }), a({ name: "avatar.pending-flag", description: "The client sets one of the account’s pending flags.", direction: "toServer", command: "af", read: (e) => ({ flag: e.int("flag") }), write: (e, { flag: t }) => e.int(t) }), a({ name: "avatar.fast-pass-add-request", description: "The player adds the first animal to an account made without one.", direction: "toServer", command: "afp", read: (e) => ({ avTypeId: e.int("avTypeId"), nameIds: de(e) }), write: (e, { avTypeId: t, nameIds: n }) => {
|
|
732
|
-
e.int(t), ce(e, n);
|
|
733
|
-
} }), a({ name: "avatar.fast-pass-added", description: "The server says whether the first animal of an account was added.", direction: "toClient", command: "afp", read: (e) => ({ success: e.flag("success") }), write: (e, { success: t }) => e.flag(t) }), a({ name: "avatar.lookup-by-id-request", description: "The client looks a player up by their id in the room.", direction: "toServer", command: "ags", read: (e) => ({ userId: e.int("userId"), userLookup: e.flag("userLookup") }), write: (e, { userId: t, userLookup: n }) => e.int(t).flag(n) }), a({ name: "avatar.name-bar-changed", description: "Someone in the room changed their name bar.", direction: "toClient", command: "an", read: (e) => ({ userId: e.int("userId"), nameBarData: e.int("nameBarData") }), write: (e, { userId: t, nameBarData: n }) => e.int(t).int(n) }), a({ name: "avatar.ordain-request", description: "The player chooses which of their avatars stay usable without a membership.", direction: "toServer", command: "ao", read: (e) => ({ avInvIds: e.repeat(e.remaining, () => e.int("avInvId")) }), write: (e, { avInvIds: t }) => e.each(t, (n) => e.int(n)) }), a({ name: "avatar.ordained", description: "The server says whether the avatars chosen to stay usable were taken.", direction: "toClient", command: "ao", read: (e) => ({ success: e.flag("success") }), write: (e, { success: t }) => e.flag(t) }), a({ name: "avatar.photo-request", description: "The player pays for a photo booth picture they saved.", direction: "toServer", command: "apb", read: () => ({}), write: () => {
|
|
734
|
-
} }), a({ name: "avatar.photo-taken", description: "The server says what the player has left after paying for a photo.", direction: "toClient", command: "apb", read: (e) => ({ gems: e.int("gems") }), write: (e, { gems: t }) => e.int(t) }), a({ name: "avatar.photo-check-request", description: "The client asks whether the player can pay for a photo booth picture.", direction: "toServer", command: "apc", read: () => ({}), write: () => {
|
|
735
|
-
} }), a({ name: "avatar.photo-checked", description: "The server says whether the player can pay for a photo booth picture.", direction: "toClient", command: "apc", read: (e) => ({ gems: e.int("gems") }), write: (e, { gems: t }) => e.int(t) }), a({ name: "buddy.list-request", description: "The player asks for their buddy and blocked lists.", direction: "toServer", command: "bl", read: () => ({}), write: () => {
|
|
736
|
-
} }), a({ name: "buddy.list", description: "The server sends the buddy list or the blocked list.", direction: "toClient", command: "bl", read: (e) => {
|
|
737
|
-
if (e.string("list") !== "0") {
|
|
738
|
-
const r = e.int("blocked");
|
|
739
|
-
return { blocked: !0, buddies: [], blockedUserNames: e.repeat(r, () => e.string("userName")) };
|
|
740
|
-
}
|
|
741
|
-
const t = e.repeat(e.int("online"), () => me(e, !0)), n = e.repeat(e.int("offline"), () => me(e, !1));
|
|
742
|
-
return { blocked: !1, buddies: [...t, ...n], blockedUserNames: [] };
|
|
743
|
-
}, write: (e, { blocked: t, buddies: n, blockedUserNames: r }) => {
|
|
744
|
-
if (t) {
|
|
745
|
-
e.string("1").int(r.length), r.forEach((o) => e.string(o));
|
|
746
|
-
return;
|
|
747
|
-
}
|
|
748
|
-
const i = n.filter((o) => o.online), s = n.filter((o) => !o.online);
|
|
749
|
-
e.string("0").int(i.length), i.forEach((o) => ue(e, o, !0)), e.int(s.length), s.forEach((o) => ue(e, o, !1));
|
|
750
|
-
} }), a({ name: "buddy.add-request", description: "The player asks someone to be their buddy.", direction: "toServer", command: "ba", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.add-result", description: "Someone asks to be a buddy, or the server answers the player’s request.", direction: "toClient", command: "ba", read: (e) => ({ status: e.int("status"), userName: e.string("userName"), userNameModerationFlag: e.int("userNameModerationFlag") }), write: (e, { status: t, userName: n, userNameModerationFlag: r }) => e.int(t).string(n).int(r) }), a({ name: "buddy.confirm", description: "The player accepts or declines a buddy request.", direction: "toServer", command: "bc", read: (e) => ({ userName: e.string("userName"), accept: e.flag("accept") }), write: (e, { userName: t, accept: n }) => e.string(t).flag(n) }), a({ name: "buddy.status", description: "A buddy comes online or goes offline, is added, or is renamed.", direction: "toClient", command: "bs", read: (e) => {
|
|
751
|
-
const t = e.string("withAvatar") === "1", n = { userName: e.string("userName"), uuid: e.string("uuid"), userNameModerationFlag: e.int("userNameModerationFlag"), online: e.string("online") === "1", accountType: e.int("accountType"), change: e.int("change") };
|
|
752
|
-
return t ? { withAvatar: t, ...n, newUserName: null, avatarName: e.string("avatarName"), perUserAvatarId: e.int("perUserAvatarId"), partyTimeLeft: e.int("partyTimeLeft") } : { withAvatar: t, ...n, newUserName: e.string("newUserName"), avatarName: null, perUserAvatarId: null, partyTimeLeft: null };
|
|
753
|
-
}, write: (e, t) => {
|
|
754
|
-
e.flag(t.withAvatar).string(t.userName).string(t.uuid).int(t.userNameModerationFlag).flag(t.online).int(t.accountType).int(t.change), t.withAvatar ? e.string(t.avatarName ?? "").int(t.perUserAvatarId ?? -1).int(t.partyTimeLeft ?? -1) : e.string(t.newUserName ?? "");
|
|
755
|
-
} }), a({ name: "buddy.remove-request", description: "The player removes a buddy.", direction: "toServer", command: "bd", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.removed", description: "A buddy is no longer a buddy.", direction: "toClient", command: "bd", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.location-request", description: "The player asks where a buddy is.", direction: "toServer", command: "br", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.location", description: "The server says where a buddy is.", direction: "toClient", command: "br", read: (e) => ({ roomName: e.string("roomName"), displayName: e.string("displayName"), displayNameId: e.int("displayNameId"), locked: e.string("locked") === "1" }), write: (e, { roomName: t, displayName: n, displayNameId: r, locked: i }) => e.string(t).string(n).int(r).flag(i) }), a({ name: "buddy.block-request", description: "The player blocks someone.", direction: "toServer", command: "bb", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.block-result", description: "The server says whether someone was blocked.", direction: "toClient", command: "bb", read: (e) => ({ userName: e.string("userName"), success: e.string("success") === "1" }), write: (e, { userName: t, success: n }) => e.string(t).flag(n) }), a({ name: "buddy.unblock-request", description: "The player unblocks someone.", direction: "toServer", command: "bu", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.unblock-result", description: "The server says whether someone was unblocked.", direction: "toClient", command: "bu", read: (e) => ({ userName: e.string("userName"), success: e.string("success") === "1" }), write: (e, { userName: t, success: n }) => e.string(t).flag(n) }), a({ name: "buddy.block-info-request", description: "The player asks whether someone is blocking them.", direction: "toServer", command: "bi", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.block-info", description: "The server says whether someone is blocking the player.", direction: "toClient", command: "bi", read: (e) => ({ userName: e.string("userName"), blockingPlayer: e.string("blockingPlayer") === "1" }), write: (e, { userName: t, blockingPlayer: n }) => e.string(t).flag(n) });
|
|
756
|
-
function me(e, t) {
|
|
757
|
-
return { userName: e.string("userName"), uuid: e.string("uuid"), userNameModerationFlag: e.int("userNameModerationFlag"), online: t, accountType: e.int("accountType"), partyTimeLeft: t ? e.int("partyTimeLeft") : null };
|
|
758
|
-
}
|
|
759
|
-
function ue(e, t, n) {
|
|
760
|
-
e.string(t.userName).string(t.uuid).int(t.userNameModerationFlag).int(t.accountType), n && e.int(t.partyTimeLeft ?? -1);
|
|
761
|
-
}
|
|
762
|
-
const an = { free: 0, safeChat: 1, emote: 2, action: 3, attachmentEmote: 4, permanentEmote: 5, slide: 6, petAction: 7, blendColor: 8, freeSafeChat: 9, alpha: 10, customAdventure: 11, customPvp: 12 };
|
|
763
|
-
q({ name: "chat.public", description: "The player says something in the room.", direction: "toServer", type: "sys", command: "pubMsg", read: (e) => {
|
|
764
|
-
var t, n;
|
|
765
|
-
const r = G(((n = (t = e.body) == null ? void 0 : t.child("txt")) == null ? void 0 : n.textContent) ?? ""), i = r.lastIndexOf("%");
|
|
766
|
-
if (i === -1) throw new u("chat.public: the text has no kind after it", "PACKET_FIELD");
|
|
767
|
-
const s = Number(r.slice(i + 1));
|
|
768
|
-
if (!Number.isInteger(s)) throw new u("chat.public: the kind is not an integer", "PACKET_FIELD");
|
|
769
|
-
return { text: r.slice(0, i), kind: s };
|
|
770
|
-
}, write: ({ text: e, kind: t }) => [new f("txt", { children: [new w(ut(`${e}%${t}`))] })] }), a({ name: "chat.room", description: "Someone in the room said something.", direction: "toClient", command: "uc", read: (e) => ({ userId: e.int("userId"), text: e.string("text"), kind: e.int("kind"), level: e.remaining > 0 ? e.int("level") : null, extra: e.rest() }), write: (e, { userId: t, text: n, kind: r, level: i, extra: s }) => {
|
|
771
|
-
e.int(t).string(n).int(r), i !== null && e.int(i), e.raw(s);
|
|
772
|
-
} }), a({ name: "chat.moderation", description: "A moderator bans, silences, kicks, warns or messages the player.", direction: "toClient", command: "fd", read: (e) => ({ action: e.string("action"), extra: e.rest() }), write: (e, { action: t, extra: n }) => e.string(t).raw(n) }), a({ name: "facilitator.invis-mode", description: "The server confirms the player's ghost mode.", direction: "toClient", command: "fi", read: (e) => ({ invisible: e.flag("invisible") }), write: (e, { invisible: t }) => e.flag(t) }), a({ name: "facilitator.report-request", description: "The player reports someone.", direction: "toServer", command: "fr", read: (e) => ({ userName: e.string("userName"), reasonId: e.int("reasonId") }), write: (e, { userName: t, reasonId: n }) => e.string(t).int(n) }), a({ name: "facilitator.report-result", description: "The server confirms a report.", direction: "toClient", command: "fr", read: (e) => ({ success: e.flag("success") }), write: (e, { success: t }) => e.flag(t) }), a({ name: "facilitator.report-with-data-request", description: "The player reports someone over something specific they sent.", direction: "toServer", command: "fra", read: (e) => ({ userName: e.string("userName"), reasonId: e.int("reasonId"), dataType: e.int("dataType"), data: e.string("data") }), write: (e, { userName: t, reasonId: n, dataType: r, data: i }) => e.string(t).int(n).int(r).string(i) }), a({ name: "facilitator.report-with-data-result", description: "The server confirms a report with content attached.", direction: "toClient", command: "fra", read: (e) => ({ success: e.flag("success") }), write: (e, { success: t }) => e.flag(t) });
|
|
773
|
-
function ut(e) {
|
|
774
|
-
let t = "";
|
|
775
|
-
for (const n of e) t += lt[n] ?? n;
|
|
776
|
-
return t;
|
|
777
|
-
}
|
|
778
|
-
const lt = { "&": "&", "<": "<", ">": ">", "'": "'", '"': """ }, le = 100;
|
|
779
|
-
a({ name: "currency.update", description: "One or more of the player’s balances changed.", direction: "toClient", command: "cu", read: (e) => {
|
|
780
|
-
const t = e.int("currency"), n = t === le ? pt(e.string("balances")) : [{ currency: t, amount: e.int("amount") }], r = e.remaining > 0 ? e.int("reason") : null;
|
|
781
|
-
return { currency: t, balances: n, reason: r, extra: e.rest() };
|
|
782
|
-
}, write: (e, { currency: t, balances: n, reason: r, extra: i }) => {
|
|
783
|
-
var s;
|
|
784
|
-
e.int(t), t === le ? e.string(n.map(({ currency: o, amount: d }) => `${o}x${d}`).join(",")) : e.int(((s = n[0]) == null ? void 0 : s.amount) ?? 0), r !== null && e.int(r), e.raw(i);
|
|
785
|
-
} });
|
|
786
|
-
function pt(e) {
|
|
787
|
-
return e === "" ? [] : e.split(",").map((t) => {
|
|
788
|
-
const n = t.split("x"), [r = "", i = ""] = n, s = Number(r), o = Number(i), d = r.trim() === "" || i.trim() === "";
|
|
789
|
-
if (n.length !== 2 || d || !Number.isInteger(s) || !Number.isInteger(o)) throw new u(`currency.update: field "balances" has "${t}", not <currency>x<amount>`, "PACKET_FIELD");
|
|
790
|
-
return { currency: s, amount: o };
|
|
791
|
-
});
|
|
792
|
-
}
|
|
793
|
-
a({ name: "currency.donate", description: "The player donates gems.", direction: "toServer", command: "cd", read: (e) => ({ amount: e.int("amount") }), write: (e, { amount: t }) => e.int(t) }), a({ name: "currency.donate-result", description: "The server says whether the donation went through.", direction: "toClient", command: "cd", read: (e) => ({ success: e.string("result") === "1", extra: e.rest() }), write: (e, { success: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), a({ name: "currency.exchange", description: "The player exchanges one currency for another at a shop.", direction: "toServer", command: "ce", read: (e) => ({ shopId: e.int("shopId"), exchangeDefId: e.int("exchangeDefId") }), write: (e, { shopId: t, exchangeDefId: n }) => e.int(t).int(n) }), a({ name: "currency.exchange-result", description: "The server says whether the exchange went through.", direction: "toClient", command: "ce", read: (e) => ({ success: e.string("result") === "1", balance: e.remaining > 0 ? e.string("balance") : "", extra: e.rest() }), write: (e, { success: t, balance: n, extra: r }) => e.string(t ? "1" : "0").string(n).raw(r) }), a({ name: "currency.redeem-code", description: "The player redeems a code.", direction: "toServer", command: "grc", read: (e) => ({ code: e.string("code"), captchaQuestion: e.string("captchaQuestion"), captchaAnswer: e.string("captchaAnswer") }), write: (e, { code: t, captchaQuestion: n, captchaAnswer: r }) => e.string(t).string(n).string(r) }), a({ name: "currency.redeem-code-result", description: "The server says what a redeemed code came to.", direction: "toClient", command: "grc", read: (e) => {
|
|
794
|
-
const t = e.string("result"), n = e.remaining > 0 ? e.string("details") : "", r = e.remaining > 0 ? e.string("hasGiftsElsewhere") === "1" : !1;
|
|
795
|
-
return { result: t, details: ht(n), hasGiftsElsewhere: r, extra: e.rest() };
|
|
796
|
-
}, write: (e, { result: t, details: n, hasGiftsElsewhere: r, extra: i }) => e.string(t).string(n === null ? "" : JSON.stringify(n)).string(r ? "1" : "0").raw(i) });
|
|
797
|
-
function ht(e) {
|
|
798
|
-
if (e === "") return null;
|
|
799
|
-
try {
|
|
800
|
-
return JSON.parse(e);
|
|
801
|
-
} catch {
|
|
802
|
-
throw new u(`currency.redeem-code-result: field "details" is not JSON ("${e}")`, "PACKET_FIELD");
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
a({ name: "currency.membership-redeemed", description: "A membership was redeemed on the account.", direction: "toClient", command: "grm", read: (e) => {
|
|
806
|
-
const t = e.int("result");
|
|
807
|
-
return t !== 1 ? { result: t, accountType: null, daysLeft: null, sourceType: null, extra: e.rest() } : { result: t, accountType: e.int("accountType"), daysLeft: e.int("daysLeft"), sourceType: e.string("sourceType"), extra: e.rest() };
|
|
808
|
-
}, write: (e, { result: t, accountType: n, daysLeft: r, sourceType: i, extra: s }) => {
|
|
809
|
-
e.int(t), t === 1 && e.int(n ?? 0).int(r ?? 0).string(i ?? ""), e.raw(s);
|
|
810
|
-
} }), a({ name: "den.join-request", description: "The player asks to join a den.", direction: "toServer", command: "dj", read: (e) => ({ denName: e.string("denName"), confirmLanguageChange: e.flag("confirmLanguageChange"), doorItem: e.int("doorItem") }), write: (e, { denName: t, confirmLanguageChange: n, doorItem: r }) => e.string(t).flag(n).int(r) }), a({ name: "den.privacy-request", description: "The player sets their den’s privacy, or asks for someone else’s.", direction: "toServer", command: "dp", read: (e) => ({ query: e.flag("lookup") ? { request: "lookup", userName: e.string("userName") } : { request: "set", privacy: e.int("privacy") } }), write: (e, { query: t }) => {
|
|
811
|
-
t.request === "lookup" ? e.flag(!0).string(t.userName) : e.flag(!1).int(t.privacy);
|
|
812
|
-
} }), a({ name: "den.privacy-result", description: "The server says who may come into someone’s den.", direction: "toClient", command: "dp", read: (e) => ({ userName: e.string("userName"), privacy: e.int("privacy") }), write: (e, { userName: t, privacy: n }) => e.string(t).int(n) }), a({ name: "den.kicked", description: "The player was sent out of a den its owner locked.", direction: "toClient", command: "dpk", read: () => ({}), write: () => {
|
|
813
|
-
} }), a({ name: "den.visitor-count", description: "Someone came into or left the player's den, by username, and how many are in it.", direction: "toClient", command: "drc", read: (e) => ({ count: e.int("count"), entering: e.flag("entering"), userName: e.string("userName") }), write: (e, { count: t, entering: n, userName: r }) => e.int(t).flag(n).string(r) }), a({ name: "den.room-list-request", description: "The player asks for their den rooms.", direction: "toServer", command: "dl", read: () => ({}), write: () => {
|
|
814
|
-
} }), a({ name: "den.room-list", description: "The server lists the player’s den rooms.", direction: "toClient", command: "dl", read: (e) => ({ rooms: e.repeat(e.int("count"), () => ({ invIdx: e.int("invIdx"), defId: e.int("defId") })) }), write: (e, { rooms: t }) => e.int(t.length).each(t, ({ invIdx: n, defId: r }) => e.int(n).int(r)) }), a({ name: "den.change-request", description: "The player switches to another of their den rooms.", direction: "toServer", command: "dc", read: (e) => ({ invIdx: e.int("invIdx") }), write: (e, { invIdx: t }) => e.int(t) }), a({ name: "den.change-result", description: "The server says which den room the player switched to.", direction: "toClient", command: "dc", read: (e) => {
|
|
815
|
-
const t = e.int("denRoomDefId"), n = e.remaining >= 2;
|
|
816
|
-
return { denRoomDefId: t, perUserAvId: n ? e.int("perUserAvId") : null, activePetInvId: n ? e.int("activePetInvId") : null, extra: e.rest() };
|
|
817
|
-
}, write: (e, { denRoomDefId: t, perUserAvId: n, activePetInvId: r, extra: i }) => {
|
|
818
|
-
e.int(t), n !== null && r !== null && e.int(n).int(r), e.raw(i);
|
|
819
|
-
} }), a({ name: "den.masterpiece-items-request", description: "The player asks for every masterpiece placed in someone’s den.", direction: "toServer", command: "dmi", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "den.masterpiece-items", description: "The server lists every masterpiece placed in a den.", direction: "toClient", command: "dmi", read: (e) => ({ items: e.repeat(e.int("count"), () => ({ defId: e.int("defId"), invIdx: e.int("invIdx"), version: e.int("version"), approved: e.string("approved") !== "", uniqueImageId: e.string("uniqueImageId"), uniqueImageCreatorDbId: e.int("uniqueImageCreatorDbId"), uniqueImageCreatorUUID: e.string("uniqueImageCreatorUUID") })) }), write: (e, { items: t }) => e.int(t.length).each(t, (n) => e.int(n.defId).int(n.invIdx).int(n.version).string(n.approved ? "1" : "").string(n.uniqueImageId).int(n.uniqueImageCreatorDbId).string(n.uniqueImageCreatorUUID)) }), a({ name: "den.masterpiece-creator-request", description: "The player asks who drew a masterpiece.", direction: "toServer", command: "dmc", read: (e) => ({ denUserName: e.string("denUserName"), uniqueImageId: e.string("uniqueImageId") }), write: (e, { denUserName: t, uniqueImageId: n }) => e.string(t).string(n) }), a({ name: "den.masterpiece-creator", description: "The server names who drew a masterpiece.", direction: "toClient", command: "dmc", read: (e) => ({ creatorName: e.string("creatorName") }), write: (e, { creatorName: t }) => e.string(t) });
|
|
820
|
-
function gt(e) {
|
|
821
|
-
return { baseColor: e.int("baseColor"), patternColor: e.int("patternColor"), patternDefId: e.int("patternDefId"), eyeColor: e.int("eyeColor"), eyeDefId: e.int("eyeDefId") };
|
|
822
|
-
}
|
|
823
|
-
function ft(e, t) {
|
|
824
|
-
e.int(t.baseColor).int(t.patternColor).int(t.patternDefId).int(t.eyeColor).int(t.eyeDefId);
|
|
825
|
-
}
|
|
826
|
-
function vt(e) {
|
|
827
|
-
return { ...gt(e), tailInvId: e.int("tailInvId"), legInvId: e.int("legInvId"), backInvId: e.int("backInvId"), neckInvId: e.int("neckInvId"), headInvId: e.int("headInvId") };
|
|
828
|
-
}
|
|
829
|
-
function It(e, t) {
|
|
830
|
-
ft(e, t), e.int(t.tailInvId).int(t.legInvId).int(t.backInvId).int(t.neckInvId).int(t.headInvId);
|
|
831
|
-
}
|
|
832
|
-
a({ name: "den.items-request", description: "The player asks for every den item they own.", direction: "toServer", command: "di", read: () => ({}), write: () => {
|
|
833
|
-
} }), a({ name: "den.items", description: "The server lists every den item the player owns.", direction: "toClient", command: "di", read: (e) => ({ activeDenIdx: e.int("activeDenIdx"), itemCount: e.int("itemCount"), petCount: e.int("petCount"), details: e.rest() }), write: (e, { activeDenIdx: t, itemCount: n, petCount: r, details: i }) => e.int(t).int(n).int(r).raw(i) }), a({ name: "den.state", description: "The server says what is placed in the den on screen.", direction: "toClient", command: "ds", read: (e) => ({ itemCount: e.int("itemCount"), petCount: e.int("petCount"), forceReload: e.string("forceReload") === "1", details: e.rest() }), write: (e, { itemCount: t, petCount: n, forceReload: r, details: i }) => e.int(t).int(n).string(r ? "1" : "0").raw(i) });
|
|
834
|
-
const pe = { baseColor: 0, patternColor: 0, patternDefId: 0, eyeColor: 0, eyeDefId: 0, tailInvId: 0, legInvId: 0, backInvId: 0, neckInvId: 0, headInvId: 0 };
|
|
835
|
-
a({ name: "den.state-save", description: "The player saves changes to their den.", direction: "toServer", command: "ds", read: (e) => ({ changes: e.repeat(e.int("count"), () => {
|
|
836
|
-
const t = e.int("refId"), n = e.int("invIdx"), r = e.flag("placed"), i = e.int("x"), s = e.int("y"), o = e.int("flipped"), d = e.string("userNameLink"), m = vt(e), c = Object.keys(pe).every((l) => m[l] === 0);
|
|
837
|
-
return { refId: t, invIdx: n, placed: r, x: i, y: s, flipped: o, userNameLink: d === "off" ? "" : d, mannequin: c ? null : m };
|
|
838
|
-
}) }), write: (e, { changes: t }) => {
|
|
839
|
-
e.int(t.length);
|
|
840
|
-
for (const n of t) e.int(n.refId).int(n.invIdx).flag(n.placed).int(n.x).int(n.y).int(n.flipped).string(n.userNameLink === "" ? "off" : n.userNameLink), It(e, n.mannequin ?? pe);
|
|
841
|
-
} }), a({ name: "den.state-saved", description: "The server says which den items it saved.", direction: "toClient", command: "dss", read: (e) => ({ invIdxs: e.repeat(e.remaining, () => e.int("invIdx")) }), write: (e, { invIdxs: t }) => e.each(t, (n) => e.int(n)) }), a({ name: "den.buy-request", description: "The player buys a den item or a den room.", direction: "toServer", command: "db", read: (e) => {
|
|
842
|
-
const t = e.string("kind") === "-1", n = e.int("shopId"), r = e.int("defId");
|
|
843
|
-
return t ? { order: { kind: "den-room", shopId: n, defId: r, denSlot: e.int("denSlot"), diamond: e.flag("diamond") } } : { order: { kind: "den-item", shopId: n, defId: r, version: e.int("version"), diamond: e.flag("diamond"), masterpiece: e.flag("masterpiece"), usingTokens: e.flag("usingTokens"), masterpieceUuid: e.string("masterpieceUuid") } };
|
|
844
|
-
}, write: (e, { order: t }) => {
|
|
845
|
-
if (t.kind === "den-room") {
|
|
846
|
-
e.string("-1").int(t.shopId).int(t.defId).int(t.denSlot).flag(t.diamond);
|
|
847
|
-
return;
|
|
848
|
-
}
|
|
849
|
-
e.string("0").int(t.shopId).int(t.defId).int(t.version).flag(t.diamond).flag(t.masterpiece).flag(t.usingTokens).string(t.masterpieceUuid);
|
|
850
|
-
} }), a({ name: "den.buy-result", description: "The server says whether a den item or den room was bought.", direction: "toClient", command: "db", read: (e) => ({ status: e.int("status"), balance: e.string("balance"), unused: e.string("unused"), currencyType: e.int("currencyType"), invIdx: e.int("invIdx"), extra: e.rest() }), write: (e, { status: t, balance: n, unused: r, currencyType: i, invIdx: s, extra: o }) => e.int(t).string(n).string(r).int(i).int(s).raw(o) }), a({ name: "den.recycle-request", description: "The player sells den items or den rooms back to the game.", direction: "toServer", command: "dr", read: (e) => {
|
|
851
|
-
const t = e.string("kind") === "-1", n = e.string("invIdxs");
|
|
852
|
-
return { rooms: t, invIdxs: n === "" ? [] : n.split(",").map(yt) };
|
|
853
|
-
}, write: (e, { rooms: t, invIdxs: n }) => e.string(t ? "-1" : "0").string(n.join(",")) });
|
|
854
|
-
function yt(e) {
|
|
855
|
-
return new k([e], "den.recycle-request").int("invIdxs");
|
|
856
|
-
}
|
|
857
|
-
a({ name: "den.recycle-result", description: "The server says which den items or rooms were sold.", direction: "toClient", command: "dr", read: (e) => {
|
|
858
|
-
const t = e.int("count");
|
|
859
|
-
return { gems: e.int("gems"), invIdxs: e.repeat(t, () => e.int("invIdx")) };
|
|
860
|
-
}, write: (e, { gems: t, invIdxs: n }) => e.int(n.length).int(t).each(n, (r) => e.int(r)) }), a({ name: "den.empty-request", description: "The player clears everything out of their den.", direction: "toServer", command: "de", read: () => ({}), write: () => {
|
|
861
|
-
} }), a({ name: "den.emptied", description: "The server says the den was cleared.", direction: "toClient", command: "de", read: (e) => ({ extra: e.rest() }), write: (e, { extra: t }) => e.raw(t) }), a({ name: "den.epic-dens-request", description: "The player asks for the epic dens the world map lists.", direction: "toServer", command: "dh", read: () => ({}), write: () => {
|
|
862
|
-
} }), a({ name: "den.epic-dens", description: "The server lists the epic dens, by owner.", direction: "toClient", command: "dh", read: (e) => ({ userNames: e.repeat(e.int("count"), () => e.string("userName")) }), write: (e, { userNames: t }) => e.int(t.length).each(t, (n) => e.string(n)) }), a({ name: "den.phantom-request", description: "The player turns into a phantom, or back.", direction: "toServer", command: "dph", read: (e) => ({ phantom: e.flag("phantom") }), write: (e, { phantom: t }) => e.flag(t) }), a({ name: "den.phantom", description: "Someone in the den turned into a phantom, or back.", direction: "toClient", command: "dph", read: (e) => {
|
|
863
|
-
const t = e.string("success") === "1";
|
|
864
|
-
return { success: t, userId: t ? e.int("userId") : null, phantom: t ? e.string("phantom") === "1" : !1, extra: e.rest() };
|
|
865
|
-
}, write: (e, { success: t, userId: n, phantom: r, extra: i }) => {
|
|
866
|
-
e.string(t ? "1" : "0"), t && e.int(n ?? 0).string(r ? "1" : "0"), e.raw(i);
|
|
867
|
-
} }), a({ name: "den.eco-state-request", description: "The player asks for the den’s eco system.", direction: "toServer", command: "dEf", read: () => ({}), write: () => {
|
|
868
|
-
} }), a({ name: "den.eco-state", description: "The server describes the den’s eco system.", direction: "toClient", command: "dEf", read: (e) => ({ numActiveWindTurbines: e.int("numActiveWindTurbines"), numActiveSolarPanels: e.int("numActiveSolarPanels"), numConsumerItems: e.int("numConsumerItems"), ecoPowerGeneration: e.int("ecoPowerGeneration"), ecoPowerConsumption: e.int("ecoPowerConsumption"), ecoScoreRequired: e.int("ecoScoreRequired"), nextRewardBitIndex: e.int("nextRewardBitIndex"), unredeemedEcoCredits: e.int("unredeemedEcoCredits"), secondsUntilNextEcoCredit: e.int("secondsUntilNextEcoCredit") }), write: (e, t) => e.int(t.numActiveWindTurbines).int(t.numActiveSolarPanels).int(t.numConsumerItems).int(t.ecoPowerGeneration).int(t.ecoPowerConsumption).int(t.ecoScoreRequired).int(t.nextRewardBitIndex).int(t.unredeemedEcoCredits).int(t.secondsUntilNextEcoCredit) }), a({ name: "den.eco-redeem-request", description: "The player redeems the den’s eco credits.", direction: "toServer", command: "dEr", read: () => ({}), write: () => {
|
|
869
|
-
} }), a({ name: "den.eco-redeem-result", description: "The server says whether the den’s eco credits were redeemed.", direction: "toClient", command: "dEr", read: (e) => ({ redeemed: e.string("redeemed") === "1", secondsUntilNextEcoCredit: e.remaining > 0 ? e.int("secondsUntilNextEcoCredit") : null }), write: (e, { redeemed: t, secondsUntilNextEcoCredit: n }) => {
|
|
870
|
-
e.string(t ? "1" : "0"), n !== null && e.int(n);
|
|
871
|
-
} }), a({ name: "den.eco-consumer-request", description: "The player turns one of the den’s eco items on or off.", direction: "toServer", command: "dEc", read: (e) => ({ invIdx: e.int("invIdx"), online: e.flag("online") }), write: (e, { invIdx: t, online: n }) => e.int(t).flag(n) }), a({ name: "den.eco-consumer-result", description: "The server says which of the den’s eco items are on.", direction: "toClient", command: "dEc", read: (e) => ({ ecoPointsConsumed: e.int("ecoPointsConsumed"), ecoScore: e.int("ecoScore"), consumers: e.repeat(e.int("count"), () => ({ invIdx: e.int("invIdx"), stateId: e.int("stateId") })) }), write: (e, { ecoPointsConsumed: t, ecoScore: n, consumers: r }) => e.int(t).int(n).int(r.length).each(r, ({ invIdx: i, stateId: s }) => e.int(i).int(s)) }), a({ name: "ecard.list-request", description: "The player asks for their jam-a-grams.", direction: "toServer", command: "el", read: (e) => ({ interactive: e.flag("interactive") }), write: (e, { interactive: t }) => e.flag(t) }), a({ name: "ecard.list", description: "The server sends the player’s jam-a-grams.", direction: "toClient", command: "el", read: (e) => {
|
|
872
|
-
const t = e.int("count");
|
|
873
|
-
return { cards: e.repeat(Math.max(t, 0), () => he(e)) };
|
|
874
|
-
}, write: (e, { cards: t }) => {
|
|
875
|
-
e.int(t.length), t.forEach((n) => ge(e, n));
|
|
876
|
-
} }), a({ name: "ecard.received", description: "The player receives a jam-a-gram.", direction: "toClient", command: "ep", read: (e) => ({ card: he(e) }), write: (e, { card: t }) => ge(e, t) }), a({ name: "ecard.send", description: "The player sends a jam-a-gram.", direction: "toServer", command: "es", read: (e) => ({ userName: e.string("userName"), cardMediaId: e.int("cardMediaId"), stampMediaId: e.int("stampMediaId"), messageType: e.int("messageType"), message: e.string("message"), type: e.int("type"), giftInvIdx: e.int("giftInvIdx"), specialType: e.int("specialType") }), write: (e, t) => e.string(t.userName).int(t.cardMediaId).int(t.stampMediaId).int(t.messageType).string(t.message).int(t.type).int(t.giftInvIdx).int(t.specialType) }), a({ name: "ecard.send-result", description: "The server says whether a jam-a-gram was sent.", direction: "toClient", command: "es", read: (e) => ({ result: e.int("result") }), write: (e, { result: t }) => e.int(t) }), a({ name: "ecard.read", description: "The player opens a jam-a-gram.", direction: "toServer", command: "er", read: (e) => ({ messageId: e.int("messageId") }), write: (e, { messageId: t }) => e.int(t) }), a({ name: "ecard.read-result", description: "The server says whether a jam-a-gram was marked read.", direction: "toClient", command: "er", read: (e) => ({ messageId: e.int("messageId"), success: e.string("success") === "1" }), write: (e, { messageId: t, success: n }) => e.int(t).flag(n) }), a({ name: "ecard.delete", description: "The player deletes a jam-a-gram.", direction: "toServer", command: "ed", read: (e) => ({ messageId: e.int("messageId") }), write: (e, { messageId: t }) => e.int(t) }), a({ name: "ecard.delete-result", description: "The server says which jam-a-grams were deleted.", direction: "toClient", command: "ed", read: (e) => ({ success: e.string("success") === "1", messageIds: e.repeat(e.int("count"), () => e.int("messageId")) }), write: (e, { success: t, messageIds: n }) => {
|
|
877
|
-
e.flag(t).int(n.length), n.forEach((r) => e.int(r));
|
|
878
|
-
} }), a({ name: "ecard.gift", description: "The player accepts or discards a jam-a-gram’s gift.", direction: "toServer", command: "eg", read: (e) => ({ messageId: e.int("messageId"), accept: e.flag("accept"), option: e.remaining > 0 ? e.int("option") : null }), write: (e, { messageId: t, accept: n, option: r }) => {
|
|
879
|
-
e.int(t).flag(n), r !== null && e.int(r);
|
|
880
|
-
} }), a({ name: "ecard.gift-result", description: "The server says whether a jam-a-gram’s gift was accepted or discarded.", direction: "toClient", command: "eg", read: (e) => ({ messageId: e.int("messageId"), success: e.string("success") === "1" }), write: (e, { messageId: t, success: n }) => e.int(t).flag(n) }), a({ name: "ecard.update", description: "The server changes a jam-a-gram’s message.", direction: "toClient", command: "eu", read: (e) => ({ messageId: e.int("messageId"), message: e.string("message") }), write: (e, { messageId: t, message: n }) => e.int(t).string(n) }), a({ name: "ecard.privacy", description: "The player changes who may send them jam-a-grams.", direction: "toServer", command: "ei", read: (e) => ({ setting: e.int("setting") }), write: (e, { setting: t }) => e.int(t) }), a({ name: "ecard.privacy-result", description: "The server says whether the jam-a-gram privacy setting changed.", direction: "toClient", command: "ei", read: (e) => ({ success: e.string("success") === "1" }), write: (e, { success: t }) => e.flag(t) }), a({ name: "ecard.buddy-answer", description: "The player accepts or declines the buddy request a jam-a-gram carries.", direction: "toServer", command: "eb", read: (e) => ({ messageId: e.int("messageId"), accept: e.flag("accept") }), write: (e, { messageId: t, accept: n }) => e.int(t).flag(n) }), a({ name: "ecard.buddy-answer-result", description: "The server answers the player’s reply to a jam-a-gram’s buddy request.", direction: "toClient", command: "eb", read: (e) => ({ result: e.int("result") }), write: (e, { result: t }) => e.int(t) }), a({ name: "ecard.clear-cache", description: "The player asks the server to drop its cached jam-a-gram inbox.", direction: "toServer", command: "ec", read: () => ({}), write: () => {
|
|
881
|
-
} });
|
|
882
|
-
function he(e) {
|
|
883
|
-
return { messageId: e.int("messageId"), senderUserName: e.string("senderUserName"), cardMediaId: e.int("cardMediaId"), stampMediaId: e.int("stampMediaId"), read: e.string("read") === "1", message: e.string("message"), type: e.int("type"), giftId: e.int("giftId"), giftColor: e.int("giftColor"), giftName: e.string("giftName"), senderAccountType: e.int("senderAccountType"), senderNameBarData: e.int("senderNameBarData"), secondaryType: e.int("secondaryType"), senderType: e.int("senderType"), userNameModerationFlag: e.int("userNameModerationFlag"), additionalGiftData: e.string("additionalGiftData"), specialType: e.int("specialType") };
|
|
884
|
-
}
|
|
885
|
-
function ge(e, t) {
|
|
886
|
-
e.int(t.messageId).string(t.senderUserName).int(t.cardMediaId).int(t.stampMediaId).flag(t.read).string(t.message).int(t.type).int(t.giftId).int(t.giftColor).string(t.giftName).int(t.senderAccountType).int(t.senderNameBarData).int(t.secondaryType).int(t.senderType).int(t.userNameModerationFlag).string(t.additionalGiftData).int(t.specialType);
|
|
887
|
-
}
|
|
888
|
-
a({ name: "item.list-request", description: "The client asks for an avatar’s items.", direction: "toServer", command: "il", read: (e) => ({ userName: e.string("userName"), perUserAvId: e.int("perUserAvId"), full: e.flag("full") }), write: (e, { userName: t, perUserAvId: n, full: r }) => e.string(t).int(n).flag(r) }), a({ name: "item.list", description: "The server lists or changes an avatar’s items.", direction: "toClient", command: "il", read: (e) => {
|
|
889
|
-
const t = e.string("type");
|
|
890
|
-
if (t === "-1") return { kind: "failed", extra: e.rest() };
|
|
891
|
-
if (t === "0" || t === "1") {
|
|
892
|
-
const g = { unused: e.string("unused"), perUserAvId: e.int("perUserAvId"), userName: e.string("userName"), eyesDefId: e.int("eyesDefId"), patternDefId: e.int("patternDefId") }, h = e.int("count"), $ = h > 0 && e.remaining === h * 5, Re = e.repeat(h, () => wt(e, $));
|
|
893
|
-
return { kind: t === "0" ? "inventory" : "worn", ...g, items: Re };
|
|
894
|
-
}
|
|
895
|
-
const n = t === "3", r = e.string("wear") === "1", i = e.int("perUserAvId"), s = e.string("userName"), o = e.int("color") >>> 0, d = e.int("added"), m = e.int("removed"), c = e.repeat(d, () => ({ invId: e.int("invId"), defId: e.int("defId") })), l = e.repeat(m, () => e.int("invId"));
|
|
896
|
-
return { kind: "changed", wornOnly: n, wear: r, perUserAvId: i, userName: s, color: o, added: c, removed: l };
|
|
897
|
-
}, write: (e, t) => {
|
|
898
|
-
if (t.kind === "failed") {
|
|
899
|
-
e.string("-1").raw(t.extra);
|
|
900
|
-
return;
|
|
901
|
-
}
|
|
902
|
-
if (t.kind === "changed") {
|
|
903
|
-
e.string(t.wornOnly ? "3" : "2").string(t.wear ? "1" : "0").int(t.perUserAvId).string(t.userName).int(t.color >>> 0).int(t.added.length).int(t.removed.length).each(t.added, ({ invId: n, defId: r }) => e.int(n).int(r)).each(t.removed, (n) => e.int(n));
|
|
904
|
-
return;
|
|
905
|
-
}
|
|
906
|
-
e.string(t.kind === "inventory" ? "0" : "1").string(t.unused).int(t.perUserAvId).string(t.userName).int(t.eyesDefId).int(t.patternDefId).int(t.items.length).each(t.items, (n) => {
|
|
907
|
-
e.int(n.defId).int(n.invId).int(n.color >>> 0), n.equippedAvatars !== null && e.string(n.equippedAvatars).int(n.denStoreInvId ?? 0);
|
|
908
|
-
});
|
|
909
|
-
} });
|
|
910
|
-
function wt(e, t) {
|
|
911
|
-
const n = e.int("defId"), r = e.int("invId"), i = e.int("color") >>> 0;
|
|
912
|
-
return t ? { defId: n, invId: r, color: i, equippedAvatars: e.string("equippedAvatars"), denStoreInvId: e.int("denStoreInvId") } : { defId: n, invId: r, color: i, equippedAvatars: null, denStoreInvId: null };
|
|
913
|
-
}
|
|
914
|
-
a({ name: "item.use", description: "The player puts items on and takes items off.", direction: "toServer", command: "iu", read: (e) => {
|
|
915
|
-
const t = e.int("wearCount"), n = e.int("removeCount");
|
|
916
|
-
return { wear: e.repeat(t, () => e.int("invId")), remove: e.repeat(n, () => e.int("invId")) };
|
|
917
|
-
}, write: (e, { wear: t, remove: n }) => e.int(t.length).int(n.length).each(t, (r) => e.int(r)).each(n, (r) => e.int(r)) }), a({ name: "item.use-result", description: "The server says whether the player’s items changed.", direction: "toClient", command: "iu", read: (e) => ({ success: e.string("success") === "1", extra: e.rest() }), write: (e, { success: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), a({ name: "item.buy", description: "The player buys an item.", direction: "toServer", command: "ib", read: (e) => ({ shopId: e.int("shopId"), quantity: e.int("quantity"), defId: e.int("defId"), colorIndex: e.int("colorIndex"), diamond: e.flag("diamond"), targetInvId: e.int("targetInvId"), targetUserName: e.string("targetUserName") }), write: (e, t) => e.int(t.shopId).int(t.quantity).int(t.defId).int(t.colorIndex).flag(t.diamond).int(t.targetInvId).string(t.targetUserName) }), a({ name: "item.buy-result", description: "The server says whether an item was bought.", direction: "toClient", command: "ib", read: (e) => {
|
|
918
|
-
const t = e.int("status"), n = e.int("shopId"), r = e.string("balance"), i = r === "" ? null : Number(r);
|
|
919
|
-
return { status: t, shopId: n, balance: i, currencyType: e.int("currencyType"), extra: e.rest() };
|
|
920
|
-
}, write: (e, { status: t, shopId: n, balance: r, currencyType: i, extra: s }) => e.int(t).int(n).string(r === null ? "" : String(r)).int(i).raw(s) }), a({ name: "item.recycle", description: "The player recycles items.", direction: "toServer", command: "ir", read: (e) => ({ invIds: e.repeat(e.remaining, () => e.int("invId")) }), write: (e, { invIds: t }) => e.each(t, (n) => e.int(n)) }), a({ name: "item.recycle-result", description: "The server says which items were recycled.", direction: "toClient", command: "ir", read: (e) => {
|
|
921
|
-
const t = e.int("count");
|
|
922
|
-
return { gems: e.int("gems"), invIds: e.repeat(t, () => e.int("invId")) };
|
|
923
|
-
}, write: (e, { gems: t, invIds: n }) => e.int(n.length).int(t).each(n, (r) => e.int(r)) }), a({ name: "item.diamond-bundle-buy", description: "The player buys the bundle shop’s whole bundle for diamonds.", direction: "toServer", command: "id", read: (e) => ({ shopId: e.int("shopId") }), write: (e, { shopId: t }) => e.int(t) }), a({ name: "item.diamond-bundle-buy-result", description: "The server says whether the bundle shop’s whole bundle was bought.", direction: "toClient", command: "id", read: (e) => ({ bought: e.string("bought") === "true", balance: e.remaining > 0 ? e.int("balance") : null, extra: e.rest() }), write: (e, { bought: t, balance: n, extra: r }) => {
|
|
924
|
-
e.string(t ? "true" : "false"), n !== null && e.int(n), e.raw(r);
|
|
925
|
-
} }), a({ name: "item.prize", description: "The server offers the player a prize.", direction: "toClient", command: "ip", read: (e) => ({ userVarId: e.int("userVarId"), isClothing: e.string("isClothing") === "1", defId: e.int("defId"), nameStrId: e.int("nameStrId"), descStrId: e.int("descStrId"), color: e.number("color"), extra: e.rest() }), write: (e, { userVarId: t, isClothing: n, defId: r, nameStrId: i, descStrId: s, color: o, extra: d }) => e.int(t).string(n ? "1" : "0").int(r).int(i).int(s).number(o).raw(d) });
|
|
926
|
-
const bt = ["hc", "pf", "mo", "as", "ul"];
|
|
927
|
-
a({ name: "minigame.info-request", description: "The client asks the server to describe minigames.", direction: "toServer", command: "mi", read: (e) => ({ gameDefIds: e.repeat(e.remaining, () => e.int("gameDefId")) }), write: (e, { gameDefIds: t }) => e.each(t, (n) => e.int(n)) }), a({ name: "minigame.join", description: "The player asks to play a minigame.", direction: "toServer", command: "mj", read: (e) => ({ gameDefId: e.int("gameDefId"), multiplayer: e.flag("multiplayer"), proModeId: e.int("proModeId"), hostUserId: e.int("hostUserId") }), write: (e, { gameDefId: t, multiplayer: n, proModeId: r, hostUserId: i }) => e.int(t).flag(n).int(r).int(i) }), a({ name: "minigame.start-request", description: "The player starts a waiting minigame now.", direction: "toServer", command: "ms", read: (e) => ({ gameDefId: e.int("gameDefId") }), write: (e, { gameDefId: t }) => e.int(t) }), a({ name: "minigame.leave", description: "The player leaves an in-room minigame.", direction: "toServer", command: "ml", read: () => ({}), write: () => {
|
|
928
|
-
} }), a({ name: "minigame.send", description: "A minigame sends its own message to the server.", direction: "toServer", command: "mm", read: (e) => ({ gameDefId: e.int("gameDefId"), data: e.rest() }), write: (e, { gameDefId: t, data: n }) => e.int(t).raw(n) }), a({ name: "minigame.pvp", description: "The player challenges, accepts, or turns down a two player game.", direction: "toServer", command: "mp", read: (e) => ({ gameDefId: e.int("gameDefId"), action: e.int("action"), userName: e.remaining > 0 ? e.string("userName") : "" }), write: (e, { gameDefId: t, action: n, userName: r }) => {
|
|
929
|
-
e.int(t).int(n), r !== "" && e.string(r);
|
|
930
|
-
} }), a({ name: "minigame.custom-pvp-join", description: "The player joins a two player game another player set up.", direction: "toServer", command: "mcp", read: (e) => ({ gameDefId: e.int("gameDefId"), action: e.int("action"), userName: e.string("userName") }), write: (e, { gameDefId: t, action: n, userName: r }) => e.int(t).int(n).string(r) }), a({ name: "minigame.leaderboard-request", description: "The client asks for a minigame’s leaderboard.", direction: "toServer", command: "mlb", read: (e) => ({ gameDefId: e.int("gameDefId") }), write: (e, { gameDefId: t }) => e.int(t) }), a({ name: "minigame.info", description: "The server describes minigames.", direction: "toClient", command: "mi", read: (e) => ({ games: e.repeat(e.int("count"), () => ({ gameDefId: e.int("gameDefId"), titleStrId: e.int("titleStrId"), extName: e.string("extName"), swfName: e.string("swfName"), minPlayers: e.int("minPlayers"), maxPlayers: e.int("maxPlayers"), maxSpectators: e.int("maxSpectators"), type: e.int("type"), gameCardMediaId: e.int("gameCardMediaId"), gameCountUserVarRef: e.int("gameCountUserVarRef"), custom1UserVarRef: e.int("custom1UserVarRef"), custom2UserVarRef: e.int("custom2UserVarRef"), readyForPvp: e.flag("readyForPvp"), gemMultiplier: e.number("gemMultiplier"), petDefId: e.int("petDefId"), proModeUserVarRefId: e.int("proModeUserVarRefId"), leaderboardUserVarRef: e.int("leaderboardUserVarRef"), gameLibraryIconMediaId: e.int("gameLibraryIconMediaId"), requiredAvatarType: e.int("requiredAvatarType") })) }), write: (e, { games: t }) => e.int(t.length).each(t, (n) => e.int(n.gameDefId).int(n.titleStrId).string(n.extName).string(n.swfName).int(n.minPlayers).int(n.maxPlayers).int(n.maxSpectators).int(n.type).int(n.gameCardMediaId).int(n.gameCountUserVarRef).int(n.custom1UserVarRef).int(n.custom2UserVarRef).flag(n.readyForPvp).number(n.gemMultiplier).int(n.petDefId).int(n.proModeUserVarRefId).int(n.leaderboardUserVarRef).int(n.gameLibraryIconMediaId).int(n.requiredAvatarType)) }), a({ name: "minigame.join-result", description: "The server seats the player in a minigame, or says why not.", direction: "toClient", command: "mj", read: (e) => {
|
|
931
|
-
if (e.remaining === 0) return { joined: !0, refusal: null, waitingUserIds: [], detail: [] };
|
|
932
|
-
const t = e.string("result"), n = bt.find((s) => s === t);
|
|
933
|
-
if (n) return { joined: !1, refusal: n, waitingUserIds: [], detail: e.rest() };
|
|
934
|
-
const r = new k([t], "minigame.join-result").int("userId"), i = e.repeat(e.remaining, () => e.int("userId"));
|
|
935
|
-
return { joined: !0, refusal: null, waitingUserIds: [r, ...i], detail: [] };
|
|
936
|
-
}, write: (e, t) => {
|
|
937
|
-
t.joined ? e.each(t.waitingUserIds, (n) => e.int(n)) : e.string(t.refusal).raw(t.detail);
|
|
938
|
-
} }), a({ name: "minigame.started", description: "The minigame starts, with its players.", direction: "toClient", command: "ms", read: (e) => ({ playerIds: e.repeat(e.int("playerCount"), () => e.int("userId")), data: e.rest() }), write: (e, { playerIds: t, data: n }) => e.int(t.length).each(t, (r) => e.int(r)).raw(n) });
|
|
939
|
-
function U(e, t, n) {
|
|
940
|
-
return a({ name: e, description: n, direction: "toClient", command: t, read: (r) => ({ data: r.rest() }), write: (r, { data: i }) => r.raw(i) });
|
|
941
|
-
}
|
|
942
|
-
U("minigame.message", "mm", "A minigame’s own message from the server."), U("minigame.left", "ml", "A player left the minigame."), U("minigame.ended", "me", "The minigame ended."), U("minigame.room-removed", "mr", "The minigame’s room was removed."), a({ name: "minigame.pvp-invite", description: "A player challenges the player to a two player game, or turns them down.", direction: "toClient", command: "mp", read: (e) => {
|
|
943
|
-
const t = e.int("gameDefId"), n = e.int("action");
|
|
944
|
-
return n !== 0 ? { gameDefId: t, action: n, userName: "", nameVisible: !1, extra: e.rest() } : { gameDefId: t, action: n, userName: e.string("userName"), nameVisible: e.int("nameVisible") > 0, extra: e.rest() };
|
|
945
|
-
}, write: (e, { gameDefId: t, action: n, userName: r, nameVisible: i, extra: s }) => {
|
|
946
|
-
e.int(t).int(n), n === 0 && e.string(r).int(i ? 1 : 0), e.raw(s);
|
|
947
|
-
} }), a({ name: "minigame.leaderboard", description: "The server gives a minigame’s leaderboard.", direction: "toClient", command: "mlb", read: (e) => {
|
|
948
|
-
const t = e.int("gameDefId");
|
|
949
|
-
if (t === -1) return { gameDefId: t, allTime: [], thisWeek: [], buddies: [] };
|
|
950
|
-
const n = () => e.repeat(e.int("count"), () => ({ name: e.string("name"), score: e.number("score") })), r = n(), i = n(), s = n();
|
|
951
|
-
return { gameDefId: t, allTime: r, thisWeek: i, buddies: s };
|
|
952
|
-
}, write: (e, { gameDefId: t, allTime: n, thisWeek: r, buddies: i }) => {
|
|
953
|
-
if (e.int(t), t !== -1) for (const s of [n, r, i]) e.int(s.length).each(s, ({ name: o, score: d }) => e.string(o).number(d));
|
|
954
|
-
} }), a({ name: "minigame.gems", description: "The server hands out the serial the next gem award is folded with.", direction: "toClient", command: "mg", read: (e) => ({ serial: e.int("serial"), forScore: e.remaining > 0 ? e.int("forScore") === 1 : !1 }), write: (e, { serial: t, forScore: n }) => e.int(t).int(n ? 1 : 0) }), a({ name: "minigame.pet-mastery", description: "The server hands out the serial the next pet mastery award is folded with.", direction: "toClient", command: "ma", read: (e) => ({ serial: e.int("serial"), showPopup: e.remaining > 0 ? e.string("showPopup") === "1" : !1 }), write: (e, { serial: t, showPopup: n }) => e.int(t).string(n ? "1" : "0") });
|
|
955
|
-
function fe(e) {
|
|
956
|
-
return { amountSum: e.number("amountSum"), gameSum: e.number("gameSum"), checkSum: e.number("checkSum") };
|
|
957
|
-
}
|
|
958
|
-
function ve(e, { amountSum: t, gameSum: n, checkSum: r }) {
|
|
959
|
-
return e.number(t).number(n).number(r);
|
|
960
|
-
}
|
|
961
|
-
a({ name: "minigame.gem-award", description: "A minigame awards the player gems.", direction: "toServer", command: "mg", read: (e) => fe(e), write: (e, t) => ve(e, t) }), a({ name: "minigame.pet-mastery-award", description: "A minigame awards the active pet mastery points.", direction: "toServer", command: "ma", read: (e) => fe(e), write: (e, t) => ve(e, t) }), a({ name: "minigame.score", description: "A minigame reports the player’s score.", direction: "toServer", command: "msv", read: (e) => ({ mainSum: e.number("mainSum"), valueSum: e.number("valueSum"), numSum: e.number("numSum"), varRefSum: e.number("varRefSum"), gameSum: e.number("gameSum") }), write: (e, { mainSum: t, valueSum: n, numSum: r, varRefSum: i, gameSum: s }) => e.number(t).number(n).number(r).number(i).number(s) }), a({ name: "party.list-request", description: "The player asks which parties are on.", direction: "toServer", command: "sl", read: () => ({}), write: () => {
|
|
962
|
-
} }), a({ name: "party.list", description: "The server lists Animal Jam’s parties.", direction: "toClient", command: "sl", read: (e) => ({ unread: e.string("unread"), parties: e.repeat(e.int("count"), () => ({ defId: e.int("defId"), secondsToStart: e.number("secondsToStart"), secondsToEnd: e.number("secondsToEnd") })) }), write: (e, { unread: t, parties: n }) => e.string(t).int(n.length).each(n, (r) => e.int(r.defId).number(r.secondsToStart).number(r.secondsToEnd)) }), a({ name: "party.join-request", description: "The player asks to join a party.", direction: "toServer", command: "sj", read: (e) => ({ defId: e.int("defId") }), write: (e, { defId: t }) => e.int(t) }), a({ name: "party.join-result", description: "The server says a party could not be joined.", direction: "toClient", command: "sj", read: (e) => {
|
|
963
|
-
const t = e.flag("joined"), n = !t && e.remaining > 0 ? e.string("reason") : null;
|
|
964
|
-
return { joined: t, reason: n, extra: e.rest() };
|
|
965
|
-
}, write: (e, { joined: t, reason: n, extra: r }) => {
|
|
966
|
-
e.flag(t), n !== null && e.string(n), e.raw(r);
|
|
967
|
-
} }), a({ name: "party.custom-list-request", description: "The player asks which parties players are hosting.", direction: "toServer", command: "slp", read: (e) => ({ start: e.int("start"), limit: e.int("limit") }), write: (e, { start: t, limit: n }) => e.int(t).int(n) }), a({ name: "party.custom-list", description: "The server lists the parties players are hosting.", direction: "toClient", command: "slp", read: (e) => {
|
|
968
|
-
const t = e.flag("unread"), n = e.int("total");
|
|
969
|
-
if (n <= 0) return { unread: t, total: n, skipped: null, parties: [] };
|
|
970
|
-
const r = [e.int("skipped1"), e.int("skipped2")], i = e.repeat(e.int("count"), () => ({ creatorUuid: e.string("creatorUuid"), name: e.string("name"), node: e.string("node"), defId: e.int("defId"), timeLeft: e.number("timeLeft") }));
|
|
971
|
-
return { unread: t, total: n, skipped: r, parties: i };
|
|
972
|
-
}, write: (e, { unread: t, total: n, skipped: r, parties: i }) => {
|
|
973
|
-
e.flag(t).int(n), !(n <= 0) && e.int((r == null ? void 0 : r[0]) ?? 0).int((r == null ? void 0 : r[1]) ?? 0).int(i.length).each(i, (s) => e.string(s.creatorUuid).string(s.name).string(s.node).int(s.defId).number(s.timeLeft));
|
|
974
|
-
} }), a({ name: "party.custom-join-request", description: "The player asks to join a party a player hosts.", direction: "toServer", command: "sjp", read: (e) => ({ creatorUuid: e.string("creatorUuid") }), write: (e, { creatorUuid: t }) => e.string(t) }), a({ name: "party.custom-join-result", description: "The server says whether a hosted party could be joined.", direction: "toClient", command: "sjp", read: (e) => {
|
|
975
|
-
const t = e.string("joined") === "1", n = !t && e.remaining > 0 ? e.string("reason") : null;
|
|
976
|
-
return { joined: t, reason: n, extra: e.rest() };
|
|
977
|
-
}, write: (e, { joined: t, reason: n, extra: r }) => {
|
|
978
|
-
e.string(t ? "1" : "0"), n !== null && e.string(n), e.raw(r);
|
|
979
|
-
} }), a({ name: "party.custom-node-request", description: "The player asks which server a hosted party is on.", direction: "toServer", command: "spn", read: (e) => ({ creatorUuid: e.string("creatorUuid") }), write: (e, { creatorUuid: t }) => e.string(t) }), a({ name: "party.custom-host-request", description: "The player asks to host a party of their own.", direction: "toServer", command: "scp", read: (e) => ({ defId: e.int("defId"), nameStrIds: [e.int("nameStrId1"), e.int("nameStrId2"), e.int("nameStrId3")], audioDefId: e.int("audioDefId") }), write: (e, { defId: t, nameStrIds: n, audioDefId: r }) => e.int(t).int(n[0]).int(n[1]).int(n[2]).int(r) }), a({ name: "party.custom-hosting-request", description: "The player asks whether someone is hosting a party.", direction: "toServer", command: "sphp", read: (e) => ({ creatorUuid: e.string("creatorUuid") }), write: (e, { creatorUuid: t }) => e.string(t) }), a({ name: "party.custom-hosting", description: "The server says how long someone has left hosting a party.", direction: "toClient", command: "sphp", read: (e) => ({ secondsLeft: e.int("secondsLeft"), extra: e.rest() }), write: (e, { secondsLeft: t, extra: n }) => e.int(t).raw(n) }), a({ name: "party.masterpieces-request", description: "The player asks for the bulletin board’s masterpieces.", direction: "toServer", command: "sm", read: () => ({}), write: () => {
|
|
980
|
-
} }), a({ name: "party.masterpieces", description: "The server gives the bulletin board’s masterpieces.", direction: "toClient", command: "sm", read: (e) => {
|
|
981
|
-
const t = e.string("pool");
|
|
982
|
-
return { json: t, pool: Tt(t) };
|
|
983
|
-
}, write: (e, { json: t }) => e.string(t) });
|
|
984
|
-
function Tt(e) {
|
|
985
|
-
if (e === "") return [];
|
|
986
|
-
let t;
|
|
987
|
-
try {
|
|
988
|
-
t = JSON.parse(e);
|
|
989
|
-
} catch {
|
|
990
|
-
throw new u(`party.masterpieces: field "pool" is not JSON ("${e}")`, "PACKET_FIELD");
|
|
991
|
-
}
|
|
992
|
-
return (Ie(t) && Array.isArray(t.pool) ? t.pool : []).filter(Ie).map((n) => ({ frameId: Number(n.frameId) || 0, resourceId: Number(n.resourceId) || 0, userName: typeof n.userName == "string" ? n.userName : "", creatorDbId: Number(n.creatorDBId) || 0, creatorUuid: typeof n.creatorId == "string" ? n.creatorId : "", raw: n }));
|
|
993
|
-
}
|
|
994
|
-
function Ie(e) {
|
|
995
|
-
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
996
|
-
}
|
|
997
|
-
a({ name: "party.custom-host-result", description: "The server says whether the player may host a party.", direction: "toClient", command: "scp", read: (e) => {
|
|
998
|
-
const t = e.flag("hosting"), n = { hosting: t, secondsLeft: null, reason: null };
|
|
999
|
-
if (!t) return { ...n, reason: e.string("reason") };
|
|
1000
|
-
const r = e.flag("stillHosting");
|
|
1001
|
-
return { ...n, secondsLeft: r ? e.int("secondsLeft") : null };
|
|
1002
|
-
}, write: (e, { hosting: t, secondsLeft: n, reason: r }) => {
|
|
1003
|
-
if (e.flag(t), !t) {
|
|
1004
|
-
e.string(r ?? "");
|
|
1005
|
-
return;
|
|
1006
|
-
}
|
|
1007
|
-
e.flag(n !== null), n !== null && e.int(n);
|
|
1008
|
-
} }), a({ name: "party.custom-killed", description: "The server ends the player’s hosted party from outside the client.", direction: "toClient", command: "spk", read: (e) => ({ diamondsRefunded: e.int("diamondsRefunded") }), write: (e, { diamondsRefunded: t }) => e.int(t) }), a({ name: "party.custom-node", description: "The server says which server a hosted party is on.", direction: "toClient", command: "spn", read: (e) => {
|
|
1009
|
-
const t = e.string("found") === "1", n = t ? { creatorUuid: e.string("creatorUuid"), node: e.string("node") } : null;
|
|
1010
|
-
return { found: t, party: n, extra: e.rest() };
|
|
1011
|
-
}, write: (e, { found: t, party: n, extra: r }) => {
|
|
1012
|
-
e.string(t ? "1" : "0"), t && n && e.string(n.creatorUuid).string(n.node), e.raw(r);
|
|
1013
|
-
} }), a({ name: "newspaper.page-seen-request", description: "The player marks a newspaper page seen.", direction: "toServer", command: "nps", read: (e) => ({ defId: e.int("defId") }), write: (e, { defId: t }) => e.int(t) }), a({ name: "newspaper.page-seen", description: "The server confirms a newspaper page was marked seen.", direction: "toClient", command: "nps", read: (e) => ({ defId: e.int("defId"), timeSeen: e.int("timeSeen") }), write: (e, { defId: t, timeSeen: n }) => e.int(t).int(n) });
|
|
1014
|
-
const C = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1015
|
-
function xt(e) {
|
|
1016
|
-
const t = e.replace(/[\s=]/g, ""), n = new Uint8Array(Math.floor(t.length * 3 / 4));
|
|
1017
|
-
let r = 0, i = 0, s = 0;
|
|
1018
|
-
for (const o of t) {
|
|
1019
|
-
const d = C.indexOf(o);
|
|
1020
|
-
if (d === -1) throw new u(`"${o}" is not a Base64 character`, "PACKET_FIELD");
|
|
1021
|
-
r = r << 6 | d, i += 6, i >= 8 && (i -= 8, n[s++] = r >> i & 255);
|
|
1022
|
-
}
|
|
1023
|
-
return n.subarray(0, s);
|
|
1024
|
-
}
|
|
1025
|
-
function Nt(e) {
|
|
1026
|
-
let t = "";
|
|
1027
|
-
for (let n = 0; n < e.length; n += 3) {
|
|
1028
|
-
const r = e[n], i = e[n + 1], s = e[n + 2], o = r << 16 | (i ?? 0) << 8 | (s ?? 0);
|
|
1029
|
-
t += C[o >> 18 & 63] + C[o >> 12 & 63], t += i === void 0 ? "=" : C[o >> 6 & 63], t += s === void 0 ? "=" : C[o & 63];
|
|
1030
|
-
}
|
|
1031
|
-
return t;
|
|
1032
|
-
}
|
|
1033
|
-
class kt {
|
|
1034
|
-
constructor(t) {
|
|
1035
|
-
this.bytes = t;
|
|
1036
|
-
}
|
|
1037
|
-
bytes;
|
|
1038
|
-
position = 0;
|
|
1039
|
-
readShort() {
|
|
1040
|
-
const t = this.byte() << 8 | this.byte();
|
|
1041
|
-
return t >= 32768 ? t - 65536 : t;
|
|
1042
|
-
}
|
|
1043
|
-
readUTF() {
|
|
1044
|
-
const t = this.byte() << 8 | this.byte(), n = this.position + t;
|
|
1045
|
-
n > this.bytes.length && this.fail("A string runs past the end of the bytes");
|
|
1046
|
-
let r = "";
|
|
1047
|
-
for (; this.position < n; ) {
|
|
1048
|
-
const i = this.byte();
|
|
1049
|
-
if (i < 128) r += String.fromCharCode(i);
|
|
1050
|
-
else if ((i & 224) === 192) r += String.fromCharCode((i & 31) << 6 | this.byte() & 63);
|
|
1051
|
-
else if ((i & 240) === 224) {
|
|
1052
|
-
const s = this.byte();
|
|
1053
|
-
r += String.fromCharCode((i & 15) << 12 | (s & 63) << 6 | this.byte() & 63);
|
|
1054
|
-
} else this.fail("A string holds a byte modified UTF-8 never starts a character with");
|
|
1055
|
-
}
|
|
1056
|
-
return r;
|
|
1057
|
-
}
|
|
1058
|
-
byte() {
|
|
1059
|
-
return this.position >= this.bytes.length && this.fail("The bytes end early"), this.bytes[this.position++];
|
|
1060
|
-
}
|
|
1061
|
-
fail(t) {
|
|
1062
|
-
throw new u(t, "PACKET_FIELD", this.position);
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
class qt {
|
|
1066
|
-
bytes = [];
|
|
1067
|
-
writeShort(t) {
|
|
1068
|
-
return this.bytes.push(t >> 8 & 255, t & 255), this;
|
|
1069
|
-
}
|
|
1070
|
-
writeUTF(t) {
|
|
1071
|
-
const n = [];
|
|
1072
|
-
for (let r = 0; r < t.length; r++) {
|
|
1073
|
-
const i = t.charCodeAt(r);
|
|
1074
|
-
i >= 1 && i < 128 ? n.push(i) : i < 2048 ? n.push(192 | i >> 6, 128 | i & 63) : n.push(224 | i >> 12, 128 | i >> 6 & 63, 128 | i & 63);
|
|
1075
|
-
}
|
|
1076
|
-
if (n.length > 65535) throw new u("A string is longer than writeUTF can write", "PACKET_FIELD");
|
|
1077
|
-
return this.writeShort(n.length), this.bytes.push(...n), this;
|
|
1078
|
-
}
|
|
1079
|
-
toBytes() {
|
|
1080
|
-
return Uint8Array.from(this.bytes);
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
function Ct(e) {
|
|
1084
|
-
const t = Math.max(1, Math.ceil(e.length / 65535)), n = new Uint8Array(2 + t * 5 + e.length + 4);
|
|
1085
|
-
n[0] = 120, n[1] = 1;
|
|
1086
|
-
let r = 2;
|
|
1087
|
-
for (let d = 0; d < t; d++) {
|
|
1088
|
-
const m = d * 65535, c = Math.min(65535, e.length - m);
|
|
1089
|
-
n[r++] = d === t - 1 ? 1 : 0, n[r++] = c & 255, n[r++] = c >> 8, n[r++] = ~c & 255, n[r++] = ~c >> 8 & 255, n.set(e.subarray(m, m + c), r), r += c;
|
|
1090
|
-
}
|
|
1091
|
-
let i = 1, s = 0;
|
|
1092
|
-
for (const d of e) i = (i + d) % 65521, s = (s + i) % 65521;
|
|
1093
|
-
const o = (s << 16 | i) >>> 0;
|
|
1094
|
-
return n[r++] = o >>> 24, n[r++] = o >>> 16 & 255, n[r++] = o >>> 8 & 255, n[r] = o & 255, n;
|
|
1095
|
-
}
|
|
1096
|
-
function St(e) {
|
|
1097
|
-
return e.length < 2 && p("A zlib stream has a two byte header"), ((e[0] & 15) !== 8 || (e[0] << 8 | e[1]) % 31 !== 0) && p("Not a zlib stream of deflate data"), e[1] & 32 && p("A zlib stream with a preset dictionary cannot be read"), Et(e.subarray(2));
|
|
1098
|
-
}
|
|
1099
|
-
const At = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], ye = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258], Dt = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], we = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], Ut = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];
|
|
1100
|
-
function S(e) {
|
|
1101
|
-
const t = new Uint16Array(16);
|
|
1102
|
-
for (let i = 0; i < e.length; i++) t[e[i]]++;
|
|
1103
|
-
t[0] = 0;
|
|
1104
|
-
const n = new Uint16Array(16);
|
|
1105
|
-
for (let i = 1; i < 16; i++) n[i] = n[i - 1] + t[i - 1];
|
|
1106
|
-
const r = new Uint16Array(e.length);
|
|
1107
|
-
for (let i = 0; i < e.length; i++) {
|
|
1108
|
-
const s = e[i];
|
|
1109
|
-
s !== 0 && (r[n[s]++] = i);
|
|
1110
|
-
}
|
|
1111
|
-
return { counts: t, symbols: r };
|
|
1112
|
-
}
|
|
1113
|
-
let F = null;
|
|
1114
|
-
function Bt() {
|
|
1115
|
-
if (!F) {
|
|
1116
|
-
const e = new Uint8Array(288);
|
|
1117
|
-
e.fill(8, 0, 144), e.fill(9, 144, 256), e.fill(7, 256, 280), e.fill(8, 280, 288), F = { literals: S(e), distances: S(new Uint8Array(30).fill(5)) };
|
|
1118
|
-
}
|
|
1119
|
-
return F;
|
|
1120
|
-
}
|
|
1121
|
-
class jt {
|
|
1122
|
-
constructor(t) {
|
|
1123
|
-
this.bytes = t;
|
|
1124
|
-
}
|
|
1125
|
-
bytes;
|
|
1126
|
-
position = 0;
|
|
1127
|
-
bitBuffer = 0;
|
|
1128
|
-
bitCount = 0;
|
|
1129
|
-
bits(t) {
|
|
1130
|
-
for (; this.bitCount < t; ) this.position >= this.bytes.length && p("The deflate data ends early"), this.bitBuffer |= this.bytes[this.position++] << this.bitCount, this.bitCount += 8;
|
|
1131
|
-
const n = this.bitBuffer & (1 << t) - 1;
|
|
1132
|
-
return this.bitBuffer >>>= t, this.bitCount -= t, n;
|
|
1133
|
-
}
|
|
1134
|
-
align() {
|
|
1135
|
-
this.bitBuffer = 0, this.bitCount = 0;
|
|
1136
|
-
}
|
|
1137
|
-
byte() {
|
|
1138
|
-
return this.position >= this.bytes.length && p("The deflate data ends early"), this.bytes[this.position++];
|
|
1139
|
-
}
|
|
1140
|
-
decode(t) {
|
|
1141
|
-
let n = 0, r = 0, i = 0;
|
|
1142
|
-
for (let s = 1; s < 16; s++) {
|
|
1143
|
-
i |= this.bits(1);
|
|
1144
|
-
const o = t.counts[s];
|
|
1145
|
-
if (i - n < o) return t.symbols[r + i - n];
|
|
1146
|
-
r += o, n = n + o << 1, i <<= 1;
|
|
1147
|
-
}
|
|
1148
|
-
return p("The deflate data holds a code that is not in its table");
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
class Lt {
|
|
1152
|
-
bytes = new Uint8Array(1024);
|
|
1153
|
-
length = 0;
|
|
1154
|
-
push(t) {
|
|
1155
|
-
if (this.length === this.bytes.length) {
|
|
1156
|
-
const n = new Uint8Array(this.bytes.length * 2);
|
|
1157
|
-
n.set(this.bytes), this.bytes = n;
|
|
1158
|
-
}
|
|
1159
|
-
this.bytes[this.length++] = t;
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
function Et(e) {
|
|
1163
|
-
const t = new jt(e), n = new Lt();
|
|
1164
|
-
let r = !1;
|
|
1165
|
-
for (; !r; ) {
|
|
1166
|
-
r = t.bits(1) === 1;
|
|
1167
|
-
const i = t.bits(2);
|
|
1168
|
-
if (i === 0) {
|
|
1169
|
-
t.align();
|
|
1170
|
-
const s = t.byte() | t.byte() << 8, o = t.byte() | t.byte() << 8;
|
|
1171
|
-
(s ^ 65535) !== o && p("A stored deflate block has a bad length");
|
|
1172
|
-
for (let d = 0; d < s; d++) n.push(t.byte());
|
|
1173
|
-
} else if (i === 1) {
|
|
1174
|
-
const { literals: s, distances: o } = Bt();
|
|
1175
|
-
be(t, n, s, o);
|
|
1176
|
-
} else if (i === 2) {
|
|
1177
|
-
const { literals: s, distances: o } = Pt(t);
|
|
1178
|
-
be(t, n, s, o);
|
|
1179
|
-
} else p("A deflate block has the reserved type 3");
|
|
1180
|
-
}
|
|
1181
|
-
return n.bytes.slice(0, n.length);
|
|
1182
|
-
}
|
|
1183
|
-
function Pt(e) {
|
|
1184
|
-
const t = e.bits(5) + 257, n = e.bits(5) + 1, r = e.bits(4) + 4, i = new Uint8Array(19);
|
|
1185
|
-
for (let m = 0; m < r; m++) i[At[m]] = e.bits(3);
|
|
1186
|
-
const s = S(i), o = new Uint8Array(t + n);
|
|
1187
|
-
let d = 0;
|
|
1188
|
-
for (; d < o.length; ) {
|
|
1189
|
-
const m = e.decode(s);
|
|
1190
|
-
if (m < 16) {
|
|
1191
|
-
o[d++] = m;
|
|
1192
|
-
continue;
|
|
1193
|
-
}
|
|
1194
|
-
let c, l = 0;
|
|
1195
|
-
m === 16 ? (d === 0 && p("A deflate block repeats a code length before giving one"), l = o[d - 1], c = 3 + e.bits(2)) : m === 17 ? c = 3 + e.bits(3) : c = 11 + e.bits(7), d + c > o.length && p("A deflate block has too many code lengths"), o.fill(l, d, d + c), d += c;
|
|
1196
|
-
}
|
|
1197
|
-
return { literals: S(o.subarray(0, t)), distances: S(o.subarray(t)) };
|
|
1198
|
-
}
|
|
1199
|
-
function be(e, t, n, r) {
|
|
1200
|
-
for (; ; ) {
|
|
1201
|
-
const i = e.decode(n);
|
|
1202
|
-
if (i < 256) t.push(i);
|
|
1203
|
-
else {
|
|
1204
|
-
if (i === 256) return;
|
|
1205
|
-
{
|
|
1206
|
-
const s = i - 257;
|
|
1207
|
-
s >= ye.length && p("A deflate block has a bad length code");
|
|
1208
|
-
const o = ye[s] + e.bits(Dt[s]), d = e.decode(r);
|
|
1209
|
-
d >= we.length && p("A deflate block has a bad distance code");
|
|
1210
|
-
const m = we[d] + e.bits(Ut[d]);
|
|
1211
|
-
m > t.length && p("A deflate block points before its start");
|
|
1212
|
-
for (let c = 0; c < o; c++) t.push(t.bytes[t.length - m]);
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
function p(e) {
|
|
1218
|
-
throw new u(e, "PACKET_FIELD");
|
|
1219
|
-
}
|
|
1220
|
-
const Mt = 200, $e = 16, $t = [11, 23], Ft = { setState: 1 }, I = { denItem: 1, clothing: 2, gems: 3, crystals: 4 };
|
|
1221
|
-
a({ name: "quest.join", description: "The player joins or creates a public adventure.", direction: "toServer", command: "qj", read: (e) => ({ roomName: e.string("roomName"), scriptDefId: e.int("scriptDefId"), difficulty: e.int("difficulty"), reserved: e.int("reserved") }), write: (e, { roomName: t, scriptDefId: n, difficulty: r, reserved: i }) => e.string(t).int(n).int(r).int(i) }), a({ name: "quest.create-private", description: "The player creates a private adventure to host.", direction: "toServer", command: "qjc", read: (e) => ({ roomName: e.string("roomName"), scriptDefId: e.int("scriptDefId"), difficulty: e.int("difficulty") }), write: (e, { roomName: t, scriptDefId: n, difficulty: r }) => e.string(t).int(n).int(r) }), a({ name: "quest.join-private", description: "The player joins a private adventure another player hosts.", direction: "toServer", command: "qjp", read: (e) => ({ roomName: e.string("roomName"), hostUserName: e.string("hostUserName") }), write: (e, { roomName: t, hostUserName: n }) => e.string(t).string(n) }), a({ name: "quest.join-buddy", description: "The player joins the adventure a buddy is in.", direction: "toServer", command: "qjf", read: (e) => ({ roomName: e.string("roomName"), buddyUserName: e.string("buddyUserName") }), write: (e, { roomName: t, buddyUserName: n }) => e.string(t).string(n) }), a({ name: "quest.join-cancel", description: "The player leaves an adventure lobby before it starts.", direction: "toServer", command: "qjx", read: () => ({}), write: () => {
|
|
1222
|
-
} }), a({ name: "quest.kick", description: "The host removes a player from a private adventure lobby.", direction: "toServer", command: "qjk", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "quest.start", description: "The player starts the adventure they are waiting in.", direction: "toServer", command: "qs", read: (e) => ({ roomName: e.string("roomName") }), write: (e, { roomName: t }) => e.string(t) }), a({ name: "quest.exit", description: "The player leaves the adventure.", direction: "toServer", command: "qx", read: (e) => ({ exitType: e.string("exitType") }), write: (e, { exitType: t }) => e.string(t) }), a({ name: "quest.actor-trigger", description: "The player sets off an adventure actor, such as a treasure chest.", direction: "toServer", command: "qat", read: (e) => ({ actorId: e.string("actorId"), value: e.int("value") }), write: (e, { actorId: t, value: n }) => e.string(t).int(n) }), a({ name: "quest.treasure-choice", description: "The player keeps or turns down a treasure chest’s prize.", direction: "toServer", command: "qatt", read: (e) => ({ actorId: e.string("actorId"), keep: e.flag("keep") }), write: (e, { actorId: t, keep: n }) => e.string(t).flag(n) }), a({ name: "quest.pick-up", description: "The player picks up an item in an adventure.", direction: "toServer", command: "qpup", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId") }), write: (e, { actorId: t, userId: n }) => e.string(t).int(n) });
|
|
1223
|
-
function Te(e, t, n) {
|
|
1224
|
-
return a({ name: e, description: n, direction: "toServer", command: t, read: (r) => ({ index: r.int("index"), belowGoal: r.flag("belowGoal"), discarded: r.flag("discarded") }), write: (r, { index: i, belowGoal: s, discarded: o }) => r.int(i).flag(s).flag(o) });
|
|
1225
|
-
}
|
|
1226
|
-
Te("quest.gift-choice", "qpgift", "The player picks a gift on an adventure’s reward screen."), Te("quest.player-gift-choice", "qpgiftplr", "The player picks a gift on their own reward screen."), a({ name: "quest.gifts-done", description: "The player finished picking an adventure’s gifts.", direction: "toServer", command: "qpgiftdone", read: (e) => ({ done: e.flag("done") }), write: (e, { done: t }) => e.flag(t) });
|
|
1227
|
-
function R(e, t, n, r) {
|
|
1228
|
-
return a({ name: e, description: n, direction: "toClient", command: t, read: (i) => {
|
|
1229
|
-
const s = i.flag("joined");
|
|
1230
|
-
return s ? { joined: s, status: i.string("status"), scriptDefId: i.int("scriptDefId"), difficulty: r && i.remaining > 0 ? i.int("difficulty") : null, extra: i.rest(), refusal: null } : { joined: s, refusal: i.string("refusal"), extra: i.rest() };
|
|
1231
|
-
}, write: (i, s) => {
|
|
1232
|
-
i.flag(s.joined), s.joined ? (i.string(s.status).int(s.scriptDefId), s.difficulty !== null && i.int(s.difficulty)) : i.string(s.refusal), i.raw(s.extra);
|
|
1233
|
-
} });
|
|
1234
|
-
}
|
|
1235
|
-
R("quest.join-result", "qj", "The server says whether the player joined a public adventure.", !0), R("quest.create-private-result", "qjc", "The server says whether the player’s private adventure was created.", !1), R("quest.join-private-result", "qjp", "The server says whether the player joined a private adventure.", !0), a({ name: "quest.waiting", description: "The players waiting in the adventure lobby changed.", direction: "toClient", command: "qw", read: (e) => ({ userIds: e.repeat(e.remaining, () => e.int("userId")) }), write: (e, { userIds: t }) => e.each(t, (n) => e.int(n)) }), a({ name: "quest.join-cancelled", description: "The server confirms the player left the adventure lobby.", direction: "toClient", command: "qjx", read: (e) => ({ extra: e.rest() }), write: (e, { extra: t }) => e.raw(t) }), a({ name: "quest.started", description: "The adventure starts, with every actor in it.", direction: "toClient", command: "qs", read: (e) => {
|
|
1236
|
-
const t = e.int("scriptDefId"), n = e.int("playerCount"), r = e.int("actorCount");
|
|
1237
|
-
if (r < 0) return { scriptDefId: t, playerCount: n, started: !1, timestamp: "", actors: [], extra: e.rest() };
|
|
1238
|
-
const i = e.string("timestamp"), s = e.repeat(r, () => Rt(e));
|
|
1239
|
-
return { scriptDefId: t, playerCount: n, started: !0, timestamp: i, actors: s, extra: e.rest() };
|
|
1240
|
-
}, write: (e, { scriptDefId: t, playerCount: n, started: r, timestamp: i, actors: s, extra: o }) => {
|
|
1241
|
-
e.int(t).int(n), r ? e.int(s.length).string(i).each(s, (d) => Ot(e, d)) : e.int(-1), e.raw(o);
|
|
1242
|
-
} });
|
|
1243
|
-
function Rt(e) {
|
|
1244
|
-
const t = e.string("actorId"), n = e.int("type"), r = n === $e, i = r ? e.string("defName") : null, s = r ? null : e.int("defId");
|
|
1245
|
-
return { actorId: t, type: n, defId: s, defName: i, state: e.int("state"), visible: e.int("visible") === 1, requireClick: e.int("requireClick") === 1, pathName: e.string("pathName"), swfState: e.string("swfState") };
|
|
1246
|
-
}
|
|
1247
|
-
function Ot(e, t) {
|
|
1248
|
-
e.string(t.actorId).int(t.type), t.type === $e ? e.string(t.defName ?? "") : e.int(t.defId ?? 0), e.int(t.state).int(t.visible ? 1 : 0).int(t.requireClick ? 1 : 0).string(t.pathName).string(t.swfState);
|
|
1249
|
-
}
|
|
1250
|
-
a({ name: "quest.treasure", description: "A treasure chest offers the player its prize.", direction: "toClient", command: "qatt", read: (e) => ({ actorId: e.string("actorId"), prize: e.int("prize"), value: e.int("value"), color: e.int("color"), popup: e.int("popup") }), write: (e, { actorId: t, prize: n, value: r, color: i, popup: s }) => e.string(t).int(n).int(r).int(i).int(s) }), a({ name: "quest.xp", description: "The player earned adventure experience.", direction: "toClient", command: "quxp", read: (e) => ({ earned: e.int("earned"), totalXp: e.int("totalXp"), previousLevel: e.int("previousLevel"), level: e.int("level"), levelProgress: e.number("levelProgress"), actorId: e.string("actorId") }), write: (e, { earned: t, totalXp: n, previousLevel: r, level: i, levelProgress: s, actorId: o }) => e.int(t).int(n).int(r).int(i).number(s).string(o) }), a({ name: "quest.level-up", description: "A player in the adventure levelled up.", direction: "toClient", command: "qulu", read: (e) => ({ userId: e.int("userId"), level: e.int("level") }), write: (e, { userId: t, level: n }) => e.int(t).int(n) }), a({ name: "quest.player-left", description: "A player left the adventure.", direction: "toClient", command: "qplq", read: (e) => ({ userId: e.int("userId"), avatarName: e.string("avatarName") }), write: (e, { userId: t, avatarName: n }) => e.int(t).string(n) });
|
|
1251
|
-
function xe(e, t, n) {
|
|
1252
|
-
return a({ name: e, description: n, direction: "toClient", command: t, read: (r) => {
|
|
1253
|
-
const i = r.int("count"), s = r.int("popupType"), o = r.repeat(i, () => ({ prize: r.int("prize"), value: r.int("value"), color: r.int("color") }));
|
|
1254
|
-
return { popupType: s, gifts: o };
|
|
1255
|
-
}, write: (r, { popupType: i, gifts: s }) => r.int(s.length).int(i).each(s, ({ prize: o, value: d, color: m }) => r.int(o).int(d).int(m)) });
|
|
1256
|
-
}
|
|
1257
|
-
xe("quest.rewards", "qpgift", "The adventure’s reward screen opens with its gifts."), xe("quest.player-rewards", "qpgiftplr", "The player’s own reward screen opens with its gifts."), a({ name: "quest.award", description: "The adventure awards a stat or achievement.", direction: "toClient", command: "qaward", read: (e) => ({ userVarId: e.int("userVarId"), value: e.int("value") }), write: (e, { userVarId: t, value: n }) => e.int(t).int(n) }), a({ name: "quest.exit-by-type", description: "The server sends the player out of the adventure.", direction: "toClient", command: "qxt", read: (e) => ({ exitType: e.string("exitType") }), write: (e, { exitType: t }) => e.string(t) }), a({ name: "quest.bundle", description: "Several adventure messages packed into one.", direction: "toClient", command: "qqm", read: (e) => {
|
|
1258
|
-
const t = e.string("payload"), n = new kt(St(xt(t))), r = n.readShort();
|
|
1259
|
-
return { messages: Array.from({ length: Math.max(0, r) }, () => {
|
|
1260
|
-
const i = n.readShort(), s = n.readUTF(), o = Array.from({ length: Math.max(0, i - 1) }, () => n.readUTF());
|
|
1261
|
-
return { command: s, args: o };
|
|
1262
|
-
}), extra: e.rest() };
|
|
1263
|
-
}, write: (e, { messages: t, extra: n }) => {
|
|
1264
|
-
const r = new qt().writeShort(t.length);
|
|
1265
|
-
for (const { command: i, args: s } of t) r.writeShort(s.length + 1).writeUTF(i), s.forEach((o) => r.writeUTF(o));
|
|
1266
|
-
e.string(Nt(Ct(r.toBytes()))).raw(n);
|
|
1267
|
-
} }), a({ name: "quest.actor-spawned", description: "An actor appears in the adventure, such as dropped treasure.", direction: "toClient", command: "qspn", read: (e) => {
|
|
1268
|
-
const t = e.string("spawnedFrom"), n = e.string("actorId"), r = e.int("type"), i = e.int("defId");
|
|
1269
|
-
let s = null, o = null;
|
|
1270
|
-
if (r === Mt) {
|
|
1271
|
-
const d = e.int("subType");
|
|
1272
|
-
s = { subType: d, denDefId: null, itemDefId: null, color: null, amount: null }, d === I.denItem ? s.denDefId = e.int("denDefId") : d === I.clothing ? (s.itemDefId = e.int("itemDefId"), s.color = e.int("color")) : (d === I.gems || d === I.crystals) && (s.amount = e.int("amount"));
|
|
1273
|
-
} else $t.includes(r) && (o = { x: e.number("spawnOffsetX"), y: e.number("spawnOffsetY") });
|
|
1274
|
-
return { spawnedFrom: t, actorId: n, type: r, defId: i, dropped: s, spawnOffset: o, extra: e.rest() };
|
|
1275
|
-
}, write: (e, { spawnedFrom: t, actorId: n, type: r, defId: i, dropped: s, spawnOffset: o, extra: d }) => {
|
|
1276
|
-
e.string(t).string(n).int(r).int(i), s ? (e.int(s.subType), s.subType === I.denItem ? e.int(s.denDefId ?? 0) : s.subType === I.clothing ? e.int(s.itemDefId ?? 0).int(s.color ?? 0) : (s.subType === I.gems || s.subType === I.crystals) && e.int(s.amount ?? 0)) : o && e.number(o.x).number(o.y), e.raw(d);
|
|
1277
|
-
} }), a({ name: "quest.actor-moved", description: "An adventure actor moved.", direction: "toClient", command: "qau", read: (e) => ({ actorId: e.string("actorId"), x: e.int("x"), y: e.int("y"), velocity: e.int("velocity"), seekType: e.int("seekType"), nearestX: e.int("nearestX"), nearestY: e.int("nearestY") }), write: (e, { actorId: t, x: n, y: r, velocity: i, seekType: s, nearestX: o, nearestY: d }) => e.string(t).int(n).int(r).int(i).int(s).int(o).int(d) }), a({ name: "quest.actor-position-report", description: "The client reports where an adventure actor it moves is.", direction: "toServer", command: "qau", read: (e) => ({ actorId: e.string("actorId"), x: e.int("x"), y: e.int("y"), velocity: e.int("velocity"), seekType: e.int("seekType"), nearestX: e.int("nearestX"), nearestY: e.int("nearestY") }), write: (e, { actorId: t, x: n, y: r, velocity: i, seekType: s, nearestX: o, nearestY: d }) => e.string(t).int(n).int(r).int(i).int(s).int(o).int(d) }), a({ name: "quest.actor-seek", description: "An adventure actor starts seeking a player, path or plant.", direction: "toClient", command: "qas", read: (e) => ({ actorId: e.string("actorId"), seekType: e.int("seekType"), userId: e.int("userId") }), write: (e, { actorId: t, seekType: n, userId: r }) => e.string(t).int(n).int(r) }), a({ name: "quest.actor-seek-request", description: "The client asks for an adventure actor to seek.", direction: "toServer", command: "qas", read: (e) => ({ actorId: e.string("actorId"), seekType: e.int("seekType") }), write: (e, { actorId: t, seekType: n }) => e.string(t).int(n) }), a({ name: "quest.actor-untrigger", description: "The player left an adventure actor’s area.", direction: "toServer", command: "qaut", read: (e) => ({ actorId: e.string("actorId") }), write: (e, { actorId: t }) => e.string(t) }), a({ name: "quest.actor-health", description: "An adventure actor was hit, or missed.", direction: "toClient", command: "qahs", read: (e) => {
|
|
1278
|
-
const t = e.string("actorId"), n = e.int("healthPercent"), r = n === -1, i = !r && e.remaining > 0 ? e.int("damage") : null, s = i !== null && e.remaining > 0 ? e.int("fierce") === 1 : null;
|
|
1279
|
-
return { actorId: t, healthPercent: n, missed: r, damage: i, fierce: s, extra: e.rest() };
|
|
1280
|
-
}, write: (e, { actorId: t, healthPercent: n, damage: r, fierce: i, extra: s }) => {
|
|
1281
|
-
e.string(t).int(n), r !== null && (e.int(r), i !== null && e.int(i ? 1 : 0)), e.raw(s);
|
|
1282
|
-
} }), a({ name: "quest.actor-died", description: "An adventure actor was defeated or used up.", direction: "toClient", command: "qad", read: (e) => ({ actorId: e.string("actorId"), damage: e.int("damage"), moved: e.string("moved") === "1", x: e.int("x"), y: e.int("y"), otherActorId: e.string("otherActorId") }), write: (e, { actorId: t, damage: n, moved: r, x: i, y: s, otherActorId: o }) => e.string(t).int(n).flag(r).int(i).int(s).string(o) }), a({ name: "quest.actor-restored", description: "An adventure actor came back.", direction: "toClient", command: "qrestore", read: (e) => ({ actorId: e.string("actorId"), healthPercent: e.int("healthPercent") }), write: (e, { actorId: t, healthPercent: n }) => e.string(t).int(n) });
|
|
1283
|
-
function Ne(e, t, n, r) {
|
|
1284
|
-
return a({ name: e, description: n, direction: "toClient", command: t, read: (i) => {
|
|
1285
|
-
const s = i.int("command");
|
|
1286
|
-
if (s !== Ft.setState || i.remaining < 2) return { command: s, actorId: null, state: null, visible: null, requireClick: null, args: i.rest() };
|
|
1287
|
-
const o = i.string("actorId"), d = i.int("state"), m = !r && i.remaining >= 2, c = m ? i.string("visible") === "1" : null, l = m ? i.string("requireClick") === "1" : null;
|
|
1288
|
-
return { command: s, actorId: o, state: d, visible: c, requireClick: l, args: i.rest() };
|
|
1289
|
-
}, write: (i, s) => {
|
|
1290
|
-
i.int(s.command), s.actorId !== null && s.state !== null && (i.string(s.actorId).int(s.state), s.visible !== null && s.requireClick !== null && i.flag(s.visible).flag(s.requireClick)), i.raw(s.args);
|
|
1291
|
-
} });
|
|
1292
|
-
}
|
|
1293
|
-
Ne("quest.command", "qcmd", "The adventure’s script tells the client to do something, such as change an actor.", !1), Ne("quest.variable", "qcmdVT", "The adventure’s script sets one of its variables.", !0), a({ name: "quest.actor-swf-state", description: "An adventure actor’s animation changes state.", direction: "toClient", command: "qswfs", read: (e) => ({ actorId: e.string("actorId"), swfState: e.string("swfState") }), write: (e, { actorId: t, swfState: n }) => e.string(t).string(n) }), a({ name: "quest.actor-path", description: "An adventure actor walks another path.", direction: "toClient", command: "qsp", read: (e) => ({ actorId: e.string("actorId"), pathName: e.string("pathName") }), write: (e, { actorId: t, pathName: n }) => e.string(t).string(n) }), a({ name: "quest.actor-icon", description: "An adventure actor’s icon shows or hides.", direction: "toClient", command: "qicon", read: (e) => ({ actorId: e.string("actorId"), showing: e.string("showing") === "1" }), write: (e, { actorId: t, showing: n }) => e.string(t).flag(n) }), a({ name: "quest.moved-items", description: "Where players moved the adventure’s items.", direction: "toClient", command: "qmi", read: (e) => ({ items: e.repeat(Math.floor(e.remaining / 5), () => ({ actorId: e.string("actorId"), innerRadius: e.int("innerRadius"), outerRadius: e.int("outerRadius"), x: e.number("x"), y: e.number("y") })), extra: e.rest() }), write: (e, { items: t, extra: n }) => e.each(t, (r) => e.string(r.actorId).int(r.innerRadius).int(r.outerRadius).number(r.x).number(r.y)).raw(n) });
|
|
1294
|
-
const T = { askToDrop: 0, pickedUp: 1, droppedAt: 3, placedAt: 4 };
|
|
1295
|
-
a({ name: "quest.pick-up-result", description: "The server says what came of picking up an adventure item.", direction: "toClient", command: "qpup", read: (e) => {
|
|
1296
|
-
const t = e.int("result"), n = { result: t, heldItem: null, actorId: null, userId: null, x: null, y: null, innerRadius: null, outerRadius: null, dropperUserId: null };
|
|
1297
|
-
if (t === T.askToDrop) return { ...n, heldItem: e.string("heldItem"), extra: e.rest() };
|
|
1298
|
-
if (t !== T.pickedUp && t !== T.droppedAt && t !== T.placedAt) return { ...n, extra: e.rest() };
|
|
1299
|
-
const r = { ...n, actorId: e.string("actorId"), userId: e.int("userId") };
|
|
1300
|
-
return t !== T.pickedUp && (r.x = e.number("x"), r.y = e.number("y")), t === T.placedAt && (r.innerRadius = e.int("innerRadius"), r.outerRadius = e.int("outerRadius"), r.dropperUserId = e.int("dropperUserId")), { ...r, extra: e.rest() };
|
|
1301
|
-
}, write: (e, t) => {
|
|
1302
|
-
e.int(t.result), t.heldItem !== null && e.string(t.heldItem), t.actorId !== null && e.string(t.actorId).int(t.userId ?? 0), t.x !== null && t.y !== null && e.number(t.x).number(t.y), t.innerRadius !== null && e.int(t.innerRadius).int(t.outerRadius ?? 0).int(t.dropperUserId ?? 0), e.raw(t.extra);
|
|
1303
|
-
} }), a({ name: "quest.give-item", description: "The server hands the player an adventure item to pick up.", direction: "toClient", command: "qgi", read: (e) => ({ actorId: e.string("actorId") }), write: (e, { actorId: t }) => e.string(t) });
|
|
1304
|
-
function ke(e, t, n, r) {
|
|
1305
|
-
return a({ name: e, description: n, direction: "toClient", command: t, read: (i) => {
|
|
1306
|
-
const s = i.int("userId"), o = i.int("healthPercent"), d = i.int("change"), m = i.int("health"), c = i.int("maxHealth"), l = r && i.remaining >= 2, g = l ? i.int("x") : null, h = l ? i.int("y") : null;
|
|
1307
|
-
return { userId: s, healthPercent: o, change: d, health: m, maxHealth: c, x: g, y: h, extra: i.rest() };
|
|
1308
|
-
}, write: (i, { userId: s, healthPercent: o, change: d, health: m, maxHealth: c, x: l, y: g, extra: h }) => {
|
|
1309
|
-
i.int(s).int(o).int(d).int(m).int(c), l !== null && g !== null && i.int(l).int(g), i.raw(h);
|
|
1310
|
-
} });
|
|
1311
|
-
}
|
|
1312
|
-
ke("quest.health", "quhp", "A player’s health in the adventure changed.", !1), ke("quest.respawned", "qrspn", "A player came back to life in the adventure.", !0), a({ name: "quest.player-dead", description: "A player in the adventure was defeated.", direction: "toClient", command: "qpd", read: (e) => ({ userId: e.int("userId") }), write: (e, { userId: t }) => e.int(t) }), a({ name: "quest.crystals", description: "The crystals the player gathered in the adventure changed.", direction: "toClient", command: "qporbs", read: (e) => ({ crystals: e.int("crystals") }), write: (e, { crystals: t }) => e.int(t) }), a({ name: "quest.exited", description: "The server answers the player leaving the adventure.", direction: "toClient", command: "qx", read: (e) => ({ extra: e.rest() }), write: (e, { extra: t }) => e.raw(t) }), a({ name: "quest.seed-given", description: "The player’s seed count changed.", direction: "toClient", command: "qseed", read: (e) => ({ defId: e.int("defId"), count: e.int("count"), max: e.int("max") }), write: (e, { defId: t, count: n, max: r }) => e.int(t).int(n).int(r) }), a({ name: "quest.seed-planted", description: "A seed was planted in the adventure, or refused.", direction: "toClient", command: "qps", read: (e) => {
|
|
1313
|
-
const t = { planted: e.flag("planted"), userName: e.string("userName"), plant: null };
|
|
1314
|
-
return t.planted ? { ...t, plant: { actorName: e.string("actorName"), defId: e.int("defId"), x: e.int("x"), y: e.int("y"), launcherUserId: e.int("launcherUserId") } } : t;
|
|
1315
|
-
}, write: (e, { planted: t, userName: n, plant: r }) => {
|
|
1316
|
-
e.flag(t).string(n), t && r && e.string(r.actorName).int(r.defId).int(r.x).int(r.y).int(r.launcherUserId);
|
|
1317
|
-
} }), a({ name: "quest.plant-ate", description: "A planted seed’s plant ate a phantom.", direction: "toClient", command: "qpa", read: (e) => ({ plantActorId: e.string("plantActorId"), phantomActorId: e.string("phantomActorId") }), write: (e, { plantActorId: t, phantomActorId: n }) => e.string(t).string(n) }), a({ name: "quest.plant-eat-recoil", description: "A planted seed’s plant recoils after eating.", direction: "toClient", command: "qepr", read: (e) => ({ actorId: e.string("actorId") }), write: (e, { actorId: t }) => e.string(t) }), a({ name: "quest.volume-progress", description: "An interactive volume’s progress changed.", direction: "toClient", command: "qviu", read: (e) => ({ actorId: e.string("actorId"), progress: e.int("progress") }), write: (e, { actorId: t, progress: n }) => e.string(t).int(n) }), a({ name: "quest.stats-update", description: "The player’s own attack and defence range in the adventure changed.", direction: "toClient", command: "qusu", read: (e) => ({ attackBase: e.int("attackBase"), attackMax: e.int("attackMax"), defenseBase: e.int("defenseBase"), defenseMax: e.int("defenseMax") }), write: (e, { attackBase: t, attackMax: n, defenseBase: r, defenseMax: i }) => e.int(t).int(n).int(r).int(i) }), a({ name: "quest.avatar-switch", description: "A player is drawn disguised as a phantom or NPC, or their disguise is taken off.", direction: "toClient", command: "qavsw", read: (e) => {
|
|
1318
|
-
const t = e.int("avatarRefId");
|
|
1319
|
-
return { avatarRefId: t === -1 ? null : t, userId: e.int("userId") };
|
|
1320
|
-
}, write: (e, { avatarRefId: t, userId: n }) => e.int(t ?? -1).int(n) }), a({ name: "quest.actor-attack", description: "The client says an adventure actor, or the player, was hit.", direction: "toServer", command: "qaa", read: (e) => ({ actorId: e.string("actorId"), playerHit: e.flag("playerHit"), weaponDefId: e.int("weaponDefId"), x: e.int("x"), y: e.int("y") }), write: (e, { actorId: t, playerHit: n, weaponDefId: r, x: i, y: s }) => e.string(t).flag(n).int(r).int(i).int(s) }), a({ name: "quest.attack-player", description: "The client says an adventure phantom it moves attacks a player.", direction: "toServer", command: "qap", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId"), weaponDefId: e.int("weaponDefId"), color: e.int("color") }), write: (e, { actorId: t, userId: n, weaponDefId: r, color: i }) => e.string(t).int(n).int(r).int(i) }), a({ name: "quest.player-attacked", description: "An adventure actor attacks a player.", direction: "toClient", command: "qap", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId"), weaponDefId: e.int("weaponDefId"), color: e.int("color") }), write: (e, { actorId: t, userId: n, weaponDefId: r, color: i }) => e.string(t).int(n).int(r).int(i) }), a({ name: "quest.beam-zap", description: "The client says an adventure beam caught the player.", direction: "toServer", command: "qbzap", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId") }), write: (e, { actorId: t, userId: n }) => e.string(t).int(n) }), a({ name: "quest.beam-zapped", description: "An adventure beam zaps.", direction: "toClient", command: "qbzap", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId") }), write: (e, { actorId: t, userId: n }) => e.string(t).int(n) }), a({ name: "quest.phantom-zap", description: "The client says a phantom’s touch caught the player.", direction: "toServer", command: "qpzap", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId"), x: e.int("x"), y: e.int("y") }), write: (e, { actorId: t, userId: n, x: r, y: i }) => e.string(t).int(n).int(r).int(i) }), a({ name: "quest.phantom-zapped", description: "An adventure phantom zaps a player.", direction: "toClient", command: "qpzap", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId") }), write: (e, { actorId: t, userId: n }) => e.string(t).int(n) }), a({ name: "quest.phantom-attack-destructible", description: "The client says a phantom’s attack caught a destructible actor.", direction: "toServer", command: "qpad", read: (e) => ({ phantomActorId: e.string("phantomActorId"), destructibleActorId: e.string("destructibleActorId") }), write: (e, { phantomActorId: t, destructibleActorId: n }) => e.string(t).string(n) }), a({ name: "quest.player-heal", description: "The client says the player’s healing weapon landed on a player.", direction: "toServer", command: "qph", read: (e) => ({ weaponDefId: e.int("weaponDefId"), userId: e.int("userId") }), write: (e, { weaponDefId: t, userId: n }) => e.int(t).int(n) });
|
|
1321
|
-
function B(e, t, n, r) {
|
|
1322
|
-
return a({ name: e, description: r, direction: n, command: t, read: (i) => ({ weaponDefId: i.int("weaponDefId"), x: i.int("x"), y: i.int("y"), actorId: i.string("actorId"), userId: i.int("userId"), color: i.int("color") }), write: (i, { weaponDefId: s, x: o, y: d, actorId: m, userId: c, color: l }) => i.int(s).int(o).int(d).string(m).int(c).int(l) });
|
|
1323
|
-
}
|
|
1324
|
-
B("quest.projectile-launch", "qp", "toServer", "The client says the player threw a weapon in an adventure."), B("quest.projectile-launched", "qp", "toClient", "A player or actor threw a weapon in the adventure."), B("quest.swipe", "qm", "toServer", "The client says the player swung a weapon in an adventure."), B("quest.swiped", "qm", "toClient", "A player or actor swung a weapon in the adventure."), a({ name: "quest.respawn-request", description: "The player asks to come back to life in the adventure.", direction: "toServer", command: "qprr", read: (e) => ({ reserved: e.int("reserved"), x: e.int("x"), y: e.int("y") }), write: (e, { reserved: t, x: n, y: r }) => e.int(t).int(n).int(r) }), a({ name: "quest.respawn-granted", description: "The server lets the player come back to life in the adventure.", direction: "toClient", command: "qprr", read: (e) => ({ extra: e.rest() }), write: (e, { extra: t }) => e.raw(t) }), a({ name: "quest.answer", description: "The player answers a question the adventure asked.", direction: "toServer", command: "qaskr", read: (e) => ({ actorName: e.string("actorName"), actorState: e.int("actorState"), yes: e.flag("yes") }), write: (e, { actorName: t, actorState: n, yes: r }) => e.string(t).int(n).flag(r) }), a({ name: "quest.minigame-done", description: "A minigame an adventure launched is over.", direction: "toServer", command: "qmgc", read: (e) => ({ actorName: e.string("actorName"), actorState: e.int("actorState"), result: e.int("result") }), write: (e, { actorName: t, actorState: n, result: r }) => e.string(t).int(n).int(r) }), a({ name: "quest.full-room-minigame-done", description: "A minigame an adventure room played together is over.", direction: "toServer", command: "qfrmgdone", read: (e) => ({ roomName: e.string("roomName"), result: e.int("result") }), write: (e, { roomName: t, result: n }) => e.string(t).int(n) }), a({ name: "quest.clone", description: "The player asks for the adventure again.", direction: "toServer", command: "qcq", read: () => ({}), write: () => {
|
|
1325
|
-
} }), a({ name: "quest.moved-items-request", description: "The client asks where players moved the adventure’s items.", direction: "toServer", command: "qmi", read: () => ({}), write: () => {
|
|
1326
|
-
} }), a({ name: "quest.drop-item", description: "The player drops the adventure item they carry.", direction: "toServer", command: "qdroppup", read: (e) => ({ x: e.int("x"), y: e.int("y"), actorId: e.string("actorId"), userId: e.int("userId") }), write: (e, { x: t, y: n, actorId: r, userId: i }) => e.int(t).int(n).string(r).int(i) }), a({ name: "quest.plant-seed", description: "The player plants a seed in the adventure.", direction: "toServer", command: "qps", read: (e) => ({ defId: e.int("defId"), x: e.int("x"), y: e.int("y") }), write: (e, { defId: t, x: n, y: r }) => e.int(t).int(n).int(r) }), a({ name: "quest.eat-phantom", description: "The client says a plant bit a phantom.", direction: "toServer", command: "qep", read: (e) => ({ plantActorId: e.string("plantActorId"), phantomActorId: e.string("phantomActorId"), x: e.int("x"), y: e.int("y") }), write: (e, { plantActorId: t, phantomActorId: n, x: r, y: i }) => e.string(t).string(n).int(r).int(i) }), a({ name: "quest.plant-ate-report", description: "The client says a plant started eating.", direction: "toServer", command: "qpa", read: (e) => ({ plantActorId: e.string("plantActorId"), phantomActorId: e.string("phantomActorId") }), write: (e, { plantActorId: t, phantomActorId: n }) => e.string(t).string(n) }), a({ name: "quest.side-scroll-report", description: "The client says where the player is in a side scrolling adventure.", direction: "toServer", command: "qssau", read: (e) => ({ x: e.int("x"), y: e.int("y"), flags: e.int("flags") }), write: (e, { x: t, y: n, flags: r }) => e.int(t).int(n).int(r) }), a({ name: "quest.side-scroll-moved", description: "A player moved in a side scrolling adventure.", direction: "toClient", command: "qssau", read: (e) => ({ userId: e.int("userId"), x: e.number("x"), y: e.number("y"), extra: e.rest() }), write: (e, { userId: t, x: n, y: r, extra: i }) => e.int(t).number(n).number(r).raw(i) }), a({ name: "quest.player-room-change", description: "A player went to another room of the adventure.", direction: "toClient", command: "qrc", read: (e) => ({ userId: e.int("userId"), roomName: e.string("roomName"), x: e.int("x"), y: e.int("y") }), write: (e, { userId: t, roomName: n, x: r, y: i }) => e.int(t).string(n).int(r).int(i) }), a({ name: "quest.torch", description: "A torch in the adventure is lit or put out.", direction: "toClient", command: "qtorch", read: (e) => {
|
|
1327
|
-
const t = e.int("target"), n = e.int("lit") === 1, r = t === 0;
|
|
1328
|
-
return { target: t, lit: n, actorId: r ? e.string("actorId") : null, userId: r ? null : e.int("userId") };
|
|
1329
|
-
}, write: (e, { target: t, lit: n, actorId: r, userId: i }) => {
|
|
1330
|
-
e.int(t).int(n ? 1 : 0), r !== null ? e.string(r) : e.int(i ?? 0);
|
|
1331
|
-
} }), a({ name: "quest.play-swf", description: "The adventure plays a film over the screen.", direction: "toClient", command: "qplayswf", read: (e) => ({ mediaId: e.int("mediaId") }), write: (e, { mediaId: t }) => e.int(t) }), a({ name: "quest.play-swf-done", description: "The client says the adventure’s film finished.", direction: "toServer", command: "qplayswf", read: () => ({}), write: () => {
|
|
1332
|
-
} }), a({ name: "quest.preload-swf", description: "The adventure loads a film ahead of playing it.", direction: "toClient", command: "qpreloadswf", read: (e) => ({ mediaId: e.int("mediaId") }), write: (e, { mediaId: t }) => e.int(t) }), a({ name: "quest.fade", description: "The adventure fades the screen out, or back in.", direction: "toClient", command: "qfade", read: (e) => ({ fadeIn: e.string("fadeIn") === "1" }), write: (e, { fadeIn: t }) => e.flag(t) }), a({ name: "quest.shake", description: "The adventure shakes the room.", direction: "toClient", command: "qshake", read: (e) => ({ milliseconds: e.number("milliseconds") }), write: (e, { milliseconds: t }) => e.number(t) }), a({ name: "quest.sound", description: "The adventure plays a sound.", direction: "toClient", command: "qsnd", read: (e) => ({ name: e.string("name") }), write: (e, { name: t }) => e.string(t) }), a({ name: "quest.voice-over", description: "The adventure plays a voice over with its subtitle.", direction: "toClient", command: "qsndVO", read: (e) => ({ name: e.string("name"), subtitle: e.string("subtitle") }), write: (e, { name: t, subtitle: n }) => e.string(t).string(n) }), a({ name: "quest.music", description: "The adventure changes its music.", direction: "toClient", command: "qmusic", read: (e) => ({ name: e.string("name") }), write: (e, { name: t }) => e.string(t) }), a({ name: "quest.media-library", description: "The adventure loads a pack of its sounds.", direction: "toClient", command: "qmlib", read: (e) => ({ mediaId: e.int("mediaId") }), write: (e, { mediaId: t }) => e.int(t) }), a({ name: "quest.sound-pack", description: "The adventure loads a pack of its sounds.", direction: "toClient", command: "qsndpk", read: (e) => ({ mediaId: e.int("mediaId") }), write: (e, { mediaId: t }) => e.int(t) }), a({ name: "quest.post-uri", description: "The adventure records a page view for analytics.", direction: "toClient", command: "qposturi", read: (e) => ({ uri: e.string("uri") }), write: (e, { uri: t }) => e.string(t) }), a({ name: "room.join-request", description: "The player asks to join a room.", direction: "toServer", command: "rj", read: (e) => ({ target: e.string("target"), confirmLanguageChange: e.flag("confirmLanguageChange"), invisible: e.flag("invisible"), joinType: e.string("joinType") }), write: (e, { target: t, confirmLanguageChange: n, invisible: r, joinType: i }) => e.string(t).flag(n).flag(r).string(i) });
|
|
1333
|
-
const zt = 8;
|
|
1334
|
-
a({ name: "room.join-result", description: "The server says whether the player joined, and describes the room.", direction: "toClient", command: "rj", read: (e) => {
|
|
1335
|
-
const t = e.flag("joined");
|
|
1336
|
-
if (!t) {
|
|
1337
|
-
const i = e.remaining > 0 ? e.string("error") : null;
|
|
1338
|
-
return { joined: t, joinedRoom: null, details: null, error: i, extra: e.rest() };
|
|
1339
|
-
}
|
|
1340
|
-
const n = { name: e.string("name"), id: e.int("id"), users: e.int("users"), maxUsers: e.int("maxUsers"), spectators: e.int("spectators"), maxSpectators: e.int("maxSpectators"), isPrivate: e.flag("isPrivate"), isGame: e.flag("isGame"), isLimbo: e.flag("isLimbo") }, r = e.remaining >= zt ? Vt(e) : null;
|
|
1341
|
-
return { joined: t, joinedRoom: n, details: r, error: null, extra: e.rest() };
|
|
1342
|
-
}, write: (e, { joined: t, joinedRoom: n, details: r, error: i, extra: s }) => {
|
|
1343
|
-
e.flag(t), t && n ? (e.string(n.name).int(n.id).int(n.users).int(n.maxUsers).int(n.spectators).int(n.maxSpectators).flag(n.isPrivate).flag(n.isGame).flag(n.isLimbo), r && (e.flag(r.isTemp).flag(r.isSubRoom).string(r.displayName).int(r.displayNameId).int(r.perUserAvId).int(r.activePetInvId).int(r.language).int(r.customMusicDef), r.shardId !== null && e.int(r.shardId))) : !t && i !== null && e.string(i), e.raw(s);
|
|
1344
|
-
} });
|
|
1345
|
-
function Vt(e) {
|
|
1346
|
-
return { isTemp: e.flag("isTemp"), isSubRoom: e.flag("isSubRoom"), displayName: e.string("displayName"), displayNameId: e.int("displayNameId"), perUserAvId: e.int("perUserAvId"), activePetInvId: e.int("activePetInvId"), language: e.int("language"), customMusicDef: e.int("customMusicDef"), shardId: e.remaining > 0 ? e.int("shardId") : null };
|
|
1347
|
-
}
|
|
1348
|
-
a({ name: "room.properties", description: "The server says which room to load, and how.", direction: "toClient", command: "rp", read: (e) => ({ pathName: e.string("pathName"), environmentType: e.int("environmentType"), roomType: e.int("roomType"), secondaryDefId: e.int("secondaryDefId"), zoom: e.int("zoom"), roomDefId: e.int("roomDefId"), customData: e.remaining > 0 ? e.string("customData") : null }), write: (e, t) => {
|
|
1349
|
-
e.string(t.pathName).int(t.environmentType).int(t.roomType).int(t.secondaryDefId).int(t.zoom).int(t.roomDefId), t.customData !== null && e.string(t.customData);
|
|
1350
|
-
} }), a({ name: "room.leave-request", description: "The player leaves an in room game’s room.", direction: "toServer", command: "rl", read: (e) => ({ roomId: e.int("roomId") }), write: (e, { roomId: t }) => e.int(t) }), a({ name: "room.list", description: "The server lists the rooms the client knows.", direction: "toClient", command: "rl", read: (e) => ({ rooms: e.repeat(e.int("count"), () => ({ id: e.int("id"), name: e.string("name"), maxUsers: e.int("maxUsers"), isTemp: e.flag("isTemp"), isGame: e.flag("isGame"), users: e.int("users") })) }), write: (e, { rooms: t }) => e.int(t.length).each(t, (n) => e.int(n.id).string(n.name).int(n.maxUsers).flag(n.isTemp).flag(n.isGame).int(n.users)) }), a({ name: "room.ffm-request", description: "The player asks for their first five minutes room.", direction: "toServer", command: "rf", read: () => ({}), write: () => {
|
|
1351
|
-
} }), a({ name: "room.ffm-result", description: "The server says whether the first five minutes room is ready.", direction: "toClient", command: "rf", read: (e) => ({ ready: e.string("ready") === "1", extra: e.rest() }), write: (e, { ready: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), q({ name: "session.version-check", description: "The client says which SmartFox version it speaks.", direction: "toServer", type: "sys", command: "verChk", read: (e) => {
|
|
1352
|
-
var t, n;
|
|
1353
|
-
return { version: ((n = (t = e.body) == null ? void 0 : t.child("ver")) == null ? void 0 : n.attribute("v")) ?? "" };
|
|
1354
|
-
}, write: ({ version: e }) => [new f("ver", { attributes: [v.create("v", e)], selfClosing: !0, trailing: " " })] }), q({ name: "session.random-key-request", description: "The client asks for the key it signs its login with.", direction: "toServer", type: "sys", command: "rndK", read: () => ({}), write: () => [] }), q({ name: "session.random-key", description: "The server gives the key the login is signed with.", direction: "toClient", type: "sys", command: "rndK", read: (e) => {
|
|
1355
|
-
var t, n;
|
|
1356
|
-
return { key: ((n = (t = e.body) == null ? void 0 : t.child("k")) == null ? void 0 : n.textContent) ?? "" };
|
|
1357
|
-
}, write: ({ key: e }) => [new f("k", { children: [new w(e)] })] }), q({ name: "session.login", description: "The client signs in to a zone with its auth token.", direction: "toServer", type: "sys", command: "login", read: (e) => {
|
|
1358
|
-
var t, n, r;
|
|
1359
|
-
const i = (t = e.body) == null ? void 0 : t.child("login");
|
|
1360
|
-
return { zone: (i == null ? void 0 : i.attribute("z")) ?? "", nick: ((n = i == null ? void 0 : i.child("nick")) == null ? void 0 : n.textContent) ?? "", password: ((r = i == null ? void 0 : i.child("pword")) == null ? void 0 : r.textContent) ?? "" };
|
|
1361
|
-
}, write: ({ zone: e, nick: t, password: n }) => [new f("login", { attributes: [v.create("z", e)], children: [new f("nick", { children: [new w(t)] }), new f("pword", { children: [new w(n)] })] })] }), a({ name: "session.email-activation-request", description: "The player asks for the email that activates their email address to be sent.", direction: "toServer", command: "ves", read: (e) => ({ email: e.string("email") }), write: (e, { email: t }) => e.string(t) }), a({ name: "session.email-activation-result", description: "The server says whether the activation email was sent.", direction: "toClient", command: "ves", read: (e) => ({ sent: e.string("sent") === "1" }), write: (e, { sent: t }) => e.string(t ? "1" : "0") }), a({ name: "session.email-validated", description: "The account’s email address was validated.", direction: "toClient", command: "vea", read: () => ({}), write: () => {
|
|
1362
|
-
} });
|
|
1363
|
-
const y = { clothing: 1e3, denItems: 1030, denRooms: 1040, currencyExchange: 1051, diamondShop: 1054, combined: 1060 }, Kt = [y.clothing, y.denItems, y.denRooms, y.currencyExchange, y.diamondShop];
|
|
1364
|
-
a({ name: "shop.list-request", description: "The player asks for a shop’s contents.", direction: "toServer", command: "gl", read: (e) => ({ listId: e.int("listId") }), write: (e, { listId: t }) => e.int(t) }), a({ name: "shop.list", description: "The server sends a shop’s contents.", direction: "toClient", command: "gl", read: (e) => {
|
|
1365
|
-
const t = e.int("listId"), n = e.int("listType"), r = Kt.indexOf(n) !== -1;
|
|
1366
|
-
if (!r && n !== y.combined) return { kind: "other", listId: t, listType: n, body: e.rest() };
|
|
1367
|
-
const i = { listId: t, listType: n, titleStrId: e.string("titleStrId"), unused: e.string("unused"), diamondBundle: e.string("diamondBundle") !== "", diamondCost: W(e.string("diamondCost")) }, s = e.int("count");
|
|
1368
|
-
return r ? { ...i, kind: "items", defIds: e.repeat(s, () => e.int("defId")) } : { ...i, kind: "combined", groups: _t(e, s) };
|
|
1369
|
-
}, write: (e, t) => {
|
|
1370
|
-
if (e.int(t.listId).int(t.listType), t.kind === "other") {
|
|
1371
|
-
e.raw(t.body);
|
|
1372
|
-
return;
|
|
1373
|
-
}
|
|
1374
|
-
if (e.string(t.titleStrId).string(t.unused).string(t.diamondBundle ? "1" : "").int(t.diamondCost), t.kind === "items") {
|
|
1375
|
-
e.int(t.defIds.length).each(t.defIds, (n) => e.int(n));
|
|
1376
|
-
return;
|
|
1377
|
-
}
|
|
1378
|
-
e.int(t.groups.length), t.groups.length !== 0 && (e.string(t.groups.map((n) => n.listType).join(",")).string(t.groups.map((n) => n.defIds.length).join(",")), t.groups.forEach((n) => n.defIds.forEach((r) => e.int(r))));
|
|
1379
|
-
} });
|
|
1380
|
-
function _t(e, t) {
|
|
1381
|
-
if (t === 0) return [];
|
|
1382
|
-
const n = e.string("groupTypes").split(","), r = e.string("groupCounts").split(",");
|
|
1383
|
-
return n.map((i, s) => ({ listType: W(i), defIds: e.repeat(W(r[s] ?? ""), () => e.int("defId")) }));
|
|
1384
|
-
}
|
|
1385
|
-
function W(e) {
|
|
1386
|
-
const t = Number(e);
|
|
1387
|
-
return Number.isInteger(t) ? t : 0;
|
|
1388
|
-
}
|
|
1389
|
-
a({ name: "shop.den-shop-update-request", description: "The player adds, reprices or removes items in their own den shop.", direction: "toServer", command: "dsu", read: (e) => ({ storeInvId: e.int("storeInvId"), state: e.string("state"), upserts: e.repeat(e.int("upsertCount"), () => ({ itemKind: e.int("itemKind"), invIdx: e.int("invIdx"), currencyType: e.int("currencyType"), cost: e.int("cost") })), removals: e.repeat(e.int("removeCount"), () => ({ itemKind: e.int("itemKind"), invIdx: e.int("invIdx") })) }), write: (e, { storeInvId: t, state: n, upserts: r, removals: i }) => {
|
|
1390
|
-
e.int(t).string(n), e.int(r.length).each(r, (s) => e.int(s.itemKind).int(s.invIdx).int(s.currencyType).int(s.cost)), e.int(i.length).each(i, (s) => e.int(s.itemKind).int(s.invIdx));
|
|
1391
|
-
} }), a({ name: "shop.den-shop-update-result", description: "The server answers a change to the player’s own den shop.", direction: "toClient", command: "dsu", read: (e) => {
|
|
1392
|
-
const t = e.string("ok") === "1";
|
|
1393
|
-
return { ok: t, state: t ? e.string("state") : "" };
|
|
1394
|
-
}, write: (e, { ok: t, state: n }) => {
|
|
1395
|
-
e.string(t ? "1" : "0"), t && e.string(n);
|
|
1396
|
-
} }), a({ name: "shop.den-shop-info-request", description: "The player asks to see a den shop’s listings.", direction: "toServer", command: "dsi", read: (e) => ({ userName: e.string("userName"), storeInvId: e.int("storeInvId") }), write: (e, { userName: t, storeInvId: n }) => e.string(t).int(n) }), a({ name: "shop.den-shop-info", description: "The server sends a den shop’s listings.", direction: "toClient", command: "dsi", read: (e) => {
|
|
1397
|
-
const t = e.string("ok") === "1", n = e.int("itemCount");
|
|
1398
|
-
if (!t || n < 0) return { ok: t, itemCount: -1, state: "", items: [] };
|
|
1399
|
-
const r = e.string("state");
|
|
1400
|
-
return { ok: t, itemCount: n, state: r, items: e.rest() };
|
|
1401
|
-
}, write: (e, t) => {
|
|
1402
|
-
e.string(t.ok ? "1" : "0").int(t.itemCount), t.ok && t.itemCount >= 0 && e.string(t.state).raw(t.items);
|
|
1403
|
-
} }), a({ name: "shop.den-shop-buy-request", description: "The player buys an item from a den shop.", direction: "toServer", command: "dsb", read: (e) => ({ userName: e.string("userName"), shopInvIdx: e.int("shopInvIdx"), state: e.string("state"), itemKind: e.int("itemKind"), invIdx: e.int("invIdx"), currencyType: e.int("currencyType"), cost: e.int("cost") }), write: (e, { userName: t, shopInvIdx: n, state: r, itemKind: i, invIdx: s, currencyType: o, cost: d }) => e.string(t).int(n).string(r).int(i).int(s).int(o).int(d) }), a({ name: "shop.den-shop-buy-result", description: "The server answers a den shop purchase.", direction: "toClient", command: "dsb", read: (e) => {
|
|
1404
|
-
const t = e.int("status");
|
|
1405
|
-
if (t !== 1) return { status: t, ownerUserName: "", storeInvId: -1, rest: [] };
|
|
1406
|
-
const n = e.string("ownerUserName"), r = e.int("storeInvId");
|
|
1407
|
-
return { status: t, ownerUserName: n, storeInvId: r, rest: e.rest() };
|
|
1408
|
-
}, write: (e, t) => {
|
|
1409
|
-
e.int(t.status), t.status === 1 && e.string(t.ownerUserName).int(t.storeInvId).raw(t.rest);
|
|
1410
|
-
} }), a({ name: "trade.list-request", description: "The player asks for someone’s trade list.", direction: "toServer", command: "tl", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "trade.list", description: "The server sends someone’s trade list.", direction: "toClient", command: "tl", read: (e) => ({ userName: e.string("userName"), clothing: e.repeat(e.int("clothing"), () => ({ defId: e.int("defId"), invIdx: e.int("invIdx"), color: e.int("color") })), den: e.repeat(e.int("den"), () => {
|
|
1411
|
-
const t = e.int("defId"), n = e.int("invIdx");
|
|
1412
|
-
return { defId: t, invIdx: n, ...X(e) };
|
|
1413
|
-
}), pets: e.repeat(e.int("pets"), () => {
|
|
1414
|
-
const t = e.int("defId"), n = e.int("invIdx"), r = e.number("createdAt"), i = H(e), s = e.string("name");
|
|
1415
|
-
return { defId: t, invIdx: n, createdAt: r, bits: i, name: s, ...Q(e) };
|
|
1416
|
-
}) }), write: (e, { userName: t, clothing: n, den: r, pets: i }) => {
|
|
1417
|
-
e.string(t).int(n.length), n.forEach((s) => e.int(s.defId).int(s.invIdx ?? -1).int(s.color)), e.int(r.length), r.forEach((s) => {
|
|
1418
|
-
e.int(s.defId).int(s.invIdx ?? -1), J(e, s);
|
|
1419
|
-
}), e.int(i.length), i.forEach((s) => {
|
|
1420
|
-
e.int(s.defId).int(s.invIdx).number(s.createdAt), Y(e, s), e.string(s.name), Z(e, s);
|
|
1421
|
-
});
|
|
1422
|
-
} }), a({ name: "trade.list-change", description: "The player changes their trade list.", direction: "toServer", command: "ts", read: (e) => ({ removed: e.repeat(e.int("removed"), () => O(e)), added: e.repeat(e.int("added"), () => O(e)) }), write: (e, { removed: t, added: n }) => {
|
|
1423
|
-
e.int(t.length), t.forEach((r) => e.int(r.itemType).int(r.invIdx)), e.int(n.length), n.forEach((r) => e.int(r.itemType).int(r.invIdx));
|
|
1424
|
-
} }), a({ name: "trade.busy", description: "The player starts or stops being busy with a trade.", direction: "toServer", command: "tb", read: (e) => ({ busy: e.flag("busy") }), write: (e, { busy: t }) => e.flag(t) }), a({ name: "trade.action", description: "The player asks for a trade, answers one, withdraws or confirms.", direction: "toServer", command: "ti", read: (e) => {
|
|
1425
|
-
const t = e.int("action");
|
|
1426
|
-
switch (t) {
|
|
1427
|
-
case 0: {
|
|
1428
|
-
const n = e.string("userName"), r = e.int("itemType"), i = e.int("invIdx"), s = e.int("clothing"), o = e.int("den"), d = e.int("audio"), m = e.int("pets");
|
|
1429
|
-
return { action: "request", userName: n, itemType: r, invIdx: i, clothing: e.repeat(s, () => e.int("invIdx")), den: e.repeat(o + d, () => e.int("invIdx")), audio: d, pets: e.repeat(m, () => e.int("invIdx")) };
|
|
1430
|
-
}
|
|
1431
|
-
case 1:
|
|
1432
|
-
return { action: "respond", response: e.int("response") };
|
|
1433
|
-
case 2:
|
|
1434
|
-
return { action: "cancel" };
|
|
1435
|
-
case 3:
|
|
1436
|
-
return { action: "confirm", confirm: e.flag("confirm") };
|
|
1437
|
-
default:
|
|
1438
|
-
throw new u(`trade.action: unknown action ${t}`, "PACKET_FIELD");
|
|
1439
|
-
}
|
|
1440
|
-
}, write: (e, t) => {
|
|
1441
|
-
switch (t.action) {
|
|
1442
|
-
case "request":
|
|
1443
|
-
e.int(0).string(t.userName).int(t.itemType).int(t.invIdx).int(t.clothing.length).int(t.den.length - t.audio).int(t.audio).int(t.pets.length), [...t.clothing, ...t.den, ...t.pets].forEach((n) => e.int(n));
|
|
1444
|
-
return;
|
|
1445
|
-
case "respond":
|
|
1446
|
-
e.int(1).int(t.response);
|
|
1447
|
-
return;
|
|
1448
|
-
case "cancel":
|
|
1449
|
-
e.int(2);
|
|
1450
|
-
return;
|
|
1451
|
-
case "confirm":
|
|
1452
|
-
e.int(3).int(t.confirm ? 1 : 0);
|
|
1453
|
-
return;
|
|
1454
|
-
}
|
|
1455
|
-
} }), a({ name: "trade.result", description: "Someone offers a trade, or a trade is accepted, done or ends.", direction: "toClient", command: "ti", read: (e) => {
|
|
1456
|
-
const t = e.int("status");
|
|
1457
|
-
switch (t) {
|
|
1458
|
-
case 0:
|
|
1459
|
-
return { kind: "offer", status: 0, offer: Wt(e) };
|
|
1460
|
-
case 1: {
|
|
1461
|
-
if (e.int("stage") === 0) return { kind: "confirm", status: 1 };
|
|
1462
|
-
const n = e.repeat(e.int("received"), () => Xt(e)), r = e.repeat(e.int("removed"), () => O(e));
|
|
1463
|
-
return { kind: "completed", status: 1, received: n, removed: r, extra: e.rest() };
|
|
1464
|
-
}
|
|
1465
|
-
case 6:
|
|
1466
|
-
return { kind: "closed", status: 6, extra: e.rest() };
|
|
1467
|
-
case 7:
|
|
1468
|
-
return { kind: "different-server", status: 7, roomName: e.string("roomName"), extra: e.rest() };
|
|
1469
|
-
default:
|
|
1470
|
-
return { kind: "failed", status: t, userName: e.string("userName"), userNameModerationFlag: e.int("userNameModerationFlag"), extra: e.rest() };
|
|
1471
|
-
}
|
|
1472
|
-
}, write: (e, t) => {
|
|
1473
|
-
switch (e.int(t.status), t.kind) {
|
|
1474
|
-
case "offer":
|
|
1475
|
-
Gt(e, t.offer);
|
|
1476
|
-
return;
|
|
1477
|
-
case "confirm":
|
|
1478
|
-
e.int(0);
|
|
1479
|
-
return;
|
|
1480
|
-
case "completed":
|
|
1481
|
-
e.int(1).int(t.received.length), t.received.forEach((n) => Jt(e, n)), e.int(t.removed.length), t.removed.forEach((n) => e.int(n.itemType).int(n.invIdx)), e.raw(t.extra);
|
|
1482
|
-
return;
|
|
1483
|
-
case "closed":
|
|
1484
|
-
e.raw(t.extra);
|
|
1485
|
-
return;
|
|
1486
|
-
case "different-server":
|
|
1487
|
-
e.string(t.roomName).raw(t.extra);
|
|
1488
|
-
return;
|
|
1489
|
-
case "failed":
|
|
1490
|
-
e.string(t.userName).int(t.userNameModerationFlag).raw(t.extra);
|
|
1491
|
-
return;
|
|
1492
|
-
}
|
|
1493
|
-
} });
|
|
1494
|
-
function Wt(e) {
|
|
1495
|
-
const t = e.string("userName"), n = e.int("userNameModerationFlag"), r = e.int("wantedKind"), i = e.int("wantedInvIdx"), s = e.int("clothing"), o = e.int("den"), d = e.int("pets");
|
|
1496
|
-
return { userName: t, userNameModerationFlag: n, wantedKind: r, wantedInvIdx: i, offered: { clothing: e.repeat(s, () => ({ defId: e.int("defId"), color: e.int("color"), invIdx: null })), den: e.repeat(o, () => ({ defId: e.int("defId"), invIdx: null, ...X(e) })), pets: e.repeat(d, () => {
|
|
1497
|
-
const m = e.number("createdAt"), c = e.int("defId"), l = e.int("invIdx"), g = H(e), h = Q(e);
|
|
1498
|
-
return { defId: c, invIdx: l, createdAt: m, bits: g, name: e.string("name"), ...h };
|
|
1499
|
-
}) } };
|
|
1500
|
-
}
|
|
1501
|
-
function Gt(e, t) {
|
|
1502
|
-
const { clothing: n, den: r, pets: i } = t.offered;
|
|
1503
|
-
e.string(t.userName).int(t.userNameModerationFlag).int(t.wantedKind).int(t.wantedInvIdx).int(n.length).int(r.length).int(i.length), n.forEach((s) => e.int(s.defId).int(s.color)), r.forEach((s) => {
|
|
1504
|
-
e.int(s.defId), J(e, s);
|
|
1505
|
-
}), i.forEach((s) => {
|
|
1506
|
-
e.number(s.createdAt).int(s.defId).int(s.invIdx), Y(e, s), Z(e, s), e.string(s.name);
|
|
1507
|
-
});
|
|
1508
|
-
}
|
|
1509
|
-
function Xt(e) {
|
|
1510
|
-
const t = e.int("type");
|
|
1511
|
-
switch (t) {
|
|
1512
|
-
case 0:
|
|
1513
|
-
return { type: "clothing", defId: e.int("defId"), invIdx: e.int("invIdx"), color: e.int("color") };
|
|
1514
|
-
case 1: {
|
|
1515
|
-
const n = e.int("invIdx");
|
|
1516
|
-
return { type: "den", defId: e.int("defId"), invIdx: n, ...X(e) };
|
|
1517
|
-
}
|
|
1518
|
-
case 2: {
|
|
1519
|
-
const n = e.number("createdAt"), r = e.int("invIdx"), i = e.int("defId"), s = H(e), o = Q(e);
|
|
1520
|
-
return { type: "pet", defId: i, invIdx: r, createdAt: n, bits: s, name: e.string("name"), ...o };
|
|
1521
|
-
}
|
|
1522
|
-
default:
|
|
1523
|
-
throw new u(`trade.result: unknown received item type ${t}`, "PACKET_FIELD");
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
function Jt(e, t) {
|
|
1527
|
-
switch (t.type) {
|
|
1528
|
-
case "clothing":
|
|
1529
|
-
e.int(0).int(t.defId).int(t.invIdx ?? -1).int(t.color);
|
|
1530
|
-
return;
|
|
1531
|
-
case "den":
|
|
1532
|
-
e.int(1).int(t.invIdx ?? -1).int(t.defId), J(e, t);
|
|
1533
|
-
return;
|
|
1534
|
-
case "pet":
|
|
1535
|
-
e.int(2).number(t.createdAt).int(t.invIdx).int(t.defId), Y(e, t), Z(e, t), e.string(t.name);
|
|
1536
|
-
return;
|
|
1537
|
-
}
|
|
1538
|
-
}
|
|
1539
|
-
function O(e) {
|
|
1540
|
-
return { itemType: e.int("itemType"), invIdx: e.int("invIdx") };
|
|
1541
|
-
}
|
|
1542
|
-
function X(e) {
|
|
1543
|
-
return { version: e.int("version"), approved: e.string("approved") === "true", uniqueImageId: e.string("uniqueImageId"), creatorDbId: e.int("creatorDbId"), creatorUuid: e.string("creatorUuid") };
|
|
1544
|
-
}
|
|
1545
|
-
function J(e, t) {
|
|
1546
|
-
e.int(t.version).string(t.approved ? "true" : "false").string(t.uniqueImageId).int(t.creatorDbId).string(t.creatorUuid);
|
|
1547
|
-
}
|
|
1548
|
-
function H(e) {
|
|
1549
|
-
return [e.int("bits1"), e.int("bits2"), e.int("bits3")];
|
|
1550
|
-
}
|
|
1551
|
-
function Y(e, t) {
|
|
1552
|
-
e.int(t.bits[0]).int(t.bits[1]).int(t.bits[2]);
|
|
1553
|
-
}
|
|
1554
|
-
function Q(e) {
|
|
1555
|
-
return { traitDefId: e.int("traitDefId"), toyDefId: e.int("toyDefId"), foodDefId: e.int("foodDefId") };
|
|
1556
|
-
}
|
|
1557
|
-
function Z(e, t) {
|
|
1558
|
-
e.int(t.traitDefId).int(t.toyDefId).int(t.foodDefId);
|
|
1559
|
-
}
|
|
1560
|
-
a({ name: "world.room-count-request", description: "The player asks how many are in each room.", direction: "toServer", command: "rc", read: () => ({}), write: () => {
|
|
1561
|
-
} }), a({ name: "world.room-counts", description: "The server says how many are in each room.", direction: "toClient", command: "rc", read: (e) => ({ rooms: e.repeat(e.int("count"), () => ({ name: e.string("name"), users: e.int("users") })) }), write: (e, { rooms: t }) => e.int(t.length).each(t, ({ name: n, users: r }) => e.string(n).int(r)) }), a({ name: "world.shard-list-request", description: "The player asks for the list of shards.", direction: "toServer", command: "rm", read: () => ({}), write: () => {
|
|
1562
|
-
} });
|
|
1563
|
-
const z = 4;
|
|
1564
|
-
a({ name: "world.shard-list", description: "The server lists the shards on each server node.", direction: "toClient", command: "rm", read: (e) => {
|
|
1565
|
-
const t = e.rest(), n = t[0];
|
|
1566
|
-
return n !== void 0 && Fe(n) ? { status: new k(t, "world.shard-list").int("status"), nodes: [] } : { status: null, nodes: Ht(t) };
|
|
1567
|
-
}, write: (e, { status: t, nodes: n }) => {
|
|
1568
|
-
if (t !== null) {
|
|
1569
|
-
e.int(t);
|
|
1570
|
-
return;
|
|
1571
|
-
}
|
|
1572
|
-
e.each(n, ({ host: r, shards: i }) => e.string(r).each(i, (s) => e.int(s.id).int(s.language).int(s.population).int(s.buddies)));
|
|
1573
|
-
} });
|
|
1574
|
-
function Ht(e) {
|
|
1575
|
-
const t = [];
|
|
1576
|
-
let n = 0;
|
|
1577
|
-
for (; n < e.length; ) {
|
|
1578
|
-
const r = e[n++];
|
|
1579
|
-
let i = n;
|
|
1580
|
-
for (; i < e.length && Fe(e[i]); ) i++;
|
|
1581
|
-
const s = i - n;
|
|
1582
|
-
if (s % z !== 0) throw new u(`world.shard-list: node "${r}" has ${s} numbers, not shards of ${z}`, "PACKET_FIELD");
|
|
1583
|
-
const o = new k(e.slice(n, i), "world.shard-list"), d = o.repeat(s / z, () => ({ id: o.int("id"), language: o.int("language"), population: o.int("population"), buddies: o.int("buddies") }));
|
|
1584
|
-
t.push({ host: r, shards: d }), n = i;
|
|
1585
|
-
}
|
|
1586
|
-
return t;
|
|
1587
|
-
}
|
|
1588
|
-
function Fe(e) {
|
|
1589
|
-
return e.trim() !== "" && Number.isFinite(Number(e));
|
|
1590
|
-
}
|
|
1591
|
-
a({ name: "world.node-hop-request", description: "The player asks to move off a server that is shutting down.", direction: "toServer", command: "nd", read: () => ({}), write: () => {
|
|
1592
|
-
} }), a({ name: "world.node-hop", description: "The server names the server to move to.", direction: "toClient", command: "nd", read: (e) => ({ host: e.string("host") }), write: (e, { host: t }) => e.string(t) }), a({ name: "player-wall.token-request", description: "The client asks for the token a player wall’s service wants.", direction: "toServer", command: "wt", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "player-wall.token", description: "The server hands over a player wall’s token, or refuses it.", direction: "toClient", command: "wt", read: (e) => {
|
|
1593
|
-
const t = e.string("result");
|
|
1594
|
-
return t !== "1" ? { result: t, token: null, read: !1, write: !1, userName: null, extra: e.rest() } : { result: t, token: e.string("token"), read: e.string("read") === "1", write: e.string("write") === "1", userName: e.string("userName"), extra: e.rest() };
|
|
1595
|
-
}, write: (e, { result: t, token: n, read: r, write: i, userName: s, extra: o }) => {
|
|
1596
|
-
e.string(t), t === "1" && e.string(n ?? "").string(r ? "1" : "0").string(i ? "1" : "0").string(s ?? ""), e.raw(o);
|
|
1597
|
-
} }), a({ name: "player-wall.settings-set-request", description: "The player sets who may post on their wall.", direction: "toServer", command: "wss", read: (e) => ({ setting: e.int("setting") }), write: (e, { setting: t }) => e.int(t) }), a({ name: "player-wall.settings-set-result", description: "The server says whether it kept who may post on the player’s wall.", direction: "toClient", command: "wss", read: (e) => ({ ok: e.string("ok") === "1", extra: e.rest() }), write: (e, { ok: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), a({ name: "player-wall.settings-request", description: "The player asks who may post on someone’s wall.", direction: "toServer", command: "wsg", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "player-wall.settings", description: "The server says who may post on a wall.", direction: "toClient", command: "wsg", read: (e) => ({ setting: e.int("setting"), extra: e.rest() }), write: (e, { setting: t, extra: n }) => e.int(t).raw(n) }), a({ name: "player-wall.parameters-request", description: "The player changes how their wall looks.", direction: "toServer", command: "wps", read: (e) => ({ changes: e.string("changes") }), write: (e, { changes: t }) => e.string(t) }), a({ name: "player-wall.parameters-result", description: "The server says whether it kept how the player’s wall looks.", direction: "toClient", command: "wps", read: (e) => ({ ok: e.string("ok") === "1", extra: e.rest() }), write: (e, { ok: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), a({ name: "player-wall.visit-request", description: "The player counts a visit to someone’s wall.", direction: "toServer", command: "wci", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "player-wall.visit-result", description: "The server says whether a visit to a wall was counted.", direction: "toClient", command: "wci", read: (e) => ({ ok: e.string("ok") === "1", extra: e.rest() }), write: (e, { ok: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), a({ name: "resource-array.get-request", description: "The player asks how many have liked a masterpiece or a wall.", direction: "toServer", command: "crg", read: (e) => ({ resourceType: e.string("resourceType"), resourceId: e.string("resourceId"), userUuid: e.string("userUuid"), report: e.string("report") === "report" }), write: (e, { resourceType: t, resourceId: n, userUuid: r, report: i }) => e.string(t).string(n).string(r).string(i ? "report" : "") }), a({ name: "resource-array.get", description: "The server says how many have liked a masterpiece or a wall.", direction: "toClient", command: "crg", read: (e) => ({ ok: e.string("ok") === "1", liked: e.remaining > 0 ? e.string("liked") === "1" : !1, count: e.remaining > 0 ? e.int("count") : 0, extra: e.rest() }), write: (e, { ok: t, liked: n, count: r, extra: i }) => e.string(t ? "1" : "0").string(n ? "1" : "0").int(r).raw(i) }), a({ name: "resource-array.put-request", description: "The player likes a masterpiece or a wall.", direction: "toServer", command: "crp", read: (e) => {
|
|
1598
|
-
const t = e.string("resourceType"), n = e.string("resourceId"), r = e.string("userUuid"), i = e.remaining > 0 ? e.string("detail") : null, s = e.remaining > 0 ? Yt(e.string("creator")) : null;
|
|
1599
|
-
return { resourceType: t, resourceId: n, userUuid: r, detail: i, creator: s, extra: e.rest() };
|
|
1600
|
-
}, write: (e, { resourceType: t, resourceId: n, userUuid: r, detail: i, creator: s, extra: o }) => {
|
|
1601
|
-
e.string(t).string(n).string(r), (i !== null || s !== null) && e.string(i ?? ""), s !== null && e.string(`${s.version},${s.creatorUuid},${s.creatorDbId}`), e.raw(o);
|
|
1602
|
-
} });
|
|
1603
|
-
function Yt(e) {
|
|
1604
|
-
const t = e.split(","), [n = "", r = "", i = ""] = t, s = Number(n), o = Number(i);
|
|
1605
|
-
if (t.length !== 3 || n.trim() === "" || i.trim() === "" || !Number.isInteger(s) || !Number.isInteger(o)) throw new u(`resource-array.put-request: field "creator" has "${e}", not <version>,<creatorUUID>,<creatorDbId>`, "PACKET_FIELD");
|
|
1606
|
-
return { version: s, creatorUuid: r, creatorDbId: o };
|
|
1607
|
-
}
|
|
1608
|
-
a({ name: "resource-array.put", description: "The server says whether a like was taken.", direction: "toClient", command: "crp", read: (e) => ({ ok: e.string("ok") === "1", extra: e.rest() }), write: (e, { ok: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), a({ name: "world-item.gift-request", description: "The player takes a world item’s gift.", direction: "toServer", command: "wig", read: (e) => ({ defId: e.int("defId"), version: e.int("version"), colorIndex: e.int("colorIndex") }), write: (e, { defId: t, version: n, colorIndex: r }) => e.int(t).int(n).int(r) }), a({ name: "world-item.gift-result", description: "The server says whether a world item’s gift was given.", direction: "toClient", command: "wig", read: (e) => ({ ok: e.string("ok") === "1", balance: e.remaining > 0 ? e.int("balance") : -1, extra: e.rest() }), write: (e, { ok: t, balance: n, extra: r }) => e.string(t ? "1" : "0").int(n).raw(r) }), a({ name: "referral.code-request", description: "The player asks for their refer a friend code.", direction: "toServer", command: "refc", read: () => ({}), write: () => {
|
|
1609
|
-
} }), a({ name: "referral.code", description: "The server sends the player’s refer a friend code.", direction: "toClient", command: "refc", read: (e) => ({ status: e.int("status"), code: e.remaining > 0 ? e.string("code") : null }), write: (e, { status: t, code: n }) => {
|
|
1610
|
-
e.int(t), n !== null && e.string(n);
|
|
1611
|
-
} }), a({ name: "referral.has-associate-request", description: "The player asks whether they have named who referred them.", direction: "toServer", command: "refh", read: () => ({}), write: () => {
|
|
1612
|
-
} }), a({ name: "referral.has-associate", description: "The server says whether the player has named who referred them.", direction: "toClient", command: "refh", read: (e) => ({ status: e.int("status") }), write: (e, { status: t }) => e.int(t) }), a({ name: "referral.associate", description: "The player names who referred them.", direction: "toServer", command: "refa", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "referral.associate-result", description: "The server says whether the player’s referrer was recorded.", direction: "toClient", command: "refa", read: (e) => ({ status: e.int("status") }), write: (e, { status: t }) => e.int(t) }), a({ name: "referral.list-request", description: "The player asks for the players who joined with their code.", direction: "toServer", command: "refr", read: (e) => ({ page: e.int("page"), pageSize: e.int("pageSize") }), write: (e, { page: t, pageSize: n }) => e.int(t).int(n) }), a({ name: "referral.list", description: "The server sends the players who joined with the player’s code.", direction: "toClient", command: "refr", read: (e) => ({ status: e.int("status"), referrals: e.remaining > 0 ? Qt(e.string("referrals")) : null }), write: (e, { status: t, referrals: n }) => {
|
|
1613
|
-
e.int(t), n !== null && e.string(Zt(n));
|
|
1614
|
-
} });
|
|
1615
|
-
function Qt(e) {
|
|
1616
|
-
let t;
|
|
1617
|
-
try {
|
|
1618
|
-
t = JSON.parse(e);
|
|
1619
|
-
} catch {
|
|
1620
|
-
throw new u(`referral.list: field "referrals" is not JSON ("${e}")`, "PACKET_FIELD");
|
|
1621
|
-
}
|
|
1622
|
-
const n = qe(t) ? t.referrals : null;
|
|
1623
|
-
return Array.isArray(n) ? n.filter(qe).map((r) => ({ userName: typeof r.name == "string" ? r.name : String(r.name ?? ""), moderatedUserName: "moderatedUserName" in r && r.moderatedUserName !== null ? String(r.moderatedUserName) : null, nameBarData: "namebarData" in r ? Number(r.namebarData) || 0 : null, accountType: typeof r.account_type == "string" ? r.account_type : "" })) : [];
|
|
1624
|
-
}
|
|
1625
|
-
function Zt(e) {
|
|
1626
|
-
return JSON.stringify({ referrals: e.map((t) => ({ name: t.userName, ...t.moderatedUserName === null ? {} : { moderatedUserName: t.moderatedUserName }, ...t.nameBarData === null ? {} : { namebarData: t.nameBarData }, account_type: t.accountType })) });
|
|
1627
|
-
}
|
|
1628
|
-
function qe(e) {
|
|
1629
|
-
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
1630
|
-
}
|
|
1631
|
-
const en = { roomManager: "room.RoomManagerWorld" }, tn = { none: 0, game: 1, denVolume: 2, splash: 3, storePet: 4, socialGroup: 5, socialEmoticon: 6, guiAction: 7, recycleAccessory: 8, recycleDenItem: 9, triggerWalkIn: 11, genericList: 12, clickEmoticon: 13, air: 14, dynamicCollision: 15, dynamicAir: 16, dynamicPhantomAir: 17, plant: 18, stealth: 19, adventureInteract: 20, darkSoft: 21, darkHard: 22, fallingPhantom: 23 };
|
|
1632
|
-
Object.fromEntries(Object.entries(tn).map(([e, t]) => [t, e]));
|
|
1633
|
-
function nn(e) {
|
|
1634
|
-
return typeof e == "number" ? e : Number(e) || 0;
|
|
1635
|
-
}
|
|
1636
|
-
const Ce = { behind: "room_bkg_main", players: "room_avatars", front: "room_fg", over: "room_super_fg", chat: "room_chat", interface: "gui" };
|
|
1637
|
-
function sn(e) {
|
|
1638
|
-
const t = e.definition(en.roomManager).at("instance", "layerManager"), n = Object.keys(Ce);
|
|
1639
|
-
return Promise.all(n.map(async (r) => {
|
|
1640
|
-
const i = Ce[r], s = t.at(i), [o, d] = await Promise.all([s.at("visible").get().catch(() => null), s.at("numChildren").get().catch(() => null)]);
|
|
1641
|
-
return { name: r, layer: i, ready: typeof d == "number", children: nn(d), visible: o === !0, place: s };
|
|
1642
|
-
}));
|
|
1643
|
-
}
|
|
1644
|
-
const rn = [[0, 31], [127, 159], [173, 173], [8203, 8204], [8206, 8207], [8232, 8238], [8288, 8303], [65279, 65279]];
|
|
1645
|
-
new RegExp(`[${rn.map(([e, t]) => `${String.fromCharCode(e)}-${String.fromCharCode(t)}`).join("")}]`, "g");
|
|
1646
|
-
const x = { shopManager: "shop.ShopManager", shopWindow: "shop.Shop" };
|
|
1647
|
-
`${N(x.shopManager)}`, `${N(x.shopWindow)}`, `${N(x.shopWindow)}`, `${N(x.shopWindow)}`, `${N(x.shopWindow)}`, `${N(x.shopWindow)}`;
|
|
1648
|
-
function N(e) {
|
|
1649
|
-
return e.replace(/\./g, ":");
|
|
1650
|
-
}
|
|
1651
|
-
new Set(Object.values(y));
|
|
1652
|
-
class on extends Error {
|
|
1653
|
-
constructor(t, n) {
|
|
1654
|
-
super(n), this.code = t, this.name = "PluginError";
|
|
1655
|
-
}
|
|
1656
|
-
code;
|
|
1657
|
-
}
|
|
1658
|
-
export {
|
|
1659
|
-
an as C,
|
|
1660
|
-
Le as M,
|
|
1661
|
-
u as P,
|
|
1662
|
-
b as X,
|
|
1663
|
-
P as a,
|
|
1664
|
-
E as b,
|
|
1665
|
-
on as c,
|
|
1666
|
-
sn as r
|
|
1667
|
-
};
|