overlay-toolkit 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/otk.d.ts CHANGED
@@ -41,6 +41,11 @@ export declare class OverlayToolkit {
41
41
  * Game version
42
42
  */
43
43
  GetGameVersion(): Promise<GameVersion>;
44
+ /**
45
+ * Plugin version
46
+ * @returns get plugin version
47
+ */
48
+ GetPluginVersion(): Promise<string>;
44
49
  /**
45
50
  * Call start overlay events
46
51
  *
@@ -1,8 +1,8 @@
1
1
  var I = Object.defineProperty;
2
- var m = (s, r, e) => r in s ? I(s, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[r] = e;
3
- var t = (s, r, e) => m(s, typeof r != "symbol" ? r + "" : r, e);
4
- function w(s) {
5
- return new y(s);
2
+ var m = (r, s, e) => s in r ? I(r, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[s] = e;
3
+ var t = (r, s, e) => m(r, typeof s != "symbol" ? s + "" : s, e);
4
+ function w(r) {
5
+ return new y(r);
6
6
  }
7
7
  class y extends EventTarget {
8
8
  //#endregion
@@ -24,7 +24,7 @@ class y extends EventTarget {
24
24
  if (this.devices.has(i.instanceId))
25
25
  a.push(this.devices.get(i.instanceId));
26
26
  else {
27
- const c = new p(this.api, i);
27
+ const c = new h(this.api, i);
28
28
  this.devices.set(i.instanceId, c), a.push(c);
29
29
  }
30
30
  }), a;
@@ -44,19 +44,19 @@ class y extends EventTarget {
44
44
  }
45
45
  callbackDeviceChanged(e) {
46
46
  var a = e.add;
47
- const i = new p(this.api, e.device), c = new v(a ? "connect" : "disconnect", i);
47
+ const i = new h(this.api, e.device), c = new v(a ? "connect" : "disconnect", i);
48
48
  this.dispatchEvent(c);
49
49
  }
50
50
  }
51
- async function d(s, r, e) {
51
+ async function d(r, s, e) {
52
52
  const a = {
53
53
  call: "otk::hid",
54
- type: r,
54
+ type: s,
55
55
  ...e
56
- }, i = await s.callOverlayHandler(a);
57
- return i.error && console.log("callOverlayHID error:", r, e, i), i;
56
+ }, i = await r.callOverlayHandler(a);
57
+ return i.error && console.log("callOverlayHID error:", s, e, i), i;
58
58
  }
59
- class p extends EventTarget {
59
+ class h extends EventTarget {
60
60
  //#endregion
61
61
  // Simulate a device with some properties
62
62
  constructor(e, a) {
@@ -129,46 +129,46 @@ class x extends Event {
129
129
  this.device = a, this.reportId = i, this.data = c;
130
130
  }
131
131
  }
132
- function u(s) {
133
- let r = null;
134
- return s instanceof ArrayBuffer ? r = new Uint8Array(s) : r = new Uint8Array(s.buffer, s.byteOffset, s.byteLength), [...r].map((e) => e.toString(16).padStart(2, "0")).join("");
132
+ function u(r) {
133
+ let s = null;
134
+ return r instanceof ArrayBuffer ? s = new Uint8Array(r) : s = new Uint8Array(r.buffer, r.byteOffset, r.byteLength), [...s].map((e) => e.toString(16).padStart(2, "0")).join("");
135
135
  }
136
- function o(s) {
137
- const r = new Uint8Array(Math.ceil(s.length / 2));
138
- for (let e = 0; e < s.length; )
139
- r[e / 2] = Number.parseInt(s.slice(e, e += 2), 16);
140
- return r;
136
+ function o(r) {
137
+ const s = new Uint8Array(Math.ceil(r.length / 2));
138
+ for (let e = 0; e < r.length; )
139
+ s[e / 2] = Number.parseInt(r.slice(e, e += 2), 16);
140
+ return s;
141
141
  }
142
142
  class f {
143
- constructor(r = null) {
143
+ constructor(s = null) {
144
144
  t(this, "subscribers", /* @__PURE__ */ new Map());
145
145
  t(this, "queue", []);
146
- this.transport = r, r && this.setTransport(r);
146
+ this.transport = s, s && this.setTransport(s);
147
147
  }
148
- setTransport(r) {
149
- this.transport = r, this.transport.addEventListener("message", (e) => {
148
+ setTransport(s) {
149
+ this.transport = s, this.transport.addEventListener("message", (e) => {
150
150
  this.dispatchOverlayEvent(e.detail);
151
151
  }), this.transport.addEventListener("connected", this.onTransportConnected.bind(this));
152
152
  }
153
- dispatchOverlayEvent(r) {
154
- const e = this.subscribers.get(r.type);
153
+ dispatchOverlayEvent(s) {
154
+ const e = this.subscribers.get(s.type);
155
155
  if (e)
156
156
  for (const a of e)
157
- a(r);
157
+ a(s);
158
158
  }
159
- addOverlayListener(r, e) {
160
- this.subscribers.has(r) || this.subscribers.set(r, []), this.subscribers.get(r).push(e);
159
+ addOverlayListener(s, e) {
160
+ this.subscribers.has(s) || this.subscribers.set(s, []), this.subscribers.get(s).push(e);
161
161
  }
162
- removeOverlayListener(r, e) {
163
- if (!this.subscribers.has(r))
162
+ removeOverlayListener(s, e) {
163
+ if (!this.subscribers.has(s))
164
164
  return;
165
- const a = this.subscribers.get(r), i = a.indexOf(e);
165
+ const a = this.subscribers.get(s), i = a.indexOf(e);
166
166
  i !== -1 && a.splice(i, 1);
167
167
  }
168
- async callOverlayHandler(r) {
169
- return !this.transport || !this.transport.connected ? (console.warn("OverlayPluginAPI: Transport not connected, queuing message", r), new Promise((a) => {
170
- this.queue.push([r, a]);
171
- })) : this.transport.sendMessage(r);
168
+ async callOverlayHandler(s) {
169
+ return !this.transport || !this.transport.connected ? (console.warn("OverlayPluginAPI: Transport not connected, queuing message", s), new Promise((a) => {
170
+ this.queue.push([s, a]);
171
+ })) : this.transport.sendMessage(s);
172
172
  }
173
173
  /**
174
174
  * Start overlay events
@@ -176,19 +176,19 @@ class f {
176
176
  * Must be called after any listeners are added.
177
177
  */
178
178
  startOverlayEvents() {
179
- var r = {
179
+ var s = {
180
180
  call: "subscribe",
181
181
  events: Array.from(this.subscribers.keys())
182
182
  };
183
- this.callOverlayHandler(r);
183
+ this.callOverlayHandler(s);
184
184
  }
185
185
  onTransportConnected() {
186
186
  if (!this.transport || !this.transport.connected || this.queue.length === 0)
187
187
  return;
188
188
  console.log("OverlayPluginAPI: Transport connected, sending queued messages");
189
- let r = this.queue;
189
+ let s = this.queue;
190
190
  this.queue = [];
191
- for (let [e, a] of r)
191
+ for (let [e, a] of s)
192
192
  this.transport.sendMessage(e).then(a);
193
193
  }
194
194
  }
@@ -266,7 +266,7 @@ class P extends EventTarget {
266
266
  this.evtHandler = e;
267
267
  }
268
268
  }
269
- class N {
269
+ class k {
270
270
  constructor() {
271
271
  /**
272
272
  * HID interface
@@ -282,10 +282,10 @@ class N {
282
282
  * @param options options
283
283
  * @returns response
284
284
  */
285
- Fetch(r, e = {}) {
285
+ Fetch(s, e = {}) {
286
286
  const a = {
287
287
  call: "Fetch",
288
- resource: r,
288
+ resource: s,
289
289
  options: e
290
290
  };
291
291
  return this.api.callOverlayHandler(a);
@@ -297,45 +297,63 @@ class N {
297
297
  * @param handler callback when packet is send/receive
298
298
  * @returns subscription name
299
299
  */
300
- async SubscribePacket(r, e, a) {
300
+ async SubscribePacket(s, e, a) {
301
301
  const i = {
302
302
  call: "otk::packet",
303
303
  action: "subscribe",
304
- name: r,
304
+ name: s,
305
+ evt_name: "otk::packet::" + s,
305
306
  filters: e
306
307
  }, c = await this.api.callOverlayHandler(i);
307
308
  if (c.error)
308
309
  throw new Error(c.error);
309
- return this.handlerMap.set(c.name || r, a), c.name || r;
310
+ return c.evt_name ? (this.api.addOverlayListener(c.evt_name, (p) => this.packetHandler(p, !1)), this.api.startOverlayEvents()) : console.warn("plugin does not support evt_name for packet subscription, may < 0.4.0"), this.handlerMap.set(c.name || s, {
311
+ handler: a,
312
+ evt_name: c.evt_name
313
+ }), c.name || s;
310
314
  }
311
315
  /**
312
316
  * Unsubscribe from game packets
313
317
  * @param name subscription name
314
318
  */
315
- async UnsubscribePacket(r) {
319
+ async UnsubscribePacket(s) {
316
320
  const e = {
317
321
  call: "otk::packet",
318
322
  action: "unsubscribe",
319
- name: r
323
+ name: s
320
324
  }, a = await this.api.callOverlayHandler(e);
321
325
  if (a.error)
322
326
  throw new Error(a.error);
323
- this.handlerMap.delete(r);
324
- }
325
- packetHandler(r) {
326
- let e = r, a = r;
327
- a.data = Uint8Array.from(atob(e.msg), (c) => c.charCodeAt(0));
328
- let i = this.handlerMap.get(e.name);
329
- i ? i(a) : console.warn("No packet handler for name", e.name);
327
+ this.handlerMap.delete(s);
328
+ }
329
+ packetHandler(s, e = !1) {
330
+ let a = s, i = s;
331
+ i.data = Uint8Array.from(atob(a.msg), (p) => p.charCodeAt(0));
332
+ let c = this.handlerMap.get(a.name);
333
+ if (c) {
334
+ if (e && c.evt_name)
335
+ return;
336
+ c.handler(i);
337
+ } else e || console.warn("No packet handler for name", a.name);
330
338
  }
331
339
  /**
332
340
  * Game version
333
341
  */
334
342
  async GetGameVersion() {
335
- const r = {
343
+ const s = {
336
344
  call: "otk::game_ver"
337
345
  };
338
- return this.api.callOverlayHandler(r);
346
+ return this.api.callOverlayHandler(s);
347
+ }
348
+ /**
349
+ * Plugin version
350
+ * @returns get plugin version
351
+ */
352
+ async GetPluginVersion() {
353
+ const s = {
354
+ call: "otk::plugin_ver"
355
+ };
356
+ return (await this.api.callOverlayHandler(s)).version;
339
357
  }
340
358
  /**
341
359
  * Call start overlay events
@@ -343,15 +361,15 @@ class N {
343
361
  * Must be called after any listeners are added
344
362
  */
345
363
  Start() {
346
- this.api.addOverlayListener("otk::packet", (r) => this.packetHandler(r)), this.api.startOverlayEvents();
364
+ this.api.addOverlayListener("otk::packet", (s) => this.packetHandler(s, !0)), this.api.startOverlayEvents();
347
365
  }
348
366
  /**
349
367
  * Call dispatch overlay event
350
368
  *
351
369
  * @param msg The message to dispatch
352
370
  */
353
- Dispatch(r) {
354
- this.api.dispatchOverlayEvent(r);
371
+ Dispatch(s) {
372
+ this.api.dispatchOverlayEvent(s);
355
373
  }
356
374
  /**
357
375
  * Add an overlay listener
@@ -359,24 +377,24 @@ class N {
359
377
  * @param event
360
378
  * @param cb
361
379
  */
362
- AddListener(r, e) {
363
- this.api.addOverlayListener(r, e);
380
+ AddListener(s, e) {
381
+ this.api.addOverlayListener(s, e);
364
382
  }
365
383
  /**
366
384
  * Remove an overlay listener
367
385
  * @param event
368
386
  * @param cb
369
387
  */
370
- RemoveListener(r, e) {
371
- this.api.removeOverlayListener(r, e);
388
+ RemoveListener(s, e) {
389
+ this.api.removeOverlayListener(s, e);
372
390
  }
373
391
  /**
374
392
  * Call overlay handler
375
393
  * @param msg
376
394
  * @returns
377
395
  */
378
- Call(r) {
379
- return this.api.callOverlayHandler(r);
396
+ Call(s) {
397
+ return this.api.callOverlayHandler(s);
380
398
  }
381
399
  /**
382
400
  * Get if running in OverlayPlugin CEF environment
@@ -390,37 +408,37 @@ class N {
390
408
  setTimeout(() => this.tryConnectToCEF(), 300);
391
409
  return;
392
410
  }
393
- const r = new D();
394
- this.api.setTransport(r), r.waitForApi();
411
+ const s = new D();
412
+ this.api.setTransport(s), s.waitForApi();
395
413
  }
396
414
  /**
397
415
  * Connect to OverlayPlugin via CEF or WebSocket
398
416
  * @param wsUrl WebSocket URL, leave empty to auto-detect from query string
399
417
  * @returns
400
418
  */
401
- Connect(r = "") {
402
- if (this.tryConnectToCEF(), r || (r = new URLSearchParams(location.search).get("OVERLAY_WS")), r) {
419
+ Connect(s = "") {
420
+ if (this.tryConnectToCEF(), s || (s = new URLSearchParams(location.search).get("OVERLAY_WS")), s) {
403
421
  if (this.IsOverlayPluginCEF()) {
404
422
  console.warn("OverlayToolkit: Connect wsUrl ignored in OverlayPlugin CEF environment");
405
423
  return;
406
424
  }
407
- const e = new P(r);
425
+ const e = new P(s);
408
426
  this.api.setTransport(e);
409
427
  }
410
428
  }
411
429
  }
412
430
  class n {
413
- constructor(r, e) {
431
+ constructor(s, e) {
414
432
  t(this, "type");
415
433
  t(this, "typeCode");
416
434
  t(this, "time");
417
- this.typeCode = parseInt(e[0]), this.time = e[1], this.type = r;
435
+ this.typeCode = parseInt(e[0]), this.time = e[1], this.type = s;
418
436
  }
419
437
  get timeDate() {
420
438
  return new Date(this.time);
421
439
  }
422
440
  }
423
- class k extends n {
441
+ class N extends n {
424
442
  constructor(e) {
425
443
  super("LogLine", e);
426
444
  t(this, "code");
@@ -429,7 +447,7 @@ class k extends n {
429
447
  this.code = e[2], this.name = e[3], this.line = e[4];
430
448
  }
431
449
  }
432
- class C extends n {
450
+ class l extends n {
433
451
  constructor(e) {
434
452
  super("ChangeZone", e);
435
453
  /**
@@ -443,7 +461,7 @@ class C extends n {
443
461
  this.zoneID = parseInt(e[2], 16), this.zoneName = e[3];
444
462
  }
445
463
  }
446
- class b extends n {
464
+ class C extends n {
447
465
  constructor(e) {
448
466
  super("ChangePrimaryPlayer", e);
449
467
  /**
@@ -460,7 +478,7 @@ class b extends n {
460
478
  return this.charID.toString(16).toUpperCase();
461
479
  }
462
480
  }
463
- class l extends n {
481
+ class b extends n {
464
482
  constructor(e) {
465
483
  super("AddCombatant", e);
466
484
  /**
@@ -612,7 +630,7 @@ class T extends n {
612
630
  this.targetCurrentHP = parseInt(e[24]), this.targetMaxHP = parseInt(e[25]), this.targetCurrentMP = parseInt(e[26]), this.targetMaxMP = parseInt(e[27]), this.targetX = parseFloat(e[30]), this.targetY = parseFloat(e[31]), this.targetZ = parseFloat(e[32]), this.targetHeading = parseFloat(e[33]), this.currentHP = parseInt(e[34]), this.maxHP = parseInt(e[35]), this.currentMP = parseInt(e[36]), this.maxMP = parseInt(e[37]), this.x = parseFloat(e[40]), this.y = parseFloat(e[41]), this.z = parseFloat(e[42]), this.heading = parseFloat(e[43]), this.sequence = parseInt(e[44], 16), this.targetIndex = parseInt(e[45]), this.targetCount = parseInt(e[46]), this.ownerID = parseInt(e[47], 16), this.ownerName = e[48], this.effectDisplayType = parseInt(e[49]), this.actionID = parseInt(e[50], 16), this.actionAnimationID = parseInt(e[51], 16), this.animationLockTime = parseFloat(e[52]), this.rotationHex = parseInt(e[53], 16);
613
631
  }
614
632
  }
615
- class S extends n {
633
+ class O extends n {
616
634
  constructor(e) {
617
635
  super("NetworkCancelAbility", e);
618
636
  t(this, "sourceID");
@@ -623,7 +641,7 @@ class S extends n {
623
641
  this.sourceID = parseInt(e[2], 16), this.source = e[3], this.id = parseInt(e[4], 16), this.name = e[5], this.reason = e[6];
624
642
  }
625
643
  }
626
- class L extends n {
644
+ class S extends n {
627
645
  constructor(e) {
628
646
  super("NetworkDoT", e);
629
647
  t(this, "id");
@@ -657,7 +675,7 @@ class L extends n {
657
675
  this.id = parseInt(e[2], 16), this.name = e[3], this.which = e[4], this.effectID = parseInt(e[5], 16), this.damage = parseInt(e[6]), this.currentHP = parseInt(e[7]), this.maxHP = parseInt(e[8]), this.currentMP = parseInt(e[9]), this.maxMP = parseInt(e[10]), this.x = parseFloat(e[13]), this.y = parseFloat(e[14]), this.z = parseFloat(e[15]), this.heading = parseFloat(e[16]), this.sourceID = parseInt(e[17], 16), this.sourceName = e[18], this.damageType = parseInt(e[19], 16), this.sourceCurrentHP = parseInt(e[20]), this.sourceMaxHP = parseInt(e[21]), this.sourceCurrentMP = parseInt(e[22]), this.sourceMaxMP = parseInt(e[23]), this.sourceX = parseFloat(e[26]), this.sourceY = parseFloat(e[27]), this.sourceZ = parseFloat(e[28]), this.sourceHeading = parseFloat(e[29]);
658
676
  }
659
677
  }
660
- class O extends n {
678
+ class L extends n {
661
679
  constructor(e) {
662
680
  super("NetworkDeath", e);
663
681
  t(this, "targetID");
@@ -683,7 +701,7 @@ class A extends n {
683
701
  this.effectID = parseInt(e[2], 16), this.effectName = e[3], this.duration = parseFloat(e[4]), this.sourceID = parseInt(e[5], 16), this.sourceName = e[6], this.targetID = parseInt(e[7], 16), this.targetName = e[8], this.count = parseInt(e[9]), this.targetMaxHP = parseInt(e[10] == "" ? "-1" : e[10]), this.sourceMaxHP = parseInt(e[11] == "" ? "-1" : e[11]);
684
702
  }
685
703
  }
686
- class z extends n {
704
+ class q extends n {
687
705
  constructor(e) {
688
706
  super("NetworkTargetIcon", e);
689
707
  t(this, "targetID");
@@ -693,7 +711,7 @@ class z extends n {
693
711
  this.targetID = parseInt(e[2], 16), this.targetName = e[3], this.id = parseInt(e[6], 16), this.data0 = parseInt(e[7], 16);
694
712
  }
695
713
  }
696
- class q extends n {
714
+ class z extends n {
697
715
  constructor(e) {
698
716
  super("NetworkRaidMarker", e);
699
717
  t(this, "operation");
@@ -760,7 +778,7 @@ class j extends n {
760
778
  this.data.push(parseInt(e[4 + a], 16));
761
779
  }
762
780
  }
763
- class G extends n {
781
+ class _ extends n {
764
782
  constructor(e) {
765
783
  super("NetworkNameToggle", e);
766
784
  t(this, "id");
@@ -774,7 +792,7 @@ class G extends n {
774
792
  this.id = parseInt(e[2], 16), this.name = e[3], this.targetID = parseInt(e[4], 16), this.targetName = e[5], this.toggle = parseInt(e[6]) === 1;
775
793
  }
776
794
  }
777
- class W extends n {
795
+ class G extends n {
778
796
  constructor(e) {
779
797
  super("NetworkTether", e);
780
798
  t(this, "sourceID");
@@ -796,7 +814,7 @@ class V extends n {
796
814
  this.value = parseInt(e[2], 16), this.bars = parseInt(e[3]);
797
815
  }
798
816
  }
799
- class Y extends n {
817
+ class W extends n {
800
818
  constructor(e) {
801
819
  super("NetworkActionSync", e);
802
820
  t(this, "id");
@@ -814,7 +832,7 @@ class Y extends n {
814
832
  this.id = parseInt(e[2], 16), this.name = e[3], this.sequenceID = parseInt(e[4], 16), this.currentHP = e[5] ? parseInt(e[5]) : -1, this.maxHP = e[6] ? parseInt(e[6]) : -1, this.currentMP = e[7] ? parseInt(e[7]) : -1, this.maxMP = e[8] ? parseInt(e[8]) : -1, this.currentShield = e[9] ? parseInt(e[9]) : -1, this.x = parseFloat(e[11]), this.y = parseFloat(e[12]), this.z = parseFloat(e[13]), this.heading = parseFloat(e[14]);
815
833
  }
816
834
  }
817
- class Z extends n {
835
+ class Y extends n {
818
836
  constructor(e) {
819
837
  super("NetworkStatusEffects", e);
820
838
  t(this, "targetID");
@@ -836,7 +854,7 @@ class Z extends n {
836
854
  this.data.push(parseInt(e[15 + a], 16));
837
855
  }
838
856
  }
839
- class X extends n {
857
+ class Z extends n {
840
858
  constructor(e) {
841
859
  super("NetworkUpdateHP", e);
842
860
  t(this, "id");
@@ -854,7 +872,7 @@ class X extends n {
854
872
  this.id = parseInt(e[2], 16), this.name = e[3], this.currentHP = parseInt(e[4]), this.maxHP = parseInt(e[5]), this.currentMP = parseInt(e[6]), this.maxMP = parseInt(e[7]), this.x = parseFloat(e[10]), this.y = parseFloat(e[11]), this.z = parseFloat(e[12]), this.heading = parseFloat(e[13]);
855
873
  }
856
874
  }
857
- class _ extends n {
875
+ class X extends n {
858
876
  constructor(e) {
859
877
  super("Map", e);
860
878
  t(this, "id");
@@ -904,8 +922,8 @@ class Q extends n {
904
922
  this.len = parseInt(e[2], 16), this.src = parseInt(e[3], 16), this.dst = parseInt(e[4], 16), this.packetType = parseInt(e[5], 16) & 65535, this.data = new Uint8Array(this.len - 16);
905
923
  for (let a = 6, i = 0; a < e.length - 2; a++, i++) {
906
924
  const c = parseInt(e[a], 16);
907
- for (let h = 0; h < 4; h++)
908
- this.data[i * 4 + h] = c >> h * 8 & 255;
925
+ for (let p = 0; p < 4; p++)
926
+ this.data[i * 4 + p] = c >> p * 8 & 255;
909
927
  }
910
928
  }
911
929
  }
@@ -1000,7 +1018,7 @@ class ce extends n {
1000
1018
  this.locale = e[2], this.unknown = parseInt(e[3], 16), this.key = e[4], this.value = e[5];
1001
1019
  }
1002
1020
  }
1003
- class he extends n {
1021
+ class pe extends n {
1004
1022
  constructor(e) {
1005
1023
  super("StartsUsingExtra", e);
1006
1024
  t(this, "sourceID");
@@ -1012,7 +1030,7 @@ class he extends n {
1012
1030
  this.sourceID = parseInt(e[2], 16), this.id = parseInt(e[3], 16), this.x = parseFloat(e[4]), this.y = parseFloat(e[5]), this.z = parseFloat(e[6]), this.heading = parseFloat(e[7]);
1013
1031
  }
1014
1032
  }
1015
- class pe extends n {
1033
+ class he extends n {
1016
1034
  constructor(e) {
1017
1035
  super("AbilityExtra", e);
1018
1036
  t(this, "sourceID");
@@ -1150,130 +1168,130 @@ class De extends n {
1150
1168
  this.rawLines = e;
1151
1169
  }
1152
1170
  }
1153
- function Ce(s) {
1154
- switch (parseInt(s[0])) {
1171
+ function le(r) {
1172
+ switch (parseInt(r[0])) {
1155
1173
  case 0:
1156
- return new k(s);
1174
+ return new N(r);
1157
1175
  case 1:
1158
- return new C(s);
1176
+ return new l(r);
1159
1177
  case 2:
1160
- return new b(s);
1178
+ return new C(r);
1161
1179
  case 3:
1162
- return new l(s);
1180
+ return new b(r);
1163
1181
  case 4:
1164
- return new F(s);
1182
+ return new F(r);
1165
1183
  case 11:
1166
- return new M(s);
1184
+ return new M(r);
1167
1185
  case 12:
1168
- return new E(s);
1186
+ return new E(r);
1169
1187
  case 20:
1170
- return new H(s);
1188
+ return new H(r);
1171
1189
  case 21:
1172
1190
  case 22:
1173
- return new T(s);
1191
+ return new T(r);
1174
1192
  case 23:
1175
- return new S(s);
1193
+ return new O(r);
1176
1194
  case 24:
1177
- return new L(s);
1195
+ return new S(r);
1178
1196
  case 25:
1179
- return new O(s);
1197
+ return new L(r);
1180
1198
  case 26:
1181
- return new A(s);
1199
+ return new A(r);
1182
1200
  case 27:
1183
- return new z(s);
1201
+ return new q(r);
1184
1202
  case 28:
1185
- return new q(s);
1203
+ return new z(r);
1186
1204
  case 29:
1187
- return new R(s);
1205
+ return new R(r);
1188
1206
  case 30:
1189
- return new B(s);
1207
+ return new B(r);
1190
1208
  case 31:
1191
- return new U(s);
1209
+ return new U(r);
1192
1210
  case 33:
1193
- return new j(s);
1211
+ return new j(r);
1194
1212
  case 34:
1195
- return new G(s);
1213
+ return new _(r);
1196
1214
  case 35:
1197
- return new W(s);
1215
+ return new G(r);
1198
1216
  case 36:
1199
- return new V(s);
1217
+ return new V(r);
1200
1218
  case 37:
1201
- return new Y(s);
1219
+ return new W(r);
1202
1220
  case 38:
1203
- return new Z(s);
1221
+ return new Y(r);
1204
1222
  case 39:
1205
- return new X(s);
1223
+ return new Z(r);
1206
1224
  case 40:
1207
- return new _(s);
1225
+ return new X(r);
1208
1226
  case 41:
1209
- return new J(s);
1227
+ return new J(r);
1210
1228
  case 42:
1211
- return new K(s);
1229
+ return new K(r);
1212
1230
  case 251:
1213
- return new $(s);
1231
+ return new $(r);
1214
1232
  case 252:
1215
- return new Q(s);
1233
+ return new Q(r);
1216
1234
  case 253:
1217
- return new g(s);
1235
+ return new g(r);
1218
1236
  case 254:
1219
- return new ee(s);
1237
+ return new ee(r);
1220
1238
  case 256:
1221
- return new te(s);
1239
+ return new te(r);
1222
1240
  case 257:
1223
- return new se(s);
1241
+ return new se(r);
1224
1242
  case 258:
1225
- return new re(s);
1243
+ return new re(r);
1226
1244
  case 259:
1227
- return new ae(s);
1245
+ return new ae(r);
1228
1246
  case 260:
1229
- return new ne(s);
1247
+ return new ne(r);
1230
1248
  case 261:
1231
- return new ie(s);
1249
+ return new ie(r);
1232
1250
  case 262:
1233
- return new ce(s);
1251
+ return new ce(r);
1234
1252
  case 263:
1235
- return new he(s);
1253
+ return new pe(r);
1236
1254
  case 264:
1237
- return new pe(s);
1255
+ return new he(r);
1238
1256
  case 265:
1239
- return new ue(s);
1257
+ return new ue(r);
1240
1258
  case 266:
1241
- return new de(s);
1259
+ return new de(r);
1242
1260
  case 267:
1243
- return new oe(s);
1261
+ return new oe(r);
1244
1262
  case 268:
1245
- return new Ie(s);
1263
+ return new Ie(r);
1246
1264
  case 269:
1247
- return new me(s);
1265
+ return new me(r);
1248
1266
  case 270:
1249
- return new we(s);
1267
+ return new we(r);
1250
1268
  case 271:
1251
- return new ye(s);
1269
+ return new ye(r);
1252
1270
  case 272:
1253
- return new ve(s);
1271
+ return new ve(r);
1254
1272
  case 273:
1255
- return new xe(s);
1273
+ return new xe(r);
1256
1274
  case 274:
1257
- return new fe(s);
1275
+ return new fe(r);
1258
1276
  default:
1259
- return new De(s);
1277
+ return new De(r);
1260
1278
  }
1261
1279
  }
1262
- let Pe = new N();
1280
+ let Pe = new k();
1263
1281
  (function() {
1264
1282
  Pe.Connect();
1265
1283
  })();
1266
1284
  export {
1267
- pe as AbilityExtra,
1285
+ he as AbilityExtra,
1268
1286
  xe as ActorControlExtra,
1269
1287
  fe as ActorControlSelfExtra,
1270
1288
  we as ActorMove,
1271
1289
  ye as ActorSetPos,
1272
- l as AddCombatant,
1290
+ b as AddCombatant,
1273
1291
  oe as BattleTalk2,
1274
1292
  ae as CEDirector,
1275
- b as ChangePrimaryPlayer,
1276
- C as ChangeZone,
1293
+ C as ChangePrimaryPlayer,
1294
+ l as ChangeZone,
1277
1295
  ie as CombatantMemory,
1278
1296
  ue as ContentFinderSettings,
1279
1297
  Ie as Countdown,
@@ -1281,40 +1299,40 @@ export {
1281
1299
  $ as Debug,
1282
1300
  ee as Error,
1283
1301
  re as FateDirector,
1284
- k as GameLogLine,
1302
+ N as GameLogLine,
1285
1303
  ne as InCombat,
1286
1304
  V as LimitBreak,
1287
1305
  te as LineRegistration,
1288
1306
  n as LogLineBase,
1289
1307
  se as MapEffect,
1290
- _ as MapLog,
1308
+ X as MapLog,
1291
1309
  H as NetowrkStartsCasting,
1292
1310
  T as NetworkAbility,
1293
- Y as NetworkActionSync,
1311
+ W as NetworkActionSync,
1294
1312
  j as NetworkActorControl,
1295
1313
  A as NetworkBuff,
1296
1314
  B as NetworkBuffRemove,
1297
- S as NetworkCancelAbility,
1298
- O as NetworkDeath,
1299
- L as NetworkDoT,
1315
+ O as NetworkCancelAbility,
1316
+ L as NetworkDeath,
1317
+ S as NetworkDoT,
1300
1318
  U as NetworkGauge,
1301
- G as NetworkNameToggle,
1302
- q as NetworkRaidMarker,
1303
- Z as NetworkStatusEffects,
1304
- z as NetworkTargetIcon,
1319
+ _ as NetworkNameToggle,
1320
+ z as NetworkRaidMarker,
1321
+ Y as NetworkStatusEffects,
1322
+ q as NetworkTargetIcon,
1305
1323
  R as NetworkTargetMarker,
1306
- W as NetworkTether,
1307
- X as NetworkUpdateHP,
1324
+ G as NetworkTether,
1325
+ Z as NetworkUpdateHP,
1308
1326
  de as NpcYell,
1309
- N as OverlayToolkit,
1327
+ k as OverlayToolkit,
1310
1328
  Q as PacketDump,
1311
- Ce as ParseLogLine,
1329
+ le as ParseLogLine,
1312
1330
  M as PartyList,
1313
1331
  E as PlayerStats,
1314
1332
  ce as RSVData,
1315
1333
  F as RemoveCombatant,
1316
1334
  ve as SpawnNpcExtra,
1317
- he as StartsUsingExtra,
1335
+ pe as StartsUsingExtra,
1318
1336
  K as StatusList3,
1319
1337
  J as SystemLogMessage,
1320
1338
  De as UnknownLogLine,
@@ -1 +1 @@
1
- (function(n,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(n=typeof globalThis<"u"?globalThis:n||self,p(n.overlayToolkit={}))})(this,function(n){"use strict";var Pe=Object.defineProperty;var le=(n,p,u)=>p in n?Pe(n,p,{enumerable:!0,configurable:!0,writable:!0,value:u}):n[p]=u;var t=(n,p,u)=>le(n,typeof p!="symbol"?p+"":p,u);function p(s){return new u(s)}class u extends EventTarget{constructor(e){super();t(this,"onconnect",null);t(this,"ondisconnect",null);t(this,"devices",new Map);this.api=e,this.addListener()}dispatchEvent(e){return e.type==="connect"&&this.onconnect&&this.onconnect.call(this,e),e.type==="disconnect"&&this.ondisconnect&&this.ondisconnect.call(this,e),super.dispatchEvent(e),!e.defaultPrevented}async getDevices(){const e=await this.requestGetDevices();let a=[];return e.forEach(c=>{if(this.devices.has(c.instanceId))a.push(this.devices.get(c.instanceId));else{const h=new I(this.api,c);this.devices.set(c.instanceId,h),a.push(h)}}),a}async requestDevice(e){return e&&console.log("Requesting device with options:",e),this.getDevices()}async requestGetDevices(){return(await o(this.api,"getDevices",{})).devices}addListener(){this.api.addOverlayListener("otk::hid::inputreport",e=>this.callbackInputReport(e)),this.api.addOverlayListener("otk::hid::devicechanged",e=>this.callbackDeviceChanged(e))}callbackInputReport(e){const a=e.instanceId,c=w(e.data),h=this.devices.get(a);h?h.dispatchEvent(new fe("inputreport",h,c[0],new DataView(c.buffer,1))):console.warn("Device not found:",a)}callbackDeviceChanged(e){var a=e.add;const c=new I(this.api,e.device),h=new ye(a?"connect":"disconnect",c);this.dispatchEvent(h)}}async function o(s,r,e){const a={call:"otk::hid",type:r,...e},c=await s.callOverlayHandler(a);return c.error&&console.log("callOverlayHID error:",r,e,c),c}class I extends EventTarget{constructor(e,a){super();t(this,"instanceId");t(this,"opened",!1);t(this,"vendorId");t(this,"productId");t(this,"productName");t(this,"collections");t(this,"oninputreport",null);this.api=e,this.instanceId=a.instanceId,this.vendorId=a.vendorId,this.productId=a.productId,this.productName=a.productName,this.collections=a.collections||[]}dispatchEvent(e){return e.type==="inputreport"&&this.oninputreport&&this.oninputreport.call(this,e),super.dispatchEvent(e),!e.defaultPrevented}async open(){this.opened||(await this.request("open",{}),this.opened=!0)}async close(){this.opened&&(await this.request("close",{}),this.opened=!1)}async forget(){}async sendReport(e,a){if(!this.opened)throw new Error("Device is not opened.");await this.request("send",{reportId:e,data:m(a)})}async sendFeatureReport(e,a){if(!this.opened)throw new Error("Device is not opened.");await this.request("sendFeature",{reportId:e,data:m(a)})}async receiveFeatureReport(e){if(!this.opened)throw new Error("Device is not opened.");const a=await this.request("recvFeature",{reportId:e}),c=w(a.data);return new DataView(c.buffer)}async request(e,a){return o(this.api,e,{instanceId:this.instanceId,...a})}}class ye extends Event{constructor(e,a){super(e);t(this,"device");this.device=a}}class fe extends Event{constructor(e,a,c,h){super(e);t(this,"device");t(this,"reportId");t(this,"data");this.device=a,this.reportId=c,this.data=h}}function m(s){let r=null;return s instanceof ArrayBuffer?r=new Uint8Array(s):r=new Uint8Array(s.buffer,s.byteOffset,s.byteLength),[...r].map(e=>e.toString(16).padStart(2,"0")).join("")}function w(s){const r=new Uint8Array(Math.ceil(s.length/2));for(let e=0;e<s.length;)r[e/2]=Number.parseInt(s.slice(e,e+=2),16);return r}class ve{constructor(r=null){t(this,"subscribers",new Map);t(this,"queue",[]);this.transport=r,r&&this.setTransport(r)}setTransport(r){this.transport=r,this.transport.addEventListener("message",e=>{this.dispatchOverlayEvent(e.detail)}),this.transport.addEventListener("connected",this.onTransportConnected.bind(this))}dispatchOverlayEvent(r){const e=this.subscribers.get(r.type);if(e)for(const a of e)a(r)}addOverlayListener(r,e){this.subscribers.has(r)||this.subscribers.set(r,[]),this.subscribers.get(r).push(e)}removeOverlayListener(r,e){if(!this.subscribers.has(r))return;const a=this.subscribers.get(r),c=a.indexOf(e);c!==-1&&a.splice(c,1)}async callOverlayHandler(r){return!this.transport||!this.transport.connected?(console.warn("OverlayPluginAPI: Transport not connected, queuing message",r),new Promise(a=>{this.queue.push([r,a])})):this.transport.sendMessage(r)}startOverlayEvents(){var r={call:"subscribe",events:Array.from(this.subscribers.keys())};this.callOverlayHandler(r)}onTransportConnected(){if(!this.transport||!this.transport.connected||this.queue.length===0)return;console.log("OverlayPluginAPI: Transport connected, sending queued messages");let r=this.queue;this.queue=[];for(let[e,a]of r)this.transport.sendMessage(e).then(a)}}class De extends EventTarget{constructor(){super(...arguments);t(this,"connected",!1);t(this,"evtHandlerWrapper",e=>{this.dispatchEvent(new CustomEvent("message",{detail:e}))})}get transportType(){return"plugin"}sendMessage(e){return new Promise(a=>{window.OverlayPluginApi.callHandler(JSON.stringify(e),a)})}waitForApi(){if(!window.OverlayPluginApi||!window.OverlayPluginApi.ready){setTimeout(()=>this.waitForApi(),300);return}window.__OverlayCallback=this.evtHandlerWrapper,this.connected=!0,this.dispatchEvent(new Event("connected"))}}class ke extends EventTarget{constructor(e){super();t(this,"ws");t(this,"sequence",0);t(this,"responseResolvers",new Map);t(this,"evtHandler",()=>{});t(this,"connected",!1);this.ws=new WebSocket(e),this.connect(this.ws)}connect(e){e.addEventListener("open",this.onOpen.bind(this)),e.addEventListener("error",this.onError.bind(this)),e.addEventListener("message",this.onMessage.bind(this)),e.addEventListener("close",this.onClosed.bind(this))}onError(e){console.error(e)}onOpen(){console.log("WebSocket connected"),this.connected=!0,this.dispatchEvent(new Event("connected"))}onMessage(e){try{const a=JSON.parse(e.data);if("rseq"in a){const c=a.rseq;this.responseResolvers.has(c)&&(this.responseResolvers.get(c)(a),this.responseResolvers.delete(c))}else this.dispatchEvent(new CustomEvent("message",{detail:a}))}catch{console.error("Failed to parse WebSocket message",e)}}onClosed(e){console.log("WebSocket closed",e),this.connected=!1,setTimeout(()=>{console.log("WebSocket reconnecting..."),this.ws=new WebSocket(this.ws.url),this.connect(this.ws)},3e3)}get transportType(){return"websocket"}sendMessage(e){const a=this.sequence++;return e.rseq=a,new Promise(c=>{this.responseResolvers.set(a,c),this.ws.send(JSON.stringify(e))})}set eventHandler(e){this.evtHandler=e}}class y{constructor(){t(this,"hid");t(this,"api",new ve);t(this,"handlerMap",new Map);this.hid=p(this.api)}Fetch(r,e={}){const a={call:"Fetch",resource:r,options:e};return this.api.callOverlayHandler(a)}async SubscribePacket(r,e,a){const c={call:"otk::packet",action:"subscribe",name:r,filters:e},h=await this.api.callOverlayHandler(c);if(h.error)throw new Error(h.error);return this.handlerMap.set(h.name||r,a),h.name||r}async UnsubscribePacket(r){const e={call:"otk::packet",action:"unsubscribe",name:r},a=await this.api.callOverlayHandler(e);if(a.error)throw new Error(a.error);this.handlerMap.delete(r)}packetHandler(r){let e=r,a=r;a.data=Uint8Array.from(atob(e.msg),h=>h.charCodeAt(0));let c=this.handlerMap.get(e.name);c?c(a):console.warn("No packet handler for name",e.name)}async GetGameVersion(){const r={call:"otk::game_ver"};return this.api.callOverlayHandler(r)}Start(){this.api.addOverlayListener("otk::packet",r=>this.packetHandler(r)),this.api.startOverlayEvents()}Dispatch(r){this.api.dispatchOverlayEvent(r)}AddListener(r,e){this.api.addOverlayListener(r,e)}RemoveListener(r,e){this.api.removeOverlayListener(r,e)}Call(r){return this.api.callOverlayHandler(r)}IsOverlayPluginCEF(){return"OverlayPluginApi"in window}tryConnectToCEF(){if(!this.IsOverlayPluginCEF()){setTimeout(()=>this.tryConnectToCEF(),300);return}const r=new De;this.api.setTransport(r),r.waitForApi()}Connect(r=""){if(this.tryConnectToCEF(),r||(r=new URLSearchParams(location.search).get("OVERLAY_WS")),r){if(this.IsOverlayPluginCEF()){console.warn("OverlayToolkit: Connect wsUrl ignored in OverlayPlugin CEF environment");return}const e=new ke(r);this.api.setTransport(e)}}}class i{constructor(r,e){t(this,"type");t(this,"typeCode");t(this,"time");this.typeCode=parseInt(e[0]),this.time=e[1],this.type=r}get timeDate(){return new Date(this.time)}}class f extends i{constructor(e){super("LogLine",e);t(this,"code");t(this,"name");t(this,"line");this.code=e[2],this.name=e[3],this.line=e[4]}}class v extends i{constructor(e){super("ChangeZone",e);t(this,"zoneID");t(this,"zoneName");this.zoneID=parseInt(e[2],16),this.zoneName=e[3]}}class D extends i{constructor(e){super("ChangePrimaryPlayer",e);t(this,"charID");t(this,"charName");this.charID=parseInt(e[2],16),this.charName=e[3]}get charIDHex(){return this.charID.toString(16).toUpperCase()}}class k extends i{constructor(e){super("AddCombatant",e);t(this,"id");t(this,"name");t(this,"job");t(this,"level");t(this,"ownerID");t(this,"worldID");t(this,"worldName");t(this,"npcNameID");t(this,"npcBaseID");t(this,"currentHP");t(this,"hp");t(this,"currentMP");t(this,"mp");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.job=parseInt(e[4],16),this.level=parseInt(e[5],16),this.ownerID=parseInt(e[6],16),this.worldID=parseInt(e[7],16),this.worldName=e[8],this.npcNameID=parseInt(e[9]),this.npcBaseID=parseInt(e[10]),this.currentHP=parseInt(e[11]),this.hp=parseInt(e[12]),this.currentMP=parseInt(e[13]),this.mp=parseInt(e[14]),this.x=parseFloat(e[17]),this.y=parseFloat(e[18]),this.z=parseFloat(e[19]),this.heading=parseFloat(e[20])}}class N extends i{constructor(e){super("RemoveCombatant",e);t(this,"id");t(this,"name");t(this,"job");t(this,"level");t(this,"ownerID");t(this,"world");t(this,"npcNameID");t(this,"npcBaseID");t(this,"currentHP");t(this,"hp");t(this,"currentMP");t(this,"mp");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.job=parseInt(e[4],16),this.level=parseInt(e[5],16),this.ownerID=parseInt(e[6],16),this.world=e[8],this.npcNameID=parseInt(e[9]),this.npcBaseID=parseInt(e[10]),this.currentHP=parseInt(e[11]),this.hp=parseInt(e[12]),this.currentMP=parseInt(e[13]),this.mp=parseInt(e[14]),this.x=parseFloat(e[17]),this.y=parseFloat(e[18]),this.z=parseFloat(e[19]),this.heading=parseFloat(e[20])}}class P extends i{constructor(e){super("PartyChanged",e);t(this,"party");this.party=[];let a=parseInt(e[2]);for(let c=0;c<a;c++)this.party.push(parseInt(e[3+c],16))}}class l extends i{constructor(e){super("PlayerStats",e);t(this,"job");t(this,"strength");t(this,"dexterity");t(this,"vitality");t(this,"intelligence");t(this,"mind");t(this,"piety");t(this,"attackPower");t(this,"directHit");t(this,"criticalHit");t(this,"attakcMagicPotency");t(this,"healingMagicPotency");t(this,"determination");t(this,"skillSpeed");t(this,"spellSpeed");t(this,"tenacity");t(this,"localContentID");this.job=parseInt(e[2],16),this.strength=parseInt(e[3]),this.dexterity=parseInt(e[4]),this.vitality=parseInt(e[5]),this.intelligence=parseInt(e[6]),this.mind=parseInt(e[7]),this.piety=parseInt(e[8]),this.attackPower=parseInt(e[9]),this.directHit=parseInt(e[10]),this.criticalHit=parseInt(e[11]),this.attakcMagicPotency=parseInt(e[12]),this.healingMagicPotency=parseInt(e[13]),this.determination=parseInt(e[14]),this.skillSpeed=parseInt(e[15]),this.spellSpeed=parseInt(e[16]),this.tenacity=parseInt(e[18]),this.localContentID=parseInt(e[19],16)}}class C extends i{constructor(e){super("NetworkStartsCasting",e);t(this,"sourceID");t(this,"sourceName");t(this,"id");t(this,"ability");t(this,"targetID");t(this,"targetName");t(this,"castTime");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.sourceID=parseInt(e[2],16),this.sourceName=e[3],this.id=parseInt(e[4],16),this.ability=e[5],this.targetID=parseInt(e[6],16),this.targetName=e[7],this.castTime=parseFloat(e[8]),this.x=parseFloat(e[9]),this.y=parseFloat(e[10]),this.z=parseFloat(e[11]),this.heading=parseFloat(e[12])}}class b extends i{constructor(e){super(e[0]=="22"?"NetworkAOEAbility":"NetworkAbility",e);t(this,"sourceID");t(this,"sourceName");t(this,"id");t(this,"ability");t(this,"targetID");t(this,"targetName");t(this,"effects");t(this,"targetCurrentHP");t(this,"targetMaxHP");t(this,"targetCurrentMP");t(this,"targetMaxMP");t(this,"targetX");t(this,"targetY");t(this,"targetZ");t(this,"targetHeading");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"sequence");t(this,"targetIndex");t(this,"targetCount");t(this,"ownerID");t(this,"ownerName");t(this,"effectDisplayType");t(this,"actionID");t(this,"actionAnimationID");t(this,"animationLockTime");t(this,"rotationHex");this.sourceID=parseInt(e[2],16),this.sourceName=e[3],this.id=parseInt(e[4],16),this.ability=e[5],this.targetID=parseInt(e[6],16),this.targetName=e[7],this.effects=[];for(let a=0;a<8;a++)this.effects[a]={flags:parseInt(e[8+a*2],16),damage:e[9+a*2]};this.targetCurrentHP=parseInt(e[24]),this.targetMaxHP=parseInt(e[25]),this.targetCurrentMP=parseInt(e[26]),this.targetMaxMP=parseInt(e[27]),this.targetX=parseFloat(e[30]),this.targetY=parseFloat(e[31]),this.targetZ=parseFloat(e[32]),this.targetHeading=parseFloat(e[33]),this.currentHP=parseInt(e[34]),this.maxHP=parseInt(e[35]),this.currentMP=parseInt(e[36]),this.maxMP=parseInt(e[37]),this.x=parseFloat(e[40]),this.y=parseFloat(e[41]),this.z=parseFloat(e[42]),this.heading=parseFloat(e[43]),this.sequence=parseInt(e[44],16),this.targetIndex=parseInt(e[45]),this.targetCount=parseInt(e[46]),this.ownerID=parseInt(e[47],16),this.ownerName=e[48],this.effectDisplayType=parseInt(e[49]),this.actionID=parseInt(e[50],16),this.actionAnimationID=parseInt(e[51],16),this.animationLockTime=parseFloat(e[52]),this.rotationHex=parseInt(e[53],16)}}class x extends i{constructor(e){super("NetworkCancelAbility",e);t(this,"sourceID");t(this,"source");t(this,"id");t(this,"name");t(this,"reason");this.sourceID=parseInt(e[2],16),this.source=e[3],this.id=parseInt(e[4],16),this.name=e[5],this.reason=e[6]}}class M extends i{constructor(e){super("NetworkDoT",e);t(this,"id");t(this,"name");t(this,"which");t(this,"effectID");t(this,"damage");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"sourceID");t(this,"sourceName");t(this,"damageType");t(this,"sourceCurrentHP");t(this,"sourceMaxHP");t(this,"sourceCurrentMP");t(this,"sourceMaxMP");t(this,"sourceX");t(this,"sourceY");t(this,"sourceZ");t(this,"sourceHeading");this.id=parseInt(e[2],16),this.name=e[3],this.which=e[4],this.effectID=parseInt(e[5],16),this.damage=parseInt(e[6]),this.currentHP=parseInt(e[7]),this.maxHP=parseInt(e[8]),this.currentMP=parseInt(e[9]),this.maxMP=parseInt(e[10]),this.x=parseFloat(e[13]),this.y=parseFloat(e[14]),this.z=parseFloat(e[15]),this.heading=parseFloat(e[16]),this.sourceID=parseInt(e[17],16),this.sourceName=e[18],this.damageType=parseInt(e[19],16),this.sourceCurrentHP=parseInt(e[20]),this.sourceMaxHP=parseInt(e[21]),this.sourceCurrentMP=parseInt(e[22]),this.sourceMaxMP=parseInt(e[23]),this.sourceX=parseFloat(e[26]),this.sourceY=parseFloat(e[27]),this.sourceZ=parseFloat(e[28]),this.sourceHeading=parseFloat(e[29])}}class F extends i{constructor(e){super("NetworkDeath",e);t(this,"targetID");t(this,"targetName");t(this,"sourceID");t(this,"sourceName");this.targetID=parseInt(e[2],16),this.targetName=e[3],this.sourceID=parseInt(e[4],16),this.sourceName=e[5]}}class E extends i{constructor(e){super("NetworkBuff",e);t(this,"effectID");t(this,"effectName");t(this,"duration");t(this,"sourceID");t(this,"sourceName");t(this,"targetID");t(this,"targetName");t(this,"count");t(this,"targetMaxHP");t(this,"sourceMaxHP");this.effectID=parseInt(e[2],16),this.effectName=e[3],this.duration=parseFloat(e[4]),this.sourceID=parseInt(e[5],16),this.sourceName=e[6],this.targetID=parseInt(e[7],16),this.targetName=e[8],this.count=parseInt(e[9]),this.targetMaxHP=parseInt(e[10]==""?"-1":e[10]),this.sourceMaxHP=parseInt(e[11]==""?"-1":e[11])}}class H extends i{constructor(e){super("NetworkTargetIcon",e);t(this,"targetID");t(this,"targetName");t(this,"id");t(this,"data0");this.targetID=parseInt(e[2],16),this.targetName=e[3],this.id=parseInt(e[6],16),this.data0=parseInt(e[7],16)}}class T extends i{constructor(e){super("NetworkRaidMarker",e);t(this,"operation");t(this,"waymark");t(this,"id");t(this,"name");t(this,"x");t(this,"y");t(this,"z");this.operation=e[2],this.waymark=parseInt(e[3]),this.id=parseInt(e[4],16),this.name=e[5],this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8])}}class S extends i{constructor(e){super("NetworkTargetMarker",e);t(this,"operation");t(this,"waymark");t(this,"id");t(this,"name");t(this,"targetID");t(this,"targetName");this.operation=e[2],this.waymark=parseInt(e[3]),this.id=parseInt(e[4],16),this.name=e[5],this.targetID=parseInt(e[6],16),this.targetName=e[7]}}class L extends i{constructor(e){super("NetworkBuffRemove",e);t(this,"effectID");t(this,"effectName");t(this,"sourceID");t(this,"sourceName");t(this,"targetID");t(this,"targetName");t(this,"count");this.effectID=parseInt(e[2],16),this.effectName=e[3],this.sourceID=parseInt(e[5],16),this.sourceName=e[6],this.targetID=parseInt(e[7],16),this.targetName=e[8],this.count=parseInt(e[9],16)}}class A extends i{constructor(e){super("NetworkGauge",e);t(this,"id");t(this,"data");this.id=parseInt(e[2],16),this.data=new Uint8Array(16);let a=new DataView(this.data.buffer);for(let c=0;c<4;c++){let h=parseInt(e[3+c]);a.setUint32(c*4,h,!0)}}}class O extends i{constructor(e){super("NetworkActorControl",e);t(this,"instance");t(this,"command");t(this,"data");this.instance=parseInt(e[2],16),this.command=parseInt(e[3],16),this.data=[];for(let a=0;a<4;a++)this.data.push(parseInt(e[4+a],16))}}class z extends i{constructor(e){super("NetworkNameToggle",e);t(this,"id");t(this,"name");t(this,"targetID");t(this,"targetName");t(this,"toggle");this.id=parseInt(e[2],16),this.name=e[3],this.targetID=parseInt(e[4],16),this.targetName=e[5],this.toggle=parseInt(e[6])===1}}class q extends i{constructor(e){super("NetworkTether",e);t(this,"sourceID");t(this,"sourceName");t(this,"targetID");t(this,"targetName");t(this,"id");this.sourceID=parseInt(e[2],16),this.sourceName=e[3],this.targetID=parseInt(e[4],16),this.targetName=e[5],this.id=parseInt(e[8],16)}}class R extends i{constructor(e){super("LimitBreak",e);t(this,"value");t(this,"bars");this.value=parseInt(e[2],16),this.bars=parseInt(e[3])}}class B extends i{constructor(e){super("NetworkActionSync",e);t(this,"id");t(this,"name");t(this,"sequenceID");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"currentShield");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.sequenceID=parseInt(e[4],16),this.currentHP=e[5]?parseInt(e[5]):-1,this.maxHP=e[6]?parseInt(e[6]):-1,this.currentMP=e[7]?parseInt(e[7]):-1,this.maxMP=e[8]?parseInt(e[8]):-1,this.currentShield=e[9]?parseInt(e[9]):-1,this.x=parseFloat(e[11]),this.y=parseFloat(e[12]),this.z=parseFloat(e[13]),this.heading=parseFloat(e[14])}}class U extends i{constructor(e){super("NetworkStatusEffects",e);t(this,"targetID");t(this,"targetName");t(this,"jobLevelData");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"currentShield");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"data");this.targetID=parseInt(e[2],16),this.targetName=e[3],this.jobLevelData=parseInt(e[4],16),this.currentHP=parseInt(e[5]),this.maxHP=parseInt(e[6]),this.currentMP=parseInt(e[7]),this.maxMP=parseInt(e[8]),this.currentShield=parseInt(e[9]),this.x=parseFloat(e[11]),this.y=parseFloat(e[12]),this.z=parseFloat(e[13]),this.heading=parseFloat(e[14]),this.data=[];for(let a=0;a<6;a++)this.data.push(parseInt(e[15+a],16))}}class j extends i{constructor(e){super("NetworkUpdateHP",e);t(this,"id");t(this,"name");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.currentHP=parseInt(e[4]),this.maxHP=parseInt(e[5]),this.currentMP=parseInt(e[6]),this.maxMP=parseInt(e[7]),this.x=parseFloat(e[10]),this.y=parseFloat(e[11]),this.z=parseFloat(e[12]),this.heading=parseFloat(e[13])}}class G extends i{constructor(e){super("Map",e);t(this,"id");t(this,"regionName");t(this,"placeName");t(this,"placeNameSub");this.id=parseInt(e[2],16),this.regionName=e[3],this.placeName=e[4],this.placeNameSub=e[5]}}class V extends i{constructor(e){super("SystemLogMessage",e);t(this,"instance");t(this,"id");t(this,"params");this.instance=parseInt(e[2],16),this.id=parseInt(e[3],16),this.params=[];for(let a=0;a<3;a++)this.params.push(parseInt(e[4+a],16))}}class W extends i{constructor(e){super("StatusList3",e);t(this,"id");t(this,"name");t(this,"statusList");this.id=parseInt(e[2],16),this.name=e[3],this.statusList=[];for(let a=0;a<e.length-4-1;a++)this.statusList.push(parseInt(e[4+a],16))}}class Y extends i{constructor(e){super("Debug",e);t(this,"message");this.message=e[2]}}class Z extends i{constructor(e){super("PacketDump",e);t(this,"len");t(this,"src");t(this,"dst");t(this,"packetType");t(this,"data");this.len=parseInt(e[2],16),this.src=parseInt(e[3],16),this.dst=parseInt(e[4],16),this.packetType=parseInt(e[5],16)&65535,this.data=new Uint8Array(this.len-16);for(let a=6,c=0;a<e.length-2;a++,c++){const h=parseInt(e[a],16);for(let d=0;d<4;d++)this.data[c*4+d]=h>>d*8&255}}}class _ extends i{constructor(e){super("Version",e);t(this,"message");this.message=e[2]}}let X=class extends i{constructor(e){super("Error",e);t(this,"message");this.message=e[2]}};class J extends i{constructor(e){super("LineRegistration",e);t(this,"id");t(this,"source");t(this,"name");t(this,"version");this.id=parseInt(e[2]),this.source=e[3],this.name=e[4],this.version=e[5]}}class K extends i{constructor(e){super("MapEffect",e);t(this,"instance");t(this,"flags");t(this,"location");t(this,"data0");t(this,"data1");this.instance=parseInt(e[2],16),this.flags=parseInt(e[3],16),this.location=parseInt(e[4],16),this.data0=parseInt(e[5],16),this.data1=parseInt(e[6],16)}}class $ extends i{constructor(e){super("FateDirector",e);t(this,"category");t(this,"unknown");t(this,"id");t(this,"progress");this.category=e[2],this.unknown=parseInt(e[3],16),this.id=parseInt(e[4],16),this.progress=parseInt(e[5],16)}}class Q extends i{constructor(e){super("CEDirector",e);t(this,"popTime");t(this,"timeRemaining");t(this,"unknown");t(this,"ceKey");t(this,"numPlayers");t(this,"status");t(this,"unknown2");t(this,"progress");this.popTime=parseInt(e[2],16),this.timeRemaining=parseInt(e[3],16),this.unknown=parseInt(e[4],16),this.ceKey=parseInt(e[5],16),this.numPlayers=parseInt(e[6],16),this.status=parseInt(e[7],16),this.unknown2=parseInt(e[8],16),this.progress=parseInt(e[9],16)}}class g extends i{constructor(e){super("InCombat",e);t(this,"inACTCombat");t(this,"inGameCombat");t(this,"isACTChanged");t(this,"isGameChanged");this.inACTCombat=parseInt(e[2])===1,this.inGameCombat=parseInt(e[3])===1,this.isACTChanged=parseInt(e[4])===1,this.isGameChanged=parseInt(e[5])===1}}class ee extends i{constructor(e){super("CombatantMemory",e);t(this,"change");t(this,"id");t(this,"data");this.change=e[2],this.id=parseInt(e[3],16),this.data=new Map;for(let a=4;a<e.length-1;a+=2)this.data.set(e[a],e[a+1])}}class te extends i{constructor(e){super("RSVData",e);t(this,"locale");t(this,"unknown");t(this,"key");t(this,"value");this.locale=e[2],this.unknown=parseInt(e[3],16),this.key=e[4],this.value=e[5]}}class se extends i{constructor(e){super("StartsUsingExtra",e);t(this,"sourceID");t(this,"id");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.sourceID=parseInt(e[2],16),this.id=parseInt(e[3],16),this.x=parseFloat(e[4]),this.y=parseFloat(e[5]),this.z=parseFloat(e[6]),this.heading=parseFloat(e[7])}}class re extends i{constructor(e){super("AbilityExtra",e);t(this,"sourceID");t(this,"id");t(this,"globalEffectCounter");t(this,"dataFlag");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"animationTargetId");this.sourceID=parseInt(e[2],16),this.id=parseInt(e[3],16),this.globalEffectCounter=parseInt(e[4],16),this.dataFlag=parseInt(e[5],16),this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8]),this.heading=parseFloat(e[9]),this.animationTargetId=parseInt(e[10],16)}}class ae extends i{constructor(e){super("ContentFinderSettings",e);t(this,"zoneID");t(this,"zoneName");t(this,"inContentFinderContent");t(this,"unrestrictedParty");t(this,"minimalItemLevel");t(this,"silenceEcho");t(this,"explorerMode");t(this,"levelSync");this.zoneID=parseInt(e[2],16),this.zoneName=e[3],this.inContentFinderContent=parseInt(e[4])===1,this.unrestrictedParty=parseInt(e[5])===1,this.minimalItemLevel=parseInt(e[6])===1,this.silenceEcho=parseInt(e[7])===1,this.explorerMode=parseInt(e[8])===1,this.levelSync=parseInt(e[9])===1}}class ne extends i{constructor(e){super("NpcYell",e);t(this,"npcId");t(this,"npcNameId");t(this,"npcYellId");this.npcId=parseInt(e[2],16),this.npcNameId=parseInt(e[3],16),this.npcYellId=parseInt(e[4],16)}}class ie extends i{constructor(e){super("BattleTalk2",e);t(this,"npcId");t(this,"instance");t(this,"npcNameId");t(this,"instanceContentTextId");t(this,"displayMs");this.npcId=parseInt(e[2],16),this.instance=parseInt(e[3],16),this.npcNameId=parseInt(e[4],16),this.instanceContentTextId=parseInt(e[5],16),this.displayMs=parseInt(e[6])}}class ce extends i{constructor(e){super("Countdown",e);t(this,"id");t(this,"worldID");t(this,"countdownTime");t(this,"result");t(this,"name");this.id=parseInt(e[2],16),this.worldID=parseInt(e[3],16),this.countdownTime=parseInt(e[4]),this.result=parseInt(e[5],16),this.name=e[6]}}class he extends i{constructor(e){super("CountdownCancel",e);t(this,"id");t(this,"worldID");t(this,"name");this.id=parseInt(e[2],16),this.worldID=parseInt(e[3],16),this.name=e[4]}}class pe extends i{constructor(e){super("ActorMove",e);t(this,"id");t(this,"heading");t(this,"unk1");t(this,"unk2");t(this,"x");t(this,"y");t(this,"z");this.id=parseInt(e[2],16),this.heading=parseFloat(e[3]),this.unk1=parseInt(e[4],16),this.unk2=parseInt(e[5],16),this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8])}}class ue extends i{constructor(e){super("ActorSetPos",e);t(this,"id");t(this,"heading");t(this,"unk1");t(this,"unk2");t(this,"x");t(this,"y");t(this,"z");this.id=parseInt(e[2],16),this.heading=parseFloat(e[3]),this.unk1=parseInt(e[4],16),this.unk2=parseInt(e[5],16),this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8])}}class de extends i{constructor(e){super("SpawnNpcExtra",e);t(this,"id");t(this,"parentID");t(this,"tetherID");t(this,"animationState");this.id=parseInt(e[2],16),this.parentID=parseInt(e[3],16),this.tetherID=parseInt(e[4],16),this.animationState=parseInt(e[5],16)}}class oe extends i{constructor(e){super("ActorControlExtra",e);t(this,"id");t(this,"category");t(this,"param1");t(this,"param2");t(this,"param3");t(this,"param4");this.id=parseInt(e[2],16),this.category=parseInt(e[3],16),this.param1=parseInt(e[4],16),this.param2=parseInt(e[5],16),this.param3=parseInt(e[6],16),this.param4=parseInt(e[7],16)}}class Ie extends i{constructor(e){super("ActorControlSelfExtra",e);t(this,"id");t(this,"category");t(this,"param1");t(this,"param2");t(this,"param3");t(this,"param4");t(this,"param5");t(this,"param6");this.id=parseInt(e[2],16),this.category=parseInt(e[3],16),this.param1=parseInt(e[4],16),this.param2=parseInt(e[5],16),this.param3=parseInt(e[6],16),this.param4=parseInt(e[7],16),this.param5=parseInt(e[8],16),this.param6=parseInt(e[9],16)}}class me extends i{constructor(e){super("Unknown",e);t(this,"rawLines");this.rawLines=e}}function Ne(s){switch(parseInt(s[0])){case 0:return new f(s);case 1:return new v(s);case 2:return new D(s);case 3:return new k(s);case 4:return new N(s);case 11:return new P(s);case 12:return new l(s);case 20:return new C(s);case 21:case 22:return new b(s);case 23:return new x(s);case 24:return new M(s);case 25:return new F(s);case 26:return new E(s);case 27:return new H(s);case 28:return new T(s);case 29:return new S(s);case 30:return new L(s);case 31:return new A(s);case 33:return new O(s);case 34:return new z(s);case 35:return new q(s);case 36:return new R(s);case 37:return new B(s);case 38:return new U(s);case 39:return new j(s);case 40:return new G(s);case 41:return new V(s);case 42:return new W(s);case 251:return new Y(s);case 252:return new Z(s);case 253:return new _(s);case 254:return new X(s);case 256:return new J(s);case 257:return new K(s);case 258:return new $(s);case 259:return new Q(s);case 260:return new g(s);case 261:return new ee(s);case 262:return new te(s);case 263:return new se(s);case 264:return new re(s);case 265:return new ae(s);case 266:return new ne(s);case 267:return new ie(s);case 268:return new ce(s);case 269:return new he(s);case 270:return new pe(s);case 271:return new ue(s);case 272:return new de(s);case 273:return new oe(s);case 274:return new Ie(s);default:return new me(s)}}let we=new y;(function(){we.Connect()})(),n.AbilityExtra=re,n.ActorControlExtra=oe,n.ActorControlSelfExtra=Ie,n.ActorMove=pe,n.ActorSetPos=ue,n.AddCombatant=k,n.BattleTalk2=ie,n.CEDirector=Q,n.ChangePrimaryPlayer=D,n.ChangeZone=v,n.CombatantMemory=ee,n.ContentFinderSettings=ae,n.Countdown=ce,n.CountdownCancel=he,n.Debug=Y,n.Error=X,n.FateDirector=$,n.GameLogLine=f,n.InCombat=g,n.LimitBreak=R,n.LineRegistration=J,n.LogLineBase=i,n.MapEffect=K,n.MapLog=G,n.NetowrkStartsCasting=C,n.NetworkAbility=b,n.NetworkActionSync=B,n.NetworkActorControl=O,n.NetworkBuff=E,n.NetworkBuffRemove=L,n.NetworkCancelAbility=x,n.NetworkDeath=F,n.NetworkDoT=M,n.NetworkGauge=A,n.NetworkNameToggle=z,n.NetworkRaidMarker=T,n.NetworkStatusEffects=U,n.NetworkTargetIcon=H,n.NetworkTargetMarker=S,n.NetworkTether=q,n.NetworkUpdateHP=j,n.NpcYell=ne,n.OverlayToolkit=y,n.PacketDump=Z,n.ParseLogLine=Ne,n.PartyList=P,n.PlayerStats=l,n.RSVData=te,n.RemoveCombatant=N,n.SpawnNpcExtra=de,n.StartsUsingExtra=se,n.StatusList3=W,n.SystemLogMessage=V,n.UnknownLogLine=me,n.Version=_,n.default=we,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(n,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(n=typeof globalThis<"u"?globalThis:n||self,p(n.overlayToolkit={}))})(this,function(n){"use strict";var Ne=Object.defineProperty;var Pe=(n,p,d)=>p in n?Ne(n,p,{enumerable:!0,configurable:!0,writable:!0,value:d}):n[p]=d;var t=(n,p,d)=>Pe(n,typeof p!="symbol"?p+"":p,d);function p(r){return new d(r)}class d extends EventTarget{constructor(e){super();t(this,"onconnect",null);t(this,"ondisconnect",null);t(this,"devices",new Map);this.api=e,this.addListener()}dispatchEvent(e){return e.type==="connect"&&this.onconnect&&this.onconnect.call(this,e),e.type==="disconnect"&&this.ondisconnect&&this.ondisconnect.call(this,e),super.dispatchEvent(e),!e.defaultPrevented}async getDevices(){const e=await this.requestGetDevices();let a=[];return e.forEach(c=>{if(this.devices.has(c.instanceId))a.push(this.devices.get(c.instanceId));else{const h=new I(this.api,c);this.devices.set(c.instanceId,h),a.push(h)}}),a}async requestDevice(e){return e&&console.log("Requesting device with options:",e),this.getDevices()}async requestGetDevices(){return(await o(this.api,"getDevices",{})).devices}addListener(){this.api.addOverlayListener("otk::hid::inputreport",e=>this.callbackInputReport(e)),this.api.addOverlayListener("otk::hid::devicechanged",e=>this.callbackDeviceChanged(e))}callbackInputReport(e){const a=e.instanceId,c=w(e.data),h=this.devices.get(a);h?h.dispatchEvent(new ve("inputreport",h,c[0],new DataView(c.buffer,1))):console.warn("Device not found:",a)}callbackDeviceChanged(e){var a=e.add;const c=new I(this.api,e.device),h=new ye(a?"connect":"disconnect",c);this.dispatchEvent(h)}}async function o(r,s,e){const a={call:"otk::hid",type:s,...e},c=await r.callOverlayHandler(a);return c.error&&console.log("callOverlayHID error:",s,e,c),c}class I extends EventTarget{constructor(e,a){super();t(this,"instanceId");t(this,"opened",!1);t(this,"vendorId");t(this,"productId");t(this,"productName");t(this,"collections");t(this,"oninputreport",null);this.api=e,this.instanceId=a.instanceId,this.vendorId=a.vendorId,this.productId=a.productId,this.productName=a.productName,this.collections=a.collections||[]}dispatchEvent(e){return e.type==="inputreport"&&this.oninputreport&&this.oninputreport.call(this,e),super.dispatchEvent(e),!e.defaultPrevented}async open(){this.opened||(await this.request("open",{}),this.opened=!0)}async close(){this.opened&&(await this.request("close",{}),this.opened=!1)}async forget(){}async sendReport(e,a){if(!this.opened)throw new Error("Device is not opened.");await this.request("send",{reportId:e,data:m(a)})}async sendFeatureReport(e,a){if(!this.opened)throw new Error("Device is not opened.");await this.request("sendFeature",{reportId:e,data:m(a)})}async receiveFeatureReport(e){if(!this.opened)throw new Error("Device is not opened.");const a=await this.request("recvFeature",{reportId:e}),c=w(a.data);return new DataView(c.buffer)}async request(e,a){return o(this.api,e,{instanceId:this.instanceId,...a})}}class ye extends Event{constructor(e,a){super(e);t(this,"device");this.device=a}}class ve extends Event{constructor(e,a,c,h){super(e);t(this,"device");t(this,"reportId");t(this,"data");this.device=a,this.reportId=c,this.data=h}}function m(r){let s=null;return r instanceof ArrayBuffer?s=new Uint8Array(r):s=new Uint8Array(r.buffer,r.byteOffset,r.byteLength),[...s].map(e=>e.toString(16).padStart(2,"0")).join("")}function w(r){const s=new Uint8Array(Math.ceil(r.length/2));for(let e=0;e<r.length;)s[e/2]=Number.parseInt(r.slice(e,e+=2),16);return s}class fe{constructor(s=null){t(this,"subscribers",new Map);t(this,"queue",[]);this.transport=s,s&&this.setTransport(s)}setTransport(s){this.transport=s,this.transport.addEventListener("message",e=>{this.dispatchOverlayEvent(e.detail)}),this.transport.addEventListener("connected",this.onTransportConnected.bind(this))}dispatchOverlayEvent(s){const e=this.subscribers.get(s.type);if(e)for(const a of e)a(s)}addOverlayListener(s,e){this.subscribers.has(s)||this.subscribers.set(s,[]),this.subscribers.get(s).push(e)}removeOverlayListener(s,e){if(!this.subscribers.has(s))return;const a=this.subscribers.get(s),c=a.indexOf(e);c!==-1&&a.splice(c,1)}async callOverlayHandler(s){return!this.transport||!this.transport.connected?(console.warn("OverlayPluginAPI: Transport not connected, queuing message",s),new Promise(a=>{this.queue.push([s,a])})):this.transport.sendMessage(s)}startOverlayEvents(){var s={call:"subscribe",events:Array.from(this.subscribers.keys())};this.callOverlayHandler(s)}onTransportConnected(){if(!this.transport||!this.transport.connected||this.queue.length===0)return;console.log("OverlayPluginAPI: Transport connected, sending queued messages");let s=this.queue;this.queue=[];for(let[e,a]of s)this.transport.sendMessage(e).then(a)}}class ke extends EventTarget{constructor(){super(...arguments);t(this,"connected",!1);t(this,"evtHandlerWrapper",e=>{this.dispatchEvent(new CustomEvent("message",{detail:e}))})}get transportType(){return"plugin"}sendMessage(e){return new Promise(a=>{window.OverlayPluginApi.callHandler(JSON.stringify(e),a)})}waitForApi(){if(!window.OverlayPluginApi||!window.OverlayPluginApi.ready){setTimeout(()=>this.waitForApi(),300);return}window.__OverlayCallback=this.evtHandlerWrapper,this.connected=!0,this.dispatchEvent(new Event("connected"))}}class De extends EventTarget{constructor(e){super();t(this,"ws");t(this,"sequence",0);t(this,"responseResolvers",new Map);t(this,"evtHandler",()=>{});t(this,"connected",!1);this.ws=new WebSocket(e),this.connect(this.ws)}connect(e){e.addEventListener("open",this.onOpen.bind(this)),e.addEventListener("error",this.onError.bind(this)),e.addEventListener("message",this.onMessage.bind(this)),e.addEventListener("close",this.onClosed.bind(this))}onError(e){console.error(e)}onOpen(){console.log("WebSocket connected"),this.connected=!0,this.dispatchEvent(new Event("connected"))}onMessage(e){try{const a=JSON.parse(e.data);if("rseq"in a){const c=a.rseq;this.responseResolvers.has(c)&&(this.responseResolvers.get(c)(a),this.responseResolvers.delete(c))}else this.dispatchEvent(new CustomEvent("message",{detail:a}))}catch{console.error("Failed to parse WebSocket message",e)}}onClosed(e){console.log("WebSocket closed",e),this.connected=!1,setTimeout(()=>{console.log("WebSocket reconnecting..."),this.ws=new WebSocket(this.ws.url),this.connect(this.ws)},3e3)}get transportType(){return"websocket"}sendMessage(e){const a=this.sequence++;return e.rseq=a,new Promise(c=>{this.responseResolvers.set(a,c),this.ws.send(JSON.stringify(e))})}set eventHandler(e){this.evtHandler=e}}class y{constructor(){t(this,"hid");t(this,"api",new fe);t(this,"handlerMap",new Map);this.hid=p(this.api)}Fetch(s,e={}){const a={call:"Fetch",resource:s,options:e};return this.api.callOverlayHandler(a)}async SubscribePacket(s,e,a){const c={call:"otk::packet",action:"subscribe",name:s,evt_name:"otk::packet::"+s,filters:e},h=await this.api.callOverlayHandler(c);if(h.error)throw new Error(h.error);return h.evt_name?(this.api.addOverlayListener(h.evt_name,u=>this.packetHandler(u,!1)),this.api.startOverlayEvents()):console.warn("plugin does not support evt_name for packet subscription, may < 0.4.0"),this.handlerMap.set(h.name||s,{handler:a,evt_name:h.evt_name}),h.name||s}async UnsubscribePacket(s){const e={call:"otk::packet",action:"unsubscribe",name:s},a=await this.api.callOverlayHandler(e);if(a.error)throw new Error(a.error);this.handlerMap.delete(s)}packetHandler(s,e=!1){let a=s,c=s;c.data=Uint8Array.from(atob(a.msg),u=>u.charCodeAt(0));let h=this.handlerMap.get(a.name);if(h){if(e&&h.evt_name)return;h.handler(c)}else e||console.warn("No packet handler for name",a.name)}async GetGameVersion(){const s={call:"otk::game_ver"};return this.api.callOverlayHandler(s)}async GetPluginVersion(){const s={call:"otk::plugin_ver"};return(await this.api.callOverlayHandler(s)).version}Start(){this.api.addOverlayListener("otk::packet",s=>this.packetHandler(s,!0)),this.api.startOverlayEvents()}Dispatch(s){this.api.dispatchOverlayEvent(s)}AddListener(s,e){this.api.addOverlayListener(s,e)}RemoveListener(s,e){this.api.removeOverlayListener(s,e)}Call(s){return this.api.callOverlayHandler(s)}IsOverlayPluginCEF(){return"OverlayPluginApi"in window}tryConnectToCEF(){if(!this.IsOverlayPluginCEF()){setTimeout(()=>this.tryConnectToCEF(),300);return}const s=new ke;this.api.setTransport(s),s.waitForApi()}Connect(s=""){if(this.tryConnectToCEF(),s||(s=new URLSearchParams(location.search).get("OVERLAY_WS")),s){if(this.IsOverlayPluginCEF()){console.warn("OverlayToolkit: Connect wsUrl ignored in OverlayPlugin CEF environment");return}const e=new De(s);this.api.setTransport(e)}}}class i{constructor(s,e){t(this,"type");t(this,"typeCode");t(this,"time");this.typeCode=parseInt(e[0]),this.time=e[1],this.type=s}get timeDate(){return new Date(this.time)}}class v extends i{constructor(e){super("LogLine",e);t(this,"code");t(this,"name");t(this,"line");this.code=e[2],this.name=e[3],this.line=e[4]}}class f extends i{constructor(e){super("ChangeZone",e);t(this,"zoneID");t(this,"zoneName");this.zoneID=parseInt(e[2],16),this.zoneName=e[3]}}class k extends i{constructor(e){super("ChangePrimaryPlayer",e);t(this,"charID");t(this,"charName");this.charID=parseInt(e[2],16),this.charName=e[3]}get charIDHex(){return this.charID.toString(16).toUpperCase()}}class D extends i{constructor(e){super("AddCombatant",e);t(this,"id");t(this,"name");t(this,"job");t(this,"level");t(this,"ownerID");t(this,"worldID");t(this,"worldName");t(this,"npcNameID");t(this,"npcBaseID");t(this,"currentHP");t(this,"hp");t(this,"currentMP");t(this,"mp");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.job=parseInt(e[4],16),this.level=parseInt(e[5],16),this.ownerID=parseInt(e[6],16),this.worldID=parseInt(e[7],16),this.worldName=e[8],this.npcNameID=parseInt(e[9]),this.npcBaseID=parseInt(e[10]),this.currentHP=parseInt(e[11]),this.hp=parseInt(e[12]),this.currentMP=parseInt(e[13]),this.mp=parseInt(e[14]),this.x=parseFloat(e[17]),this.y=parseFloat(e[18]),this.z=parseFloat(e[19]),this.heading=parseFloat(e[20])}}class l extends i{constructor(e){super("RemoveCombatant",e);t(this,"id");t(this,"name");t(this,"job");t(this,"level");t(this,"ownerID");t(this,"world");t(this,"npcNameID");t(this,"npcBaseID");t(this,"currentHP");t(this,"hp");t(this,"currentMP");t(this,"mp");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.job=parseInt(e[4],16),this.level=parseInt(e[5],16),this.ownerID=parseInt(e[6],16),this.world=e[8],this.npcNameID=parseInt(e[9]),this.npcBaseID=parseInt(e[10]),this.currentHP=parseInt(e[11]),this.hp=parseInt(e[12]),this.currentMP=parseInt(e[13]),this.mp=parseInt(e[14]),this.x=parseFloat(e[17]),this.y=parseFloat(e[18]),this.z=parseFloat(e[19]),this.heading=parseFloat(e[20])}}class N extends i{constructor(e){super("PartyChanged",e);t(this,"party");this.party=[];let a=parseInt(e[2]);for(let c=0;c<a;c++)this.party.push(parseInt(e[3+c],16))}}class P extends i{constructor(e){super("PlayerStats",e);t(this,"job");t(this,"strength");t(this,"dexterity");t(this,"vitality");t(this,"intelligence");t(this,"mind");t(this,"piety");t(this,"attackPower");t(this,"directHit");t(this,"criticalHit");t(this,"attakcMagicPotency");t(this,"healingMagicPotency");t(this,"determination");t(this,"skillSpeed");t(this,"spellSpeed");t(this,"tenacity");t(this,"localContentID");this.job=parseInt(e[2],16),this.strength=parseInt(e[3]),this.dexterity=parseInt(e[4]),this.vitality=parseInt(e[5]),this.intelligence=parseInt(e[6]),this.mind=parseInt(e[7]),this.piety=parseInt(e[8]),this.attackPower=parseInt(e[9]),this.directHit=parseInt(e[10]),this.criticalHit=parseInt(e[11]),this.attakcMagicPotency=parseInt(e[12]),this.healingMagicPotency=parseInt(e[13]),this.determination=parseInt(e[14]),this.skillSpeed=parseInt(e[15]),this.spellSpeed=parseInt(e[16]),this.tenacity=parseInt(e[18]),this.localContentID=parseInt(e[19],16)}}class C extends i{constructor(e){super("NetworkStartsCasting",e);t(this,"sourceID");t(this,"sourceName");t(this,"id");t(this,"ability");t(this,"targetID");t(this,"targetName");t(this,"castTime");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.sourceID=parseInt(e[2],16),this.sourceName=e[3],this.id=parseInt(e[4],16),this.ability=e[5],this.targetID=parseInt(e[6],16),this.targetName=e[7],this.castTime=parseFloat(e[8]),this.x=parseFloat(e[9]),this.y=parseFloat(e[10]),this.z=parseFloat(e[11]),this.heading=parseFloat(e[12])}}class b extends i{constructor(e){super(e[0]=="22"?"NetworkAOEAbility":"NetworkAbility",e);t(this,"sourceID");t(this,"sourceName");t(this,"id");t(this,"ability");t(this,"targetID");t(this,"targetName");t(this,"effects");t(this,"targetCurrentHP");t(this,"targetMaxHP");t(this,"targetCurrentMP");t(this,"targetMaxMP");t(this,"targetX");t(this,"targetY");t(this,"targetZ");t(this,"targetHeading");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"sequence");t(this,"targetIndex");t(this,"targetCount");t(this,"ownerID");t(this,"ownerName");t(this,"effectDisplayType");t(this,"actionID");t(this,"actionAnimationID");t(this,"animationLockTime");t(this,"rotationHex");this.sourceID=parseInt(e[2],16),this.sourceName=e[3],this.id=parseInt(e[4],16),this.ability=e[5],this.targetID=parseInt(e[6],16),this.targetName=e[7],this.effects=[];for(let a=0;a<8;a++)this.effects[a]={flags:parseInt(e[8+a*2],16),damage:e[9+a*2]};this.targetCurrentHP=parseInt(e[24]),this.targetMaxHP=parseInt(e[25]),this.targetCurrentMP=parseInt(e[26]),this.targetMaxMP=parseInt(e[27]),this.targetX=parseFloat(e[30]),this.targetY=parseFloat(e[31]),this.targetZ=parseFloat(e[32]),this.targetHeading=parseFloat(e[33]),this.currentHP=parseInt(e[34]),this.maxHP=parseInt(e[35]),this.currentMP=parseInt(e[36]),this.maxMP=parseInt(e[37]),this.x=parseFloat(e[40]),this.y=parseFloat(e[41]),this.z=parseFloat(e[42]),this.heading=parseFloat(e[43]),this.sequence=parseInt(e[44],16),this.targetIndex=parseInt(e[45]),this.targetCount=parseInt(e[46]),this.ownerID=parseInt(e[47],16),this.ownerName=e[48],this.effectDisplayType=parseInt(e[49]),this.actionID=parseInt(e[50],16),this.actionAnimationID=parseInt(e[51],16),this.animationLockTime=parseFloat(e[52]),this.rotationHex=parseInt(e[53],16)}}class x extends i{constructor(e){super("NetworkCancelAbility",e);t(this,"sourceID");t(this,"source");t(this,"id");t(this,"name");t(this,"reason");this.sourceID=parseInt(e[2],16),this.source=e[3],this.id=parseInt(e[4],16),this.name=e[5],this.reason=e[6]}}class M extends i{constructor(e){super("NetworkDoT",e);t(this,"id");t(this,"name");t(this,"which");t(this,"effectID");t(this,"damage");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"sourceID");t(this,"sourceName");t(this,"damageType");t(this,"sourceCurrentHP");t(this,"sourceMaxHP");t(this,"sourceCurrentMP");t(this,"sourceMaxMP");t(this,"sourceX");t(this,"sourceY");t(this,"sourceZ");t(this,"sourceHeading");this.id=parseInt(e[2],16),this.name=e[3],this.which=e[4],this.effectID=parseInt(e[5],16),this.damage=parseInt(e[6]),this.currentHP=parseInt(e[7]),this.maxHP=parseInt(e[8]),this.currentMP=parseInt(e[9]),this.maxMP=parseInt(e[10]),this.x=parseFloat(e[13]),this.y=parseFloat(e[14]),this.z=parseFloat(e[15]),this.heading=parseFloat(e[16]),this.sourceID=parseInt(e[17],16),this.sourceName=e[18],this.damageType=parseInt(e[19],16),this.sourceCurrentHP=parseInt(e[20]),this.sourceMaxHP=parseInt(e[21]),this.sourceCurrentMP=parseInt(e[22]),this.sourceMaxMP=parseInt(e[23]),this.sourceX=parseFloat(e[26]),this.sourceY=parseFloat(e[27]),this.sourceZ=parseFloat(e[28]),this.sourceHeading=parseFloat(e[29])}}class F extends i{constructor(e){super("NetworkDeath",e);t(this,"targetID");t(this,"targetName");t(this,"sourceID");t(this,"sourceName");this.targetID=parseInt(e[2],16),this.targetName=e[3],this.sourceID=parseInt(e[4],16),this.sourceName=e[5]}}class E extends i{constructor(e){super("NetworkBuff",e);t(this,"effectID");t(this,"effectName");t(this,"duration");t(this,"sourceID");t(this,"sourceName");t(this,"targetID");t(this,"targetName");t(this,"count");t(this,"targetMaxHP");t(this,"sourceMaxHP");this.effectID=parseInt(e[2],16),this.effectName=e[3],this.duration=parseFloat(e[4]),this.sourceID=parseInt(e[5],16),this.sourceName=e[6],this.targetID=parseInt(e[7],16),this.targetName=e[8],this.count=parseInt(e[9]),this.targetMaxHP=parseInt(e[10]==""?"-1":e[10]),this.sourceMaxHP=parseInt(e[11]==""?"-1":e[11])}}class H extends i{constructor(e){super("NetworkTargetIcon",e);t(this,"targetID");t(this,"targetName");t(this,"id");t(this,"data0");this.targetID=parseInt(e[2],16),this.targetName=e[3],this.id=parseInt(e[6],16),this.data0=parseInt(e[7],16)}}class T extends i{constructor(e){super("NetworkRaidMarker",e);t(this,"operation");t(this,"waymark");t(this,"id");t(this,"name");t(this,"x");t(this,"y");t(this,"z");this.operation=e[2],this.waymark=parseInt(e[3]),this.id=parseInt(e[4],16),this.name=e[5],this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8])}}class S extends i{constructor(e){super("NetworkTargetMarker",e);t(this,"operation");t(this,"waymark");t(this,"id");t(this,"name");t(this,"targetID");t(this,"targetName");this.operation=e[2],this.waymark=parseInt(e[3]),this.id=parseInt(e[4],16),this.name=e[5],this.targetID=parseInt(e[6],16),this.targetName=e[7]}}class L extends i{constructor(e){super("NetworkBuffRemove",e);t(this,"effectID");t(this,"effectName");t(this,"sourceID");t(this,"sourceName");t(this,"targetID");t(this,"targetName");t(this,"count");this.effectID=parseInt(e[2],16),this.effectName=e[3],this.sourceID=parseInt(e[5],16),this.sourceName=e[6],this.targetID=parseInt(e[7],16),this.targetName=e[8],this.count=parseInt(e[9],16)}}class A extends i{constructor(e){super("NetworkGauge",e);t(this,"id");t(this,"data");this.id=parseInt(e[2],16),this.data=new Uint8Array(16);let a=new DataView(this.data.buffer);for(let c=0;c<4;c++){let h=parseInt(e[3+c]);a.setUint32(c*4,h,!0)}}}class O extends i{constructor(e){super("NetworkActorControl",e);t(this,"instance");t(this,"command");t(this,"data");this.instance=parseInt(e[2],16),this.command=parseInt(e[3],16),this.data=[];for(let a=0;a<4;a++)this.data.push(parseInt(e[4+a],16))}}class q extends i{constructor(e){super("NetworkNameToggle",e);t(this,"id");t(this,"name");t(this,"targetID");t(this,"targetName");t(this,"toggle");this.id=parseInt(e[2],16),this.name=e[3],this.targetID=parseInt(e[4],16),this.targetName=e[5],this.toggle=parseInt(e[6])===1}}class z extends i{constructor(e){super("NetworkTether",e);t(this,"sourceID");t(this,"sourceName");t(this,"targetID");t(this,"targetName");t(this,"id");this.sourceID=parseInt(e[2],16),this.sourceName=e[3],this.targetID=parseInt(e[4],16),this.targetName=e[5],this.id=parseInt(e[8],16)}}class R extends i{constructor(e){super("LimitBreak",e);t(this,"value");t(this,"bars");this.value=parseInt(e[2],16),this.bars=parseInt(e[3])}}class B extends i{constructor(e){super("NetworkActionSync",e);t(this,"id");t(this,"name");t(this,"sequenceID");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"currentShield");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.sequenceID=parseInt(e[4],16),this.currentHP=e[5]?parseInt(e[5]):-1,this.maxHP=e[6]?parseInt(e[6]):-1,this.currentMP=e[7]?parseInt(e[7]):-1,this.maxMP=e[8]?parseInt(e[8]):-1,this.currentShield=e[9]?parseInt(e[9]):-1,this.x=parseFloat(e[11]),this.y=parseFloat(e[12]),this.z=parseFloat(e[13]),this.heading=parseFloat(e[14])}}class U extends i{constructor(e){super("NetworkStatusEffects",e);t(this,"targetID");t(this,"targetName");t(this,"jobLevelData");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"currentShield");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"data");this.targetID=parseInt(e[2],16),this.targetName=e[3],this.jobLevelData=parseInt(e[4],16),this.currentHP=parseInt(e[5]),this.maxHP=parseInt(e[6]),this.currentMP=parseInt(e[7]),this.maxMP=parseInt(e[8]),this.currentShield=parseInt(e[9]),this.x=parseFloat(e[11]),this.y=parseFloat(e[12]),this.z=parseFloat(e[13]),this.heading=parseFloat(e[14]),this.data=[];for(let a=0;a<6;a++)this.data.push(parseInt(e[15+a],16))}}class j extends i{constructor(e){super("NetworkUpdateHP",e);t(this,"id");t(this,"name");t(this,"currentHP");t(this,"maxHP");t(this,"currentMP");t(this,"maxMP");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.id=parseInt(e[2],16),this.name=e[3],this.currentHP=parseInt(e[4]),this.maxHP=parseInt(e[5]),this.currentMP=parseInt(e[6]),this.maxMP=parseInt(e[7]),this.x=parseFloat(e[10]),this.y=parseFloat(e[11]),this.z=parseFloat(e[12]),this.heading=parseFloat(e[13])}}class _ extends i{constructor(e){super("Map",e);t(this,"id");t(this,"regionName");t(this,"placeName");t(this,"placeNameSub");this.id=parseInt(e[2],16),this.regionName=e[3],this.placeName=e[4],this.placeNameSub=e[5]}}class G extends i{constructor(e){super("SystemLogMessage",e);t(this,"instance");t(this,"id");t(this,"params");this.instance=parseInt(e[2],16),this.id=parseInt(e[3],16),this.params=[];for(let a=0;a<3;a++)this.params.push(parseInt(e[4+a],16))}}class V extends i{constructor(e){super("StatusList3",e);t(this,"id");t(this,"name");t(this,"statusList");this.id=parseInt(e[2],16),this.name=e[3],this.statusList=[];for(let a=0;a<e.length-4-1;a++)this.statusList.push(parseInt(e[4+a],16))}}class W extends i{constructor(e){super("Debug",e);t(this,"message");this.message=e[2]}}class Y extends i{constructor(e){super("PacketDump",e);t(this,"len");t(this,"src");t(this,"dst");t(this,"packetType");t(this,"data");this.len=parseInt(e[2],16),this.src=parseInt(e[3],16),this.dst=parseInt(e[4],16),this.packetType=parseInt(e[5],16)&65535,this.data=new Uint8Array(this.len-16);for(let a=6,c=0;a<e.length-2;a++,c++){const h=parseInt(e[a],16);for(let u=0;u<4;u++)this.data[c*4+u]=h>>u*8&255}}}class Z extends i{constructor(e){super("Version",e);t(this,"message");this.message=e[2]}}let X=class extends i{constructor(e){super("Error",e);t(this,"message");this.message=e[2]}};class J extends i{constructor(e){super("LineRegistration",e);t(this,"id");t(this,"source");t(this,"name");t(this,"version");this.id=parseInt(e[2]),this.source=e[3],this.name=e[4],this.version=e[5]}}class K extends i{constructor(e){super("MapEffect",e);t(this,"instance");t(this,"flags");t(this,"location");t(this,"data0");t(this,"data1");this.instance=parseInt(e[2],16),this.flags=parseInt(e[3],16),this.location=parseInt(e[4],16),this.data0=parseInt(e[5],16),this.data1=parseInt(e[6],16)}}class $ extends i{constructor(e){super("FateDirector",e);t(this,"category");t(this,"unknown");t(this,"id");t(this,"progress");this.category=e[2],this.unknown=parseInt(e[3],16),this.id=parseInt(e[4],16),this.progress=parseInt(e[5],16)}}class Q extends i{constructor(e){super("CEDirector",e);t(this,"popTime");t(this,"timeRemaining");t(this,"unknown");t(this,"ceKey");t(this,"numPlayers");t(this,"status");t(this,"unknown2");t(this,"progress");this.popTime=parseInt(e[2],16),this.timeRemaining=parseInt(e[3],16),this.unknown=parseInt(e[4],16),this.ceKey=parseInt(e[5],16),this.numPlayers=parseInt(e[6],16),this.status=parseInt(e[7],16),this.unknown2=parseInt(e[8],16),this.progress=parseInt(e[9],16)}}class g extends i{constructor(e){super("InCombat",e);t(this,"inACTCombat");t(this,"inGameCombat");t(this,"isACTChanged");t(this,"isGameChanged");this.inACTCombat=parseInt(e[2])===1,this.inGameCombat=parseInt(e[3])===1,this.isACTChanged=parseInt(e[4])===1,this.isGameChanged=parseInt(e[5])===1}}class ee extends i{constructor(e){super("CombatantMemory",e);t(this,"change");t(this,"id");t(this,"data");this.change=e[2],this.id=parseInt(e[3],16),this.data=new Map;for(let a=4;a<e.length-1;a+=2)this.data.set(e[a],e[a+1])}}class te extends i{constructor(e){super("RSVData",e);t(this,"locale");t(this,"unknown");t(this,"key");t(this,"value");this.locale=e[2],this.unknown=parseInt(e[3],16),this.key=e[4],this.value=e[5]}}class se extends i{constructor(e){super("StartsUsingExtra",e);t(this,"sourceID");t(this,"id");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");this.sourceID=parseInt(e[2],16),this.id=parseInt(e[3],16),this.x=parseFloat(e[4]),this.y=parseFloat(e[5]),this.z=parseFloat(e[6]),this.heading=parseFloat(e[7])}}class re extends i{constructor(e){super("AbilityExtra",e);t(this,"sourceID");t(this,"id");t(this,"globalEffectCounter");t(this,"dataFlag");t(this,"x");t(this,"y");t(this,"z");t(this,"heading");t(this,"animationTargetId");this.sourceID=parseInt(e[2],16),this.id=parseInt(e[3],16),this.globalEffectCounter=parseInt(e[4],16),this.dataFlag=parseInt(e[5],16),this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8]),this.heading=parseFloat(e[9]),this.animationTargetId=parseInt(e[10],16)}}class ae extends i{constructor(e){super("ContentFinderSettings",e);t(this,"zoneID");t(this,"zoneName");t(this,"inContentFinderContent");t(this,"unrestrictedParty");t(this,"minimalItemLevel");t(this,"silenceEcho");t(this,"explorerMode");t(this,"levelSync");this.zoneID=parseInt(e[2],16),this.zoneName=e[3],this.inContentFinderContent=parseInt(e[4])===1,this.unrestrictedParty=parseInt(e[5])===1,this.minimalItemLevel=parseInt(e[6])===1,this.silenceEcho=parseInt(e[7])===1,this.explorerMode=parseInt(e[8])===1,this.levelSync=parseInt(e[9])===1}}class ne extends i{constructor(e){super("NpcYell",e);t(this,"npcId");t(this,"npcNameId");t(this,"npcYellId");this.npcId=parseInt(e[2],16),this.npcNameId=parseInt(e[3],16),this.npcYellId=parseInt(e[4],16)}}class ie extends i{constructor(e){super("BattleTalk2",e);t(this,"npcId");t(this,"instance");t(this,"npcNameId");t(this,"instanceContentTextId");t(this,"displayMs");this.npcId=parseInt(e[2],16),this.instance=parseInt(e[3],16),this.npcNameId=parseInt(e[4],16),this.instanceContentTextId=parseInt(e[5],16),this.displayMs=parseInt(e[6])}}class ce extends i{constructor(e){super("Countdown",e);t(this,"id");t(this,"worldID");t(this,"countdownTime");t(this,"result");t(this,"name");this.id=parseInt(e[2],16),this.worldID=parseInt(e[3],16),this.countdownTime=parseInt(e[4]),this.result=parseInt(e[5],16),this.name=e[6]}}class he extends i{constructor(e){super("CountdownCancel",e);t(this,"id");t(this,"worldID");t(this,"name");this.id=parseInt(e[2],16),this.worldID=parseInt(e[3],16),this.name=e[4]}}class pe extends i{constructor(e){super("ActorMove",e);t(this,"id");t(this,"heading");t(this,"unk1");t(this,"unk2");t(this,"x");t(this,"y");t(this,"z");this.id=parseInt(e[2],16),this.heading=parseFloat(e[3]),this.unk1=parseInt(e[4],16),this.unk2=parseInt(e[5],16),this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8])}}class ue extends i{constructor(e){super("ActorSetPos",e);t(this,"id");t(this,"heading");t(this,"unk1");t(this,"unk2");t(this,"x");t(this,"y");t(this,"z");this.id=parseInt(e[2],16),this.heading=parseFloat(e[3]),this.unk1=parseInt(e[4],16),this.unk2=parseInt(e[5],16),this.x=parseFloat(e[6]),this.y=parseFloat(e[7]),this.z=parseFloat(e[8])}}class de extends i{constructor(e){super("SpawnNpcExtra",e);t(this,"id");t(this,"parentID");t(this,"tetherID");t(this,"animationState");this.id=parseInt(e[2],16),this.parentID=parseInt(e[3],16),this.tetherID=parseInt(e[4],16),this.animationState=parseInt(e[5],16)}}class oe extends i{constructor(e){super("ActorControlExtra",e);t(this,"id");t(this,"category");t(this,"param1");t(this,"param2");t(this,"param3");t(this,"param4");this.id=parseInt(e[2],16),this.category=parseInt(e[3],16),this.param1=parseInt(e[4],16),this.param2=parseInt(e[5],16),this.param3=parseInt(e[6],16),this.param4=parseInt(e[7],16)}}class Ie extends i{constructor(e){super("ActorControlSelfExtra",e);t(this,"id");t(this,"category");t(this,"param1");t(this,"param2");t(this,"param3");t(this,"param4");t(this,"param5");t(this,"param6");this.id=parseInt(e[2],16),this.category=parseInt(e[3],16),this.param1=parseInt(e[4],16),this.param2=parseInt(e[5],16),this.param3=parseInt(e[6],16),this.param4=parseInt(e[7],16),this.param5=parseInt(e[8],16),this.param6=parseInt(e[9],16)}}class me extends i{constructor(e){super("Unknown",e);t(this,"rawLines");this.rawLines=e}}function le(r){switch(parseInt(r[0])){case 0:return new v(r);case 1:return new f(r);case 2:return new k(r);case 3:return new D(r);case 4:return new l(r);case 11:return new N(r);case 12:return new P(r);case 20:return new C(r);case 21:case 22:return new b(r);case 23:return new x(r);case 24:return new M(r);case 25:return new F(r);case 26:return new E(r);case 27:return new H(r);case 28:return new T(r);case 29:return new S(r);case 30:return new L(r);case 31:return new A(r);case 33:return new O(r);case 34:return new q(r);case 35:return new z(r);case 36:return new R(r);case 37:return new B(r);case 38:return new U(r);case 39:return new j(r);case 40:return new _(r);case 41:return new G(r);case 42:return new V(r);case 251:return new W(r);case 252:return new Y(r);case 253:return new Z(r);case 254:return new X(r);case 256:return new J(r);case 257:return new K(r);case 258:return new $(r);case 259:return new Q(r);case 260:return new g(r);case 261:return new ee(r);case 262:return new te(r);case 263:return new se(r);case 264:return new re(r);case 265:return new ae(r);case 266:return new ne(r);case 267:return new ie(r);case 268:return new ce(r);case 269:return new he(r);case 270:return new pe(r);case 271:return new ue(r);case 272:return new de(r);case 273:return new oe(r);case 274:return new Ie(r);default:return new me(r)}}let we=new y;(function(){we.Connect()})(),n.AbilityExtra=re,n.ActorControlExtra=oe,n.ActorControlSelfExtra=Ie,n.ActorMove=pe,n.ActorSetPos=ue,n.AddCombatant=D,n.BattleTalk2=ie,n.CEDirector=Q,n.ChangePrimaryPlayer=k,n.ChangeZone=f,n.CombatantMemory=ee,n.ContentFinderSettings=ae,n.Countdown=ce,n.CountdownCancel=he,n.Debug=W,n.Error=X,n.FateDirector=$,n.GameLogLine=v,n.InCombat=g,n.LimitBreak=R,n.LineRegistration=J,n.LogLineBase=i,n.MapEffect=K,n.MapLog=_,n.NetowrkStartsCasting=C,n.NetworkAbility=b,n.NetworkActionSync=B,n.NetworkActorControl=O,n.NetworkBuff=E,n.NetworkBuffRemove=L,n.NetworkCancelAbility=x,n.NetworkDeath=F,n.NetworkDoT=M,n.NetworkGauge=A,n.NetworkNameToggle=q,n.NetworkRaidMarker=T,n.NetworkStatusEffects=U,n.NetworkTargetIcon=H,n.NetworkTargetMarker=S,n.NetworkTether=z,n.NetworkUpdateHP=j,n.NpcYell=ne,n.OverlayToolkit=y,n.PacketDump=Y,n.ParseLogLine=le,n.PartyList=N,n.PlayerStats=P,n.RSVData=te,n.RemoveCombatant=l,n.SpawnNpcExtra=de,n.StartsUsingExtra=se,n.StatusList3=V,n.SystemLogMessage=G,n.UnknownLogLine=me,n.Version=Z,n.default=we,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/packet.d.ts CHANGED
@@ -61,11 +61,18 @@ export interface PacketSubscribeRequest {
61
61
  call: "otk::packet";
62
62
  action: "subscribe";
63
63
  name: string;
64
+ evt_name?: string;
64
65
  filters: PacketFilter[];
65
66
  }
66
67
  export interface PacketSubscribeResponse {
67
68
  name?: string;
68
69
  error?: string;
70
+ /**
71
+ * Event name for this subscription
72
+ *
73
+ * @since 0.4.0
74
+ */
75
+ evt_name?: string;
69
76
  }
70
77
  export interface PacketUnsubscribeRequest {
71
78
  call: "otk::packet";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "overlay-toolkit",
3
3
  "private": false,
4
- "version": "0.10.1",
4
+ "version": "0.11.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"