Update
This commit is contained in:
1
frontend/ingest/data.json
Normal file
1
frontend/ingest/data.json
Normal file
File diff suppressed because one or more lines are too long
13
frontend/ingest/fuckifier2.js
Normal file
13
frontend/ingest/fuckifier2.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import fs from 'fs';
|
||||
|
||||
const universe = JSON.parse(fs.readFileSync('../public/universe.json', 'utf8'));
|
||||
|
||||
for (const region of universe) {
|
||||
region.x = parseInt(region.x);
|
||||
region.y = parseInt(region.y);
|
||||
|
||||
region.x = region.x * 1.4;
|
||||
region.y = region.y * 1.4;
|
||||
}
|
||||
|
||||
fs.writeFileSync('../public/universe.json', JSON.stringify(universe, null, 2));
|
||||
15
frontend/ingest/fuckifier3.js
Normal file
15
frontend/ingest/fuckifier3.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from 'fs';
|
||||
|
||||
const jsonFiles = fs.readdirSync('../public');
|
||||
|
||||
for (const file of jsonFiles) {
|
||||
if (!file.endsWith('.json')) continue
|
||||
const data = fs.readFileSync(`../public/${file}`, 'utf8');
|
||||
const json = JSON.parse(data);
|
||||
for (const region of json) {
|
||||
if (region.connectedSystems) {
|
||||
region.connectedSystems = region.connectedSystems.join(',');
|
||||
}
|
||||
}
|
||||
fs.writeFileSync(`../public/${file}`, JSON.stringify(json, null, 2));
|
||||
}
|
||||
25
frontend/ingest/quickerfucker.js
Normal file
25
frontend/ingest/quickerfucker.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import fs from "fs"
|
||||
|
||||
const data = JSON.parse(fs.readFileSync("data.json", "utf8"))
|
||||
|
||||
const dataPerRegion = {}
|
||||
|
||||
for (const item of data) {
|
||||
if (!dataPerRegion[item.regionName]) {
|
||||
dataPerRegion[item.regionName] = []
|
||||
}
|
||||
const connectedSystems = item.connectedSystems.split(",")
|
||||
item.connectedSystems = connectedSystems
|
||||
item.x = parseInt(item.x)
|
||||
item.y = parseInt(item.y)
|
||||
dataPerRegion[item.regionName].push(item)
|
||||
delete item.regionName
|
||||
}
|
||||
|
||||
for (const region in dataPerRegion) {
|
||||
const regionFile = `../public/${region}.json`
|
||||
console.log("Writing to", regionFile)
|
||||
fs.writeFileSync(regionFile, JSON.stringify(dataPerRegion[region], null, 2))
|
||||
}
|
||||
|
||||
console.log("Done")
|
||||
39
frontend/ingest/solarSystems.sql
Normal file
39
frontend/ingest/solarSystems.sql
Normal file
@@ -0,0 +1,39 @@
|
||||
WITH CanonicalLayouts AS (
|
||||
SELECT regionId, MIN(layoutId) AS layoutId
|
||||
FROM MapLayouts
|
||||
GROUP BY regionId
|
||||
),
|
||||
RegionLayouts AS (
|
||||
SELECT
|
||||
re.regionId,
|
||||
re.regionName,
|
||||
cl.layoutId
|
||||
FROM Regions re
|
||||
JOIN CanonicalLayouts cl ON re.regionId = cl.regionId
|
||||
),
|
||||
SystemConnections AS (
|
||||
SELECT
|
||||
ss_from.solarSystemId AS fromSystemId,
|
||||
ss_to.solarSystemName AS toSystemName
|
||||
FROM StarGates sg
|
||||
JOIN SolarSystems ss_from ON sg.fromSystemId = ss_from.solarSystemId
|
||||
JOIN SolarSystems ss_to ON sg.toSystemId = ss_to.solarSystemId
|
||||
),
|
||||
ConnectedSystems AS (
|
||||
SELECT
|
||||
fromSystemId,
|
||||
GROUP_CONCAT(DISTINCT toSystemName) AS connectedSystems
|
||||
FROM SystemConnections
|
||||
GROUP BY fromSystemId
|
||||
)
|
||||
SELECT
|
||||
ss.solarSystemName AS solarSystemName,
|
||||
ml.x,
|
||||
ml.y,
|
||||
rl.regionName AS regionName,
|
||||
ss.security AS security,
|
||||
COALESCE(cs.connectedSystems, '') AS connectedSystems
|
||||
FROM RegionLayouts rl
|
||||
JOIN MapLayout ml ON ml.layoutId = rl.layoutId
|
||||
JOIN SolarSystems ss ON ss.solarSystemId = ml.solarSystemId
|
||||
LEFT JOIN ConnectedSystems cs ON ss.solarSystemId = cs.fromSystemId
|
||||
BIN
frontend/ingest/static.db
Normal file
BIN
frontend/ingest/static.db
Normal file
Binary file not shown.
28
frontend/ingest/systemregion.sql
Normal file
28
frontend/ingest/systemregion.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
WITH RegionConnections AS (
|
||||
SELECT
|
||||
ss.regionId AS fromRegionId,
|
||||
ss_to.regionId AS toRegionId
|
||||
FROM StarGates sg
|
||||
JOIN SolarSystems ss ON sg.fromSystemId = ss.solarSystemId
|
||||
JOIN SolarSystems ss_to ON sg.toSystemId = ss_to.solarSystemId
|
||||
WHERE ss.regionId != ss_to.regionId
|
||||
),
|
||||
ConnectedRegions AS (
|
||||
SELECT
|
||||
fromRegionId,
|
||||
GROUP_CONCAT(DISTINCT r2.regionName) AS connectedRegions
|
||||
FROM RegionConnections rc
|
||||
JOIN Regions r2 ON rc.toRegionId = r2.regionId
|
||||
GROUP BY fromRegionId
|
||||
)
|
||||
SELECT
|
||||
re.regionName AS regionName,
|
||||
rml.x,
|
||||
rml.y,
|
||||
AVG(ss.security) AS security,
|
||||
COALESCE(cr.connectedRegions, '') AS connectsTo
|
||||
FROM RegionMapLayout rml
|
||||
JOIN Regions re ON rml.regionId = re.regionId
|
||||
JOIN SolarSystems ss ON ss.regionId = re.regionId
|
||||
LEFT JOIN ConnectedRegions cr ON re.regionId = cr.fromRegionId
|
||||
GROUP BY re.regionId;
|
||||
26
frontend/ingest/systems.js
Normal file
26
frontend/ingest/systems.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import fs from 'fs';
|
||||
|
||||
const data = JSON.parse(fs.readFileSync('systems.json', 'utf8'));
|
||||
const pbUrl = "https://evebase.site.quack-lab.dev/api/collections/system/records"
|
||||
|
||||
async function main() {
|
||||
for (const system of data) {
|
||||
const datum = {
|
||||
name: system.solarSystemName,
|
||||
region: system.regionName,
|
||||
connectedTo: system.connectedSystems,
|
||||
}
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
const response = await fetch(pbUrl, {
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: JSON.stringify(datum),
|
||||
});
|
||||
console.log(response);
|
||||
}
|
||||
}
|
||||
main().then(() => {
|
||||
console.log('done');
|
||||
});
|
||||
1
frontend/ingest/systems.json
Normal file
1
frontend/ingest/systems.json
Normal file
File diff suppressed because one or more lines are too long
28
frontend/ingest/universe.sql
Normal file
28
frontend/ingest/universe.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
WITH RegionConnections AS (
|
||||
SELECT
|
||||
ss.regionId AS fromRegionId,
|
||||
ss_to.regionId AS toRegionId
|
||||
FROM StarGates sg
|
||||
JOIN SolarSystems ss ON sg.fromSystemId = ss.solarSystemId
|
||||
JOIN SolarSystems ss_to ON sg.toSystemId = ss_to.solarSystemId
|
||||
WHERE ss.regionId != ss_to.regionId
|
||||
),
|
||||
ConnectedRegions AS (
|
||||
SELECT
|
||||
fromRegionId,
|
||||
GROUP_CONCAT(DISTINCT r2.regionName) AS connectedRegions
|
||||
FROM RegionConnections rc
|
||||
JOIN Regions r2 ON rc.toRegionId = r2.regionId
|
||||
GROUP BY fromRegionId
|
||||
)
|
||||
SELECT
|
||||
re.regionName AS regionName,
|
||||
rml.x,
|
||||
rml.y,
|
||||
AVG(ss.security) AS security,
|
||||
COALESCE(cr.connectedRegions, '') AS connectsTo
|
||||
FROM RegionMapLayout rml
|
||||
JOIN Regions re ON rml.regionId = re.regionId
|
||||
JOIN SolarSystems ss ON ss.regionId = re.regionId
|
||||
LEFT JOIN ConnectedRegions cr ON re.regionId = cr.fromRegionId
|
||||
GROUP BY re.regionId;
|
||||
Reference in New Issue
Block a user