Archive > AoC 0.6.x Custom/Unofficial modules

ginfo help please

<< < (2/6) > >>

Cuval:
You only keep the ginfo.php and change the texts in that file in your code editor (notepad++ or whatever you like to use). All texts are in the .php file. This module does not support a .txt file with the info.

dragonjr:
do any of the mods except .txt because im getting broken codes in scripts and everything else do i just rename them ?

snyder:
you can change
[/code]private $recruitment_file = 'D:/www/bebot/recruitment.php';
--- Code: ---to whatever you want, it will work since file is being read with file_get_contents() function
--- End code ---

dragonjr:
i have one more question on the guild info mod is it possible to run 2 different ginfo at the same time like i wanted to try this one

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

class GuildInfo extends BaseActiveModule
{

   function __construct(&$bot)
   {
      parent::__construct(&$bot, get_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.";
      $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($msg, strlen('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##_-E M P-_##end##\n\n";
      
      
      $txt.= "##purple##Leaders:##end##\n\n";
      $online = $this -> bot -> core("online") -> get_online_state('Jiheld');
      $txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Jiheld Im interested in joining _-E M P-_'>Jiheld</a>##end##\n";
      $online = $this -> bot -> core("online") -> get_online_state('Ronmel');
      $txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Ronmel Im interested in joining _-E M P-_'>Ronmel</a>##end##\n\n";
      $txt.= "##purple##Leaders Alts:##end##\n";
      $online = $this -> bot -> core("online") -> get_online_state('Mustage');
      $txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Mustage Im interested in joining _-E M P-_'>Mustage</a>##end##\n";
      $online = $this -> bot -> core("online") -> get_online_state('Ronmello');
      $txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Ronmello Im interested in joining _-E M P-_'>Ronmello</a>##end##\n";
      $online = $this -> bot -> core("online") -> get_online_state('Balashi');
      $txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Balashi Im interested in joining _-E M P-_'>Balashi</a>##end##\n\n";
      
      $txt.= "##purple##Officers:##end##\n";
      $online = $this -> bot -> core("online") -> get_online_state('Cheyenne');
      $txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Cheyenne Im interested in joining _-E M P-_'>Cheyenne</a> - Officer##end##\n";
      $online = $this -> bot -> core("online") -> get_online_state('Blui');
      $txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Blui Im interested in joining _-E M P-_'>Blui</a> - Officer##end##\n";
      $online = $this -> bot -> core("online") -> get_online_state('Haiwan');
      $txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Haiwan Im interested in joining _-E M P-_'>Haiwan</a> - Officer##end##\n";
      $online = $this -> bot -> core("online") -> get_online_state('Froxer');
      $txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Froxer Im interested in joining _-E M P-_'>Froxer</a> - Officer##end##\n";
      $txt.= "##GI_red##Website:##end## ##GI_highlight##http://www.enragedpolarbears.com##end##\n\n";
      $txt.= "##GI_red##City:##end## ##GI_highlight##Full Tier II (include towers and walls). Tier III keep##end##\n\n";
      
      $txt.= "##GI_red##Recruitment:##end## ##yellow## We looking for people older then the age of 18 and from level 70+ Active people that want to raid and have fun.##end##\n\n";
      $txt.= "##Red## [Low]: We have enough.##end## ##yellow## [Medium]: We could use 1.##end## ##green##[High]: need 2 or more.##end##\n\n";
      $txt.= "##purple##Assissin:##end## ##yellow##[Medium]##end##\n";
      $txt.= "##purple##Barbarian:##end## [Closed]##end##\n";
      $txt.= "##purple##Bear Shaman:##end## ##red##[Low]##end##\n";
      $txt.= "##purple##Conqueror:##end## ##yellow##[Medium]##end##\n";
      $txt.= "##purple##Dark Templer:##end## ##red##[Low]##end##\n";
      $txt.= "##purple##Demonologist:##end## ##Yellow##[Medium]##end##\n";
      $txt.= "##purple##Guardian:##end## ##red##[Low]##end##\n";
      $txt.= "##purple##Herald of Xotli:##end## ##Yellow##[Medium]##end##\n";
      $txt.= "##purple##Necromancer:##end## ##Red##[Low]##end##\n";
      $txt.= "##purple##Priest of Mitra:##end## ##red##[Low]##end##\n";
      $txt.= "##purple##Ranger:##end## ##Yellow##[Medium]##end##\n";
      $txt.= "##purple##Tempest of set:##end## ##Yellow##[Medium]##end##\n\n";
      
      $txt.= "##GI_red##Guild Info:##end##\n";
      $txt.= "##GI_info##";
      $txt.= "Enraged Polarbears is curently progressing through the 24 people raid material of AoC, and we are curently in need of a few selected recruits among our ranks.\n

Our main goal is to form a stable and solid relatively small raiding team with people that will get to know each other and have fun together. This is, in our opinion, the only way a guild can stack together and succeed, and the only way one won't feel just another pawn of the guild's leadership. We plan on making members feel at home and welcome. We also plan on encouraging people to take part in the guild's doings, not only in the raiding part but also the planning ones. We will ask for your opinion, your best thought strategy, your participation in the guild's politics, we will be happy when you speak your mind and provide constructive feedback at our forum. \n

We will also face with respect any prospective applicants, trials and members. There will not be any form of abusing at all, none harassing/pseudo-professional elitist attitude and so on and forth. We are fully aware of the true importance of this game, which is close to zero, and our priority -hands down- will be to have fun and make people in the raid happy so they will be eager to raid with us again, irregardless of the epics. \n

That of course doesn't mean we will slack behind and go casual, rather the opposite. We are a semi-hardcore guild with high if not very high end-game goals that are to be achieved, meaning that we have a good selection system and only keep players good enough to achieve those goals. \n

In any case, anyone who decides to apply, please visit our website for an application. Or just have a chat with one of us. http://www.enragedpolarbears.com \n

If you reached here, bravo! and thank you for your time and hope to see all of you soon online! \n\n";
      $txt.= "<a href='chatcmd:///tell embot !ginfo members'>List of Members</a>\n";
      $txt.= "<a href='chatcmd:///tell embot !ginfo classes'>List of Classes</a>\n";
      $txt.= "##end##";
      
      
      return $this -> bot -> core("tools") -> make_blob("_-E M P-_", $txt);
   }
   /*
   Still working on this, for now just some random debugging stuff I was trying
   */
   function recruit()
   {   
      $blob = "EMP is Recruiting!: '";
      $blob.= $this -> info();
      $blob.= " Playfield ID: ";
      return $blob;
      
   }
   
   /*
   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;
   }
}
?>
--- End code ---

and im useing this one


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

class GuildInfo extends BaseActiveModule
{

   function __construct(&$bot)
   {
      parent::__construct(&$bot, get_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($msg, strlen('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##Black Moon Rising##end##\n\n";
    $txt.= "##end##\n";      
      
      $txt.= "##highlight##Leader:##end##\n\n";
   $online = $this -> officercheck("Reklats");
   $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("nerissa");
   $online_state = $online[0];
      $txt.= "##GI_highlight##".$online_state['content'] . $online[1];
    $txt.= "##end##\n";
     $online = $this -> officercheck("sininstyle");
   $online_state = $online[0];
      $txt.= "##GI_highlight##".$online_state['content'] . $online[1];
    $txt.= "##end##\n";
   $online = $this -> officercheck("jormette");
   $online_state = $online[0];
      $txt.= "##GI_highlight##".$online_state['content'] . $online[1];
    $txt.= "##end##\n";
   $online = $this -> officercheck("bludflo");
   $online_state = $online[0];
      $txt.= "##GI_highlight##".$online_state['content'] . $online[1];
    $txt.= "##end##\n";
 $online = $this -> officercheck("wintershade");
   $online_state = $online[0];
      $txt.= "##GI_highlight##".$online_state['content'] . $online[1];
    $txt.= "##end##\n";
 $online = $this -> officercheck("Lunixxheals");
   $online_state = $online[0];
      $txt.= "##GI_highlight##".$online_state['content'] . $online[1];
    $txt.= "##end##\n";
   $online = $this -> officercheck("thrognar");
   $online_state = $online[0];
      $txt.= "##GI_highlight##".$online_state['content'] . $online[1];
    $txt.= "##end##\n";    
   $online = $this -> officercheck("melwren");
   $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## http://blackmoonrising.guildlaunch.com##end##\n\n";
      $txt.= "##GI_red##City:##end## ##Silver##Complete T3 City##end##\n\n";
      $txt.= "##GI_red##Raids:##end## ##Silver##T1 T2 T3##end##\n\n";
      $txt.= "##GI_red##Recruitment:##end## ##Silver##Open.##end##\n\n";
    $txt.= "##end##\n";
      $txt.= "##highlight##Assassin:##end## ##Red##[open]##end##\n";
      $txt.= "##highlight##Barbarian:##end## ##Red## [open]##end##\n";
      $txt.= "##highlight##Bear Shaman:##end## ##Red##[open]##end##\n";
      $txt.= "##highlight##Conqueror:##end## ##Red##[open]##end##\n";
      $txt.= "##highlight##Dark Templer:##end## ##Red##[open]##end##\n";
      $txt.= "##highlight##Demonologist:##end## ##Red##[open]##end##\n";
      $txt.= "##highlight##Guardian:##end## ##Red##[open]##end##\n";
      $txt.= "##highlight##Herald of Xotli:##end## ##Red##[open]##end##\n";
      $txt.= "##highlight##Necromancer:##end## ##Red##[open]##end##\n";
      $txt.= "##highlight##Priest of Mitra:##end## ##Red##[open]##end##\n";
      $txt.= "##highlight##Ranger:##end## ##Red##[open]##end##\n";
      $txt.= "##highlight##Tempest of Set:##end## ##Red##[open]##end##\n\n";
    $txt.= "##end##\n";
      
      $txt.= "##GI_red##Guild Info:##end##\n";
      $txt.= "##Silver##";
      $txt.= "Mature Casual Guild -  Looking for all classes and levels - and serious raiders, especially West Coast and Oceanic Players.Also Looking for Tier Three Raiders willing to put in the work of learning new strats and be part of a team.
\n\n";
    $txt.= "##end##\n";
    
    
      
      
      return $this -> bot -> core("tools") -> make_blob("Black Moon Rising", $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;
   }
}
?>
--- End code ---

and i have this file saved in the mod folder as php and i have it saved in txt file.
if i want to add info on it all i do is change and save it in both files but is it possible to have 2 diffrent Ginfo's in the bot running at the same time? if so how would i make it work?

Drizzurdeen:
of course it is possible ... just change the name of the second file ... like ginfo2.php than u have to change the code itself ... u have to change the comand ginfo into ex. ginfo2 ... so u can see with !ginfo2 the text of the ginfo2.php ... this would be the easiest way so i think

hope i could help

greetz drizz

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version