fix: parsing quantity (... x5) fails when loading EFT fits (#7)
This commit is contained in:
@@ -51,6 +51,8 @@ Loki Core - Augmented Nuclear Reactor
|
||||
Loki Defensive - Covert Reconfiguration
|
||||
Loki Offensive - Launcher Efficiency Configuration
|
||||
Loki Propulsion - Wake Limiter
|
||||
|
||||
Hammerhead II x1
|
||||
`,
|
||||
},
|
||||
decorators: [withEveDataProvider],
|
||||
|
||||
@@ -81,7 +81,8 @@ export function useFormatEftToEsi() {
|
||||
continue;
|
||||
}
|
||||
|
||||
const itemType = line.split(",")[0].trim();
|
||||
const itemType = line.split(",")[0].split(" x")[0].trim();
|
||||
const itemCount = parseInt(line.split(",")[0].split(" x")[1]?.trim() ?? "1");
|
||||
const itemTypeId = lookupTypeByName(itemType);
|
||||
if (itemTypeId === undefined) throw new Error(`Unknown item '${itemType}'.`);
|
||||
|
||||
@@ -99,7 +100,7 @@ export function useFormatEftToEsi() {
|
||||
/* Ignore items we don't care about. */
|
||||
if (slotType === "") continue;
|
||||
|
||||
esiFit.items.push({"flag": EsiFlagMapping[slotType] + slotIndex[slotType], "quantity": 1, "type_id": itemTypeId});
|
||||
esiFit.items.push({"flag": EsiFlagMapping[slotType] + slotIndex[slotType], "quantity": itemCount, "type_id": itemTypeId});
|
||||
slotIndex[slotType]++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user