Add 4/5 and 5/5 "detection"
This commit is contained in:
@@ -1,5 +1,28 @@
|
|||||||
import { SigviewRecord as Signature } from "@/lib/pbtypes";
|
import { SigviewRecord as Signature } from "@/lib/pbtypes";
|
||||||
|
|
||||||
|
const fourOutOfTen = [
|
||||||
|
"Angel Cartel Occupied Mining Colony",
|
||||||
|
"Mul-Zatah Monastery",
|
||||||
|
"Guristas Scout Outpost",
|
||||||
|
"Sansha's Nation Occupied Mining Colony",
|
||||||
|
"Serpentis Phi-Outpost",
|
||||||
|
"Drone Infested Mine",
|
||||||
|
];
|
||||||
|
const fiveOutOfTen = [
|
||||||
|
"Angel's Red Light District",
|
||||||
|
"Blood Raider Psychotropics Depot",
|
||||||
|
"Guristas Hallucinogen Supply Waypoint",
|
||||||
|
"Sansha's Nation Neural Paralytic Facility",
|
||||||
|
"Serpentis Corporation Hydroponics Site",
|
||||||
|
"Outgrowth Rogue Drone Hive",
|
||||||
|
];
|
||||||
|
function isFourOutOfTen(signature: string): boolean {
|
||||||
|
return fourOutOfTen.some((s) => signature.includes(s));
|
||||||
|
}
|
||||||
|
function isFiveOutOfTen(signature: string): boolean {
|
||||||
|
return fiveOutOfTen.some((s) => signature.includes(s));
|
||||||
|
}
|
||||||
|
|
||||||
export const parseSignature = (text: string): Omit<Signature, 'system' | 'id' | 'sysid'> | null => {
|
export const parseSignature = (text: string): Omit<Signature, 'system' | 'id' | 'sysid'> | null => {
|
||||||
const parts = text.split('\t');
|
const parts = text.split('\t');
|
||||||
if (parts.length < 4) return null;
|
if (parts.length < 4) return null;
|
||||||
@@ -10,12 +33,23 @@ export const parseSignature = (text: string): Omit<Signature, 'system' | 'id' |
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let note = "";
|
||||||
|
const isFour = isFourOutOfTen(parts[3]);
|
||||||
|
if (isFour) {
|
||||||
|
note = "4/10";
|
||||||
|
}
|
||||||
|
const isFive = isFiveOutOfTen(parts[3]);
|
||||||
|
if (isFive) {
|
||||||
|
note = "5/10";
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
identifier: parts[0],
|
identifier: parts[0],
|
||||||
type: parts[2],
|
type: parts[2],
|
||||||
signame: parts[3],
|
signame: parts[3],
|
||||||
scanned: parts.length > 4 ? parts[4] : undefined,
|
scanned: parts.length > 4 ? parts[4] : undefined,
|
||||||
dangerous: false // TODO: Implement dangerous signature detection
|
dangerous: false, // TODO: Implement dangerous signature detection
|
||||||
|
note: note,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user