Compare commits
3 Commits
3c02c353e7
...
03073f5436
Author | SHA1 | Date |
---|---|---|
HardiReady | 03073f5436 | |
HardiReady | 7c23c302c6 | |
HardiReady | de05260298 |
|
@ -46,7 +46,6 @@ Thumbs.db
|
|||
|
||||
# Internal Data
|
||||
/public/
|
||||
mongodb-data/
|
||||
server/resource/
|
||||
server/apib/dredd/data/tmp-resource
|
||||
backup/
|
||||
|
@ -59,4 +58,3 @@ backup/
|
|||
.cache/motd.legal-displayed
|
||||
.profile
|
||||
.ssh/
|
||||
|
||||
|
|
Binary file not shown.
|
@ -32,6 +32,7 @@ const LogBudgetSchema = new Schema({
|
|||
},
|
||||
}, {
|
||||
collection: 'logBudget',
|
||||
versionKey: false,
|
||||
});
|
||||
// optional more indices
|
||||
LogBudgetSchema.index({war: 1});
|
||||
|
|
|
@ -28,6 +28,7 @@ const LogFlagSchema = new Schema({
|
|||
},
|
||||
}, {
|
||||
collection: 'logFlag',
|
||||
versionKey: false,
|
||||
});
|
||||
// optional more indices
|
||||
LogFlagSchema.index({war: 1, player: 1});
|
||||
|
|
|
@ -40,6 +40,7 @@ const LogKillSchema = new Schema({
|
|||
},
|
||||
}, {
|
||||
collection: 'logKill',
|
||||
versionKey: false,
|
||||
});
|
||||
// optional more indices
|
||||
LogKillSchema.index({war: 1, shooter: 1, target: 1});
|
||||
|
|
|
@ -27,6 +27,7 @@ const LogPlayerCountSchema = new Schema({
|
|||
},
|
||||
}, {
|
||||
collection: 'logPlayerCount',
|
||||
versionKey: false,
|
||||
});
|
||||
// optional more indices
|
||||
LogPlayerCountSchema.index({war: 1});
|
||||
|
|
|
@ -32,6 +32,7 @@ const LogKillSchema = new Schema({
|
|||
},
|
||||
}, {
|
||||
collection: 'logPoints',
|
||||
versionKey: false,
|
||||
});
|
||||
// optional more indices
|
||||
LogKillSchema.index({war: 1, shooter: 1, target: 1});
|
||||
|
|
|
@ -19,6 +19,7 @@ const LogRespawnSchema = new Schema({
|
|||
},
|
||||
}, {
|
||||
collection: 'logRespawn',
|
||||
versionKey: false,
|
||||
});
|
||||
// optional more indices
|
||||
LogRespawnSchema.index({war: 1, player: 1});
|
||||
|
|
|
@ -32,6 +32,7 @@ const LogReviveSchema = new Schema({
|
|||
},
|
||||
}, {
|
||||
collection: 'logRevive',
|
||||
versionKey: false,
|
||||
});
|
||||
// optional more indices
|
||||
LogReviveSchema.index({war: 1, medic: 1});
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
'use strict';
|
||||
|
||||
const mongoose = require('mongoose');
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const LogServerFpsSchema = new Schema({
|
||||
war: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'War',
|
||||
required: true,
|
||||
},
|
||||
entityName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
singleAvgFps: {
|
||||
type: Number,
|
||||
get: (v) => Math.round(v),
|
||||
set: (v) => Math.round(v),
|
||||
required: true,
|
||||
},
|
||||
singleMinFps: {
|
||||
type: Number,
|
||||
get: (v) => Math.round(v),
|
||||
set: (v) => Math.round(v),
|
||||
required: true,
|
||||
},
|
||||
avgFps: [{
|
||||
type: Number,
|
||||
get: (v) => Math.round(v),
|
||||
set: (v) => Math.round(v),
|
||||
required: true,
|
||||
}],
|
||||
minFps: [{
|
||||
type: Number,
|
||||
get: (v) => Math.round(v),
|
||||
set: (v) => Math.round(v),
|
||||
required: true,
|
||||
}],
|
||||
}, {
|
||||
collection: 'logServerFps',
|
||||
versionKey: false,
|
||||
});
|
||||
// optional more indices
|
||||
LogServerFpsSchema.index({war: 1});
|
||||
|
||||
module.exports = mongoose.model('LogServerFpsSchema', LogServerFpsSchema);
|
|
@ -34,6 +34,7 @@ const LogTransportSchema = new Schema({
|
|||
},
|
||||
}, {
|
||||
collection: 'logTransport',
|
||||
versionKey: false,
|
||||
});
|
||||
// optional more indices
|
||||
LogTransportSchema.index({war: 1, driver: 1});
|
||||
|
|
|
@ -41,6 +41,7 @@ const LogVehicleKillSchema = new Schema({
|
|||
},
|
||||
}, {
|
||||
collection: 'logVehicle',
|
||||
versionKey: false,
|
||||
});
|
||||
// optional more indices
|
||||
LogVehicleKillSchema.index({war: 1, shooter: 1, target: 1});
|
||||
|
|
|
@ -82,6 +82,11 @@ const PlayerSchema = new Schema({
|
|||
get: (v) => Math.round(v),
|
||||
set: (v) => Math.round(v),
|
||||
},
|
||||
performance: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'LogServerFpsSchema',
|
||||
required: true,
|
||||
},
|
||||
}, {
|
||||
collection: 'player',
|
||||
timestamps: {createdAt: 'timestamp'},
|
||||
|
|
|
@ -34,6 +34,7 @@ const LogFlagModel = require('../models/logs/flag');
|
|||
const LogBudgetModel = require('../models/logs/budget');
|
||||
const LogPointsModel = require('../models/logs/points');
|
||||
const LogPlayerCountModel = require('../models/logs/player-count');
|
||||
const LogServerFpsModel = require('../models/logs/server-fps');
|
||||
|
||||
// util
|
||||
const genericPatch = require('./_generic').genericPatch;
|
||||
|
@ -73,11 +74,6 @@ wars.route('/')
|
|||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
PlayerModel.create(statsResult.players, (err) => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
LogKillModel.create(statsResult.kills, () => {
|
||||
LogVehicleKillModel.create(statsResult.vehicles, () => {
|
||||
LogRespawnModel.create(statsResult.respawn, () => {
|
||||
|
@ -87,6 +83,20 @@ wars.route('/')
|
|||
LogTransportModel.create(statsResult.transport, () => {
|
||||
LogPlayerCountModel.create(statsResult.playerCount, () => {
|
||||
LogPointsModel.create(statsResult.points, () => {
|
||||
LogServerFpsModel.create(statsResult.serverFps, (err, serverPerformanceEntries) => {
|
||||
serverPerformanceEntries.forEach((entry) => {
|
||||
const idx = statsResult.players
|
||||
.findIndex((player) => player.name === entry.entityName);
|
||||
if (idx !== -1) {
|
||||
const player = statsResult.players[idx];
|
||||
player['performance'] = entry._id;
|
||||
statsResult.players[idx] = player;
|
||||
}
|
||||
});
|
||||
PlayerModel.create(statsResult.players, (err) => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
const folderName = resourceLocation.concat(war._id);
|
||||
mkdirp(folderName, (err) => {
|
||||
if (err) return next(err);
|
||||
|
@ -121,12 +131,14 @@ wars.route('/')
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
const err = new Error('no Logfile provided');
|
||||
err.status = codes.wrongmediasend;
|
||||
next(err);
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
.all(
|
||||
routerHandling.httpMethodNotAllowed
|
||||
|
|
|
@ -29,6 +29,14 @@ const opforPlayerCountRegex = /CSAT\s(\d*)/;
|
|||
|
||||
const timestampRegex = /LOG:\s(\d*:\d*:\d*)\s---/;
|
||||
|
||||
const singleMinFpsRegex = /Single min\. FPS for (.*):\s(\d*.\d*)"/; // group1 = entity name, group2 = value
|
||||
|
||||
const singleAvgFpsRegex = /Single avg\. FPS for (.*):\s(\d*.\d*)"/; // group1 = entity name, group2 = value
|
||||
|
||||
const minFpsRegex = /Min\. FPS for (.*):\s\[(.*)\]"/; // group1 = entity name, group2 = comma separated values
|
||||
|
||||
const avgFpsRegex = /Avg\. FPS for (.*):\s\[(.*)\]"/; // group1 = entity name, group2 = comma separated values
|
||||
|
||||
const parseWarLog = (lineArray, war) => {
|
||||
let flagBlufor = true;
|
||||
let flagOpfor = true;
|
||||
|
@ -48,6 +56,7 @@ const parseWarLog = (lineArray, war) => {
|
|||
transport: [],
|
||||
players: [],
|
||||
playerCount: [],
|
||||
serverFps: [],
|
||||
};
|
||||
|
||||
const VEHICLE_BLACKLIST = [
|
||||
|
@ -265,6 +274,43 @@ const parseWarLog = (lineArray, war) => {
|
|||
countBlufor: countBlufor,
|
||||
countOpfor: countOpfor,
|
||||
});
|
||||
} else if (line.includes('(FPS)')) {
|
||||
stats.clean.push(line);
|
||||
|
||||
const updateServerFpsLogEntry = (entityName, addKey, addValue) => {
|
||||
const idx = stats.serverFps.findIndex((entry) => entry.entityName === entityName);
|
||||
if (idx === -1) {
|
||||
stats.serverFps.push({
|
||||
war: war.id,
|
||||
entityName: entityName,
|
||||
[addKey]: addValue,
|
||||
});
|
||||
return;
|
||||
}
|
||||
const entity = stats.serverFps[idx];
|
||||
entity[addKey] = addValue;
|
||||
stats.serverFps[idx] = entity;
|
||||
};
|
||||
|
||||
const singleMinMatch = singleMinFpsRegex.exec(line);
|
||||
if (singleMinMatch) {
|
||||
updateServerFpsLogEntry(singleMinMatch[1], 'singleMinFps', singleMinMatch[2]);
|
||||
} else {
|
||||
const singleAvgMatch = singleAvgFpsRegex.exec(line);
|
||||
if (singleAvgMatch) {
|
||||
updateServerFpsLogEntry(singleAvgMatch[1], 'singleAvgFps', singleAvgMatch[2]);
|
||||
} else {
|
||||
const minCollectionMatch = minFpsRegex.exec(line);
|
||||
if (minCollectionMatch) {
|
||||
updateServerFpsLogEntry(minCollectionMatch[1], 'minFps', minCollectionMatch[2].split(','));
|
||||
} else {
|
||||
const avgCollectionMatch = avgFpsRegex.exec(line);
|
||||
if (avgCollectionMatch) {
|
||||
updateServerFpsLogEntry(avgCollectionMatch[1], 'avgFps', avgCollectionMatch[2].split(','));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (line.includes('(Fraktionsuebersicht)') || line.includes('Fraktionsübersicht')) {
|
||||
/**
|
||||
* PLAYERS
|
||||
|
|
Loading…
Reference in New Issue