diff --git a/src/lgsl_protocol.php b/src/lgsl_protocol.php index 015645d..07f7829 100644 --- a/src/lgsl_protocol.php +++ b/src/lgsl_protocol.php @@ -237,11 +237,6 @@ static public function lgslList($type = null) { self::DH2005 => ["Query09", "Deer Hunter 2005"], self::ECO => ["Query40", "ECO"], self::FACTORIO => ["Query42", "Factorio"], - self::HAD2 => ["Query03", "Hidden and Dangerous 2"], - self::HALFLIFE => ["Query05", "Half-Life Steam Protocol (CS 1.6, etc)"], - self::HALFLIFEWON => ["Query05", "Half-Life WON Protocol [OLD] (CS 1.5)"], - self::HALO => ["Query03", "Halo"], - self::IL2 => ["Query03", "IL-2 Sturmovik"], self::FARCRY => ["Query08", "Far Cry"], self::FEAR => ["Query09", "F.E.A.R."], self::FIVEM => ["Query35", "FiveM / RedM"], @@ -256,6 +251,11 @@ static public function lgslList($type = null) { self::GRAW => ["Query06", "Ghost Recon: Advanced Warfighter"], self::GRAW2 => ["Query09", "Ghost Recon: Advanced Warfighter 2"], self::GTAC => ["Query45", "GTA Connected"], + self::HAD2 => ["Query03", "Hidden and Dangerous 2"], + self::HALFLIFE => ["Query05", "Half-Life Steam Protocol (CS 1.6, etc)"], + self::HALFLIFEWON => ["Query05", "Half-Life WON Protocol [OLD] (CS 1.5)"], + self::HALO => ["Query03", "Halo"], + self::IL2 => ["Query03", "IL-2 Sturmovik"], self::JEDIKNIGHT2 => ["Query02", "JediKnight 2: Jedi Outcast"], self::JEDIKNIGHTJA => ["Query02", "JediKnight: Jedi Academy"], self::JC2MP => ["Query06", "Just Cause 2 Multiplayer"], @@ -1515,8 +1515,10 @@ public function process() { $buffer_s->skip(5); $this->_data['e']['hostport'] = $buffer_s->cutByteUnpack(4, "S"); $buffer_s->skip(4); - $this->_data['s']['name'] = Helper::lgslParseColor($buffer_s->cutString(1), "ut2003", true); - $this->_data['s']['map'] = Helper::lgslParseColor($buffer_s->cutString(1), "ut2003", true); + + $this->_data['o']['colored_name'] = substr(Helper::lgslParseColor($buffer_s->cutString(1), "ut2003", false), 1); + $this->_data['s']['name'] = Helper::lgslHtmlColor($this->_data['o']['colored_name'], true); + $this->_data['s']['map'] = Helper::lgslParseColor($buffer_s->cutString(1), "ut2003"); $this->_data['s']['mode'] = $buffer_s->cutString(1); $this->_data['s']['players'] = $buffer_s->cutByteUnpack(4, "S"); $this->_data['s']['playersmax'] = $buffer_s->cutByteUnpack(4, "S"); @@ -3231,7 +3233,7 @@ static function lgslHtmlColor($string, $removeColors = false) { if ((new Config())->offsetGet('remove_colors') || $removeColors) { return preg_replace('/##([0-9a-fA-F]{6})/', "", $string); } - $outputText = preg_replace_callback('/##([0-9a-fA-F]{6})([0-9a-zA-Z !@$%&-*+|\/\.]+)?/', function($matches) { + $outputText = preg_replace_callback('/##([0-9a-fA-F]{6})([0-9a-zA-Z !@$%&-*+|\/\.>]+)?/', function($matches) { $text = $matches[2] ?? ''; return "{$text}"; }, $string); @@ -3248,7 +3250,20 @@ static function lgslParseColor($string, $type, $needRemove = true) { $needRemove &= !(new Config())->offsetGet('remove_colors'); switch ($type) { case "2": return preg_replace("/\^[\x20-\x7E]/", "", $string); - case "ut2003": return preg_replace("/[^\x20-\x7E]/", "", $string); + case "ut2003": + if ($needRemove) { + return preg_replace("/\x1B([\x00-\xFF]{3})/", "", $string); + } + $outputText = preg_replace_callback('/\x1B([\x00-\xFF]{3})([0-9a-zA-Z !@$%&-*+|\/\.>]+)?/', function($matches) { + $hexColor = ""; + $numericValues = array_map('ord', str_split($matches[1])); + foreach ($numericValues as $value) { + $hexColor .= str_pad(dechex($value), 2, "0", STR_PAD_LEFT); + } + $text = $matches[2] ?? ''; + return "##{$hexColor}{$text}"; + }, $string); + return $outputText; case "doomskulltag": return preg_replace("/\\x1c./", "", $string); case "farcry": return preg_replace("/\\$\d/", "", $string); case "fivem": diff --git a/src/styles/cards_style.css b/src/styles/cards_style.css index cbf86da..f040e28 100644 --- a/src/styles/cards_style.css +++ b/src/styles/cards_style.css @@ -95,7 +95,7 @@ div[id^="servername"] { margin:auto; text-align:center; font-weight:bold; paddin #details_playerlist {margin:auto; overflow:auto; text-align:center; padding:10px} /* list */ -.contry_link { position: absolute; margin-top: -18px; margin-left: -20px; } +.contry_link { float: right; margin-top: -22px; } .contry_icon { border:none; width: 16px; height: 16px; } a.details_icon { width: 100%; height: 32px; display: inline-block; background: url(../other/magnifier.svg) no-repeat center center; background-size: contain; } .status_icon_onl, .status_icon_nrs, .status_icon_pwd { @@ -108,8 +108,8 @@ a.details_icon { width: 100%; height: 32px; display: inline-block; background: u .status_icon_onl { background-image: url(../other/icon_online.gif) !important; } .status_icon_nrs { background-image: url(../other/icon_no_response.gif) !important; } .status_icon_pwd { background-image: url(../other/icon_online_password.gif) !important; } -.status_icon_pen { width: 14px; height: 14px; background-color: gray; display: inline-block; border: 1px solid black; } -img.game_icon { width: 42px; border: 3px solid black; } +.status_icon_pen { width: 42px; height: 42px; background-color: gray; display: inline-block; border: 3px solid black; } +img.game_icon { width: 42px; height: 42px; border: 3px solid black; } a.details_icon:before { content: 'Details'; font-size: 1.3em; color: black; } a.details_icon { background: inherit !important; border: 1px solid black; border-radius: 16px; } a.details_icon:hover { opacity: 0.6; }