- if($type eq 'Surface Analysis'){
- my $f = $dbh->prepare("UPDATE covop_targets SET structures = ?, sec_centres = ?, dists = ? WHERE planet = ?");
- if ($f->execute($total,$sec,$dist,$planet) < 1){
- $f = $dbh->prepare("INSERT INTO covop_targets (planet,structures, sec_centres, dists) VALUES(?,?,?,?)");
- $f->execute($planet,$total,$sec,$dist);
- }
- }
- } elsif($type eq 'Military'){
- $scantext .= "<table>\n";
- my $i = 1;
- my @totals = (0,0,0,0);
- my @eta = (8,8,8,8);
- my $f = $dbh->prepare(qq{SELECT "type","class" FROM ship_stats WHERE name = ?});
- while($file =~ m/big left">((?:[a-zA-Z]| )+)<\/t[dh]>.*?center>(\d+).*?center>(\d+).*?center>(\d+).*?center>(\d+)/sg){
- next if ($2+$3+$4+$5 == 0);
- my @ships = ($2,$3,$4,$5);
- my $row = "odd";
- my ($type,$class) = $dbh->selectrow_array($f,undef,$1);
- #print "$1 $type\n";
- $row = "even" if ($i % 2 == 0);
- $scantext .= "<tr class=\"$row\"><td>$1</td><td>$2</td><td>$3</td><td>$4</td><td>$5</td></tr>\n";
- $i++;
- unless ($type eq "Cloak"){
- $totals[0] += $2;
- $totals[1] += $3;
- $totals[2] += $4;
- $totals[3] += $5;
- }
- foreach my $i (0,1,2,3){
- if ($ships[$i] > 0 && $eta[$i] < 9 && ($class =~ /Frigate|Destroyer/)){
- $eta[$i] = 9;
- }elsif ($ships[$i] > 0 && $eta[$i] < 10 && ($class =~ /Cruiser|Battleship/)){
- $eta[$i] = 10;
- }
- }
+ } elsif($type eq 'Unit' || $type eq 'Advanced Unit'){
+ my $id = addfleet($type,'Full fleet',$file,$planet,undef,$tick,undef,undef,undef);
+ $fleetscan->execute($id,$scan->{id}) or die $dbh->errstr;
+ } elsif($type eq 'Incoming'){
+ while($file =~ m{class="left">Fleet: (.*?)</td><td class="left">Mission: (\w+)</td></tr>(.*?)Total Ships: (\d+)}sg){
+ my $id = addfleet($1,$2,$3,$planet,undef,$tick,undef,undef,$4);
+ $fleetscan->execute($id,$scan->{id}) or die $dbh->errstr;