overlay-toolkit 0.9.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.
@@ -0,0 +1,3 @@
1
+ (function(n,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(n=typeof globalThis<"u"?globalThis:n||self,I(n.overlayToolkit={}))})(this,function(n){"use strict";var xe=Object.defineProperty;var Me=(n,I,w)=>I in n?xe(n,I,{enumerable:!0,configurable:!0,writable:!0,value:w}):n[I]=w;var t=(n,I,w)=>Me(n,typeof I!="symbol"?I+"":I,w);(function(){let s=/[\?&]OVERLAY_WS=([^&]+)/.exec(location.href),a=null,e=[],r=0,c={},h={},o=null,Ne=!1;if(s){let u=function(){a=new WebSocket(s[1]),a.addEventListener("error",p=>{console.error(p)}),a.addEventListener("open",()=>{console.log("Connected!");let p=e;e=null;for(let d of p)o(d)}),a.addEventListener("message",p=>{try{p=JSON.parse(p.data)}catch{console.error("Invalid message received: ",p);return}p.rseq!==void 0&&c[p.rseq]?(c[p.rseq](p),delete c[p.rseq]):y(p)}),a.addEventListener("close",()=>{e=[],console.log("Trying to reconnect..."),setTimeout(()=>{u()},300)})};o=p=>{e?e.push(p):a.send(JSON.stringify(p))},u()}else{let u=function(){if(!window.OverlayPluginApi||!window.OverlayPluginApi.ready){setTimeout(u,300);return}let p=e;e=null,window.__OverlayCallback=y;for(let[d,m]of p)o(d,m)};o=(p,d)=>{e?e.push([p,d]):OverlayPluginApi.callHandler(JSON.stringify(p),d)},u()}function y(u){if(h[u.type])for(let p of h[u.type])p(u)}window.dispatchOverlayEvent=y,window.addOverlayListener=(u,p)=>{Ne&&h[u]&&console.warn(`A new listener for ${u} has been registered after event transmission has already begun.
2
+ Some events might have been missed and no cached values will be transmitted.
3
+ Please register your listeners before calling startOverlayEvents().`),h[u]||(h[u]=[]),h[u].push(p)},window.removeOverlayListener=(u,p)=>{if(h[u]){let d=h[u],m=d.indexOf(p);m>-1&&d.splice(m,1)}},window.callOverlayHandler=u=>{let p;return a?(u.rseq=r++,p=new Promise(d=>{c[u.rseq]=d}),o(u)):p=new Promise(d=>{o(u,m=>{d(m==null?null:JSON.parse(m))})}),p},window.startOverlayEvents=()=>{Ne=!1,o({call:"subscribe",events:Object.keys(h)})}})();function I(){return new w}class w extends EventTarget{constructor(){super();t(this,"onconnect",null);t(this,"ondisconnect",null);t(this,"devices",new Map);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 r=[];return e.forEach(c=>{if(this.devices.has(c.instanceId))r.push(this.devices.get(c.instanceId));else{const h=new D(c);this.devices.set(c.instanceId,h),r.push(h)}}),r}async requestDevice(e){return e&&console.log("Requesting device with options:",e),this.getDevices()}async requestGetDevices(){return(await f("getDevices",{})).devices}addListener(){addOverlayListener("otk::hid::inputreport",e=>this.callbackInputReport(e)),addOverlayListener("otk::hid::devicechanged",e=>this.callbackDeviceChanged(e))}callbackInputReport(e){const r=e.instanceId,c=k(e.data),h=this.devices.get(r);h?h.dispatchEvent(new ve("inputreport",h,c[0],new DataView(c.buffer,1))):console.warn("Device not found:",r)}callbackDeviceChanged(e){var r=e.add;const c=new D(e.device),h=new ke(r?"connect":"disconnect",c);this.dispatchEvent(h)}}async function f(s,a){const e={call:"otk::hid",type:s,...a},r=await callOverlayHandler(e);return r.error&&console.log("callOverlayHID error:",s,a,r),r}class D extends EventTarget{constructor(e){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.instanceId=e.instanceId,this.vendorId=e.vendorId,this.productId=e.productId,this.productName=e.productName,this.collections=e.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,r){if(!this.opened)throw new Error("Device is not opened.");await this.request("send",{reportId:e,data:N(r)})}async sendFeatureReport(e,r){if(!this.opened)throw new Error("Device is not opened.");await this.request("sendFeature",{reportId:e,data:N(r)})}async receiveFeatureReport(e){if(!this.opened)throw new Error("Device is not opened.");const r=await this.request("recvFeature",{reportId:e}),c=k(r.data);return new DataView(c.buffer)}async request(e,r){return f(e,{instanceId:this.instanceId,...r})}}class ke extends Event{constructor(e,r){super(e);t(this,"device");this.device=r}}class ve extends Event{constructor(e,r,c,h){super(e);t(this,"device");t(this,"reportId");t(this,"data");this.device=r,this.reportId=c,this.data=h}}function N(s){let a=null;return s instanceof ArrayBuffer?a=new Uint8Array(s):a=new Uint8Array(s.buffer,s.byteOffset,s.byteLength),[...a].map(e=>e.toString(16).padStart(2,"0")).join("")}function k(s){const a=new Uint8Array(Math.ceil(s.length/2));for(let e=0;e<s.length;)a[e/2]=Number.parseInt(s.slice(e,e+=2),16);return a}class Pe{constructor(){t(this,"handlerMap",new Map);t(this,"hid",I())}Fetch(a,e={}){const r={call:"Fetch",resource:a,options:e};return callOverlayHandler(r)}async SubscribePacket(a,e,r){const c={call:"otk::packet",action:"subscribe",name:a,filters:e},h=await callOverlayHandler(c);if(h.error)throw new Error(h.error);return this.handlerMap.set(h.name||a,r),h.name||a}async UnsubscribePacket(a){const e={call:"otk::packet",action:"unsubscribe",name:a},r=await callOverlayHandler(e);if(r.error)throw new Error(r.error);this.handlerMap.delete(a)}packetHandler(a){let e=a,r=a;r.data=Uint8Array.from(atob(e.msg),h=>h.charCodeAt(0));let c=this.handlerMap.get(e.name);c?c(r):console.warn("No packet handler for name",e.name)}async GetGameVersion(){const a={call:"otk::game_ver"};return callOverlayHandler(a)}Start(){addOverlayListener("otk::packet",a=>this.packetHandler(a)),startOverlayEvents()}Dispatch(a){dispatchOverlayEvent(a)}AddListener(a,e){addOverlayListener(a,e)}RemoveListener(a,e){removeOverlayListener(a,e)}Call(a){return callOverlayHandler(a)}IsOverlayPluginCEF(){return"OverlayPluginApi"in window}}class i{constructor(a,e){t(this,"type");t(this,"typeCode");t(this,"time");this.typeCode=parseInt(e[0]),this.time=e[1],this.type=a}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 P extends i{constructor(e){super("ChangeZone",e);t(this,"zoneID");t(this,"zoneName");this.zoneID=parseInt(e[2],16),this.zoneName=e[3]}}class l 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 C 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 x 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 M extends i{constructor(e){super("PartyChanged",e);t(this,"party");this.party=[];let r=parseInt(e[2]);for(let c=0;c<r;c++)this.party.push(parseInt(e[3+c],16))}}class b 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 F 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 H 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 r=0;r<8;r++)this.effects[r]={flags:parseInt(e[8+r*2],16),damage:e[9+r*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 S 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 E 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 L 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 T 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 A 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 O 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 z 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 q 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 R 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 r=new DataView(this.data.buffer);for(let c=0;c<4;c++){let h=parseInt(e[3+c]);r.setUint32(c*4,h,!0)}}}class B 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 r=0;r<4;r++)this.data.push(parseInt(e[4+r],16))}}class U 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 j 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 G 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 V 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 Y 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 r=0;r<6;r++)this.data.push(parseInt(e[15+r],16))}}class Z 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 J 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 r=0;r<3;r++)this.params.push(parseInt(e[4+r],16))}}class X 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 r=0;r<e.length-4-1;r++)this.statusList.push(parseInt(e[4+r],16))}}class W extends i{constructor(e){super("Debug",e);t(this,"message");this.message=e[2]}}class K 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 r=6,c=0;r<e.length-2;r++,c++){const h=parseInt(e[r],16);for(let o=0;o<4;o++)this.data[c*4+o]=h>>o*8&255}}}class $ extends i{constructor(e){super("Version",e);t(this,"message");this.message=e[2]}}let Q=class extends i{constructor(e){super("Error",e);t(this,"message");this.message=e[2]}};class g 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 ee 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 te 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 se 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 ae 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 re 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 r=4;r<e.length-1;r+=2)this.data.set(e[r],e[r+1])}}class ne 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 ie 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 ce 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 he 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 pe 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 ue 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 de 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 Ie 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 oe 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 me 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 we 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 ye 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 fe 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 De extends i{constructor(e){super("Unknown",e);t(this,"rawLines");this.rawLines=e}}function le(s){switch(parseInt(s[0])){case 0:return new v(s);case 1:return new P(s);case 2:return new l(s);case 3:return new C(s);case 4:return new x(s);case 11:return new M(s);case 12:return new b(s);case 20:return new F(s);case 21:case 22:return new H(s);case 23:return new S(s);case 24:return new E(s);case 25:return new L(s);case 26:return new T(s);case 27:return new A(s);case 28:return new O(s);case 29:return new z(s);case 30:return new q(s);case 31:return new R(s);case 33:return new B(s);case 34:return new U(s);case 35:return new j(s);case 36:return new G(s);case 37:return new V(s);case 38:return new Y(s);case 39:return new Z(s);case 40:return new _(s);case 41:return new J(s);case 42:return new X(s);case 251:return new W(s);case 252:return new K(s);case 253:return new $(s);case 254:return new Q(s);case 256:return new g(s);case 257:return new ee(s);case 258:return new te(s);case 259:return new se(s);case 260:return new ae(s);case 261:return new re(s);case 262:return new ne(s);case 263:return new ie(s);case 264:return new ce(s);case 265:return new he(s);case 266:return new pe(s);case 267:return new ue(s);case 268:return new de(s);case 269:return new Ie(s);case 270:return new oe(s);case 271:return new me(s);case 272:return new we(s);case 273:return new ye(s);case 274:return new fe(s);default:return new De(s)}}let Ce=new Pe;n.AbilityExtra=ce,n.ActorControlExtra=ye,n.ActorControlSelfExtra=fe,n.ActorMove=oe,n.ActorSetPos=me,n.AddCombatant=C,n.BattleTalk2=ue,n.CEDirector=se,n.ChangePrimaryPlayer=l,n.ChangeZone=P,n.CombatantMemory=re,n.ContentFinderSettings=he,n.Countdown=de,n.CountdownCancel=Ie,n.Debug=W,n.Error=Q,n.FateDirector=te,n.GameLogLine=v,n.InCombat=ae,n.LimitBreak=G,n.LineRegistration=g,n.LogLineBase=i,n.MapEffect=ee,n.MapLog=_,n.NetowrkStartsCasting=F,n.NetworkAbility=H,n.NetworkActionSync=V,n.NetworkActorControl=B,n.NetworkBuff=T,n.NetworkBuffRemove=q,n.NetworkCancelAbility=S,n.NetworkDeath=L,n.NetworkDoT=E,n.NetworkGauge=R,n.NetworkNameToggle=U,n.NetworkRaidMarker=O,n.NetworkStatusEffects=Y,n.NetworkTargetIcon=A,n.NetworkTargetMarker=z,n.NetworkTether=j,n.NetworkUpdateHP=Z,n.NpcYell=pe,n.PacketDump=K,n.ParseLogLine=le,n.PartyList=M,n.PlayerStats=b,n.RSVData=ne,n.RemoveCombatant=x,n.SpawnNpcExtra=we,n.StartsUsingExtra=ie,n.StatusList3=X,n.SystemLogMessage=J,n.UnknownLogLine=De,n.Version=$,n.default=Ce,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Packet filter
3
+ */
4
+ export interface PacketFilter {
5
+ /**
6
+ * Packet direction, true = to server, false = to client
7
+ */
8
+ direction?: boolean;
9
+ /**
10
+ * Opcode
11
+ */
12
+ opcode?: number;
13
+ /**
14
+ * Packet length
15
+ */
16
+ length?: number;
17
+ }
18
+ /**
19
+ * Shared packet information
20
+ */
21
+ export interface PacketInfo {
22
+ /**
23
+ * Event type (must be "otk::packet")
24
+ */
25
+ type: string;
26
+ /**
27
+ * Subscription name
28
+ */
29
+ name: string;
30
+ /**
31
+ * Packet direction, true = to server, false = to client
32
+ */
33
+ dir: boolean;
34
+ /**
35
+ * Connection
36
+ */
37
+ conn: string;
38
+ /**
39
+ * Packet timestamp
40
+ */
41
+ epoch: number;
42
+ /**
43
+ * Packet opcode
44
+ */
45
+ opcode: number;
46
+ /**
47
+ * Packet length
48
+ */
49
+ length: number;
50
+ }
51
+ /**
52
+ * Packet event from overlay plugin
53
+ */
54
+ export interface PacketEvent extends PacketInfo {
55
+ /**
56
+ * Packet data, encoded as base64
57
+ */
58
+ msg: string;
59
+ }
60
+ export interface PacketSubscribeRequest {
61
+ call: "otk::packet";
62
+ action: "subscribe";
63
+ name: string;
64
+ filters: PacketFilter[];
65
+ }
66
+ export interface PacketSubscribeResponse {
67
+ name?: string;
68
+ error?: string;
69
+ }
70
+ export interface PacketUnsubscribeRequest {
71
+ call: "otk::packet";
72
+ action: "unsubscribe";
73
+ name: string;
74
+ }
75
+ export interface Packet extends PacketInfo {
76
+ /**
77
+ * Packet data
78
+ */
79
+ data: Uint8Array;
80
+ }
81
+ export type PacketHandler = (packet: Packet) => void;
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "overlay-toolkit",
3
+ "private": false,
4
+ "version": "0.9.0",
5
+ "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "main": "./dist/overlay-toolkit.umd.cjs",
10
+ "module": "./dist/overlay-toolkit.js",
11
+ "types": "./dist/main.d.ts",
12
+ "scripts": {
13
+ "dev": "vite",
14
+ "build": "tsc && vite build",
15
+ "preview": "vite preview"
16
+ },
17
+ "devDependencies": {
18
+ "@types/w3c-web-hid": "^1.0.6",
19
+ "typescript": "~5.7.2",
20
+ "vite": "^6.3.1",
21
+ "vite-plugin-dts": "^4.5.3"
22
+ }
23
+ }