X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=covop.pl;h=daf782458281a2e46a1257e236415e101f66c2fe;hb=dfdaf29be0eb73b0b900ce3bced443120b1fca96;hp=180a0a4f05412cb4c814e641cd033c520e189504;hpb=1b53b46299c5a8a8a89b1c7d916e1234d9d064a8;p=ndwebbie.git diff --git a/covop.pl b/covop.pl index 180a0a4..daf7824 100644 --- a/covop.pl +++ b/covop.pl @@ -18,6 +18,7 @@ #**************************************************************************/ use strict; +use warnings FATAL => 'all'; $ND::TEMPLATE->param(TITLE => 'CovOp Targets'); @@ -28,15 +29,15 @@ our $LOG; die "You don't have access" unless isMember(); my $show = q{AND ((planet_status IS NULL OR NOT planet_status IN ('Friendly','NAP')) AND (relationship IS NULL OR NOT relationship IN ('Friendly','NAP')))}; -$show = '' if param('show') eq 'all'; -if (param('covop') =~ /^(\d+)$/){ +$show = '' if defined param('show') && param('show') eq 'all'; +if (defined param('covop') && param('covop') =~ /^(\d+)$/){ my $update = $DBH->prepare('UPDATE covop_targets SET covop_by = ?, last_covop = tick() WHERE planet = ? '); $update->execute($ND::UID,$1); } my $list = ''; my $where = ''; -if (param('list') eq 'distwhores'){ +if (defined param('list') && param('list') eq 'distwhores'){ $list = '&list=distwhores'; $where = qq{WHERE dists > 0 $show ORDER BY dists DESC,COALESCE(sec_centres::float/structures*100,0)ASC} @@ -57,10 +58,12 @@ FROM covop_targets c JOIN current_planet_stats p ON p.id = c.planet $query->execute($ND::PLANET); my @targets; +my $i = 0; while (my ($id,$coords,$metal,$crystal,$eonium,$seccents,$dists,$lastcovop,$user,$max) = $query->fetchrow){ + $i++; push @targets,{Username => $user, Target => $id, Coords => $coords , Metal => $metal, Crystal => $crystal, Eonium => $eonium, SecCents => $seccents - , Dists => $dists, MaxResHack => $max, LastCovOp => $lastcovop, List => $list}; + , Dists => $dists, MaxResHack => $max, LastCovOp => $lastcovop, List => $list, ODD => $i % 2}; } $BODY->param(Targets => \@targets);