]> ruin.nu Git - NDIRC.git/commitdiff
Show number of dists on scan requests
authorMichael Andreen <harv@ruin.nu>
Wed, 4 Nov 2009 18:57:52 +0000 (19:57 +0100)
committerMichael Andreen <harv@ruin.nu>
Wed, 4 Nov 2009 18:57:52 +0000 (19:57 +0100)
Commands/Scans.pm

index ffc8e184023a0b31d09ce894de92346ae103cff3..06ae96f960e93bfd352d1ee0cf142a9ef8353c03 100644 (file)
@@ -52,8 +52,11 @@ sub gs
        $typeid = $scanid{$typeid};
        my $type = $scantypes[$typeid-1];
 
-       my $planet = $c->model->selectrow_array(q{SELECT planetid($1,$2,$3,tick())}
-               ,undef,$x,$y,$z);
+       my ($planet,$dists,$tick) = $c->model->selectrow_array(q{
+SELECT pid,distorters,tick
+FROM current_planet_stats LEFT JOIN current_development_scans USING (pid)
+WHERE x = $1 AND y = $2 AND z = $3
+               },undef,$x,$y,$z);
        unless ($planet){
                $c->reply("There is no planet with coords $x:$y:$z, try again after the tick.");
                return;
@@ -93,9 +96,15 @@ VALUES($1,$2,$3,$4) RETURNING (id)
                }
 
                if ($id){
+
+                       if (defined $dists){
+                               $dists = "$dists dists PT$tick"
+                       }else{
+                               $dists = "DISTS UNKNOWN, ADD DEVSCAN"
+                       }
                        $c->message(privmsg => $c->disp->targets->{scan}
                                ,"<b>$id</b> http://game.planetarion.com/waves.pl?id=$typeid&x=$x&y=$y&z=$z"
-                               . " ($x:$y:$z $type) | <".$c->nick."> $msg"
+                               . " ($x:$y:$z $type - $dists) | <".$c->nick."> $msg"
                        );
                        $c->reply("sent request ($x:$y:$z $type)");
                }else{