# Special Script for Frontiers (http://btmux.com)

my $version="2007-10-24";


statusWindow->print(ansi('%cm%cu%chXperthud script for Frontier Lands%cn %cx%chVersion '.$version.'%cn%r'));
addDelayed("Frontiers_AD",60,sub {
             XM::sendText('@force me=@doing %cb%chhttp://xpertmud.btmux.com/'."\n");
});


setWriteRegExps(qr/^$/, qr/^\#HUD|^MOTD/);

addTrigger("STARTUP",qr/MOTD/,sub {
  parse("xperthud.pl");
  parse("battlerecorder.pl");
  delDelayed(qr/^IDLE$/);
  addDelayed("IDLE",25*60,sub {
     setDelayed(qr/^IDLE/,25*60);
     normalMode();
  });
  addDelayed("version_check",5,sub {
     XM::sendText("xpertmud_version $version\n");  
  });

  delTrigger(qr/^STARTUP$/);
  delDelayed(qr/^Advertisment$/);
  
  addTimer("BT_HOUSEKEEP",61,sub {
    my @vars=qw/ID AC SE UT MN X Y Z RN BR SP VS HD JH RTC BTC TN HT FL AG/;
    foreach my $c ($battleCore->getContacts) {
      my @v=@vars;
      my %con=map {(shift @v)=>$_} split /\|/, $battleCore->getContact($c);
      if ($con{AG}>60 and $con{FL}=~/D/) {
        $battleCore->deleteContact($c);
      }
    }
  },0);

  my $oldOwnID="";
  addTimer("BT_AUTOCENTER",15,sub {
    my $oid=$battleCore->getOwnID();
    if (defined $oid and $oid ne $oldOwnID) {
      $oldOwnID=$oid;
      $Map->centerMech($oid);
    }
  },0);
  
  shift;
});

parse("completion.pl");

addTrigger("COMLETION",qr/\] (\w[\w\s]+\w):/,sub { addCompletionWord($1); shift; });
addTrigger("COMLETION",qr/^(\w[\w\s]+\w) says/,sub { addCompletionWord($1); shift; });
addTrigger("COMLETION",qr/^(\w[\w\s]+\w) has/,sub { addCompletionWord($1); shift; });

parse("damagelog.pl");

