Add ProjectZomboidPvpLog (pvp.txt)

Two row variants share the file: Safe House toggles ([LOG] Safety:)
and Combat events ([INFO] Combat: ... weapon=... damage=...). Parser
captures time, level, and the subsystem token (Safety|Combat) as the
entry prefix. COMBAT and SAFETY regexes extract structured fields,
including support for negative Z coordinates from basement levels.
Synthetic fixture covers both variants and represents zombie/vehicle/
real-PvP weapon types so analysers can later filter on damage>0 and
weapon!=zombie.
This commit is contained in:
2026-04-30 20:40:03 +00:00
parent 00c17261a3
commit af05c97dfc
4 changed files with 153 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
<?php
namespace IndifferentKetchup\Codex\Log\ProjectZomboid;
use IndifferentKetchup\Codex\Analyser\AnalyserInterface;
use IndifferentKetchup\Codex\Analyser\PatternAnalyser;
use IndifferentKetchup\Codex\Detective\FilenameDetector;
use IndifferentKetchup\Codex\Detective\WeightedSinglePatternDetector;
use IndifferentKetchup\Codex\Parser\ParserInterface;
use IndifferentKetchup\Codex\Parser\PatternParser;
use IndifferentKetchup\Codex\Pattern\ProjectZomboid\PvpPattern;
class ProjectZomboidPvpLog extends ProjectZomboidEventLog
{
public static function getDefaultParser(): ParserInterface
{
return static::makePatternParser(
PvpPattern::LINE,
[PatternParser::TIME, PatternParser::LEVEL, PatternParser::PREFIX]
);
}
public static function getDefaultAnalyser(): AnalyserInterface
{
return new PatternAnalyser();
}
public static function getDetectors(): array
{
return [
(new FilenameDetector())
->setPattern('/_pvp\.txt$/')
->setWeight(0.95),
(new WeightedSinglePatternDetector())
->setPattern('/^\[[^\]]+\]\[\w+\] Combat: "[^"]+" \(/m')
->setWeight(0.95),
(new WeightedSinglePatternDetector())
->setPattern('/^\[[^\]]+\]\[\w+\] Safety: "/m')
->setWeight(0.85),
];
}
public function getTitle(): string
{
return "Project Zomboid PvP Log";
}
}