<?PHP
/**
*
* $Id: wswRconBot.class.php 117 2006-09-30 07:37:15Z khaless $
* $Revision: 117 $
* $Author: khaless $
* $Date: 2006-09-30 17:37:15 +1000 (Sat, 30 Sep 2006) $
*
* Copyright (c) 2005 Mathew Rodley <hide@address.com>
*
* Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class wswRconBot
{
public $dataArray;
public $coreFuncs;
public $matchAdminSteamID;
public $pugLive;
public $halfCount;
public $roundsPlayed;
public $roundsToBePlayed;
public $countTillEnd;
public $endingProc;
public $playerCount;
public $playerInfoArray;
public $timeout;
function __construct($dataArray, $coreFuncs)
{
$this->dataArray = &$dataArray;
$this->coreFuncs = &$coreFuncs;
$this->matchAdminSteamID = NULL;
// process the team string so we can display it adhearing to rcon say length limits.
$teams = $this->dataArray['teams'];
$members = $this->dataArray['teamMembers'];
$this->teamRemindLines = array();
foreach($teams as $index => $team)
{
array_push($this->teamRemindLines, $team.':');
$lineString = '';
foreach($members[$index] as $member)
{
if(strlen($lineString . $member) > 64)
{
array_push($this->teamRemindLines, substr($lineString,0,-2));
$lineString = '';
}
$lineString .= $member .', ';
}
if($lineString != '') array_push($this->teamRemindLines, substr($lineString,0,-2));
}
}
/**
* Called once when the bot starts and is connected.
*
*/
function init() {
return;
}
function cleanUp() {
return;
}
function maintinence() {
return;
}
function stripColours($name) {
return preg_replace("/\^./", "", $name);
}
function connect($data) {
$name = $this->stripColours($data[1]);
$this->coreFuncs->sendToIRC('MSG:'.$name.' has connected');
}
function any($data) {
$this->coreFuncs->sendToIRC('MSG: UDP Recieved: "'.$data[1].'"');
}
}
?>