]> ruin.nu Git - NDIRC.git/blobdiff - Commands/PA.pm
Converted the .g command
[NDIRC.git] / Commands / PA.pm
index 87e229049bd37347511db9b703f12034bbad9c8d..2440feaffc747649557f4f7de524144d0cad0f6c 100644 (file)
@@ -63,4 +63,22 @@ FROM current_planet_stats WHERE (x = $1 AND y = $2 and z = $3) OR nick ILIKE $4
        }
 }
 
+sub g
+       : Help(usage: .g X:Y)
+{
+       my ($self, $c, $msg) = @_;
+
+       my ($x,$y) = ($msg =~ /(\d+)\D+(\d+)/) or die 'ARGS';
+
+       my $f = $c->model->prepare(q{
+SELECT score,scorerank,size,sizerank,value,valuerank,planets
+FROM galaxies WHERE x = ? AND y = ? AND tick = (SELECT max(tick) from galaxies)
+       });
+       $f->execute($x,$y);
+       while (my @row = $f->fetchrow()){
+               @row = map (valuecolor(1),@row);
+               $c->reply("$x:$y  Score=$row[0] ($row[1]), Size=$row[2] ($row[3]), Value=$row[4] ($row[5]), Planets=$row[6]");
+       }
+}
+
 1;