@phantomclient/plugin 0.1.1 → 0.1.3

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.
@@ -6,8 +6,8 @@ class u extends Error {
6
6
  offset;
7
7
  }
8
8
  new TextEncoder();
9
- const $e = { lt: "<", gt: ">", amp: "&", apos: "'", quot: '"' };
10
- function _(e) {
9
+ const Oe = { lt: "<", gt: ">", amp: "&", apos: "'", quot: '"' };
10
+ function G(e) {
11
11
  if (!e.includes("&")) return e;
12
12
  let t = "", n = 0;
13
13
  for (; n < e.length; ) {
@@ -15,41 +15,41 @@ function _(e) {
15
15
  if (r === -1) break;
16
16
  const i = e.indexOf(";", r + 1);
17
17
  t += e.slice(n, r);
18
- const s = i === -1 ? null : Fe(e.slice(r + 1, i));
18
+ const s = i === -1 ? null : ze(e.slice(r + 1, i));
19
19
  s === null ? (t += "&", n = r + 1) : (t += s, n = i + 1);
20
20
  }
21
21
  return t + e.slice(n);
22
22
  }
23
- function Fe(e) {
23
+ function ze(e) {
24
24
  if (e.startsWith("#")) {
25
25
  const t = e[1] === "x" || e[1] === "X", n = e.slice(t ? 2 : 1);
26
- if (n.length === 0 || !(t ? Oe(n) : Re(n))) return null;
26
+ if (n.length === 0 || !(t ? Ke(n) : Ve(n))) return null;
27
27
  const r = Number.parseInt(n, t ? 16 : 10);
28
28
  return r <= 1114111 ? String.fromCodePoint(r) : null;
29
29
  }
30
- return $e[e] ?? null;
30
+ return Oe[e] ?? null;
31
31
  }
32
- function Re(e) {
32
+ function Ve(e) {
33
33
  for (const t of e) if (t < "0" || t > "9") return !1;
34
34
  return !0;
35
35
  }
36
- function Oe(e) {
36
+ function Ke(e) {
37
37
  for (const t of e.toLowerCase()) if (!(t >= "0" && t <= "9" || t >= "a" && t <= "f")) return !1;
38
38
  return !0;
39
39
  }
40
- function O(e) {
40
+ function V(e) {
41
41
  let t = "";
42
42
  for (const n of e) n === "&" ? t += "&amp;" : n === "<" ? t += "&lt;" : n === ">" ? t += "&gt;" : t += n;
43
43
  return t;
44
44
  }
45
- function Q(e, t) {
45
+ function ee(e, t) {
46
46
  let n = "";
47
47
  for (const r of e) r === "&" ? n += "&amp;" : r === "<" ? n += "&lt;" : r === t ? n += t === '"' ? "&quot;" : "&apos;" : n += r;
48
48
  return n;
49
49
  }
50
50
  class v {
51
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 = _(n);
52
+ this.name = t, this.quote = r, this.leading = i, this.around = s, this.written = n, this.decoded = G(n);
53
53
  }
54
54
  name;
55
55
  quote;
@@ -58,33 +58,33 @@ class v {
58
58
  written;
59
59
  decoded;
60
60
  static create(t, n, r = "'") {
61
- return new v(t, Q(n, r), r);
61
+ return new v(t, ee(n, r), r);
62
62
  }
63
63
  get value() {
64
64
  return this.decoded;
65
65
  }
66
66
  set value(t) {
67
- this.decoded = t, this.written = Q(t, this.quote);
67
+ this.decoded = t, this.written = ee(t, this.quote);
68
68
  }
69
69
  get raw() {
70
70
  return this.written;
71
71
  }
72
72
  }
73
- class E {
73
+ class M {
74
74
  type = "text";
75
75
  written;
76
76
  decoded;
77
77
  constructor(t) {
78
- this.written = t, this.decoded = _(t);
78
+ this.written = t, this.decoded = G(t);
79
79
  }
80
80
  static create(t) {
81
- return new E(O(t));
81
+ return new M(V(t));
82
82
  }
83
83
  get value() {
84
84
  return this.decoded;
85
85
  }
86
86
  set value(t) {
87
- this.decoded = t, this.written = O(t);
87
+ this.decoded = t, this.written = V(t);
88
88
  }
89
89
  get raw() {
90
90
  return this.written;
@@ -97,14 +97,14 @@ class w {
97
97
  value;
98
98
  type = "cdata";
99
99
  }
100
- class ze {
100
+ class _e {
101
101
  constructor(t) {
102
102
  this.value = t;
103
103
  }
104
104
  value;
105
105
  type = "comment";
106
106
  }
107
- class Ve {
107
+ class We {
108
108
  constructor(t, n) {
109
109
  this.target = t, this.content = n;
110
110
  }
@@ -159,13 +159,13 @@ class f {
159
159
  }
160
160
  set textContent(t) {
161
161
  const n = this.children.some((r) => r.type === "cdata");
162
- this.children = [n ? new w(t) : E.create(t)], this.selfClosing = !1;
162
+ this.children = [n ? new w(t) : M.create(t)], this.selfClosing = !1;
163
163
  }
164
164
  append(...t) {
165
165
  this.children.push(...t), t.length > 0 && (this.selfClosing = !1);
166
166
  }
167
167
  }
168
- class ke {
168
+ class Se {
169
169
  constructor(t) {
170
170
  this.children = t;
171
171
  }
@@ -174,7 +174,7 @@ class ke {
174
174
  return this.children.find((t) => t.type === "element") ?? null;
175
175
  }
176
176
  }
177
- class Ke {
177
+ class Ge {
178
178
  constructor(t) {
179
179
  this.input = t;
180
180
  }
@@ -200,7 +200,7 @@ class Ke {
200
200
  }
201
201
  whitespace() {
202
202
  const t = this.index;
203
- for (; !this.done && Je(this.input.charCodeAt(this.index)); ) this.index++;
203
+ for (; !this.done && Qe(this.input.charCodeAt(this.index)); ) this.index++;
204
204
  return this.input.slice(t, this.index);
205
205
  }
206
206
  until(t, n) {
@@ -211,65 +211,65 @@ class Ke {
211
211
  }
212
212
  name() {
213
213
  const t = this.index;
214
- for ((this.done || !qe(this.input.charCodeAt(this.index))) && this.fail("Expected a name"), this.index++; !this.done && He(this.input.charCodeAt(this.index)); ) 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
215
  return this.input.slice(t, this.index);
216
216
  }
217
217
  fail(t) {
218
218
  throw new u(t, "XML_SYNTAX", this.index);
219
219
  }
220
220
  }
221
- const _e = 32, Ge = 9, Xe = 10, We = 13;
222
- function Je(e) {
223
- return e === _e || e === Ge || e === Xe || e === We;
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
224
  }
225
- function qe(e) {
225
+ function Ae(e) {
226
226
  return e >= 97 && e <= 122 || e >= 65 && e <= 90 || e === 95 || e === 58 || e > 127;
227
227
  }
228
- function He(e) {
229
- return qe(e) || e >= 48 && e <= 57 || e === 45 || e === 46;
228
+ function Ze(e) {
229
+ return Ae(e) || e >= 48 && e <= 57 || e === 45 || e === 46;
230
230
  }
231
- const Z = 64;
232
- function Ce(e) {
233
- const t = new Ke(e), n = Se(t, null, 0);
234
- return n.some((r) => r.type === "element") || t.fail("Expected an element"), new ke(n);
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
235
  }
236
- function Se(e, t, n) {
236
+ function Ue(e, t, n) {
237
237
  const r = [];
238
238
  for (; !e.done; ) {
239
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 ze(e.until("-->", "comment"))), e.advance(3)) : e.startsWith("<?") ? r.push(Qe(e)) : e.startsWith("<!") ? e.fail("Document type declarations are not supported") : e.peek() === "<" ? r.push(Ze(e, n)) : r.push(Ye(e));
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
241
  }
242
242
  return t !== null && e.fail(`Unclosed element <${t}>`), r;
243
243
  }
244
- function Ye(e) {
244
+ function et(e) {
245
245
  const t = e.offset;
246
246
  for (; !e.done && e.peek() !== "<"; ) e.advance();
247
- return new E(e.input.slice(t, e.offset));
247
+ return new M(e.input.slice(t, e.offset));
248
248
  }
249
- function Qe(e) {
249
+ function tt(e) {
250
250
  e.expect("<?");
251
251
  const t = e.name(), n = e.until("?>", "processing instruction");
252
- return e.advance(2), new Ve(t, n);
252
+ return e.advance(2), new We(t, n);
253
253
  }
254
- function Ze(e, t) {
255
- t >= Z && e.fail(`Elements nested deeper than ${Z}`), e.expect("<");
254
+ function nt(e, t) {
255
+ t >= te && e.fail(`Elements nested deeper than ${te}`), e.expect("<");
256
256
  const n = e.name(), r = [];
257
257
  for (; ; ) {
258
258
  const i = e.whitespace();
259
259
  if (e.startsWith("/>")) return e.advance(2), new f(n, { attributes: r, selfClosing: !0, trailing: i });
260
260
  if (e.peek() === ">") {
261
261
  e.advance();
262
- const s = Se(e, n, t + 1);
262
+ const s = Ue(e, n, t + 1);
263
263
  e.expect("</");
264
264
  const o = e.name();
265
265
  o !== n && e.fail(`Expected </${n}> but found </${o}>`);
266
266
  const d = e.whitespace();
267
267
  return e.expect(">"), new f(n, { attributes: r, children: s, trailing: i, closingTrailing: d });
268
268
  }
269
- e.done && e.fail(`Unterminated tag <${n}>`), i.length === 0 && e.fail("Expected whitespace before an attribute"), r.push(et(e, i, r));
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
270
  }
271
271
  }
272
- function et(e, t, n) {
272
+ function rt(e, t, n) {
273
273
  const r = e.name();
274
274
  n.some((m) => m.name === r) && e.fail(`Attribute "${r}" given twice`);
275
275
  const i = e.whitespace();
@@ -279,13 +279,13 @@ function et(e, t, n) {
279
279
  const d = e.until(o, "attribute value");
280
280
  return d.includes("<") && e.fail('"<" is not allowed in an attribute value'), e.advance(), new v(r, d, o, t, [i, s]);
281
281
  }
282
- function ee(e) {
283
- return e instanceof ke ? e.children.map(z).join("") : z(e);
282
+ function ne(e) {
283
+ return e instanceof Se ? e.children.map(K).join("") : K(e);
284
284
  }
285
- function z(e) {
285
+ function K(e) {
286
286
  switch (e.type) {
287
287
  case "element":
288
- return tt(e);
288
+ return it(e);
289
289
  case "text":
290
290
  return e.raw;
291
291
  case "cdata":
@@ -296,34 +296,34 @@ function z(e) {
296
296
  return `<?${e.target}${e.content}?>`;
297
297
  }
298
298
  }
299
- function tt(e) {
300
- const t = e.attributes.map(nt).join(""), n = `<${e.name}${t}${e.trailing}`;
299
+ function it(e) {
300
+ const t = e.attributes.map(at).join(""), n = `<${e.name}${t}${e.trailing}`;
301
301
  if (e.selfClosing && e.children.length === 0) return `${n}/>`;
302
- const r = e.children.map(z).join("");
302
+ const r = e.children.map(K).join("");
303
303
  return `${n}>${r}</${e.name}${e.closingTrailing}>`;
304
304
  }
305
- function nt(e) {
305
+ function at(e) {
306
306
  const [t, n] = e.around, { leading: r, name: i, quote: s, raw: o } = e;
307
307
  return `${r}${i}${t}=${n}${s}${o}${s}`;
308
308
  }
309
- function rt(e) {
310
- const t = Ce(e).root;
309
+ function st(e) {
310
+ const t = De(e).root;
311
311
  if (!t || t.name !== "dataObj") throw new u("Expected a <dataObj> element", "DATA_OBJECT");
312
- return Ae(t, {});
312
+ return Be(t, {});
313
313
  }
314
- function Ae(e, t) {
314
+ function Be(e, t) {
315
315
  const n = t;
316
- for (const r of e.elements) if (r.name === "var") n[U(r, "n")] = it(r);
316
+ for (const r of e.elements) if (r.name === "var") n[j(r, "n")] = ot(r);
317
317
  else if (r.name === "obj") {
318
- const i = U(r, "t");
318
+ const i = j(r, "t");
319
319
  if (i !== "a" && i !== "o") throw new u(`Unknown object kind "${i}"`, "DATA_OBJECT");
320
- n[U(r, "o")] = Ae(r, i === "a" ? [] : {});
320
+ n[j(r, "o")] = Be(r, i === "a" ? [] : {});
321
321
  }
322
322
  return t;
323
323
  }
324
- function it(e) {
324
+ function ot(e) {
325
325
  const t = e.textContent;
326
- switch (U(e, "t")) {
326
+ switch (j(e, "t")) {
327
327
  case "s":
328
328
  return t;
329
329
  case "n":
@@ -336,18 +336,18 @@ function it(e) {
336
336
  throw new u(`Unknown variable type "${e.attribute("t")}"`, "DATA_OBJECT");
337
337
  }
338
338
  }
339
- function U(e, t) {
339
+ function j(e, t) {
340
340
  const n = e.attribute(t);
341
341
  if (n === null) throw new u(`<${e.name}> is missing its "${t}" attribute`, "DATA_OBJECT");
342
342
  return n;
343
343
  }
344
- function at(e) {
345
- return `<dataObj>${De(e)}</dataObj>`;
344
+ function dt(e) {
345
+ return `<dataObj>${je(e)}</dataObj>`;
346
346
  }
347
- function De(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}'>${De(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'>${O(n)}</var>`).join("");
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
349
  }
350
- class Ue {
350
+ class Le {
351
351
  constructor(t, n) {
352
352
  this.raw = t, this.direction = n;
353
353
  }
@@ -374,16 +374,16 @@ class Ue {
374
374
  this.wasModified = !0;
375
375
  }
376
376
  }
377
- const te = "xt";
378
- class j extends Ue {
377
+ const re = "xt";
378
+ class E extends Le {
379
379
  format = "xml";
380
380
  document;
381
381
  constructor(t, n) {
382
- super(t, n), this.document = Ce(t);
382
+ super(t, n), this.document = De(t);
383
383
  }
384
384
  static create(t, n, r, i, s = []) {
385
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 j(ee(o), t);
386
+ return new E(ne(o), t);
387
387
  }
388
388
  get element() {
389
389
  return this.document.root.name;
@@ -409,13 +409,13 @@ class j extends Ue {
409
409
  return ((t = this.envelope) == null ? void 0 : t.child("body")) ?? null;
410
410
  }
411
411
  get data() {
412
- return this.type !== te || !this.body ? null : rt(this.body.textContent);
412
+ return this.type !== re || !this.body ? null : st(this.body.textContent);
413
413
  }
414
414
  set data(t) {
415
- if (this.type !== te || !this.body) throw new u("Only an extension message carries an object", "PACKET_FORMAT");
415
+ if (this.type !== re || !this.body) throw new u("Only an extension message carries an object", "PACKET_FORMAT");
416
416
  this.edit((n) => {
417
417
  const r = n.root.child("body");
418
- r.children = [new w(at(t))];
418
+ r.children = [new w(dt(t))];
419
419
  });
420
420
  }
421
421
  edit(t) {
@@ -423,28 +423,28 @@ class j extends Ue {
423
423
  t(this.document), this.markModified();
424
424
  }
425
425
  serialize() {
426
- return ee(this.document);
426
+ return ne(this.document);
427
427
  }
428
428
  get envelope() {
429
429
  const t = this.document.root;
430
430
  return (t == null ? void 0 : t.name) === "msg" ? t : null;
431
431
  }
432
432
  }
433
- const b = "%", V = "xt";
434
- class L extends Ue {
433
+ const b = "%", _ = "xt";
434
+ class P extends Le {
435
435
  format = "xt";
436
436
  fields;
437
437
  constructor(t, n) {
438
- super(t, n), this.fields = st(t, n);
438
+ super(t, n), this.fields = ct(t, n);
439
439
  }
440
440
  static create(t, n, r, i = [], s = "o") {
441
- return new L(ne(t, { extension: s, command: n, room: String(r), args: i.map(String) }), t);
441
+ return new P(ie(t, { extension: s, command: n, room: String(r), args: i.map(String) }), t);
442
442
  }
443
443
  get command() {
444
444
  return this.fields.command;
445
445
  }
446
446
  set command(t) {
447
- B(t), this.fields.command = t, this.markModified();
447
+ L(t), this.fields.command = t, this.markModified();
448
448
  }
449
449
  get extension() {
450
450
  return this.fields.extension;
@@ -468,32 +468,32 @@ class L extends Ue {
468
468
  setArg(t, n) {
469
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
470
  const r = String(n);
471
- B(r), this.fields.args[t] = r, this.markModified();
471
+ L(r), this.fields.args[t] = r, this.markModified();
472
472
  }
473
473
  setArgs(t) {
474
474
  const n = t.map(String);
475
- n.forEach(B), this.fields.args = n, this.markModified();
475
+ n.forEach(L), this.fields.args = n, this.markModified();
476
476
  }
477
477
  serialize() {
478
- return ne(this.direction, this.fields);
478
+ return ie(this.direction, this.fields);
479
479
  }
480
480
  }
481
- function st(e, t) {
481
+ function ct(e, t) {
482
482
  if (e.length < 2 || !e.startsWith(b) || !e.endsWith(b)) throw new u('An extension message starts and ends with "%"', "XT_SYNTAX");
483
483
  const n = e.slice(1, -1).split(b);
484
- if (n[0] !== V) throw new u(`Expected the "xt" handler, found "${n[0]}"`, "XT_SYNTAX", 1);
484
+ if (n[0] !== _) throw new u(`Expected the "xt" handler, found "${n[0]}"`, "XT_SYNTAX", 1);
485
485
  const r = t === "toServer" ? 4 : 3;
486
486
  if (n.length < r) throw new u(`A message to the ${t === "toServer" ? "server" : "client"} has at least ${r} fields`, "XT_SYNTAX");
487
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
488
  }
489
- function ne(e, t) {
490
- const n = [...e === "toServer" ? [V, t.extension ?? "o", t.command, t.room] : [V, t.command, t.room], ...t.args];
491
- return n.forEach(B), b + n.map((r) => r + b).join("");
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
492
  }
493
- function B(e) {
493
+ function L(e) {
494
494
  if (e.includes(b)) throw new u(`An extension message value cannot contain "${b}": ${e}`, "XT_VALUE");
495
495
  }
496
- class x {
496
+ class k {
497
497
  constructor(t, n) {
498
498
  this.values = t, this.packet = n;
499
499
  }
@@ -535,7 +535,7 @@ class x {
535
535
  throw new u(`${this.packet}: field "${t}" (${n}) ${r}${s}`, "PACKET_FIELD");
536
536
  }
537
537
  }
538
- class ot {
538
+ class mt {
539
539
  written = [];
540
540
  string(t) {
541
541
  return this.written.push(t), this;
@@ -562,49 +562,49 @@ class ot {
562
562
  }
563
563
  }
564
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 L && c.direction === r && c.command === i && (r === "toClient" || c.extension === s);
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
566
  return { name: t, description: n, format: "xt", direction: r, command: i, matches: m, decode(c) {
567
- return Be(m(c), t, c), { ...o(new x(c.args, t)), room: c.room ?? -1 };
567
+ return Ee(m(c), t, c), { ...o(new k(c.args, t)), room: c.room ?? -1 };
568
568
  }, encode(c) {
569
- const l = new ot();
570
- return d(l, c), L.create(r, i, c.room, l.values, s);
569
+ const l = new mt();
570
+ return d(l, c), P.create(r, i, c.room, l.values, s);
571
571
  } };
572
572
  }
573
- function N(e) {
574
- const { name: t, description: n, direction: r, command: i, type: s, read: o, write: d } = e, m = (c) => c instanceof j && c.direction === r && c.type === s && c.command === i;
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
575
  return { name: t, description: n, format: "xml", direction: r, command: i, matches: m, decode(c) {
576
- return Be(m(c), t, c), { ...o(c), room: c.room ?? -1 };
576
+ return Ee(m(c), t, c), { ...o(c), room: c.room ?? -1 };
577
577
  }, encode(c) {
578
- return j.create(r, s, i, c.room, d(c));
578
+ return E.create(r, s, i, c.room, d(c));
579
579
  } };
580
580
  }
581
- function Be(e, t, n) {
581
+ function Ee(e, t, n) {
582
582
  if (!e) throw new TypeError(`A ${n.format} "${n.command}" message ${n.direction} is not ${t}`);
583
583
  }
584
- function re(e) {
584
+ function ae(e) {
585
585
  return { invId: e.int("invId"), defId: e.int("defId") };
586
586
  }
587
- function ie(e, t) {
587
+ function se(e, t) {
588
588
  e.int(t.length).each(t, ({ invId: n, defId: r }) => e.int(n).int(r));
589
589
  }
590
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
591
  } }), a({ name: "achievement.list", description: "The server gives a player’s achievements.", direction: "toClient", command: "za", read: (e) => {
592
592
  const t = e.string("userName"), n = e.int("count");
593
- return { userName: t, archived: n === -1, achievements: e.repeat(Math.max(n, 0), () => re(e)) };
593
+ return { userName: t, archived: n === -1, achievements: e.repeat(Math.max(n, 0), () => ae(e)) };
594
594
  }, write: (e, { userName: t, archived: n, achievements: r }) => {
595
- e.string(t), n ? e.int(-1) : ie(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"), () => re(e)) }), write: (e, { userVarId: t, value: n, achievements: r }) => {
597
- e.int(t).number(n), ie(e, 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
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
599
  const t = e.flag("success");
600
600
  return t ? { success: t, cards: e.repeat(e.int("count"), () => ({ defId: e.int("defId"), invId: e.int("invId") })) } : { success: t, cards: [] };
601
601
  }, write: (e, { success: t, cards: n }) => {
602
602
  e.flag(t), t && e.int(n.length).each(n, (r) => e.int(r.defId).int(r.invId));
603
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 je(e) {
604
+ function Pe(e) {
605
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
606
  }
607
- function Le(e, t) {
607
+ function Me(e, t) {
608
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
609
  }
610
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) => {
@@ -618,9 +618,9 @@ a({ name: "pet.list-request", description: "The client asks for a player’s pet
618
618
  const t = e.string("success") === "1";
619
619
  if (!t) return { success: t, userId: -1, activePetInvId: null, pet: null };
620
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: je(e) };
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
622
  }, write: (e, { success: t, userId: n, activePetInvId: r, pet: i }) => {
623
- if (e.string(t ? "1" : "0"), !!t) if (e.int(n), i) Le(e, i);
623
+ if (e.string(t ? "1" : "0"), !!t) if (e.int(n), i) Me(e, i);
624
624
  else if (r !== null) e.int(r);
625
625
  else throw new u("pet.switched: a success names a pet or an inventory id", "PACKET_FIELD");
626
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) => {
@@ -631,8 +631,8 @@ a({ name: "pet.list-request", description: "The client asks for a player’s pet
631
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
632
  const t = e.flag("success");
633
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"), P = 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: P } };
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
636
  }, write: (e, t) => {
637
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
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) => {
@@ -647,23 +647,23 @@ a({ name: "pet.list-request", description: "The client asks for a player’s pet
647
647
  const t = e.int("userId"), n = e.int("count"), r = e.repeat(n, () => ({ x: e.int("x"), y: e.int("y") }));
648
648
  return { userId: t, path: r, teleport: e.flag("teleport") };
649
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 C(e) {
650
+ function A(e) {
651
651
  return [e.int("color1"), e.int("color2"), e.int("color3")];
652
652
  }
653
- function S(e, t) {
653
+ function D(e, t) {
654
654
  e.int(t[0]).int(t[1]).int(t[2]);
655
655
  }
656
- function ae(e) {
656
+ function oe(e) {
657
657
  return e !== void 0 && e.trim() !== "" && Number.isInteger(Number(e));
658
658
  }
659
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
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: C(e), avName: e.string("avName") };
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
662
  if (e.remaining === 2) {
663
663
  const i = { activePetInvId: e.int("activePetInvId"), questLevel: e.int("questLevel") };
664
664
  return { success: !0, userId: t, avatar: n, player: i, other: null };
665
665
  }
666
- const r = { pet: je(e), questLevel: e.int("questLevel") };
666
+ const r = { pet: Pe(e), questLevel: e.int("questLevel") };
667
667
  return { success: !0, userId: t, avatar: n, player: null, other: r };
668
668
  }, write: (e, t) => {
669
669
  if (!t.success) {
@@ -671,12 +671,12 @@ a({ name: "avatar.paint-result", description: "The server says whether the playe
671
671
  return;
672
672
  }
673
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), S(e, r.colors), e.string(r.avName), i) e.int(i.activePetInvId).int(i.questLevel);
675
- else if (s) Le(e, s.pet), e.int(s.questLevel);
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
676
  else throw new u("avatar.switched: a success has a player or an other part", "PACKET_FIELD");
677
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 x(t, "avatar.list"), r = n.string("userName"), i = Number(t[1]);
679
- if (ae(t[1]) && t.length === 2 + i && t.slice(2).every((m) => ae(m))) {
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
680
  const m = n.int("count");
681
681
  return { own: !1, userName: r, perUserAvIds: n.repeat(m, () => n.int("perUserAvId")) };
682
682
  }
@@ -689,7 +689,7 @@ a({ name: "avatar.paint-result", description: "The server says whether the playe
689
689
  }
690
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
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: C(e), avName: e.string("avName"), questLevel: e.int("questLevel") };
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
693
  if (e.remaining === 8) {
694
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
695
  return { ...t, player: r, other: null };
@@ -697,7 +697,7 @@ a({ name: "avatar.paint-result", description: "The server says whether the playe
697
697
  const n = { lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), petName: e.string("petName") };
698
698
  return { ...t, player: null, other: n };
699
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), S(e, t.colors), e.string(t.avName).int(t.questLevel);
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
701
  const { player: n, other: r } = t;
702
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
703
  else if (r) e.int(r.lBits).int(r.uBits).int(r.eBits).string(r.petName);
@@ -705,12 +705,12 @@ a({ name: "avatar.paint-result", description: "The server says whether the playe
705
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
706
  const t = e.string("userName"), n = e.string("uuid"), r = e.int("status");
707
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: C(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") })) };
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
709
  return { userName: t, uuid: n, status: r, avatar: { ...i, ...o } };
710
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), S(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: C(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), S(e, t.colors), e.int(t.questLevel).raw(t.details);
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
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
715
  const t = e.int("userId");
716
716
  if (e.remaining === 0) return { userId: t, walkOut: 0, walkTo: null, extra: [] };
@@ -719,17 +719,17 @@ a({ name: "avatar.paint-result", description: "The server says whether the playe
719
719
  }, write: (e, { userId: t, walkOut: n, walkTo: r, extra: i }) => {
720
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
721
  } });
722
- function se(e) {
722
+ function de(e) {
723
723
  return [e.int("nameId1"), e.int("nameId2"), e.int("nameId3")];
724
724
  }
725
- function oe(e, t) {
725
+ function ce(e, t) {
726
726
  e.int(t[0]).int(t[1]).int(t[2]);
727
727
  }
728
- a({ name: "avatar.add-request", description: "The player adds a new animal to their account.", direction: "toServer", command: "aa", read: (e) => ({ nameIds: se(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
- oe(e, t), e.int(n).int(r).int(i).int(s);
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
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: se(e) }), write: (e, { avTypeId: t, nameIds: n }) => {
732
- e.int(t), oe(e, n);
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
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
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
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: () => {
@@ -738,7 +738,7 @@ a({ name: "avatar.add-request", description: "The player adds a new animal to th
738
738
  const r = e.int("blocked");
739
739
  return { blocked: !0, buddies: [], blockedUserNames: e.repeat(r, () => e.string("userName")) };
740
740
  }
741
- const t = e.repeat(e.int("online"), () => de(e, !0)), n = e.repeat(e.int("offline"), () => de(e, !1));
741
+ const t = e.repeat(e.int("online"), () => me(e, !0)), n = e.repeat(e.int("offline"), () => me(e, !1));
742
742
  return { blocked: !1, buddies: [...t, ...n], blockedUserNames: [] };
743
743
  }, write: (e, { blocked: t, buddies: n, blockedUserNames: r }) => {
744
744
  if (t) {
@@ -746,44 +746,44 @@ a({ name: "avatar.add-request", description: "The player adds a new animal to th
746
746
  return;
747
747
  }
748
748
  const i = n.filter((o) => o.online), s = n.filter((o) => !o.online);
749
- e.string("0").int(i.length), i.forEach((o) => ce(e, o, !0)), e.int(s.length), s.forEach((o) => ce(e, o, !1));
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
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
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
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
753
  }, write: (e, t) => {
754
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
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 de(e, t) {
756
+ function me(e, t) {
757
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
758
  }
759
- function ce(e, t, n) {
759
+ function ue(e, t, n) {
760
760
  e.string(t.userName).string(t.uuid).int(t.userNameModerationFlag).int(t.accountType), n && e.int(t.partyTimeLeft ?? -1);
761
761
  }
762
- const Qt = { 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
- N({ name: "chat.public", description: "The player says something in the room.", direction: "toServer", type: "sys", command: "pubMsg", read: (e) => {
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
764
  var t, n;
765
- const r = _(((n = (t = e.body) == null ? void 0 : t.child("txt")) == null ? void 0 : n.textContent) ?? ""), i = r.lastIndexOf("%");
765
+ const r = G(((n = (t = e.body) == null ? void 0 : t.child("txt")) == null ? void 0 : n.textContent) ?? ""), i = r.lastIndexOf("%");
766
766
  if (i === -1) throw new u("chat.public: the text has no kind after it", "PACKET_FIELD");
767
767
  const s = Number(r.slice(i + 1));
768
768
  if (!Number.isInteger(s)) throw new u("chat.public: the kind is not an integer", "PACKET_FIELD");
769
769
  return { text: r.slice(0, i), kind: s };
770
- }, write: ({ text: e, kind: t }) => [new f("txt", { children: [new w(dt(`${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 }) => {
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
771
  e.int(t).string(n).int(r), i !== null && e.int(i), e.raw(s);
772
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 dt(e) {
773
+ function ut(e) {
774
774
  let t = "";
775
- for (const n of e) t += ct[n] ?? n;
775
+ for (const n of e) t += lt[n] ?? n;
776
776
  return t;
777
777
  }
778
- const ct = { "&": "&amp;", "<": "&lt;", ">": "&gt;", "'": "&apos;", '"': "&quot;" }, me = 100;
778
+ const lt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", "'": "&apos;", '"': "&quot;" }, le = 100;
779
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 === me ? mt(e.string("balances")) : [{ currency: t, amount: e.int("amount") }], r = e.remaining > 0 ? e.int("reason") : null;
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
781
  return { currency: t, balances: n, reason: r, extra: e.rest() };
782
782
  }, write: (e, { currency: t, balances: n, reason: r, extra: i }) => {
783
783
  var s;
784
- e.int(t), t === me ? 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);
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
785
  } });
786
- function mt(e) {
786
+ function pt(e) {
787
787
  return e === "" ? [] : e.split(",").map((t) => {
788
788
  const n = t.split("x"), [r = "", i = ""] = n, s = Number(r), o = Number(i), d = r.trim() === "" || i.trim() === "";
789
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");
@@ -792,9 +792,9 @@ function mt(e) {
792
792
  }
793
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
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: ut(n), hasGiftsElsewhere: r, extra: e.rest() };
795
+ return { result: t, details: ht(n), hasGiftsElsewhere: r, extra: e.rest() };
796
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 ut(e) {
797
+ function ht(e) {
798
798
  if (e === "") return null;
799
799
  try {
800
800
  return JSON.parse(e);
@@ -817,27 +817,27 @@ a({ name: "currency.membership-redeemed", description: "A membership was redeeme
817
817
  }, write: (e, { denRoomDefId: t, perUserAvId: n, activePetInvId: r, extra: i }) => {
818
818
  e.int(t), n !== null && r !== null && e.int(n).int(r), e.raw(i);
819
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 lt(e) {
820
+ function gt(e) {
821
821
  return { baseColor: e.int("baseColor"), patternColor: e.int("patternColor"), patternDefId: e.int("patternDefId"), eyeColor: e.int("eyeColor"), eyeDefId: e.int("eyeDefId") };
822
822
  }
823
- function pt(e, t) {
823
+ function ft(e, t) {
824
824
  e.int(t.baseColor).int(t.patternColor).int(t.patternDefId).int(t.eyeColor).int(t.eyeDefId);
825
825
  }
826
- function ht(e) {
827
- return { ...lt(e), tailInvId: e.int("tailInvId"), legInvId: e.int("legInvId"), backInvId: e.int("backInvId"), neckInvId: e.int("neckInvId"), headInvId: e.int("headInvId") };
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
828
  }
829
- function gt(e, t) {
830
- pt(e, t), e.int(t.tailInvId).int(t.legInvId).int(t.backInvId).int(t.neckInvId).int(t.headInvId);
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
831
  }
832
832
  a({ name: "den.items-request", description: "The player asks for every den item they own.", direction: "toServer", command: "di", read: () => ({}), write: () => {
833
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 ue = { baseColor: 0, patternColor: 0, patternDefId: 0, eyeColor: 0, eyeDefId: 0, tailInvId: 0, legInvId: 0, backInvId: 0, neckInvId: 0, headInvId: 0 };
834
+ const pe = { baseColor: 0, patternColor: 0, patternDefId: 0, eyeColor: 0, eyeDefId: 0, tailInvId: 0, legInvId: 0, backInvId: 0, neckInvId: 0, headInvId: 0 };
835
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 = ht(e), c = Object.keys(ue).every((l) => m[l] === 0);
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
837
  return { refId: t, invIdx: n, placed: r, x: i, y: s, flipped: o, userNameLink: d === "off" ? "" : d, mannequin: c ? null : m };
838
838
  }) }), write: (e, { changes: t }) => {
839
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), gt(e, n.mannequin ?? ue);
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
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
842
  const t = e.string("kind") === "-1", n = e.int("shopId"), r = e.int("defId");
843
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") } };
@@ -849,10 +849,10 @@ a({ name: "den.state-save", description: "The player saves changes to their den.
849
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
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
851
  const t = e.string("kind") === "-1", n = e.string("invIdxs");
852
- return { rooms: t, invIdxs: n === "" ? [] : n.split(",").map(ft) };
852
+ return { rooms: t, invIdxs: n === "" ? [] : n.split(",").map(yt) };
853
853
  }, write: (e, { rooms: t, invIdxs: n }) => e.string(t ? "-1" : "0").string(n.join(",")) });
854
- function ft(e) {
855
- return new x([e], "den.recycle-request").int("invIdxs");
854
+ function yt(e) {
855
+ return new k([e], "den.recycle-request").int("invIdxs");
856
856
  }
857
857
  a({ name: "den.recycle-result", description: "The server says which den items or rooms were sold.", direction: "toClient", command: "dr", read: (e) => {
858
858
  const t = e.int("count");
@@ -870,27 +870,27 @@ a({ name: "den.recycle-result", description: "The server says which den items or
870
870
  e.string(t ? "1" : "0"), n !== null && e.int(n);
871
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
872
  const t = e.int("count");
873
- return { cards: e.repeat(Math.max(t, 0), () => le(e)) };
873
+ return { cards: e.repeat(Math.max(t, 0), () => he(e)) };
874
874
  }, write: (e, { cards: t }) => {
875
- e.int(t.length), t.forEach((n) => pe(e, n));
876
- } }), a({ name: "ecard.received", description: "The player receives a jam-a-gram.", direction: "toClient", command: "ep", read: (e) => ({ card: le(e) }), write: (e, { card: t }) => pe(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 }) => {
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
877
  e.flag(t).int(n.length), n.forEach((r) => e.int(r));
878
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
879
  e.int(t).flag(n), r !== null && e.int(r);
880
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
881
  } });
882
- function le(e) {
882
+ function he(e) {
883
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
884
  }
885
- function pe(e, t) {
885
+ function ge(e, t) {
886
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
887
  }
888
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
889
  const t = e.string("type");
890
890
  if (t === "-1") return { kind: "failed", extra: e.rest() };
891
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"), P = h > 0 && e.remaining === h * 5, Me = e.repeat(h, () => vt(e, P));
893
- return { kind: t === "0" ? "inventory" : "worn", ...g, items: Me };
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
894
  }
895
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
896
  return { kind: "changed", wornOnly: n, wear: r, perUserAvId: i, userName: s, color: o, added: c, removed: l };
@@ -907,7 +907,7 @@ a({ name: "item.list-request", description: "The client asks for an avatar’s i
907
907
  e.int(n.defId).int(n.invId).int(n.color >>> 0), n.equippedAvatars !== null && e.string(n.equippedAvatars).int(n.denStoreInvId ?? 0);
908
908
  });
909
909
  } });
910
- function vt(e, t) {
910
+ function wt(e, t) {
911
911
  const n = e.int("defId"), r = e.int("invId"), i = e.int("color") >>> 0;
912
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
913
  }
@@ -923,23 +923,23 @@ a({ name: "item.use", description: "The player puts items on and takes items off
923
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
924
  e.string(t ? "true" : "false"), n !== null && e.int(n), e.raw(r);
925
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 It = ["hc", "pf", "mo", "as", "ul"];
926
+ const bt = ["hc", "pf", "mo", "as", "ul"];
927
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
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
929
  e.int(t).int(n), r !== "" && e.string(r);
930
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
931
  if (e.remaining === 0) return { joined: !0, refusal: null, waitingUserIds: [], detail: [] };
932
- const t = e.string("result"), n = It.find((s) => s === t);
932
+ const t = e.string("result"), n = bt.find((s) => s === t);
933
933
  if (n) return { joined: !1, refusal: n, waitingUserIds: [], detail: e.rest() };
934
- const r = new x([t], "minigame.join-result").int("userId"), i = e.repeat(e.remaining, () => e.int("userId"));
934
+ const r = new k([t], "minigame.join-result").int("userId"), i = e.repeat(e.remaining, () => e.int("userId"));
935
935
  return { joined: !0, refusal: null, waitingUserIds: [r, ...i], detail: [] };
936
936
  }, write: (e, t) => {
937
937
  t.joined ? e.each(t.waitingUserIds, (n) => e.int(n)) : e.string(t.refusal).raw(t.detail);
938
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 A(e, t, n) {
939
+ function U(e, t, n) {
940
940
  return a({ name: e, description: n, direction: "toClient", command: t, read: (r) => ({ data: r.rest() }), write: (r, { data: i }) => r.raw(i) });
941
941
  }
942
- A("minigame.message", "mm", "A minigame’s own message from the server."), A("minigame.left", "ml", "A player left the minigame."), A("minigame.ended", "me", "The minigame ended."), A("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) => {
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
943
  const t = e.int("gameDefId"), n = e.int("action");
944
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
945
  }, write: (e, { gameDefId: t, action: n, userName: r, nameVisible: i, extra: s }) => {
@@ -952,13 +952,13 @@ A("minigame.message", "mm", "A minigame’s own message from the server."), A("m
952
952
  }, write: (e, { gameDefId: t, allTime: n, thisWeek: r, buddies: i }) => {
953
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
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 he(e) {
955
+ function fe(e) {
956
956
  return { amountSum: e.number("amountSum"), gameSum: e.number("gameSum"), checkSum: e.number("checkSum") };
957
957
  }
958
- function ge(e, { amountSum: t, gameSum: n, checkSum: r }) {
958
+ function ve(e, { amountSum: t, gameSum: n, checkSum: r }) {
959
959
  return e.number(t).number(n).number(r);
960
960
  }
961
- a({ name: "minigame.gem-award", description: "A minigame awards the player gems.", direction: "toServer", command: "mg", read: (e) => he(e), write: (e, t) => ge(e, t) }), a({ name: "minigame.pet-mastery-award", description: "A minigame awards the active pet mastery points.", direction: "toServer", command: "ma", read: (e) => he(e), write: (e, t) => ge(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: () => {
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
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
963
  const t = e.flag("joined"), n = !t && e.remaining > 0 ? e.string("reason") : null;
964
964
  return { joined: t, reason: n, extra: e.rest() };
@@ -979,9 +979,9 @@ a({ name: "minigame.gem-award", description: "A minigame awards the player gems.
979
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
980
  } }), a({ name: "party.masterpieces", description: "The server gives the bulletin board’s masterpieces.", direction: "toClient", command: "sm", read: (e) => {
981
981
  const t = e.string("pool");
982
- return { json: t, pool: yt(t) };
982
+ return { json: t, pool: Tt(t) };
983
983
  }, write: (e, { json: t }) => e.string(t) });
984
- function yt(e) {
984
+ function Tt(e) {
985
985
  if (e === "") return [];
986
986
  let t;
987
987
  try {
@@ -989,9 +989,9 @@ function yt(e) {
989
989
  } catch {
990
990
  throw new u(`party.masterpieces: field "pool" is not JSON ("${e}")`, "PACKET_FIELD");
991
991
  }
992
- return (fe(t) && Array.isArray(t.pool) ? t.pool : []).filter(fe).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 }));
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
993
  }
994
- function fe(e) {
994
+ function Ie(e) {
995
995
  return typeof e == "object" && e !== null && !Array.isArray(e);
996
996
  }
997
997
  a({ name: "party.custom-host-result", description: "The server says whether the player may host a party.", direction: "toClient", command: "scp", read: (e) => {
@@ -1011,26 +1011,26 @@ a({ name: "party.custom-host-result", description: "The server says whether the
1011
1011
  }, write: (e, { found: t, party: n, extra: r }) => {
1012
1012
  e.string(t ? "1" : "0"), t && n && e.string(n.creatorUuid).string(n.node), e.raw(r);
1013
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 k = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1015
- function wt(e) {
1014
+ const C = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1015
+ function xt(e) {
1016
1016
  const t = e.replace(/[\s=]/g, ""), n = new Uint8Array(Math.floor(t.length * 3 / 4));
1017
1017
  let r = 0, i = 0, s = 0;
1018
1018
  for (const o of t) {
1019
- const d = k.indexOf(o);
1019
+ const d = C.indexOf(o);
1020
1020
  if (d === -1) throw new u(`"${o}" is not a Base64 character`, "PACKET_FIELD");
1021
1021
  r = r << 6 | d, i += 6, i >= 8 && (i -= 8, n[s++] = r >> i & 255);
1022
1022
  }
1023
1023
  return n.subarray(0, s);
1024
1024
  }
1025
- function bt(e) {
1025
+ function Nt(e) {
1026
1026
  let t = "";
1027
1027
  for (let n = 0; n < e.length; n += 3) {
1028
1028
  const r = e[n], i = e[n + 1], s = e[n + 2], o = r << 16 | (i ?? 0) << 8 | (s ?? 0);
1029
- t += k[o >> 18 & 63] + k[o >> 12 & 63], t += i === void 0 ? "=" : k[o >> 6 & 63], t += s === void 0 ? "=" : k[o & 63];
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
1030
  }
1031
1031
  return t;
1032
1032
  }
1033
- class Tt {
1033
+ class kt {
1034
1034
  constructor(t) {
1035
1035
  this.bytes = t;
1036
1036
  }
@@ -1062,7 +1062,7 @@ class Tt {
1062
1062
  throw new u(t, "PACKET_FIELD", this.position);
1063
1063
  }
1064
1064
  }
1065
- class xt {
1065
+ class qt {
1066
1066
  bytes = [];
1067
1067
  writeShort(t) {
1068
1068
  return this.bytes.push(t >> 8 & 255, t & 255), this;
@@ -1080,7 +1080,7 @@ class xt {
1080
1080
  return Uint8Array.from(this.bytes);
1081
1081
  }
1082
1082
  }
1083
- function Nt(e) {
1083
+ function Ct(e) {
1084
1084
  const t = Math.max(1, Math.ceil(e.length / 65535)), n = new Uint8Array(2 + t * 5 + e.length + 4);
1085
1085
  n[0] = 120, n[1] = 1;
1086
1086
  let r = 2;
@@ -1093,11 +1093,11 @@ function Nt(e) {
1093
1093
  const o = (s << 16 | i) >>> 0;
1094
1094
  return n[r++] = o >>> 24, n[r++] = o >>> 16 & 255, n[r++] = o >>> 8 & 255, n[r] = o & 255, n;
1095
1095
  }
1096
- function kt(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"), Bt(e.subarray(2));
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
1098
  }
1099
- const qt = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], ve = [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], Ct = [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], Ie = [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], St = [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 q(e) {
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
1101
  const t = new Uint16Array(16);
1102
1102
  for (let i = 0; i < e.length; i++) t[e[i]]++;
1103
1103
  t[0] = 0;
@@ -1110,15 +1110,15 @@ function q(e) {
1110
1110
  }
1111
1111
  return { counts: t, symbols: r };
1112
1112
  }
1113
- let M = null;
1114
- function At() {
1115
- if (!M) {
1113
+ let F = null;
1114
+ function Bt() {
1115
+ if (!F) {
1116
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), M = { literals: q(e), distances: q(new Uint8Array(30).fill(5)) };
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
1118
  }
1119
- return M;
1119
+ return F;
1120
1120
  }
1121
- class Dt {
1121
+ class jt {
1122
1122
  constructor(t) {
1123
1123
  this.bytes = t;
1124
1124
  }
@@ -1148,7 +1148,7 @@ class Dt {
1148
1148
  return p("The deflate data holds a code that is not in its table");
1149
1149
  }
1150
1150
  }
1151
- class Ut {
1151
+ class Lt {
1152
1152
  bytes = new Uint8Array(1024);
1153
1153
  length = 0;
1154
1154
  push(t) {
@@ -1159,8 +1159,8 @@ class Ut {
1159
1159
  this.bytes[this.length++] = t;
1160
1160
  }
1161
1161
  }
1162
- function Bt(e) {
1163
- const t = new Dt(e), n = new Ut();
1162
+ function Et(e) {
1163
+ const t = new jt(e), n = new Lt();
1164
1164
  let r = !1;
1165
1165
  for (; !r; ) {
1166
1166
  r = t.bits(1) === 1;
@@ -1171,19 +1171,19 @@ function Bt(e) {
1171
1171
  (s ^ 65535) !== o && p("A stored deflate block has a bad length");
1172
1172
  for (let d = 0; d < s; d++) n.push(t.byte());
1173
1173
  } else if (i === 1) {
1174
- const { literals: s, distances: o } = At();
1175
- ye(t, n, s, o);
1174
+ const { literals: s, distances: o } = Bt();
1175
+ be(t, n, s, o);
1176
1176
  } else if (i === 2) {
1177
- const { literals: s, distances: o } = jt(t);
1178
- ye(t, n, s, o);
1177
+ const { literals: s, distances: o } = Pt(t);
1178
+ be(t, n, s, o);
1179
1179
  } else p("A deflate block has the reserved type 3");
1180
1180
  }
1181
1181
  return n.bytes.slice(0, n.length);
1182
1182
  }
1183
- function jt(e) {
1183
+ function Pt(e) {
1184
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[qt[m]] = e.bits(3);
1186
- const s = q(i), o = new Uint8Array(t + n);
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
1187
  let d = 0;
1188
1188
  for (; d < o.length; ) {
1189
1189
  const m = e.decode(s);
@@ -1194,9 +1194,9 @@ function jt(e) {
1194
1194
  let c, l = 0;
1195
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
1196
  }
1197
- return { literals: q(o.subarray(0, t)), distances: q(o.subarray(t)) };
1197
+ return { literals: S(o.subarray(0, t)), distances: S(o.subarray(t)) };
1198
1198
  }
1199
- function ye(e, t, n, r) {
1199
+ function be(e, t, n, r) {
1200
1200
  for (; ; ) {
1201
1201
  const i = e.decode(n);
1202
1202
  if (i < 256) t.push(i);
@@ -1204,10 +1204,10 @@ function ye(e, t, n, r) {
1204
1204
  if (i === 256) return;
1205
1205
  {
1206
1206
  const s = i - 257;
1207
- s >= ve.length && p("A deflate block has a bad length code");
1208
- const o = ve[s] + e.bits(Ct[s]), d = e.decode(r);
1209
- d >= Ie.length && p("A deflate block has a bad distance code");
1210
- const m = Ie[d] + e.bits(St[d]);
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
1211
  m > t.length && p("A deflate block points before its start");
1212
1212
  for (let c = 0; c < o; c++) t.push(t.bytes[t.length - m]);
1213
1213
  }
@@ -1217,14 +1217,14 @@ function ye(e, t, n, r) {
1217
1217
  function p(e) {
1218
1218
  throw new u(e, "PACKET_FIELD");
1219
1219
  }
1220
- const Lt = 200, Ee = 16, Et = [11, 23], Pt = { setState: 1 }, I = { denItem: 1, clothing: 2, gems: 3, crystals: 4 };
1220
+ const Mt = 200, $e = 16, $t = [11, 23], Ft = { setState: 1 }, I = { denItem: 1, clothing: 2, gems: 3, crystals: 4 };
1221
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
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 we(e, t, n) {
1223
+ function Te(e, t, n) {
1224
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
1225
  }
1226
- we("quest.gift-choice", "qpgift", "The player picks a gift on an adventure’s reward screen."), we("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 $(e, t, n, r) {
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
1228
  return a({ name: e, description: n, direction: "toClient", command: t, read: (i) => {
1229
1229
  const s = i.flag("joined");
1230
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() };
@@ -1232,45 +1232,45 @@ function $(e, t, n, r) {
1232
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
1233
  } });
1234
1234
  }
1235
- $("quest.join-result", "qj", "The server says whether the player joined a public adventure.", !0), $("quest.create-private-result", "qjc", "The server says whether the player’s private adventure was created.", !1), $("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) => {
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
1236
  const t = e.int("scriptDefId"), n = e.int("playerCount"), r = e.int("actorCount");
1237
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, () => Mt(e));
1238
+ const i = e.string("timestamp"), s = e.repeat(r, () => Rt(e));
1239
1239
  return { scriptDefId: t, playerCount: n, started: !0, timestamp: i, actors: s, extra: e.rest() };
1240
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) => $t(e, d)) : e.int(-1), e.raw(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
1242
  } });
1243
- function Mt(e) {
1244
- const t = e.string("actorId"), n = e.int("type"), r = n === Ee, i = r ? e.string("defName") : null, s = r ? null : e.int("defId");
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
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
1246
  }
1247
- function $t(e, t) {
1248
- e.string(t.actorId).int(t.type), t.type === Ee ? 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);
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
1249
  }
1250
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 be(e, t, n) {
1251
+ function xe(e, t, n) {
1252
1252
  return a({ name: e, description: n, direction: "toClient", command: t, read: (r) => {
1253
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
1254
  return { popupType: s, gifts: o };
1255
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
1256
  }
1257
- be("quest.rewards", "qpgift", "The adventure’s reward screen opens with its gifts."), be("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 Tt(kt(wt(t))), r = n.readShort();
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
1259
  return { messages: Array.from({ length: Math.max(0, r) }, () => {
1260
1260
  const i = n.readShort(), s = n.readUTF(), o = Array.from({ length: Math.max(0, i - 1) }, () => n.readUTF());
1261
1261
  return { command: s, args: o };
1262
1262
  }), extra: e.rest() };
1263
1263
  }, write: (e, { messages: t, extra: n }) => {
1264
- const r = new xt().writeShort(t.length);
1264
+ const r = new qt().writeShort(t.length);
1265
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(bt(Nt(r.toBytes()))).raw(n);
1266
+ e.string(Nt(Ct(r.toBytes()))).raw(n);
1267
1267
  } }), a({ name: "quest.actor-spawned", description: "An actor appears in the adventure, such as dropped treasure.", direction: "toClient", command: "qspn", read: (e) => {
1268
1268
  const t = e.string("spawnedFrom"), n = e.string("actorId"), r = e.int("type"), i = e.int("defId");
1269
1269
  let s = null, o = null;
1270
- if (r === Lt) {
1270
+ if (r === Mt) {
1271
1271
  const d = e.int("subType");
1272
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 Et.includes(r) && (o = { x: e.number("spawnOffsetX"), y: e.number("spawnOffsetY") });
1273
+ } else $t.includes(r) && (o = { x: e.number("spawnOffsetX"), y: e.number("spawnOffsetY") });
1274
1274
  return { spawnedFrom: t, actorId: n, type: r, defId: i, dropped: s, spawnOffset: o, extra: e.rest() };
1275
1275
  }, write: (e, { spawnedFrom: t, actorId: n, type: r, defId: i, dropped: s, spawnOffset: o, extra: d }) => {
1276
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);
@@ -1280,17 +1280,17 @@ be("quest.rewards", "qpgift", "The adventure’s reward screen opens with its gi
1280
1280
  }, write: (e, { actorId: t, healthPercent: n, damage: r, fierce: i, extra: s }) => {
1281
1281
  e.string(t).int(n), r !== null && (e.int(r), i !== null && e.int(i ? 1 : 0)), e.raw(s);
1282
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 Te(e, t, n, r) {
1283
+ function Ne(e, t, n, r) {
1284
1284
  return a({ name: e, description: n, direction: "toClient", command: t, read: (i) => {
1285
1285
  const s = i.int("command");
1286
- if (s !== Pt.setState || i.remaining < 2) return { command: s, actorId: null, state: null, visible: null, requireClick: null, args: i.rest() };
1286
+ if (s !== Ft.setState || i.remaining < 2) return { command: s, actorId: null, state: null, visible: null, requireClick: null, args: i.rest() };
1287
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
1288
  return { command: s, actorId: o, state: d, visible: c, requireClick: l, args: i.rest() };
1289
1289
  }, write: (i, s) => {
1290
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
1291
  } });
1292
1292
  }
1293
- Te("quest.command", "qcmd", "The adventure’s script tells the client to do something, such as change an actor.", !1), Te("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) });
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
1294
  const T = { askToDrop: 0, pickedUp: 1, droppedAt: 3, placedAt: 4 };
1295
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
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 };
@@ -1301,7 +1301,7 @@ a({ name: "quest.pick-up-result", description: "The server says what came of pic
1301
1301
  }, write: (e, t) => {
1302
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
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 xe(e, t, n, r) {
1304
+ function ke(e, t, n, r) {
1305
1305
  return a({ name: e, description: n, direction: "toClient", command: t, read: (i) => {
1306
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
1307
  return { userId: s, healthPercent: o, change: d, health: m, maxHealth: c, x: g, y: h, extra: i.rest() };
@@ -1309,7 +1309,7 @@ function xe(e, t, n, r) {
1309
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
1310
  } });
1311
1311
  }
1312
- xe("quest.health", "quhp", "A player’s health in the adventure changed.", !1), xe("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) => {
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
1313
  const t = { planted: e.flag("planted"), userName: e.string("userName"), plant: null };
1314
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
1315
  }, write: (e, { planted: t, userName: n, plant: r }) => {
@@ -1318,10 +1318,10 @@ xe("quest.health", "quhp", "A player’s health in the adventure changed.", !1),
1318
1318
  const t = e.int("avatarRefId");
1319
1319
  return { avatarRefId: t === -1 ? null : t, userId: e.int("userId") };
1320
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 D(e, t, n, r) {
1321
+ function B(e, t, n, r) {
1322
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
1323
  }
1324
- D("quest.projectile-launch", "qp", "toServer", "The client says the player threw a weapon in an adventure."), D("quest.projectile-launched", "qp", "toClient", "A player or actor threw a weapon in the adventure."), D("quest.swipe", "qm", "toServer", "The client says the player swung a weapon in an adventure."), D("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: () => {
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
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
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
1327
  const t = e.int("target"), n = e.int("lit") === 1, r = t === 0;
@@ -1330,42 +1330,42 @@ D("quest.projectile-launch", "qp", "toServer", "The client says the player threw
1330
1330
  e.int(t).int(n ? 1 : 0), r !== null ? e.string(r) : e.int(i ?? 0);
1331
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
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 Ft = 8;
1333
+ const zt = 8;
1334
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
1335
  const t = e.flag("joined");
1336
1336
  if (!t) {
1337
1337
  const i = e.remaining > 0 ? e.string("error") : null;
1338
1338
  return { joined: t, joinedRoom: null, details: null, error: i, extra: e.rest() };
1339
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 >= Ft ? Rt(e) : null;
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
1341
  return { joined: t, joinedRoom: n, details: r, error: null, extra: e.rest() };
1342
1342
  }, write: (e, { joined: t, joinedRoom: n, details: r, error: i, extra: s }) => {
1343
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
1344
  } });
1345
- function Rt(e) {
1345
+ function Vt(e) {
1346
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
1347
  }
1348
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
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
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) }), N({ name: "session.version-check", description: "The client says which SmartFox version it speaks.", direction: "toServer", type: "sys", command: "verChk", read: (e) => {
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
1352
  var t, n;
1353
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: " " })] }), N({ 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: () => [] }), N({ name: "session.random-key", description: "The server gives the key the login is signed with.", direction: "toClient", type: "sys", command: "rndK", read: (e) => {
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
1355
  var t, n;
1356
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)] })] }), N({ name: "session.login", description: "The client signs in to a zone with its auth token.", direction: "toServer", type: "sys", command: "login", read: (e) => {
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
1358
  var t, n, r;
1359
1359
  const i = (t = e.body) == null ? void 0 : t.child("login");
1360
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
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
1362
  } });
1363
- const y = { clothing: 1e3, denItems: 1030, denRooms: 1040, currencyExchange: 1051, diamondShop: 1054, combined: 1060 }, Ot = [y.clothing, y.denItems, y.denRooms, y.currencyExchange, y.diamondShop];
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
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 = Ot.indexOf(n) !== -1;
1365
+ const t = e.int("listId"), n = e.int("listType"), r = Kt.indexOf(n) !== -1;
1366
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: K(e.string("diamondCost")) }, s = e.int("count");
1368
- return r ? { ...i, kind: "items", defIds: e.repeat(s, () => e.int("defId")) } : { ...i, kind: "combined", groups: zt(e, s) };
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
1369
  }, write: (e, t) => {
1370
1370
  if (e.int(t.listId).int(t.listType), t.kind === "other") {
1371
1371
  e.raw(t.body);
@@ -1377,12 +1377,12 @@ a({ name: "shop.list-request", description: "The player asks for a shop’s cont
1377
1377
  }
1378
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
1379
  } });
1380
- function zt(e, t) {
1380
+ function _t(e, t) {
1381
1381
  if (t === 0) return [];
1382
1382
  const n = e.string("groupTypes").split(","), r = e.string("groupCounts").split(",");
1383
- return n.map((i, s) => ({ listType: K(i), defIds: e.repeat(K(r[s] ?? ""), () => e.int("defId")) }));
1383
+ return n.map((i, s) => ({ listType: W(i), defIds: e.repeat(W(r[s] ?? ""), () => e.int("defId")) }));
1384
1384
  }
1385
- function K(e) {
1385
+ function W(e) {
1386
1386
  const t = Number(e);
1387
1387
  return Number.isInteger(t) ? t : 0;
1388
1388
  }
@@ -1409,17 +1409,17 @@ a({ name: "shop.den-shop-update-request", description: "The player adds, reprice
1409
1409
  e.int(t.status), t.status === 1 && e.string(t.ownerUserName).int(t.storeInvId).raw(t.rest);
1410
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
1411
  const t = e.int("defId"), n = e.int("invIdx");
1412
- return { defId: t, invIdx: n, ...G(e) };
1412
+ return { defId: t, invIdx: n, ...X(e) };
1413
1413
  }), pets: e.repeat(e.int("pets"), () => {
1414
- const t = e.int("defId"), n = e.int("invIdx"), r = e.number("createdAt"), i = W(e), s = e.string("name");
1415
- return { defId: t, invIdx: n, createdAt: r, bits: i, name: s, ...H(e) };
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
1416
  }) }), write: (e, { userName: t, clothing: n, den: r, pets: i }) => {
1417
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), X(e, s);
1418
+ e.int(s.defId).int(s.invIdx ?? -1), J(e, s);
1419
1419
  }), e.int(i.length), i.forEach((s) => {
1420
- e.int(s.defId).int(s.invIdx).number(s.createdAt), J(e, s), e.string(s.name), Y(e, s);
1420
+ e.int(s.defId).int(s.invIdx).number(s.createdAt), Y(e, s), e.string(s.name), Z(e, s);
1421
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"), () => F(e)), added: e.repeat(e.int("added"), () => F(e)) }), write: (e, { removed: t, added: n }) => {
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
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
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
1425
  const t = e.int("action");
@@ -1456,10 +1456,10 @@ a({ name: "shop.den-shop-update-request", description: "The player adds, reprice
1456
1456
  const t = e.int("status");
1457
1457
  switch (t) {
1458
1458
  case 0:
1459
- return { kind: "offer", status: 0, offer: Vt(e) };
1459
+ return { kind: "offer", status: 0, offer: Wt(e) };
1460
1460
  case 1: {
1461
1461
  if (e.int("stage") === 0) return { kind: "confirm", status: 1 };
1462
- const n = e.repeat(e.int("received"), () => _t(e)), r = e.repeat(e.int("removed"), () => F(e));
1462
+ const n = e.repeat(e.int("received"), () => Xt(e)), r = e.repeat(e.int("removed"), () => O(e));
1463
1463
  return { kind: "completed", status: 1, received: n, removed: r, extra: e.rest() };
1464
1464
  }
1465
1465
  case 6:
@@ -1472,13 +1472,13 @@ a({ name: "shop.den-shop-update-request", description: "The player adds, reprice
1472
1472
  }, write: (e, t) => {
1473
1473
  switch (e.int(t.status), t.kind) {
1474
1474
  case "offer":
1475
- Kt(e, t.offer);
1475
+ Gt(e, t.offer);
1476
1476
  return;
1477
1477
  case "confirm":
1478
1478
  e.int(0);
1479
1479
  return;
1480
1480
  case "completed":
1481
- e.int(1).int(t.received.length), t.received.forEach((n) => Gt(e, n)), e.int(t.removed.length), t.removed.forEach((n) => e.int(n.itemType).int(n.invIdx)), e.raw(t.extra);
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
1482
  return;
1483
1483
  case "closed":
1484
1484
  e.raw(t.extra);
@@ -1491,79 +1491,79 @@ a({ name: "shop.den-shop-update-request", description: "The player adds, reprice
1491
1491
  return;
1492
1492
  }
1493
1493
  } });
1494
- function Vt(e) {
1494
+ function Wt(e) {
1495
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, ...G(e) })), pets: e.repeat(d, () => {
1497
- const m = e.number("createdAt"), c = e.int("defId"), l = e.int("invIdx"), g = W(e), h = H(e);
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
1498
  return { defId: c, invIdx: l, createdAt: m, bits: g, name: e.string("name"), ...h };
1499
1499
  }) } };
1500
1500
  }
1501
- function Kt(e, t) {
1501
+ function Gt(e, t) {
1502
1502
  const { clothing: n, den: r, pets: i } = t.offered;
1503
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), X(e, s);
1504
+ e.int(s.defId), J(e, s);
1505
1505
  }), i.forEach((s) => {
1506
- e.number(s.createdAt).int(s.defId).int(s.invIdx), J(e, s), Y(e, s), e.string(s.name);
1506
+ e.number(s.createdAt).int(s.defId).int(s.invIdx), Y(e, s), Z(e, s), e.string(s.name);
1507
1507
  });
1508
1508
  }
1509
- function _t(e) {
1509
+ function Xt(e) {
1510
1510
  const t = e.int("type");
1511
1511
  switch (t) {
1512
1512
  case 0:
1513
1513
  return { type: "clothing", defId: e.int("defId"), invIdx: e.int("invIdx"), color: e.int("color") };
1514
1514
  case 1: {
1515
1515
  const n = e.int("invIdx");
1516
- return { type: "den", defId: e.int("defId"), invIdx: n, ...G(e) };
1516
+ return { type: "den", defId: e.int("defId"), invIdx: n, ...X(e) };
1517
1517
  }
1518
1518
  case 2: {
1519
- const n = e.number("createdAt"), r = e.int("invIdx"), i = e.int("defId"), s = W(e), o = H(e);
1519
+ const n = e.number("createdAt"), r = e.int("invIdx"), i = e.int("defId"), s = H(e), o = Q(e);
1520
1520
  return { type: "pet", defId: i, invIdx: r, createdAt: n, bits: s, name: e.string("name"), ...o };
1521
1521
  }
1522
1522
  default:
1523
1523
  throw new u(`trade.result: unknown received item type ${t}`, "PACKET_FIELD");
1524
1524
  }
1525
1525
  }
1526
- function Gt(e, t) {
1526
+ function Jt(e, t) {
1527
1527
  switch (t.type) {
1528
1528
  case "clothing":
1529
1529
  e.int(0).int(t.defId).int(t.invIdx ?? -1).int(t.color);
1530
1530
  return;
1531
1531
  case "den":
1532
- e.int(1).int(t.invIdx ?? -1).int(t.defId), X(e, t);
1532
+ e.int(1).int(t.invIdx ?? -1).int(t.defId), J(e, t);
1533
1533
  return;
1534
1534
  case "pet":
1535
- e.int(2).number(t.createdAt).int(t.invIdx).int(t.defId), J(e, t), Y(e, t), e.string(t.name);
1535
+ e.int(2).number(t.createdAt).int(t.invIdx).int(t.defId), Y(e, t), Z(e, t), e.string(t.name);
1536
1536
  return;
1537
1537
  }
1538
1538
  }
1539
- function F(e) {
1539
+ function O(e) {
1540
1540
  return { itemType: e.int("itemType"), invIdx: e.int("invIdx") };
1541
1541
  }
1542
- function G(e) {
1542
+ function X(e) {
1543
1543
  return { version: e.int("version"), approved: e.string("approved") === "true", uniqueImageId: e.string("uniqueImageId"), creatorDbId: e.int("creatorDbId"), creatorUuid: e.string("creatorUuid") };
1544
1544
  }
1545
- function X(e, t) {
1545
+ function J(e, t) {
1546
1546
  e.int(t.version).string(t.approved ? "true" : "false").string(t.uniqueImageId).int(t.creatorDbId).string(t.creatorUuid);
1547
1547
  }
1548
- function W(e) {
1548
+ function H(e) {
1549
1549
  return [e.int("bits1"), e.int("bits2"), e.int("bits3")];
1550
1550
  }
1551
- function J(e, t) {
1551
+ function Y(e, t) {
1552
1552
  e.int(t.bits[0]).int(t.bits[1]).int(t.bits[2]);
1553
1553
  }
1554
- function H(e) {
1554
+ function Q(e) {
1555
1555
  return { traitDefId: e.int("traitDefId"), toyDefId: e.int("toyDefId"), foodDefId: e.int("foodDefId") };
1556
1556
  }
1557
- function Y(e, t) {
1557
+ function Z(e, t) {
1558
1558
  e.int(t.traitDefId).int(t.toyDefId).int(t.foodDefId);
1559
1559
  }
1560
1560
  a({ name: "world.room-count-request", description: "The player asks how many are in each room.", direction: "toServer", command: "rc", read: () => ({}), write: () => {
1561
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
1562
  } });
1563
- const R = 4;
1563
+ const z = 4;
1564
1564
  a({ name: "world.shard-list", description: "The server lists the shards on each server node.", direction: "toClient", command: "rm", read: (e) => {
1565
1565
  const t = e.rest(), n = t[0];
1566
- return n !== void 0 && Pe(n) ? { status: new x(t, "world.shard-list").int("status"), nodes: [] } : { status: null, nodes: Xt(t) };
1566
+ return n !== void 0 && Fe(n) ? { status: new k(t, "world.shard-list").int("status"), nodes: [] } : { status: null, nodes: Ht(t) };
1567
1567
  }, write: (e, { status: t, nodes: n }) => {
1568
1568
  if (t !== null) {
1569
1569
  e.int(t);
@@ -1571,21 +1571,21 @@ a({ name: "world.shard-list", description: "The server lists the shards on each
1571
1571
  }
1572
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
1573
  } });
1574
- function Xt(e) {
1574
+ function Ht(e) {
1575
1575
  const t = [];
1576
1576
  let n = 0;
1577
1577
  for (; n < e.length; ) {
1578
1578
  const r = e[n++];
1579
1579
  let i = n;
1580
- for (; i < e.length && Pe(e[i]); ) i++;
1580
+ for (; i < e.length && Fe(e[i]); ) i++;
1581
1581
  const s = i - n;
1582
- if (s % R !== 0) throw new u(`world.shard-list: node "${r}" has ${s} numbers, not shards of ${R}`, "PACKET_FIELD");
1583
- const o = new x(e.slice(n, i), "world.shard-list"), d = o.repeat(s / R, () => ({ id: o.int("id"), language: o.int("language"), population: o.int("population"), buddies: o.int("buddies") }));
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
1584
  t.push({ host: r, shards: d }), n = i;
1585
1585
  }
1586
1586
  return t;
1587
1587
  }
1588
- function Pe(e) {
1588
+ function Fe(e) {
1589
1589
  return e.trim() !== "" && Number.isFinite(Number(e));
1590
1590
  }
1591
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: () => {
@@ -1595,12 +1595,12 @@ a({ name: "world.node-hop-request", description: "The player asks to move off a
1595
1595
  }, write: (e, { result: t, token: n, read: r, write: i, userName: s, extra: o }) => {
1596
1596
  e.string(t), t === "1" && e.string(n ?? "").string(r ? "1" : "0").string(i ? "1" : "0").string(s ?? ""), e.raw(o);
1597
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 ? Wt(e.string("creator")) : null;
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
1599
  return { resourceType: t, resourceId: n, userUuid: r, detail: i, creator: s, extra: e.rest() };
1600
1600
  }, write: (e, { resourceType: t, resourceId: n, userUuid: r, detail: i, creator: s, extra: o }) => {
1601
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
1602
  } });
1603
- function Wt(e) {
1603
+ function Yt(e) {
1604
1604
  const t = e.split(","), [n = "", r = "", i = ""] = t, s = Number(n), o = Number(i);
1605
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
1606
  return { version: s, creatorUuid: r, creatorDbId: o };
@@ -1609,39 +1609,59 @@ a({ name: "resource-array.put", description: "The server says whether a like was
1609
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
1610
  e.int(t), n !== null && e.string(n);
1611
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 ? Jt(e.string("referrals")) : null }), write: (e, { status: t, referrals: n }) => {
1613
- e.int(t), n !== null && e.string(Ht(n));
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
1614
  } });
1615
- function Jt(e) {
1615
+ function Qt(e) {
1616
1616
  let t;
1617
1617
  try {
1618
1618
  t = JSON.parse(e);
1619
1619
  } catch {
1620
1620
  throw new u(`referral.list: field "referrals" is not JSON ("${e}")`, "PACKET_FIELD");
1621
1621
  }
1622
- const n = Ne(t) ? t.referrals : null;
1623
- return Array.isArray(n) ? n.filter(Ne).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 : "" })) : [];
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
1624
  }
1625
- function Ht(e) {
1625
+ function Zt(e) {
1626
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
1627
  }
1628
- function Ne(e) {
1628
+ function qe(e) {
1629
1629
  return typeof e == "object" && e !== null && !Array.isArray(e);
1630
1630
  }
1631
- const Yt = { 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(Yt).map(([e, t]) => [t, e])), new Set(Object.values(y));
1633
- class Zt extends Error {
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 {
1634
1653
  constructor(t, n) {
1635
1654
  super(n), this.code = t, this.name = "PluginError";
1636
1655
  }
1637
1656
  code;
1638
1657
  }
1639
1658
  export {
1640
- Qt as C,
1641
- Ue as M,
1659
+ an as C,
1660
+ Le as M,
1642
1661
  u as P,
1643
1662
  b as X,
1644
- L as a,
1645
- j as b,
1646
- Zt as c
1663
+ P as a,
1664
+ E as b,
1665
+ on as c,
1666
+ sn as r
1647
1667
  };