collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: updated Callers.php (from svn)  (Read 7053 times)

0 Members and 2 Guests are viewing this topic.

Offline Wanuarmi

  • Contributor
  • *******
  • Posts: 121
  • Karma: +0/-0
updated Callers.php (from svn)
« on: January 23, 2006, 12:59:10 am »
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: [Select]
<?
/*
* 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 23, 2006, 01:05:28 am by Wanuarmi »

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 120
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal