collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18365
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Guild Raidbot  (Read 8902 times)

0 Members and 1 Guest are viewing this topic.

Offline Sojourner

  • BeBot Rookie
  • *
  • Posts: 12
  • Karma: +0/-0
    • http://majestic.webhop.net
Guild Raidbot
« on: August 28, 2005, 03:31:37 pm »
This module may be handy if you use the bot for your orgs AI raid bot.  It will go through the org member list and anyone that is high enough to work the city CC automatically gets added to the bots member list.

Basically a modified version of the rooster_GUILD.php file

Note that in order for it to work, you will need to add your guilds ID number to the Bot.conf file.

ForGuildRaidBot.php

Offline Derroylo

  • Contributor
  • *******
  • Posts: 43
  • Karma: +0/-0
Guild Raidbot
« Reply #1 on: August 28, 2005, 08:24:39 pm »
sry a bit confused atm for what do you need such a module?

nothing against your work just wondering :)
Derroylo 220/23 NT RK2

Offline Sojourner

  • BeBot Rookie
  • *
  • Posts: 12
  • Karma: +0/-0
    • http://majestic.webhop.net
Guild Raidbot
« Reply #2 on: August 29, 2005, 02:13:08 pm »
We use the bot for our AI raids

We want everyone who is high enough in the org leadership to be able to drop the City cloak to also automatically be a member in the bot so that they can use it if they are organizing a raid.

It doesn't auto-invite or anything like that.  Just sits silent like a raid bot.  But, anyone in the org who can run the CC is automatically a member, so the bot will listen to them.

That way, they are not dependent on 3 or 4 bot admins to be online if they want to run a raid and use the bot.

I'm tempted to change the code to make them bot admins instead of just members.  Not entirely sure what what admins have access to that members don't.

Offline Shelly

  • BeBot Apprentice
  • ***
  • Posts: 192
  • Karma: +0/-0
Re: Guild Raidbot
« Reply #3 on: September 06, 2005, 04:25:21 am »
We use our bot as just a raid bot also and liked your's and Xenixa's code so I added functions into your code based on Xenixa's post to capture the AI levels and auto populate the bot admin and bot raidleaders tables based on the org level of a member and also made it so any org member is added to the raid bot as a member.

I am sorry I don't have a way to upload a text copy to download. :oops:

Shelly

Quote from: "Sojourner"
This module may be handy if you use the bot for your orgs AI raid bot.  It will go through the org member list and anyone that is high enough to work the city CC automatically gets added to the bots member list.

Basically a modified version of the rooster_GUILD.php file

Note that in order for it to work, you will need to add your guilds ID number to the Bot.conf file.

ForGuildRaidBot.php


Code: [Select]

ForGuildRaidBot.php
<?
  /*
   * ForGuildRaidBot.php - To automatically add guild leaders to the raidbot's member list
   * By Sojon (RK2), based off the rooster_GUILD.php file by Blondeny
   *
   * NOTE: Normally if you run your bot as a raid bot, you do not need your org's id # in the
   * Bot.conf file, but for this module you do.
   *
   * File last changed at $LastChangedDate: 2005-08-28 09:10:00 -0500 (Sun, 28 Aug 2005) $
   * Revision: $Id: ForGuildRaidBot.php 1 2005-08-28 09:10:00 sojon $
   *
   *
   * BeBot - An Anarchy Online Chat Automaton
   * Copyright (C) 2004 Jonas Jax
   *
   * Developed by Blondengy (RK1)
   * Special thanks goes out to Khalem (RK1) for his support.
   *
   */


  /* Prepare MySQL database  */
  $db -> query("CREATE TABLE IF NOT EXISTS members
              (id INT NOT NULL PRIMARY KEY,
              nickname VARCHAR(25),
              firstname VARCHAR(25),
              lastname VARCHAR(25),
              rank TINYINT,
              rank_name VARCHAR(20),
              level INT,
              profession VARCHAR(15),
              gender VARCHAR(10),
              breed VARCHAR(10),
              ai_rank_id INT,
              ai_rank VARCHAR(15),
              pic VARCHAR(100),
              lvlrange VARCHAR(10))");

  $db -> query("CREATE TABLE IF NOT EXISTS admin_groups
             (id int(11) NOT NULL auto_increment,
              name varchar(35) default NULL,
               PRIMARY KEY  (id),
               UNIQUE KEY name (name)
             ) TYPE=MyISAM AUTO_INCREMENT=4" );

  $db -> query("INSERT INTO admin_groups (id, name)
             VALUES (2, admin)");
  $db -> query("INSERT INTO admin_groups (id, name)
             VALUES (1, superadmin)");
  $db -> query("INSERT INTO admin_groups (id, name)
             VALUES (3, raidleader)");

  $db -> query("CREATE TABLE IF NOT EXISTS admin_members
            (name varchar(50) default NULL,
             admin_group int(11) default NULL
            ) TYPE=MyISAM");

  $roster = new Roster($bot);

  $cron["12hour"][] = &$roster;


  /* The Class itself... */
  class Roster
  {
    var $bot;
   
    /* Constructor: Hands over a referance to the "Bot" and "MySQL" class. */
    function Roster (&$bot)
    {
      $this -> bot = &$bot;
    }

    /* This gets called on cron */
    function cron()
    {
      $this -> bot -> log("ROSTER", "UPDATE", "Starting roster update");
      // Get the guild roster from the anarchy website
      $org = $this -> bot -> get_site("http://community.anarchy-online.com/org/stats/d/" . $this -> bot -> dimension . "/name/" . $t
his -> bot -> guildid . "/basicstats.xml");
      $org = explode("<member>", $org);
     
      // Parse members
      for ($i = 1; $i < count($org); $i++)
      {
        $members[($i - 1)]["nickname"] = $this -> bot -> xmlparse($org[$i], "nickname");
        $members[($i - 1)]["firstname"] = $this -> bot -> xmlparse($org[$i], "firstname");
        $members[($i - 1)]["lastname"] = $this -> bot -> xmlparse($org[$i], "lastname");
        $members[($i - 1)]["rank"] = $this -> bot -> xmlparse($org[$i], "rank");
        $members[($i - 1)]["rank_name"] = $this -> bot -> xmlparse($org[$i], "rank_name");
        $members[($i - 1)]["level"] = $this -> bot -> xmlparse($org[$i], "level");
        $members[($i - 1)]["profession"] = $this -> bot -> xmlparse($org[$i], "profession");
        $members[($i - 1)]["gender"] = $this -> bot -> xmlparse($org[$i], "gender");
        $members[($i - 1)]["breed"] = $this -> bot -> xmlparse($org[$i], "breed");
        $members[($i - 1)]["ai_rank_id"] = $this -> bot -> xmlparse($org[$i], "defender_rank_id");
        $members[($i - 1)]["ai_rank"] = $this -> bot -> xmlparse($org[$i], "defender_rank");
        $members[($i - 1)]["pic"] = $this -> bot -> xmlparse($org[$i], "photo_url");
        $members[($i - 1)]["id"] = $this -> bot -> aoc -> get_uid($members[($i - 1)]["nickname"]);

        if (($members[($i - 1)]["level"] >= 1) && ($members[($i - 1)]["level"] <= 99))
          $members[($i - 1)]["lvlrange"] = "1-99";
        else if (($members[($i - 1)]["level"] >= 100) && ($members[($i - 1)]["level"] <= 149))
          $members[($i - 1)]["lvlrange"] = "100-149";
        else if (($members[($i - 1)]["level"] >= 150) && ($members[($i - 1)]["level"] <= 199))
          $members[($i - 1)]["lvlrange"] = "150-199";
        else if (($members[($i - 1)]["level"] >= 200) && ($members[($i - 1)]["level"] <= 214))
          $members[($i - 1)]["lvlrange"] = "200-214";
        else if (($members[($i - 1)]["level"] >= 215) && ($members[($i - 1)]["level"] <= 220))
          $members[($i - 1)]["lvlrange"] = "215-220";
        else
          $members[($i - 1)]["lvlrange"] = "unknown";

        if ($members[($i - 1)]["nickname"] == ucfirst(strtolower($this -> bot -> botname)))
          unset($members[($i - 1)]);
        if ($members[($i - 1)]["nickname"] == "Ailbot")                                           // TEMP HACK!!
          unset($members[($i - 1)]);                                                              // TEMP HACK!!
      }
     
      // Update roster if there are more then 1 people on it.
      if (count($members) > 1)
      {
        $buds = $this -> bot -> aoc -> buddies;
        $added = 0;
        $removed = 0;
         
        foreach ($members as $memb)
        {
          // If the member is an org member (top 4 ranks)
          if($memb["rank"] < 4)
          {
            // Add to buddylist if not yet in there
            if (!$this -> bot -> aoc -> buddy_exists($memb["id"]))
            {
              $this -> bot -> aoc -> buddy_add($memb["id"]);
              $this -> bot -> log("BUDDY", "ADD", $this -> bot -> aoc -> get_uname($memb["id"]));
              $added++;
            }
          }
         
          unset($buds[$memb["id"]]);
         
          $removed = count($buds);
         
          // Remove buddys not on member list...
          foreach ($buds as $id => $value)
          {
            $this -> bot -> aoc -> buddy_remove($id);
            $this -> bot -> log("BUDDY", "DEL", $this -> bot -> aoc -> get_uname($id));
          }
         
          // Remove members that are on buddy list but aren't org leaders
          if($memb["rank"] > 4)
          {
             if($this -> bot -> aoc -> buddy_exists($memb["id"]))
             {
               $this -> bot -> aoc -> buddy_remove($id);
               $this -> bot -> log("BUDDY", "DEL", $this -> bot -> aoc -> get_uname($id));
             }
           }
         }
           
         // Update database...
         $this -> bot -> db -> query("DELETE FROM members");
         foreach ($members as $memb)
         {
           // If they are org top leaders (top 2 ranks) add them to the admin table of the Db
           if($memb["rank"] < 2)
           {
          $this -> bot -> db -> query("INSERT INTO admin_members (name, admin_group)
                      VALUES ('" . $memb["nickname"] . "', '" . 2 . "')");
           }

           // If they are org top leaders (top 3 ranks) add them to the raidleaders table of the Db
           if($memb["rank"] < 3)
           {
          $this -> bot -> db -> query("INSERT INTO admin_members (name, admin_group)
                      VALUES ('" . $memb["nickname"] . "', '" . 3 . "')");
           }

           // If they are org members (top 4 ranks) add them to the member table of the Db
           if($memb["rank"] < 4)
           {
          $this -> bot -> db -> query("INSERT INTO members (id, nickname, firstname, lastname, rank, rank_name, level, profession, g
ender, breed, ai_rank_id, ai_rank, pic, lvlrange)
                      VALUES ('" . $memb["id"] . "',
                              '" . $memb["nickname"] . "', '" . $memb["firstname"] . "',
                              '" . $memb["lastname"] . "', '" . $memb["rank"] . "',
                              '" . $memb["rank_name"] . "', '" . $memb["level"] . "',
                              '" . $memb["profession"] . "', '" . $memb["gender"] . "',
                              '" . $memb["breed"] . "', '" . $memb["ai_rank_id"] . "',
                              '" . $memb["ai_rank"] . "', '" . $memb["pic"] . "',
                              '" . $memb["lvlrange"] . "')");
           }
         }
        $this -> bot -> log("ROSTER", "UPDATE", "Roster update complete. Added $added members, removed $removed.");
      }
    }
  }
?>

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Guild Raidbot
« Reply #4 on: September 06, 2005, 10:22:34 am »
Quote from: "Shelly"

Code: [Select]

ForGuildRaidBot.php
<?
        if ($members[($i - 1)]["nickname"] == "Ailbot")                                           // TEMP HACK!!
          unset($members[($i - 1)]);                                                              // TEMP HACK!!
      }

?>


You can safely remove those 2 lines. It was for test purposes I believe.
The piece of code just before it serves the same purpose. I.E. remove the bot from the member list.

Or if you are running more than one bot I suppose you could use it to remove the other bot from the member list also. :)
<<< Hack's in Zend Studio

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

Offline Sojourner

  • BeBot Rookie
  • *
  • Posts: 12
  • Karma: +0/-0
    • http://majestic.webhop.net
Guild Raidbot
« Reply #5 on: September 07, 2005, 03:07:17 am »
Cool, thanks for the help.

Posted an updated version of the module.  Here

Changes
  • Removed the Temp Hack lines as suggested by Xenixa
  • Used all the updates posted by Shelly
  • Commented out the buddy updates.  
    • Shouldn't need them if it isn't going to announce on/offline
    • Just need to uncomment them if you want the online buddies to be updated
  • It now removes the admins and raidleaders from the admin_members table and the repopulates them.  Should work just like it does for members.  That way it should handle admins/leaders getting demoted.

Offline Shelly

  • BeBot Apprentice
  • ***
  • Posts: 192
  • Karma: +0/-0
Guild Raidbot
« Reply #6 on: September 07, 2005, 03:19:15 am »
Quote from: "Sojourner"
Cool, thanks for the help.

Posted an updated version of the module.  Here



Nice modification! ... your url for your updated version didn't work... I was able to get a copy from http://majestic.game-host.org:8800/pages/oog/bebot/ForGuildRaidBot.php by doing a little sleuthing. ;-)

Shelly

 

* Recent Posts
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 ]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm ]

* Who's Online
  • Dot Guests: 421
  • 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