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: Autogratz Modul for Verison 0.6.5  (Read 24418 times)

0 Members and 1 Guest are viewing this topic.

Offline Luclia

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Autogratz Modul for Verison 0.6.5
« on: September 23, 2009, 01:33:40 am »
Hi,
just a question
is there a working autogratzmodul for the current Bot-Version ?

Greeting
Luclia

Offline snyder

  • BeBot User
  • **
  • Posts: 34
  • Karma: +0/-0
  • CRO guild
    • CRO Guild @ Crom
Re: Autogratz Modul for Verison 0.6.5
« Reply #1 on: September 23, 2009, 09:39:14 am »
there :)

Code: [Select]
<?
$announceGratz = new autogratz(&$bot);

/*
The Class itself...
*/
class autogratz Extends BaseActiveModule
{
    var $bot;


    /*
    Constructor:
    Hands over a referance to the "Bot" class.
    */
    function __construct (&$bot)
    {
        parent::__construct(&$bot, get_class($this));
        $this -> register_event('buddy');
        $this -> register_command('all', 'autogratz', 'ADMIN', array('add' => 'ADMIN', 'addlevel' => 'ADMIN', 'remove' => 'ADMIN', 'list' => 'ADMIN'));

        $this -> bot -> core("settings") -> create("autogratz", "Enabled", "Off", "Turns the functionality of this module on and off.", "On;Off");
        $this -> bot -> core("settings") -> create("autogratz", "SendTo", "gc", "Send the message via tell or guild chat.", "gc;tell");
        $this -> bot -> db -> query("CREATE TABLE IF NOT EXISTS " . $this -> bot -> db -> define_tablename("gratz_messages", "true") . " (id int(10) unsigned NOT NULL AUTO_INCREMENT, level int(10) unsigned NOT NULL DEFAULT '0', message varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (id)) DEFAULT CHARSET=utf8;");
        $this -> bot -> db -> update_table('gratz_messages', 'id', 'add', "ALTER TABLE #___gratz_messages ADD COLUMN id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, DROP PRIMARY KEY, ADD PRIMARY KEY (id);");
        $this -> help['description'] = "Congratulates a guild member on gaining a level.";
        $this -> help['command']['autogratz add &lt;message&gt;']="Adds a congratulations message (use &lt;name&gt; for the characters name and &lt;level&gt; for the characters level).";
        $this -> help['command']['autogratz addlevel &lt;level&gt; &lt;message&gt;']="Adds a congratulations message (use &lt;name&gt; for the characters name and &lt;level&gt; for the characters level).";
        $this -> help['command']['autogratz remove &lt;id&gt;']="Removes a levelling message.";
        $this -> help['command']['autogratz list']="Displays a list of levelling messages.";
    }

    function command_handler($name, $msg, $origin)
    {
        $this->error->reset(); //Reset the error message so we don't trigger the handler by old error messages.

        $com = $this->parse_com($msg, array('com', 'sub', 'level', 'message'));

        switch($com['sub'])
        {
            case 'add':
                return $this -> add_gratz(0, $com['level'].' '.$com['message']);
            case 'addlevel':
                return $this -> add_gratz($com['level'], $com['message']);
            case 'remove':
                return $this -> remove_gratz($com['level']);
            case 'list':
                return $this -> list_gratz();
        }

        return 'Please use autograts add or autogratz addlevel to add messages.';
    }

    function add_gratz($level, $message)
    {
        $level = trim($level);
        if('' == $level)
                $level = 0;

        if($this -> bot -> db -> query("INSERT INTO #___gratz_messages (level, message) VALUES (".$level.", '".mysql_real_escape_string(html_entity_decode($message))."');"))
            return 'The message has been added.';
        else
            return 'Problem occured while adding a message.';
    }

    function remove_gratz($id)
    {
        if($this -> bot -> db -> query("DELETE FROM #___gratz_messages WHERE id = '".mysql_real_escape_string($id)."';"))
            return 'The message has been removed.';
        else
            return 'A problem occured while removing the message.';
    }

    function list_gratz()
    {
        $results = $this -> bot -> db -> select("SELECT id, level, message FROM #___gratz_messages ORDER BY level, message");
        if (!empty($results))
        {
            $old_level = -1;
            $inside = "Gratz Messages\n\n";

            foreach ($results as $val)
            {
                if($old_level != $val[1])
                {
                    if(0 == $val[1])
                        $inside .= "<font color='#FFFFFF'>For All Levels :: </font>\n\n";
                    else
                        $inside .= "<font color='#FFFFFF'>For Level ".$val[1]." :: </font>\n\n";
                }

                $inside .= htmlentities($val[2])." [".$this -> bot -> core("tools") -> chatcmd("autogratz remove " . $val[0], "Delete")."]";

                $inside .= "\n\n";
                $old_level = $val[1];
            }
        }
        return "Gratz Messages :: " . $this -> bot -> core("tools") -> make_blob("click to view", $inside);
    }

    function buddy($name, $status, $level)
    {
        if(7 == $status)
        {
            // If the module is active
            if('on' == strtolower($this -> bot -> core("settings") -> get("Autogratz", "Enabled")))
            {
                if(!is_numeric($level) && !is_int((real) $level))
                {
                    $this -> bot -> log("BUDDY", "LOG", "Invalid level data");
                    return;
                }

                $user = $this -> bot -> core("chat") -> get_uname($name);
                $mem = $this -> bot -> core("notify") -> check($user);

                // Check if $name is a guild member
                if ($mem)
                {
                    $class_name = $this -> bot -> core("Whois") -> class_name[$classId];
                    $who = $this -> bot -> core("Whois") -> lookup($name);

                    $messages = $this -> bot -> db -> select("SELECT message FROM #___gratz_messages WHERE level = ".$level." ORDER BY RAND() LIMIT 1;");
                    if (empty($messages))
                    {
                        $messages = $this -> bot -> db -> select("SELECT message FROM #___gratz_messages WHERE level = 0 ORDER BY RAND() LIMIT 1;");
                        if (empty($messages))
                        {
                            $message = "Congratulations on level <level>, <name>";
                        }
                    }

                    if('' == $message)
                    {
                        $message = array_shift($messages);
                        $message = $message[0];
                    }

                    $message = str_replace('<name>', $name, $message);
                    $message = str_replace('<level>', $level, $message);
                    $message = htmlentities($message);

                    // Send Gratz message to guild chat and log the event
                    if('gc' == strtolower($this -> bot -> core("settings") -> get("Autogratz", "SendTo")))
                        $this -> bot -> send_gc($message);
                    else
                        $this -> bot -> send_tell($name, $message);
                    $this -> bot -> log("AUTOGRATZ", "LOG", $name . " achieved level " . $level);
                }
            }
        }
    }
}
?>

Offline belatu

  • BeBot Rookie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Autogratz Modul for Verison 0.6.5
« Reply #2 on: January 20, 2010, 09:53:11 am »
Hello,

what shall i do if want this to get working??

thnaks in advance

Offline snyder

  • BeBot User
  • **
  • Posts: 34
  • Karma: +0/-0
  • CRO guild
    • CRO Guild @ Crom
Re: Autogratz Modul for Verison 0.6.5
« Reply #3 on: January 20, 2010, 12:58:53 pm »
put it in your bebot dit/custom/modules/Autogratz.php
remember, utf-8 encodeing and no spaces or chars before or after php code

then you restart your bot and type to it

Code: [Select]
!autogratz add Congratulations <name>, you reached <level> level!

Offline shadowrik

  • BeBot Rookie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Autogratz Modul for Verison 0.6.5
« Reply #4 on: January 21, 2010, 04:52:21 am »
i love you guys
« Last Edit: January 21, 2010, 05:34:12 am by shadowrik »

Offline Space

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Autogratz Modul for Verison 0.6.5
« Reply #5 on: March 17, 2010, 10:58:12 am »
Hi all,

My 1st post, so please be gentle with me!!! (LOL)

I have done all of the above, and the module is loading as i can set messages and all but.... nobody gets GRATZ when lvl changes???

What am i doing wrong!

the only entry i have done is:
Code: [Select]
!autogratz add Congratulations <name>, you reached <level> level!
Which is shown in the list!!

Plz help
« Last Edit: March 17, 2010, 12:22:43 pm by Space »

Offline ripperjpx

  • BeBot Rookie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: Autogratz Modul for Verison 0.6.5
« Reply #6 on: March 17, 2010, 04:06:18 pm »
Hi guys,

I have the same problem that Space, Autogratz is running (i think) but not gets Gratz when lvl change.

[16:04] [Guild] [xxx]: !autogratz add Congratulations <name>, you reached <level> level!
[16:04] [Guild] [xxx]: The message has been added.

Gratz Messages
For All Levels ::
Congratulations <name>, you reached <level> level!

Any1 can help me?

Offline Anastasia

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Autogratz Modul for Verison 0.6.5
« Reply #7 on: March 18, 2010, 04:03:29 am »
I thought i would try this one too...

Im having same probs though as others before me...

no one is getting Congratulated :(

Any help would be awesome!!!!

Ana

Offline fowlskins

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: Autogratz Modul for Verison 0.6.5
« Reply #8 on: March 18, 2010, 03:43:25 pm »
i have this installed but it seemed to me last night that the actual guild annoucment is not appearing when people level so maby that has something to do with it

Offline Drizzurdeen

  • BeBot Apprentice
  • ***
  • Posts: 193
  • Karma: +0/-0
    • Obsidian-Cult
Re: Autogratz Modul for Verison 0.6.5
« Reply #9 on: March 18, 2010, 09:06:22 pm »
is the module set ON ???

u could set it ON in the settings !settings
maybee this would help

Offline fowlskins

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: Autogratz Modul for Verison 0.6.5
« Reply #10 on: March 18, 2010, 11:14:31 pm »
lmao yeah turning it on definatly helps

allthough having it set to default on might be a more intuitive system  ;)


Offline Space

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Autogratz Modul for Verison 0.6.5
« Reply #11 on: March 19, 2010, 04:41:45 pm »
You are DA MAN!!!

LOL  :P

All is working...

Offline ST34LTH

  • BeBot Rookie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Autogratz Modul for Verison 0.6.5
« Reply #12 on: April 04, 2010, 09:36:52 pm »
Thanks m8, its awesome
« Last Edit: April 04, 2010, 09:44:30 pm by ST34LTH »

Offline deathwarnt

  • BeBot Rookie
  • *
  • Posts: 16
  • Karma: +0/-0
Re: Autogratz Modul for Verison 0.6.5
« Reply #13 on: May 02, 2010, 01:00:52 pm »
cool yeah that was my issue, too :D

Offline deathwarnt

  • BeBot Rookie
  • *
  • Posts: 16
  • Karma: +0/-0
Re: Autogratz Modul for Verison 0.6.5
« Reply #14 on: May 03, 2010, 02:19:11 am »
hello!  first off great mod.  it's fun :d  however I do have a request.  There any way you can make it (if there isn't already) how to remove a autogratz message?  I put in some funny ones, but some don't find them so funny :O.  I tried a few things and without going into the database manualy, is there a means of removeing it?  manual db removal is not an option atm.  so can you put in a command or somethign to remove a message?  thanks

 

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