OpenGSQ PHP

KillingFloor extends Unreal2
in package

Class KillingFloor

This class provides methods to interact with the Killing Floor Protocol.

Table of Contents

Constants

DETAILS  = 0x0
Represents the byte value for details.
PLAYERS  = 0x2
Represents the byte value for players.
RULES  = 0x1
Represents the byte value for rules.

Properties

$fullname  : string
$host  : string
$port  : int
$timeout  : int

Methods

__construct()  : mixed
Constructs an KillingFloor instance.
getDetails()  : Status
Retrieves the server details.
getPlayers()  : array<string|int, Player>
Retrieves the server players.
getRules()  : Rules
Retrieves the server rules.
stripColor()  : string
Strips color codes from the input text.
getIPAddress()  : string
Gets the Internet Protocol (IP) endpoint.
readNullString()  : string
Reads a null-padded string from the binary data string.
readUInt16()  : int
Reads an unsigned 16-bit integer from the binary data string.
readUInt32()  : int
Reads an unsigned 32-bit integer from the binary data string.
readUnreal2String()  : string
Reads a string from a BinaryReader, decodes it, and optionally strips color codes.

Constants

DETAILS

Represents the byte value for details.

protected mixed DETAILS = 0x0

PLAYERS

Represents the byte value for players.

protected mixed PLAYERS = 0x2

RULES

Represents the byte value for rules.

protected mixed RULES = 0x1

Properties

$fullname

public string $fullname = "Killing Floor Protocol"

The full name of the protocol.

$timeout

public int $timeout

The timeout for the connection in seconds.

Methods

__construct()

Constructs an KillingFloor instance.

public __construct(string $host, int $port[, int $timeout = 5 ]) : mixed
Parameters
$host : string

The IP address or hostname of the server.

$port : int

The port number of the server.

$timeout : int = 5

The timeout duration (in seconds) for server communication.

getDetails()

Retrieves the server details.

public getDetails([bool $stripColor = true ]) : Status
Parameters
$stripColor : bool = true

Determines whether to remove color codes from the server details.

Return values
Status —

The details of the server.

getPlayers()

Retrieves the server players.

public getPlayers([bool $stripColor = true ]) : array<string|int, Player>
Parameters
$stripColor : bool = true

Determines whether to remove color codes from the players.

Tags
throws
Exception

If the received packet header is invalid.

Return values
array<string|int, Player> —

An array of Player objects representing the server players.

getRules()

Retrieves the server rules.

public getRules([bool $stripColor = true ]) : Rules
Parameters
$stripColor : bool = true

Determines whether to remove color codes from the server rules.

Tags
throws
Exception

If the received packet header is invalid.

Return values
Rules —

An object containing the server rules.

stripColor()

Strips color codes from the input text.

public static stripColor(string $text) : string
Parameters
$text : string

The input text potentially containing color codes.

Return values
string —

The input text with color codes removed.

getIPAddress()

Gets the Internet Protocol (IP) endpoint.

protected getIPAddress() : string
Return values
string —

The IP address of the host.

readNullString()

Reads a null-padded string from the binary data string.

protected readNullString(string &$data) : string
Parameters
$data : string

The binary data string. This parameter is passed by reference, and the function will modify it by removing the read bytes.

Return values
string —

The null-padded string read from the binary data string.

readUInt16()

Reads an unsigned 16-bit integer from the binary data string.

protected readUInt16(string &$data) : int
Parameters
$data : string

The binary data string. This parameter is passed by reference, and the function will modify it by removing the read bytes.

Return values
int —

The unsigned 16-bit integer read from the binary data string.

readUInt32()

Reads an unsigned 32-bit integer from the binary data string.

protected readUInt32(string &$data) : int
Parameters
$data : string

The binary data string. This parameter is passed by reference, and the function will modify it by removing the read bytes.

Return values
int —

The unsigned 32-bit integer read from the binary data string.

readUnreal2String()

Reads a string from a BinaryReader, decodes it, and optionally strips color codes.

protected readUnreal2String(string &$response, bool $stripColor[, bool $pascal = true ]) : string
Parameters
$response : string

The response from the BinaryReader.

$stripColor : bool

Determines whether to remove color codes from the response.

$pascal : bool = true
Return values
string —

The decoded string. If $stripColor is true, the returned string will have color codes removed.


        
On this page

Search results