refactor: updated log parsers for Squad V7

This commit is contained in:
Fantino Davide 2023-12-12 02:55:51 +01:00
parent 2905b229a7
commit 978ad35b3a
18 changed files with 165 additions and 127 deletions

View File

@ -1,6 +1,6 @@
export default { export default {
regex: regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: AddClientConnection: Added client connection: \[UNetConnection\] RemoteAddr: ([\d\.]+):[0-9]+, Name: (EOSIpNetConnection_[0-9]+), Driver: GameNetDriver (EOSNetDriver_[0-9]+), IsServer: YES, PC: NULL, Owner: NULL, UniqueId: INVALID/, /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: AddClientConnection: Added client connection: \[UNetConnection\] RemoteAddr: ([\d.]+):[0-9]+, Name: (EOSIpNetConnection_[0-9]+), Driver: GameNetDriver (EOSNetDriver_[0-9]+), IsServer: YES, PC: NULL, Owner: NULL, UniqueId: INVALID/,
onMatch: (args, logParser) => { onMatch: (args, logParser) => {
const data = { const data = {
raw: args[0], raw: args[0],

View File

@ -6,7 +6,7 @@ export default {
raw: args[0], raw: args[0],
time: args[1], time: args[1],
chainID: +args[2], chainID: +args[2],
eosID: args[ 3 ], eosID: args[3]
}; };
logParser.eventStore.joinRequests[data.chainID].eosID = data.eosID; logParser.eventStore.joinRequests[data.chainID].eosID = data.eosID;

View File

@ -7,14 +7,14 @@ export default {
time: args[1], time: args[1],
chainID: args[2], chainID: args[2],
eosID: args.groups.eosId, eosID: args.groups.eosId,
steamID: args.groups.steamId, steamID: args.groups.steamId
}; };
logParser.eventStore.players[data.steamID] = { logParser.eventStore.players[data.steamID] = {
eosID: data.eosID, eosID: data.eosID,
steamID: data.steamID steamID: data.steamID
}; };
logParser.eventStore.playersEOS[ data.eosID ] = logParser.eventStore.players[ data.steamID ] logParser.eventStore.playersEOS[data.eosID] = logParser.eventStore.players[data.steamID];
logParser.emit('CLIENT_EXTERNAL_ACCOUNT_INFO', data); logParser.emit('CLIENT_EXTERNAL_ACCOUNT_INFO', data);
} }

View File

@ -19,11 +19,12 @@ import ServerTickRate from './server-tick-rate.js';
import AddingClientConnection from './adding-client-connection.js'; import AddingClientConnection from './adding-client-connection.js';
import ClientLogin from './client-login.js'; import ClientLogin from './client-login.js';
import PendingConnectionDestroyed from './pending-connection-destroyed.js'; import PendingConnectionDestroyed from './pending-connection-destroyed.js';
import clientExternalAccountInfo from './client-external-account-info.js'; import ClientExternalAccountInfo from './client-external-account-info.js';
import sendingAuthResult from './sending-auth-result.js'; import SendingAuthResult from './sending-auth-result.js';
import loginRequest from './login-request.js'; import LoginRequest from './login-request.js';
import joinRequest from './join-request.js'; import JoinRequest from './join-request.js';
import checkPermissionResolveEosid from './check-permission-resolve-eosid.js'; import PlayerJoinSucceeded from './player-join-succeeded.js';
import CheckPermissionResolveEosid from './check-permission-resolve-eosid.js';
export default class SquadLogParser extends LogParser { export default class SquadLogParser extends LogParser {
constructor(options) { constructor(options) {
super('SquadGame.log', options); super('SquadGame.log', options);
@ -50,11 +51,12 @@ export default class SquadLogParser extends LogParser {
AddingClientConnection, AddingClientConnection,
ClientLogin, ClientLogin,
PendingConnectionDestroyed, PendingConnectionDestroyed,
clientExternalAccountInfo, ClientExternalAccountInfo,
sendingAuthResult, SendingAuthResult,
loginRequest, LoginRequest,
joinRequest, JoinRequest,
checkPermissionResolveEosid, PlayerJoinSucceeded,
CheckPermissionResolveEosid
]; ];
} }
} }

View File

@ -1,12 +1,11 @@
export default { export default {
regex: regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: Join request: .+\?Name=(.+)\?SplitscreenCount=\d$/,
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: Join request: .+\?Name=(.+)\?SplitscreenCount=\d$/,
onMatch: (args, logParser) => { onMatch: (args, logParser) => {
const data = { const data = {
raw: args[0], raw: args[0],
time: args[1], time: args[1],
chainID: +args[2], chainID: +args[2],
suffix: args[ 3 ], suffix: args[3]
}; };
logParser.eventStore.joinRequests[data.chainID] = data; logParser.eventStore.joinRequests[data.chainID] = data;

View File

@ -1,31 +1,20 @@
export default { export default {
regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: Join succeeded: (.+)/, regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquad: PostLogin: NewPlayer: BP_PlayerController_C .+PersistentLevel\.([^\s]+) \(IP: ([\d.]+) \| Online IDs: EOS: ([0-9a-f]{32}) steam: (\d+)\)/,
onMatch: (args, logParser) => { onMatch: (args, logParser) => {
const data = { const data = {
raw: args[0], raw: args[0],
time: args[1], time: args[1],
chainID: +args[2], chainID: +args[2],
playerSuffix: args[ 3 ] ip: args[4],
eosID: args[5],
steamID: args[6]
}; };
// console.log(`ChainID: ${data.chainID}`, logParser.eventStore.joinRequests[ data.chainID ]); const joinRequestData = logParser.eventStore.joinRequests[+args[2]];
const joinRequestsData = { ...logParser.eventStore.joinRequests[ data.chainID ] }; data.connection = joinRequestData.connection;
// console.log('loginRequestData', loginRequestData) data.playerSuffix = joinRequestData.suffix;
data.eosID = joinRequestsData.eosID
data.controller = joinRequestsData.controller
data.steamID = `${logParser.eventStore.connectionIdToSteamID.get(joinRequestsData.connection)}`
logParser.eventStore.connectionIdToSteamID.delete(joinRequestsData.connection)
delete logParser.eventStore.joinRequests[ +data.chainID ];
// Handle Reconnecting players
if (logParser.eventStore.disconnected[ data.steamID ]) {
delete logParser.eventStore.disconnected[ data.steamID ];
}
logParser.emit('PLAYER_CONNECTED', data); logParser.emit('PLAYER_CONNECTED', data);
// logParser.eventStore.players[ data.steamID ].suffix = data.playerSuffix
// logParser.eventStore.players[ data.steamID ].controller = data.controller
} }
}; };

View File

@ -1,6 +1,6 @@
export default { export default {
regex: regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquad: Player:(.+) ActualDamage=([0-9.]+) from (.+) caused by ([A-z_0-9-]+)_C/, /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquad: Player:(.+) ActualDamage=([0-9.]+) from (.+) \(Online IDs: EOS: ([0-9a-f]{32}) steam: (\d{17}) \| Player Controller ID: ([^ ]+)\)caused by ([A-z_0-9-]+)_C/,
onMatch: (args, logParser) => { onMatch: (args, logParser) => {
const data = { const data = {
raw: args[0], raw: args[0],
@ -9,7 +9,10 @@ export default {
victimName: args[3], victimName: args[3],
damage: parseFloat(args[4]), damage: parseFloat(args[4]),
attackerName: args[5], attackerName: args[5],
weapon: args[6] attackerEOSID: args[6],
attackerSteamID: args[7],
attackerController: args[8],
weapon: args[9]
}; };
logParser.eventStore.session[args[3]] = data; logParser.eventStore.session[args[3]] = data;

View File

@ -1,6 +1,6 @@
export default { export default {
regex: regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQSoldier::)?Die\(\): Player:(.+) KillingDamage=(?:-)*([0-9.]+) from ([A-z_0-9]+) caused by ([A-z_0-9-]+)_C/, /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQSoldier::)?Die\(\): Player:(.+) KillingDamage=(?:-)*([0-9.]+) from ([A-z_0-9]+) \(Online IDs: EOS: ([\w\d]{32}) steam: (\d{17}) \| Contoller ID: ([\w\d]+)\) caused by ([A-z_0-9-]+)_C/,
onMatch: (args, logParser) => { onMatch: (args, logParser) => {
const data = { const data = {
...logParser.eventStore.session[args[3]], ...logParser.eventStore.session[args[3]],
@ -11,11 +11,15 @@ export default {
victimName: args[3], victimName: args[3],
damage: parseFloat(args[4]), damage: parseFloat(args[4]),
attackerPlayerController: args[5], attackerPlayerController: args[5],
weapon: args[6] attackerEOSID: args[6],
attackerSteamID: args[7],
weapon: args[9]
}; };
logParser.eventStore.session[args[3]] = data; logParser.eventStore.session[args[3]] = data;
console.log('Die', data);
logParser.emit('PLAYER_DIED', data); logParser.emit('PLAYER_DIED', data);
} }
}; };

View File

@ -1,16 +1,18 @@
export default { export default {
regex: regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: UChannel::Close: Sending CloseBunch\. ChIndex == [0-9]+\. Name: \[UChannel\] ChIndex: [0-9]+, Closing: [0-9]+ \[UNetConnection\] RemoteAddr: ([0-9a-f]{32}):[0-9]+, Name: SteamNetConnection_[0-9]+, Driver: GameNetDriver SteamNetDriver_[0-9]+, IsServer: YES, PC: ([^ ]+PlayerController_C_[0-9]+), Owner: [^ ]+PlayerController_C_[0-9]+/, /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: UChannel::Close: Sending CloseBunch\. ChIndex == [0-9]+\. Name: \[UChannel\] ChIndex: [0-9]+, Closing: [0-9]+ \[UNetConnection\] RemoteAddr: ([\d.]+):[\d]+, Name: EOSIpNetConnection_[0-9]+, Driver: GameNetDriver EOSNetDriver_[0-9]+, IsServer: YES, PC: ([^ ]+PlayerController_C_[0-9]+), Owner: [^ ]+PlayerController_C_[0-9]+, UniqueId: RedpointEOS:([\d\w]+)/,
onMatch: (args, logParser) => { onMatch: (args, logParser) => {
const data = { const data = {
raw: args[0], raw: args[0],
time: args[1], time: args[1],
chainID: args[2], chainID: args[2],
steamID: args[3], ip: args[3],
playerController: args[4] playerController: args[4],
playerEOSID: args[5]
}; };
logParser.eventStore.disconnected[data.steamID] = true; logParser.eventStore.disconnected[data.steamID] = true;
logParser.emit('PLAYER_DISCONNECTED', data); logParser.emit('PLAYER_DISCONNECTED', data);
} }
}; };

View File

@ -0,0 +1,28 @@
export default {
regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: Join succeeded: (.+)/,
onMatch: (args, logParser) => {
const data = {
raw: args[0],
time: args[1],
chainID: +args[2],
playerSuffix: args[3]
};
const joinRequestsData = { ...logParser.eventStore.joinRequests[data.chainID] };
data.eosID = joinRequestsData.eosID;
data.controller = joinRequestsData.controller;
data.steamID = `${logParser.eventStore.connectionIdToSteamID.get(joinRequestsData.connection)}`;
logParser.eventStore.connectionIdToSteamID.delete(joinRequestsData.connection);
delete logParser.eventStore.joinRequests[+data.chainID];
// Handle Reconnecting players
if (logParser.eventStore.disconnected[data.steamID]) {
delete logParser.eventStore.disconnected[data.steamID];
}
logParser.emit('JOIN_SUCCEEDED', data);
}
};

View File

@ -1,13 +1,15 @@
export default { export default {
regex: regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQPlayerController::)?OnPossess\(\): PC=(.+) Pawn=([A-z0-9_]+)_C/, /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQPlayerController::)?OnPossess\(\): PC=(.+) \(Online IDs: EOS: ([\w\d]{32}) steam: (\d{17})\) Pawn=([A-z0-9_]+)_C/,
onMatch: (args, logParser) => { onMatch: (args, logParser) => {
const data = { const data = {
raw: args[0], raw: args[0],
time: args[1], time: args[1],
chainID: args[2], chainID: args[2],
playerSuffix: args[3], playerSuffix: args[3],
possessClassname: args[4], playerEOSID: args[4],
playerSteamID: args[5],
possessClassname: args[6],
pawn: args[5] pawn: args[5]
}; };

View File

@ -1,6 +1,7 @@
export default { export default {
// the names are currently the wrong way around in these logs // the names are currently the wrong way around in these logs
regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquad: (.+) has revived (.+)\./, regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquad: (.+) \(Online IDs: EOS: ([0-9a-f]{32}) steam: (\d{17})\) has revived (.+) \(Online IDs: EOS: ([0-9a-f]{32}) steam: (\d{17})\)\./,
onMatch: (args, logParser) => { onMatch: (args, logParser) => {
const data = { const data = {
...logParser.eventStore.session[args[3]], ...logParser.eventStore.session[args[3]],
@ -8,7 +9,11 @@ export default {
time: args[1], time: args[1],
chainID: args[2], chainID: args[2],
reviverName: args[3], reviverName: args[3],
victimName: args[4] reviverEOSID: args[4],
reviverSteamID: args[5],
victimName: args[6],
victimEOSID: args[7],
victimSteamID: args[8]
}; };
logParser.emit('PLAYER_REVIVED', data); logParser.emit('PLAYER_REVIVED', data);

View File

@ -1,14 +1,16 @@
export default { export default {
regex: regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQPlayerController::)?OnUnPossess\(\): PC=(.+)/, /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQPlayerController::)?OnUnPossess\(\): PC=(.+) \(Online IDs: EOS: ([\w\d]{32}) steam: (\d{17})\)/,
onMatch: (args, logParser) => { onMatch: (args, logParser) => {
const data = { const data = {
raw: args[0], raw: args[0],
time: args[1], time: args[1],
chainID: args[2], chainID: args[2],
playerSuffix: args[3], playerSuffix: args[3],
playerEOSID: args[4],
playerSteamID: args[5],
switchPossess: switchPossess:
args[3] in logParser.eventStore.session && logParser.eventStore.session[args[3]] === args[2] args[4] in logParser.eventStore.session && logParser.eventStore.session[args[4]] === args[2]
}; };
delete logParser.eventStore.session[args[3]]; delete logParser.eventStore.session[args[3]];

View File

@ -1,6 +1,6 @@
export default { export default {
regex: regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQSoldier::)?Wound\(\): Player:(.+) KillingDamage=(?:-)*([0-9.]+) from ([A-z_0-9]+) caused by ([A-z_0-9-]+)_C/, /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQSoldier::)?Wound\(\): Player:(.+) KillingDamage=(?:-)*([0-9.]+) from ([A-z_0-9]+) \(Online IDs: EOS: ([\w\d]{32}) steam: (\d{17}) \| Controller ID: ([\w\d]+)\) caused by ([A-z_0-9-]+)_C/,
onMatch: (args, logParser) => { onMatch: (args, logParser) => {
const data = { const data = {
...logParser.eventStore.session[args[3]], ...logParser.eventStore.session[args[3]],
@ -10,7 +10,9 @@ export default {
victimName: args[3], victimName: args[3],
damage: parseFloat(args[4]), damage: parseFloat(args[4]),
attackerPlayerController: args[5], attackerPlayerController: args[5],
weapon: args[6] attackerEOSID: args[6],
attackerSteamID: args[7],
weapon: args[9]
}; };
logParser.eventStore.session[args[3]] = data; logParser.eventStore.session[args[3]] = data;

View File

@ -13,7 +13,7 @@ export default {
*/ */
logParser.eventStore.clients[data.connection] = data.steamID; logParser.eventStore.clients[data.connection] = data.steamID;
logParser.eventStore.connectionIdToSteamID.set(data.connection, data.steamID) logParser.eventStore.connectionIdToSteamID.set(data.connection, data.steamID);
logParser.emit('CLIENT_CONNECTED', data); logParser.emit('CLIENT_CONNECTED', data);
delete logParser.eventStore['last-connection']; delete logParser.eventStore['last-connection'];