From 72008300a934a6998951d89ceaf5e4bb10ea62e2 Mon Sep 17 00:00:00 2001 From: GodMod Date: Sun, 13 Jan 2019 09:08:16 +0100 Subject: [PATCH] Added another format --- includes/parser/everquest_who.parser.class.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/includes/parser/everquest_who.parser.class.php b/includes/parser/everquest_who.parser.class.php index d0bc11d..8cb3b7c 100644 --- a/includes/parser/everquest_who.parser.class.php +++ b/includes/parser/everquest_who.parser.class.php @@ -39,6 +39,7 @@ public static function check($text) { } public static function parse($text) { + //[Fri Nov 02 23:00:00 2018] [52 Heretic] Zibaxia $regex = '~\[(ANONYMOUS|(?[0-9]{1,3})\h(?\w*))\]\h(?\w*)~'; preg_match_all($regex, $text, $matches, PREG_SET_ORDER); foreach($matches as $match) { @@ -49,9 +50,22 @@ public static function parse($text) { $data['times'][] = array(trim($match['name']), time(), 'leave'); } - + //[Fri Nov 02 23:00:00 2018] [52 Heretic (Someclass)] Zibaxia (Iksar) $regex = '~((\[ANONYMOUS\])|((\[(?[0-9]{1,3})\h(?\w*\s?\w*)\h\((?<class>.*)\)\])))\h(?<name>\w*)\h*((\((?<race>.*)\))*\h*(<(?<guild>.*)>)*)*~'; preg_match_all($regex, $text, $matches, PREG_SET_ORDER); + + foreach($matches as $match) { + $lvl = (isset($match['lvl']) && $match['lvl'] != "") ? trim($match['lvl']) : 0; + $class = (isset($match['class']) && $match['class'] != "") ? trim($match['class']) : ''; + $data['members'][] = array(trim($match['name']), $class, '', $lvl); + $data['times'][] = array(trim($match['name']), time() - (2*3600), 'join'); + $data['times'][] = array(trim($match['name']), time(), 'leave'); + } + + //[Fri Nov 02 23:00:00 2018] [52 Heretic] Zibaxia (Iksar) <The Fallen Ones> + $regex = '~((\[ANONYMOUS\])|((\[(?<lvl>[0-9]{1,3})\h(?<title>\w*\s?\w*)\])))\h(?<name>\w*)\h*((\((?<race>.*)\))*\h*(<(?<guild>.*)>)*)*~'; + preg_match_all($regex, $text, $matches, PREG_SET_ORDER); + foreach($matches as $match) { $lvl = (isset($match['lvl']) && $match['lvl'] != "") ? trim($match['lvl']) : 0; $class = (isset($match['class']) && $match['class'] != "") ? trim($match['class']) : '';