Add new transport parsing to stats upload
parent
8ae4999593
commit
c6b9858420
|
@ -140,26 +140,26 @@ const parseWarLog = (lineArray, war) => {
|
|||
});
|
||||
}
|
||||
|
||||
// /**
|
||||
// * TRANSPORT
|
||||
// */
|
||||
// else if (line.includes('Transport ||')) {
|
||||
// stats.clean.push(line);
|
||||
// const driverString = line.substring(line.lastIndexOf('wurde von ') + 10, line.lastIndexOf(' eingeflogen'));
|
||||
// const driver = getPlayerAndFractionFromString(driverString);
|
||||
// const passengerString = line.substring(line.lastIndexOf('|| ') + 3, line.lastIndexOf(' wurde von'));
|
||||
// const passenger = getPlayerAndFractionFromString(passengerString);
|
||||
// const distance = parseInt(line.substring(line.lastIndexOf('eingeflogen (') + 13, line.lastIndexOf('m)') - 1));
|
||||
//
|
||||
// stats.transport.push({
|
||||
// war: war._id,
|
||||
// time: getFullTimeDate(war.date, line.split(' ')[5]),
|
||||
// driver: driver.name,
|
||||
// passenger: passenger ? passenger.name : null,
|
||||
// fraction: driver.fraction,
|
||||
// distance: distance
|
||||
// });
|
||||
// }
|
||||
/**
|
||||
* TRANSPORT
|
||||
*/
|
||||
else if (line.includes('(Transport)')) {
|
||||
stats.clean.push(line);
|
||||
const driverString = line.substring(line.lastIndexOf('wurde von ') + 10, line.lastIndexOf(' eingeflogen'));
|
||||
const driver = getPlayerAndFractionFromString(driverString);
|
||||
const passengerString = line.substring(line.lastIndexOf('--- ') + 3, line.lastIndexOf(' wurde von'));
|
||||
const passenger = getPlayerAndFractionFromString(passengerString);
|
||||
const distance = parseInt(line.substring(line.lastIndexOf('eingeflogen (') + 13, line.lastIndexOf('m)') - 1));
|
||||
|
||||
stats.transport.push({
|
||||
war: war._id,
|
||||
time: getFullTimeDate(war.date, line.split(' ')[5]),
|
||||
driver: driver.name,
|
||||
passenger: passenger ? passenger.name : null,
|
||||
fraction: driver.fraction,
|
||||
distance: distance
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* PLAYERS
|
||||
|
|
Loading…
Reference in New Issue