L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 01, 2008, 01:06:18 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Coding and development discussion > Topic: updated Callers.php (from svn)
Pages: [1]   Go Down
« previous next »
Print
Author Topic: updated Callers.php (from svn)  (Read 392 times)
0 Members and 1 Guest are viewing this topic.
Wanuarmi
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 121


updated Callers.php (from svn)
« on: January 22, 2006, 06:59:10 PM »

Made it so it work on tells (all output is thrown in privategroup), not sure if should work in gc aswell?

Added assist commands to list of callers, and a command "assist everyone"

Made "caller add <player>" be just "caller <player>"

Added "callers clear" command, same as "caller del all"

Code:
<?
/*
* Callers.php - Designate and list "Callers" for raids and events.
*
* BeBot - An Anarchy Online Chat Automaton
* Copyright (C) 2004 Jonas Jax
*
* Developed by Blondengy (RK1)
* Special thanks goes out to Khalem (RK1) for his support.
*
* File last changed at $LastChangedDate$
* Revision: $Id$
*/


$callers = new Callers($bot);


$commands["pgmsg"]["caller"] = &$callers;
$commands["pgmsg"]["callers"] = &$callers;
$commands["tell"]["caller"] = &$callers;
$commands["tell"]["callers"] = &$callers;




/*
The Class itself...
*/
class Callers
{
var $bot;
var $callers;



/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function Callers (&$bot)
{
$this -> bot = &$bot;
$this -> callers = array();
}



/*
This gets called on a tell with the command
*/
function tell($name, $msg)
{
process_command($name, $msg);
}



/*
This gets called on a msg in the privgroup with the command
*/
function pgmsg($name, $msg)
{
process_command($name, $msg);
}



function process_command($name, $msg)
{
if ($this -> bot -> is_member($name))
{
if (preg_match("/^" . $this -> bot -> commpre . "callers/i", $msg))
$this -> bot -> send_pgroup($this -> show_callers());
else if (preg_match("/^" . $this -> bot -> commpre . "caller (.+)/i", $msg, $info))
$this -> caller_add($info[1]);
else if (preg_match("/^" . $this -> bot -> commpre . "caller del all/i", $msg))
$this -> clear_callers();
else if (preg_match("/^" . $this -> bot -> commpre . "callers clear/i", $msg))
$this -> clear_callers();
else if (preg_match("/^" . $this -> bot -> commpre . "caller del (.+)/i", $msg, $info))
$this -> caller_del($info[1]);
}
else
$this -> bot -> send_pgroup("You must be a member to use this command.");
}



/*
Add a caller
*/
function caller_add($name)
{
$name = ucfirst(strtolower($name));

if ($this -> bot -> aoc -> get_uid($name))
{
$this -> callers[$name] = 1;
$this -> bot -> send_pgroup("<font color=#ffff00>" . $name . "</font> has been added to caller list. " . $this -> show_callers());
}
else
$this -> bot -> send_pgroup("Player <font color=#ffff00>" . $name . "</font> does not exist.");
}



/*
Remove a caller
*/
function caller_del($name)
{
$name = ucfirst(strtolower($name));

if ($this -> bot -> aoc -> get_uid($name) != -1)
{
if (isset($this -> callers[$name]))
{
unset($this -> callers[$name]);
$this -> bot -> send_pgroup("<font color=#ffff00>" . $name . "</font> has been removed from caller list. " . $this -> show_callers());
}
else
$this -> bot -> send_pgroup("<font color=#ffff00>" . $name . "</font> is not on list of callers. " . $this -> show_callers());
}
else
$this -> bot -> send_pgroup("Player <font color=#ffff00>" . $name . "</font> does not exist.");
}



/*
Clear list of callers
*/
function clear_callers()
{
$this -> callers = array();
$this -> bot -> send_pgroup("List of callers has been cleared.");
}



/*
Return the list of callers
*/
function show_callers()
{
$call = array_keys($this -> callers);
if (empty($call))
return "No callers on list.";
else
{
$list = "<font color=CCInfoHeadline>::: List of callers :::</font>\n\n";
$list .= "Macros:";
foreach ($call as $player)
$list .= " - <a href='chatcmd:///macro $player /assist $player'>$player</a>\n";
$list .= "Commands:";
foreach ($call as $player)
$list .= " - <a href='chatcmd:///assist $player'>$player</a>\n";
$list .= "\n<a href='chatcmd:///assist" . implode('\n /assist ', $call) . "'>Assist everyone</a>"
return "List of Callers :: " . $this -> bot -> make_blob("click to view", $list);
}
}
}
?>
« Last Edit: January 22, 2006, 07:05:28 PM by Wanuarmi » Logged
Pages: [1]   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Coding and development discussion > Topic: updated Callers.php (from svn)
« previous next »
 
Jump to:  

Recent
[request] Raid timers
by Alreadythere
[Today at 11:42:32 AM]

Shared DB online list
by Temar
[Today at 01:55:47 AM]

relay colors
by Temar
[Today at 01:54:56 AM]

BeBot v0.6.0 released
by Alreadythere
[November 30, 2008, 05:32:00 PM]

Change to Bid.php
by Temar
[November 30, 2008, 11:41:44 AM]

OnlineOrg
by Jiheld
[November 29, 2008, 12:44:27 PM]

Silly Newbie Question.
by Temar
[November 29, 2008, 12:00:02 PM]

massive_pvp_time_table 1
by gerborg
[November 29, 2008, 06:55:35 AM]

Bot not see Guild Chat
by Delvar
[November 28, 2008, 08:30:34 AM]

Starting Bot
by Allisande
[November 28, 2008, 07:08:21 AM]
Stats
Members
Total Members: 1243
Latest: Whackoeng
Stats
Total Posts: 11143
Total Topics: 1505
Online Today: 21
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 2
Guests: 10
Total: 12
egrath
Temar

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.72 seconds with 28 queries. (Pretty URLs adds 0.023s, 4q)
Loading...