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: Org Event chat notification  (Read 8576 times)

0 Members and 2 Guests are viewing this topic.

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Org Event chat notification
« on: December 11, 2005, 02:36:31 am »
Just something I thought I'd share. Not the greatest, any ideas are welcomed. :) Hope you enjoy it.

P.S. Make sure to have updated the AOChat.php and whatnot. Any issues/problems with it, please also leave a msg.

Code: [Select]
<?php

  
/*
   * OrgEvent.php - Handles Org join/leave/kick events.
   *
   * Written by Naturalistic for the BeBot (Guild version) bot.
   *
   * Really simple, variables aren't the greatest thoughtup but it's what you get with lack of sleep ;)
   */

$orgevent = new orgevent($bot);

$commands['gmsg']['Org. Msg.'][] = &$orgevent;

class 
orgevent 
{
    var 
$bot;

function orgevent(&$bot)
{
$this -> bot = &$bot;
}

function gmsg($name$group$msg
{
if ($name == "0")
{
if (preg_match("/(.+) kicked (.+) from your organization./i"$msg$info))
{
$personkicked $info[2];
$kicker $info[1];
$this -> bot -> send_gc("<font color=#ffff00>$personkicked</font> was kicked from the org by $kicker!");
} else if (preg_match("/(.+) has left your organization./i"$msg$info)) 
{
$person $info[1];
$this -> bot -> send_gc("<font color=#ffff00>$person</font> has left the org!");
} else if (preg_match("/(.+) has joined your organization./i"$msg$info))
{
$person $info[1];
$this -> bot -> send_gc("<font color=#ffff00>$person</font> has just joined the org!");
}
}
}
}
?>

« Last Edit: December 18, 2005, 02:10:44 am by Naturalistic »
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: Org Event chat notification
« Reply #1 on: December 18, 2005, 02:25:32 am »
Bump

Fix for a minor chat misread on my part (thanks akarah for pointing it out :) )

Code: [Select]
else if (preg_match("/(.+) just left your organization./i", $msg, $info))
should be:

Code: [Select]
else if (preg_match("/(.+) has left your organization./i", $msg, $info))
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline Wolfbiter

  • Contributor
  • *******
  • Posts: 149
  • Karma: +0/-0
    • KAZE
Re: Org Event chat notification
« Reply #2 on: December 18, 2005, 12:59:42 pm »
Some suggested additional stuff...
This goes into the has "joined the organization" part.
Code: [Select]
$this->bot->log("Members","Add","Adding new member: $info[1]");
$whois = $this->whois($info[1]);
$this->bot->db->query("INSERT into members (nickname,level,aleve,profession,rank_name) VALUES ('".$info[1]."',".$whois[1].",".$whois[2].",'".$whois[3]."','newMember')");
$this->bot->send_gc("<font color=#ffff00>$info[1]</font> (<font color=#00CC00>$whois[1]</font> / <font color=#008800>$whois[2]</font> <font color=#10a5e5>$whois[3]</font>) just joined the organization.");
$uid = $this->bot->get_uid($info[1]);
$this->bot->aoc->buddy_add($uid);
It'll add them to the buddylist and also into the members database.

And this is the whois function
Code: [Select]
function whois($name) {
        $content = $this -> bot -> get_site("http://www.anarchy-online.com/character/bio/d/" . $this -> bot -> dimension . "/name/" . strtolower($name) . "/bio.xml");
        $result[0] = $name;
        $result[1] = $this -> bot -> xmlparse($content, "level");
        $result[2] = $this -> bot -> xmlparse($content, "defender_rank_id");
        $result[3] = $this -> bot -> xmlparse($content, "profession");
if (empty($result[1]))
$result[1] = -1;
if (empty($result[2]))
$result[1] = -1;
if (empty($result[3]))
$result[1] = "Unknown";

return $result;
    }

This is using my slightly modified roster files thou, so you should change "alevel" to whatever alien level is in your database.
Too many toons.

Offline Akarah

  • Contributor
  • *******
  • Posts: 72
  • Karma: +0/-0
    • http://synergyfactor.net/
Re: Org Event chat notification
« Reply #3 on: December 18, 2005, 07:26:46 pm »
what happens if it's a new character? i see your whois function sets it as unknown. wouldn't that insert unknowns into the member table? or would it fail due to values being negative?

i'll probably do something like this, with the WhoisCache functions though, and make sure it exists before actually inserting, etc..

i've also added a few "announcements"-- one to irc, one to guildchat, and my favorite, sending a "fine! be that way! :(" tell to someone who org leaves ;)


Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: Org Event chat notification
« Reply #4 on: December 18, 2005, 11:16:06 pm »
yeah, spam and insult them for leaving... :P
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline Wolfbiter

  • Contributor
  • *******
  • Posts: 149
  • Karma: +0/-0
    • KAZE
Re: Org Event chat notification
« Reply #5 on: December 19, 2005, 12:39:33 am »
It only sets level, alien level and profession as unknown. The name is the supplied name...
Too many toons.

Offline Akarah

  • Contributor
  • *******
  • Posts: 72
  • Karma: +0/-0
    • http://synergyfactor.net/
Re: Org Event chat notification
« Reply #6 on: December 19, 2005, 04:44:44 am »
right. sorry wasn't thinking. hehe. roster update would fix it next cycle anyway.

i'll try to remember to avoid posting before i've had coffee ;)

 

* 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: 215
  • 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