diff --git a/html/index.html b/html/index.html index 9a84720..e65711a 100644 --- a/html/index.html +++ b/html/index.html @@ -93,7 +93,7 @@ - +
Codex Discoveries
SystemBodyCodex CategoryTypeRegion
SystemBodyCodex CategoryTypeRegion
diff --git a/html/js/board.js b/html/js/board.js index 9375f88..db7625f 100644 --- a/html/js/board.js +++ b/html/js/board.js @@ -2,7 +2,7 @@ import { ReconnectingWebSocket } from "./reconnecting-websocket.min.js"; import { PageIconActivity } from "./activity_icon.min.js"; import { StatsBox, SortedStatsBox } from "./statsbox.min.js"; import { InfoBox } from "./infobox.min.js"; -import { distance3, trimPrefix, makeTd, addRow, whatGame } from "./utils.min.js"; +import { distance3, trimPrefix, makeTd, addRow, whatGame, GalacticRegions } from "./utils.min.js"; // TODO: modularize // TODO: remove/rework global config options (socketUrl, listLength, idleTimeout, resetTimeout) @@ -285,7 +285,7 @@ ws.onmessage = (event) => { makeTd(trimPrefix(message.BodyName || "", message.System)), makeTd(`${message.Category.replace(/^\$Codex_Category_(.*);$/, "$1").replaceAll("_", " ")} / ${message.SubCategory.replace(/^\$Codex_SubCategory_(.*);$/, "$1").replaceAll("_", " ")}`), makeTd(message.Name.replace(/^\$Codex_Ent_(.*)_Name;$/, "$1").replaceAll("_", " ")), - makeTd(message.Region.replace(/^\$Codex_RegionName_(.*);$/, "$1"))); + makeTd(GalacticRegions[message.Region.replace(/^\$Codex_RegionName_(.*);$/, "$1")])); addRow(window.codex, tr); break; } diff --git a/html/js/board.min.js b/html/js/board.min.js index dd8c80b..d8fce35 100644 --- a/html/js/board.min.js +++ b/html/js/board.min.js @@ -1 +1 @@ -import{ReconnectingWebSocket as e}from"./reconnecting-websocket.min.js";import{PageIconActivity as t}from"./activity_icon.min.js";import{StatsBox as o,SortedStatsBox as i}from"./statsbox.min.js";import{InfoBox as a}from"./infobox.min.js";import{distance3 as u,trimPrefix as _,makeTd as f,addRow as x,whatGame as n}from"./utils.min.js";const g=new t(window.icon,idleTimeout),s=new a(document.body,window.infotemplate.content.children[0]),k=new o(window.softbody),p=new i(window.eventsbody),v=new o(window.statsbody,{Total:0,Odyssey:0,Horizons:0,Base:0,Legacy:0,Unknown:0,Taxi:0,Multicrew:0,Old:0,New:0,Ignored:0,"Last timestamp":"","Max jump range":""});let h=0;class y{t;o;i;m;l;u;_;g;constructor(e){this.t=e,this.o=n(e),e=e.message,this.i=e.timestamp,this.m=e.event,this.l=!!e.Taxi,this.u=!!e.Multicrew,e=new Date-new Date(e.timestamp),this._=36e5{let t;try{if(!((t=JSON.parse(e.data)).$schemaRef&&t.header&&t.message))return console.log("Invalid message:",t),void g.error()}catch(e){return console.log("JSON object error:",e),void g.error()}t.$schemaRef;var o,e=t.header,i=t.message,a=(g.ok(),S=Date.now(),v.inc("Total"),new y(t)),n=(v.inc(a.o),v.set("Last timestamp",a.i),window.softbody),s=n.childElementCount;if(k.inc(e.softwareName+" "+e.softwareVersion),n.childElementCount!=s&&n.replaceChildren(...[...n.children].sort((e,t)=>e.children[0].textContent{let t;"TR"===e.target.tagName?t=e.target:"TD"===e.target.tagName&&(t=e.target.parentNode),t&&s.has(t)&&s.show(t)}),function e(){r.readyState===WebSocket.OPEN&&Date.now()-S>resetTimeout&&(console.log("Receive timeout. Resetting connection."),r.refresh());var t=~~(6e4+42e3*Math.random());setTimeout(e,t)}(); +import{ReconnectingWebSocket as e}from"./reconnecting-websocket.min.js";import{PageIconActivity as t}from"./activity_icon.min.js";import{StatsBox as o,SortedStatsBox as a}from"./statsbox.min.js";import{InfoBox as i}from"./infobox.min.js";import{distance3 as u,trimPrefix as _,makeTd as f,addRow as g,whatGame as n,GalacticRegions as x}from"./utils.min.js";const k=new t(window.icon,idleTimeout),s=new i(document.body,window.infotemplate.content.children[0]),p=new o(window.softbody),v=new a(window.eventsbody),h=new o(window.statsbody,{Total:0,Odyssey:0,Horizons:0,Base:0,Legacy:0,Unknown:0,Taxi:0,Multicrew:0,Old:0,New:0,Ignored:0,"Last timestamp":"","Max jump range":""});let y=0;class b{t;o;i;m;l;u;_;g;constructor(e){this.t=e,this.o=n(e),e=e.message,this.i=e.timestamp,this.m=e.event,this.l=!!e.Taxi,this.u=!!e.Multicrew,e=new Date-new Date(e.timestamp),this._=36e5{let t;try{if(!((t=JSON.parse(e.data)).$schemaRef&&t.header&&t.message))return console.log("Invalid message:",t),void k.error()}catch(e){return console.log("JSON object error:",e),void k.error()}t.$schemaRef;var o,e=t.header,a=t.message,i=(k.ok(),T=Date.now(),h.inc("Total"),new b(t)),n=(h.inc(i.o),h.set("Last timestamp",i.i),window.softbody),s=n.childElementCount;if(p.inc(e.softwareName+" "+e.softwareVersion),n.childElementCount!=s&&n.replaceChildren(...[...n.children].sort((e,t)=>e.children[0].textContent{let t;"TR"===e.target.tagName?t=e.target:"TD"===e.target.tagName&&(t=e.target.parentNode),t&&s.has(t)&&s.show(t)}),function e(){r.readyState===WebSocket.OPEN&&Date.now()-T>resetTimeout&&(console.log("Receive timeout. Resetting connection."),r.refresh());var t=~~(6e4+42e3*Math.random());setTimeout(e,t)}(); diff --git a/html/js/utils.js b/html/js/utils.js index 7b25cf8..95262a3 100644 --- a/html/js/utils.js +++ b/html/js/utils.js @@ -29,3 +29,49 @@ export function whatGame(data) { return "Unknown"; } } + +export const GalacticRegions = [ + "Null", // 0 + "Galactic Centre", // 1 + "Empyrean Straits", // 2 + "Ryker's Hope", // 3 + "Odin's Hold", // 4 + "Norma Arm", // 5 + "Arcadian Stream", // 6 + "Izanami", // 7 + "Inner Orion-Perseus Conflux", // 8 + "Inner Scutum-Centaurus Arm", // 9 + "Norma Expanse", // 10 + "Trojan Belt", // 11 + "The Veils", // 12 + "Newton's Vault", // 13 + "The Conduit", // 14 + "Outer Orion-Perseus Conflux", // 15 + "Orion-Cygnus Arm", // 16 + "Temple", // 17 + "Inner Orion Spur", // 18 + "Hawking's Gap", // 19 + "Dryman's Point", // 20 + "Sagittarius-Carina Arm", // 21 + "Mare Somnia", // 22 + "Acheron", // 23 + "Formorian Frontier", // 24 + "Hieronymus Delta", // 25 + "Outer Scutum-Centaurus Arm", // 26 + "Outer Arm", // 27 + "Aquila's Halo", // 28 + "Errant Marches", // 29 + "Perseus Arm", // 30 + "Formidine Rift", // 31 + "Vulcan Gate", // 32 + "Elysian Shore", // 33 + "Sanguineous Rim", // 34 + "Outer Orion Spur", // 35 + "Achilles's Altar", // 36 + "Xibalba", // 37 + "Lyra's Song", // 38 + "Tenebrae", // 39 + "The Abyss", // 40 + "Kepler's Crest", // 41 + "The Void", // 42 +]; diff --git a/html/js/utils.min.js b/html/js/utils.min.js index d5abcab..72320b1 100644 --- a/html/js/utils.min.js +++ b/html/js/utils.min.js @@ -1 +1 @@ -var n=(n,r)=>Math.hypot(n[0]-r[0],n[1]-r[1],n[2]-r[2]),r=(n,r)=>(n.startsWith(r)?n.slice(r.length):n).trim(),e=n=>{var r=document.createElement("td");return r.textContent=r.title=n,r};function t(n,r){for(;n.childElementCount>=listLength;)n.lastElementChild.remove();n.prepend(r)}function o(n){try{var r,e=n.header.gameversion;return e&&(e.startsWith("CAPI-Legacy-")||parseInt(e)<4)?"Legacy":(r=n.message).odyssey?"Odyssey":r.horizons?"Horizons":!1===r.horizons?"Base":"Unknown"}catch(n){return console.log("gameversion error:",n),"Unknown"}}export{n as distance3,r as trimPrefix,e as makeTd,t as addRow,o as whatGame}; +var r=(r,e)=>Math.hypot(r[0]-e[0],r[1]-e[1],r[2]-e[2]),e=(r,e)=>(r.startsWith(e)?r.slice(e.length):r).trim(),n=r=>{var e=document.createElement("td");return e.textContent=e.title=r,e};function a(r,e){for(;r.childElementCount>=listLength;)r.lastElementChild.remove();r.prepend(e)}function t(r){try{var e,n=r.header.gameversion;return n&&(n.startsWith("CAPI-Legacy-")||parseInt(n)<4)?"Legacy":(e=r.message).odyssey?"Odyssey":e.horizons?"Horizons":!1===e.horizons?"Base":"Unknown"}catch(r){return console.log("gameversion error:",r),"Unknown"}}var o=["Null","Galactic Centre","Empyrean Straits","Ryker's Hope","Odin's Hold","Norma Arm","Arcadian Stream","Izanami","Inner Orion-Perseus Conflux","Inner Scutum-Centaurus Arm","Norma Expanse","Trojan Belt","The Veils","Newton's Vault","The Conduit","Outer Orion-Perseus Conflux","Orion-Cygnus Arm","Temple","Inner Orion Spur","Hawking's Gap","Dryman's Point","Sagittarius-Carina Arm","Mare Somnia","Acheron","Formorian Frontier","Hieronymus Delta","Outer Scutum-Centaurus Arm","Outer Arm","Aquila's Halo","Errant Marches","Perseus Arm","Formidine Rift","Vulcan Gate","Elysian Shore","Sanguineous Rim","Outer Orion Spur","Achilles's Altar","Xibalba","Lyra's Song","Tenebrae","The Abyss","Kepler's Crest","The Void"];export{r as distance3,e as trimPrefix,n as makeTd,a as addRow,t as whatGame,o as GalacticRegions};