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>.";
}
}
}
?>