BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Age of Conan Archive => AoC 0.6.x Custom/Unofficial modules => Topic started by: Getrix on June 08, 2010, 03:28:45 pm

Title: Offline AA training timer module
Post by: Getrix on June 08, 2010, 03:28:45 pm
Just putted togheter a fast module so i didnt need to log all my 80s and check whenever i could put new AA Offline training.
I dont wanna give any promise of more functions but if anyone wants to contribute with more function you are welcome to do publish it here and be credited.

URL: http://dump.sjef.biz/aoc/bebot/TimerAA/TimerAA.phps

description:
This module helps you keep track of Offline AA time training.

command:
timeraa show <nick> Show how long time left on AA training
timeraa set 18 Set the training time for current AA. Only use hours.
Title: Re: Offline AA training timer module
Post by: Runemy on June 08, 2010, 04:15:06 pm
Thanks for this one mate! :)

But one thing, it only seems to work when I'm on the owner of the bot. Others experiencing the same?
Title: Re: Offline AA training timer module
Post by: Getrix on June 08, 2010, 05:01:40 pm
Uploaded new version.
This requires a DROP of #__timer_aa database because i changed some stuff in database. Or you can alter and add "timeraa_end" to "#__timer_aa" after "timeraa_start". But then everyone needs to update their AA timer.

Also run "!commands update all timeraa M" to be sure it works for members.

Title: Re: Offline AA training timer module
Post by: GBH on June 09, 2010, 04:34:33 pm
Cheers for this I was just starting to write my own - saved me the hassle so I owe you one ;)

G
Title: Re: Offline AA training timer module
Post by: Kyr on June 09, 2010, 07:56:34 pm
Thanks for this module!

My guild really likes it.

~Kyr
Title: Re: Offline AA training timer module
Post by: Yite on June 09, 2010, 09:41:58 pm
NOTE: These are code snippets, to use them copy them into the main module. If you are not sure about that leave it for now and wait for an updated module (if Getrix want this to be part of his module that is)

I added a new function showall (code below) basically returns a blob with the times of all alts as well.

Code: [Select]
    function timer_show_all($name, $args) {
        if (!empty($args)) {
          $name = mysql_real_escape_string($args);
        }

        $findmain = $this -> bot -> db -> select("SELECT main FROM alts WHERE alts.alt='$name'");
if (empty($findmain)) {$main=$name;}
else {$main = current($findmain[0]);}
$output = "<Center>##ao_infoheadline##:::: Offline timer info for $main and alts ::::##end##</Center>\n\n";

$chk_time = $this -> bot -> db -> select("SELECT * FROM #___timer_aa WHERE timeraa_username='$main'");
          if (!empty($chk_time)) {
            foreach ($chk_time as $aa) {
                $timeraa_start      = $aa[2];
                $timeraa_end        = $aa[3];
                $timeraa_cooldown   = $aa[4];
                $today  = time();
                $diff = $this->get_time_difference($today, $timeraa_end);

                $output .= "$main has ".$diff['days']." days, ".$diff['hours']." hour, ".$diff['minutes']." min, ".$diff['seconds']." sec left until cooldown.\n";
            }
        }
        else { $output .= "$main has no timer set.\n"; }

$altlist = $this -> bot -> db -> select("SELECT alt FROM alts WHERE alts.main='$main'");
if (!empty($altlist)) {
  foreach ($altlist as $charlist) {
   foreach ($charlist as $charname) {
    $chk_time = $this -> bot -> db -> select("SELECT * FROM #___timer_aa WHERE timeraa_username='$charname'");
            if (!empty($chk_time)) {
              foreach ($chk_time as $aa) {
                $timeraa_start      = $aa[2];
                $timeraa_end        = $aa[3];
                $timeraa_cooldown   = $aa[4];
                $today  = time();
                $diff = $this->get_time_difference($today, $timeraa_end);
                $output .= "$charname has ".$diff['days']." days, ".$diff['hours']." hour, ".$diff['minutes']." min, ".$diff['seconds']." sec left until cooldown.\n";
              }
    }
    else { $output .= "$charname has no timer set.\n"; }
  }
}
}
$output = $this -> bot -> core("tools") -> make_blob("AA timers for $main", $output);
return $output;
}

It will also need an extra case in the sub_handler:

Code: [Select]
            case 'showall':
                return($this -> timer_show_all($name, $com['args']));
            break;


Usage: (As I didn't update the help)
!timeraa showall [character]

It will find the character's main and then list all timers in a blob, if no character is specified it will show for the person who typed the command.
Title: Re: Offline AA training timer module
Post by: Getrix on June 09, 2010, 10:07:35 pm
Thanx Yite.
I modified it abit to support some changes i did in calculation in b1.0.2

// b1.0.3 Added "timeraa showall <nick>" to include alts of a chars. (Thanks to Yite@BeBot Forum)

URL: http://dump.sjef.biz/aoc/bebot/TimerAA/TimerAA.phps
Title: Re: Offline AA training timer module
Post by: dillinger on June 10, 2010, 08:21:02 am
Yeah, very nice and useful module, thanx @ Getrix! This makes the AA overview much easyer, even with 8 lvl 80 chars!  ;)
Title: Re: Offline AA training timer module
Post by: GBH on June 10, 2010, 09:56:56 am
Yay showall saved me todays bit of coding too!

You guys rock or something ;)

G
Title: Re: Offline AA training timer module
Post by: Yite on June 10, 2010, 11:15:59 am
It 'cost' me a few hours until I found that the select statement provided an array of arrays.

What I would like to still do on the showall is:
* filter out non 80's (non 80's can't train on time)
* sort the output by skill time left (probably a matter of putting the output strings in an array and sorting it
Title: Re: Offline AA training timer module
Post by: GBH on June 10, 2010, 01:04:28 pm
It 'cost' me a few hours until I found that the select statement provided an array of arrays.

Yep being a noob with PHP/SQL that caught me out a few times and I still don't completely understand why it does it.

G
Title: Re: Offline AA training timer module
Post by: Yite on June 11, 2010, 09:29:47 am
What I would like to still do on the showall is:
* filter out non 80's (non 80's can't train on time)
* sort the output by skill time left (probably a matter of putting the output strings in an array and sorting it
Still working on this, have some nice ideas but raids prevented me from executing them :)
Title: Re: Offline AA training timer module
Post by: Shendar on June 12, 2010, 04:30:14 pm
Version 1.0.3 works perfectly. Thanks for great mod.
Title: Re: Offline AA training timer module
Post by: Salpa on June 13, 2010, 07:09:38 pm
Great module, thank you for your hard work.

I just wanted to ask... what happens when the bot is down? (maintenance or something) will the time spend in offline state be counted or will it just mess things up and delay the counter, so that the actual time-left is incorrect?

Thanks for answering me :)
Title: Re: Offline AA training timer module
Post by: Getrix on June 13, 2010, 10:01:45 pm
Its not working as the !timer function. so its no real "countdown" but a fixed endtime of your timer thats always static in your database. calculation is done on each time you run the command.
Title: Re: Offline AA training timer module
Post by: Salpa on June 13, 2010, 10:46:52 pm
Thanks for answer Getrix, all i need now i your ItemDB hope you got my PM.
Thanks again :)
Title: Re: Offline AA training timer module
Post by: RaZeR on June 14, 2010, 10:19:49 am
this module is excellent :) and very useful
Title: Re: Offline AA training timer module
Post by: rmb on July 06, 2010, 12:11:31 pm
I have added some colors to the output because it was somewhat hard to read when you have lots of alts.

Now the name of the character and the time remaining is green (or lime to be precise).
If there is no timer set the name stays lime but the message is shown in red.

Modified lines:

126:
Code: [Select]
               return "Offline AA Training Timer for ##lime##$name##end## ends $timeraa_ends (##lime##$diff left of ".$timeraa_cooldown."hrs##end##)";

129:
 
Code: [Select]
else { return "##red##No timer set##end##"; }
152:
 
Code: [Select]
$output .= "##lime##$main##end## ends $timeraa_ends (##lime##$diff left of ".$timeraa_cooldown."hrs##end##)".$this->brfix();
155:
Code: [Select]
  else { $output .= "##lime##$main##end## has ##red##no timer set.##end##".$this->brfix(); }
170:
 
Code: [Select]
$output .= "##lime##$charname##end## ends $timeraa_ends (##lime##$diff left of ".$timeraa_cooldown."hrs##end##)".$this->brfix();
173:
 
Code: [Select]
else { $output .= "##lime##$charname##end## has ##red##no timer set.##end##".$this->brfix(); }
Title: Re: Offline AA training timer module
Post by: Exodus00FF on July 20, 2010, 09:31:28 pm
Is it possible to have this module, once an hour check to see which toons have an Timer which ends in 24 Hours, 6 Hours, and 1 Hour.  Then send a message using the Mail Module, Saying your Timer on <Toon Name> will be ending in X Hours.
Title: Re: Offline AA training timer module
Post by: Yite on July 21, 2010, 11:58:26 am
Anything is possible, getting someone to code it is a different matter though.

Personally I don't see the need for this as you can check the times from any of your toons, if you want that type of functionality then it might be better (and easier) to download some sort of calendar app and put the ending times in there.
Title: Re: Offline AA training timer module
Post by: heljeere on October 07, 2010, 09:52:53 am
With my 17 lvl 80s I got confused trying to read the showall output, so I rewrote it to sort the timers by when they run out. I also cleaned it up a bit so it now does all the work in a single query instead of doing one per toon.

Just replace the timer_show_all function with this:

Code: [Select]
    function timer_show_all($name, $args) {
        if (!empty($args)) {
          $name = mysql_real_escape_string($args);
        }
     
        $findmain = $this -> bot -> db -> select("SELECT main FROM alts WHERE alts.alt='$name'");
        if (empty($findmain)) {$main=$name;}
        else {$main = current($findmain[0]);}
        $output = "<Center>##ao_infoheadline##:::: Offline timer info for $main and alts ::::##end##</Center>".$this->brfix(2);

$notsetoutput = $this->brfix()."<Center>##ao_infoheadline##:::: No timers ::::##end##</Center>".$this->brfix(2);
$chk_time = $this -> bot -> db -> select("SELECT #___timer_aa.*, alts.alt FROM alts LEFT OUTER JOIN #___timer_aa ON alts.alt = timeraa_username WHERE alts.main = '$main' UNION SELECT #___timer_aa.*, '$main' AS alt FROM #___timer_aa WHERE timeraa_username = '$main' ORDER BY timeraa_end ASC");
if (!empty($chk_time)) {
foreach ($chk_time as $aa) {
  $timeraa_start      = $aa[2];
  $timeraa_end        = $aa[3];
  $timeraa_ends       = date("M d H:i:s",$timeraa_end);
  $timeraa_cooldown   = $aa[4];
  $today  = time();
  $diff = $this->get_time_difference($today, $timeraa_end);
  if (!empty($aa[1])) $output .= "##lime##".$aa[5]."##end## ends $timeraa_ends (##lime##$diff left of ".$timeraa_cooldown."hrs##end##)".$this->brfix();
  else $notsetoutput .= $aa[5].$this->brfix();
}
}
       
        $output = $this -> bot -> core("tools") -> make_blob("AA timers for $main", $output.$notsetoutput);
        return $output;
    }
Title: b1.0.4 uploaded
Post by: Getrix on October 07, 2010, 12:39:23 pm
Thanks heljeere!
Added the changes and updated the file in link: http://dump.sjef.biz/aoc/bebot/TimerAA/TimerAA.phps

Quote
b1.0.4 Rewrote "showall" to sort the timers by when they run out. Also cleaned it up a bit so it now does all the work in a single query instead of doing one per toon. (Credits: [email protected]/Crom)
Title: Re: Offline AA training timer module
Post by: Kyr on October 09, 2010, 08:19:40 am
This version lets you add the AA you are time training to the list.

Also, it adds some color.

Enjoy.

~Kyr

Edit: Small change to fix a bug when an AA name wasn't included.
Title: Re: Offline AA training timer module
Post by: SalmonSeller on November 14, 2010, 09:47:30 pm
Is there any way to have the aa timer info that this module returns displayed as text straight into chat. The reason I ask is that I have been using Conan Chat (Conan To Go now I guess), and whilst you can ping the bot, the links that it returns are of no use on the iPod/iPhone, mobile device, etc.

Perhaps a slightly different command, still sent to the same module though, but would recognise it as to be responded to/displayed in the chat directly, as opposed to creating a link/info box. Currently I get around this by pinging the aatimer module in the bot, and just get someone who is actually in-game to copy and paste my timers to me in chat.
Title: Re: Offline AA training timer module
Post by: Yite on November 15, 2010, 09:15:23 am
!timeraa show
Will show you the timer for the character you're logged in as in chat.
Title: Re: Offline AA training timer module
Post by: Kyr on November 15, 2010, 06:33:35 pm
Toon you are logged in on:
Code: [Select]
!timeraa show
Show your toon1, toon2 and toon3:
Code: [Select]
!timeraa show toon1
!timeraa show toon2
!timeraa show toon3

showall will make the link.

Code: [Select]
[Guild] [Toon]: !timeraa show
[Guild] [Bot]: Offline AA Training Timer Toon ends Nov 18 12:13:46 (2 days 18 hours 45 minutes 41 seconds left of 540 hrs) Chromatic Warding V

Code: [Select]
[Guild] [Toon]: !timeraa show Toon2
[Guild] [Bot]: Offline AA Training Timer Toon2 ends Nov 20 03:24:17 (4 days 9 hours 51 minutes 0 seconds left of 126 hrs) Expanded BtD III
Title: Re: Offline AA training timer module
Post by: Kentarii on November 20, 2010, 02:56:31 am
Thanks for this module Getrix and friends  :D

Edit: don't want to hijack this thread
Title: Re: Offline AA training timer module
Post by: SalmonSeller on November 22, 2010, 10:38:24 am
Aha! Much appreciated Kyr & Yite   :D
Title: Re: Offline AA training timer module
Post by: Yite on November 22, 2010, 11:01:28 am
Hey Kentarii,

I've played EvE so I know where you're coming from.

There is no API for Conan though so all information would still have to be stored manually.
Title: Re: Offline AA training timer module
Post by: Getrix on November 23, 2010, 05:18:19 pm
Thanks Kyr!
Added the changes and updated the file in link: http://dump.sjef.biz/aoc/bebot/TimerAA/TimerAA.phps

Quote
b1.0.5 Added optional name of AA being trained (Thanks to [email protected])
Title: Re: Offline AA training timer module
Post by: Oolwe on February 10, 2011, 11:26:23 am
Hi,

is it possible to make this script to send an email alarm to a specified mail by user please ?

thxxxx ;)
regards.
Title: Re: Offline AA training timer module
Post by: Yite on February 10, 2011, 02:04:56 pm
That would mean having a mail server configured and having a function checking on expired (or about to expire) timers all the time.

I'd think the best way to do this would be to create something outside of bebot that checks the database.
Title: Re: Offline AA training timer module
Post by: Oolwe on February 10, 2011, 04:13:52 pm
mail can be send from a ISP smtp relay no ?
Title: Re: Offline AA training timer module
Post by: Kyr on March 04, 2011, 09:55:08 am
I hate to say it, since Getrix others have put so much work into this module, but the AAMon module has more features.

Check it out here: http://aoc-is.better-than.tv/aamon.php (http://aoc-is.better-than.tv/aamon.php)

You can use this to set an alarm on your desktop when you need to set an AA.

Title: Re: b1.0.4 uploaded
Post by: dragonjr on November 08, 2012, 02:56:11 am
Thanks heljeere!
Added the changes and updated the file in link: http://dump.sjef.biz/aoc/bebot/TimerAA/TimerAA.phps

Quote
b1.0.4 Rewrote "showall" to sort the timers by when they run out. Also cleaned it up a bit so it now does all the work in a single query instead of doing one per toon. (Credits: [email protected]/Crom)

if i copy whats hear for the coding and paste it on what i have i should be fine right?

is that how i update the version that im running now?
and is there anything i have to do in game to make it work
Title: Re: Offline AA training timer module
Post by: dragonjr on November 11, 2012, 01:03:55 pm
i figured it out im just a idot
Title: Re: Offline AA training timer module
Post by: Ruskebusk on August 29, 2019, 11:12:14 pm
I added a logon notify if the user does not have a timer set.

Wanted to share it as I find it usefull  :D

EDIT: Didnt get it to work properly :(

EDIT2: Got it to work! If it doesnt work for you please tell me.

https://www.dropbox.com/s/muwlf87cvsenbcv/TimerAA.php?dl=0
SimplePortal 2.3.7 © 2008-2024, SimplePortal