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

Title: Beast Day (RK1 - hellcom/pandebot 6 2 6 2 deal)
Post 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
Code: [Select]
<?
$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>.";
}
}

}
?>
Title: Re: Beast Day
Post by: Wanuarmi on December 17, 2005, 07:45:48 am
updated, fixed a typo in a variable
Title: Re: Beast Day
Post by: Wanuarmi on December 17, 2005, 08:34:11 pm
updated, put in the right starting day
Title: Re: Beast Day (RK1 - hellcom/pandebot 6 2 6 2 deal)
Post by: jjones666 on October 22, 2006, 11:30:23 pm
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-
Title: Re: Beast Day (RK1 - hellcom/pandebot 6 2 6 2 deal)
Post by: Wolfbiter on October 23, 2006, 12:12:46 am
Some quick changes to make code "cleaner" (and also help people set day interval).

Code: (As usual, don't try and add this if you have no idea what you're doing) [Select]
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));

Title: Re: Beast Day (RK1 - hellcom/pandebot 6 2 6 2 deal)
Post by: jjones666 on October 23, 2006, 12:14:36 am
Cheers :-)

-jj-
Title: Re: Beast Day (RK1 - hellcom/pandebot 6 2 6 2 deal)
Post by: jjones666 on October 30, 2006, 08:32:17 am
Different order of days, please update.
Blame Coen :-P

Code: [Select]
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";
}
Title: Re: Beast Day (RK1 - hellcom/pandebot 6 2 6 2 deal)
Post by: jjones666 on December 13, 2006, 01:51:03 am
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-
Title: Re: Beast Day (RK1 - hellcom/pandebot 6 2 6 2 deal)
Post by: Areteh on January 06, 2007, 12:07:21 pm
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.
SimplePortal 2.3.7 © 2008-2025, SimplePortal