Do not process/count duplicated flagTouch
parent
21e2d81b06
commit
14c4cf68ff
|
@ -24,6 +24,10 @@ const vehicleRegex = /(vehicle:\s(.*?)\))/;
|
||||||
const categoryRegex = /(category:\s(.*?)\))/;
|
const categoryRegex = /(category:\s(.*?)\))/;
|
||||||
|
|
||||||
const parseWarLog = (lineArray, war) => {
|
const parseWarLog = (lineArray, war) => {
|
||||||
|
|
||||||
|
let flagBlufor = true;
|
||||||
|
let flagOpfor = true;
|
||||||
|
|
||||||
const NAME_TOO_LONG_ERROR = 'Error: ENAMETOOLONG: name too long, open \'';
|
const NAME_TOO_LONG_ERROR = 'Error: ENAMETOOLONG: name too long, open \'';
|
||||||
|
|
||||||
const stats = {
|
const stats = {
|
||||||
|
@ -164,18 +168,29 @@ const parseWarLog = (lineArray, war) => {
|
||||||
/**
|
/**
|
||||||
* FLAG
|
* FLAG
|
||||||
*/
|
*/
|
||||||
stats.clean.push(line);
|
|
||||||
const playerName = line.substring(line.lastIndexOf('rt von ') + 7).slice(0, -1);
|
|
||||||
const flagFraction = line.includes('NATO Flagge') ? 'BLUFOR' : 'OPFOR';
|
const flagFraction = line.includes('NATO Flagge') ? 'BLUFOR' : 'OPFOR';
|
||||||
const capture = !!line.includes('Flagge erobert');
|
const capture = !!line.includes('Flagge erobert');
|
||||||
|
|
||||||
stats.flag.push({
|
if ((flagFraction === 'BLUFOR' && ((capture && flagBlufor) || (!capture && !flagBlufor))) ||
|
||||||
war: war._id,
|
(flagFraction === 'OPFOR' && ((capture && flagOpfor) || (!capture && !flagOpfor)))) {
|
||||||
time: getFullTimeDate(war.date, line.split(WHITESPACE)[5]),
|
stats.clean.push(line);
|
||||||
player: playerName,
|
|
||||||
flagFraction: flagFraction,
|
const playerName = line.substring(line.lastIndexOf('rt von ') + 7).slice(0, -1);
|
||||||
capture: capture,
|
|
||||||
});
|
if (flagFraction === 'BLUFOR') {
|
||||||
|
flagBlufor = !capture;
|
||||||
|
} else if (flagFraction === 'OPFOR') {
|
||||||
|
flagOpfor = !capture;
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.flag.push({
|
||||||
|
war: war._id,
|
||||||
|
time: getFullTimeDate(war.date, line.split(WHITESPACE)[5]),
|
||||||
|
player: playerName,
|
||||||
|
flagFraction: flagFraction,
|
||||||
|
capture: capture,
|
||||||
|
});
|
||||||
|
}
|
||||||
} else if (line.includes('(Punkte)')) {
|
} else if (line.includes('(Punkte)')) {
|
||||||
/**
|
/**
|
||||||
* POINTS
|
* POINTS
|
||||||
|
|
Loading…
Reference in New Issue