BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => BeBot 0.2 support => Topic started by: bmoscato on January 30, 2007, 09:52:19 pm
-
I'm currently using JJ's Logon_Guild.php. When I member logs on I see:
[Exodus] Exobot2: "Kattemp" (Lvl 56 Meta-Physicist Applicant) logged on.
I would like to add the AI level and to this to look something like:
[Exodus] Exobot2: "Kattemp" (Level 56/0 - None, Female Solitus Meta-Physicist, Applicant of Exodus) logged on.
Has anyone done this?
-
Yes, I have.
The code below will not work unless your member table has the same fields as the one I have listed.
For this code I pull out of table members:
nickname, firstname, lastname, level, profession, rank_name, ailevel, aititle
Check your roster or whatever php file creates and modifies your member table to make sure it has the ai fields. It should but check anyways.
This code also changes the default color of the login logoff messages and sends to both GC and pgroup. (our pgroup is our guest channel and thus they should see everything that goes on in gc. You can edit this out if you want.)
/*
This gets called if a buddy logs on/off
*/
function buddy($name, $msg)
{
if ($this -> start < time())
{
if ($this -> bot -> is_member($name) == 1)
{
$id = $this -> bot -> aoc -> get_uid($name);
if ($msg == 1)
{
if ($this -> last_log["on"][$name] < (time() - 5))
{
$result = $this -> bot -> db -> select("SELECT nickname, firstname, lastname, level, profession, rank_name, ailevel, aititle FROM members WHERE id = " . $id);
$res = "\"" . $name . "\"";
if (!empty($result[0][1]))
$res = $result[0][1] . " " . $res;
if (!empty($result[0][2]))
$res .= " " . $result[0][2];
$res .= " (Lvl " . $result[0][3] . " / " . $result[0][6] . " (" . $result[0][7] . ") " . $result[0][4] . " " . $result[0][5] . ") logged on.";
$main = $this -> bot -> alts -> main($name);
$alts = $this -> bot -> alts -> get_alts($main);
if (!empty($alts))
{
$altsresult = " ";
$altsresult .= $this -> bot -> alts -> make_alt_blob($main, $alts);
}
else
$altsresult = "";
$res .= $altsresult;
$result = $this -> bot -> db -> select("SELECT message FROM logon WHERE id = " . $id);
if (!empty($result))
$res .= " :: " . $result[0][0];
$this -> bot -> send_gc("<font color=#66FFFF>" . $res . "</font>");
$this -> bot -> send_pgroup("<font color=#66FFFF>" . $res . "</font>");
if ($this -> bot -> guild_relay_target)
{
$tell = "<pre>gcr [" . $this -> bot -> guildname . "] <font color=#66FFFF>" . $res . "</font>";
$target = strtolower($this -> bot -> guild_relay_target);
$this -> bot -> send_tell($target, $tell, 0, false);
}
$this -> last_log["on"][$name] = time();
}
}
else
{
if ($this -> last_log["off"][$name] < (time() - 5))
{
$this -> bot -> send_gc("<font color=#66FFFF>" . $name . " logged off</font>");
$this -> bot -> send_pgroup("<font color=#66FFFF>" . $name . " logged off</font>");
$this -> last_log["off"][$name] = time();
if ($this -> bot -> guild_relay_target)
{
$tell = "<pre>gcr [" . $this -> bot -> guildname . "] " . $this -> bot -> botname . ": <font color=#66FFFF>" . $name . " logged off</font>";
$target = strtolower($this -> bot -> guild_relay_target);
$this -> bot -> send_tell($target, $tell, 0, false);
}
}
}
}
}
}
-
Hey Nebhyper, thanks that worked.
Is there a way to use multiple colors? Like make the AI level appear green instead of blue.
-
Hmm, this is most strange. Here's the output from my logon_guild module (this has changed alts and blacklist settings from the standard bebot module)...
-jj-
Uprnet: Gimmeh "Litespeeeed" Now (Lvl 217 / 13 (Adept) Fixer Member) logged on. View Lilshooter's Alts :: You hit Culuth-Len for 6153 points of Burst damage.
-
With the code above I get this when I logon:
Ivana "Siocuffin" Urhans (Lvl 210 / 18 (Trustworthy) Agent Squad Commander) logged on. View Siocuffin's Alts :: Muhandes: You might want to be more careful with !logon material
As for colors, sure.
function buddy($name, $msg)
{
if ($this -> start < time())
{
if ($this -> bot -> is_member($name) == 1)
{
$id = $this -> bot -> aoc -> get_uid($name);
if ($msg == 1)
{
if ($this -> last_log["on"][$name] < (time() - 5))
{
$result = $this -> bot -> db -> select("SELECT nickname, firstname, lastname, level, profession, rank_name, ailevel, aititle FROM members WHERE id = " . $id);
$res = "<font color=#66FFFF>\"" . $name . "\"</font>";
//$res = "<font color=#66FFFF>" . $res . "</font>";
if (!empty($result[0][1]))
$res = "<font color=#66FFFF>" . $result[0][1] . " " . $res . "</font>";
if (!empty($result[0][2]))
$res .= " " . $result[0][2];
$res .= "<font color=#66FFFF> (Lvl " . $result[0][3] . " / </font><font color=#33cc33>" . $result[0][6] . "</font><font color=#66FFFF> (</font><font color=#33cc33>" . $result[0][7] . "</font><font color=#66FFFF>) " . $result[0][4] . " " . $result[0][5] . ") logged on.</font>";
$main = $this -> bot -> alts -> main($name);
$alts = $this -> bot -> alts -> get_alts($main);
if (!empty($alts))
{
$altsresult = " ";
$altsresult .= $this -> bot -> alts -> make_alt_blob($main, $alts);
}
else
$altsresult = "";
$res .= $altsresult;
$result = $this -> bot -> db -> select("SELECT message FROM logon WHERE id = " . $id);
if (!empty($result))
$res .= "<font color=#66FFFF> :: " . $result[0][0] . "</font>";
$this -> bot -> send_gc($res);
$this -> bot -> send_pgroup($res);
if ($this -> bot -> guild_relay_target)
{
$tell = "<pre>gcr [" . $this -> bot -> guildname . "] <font color=#66FFFF>" . $res . "</font>";
$target = strtolower($this -> bot -> guild_relay_target);
$this -> bot -> send_tell($target, $tell, 0, false);
}
$this -> last_log["on"][$name] = time();
}
}
else
{
if ($this -> last_log["off"][$name] < (time() - 3))
{
$this -> bot -> send_gc("<font color=#66FFFF>" . $name . " logged off</font>");
$this -> bot -> send_pgroup("<font color=#66FFFF>" . $name . " logged off</font>");
$this -> last_log["off"][$name] = time();
if ($this -> bot -> guild_relay_target)
{
$tell = "<pre>gcr [" . $this -> bot -> guildname . "] " . $this -> bot -> botname . ": <font color=#66FFFF>" . $name . " logged off</font>";
$target = strtolower($this -> bot -> guild_relay_target);
$this -> bot -> send_tell($target, $tell, 0, false);
}
}
}
}
}
}
That should give you what you want.
-
Thanks again Nebhyper that was exactly what I was looking for.
Bryan