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
-
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.
-
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?
-
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.
-
Cheers for this I was just starting to write my own - saved me the hassle so I owe you one ;)
G
-
Thanks for this module!
My guild really likes it.
~Kyr
-
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.
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:
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.
-
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
-
Yeah, very nice and useful module, thanx @ Getrix! This makes the AA overview much easyer, even with 8 lvl 80 chars! ;)
-
Yay showall saved me todays bit of coding too!
You guys rock or something ;)
G
-
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
-
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
-
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 :)
-
Version 1.0.3 works perfectly. Thanks for great mod.
-
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 :)
-
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.
-
Thanks for answer Getrix, all i need now i your ItemDB hope you got my PM.
Thanks again :)
-
this module is excellent :) and very useful
-
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:
return "Offline AA Training Timer for ##lime##$name##end## ends $timeraa_ends (##lime##$diff left of ".$timeraa_cooldown."hrs##end##)";
129:
else { return "##red##No timer set##end##"; }
152:
$output .= "##lime##$main##end## ends $timeraa_ends (##lime##$diff left of ".$timeraa_cooldown."hrs##end##)".$this->brfix();
155:
else { $output .= "##lime##$main##end## has ##red##no timer set.##end##".$this->brfix(); }
170:
$output .= "##lime##$charname##end## ends $timeraa_ends (##lime##$diff left of ".$timeraa_cooldown."hrs##end##)".$this->brfix();
173:
else { $output .= "##lime##$charname##end## has ##red##no timer set.##end##".$this->brfix(); }
-
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.
-
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.
-
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:
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;
}
-
Thanks heljeere!
Added the changes and updated the file in link: http://dump.sjef.biz/aoc/bebot/TimerAA/TimerAA.phps
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)
-
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.
-
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.
-
!timeraa show
Will show you the timer for the character you're logged in as in chat.
-
Toon you are logged in on:
!timeraa show
Show your toon1, toon2 and toon3:
!timeraa show toon1
!timeraa show toon2
!timeraa show toon3
showall will make the link.
[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
[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
-
Thanks for this module Getrix and friends :D
Edit: don't want to hijack this thread
-
Aha! Much appreciated Kyr & Yite :D
-
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.
-
Thanks Kyr!
Added the changes and updated the file in link: http://dump.sjef.biz/aoc/bebot/TimerAA/TimerAA.phps
b1.0.5 Added optional name of AA being trained (Thanks to [email protected])
-
Hi,
is it possible to make this script to send an email alarm to a specified mail by user please ?
thxxxx ;)
regards.
-
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.
-
mail can be send from a ISP smtp relay no ?
-
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.
-
Thanks heljeere!
Added the changes and updated the file in link: http://dump.sjef.biz/aoc/bebot/TimerAA/TimerAA.phps
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
-
i figured it out im just a idot
-
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