From 8492985c19c12b19d892a78664409590aeb57f47 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Wed, 6 May 2009 22:06:09 +0200 Subject: [PATCH] Converted the .g command --- Commands/PA.pm | 18 ++++++++++++++++++ PA.pm | 22 +--------------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/Commands/PA.pm b/Commands/PA.pm index 87e2290..2440fea 100644 --- a/Commands/PA.pm +++ b/Commands/PA.pm @@ -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; diff --git a/PA.pm b/PA.pm index 04cf743..72050d8 100644 --- a/PA.pm +++ b/PA.pm @@ -28,27 +28,7 @@ require Exporter; our @ISA = qw/Exporter/; -our @EXPORT = qw/checkGal shipEff shipStop parseValue prettyValue calcXp findCovOpper tick_time/; - -sub checkGal { - my ($msg) = @_; - - my ($x,$y,); - if ($msg =~ /(\d+)\D+(\d+)/){ - $x = $1; - $y = $2; - }else{ - $ND::server->command("notice $ND::nick syntax: .g X:Y"); - } - my $f = $ND::DBH->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); - $ND::server->command("notice $ND::nick $x:$y Score=$row[0] ($row[1]), Size=$row[2] ($row[3]), Value=$row[4] ($row[5]), Planets=$row[6]"); - } -} +our @EXPORT = qw/shipEff shipStop parseValue prettyValue calcXp findCovOpper tick_time/; sub shipEff { my ($msg,$command) = @_; -- 2.39.2