From 6b70fe088882642e645376f36876522e43d43db4 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 6 Jul 2024 14:12:34 +0200 Subject: [PATCH] chore: bump data and dogma-engine to latest (#152) This renamed a few attributes to be more in line with others. --- package.json | 4 +- .../CalculationDetail/CalculationDetail.tsx | 2 +- src/components/CargoBay/CargoBay.tsx | 6 +- src/components/DroneBay/DroneBay.tsx | 8 +- .../HardwareListing/HardwareListing.tsx | 8 +- src/components/HullListing/HullListing.tsx | 6 +- .../ShipAttribute/ShipAttribute.stories.tsx | 2 +- .../ShipAttribute/ShipAttribute.tsx | 16 +++- src/components/ShipFit/Hull.tsx | 2 +- src/components/ShipFit/Slot.tsx | 4 +- src/components/ShipFit/Usage.tsx | 5 +- .../ShipFitExtended/ShipFitExtended.tsx | 8 +- .../ShipStatistics/RechargeRate.tsx | 12 +-- .../ShipStatistics/ShipStatistics.tsx | 14 ++-- src/hooks/ExportEft/ExportEft.tsx | 10 +-- src/hooks/ImportEft/ImportEft.tsx | 4 +- src/hooks/ImportEveShipFit/DecodeKillMail.tsx | 2 +- .../DefaultCharactersProvider.tsx | 4 +- .../EsiCharactersProvider.tsx | 4 +- .../DogmaEngineProvider.tsx | 6 +- src/providers/EveDataProvider/DataTypes.tsx | 4 +- .../EveDataProvider.stories.tsx | 4 +- .../EveDataProvider/EveDataProvider.tsx | 22 +++--- src/providers/EveDataProvider/esf_pb2.js | 76 +++++++++---------- src/providers/EveDataProvider/index.ts | 2 +- .../FitManagerProvider/FitManagerProvider.tsx | 4 +- .../StatisticsProvider/StatisticsProvider.tsx | 2 +- 27 files changed, 125 insertions(+), 116 deletions(-) diff --git a/package.json b/package.json index 989c8c9..e351c80 100644 --- a/package.json +++ b/package.json @@ -67,8 +67,8 @@ "typescript-plugin-css-modules": "^5" }, "peerDependencies": { - "@eveshipfit/data": "^9", - "@eveshipfit/dogma-engine": "^5", + "@eveshipfit/data": "^10", + "@eveshipfit/dogma-engine": "^6", "react": "^18", "react-dom": "^18" }, diff --git a/src/components/CalculationDetail/CalculationDetail.tsx b/src/components/CalculationDetail/CalculationDetail.tsx index 5c9116f..18c9b13 100644 --- a/src/components/CalculationDetail/CalculationDetail.tsx +++ b/src/components/CalculationDetail/CalculationDetail.tsx @@ -96,7 +96,7 @@ const Effect = (props: { effect: CalculationItemAttributeEffect }) => { if (item === undefined) { sourceName = `Unknown ${sourceType}`; } else { - sourceName = `${sourceType}: ` + (eveData.typeIDs?.[item?.type_id]?.name ?? sourceName); + sourceName = `${sourceType}: ` + (eveData.types?.[item?.type_id]?.name ?? sourceName); attribute = item?.attributes.get(props.effect.source_attribute_id); const itemState = stateToInteger(item.state); diff --git a/src/components/CargoBay/CargoBay.tsx b/src/components/CargoBay/CargoBay.tsx index 71e73d0..467a8ba 100644 --- a/src/components/CargoBay/CargoBay.tsx +++ b/src/components/CargoBay/CargoBay.tsx @@ -31,9 +31,9 @@ const CargoBayEntry = ({ name, cargo }: { name: string; cargo: EsfCargo }) => { }, [fitManager, cargo]); let slotType: CalculationSlotType | undefined = undefined; - if (eveData?.typeIDs[cargo.typeId]?.categoryID === 18) { + if (eveData?.types[cargo.typeId]?.categoryID === 18) { slotType = "DroneBay"; - } else if (eveData?.typeIDs[cargo.typeId]?.categoryID === 8) { + } else if (eveData?.types[cargo.typeId]?.categoryID === 8) { slotType = "Charge"; } else { slotType = eveData?.typeDogma[cargo.typeId]?.dogmaEffects @@ -79,7 +79,7 @@ export const CargoBay = () => { /* Fetch name of all cargo items. */ const cargoList: { name: string; item: EsfCargo }[] = []; for (const item of currentFit.fit.cargo) { - const name = eveData.typeIDs?.[item.typeId].name ?? ""; + const name = eveData.types?.[item.typeId].name ?? ""; cargoList.push({ name, diff --git a/src/components/DroneBay/DroneBay.tsx b/src/components/DroneBay/DroneBay.tsx index 38d125e..d91a9cb 100644 --- a/src/components/DroneBay/DroneBay.tsx +++ b/src/components/DroneBay/DroneBay.tsx @@ -49,13 +49,13 @@ const DroneBayEntry = ({ name, drones }: { name: string; drones: CalculationItem if (eveData === null || statistics === null) return <>; - const attributeDroneBandwidthUsedTotal = eveData.attributeMapping.droneBandwidthUsedTotal ?? 0; + const attributeDroneBandwidthLoad = eveData.attributeMapping.droneBandwidthLoad ?? 0; const attributeDroneActive = eveData.attributeMapping.droneActive ?? 0; const attributeDroneBandwidthUsed = eveData.attributeMapping.droneBandwidthUsed ?? 0; const attributeDroneBandwidth = eveData.attributeMapping.droneBandwidth ?? 0; const attributeMaxActiveDrones = eveData.attributeMapping.maxActiveDrones ?? 0; - const bandwidthUsed = statistics.hull.attributes.get(attributeDroneBandwidthUsedTotal)?.value ?? 0; + const bandwidthLoad = statistics.hull.attributes.get(attributeDroneBandwidthLoad)?.value ?? 0; const bandwidthAvailable = statistics.hull.attributes.get(attributeDroneBandwidth)?.value ?? 0; const dronesActive = statistics.hull.attributes.get(attributeDroneActive)?.value ?? 0; const maxDronesActive = statistics.char.attributes.get(attributeMaxActiveDrones)?.value ?? 0; @@ -64,7 +64,7 @@ const DroneBayEntry = ({ name, drones }: { name: string; drones: CalculationItem let maxOpen = Math.max( 0, - Math.min(maxDronesActive - dronesActive, Math.floor((bandwidthAvailable - bandwidthUsed) / droneBandwidth)), + Math.min(maxDronesActive - dronesActive, Math.floor((bandwidthAvailable - bandwidthLoad) / droneBandwidth)), ); let index = 0; @@ -104,7 +104,7 @@ export const DroneBay = () => { /* Group drones by type_id */ const dronesGrouped: Record = {}; for (const drone of statistics.items.filter((item) => item.slot.type == "DroneBay")) { - const name = eveData.typeIDs?.[drone.type_id].name ?? ""; + const name = eveData.types?.[drone.type_id].name ?? ""; if (dronesGrouped[name] === undefined) { dronesGrouped[name] = []; diff --git a/src/components/HardwareListing/HardwareListing.tsx b/src/components/HardwareListing/HardwareListing.tsx index 03dfe95..91bd109 100644 --- a/src/components/HardwareListing/HardwareListing.tsx +++ b/src/components/HardwareListing/HardwareListing.tsx @@ -161,7 +161,7 @@ export const HardwareListing = () => { modules.push({ typeId: item.type_id, - name: eveData?.typeIDs?.[item.type_id].name ?? "Unknown", + name: eveData?.types?.[item.type_id].name ?? "Unknown", chargeGroupIDs, chargeSize: item.attributes.get(eveData?.attributeMapping.chargeSize ?? 0)?.value ?? -1, }); @@ -190,8 +190,8 @@ export const HardwareListing = () => { items: [], }; - for (const typeId in eveData.typeIDs) { - const module = eveData.typeIDs[typeId]; + for (const typeId in eveData.types) { + const module = eveData.types[typeId]; /* Modules (7), Charges (8), Drones (18), Subsystems (32), and Structures (66) */ if ( module.categoryID !== 7 && @@ -267,7 +267,7 @@ export const HardwareListing = () => { } } - const shipGroup = eveData.typeIDs[shipType]?.groupID; + const shipGroup = eveData.types[shipType]?.groupID; const canFitShipType = eveData.typeDogma[typeId]?.dogmaAttributes.filter( (attr) => diff --git a/src/components/HullListing/HullListing.tsx b/src/components/HullListing/HullListing.tsx index 96c393d..217f3a8 100644 --- a/src/components/HullListing/HullListing.tsx +++ b/src/components/HullListing/HullListing.tsx @@ -207,8 +207,8 @@ export const HullListing = () => { const anyFilter = filter.localFits || filter.characterFits; const grouped: ListingGroups = {}; - for (const typeId in eveData.typeIDs) { - const hull = eveData.typeIDs[typeId]; + for (const typeId in eveData.types) { + const hull = eveData.types[typeId]; if (hull.categoryID !== 6) continue; if (hull.marketGroupID === undefined) continue; if (!hull.published) continue; @@ -230,7 +230,7 @@ export const HullListing = () => { if (search !== "" && !hull.name.toLowerCase().includes(search.toLowerCase())) continue; - const group = eveData.groupIDs[hull.groupID]?.name ?? "Unknown Group"; + const group = eveData.groups[hull.groupID]?.name ?? "Unknown Group"; const race = factionIdToRace[hull.factionID ?? 0] ?? "NonEmpire"; if (grouped[group] === undefined) { diff --git a/src/components/ShipAttribute/ShipAttribute.stories.tsx b/src/components/ShipAttribute/ShipAttribute.stories.tsx index 3b5e64e..9b90fc1 100644 --- a/src/components/ShipAttribute/ShipAttribute.stories.tsx +++ b/src/components/ShipAttribute/ShipAttribute.stories.tsx @@ -24,7 +24,7 @@ export const Default: Story = { }, args: { fit: null, - name: "cpuUsed", + name: "cpuLoad", }, decorators: [withDecoratorFull], render: ({ fit, ...args }) => { diff --git a/src/components/ShipAttribute/ShipAttribute.tsx b/src/components/ShipAttribute/ShipAttribute.tsx index 33b1dff..9ca5022 100644 --- a/src/components/ShipAttribute/ShipAttribute.tsx +++ b/src/components/ShipAttribute/ShipAttribute.tsx @@ -50,11 +50,19 @@ export function useAttribute(type: "Ship" | "Char", props: AttributeProps): { va value = statistics.capacityUsed; currentValue = currentStatistics?.capacityUsed; } else if (type === "Ship") { - value = statistics.hull.attributes.get(attributeId)?.value; - currentValue = currentStatistics?.hull.attributes.get(attributeId)?.value; + value = + statistics.hull.attributes.get(attributeId)?.value || eveData?.dogmaAttributes[attributeId]?.defaultValue || 0; + currentValue = + currentStatistics?.hull.attributes.get(attributeId)?.value || + eveData?.dogmaAttributes[attributeId]?.defaultValue || + 0; } else { - value = statistics.char.attributes.get(attributeId)?.value; - currentValue = currentStatistics?.char.attributes.get(attributeId)?.value; + value = + statistics.char.attributes.get(attributeId)?.value || eveData?.dogmaAttributes[attributeId]?.defaultValue || 0; + currentValue = + currentStatistics?.char.attributes.get(attributeId)?.value || + eveData?.dogmaAttributes[attributeId]?.defaultValue || + 0; } } diff --git a/src/components/ShipFit/Hull.tsx b/src/components/ShipFit/Hull.tsx index 2625c30..d39ba74 100644 --- a/src/components/ShipFit/Hull.tsx +++ b/src/components/ShipFit/Hull.tsx @@ -26,7 +26,7 @@ export const Hull = () => {
{eveData.typeIDs[shipTypeId].name}
); diff --git a/src/components/ShipFit/Slot.tsx b/src/components/ShipFit/Slot.tsx index 04e651d..ecc8792 100644 --- a/src/components/ShipFit/Slot.tsx +++ b/src/components/ShipFit/Slot.tsx @@ -230,7 +230,7 @@ export const Slot = (props: { type: EsfSlotType; index: number; fittable: boolea item = ( @@ -239,7 +239,7 @@ export const Slot = (props: { type: EsfSlotType; index: number; fittable: boolea item = ( { if (eveData === null) return <>; - const isStructure = eveData.typeIDs[currentFit.currentFit?.shipTypeId ?? 0]?.categoryID === 65; + const isStructure = eveData.types[currentFit.currentFit?.shipTypeId ?? 0]?.categoryID === 65; if (currentFit.fit?.drones.length === 0 && isOpen) { setIsOpen(false); @@ -100,7 +100,7 @@ const ShipDroneBay = () => {
- +
/ {isStructure && <>0.0} @@ -169,10 +169,10 @@ export const ShipFitExtended = (props: { isPreview?: boolean }) => {
- / + / - / + /
diff --git a/src/components/ShipStatistics/RechargeRate.tsx b/src/components/ShipStatistics/RechargeRate.tsx index 13230ca..0f019b9 100644 --- a/src/components/ShipStatistics/RechargeRate.tsx +++ b/src/components/ShipStatistics/RechargeRate.tsx @@ -34,7 +34,7 @@ export const RechargeRateItem = (props: { name: string; icon: IconName }) => { }; export const RechargeRate = () => { - const [moduleType, setModuleType] = React.useState("passiveShieldRecharge"); + const [moduleType, setModuleType] = React.useState("passiveShieldRechargeRate"); const [showDropdown, setShowDropdown] = React.useState(false); return ( @@ -64,10 +64,12 @@ export const RechargeRate = () => {
{ - setModuleType("passiveShieldRecharge"); + setModuleType("passiveShieldRechargeRate"); setShowDropdown(false); }} - className={clsx({ [styles.rechargeRateDropdownContentSelected]: moduleType == "passiveShieldRecharge" })} + className={clsx({ + [styles.rechargeRateDropdownContentSelected]: moduleType == "passiveShieldRechargeRate", + })} > Passive shield recharge
@@ -85,8 +87,8 @@ export const RechargeRate = () => {
setShowDropdown((current) => !current)}> {moduleType == "armorRepairRate" && } {moduleType == "hullRepairRate" && } - {moduleType == "passiveShieldRecharge" && ( - + {moduleType == "passiveShieldRechargeRate" && ( + )} {moduleType == "shieldBoostRate" && }
diff --git a/src/components/ShipStatistics/ShipStatistics.tsx b/src/components/ShipStatistics/ShipStatistics.tsx index c29913b..bd3f843 100644 --- a/src/components/ShipStatistics/ShipStatistics.tsx +++ b/src/components/ShipStatistics/ShipStatistics.tsx @@ -22,7 +22,7 @@ export const ShipStatistics = () => { const statistics = useStatistics(); let capacitorState = "Stable"; - const isStructure = eveData?.typeIDs[currentFit.currentFit?.shipTypeId ?? 0]?.categoryID === 65; + const isStructure = eveData?.types[currentFit.currentFit?.shipTypeId ?? 0]?.categoryID === 65; const attributeId = eveData?.attributeMapping.capacitorDepletesIn ?? 0; const capacitorDepletesIn = statistics?.hull.attributes.get(attributeId)?.value; @@ -71,7 +71,7 @@ export const ShipStatistics = () => { headerLabel="Offense" headerContent={ - + } > @@ -81,8 +81,8 @@ export const ShipStatistics = () => { - ( - ) + ( + ) @@ -90,7 +90,7 @@ export const ShipStatistics = () => { - + @@ -273,7 +273,7 @@ export const ShipStatistics = () => { headerLabel="Drones" headerContent={ - + } > @@ -283,7 +283,7 @@ export const ShipStatistics = () => { - / + / Mbit/sec diff --git a/src/hooks/ExportEft/ExportEft.tsx b/src/hooks/ExportEft/ExportEft.tsx index b61e234..ba9f114 100644 --- a/src/hooks/ExportEft/ExportEft.tsx +++ b/src/hooks/ExportEft/ExportEft.tsx @@ -28,7 +28,7 @@ export function useExportEft() { let eft = ""; - const shipType = eveData.typeIDs[fit.shipTypeId]; + const shipType = eveData.types[fit.shipTypeId]; if (shipType === undefined) return null; eft += `[${shipType.name}, ${fit.name}]\n`; @@ -41,7 +41,7 @@ export function useExportEft() { continue; } - const moduleType = eveData.typeIDs[module.typeId]; + const moduleType = eveData.types[module.typeId]; if (moduleType === undefined) { eft += "[Empty " + slotToEft[slotType] + "]\n"; continue; @@ -49,7 +49,7 @@ export function useExportEft() { eft += moduleType.name; if (module.charge !== undefined) { - const chargeType = eveData.typeIDs[module.charge.typeId]; + const chargeType = eveData.types[module.charge.typeId]; if (chargeType !== undefined) { eft += `, ${chargeType.name}`; } @@ -64,7 +64,7 @@ export function useExportEft() { eft += "\n"; for (const drone of fit.drones) { - const droneType = eveData.typeIDs[drone.typeId]; + const droneType = eveData.types[drone.typeId]; if (droneType === undefined) continue; eft += droneType.name; @@ -76,7 +76,7 @@ export function useExportEft() { eft += "\n"; for (const cargo of fit.cargo) { - const cargoType = eveData.typeIDs[cargo.typeId]; + const cargoType = eveData.types[cargo.typeId]; if (cargoType === undefined) continue; eft += `${cargoType.name} x${cargo.quantity}`; diff --git a/src/hooks/ImportEft/ImportEft.tsx b/src/hooks/ImportEft/ImportEft.tsx index 5b60298..42c74ef 100644 --- a/src/hooks/ImportEft/ImportEft.tsx +++ b/src/hooks/ImportEft/ImportEft.tsx @@ -27,8 +27,8 @@ export function useImportEft() { if (eveData === null) return null; function lookupTypeByName(name: string): number | undefined { - for (const typeId in eveData?.typeIDs) { - const type = eveData.typeIDs[typeId]; + for (const typeId in eveData?.types) { + const type = eveData.types[typeId]; if (type.name === name) { return parseInt(typeId); diff --git a/src/hooks/ImportEveShipFit/DecodeKillMail.tsx b/src/hooks/ImportEveShipFit/DecodeKillMail.tsx index be3454f..1b50051 100644 --- a/src/hooks/ImportEveShipFit/DecodeKillMail.tsx +++ b/src/hooks/ImportEveShipFit/DecodeKillMail.tsx @@ -79,7 +79,7 @@ export function useFetchKillMail() { modules = modules .map((moduleOrCharge) => { /* Looks for items that are charges. */ - if (eveData.typeIDs[moduleOrCharge.typeId]?.categoryID !== 8) return moduleOrCharge; + if (eveData.types[moduleOrCharge.typeId]?.categoryID !== 8) return moduleOrCharge; /* Find the module on the same slot. */ const module = modules.find( diff --git a/src/providers/Characters/DefaultCharactersProvider/DefaultCharactersProvider.tsx b/src/providers/Characters/DefaultCharactersProvider/DefaultCharactersProvider.tsx index eb644f6..f60fdef 100644 --- a/src/providers/Characters/DefaultCharactersProvider/DefaultCharactersProvider.tsx +++ b/src/providers/Characters/DefaultCharactersProvider/DefaultCharactersProvider.tsx @@ -11,8 +11,8 @@ interface DefaultCharacterProps { const CreateSkills = (eveData: EveData, level: number) => { const skills: Skills = {}; - for (const typeId in eveData.typeIDs) { - if (eveData.typeIDs[typeId].categoryID !== 16) continue; + for (const typeId in eveData.types) { + if (eveData.types[typeId].categoryID !== 16) continue; skills[typeId] = level; } diff --git a/src/providers/Characters/EsiCharactersProvider/EsiCharactersProvider.tsx b/src/providers/Characters/EsiCharactersProvider/EsiCharactersProvider.tsx index e0b4a5f..0c2dbfb 100644 --- a/src/providers/Characters/EsiCharactersProvider/EsiCharactersProvider.tsx +++ b/src/providers/Characters/EsiCharactersProvider/EsiCharactersProvider.tsx @@ -141,8 +141,8 @@ export const EsiCharactersProvider = (props: EsiProps) => { if (esiFittings === undefined) return; /* Ensure all skills are set; also those not learnt. */ - for (const typeId in eveData.typeIDs) { - if (eveData?.typeIDs[typeId].categoryID !== 16) continue; + for (const typeId in eveData.types) { + if (eveData?.types[typeId].categoryID !== 16) continue; if (skills[typeId] !== undefined) continue; skills[typeId] = 0; } diff --git a/src/providers/DogmaEngineProvider/DogmaEngineProvider.tsx b/src/providers/DogmaEngineProvider/DogmaEngineProvider.tsx index ce21b38..7f7e5b0 100644 --- a/src/providers/DogmaEngineProvider/DogmaEngineProvider.tsx +++ b/src/providers/DogmaEngineProvider/DogmaEngineProvider.tsx @@ -5,7 +5,7 @@ import { DogmaEffect, TypeDogmaAttribute, TypeDogmaEffect, - TypeID, + Type, useEveData, } from "@/providers/EveDataProvider"; import { EsfFit } from "@/providers/CurrentFitProvider"; @@ -88,8 +88,8 @@ export const DogmaEngineProvider = (props: DogmaEngineProps) => { window.get_dogma_effect = (effect_id: number): DogmaEffect | undefined => { return eveData.dogmaEffects[effect_id]; }; - window.get_type_id = (type_id: number): TypeID | undefined => { - return eveData.typeIDs[type_id]; + window.get_type_id = (type_id: number): Type | undefined => { + return eveData.types[type_id]; }; } diff --git a/src/providers/EveDataProvider/DataTypes.tsx b/src/providers/EveDataProvider/DataTypes.tsx index eb5073d..7a62176 100644 --- a/src/providers/EveDataProvider/DataTypes.tsx +++ b/src/providers/EveDataProvider/DataTypes.tsx @@ -13,7 +13,7 @@ export interface TypeDogma { dogmaEffects: TypeDogmaEffect[]; } -export interface TypeID { +export interface Type { name: string; groupID: number; categoryID: number; @@ -27,7 +27,7 @@ export interface TypeID { volume?: number; } -export interface GroupID { +export interface Group { name: string; categoryID: number; published: boolean; diff --git a/src/providers/EveDataProvider/EveDataProvider.stories.tsx b/src/providers/EveDataProvider/EveDataProvider.stories.tsx index d787740..6a943bd 100644 --- a/src/providers/EveDataProvider/EveDataProvider.stories.tsx +++ b/src/providers/EveDataProvider/EveDataProvider.stories.tsx @@ -20,9 +20,9 @@ const TestEveData = () => { return (
- TypeIDs: {Object.keys(eveData.typeIDs).length} + Types: {Object.keys(eveData.types).length}
- GroupIDs: {Object.keys(eveData.groupIDs).length} + Groups: {Object.keys(eveData.groups).length}
MarketGroups: {Object.keys(eveData.marketGroups).length}
diff --git a/src/providers/EveDataProvider/EveDataProvider.tsx b/src/providers/EveDataProvider/EveDataProvider.tsx index b1fbc05..f33371d 100644 --- a/src/providers/EveDataProvider/EveDataProvider.tsx +++ b/src/providers/EveDataProvider/EveDataProvider.tsx @@ -2,7 +2,7 @@ import React from "react"; import { defaultDataUrl } from "@/settings"; -import { DogmaAttribute, DogmaEffect, GroupID, MarketGroup, TypeDogma, TypeID } from "./DataTypes"; +import { DogmaAttribute, DogmaEffect, Group, MarketGroup, TypeDogma, Type } from "./DataTypes"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore @@ -10,8 +10,8 @@ import { DogmaAttribute, DogmaEffect, GroupID, MarketGroup, TypeDogma, TypeID } import * as esf_pb2 from "./esf_pb2.js"; export interface EveData { - typeIDs: Record; - groupIDs: Record; + types: Record; + groups: Record; marketGroups: Record; typeDogma: Record; dogmaEffects: Record; @@ -47,8 +47,8 @@ async function fetchDataFile(dataUrl: string, name: string, pb2: any): Promise { const dataUrl = props.dataUrl ?? `${defaultDataUrl}sde/`; /* Initialize with empty data; we never set the context till everything is loaded. */ const [dogmaData, setDogmaData] = React.useState({ - typeIDs: {}, - groupIDs: {}, + types: {}, + groups: {}, marketGroups: {}, typeDogma: {}, dogmaEffects: {}, @@ -97,8 +97,8 @@ export const EveDataProvider = (props: EveDataProps) => { }); } - fetchAndLoadDataFile("typeIDs", esf_pb2.esf.TypeIDs); - fetchAndLoadDataFile("groupIDs", esf_pb2.esf.GroupIDs); + fetchAndLoadDataFile("types", esf_pb2.esf.Types); + fetchAndLoadDataFile("groups", esf_pb2.esf.Groups); fetchAndLoadDataFile("marketGroups", esf_pb2.esf.MarketGroups); fetchAndLoadDataFile("typeDogma", esf_pb2.esf.TypeDogma); fetchAndLoadDataFile("dogmaEffects", esf_pb2.esf.DogmaEffects); diff --git a/src/providers/EveDataProvider/esf_pb2.js b/src/providers/EveDataProvider/esf_pb2.js index 5723772..f77623f 100644 --- a/src/providers/EveDataProvider/esf_pb2.js +++ b/src/providers/EveDataProvider/esf_pb2.js @@ -195,9 +195,9 @@ export const esf = $root.esf = (() => { return TypeDogma; })(); - esf.TypeIDs = (function() { + esf.Types = (function() { - function TypeIDs(p) { + function Types(p) { this.entries = {}; if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) @@ -205,12 +205,12 @@ export const esf = $root.esf = (() => { this[ks[i]] = p[ks[i]]; } - TypeIDs.prototype.entries = emptyObject; + Types.prototype.entries = emptyObject; - TypeIDs.decode = async function decode(r, l) { + Types.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.TypeIDs(), k, value; + var c = l === undefined ? r.len : r.pos + l, m = new $root.esf.Types(), k, value; while (r.pos < c) { if (r.need_data()) { await r.fetch_data(); @@ -232,7 +232,7 @@ export const esf = $root.esf = (() => { k = r.int32(); break; case 2: - value = $root.esf.TypeIDs.TypeID.decode(r, r.uint32()); + value = $root.esf.Types.Type.decode(r, r.uint32()); break; default: r.skipType(tag2 & 7); @@ -250,31 +250,31 @@ export const esf = $root.esf = (() => { return m; }; - TypeIDs.TypeID = (function() { + Types.Type = (function() { - function TypeID(p) { + function Type(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]]; } - TypeID.prototype.name = ""; - TypeID.prototype.groupID = 0; - TypeID.prototype.categoryID = 0; - TypeID.prototype.published = false; - TypeID.prototype.factionID = undefined; - TypeID.prototype.marketGroupID = undefined; - TypeID.prototype.metaGroupID = undefined; - TypeID.prototype.capacity = undefined; - TypeID.prototype.mass = undefined; - TypeID.prototype.radius = undefined; - TypeID.prototype.volume = undefined; + Type.prototype.name = ""; + Type.prototype.groupID = 0; + Type.prototype.categoryID = 0; + Type.prototype.published = false; + Type.prototype.factionID = undefined; + Type.prototype.marketGroupID = undefined; + Type.prototype.metaGroupID = undefined; + Type.prototype.capacity = undefined; + Type.prototype.mass = undefined; + Type.prototype.radius = undefined; + Type.prototype.volume = undefined; - TypeID.decode = function decode(r, l) { + Type.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.TypeIDs.TypeID(); + var c = l === undefined ? r.len : r.pos + l, m = new $root.esf.Types.Type(); while (r.pos < c) { var t = r.uint32(); switch (t >>> 3) { @@ -338,15 +338,15 @@ export const esf = $root.esf = (() => { return m; }; - return TypeID; + return Type; })(); - return TypeIDs; + return Types; })(); - esf.GroupIDs = (function() { + esf.Groups = (function() { - function GroupIDs(p) { + function Groups(p) { this.entries = {}; if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) @@ -354,12 +354,12 @@ export const esf = $root.esf = (() => { this[ks[i]] = p[ks[i]]; } - GroupIDs.prototype.entries = emptyObject; + Groups.prototype.entries = emptyObject; - GroupIDs.decode = async function decode(r, l) { + Groups.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; + var c = l === undefined ? r.len : r.pos + l, m = new $root.esf.Groups(), k, value; while (r.pos < c) { if (r.need_data()) { await r.fetch_data(); @@ -381,7 +381,7 @@ export const esf = $root.esf = (() => { k = r.int32(); break; case 2: - value = $root.esf.GroupIDs.GroupID.decode(r, r.uint32()); + value = $root.esf.Groups.Group.decode(r, r.uint32()); break; default: r.skipType(tag2 & 7); @@ -399,23 +399,23 @@ export const esf = $root.esf = (() => { return m; }; - GroupIDs.GroupID = (function() { + Groups.Group = (function() { - function GroupID(p) { + function Group(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; + Group.prototype.name = ""; + Group.prototype.categoryID = 0; + Group.prototype.published = false; - GroupID.decode = function decode(r, l) { + Group.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(); + var c = l === undefined ? r.len : r.pos + l, m = new $root.esf.Groups.Group(); while (r.pos < c) { var t = r.uint32(); switch (t >>> 3) { @@ -445,10 +445,10 @@ export const esf = $root.esf = (() => { return m; }; - return GroupID; + return Group; })(); - return GroupIDs; + return Groups; })(); esf.MarketGroups = (function() { diff --git a/src/providers/EveDataProvider/index.ts b/src/providers/EveDataProvider/index.ts index 5ca3df4..8c0053f 100644 --- a/src/providers/EveDataProvider/index.ts +++ b/src/providers/EveDataProvider/index.ts @@ -1,3 +1,3 @@ export { useEveData, EveDataProvider } from "./EveDataProvider"; export type { EveData } from "./EveDataProvider"; -export type { DogmaAttribute, DogmaEffect, TypeDogmaAttribute, TypeDogmaEffect, TypeID } from "./DataTypes"; +export type { DogmaAttribute, DogmaEffect, TypeDogmaAttribute, TypeDogmaEffect, Type } from "./DataTypes"; diff --git a/src/providers/FitManagerProvider/FitManagerProvider.tsx b/src/providers/FitManagerProvider/FitManagerProvider.tsx index 8f721f2..65e9347 100644 --- a/src/providers/FitManagerProvider/FitManagerProvider.tsx +++ b/src/providers/FitManagerProvider/FitManagerProvider.tsx @@ -153,7 +153,7 @@ export const FitManagerProvider = (props: FitManagerProps) => { eveData.typeDogma[typeId]?.dogmaAttributes.find( (attr) => attr.attributeID === eveData.attributeMapping?.chargeSize, )?.value ?? -1; - const groupID = eveData.typeIDs[typeId]?.groupID ?? -1; + const groupID = eveData.types[typeId]?.groupID ?? -1; const newModules = []; for (let module of oldFit.modules) { @@ -319,7 +319,7 @@ export const FitManagerProvider = (props: FitManagerProps) => { eveData.typeDogma[typeId]?.dogmaAttributes.find( (attr) => attr.attributeID === eveData.attributeMapping?.chargeSize, )?.value ?? -1; - const groupID = eveData.typeIDs[typeId]?.groupID ?? -1; + const groupID = eveData.types[typeId]?.groupID ?? -1; setFit((oldFit: EsfFit | null): EsfFit | null => { if (oldFit === null) return null; diff --git a/src/providers/StatisticsProvider/StatisticsProvider.tsx b/src/providers/StatisticsProvider/StatisticsProvider.tsx index 0368c1d..60f6949 100644 --- a/src/providers/StatisticsProvider/StatisticsProvider.tsx +++ b/src/providers/StatisticsProvider/StatisticsProvider.tsx @@ -77,7 +77,7 @@ const CalculateSlots = (eveData: EveData, statistics: Statistics) => { const CalculateCargoBay = (eveData: EveData, fit: EsfFit): number => { /* Calculate the volume of all cargo. */ const cargoVolume = fit.cargo.reduce((acc, cargo) => { - const type = eveData.typeIDs[cargo.typeId]; + const type = eveData.types[cargo.typeId]; if (type === undefined) return acc; return acc + (type.volume ?? 0) * cargo.quantity;