Fix parsing for vehicle info

pull/35/head
HardiReady 2018-06-04 20:34:17 +02:00
parent b1cc8a8f9a
commit c14b33f9c5
2 changed files with 5 additions and 4 deletions

View File

@ -78,7 +78,7 @@ const parseWarLog = (lineArray, war) => {
}); });
} }
} else { } else {
const targetString = line.substring(line.lastIndexOf(' --- ') + 5, line.lastIndexOf(' von:')); const targetString = line.substring(line.lastIndexOf(' --- Einheit: ') + 14, line.lastIndexOf(' von:'));
const target = getPlayerAndFractionFromString(targetString); const target = getPlayerAndFractionFromString(targetString);
stats.kills.push({ stats.kills.push({
war: war._id, war: war._id,
@ -277,11 +277,12 @@ const getPlayerAndFractionFromString = (nameAndFractionString) => {
const getVehicleAndFractionFromString = (nameClassFractionString) => { const getVehicleAndFractionFromString = (nameClassFractionString) => {
const nameArray = nameClassFractionString.trim().split(WHITESPACE); const nameArray = nameClassFractionString.trim().split(WHITESPACE);
const vehicleFraction = nameArray[nameArray.length - 1].slice(0,-1);
const vehicleFraction = nameArray[nameArray.length - 1]; nameArray.pop();
nameArray.pop(); nameArray.pop();
const vehicleClassString = nameArray[nameArray.length - 1].replace('(', '').replace(')', ''); const vehicleClassString = nameArray[nameArray.length - 1].replace('(', '').replace(')', '');
nameArray.pop(); nameArray.pop();
nameArray.pop();
const vehicleName = nameArray.join(WHITESPACE); const vehicleName = nameArray.join(WHITESPACE);
// skip logging here - this is some basic equipment identifier (i.e. parachute) // skip logging here - this is some basic equipment identifier (i.e. parachute)

View File

@ -1,6 +1,6 @@
{ {
"name": "opt-cc", "name": "opt-cc",
"version": "1.7.4", "version": "1.7.5",
"author": "Florian Hartwich <hardi@noarch.de>", "author": "Florian Hartwich <hardi@noarch.de>",
"private": true, "private": true,
"scripts": { "scripts": {