BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: Wanuarmi on December 17, 2005, 05:57:47 am
-
This will show if the current day is Clan/Omni/FFA Beast day. (oh btw this is for Atlantean RK1)
Id like some feedback as I can have made a mistake somewhere.
!beastday
modules/BeastDay.php
<?
$beastDay = new BeastDay($bot);
$commands["tell"]["beastday"] = &$beastDay;
$commands["pgmsg"]["beastday"] = &$beastDay;
$commands["gc"]["beastday"] = &$beastDay;
class BeastDay
{
var $bot;
var $start_date;
var $day_cycle;
var $omni_color;
var $clan_color;
var $ffa_color;
function BeastDay (&$bot)
{
$this -> bot = &$bot;
$this -> day_cycle = 6 + 2 + 6 + 2;
$this -> start_date = gmmktime(0, 0, 0, 12, 3, 2005);
$this -> omni_color = "#FFFF31";
$this -> clan_color = "#00FF00";
$this -> ffa_color = "#FF0000";
}
function tell($name, $msg)
{
$this -> bot -> send_tell($name, $this -> beast_day());
}
function pgmsg($name, $msg)
{
$this -> bot -> send_pgroup($this -> beast_day());
}
function gc($name, $msg)
{
$this -> bot -> send_gc($this -> beast_day());
}
function beast_day()
{
$ocolor = $this -> omni_color;
$ccolor = $this -> clan_color;
$fcolor = $this -> ffa_color;
$seconds_since_start = gmmktime() - $this -> start_date;
$seconds = $seconds_since_start % ($this -> day_cycle * (24*60*60));
$days = floor( $seconds / (24*60*60) ) + 1;
if ($days <= 6)
{
$end = 6 - $days;
return "Today is <font color=$ocolor>Omni</font> day $days. There are $end more days until <font color=$fcolor>FFA</font>.";
}
else if ($days > 6 && $days <= 8)
{
$end = 8 - $days;
$day = $days - 6;
return "Today is <font color=$fcolor>FFA</font> day $day. There are $end more days until <font color=$ccolor>Clan</font>.";
}
else if ($days > 8 && $days <= 14)
{
$end = 14 - $days;
$day = $days - 8;
return "Today is <font color=$ccolor>Clan</font> day $day. There are $end more days until <font color=$fcolor>FFA</font>.";
}
else if ($days > 14)
{
$end = 16 - $days;
$day = $days - 14;
return "Today is <font color=$fcolor>FFA</font> day $day. There are $end more days until <font color=$ocolor>Omni</font>.";
}
}
}
?>
-
updated, fixed a typo in a variable
-
updated, put in the right starting day
-
http://jjones.kicks-ass.net/files/beastday.php
- updated for 7/7/7.
- shows 7 days previous and 14 in front.
- appalling code but works.
-jj-
-
Some quick changes to make code "cleaner" (and also help people set day interval).
var $start;
var $end;
....
$this->start = -7;
$this->end = 14;
....
for($i=$this->start;$i<=$this->end;$i++)
$list.=$this->beast_day_calc(gmmktime($hours,$minutes,$seconds,$month,$day+$i,$year));
-
Cheers :-)
-jj-
-
Different order of days, please update.
Blame Coen :-P
if ($days <= 7)
{
return "$dateis is <font color=$ocolor>FFA</font> day $days.\n";
}
else if ($days >= 8 && $days <= 14)
{
$day = $days - 7;
return "$dateis is <font color=$fcolor>Omni</font> day $day.\n";
}
else if ($days >= 15)
{
$day = $days - 14;
return "$dateis is <font color=$ccolor>Clan</font> day $day.\n";
}
-
http://jjones.kicks-ass.net/files/beastday.php
Updated to reflect new order : FFA/Clan/Omni.
Blame Coen['s hairdresser] again!
Or you can just manually change the code if u use Wolfbiter's version.
-jj-
-
Well, originally this was just going to be a help file, but I didn't like that you had to click the calendar to get the current day, so I changed it. Of course, if you prefer the previous version, you can still use this help file with it.
specifically, I changed
[Bot]: Beastday Calendar :: <a>click to view</a>
to
[Bot]: Sat 06 Jan 07 is FFA day 6. :: <a>Beastday Calendar</a>
edit: oops, uploaded the helpfile twice instead of the php file. fixed.