BeBot - An Anarchy Online and Age Of Conan chat automaton

Development => Coding and development discussion => Topic started by: Khalem on June 18, 2006, 10:03:58 pm

Title: Function to cleanup Raidbot Roster
Post by: Khalem on June 18, 2006, 10:03:58 pm
This is just a quick and dirty function i wrote to cleanup the roster on a raidbot. It can be improved as you currently have to depend on the echo from the whois function in the bot output to catch some deleted characters (this can be automated now of course, but i just needed a quick way)

It also populates the Whoiscache with all members as a side effect
Code: [Select]
<?php
        
function update_whois($name)
        {
                
$result $this -> bot -> db -> select("SELECT id, nickname FROM members");
                for (
$i 0$i count($result); $i++)
                {
                        
$oldid $result[$i][0];
                        
$oldname $result[$i][1];
                        
$tempid $this -> bot -> aoc -> get_uid ($oldname);

                        if (
$tempid != $oldid )
                        {
                                
$this -> bot -> send_tell($name"$oldname ($oldid) seems to have been rerolled to $tempid");
                        }
                        else
                        {
                               
$this -> bot -> whois($oldname);
                        }
                }
        }
?>

SimplePortal 2.3.7 © 2008-2024, SimplePortal