Add AdminAddedItemInformation insight
This commit is contained in:
26
src/Analysis/ProjectZomboid/AdminAddedItemInformation.php
Normal file
26
src/Analysis/ProjectZomboid/AdminAddedItemInformation.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace IndifferentKetchup\Codex\Analysis\ProjectZomboid;
|
||||
|
||||
use IndifferentKetchup\Codex\Analysis\Information;
|
||||
use IndifferentKetchup\Codex\Analysis\PatternInsightInterface;
|
||||
use IndifferentKetchup\Codex\Pattern\ProjectZomboid\AdminPattern;
|
||||
|
||||
class AdminAddedItemInformation extends Information implements PatternInsightInterface
|
||||
{
|
||||
public static function getPatterns(): array
|
||||
{
|
||||
return [AdminPattern::ADDED_ITEM_ENTRY];
|
||||
}
|
||||
|
||||
public function setMatches(array $matches, mixed $patternKey): void
|
||||
{
|
||||
$this->setLabel('Admin added item');
|
||||
$this->setValue(sprintf(
|
||||
'%s added %s to %s',
|
||||
$matches['admin'],
|
||||
$matches['item'],
|
||||
$matches['target']
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -25,4 +25,12 @@ class AdminPattern
|
||||
public const string RELOADED_OPTIONS = '/^(?<admin>.+?) reloaded options$/';
|
||||
|
||||
public const string TELEPORTED = '/^(?<admin>.+?) teleported (?<target>.+?) to (?<x>\d+),(?<y>\d+),(?<z>-?\d+)$/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry-anchored variants for analyser use. PatternAnalyser passes the
|
||||
* full Entry text (including the [time] prefix) to preg_match_all, so
|
||||
* these include the timestamp prefix and are anchored at start/end of
|
||||
* the line. The body-only constants above are kept for direct-message
|
||||
* matching.
|
||||
*/
|
||||
public const string ADDED_ITEM_ENTRY = '/^\[\d{2}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}\] (?<admin>.+?) added item (?<item>Base\.\S+) in (?<target>.+?)\'s inventory\.?$/';
|
||||
|
||||
Reference in New Issue
Block a user