BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Age of Conan Archive => AoC 0.6 support => Topic started by: Monk4y on September 21, 2009, 08:20:50 pm

Title: help request - Ginfo officer online status
Post by: Monk4y on September 21, 2009, 08:20:50 pm
Im not sure if this is the right place, but I'll post it here anyway.

Im trying to sort out a guild info script with an online status for officers. The trouble is they are always on their alt characters and when the ginfo script goes up it shows their main as offline - but they are actually online with an alt.  I have the section regarding online/offline status below but need someone smarter than me to make it show that he is on an alt and not just offline.

Code: [Select]
$txt.= "##GI_orange##GUILD LEADER##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Doob');
if ($online['status'] <= 0)
{
$txt.= "##GI_highlight##".$online['content']." :: Doob##end##<br /><br>";
}
else
{
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Doob I just clicked the guild advert in globlal, do you have time to chat?'>Doob</a>##end##\n";
}

Any assistance would be greatly appreciated.
Thankyou for your time.
Title: Re: help request - Ginfo officer online status
Post by: BoA-Gert on October 17, 2009, 02:22:15 am
I use:

Code: [Select]
  $txt.= "##purple##{Officer block}:##end##\n{Officer Name} ";
  $contact = "is currently offline.\n\n";
     
  $found = 0;  
      $online = $this -> bot -> core("online") -> get_online_state('{Main char}');  
  if ($online['status'] == 1 && $found == 0) {
        $contact = "##GI_highlight## is on with <a href='chatcmd:///tell {Main char} {text}'>{Main char}</a>##end##\n\n";
$found = 1;
      }
 
      $online = $this -> bot -> core("online") -> get_online_state('{Alt char}');  
  if ($online['status'] == 1 && $found == 0) {
        $contact = "##GI_highlight## is on with <a href='chatcmd:///tell {Alt char} {text}'>{Alt char}</a>##end##\n\n";
$found = 1;
      }
.
.
.
$txt .= $contact;

repeat the alt char block for each alt - the last line as after all the alts - this will output 1 line with a click link for whichever alt is online or use the default "is currently offline" if no alts are on.

Probably could be a bit neater but works how I need it to ;)
Title: Re: help request - Ginfo officer online status
Post by: Monk4y on October 20, 2009, 04:19:44 am
thanks for your reply.
Title: Re: help request - Ginfo officer online status
Post by: keirou on October 20, 2009, 05:53:00 am
With the help of a guild member I was able to modify this script so it now tells you if the leader / officers are online (AND on what character)

Code: [Select]
<?php
/*
* GuildInfo
* This module helps people with guild recruitment.
*
*
*/
$GuildInfo = new GuildInfo($bot);

class 
GuildInfo extends BaseActiveModule
{

   function 
__construct(&$bot)
   {
      
parent::__construct(&$botget_class($this));
      
      
$this -> register_command('all''ginfo'"ANONYMOUS");

      
$this -> bot -> core("colors") -> define_scheme("GI""highlight""yellow");
      
$this -> bot -> core("colors") -> define_scheme("GI""normal""white");
      
$this -> bot -> core("colors") -> define_scheme("GI""info""lightgreen");
      
$this -> bot -> core("colors") -> define_scheme("GI""red""red");
      
$this -> bot -> core("colors") -> define_scheme("GI""Silver""Silver");

      
$this -> help['description'] = 'Helps with guild recruitment.';
      
$this -> help['command']['ginfo']="Displays guild's info tab.";
      
$this -> help['command']['ginfo members']="Displays a list of members in the guild.";
      
$this -> help['command']['ginfo classes']="Displays a list of classes in the guild.";
      
$this -> help['command']['grecruit']="Displays a recruitment link in OOC (usable only with priveleges).";
   }

   function 
command_handler($name$msg$origin)
   {
      if (
preg_match('/^ginfo/i'$msg$info)) {
         
$words trim(substr($msgstrlen('ginfo')));
         if (
$words == "members")
         {
            return 
$this -> memberslist();
         } else if(
$words == "classes") {
            return 
$this -> memberscount();
         } else {
            return 
$this -> info();
         }
      } else if(
preg_match('/^grecruit/i'$msg$info)) {
         
//return "Command under development";
         
$msg $this -> recruit();
         
$channel $this -> bot -> core("chat") -> lookup_group("Playfield");
         return 
"Currently under development: ".$channel;
      } else {
         
$this -> bot -> send_help($name);
      }
   }
   
   
/*
   Guilds Info
   */
   
function info()
   {
      
$txt.= "##GI_red##GUILD NAME HERE##end##\n\n";
 $txt.= "##end##\n";      
      
      
$txt.= "##highlight##Leader:##end##\n\n";
$online $this -> officercheck("GUILD LEADER NAME");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";
 $txt.= "##end##\n";      
      
$txt.= "##highlight##Officers:##end##\n";
$online $this -> officercheck("OFFICER 1");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";
     
$online $this -> officercheck("OFFICER 2");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";
$online $this -> officercheck("OFFICER 3");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";
$online $this -> officercheck("OFFICER 4");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";
$online $this -> officercheck("OFFICER 5");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";  
$online $this -> officercheck("OFFICER 6");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";  
 $txt.= "##end##\n"
      
$txt.= "##GI_red##Website:##end## ##GI_info## WWW. YOUR WEBSITE HERE .COM##end##\n\n";
      
$txt.= "##GI_red##City:##end## ##Silver##WHAT YOUVE BUILT##end##\n\n";
      
$txt.= "##GI_red##Raids:##end## ##Silver##WHAT YOUVE KILLED##end##\n\n";
      
$txt.= "##GI_red##Recruitment:##end## ##Silver##SPECIAL REQUIREMENTS??.##end##\n\n";
 $txt.= "##end##\n";
      
$txt.= "##highlight##Assassin:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Barbarian:##end## ##Red## [Closed]##end##\n";
      
$txt.= "##highlight##Bear Shaman:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Conqueror:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Dark Templer:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Demonologist:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Guardian:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Herald of Xotli:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Necromancer:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Priest of Mitra:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Ranger:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Tempest of Set:##end## ##Red##[Closed]##end##\n\n";
 $txt.= "##end##\n";
      
      
$txt.= "##GI_red##Guild Info:##end##\n";
      
$txt.= "##Silver##";
      
$txt.= "GUILD INFO SECTION 1\n\n";
 $txt.= "##end##\n";
 $txt.= "##Silver##";
      
$txt.= "GUILD INFO SECTION 2\n\n";
 $txt.= "##end##\n";
 $txt.= "##Silver##";
      
$txt.= "GUILD INFO SECTION 3\n\n";
      
$txt.= "##end##";
      
      
      return 
$this -> bot -> core("tools") -> make_blob("WHAT YOU WANT THE BOT TO TELL THE PLAYER"$txt);
   }
   
/*
   Still working on this, for now just some random debugging stuff I was trying
   */
   
function recruit()
   {   
      
$blob "Guild Name is Recruiting!: '";
      
$blob.= $this -> info();
      
$blob.= " Playfield ID: ";
      return 
$blob;
      
   }

/*
Checks online list for presence of officer of $name
Returns online status, and if online, name of current main/alt
*/
function officercheck($name)
{
$online $this -> bot -> db -> select("SELECT t1.nickname FROM "
"#___online AS t1 LEFT JOIN #___whois AS t2 ON t1.nickname = t2.nickname WHERE status_gc=1");

$found FALSE;
if (!empty($online))
{
foreach ($online as $player)
{
if(isset($this -> listed[$channel][$player[0]]))
Continue;

$main $this -> bot -> core("alts") -> main($player[0]);

if ($name == $main)
{
$online_state $this -> bot -> core("online") -> get_online_state($this -> bot -> core("chat") -> get_uname($player[0]));
$retstr " - " $this -> bot -> core("chat") -> get_uname($player[0]);
$found TRUE;
break;
}
else if ($name == $this -> bot -> core("chat") -> get_uname($player[0]))
{
$online_state $this -> bot -> core("online") -> get_online_state($main);
$retstr " - " $main;
$found TRUE;
break;
}
}
if ($found == FALSE)
{
$online_state $this -> bot -> core("online") -> get_online_state($name);
$retstr " - " $name;
}
}
return array($online_state$retstr);
}
   
   
/*
   Need to revize so it just uses core
   */
   
function memberslist()
   {
      
$blob "";
      
$count 0;
      
$result $this -> bot -> db -> select("SELECT nickname, last_seen FROM #___users WHERE user_level = " MEMBER " ORDER BY nickname ASC");
      if (!empty(
$result))
      {
         
$inside "##blob_title##:::: <botname>'s Member List ::::##end##\n\n";
         foreach (
$result as $val)
         {
            
$count++;
            
$inside .= "##blob_text##&#8226; " $val[0];
            if (
$val[1] > 0)
            {
               
$inside .= ", last seen at " gmdate($this -> bot -> core("settings") -> get("Time""FormatString"), $val[1]);
            }
            else
            {
               
$inside .= ", never seen online";
            }
            
$inside .= "##end## ".$this -> bot -> core("tools") -> chatcmd("whois " $val[0], "[Whois]")."\n";
         }
         
$blob " :: " $this -> bot -> core("tools") -> make_blob("click to view"$inside);
      }
      return 
$count " Guild Members:" $blob;
   }
   
   
/*
   Need to revize so it just uses core
   */
   
function memberscount()
   {
      
$blob "";
      
$total 0;
      
      
$buddies count($this -> bot -> aoc -> buddies);
      
//Get a list of professions
      
$profession_list "'".$this->bot->core('professions')->get_professions("', '")."'";
      
$counts $this -> bot -> db -> select("SELECT t2.class, COUNT(DISTINCT t1.nickname)
            FROM #___users AS t1 LEFT JOIN #___whois AS t2 ON t1.nickname = t2.nickname
             WHERE user_level = " 
MEMBER " AND t2.class IN ($profession_list) GROUP BY class");
            
      foreach (
$this -> bot->core('professions')->get_profession_array() as $prof)
         
$count[$prof] = 0;
      if (!(empty(
$counts)))
      {
         foreach (
$counts as $profcount)
         {
            
$count[$profcount[0]] += $profcount[1];
            
$total += $profcount[1];
         }
      }
      
      
$inside "##blob_title##:::: <botname>'s Member Count ::::##end##\n";
      
$inside .= "\n##blob_text##Buddy List Count: ##blob_title##".$buddies."##end##\n";
      foreach (
$count as $key => $value)
         
$inside .= "\n&#8226; ".$key." = ##blob_title##".$value."##end##";
      
$blob " :: " $this -> bot -> core("tools") -> make_blob("click to view"$inside);

      return 
$total " Guild Classes:" $blob;
   }
}
?>

It shows if they are offline or Online, and uses the current ginfo script.

Props to kontar from Third Time Lucky on Gwahlur for coding that for me though.
Title: Re: help request - Ginfo officer online status
Post by: Monk4y on October 21, 2009, 02:08:49 am
thanks again.
Title: Re: help request - Ginfo officer online status
Post by: snyder on October 24, 2009, 10:46:10 pm
try this for officers online (any member actually)

Code: [Select]
        $query = $this->bot->db->select("select o.nickname from #___online as o, #___alts as a where o.status_gc = '1' and ( (o.nickname = a.alt and a.main = '".$name."') or (o.nickname = a.main and a.alt = '".$name."') ) LIMIT 1");
        if (!empty($query)) {
            foreach ($query as $user) {
                $name = $user[0];
                unset($user);
            }
        }
        unset($query);
        // online status
        $online = $this->bot->core("online")->get_online_state($name);
        return array($online, $name);
Title: Re: help request - Ginfo officer online status
Post by: PBbot on October 28, 2009, 04:23:05 pm
I get the error :
fatal error: Cannot redeclare class Guildinfo in C:\.......\ginfo.php on line 294
Title: Re: help request - Ginfo officer online status
Post by: Getrix on October 28, 2009, 04:30:53 pm
Check if you have pasted the code two times in your file...
Title: Re: help request - Ginfo officer online status
Post by: PBbot on October 28, 2009, 04:55:29 pm
This is the code. Im not a php guru so any help is appriciated.

Code: [Select]
<?php
/*
* GuildInfo
* This module helps people with guild recruitment.
*
*
*/
$GuildInfo = new GuildInfo($bot);

class 
GuildInfo extends BaseActiveModule
{

   function 
__construct(&$bot)
   {
      
parent::__construct(&$botget_class($this));
      
      
$this -> register_command('all''ginfo'"ANONYMOUS");

      
$this -> bot -> core("colors") -> define_scheme("GI""highlight""yellow");
      
$this -> bot -> core("colors") -> define_scheme("GI""normal""white");
      
$this -> bot -> core("colors") -> define_scheme("GI""info""lightgreen");
      
$this -> bot -> core("colors") -> define_scheme("GI""red""red");
      
$this -> bot -> core("colors") -> define_scheme("GI""Silver""Silver");

      
$this -> help['description'] = 'Helps with guild recruitment.';
      
$this -> help['command']['ginfo']="Displays guild's info tab.";
      
$this -> help['command']['ginfo members']="Displays a list of members in the guild.";
      
$this -> help['command']['ginfo classes']="Displays a list of classes in the guild.";
      
$this -> help['command']['grecruit']="Displays a recruitment link in OOC (usable only with priveleges).";
   }

   function 
command_handler($name$msg$origin)
   {
      if (
preg_match('/^ginfo/i'$msg$info)) {
         
$words trim(substr($msgstrlen('ginfo')));
         if (
$words == "members")
         {
            return 
$this -> memberslist();
         } else if(
$words == "classes") {
            return 
$this -> memberscount();
         } else {
            return 
$this -> info();
         }
      } else if(
preg_match('/^grecruit/i'$msg$info)) {
         
//return "Command under development";
         
$msg $this -> recruit();
         
$channel $this -> bot -> core("chat") -> lookup_group("Playfield");
         return 
"Currently under development: ".$channel;
      } else {
         
$this -> bot -> send_help($name);
      }
   }
   
   
/*
   Guilds Info
   */
   
function info()
   {
      
$txt.= "##GI_red##Polarbears##end##\n\n";
 $txt.= "##end##\n";      
      
      
$txt.= "##highlight##Leader:##end##\n\n";
$online $this -> officercheck("Ronmel");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";
 $txt.= "##end##\n";      
      
$txt.= "##highlight##Officers:##end##\n";
$online $this -> officercheck("Dawee");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";
     
$online $this -> officercheck("Sabasi");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";
$online $this -> officercheck("Groshznax");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";
$online $this -> officercheck("Senkar");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";
$txt.= "##highlight##Recryitments Officers:##end##\n";
$online $this -> officercheck("Idia");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
 $txt.= "##end##\n";  
$online $this -> officercheck("Twistybull");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1];
$online $this -> officercheck("Aerithchan");
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state['content'] . $online[1]; 
$txt.= "##end##\n";  
 $txt.= "##end##\n"
      
$txt.= "##GI_red##Website:##end## ##GI_info## www.Polarbears.no##end##\n\n";
      
$txt.= "##GI_red##City:##end## ##Silver##Tier 3 50%##end##\n\n";
      
$txt.= "##GI_red##Raids:##end## ##Silver##Tier 1 50%##end##\n\n";
      
$txt.= "##GI_red##Recruitment:##end## ##Silver##Looking for active scandinavians older than 18 that want to raid and have fun.##end##\n\n";
 $txt.= "##end##\n";
      
$txt.= "##highlight##Assassin:##end## ##Green##[High]##end##\n";
      
$txt.= "##highlight##Barbarian:##end## ##Yellow## [Medium]##end##\n";
      
$txt.= "##highlight##Bear Shaman:##end## ##Green##[High]##end##\n";
      
$txt.= "##highlight##Conqueror:##end## ##Green##[High]##end##\n";
      
$txt.= "##highlight##Dark Templer:##end## ##Yellow##[Medium]##end##\n";
      
$txt.= "##highlight##Demonologist:##end## ##Red##[Low]##end##\n";
      
$txt.= "##highlight##Guardian:##end## ##Green##[High]##end##\n";
      
$txt.= "##highlight##Herald of Xotli:##end## ##Yellow##[Medium]##end##\n";
      
$txt.= "##highlight##Necromancer:##end## ##Yellow##[Medium]##end##\n";
      
$txt.= "##highlight##Priest of Mitra:##end## ##Red##[Low]##end##\n";
      
$txt.= "##highlight##Ranger:##end## ##Green##[High]##end##\n";
      
$txt.= "##highlight##Tempest of Set:##end## ##Red##[Low]##end##\n\n";
 $txt.= "##end##\n";
      
      
$txt.= "##GI_red##Guild Info:##end##\n";
      
$txt.= "##Silver##";
      
$txt.= "We are a mature guild with most of our members 
between the age 25-45 yrs old. Most of us have rather 
extensive gaming experiences from other MMO and 
FPS games. Our main goal with this guild is to 
create a comfortable and fun journey in the world 
of Hyboria for all our members. We are loyal and 
helpful towards our ingame friends, and espesially 
towards our guildies.\n\n"
;
 $txt.= "##end##\n";
 $txt.= "##Silver##";
      
$txt.= "As mentioned earlier community and friendship will 
be essential in running our Guild. Needless to say 
due to our prior gaming experiences we are ambitious 
and serious gamers and will not be mistaken for being 
pushovers in any sence. Still if your goal is hardcore 
raiding, grinding and sieging 24/7 we might not be 
the Guild to fulfill your ingame ambitions. We all have 
RL obligations like work/school/family life etc. which 
can be quite time consuming at times so we will 
probably never become the first Guild to new content 
or be the first to take down any high end bosses.\n\n"
;
 $txt.= "##end##\n";
 $txt.= "##Silver##";
      
$txt.= "We have a 24/7 ventrilo server running, webpages, 
AOCbot and very helpfully members.
We also have almost a full tier 3 city. 
We are raiding 2-3 times a week.\n\n"
;
      
$txt.= "##end##";
      
$txt.= "##Silver##";
      
$txt.= "Every new member will have a 2 week trial peroid 
in which they can get to know other members of our 
guild, and we can also get to know them better. 
During this period we will look at your level of 
ingame activity and how you interact socially and 
gamewice with your new guildies. You will during 
this peroid be treated equally and regarded as 
any other guildmember.\n\n"
;
      
$txt.= "##end##";
$txt.= "##Silver##";
      
$txt.= "In addition go to www.Polarbears.no and click on 
Guild Policies. Read these please so you are fully 
updated and aware of what we expect of you.\n\n"
;
      
$txt.= "##end##";
$txt.= "##Silver##";
      
$txt.= "If you think this could be a guild for you and want to 
join, go to www.Polarbears forum and post an application.\n\n"
;
      
$txt.= "##end##";
$txt.= "##Silver##";
      
$txt.= "Thank you for reading.\n\n";
      
$txt.= "##end##";
$txt.= "##Silver##";
      
$txt.= "We wish you all the best in the glorious world of Hyboria.\n\n";
      
$txt.= "##end##";
      
      return 
$this -> bot -> core("tools") -> make_blob("Polarbears"$txt);
   }
   
/*
   Still working on this, for now just some random debugging stuff I was trying
   */
   
function recruit()
   {   
      
$blob "Guild Name is Recruiting!: '";
      
$blob.= $this -> info();
      
$blob.= " Playfield ID: ";
      return 
$blob;
      
   }

/*
Checks online list for presence of officer of $name
Returns online status, and if online, name of current main/alt
*/
function officercheck($name)
{
$online $this -> bot -> db -> select("SELECT t1.nickname FROM "
"#___online AS t1 LEFT JOIN #___whois AS t2 ON t1.nickname = t2.nickname WHERE status_gc=1");

$found FALSE;
if (!empty($online))
{
foreach ($online as $player)
{
if(isset($this -> listed[$channel][$player[0]]))
Continue;

$main $this -> bot -> core("alts") -> main($player[0]);

if ($name == $main)
{
$online_state $this -> bot -> core("online") -> get_online_state($this -> bot -> core("chat") -> get_uname($player[0]));
$retstr " - " $this -> bot -> core("chat") -> get_uname($player[0]);
$found TRUE;
break;
}
else if ($name == $this -> bot -> core("chat") -> get_uname($player[0]))
{
$online_state $this -> bot -> core("online") -> get_online_state($main);
$retstr " - " $main;
$found TRUE;
break;
}
}
if ($found == FALSE)
{
$online_state $this -> bot -> core("online") -> get_online_state($name);
$retstr " - " $name;
}
}
return array($online_state$retstr);
}
   
   
/*
   Need to revize so it just uses core
   */
   
function memberslist()
   {
      
$blob "";
      
$count 0;
      
$result $this -> bot -> db -> select("SELECT nickname, last_seen FROM #___users WHERE user_level = " MEMBER " ORDER BY nickname ASC");
      if (!empty(
$result))
      {
         
$inside "##blob_title##:::: <botname>'s Member List ::::##end##\n\n";
         foreach (
$result as $val)
         {
            
$count++;
            
$inside .= "##blob_text##&#38;#8226; " $val[0];
            if (
$val[1] > 0)
            {
               
$inside .= ", last seen at " gmdate($this -> bot -> core("settings") -> get("Time""FormatString"), $val[1]);
            }
            else
            {
               
$inside .= ", never seen online";
            }
            
$inside .= "##end## ".$this -> bot -> core("tools") -> chatcmd("whois " $val[0], "[Whois]")."\n";
         }
         
$blob " :: " $this -> bot -> core("tools") -> make_blob("click to view"$inside);
      }
      return 
$count " Guild Members:" $blob;
   }
   
   
/*
   Need to revize so it just uses core
   */
   
function memberscount()
   {
      
$blob "";
      
$total 0;
      
      
$buddies count($this -> bot -> aoc -> buddies);
      
//Get a list of professions
      
$profession_list "'".$this->bot->core('professions')->get_professions("', '")."'";
      
$counts $this -> bot -> db -> select("SELECT t2.class, COUNT(DISTINCT t1.nickname)
            FROM #___users AS t1 LEFT JOIN #___whois AS t2 ON t1.nickname = t2.nickname
             WHERE user_level = " 
MEMBER " AND t2.class IN ($profession_list) GROUP BY class");
            
      foreach (
$this -> bot->core('professions')->get_profession_array() as $prof)
         
$count[$prof] = 0;
      if (!(empty(
$counts)))
      {
         foreach (
$counts as $profcount)
         {
            
$count[$profcount[0]] += $profcount[1];
            
$total += $profcount[1];
         }
      }
      
      
$inside "##blob_title##:::: <botname>'s Member Count ::::##end##\n";
      
$inside .= "\n##blob_text##Buddy List Count: ##blob_title##".$buddies."##end##\n";
      foreach (
$count as $key => $value)
         
$inside .= "\n&#38;#8226; ".$key." = ##blob_title##".$value."##end##";
      
$blob " :: " $this -> bot -> core("tools") -> make_blob("click to view"$inside);

      return 
$total " Guild Classes:" $blob;
   }
}
?>

Title: Re: help request - Ginfo officer online status
Post by: PBbot on October 28, 2009, 05:21:05 pm
I'm noob, had a copy of the old ginfo file in the same folder.
All ok now :)
Title: Re: help request - Ginfo officer online status
Post by: snyder on October 28, 2009, 06:52:11 pm
replace officercheck function with

Code: [Select]
function officercheck($name) {
        $query = $this->bot->db->select("select o.nickname from #___online as o, #___alts as a where o.status_gc = '1' and ( (o.nickname = a.alt and a.main = '".$name."') or (o.nickname = a.main and a.alt = '".$name."') ) LIMIT 1");
        if (!empty($query)) {
            foreach ($query as $user) {
                $name = $user[0];
                unset($user);
            }
        }
        unset($query);
        // online status
        $online = $this->bot->core("online")->get_online_state($name);
        return array($online, $name);
}

you get back array(Online/Offline status, Name character is useing)

and its much smaller than one from script few post up :)
Title: Re: help request - Ginfo officer online status
Post by: snyder on October 29, 2009, 10:47:15 am
modifyed guild info module alot, you now have !settings GuildInfo option to set requirements on classes (5 levels curently: none,low,medium,high,ultrahigh)

also, recruitment text is in some external file (so you can edit without problems), but double \n dont work unfortunately there so find some other ways of making double line space

link to file:
http://www.cro-guild.com/bebot/Ginfo.php.txt
Title: Re: help request - Ginfo officer online status
Post by: Yite on November 03, 2009, 01:08:06 am
also, recruitment text is in some external file (so you can edit without problems), but double \n dont work unfortunately there so find some other ways of making double line space

For a double line space I use the following:
Quote
Blah blah blah
blah bah
##end##
##end##
Blah blah

-Yite
Title: Re: help request - Ginfo officer online status
Post by: snyder on November 08, 2009, 03:14:25 pm
i updated module with spam protection

you know when some guys click 5 times and bot gets blocked :)

its 15 minutes default, you can change that of course

http://www.cro-guild.com/bebot/
Title: Re: help request - Ginfo officer online status
Post by: shadowrik on January 02, 2010, 08:39:24 pm
 8) I realize I'll get the 'what a noob' expression but I'm really missing how this works for recruitment when the bot watches my guild chat not my global or say.  I've searched the file for a ///gsay and can't find it...now for testing purposes I like it returning it to guild instead.
Oh there's a couple php files failing to load and when you make it so they will load...they seem to be missing the php header(<?php)
Title: Re: help request - Ginfo officer online status
Post by: BoA-Gert on January 04, 2010, 01:58:42 am
It's a 3rd party BeBot module you add in to allow the !ginfo response - tried to search for the original but can't find it on here since the change.  I'd suggest looking at Snyder's !ginfo module (see here (http://www.cro-guild.com/bebot/?f=Ginfo)) or I can see if I can dig out the original module...
Title: Re: help request - Ginfo officer online status
Post by: shadowrik on January 04, 2010, 10:50:00 pm
I installed Scott's and while it posts the information into guild chat I am failing to get it to post it in OOC or global so I"m doing something wrong.  Is it the recruitment.php file that I am missing?  Is there an example recruitment.php?

And I truly appreciate all your assitance.
Title: Re: help request - Ginfo officer online status
Post by: BoA-Gert on January 05, 2010, 07:02:27 am
Snyder's one uses recruitment.php so you can edit the recruitment info without changing the ginfo module each time - so you will need that...

The one I've tweaked is:

Code: [Select]
'<?php
/*
* GuildInfo, by Kaeus
* This module helps people with guild recruitment.
*
*
*/
$GuildInfo = new GuildInfo($bot);

class 
GuildInfo extends BaseActiveModule
{
private $who_clicked = array();
private $spam_time 15;// minutes that spam protection is active

   
function __construct(&$bot)
   {
      
parent::__construct(&$botget_class($this));
      
      
$this -> register_command('all''ginfo'"ANONYMOUS");

      
$this -> bot -> core("colors") -> define_scheme("GI""highlight""yellow");
      
$this -> bot -> core("colors") -> define_scheme("GI""normal""white");
      
$this -> bot -> core("colors") -> define_scheme("GI""info""lightgreen");
      
$this -> bot -> core("colors") -> define_scheme("GI""red""red");
      
$this -> bot -> core("colors") -> define_scheme("GI""blue""blue");

      
$this -> help['description'] = 'Helps with guild recruitment.';
      
$this -> help['command']['ginfo']="Displays guild's info tab.";
   }

function command_handler($name$msg$origin
{
// there is only one command
if (preg_match('/^ginfo/i'$msg$info)) {
// spam protection
if ($this->is_not_spam($name)) {
return $this->info($name);
}
}
else {
$this->bot->send_help($name);
}
}
   
   
/*
   Guilds Info
   */
   
function info()
   {
      
$txt.= "##GI_red##[GUILD NAME]##end##\n\n";
  $txt.= "##GI_red##----------------##end##\n\n";
  
      
      
$txt.= "##GI_info##Recruitment contacts:##end##\n\n";
       
      
$txt.= "##purple##Guild Leader:##end##\n [GUILD LEADER] "
  $contact "is currently offline.\n\n";
 
     
  $found 0;   
      
$online $this -> bot -> core("online") -> get_online_state('[GUILD LEADER MAIN]');   
  if ($online['status'] == && $found == 0) {
        
$contact "##GI_highlight## is on with <a href='chatcmd:///tell [GUILD LEADER MAIN] I am interested in joining [GUILD NAME]'>[GUILD LEADER MAIN]</a>##end##\n\n"
$found 1;
      } 

  $online $this -> bot -> core("online") -> get_online_state('[GUILD LEADER ALT]');
  if ($online['status'] == && $found == 0) {
         
$contact "##GI_highlight##is on with <a href='chatcmd:///tell [GUILD LEADER ALT] I am interested in joining [GUILD NAME]'>[GUILD LEADER ALT]</a> (alt)##end##\n\n"
 $found 1;
  
  $txt .= $contact;
  $txt.= "##GI_normal##"."--##end##\n";
    
      
$txt.= "##purple##Guild Officers:##end##\n";
  $txt.= "[GUILD OFFICER 1] ";
  $contact "is currently offline.\n\n";
 
  
  $found 0;   
  $online $this -> bot -> core("online") -> get_online_state('[GUILD OFFICER 1 MAIN]');   
  if ($online['status'] == && $found == 0) {
        
$contact "##GI_highlight## is on with <a href='chatcmd:///tell [GUILD OFFICER 1 MAIN] I am interested in joining [GUILD NAME]'>[GUILD OFFICER 1 MAIN]</a>##end##\n\n"
$found 1;
  }
      
  $online $this -> bot -> core("online") -> get_online_state('[GUILD OFFICER 1 ALT]');
  if ($online['status'] == && $found == 0) {
         
$contact "##GI_highlight##is on with <a href='chatcmd:///tell [GUILD OFFICER 1 ALT] I am interested in joining [GUILD NAME]'>[GUILD OFFICER 1 ALT]</a> (alt)##end##\n\n"
 $found 1;
   }  
   
  $txt .= $contact   
  $txt.= "##GI_normal##"."--##end##\n";
      
  $txt.= "##GI_red##Forums:##end## ##GI_highlight##[GUILD SITE URL]\n \n";
  $txt.= "##GI_normal##"."--##end##\n";
      
$txt.= "##GI_red##City:##end## ##GI_highlight##[GUILD CITY INFO]##end##\n \n";
  $txt.= "##GI_normal##"."--##end##\n";      
      
$txt.= "##GI_red##Recruitment:##end## ##yellow##[GUILD RECRUITMENT BLOCK]##end##\n \n";
      
  $txt.= "##GI_normal##"."--##end##\n";            
      
$txt.= "##GI_red##Guild Info:##end##\n \n";
      
$txt.= "##GI_info##";
      
$txt.= "[GUILD INFO BLOCK]\n";
  $txt.= "##end##";
      
      return 
$this -> bot -> core("tools") -> make_blob("[GUILD NAME] Guild info"$txt);
   }
   
public function is_not_spam($name
{
// if name is in array, check if he clicked in last $this->spam_time minutes
if (isset($this->who_clicked$name ])) {
// name is in array, check if time char last time clicked is greater than time() - $this->spam_time
if ( $this->who_clicked$name ] > ( time() - $this->spam_time 60 60 ) ) {
return false;
}
}
$this->who_clicked$name ] = time();
return true;
}
}   
?>

Less flexible than Snyder's but has similar functionality - I've got mine setup so it checks a set of officer alts rather than all officer alts (as Snyder's does), recruitment and guild info is fixed in the 1 file (so a bot restart is needed but that's not that often) but does use the 15min spam routine from Snyder's (handy to avoid those who like clicking links 6-7 times :P)...

As for showing information, not sure what you're trying to do - the !ginfo module is normally used so people can send a tell to the bot and receive a link to click which has more info than a normal recruitment script can have.

For example, you'd have a script which would be:

Code: [Select]
<a href="text://[Some brief info - no more than ~40 chars is good]<br><br><a href='chatcmd:///tell [Your Bot]!ginfo>Click here</a> for more info about the guild.">[Your guild name/click text]</a> - [normal text]
This would show [Your guild name/click text] - [normal text] in global, a user would click the link and see the brief info with a link to click for more info (this is the !ginfo link).  When a user clicks the !ginfo link, they'd get a tell back with a link to click which would have the actual guild info stuff.

Hope that's clear :P
Title: Re: help request - Ginfo officer online status
Post by: TBK on February 08, 2010, 01:14:48 am
I would like to add a feature, where I get one of the online staffs (leader(s) and officers) name (chosen randomly). Anybody got a clue how it can be done?

Which I then can use in the link below:
Code: [Select]
$txt .="<Center><font color='#FFFFFF' face='HYBORIANSMALL'><a style='text-decoration:none' href='chatcmd:///tell ".$inv." Hi ".$inv.", I would like to join'><u>Press here to Join!</u></a></font></Center>
Title: Re: help request - Ginfo officer online status
Post by: BoA-Gert on February 08, 2010, 02:49:18 am
Could be done - can see if I can get something up during the week if no-one else does...
Title: Re: help request - Ginfo officer online status
Post by: TBK on February 18, 2010, 01:55:11 pm
I have come up with this, but my output is 0. Could anybody point out what I'm doing wrong?

Code: [Select]
<?php
foreach ($this->officers as $v) {
$online $this->find_officer($v);

$name_online in_array('online'$online);

unset($v$online$name_online[0]);
}

$online_staff = array($name_online);


function randomElement(array $array)
{

$rand mt_rand(0count($array) - 1);
$array_keys array_keys($array);
   
return $array[$array_keys[$rand]];
}

function randomKey(array $array)
{
return randomElement(array_keys($array));
}

$inv randomKey($online_staff);


$txt .="<Center><font color='#FFFFFF' face='HYBORIANSMALL'><a style='text-decoration:none' href='chatcmd:///tell ".$inv." Hi ".$inv.", I would like to join'><u>Press here to Join!</u></a></font>;
?>

Title: Re: help request - Ginfo officer online status
Post by: Getrix on February 18, 2010, 03:23:31 pm
$txt .="<Center><font color='#FFFFFF' face='HYBORIANSMALL'><a style='text-decoration:none' href='chatcmd:///tell ".$inv." Hi ".$inv.", I would like to join'><u>Press here to Join!</u></a></font>";

Missing a " at the end

And im not sure if this is your complete file, because there are other problem too like missing print/echo and functions
Title: Re: help request - Ginfo officer online status
Post by: TBK on February 18, 2010, 09:39:26 pm
It is not my full file. I use the Snyder modified version as template (http://www.cro-guild.com/bebot/Ginfo.php.txt).


The problem is not ", I just removed to must of my file xD
Title: Re: help request - Ginfo officer online status
Post by: Getrix on February 18, 2010, 10:59:38 pm
Ok, i dunno why you have function (array $array) {} ...

For easier making of the random function, take a look on: http://php.net/manual/en/function.array-rand.php


Code: [Select]
<?php
      
foreach ($this->officers as $v) {
         
$online $this->find_officer($v);
         
         
$name_online in_array('online'$online);

         unset(
$v$online$name_online[0]);
      }
      
      
$online_staff = array($name_online);
      
      
      function 
randomElement($array)
      {

         
$rand mt_rand(0count($array) - 1);
         
$array_keys array_keys($array);
         
         return 
$array[$array_keys[$rand]];
      }
      
      function 
randomKey($array)
      {
         return 
randomElement(array_keys($array));
      }
      
      
$inv randomKey($online_staff);
      
      
$txt .="<Center><font color='#FFFFFF' face='HYBORIANSMALL'><a style='text-decoration:none' href='chatcmd:///tell ".$inv." Hi ".$inv.", I would like to join'><u>Press here to Join!</u></a></font>";
?>
Title: Re: help request - Ginfo officer online status
Post by: TBK on February 19, 2010, 12:14:52 am
Like this?
Code: [Select]
<?php
      
foreach ($this->officers as $v) {
         
$online $this->find_officer($v);
         
         
$name_online in_array('online'$online);

         unset(
$v$online$name_online[0]);
      }
      
      
$online_staff = array($name_online);
          
      
$inv array_rand($online_staff1);
      
      
$txt .="<Center><font color='#FFFFFF' face='HYBORIANSMALL'><a style='text-decoration:none' href='chatcmd:///tell ".$inv." Hi ".$inv.", I would like to join'><u>Press here to Join!</u></a></font>";
?>
Title: Re: help request - Ginfo officer online status
Post by: TBK on February 19, 2010, 12:26:10 am
Get this output :
Code: [Select]
/tell 0, Hi 0, I would like to join
Title: Re: help request - Ginfo officer online status
Post by: Getrix on February 19, 2010, 07:00:29 am
Quote
If you are picking only one entry, array_rand()  returns the key for a random entry. Otherwise, it returns an array of keys for the random entries. This is done so that you can pick random keys as well as values out of the array.

$inv = array_rand($online_staff, 1);
$officer = $online_staff[$inv];
Title: Re: help request - Ginfo officer online status
Post by: TBK on February 24, 2010, 03:11:11 am
Figured out the problem, the $online_status returns a multidimensional array, which I of cause didn't know. So I searched the wrong array. Should had done a dump to begin with  ;D

Thx for the help Getrix :)

Here is the working code:
Code: [Select]
<?php
$online_staff = array();

foreach ($this->officers as $x) {
$online_status $this->find_officer($x);
$status $online_status[0];

if (in_array(1$status)) {
array_push($online_staff,$online_status[1]);
}

unset($x$status$online_status);
}

$officer array_rand($online_staff1);
$inv $online_staff[$officer];

$txt .="<Center><font color='#FFFFFF' face='HYBORIANSMALL'><a style='text-decoration:none' href='chatcmd:///tell ".$inv." Hi ".$inv.", I would like to join'><u>Press here to Join!</u></a></font>";
?>

Title: Re: help request - Ginfo officer online status
Post by: esnir on April 16, 2010, 10:26:16 am
Hi Guys,

Can someone pls tell me how recruitment.php should look like?

Title: Re: help request - Ginfo officer online status
Post by: snyder on April 19, 2010, 03:58:25 pm
my info in it, just change :)

Code: [Select]
##GI_red##About us##end##
##GI_normal##We were formed as Croatian only guild, but after few weeks we realized that there can not be only one nationality in guild and then started to recruiting people from every country. It took us some time, but now we have over 40 active lvl 80 players that are doing all raid instances. All players are 18+, but most of them is even 30+. We have Ventrilo server and most ppl use it all the time so there is allways someone to talk.##end##
##end##
##end##
##GI_red##Raiding##end##
##GI_normal##Curently we have 5 raids per week (Monday,Tuesday,Wednesday,Thursday,Sunday) and hopeing to build good secondary raid team so we have two raids at time. We are farming ALL raid bosses atleast once a week, but mostly we get 2 full BRC runs per week and 1 on T1 raids. Sometimes we hold pug raids if there is time for it and we have raid leader avaliable.##end##
##end##
##end##
##GI_red##Guild city##end##
##GI_normal##We have all Tier 3 buldings, walls will wait some better times...##end##
##end##
##end##
##GI_red##Bot##end##
##GI_normal##What is bot? Its (in this case) PHP multi-purpose script that runs from one webserver. It has a LOT of options and we make new ones if required (improved rolls, who can craft what, what materials are needed for something, what is some material used for and how much, ninja list....). Basicaly, bot is logged on one character, Shonjo, and monitores guild chat and tells (commands) to it and then makes response if it is required.##end##
##end##
##end##
##GI_red##Web site##end##
##GI_normal##Our web site, www.cro-guild.com, is custom made PHP based web, but uses SMF forum for easy user management and verification.
Members create their characters on web and apply for raids through raid planer with character they wanna go with (using AoC classes, not like most raid planers only Soldier, DPS, Healer dinstiction).
There is list of what our guild members can craft (that list is made with bot) so members can find who can make something and what does it require to be crafted.
List of items that people got is implemented on web aswell (info goes from guild bot) so you can see info on item (hover item name), who got it, when and in which raid. List is searchable aswell....##end##
##end##
##end##
##GI_red##Type of players in guild##end##
##GI_normal##We are semi-hardcore in some ways (amount of raids and time to complete runs), but we also have a lot of casual players that are here mostly for daily dungeon runs and some raids if they want. And it does not matter what kind of player you are!##end##
##end##
##end##
##GI_red##What do we require?##end##
##GI_normal##Basicaly, not much. If you want to do raids with guild you need to give some materials and money monthly (it is changed depending on building requirements for mats and what we have most) so check web site for that. We do NOT require your daily activity, a number of raids per month, etc... If you want to play, just play, if you don't, then don't play, your choice and you will not be looked at differently. We require that if you are applyed on raid planer as confirmed or avaliable to be online at raid time. You can change that status on planer any time you want.##end##
##end##
##end##
##GI_red##We are looking for:##end##
Title: Re: help request - Ginfo officer online status
Post by: altera on April 19, 2010, 08:58:25 pm
Thanks for the info (and the question).  I thought I was the only one who didn't know how to make the external .php file work.  I just hardcoded all the info into the main recruitinment module.  I guess I can go back and clean it up by splitting the info into that separate file . ;D
SimplePortal 2.3.7 © 2008-2025, SimplePortal