You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
14 KiB
1 lines
14 KiB
{"version":3,"sources":["ACTListener.js","Action.js","Rotation.js","App.js","index.js"],"names":["getHost","exec","window","location","search","listenToACT","callback","listenActWebSocket","listener","e","detail","document","addEventListener","removeEventListener","listenOverlayPlugin","wsUri","undefined","ws","WebSocket","onerror","close","onclose","setTimeout","onmessage","m","data","send","obj","JSON","parse","msgtype","msg","split","gcdOverrides","Set","ogcdOverrides","actionMap","Map","Action","actionId","additionalClasses","React","useState","apiData","setApiData","useEffect","mapData","get","current","a","fetch","mode","json","set","Icon","className","has","ActionCategoryTargetID","src","alt","Name","RotationContainer","encounterId","name","actionList","open","setOpen","onClick","RotationContents","expanded","map","action","i","handleCodes","App","setActionList","encounterList","setEncounterList","selfId","lastTimestamp","lastAction","currentZone","lastKey","closeFn","openNewEncounter","rotation","length","shift","unshift","slice","logSplit","charID","logCode","logTimestamp","logParameter1","logParameter2","logParameter3","parseInt","Date","now","key","ReactDOM","unstable_batchedUpdates","concat","push","encounter","render","getElementById"],"mappings":"4OAAMA,EAAU,iBAAM,kCAAkCC,KAAKC,OAAOC,SAASC,SAE9D,SAASC,EAAYC,GACnC,OAAKN,IACEO,EAAmBD,GA2B3B,SAA6BA,GAC5B,IAAME,EAAW,SAAAC,GAChBH,EAAQ,WAAR,cAAYG,EAAEC,UAKf,OAFAC,SAASC,iBAAiB,YAAaJ,GAEhC,WACNG,SAASE,oBAAoB,YAAaL,IApCpBM,CAAoBR,GAI5C,SAASC,EAAmBD,GAC3B,IAAMS,EAAQ,UAAGf,IAAU,GAAb,wBAAuCgB,EAC/CC,EAAK,IAAIC,UAAUH,GAiBzB,OAhBAE,EAAGE,QAAU,kBAAMF,EAAGG,SACtBH,EAAGI,QAAU,kBACZC,YAAW,WACVf,EAAmBD,KACjB,MACJW,EAAGM,UAAY,SAASd,EAAGe,GAC1B,GAAe,MAAXf,EAAEgB,KAAc,OAAOR,EAAG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C,GAAZ,OAClB,cAACX,EAAD,CAECC,YAAaU,EACbT,KAAM0C,EAAU1C,KAChBC,WAAYyC,EAAUpB,UAHjBb,WCxIX6B,IAASK,OAAO,cAAC,EAAD,IAAS/F,SAASgG,eAAe,W","file":"static/js/main.5a6b4ae7.chunk.js","sourcesContent":["const getHost = () => /[?&]HOST_PORT=(wss?:\\/\\/[^&/]+)/.exec(window.location.search)\r\n\r\nexport default function listenToACT(callback) {\r\n\tif (!getHost()) return listenOverlayPlugin(callback)\r\n\treturn listenActWebSocket(callback)\r\n}\r\n\r\nfunction listenActWebSocket(callback) {\r\n\tconst wsUri = `${getHost()[1]}/BeforeLogLineRead` || undefined\r\n\tconst ws = new WebSocket(wsUri)\r\n\tws.onerror = () => ws.close()\r\n\tws.onclose = () =>\r\n\t\tsetTimeout(() => {\r\n\t\t\tlistenActWebSocket(callback)\r\n\t\t}, 1000)\r\n\tws.onmessage = function(e, m) {\r\n\t\tif (e.data === \".\") return ws.send(\".\")\r\n\r\n\t\tconst obj = JSON.parse(e.data)\r\n\t\tif (obj.msgtype === \"SendCharName\") {\r\n\t\t\treturn callback(obj.msg)\r\n\t\t} else if (obj.msgtype === \"Chat\") {\r\n\t\t\treturn callback(...obj.msg.split(\"|\"))\r\n\t\t}\r\n\t}\r\n\r\n\treturn () => {\r\n\t\tws.close()\r\n\t}\r\n}\r\n\r\nfunction listenOverlayPlugin(callback) {\r\n\tconst listener = e => {\r\n\t\tcallback(...e.detail)\r\n\t}\r\n\r\n\tdocument.addEventListener(\"onLogLine\", listener)\r\n\r\n\treturn () => {\r\n\t\tdocument.removeEventListener(\"onLogLine\", listener)\r\n\t}\r\n}\r\n","import React from \"react\"\r\nimport \"./css/Action.css\"\r\n\r\nconst gcdOverrides = new Set([\r\n\t15997, //standard step\r\n\t15998, //technical step\r\n\t15999,\r\n\t16000,\r\n\t16001,\r\n\t16002, //step actions\r\n\t16003, //standard finish\r\n\t16004, //technical finish\r\n\t16191, //single standard finish\r\n\t16192, //double standard finish (WHY IS IT LIKE THIS)\r\n\t16193, //single technical finish\r\n\t16194, //double technical finish\r\n\t16195, //triple technical finish\r\n\t16196, //quadruple technical finish\r\n\t7418, //flamethrower\r\n\t16484, //kaeshi higanbana\r\n\t16485, //kaeshi goken\r\n\t16486, //kaeshi setsugekka\r\n\t2259, //ten\r\n\t18805, \r\n\t2261, //chi\r\n\t18806,\r\n\t2263, //jin\r\n\t18807,\r\n\t2265, //fuma shurikan\r\n\t18873,\r\n\t18874,\r\n\t18875,\r\n\t2267, //raiton\r\n\t18877,\r\n\t2266, //katon\r\n\t18876,\r\n\t2268, //hyoton\r\n\t18878,\r\n\t16492, //hyosho ranryu\r\n\t16471, //goka meykakku\r\n\t16491, //goka meykakku (16471 is the PvP version, 16491 is the PvE version)\r\n\t2270, //doton\r\n\t18880,\r\n\t2269, //huton\r\n\t18879,\r\n\t2271, //suiton\r\n\t18881,\r\n\t2272, //rabbit medium\r\n])\r\n\r\nconst ogcdOverrides = new Set([\r\n\t3559, //bard WM\r\n\t116, //bard AP\r\n\t114 //bard MB\r\n])\r\n\r\nconst actionMap = new Map()\r\n\r\nexport default function Action({ actionId, additionalClasses }) {\r\n\tconst [apiData, setApiData] = React.useState()\r\n\r\n\tReact.useEffect(() => {\r\n\t\tconst mapData = actionMap.get(actionId)\r\n\t\tif (mapData != null) {\r\n\t\t\tsetApiData(mapData)\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tlet current = true\r\n\t\tvoid (async () => {\r\n\t\t\tconst data = await (await fetch(`https://xivapi.com/Action/${actionId}?columns=Icon,Name,ActionCategoryTargetID`, {\r\n\t\t\t\tmode: \"cors\"\r\n\t\t\t})).json()\r\n\t\t\tif (current) {\r\n\t\t\t\tactionMap.set(actionId, data)\r\n\t\t\t\tsetApiData(data)\r\n\t\t\t}\r\n\t\t})()\r\n\r\n\t\treturn () => {\r\n\t\t\tcurrent = false\r\n\t\t}\r\n\t}, [actionId])\r\n\r\n\tif (apiData === undefined || !apiData.Icon) {\r\n\t\treturn null\r\n\t}\r\n\r\n\treturn (\r\n\t\t<img\r\n\t\t\tclassName={\r\n\t\t\t\tgcdOverrides.has(actionId) ||\r\n\t\t\t\t(!ogcdOverrides.has(actionId) && apiData.ActionCategoryTargetID !== 4)\r\n\t\t\t\t\t? `gcd ${additionalClasses}`\r\n\t\t\t\t\t: `ogcd ${additionalClasses}`\r\n\t\t\t}\r\n\t\t\tsrc={`https://xivapi.com/${apiData.Icon}`}\r\n\t\t\talt={apiData.Name || \"\"}\r\n\t\t/>\r\n\t)\r\n}\r\n","import React from \"react\"\r\nimport \"./css/Rotation.css\"\r\nimport Action from \"./Action\"\r\n\r\nexport default function RotationContainer({ encounterId, name, actionList }) {\r\n\tconst [open, setOpen] = React.useState(false)\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t<button\r\n\t\t\t\tclassName={open ? \"rotation-button expanded\" : \"rotation-button\"}\r\n\t\t\t\tonClick={() => {\r\n\t\t\t\t\tsetOpen(open => !open)\r\n\t\t\t\t}}\r\n\t\t\t>\r\n\t\t\t\t{encounterId === 0 ? \"Current Rotation\" : name}\r\n\t\t\t</button>\r\n\t\t\t<RotationContents expanded={open} actionList={actionList} />\r\n\t\t</>\r\n\t)\r\n}\r\n\r\nfunction RotationContents({ expanded, actionList }) {\r\n\tif (!expanded) return null\r\n\r\n\treturn (\r\n\t\t<div className=\"rotation-list\">\r\n\t\t\t{actionList.map((action, i) => (\r\n\t\t\t\t<Action key={i} actionId={action} additionalClasses=\"action-rotation\" />\r\n\t\t\t))}\r\n\t\t</div>\r\n\t)\r\n}\r\n","import React from \"react\"\r\nimport listenToACT from \"./ACTListener\"\r\nimport \"./css/App.css\"\r\nimport Action from \"./Action\"\r\nimport RotationContainer from \"./Rotation\"\r\nimport ReactDOM from \"react-dom\"\r\n\r\nconst handleCodes = new Set([\"00\", \"01\", \"02\", \"21\", \"22\", \"33\"])\r\n\r\nexport default function App() {\r\n\tconst [actionList, setActionList] = React.useState([])\r\n\tconst [encounterList, setEncounterList] = React.useState([])\r\n\r\n\tReact.useEffect(() => {\r\n\t\tlet selfId\r\n\t\tlet lastTimestamp = \"\"\r\n\t\tlet lastAction = -1\r\n\t\tlet currentZone = \"Unknown\"\r\n\r\n\t\tlet lastKey = 1\r\n\r\n\t\tlet closeFn = listenToACT((...logSplit) => {\r\n\t\t\tconst openNewEncounter = () => {\r\n\t\t\t\tsetEncounterList(encounterList => {\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tencounterList[0] &&\r\n\t\t\t\t\t\tencounterList[0].rotation &&\r\n\t\t\t\t\t\tencounterList[0].rotation.length <= 0\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tencounterList.shift()\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tencounterList.unshift({\r\n\t\t\t\t\t\tname: currentZone,\r\n\t\t\t\t\t\trotation: []\r\n\t\t\t\t\t})\r\n\r\n\t\t\t\t\treturn encounterList.slice(0, 3)\r\n\t\t\t\t})\r\n\t\t\t}\r\n\r\n\t\t\tif (logSplit.length === 1 && logSplit[0].charID) {\r\n\t\t\t\tselfId = logSplit[0].charID\r\n\t\t\t\topenNewEncounter()\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\r\n\t\t\tconst [\r\n\t\t\t\tlogCode,\r\n\t\t\t\tlogTimestamp,\r\n\t\t\t\tlogParameter1,\r\n\t\t\t\tlogParameter2,\r\n\t\t\t\tlogParameter3\r\n\t\t\t] = logSplit\r\n\r\n\t\t\tif (!handleCodes.has(logCode)) return\r\n\r\n\t\t\tswitch (logCode) {\r\n\t\t\t\tcase \"00\":\r\n\t\t\t\t\tif (logParameter1 === \"0038\" && logParameter3 === \"end\")\r\n\t\t\t\t\t\topenNewEncounter()\r\n\t\t\t\t\treturn\r\n\t\t\t\tcase \"01\":\r\n\t\t\t\t\tcurrentZone = logParameter2\r\n\t\t\t\t\treturn\r\n\t\t\t\tcase \"02\":\r\n\t\t\t\t\tselfId = parseInt(logParameter1, 16)\r\n\t\t\t\t\topenNewEncounter()\r\n\t\t\t\t\treturn\r\n\t\t\t\tcase \"33\":\r\n\t\t\t\t\tif (logParameter2 === \"40000012\" || logParameter2 === \"40000010\")\r\n\t\t\t\t\t\topenNewEncounter()\r\n\t\t\t\t\treturn\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbreak\r\n\t\t\t}\r\n\r\n\t\t\tif (selfId === undefined) return\r\n\r\n\t\t\tif (parseInt(logParameter1, 16) !== selfId) return\r\n\r\n\t\t\tconst action = parseInt(logParameter3, 16)\r\n\r\n\t\t\tif ( //sanity check the tea sis period wig snapped\r\n\t\t\t\t((action < 9 || action > 20000) && //is not a combat action\r\n (action < 100001 || action > 100300)) || //and is not a crafting action\r\n\t\t\t\t(logTimestamp === lastTimestamp && action === lastAction) //or this action is a bug/duplicate\r\n\t\t\t)\r\n\t\t\t\treturn\r\n\r\n\t\t\tif (Date.now() - Date.parse(lastTimestamp) > 120000) openNewEncounter() //last action > 120s ago\r\n\r\n\t\t\tlastTimestamp = logTimestamp\r\n\t\t\tlastAction = action\r\n\r\n\t\t\tconst key = (lastKey % 256) + 1\r\n\t\t\tlastKey = key\r\n\r\n\t\t\t// This is pretty silly but it's the neatest way to handle the updates going\r\n\t\t\t// out at the same time, without finding some way to merge the action lists....\r\n\t\t\tReactDOM.unstable_batchedUpdates(() => {\r\n\t\t\t\tsetActionList(actionList => actionList.concat({ action, key }))\r\n\t\t\t\tsetEncounterList(encounterList => {\r\n\t\t\t\t\tif (!encounterList[0]) {\r\n\t\t\t\t\t\tencounterList[0] = {\r\n\t\t\t\t\t\t\tname: currentZone,\r\n\t\t\t\t\t\t\trotation: []\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tencounterList[0].rotation.push(action)\r\n\r\n\t\t\t\t\treturn encounterList\r\n\t\t\t\t})\r\n\t\t\t})\r\n\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tsetActionList(actionList => actionList.slice(1))\r\n\t\t\t}, 10000)\r\n\t\t})\r\n\r\n\t\treturn () => {\r\n\t\t\tcloseFn()\r\n\t\t}\r\n\t}, [])\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t<div className=\"container\">\r\n\t\t\t\t<div className=\"actions\">\r\n\t\t\t\t\t{actionList.map(({ action, key }) => (\r\n\t\t\t\t\t\t<Action\r\n\t\t\t\t\t\t\tkey={key}\r\n\t\t\t\t\t\t\tactionId={action}\r\n\t\t\t\t\t\t\tadditionalClasses=\"action-move\"\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t))}\r\n\t\t\t\t</div>\r\n\t\t\t\t{encounterList.map((encounter, i) => (\r\n\t\t\t\t\t<RotationContainer\r\n\t\t\t\t\t\tkey={i}\r\n\t\t\t\t\t\tencounterId={i}\r\n\t\t\t\t\t\tname={encounter.name}\r\n\t\t\t\t\t\tactionList={encounter.rotation}\r\n\t\t\t\t\t/>\r\n\t\t\t\t))}\r\n\t\t\t</div>\r\n\t\t</>\r\n\t)\r\n}\r\n","import React from 'react'\r\nimport ReactDOM from 'react-dom'\r\nimport App from './App'\r\n\r\nReactDOM.render(<App />, document.getElementById('root'))\r\n"],"sourceRoot":""} |