int boredom_level()
{
buffer charpane = visit_url( "charpane.php" );
// Full
matcher Boredom = create_matcher( "Boredom:</td><td><b><font color=blue>(\\d+)%", charpane );
if( Boredom.find() ) return Boredom.group( 1 ).to_int();
// Compact
matcher Bored = create_matcher("Bored:</td><td aligh=left><b><font color=blue>(\\d+)%", charpane );
if( Bored.find() ) return Bored.group( 1 ).to_int();
return 0;
}
int boredom_inc( string page )
{
if( contains_text( page , "choice.php" ) )Abort("Unknown Choice");
matcher bored_inc = create_matcher( "<td valign=center><b>Boredom (\\+|-)(\\d+)%", page );
if( bored_inc.find() )
{
int fac = 1;
if( bored_inc.group( 1 ) == "-" ) fac = -1;
return fac * bored_inc.group( 2 ).to_int();
}
return 0;
}
void main(int maxBoredom)
{
if( !contains_text( visit_url( "mountains.php" ) , "crimbcohq.gif" ) )
{
print( "I'm sorry, Crimbo2010 is currently closed!","red" );
return;
}
Print("Crimbo 2010, Wasteing Adventures the Easy Way","blue");
int B = boredom_level();
int S=item_amount($item[CRIMBCO scrip]);
int A= my_adventures();
print("Starting Boredom: "+B+"%","blue");
while( B < maxBoredom && my_adventures()!=0 )
{
adventure(1, $location[CRIMBCO cubicles]);
B += boredom_inc( run_combat() );
print("Boredom: "+B+"%","olive");
}
S=(item_amount($item[CRIMBCO scrip])-S);
A=(A- my_adventures());
print("");
print("Finish Boredom: "+B+"%","red");
print("You gained "+S+" script using "+A+" adventures.","blue");
if(A==0) A=1;
print("SPA: "+(S/A),"green");
print("Current Crimbco Scrip: "+item_amount($item[CRIMBCO scrip]),"green");
}