feat: support import/export of ammo via EFT (#101)

This commit is contained in:
Patric Stout
2024-05-10 23:09:30 +02:00
committed by GitHub
parent 0126b2cf96
commit a0b573d66c
2 changed files with 16 additions and 0 deletions

View File

@@ -65,6 +65,12 @@ export function useFormatAsEft() {
if (module.quantity > 1) {
eft += ` x${module.quantity}`;
}
if (module.charge !== undefined) {
const chargeType = eveData.typeIDs?.[module.charge.type_id];
if (chargeType !== undefined) {
eft += `, ${chargeType.name}`;
}
}
eft += "\n";
}
}

View File

@@ -99,6 +99,9 @@ export function useFormatEftToEsi() {
const itemTypeId = lookupTypeByName(itemType);
if (itemTypeId === undefined) throw new Error(`Unknown item '${itemType}'.`);
const chargeType = (line.split(",")[1] ?? "").trim();
const chargeTypeId = lookupTypeByName(chargeType);
const effects = eveData.typeDogma?.[itemTypeId]?.dogmaEffects;
if (effects === undefined) throw new Error(`No dogma effects defined for item '${itemType}'.`);
const attributes = eveData.typeDogma?.[itemTypeId]?.dogmaAttributes;
@@ -122,11 +125,18 @@ export function useFormatEftToEsi() {
if (!slotType) continue;
const flag = slotType === "droneBay" ? 87 : esiFlagMapping[slotType][slotIndex[slotType]];
let charge = undefined;
if (chargeTypeId !== undefined) {
charge = {
type_id: chargeTypeId,
};
}
esiFit.items.push({
flag,
quantity: itemCount,
type_id: itemTypeId,
charge,
});
slotIndex[slotType]++;
}