1. GSManager
    1. Funktionen
    2. Unterstützte Spiele
    3. Neuigkeiten
    4. Statistiken
    5. Serverliste
  2. Lexikon
  3. Filebase
  4. Entwicklung
  5. Forum
    1. Dashboard
    2. Unerledigte Themen
  6. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Dateien
  • Forum
  • Lexikon
  • Erweiterte Suche
  1. GSManager
  2. Mitglieder
  3. Bunni

Beiträge von Bunni

Das Projekt GSManager (vormals ManuAdminMod) wurde am 01.01.2020 eingestellt - diese Internetpräsenz bleibt verfügbar, die Software wird aber nicht länger gepflegt. Vielen Dank für eure Unterstützung in den mehr als zehn vergangenen Jahren!
  • Issues with 1.3 patch

    • Bunni
    • 5. März 2009 um 06:35

    tyty!


    yup works for windows and linux!

  • Issues with 1.3 patch

    • Bunni
    • 5. März 2009 um 06:29

    fix for the parser:

    PHP
    <?php
    
    
    
    
    class parser {
    	private $logfile = false;
    	private $parsedloglines = 0;
    	private $logpos = 0;
    	private $lastparsed = "0000000000";
    
    
    
    
    	public function __construct($logfile, &$success) {
    		if (!is_readable($logfile)) {
    			$success = false;
    			return;
    		}
    		$this->logfile = $logfile;
    		$this->logpos = filesize($this->logfile);
    
    
    
    
    		$succes = true;
    	}
    
    
    
    
    	public function getNewLines() {
    		$fp = fopen($this->logfile, "r");
    		fseek($fp, $this->logpos, SEEK_SET);
    
    
    
    
    		$newlines = array();
    
    
    
    
    		while (!feof($fp)) {
    			$get = fgets($fp);
    			if ($get === false) {
    				break;
    			}
    			$this->logpos += strlen($get);
    			$newlines[] = $get;
    		}
    
    
    
    
    		fclose($fp);
    
    
    
    
    		return $newlines;
    
    
    
    
    	}
    
    
    
    
    	public function parseLine($line) {
    		$pattern = '|^\s*(\d{10}) |';
    		if (preg_match($pattern, $line, $subpatterns) == 0) {
    			return false;
    		}
    
    
    
    
        	$lasttime = (int) $this->lastparsed;
        	$thistime = (int) $subpatterns[1];
    
        	if ($lasttime > $thistime) {
            	$restart = true;
        	}
        	else {
            	$restart = false;
        	}
    
    
    
    
    		$this->lastparsed = $subpatterns[1];
    		$this->parsedloglines ++;
    
    
    
    
    		$line = trim(str_replace($subpatterns[0], "", $line));
    		$action = $this->getAction($line);
    
    
    
    
    		return array(
    			"timestamp" => $this->lastparsed,
    			"line" => $line,
    			"action" => $action,
    			"parsed" => $this->parseParts($line, $action),
    			"serverrestart" => $restart,
    		);
    	}
    
    
    
    
    	private function getAction($line) {
    		$actions = array(
    			"damage" => "D;",
    			"vehicledamage" => "VD;",
    			"actordamage" => "AD;",
    			"kill" => "K;",
    			"join" => "J;",
    			"quit" => "Q;",
    			"say" => "say;",
    			"sayteam" => "sayteam;",
    			"weapon" => "Weapon;",
    			"nextmap" => "InitGame:",
    			"exitmap" => "ShutdownGame:",
    			"mapend" => "ExitLevel: executed"
    		);
    		foreach ($actions as $key => $value) {
    			if (strpos($line, $value) === 0) {
    				return $key;
    			}
    		}
    		return "unknown";
    	}
    
    
    
    
    	private function parseParts($line, $action) {
    		switch ($action) {
    			case "damage":
    			case "weapon":
    			case "kill":
    			case "join":
    			case "quit":
    			case "vehicledamage":
    			case "actordamage":
    				$parts = explode(";", $line);
    				array_shift($parts);
    				return $parts;
    
    
    
    
    			case "say":
    			case "sayteam";
    				$parts = explode(";", $line, 5);
    				array_shift($parts);
    				if ($parts[3]{0} == chr(21)) {
    					$parts[3] = substr($parts[3], 1);
    				}
    				return $parts;
    
    
    
    
    			case "mapend":
    			case "exitmap":
    				return false;
    
    
    
    
    			case "nextmap":
    				$explode = explode("\\", $line);
    				$parts = array();
    				for($i = 1; $i < count($explode); $i += 2) {
    					$parts[$explode[$i]] = $explode[$i + 1];
    				}
    				return $parts;
    
    
    
    
    			default:
    				return false;
    		}
    	}
    
    
    
    
    	public function getLastParsedTimeStamp() {
    		return $this->lastparsed;
    	}
    }
    Alles anzeigen

    testing to make sure this works on windows...

  1. Mitarbeiter
  2. Datenschutzerklärung
  3. Nutzungsbedingungen
  4. Impressum
  5. Kontakt
Community-Software: WoltLab Suite™