mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-05-10 03:51:23 +08:00
This commit is contained in:
parent
01f16201a9
commit
3b940ead08
@ -38,6 +38,9 @@ class LogAnalyzeLineData with _$LogAnalyzeLineData {
|
||||
|
||||
@riverpod
|
||||
class ToolsLogAnalyze extends _$ToolsLogAnalyze {
|
||||
|
||||
static const String unknownValue = "<Unknown>";
|
||||
|
||||
@override
|
||||
Future<List<LogAnalyzeLineData>> build(String gameInstallPath) async {
|
||||
final logFile = File("$gameInstallPath/Game.log");
|
||||
@ -315,10 +318,10 @@ class ToolsLogAnalyze extends _$ToolsLogAnalyze {
|
||||
'distance': RegExp(r'Distance:\s*([\d.]+)')
|
||||
};
|
||||
|
||||
final zone = safeExtract(patterns['zone']!, line) ?? 'Unknown';
|
||||
final zone = safeExtract(patterns['zone']!, line) ?? unknownValue;
|
||||
final playerPilot = (safeExtract(patterns['player_pilot']!, line) ?? '0') == '1';
|
||||
final hitEntity = safeExtract(patterns['hit_entity']!, line) ?? 'Unknown';
|
||||
final hitEntityVehicle = safeExtract(patterns['hit_entity_vehicle']!, line) ?? 'Unknown Vehicle';
|
||||
final hitEntity = safeExtract(patterns['hit_entity']!, line) ?? unknownValue;
|
||||
final hitEntityVehicle = safeExtract(patterns['hit_entity_vehicle']!, line) ?? unknownValue;
|
||||
final distance = double.tryParse(safeExtract(patterns['distance']!, line) ?? '') ?? 0.0;
|
||||
return LogAnalyzeLineData(
|
||||
type: "fatal_collision",
|
||||
@ -342,10 +345,10 @@ class ToolsLogAnalyze extends _$ToolsLogAnalyze {
|
||||
);
|
||||
final match = pattern.firstMatch(line);
|
||||
if (match != null) {
|
||||
final vehicleModel = match.group(1) ?? 'Unknown';
|
||||
final zone = match.group(2) ?? 'Unknown';
|
||||
final vehicleModel = match.group(1) ?? unknownValue;
|
||||
final zone = match.group(2) ?? unknownValue;
|
||||
final destructionLevel = int.tryParse(match.group(3) ?? '') ?? 0;
|
||||
final causedBy = match.group(4) ?? 'Unknown';
|
||||
final causedBy = match.group(4) ?? unknownValue;
|
||||
|
||||
final destructionLevelMap = {1: S.current.log_analyzer_soft_death, 2: S.current.log_analyzer_disintegration};
|
||||
|
||||
@ -364,7 +367,7 @@ class ToolsLogAnalyze extends _$ToolsLogAnalyze {
|
||||
vehicleModel,
|
||||
zone,
|
||||
destructionLevel.toString(),
|
||||
destructionLevelMap[destructionLevel] ?? "Unknown",
|
||||
destructionLevelMap[destructionLevel] ?? unknownValue,
|
||||
causedBy,
|
||||
),
|
||||
dateTime: _getLogLineDateTimeString(line),
|
||||
@ -382,10 +385,10 @@ class ToolsLogAnalyze extends _$ToolsLogAnalyze {
|
||||
|
||||
final match = pattern.firstMatch(line);
|
||||
if (match != null) {
|
||||
final victimId = match.group(1) ?? 'Unknown';
|
||||
final zone = match.group(2) ?? 'Unknown';
|
||||
final killerId = match.group(3) ?? 'Unknown';
|
||||
final damageType = match.group(4) ?? 'Unknown';
|
||||
final victimId = match.group(1) ?? unknownValue;
|
||||
final zone = match.group(2) ?? unknownValue;
|
||||
final killerId = match.group(3) ?? unknownValue;
|
||||
final damageType = match.group(4) ?? unknownValue;
|
||||
|
||||
if (victimId.trim() == killerId.trim()) {
|
||||
// 自杀
|
||||
@ -419,7 +422,7 @@ class ToolsLogAnalyze extends _$ToolsLogAnalyze {
|
||||
final pattern = RegExp(r"name\s+([^-]+)");
|
||||
final match = pattern.firstMatch(line);
|
||||
if (match != null) {
|
||||
final characterName = match.group(1)?.trim() ?? 'Unknown';
|
||||
final characterName = match.group(1)?.trim() ?? unknownValue;
|
||||
_playerName = characterName.trim(); // 更新玩家名称
|
||||
return LogAnalyzeLineData(
|
||||
type: "player_login",
|
||||
@ -434,8 +437,8 @@ class ToolsLogAnalyze extends _$ToolsLogAnalyze {
|
||||
final pattern = RegExp(r"Player\[([^\]]+)\].*?Location\[([^\]]+)\]");
|
||||
final match = pattern.firstMatch(line);
|
||||
if (match != null) {
|
||||
final playerId = match.group(1) ?? 'Unknown';
|
||||
final location = match.group(2) ?? 'Unknown';
|
||||
final playerId = match.group(1) ?? unknownValue;
|
||||
final location = match.group(2) ?? unknownValue;
|
||||
|
||||
return LogAnalyzeLineData(
|
||||
type: "request_location_inventory",
|
||||
|
Loading…
x
Reference in New Issue
Block a user