Add ProjectZomboidPerkLog (PerkLog.txt)
Per-line skill snapshot log; each Login event is paired with a perks row containing comma-separated Skill=N tokens. PERK_PAIR regex extracts each pair via preg_match_all for analyser use. Detectors: filename match plus content signature on the unique '[Cooking=N, Fitness=N, Strength=N,' prefix of the perks-row bracket.
This commit is contained in:
21
src/Pattern/ProjectZomboid/PerkPattern.php
Normal file
21
src/Pattern/ProjectZomboid/PerkPattern.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace IndifferentKetchup\Codex\Pattern\ProjectZomboid;
|
||||
|
||||
/**
|
||||
* Regex constants for the Project Zomboid PerkLog.txt format.
|
||||
*
|
||||
* [time] [steamid][player][x,y,z][event-or-perks][Hours Survived: N].
|
||||
*
|
||||
* The fourth bracketed field is either a single token (Login, Logout,
|
||||
* LevelUp, etc.) or a comma-separated list of Skill=N pairs. Both fit
|
||||
* the same character class.
|
||||
*/
|
||||
class PerkPattern
|
||||
{
|
||||
public const string LINE = '/^\[(\d{2}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3})\] \[\d{17}\]\[[^\]]+\]\[\d+,\d+,\d+\]\[[^\]]+\]\[Hours Survived: \d+\]\.$/';
|
||||
|
||||
public const string FIELDS = '/^\[\d{2}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}\] \[(?<steamid>\d{17})\]\[(?<player>[^\]]+)\]\[(?<x>\d+),(?<y>\d+),(?<z>\d+)\]\[(?<event>[^\]]+)\]\[Hours Survived: (?<hours>\d+)\]\.$/';
|
||||
|
||||
public const string PERK_PAIR = '/(?<skill>[A-Za-z_]+)=(?<level>\d+)/';
|
||||
}
|
||||
Reference in New Issue
Block a user