diff --git a/.storybook/fits.ts b/.storybook/fits.ts
index 607d6e4..8c1cafe 100644
--- a/.storybook/fits.ts
+++ b/.storybook/fits.ts
@@ -39,10 +39,13 @@ export const fullFits = [
ship_type_id: 29984,
description: "",
items: [
- { flag: 125, quantity: 1, type_id: 45626 },
- { flag: 126, quantity: 1, type_id: 45591 },
- { flag: 127, quantity: 1, type_id: 45601 },
- { flag: 128, quantity: 1, type_id: 45615 },
+ { flag: 5, quantity: 1, type_id: 35794 },
+ { flag: 5, quantity: 1, type_id: 35794 },
+ { flag: 5, quantity: 1, type_id: 35795 },
+ { flag: 5, quantity: 3720, type_id: 24492 },
+ { flag: 5, quantity: 396, type_id: 24492 },
+ { flag: 5, quantity: 5472, type_id: 2679 },
+ { flag: 5, quantity: 8, type_id: 30486 },
{ flag: 11, quantity: 1, type_id: 22291 },
{ flag: 12, quantity: 1, type_id: 22291 },
{ flag: 13, quantity: 1, type_id: 22291 },
@@ -63,13 +66,10 @@ export const fullFits = [
{ flag: 92, quantity: 1, type_id: 31724 },
{ flag: 93, quantity: 1, type_id: 31824 },
{ flag: 94, quantity: 1, type_id: 31378 },
- { flag: 5, quantity: 3720, type_id: 24492 },
- { flag: 5, quantity: 5472, type_id: 2679 },
- { flag: 5, quantity: 1, type_id: 35795 },
- { flag: 5, quantity: 1, type_id: 35794 },
- { flag: 5, quantity: 8, type_id: 30486 },
- { flag: 5, quantity: 1, type_id: 35794 },
- { flag: 5, quantity: 396, type_id: 24492 },
+ { flag: 125, quantity: 1, type_id: 45626 },
+ { flag: 126, quantity: 1, type_id: 45591 },
+ { flag: 127, quantity: 1, type_id: 45601 },
+ { flag: 128, quantity: 1, type_id: 45615 },
],
},
{
@@ -77,37 +77,76 @@ export const fullFits = [
ship_type_id: 29986,
description: "",
items: [
- { flag: 21, quantity: 1, type_id: 527 },
- { flag: 19, quantity: 1, type_id: 2024 },
+ { flag: 5, quantity: 1, type_id: 32014 },
+ { flag: 5, quantity: 1, type_id: 33474 },
+ { flag: 5, quantity: 2, type_id: 30832 },
+ { flag: 5, quantity: 2, type_id: 30834 },
+ { flag: 5, quantity: 6, type_id: 12826 },
+ { flag: 11, quantity: 1, type_id: 3530 },
+ { flag: 12, quantity: 1, type_id: 14072 },
+ { flag: 13, quantity: 1, type_id: 14072 },
+ { flag: 14, quantity: 1, type_id: 5839 },
{ flag: 15, quantity: 1, type_id: 2364 },
+ { flag: 19, quantity: 1, type_id: 2024 },
+ { flag: 20, quantity: 1, type_id: 3244 },
+ { flag: 21, quantity: 1, type_id: 527 },
+ { flag: 22, quantity: 1, type_id: 35656 },
{ flag: 27, quantity: 1, type_id: 3025, charge: { type_id: 253 } },
{ flag: 28, quantity: 1, type_id: 3025, charge: { type_id: 253 } },
{ flag: 29, quantity: 1, type_id: 3025, charge: { type_id: 253 } },
{ flag: 30, quantity: 1, type_id: 3025, charge: { type_id: 253 } },
{ flag: 31, quantity: 1, type_id: 3025, charge: { type_id: 253 } },
{ flag: 32, quantity: 1, type_id: 3025, charge: { type_id: 253 } },
- { flag: 20, quantity: 1, type_id: 3244 },
- { flag: 11, quantity: 1, type_id: 3530 },
- { flag: 14, quantity: 1, type_id: 5839 },
- { flag: 34, quantity: 1, type_id: 11578 },
- { flag: 5, quantity: 6, type_id: 12826 },
- { flag: 12, quantity: 1, type_id: 14072 },
- { flag: 13, quantity: 1, type_id: 14072 },
{ flag: 33, quantity: 1, type_id: 28756 },
- { flag: 5, quantity: 2, type_id: 30832 },
- { flag: 5, quantity: 2, type_id: 30834 },
+ { flag: 34, quantity: 1, type_id: 11578 },
{ flag: 92, quantity: 1, type_id: 31055 },
- { flag: 94, quantity: 1, type_id: 31071 },
{ flag: 93, quantity: 1, type_id: 31215 },
- { flag: 5, quantity: 1, type_id: 32014 },
- { flag: 5, quantity: 1, type_id: 33474 },
- { flag: 22, quantity: 1, type_id: 35656 },
- { flag: 126, quantity: 1, type_id: 45586 },
- { flag: 128, quantity: 1, type_id: 45598 },
+ { flag: 94, quantity: 1, type_id: 31071 },
{ flag: 125, quantity: 1, type_id: 45612 },
+ { flag: 126, quantity: 1, type_id: 45586 },
{ flag: 127, quantity: 1, type_id: 45622 },
+ { flag: 128, quantity: 1, type_id: 45598 },
+ ],
+ },
+ {
+ name: "Loki",
+ ship_type_id: 29990,
+ description: "",
+ items: [
+ { flag: 5, quantity: 1, type_id: 33700 },
+ { flag: 5, quantity: 150, type_id: 28668 },
+ { flag: 5, quantity: 16, type_id: 30486 },
+ { flag: 5, quantity: 16, type_id: 30488 },
+ { flag: 5, quantity: 330, type_id: 2679 },
+ { flag: 5, quantity: 9000, type_id: 13856 },
+ { flag: 5, quantity: 9000, type_id: 24488 },
+ { flag: 11, quantity: 1, type_id: 22291 },
+ { flag: 12, quantity: 1, type_id: 22291 },
+ { flag: 19, quantity: 1, type_id: 19203 },
+ { flag: 20, quantity: 1, type_id: 19289 },
+ { flag: 21, quantity: 1, type_id: 2281 },
+ { flag: 22, quantity: 1, type_id: 17500 },
+ { flag: 23, quantity: 1, type_id: 14142 },
+ { flag: 24, quantity: 1, type_id: 41220 },
+ { flag: 25, quantity: 1, type_id: 14108 },
+ { flag: 27, quantity: 1, type_id: 25715, charge: { type_id: 24488 } },
+ { flag: 28, quantity: 1, type_id: 25715, charge: { type_id: 24488 } },
+ { flag: 29, quantity: 1, type_id: 25715, charge: { type_id: 24488 } },
+ { flag: 30, quantity: 1, type_id: 25715, charge: { type_id: 24488 } },
+ { flag: 31, quantity: 1, type_id: 25715, charge: { type_id: 24488 } },
+ { flag: 32, quantity: 1, type_id: 30836 },
+ { flag: 33, quantity: 1, type_id: 11578 },
+ { flag: 34, quantity: 1, type_id: 28756, charge: { type_id: 30488 } },
+ { flag: 87, quantity: 5, type_id: 2456 },
+ { flag: 92, quantity: 1, type_id: 31748 },
+ { flag: 93, quantity: 1, type_id: 31760 },
+ { flag: 94, quantity: 1, type_id: 31588 },
+ { flag: 125, quantity: 1, type_id: 45633 },
+ { flag: 126, quantity: 1, type_id: 45595 },
+ { flag: 127, quantity: 1, type_id: 45608 },
+ { flag: 128, quantity: 1, type_id: 45621 },
],
},
];
-export const fullFit = fullFits[0];
+export const fullFit = fullFits[2];
diff --git a/package.json b/package.json
index 3bbd0aa..9e997d2 100644
--- a/package.json
+++ b/package.json
@@ -63,7 +63,7 @@
"typescript-plugin-css-modules": "^5.0.2"
},
"peerDependencies": {
- "@eveshipfit/dogma-engine": "^3.0.0",
+ "@eveshipfit/dogma-engine": "^3.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
diff --git a/src/CalculationDetail/CalculationDetail.stories.tsx b/src/CalculationDetail/CalculationDetail.stories.tsx
index a3f0e98..640057e 100644
--- a/src/CalculationDetail/CalculationDetail.stories.tsx
+++ b/src/CalculationDetail/CalculationDetail.stories.tsx
@@ -1,7 +1,7 @@
import type { Decorator, Meta, StoryObj } from "@storybook/react";
import React from "react";
-import { fullFits } from "../../.storybook/fits";
+import { fullFit } from "../../.storybook/fits";
import { DogmaEngineProvider } from "../DogmaEngineProvider";
import { EsiProvider } from "../EsiProvider";
@@ -43,7 +43,7 @@ export const Default: Story = {
decorators: [useShipSnapshotProvider],
parameters: {
snapshot: {
- fit: fullFits[1],
+ fit: fullFit,
},
},
};
diff --git a/src/ShipAttribute/ShipAttribute.tsx b/src/ShipAttribute/ShipAttribute.tsx
index bca8330..08fc786 100644
--- a/src/ShipAttribute/ShipAttribute.tsx
+++ b/src/ShipAttribute/ShipAttribute.tsx
@@ -3,7 +3,7 @@ import React from "react";
import { EveDataContext } from "../EveDataProvider";
import { ShipSnapshotContext } from "../ShipSnapshotProvider";
-export interface ShipAttributeProps {
+export interface AttributeProps {
/** Name of the attribute. */
name: string;
/** How many decimals to render. */
@@ -17,13 +17,18 @@ export interface ShipAttributeProps {
/**
* Return the value of a ship's attribute.
*/
-export function useShipAttribute(props: ShipAttributeProps) {
+export function useAttribute(type: "Ship" | "Char", props: AttributeProps) {
const eveData = React.useContext(EveDataContext);
const shipSnapshot = React.useContext(ShipSnapshotContext);
if (shipSnapshot?.loaded) {
const attributeId = eveData.attributeMapping?.[props.name] || 0;
- let value = shipSnapshot.hull?.attributes.get(attributeId)?.value;
+ let value;
+ if (type === "Ship") {
+ value = shipSnapshot.hull?.attributes.get(attributeId)?.value;
+ } else {
+ value = shipSnapshot.char?.attributes.get(attributeId)?.value;
+ }
let highIsGood = eveData.dogmaAttributes?.[attributeId]?.highIsGood;
if (value == undefined) {
@@ -63,10 +68,19 @@ export function useShipAttribute(props: ShipAttributeProps) {
}
/**
- * Render a single attribute of a ship's snapshot.
+ * Render a single ship attribute of a ship's snapshot.
*/
-export const ShipAttribute = (props: ShipAttributeProps) => {
- const stringValue = useShipAttribute(props);
+export const ShipAttribute = (props: AttributeProps) => {
+ const stringValue = useAttribute("Ship", props);
+
+ return {stringValue};
+};
+
+/**
+ * Render a single character attribute of a ship's snapshot.
+ */
+export const CharAttribute = (props: AttributeProps) => {
+ const stringValue = useAttribute("Char", props);
return {stringValue};
};
diff --git a/src/ShipAttribute/index.ts b/src/ShipAttribute/index.ts
index 620ab71..b517f3c 100644
--- a/src/ShipAttribute/index.ts
+++ b/src/ShipAttribute/index.ts
@@ -1 +1 @@
-export { useShipAttribute, ShipAttribute } from "./ShipAttribute";
+export { useAttribute, CharAttribute, ShipAttribute } from "./ShipAttribute";
diff --git a/src/ShipFitExtended/ShipFitExtended.tsx b/src/ShipFitExtended/ShipFitExtended.tsx
index bfe1acf..4b3729b 100644
--- a/src/ShipFitExtended/ShipFitExtended.tsx
+++ b/src/ShipFitExtended/ShipFitExtended.tsx
@@ -31,7 +31,9 @@ const DroneBay = () => {