Files
ik-codex/src/Pattern/ProjectZomboid/PerkPattern.php
indifferentketchup 00c17261a3 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.
2026-04-30 20:38:39 +00:00

22 lines
865 B
PHP

<?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+)/';
}