X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=raids.pl;h=3d474b59bacc19dafe8b93db3e89ead25738ea2a;hb=cdd543f418350bf065d586dee2f544536a2a1c6f;hp=535a1bb131e496a211a276c4d0fc653d6cc74ad7;hpb=8d1ec9372fa9786009022fca3503ef3c79974f3e;p=ndwebbie.git diff --git a/raids.pl b/raids.pl index 535a1bb..3d474b5 100644 --- a/raids.pl +++ b/raids.pl @@ -156,6 +156,11 @@ if ($XML && $raid && param('cmd') eq 'update' ){ } generateClaimXml($raid,$from); } +if ($XML && param('cmd') eq 'gettargets' ){ + $_ = listTargets(); + chop; + $BODY->param(TargetList => $_); +} unless ($XML){ $ND::TEMPLATE->param(TITLE => 'Raids'); @@ -186,6 +191,7 @@ ORDER BY size}); while (my $target = $targetquery->fetchrow_hashref){ my %target; $target{Id} = $target->{id}; + $target{Ajax} = $ajax; my $num = pow(10,length($target->{score})-2); $target{Score} = ceil($target->{score}/$num)*$num; $num = pow(10,length($target->{value})-2); @@ -197,6 +203,31 @@ ORDER BY size}); $num = pow(10,length($target->{resvalue})-2); $target{ResValue} = floor($target->{resvalue}/$num)*$num; $target{comment} = parseMarkup($target->{comment}) if ($target->{comment}); + + my $scans = $DBH->prepare(q{SELECT DISTINCT ON (type) type, tick, scan FROM scans + WHERE planet = ? AND type ~ 'Unit|Planet|Military|.* Analysis' AND tick + 24 > tick() + GROUP BY type, tick, scan ORDER BY type ,tick DESC}); + $scans->execute($target->{planet}); + my %scans; + while (my $scan = $scans->fetchrow_hashref){ + $scans{$scan->{type}} = $scan; + } + + my @scans; + for my $type ('Planet','Unit','Military','Surface Analysis','Technology Analysis'){ + next unless exists $scans{$type}; + my $scan = $scans{$type}; + if ($ND::TICK - $scan->{tick} > 5){ + $scan->{scan} =~ s{