feat: list hulls for creating new empty fits (#28)

This list can be searched and navigated pretty much like you can
in-game.
This commit is contained in:
Patric Stout
2023-11-27 20:07:33 +01:00
committed by GitHub
parent afc0cc3df5
commit 983917f5e6
11 changed files with 503 additions and 6 deletions

View File

@@ -19,6 +19,7 @@ export interface TypeID {
groupID: number,
categoryID: number,
published: boolean,
factionID?: number,
marketGroupID?: number,
capacity?: number,
mass?: number,
@@ -26,6 +27,17 @@ export interface TypeID {
volume?: number,
}
export interface GroupID {
name: string,
categoryID: number,
published: boolean,
}
export interface MarketGroup {
name: string,
parentGroupID?: number,
}
export interface DogmaAttribute {
name: string
published: boolean,

View File

@@ -18,6 +18,8 @@ const TestEveData = () => {
return (
<div>
TypeIDs: {eveData.typeIDs ? Object.keys(eveData.typeIDs).length : "loading"}<br/>
GroupIDs: {eveData.groupIDs ? Object.keys(eveData.groupIDs).length : "loading"}<br/>
MarketGroups: {eveData.marketGroups ? Object.keys(eveData.marketGroups).length : "loading"}<br/>
TypeDogma: {eveData.typeDogma ? Object.keys(eveData.typeDogma).length : "loading"}<br/>
DogmaEffects: {eveData.dogmaEffects ? Object.keys(eveData.dogmaEffects).length : "loading"}<br/>
DogmaAttributes: {eveData.dogmaAttributes ? Object.keys(eveData.dogmaAttributes).length : "loading"}<br/>

View File

@@ -1,6 +1,6 @@
import React from "react";
import { DogmaAttribute, DogmaEffect, TypeDogma, TypeID } from "./DataTypes";
import { DogmaAttribute, DogmaEffect, GroupID, MarketGroup, TypeDogma, TypeID } from "./DataTypes";
import { defaultDataUrl } from "../settings";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -11,6 +11,8 @@ import * as esf_pb2 from "./esf_pb2.js";
interface DogmaData {
loaded?: boolean;
typeIDs?: Record<string, TypeID>;
groupIDs?: Record<string, GroupID>;
marketGroups?: Record<string, MarketGroup>;
typeDogma?: Record<string, TypeDogma>;
dogmaEffects?: Record<string, DogmaEffect>;
dogmaAttributes?: Record<string, DogmaAttribute>;
@@ -37,6 +39,8 @@ async function fetchDataFile(dataUrl: string, name: string, pb2: any): Promise<o
function isLoaded(dogmaData: DogmaData): boolean | undefined {
if (dogmaData.typeIDs === undefined) return undefined;
if (dogmaData.groupIDs === undefined) return undefined;
if (dogmaData.marketGroups === undefined) return undefined;
if (dogmaData.typeDogma === undefined) return undefined;
if (dogmaData.dogmaEffects === undefined) return undefined;
if (dogmaData.dogmaAttributes === undefined) return undefined;
@@ -77,6 +81,8 @@ export const EveDataProvider = (props: DogmaDataProps) => {
}
fetchAndLoadDataFile("typeIDs", esf_pb2.esf.TypeIDs);
fetchAndLoadDataFile("groupIDs", esf_pb2.esf.GroupIDs);
fetchAndLoadDataFile("marketGroups", esf_pb2.esf.MarketGroups);
fetchAndLoadDataFile("typeDogma", esf_pb2.esf.TypeDogma);
fetchAndLoadDataFile("dogmaEffects", esf_pb2.esf.DogmaEffects);
fetchAndLoadDataFile("dogmaAttributes", esf_pb2.esf.DogmaAttributes);

View File

@@ -263,6 +263,7 @@ export const esf = $root.esf = (() => {
TypeID.prototype.groupID = 0;
TypeID.prototype.categoryID = 0;
TypeID.prototype.published = false;
TypeID.prototype.factionID = 0;
TypeID.prototype.marketGroupID = 0;
TypeID.prototype.capacity = 0;
TypeID.prototype.mass = 0;
@@ -293,22 +294,26 @@ export const esf = $root.esf = (() => {
break;
}
case 5: {
m.marketGroupID = r.int32();
m.factionID = r.int32();
break;
}
case 6: {
m.capacity = r.float();
m.marketGroupID = r.int32();
break;
}
case 7: {
m.mass = r.float();
m.capacity = r.float();
break;
}
case 8: {
m.radius = r.float();
m.mass = r.float();
break;
}
case 9: {
m.radius = r.float();
break;
}
case 10: {
m.volume = r.float();
break;
}
@@ -334,6 +339,211 @@ export const esf = $root.esf = (() => {
return TypeIDs;
})();
esf.GroupIDs = (function() {
function GroupIDs(p) {
this.entries = {};
if (p)
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
if (p[ks[i]] != null)
this[ks[i]] = p[ks[i]];
}
GroupIDs.prototype.entries = emptyObject;
GroupIDs.decode = async function decode(r, l) {
if (!(r instanceof $Reader))
r = $Reader.create(r);
var c = l === undefined ? r.len : r.pos + l, m = new $root.esf.GroupIDs(), k, value;
while (r.pos < c) {
if (r.need_data()) {
await r.fetch_data();
}
if (r.is_eof()) break;
var t = r.uint32();
switch (t >>> 3) {
case 1: {
if (m.entries === emptyObject)
m.entries = {};
var c2 = r.uint32() + r.pos;
k = 0;
value = null;
while (r.pos < c2) {
var tag2 = r.uint32();
switch (tag2 >>> 3) {
case 1:
k = r.int32();
break;
case 2:
value = $root.esf.GroupIDs.GroupID.decode(r, r.uint32());
break;
default:
r.skipType(tag2 & 7);
break;
}
}
m.entries[k] = value;
break;
}
default:
r.skipType(t & 7);
break;
}
}
return m;
};
GroupIDs.GroupID = (function() {
function GroupID(p) {
if (p)
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
if (p[ks[i]] != null)
this[ks[i]] = p[ks[i]];
}
GroupID.prototype.name = "";
GroupID.prototype.categoryID = 0;
GroupID.prototype.published = false;
GroupID.decode = function decode(r, l) {
if (!(r instanceof $Reader))
r = $Reader.create(r);
var c = l === undefined ? r.len : r.pos + l, m = new $root.esf.GroupIDs.GroupID();
while (r.pos < c) {
var t = r.uint32();
switch (t >>> 3) {
case 1: {
m.name = r.string();
break;
}
case 2: {
m.categoryID = r.int32();
break;
}
case 3: {
m.published = r.bool();
break;
}
default:
r.skipType(t & 7);
break;
}
}
if (!m.hasOwnProperty("name"))
throw Error("missing required 'name'", { instance: m });
if (!m.hasOwnProperty("categoryID"))
throw Error("missing required 'categoryID'", { instance: m });
if (!m.hasOwnProperty("published"))
throw Error("missing required 'published'", { instance: m });
return m;
};
return GroupID;
})();
return GroupIDs;
})();
esf.MarketGroups = (function() {
function MarketGroups(p) {
this.entries = {};
if (p)
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
if (p[ks[i]] != null)
this[ks[i]] = p[ks[i]];
}
MarketGroups.prototype.entries = emptyObject;
MarketGroups.decode = async function decode(r, l) {
if (!(r instanceof $Reader))
r = $Reader.create(r);
var c = l === undefined ? r.len : r.pos + l, m = new $root.esf.MarketGroups(), k, value;
while (r.pos < c) {
if (r.need_data()) {
await r.fetch_data();
}
if (r.is_eof()) break;
var t = r.uint32();
switch (t >>> 3) {
case 1: {
if (m.entries === emptyObject)
m.entries = {};
var c2 = r.uint32() + r.pos;
k = 0;
value = null;
while (r.pos < c2) {
var tag2 = r.uint32();
switch (tag2 >>> 3) {
case 1:
k = r.int32();
break;
case 2:
value = $root.esf.MarketGroups.MarketGroup.decode(r, r.uint32());
break;
default:
r.skipType(tag2 & 7);
break;
}
}
m.entries[k] = value;
break;
}
default:
r.skipType(t & 7);
break;
}
}
return m;
};
MarketGroups.MarketGroup = (function() {
function MarketGroup(p) {
if (p)
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
if (p[ks[i]] != null)
this[ks[i]] = p[ks[i]];
}
MarketGroup.prototype.name = "";
MarketGroup.prototype.parentGroupID = 0;
MarketGroup.decode = function decode(r, l) {
if (!(r instanceof $Reader))
r = $Reader.create(r);
var c = l === undefined ? r.len : r.pos + l, m = new $root.esf.MarketGroups.MarketGroup();
while (r.pos < c) {
var t = r.uint32();
switch (t >>> 3) {
case 1: {
m.name = r.string();
break;
}
case 2: {
m.parentGroupID = r.int32();
break;
}
default:
r.skipType(t & 7);
break;
}
}
if (!m.hasOwnProperty("name"))
throw Error("missing required 'name'", { instance: m });
return m;
};
return MarketGroup;
})();
return MarketGroups;
})();
esf.DogmaAttributes = (function() {
function DogmaAttributes(p) {