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