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