thunderbug/tracker-quake-connection

A library to retrieve information from quake master servers and game servers

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

This package is auto-updated.

Last update: 2024-04-27 18:52:18 UTC


README

Build Status Scrutinizer Code Quality Total Downloads Version

A library to interact with a call of duty, wolfenstein, ... master server and the game servers.

Usage

Master

The Master class handles the connection with the master server of a certain game. At this moment there is only 1 function within the master server function and this is retrieving a full list of gameservers currently online.

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

The returns a array with Server objects.

Gameserver

The gameserver class handles the connection to an individual gameserver.

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

Also you can still retrieve the arrays after doing the getstatus command.

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

Colors are also handled by this library.

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

Installation

You can download the library via composer:

composer require thunderbug/tracker-quake-connection