mirror of
https://github.com/StarCitizenToolBox/app.git
synced 2026-01-13 19:50:28 +00:00
fix: username
This commit is contained in:
parent
750f3b1fee
commit
dc163d790c
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user