thunderbug / tracker-quake-connection

一个从quake主服务器和游戏服务器检索信息的库

v1.0.2 2021-01-27 11:56 UTC

This package is auto-updated.

Last update: 2024-09-27 19:39:35 UTC


README

Build Status Scrutinizer Code Quality Total Downloads Version

一个用于与使命召唤、 Wolfenstein 等 master 服务器和游戏服务器交互的库。

用法

主服务器

主类处理与特定游戏主服务器的连接。目前主服务器功能中只有一个功能,即检索当前在线的所有游戏服务器的完整列表。

$master = new \Thunderbug\QuakeConnection\Master\Master("master.game.com", 28910);
$servers = $master->getServerList();

返回包含服务器对象的数组。

游戏服务器

游戏服务器类处理与单个游戏服务器的连接。

$gameserver = new \Thunderbug\QuakeConnection\Server\Gameserver("192.168.1.100", 28960);
$gameserver->getStatus($cvars, $players);

您还可以在执行 getstatus 命令后检索数组。

$cvars = $gameserver->getCvars();
$players = $gameserver->getPlayers();

颜色也由该库处理。

print(\Thunderbug\QuakeConnection\Server\Colors::colorize("^5Thun^6der", ColorType::DARK)); 
//Prints html <span> with color codes
//Depending on the color of the site the color type can be light or dark
print(\Thunderbug\QuakeConnection\Server\Colors::removeColors("^5Thun^6der")); 
//Removes all color codes

安装

您可以通过 composer 下载此库。

composer require thunderbug/tracker-quake-connection