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