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: Experimental Rooster_GUILD.php  (Read 36751 times)

0 Members and 1 Guest are viewing this topic.

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Experimental Rooster_GUILD.php
« on: December 29, 2005, 06:24:16 pm »
Okies... so I sat here mulling over the Auto update part with an integrated !seen command
This version is pretty much reworked in alot of ways.
  • 1st I ditched the redundant(same code for 2 different channels) manual Member handling routine I had had incorporated from Rooster_RAID.php
  • 2nd I blended in Wanuarmi lastseen.php, which I had to modify that a bit to get it to work using the Member table.
  • 3rd (which took a little more thinking over than I thought it would) I had to update the way the Cron job stored member info. In the original manner it completely Deleted the contents of the Member table before updating it. This was a bad thing since I wanted to store the "lastseen" timestamp there. Solution? Don't dump the contents of the table using DELETE, create a conditional routine that checks to see if there is a timestamp recorded (not the Default 0), grab that time stamp and set it to a Variable to be re-inserted with other updated info from FC server. Then instead of using an INSERT INTO we use REPLACE INTO. Why you ask? Well to quote the MySQL Docs -- "REPLACE works exactly like INSERT, except that if an old record in the table has the same value as a new record for a PRIMARY KEY or a UNIQUE index, the old record is deleted before the new record is inserted." In other words I can grab values from the Table I don't want to loose before they get re-inserted.
  • I dumped the columns for the Picture and Level Range since nothing in Bebot seemed to be using them.
  • ++ Last addition, this one is now aware of messages in Org. Msg. channel. Bot will auto add/remove Org members as it witnesses those events.

Here's the code, I have it running on my bot currently and it works. :) Take a read through it and if you've played with the Rooster enough you'll notice the changes. Oh and I also changed the formating a bit on the !seen output from Wanuarmi's

21 May 2006 Edit: I'm happy and I am done with this module. The member update Cron job does what it's supposed to do now and doesn't disturb guests on the bots Buddy list. It still contains all the previous notes above. I did this update mostly to fix issues with Guest auto inviting. BTW, the Auto inviting fixes go beyond the scope of this file. There were also fixes to AutoInv.php and Relay_GUILD.php. You can find those FILES HERE
There are also some fixed functions in Bot.php that needed to be done. They are is_member() and inc_buddy(), I placed those functions in a text file here rather than post my entire customized Bot.php. If your using a stock Bot.php replacing these functions shouldn't mess up anything else.

11 Jan 07 Edit: Updated links to files in this post. See link in my Sig for all other files posted by me around these forums.
« Last Edit: January 11, 2007, 08:40:45 am by Xenixa »
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Experimental Rooster_GUILD.php
« Reply #1 on: December 30, 2005, 05:47:55 am »
Little update to the code above. Turned out the order in which I had originally set the Command Processing function was keeping Members from using the !seen command if they weren't a bot admin. Updated to work correctly.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Experimental Rooster_GUILD.php
« Reply #2 on: January 02, 2006, 12:39:36 am »
Hi Xenixa,

Works great here, no problems at all so far =)

p.s. did you ever post your working auto-invite guests code, did a quick scout on forum and couldn't find.

Cheers,

-jj-

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Experimental Rooster_GUILD.php
« Reply #3 on: January 02, 2006, 01:01:46 am »
No, unfortunatly the auto-invite code stuff is also still very experimantal. It kinda worked for a bit until I discovered other issues which lead back to the way Bot members are handled in the Roster updates. That whole Buddy list thing again.  :-\

Working on that though as time permits. :)
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Ainen

  • BeBot User
  • **
  • Posts: 22
  • Karma: +0/-0
Re: Experimental Rooster_GUILD.php
« Reply #4 on: January 02, 2006, 01:41:10 am »
Just put this on my bot. One thing I noted is that my members table had the fields ai_rank_id and ai_rank instead of ailevel and aititle, so I had to go through and change all the references.
BeBot 0.3.4 svn 91 // PHP 4.3.9 // MySQL 4.1.12

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Experimental Rooster_GUILD.php
« Reply #5 on: January 02, 2006, 11:57:07 am »
The ailevel and aititle are inline with the SVN, so I just changed my column names in the DB and anywhere else it called those columns.. sorry I forgot to mention that, but what ever works for you :)

Edit: On another of my fixes I had for Auto invites of guests that was kinda working(which I didn't post here, was very ugly) I should have posted up tomarrow after work. Need sleepz before work. Doing APF raids is hard work too.  :P
« Last Edit: January 02, 2006, 12:09:56 pm by Xenixa »
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Experimental Rooster_GUILD.php
« Reply #6 on: January 05, 2006, 05:44:15 pm »
Hrrm ok, so sow does the Roster Updates relate to auto invites you may be wondering?
Well else were I have posted fixes to Bot.php, and AutoInv.php that address actual Auto Inviting of people on the Guest list. Well since bots rely on knowing when people logon by them being in the bots Buddy list, Rooster_GUILD.php would prevent this.

So, I looked at this 2 ways and the best solution I could think of was to just do a simple comparison against the Guest Table. Or if you want to try it yourself, Find in Rooster_GUILD.php I have above:
Code: [Select]
// Remove buddys not on list...
foreach ($buds as $id => $value)
{
$this -> bot -> aoc -> buddy_remove($id);
$this -> bot -> log("BUDDY", "DEL", $this -> bot -> aoc -> get_uname($id));
}
Replace with:
Code: [Select]
// Remove buddys not on list...
foreach ($buds as $id => $value)
{
//Auto Invite Fix: Test to see if buddy exsists on Guestlist first. Don't remove if they are.
$gbuds = $this -> bot -> db -> select("SELECT id FROM guests WHERE id = $id");
if (empty($gbuds[0][0]))
{
$this -> bot -> aoc -> buddy_remove($id);
$this -> bot -> log("BUDDY", "DEL", $this -> bot -> aoc -> get_uname($id));
}
}
The updated AutoInv.php can be found on my ftp server here ftp://xen.afraid.org/bebot_files/
And changes to Bot.php can be found here: http://bebot.link/index.php/topic,255.0.html

You may have to remove then re-add people from the guest list so they can start getting Auto Invited on logon.
Also after restarting the bot don't forget to do a !autoinv on
« Last Edit: January 06, 2006, 12:50:51 am by Xenixa »
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Ainen

  • BeBot User
  • **
  • Posts: 22
  • Karma: +0/-0
Re: Experimental Rooster_GUILD.php
« Reply #7 on: January 07, 2006, 07:29:22 am »
I'm wondering if this has something to do with this module, but when someone joins the guest channel, they're added to both the Guild and private group online listing, but when they leave the private group, they do not leave the guild part of the listing. I have to restart the bot to clear that up. I'm running the version of 12/29.
BeBot 0.3.4 svn 91 // PHP 4.3.9 // MySQL 4.1.12

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Experimental Rooster_GUILD.php
« Reply #8 on: January 07, 2006, 11:46:28 am »
I saw that happen before the changes I made. Usually doing an !is will knock them off Online list if they logged out.

Edit: I looked this again Ainen, It's an issue with the Online.php ... It seems to base the Members online by read it's own buddylist with AND like condition on the is_member function.
« Last Edit: January 08, 2006, 10:27:50 am by Xenixa »
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Experimental Rooster_GUILD.php
« Reply #9 on: January 11, 2006, 08:38:05 am »
I'm wondering if this has something to do with this module, but when someone joins the guest channel, they're added to both the Guild and private group online listing, but when they leave the private group, they do not leave the guild part of the listing. I have to restart the bot to clear that up. I'm running the version of 12/29.

I just at this very moment fixed this issue Ainen. Was pretty strait forward.
Basically in the Online.php module find inside the function buddy($name, $msg) the following line:
Code: [Select]
if ($this -> bot -> is_member($name))Change to:
Code: [Select]
if ($this -> bot -> is_member($name) == 1)That should stop it from showing guests in the Members area of the Online Info window. This of course assumes your function is_member() in the Bot.php looks like this:
Code: [Select]
    function is_member($uname)
    {
if ($uid = $this -> aoc -> get_uid($uname))
{
$result = $this -> db -> select("SELECT nickname FROM members WHERE id = " . $uid);
    if (!empty($result))
        return 1;
else
$result = $this -> db -> select("SELECT id FROM guests WHERE id = " . $uid);
      if (!empty($result))
      return 2;
else
      return false;
}
    }
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Experimental Rooster_GUILD.php
« Reply #10 on: January 25, 2006, 02:29:19 am »
Hi Xenixa,

Still using the code above plus the various fixes - autoinvite works perfectly :-)

However, one problem I found is that if someone leaves org, the member does not get deleted at next roster check (you can delete manually with the !member command though).

Just wondered if this was a side-effect of not removing the guests from buddy list or could it be fixed?

Either way, just to let you know this problem exists (and is fixable manually).

Cheers,

-jj-

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Experimental Rooster_GUILD.php
« Reply #11 on: January 28, 2006, 08:48:54 am »
Ya, I've noticed this one also. :)

Problem is in order to keep the lastseen column from getting nuked I changed it so it wouldn't delete the whole list of Org members. What I failed to realize was that members could get stuck on that table if no one wasn't actively keeping track of there Org's roster and deleting them from the bot.

I been working on another method actually as time permits that should fix this.

Oh I've also since 'fixed' another problem I was having with auto invites. Not so much a bot problem but a guest problem. Not all guests of the bot like to be auto invited every time they log on. So I modified the the autoinv.php to add an additional command(!notify) and check. It stores a boolean in the guests table for each of the guests preferences, 1 for on and 0 for off. Defaults to on. Also required changes to Relay_GUILD.php and the guests table of course. My copy of Relay_GUILD.php also uses Alreadythere's Whois Cache module to handle output of info on who joinded the Private channel. I can make them available if anyone is interested.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Experimental Rooster_GUILD.php
« Reply #12 on: January 28, 2006, 09:38:24 am »
Ya, I've noticed this one also. :)

Problem is in order to keep the lastseen column from getting nuked I changed it so it wouldn't delete the whole list of Org members. What I failed to realize was that members could get stuck on that table if no one wasn't actively keeping track of there Org's roster and deleting them from the bot.

I been working on another method actually as time permits that should fix this.

There are two different approaches to this issue that i can see.

The easy way is to grab the messages from Org. Msg. which we should be doing (and will be doing) and use it to delete members, and simply leave it up to the administrators of the bot to delete any members missed by the automated system.

The second way, which isn't quite as easy, is still grabbing the messages by automated removal, but also actually validating the list somehow, I'm just not sure what way would be best.
My original thoughts went towards md5'ing the org XML, however that would pick up on a lot of changes not related to org additions and leavings. Another avenue would be using the member count, but even that is prone to problems as it can occur that a member leaves and a member is added in a single day, in which case the member count would stay the same but the org rooster would remain unchanged.

Bot's nowdays barring server issues tend to stay online almost constantly though so it could be argued that a more sophisticated approach than the first is a total waste anyways.
BeBot Founder and Fixer Kingpin

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Experimental Rooster_GUILD.php
« Reply #13 on: January 28, 2006, 09:54:43 am »
Funny you should mention Org. Msg.'s from the gmsg channel. :)

I'm just now wrapping up adding that to Rooster_GUILD.php since its slow ingame and I have nothing better to do.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Tsuyoi

  • BeBot User
  • **
  • Posts: 30
  • Karma: +0/-0
  • BigT
    • Adrenaline Rush Forums
Re: Experimental Rooster_GUILD.php
« Reply #14 on: January 28, 2006, 09:55:52 am »
You could use a combination of the the method used now and the ["Org. Msg."].  Just add the functionality of (.+) (joined|left) the org./i into the system, and max out the cron time.  I realize it's double redundancy, but it will not only provide real-time updates to the roster, but also provide the reliability of a periodic revamp of the roster as well.

Just starting my delve into Bebot, so I apologize if this method has been trashed before or there are prior reasons for not using it.

- Tsuyoi
« Last Edit: January 28, 2006, 10:09:02 am by Tsuyoi »

 

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