fix: username

This commit is contained in:
xkeyC 2025-12-17 22:28:12 +08:00
parent 750f3b1fee
commit dc163d790c

View File

@ -259,8 +259,7 @@ class _SessionInfo {
///
class YearlyReportAnalyzer {
//
static final _characterNamePattern = RegExp(r'name\s+(\w+)\s+signedIn');
static final _characterNamePattern = RegExp(r'name\s+([^-]+)');
static final _vehicleDestructionPattern = RegExp(
r"Vehicle\s+'([^']+)'.*?" //
r"in zone\s+'([^']+)'.*?" // Zone
@ -274,7 +273,6 @@ class YearlyReportAnalyzer {
);
// Legacy ()
static final _legacyCharacterNamePattern = RegExp(r"name\s+([^-]+)");
static final _legacyActorDeathPattern = RegExp(
r"CActor::Kill: '([^']+)'.*?" // ID
r"in zone '([^']+)'.*?" //
@ -315,23 +313,24 @@ class YearlyReportAnalyzer {
stats.hasCrash = true;
}
// ()
var nameMatch = _characterNamePattern.firstMatch(line);
nameMatch ??= _legacyCharacterNamePattern.firstMatch(line);
if (nameMatch != null) {
final playerName = nameMatch.group(1)?.trim();
if (playerName != null &&
playerName.isNotEmpty &&
!playerName.contains(' ') &&
!playerName.contains('/') &&
!playerName.contains(r'\') &&
!playerName.contains('.')) {
stats.currentPlayerName = playerName;
// ()
if (!stats.playerNames.any((n) => n.toLowerCase() == playerName.toLowerCase())) {
stats.playerNames.add(playerName);
//
if (line.contains('AccountLoginCharacterStatus_Character')) {
final nameMatch = _characterNamePattern.firstMatch(line);
if (nameMatch != null) {
final playerName = nameMatch.group(1)?.trim();
if (playerName != null &&
playerName.isNotEmpty &&
!playerName.contains(' ') &&
!playerName.contains('/') &&
!playerName.contains(r'\\') &&
!playerName.contains('.')) {
stats.currentPlayerName = playerName;
// ()
if (!stats.playerNames.any((n) => n.toLowerCase() == playerName.toLowerCase())) {
stats.playerNames.add(playerName);
}
stats.firstPlayerName ??= playerName;
}
stats.firstPlayerName ??= playerName;
}
}
@ -358,7 +357,10 @@ class YearlyReportAnalyzer {
final vehicleName = controlMatch.group(1);
if (vehicleName != null) {
final cleanVehicleName = GameLogAnalyzer.removeVehicleId(vehicleName);
stats.vehiclePiloted[cleanVehicleName] = (stats.vehiclePiloted[cleanVehicleName] ?? 0) + 1;
// "Default"
if (cleanVehicleName != 'Default') {
stats.vehiclePiloted[cleanVehicleName] = (stats.vehiclePiloted[cleanVehicleName] ?? 0) + 1;
}
}
}