Add revive and flag parsing
parent
f1449e5047
commit
db48cd8ef6
|
@ -12,7 +12,6 @@ const parseWarLog = (lineArray, war) => {
|
||||||
const flag = [];
|
const flag = [];
|
||||||
const transport = [];
|
const transport = [];
|
||||||
const playerNames = [];
|
const playerNames = [];
|
||||||
|
|
||||||
const addPlayerIfNotExists = (playerName) => {
|
const addPlayerIfNotExists = (playerName) => {
|
||||||
if (playerName !== 'Error: No unit' && !arrayContains(playerNames, playerName)) {
|
if (playerName !== 'Error: No unit' && !arrayContains(playerNames, playerName)) {
|
||||||
playerNames.push(playerName);
|
playerNames.push(playerName);
|
||||||
|
@ -45,7 +44,18 @@ const parseWarLog = (lineArray, war) => {
|
||||||
|
|
||||||
if (line.includes("Fahne")) {
|
if (line.includes("Fahne")) {
|
||||||
clean.push(line);
|
clean.push(line);
|
||||||
|
const playerName = line.substring(line.lastIndexOf("t von ") + 6, line.lastIndexOf(" :OPT LOG END"));
|
||||||
|
const flagFraction = line.includes('NATO Flagge') ? 'BLUFOR' : 'OPFOR';
|
||||||
|
const capture = !!line.includes('Flagge erobert');
|
||||||
|
|
||||||
|
flag.push({
|
||||||
|
warId: 'sdf89uiz786',
|
||||||
|
time: getDateTime(line.split(" ")[5]),
|
||||||
|
player: playerName,
|
||||||
|
flagFraction: flagFraction,
|
||||||
|
capture: capture
|
||||||
|
});
|
||||||
|
addPlayerIfNotExists(playerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.includes("Punkte")) {
|
if (line.includes("Punkte")) {
|
||||||
|
@ -71,7 +81,29 @@ const parseWarLog = (lineArray, war) => {
|
||||||
|
|
||||||
if (line.includes("Revive")) {
|
if (line.includes("Revive")) {
|
||||||
clean.push(line);
|
clean.push(line);
|
||||||
//console.log(line);
|
|
||||||
|
const stabilized = !!line.includes('stabilisiert');
|
||||||
|
|
||||||
|
const medicName = line.substring(line.lastIndexOf("wurde von ") + 10, line.lastIndexOf(stabilized ? ' stabilisiert' : ' wiederbelebt'));
|
||||||
|
const medicNameArray = medicName.split(" ");
|
||||||
|
const medicFraction = medicNameArray[medicNameArray.length - 1] === "(WEST)" ? "BLUFOR" : "OPFOR";
|
||||||
|
const sanitizedMedicName = medicName.substring(0, medicName.indexOf(medicNameArray[medicNameArray.length - 1]) - 1);
|
||||||
|
|
||||||
|
const patientName = line.substring(line.lastIndexOf("|| ") + 3, line.lastIndexOf(" wurde von"));
|
||||||
|
const patientNameArray = patientName.split(" ");
|
||||||
|
const patientFraction = patientNameArray[patientNameArray.length - 1] === "(WEST)" ? "BLUFOR" : "OPFOR";
|
||||||
|
const sanitizedPatientName = patientName.substring(0, patientName.indexOf(patientNameArray[patientNameArray.length - 1]) - 1);
|
||||||
|
|
||||||
|
revive.push({
|
||||||
|
warId: 'asfddf',
|
||||||
|
time: getDateTime(line.split(" ")[5]),
|
||||||
|
stabilized: stabilized,
|
||||||
|
medic: sanitizedMedicName,
|
||||||
|
patient: sanitizedPatientName
|
||||||
|
});
|
||||||
|
|
||||||
|
addPlayerIfNotExists(sanitizedMedicName);
|
||||||
|
addPlayerIfNotExists(sanitizedPatientName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.includes("Transport ||")) {
|
if (line.includes("Transport ||")) {
|
||||||
|
@ -89,6 +121,7 @@ const parseWarLog = (lineArray, war) => {
|
||||||
|
|
||||||
transport.push({
|
transport.push({
|
||||||
war: "blablub7z8",
|
war: "blablub7z8",
|
||||||
|
time: getDateTime(line.split(" ")[5]),
|
||||||
driver: sanitizedDriverName,
|
driver: sanitizedDriverName,
|
||||||
passenger: sanitizedPassengerName,
|
passenger: sanitizedPassengerName,
|
||||||
distance: distance
|
distance: distance
|
||||||
|
@ -99,7 +132,8 @@ const parseWarLog = (lineArray, war) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//
|
//
|
||||||
playerNames.forEach(budg => console.log(budg));
|
// revive.forEach(budg => console.log(budg));
|
||||||
|
// console.log(revive.length)
|
||||||
};
|
};
|
||||||
|
|
||||||
function getRespawnEntry(respawn, playerName) {
|
function getRespawnEntry(respawn, playerName) {
|
||||||
|
|
Loading…
Reference in New Issue