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: Rufussondheim on April 12, 2011, 07:06:33 pm
-
I am dumb or I would do it. But is it possible for someone to redo the timeraa module so one could keep track of one's lockout on the refuge of the apostate solo instance.
-
It's probably not the right module.
Would be better to add Apostate to the !bound plugin, and should be easy to change yourself when you look at it.
-
iirc !bound is set to auto clear when raids reset -- refgue is 20hrs from when you kill the last boss and leave the instance.
-
the !timeraa module would be better, although it would be too complex.
I know nothing about programming. Can't even tell what language the code is in. So even if I did have the confidence to do it, I doubt I could.
It's ok if it's not done, it's just a request, a few of us in a pug raid thought it would be useful to a lot of people.
-
i called mine Locked and it is the timeraa module indeed ( i had the same idea )
<?php
/*
* locked.php - locked.
* <Copyright Getrix @ Fury AoC>
* <Credits>
* [email protected]
* [email protected]/Crom
* [email protected]
* </Credits>
*/
$version = "b1.0.5 - 2010-10-09";
// b1.0.5 Added optional name of AA being trained (Thanks to [email protected])
// 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)
// b1.0.3 Added "timeraa showall <nick>" to include alts of a chars. (Thanks to [email protected])
// b1.0.2 Recoded diff calculation and some minor text changes
// b1.0.1 Command access fixed and change in database. Clean of old structur needed (DROP #__timer_aa)
// b1.0.0 First release.
/*
* BeBot - An Anarchy Online & Age of Conan Chat Automaton
* Copyright (C) 2004 Jonas Jax
* Copyright (C) 2005-2007 Thomas Juberg Stensås, ShadowRealm Creations and the BeBot development team.
*
*/
$locked = new locked($bot);
$locked -> version = $version;
class locked extends BaseActiveModule
{
var $version;
function __construct (&$bot)
{
/* Constructor: Hands over a referance to the "Bot" class. */
//Initialize the base module
parent::__construct(&$bot, get_class($this));
$this -> bot -> db -> query("CREATE TABLE IF NOT EXISTS " . $this -> bot -> db -> define_tablename("locked_refuge", "true") . " (
`Locked_id` int(11) NOT NULL AUTO_INCREMENT,
`Locked_username` varchar(255) DEFAULT NULL,
`Locked_start` varchar(255) DEFAULT NULL,
`Locked_end` varchar(255) DEFAULT NULL,
`Locked_cooldown` int(11) DEFAULT NULL,
PRIMARY KEY (`Locked_id`))");
$this -> update_table();
$this -> register_command('all', 'locked', 'MEMBER');
$this -> help['description'] = "This module helps you keep track the instance locked time of refuge.";
$this -> help['command']['locked show <nick>'] = "Show how long time left on refuge.";
$this -> help['command']['locked showall <nick>'] = "Show how long time left on refuge on all chars for user.";
$this -> help['command']['locked set 18'] = "Set the time for current refuge. Only use hours.";
$this -> help['command']['locked set 18 <name of zone>'] = "Set the training time for current refuge. Only use hours, with optional name of zone.";
$this -> help['notes'] = "(C) Module By Pat\n";
}
function update_table()
{
Switch($this -> bot -> db -> get_version("locked_refuge"))
{
case 1:
$this -> bot -> db -> update_table("locked_refuge", "locked_name", "add",
"ALTER IGNORE TABLE #___locked_refuge ADD locked_name varchar(100)");
Default:
}
$this -> bot -> db -> set_version("locked_refuge", 2);
}
function command_handler($name, $msg, $origin)
{
/*
Unified message handler
$source: The originating player
$msg: The actual message, including command prefix and all
$type: The channel the message arrived from. This can be either "tell", "pgmsg" or "gc"
*/
$com = $this->parse_com($msg);
switch($com['com'])
{
case 'locked':
return($this -> sub_handler($name, $com, 1));
break;
default:
return "Error 1";
break;
}
}
function sub_handler($name, $com, $type)
{
switch($com['sub'])
{
case 'set':
return($this -> timer_set($name, $com['args']));
break;
case 'show':
return($this -> timer_show($name, $com['args']));
break;
case 'showall':
return($this -> timer_show_all($name, $com['args']));
break;
default:
//return($this -> donate($name, $com['sub']));
return("Not added");
break;
}
}
function timer_set($name, $args) {
$arr = explode(" ", $args);
$firstspace = strpos($args, ' ');
$locked_username = mysql_real_escape_string($name);
$locked_cooldown = mysql_real_escape_string($arr[0]);
$locked_start = time();
$locked_end = $this->utime_add($locked_start, $locked_cooldown);
$locked_name = "";
if ($firstspace != 0)
$locked_name = substr($args, $firstspace + 1);
if (!is_numeric($locked_cooldown)) { return $locked_cooldown." is not a number"; }
$chk_time = $this -> bot -> db -> select("SELECT * FROM #___locked_refuge WHERE locked_username='$name'");
if (empty($chk_time)) {
$sql = "INSERT INTO #___locked_refuge (locked_username, locked_cooldown, locked_start, locked_end, locked_name) VALUES ('$locked_username', '$locked_cooldown', '$locked_start', '$locked_end', '$locked_name')";
}
else {
$sql = "UPDATE #___locked_refuge SET locked_username='$locked_username', locked_cooldown='$locked_cooldown', locked_start='$locked_start', locked_end='$locked_end', locked_name='$locked_name' WHERE locked_username='$name'";
}
$this -> bot -> db -> query($sql);
return "refuge time set for ##lime##$locked_username##end## with Cooldown ##fuchsia##$locked_cooldown##end## ##aqua##$locked_name##end##";
}
function timer_show($name, $args) {
if (!empty($args)) {
$name = mysql_real_escape_string($args);
}
$chk_time = $this -> bot -> db -> select("SELECT * FROM #___locked_refuge WHERE locked_username='$name'");
if (!empty($chk_time)) {
foreach ($chk_time as $refuge) {
$locked_start = $refuge[2];
$locked_end = $refuge[3];
$locked_ends = date("M d H:i:s",$locked_end);
$locked_cooldown = $refuge[4];
$locked_name = $refuge[5];
$today = time();
$diff = $this->get_time_difference($today, $locked_end);
return "Offline Instance Timer ##lime##$name##end## ends $locked_ends (##fuchsia##$diff left of $locked_cooldown hrs##end##) ##aqua##$locked_name##end##";
}
}
else { return "No timer set"; }
}
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 #___locked_refuge.*, alts.alt FROM alts LEFT OUTER JOIN #___locked_refuge ON alts.alt = locked_username WHERE alts.main = '$main' UNION SELECT #___locked_refuge.*, '$main' AS alt FROM #___locked_refuge WHERE locked_username = '$main' ORDER BY locked_end ASC");
if (!empty($chk_time)) {
foreach ($chk_time as $refuge) {
$locked_start = $refuge[2];
$locked_end = $refuge[3];
$locked_ends = date("M d H:i:s",$locked_end);
$locked_cooldown = $refuge[4];
$locked_name = $refuge[5];
$today = time();
$diff = $this->get_time_difference($today, $locked_end);
if (!empty($refuge[1])) $output .= "##lime##".$refuge[6]."##end## ends $locked_ends (##fuchsia##$diff left of ".$locked_cooldown."hrs##end##) ##aqua##$locked_name##end##".$this->brfix();
else $notsetoutput .= $refuge[6].$this->brfix();
}
}
$output = $this -> bot -> core("tools") -> make_blob("refuge timers for ##lime##$main##end##", $output.$notsetoutput);
return $output;
}
function utime_add($unixtime, $hr=0, $min=0, $sec=0, $mon=0, $day=0, $yr=0) {
$dt = localtime($unixtime, true);
$unixnewtime = mktime(
$dt['tm_hour']+$hr, $dt['tm_min']+$min, $dt['tm_sec']+$sec,
$dt['tm_mon']+1+$mon, $dt['tm_mday']+$day, $dt['tm_year']+1900+$yr
);
return $unixnewtime;
}
function get_time_difference( $start, $end ) {
$uts['start'] = $start ;
$uts['end'] = $end ;
if( $uts['start']!==-1 && $uts['end']!==-1 ) {
if( $uts['end'] >= $uts['start'] ) {
$diff = $uts['end'] - $uts['start'];
if( $days=intval((floor($diff/86400))) )
$diff = $diff % 86400;
if( $hours=intval((floor($diff/3600))) )
$diff = $diff % 3600;
if( $minutes=intval((floor($diff/60))) )
$diff = $diff % 60;
$diff = intval( $diff );
$diffs = array();
if ($days != "0") { $diffs['days'] = $days; }
if ($hours != "0") { $diffs['hours'] = $hours; }
if ($minutes != "0") { $diffs['minutes'] = $minutes; }
if ($seconds != "0") { $diffs['seconds'] = $diff; }
foreach ($diffs as $key=>$df) {
$diff_text .= $df." ".$key." ";
}
return $diff_text;
}
else { return "0"; }
}
else { return "Invalid date/time data detected"; }
return( false );
}
function brfix($count=1) {
if ($count == 2) { $br = "<b></b><br><b></b><br>";}
elseif ($count == 3) { $br = "<b></b><br><b></b><br><b></b><br>"; }
else { $br = "<b></b><br>"; }
return $br;
}
}
?>
-
I just use the !timer module on my main to keep track of the lockout. It can have multiple timers running. The only issue is I have to log on to my main after my alt runs to set it, and you can't check it from any toon like the AA one.
-
Another useful application I used for tracking AA before I made AAMon was Swizztool.
It lets you add timers and sits neatly in the tray until the timer runs out.
http://www.specop.se/index.php?action=swizztool
-
Bound Tracker is rewritten to support this request
http://bebot.link/generic-custom-modules/instance-bound-tracker/msg17156/#msg17156